Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RwCamera
[Cameras]


Data Structures

struct   RwCamera

Typedefs

typedef RwCamera *(*  RwCameraCallBack )(RwCamera *camera, void *data)
typedef rwStreamCamera  RwCameraChunkInfo

Enumerations

enum   RwCameraClearMode { rwCAMERACLEARIMAGE = 0x1, rwCAMERACLEARZ = 0x2, rwCAMERACLEARSTENCIL = 0x4, rwCAMERACLEARMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }
enum   RwCameraProjection { rwNACAMERAPROJECTION = 0, rwPERSPECTIVE = 1, rwPARALLEL = 2, rwCAMERAPROJECTIONFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }
enum   RwFrustumTestResult { rwSPHEREOUTSIDE = 0, rwSPHEREBOUNDARY = 1, rwSPHEREINSIDE = 2, rwFRUSTUMTESTRESULTFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }

Functions

RwInt32  RwCameraRegisterPluginStream (RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB)
RwInt32  RwCameraSetStreamAlwaysCallBack (RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB)
RwUInt32  RwCameraStreamGetSize (const RwCamera *camera)
const RwCamera RwCameraStreamWrite (const RwCamera *camera, RwStream *stream)
RwCamera RwCameraStreamRead (RwStream *stream)
RwCameraChunkInfo RwCameraChunkInfoRead (RwStream *stream, RwCameraChunkInfo *cameraChunkInfo, RwInt32 *bytesRead)
void  RwCameraSetFreeListCreateParams (RwInt32 blockSize, RwInt32 numBlocksToPrealloc)
RwCamera RwCameraEndUpdate (RwCamera *camera)
RwCamera RwCameraBeginUpdate (RwCamera *camera)
const RwV2d RwCameraGetViewOffset (const RwCamera *camera)
RwCamera RwCameraSetViewOffset (RwCamera *camera, const RwV2d *offset)
RwCamera RwCameraSetRaster (RwCamera *camera, RwRaster *raster)
RwRaster RwCameraGetRaster (const RwCamera *camera)
RwCamera RwCameraSetZRaster (RwCamera *camera, RwRaster *zRaster)
RwRaster RwCameraGetZRaster (const RwCamera *camera)
RwCamera RwCameraSetNearClipPlane (RwCamera *camera, RwReal nearClip)
RwReal  RwCameraGetNearClipPlane (const RwCamera *camera)
RwCamera RwCameraSetFarClipPlane (RwCamera *camera, RwReal farClip)
RwReal  RwCameraGetFarClipPlane (const RwCamera *camera)
RwCamera RwCameraSetFogDistance (RwCamera *camera, RwReal fogDistance)
RwReal  RwCameraGetFogDistance (const RwCamera *camera)
RwCamera RwCameraGetCurrentCamera (void)
RwFrustumTestResult  RwCameraFrustumTestSphere (const RwCamera *camera, const RwSphere *sphere)
RwCamera RwCameraClear (RwCamera *camera, RwRGBA *color, RwInt32 clearMode)
RwCamera RwCameraShowRaster (RwCamera *camera, void *dev, RwUInt32 flags)
RwCamera RwCameraSetProjection (RwCamera *camera, RwCameraProjection projection)
RwCameraProjection  RwCameraGetProjection (const RwCamera *camera)
RwCamera RwCameraSetViewWindow (RwCamera *camera, const RwV2d *viewWindow)
const RwV2d RwCameraGetViewWindow (const RwCamera *camera)
RwMatrix RwCameraGetViewMatrix (RwCamera *camera)
RwInt32  RwCameraRegisterPlugin (RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB)
RwInt32  RwCameraGetPluginOffset (RwUInt32 pluginID)
RwBool  RwCameraValidatePlugins (const RwCamera *camera)
RwCamera RwCameraSetFrame (RwCamera *camera, RwFrame *frame)
RwFrame RwCameraGetFrame (const RwCamera *camera)
RwBool  RwCameraDestroy (RwCamera *camera)
RwCamera RwCameraCreate (void)
RwCamera RwCameraClone (RwCamera *camera)

Detailed Description

Cameras define how and what things can be seen. They also define the depth and width of the view by the use of clip-planes and the view window.

RwCamera Overview

Requirements

Overview

RenderWare Graphics utilizes a standard virtual camera model and this object represents the virtual camera. Usually, a camera object requires a frame and two rasters. The frame is required so the camera can be positioned within world space.

