Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RpGeometry
[Basic Geometry]


Data Structures

struct   RpGeometry

Typedefs

typedef RpGeometry *(*  RpGeometryCallBack )(RpGeometry *geometry, void *data)
typedef void(*  RpGeometrySortByMaterialCallBack )(const RpGeometry *oldGeom, RpGeometry *newGeom, RwUInt16 *remapTable, RwUInt16 numberOfEntries)

Enumerations

enum   RpGeometryFlag {
  rpGEOMETRYTRISTRIP = 0x00000001, rpGEOMETRYPOSITIONS = 0x00000002, rpGEOMETRYTEXTURED = 0x00000004, rpGEOMETRYPRELIT = 0x00000008,
  rpGEOMETRYNORMALS = 0x00000010, rpGEOMETRYLIGHT = 0x00000020, rpGEOMETRYMODULATEMATERIALCOLOR = 0x00000040, rpGEOMETRYTEXTURED2 = 0x00000080,
  rpGEOMETRYNATIVE = 0x01000000, rpGEOMETRYNATIVEINSTANCE = 0x02000000, rpGEOMETRYFLAGSMASK = 0x000000FF, rpGEOMETRYNATIVEFLAGSMASK = 0x0F000000,
  rpGEOMETRYFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
}
enum   RpGeometryLockMode {
  rpGEOMETRYLOCKPOLYGONS = 0x01, rpGEOMETRYLOCKVERTICES = 0x02, rpGEOMETRYLOCKNORMALS = 0x04, rpGEOMETRYLOCKPRELIGHT = 0x08,
  rpGEOMETRYLOCKTEXCOORDS = 0x10, rpGEOMETRYLOCKTEXCOORDS1 = 0x10, rpGEOMETRYLOCKTEXCOORDS2 = 0x20, rpGEOMETRYLOCKTEXCOORDS3 = 0x40,
  rpGEOMETRYLOCKTEXCOORDS4 = 0x80, rpGEOMETRYLOCKTEXCOORDS5 = 0x0100, rpGEOMETRYLOCKTEXCOORDS6 = 0x0200, rpGEOMETRYLOCKTEXCOORDS7 = 0x0400,
  rpGEOMETRYLOCKTEXCOORDS8 = 0x0800, rpGEOMETRYLOCKTEXCOORDSALL = 0x0ff0, rpGEOMETRYLOCKALL = 0x0fff, rpGEOMETRYLOCKMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
}

Functions

RpGeometry RpGeometryTransform (RpGeometry *geometry, const RwMatrix *matrix)
RpGeometry RpGeometryCreateSpace (RwReal radius)
RwInt32  RpGeometryAddMorphTargets (RpGeometry *geometry, RwInt32 mtcount)
RwInt32  RpGeometryAddMorphTarget (RpGeometry *geometry)
RpGeometry RpGeometryRemoveMorphTarget (RpGeometry *geometry, RwInt32 morphTargetIndex)
RwInt32  RpGeometryGetNumMorphTargets (const RpGeometry *geometry)
RpMorphTarget RpGeometryGetMorphTarget (const RpGeometry *geometry, RwInt32 morphTargetIndex)
RwRGBA RpGeometryGetPreLightColors (const RpGeometry *geometry)
RwTexCoords RpGeometryGetVertexTexCoords (const RpGeometry *geometry, RwTextureCoordinateIndex uvIndex)
RwInt32  RpGeometryGetNumTexCoordSets (const RpGeometry *geometry)
RwInt32  RpGeometryGetNumVertices (const RpGeometry *geometry)
RpTriangle RpGeometryGetTriangles (const RpGeometry *geometry)
RwInt32  RpGeometryGetNumTriangles (const RpGeometry *geometry)
RpMaterial RpGeometryGetMaterial (const RpGeometry *geometry, RwInt32 matNum)
const RpGeometry RpGeometryTriangleSetVertexIndices (const RpGeometry *geometry, RpTriangle *triangle, RwUInt16 vert1, RwUInt16 vert2, RwUInt16 vert3)
RpGeometry RpGeometryTriangleSetMaterial (RpGeometry *geometry, RpTriangle *triangle, RpMaterial *material)
const RpGeometry RpGeometryTriangleGetVertexIndices (const RpGeometry *geometry, const RpTriangle *triangle, RwUInt16 *vert1, RwUInt16 *vert2, RwUInt16 *vert3)
RpMaterial RpGeometryTriangleGetMaterial (const RpGeometry *geometry, const RpTriangle *triangle)
RwInt32  RpGeometryGetNumMaterials (const RpGeometry *geometry)
RpGeometry RpGeometryForAllMaterials (RpGeometry *geometry, RpMaterialCallBack fpCallBack, void *pData)
RpGeometry RpGeometryLock (RpGeometry *geometry, RwInt32 lockMode)
RpGeometry RpGeometryUnlock (RpGeometry *geometry)
const RpGeometry RpGeometryForAllMeshes (const RpGeometry *geometry, RpMeshCallBack fpCallBack, void *pData)
RpGeometry RpGeometryCreate (RwInt32 numVerts, RwInt32 numTriangles, RwUInt32 format)
RwBool  RpGeometryDestroy (RpGeometry *geometry)
RwInt32  RpGeometryRegisterPlugin (RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB)
RwInt32  RpGeometryRegisterPluginStream (RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB)
RwInt32  RpGeometrySetStreamAlwaysCallBack (RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB)
RwInt32  RpGeometryGetPluginOffset (RwUInt32 pluginID)
RwBool  RpGeometryValidatePlugins (const RpGeometry *geometry)
RwUInt32  RpGeometryStreamGetSize (const RpGeometry *geometry)
const RpGeometry RpGeometryStreamWrite (const RpGeometry *geometry, RwStream *stream)
RpGeometry RpGeometryStreamRead (RwStream *stream)
RwUInt32  RpGeometryGetFlags (const RpGeometry *geometry)
RpGeometry RpGeometrySetFlags (RpGeometry *geometry, RwUInt32 flags)
const RpGeometry RpGeometryIsCorrectlySorted (const RpGeometry *geometry, RwBool *result)
RpGeometry RpGeometrySortByMaterial (const RpGeometry *source, RpGeometrySortByMaterialCallBack callback)

