Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RpMesh
[Meshes]


Data Structures

struct  RpBuildMesh
struct  RpBuildMeshTriangle
struct  RpMesh
struct  RpMeshHeader
struct  RpTriStripData
struct  RpTriStripEdge
struct  RpTriStripMesh
struct  RpTriStripPolygon
struct  RpTriStripTunnelData

Typedefs

typedef RpMesh *(* RpMeshCallBack )(RpMesh *mesh, RpMeshHeader *meshHeader, void *pData)
typedef RpMeshHeader *(* RpTriStripMeshCallBack )(RpBuildMesh *buildMesh, void *data)
typedef RpTriStripMesh *(* RpTriStripMeshStripCallBack )(RpTriStripMesh *mesh, void *data)
typedef RwUInt32(* RpTriStripCostCallBack )(RpTriStripPolygon *startPolygon, RwUInt32 testFrame, void *data)

Enumerations

enum  RpMeshHeaderFlags {
  rpMESHHEADERTRISTRIP = 0x0001, rpMESHHEADERTRIFAN = 0x0002, rpMESHHEADERLINELIST = 0x0004, rpMESHHEADERPOLYLINE = 0x0008,
  rpMESHHEADERPOINTLIST = 0x0010, rpMESHHEADERPRIMMASK = 0x00FF, rpMESHHEADERUNINDEXED = 0x0100, rpMESHHEADERFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
}

Functions

RwPrimitiveType RpMeshHeaderGetPrimType (RpMeshHeader *meshHeader)
RpMeshHeaderRpMeshHeaderSetPrimType (RpMeshHeader *meshHeader, RwPrimitiveType primType)
RpMeshHeaderRpBuildMeshGenerateTrivialTriStrip (RpBuildMesh *buildMesh, void *data)
RpMeshHeaderRpBuildMeshGenerateDefaultTriStrip (RpBuildMesh *buildMesh, void *data)
RpMeshHeaderRpBuildMeshGenerateDefaultIgnoreWindingTriStrip (RpBuildMesh *buildMesh, void *data)
RpMeshHeaderRpBuildMeshGeneratePreprocessTriStrip (RpBuildMesh *buildMesh, void *data)
RpMeshHeaderRpBuildMeshGeneratePreprocessIgnoreWindingTriStrip (RpBuildMesh *buildMesh, void *data)
RpMeshHeaderRpBuildMeshGenerateExhaustiveTriStrip (RpBuildMesh *buildMesh, void *data)
RpMeshHeaderRpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip (RpBuildMesh *buildMesh, void *data)
RwUInt32 RpTriStripDefaultCost (RpTriStripPolygon *startPolygon, RwUInt32 testFrame, void *data)
RpTriStripMeshRpTriStripMeshTunnel (RpTriStripMesh *mesh, void *data)
RpTriStripMeshRpTriStripMeshQuick (RpTriStripMesh *mesh, void *data)
RpTriStripPolygonRpTriStripPolygonFollowStrip (RpTriStripPolygon *curr, RpTriStripPolygon *prev)
RpMeshHeaderRpBuildMeshGenerateTriStrip (RpBuildMesh *buildMesh, void *data)
RwBool RpMeshSetTriStripMethod (RpTriStripMeshCallBack callback, void *data)
RwBool RpMeshGetTriStripMethod (RpTriStripMeshCallBack *callback, void **data)

Detailed Description

Provide construction and enumeration facilities for meshes.

RpMesh Overview

Requirements

Overview

Meshes are a caching system designed to speed up rendering.

To make efficient use of hardware acceleration, RenderWare Graphics groups your model geometry into Meshes when the Geometry object is loaded and/or unlocked. Meshes are generated by sorting the model geometry by Material to reduce repeated uploads of the same texture data and Tristripping is also performed at the this level.

The RpMesh API concerns itself primarily with the tristripping process. It is possible to attach your own callback function to use your own tristripping algorithms if required.

Note:
Manipulating geometry data at run-time can affect overall performance of your application as the Meshes need to be regenerated when such changes are made. For small numbers of changes, the effect should be negligible, but this depends heavily on the underlying architecture of the hardware.
Further information is available in the Dynamic Models chapter of the User Guide.