The rasters will usually be of type rwRASTERTYPECAMERA and rwRASTERTYPEZBUFFER, representing the frame buffer and Z buffer respectively. Alternatively, a camera can reference a sub-raster stored within another camera to allow split-screen or picture-in-picture rendering.

Creating a Camera
A camera is typically created as follows:
  1. Create and allocate a raster of type rwRASTERTYPECAMERA
  2. Create and allocate another raster of type rwRASTERTYPEZBUFFER
  3. Create a camera object using RwCameraCreate
  4. Attach the two rasters to the camer object using RwCameraSetRaster and RwCameraSetZRaster
  5. Create a frame obejct and attact the frame to the camera using RwCameraSetFrame
Rendering to a Texture
RenderWare Graphics allows rendering to a texture. This requires using a frame buffer raster of type rwRASTERTYPECAMERATEXTURE. In addition, rendering to a texture functionality may require platform-specific API calls - you should check any platform-specific RenderWare Graphics documentation provided for more information on this feature.
More Information
More information can be found in the Cameras chapter of the User Guide.

Typedef Documentation

typedef RwCamera*(* RwCameraCallBack)(RwCamera *camera, void *data)
 

RwCameraCallBack type represents a function called from any camera iterator that may be implemented in plugins. This function should return a pointer to the current camera to indicate success. The callback may return NULL to terminate further callbacks on other cameras.

Parameters:
camera  Pointer to the current camera, supplied by iterator.
data  Pointer to developer-defined data structure.
Returns:
typedef struct rwStreamCamera RwCameraChunkInfo
 

RwCameraChunkInfo is typedef'd to a structure that holds camera data. This should be considered an opaque type. Use the RwCamera API functions to access it.


Enumeration Type Documentation

enum RwCameraClearMode
 

RwCameraClearMode Camera clear flags

Enumeration values:
rwCAMERACLEARIMAGE  Clear the frame buffer
rwCAMERACLEARZ  Clear the Z buffer
enum RwCameraProjection
 

RwCameraProjection This type represents the options available for setting the camera projection model, either perspective projection or parallel projection (see API function RwCameraSetProjection)

Enumeration values:
rwNACAMERAPROJECTION  Invalid projection
rwPERSPECTIVE  Perspective projection
rwPARALLEL  Parallel projection
enum RwFrustumTestResult
 

RwFrustumTestResult This type represents the results from a camera frustum test on a given sphere (see API function RwCameraFrustumTestSphere)

Enumeration values:
rwSPHEREOUTSIDE  Outside the frustum
rwSPHEREBOUNDARY  On the boundary of the frustum
rwSPHEREINSIDE  Inside the frustum

Function Documentation

RwCamera* RwCameraBeginUpdate RwCamera   camera
 

RwCameraBeginUpdate is used to indicate that the specified camera is about to start rendering a view of a scene and that the camera's frame buffer raster is to be the target of any subsequent 3D rendering.

When RwCameraBeginUpdate is called, the camera's image raster is pushed onto the context stack, thereby ensuring that the result of any rendering is stored in the camera's own raster.

At the same time, all dirty frame hierarchies are synchronized, i.e. the individual Local Transform Matrices (LTMs) are recalculated ready for processing. Rendering to the camera can now take place with all scene objects guaranteed to be in their correct positions and orientations.

Parameters:
camera  Pointer to the camera to use for 3D rendering.
Returns:
Returns a pointer to the camera used for rendering, or NULL if an error occurred.
See also:
RwCameraEndUpdate , RwCameraForAllClumpsInFrustum , RwCameraGetCurrentCamera , RpClumpGetCallBack , RpClumpSetCallBack
RwCameraChunkInfo* RwCameraChunkInfoRead RwStream   stream,
RwCameraChunkInfo   cameraChunkInfo,
RwInt32   bytesRead
 

RwCameraChunkInfoRead extracts Chunk Info data from a RenderWare stream. The data is converted from its original format and inserted into an RwCameraChunkInfo structure. A pointer to this structure is returned on success.

Parameters:
stream  Pointer to the stream object to be read.
cameraChunkInfo  Pointer to the camera ChunkInfo structure to be filled by the data.
bytesRead  Pointer to an RwInt32 which will hold the number of bytes read from the stream.
Returns:
Returns a pointer to the filled structure if successful. Returns NULL if an error occurred.
See also:
RwCameraStreamRead , RwCameraStreamWrite , RwStreamOpen , RwStreamClose , RwStreamFindChunk
RwCamera* RwCameraClear RwCamera   camera,
RwRGBA   color,
RwInt32    clearMode
 