Detailed Description

Handling atomic's geometry

RpGeometry Overview

Requirements

Overview

This object is the primary container object for dynamic model data.

The data itself is stored as lists of Triangles (RpTriangle) stored in a Morph Target (RpMorphTarget). Each such Triangle object also contains a reference to a Material (RpMaterial) object, which defines that triangle's appearance.

During scene generation process, RenderWare Graphics will use the Geometry data to generate Mesh (RpMesh) data for rendering. A Geometry object cannot be directly liked to a Frame as there is no storage for these. Instead, you should create an Atomic with a reference the Geometry, then link that Atomic to a Frame.

Further information is available in the Dynamic Models chapter of the User Guide.


Typedef Documentation

typedef RpGeometry*(* RpGeometryCallBack)(RpGeometry *geometry, void *data)
 

RpGeometryCallBack represents the simple callback function for the RpGeometry object. The callback may return NULL to terminate further callbacks on the geometry.

Parameters:
geometry  Pointer to the current geometry, supplied by iterator.
data  Pointer to developer-defined data structure.
Returns:
typedef void(* RpGeometrySortByMaterialCallBack)(const RpGeometry *oldGeom, RpGeometry *newGeom, RwUInt16 *remapTable, RwUInt16 numberOfEntries)
 

RpGeometrySortByMaterialCallBack RpGeometrySortByMaterialCallBack is used by RpGeometrySortByMaterial in order to preserve the validity of plugin data when the vertices in an RpGeometry are sorted (and some possibly duplicated).

A vertex map table is provided to the callback - this contains, for each vertex in the new geometry, the index of the corresponding vertex in the original geometry.

Parameters:
oldGeom  Pointer to the source geometry.
newGeom  Pointer to the new, sorted geometry.
remapTable  Pointer to the vertex map table
numberOfEntries  Number of vertices in the new geometry (size of the map table)

Enumeration Type Documentation

enum RpGeometryFlag
 

RpGeometryFlag Geometry type flags

When creating a geometry, these flags can be OR'ed together to specify the format along with the rpGEOMETRYTEXCOORDSETS(n) macro if more than two sets of texture coordinates are required. See RpGeometryCreate for more details.

See also:
RpGeometryCreate().
Enumeration values:
rpGEOMETRYTRISTRIP  This geometry's meshes can be rendered as strips. RpMeshSetTriStripMethod is used to change this method.
rpGEOMETRYPOSITIONS  This geometry has positions
rpGEOMETRYTEXTURED  This geometry has only one set of texture coordinates. Texture coordinates are specified on a per vertex basis
rpGEOMETRYPRELIT  This geometry has pre-light colors
rpGEOMETRYNORMALS  This geometry has vertex normals
rpGEOMETRYLIGHT  This geometry will be lit
rpGEOMETRYMODULATEMATERIALCOLOR  Modulate material color with vertex colors (pre-lit + lit)
rpGEOMETRYTEXTURED2  This geometry has at least 2 sets of texture coordinates.
enum RpGeometryLockMode
 

RpGeometryLockMode Geometry lock flags

Enumeration values:
rpGEOMETRYLOCKPOLYGONS  Lock the polygons (triangle list)
rpGEOMETRYLOCKVERTICES  Lock the vertex positional data
rpGEOMETRYLOCKNORMALS  Lock the vertex normal data
rpGEOMETRYLOCKPRELIGHT  Lock the pre-light values
rpGEOMETRYLOCKTEXCOORDS  Lock the texture coordinates set 1
rpGEOMETRYLOCKTEXCOORDS1  Lock the texture coordinates set 1
rpGEOMETRYLOCKTEXCOORDS2  Lock the texture coordinates set 2
rpGEOMETRYLOCKTEXCOORDS3  Lock the texture coordinates set 3
rpGEOMETRYLOCKTEXCOORDS4  Lock the texture coordinates set 4
rpGEOMETRYLOCKTEXCOORDS5  Lock the texture coordinates set 5
rpGEOMETRYLOCKTEXCOORDS6  Lock the texture coordinates set 6
rpGEOMETRYLOCKTEXCOORDS7  Lock the texture coordinates set 7
rpGEOMETRYLOCKTEXCOORDS8  Lock the texture coordinates set 8
rpGEOMETRYLOCKTEXCOORDSALL  Lock all texture coordinate sets
rpGEOMETRYLOCKALL  Combination of all the above

Function Documentation