Typedef Documentation

typedef RpMesh*(* RpMeshCallBack)(RpMesh * mesh, RpMeshHeader * meshHeader, void *pData)
 

RpMeshCallBack is the callback function supplied to RpGeometryForAllMeshes and RpWorldSectorForAllMeshes for all meshes in a given geometry.

This function should return a pointer to the current mesh to indicate success. The callback may return NULL to terminate further callbacks on the meshes.

Parameters:
mesh  Pointer to the current mesh, supplied by iterator.
meshHeader  Pointer to the meshes header
data  Pointer to developer-defined data structure.
Returns:
Returns a pointer to the current mesh if successful or NULL if an error occurred.

typedef RwUInt32(* RpTriStripCostCallBack)(RpTriStripPolygon *startPolygon, RwUInt32 testFrame, void *data)
 

RpTriStripCostCallBack represents the callback function used by the tunnelling tri-stripper to determine the cost of a tri-strip.

Parameters:
startPolygon  Pointer to polygon at the start of the tri-strip.
testFrame  Value that must be written to the testFrame of all polygons in the tri-strip
data  Pointer to user-supplied data.
Returns:
Returns the cost of the tri-strip.

typedef RpMeshHeader*(* RpTriStripMeshCallBack)(RpBuildMesh *buildMesh, void *data)
 

RpTriStripMeshCallBack is the callback to generate triangle strips when the triangle stripped geometries or world sectors are unlocked.

Parameters:
buildMesh  pointer to the mesh which the triangle strip will be generated from.
data  pointer to user-supplied data to pass to the callback function.
Returns:
a pointer to the constructed mesh header.

typedef RpTriStripMesh*(* RpTriStripMeshStripCallBack)(RpTriStripMesh *mesh, void *data)
 

RpTriStripMeshStripCallBack represents the callback function to tri-strip a mesh.

Parameters:
mesh  Pointer to the mesh to tri-strip.
data  Pointer to user-supplied data.
Returns:
Returns a pointer to the current mesh if successful or NULL if an error occurred.


Enumeration Type Documentation

enum RpMeshHeaderFlags
 

RpMeshHeaderFlags represents the different types of mesh.

See also:
RpMeshHeader
Enumeration values:
rpMESHHEADERTRISTRIP  Render as tristrips
rpMESHHEADERTRIFAN  On PlayStation 2 these will be converted to trilists
rpMESHHEADERLINELIST  Render as linelists
rpMESHHEADERPOLYLINE  On PlayStation 2 these will be converted to linelists
rpMESHHEADERPOINTLIST  Pointlists are supported only if rendered by custom pipelines; there is no default RenderWare way to render pointlists.
rpMESHHEADERPRIMMASK  All bits reserved for specifying primitive type
rpMESHHEADERUNINDEXED  Topology is defined implicitly by vertex order, ergo the mesh contains no indices


Function Documentation

RpMeshHeader* RpBuildMeshGenerateDefaultIgnoreWindingTriStrip RpBuildMesh   buildMesh,
void *    data
 

RpBuildMeshGenerateDefaultIgnoreWindingTriStrip generates a triangle strip by selecting a starting triangle with the lowest adjacency and builds the strip off it. This is repeated until the mesh is stripped.

Parameters:
buildMesh  pointer to the mesh which the triangle strip will be generated from.
data  pointer to user-supplied data to pass to the callback function.
Returns:
a pointer to the constructed mesh header.
See also:
RpMeshGetTriStripMethod , RpMeshSetTriStripMethod , RpBuildMeshGenerateDefaultTriStrip , RpBuildMeshGeneratePreprocessTriStrip , RpBuildMeshGenerateExhaustiveTriStrip , RpBuildMeshGenerateTrivialTriStrip , RpBuildMeshGeneratePreprocessIgnoreWindingTriStrip , RpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip , RpBuildMeshGenerateTriStrip

RpMeshHeader* RpBuildMeshGenerateDefaultTriStrip RpBuildMesh   buildMesh,
void *    data
 

