Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RpPatch
[Bézier Patches]


Modules

PlayStation 2

Data Structures

struct   RpPatchLODRange
struct   RpPatchMesh
struct   RpPatchMeshDefinition
struct   RpQuadPatch
struct   RpTriPatch

Defines

#define  rpQUADPATCHNUMCONTROLPOINTS   (16)
#define  rpTRIPATCHNUMCONTROLPOINTS   (10)
#define  rpQUADPATCHNUMCONTROLINDICES   rpQUADPATCHNUMCONTROLPOINTS
#define  rpTRIPATCHNUMCONTROLINDICES   rpTRIPATCHNUMCONTROLPOINTS
#define  rpPATCHLODMAXVALUE   (20)
#define  rpPATCHSKINLODMAXVALUE   (18)
#define  rpPATCHLODMINVALUE   (4)
#define  rpPATCHMESHTEXCOORDSETS(_num)   ((_num & 0xff) << 16)
#define  rpPATCHMESHLOCKTEXCOORDSIDX(_idx)   (rpPATCHMESHLOCKTEXCOORDS1 << (_idx))

Typedefs

typedef void *  RpPatchLODUserData
typedef RwUInt32(*  RpPatchLODCallBack )(RpAtomic *atomic, RpPatchLODUserData userData)

Enumerations

enum   RpPatchMeshFlag {
  rpNAPATCHMESHFLAG = 0, rpPATCHMESHPOSITIONS = 0x01, rpPATCHMESHNORMALS = 0x02, rpPATCHMESHPRELIGHTS = 0x04,
  rpPATCHMESHTEXTURED = 0x08, rpPATCHMESHLIGHT = 0x10, rpPATCHMESHMODULATEMATERIALCOLOR = 0x20, rpPATCHMESHSMOOTHNORMALS = 0x40,
  rpPATCHMESHFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
}
enum   RpPatchMeshLockMode {
  rpNAPATCHMESHLOCKMODE = 0, rpPATCHMESHLOCKPATCHES = 0x0001, rpPATCHMESHLOCKPOSITIONS = 0x0002, rpPATCHMESHLOCKNORMALS = 0x0004,
  rpPATCHMESHLOCKPRELIGHTS = 0x0008, rpPATCHMESHLOCKTEXCOORDS1 = 0x0100, rpPATCHMESHLOCKTEXCOORDS2 = 0x0200, rpPATCHMESHLOCKTEXCOORDS3 = 0x0400,
  rpPATCHMESHLOCKTEXCOORDS4 = 0x0800, rpPATCHMESHLOCKTEXCOORDS5 = 0x1000, rpPATCHMESHLOCKTEXCOORDS6 = 0x2000, rpPATCHMESHLOCKTEXCOORDS7 = 0x4000,
  rpPATCHMESHLOCKTEXCOORDS8 = 0x8000, rpPATCHMESHLOCKTEXCOORDSALL = 0xff00, rpPATCHMESHLOCKALL = 0xffff, rpPATCHMESHLOCKMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
}
enum   RpPatchType {
  rpNAPATCHTYPE = 0, rpPATCHTYPEGENERIC = 1, rpPATCHTYPESKIN = 2, rpPATCHTYPEMATFX = 3,
  rpPATCHTYPESKINMATFX = 4, rpPATCHTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
}

Functions

RpPatchMesh RpPatchMeshCreate (RwUInt32 numQuadPatches, RwUInt32 numTriPatches, RwUInt32 numControlPoints, RwUInt32 definitionFlag)
RwBool  RpPatchMeshDestroy (RpPatchMesh *patchMesh)
RpPatchMesh RpPatchMeshSetQuadPatch (RpPatchMesh *patchMesh, RwUInt32 quadIndex, RpQuadPatch *quadPatch)
RpPatchMesh RpPatchMeshSetTriPatch (RpPatchMesh *patchMesh, RwUInt32 triIndex, RpTriPatch *triPatch)
const RpQuadPatch RpPatchMeshGetQuadPatch (const RpPatchMesh *patchMesh, RwUInt32 quadIndex)
const RpTriPatch RpPatchMeshGetTriPatch (const RpPatchMesh *patchMesh, RwUInt32 triIndex)
RpPatchMesh RpPatchMeshLock (RpPatchMesh *patchMesh, RwUInt32 lockMode)
RpPatchMesh RpPatchMeshUnlock (RpPatchMesh *patchMesh)
RpPatchMesh RpPatchMeshSetQuadPatchMaterial (RpPatchMesh *patchMesh, RwUInt32 quadIndex, RpMaterial *material)
RpPatchMesh RpPatchMeshSetTriPatchMaterial (RpPatchMesh *patchMesh, RwUInt32 triIndex, RpMaterial *material)
RpMaterial RpPatchMeshGetQuadPatchMaterial (const RpPatchMesh *patchMesh, RwUInt32 quadIndex)
RpMaterial RpPatchMeshGetTriPatchMaterial (const RpPatchMesh *patchMesh, RwUInt32 triIndex)
RwUInt32  RpPatchMeshGetNumMaterials (const RpPatchMesh *patchMesh)
RpMaterial RpPatchMeshGetMaterial (const RpPatchMesh *patchMesh, RwUInt32 materialIndex)
const RpPatchMesh RpPatchMeshForAllMaterials (const RpPatchMesh *patchMesh, RpMaterialCallBack callBack, void *userData)
RpAtomic RpPatchAtomicSetPatchMesh (RpAtomic *atomic, RpPatchMesh *patchMesh)
RpPatchMesh RpPatchAtomicGetPatchMesh (const RpAtomic *atomic)
RpAtomic RpPatchAtomicSetType (RpAtomic *atomic, RpPatchType type)
RpPatchType  RpPatchAtomicGetType (const RpAtomic *atomic)
RpSkin RpPatchMeshGetSkin (RpPatchMesh *patchMesh)
RpPatchMesh RpPatchMeshSetSkin (RpPatchMesh *patchMesh, RpSkin *skin)
RwUInt32  RpPatchMeshStreamGetSize (const RpPatchMesh *patchMesh)
RpPatchMesh RpPatchMeshStreamRead (RwStream *stream)
const RpPatchMesh RpPatchMeshStreamWrite (const RpPatchMesh *patchMesh, RwStream *stream)
RpPatchMesh RpPatchMeshTransform (RpPatchMesh *patchMesh, const RwMatrix *matrix)
RwUInt32  RpPatchMeshGetFlags (const RpPatchMesh *patchMesh)
RpPatchMesh RpPatchMeshSetFlags (RpPatchMesh *patchMesh, RwUInt32 flags)
RwUInt32  RpPatchMeshGetNumControlPoints (const RpPatchMesh *patchMesh)
RwUInt32  RpPatchMeshGetNumQuadPatches (const RpPatchMesh *patchMesh)
RwUInt32  RpPatchMeshGetNumTriPatches (const RpPatchMesh *patchMesh)
RwUInt32  RpPatchMeshGetNumTexCoordSets (const RpPatchMesh *patchMesh)
RwV3d RpPatchMeshGetPositions (const RpPatchMesh *patchMesh)
RwV3d RpPatchMeshGetNormals (const RpPatchMesh *patchMesh)
RwRGBA RpPatchMeshGetPreLightColors (const RpPatchMesh *patchMesh)
RwTexCoords RpPatchMeshGetTexCoords (const RpPatchMesh *patchMesh, RwTextureCoordinateIndex index)
RwBool  RpPatchAtomicSetPatchLODCallBack (RpAtomic *atomic, RpPatchLODCallBack callback, RpPatchLODUserData userData)
RwBool  RpPatchAtomicGetPatchLODCallBack (const RpAtomic *atomic, RpPatchLODCallBack *callback, RpPatchLODUserData *userData)
RwBool  RpPatchSetDefaultLODCallBackRange (RpPatchLODRange *lodRange)
RwBool  RpPatchGetDefaultLODCallBackRange (RpPatchLODRange *lodRange)
void  RpPatchAtomicSetFreeListCreateParams (RwInt32 blockSize, RwInt32 numBlocksToPrealloc)
void  RpPatchGeometrySetFreeListCreateParams (RwInt32 blockSize, RwInt32 numBlocksToPrealloc)
RwBool  RpPatchPluginAttach (void)