RwInt32 RpGeometryAddMorphTarget RpGeometry   geometry
 

RpGeometryAddMorphTarget is used to add a new morph target to the specified geometry. Space is allocated for the morph target's vertices (and vertex normals if the geometry requires them) but their values are completely undefined.

The new morph target's bounding sphere is also undefined. The sphere must be determined and set using RpMorphTargetCalcBoundingSphere and RpMorphTargetSetBoundingSphere before it is used.

All morph targets in the geometry have the same number of vertices and triangle topology (vertex connectivity).

The world plugin must be attached before using this function.

Note:
All calls to RpGeometryAddMorphTarget or RpGeometryAddMorphTargets invalidate any pointers to morph targets returned by earlier calls to RpGeometryGetMorphTarget.
Parameters:
geometry  Pointer to the geometry.
Returns:
Returns a RwInt32 value equal to the morph target's index (first morph target has index 0) or -1 if there is an error.
See also:
RpGeometryCreate , RpGeometryGetMorphTarget , RpGeometryGetNumVertices , RpMorphTargetGetVertices , RpMorphTargetGetVertexNormals , RpGeometryRemoveMorphTarget , RpGeometryLock , RpGeometryUnlock , RpWorldPluginAttach
RwInt32 RpGeometryAddMorphTargets RpGeometry   geometry,
RwInt32    mtcount
 

RpGeometryAddMorphTargets is used to add N new morph target to the specified geometry. Space is allocated for the morph targets vertices (and vertex normals if the geometry requires them) but their values are completely undefined.

The new morph targets bounding spheres are also undefined. The spheres must be determined and set using RpMorphTargetCalcBoundingSphere and RpMorphTargetSetBoundingSphere before they are used.

All morph targets in the geometry have the same number of vertices and triangle topology (vertex connectivity).

The world plugin must be attached before using this function.

Note:
All calls to RpGeometryAddMorphTarget or RpGeometryAddMorphTargets invalidate any pointers to morph targets returned by earlier calls to RpGeometryGetMorphTarget.
Parameters:
geometry  Pointer to the geometry.
mtcount  RwInt32 count of how many new morph targets.
Returns:
Returns a RwInt32 value equal to the morph target's index (first morph target has index 0) or -1 if there is an error.
See also:
RpGeometryCreate , RpGeometryGetMorphTarget , RpGeometryGetNumVertices , RpMorphTargetGetVertices , RpMorphTargetGetVertexNormals , RpGeometryRemoveMorphTarget , RpGeometryLock , RpGeometryUnlock , RpWorldPluginAttach
RpGeometry* RpGeometryCreate RwInt32    numVerts,
RwInt32    numTriangles,
RwUInt32    format
 

RpGeometryCreate is used to create a new geometry according to the specified number of vertices and triangles and the specified format. The geometry is created with one morph target. Arrays are allocated for the vertex and triangle lists as well as for the vertex normals, pre-light colors and texture coordinates if any of these are required according to the format. All arrays are undefined and must be initialized before the geometry is unlocked, including the material properties defined in the triangle list.

The format is specified by combining RpGeometryFlag flags using an OR operation. The rpGEOMETRYTEXTURED and rpGEOMETRYTEXTURED2 flags specify that either a single or double set of texture coordinates are required. Alternatively, the rpGEOMETRYTEXCOORDSETS(n) macro may be used to explicitly set the number of sets required up to rwMAXTEXTURECOORDS (restricted to 8). In this case, the backward compatibility flags (rpGEOMETRYTEXTURED and rpGEOMETRYTEXTURED2) are set internally to reflect the status, rpGEOMETRYTEXTURED2 indicating that 2 or more sets are present. For example:-

   geom1 = RpGeometryCreate(numVerts, numTris, 
                            rpGEOMETRYTRISTRIP | rpGEOMETRYTEXTURED |
                            rpGEOMETRYNORMALS | rpGEOMETRYLIGHT);

   geom2 = RpGeometryCreate(numVerts, numTris, 
                            rpGEOMETRYTRISTRIP | rpGEOMETRYTEXCOORDSETS(2) |
                            rpGEOMETRYNORMALS | rpGEOMETRYLIGHT);

   

Note that the geometry is created with a reference count of one. Hence, it is the responsiblity of the application to destroy the geometry if it is no longer required.

The newly created geometry is in a locked state and must be unlocked if it is to be used in any rendering.

The world plugin must be attached before using this function.

Parameters:
numVerts  A RwInt32 value equal to the number of vertices (maximum allowable is 65535).
numTriangles  A RwInt32 value equal to the number of triangles.
format  A 32-bit unsigned integer bit-field specifying the geometry's format. This should consist of an OR combined list of flags of type RpGeometryFlag.
Returns:
Returns pointer to the geometry if successful or NULL if there is an error.
See also:
RpGeometryDestroy , RpGeometryAddMorphTarget , RpMorphTargetGetVertices , RpGeometryGetNumVertices , RpGeometryGetTriangles , RpGeometryGetNumTriangles , RpGeometryGetNumTexCoordSets , RpMorphTargetGetVertexNormals , RpGeometryGetPreLightColors , RpGeometryGetVertexTexCoords , RpAtomicSetGeometry , RpWorldPluginAttach
RpGeometry* RpGeometryCreateSpace RwReal    radius
 