RpBuildMeshGenerateDefaultTriStrip generates a triangle strip by selecting a starting triangle with the lowest adjacency and builds the strip off it. This is repeated until the mesh is stripped.

Parameters:
buildMesh  pointer to the mesh which the triangle strip will be generated from.
data  pointer to user-supplied data to pass to the callback function.
Returns:
a pointer to the constructed mesh header.
See also:
RpMeshGetTriStripMethod , RpMeshSetTriStripMethod , RpBuildMeshGeneratePreprocessTriStrip , RpBuildMeshGenerateExhaustiveTriStrip , RpBuildMeshGenerateTrivialTriStrip , RpBuildMeshGenerateDefaultIgnoreWindingTriStrip , RpBuildMeshGeneratePreprocessIgnoreWindingTriStrip , RpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip , RpBuildMeshGenerateTriStrip

RpMeshHeader* RpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip RpBuildMesh   buildMesh,
void *    data
 

RpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip generates a triangle strip similarly to RpBuildMeshGeneratePreprocessTriStrip but repeats the process starting on every triangle and chooses the longest (not counting degenerates). It should be noted that presently this algorithm is not fully exhaustive.

Parameters:
buildMesh  pointer to the mesh which the triangle strip will be generated from.
data  pointer to user-supplied data to pass to the callback function.
Returns:
a pointer to the constructed mesh header.
See also:
RpMeshGetTriStripMethod , RpMeshSetTriStripMethod , RpBuildMeshGenerateDefaultTriStrip , RpBuildMeshGeneratePreprocessTriStrip , RpBuildMeshGenerateExhaustiveTriStrip , RpBuildMeshGenerateTrivialTriStrip , RpBuildMeshGenerateDefaultIgnoreWindingTriStrip , RpBuildMeshGeneratePreprocessIgnoreWindingTriStrip , RpBuildMeshGenerateTriStrip

RpMeshHeader* RpBuildMeshGenerateExhaustiveTriStrip RpBuildMesh   buildMesh,
void *    data
 

RpBuildMeshGenerateExhaustiveTriStrip generates a triangle strip similarly to RpBuildMeshGeneratePreprocessTriStrip but repeats the process starting on every triangle and chooses the longest (not counting degenerates). It should be noted that presently this algorithm is not fully exhaustive.

Parameters:
buildMesh  pointer to the mesh which the triangle strip will be generated from.
data  pointer to user-supplied data to pass to the callback function.
Returns:
a pointer to the constructed mesh header.
See also:
RpMeshGetTriStripMethod , RpMeshSetTriStripMethod , RpBuildMeshGenerateDefaultTriStrip , RpBuildMeshGeneratePreprocessTriStrip , RpBuildMeshGenerateTrivialTriStrip , RpBuildMeshGenerateDefaultIgnoreWindingTriStrip , RpBuildMeshGeneratePreprocessIgnoreWindingTriStrip , RpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip , RpBuildMeshGenerateTriStrip

RpMeshHeader* RpBuildMeshGeneratePreprocessIgnoreWindingTriStrip RpBuildMesh   buildMesh,
void *    data
 

RpBuildMeshGeneratePreprocessIgnoreWindingTriStrip generates a triangle strip by selecting a starting triangle with the lowest adjacency. It then builds a strip off each side of triangle and chooses the longest (not counting degenerates). This is repeated until the mesh is stripped.

Parameters:
buildMesh  pointer to the mesh which the triangle strip will be generated from.
data  pointer to user-supplied data to pass to the callback function.
Returns:
a pointer to the constructed mesh header.
See also:
RpMeshGetTriStripMethod , RpMeshSetTriStripMethod , RpBuildMeshGenerateDefaultTriStrip , RpBuildMeshGeneratePreprocessTriStrip , RpBuildMeshGenerateExhaustiveTriStrip , RpBuildMeshGenerateTrivialTriStrip , RpBuildMeshGenerateDefaultIgnoreWindingTriStrip , RpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip , RpBuildMeshGenerateTriStrip

RpMeshHeader* RpBuildMeshGeneratePreprocessTriStrip RpBuildMesh   buildMesh,
void *    data
 