RwCameraClear is used to clear the image and/or Z-buffer rasters associated with the specified camera. This function is typically used to prepare the camera's rasters for receiving the results from a new rendering, just before an RwCameraBeginUpdate / RwCameraEndUpdate block. The image raster can be cleared to a specified color.

Note:
The RwCameraClear function must be called outside of the RwCameraBeginUpdate / RwCameraEndUpdate block.
Parameters:
camera  Pointer to the camera to clear.
color  Pointer to an RwRGBA containing the color to clear the image raster with.
clearMode  A 32-bit integer bit-field specifying which of the camera's rasters to clear. Its value is one (or more OR'd together) of the following values:
  • rwCAMERACLEARIMAGE - Clear the image raster.
  • rwCAMERACLEARZ - Clear the Z-buffer raster.
Returns:
Returns pointer to the specified camera if successful or NULL if an error occurred.
See also:
RwCameraBeginUpdate , RwCameraCreate , RwCameraEndUpdate , RwRasterClear , RwRasterClearRect
RwCamera* RwCameraClone RwCamera   camera
 

RwCameraClone is used to create a copy of the specified camera.

Note that the old and new cameras share the same frame, image raster and Z-buffer raster. If the original camera has been added to a world, the new camera is also in that world.

The following camera attributes are copied directly:

  • view-window dimensions
  • view-offset
  • near and far clip-plane distances
  • fog plane distance
  • camera projection type
Parameters:
camera  Pointer to the camera.
Returns:
a pointer to the new camera if successful, or NULL if an error occurred.
See also:
RwCameraCreate , RwCameraDestroy , RwCameraGetFrame , RwCameraGetRaster , RwCameraGetZRaster , RwCameraSetFrame , RwCameraSetRaster , RwCameraSetZRaster
RwCamera* RwCameraCreate void   
 

RwCameraCreate creates a new camera. Before the camera can be used to render a view of a scene, a frame, image raster and Z-buffer raster must be attached to the camera.

The associated frame enables the camera to be positioned and oriented (i.e. pointed) within a world. The image raster is used for storing the rendered image. The Z-buffer raster contains depth information used for hidden surface calculations.

Finally, the camera must also be added to the world in which it is to be used for rendering.

When a frame is defined, the camera is positioned at the origin and is oriented such that its view direction is along the positive z-axis and 'up' is along the positive y-axis. Transformations applied to the frame can be used to move and re-orient the camera as required.

The camera is created with a pre-defined view-window, view-offset and near and far clip-planes. Initially, the view-window is a unit square with a view-offset of zero, giving a 'look-at' direction passing through the center of the rendered image. The near and far clip-planes are positioned at distances of 0.05 and 10.0 units, respectively, from the camera's local origin, measured along the 'look-at' direction. Both the view plane and near and far clip-planes are perpendicular to the view direction.

Note that the view-window is fixed at unit distance from the camera and cannot be moved. In this situation changes to the aspect ratio and angular field-of-view of the rendered image can be achieved by defining new values for the width and height of the view-window.

The default projection model is rwPERSPECTIVE.

Returns:
Returns pointer to the created camera if successful, or NULL if an error occurred.
See also:
RwCameraClone , RwCameraDestroy , RwCameraGetProjection , RwCameraSetFarClipPlane , RwCameraSetNearClipPlane , RwCameraSetProjection , RwCameraSetRaster , RwCameraSetViewWindow , RwCameraSetViewOffset , RwCameraSetZRaster , RwRasterCreate , RpWorldAddCamera , RpWorldRemoveCamera
RwBool RwCameraDestroy RwCamera   camera
 

RwCameraDestroy destroys the specified camera. It is recommended that the camera's frame, image raster and Z-buffer raster are destroyed first before actually calling RwCameraDestroy as they are not explicitly destroyed by this function.

Parameters:
camera  Pointer to the camera to destroy.
Returns:
Returns TRUE.
See also:
RwCameraCreate , RwCameraClone , RwCameraSetFrame , RwCameraSetRaster , RwCameraSetZRaster , RwCameraGetFrame , RwCameraGetRaster , RwCameraGetZRaster , RwFrameDestroy , RwRasterDestroy
RwCamera* RwCameraEndUpdate RwCamera   camera
 

RwCameraEndUpdate is used to indicate that 3D rendering to the specified camera has been completed.