Detailed Description

Bezier patch library

This library provides efficient evaluation of patches.

RpPatch Plugin Overview

Requirements
There are presently four versions of the RpPatch libraries in the RenderWare Graphics SDK. They are all fully featured versions of the RpPatch plugin and they contain identical APIs. However, because the rendering pipelines are large, different versions have been compiled so that the user can select precisely the pipelines they will be using to link against.
Requirements for rppatch library
The rppatch.lib library only contains the rpPATCHTYPEGENERIC pipeline.
Requirements for rppatchmatfx library
The rppatchmatfx.lib library contains both the rpPATCHTYPEGENERIC and rpPATCHTYPEMATFX pipelines.
Requirements for rppatchskin library
The rppatchskin.lib library contains both the rpPATCHTYPEGENERIC and rpPATCHTYPESKIN pipelines.
Requirements for rppatchskinmatfx library
The rppatchskinmatfx.lib library contains all the pipelines, rpPATCHTYPEGENERIC, rpPATCHTYPESKIN, rpPATCHTYPEMATFX and rpPATCHTYPESKINMATFX.
Note:
Only one of the patch libraries should be used in an application at once.

Overview

3-D Bézier patches

The RpPatch plugin extends the RenderWare Graphics API to support patches. Quadrilateral and triangular bi-cubic patches are supported using 16 and 10 control points respectively.

A patch provides several benefits for representing curved surfaces over a regular triangular mesh because of some of its inherent properties.

The advantages of using patches rather than triangular meshes are:

The disadvantage of using patches is that a patch is not directly renderable. A triangular mesh must be generated from the patch control points.

The process of refining the patch mesh's control points into a triangle mesh varies on each platform. Depending on the hardware of the host platform the patch mesh will either be refined and retained or refined every frame:

Creating and initializing a Patch Mesh

Before using any of the RpPatch functions the plugin should be attached with:

The patch plugin defines a new type, RpPatchMesh . This represents the collection of patches and has similar functions to that of RpGeometry.

There are two different types of patches:-

A RpPatchMesh should be initially setup with:- Information on a previously created RpPatchMesh can be retrieved with:- The RpPatchMeshFlag's can be accessed with:- The control points can be setup by accessing them either directly in the RpPatchMesh and RpPatchMeshDefinition structures or using the following functions:- Once the control points have be defined, RpQuadPatch 'es and RpTriPatch 'es can be added to the RpPatchMesh. The patches contain either rpQUADPATCHNUMCONTROLINDICES or rpTRIPATCHNUMCONTROLINDICES indices into the control points. This allows the patches to share control points. The patches should be setup with the following functions:-
Materials

Each patch within the patch mesh should normally have an RpMaterial attached to it. The patches are grouped by material when rendered. The patch materials should be accessed with the following functions:-

The RpMaterial's attached to an RpPatchMesh can be accessed by the following functions:-
Streaming

RpPatchMesh 'es may be written to and read from a binary stream using:-

Atomics

An RpPatchMesh defines but does not render its mesh. It must be attached to an RpAtomic to be rendered; a system very similar to that used with the RpGeometry.

Skinning

A patch mesh can be skinned in the same way as a geometry. An RpSkin should be created as usual for the control points and then attached to the RpPatchMesh with:-

Level Of Detail (LOD)

When the patches rendering the control points are refined into triangles the level of tesselation is controlled by LOD callback functions. All patch atomics by default will use the default LOD function. The user may control this by defining the LOD ranges:-

The following types are defined for use with the LOD callback system:- It is possible to overload the LOD callback function per patch atomic, this allows the user to vary the callback function on a per object basis:-
Pipelines

The patch plugin makes no assumptions about how to render the patch atomics. Once an RpPatchMesh has been attached to an RpAtomic it is necessary to attach a suitable patch rendering pipeline. The patch plugin supports four different rendering types, these are defined in the RpPatchType enumeration:-

The RpAtomic type is setup with the following functions:-

Define Documentation

#define rpPATCHLODMAXVALUE   (20)
 

defines the maximum value that can be returned for the patch evaluation LOD.

See also:
rpPATCHSKINLODMAXVALUE , rpPATCHLODMINVALUE , RpPatchLODCallBack
#define rpPATCHLODMINVALUE   (4)
 

defines the minimum value that can be returned for the patch evaluation LOD.