RpBuildMeshGeneratePreprocessTriStrip generates a triangle strip by selecting a starting triangle with the lowest adjacency. It then builds a strip off each side of triangle and chooses the longest (not counting degenerates). This is repeated until the mesh is stripped.

Parameters:
buildMesh  pointer to the mesh which the triangle strip will be generated from.
data  pointer to user-supplied data to pass to the callback function.
Returns:
a pointer to the constructed mesh header.
See also:
RpMeshGetTriStripMethod , RpMeshSetTriStripMethod , RpBuildMeshGenerateDefaultTriStrip , RpBuildMeshGenerateExhaustiveTriStrip , RpBuildMeshGenerateTrivialTriStrip , RpBuildMeshGenerateDefaultIgnoreWindingTriStrip , RpBuildMeshGeneratePreprocessIgnoreWindingTriStrip , RpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip , RpBuildMeshGenerateTriStrip

RpMeshHeader* RpBuildMeshGenerateTriStrip RpBuildMesh   buildMesh,
void *    data
 

RpBuildMeshGenerateTriStrip generates a triangle strip using the tristripping callback supplied in the RpTriStripData structure passed into RpMeshSetTriStripMethod as user supplied data.

Returns:
a pointer to the constructed mesh header.
See also:
RpTriStripMeshTunnel , RpMeshGetTriStripMethod , RpMeshSetTriStripMethod , RpBuildMeshGenerateDefaultTriStrip , RpBuildMeshGeneratePreprocessTriStrip , RpBuildMeshGenerateExhaustiveTriStrip , RpBuildMeshGenerateTrivialTriStrip , RpBuildMeshGenerateDefaultIgnoreWindingTriStrip , RpBuildMeshGeneratePreprocessIgnoreWindingTriStrip , RpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip

RpMeshHeader* RpBuildMeshGenerateTrivialTriStrip RpBuildMesh   buildMesh,
void *    data
 

RpBuildMeshGenerateTrivialTriStrip generates singleton triangle strips.

Parameters:
buildMesh  pointer to the mesh which the triangle strip will be generated from.
data  pointer to user-supplied data to pass to the callback function.
Returns:
a pointer to the constructed mesh header.
See also:
RpMeshGetTriStripMethod , RpMeshSetTriStripMethod , RpBuildMeshGenerateDefaultTriStrip , RpBuildMeshGeneratePreprocessTriStrip , RpBuildMeshGenerateExhaustiveTriStrip , RpBuildMeshGenerateDefaultIgnoreWindingTriStrip , RpBuildMeshGeneratePreprocessIgnoreWindingTriStrip , RpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip , RpBuildMeshGenerateTriStrip

RwBool RpMeshGetTriStripMethod RpTriStripMeshCallBack   callback,
void **    data
 

RpMeshGetTriStripMethod is used to query the specified triangle strip generation function and user-supplied data.

The format of the callback is

   RpMeshHeader *
   (*RpTriStripMeshCallBack)(RpBuildMesh *buildMesh,
                             void *data);
   
Parameters:
callback  pointer to receive the callback function. If NULL then ignored.
data  pointer to recieve the user-supplied data which is passed to the callback function. If NULL then ignored.
Returns:
TRUE.
See also:
RpMeshSetTriStripMethod , RpBuildMeshGenerateTriStrip , RpBuildMeshGenerateDefaultTriStrip , RpBuildMeshGeneratePreprocessTriStrip , RpBuildMeshGenerateExhaustiveTriStrip , RpBuildMeshGenerateTrivialTriStrip , RpBuildMeshGenerateDefaultIgnoreWindingTriStrip , RpBuildMeshGeneratePreprocessIgnoreWindingTriStrip , RpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip

RwPrimitiveType RpMeshHeaderGetPrimType RpMeshHeader   meshHeader
 

RpMeshHeaderGetPrimType is used to extract the primitive type from a mesh header's flags.

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:
meshHeader  Pointer to the mesh header.
Returns:
Returns the RwPrimitiveType of the mesh header.
See also:
RpMeshHeaderSetPrimType