Note that RwCameraBeginUpdate and RwCameraEndUpdate work as a pair and only between these calls can any rendering be properly performed.

Parameters:
camera  Pointer to the camera used for 3D rendering.
Returns:
Returns pointer to the camera used for rendering or NULL if an error occurred.
See also:
RwCameraBeginUpdate , RwCameraGetCurrentCamera , RwCameraShowRaster , RwRenderStateGet , RwRenderStateSet
RwFrustumTestResult RwCameraFrustumTestSphere const RwCamera   camera,
const RwSphere   sphere
 

RwCameraFrustumTestSphere is used to check if a specified sphere intersects the view frustum of the given camera. A sphere that is wholly inside the frustum is considered to have intersected the frustum.

Parameters:
camera  Pointer to the camera with the frustum to be tested.
sphere  Pointer to the sphere which is to be tested against the frustum.
Returns:
Returns an RwFrustumTestResult value indicating the result. Results can be: outside the frustum (rwSPHEREOUTSIDE), on the boundary of the frustum (rwSPHEREBOUNDARY), or totally within the frustum (rwSPHEREINSIDE). Returns (RwSPHEREOUTSIDE) if an error occurred.
See also:
RwCameraForAllClumpsInFrustum , RpClumpGetCallBack , RpClumpSetCallBack
RwCamera* RwCameraGetCurrentCamera void   
 

RwCameraGetCurrentCamera is used to determine which (if any) camera is being used for 3D rendering of the current scene. The current camera is only defined between calls to RwCameraBeginUpdate and RwCameraEndUpdate.

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Returns:
Returns a pointer to the current camera if successful or NULL if there is an error or if there is no current camera.
See also:
RwCameraBeginUpdate , RwCameraEndUpdate , RwCameraShowRaster
RwReal RwCameraGetFarClipPlane const RwCamera   camera
 

RwCameraGetFarClipPlane returns the distance of the specified camera's far clip-plane. This distance is measured in world units from the camera's position in the direction of the 'look-at' vector.

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
camera  Pointer to the camera for which the far clip-plane distance is required.
Returns:
Returns an RwReal value equal to the specified camera's far clip-plane.
See also:
RwCameraClone , RwCameraCreate , RwCameraGetFogDistance , RwCameraGetNearClipPlane , RwCameraGetViewWindow , RwCameraSetFarClipPlane , RwCameraSetFogDistance , RwCameraSetNearClipPlane , RwCameraSetViewWindow
RwReal RwCameraGetFogDistance const RwCamera   camera
 

RwCameraGetFogDistance returns the specified camera's fogging distance. This distance is measured in world and is the distance at which fogging begins to take effect. The far clip-plane is the distance at which the full fog effect is obtained.

The fog distance cannot be zero. The default fog distance is 5.0 units.

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
camera  Pointer to the camera from which the fogging distance is required.
Returns:
Returns an RwReal value equal to the specified camera's fogging distance.
See also:
RwCameraClone , RwCameraCreate , RwCameraGetFarClipPlane , RwCameraGetNearClipPlane , RwCameraGetViewWindow , RwCameraSetFarClipPlane , RwCameraSetFogDistance , RwCameraSetNearClipPlane , RwCameraSetViewWindow
RwFrame* RwCameraGetFrame const RwCamera   camera
 

RwCameraGetFrame returns a pointer to the frame attached to the specified camera, (if any).

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
camera  Pointer to the camera to be referenced.
Returns:
Returns a pointer to the specified camera's frame.
See also:
RwCameraSetFrame , RwCameraCreate , RwCameraClone
RwReal RwCameraGetNearClipPlane const RwCamera   camera
 

RwCameraGetNearClipPlane returns the distance of the specified camera's near clip-plane. This distance is measured in world units from the camera's position in the direction of the 'look-at' vector. (The near clip-plane distance cannot be zero.)

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
camera  Pointer to the camera from which to retrieve the near clip-plane distance.
Returns:
Returns an RwReal value equal to the specified camera's near clip-plane.
See also:
RwCameraClone , RwCameraCreate , RwCameraGetFarClipPlane , RwCameraGetFogDistance , RwCameraGetViewWindow , RwCameraSetFarClipPlane , RwCameraSetFogDistance , RwCameraSetNearClipPlane , RwCameraSetViewWindow
RwInt32 RwCameraGetPluginOffset RwUInt32    pluginID
 

RwCameraGetPluginOffset is used to get the offset of a previously registered camera plugin.