RpGeometryCreateSpace is used to create an empty geometry containing no vertices or polygons and one morph target with a bounding sphere of the specified radius, centered at the origin.

Note that the returned geometry is unlocked.

This function is typically used to create 'invisible' surfaces for use in collision simulations.

The world plugin must be attached before using this function.

Parameters:
radius  A RwReal value equal to the radius of the geometry's bounding sphere.
Returns:
Returns pointer to the geometry if successful or NULL if there is an error.
See also:
RpGeometryCreate , RpGeometryDestroy , RpWorldPluginAttach
RwBool RpGeometryDestroy RpGeometry   geometry
 

RpGeometryDestroy is used to destroy the specified geometry and any resources associated with it. Only geometries whose reference count is zero are actually removed from the system. Reference counts greater than one indicate that this particular geometry is still being used by other atomics; in this situation, this function will only decrement the geometry's reference count. It is the application's responsibility to destroy the geometry if it is no longer required and it is not referenced by any atomics. This does not apply if the geometry was acquired by reading an atomic from a binary stream: destroying the atomic will also destroy the geometry it references.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry
Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RpGeometryCreate , RpGeometryRemoveMorphTarget , RpWorldPluginAttach
RpGeometry* RpGeometryForAllMaterials RpGeometry   geometry,
RpMaterialCallBack    fpCallBack,
void *    pData
 

RpGeometryForAllMaterials is used to apply the given callback function to all materials referenced by polygons in the specified geometry. The format of the callback function is:

RpMaterial * (*RpMaterialCallBack)(RpMaterial *material, void *data)

where data is a user-supplied data pointer to pass to the callback function.

Note that if any invocation of the callback function returns a failure status the iteration is terminated. However, RpGeometryForAllMaterials will still return successfully.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry containing the materials.
fpCallBack  Pointer to the callback function to apply to each material.
pData  Pointer to user-supplied data to pass to callback function.
Returns:
Returns pointer to the geometry if successful or NULL if there is an error.
See also:
RpGeometryGetNumMaterials , RpGeometryTriangleGetMaterial , RpGeometryTriangleSetMaterial , RpGeometryGetMaterial , RpWorldPluginAttach
const RpGeometry* RpGeometryForAllMeshes const RpGeometry   geometry,
RpMeshCallBack    fpCallBack,
void *    pData
 

RpGeometryForAllMeshes is used to apply the given callback function to all meshes in the given geometry. The format of the callback function is:

RpMesh *(*RpMeshCallBack)(RpMesh *mesh, RpMeshHeader *meshHeader, void *data);

where data is a user-supplied data pointer to pass to the callback function.

If any invocation of the callback function returns a failure status the iteration is terminated. However RpGeometryForAllMeshes will still return successfully.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry containing the mesh.
fpCallBack  Pointer to the callback function to apply to each mesh.
pData  Pointer to the user-supplied data to pass to callback function.
Returns:
Returns pointer to the geometry if successful or NULL if there is an error or if the geometry does not have any mesh information.
See also:
RpGeometryCreate , RpGeometryUnlock , RpGeometryLock , RpGeometryForAllMeshes , RpWorldPluginAttach
RwUInt32 RpGeometryGetFlags const RpGeometry   geometry
 

RpGeometryGetFlags is used to retrieve the property flags associated with the specified geometry.

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.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry.
Returns:
Returns a 32-bit integer bit-field whose value is the bit-wise OR of RpGeometryFlag values if successful or zero if there is an error or if the geometry's flags are zero.
See also:
RpGeometrySetFlags , RpGeometryCreate , RpMeshSetTriStripMethod , RpWorldPluginAttach
RpMaterial* RpGeometryGetMaterial const RpGeometry   geometry,
RwInt32    matNum
 

RpGeometryGetMaterial is used to retrieve the material with the given index from the specified geometry's material list.

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.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry.
matNum  A RwInt32 value equal to the index of the material.
Returns:
Returns pointer to the material if successful or NULL if there is an error.
See also:
RpGeometryTriangleGetMaterial , RpGeometryGetNumMaterials , RpGeometryForAllMaterials , RpMaterialCreate , RpGeometryGetTriangles , RpGeometryGetNumTriangles , RpGeometryCreate , RpWorldPluginAttach
RpMorphTarget* RpGeometryGetMorphTarget const RpGeometry   geometry,
RwInt32    morphTargetIndex
 

RpGeometryGetMorphTarget is used to retrieve the morph target with the specified index from the given geometry.

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.

The world plugin must be attached before using this function.

Note:
All calls to RpGeometryAddMorphTarget or RpGeometryAddMorphTargets invalidate any pointers to morph targets returned by earlier calls to RpGeometryGetMorphTarget.
Parameters:
geometry  Pointer to the geometry containing the morph targets.
morphTargetIndex  A RwInt32 value equal to the index of the morph target (first morph target has index 0).
Returns:
Returns pointer to the morph target if successful or NULL if there is an error or if the morph target does not exist.
See also:
RpGeometryAddMorphTarget , RpMorphTargetGetVertices , RpMorphTargetGetVertexNormals , RpGeometryGetNumVertices , RpGeometryGetNumMorphTargets , RpGeometryRemoveMorphTarget , RpWorldPluginAttach
RwInt32 RpGeometryGetNumMaterials const RpGeometry   geometry
 