See also:
rpPATCHSKINLODMAXVALUE , rpPATCHLODMAXVALUE , RpPatchLODCallBack
#define rpPATCHMESHLOCKTEXCOORDSIDX _idx       (rpPATCHMESHLOCKTEXCOORDS1 << (_idx))
 

Convenience macro for generating a texture coordinate lock flag.

#define rpPATCHMESHTEXCOORDSETS _num       ((_num & 0xff) << 16)
 

Multi texture coordinate format specifier for RpPatchMeshCreate(). This should be OR'd into the RpPatchMeshFlag .

#define rpPATCHSKINLODMAXVALUE   (18)
 

defines the maximum value that can be returned for the skinned patch evaluation LOD.

See also:
rpPATCHLODMAXVALUE , rpPATCHLODMINVALUE , RpPatchLODCallBack
#define rpQUADPATCHNUMCONTROLINDICES   rpQUADPATCHNUMCONTROLPOINTS
 

defines the number of control point indices in a RpQuadPatch quadrilateral patch.

See also:
rpQUADPATCHNUMCONTROLPOINTS , RpPatchMeshSetQuadPatch
#define rpQUADPATCHNUMCONTROLPOINTS   (16)
 

defines the number of control points in a quadrilateral patch.

See also:
RpQuadPatch , rpQUADPATCHNUMCONTROLINDICES , RpPatchMeshSetQuadPatch
#define rpTRIPATCHNUMCONTROLINDICES   rpTRIPATCHNUMCONTROLPOINTS
 

defines the number of control points indices in a RpTriPatch triangular patch.

See also:
rpTRIPATCHNUMCONTROLPOINTS , RpPatchMeshSetTriPatch
#define rpTRIPATCHNUMCONTROLPOINTS   (10)
 

defines the number of control points in a triangular patch.

See also:
RpTriPatch , rpTRIPATCHNUMCONTROLINDICES , RpPatchMeshSetTriPatch

Typedef Documentation

typedef RwUInt32(* RpPatchLODCallBack)( RpAtomic *atomic, RpPatchLODUserData userData )
 

RpPatchLODCallBack typedef for the patch atomic LOD calculation function.

Parameters:
atomic  Pointer to atomic for which the LOD value is being calculated
userData  Pointer to the user supplied data
Returns:
LOD of the atomic in the range rpPATCHLODMINVALUE and rpPATCHLODMAXVALUE (or rpPATCHSKINLODMAXVALUE if atomic is skinned.)
See also:
RpPatchAtomicSetPatchLODCallBack , RpPatchAtomicGetPatchLODCallBack
typedef void* RpPatchLODUserData
 

RpPatchLODUserData typedef for the user data passed to the RpPatchLODCallBack function which calculates the atomics' LOD.

See also:
RpPatchAtomicSetPatchLODCallBack , RpPatchAtomicGetPatchLODCallBack

Enumeration Type Documentation

enum RpPatchMeshFlag
 

RpPatchMeshFlag When creating a RpPatchMesh, these flags can be OR'ed together to specify the format along with the rpPATCHMESHTEXCOORDSETS(num) macro to specify the number of texture coordinate sets required.

See also:
RpPatchMeshCreate
Enumeration values:
rpPATCHMESHPOSITIONS  Patch mesh contains control point positions.
rpPATCHMESHNORMALS  Patch mesh contains control point normals.
rpPATCHMESHPRELIGHTS  Patch mesh contains control point pre-light color values.
rpPATCHMESHTEXTURED  Patch mesh is textured. The number of texture sets must also be defined.
rpPATCHMESHLIGHT  Patch mesh will be lit.
rpPATCHMESHMODULATEMATERIALCOLOR  Control point color will be modulated with the material color.
rpPATCHMESHSMOOTHNORMALS  Patch mesh normals will be smoothed automatically.
enum RpPatchMeshLockMode
 

RpPatchMeshLockMode patch mesh lock flags.

See also:
rpPATCHMESHLOCKTEXCOORDSIDX
Enumeration values:
rpPATCHMESHLOCKPATCHES  Lock the mesh patches.
rpPATCHMESHLOCKPOSITIONS  Lock the control point positions.
rpPATCHMESHLOCKNORMALS  Lock the control point normals.
rpPATCHMESHLOCKPRELIGHTS  Lock the control point pre-light color values.
rpPATCHMESHLOCKTEXCOORDS1  Lock the texture coordinates set 1.
rpPATCHMESHLOCKTEXCOORDS2  Lock the texture coordinates set 2.
rpPATCHMESHLOCKTEXCOORDS3  Lock the texture coordinates set 3.
rpPATCHMESHLOCKTEXCOORDS4  Lock the texture coordinates set 4.
rpPATCHMESHLOCKTEXCOORDS5  Lock the texture coordinates set 5.
rpPATCHMESHLOCKTEXCOORDS6  Lock the texture coordinates set 6.
rpPATCHMESHLOCKTEXCOORDS7  Lock the texture coordinates set 7.
rpPATCHMESHLOCKTEXCOORDS8  Lock the texture coordinates set 8.
rpPATCHMESHLOCKTEXCOORDSALL  Lock all texture coordinate sets.
rpPATCHMESHLOCKALL  Combination of all the above.
enum RpPatchType
 

RpPatchType defines the different ways a patch atomic can be rendered. Once a RpPatchMesh has been attached to an RpAtomic with RpPatchAtomicSetPatchMesh the atomic must be setup with the correct rendering pipeline with RpPatchAtomicSetType .

The patch plugin makes no assumptions about how to render the patch atomics. Once an RpPatchMesh has been attached to an RpAtomic it is necessary to attach a suitable patch rendering pipeline. The patch plugin supports four different rendering types, these are defined in the RpPatchType enumeration:-

Enumeration values:
rpNAPATCHTYPE  Invalid patch pipeline.
rpPATCHTYPEGENERIC  Generic patch rendering.
rpPATCHTYPESKIN  Skinned patch rendering.
rpPATCHTYPEMATFX  Material effects patch rendering.
rpPATCHTYPESKINMATFX  Skinned material effects patch rendering.

Function Documentation

RwBool RpPatchAtomicGetPatchLODCallBack const RpAtomic   atomic,
RpPatchLODCallBack   callback,
RpPatchLODUserData   userData
 

RpPatchAtomicGetPatchLODCallBack is used to retrieve the atomic's LOD callback function.

The patch plugin must be attached before using this function.

