#define VUCONTINUEx #define OVERRIDELIGHTx #define SUBSISTLIGHTx #define PS2ALLNULLLIGHTBLOCKSIZE 2 #if (!defined(FASTMORPH)) #define FMADD (0) #else /* (!defined(FASTMORPH)) */ #define FMADD (2) #endif /* (!defined(FASTMORPH)) */ /* For getting the ps2AllResHeader from a RwResEntry */ #define RWPS2ALLRESENTRYHEADERFROMRESENTRY(_resEntry) \ ((rwPS2AllResEntryHeader *)(_resEntry + 1)) /* For getting the Object Identifier from a ps2AllResHeader */ #define RWPS2ALLRESENTRYHEADERGETOBJIDENTIFIER(_ps2AllResEntry) \ ((_ps2AllResEntry)->objIdentifier) /* For getting the Mesh Identifier from a ps2AllResHeader */ #define RWPS2ALLRESENTRYHEADERGETMESHIDENTIFIER(_ps2AllResEntry) \ ((_ps2AllResEntry)->meshIdentifier) /* We expand trifans into trilists during instancing and * RPMESHPS2ALLCALCNUMVERTS calculates the 'numverts' in the * DMA chain and on VU1 (NOT counting tristrip/polyline vertex * duplication). */ #define RPMESHPS2ALLCALCNUMVERTS(_ps2AllPipeData, _numVerts) \ MACRO_START \ { \ RxPS2AllPipeData *_psald = (_ps2AllPipeData); \ RwUInt32 *_nmvt = (_numVerts); \ \ *_nmvt = _psald->mesh->numIndices; \ if (_psald->meshHeader->flags & rpMESHHEADERTRIFAN) \ { \ *_nmvt = ((*_nmvt) - 2)*3; \ } \ } \ MACRO_STOP /** * \ingroup ps2all * \ref RxInstanceFlags * These flags control the decision of whether to re-instance meshes * during the execution of PS2All.csl and PS2AllMat.csl. See * \ref RxPipelineNodePS2AllSetCallBack for an overview of this process. */ enum RxInstanceFlags { rxINSTANCENAINSTANCEFLAG = 0x0000, rxINSTANCEDONTINSTANCE = 0x0001, /**< Signifies that no per-mesh reinstancing or testing * should occur */ rxINSTANCEINPLACEINSTANCE = 0x0002, /**< Some or all clusters (depending on cluster reinstance * flags below) are to be re-instanced 'in-place', in the * existing resEntry (see \ref RxPipelineNodePS2AllSetCallBack * for details of the consequences) (overrides DONTINSTANCE) */ rxINSTANCECONGRUENTINSTANCE = 0x0004, /**< The resEntry is thrown away but its size/layout is * cached and reused for the new ResEntry (overrides * DONTINSTANCE and INPLACEINSTANCE) */ rxINSTANCEFULLINSTANCE = 0x0008, /**< Size/layout have changed, so we can't cache them * (overrides DONTINSTANCE, INPLACEINSTANCE and * CONGRUENTINSTANCE) */ rxINSTANCETYPEMASK = (rxINSTANCEINPLACEINSTANCE | rxINSTANCECONGRUENTINSTANCE | rxINSTANCEFULLINSTANCE), rxINSTANCEXYZ = 0x00010,/**< Vertex positions should be re-instanced in-place */ rxINSTANCENORMAL = 0x00020,/**< Vertex normals should be re-instanced in-place */ rxINSTANCERGBA = 0x00040,/**< Vertex (prelight) colors should be re-instanced in-place */ rxINSTANCEUV = 0x00080,/**< First vertex texture coordinates should be re-instanced in-place */ rxINSTANCEUV1 = 0x00080,/**< Alternate version of rxINSTANCEUV, different naming convention */ rxINSTANCEUV2 = 0x00100,/**< Second vertex texture coordinates should be re-instanced in-place */ rxINSTANCEUV3 = 0x00200,/**< Third vertex texture coordinates should be re-instanced in-place */ rxINSTANCEUV4 = 0x00400,/**< Fourth vertex texture coordinates should be re-instanced in-place */ rxINSTANCEUV5 = 0x00800,/**< Fifth vertex texture coordinates should be re-instanced in-place */ rxINSTANCEUV6 = 0x01000,/**< Sixth vertex texture coordinates should be re-instanced in-place */ rxINSTANCEUV7 = 0x02000,/**< Seventh vertex texture coordinates should be re-instanced in-place */ rxINSTANCEUV8 = 0x04000,/**< Eighth vertex texture coordinates should be re-instanced in-place */ rxINSTANCEUSER1 = 0x08000,/**< User cluster 1 should be re-instanced in-place */ rxINSTANCEUSER2 = 0x10000,/**< User cluster 2 should be re-instanced in-place */ rxINSTANCEUSER3 = 0x20000,/**< User cluster 3 should be re-instanced in-place */ rxINSTANCEUSER4 = 0x40000,/**< User cluster 4 should be re-instanced in-place */ rxINSTANCEALL = (rxINSTANCEXYZ | rxINSTANCENORMAL | rxINSTANCERGBA | rxINSTANCEUV1 | rxINSTANCEUV2 | rxINSTANCEUV3 | rxINSTANCEUV4 | rxINSTANCEUV5 | rxINSTANCEUV6 | rxINSTANCEUV7 | rxINSTANCEUV8 | rxINSTANCEUSER1 | rxINSTANCEUSER2 | rxINSTANCEUSER3 | rxINSTANCEUSER4), rxINSTANCEMASK = (rxINSTANCEDONTINSTANCE | rxINSTANCETYPEMASK | rxINSTANCEALL), rxINSTANCEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RxInstanceFlags RxInstanceFlags; /** * \ingroup ps2all * \struct RxPS2AllPipeData * Describes information used within the RxPS2All.csl node * and passed to callbacks registered therewith. */ struct RxPS2AllPipeData { /* Per-object stuff */ struct rxNodePS2AllPvtData *objPvtData; /**< A pointer to the private data of the currently * executing PS2All (object-pipeline) node */ struct rxNodePS2AllMatPvtData *matPvtData; /**< A pointer to the private data of the current * material pipeline's PS2AllMat node */ void *sourceObject; /**< A pointer to the source object */ RpMeshHeader *meshHeader; /**< A pointer to the source object's \ref RpMeshHeader */ RwMeshCache *meshCache; /**< A pointer to the \ref RwMeshCache associated * with meshHeader */ RxInstanceFlags objInstance; /**< Set by the ObjectSetup CB, says whether to instance * the object and if so whether to do in-place, congruent * or full reinstancing (and if in-place which clusters * to reinstance) */ RwUInt32 objIdentifier; /**< Per-object, object-type-specific data that gets * written into the PS2ResHeader such that state changes * since creation of the instance data can be detected by * object-specific code */ RwReal spExtra; /**< An extra RwReal that can be uploaded in the same * quadword as the surface properties. It is initialized * by default to zero and persists between meshes. */ #if (defined(FASTMORPH)) RwInt32 numMorphTargets; /**< Internal Use */ RwUInt32 fastMorphing; /**< Internal Use */ #endif /* (defined(FASTMORPH)) */ RwUInt8 transType; /**< RwUInt8 flags, specifying the type of transform to use * (ortho/persp, fog/not, etc - see \ref RxSkyTransTypeFlags) */ RwUInt8 primType; /**< RwUInt8 code for the primitive type that will * be submitted by VU1 to the GS (see GS manual ~p113) */ RwUInt8 matModulate; /**< RwUInt8 specifying whether or not to modulate * the object material colors (0 means FALSE) */ /* Following change per mesh */ RwUInt8 vu1CodeIndex; /**< RwUInt8 index into VU code array, */ /* specifying the transform to use */ const RpMesh *mesh; /**< A pointer to the source \ref RpMesh */ RwResEntry **cacheEntryRef; /**< A pointer to a pointer to a \ref RwResEntry * holding the instance data for the mesh */ RxInstanceFlags meshInstance; /**< Optionally set by the MeshReInstanceTest CB, overrides * objInstance in saying whether to instance the mesh and if * so whether to do in-place, congruent or full reinstancing * (and if in-place which clusters to reinstance) */ RwUInt32 meshIdentifier; /**< Per-mesh data that gets * written into the PS2ResHeader such that state changes * since creation of the instance data can be detected by * object-specific code. */ RwSurfaceProperties *surfProps; /**< A pointer to the current material surface properties. If * left NULL, default {1, 1, 1} surface properties will be used. */ RwTexture *texture; /**< A pointer to a RwTexture for the current mesh */ RwRGBA matCol; /**< RwRGBA material color value. Initialised by default to * {255, 255, 255, 255} */ }; typedef struct rwPS2AllPrimTypeLUT rwPS2AllPrimTypeLUT; #if (!defined(DOXYGEN)) struct rwPS2AllPrimTypeLUT { RwUInt8 vertToIndRatio[rwPRIMTYPEOR]; /**< Internal Use */ RwUInt8 vertToIndOffset[rwPRIMTYPEOR]; /**< Internal Use */ }; typedef struct rwPS2AllClusterQuickInfo rwPS2AllClusterQuickInfo; struct rwPS2AllClusterQuickInfo { u_long128 *data; /**< Internal Use */ RwUInt32 stride; /**< Internal Use */ }; #endif /* (!defined(DOXYGEN)) */ /** * \ingroup ps2all * \ref RxPipelineNodePS2AllCallBackType * PS2All.csl callback types (see \ref RxPipelineNodePS2AllSetCallBack * and \ref RxPipelineNodePS2AllMatSetCallBack), in order of execution within * the node. */ enum RxPipelineNodePS2AllCallBackType { rxPS2ALLCALLBACKNACALLBACK = 0, rxPS2ALLCALLBACKOBJECTSETUP = 1, /**< Performs per-object setup * (see \ref RxPipelineNodePS2AllObjectSetupCallBack) */ rxPS2ALLCALLBACKOBJECTFINALIZE = 2, /**< Performs per-object post-render tasks * (see \ref RxPipelineNodePS2AllObjectFinalizeCallBack) */ rxPS2ALLCALLBACKFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RxPipelineNodePS2AllCallBackType RxPipelineNodePS2AllCallBackType; typedef RwBool (*RxPipelineNodePS2AllObjectSetupCallBack) (RxPS2AllPipeData *ps2AllPipeData, RwMatrix **transform); typedef RwBool (*RxPipelineNodePS2AllObjectFinalizeCallBack) (RxPS2AllPipeData *ps2AllPipeData); typedef struct rwPS2AllResEntryHeader rwPS2AllResEntryHeader; #if (!defined(DOXYGEN)) struct rwPS2AllResEntryHeader { RwInt32 refCnt; /**< Internal Use */ RwInt32 clrCnt; /**< Internal Use */ u_long128 *data; /**< Internal Use */ RwUInt32 numVerts; /**< Internal Use */ RwUInt32 objIdentifier; /**< Internal Use */ RwUInt32 meshIdentifier; /**< Internal Use */ int batchSize; /**< Internal Use */ int numBatches; /**< Internal Use */ int batchesPerTag; /**< Internal Use */ #if (defined(FASTMORPH)) int morphStart; /**< Internal Use */ int morphFinish; /**< Internal Use */ int morphNum; /**< Internal Use */ #endif /* (defined(FASTMORPH)) */ rwPS2AllClusterQuickInfo clquickinfo[CL_MAXCL + FMADD]; /**< Internal Use */ rwPS2AllFieldRec fieldRec[CL_MAXCL + FMADD]; /**< Internal Use */ }; #endif /* (!defined(DOXYGEN)) */ #if (defined(__cplusplus)) extern "C" { #endif /* (defined(__cplusplus)) */ extern RxNodeDefinition * RxNodeDefinitionGetPS2All(void); /* Post-unlock API functions (these may be called more than * once, to change pipe behaviour between pipe executions) */ extern RxPipelineNode * RxPipelineNodePS2AllSetCallBack( RxPipelineNode *self, RxPipelineNodePS2AllCallBackType type, void *func); extern RxPipelineNode * RxPipelineNodePS2AllGroupMeshes( RxPipelineNode *node, RxPipeline *pipe); extern RxPipelineNode * RxPipelineNodePS2AllSetLightBufferOffset( RxPipelineNode *self, RwUInt32 offset); #if (defined(__cplusplus)) } #endif /* (defined(__cplusplus)) */