Parameters:
pluginID  The plugin ID number identifying the plugin for which the offset is required.
Returns:
Returns the data block offset, or -1 if the plugin is not registered.
See also:
RwCameraRegisterPlugin , RwCameraRegisterPluginStream , RwCameraSetStreamAlwaysCallBack , RwCameraValidatePlugins
RwCameraProjection RwCameraGetProjection const RwCamera   camera
 

RwCameraGetProjection is used to determine the projection model currently set for the specified camera.

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
camera  Pointer to the camera.
Returns:
Returns type of projection model that the camera is using, or rwNACAMERAPROJECTION if there is an error:
  • rwPERSPECTIVE - Camera is using a perspective projection model.
  • rwPARALLEL - Camera is using a parallel projection model.
See also:
RwCameraClone , RwCameraCreate , RwCameraSetProjection
RwRaster* RwCameraGetRaster const RwCamera   camera
 

RwCameraGetRaster is used to retrieve a pointer to the raster attached to the specified camera which serves as the camera's image buffer.

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
camera  Pointer to the camera whose image raster is required.
Returns:
Returns pointer to the camera's image raster if successful or NULL if there is an error or if the camera does not have an image raster defined.
See also:
RwCameraSetRaster , RwCameraGetZRaster , RwCameraSetZRaster , RwCameraCreate , RwCameraClone
RwMatrix* RwCameraGetViewMatrix RwCamera   camera
 

RwCameraGetViewMatrix is used to retrieve the specified camera's view-transformation matrix.

This matrix can be used to transform world coordinate positions to camera clip space. The camera's clip space is bounded by the near and far clip planes, and side planes defined as follows:

  • x = 0, x = 1, y = 0 and y = 1 for a parallel projection model
  • x = 0, x = z, y = 0 and y = z for a perspective projection model
Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
camera  Pointer to the camera to query.
Returns:
Returns pointer to the specified camera's view matrix.
const RwV2d* RwCameraGetViewOffset const RwCamera   camera
 

RwCameraGetViewOffset is used to determine the current view-offset of the specified camera.

The x- and y-offsets are measured in world units in a plane passing through the camera's viewpoint and parallel to the view-plane, in the negative direction of the camera's 'look-right' and in the positive direction of the camera's 'look-up' vectors respectively. Non-zero offsets move the apex of the view volume whilst its edges remain fixed to the corners of the view-window. This has the effect of shearing the view volume.

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
camera  Pointer to the camera whose view offset is required.
Returns:
Returns pointer to an RwV2d that specifies the camera's view offset.
See also:
RwCameraClone , RwCameraCreate , RwCameraGetViewWindow , RwCameraSetViewOffset , RwCameraSetViewWindow
const RwV2d* RwCameraGetViewWindow const RwCamera   camera
 

RwCameraGetViewWindow is used to retrieve the specified camera's view-window size. View-window sizes are measured in world units.

The returned 2D vector represents the half-width and half-height of the view- window. The default view-window has dimensions of (1.0, 1.0) giving a window 2.0 units on each side.

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
camera  Pointer to the camera.
Returns:
Returns pointer to an RwV2d that describes the camera's view window.
See also:
RwCameraClone , RwCameraCreate , RwCameraGetViewOffset , RwCameraSetViewOffset , RwCameraSetViewWindow
RwRaster* RwCameraGetZRaster const RwCamera   camera
 

RwCameraGetZRaster is used to retrieve a pointer to the raster, if any, attached to the specified camera and serving as the camera's Z-buffer.

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
camera  Pointer to the camera for which the Z-buffer raster is required.
Returns:
Returns pointer to the camera's Z-buffer raster.
See also:
RwCameraSetZRaster , RwCameraCreate , RwCameraGetRaster , RwCameraSetRaster
RwInt32 RwCameraRegisterPlugin RwInt32    size,
RwUInt32    pluginID,
RwPluginObjectConstructor    constructCB,
RwPluginObjectDestructor    destructCB,
RwPluginObjectCopy    copyCB
 

RwCameraRegisterPlugin is used to register a plugin and reserve some space within a camera. This must happen after the engine has been initialized but before the engine is opened.