Parameters:
atomic  Pointer to the atomic containing the patch mesh.
callback  Pointer to receive the LOD callback function.
userData  Pointer to receive the user-supplied data.
Returns:
TRUE if successful: FALSE otherwise.
See also:
RpPatchAtomicSetPatchLODCallBack , RpPatchSetDefaultLODCallBackRange , RpPatchGetDefaultLODCallBackRange
RpPatchMesh* RpPatchAtomicGetPatchMesh const RpAtomic   atomic
 

RpPatchAtomicGetPatchMesh is used to retrieve the patch mesh referenced by the specified atomic.

The patch plugin must be attached before using this function.

Parameters:
atomic  Pointer to the atomic containing the patch mesh.
Returns:
A pointer to the atomic's RpPatchMesh if successful, or NULL if there is an error or if no patch mesh is defined.
See also:
RpPatchAtomicSetPatchMesh
RpPatchType RpPatchAtomicGetType const RpAtomic   atomic
 

RpPatchAtomicGetType

Returns the RpPatchType of the rendering pipeline attached to the atomic.

The patch plugin must be attached before using this function.

Parameters:
atomic  Pointer to the atomic.
Returns:
The RpPatchType of the pipeline attached to the atomic, or rpNAPATCHTYPE otherwise.
See also:
RpPatchAtomicSetType
void RpPatchAtomicSetFreeListCreateParams RwInt32    blockSize,
RwInt32    numBlocksToPrealloc
 

RpPatchAtomicSetFreeListCreateParams allows the developer to specify how many PatchAtomicData 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
RwBool RpPatchAtomicSetPatchLODCallBack RpAtomic   atomic,
RpPatchLODCallBack    callback,
RpPatchLODUserData    userData
 

RpPatchAtomicSetPatchLODCallBack is used to define a callback function that determines which LOD should be used to facet the specified atomic. This allows a custom LOD selection defined by the application.

If a NULL callback is specified then a default callback is registered for the atomic that calculates the LOD using linear interpolation between a near and far range.

Values beyond the range are clamped to use the max rpPATCHLODMAXVALUE and min rpPATCHLODMINVALUE LOD respectively.

The format of the callback function is RpPatchLODCallBack:

RwUInt32 (* RpPatchLODCallBack) ( RpAtomic *atomic, RpPatchLODUserData userData );

The patch plugin must be attached before using this function.

Parameters:
atomic  Pointer to the atomic containing the patch mesh.
callback  The callback function to apply to the atomic.
userData  Pointer to user-supplied data to pass to the callback function.
Returns:
TRUE if successful: FALSE otherwise.
See also:
RpPatchAtomicGetPatchLODCallBack , RpPatchSetDefaultLODCallBackRange , RpPatchGetDefaultLODCallBackRange
RpAtomic* RpPatchAtomicSetPatchMesh RpAtomic   atomic,
RpPatchMesh   patchMesh
 

RpPatchAtomicSetPatchMesh is used to attach the specified patch mesh to the given atomic. Setting the patch mesh also sets the atomic's bounding sphere equal to the bounding sphere of the patch mesh.

If a patch mesh is already attached to the given atomic then that patch mesh is destroyed (unless it is still used by another atomic) before the new one is added.

The patch plugin must be attached before using this function.

Parameters:
atomic  Pointer to the atomic.
patchMesh  Pointer to the patch mesh.
Returns:
A pointer to the RpAtomic if successful, or NULL otherwise.
See also:
RpPatchAtomicGetPatchMesh , RpPatchMeshCreate , RpPatchMeshLock , RpPatchMeshUnlock
RpAtomic* RpPatchAtomicSetType RpAtomic   atomic,
RpPatchType    type
 

RpPatchAtomicSetType

Sets up the patch RpAtomic with the correct rendering pipeline. The RpPatchMesh should be attached to the RpAtomic with RpPatchAtomicSetPatchMesh before setting up the RpAtomic's rendering pipeline.

The patch plugin must be attached before using this function.

Parameters:
atomic  Pointer to the atomic.
type  Atomic rendering type.
Returns:
A pointer to the RpAtomic if successful, or NULL otherwise.
See also:
RpPatchAtomicGetType , RpPatchAtomicSetPatchMesh
void RpPatchGeometrySetFreeListCreateParams RwInt32    blockSize,
RwInt32    numBlocksToPrealloc
 

RpPatchGeometrySetFreeListCreateParams allows the developer to specify how many PatchGeometryData 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
RwBool RpPatchGetDefaultLODCallBackRange RpPatchLODRange   lodRange
 

RpPatchGetDefaultLODCallBackRange is used to query the setup of the default LOD callback. The values returned in RpPatchLODRange are used by the default patch atomic LOD callback.

The patch plugin must be attached before using this function.

Parameters:
lodRange  Pointer to the query structure RpPatchLODRange:
Returns:
TRUE if successful: FALSE otherwise.
See also:
RpPatchAtomicSetPatchLODCallBack , RpPatchAtomicGetPatchLODCallBack , RpPatchSetDefaultLODCallBackRange
RpPatchMesh* RpPatchMeshCreate RwUInt32    numQuadPatches,
RwUInt32    numTriPatches,
RwUInt32    numControlPoints,
RwUInt32    flag
 

RpPatchMeshCreate is used to created a new empty RpPatchMesh. The number of RpQuadPatch patches and RpTriPatch patches must be defined. The number of control points must also be specified.

The patch mesh is created locked with RpPatchMeshLockMode rpPATCHMESHLOCKALL and should be unlocked with RpPatchMeshUnlock once the control points and patches have been defined.

The patch plugin must be attached before using this function.

Parameters:
numQuadPatches  Number of RpQuadPatch quadrilateral patches the patch mesh will contain.
numTriPatches  Number of RpTriPatch triangular patches the patch mesh will contain.
numControlPoints  Total number of unique control points in the patch mesh.
flag  An RwUInt32 bit-field specifying the patch mesh's properties. RpPatchMeshFlag:
  • rpPATCHMESHPOSITIONS - Patch mesh has control point positions.
  • rpPATCHMESHNORMALS - Patch mesh has control point normals.
  • rpPATCHMESHPRELIGHTS - Patch mesh has control point pre-light color values.
  • rpPATCHMESHTEXTURED - Patch mesh should be textured.
  • rpPATCHMESHLIGHT - Patch mesh will be lit.
  • rpPATCHMESHMODULATEMATERIALCOLOR - Control point color will be modulated with the material color.
  • rpPATCHMESHTEXCOORDSETS(num) - Number of texture sets.