RpGeometryGetNumMaterials is used to retrieve the number of different materials in use by all polygons in the specified geometry.

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.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry
Returns:
Returns a RwInt32 value equal to the number of materials if successful or -1 if there is an error.
See also:
RpGeometryTriangleGetMaterial , RpGeometryTriangleSetMaterial , RpGeometryGetMaterial , RpGeometryForAllMaterials , RpWorldPluginAttach
RwInt32 RpGeometryGetNumMorphTargets const RpGeometry   geometry
 

RpGeometryGetNumMorphTargets is used to determine the number of morph targets defined in the specified geometry. All geometries have at least one morph target allocated to them at creation time (though it may not necessarily be initialized).

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.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry.
Returns:
Returns a RwInt32 value equal to the number of morph targets if successful or -1 if there is an error.
See also:
RpGeometryGetMorphTarget , RpGeometryAddMorphTarget , RpGeometryGetNumVertices , RpGeometryGetNumTriangles , RpGeometryRemoveMorphTarget , RpWorldPluginAttach
RwInt32 RpGeometryGetNumTexCoordSets const RpGeometry   geometry
 

RpGeometryGetNumTexCoordSets is used to determine the number of sets of texture coordinates in the specified geometry. Each set has one texture coordinate per vertex.

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.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry.
Returns:
Returns a RwInt32 value equal to the number of texture coordinate sets.
See also:
RpGeometryGetNumVertices , RpGeometryGetNumTriangles , RpGeometryGetNumMorphTargets , RpGeometryGetVertexTexCoords , RpGeometryGetMorphTarget , RpGeometryCreate , RpWorldPluginAttach
RwInt32 RpGeometryGetNumTriangles const RpGeometry   geometry
 

RpGeometryGetNumTriangles is used to retrieve the number of triangles defining the specified geometry. The triangles define the geometry's topology (vertex connectivity) and material properties which are shared between each morph target. Hence, all morph targets have the same number of triangles.

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.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry.
Returns:
Returns a RwInt32 value equal to the number of triangles if successful or -1 if there is an error.
See also:
RpGeometryGetNumVertices , RpGeometryGetNumMorphTargets , RpGeometryCreate , RpWorldPluginAttach
RwInt32 RpGeometryGetNumVertices const RpGeometry   geometry
 

RpGeometryGetNumVertices is used to determine the number of vertices defining the specified geometry. All morph targets have the same number of vertices.

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.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry.
Returns:
Returns a RwInt32 value equal to the number of vertices if successful or -1 if there is an error.
See also:
RpGeometryGetNumTriangles , RpGeometryGetNumMorphTargets , RpGeometryGetMorphTarget , RpGeometryCreate , RpWorldPluginAttach
RwInt32 RpGeometryGetPluginOffset RwUInt32    pluginID
 

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

The world plugin must be attached before using this function.

Parameters:
pluginID  A RwUInt32 value equal to the plugin ID.
Returns:
Returns the data block offset if successful or -1 if the plugin is not registered.
See also:
RpGeometryRegisterPlugin , RpGeometryRegisterPluginStream , RpGeometrySetStreamAlwaysCallBack , RpGeometryValidatePlugins , RpWorldPluginAttach
RwRGBA* RpGeometryGetPreLightColors const RpGeometry   geometry
 

RpGeometryGetPreLightColors is used to retrieve the array of pre-lighting colors from the specified geometry. The array only exists if the geometry has been created using the rpGEOMETRYPRELIT flag. The pre-lighting colors reside within the geometry's topology, at one color per vertex, and are therefore shared between all morph targets. Use this function to initialize or redefine the pre-lighting colors.

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.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry containing the pre-lighting colors.
Returns:
Returns pointer to an array of RwRGBA values if successful or NULL if there is an error.
See also:
RpGeometryCreate , RpGeometryGetFlags , RpGeometryGetNumVertices , RpGeometryGetVertexTexCoords , RpMorphTargetGetVertices , RpMorphTargetGetVertexNormals , RpWorldPluginAttach
RpTriangle* RpGeometryGetTriangles const RpGeometry   geometry
 

RpGeometryGetTriangles is used to retrieve the array of triangles from the specified geometry. The triangles define the geometry's topology (vertex connectivity) and material properties, which are shared between each morph target. Hence, all morph targets have the same number of triangles. The material associated with each triangle can be used to define the geometry's color, opacity and texture. Use this function prior to initializing or redefining the geometry's topology and material properties.

The geometry must be locked before modifying the geometry's topology and material data.

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.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry that contains the triangles.
Returns:
Returns pointer to an array of RpTriangle values if successful or NULL if there is an error.
See also:
RpGeometryTriangleSetVertexIndices , RpGeometryTriangleSetMaterial , RpGeometryGetNumVertices , RpGeometryGetNumTriangles , RpGeometryGetPreLightColors , RpMorphTargetGetVertices , RpMorphTargetGetVertexNormals , RpGeometryCreate , RpGeometryLock , RpGeometryUnlock , RpMaterialCreate , RpWorldPluginAttach
To set the topology and material properties of a geometry consisting of two triangles sharing an edge (4 vertices):
   RpGeometry *geometry;
   RpTriangle *tlist;
   RpMaterial *red, *white;
  
   tlist = RpGeometryGetTriangles(geometry);
  
   // First triangle...
   RpGeometryTriangleSetVertexIndices(geometry, &tlist[0], 0, 1, 2 );
   RpGeometryTriangleSetMaterial(geometry, &tlist[0], red );
  
   // Second triangle...
   RpGeometryTriangleSetVertexIndices(geometry, &tlist[1], 0, 2, 3 );
   RpGeometryTriangleSetMaterial(geometry, &tlist[1], white );
   