Parameters:
size  A RwInt32 value equal to the size of the memory block to reserve.
pluginID  A RwInt32 value equal to the plugin ID (must be unique; used to identify binary chunks).
constructCB  Constructor for the plugin data block.
destructCB  Destructor for the plugin data block.
copyCB  Copy constructor for the plugin data block.
Returns:
Returns an RwInt32 containing the byte offset within the camera of memory reserved for this plugin, or -1 if an error occurred.
See also:
RwCameraValidatePlugins , RwCameraRegisterPluginStream , RwCameraSetStreamAlwaysCallBack , RwCameraGetPluginOffset
RwInt32 RwCameraRegisterPluginStream RwUInt32    pluginID,
RwPluginDataChunkReadCallBack    readCB,
RwPluginDataChunkWriteCallBack    writeCB,
RwPluginDataChunkGetSizeCallBack    getSizeCB
 

RwCameraRegisterPluginStream is used to add stream capability to a previously registered plugin.

Parameters:
pluginID  A RwInt32 value equal to the plugin ID.
readCB  Callback used when a chunk is read that is identified as being for this plugin.
writeCB  Callback used when a chunk should be written out for this plugin.
getSizeCB  Callback used to determine the binary stream size required for this plugin.
Returns:
Returns the byte offset within the camera of memory reserved for this plugin or a negative value if there is an error.
See also:
RwCameraSetStreamAlwaysCallBack , RwCameraValidatePlugins , RwCameraRegisterPlugin , RwCameraGetPluginOffset
RwCamera* RwCameraSetFarClipPlane RwCamera   camera,
RwReal    farClip
 

RwCameraSetFarClipPlane is used to set the distance of the specified camera's far clip-plane. This distance is specified in world units and must be greater than the near clip-plane.

Note:
This function should not be called between RwCameraBeginUpdate and RwCameraEndUpdate.
Parameters:
camera  Pointer to the camera for which the far clip-plane is to be set.
farClip  An RwReal value equal to the far clip-plane distance.
Returns:
Returns pointer to the camera for which the far clip-plane has been set.
See also:
RwCameraClone , RwCameraCreate , RwCameraGetFarClipPlane , RwCameraGetFogDistance , RwCameraGetNearClipPlane , RwCameraGetViewWindow , RwCameraSetFogDistance , RwCameraSetNearClipPlane , RwCameraSetViewWindow
RwCamera* RwCameraSetFogDistance RwCamera   camera,
RwReal    fogDistance
 

RwCameraSetFogDistance is used to set the a camera's fogging distance. This distance is specified in world units and is the distance at which fogging begins to take effect. The far clip-plane is the distance at which full fog effect is obtained.

The fog distance cannot be zero. The default fog distance is 5.0 units.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Note:
This function should not be called between RwCameraBeginUpdate and RwCameraEndUpdate.
Parameters:
camera  Pointer to the camera for which the fogging distance is to be set.
fogDistance  An RwReal value equal to the fogging distance.
Returns:
Returns pointer to the camera for which the fogging distance was set.
See also:
RwCameraClone , RwCameraCreate , RwCameraGetFogDistance , RwCameraGetFarClipPlane , RwCameraGetNearClipPlane , RwCameraGetViewWindow , RwCameraSetFarClipPlane , RwCameraSetNearClipPlane , RwCameraSetViewWindow
RwCamera* RwCameraSetFrame RwCamera   camera,
RwFrame   frame
 

RwCameraSetFrame is used to attach a frame to the specified camera so that it can be positioned and oriented, as appropriate, within a world.

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
camera  Pointer to the camera that will have its frame set.
frame  Pointer to the frame to attach to the camera.
Returns:
Returns a pointer to the camera.
See also:
RwCameraCreate , RwCameraClone , RwCameraGetFrame
void RwCameraSetFreeListCreateParams RwInt32    blockSize,
RwInt32    numBlocksToPrealloc
 

RwCameraSetFreeListCreateParams allows the developer to specify how many RwCamera s to preallocate space for. Call before RwEngineInit.

Parameters:
blockSize  number of entries per freelist block.
numBlocksToPrealloc  number of blocks to allocate on RwFreeListCreateAndPreallocateSpace.
See also:
RwFreeList
RwCamera* RwCameraSetNearClipPlane RwCamera   camera,
RwReal    nearClip
 

RwCameraSetNearClipPlane is used to set the distance of the specified camera's near clip-plane. This distance is specified in world units and must be greater than zero and less than the far clip-plane.

Note:
This function should not be called between RwCameraBeginUpdate and RwCameraEndUpdate.
Parameters:
camera  Pointer to the camera for which the near clip-plane is to be set.
nearClip  An RwReal value equal to the near clip-plane distance.
Returns:
Returns a pointer to the camera whose near clip-plane is set.
See also:
RwCameraClone , RwCameraCreate , RwCameraGetNearClipPlane , RwCameraGetFarClipPlane , RwCameraSetFarClipPlane , RwCameraGetFogDistance , RwCameraGetViewWindow , RwCameraSetFogDistance , RwCameraSetViewWindow
RwCamera* RwCameraSetProjection RwCamera   camera,
RwCameraProjection    projection
 