The control point positions are mandatory and must be defined when creating the patch mesh. The control point pre-light color values and texture coordinates are optional. The patch mesh can hold up to eight sets of texture coordinates for multipass and multitexture rendering. The number of texture coordinate sets supported is platform dependent.
Returns:
A pointer to the RpPatchMesh if successful, or NULL otherwise.
See also:
RpPatchMeshDestroy , RpPatchMeshLock , RpPatchMeshUnlock
RwBool RpPatchMeshDestroy RpPatchMesh   patchMesh
 

RpPatchMeshDestroy is used to destroy an RpPatchMesh. This destroys the patch mesh together with any privately allocated data structure.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh to destroy.
Returns:
TRUE if successful, NULL otherwise.
See also:
RpPatchMeshCreate.
const RpPatchMesh* RpPatchMeshForAllMaterials const RpPatchMesh   patchMesh,
RpMaterialCallBack    callBack,
void *    userData
 

RpPatchMeshForAllMaterials is used to apply the given callback function to all materials referenced by patches in the specified patch mesh.

The format of the callback function is:

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

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, RpPatchMeshForAllMaterials will still return successfully.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh containing the materials.
callBack  Pointer to the callback function to apply to each material.
userData  Pointer to user-supplied data to pass to the callback function.
Returns:
Returns a pointer to the patch mesh if successful or NULL if there is an error.
See also:
RpPatchMeshGetNumMaterials , RpPatchMeshGetMaterial
RwUInt32 RpPatchMeshGetFlags const RpPatchMesh   patchMesh
 

RpPatchMeshGetFlags is used to retrieve the property flags associated with the specified patch mesh.

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

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
Returns:
Returns an RwUInt32 bit-field whose value is the bit-wise OR of RpPatchMeshFlag values if successful, or zero if there is an error.
See also:
RpPatchMeshLock , RpPatchMeshUnlock , RpPatchMeshSetFlags
RpMaterial* RpPatchMeshGetMaterial const RpPatchMesh   patchMesh,
RwUInt32    materialIndex
 

RpPatchMeshGetMaterial is used to retrieve the material with the given index from the specified patch mesh's material list.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
materialIndex  Index of the material in the patch mesh.
Returns:
Returns a pointer to the material if successful, or NULL otherwise.
See also:
RpPatchMeshSetQuadPatchMaterial , RpPatchMeshSetTriPatchMaterial , RpPatchMeshGetQuadPatchMaterial , RpPatchMeshGetTriPatchMaterial , RpPatchMeshForAllMaterials , RpPatchMeshGetNumMaterials , RpPatchMeshGetNumQuadPatches , RpPatchMeshGetNumTriPatches
RwV3d* RpPatchMeshGetNormals const RpPatchMesh   patchMesh
 

RpPatchMeshGetNormals is used to retrieve the array of control point normals from the specified patch mesh. The array only exists if the patch mesh has been created using the rpPATCHMESHNORMALS flag. Use this function to initialize or redefine the patch mesh's control point normal list. There is a one-to-one correspondence between the control point position list array and the control point normal list array.

The patch mesh must be locked before the control point normal data can be modified.

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

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
Returns:
Returns a pointer to the control point normals if successful, or NULL otherwise.
See also:
RpPatchMeshLock , RpPatchMeshUnlock , RpPatchMeshGetFlags , RpPatchMeshSetFlags , RpPatchMeshGetNumControlPoints , RpPatchMeshGetNumQuadPatches , RpPatchMeshGetNumTriPatches , RpPatchMeshGetNumTexCoordSets , RpPatchMeshGetPositions , RpPatchMeshGetPreLightColors , RpPatchMeshGetTexCoords
RwUInt32 RpPatchMeshGetNumControlPoints const RpPatchMesh   patchMesh
 

RpPatchMeshGetNumControlPoints is used to determine the number of control points defining the specified patch mesh.

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

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
Returns:
Returns number of control points in the patch mesh.
See also:
RpPatchMeshLock , RpPatchMeshUnlock , RpPatchMeshGetFlags , RpPatchMeshSetFlags , RpPatchMeshGetNumTexCoordSets , RpPatchMeshGetNumQuadPatches , RpPatchMeshGetNumTriPatches , RpPatchMeshGetPositions , RpPatchMeshGetNormals , RpPatchMeshGetPreLightColors , RpPatchMeshGetTexCoords
RwUInt32 RpPatchMeshGetNumMaterials const RpPatchMesh   patchMesh
 

RpPatchMeshGetNumMaterials is used to retrieve the number of different materials in use by all the patches in the specified patch mesh.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
Returns:
Returns the number of materials referenced by the patch mesh.
See also:
RpPatchMeshSetQuadPatchMaterial , RpPatchMeshSetTriPatchMaterial , RpPatchMeshGetQuadPatchMaterial , RpPatchMeshGetTriPatchMaterial , RpPatchMeshForAllMaterials , RpPatchMeshGetNumQuadPatches , RpPatchMeshGetNumTriPatches , RpPatchMeshGetMaterial
RwUInt32 RpPatchMeshGetNumQuadPatches const RpPatchMesh   patchMesh
 

RpPatchMeshGetNumQuadPatches is used to retrieve the number of quad patches that define the specified patch mesh. The quad patches define the patch mesh's topology and material properties.

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

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
Returns:
Returns number of quad patches in the patch mesh.
See also:
RpPatchMeshLock , RpPatchMeshUnlock , RpPatchMeshGetFlags , RpPatchMeshSetFlags , RpPatchMeshGetNumControlPoints , RpPatchMeshGetNumTexCoordSets , RpPatchMeshGetNumTriPatches , RpPatchMeshGetPositions , RpPatchMeshGetNormals , RpPatchMeshGetPreLightColors , RpPatchMeshGetTexCoords
RwUInt32 RpPatchMeshGetNumTexCoordSets const RpPatchMesh   patchMesh
 