RwTexCoords* RpGeometryGetVertexTexCoords const RpGeometry   geometry,
RwTextureCoordinateIndex    uvIndex
 

RpGeometryGetVertexTexCoords is used to retrieve a particular set of vertex texture coordinates, if any exist in the specified geometry. The number of sets available may be determined using RpGeometryGetNumTexCoordSets, and is fixed when the geometry is created (see RpGeometryCreate).

Vertex texture coordinates reside within the geometry's topology, with each set having a (u,v) coordinate pair per vertex, and are therefore shared between all morph targets. Use this function to initialize or redefine the vertex texture coordinates.

There is a one-to-one correspondence between the vertex texture coordinates array and the vertex list array defined in the morph targets.

The geometry must be locked before modifying the vertex texture coordinates.

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.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry containing the vertex texture coordinates.
uvIndex  The index of the desired texture coordinate set.
Returns:
Returns a pointer to an array of RwTexCoords if successful or NULL if the specified texture coordinate set does not exist.
See also:
RpGeometryGetFlags , RpGeometryGetNumVertices , RpGeometryGetPreLightColors , RpMorphTargetGetVertices , RpMorphTargetGetVertexNormals , RpGeometryGetTriangles , RpGeometryCreate , RpGeometryLock , RpGeometryUnlock , RpWorldPluginAttach
To set the vertex texture coordinates of a geometry consisting of two triangles sharing an edge (4 vertices, 4 (u,v) pairs): |
   RpGeometry *geometry;
   RwTexCoords *texCoord;
  
   texCoord = RpGeometryGetVertexTexCoords(geometry, rwTEXTURECOORDINATEINDEX0);
  
   texCoord[0].u = (RwReal)(0.0); texCoord[0].v = (RwReal)(0.0);
   texCoord[1].u = (RwReal)(1.0); texCoord[1].v = (RwReal)(0.0);
   texCoord[2].u = (RwReal)(0.0); texCoord[2].v = (RwReal)(1.0);
   texCoord[3].u = (RwReal)(1.0); texCoord[3].v = (RwReal)(1.0);
  
const RpGeometry* RpGeometryIsCorrectlySorted const RpGeometry   geometry,
RwBool   result
 

RpGeometryIsCorrectlySorted is used to check if the specified geometry is sorted by material, with no shared vertices at material boundaries.

The world plugin must be attached before using this function.

Parameters:
geometry  A pointer to an RpGeometry.
result  A pointer to an RwBool to receive the result.
Returns:
Returns a pointer to the geometry if successful (and result will receive a legitimate value) or NULL if there is an error (and result will receive an unspecified value)
See also:
RpGeometrySortByMaterial , RpWorldPluginAttach
RpGeometry* RpGeometryLock RpGeometry   geometry,
RwInt32    lockMode
 

RpGeometryLock is used to lock the specified geometry so an application can access it's internal data structures. This function prepares the geometry for unlocking after its data has been modified so that a geometry's meshes can be rebuilt. (Meshes are used to group polygons with the same material, enabling efficient rendering.) A newly created geometry is already locked.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry.
lockMode  A bit-field specifying which of the geometry's data to lock; use bitwise OR to specify more than one (bit-field type RpGeometryLockMode):
Returns:
Returns pointer to the geometry if successful or NULL if there is an error.
See also:
RpGeometryUnlock , RpGeometryCreate , RpGeometryForAllMeshes , RpWorldPluginAttach
RwInt32 RpGeometryRegisterPlugin RwInt32    size,
RwUInt32    pluginID,
RwPluginObjectConstructor    constructCB,
RwPluginObjectDestructor    destructCB,
RwPluginObjectCopy    copyCB
 

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

The world plugin must be attached before using this function.

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 the byte offset within the geometry of memory reserved for this plugin or a negative value if there is an error.
See also:
RpGeometryRegisterPluginStream , RpGeometrySetStreamAlwaysCallBack , RpGeometryGetPluginOffset , RpGeometryValidatePlugins , RpWorldPluginAttach
RwInt32 RpGeometryRegisterPluginStream RwUInt32    pluginID,
RwPluginDataChunkReadCallBack    readCB,
RwPluginDataChunkWriteCallBack    writeCB,
RwPluginDataChunkGetSizeCallBack    getSizeCB
 

RpGeometryRegisterPluginStream is used to associate a set of binary stream functionality with a previously registered plugin.

The world plugin must be attached before using this function.

Parameters:
pluginID  A RwInt32 value equal to the plugin ID (must be unique; used to identify binary chunks).
readCB  Callback used when a chunk is read that is identified as being for this plugin. If the plugin does not wish to read chunks it should skip bytes in the stream in this callback.
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 (return negative to suppress chunk writing).
Returns:
Returns the byte offset within the geometry of memory reserved for this plugin or a negative value if there is an error.
See also:
RpGeometrySetStreamAlwaysCallBack , RpGeometryRegisterPlugin , RpGeometryGetPluginOffset , RpGeometryValidatePlugins , RpWorldPluginAttach
RpGeometry* RpGeometryRemoveMorphTarget RpGeometry   geometry,
RwInt32    morphTargetIndex
 