RwCameraSetProjection is used to specify the projection model for the given camera. Two types of projection model are currently supported: perspective and parallel. Perspective projection takes into account the distance of an object from the camera and produces a view very much like we expect from a real camera. Parallel projection presumes that objects maintain their same relative size regardless of distance from the camera. Hence two identical objects at different distances look the same size when viewed with a parallel camera.

The default projection model is perspective.

Note:
This function should not be called between RwCameraBeginUpdate and RwCameraEndUpdate.
Parameters:
camera  Pointer to the camera to adjust
projection  projection model to use:
  • rwPERSPECTIVE - Use a perspective projection model.
  • rwPARALLEL - Use a parallel projection model.
Returns:
Returns pointer to the camera if successful or NULL if there is an error.
See also:
RwCameraClone , RwCameraCreate , RwCameraGetProjection
RwCamera* RwCameraSetRaster RwCamera   camera,
RwRaster   raster
 

RwCameraSetRaster is used to specify a raster which will serve as the camera's image buffer. Note that the raster must have been defined as type rwRASTERTYPECAMERA or rwRASTERTYPECAMERATEXTURE when it was created.

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
camera  Pointer to the camera with the image buffer to be set.
raster  Pointer to a raster which will become the camera's image buffer. (Set to NULL to detach an existing raster.)
Returns:
Returns pointer to the camera.
See also:
RwCameraCreate , RwCameraClone , RwCameraGetRaster , RwCameraGetZRaster , RwCameraSetZRaster , RwRasterCreate
RwInt32 RwCameraSetStreamAlwaysCallBack RwUInt32    pluginID,
RwPluginDataChunkAlwaysCallBack    alwaysCB
 

RwCameraSetStreamAlwaysCallBack is used to associate a binary stream functionality with a previously registered camera plugin. This callback is called for all plugins after stream data reading has completed.

Parameters:
pluginID  A RwInt32 value equal to the plugin ID.
alwaysCB  Callback used when object base and plugin data reading is complete.
Returns:
Returns the byte offset within the camera of memory reserved for this plugin or a negative value if there is an error.
See also:
RwCameraRegisterPluginStream , RwCameraValidatePlugins , RwCameraRegisterPlugin , RwCameraGetPluginOffset
RwCamera* RwCameraSetViewOffset RwCamera   camera,
const RwV2d   offset
 

RwCameraSetViewOffset is used to specify the current view-offset of the given camera.

The x- and y-offsets are measured in world units in a plane passing through the camera's viewpoint and parallel to the view-plane, in the negative direction of the camera's 'look-right' and in the positive direction of the camera's 'look-up' vectors respectively. Non-zero offsets move the apex of the view volume whilst its edges remain fixed to the corners of the view-window. This has the effect of shearing the view volume.

Note:
The offsets are specified as absolute values from their initial unsheared camera view-point position - successive calls to RwCameraSetViewOffset are not accumulated as relative displacements.
Note:
This function should not be called between RwCameraBeginUpdate and RwCameraEndUpdate.
Parameters:
camera  Pointer to the camera for which the view offset is to be set.
offset  An RwV2d specifing the new view window offset.
Returns:
Returns pointer to the specified camera.
See also:
RwCameraClone , RwCameraCreate , RwCameraGetViewOffset , RwCameraGetViewWindow , RwCameraSetViewWindow
RwCamera* RwCameraSetViewWindow RwCamera   camera,
const RwV2d   viewWindow
 

RwCameraSetViewWindow is used to set the size of the specified camera's view-window (in world units). The specified 2D vector represents the half-width and half-height of the view-window. The default view-window has dimensions (1.0, 1.0) giving a window 2.0 units on each side.

This function can be used to control the angular field-of-view of the camera. Larger values give a wider field-of-view while smaller values give a narrower view. Hence changing the size of the view-window gives the effect of a zoom-lens. Note that changing the size of the view-window does not alter the size of the camera's image raster, so unless the aspect ratios match, the resulting image will be distorted to conform to the image raster's aspect ratio.