RpPatchMeshGetNumTexCoordSets is used to determine the number of sets of texture coordinates in the specified patch mesh. Each set has one texture coordinate per control point.

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

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
Returns:
Returns number of texture coordinate sets.
See also:
RpPatchMeshLock , RpPatchMeshUnlock , RpPatchMeshGetFlags , RpPatchMeshSetFlags , RpPatchMeshGetNumControlPoints , RpPatchMeshGetNumQuadPatches , RpPatchMeshGetNumTriPatches , RpPatchMeshGetPositions , RpPatchMeshGetNormals , RpPatchMeshGetPreLightColors , RpPatchMeshGetTexCoords
RwUInt32 RpPatchMeshGetNumTriPatches const RpPatchMesh   patchMesh
 

RpPatchMeshGetNumTriPatches is used to retrieve the number of tri patches that define the specified patch mesh. The tri patches define the patch mesh's topology and material properties.

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

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
Returns:
Returns number of texture coordinate sets.
See also:
RpPatchMeshLock , RpPatchMeshUnlock , RpPatchMeshGetFlags , RpPatchMeshSetFlags , RpPatchMeshGetNumControlPoints , RpPatchMeshGetNumQuadPatches , RpPatchMeshGetNumTexCoordSets , RpPatchMeshGetPositions , RpPatchMeshGetNormals , RpPatchMeshGetPreLightColors , RpPatchMeshGetTexCoords
RwV3d* RpPatchMeshGetPositions const RpPatchMesh   patchMesh
 

RpPatchMeshGetPositions is used to retrieve the array of control point positions from the specified patch mesh. The array only exists if the patch mesh has been created using the rpPATCHMESHPOSITIONS flag. Use this function to initialize or redefine the patch mesh's control point position list. There is a one-to-one correspondence between the control point position array and the control point normal array.

The patch mesh must be locked before the control point position data can be modified.

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

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
Returns:
Returns a pointer to the control point positions if successful, or NULL otherwise.
See also:
RpPatchMeshLock , RpPatchMeshUnlock , RpPatchMeshGetFlags , RpPatchMeshSetFlags , RpPatchMeshGetNumControlPoints , RpPatchMeshGetNumQuadPatches , RpPatchMeshGetNumTriPatches , RpPatchMeshGetNumTexCoordSets , RpPatchMeshGetNormals , RpPatchMeshGetPreLightColors , RpPatchMeshGetTexCoords
RwRGBA* RpPatchMeshGetPreLightColors const RpPatchMesh   patchMesh
 

RpPatchMeshGetPreLightColors is used to retrieve the array of pre-lighting colors from the specified patch mesh. The array only exists if the patch mesh has been created using the rpPATCHMESHPRELIGHTS flag. The pre-lighting colors reside within the patch mesh's control point topology, at one color per control point. Use this function to initialize or redefine the pre-lighting colors.

The patch mesh must be locked before the control point pre-lighting colors data can be modified.

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

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
Returns:
Returns a pointer to the control point pre-light colors if successful, or NULL otherwise.
See also:
RpPatchMeshLock , RpPatchMeshUnlock , RpPatchMeshGetFlags , RpPatchMeshSetFlags , RpPatchMeshGetNumControlPoints , RpPatchMeshGetNumQuadPatches , RpPatchMeshGetNumTriPatches , RpPatchMeshGetNumTexCoordSets , RpPatchMeshGetPositions , RpPatchMeshGetNormals , RpPatchMeshGetTexCoords
const RpQuadPatch* RpPatchMeshGetQuadPatch const RpPatchMesh   patchMesh,
RwUInt32    quadIndex
 

RpPatchMeshGetQuadPatch is used to get a set of quadrilateral (quad) patch control point indices from the patch mesh.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
quadIndex  Index of the quad patch to define.
Returns:
Pointer to the RpQuadPatch if successful, NULL otherwise.
See also:
RpPatchMeshSetQuadPatch
RpMaterial* RpPatchMeshGetQuadPatchMaterial const RpPatchMesh   patchMesh,
RwUInt32    quadIndex
 

RpPatchMeshGetQuadPatchMaterial is used to retrieve the material associated with the specified quad patch in the given patch mesh.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
quadIndex  Index into the patch mesh's quad patches array.
Returns:
Returns a pointer to the quad patch's material if successful, or NULL otherwise.
See also:
RpPatchMeshSetQuadPatchMaterial , RpPatchMeshSetTriPatchMaterial , RpPatchMeshGetTriPatchMaterial , RpPatchMeshForAllMaterials , RpPatchMeshGetNumMaterials , RpPatchMeshGetNumQuadPatches , RpPatchMeshGetNumTriPatches , RpPatchMeshGetMaterial
RpSkin* RpPatchMeshGetSkin RpPatchMesh   patchMesh
 

RpPatchMeshGetSkin is used to retrieve the RpSkin attached to the patch mesh.

The patch plugin must be attached before using this function. The skin plugin must also be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh containing the skin.
Returns:
Returns a pointer to the RpSkin if successful, or NULL otherwise.
See also:
RpPatchMeshSetSkin , RpPatchAtomicSetPatchMesh , RpPatchAtomicGetPatchMesh , RpSkinCreate
RwTexCoords* RpPatchMeshGetTexCoords const RpPatchMesh   patchMesh,
RwTextureCoordinateIndex    index
 

RpPatchMeshGetTexCoords is used to retrieve a particular set of control point texture coordinates, if they exist in the specified patch mesh. The number of sets available may be determined using RpPatchMeshGetNumTexCoordSets, and is fixed when the patch mesh is created (see RpPatchMeshCreate).

Control point texture coordinates reside within the patch mesh's topology, with each set having a (u,v) coordinate pair per control point. Use this function to initialize or redefine the control point texture coordinates.

There is a one-to-one correspondence between the control point texture coordinates array and other control point list arrays.

The patch mesh must be locked before modifying the control point texture coordinates.

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

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
index  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:
RpPatchMeshLock , RpPatchMeshUnlock , RpPatchMeshGetFlags , RpPatchMeshSetFlags , RpPatchMeshGetNumControlPoints , RpPatchMeshGetNumQuadPatches , RpPatchMeshGetNumTriPatches , RpPatchMeshGetNumTexCoordSets , RpPatchMeshGetPositions , RpPatchMeshGetNormals , RpPatchMeshGetPreLightColors
const RpTriPatch* RpPatchMeshGetTriPatch const RpPatchMesh   patchMesh,
RwUInt32    triIndex
 