RpGeometryRemoveMorphTarget is used to destroy the morph target with the specified index in the given geometry.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry containing the morph targets.
morphTargetIndex  A RwInt32 value specifying the index of the morph target (first morph target has index 0).
Returns:
Returns pointer to the geometry if successful, or FALSE if there is an error.
See also:
RpGeometryAddMorphTarget , RpGeometryCreate , RpWorldPluginAttach
RpGeometry* RpGeometrySetFlags RpGeometry   geometry,
RwUInt32    flags
 

RpGeometrySetFlags is used to modify the property flags for the given geometry.

Note that the new flag settings will completely replace the existing ones. Developers can logically OR (or add) flags together to combine them.

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.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry.
flags  A 32-bit integer bit-field specifying the geometry's properties.
Returns:
Returns pointer to the geometry if successful or NULL if there is an error.
See also:
RpGeometryGetFlags , RpGeometryCreate , RpWorldPluginAttach
RwInt32 RpGeometrySetStreamAlwaysCallBack RwUInt32    pluginID,
RwPluginDataChunkAlwaysCallBack    alwaysCB
 

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

The world plugin must be attached before using this function.

Parameters:
pluginID  A RwInt32 value equal to the plugin ID (must be unique; used to identify binary chunks).
alwaysCB  Callback used when object base and plugin data reading is complete.
Returns:
Returns the byte offset within the geometry of memory reserved for this plugin or a negative value if there is an error.
See also:
RpGeometryRegisterPluginStream , RpGeometryRegisterPlugin , RpGeometryGetPluginOffset , RpGeometryValidatePlugins , RpWorldPluginAttach
RpGeometry* RpGeometrySortByMaterial const RpGeometry   source,
RpGeometrySortByMaterialCallBack    callback
 

RpGeometrySortByMaterial is used to create a modified clone of the specified geometry, the modification entailing sorting vertices by material and duplicating them along material boundaries. The new geometry is returned in the unlocked state.

If the source geometry contains any plugin data, the app should provide an RpGeometrySortByMaterialCallBack function to update this data as appropriate. The callback will receive pointers to the original geometry, the new geometry, a mapping array (for every vertex in the new geometry, what was the index of the corresponding vertex in the source geometry?) and the length of that array (the number of vertices in the new geometry).

The world plugin must be attached before using this function.

Parameters:
source  A pointer to an RpGeometry.
callback  A pointer to a RpGeometrySortByMaterialCallBack function, or NULL if not required
Returns:
Returns pointer to the new, sorted geometry if successful or NULL if there is an error.
See also:
RpGeometryIsCorrectlySorted , RpWorldPluginAttach
RwUInt32 RpGeometryStreamGetSize const RpGeometry   geometry
 

RpGeometryStreamGetSize is used to determine the size in bytes of the binary representation of the specified geometry. This is used in the binary chunk header to indicate the size of the geometry chunk. The size does not include the size of the chunk header.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry whose binary size is required.
Returns:
Returns the chunk size of the geometry if successful or zero if there is an error.
See also:
RpGeometryStreamRead , RpGeometryStreamWrite , RpWorldPluginAttach
RpGeometry* RpGeometryStreamRead RwStream   stream
 

RpGeometryStreamRead is used to read a geometry from the specified binary stream. Prior to this function call a binary geometry chunk must have been found in the stream.

The world plugin must be attached before using this function.

The sequence to locate and read a geometry from a binary stream connected to a disk file is as follows:

   RwStream *stream;
   RpGeometry *NewGeometry;
  
   stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "mybinary.xxx");
   if( stream )
   {
       if( RwStreamFindChunk(stream, rwID_GEOMETRY, NULL, NULL) )
       {
           NewGeometry = RpGeometryStreamRead(stream);
       }
   
       RwStreamClose(stream, NULL);
   }
Parameters:
stream  Pointer to the binary stream.
Returns:
Returns pointer to the geometry if successful or NULL if there is an error.
See also:
RpGeometryStreamGetSize , RpGeometryStreamWrite , RwStreamOpen , RwStreamClose , RwStreamFindChunk , RpWorldPluginAttach
const RpGeometry* RpGeometryStreamWrite const RpGeometry   geometry,
RwStream   stream
 

RpGeometryStreamWrite is used to write the specified geometry to the given binary stream. The stream must have been opened prior to this function call.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry.
stream  Pointer to the binary stream.
Returns:
Returns pointer to the geometry if successful or NULL if there is an error.
See also:
RpGeometryStreamGetSize , RpGeometryStreamRead , RwStreamOpen , RwStreamClose , RpWorldPluginAttach
RpGeometry* RpGeometryTransform RpGeometry   geometry,
const RwMatrix   matrix
 

RpGeometryTransform is used to apply the specified transformation matrix to the given geometry. The transformation is applied equally to all morph targets defined in the geometry and for each morph target transforms both the vertex positions and vertex normals. All morph target bounding spheres are also recalculated.