Note:
This function should not be called between RwCameraBeginUpdate and RwCameraEndUpdate.
Parameters:
camera  Pointer to the camera.
viewWindow  An RwV2d describing the view-window dimensions.
Returns:
Returns pointer to the specified camera.
See also:
RwCameraGetViewWindow , RwCameraSetViewOffset , RwCameraGetViewOffset , RwCameraCreate , RwCameraClone
RwCamera* RwCameraSetZRaster RwCamera   camera,
RwRaster   zRaster
 

RwCameraSetZRaster is used to specify a raster which will serve as the camera's Z-buffer. Note that the raster must have been defined as type rwRASTERTYPEZBUFFER when it was created.

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
camera  Pointer to the camera for which the Z-buffer is to be set.
zRaster  Pointer to a raster which will become the camera's Z-buffer. (Set to NULL to detach an existing raster.)
Returns:
Returns pointer to the camera.
See also:
RwCameraGetZRaster , RwCameraSetRaster , RwCameraGetRaster , RwCameraClone , RwCameraCreate , RwRasterCreate
RwCamera* RwCameraShowRaster RwCamera   camera,
void *    dev,
RwUInt32    flags
 

RwCameraShowRaster is used to copy the specified camera's image raster to the display. This function often immediately follows a RwCameraBeginUpdate / RwCameraEndUpdate block in order to transfer the new rendering to the display device.

Parameters:
camera  Pointer to the camera with the image raster to be displayed.
dev  Device-dependent parameter, e.g. for Windows applications this is a handle ('HWND') to the output window returned by CreateWindow.
flags  A flags field indicating hints about how to flip. Valid fields in this flags are:
  • rwRASTERFLIPWAITVSYNC - Flip should happen on next VSync if possible. (This flag should be used only for full-screen applications. Specify zero if running in a window.)
Returns:
Returns pointer to the specified camera if successful or NULL if there is an error.
See also:
RwCameraBeginUpdate , RwCameraEndUpdate , RwRasterShowRaster
RwUInt32 RwCameraStreamGetSize const RwCamera   camera
 

RwCameraStreamGetSize determines the size in bytes of the binary representation of the specified camera object. This is used in the binary chunk header to indicate the size of the chunk. The size does not include the size of the chunk header.

Parameters:
camera  Pointer to the camera for which the size is required.
Returns:
Returns the chunk size of the specified camera in bytes or zero if there is an error.
See also:
RwCameraStreamRead , RwCameraStreamWrite
RwCamera* RwCameraStreamRead RwStream   stream
 

RwCameraStreamRead reads a camera object from a binary stream. Note that prior to this function call, a binary camera chunk must be found in the stream using the RwStreamFindChunk API function.

Parameters:
stream  Pointer to the stream the camera will be read from.
Returns:
Returns pointer to the camera if successful or NULL on error.
The sequence to locate and read a camera from a binary stream connected to a disk file is as follows:
   RwStream *stream;
   RwCamera *newCamera;
  
   stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "mybinary.xxx");
   if (stream)
   {
       if (RwStreamFindChunk(stream, rwID_CAMERA, NULL, NULL))
       {
           newCamera = RwCameraStreamRead(stream);
       }
  
       RwStreamClose(stream, NULL);
   }
See also:
RwCameraStreamWrite , RwStreamOpen , RwStreamClose , RwStreamFindChunk
const RwCamera* RwCameraStreamWrite const RwCamera   camera,
RwStream   stream
 

RwCameraStreamWrite writes the specified camera object to a binary stream. Note that the stream will have been opened prior to this function call.

Parameters:
camera  Pointer to the camera to be written.
stream  Pointer to the stream.
Returns:
Returns pointer to the specified camera if successful or NULL if there is an error.
See also:
RwCameraStreamRead , RwStreamOpen , RwStreamClose
RwBool RwCameraValidatePlugins const RwCamera   camera
 

RwCameraValidatePlugins is used to validate the plugin memory allocated within the specified camera. This function is useful for determining where memory trampling may be occuring within an application.

NOTE: This function only returns a meaningful response under a debug library.

Parameters:
camera  Pointer to the camera to validate.
Returns:
Returns TRUE if the camera data is valid, FALSE if there is an error, or if the camera data has become corrupt.
See also:
RwCameraRegisterPlugin , RwCameraRegisterPluginStream , RwCameraSetStreamAlwaysCallBack , RwCameraGetPluginOffset

Criterion Software © 1993-2003 Criterion Software Limited. All rights reserved. Built Tue Apr 22 12:46:17 2003. Send Feedback
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)