RpPatchMeshGetTriPatch is used to get a set of triangle (tri) patch control point indices from the patch mesh.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
triIndex  Index of the tri patch to define.
Returns:
Pointer to the RpTriPatch if successful, NULL otherwise.
See also:
RpPatchMeshSetTriPatch
RpMaterial* RpPatchMeshGetTriPatchMaterial const RpPatchMesh   patchMesh,
RwUInt32    triIndex
 

RpPatchMeshGetTriPatchMaterial is used to retrieve the material associated with the specified tri patch in the given patch mesh.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
triIndex  Index into the tri patches array.
Returns:
Returns a pointer to the tri patch's material if successful, or NULL otherwise.
See also:
RpPatchMeshSetQuadPatchMaterial , RpPatchMeshSetTriPatchMaterial , RpPatchMeshGetQuadPatchMaterial , RpPatchMeshForAllMaterials , RpPatchMeshGetNumMaterials , RpPatchMeshGetNumQuadPatches , RpPatchMeshGetNumTriPatches , RpPatchMeshGetMaterial
RpPatchMesh* RpPatchMeshLock RpPatchMesh   patchMesh,
RwUInt32    lockMode
 

RpPatchMeshLock should be called before any of the patch mesh's control points or patches are changed. This function also prepares the patch mesh for unlocking after its data has been modified so that the platform specific instance can be rebuilt.

A newly created patch mesh is already locked.

Parameters:
patchMesh  Pointer to the patch mesh to lock.
lockMode  A RwUInt32 bit-field specifying the patch mesh locking flag.
The lock flags are (type RpPatchMeshLockMode):
  • rpPATCHMESHLOCKPATCHES - Lock the mesh patches.
  • rpPATCHMESHLOCKPOSITIONS - Lock the control point positions.
  • rpPATCHMESHLOCKNORMALS - Lock the control point normals.
  • rpPATCHMESHLOCKPRELIGHTS - Lock the control point pre-light color values.
  • rpPATCHMESHLOCKTEXCOORDS - Lock the control point first set of texture coordinates.
  • rpPATCHMESHLOCKTEXCOORDS2 - Lock the control point second set of texture coordinates.
  • . . .
  • rpPATCHMESHLOCKTEXCOORDS8 - Lock the control point eighth set of texture coordinates.
  • rpPATCHMESHLOCKALL - Combination of all the above.
The library rppatch and the header file rppatch.h are required.
Returns:
Pointer to the RpPatchMesh if successful or NULL otherwise.
See also:
RpPatchMeshCreate , RpPatchMeshUnlock
RpPatchMesh* RpPatchMeshSetFlags RpPatchMesh   patchMesh,
RwUInt32    flags
 

RpPatchMeshSetFlags is used to modify the property flags for the given patch mesh.

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 the final release version of an application.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
flags  An RwUInt32 bit-field whose value is the bit-wise OR of RpPatchMeshFlag values specifying the patch mesh's properties.
See also:
RpPatchMeshLock , RpPatchMeshUnlock , RpPatchMeshGetFlags
RpPatchMesh* RpPatchMeshSetQuadPatch RpPatchMesh   patchMesh,
RwUInt32    quadIndex,
RpQuadPatch   quadPatch
 

RpPatchMeshSetQuadPatch is used to add a set of quadrilateral (quad) patch control point indices to the patch mesh. The quad patch RpQuadPatch object consists of rpQUADPATCHNUMCONTROLINDICES control points.

The quad patch indices are copied internally and not referenced. The patch mesh must be locked with RpPatchMeshLockMode rpPATCHMESHLOCKPATCHES before the patch indices are added.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
quadIndex  Index of the quad patch to define.
quadPatch  Pointer to the RpQuadPatch indices.
Returns:
Pointer to the patch mesh if successful, NULL otherwise.
See also:
RpPatchMeshCreate , RpPatchMeshSetTriPatch , RpPatchMeshGetQuadPatch , RpPatchMeshLock
RpPatchMesh* RpPatchMeshSetQuadPatchMaterial RpPatchMesh   patchMesh,
RwUInt32    quadIndex,
RpMaterial   material
 

RpPatchMeshSetQuadPatchMaterial is used to associate the specified material with the given quad patch in the given patch mesh. The patch mesh's material list is modified accordingly. The material's reference count will be incremented if it's the first patch in the patch mesh to reference the material.

Before updating the patch mesh's materials, the patch mesh should be locked with rpPATCHMESHLOCKPATCHES. When the patch mesh is unlocked, the patches will be collected into material groups. This decreases the number of renderstate changes when rendering the patch mesh.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
quadIndex  Index into the patch mesh's array of quad patches.
material  Pointer to the material to set.
Returns:
Returns a pointer to the patch mesh if successful, or NULL otherwise.
See also:
RpPatchMeshSetTriPatchMaterial , RpPatchMeshGetQuadPatchMaterial , RpPatchMeshGetTriPatchMaterial , RpPatchMeshForAllMaterials , RpPatchMeshGetNumMaterials , RpPatchMeshGetNumQuadPatches , RpPatchMeshGetNumTriPatches , RpPatchMeshGetMaterial
RpPatchMesh* RpPatchMeshSetSkin RpPatchMesh   patchMesh,
RpSkin   skin
 

RpPatchMeshSetSkin is used to attach the RpSkin to the specified patch mesh. The skin data is used during rendering to skin the patch mesh.

The patch plugin and the skin plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
skin  Pointer to the skin to attach.
Returns:
Returns a pointer to the patch mesh if successful, or NULL otherwise.
See also:
RpPatchMeshGetSkin , RpPatchAtomicSetPatchMesh , RpPatchAtomicGetPatchMesh , RpSkinCreate
RpPatchMesh* RpPatchMeshSetTriPatch RpPatchMesh   patchMesh,
RwUInt32    triIndex,
RpTriPatch   triPatch
 

RpPatchMeshSetTriPatch is used to add a set of triangle (tri) patch control point indices to the patch mesh. The tri patch RpTriPatch object consists of rpTRIPATCHNUMCONTROLINDICES control points.

The tri patch indices are copied internally and not referenced. The patch mesh must be locked with RpPatchMeshLockMode rpPATCHMESHLOCKPATCHES before the patch indices are added.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
triIndex  Index of the tri patch to define.
triPatch  Pointer to the RpTriPatch indices.
Returns:
Pointer to the patch mesh if successful, NULL otherwise.
See also:
RpPatchMeshCreate , RpPatchMeshSetQaudPatch , RpPatchMeshGetTriPatch , RpPatchMeshLock
RpPatchMesh* RpPatchMeshSetTriPatchMaterial RpPatchMesh   patchMesh,
RwUInt32    triIndex,
RpMaterial   material
 