Note that the transformation modifies the morph target data and is permanent. Note also that geometry locking and unlocking is performed, as appropriate, before and after applying the transformation.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry.
matrix  Pointer to the matrix describing the transformation.
Returns:
Returns pointer to the geometry if successsful or NULL if there is an error.
See also:
RpGeometryLock , RpGeometryUnlock , RpGeometryCreate , RpMorphTarget , RpMorphTargetGetVertexNormals , RpGeometryGetTriangles , RpWorldPluginAttach
RpMaterial* RpGeometryTriangleGetMaterial const RpGeometry   geometry,
const RpTriangle   triangle
 

RpGeometryTriangleGetMaterial is used to retrieve the material associated with the specified triangle in the given geometry.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry containing the triangles.
triangle  Pointer to the triangle.
Returns:
Returns pointer to the material if successsful or NULL if there is an error.
See also:
RpGeometryTriangleSetMaterial , RpGeometryGetMaterial , RpGeometryGetNumMaterials , RpGeometryForAllMaterials , RpMaterialCreate , RpGeometryTriangleGetVertexIndices , RpGeometryTriangleSetVertexIndices , RpGeometryGetTriangles , RpGeometryGetNumTriangles , RpGeometryCreate , RpWorldPluginAttach
const RpGeometry* RpGeometryTriangleGetVertexIndices const RpGeometry   geometry,
const RpTriangle   triangle,
RwUInt16   vert1,
RwUInt16   vert2,
RwUInt16   vert3
 

RpGeometryTriangleGetVertexIndices is used to retrieve the vertex indices that define the given triangle in the specified geometry. Specify NULL for those vertex indices not required.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry containing the triangles.
triangle  Pointer to the triangle.
vert1  Pointer to a RwUInt16 value which will receive the first vertex index.
vert2  Pointer to a RwUInt16 value which will receive the second vertex index.
vert3  Pointer to a RwUInt16 value which will receive the third vertex index.
Returns:
Returns pointer to the geometry if successful or NULL if there is an error.
See also:
RpGeometryTriangleSetVertexIndices , RpGeometryGetTriangles , RpGeometryGetNumTriangles , RpGeometryGetNumVertices , RpGeometryGetMaterial , RpGeometryTriangleSetMaterial , RpGeometryCreate , RpWorldPluginAttach
RpGeometry* RpGeometryTriangleSetMaterial RpGeometry   geometry,
RpTriangle   triangle,
RpMaterial   material
 

RpGeometryTriangleSetMaterial is used to associate the specified material with the given triangle in the given geometry. The geometry's material list is modified accordingly and the material's reference count incremented.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry containing the triangles.
triangle  Pointer to the triangle.
material  Pointer to the material.
Returns:
Returns pointer to the geometry if successful or NULL if there is an error.
See also:
RpGeometryTriangleGetMaterial , RpGeometryGetNumMaterials , RpGeometryForAllMaterials , RpGeometryGetMaterial , RpMaterialCreate , RpGeometryTriangleGetVertexIndices , RpGeometryTriangleSetVertexIndices , RpGeometryGetTriangles , RpGeometryGetNumTriangles , RpGeometryCreate , RpWorldPluginAttach
const RpGeometry* RpGeometryTriangleSetVertexIndices const RpGeometry   geometry,
RpTriangle   triangle,
RwUInt16    vert1,
RwUInt16    vert2,
RwUInt16    vert3
 

RpGeometryTriangleSetVertexIndices is used to define the specified triangle in the given geometry according to the given vertex indices.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry containing the triangles.
triangle  Pointer to the triangle.
vert1  A RwUInt32 value specifying the index of the first vertex.
vert2  A RwUInt32 value specifying the index of the second vertex.
vert3  A RwUInt32 value specifying the index of the third vertex.
Returns:
Returns pointer to the geometry if successful or NULL if there is an error.
See also:
RpGeometryTriangleGetVertexIndices , RpGeometryGetTriangles , RpGeometryGetNumTriangles , RpGeometryGetNumVertices , RpGeometryGetMaterial , RpGeometryTriangleGetMaterial , RpGeometryTriangleSetMaterial , RpGeometryCreate , RpWorldPluginAttach
RpGeometry* RpGeometryUnlock RpGeometry   geometry
 

RpGeometryUnlock is used to unlock the specified geometry. This function is typically used to release the geometry's data structures after modification so that a geometry's meshes can be rebuilt from the new data. (Meshes are used to group polygons with the same material, enabling efficient rendering.)

Newly created geometry is always locked and should be unlocked before it can be used in any rendering.

Note all triangles in a geometry must have a material assigned to them before it can be unlocked.

Note that the bounding sphere on each morph target will need recalculating if the geometry's vertex data has changed; RpGeometryUnlock does not do this for you.

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry.
Returns:
Returns pointer to the geometry if successful or NULL if there an error,
See also:
RpGeometryLock , RpGeometryCreate , RpGeometryForAllMeshes , RpMorphTargetCalcBoundingSphere , RpMorphTargetSetBoundingSphere , RpWorldPluginAttach
RwBool RpGeometryValidatePlugins const RpGeometry   geometry
 

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

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

The world plugin must be attached before using this function.

Parameters:
geometry  Pointer to the geometry to validate.
Returns:
Returns TRUE is the geometry data is valid or FALSE if there is an error or if the geometry data has become corrupt.
See also:
RpGeometryRegisterPlugin , RpGeometryRegisterPluginStream , RpGeometrySetStreamAlwaysCallBack , RpWorldPluginAttach

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