RpMeshHeader* RpMeshHeaderSetPrimType RpMeshHeader   meshHeader,
RwPrimitiveType    primType
 

RpMeshHeaderSetPrimType is used to change the flags of a mesh header to determine its primitive type.

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:
meshHeader  Pointer to the mesh header.
primType  RwPrimitiveType value to set.
Returns:
Returns a pointer to the mesh header on success, otherwise NULL
See also:
RpMeshHeaderGetPrimType

RwBool RpMeshSetTriStripMethod RpTriStripMeshCallBack    callback,
void *    data
 

RpMeshSetTriStripMethod is used to register the specified triangle strip generation function. The specified callback function is executed when the the geometry or world sectors are unlocked. If NULL is specified for the callback, then RpBuildMeshGenerateDefaultTriStrip is registered as the default function and the user-supplied data is set to NULL.

The format of the callback is

   RpMeshHeader *
   (*RpTriStripMeshCallBack)(RpBuildMesh *buildMesh, void *data);
   
Parameters:
callback  pointer to the callback function.
data  pointer to user-supplied data to pass to callback function.
Returns:
TRUE.
See also:
RpMeshGetTriStripMethod , RpBuildMeshGenerateTriStrip , RpBuildMeshGenerateDefaultTriStrip , RpBuildMeshGeneratePreprocessTriStrip , RpBuildMeshGenerateExhaustiveTriStrip , RpBuildMeshGenerateTrivialTriStrip , RpBuildMeshGenerateDefaultIgnoreWindingTriStrip , RpBuildMeshGeneratePreprocessIgnoreWindingTriStrip , RpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip

RwUInt32 RpTriStripDefaultCost RpTriStripPolygon   startPolygon,
RwUInt32    testFrame,
void *    data
 

RpTriStripDefaultCost calculates the cost of a tristrip as the number of fans contained in the strip.

Parameters:
startPolygon  pointer to the polygon at the start of the strip.
testFrame  Value that is written to the testFrame of all polygons in the tri-strip
data  pointer to RpTriStripTunnelData supplied as the user data in the RpTriStripData structure passed into RpMeshSetTriStripMethod as the user supplied data.
Returns:
the cost of the strip (the number of fans it contains).
See also:
RpMeshGetTriStripMethod , RpMeshSetTriStripMethod , RpBuildMeshGenerateTriStrip

RpTriStripMesh* RpTriStripMeshQuick RpTriStripMesh   mesh,
void *    data
 

RpTriStripMeshQuick generates a triangle strip by selecting a starting triangle with the lowest adjacency. It then builds a strip off each side of triangle and chooses the longest (not counting degenerates). This is repeated until the mesh is stripped.

Parameters:
mesh  pointer to the mesh to tristrip.
data  pointer to user supplied data (ignored).
Returns:
the mesh.
See also:
RpTriStripMeshTunnel , RpBuildMeshGenerateTriStrip

RpTriStripMesh* RpTriStripMeshTunnel RpTriStripMesh   mesh,
void *    data
 

RpTriStripMeshTunnel uses a tunneling algorithm to tristrip the supplied mesh.

Parameters:
mesh  pointer to the mesh to tristrip.
data  pointer to RpTriStripData structure passed into RpMeshSetTriStripMethod as the user supplied data.
Returns:
the mesh.
See also:
RpTriStripMeshQuick , RpMeshGetTriStripMethod , RpMeshSetTriStripMethod , RpBuildMeshGenerateTriStrip

RpTriStripPolygon* RpTriStripPolygonFollowStrip RpTriStripPolygon   curr,
RpTriStripPolygon   prev
 

RpTriStripPolygonFollowStrip returns the next polygon of the tristrip.

Parameters:
curr  pointer to current polygon of the tristrip.
prev  pointer to the previous polygon of the tristrip. If this is NULL then any polygon joined to the current polygon by a strip edge will be returned.
Returns:
pointer to the next polygon of the tristrip.


Criterion Software © 1993-2004 Criterion Software Limited. All rights reserved. Built Thu Feb 12 13:46:54 2004. Send Feedback