RpPatchMeshSetTriPatchMaterial is used to associate the specified material with the given tri patch in the given patch mesh. The patch mesh's material list is modified accordingly. The material's reference count will be incremented if it's the first patch in the patch mesh to reference the material.

Before updating the patch mesh's materials, the patch mesh should be locked with rpPATCHMESHLOCKPATCHES. When the patch mesh is unlocked, the patches will be collected into material groups. This decreases the number of renderstate changes when rendering the patch mesh.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
triIndex  Index of the tri patch in the patch mesh.
material  Pointer to the material to set.
Returns:
Returns a pointer to the patch mesh if successful, or NULL otherwise.
See also:
RpPatchMeshSetQuadPatchMaterial , RpPatchMeshGetQuadPatchMaterial , RpPatchMeshGetTriPatchMaterial , RpPatchMeshForAllMaterials , RpPatchMeshGetNumMaterials , RpPatchMeshGetNumQuadPatches , RpPatchMeshGetNumTriPatches , RpPatchMeshGetMaterial
RwUInt32 RpPatchMeshStreamGetSize const RpPatchMesh   patchMesh
 

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

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh whose binary size is required.
Returns:
the chunk size of the patch mesh if successful, or zero otherwise.
See also:
RwStreamOpen , RwStreamClose , RpPatchMeshStreamRead , RpPatchMeshStreamWrite
RpPatchMesh* RpPatchMeshStreamRead RwStream   stream
 

RpPatchMeshStreamRead is used to read a patch mesh from the specified binary stream. Prior to this function call, a binary patch mesh chunk must have been found in the stream using the RwStreamFindChunk API function..

The sequence to locate and read a patch mesh from a binary stream is as follows:

   RwStream *stream;
   RpPatchMesh *newPatchMesh;

   stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "mybinary.xxx");
   if( stream )
   {
       if( RwStreamFindChunk(stream, rwID_PATCHMESH, NULL, NULL) )
       {
           newPatchMesh = RpPatchMeshStreamRead(stream);
       }

       RwStreamClose(stream, NULL);
   }

The patch plugin must be attached before using this function.

Parameters:
stream  Pointer to the binary stream.
Returns:
Returns a pointer to the patch mesh if successful, or NULL if there is an error.
See also:
RwStreamOpen , RwStreamClose , RpPatchMeshStreamGetSize , RpPatchMeshStreamRead , RpPatchMeshStreamWrite
const RpPatchMesh* RpPatchMeshStreamWrite const RpPatchMesh   patchMesh,
RwStream   stream
 

RpPatchMeshStreamWrite is used to write the specified patch mesh to the given binary stream. The stream must have been opened prior to this function call.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
stream  Pointer to the binary stream.
Returns:
Returns a pointer to the patch mesh if successful, or NULL if there is an error.
See also:
RwStreamOpen , RwStreamClose , RpPatchMeshStreamGetSize , RpPatchMeshStreamRead
RpPatchMesh* RpPatchMeshTransform RpPatchMesh   patchMesh,
const RwMatrix   matrix
 

RpPatchMeshTransform is used to apply the specified transformation matrix to the given patch mesh. The transformation is applied equally to all the control point positions and control point normals. The patch mesh bounding sphere is recalculated after the transform.

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

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
matrix  Pointer to the matrix transformation.
Returns:
Returns a pointer to the patch mesh if successsful, or NULL if there is an error.
See also:
RpPatchMeshLock , RpPatchMeshUnlock , RpPatchMeshCreate , RpPatchMeshGetPositions , RpPatchMeshGetNormals , RpPatchMeshGetNumControlPoints
RpPatchMesh* RpPatchMeshUnlock RpPatchMesh   patchMesh
 

RpPatchMeshUnlock is used to unlock the specified patch mesh. This function will release the internal sections of the patch mesh which were locked with RpPatchMeshLock. Unlocking a patch mesh may force the patch mesh to be reinstanced. When the patch mesh is instanced the individual patches are grouped by material into patch material meshes which substantially speeds up the rendering process. The reinstancing, particularly the re-grouping process, is potentially slow, especially if the patch material meshes are rebuilt. Hence the locking and unlocking of patch meshes should be used carefully between rendering frames.

Newly created patch meshes are always locked and should be unlocked before they are used in any rendering.

The patch plugin must be attached before using this function.

Parameters:
patchMesh  Pointer to the patch mesh.
Returns:
Pointer to the patch mesh if successful, NULL otherwise.
See also:
RpPatchMeshLock
RwBool RpPatchPluginAttach void   
 

RpPatchPluginAttach is used to attach the patch plugin to the RenderWare system to enable the use of patch modelling for atomics. The patch plugin must be attached between initializing the system with RwEngineInit and opening it with RwEngineOpen.

Note that the include file rppatch.h is required and must be included by an application wishing to use this plugin. The patch plugin library is contained in the file rppatch.lib.

Returns:
TRUE on success: FALSE otherwise
RwBool RpPatchSetDefaultLODCallBackRange RpPatchLODRange   lodRange
 

RpPatchSetDefaultLODCallBackRange is used to setup the default LOD callback. The values in RpPatchLODRange are used by the default patch atomic LOD callback.

The minimum range defines the distance when the patch is at the maximum LOD. Atomics closer than this distance are facetted at the maximum LOD. The maximum range defines the distance when the patch is at the minimum LOD. Atomics futher than this distance are facetted at the minimum LOD. Atomics within the minimum and maximum range will have an LOD in inverse proportion to the distance from the viewer. The minimum and maximum values set the minimum and maximum LOD.

The patch plugin must be attached before using this function.

Parameters:
lodRange  Pointer to the definition structure RpPatchLODRange:
  • RwUInt32 minLod - Minimum LOD value.
  • RwUInt32 maxLod - Maximum LOD value.
  • RwReal minRange - Minimum LOD range.
  • RwReal maxRange - Maximum LOD range.
Returns:
TRUE if successful: FALSE otherwise.
See also:
RpPatchAtomicSetPatchLODCallBack , RpPatchAtomicGetPatchLODCallBack , RpPatchGetDefaultLODCallBackRange

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