/******************************************/ /* */ /* RenderWare(TM) Graphics Library */ /* */ /******************************************/ /* * This file is a product of Criterion Software Ltd. * * This file is provided as is with no warranties of any kind and is * provided without any obligation on Criterion Software Ltd. * or Canon Inc. to assist in its use or modification. * * Criterion Software Ltd. and Canon Inc. will not, under any * circumstances, be liable for any lost revenue or other damages * arising from the use of this file. * * Copyright (c) 1999. Criterion Software Ltd. * All Rights Reserved. */ /************************************************************************* * * Filename: * Automatically Generated on: Wed Jul 10 10:45:01 2002 * ************************************************************************/ #ifndef RPWORLD_H #define RPWORLD_H /*--- Check For Previous Required Includes ---*/ #ifndef RWCORE_H #error "Include RWCORE.H before including this file" #endif /* RWCORE_H */ /*--- System Header Files ---*/ #include #include /*--- Error enumerations ---*/ #include "rpworld.rpe" /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/d3d8/native.h ---*/ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/d3d8/wrldpipe.h ---*/ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/d3d8/nodeD3D8WorldSectorAllInOne.h ---*/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RxNodeDefinition *RxNodeDefinitionGetD3D8WorldSectorAllInOne(void); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/d3d8/nodeD3D8AtomicAllInOne.h ---*/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RxNodeDefinition *RxNodeDefinitionGetD3D8AtomicAllInOne(void); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/d3d8/D3D8VertexBufferManager.h ---*/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeWorldSectorInstance.h ---*/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RxNodeDefinition *RxNodeDefinitionGetWorldSectorInstance(void); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeWorldSectorEnumerateLights.h ---*/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RxNodeDefinition *RxNodeDefinitionGetWorldSectorEnumerateLights(void); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodePreLight.h ---*/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RxNodeDefinition *RxNodeDefinitionGetPreLight(void); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodePostLight.h ---*/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RxNodeDefinition *RxNodeDefinitionGetPostLight(void); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeMaterialScatter.h ---*/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RxNodeDefinition *RxNodeDefinitionGetMaterialScatter(void); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeLight.h ---*/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RxNodeDefinition *RxNodeDefinitionGetLight(void); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeFastPathSplitter.h ---*/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RxNodeDefinition *RxNodeDefinitionGetFastPathSplitter(void); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeAtomicInstance.h ---*/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RxNodeDefinition *RxNodeDefinitionGetAtomicInstance(void); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeAtomicEnumerateLights.h ---*/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RxNodeDefinition *RxNodeDefinitionGetAtomicEnumerateLights(void); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: c:/daily/rwsdk/world/bamateri.h ---*/ /* * Handling surface materials * Materials describe how things are to appear when rendered * * Copyright (c) 1998 Criterion Software Ltd. */ /**************************************************************************** Global Types */ typedef struct RpMaterialChunkInfo RpMaterialChunkInfo; typedef struct RpMaterialChunkInfo _rpMaterial; struct RpMaterialChunkInfo { RwInt32 flags; /**< Material flags - unused currently - for future expansion */ RwRGBA color; /**< Colour of material. */ RwInt32 unused; /**< Not used */ RwBool textured; /**< Are we textured? */ RwSurfaceProperties surfaceProps; /**< Surface properties */ }; #if (!defined(RwMaterialAssign)) #define RwMaterialAssign(_target, _source) \ ( *(_target) = *(_source) ) #endif /* (!defined(RwMaterialAssign)) */ /** * \ingroup rpworlddatatypes * \typedef RpMaterial * Material object. This should be * considered an opaque type. Use the RpMaterial API functions to access. */ typedef struct RpMaterial RpMaterial; #if (!defined(DOXYGEN)) struct RpMaterial { RwTexture *texture; /**< texture */ RwRGBA color; /**< color */ RxPipeline *pipeline; /**< pipeline */ RwSurfaceProperties surfaceProps; /**< surfaceProps */ RwInt16 refCount; /* C.f. rwsdk/world/bageomet.h:RpGeometry */ RwInt16 pad; }; #endif /* (!defined(DOXYGEN)) */ /** * \ingroup rpworlddatatypes * \typedef RpMaterialCallBack \ref RpMaterialCallBack * represents the function called from \ref RpGeometryForAllMaterials and * \ref RpWorldForAllMaterials for all materials referenced by polygons in a * given geometry. This function should return a pointer to the current * material to indicate success. The callback may return NULL to terminate * further callbacks on the materials. * * \param material Pointer to the current material * \param data Pointer to developer-defined data structure. * * \return Pointer to the current material. */ typedef RpMaterial *(*RpMaterialCallBack)(RpMaterial *material, void *data); /**************************************************************************** refCount++), (_material)) #define RpMaterialAddRefVoidMacro(_material) \ MACRO_START \ { \ (_material)->refCount++; \ } \ MACRO_STOP #define RpMaterialSetColorMacro(_material, _color) \ (RwRGBAAssign(&((_material)->color), (_color)), (_material)) #define RpMaterialGetColorMacro(_material) \ (&((_material)->color)) #define RpMaterialSetSurfacePropertiesMacro(_material, _surfProps) \ (RwSurfacePropertiesAssign(&((_material)->surfaceProps), \ (_surfProps)), (_material)) #define RpMaterialSetSurfacePropertiesVoidMacro(_material, _surfProps) \ MACRO_START \ { \ RwSurfacePropertiesAssign(&((_material)->surfaceProps), \ (_surfProps)); \ } \ MACRO_STOP #define RpMaterialGetSurfacePropertiesMacro(_material) \ (&((_material)->surfaceProps)) #define RpMaterialGetTextureMacro(_material) \ ((_material)->texture) #if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) #define RpMaterialAddRef(_material) \ RpMaterialAddRefMacro(_material) #define RpMaterialSetColor(_material, _color) \ RpMaterialSetColorMacro(_material, _color) #define RpMaterialGetColor(_material) \ RpMaterialGetColorMacro(_material) #define RpMaterialSetSurfaceProperties(_material, _surfProps) \ RpMaterialSetSurfacePropertiesMacro(_material, _surfProps) #define RpMaterialGetSurfaceProperties(_material) \ RpMaterialGetSurfacePropertiesMacro(_material) #define RpMaterialGetTexture(_material) \ RpMaterialGetTextureMacro(_material) #endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ /**************************************************************************** Function prototypes */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Creating, destroying and referencing materials */ extern RpMaterial *RpMaterialCreate(void); extern RwBool RpMaterialDestroy(RpMaterial *material); extern RpMaterial *RpMaterialClone(RpMaterial *material); /* Textures */ extern RpMaterial *RpMaterialSetTexture(RpMaterial *material, RwTexture *texture); #if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) extern RpMaterial *RpMaterialAddRef(RpMaterial *material); /* Textures */ extern RwTexture *RpMaterialGetTexture(const RpMaterial *material); /* Setting and getting colors */ extern RpMaterial *RpMaterialSetColor(RpMaterial *material, const RwRGBA *color); extern const RwRGBA *RpMaterialGetColor(const RpMaterial *material); /* Setting and getting surface properties */ extern RpMaterial * RpMaterialSetSurfaceProperties(RpMaterial *material, const RwSurfaceProperties *surfaceProperties); extern const RwSurfaceProperties * RpMaterialGetSurfaceProperties(const RpMaterial *material); #endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ /* Attaching toolkits */ extern RwInt32 RpMaterialRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB); extern RwInt32 RpMaterialRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB); extern RwInt32 RpMaterialSetStreamAlwaysCallBack( RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB); extern RwInt32 RpMaterialGetPluginOffset(RwUInt32 pluginID); extern RwBool RpMaterialValidatePlugins(const RpMaterial *material); /* Binary format */ extern RwUInt32 RpMaterialStreamGetSize(const RpMaterial *material); extern RpMaterial *RpMaterialStreamRead(RwStream *stream); extern const RpMaterial *RpMaterialStreamWrite(const RpMaterial *material, RwStream *stream); extern RpMaterialChunkInfo * _rpMaterialChunkInfoRead(RwStream *stream, RpMaterialChunkInfo *materialChunkInfo, RwInt32 *bytesRead); #ifdef __cplusplus } #endif /* __cplusplus */ #define RpMaterialChunkInfoRead(stream, materialChunkInfo, bytesRead) \ _rpMaterialChunkInfoRead(stream, materialChunkInfo, bytesRead) /*--- Automatically derived from: c:/daily/rwsdk/world/bamatlst.h ---*/ /**************************************************************************** Global Types */ typedef struct RpMaterialList RpMaterialList; struct RpMaterialList { RpMaterial **materials; RwInt32 numMaterials; RwInt32 space; }; /**************************************************************************** Function prototypes */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #define rpMaterialListGetNumMaterials(mlist) ((mlist)->numMaterials) /* Setting up and destroying material lists */ extern RpMaterialList *_rpMaterialListInitialize(RpMaterialList *matList); extern RpMaterialList *_rpMaterialListDeinitialize(RpMaterialList *matList); /* Accessing material lists */ extern RpMaterial ** _rpMaterialListAlloc(RwUInt32 count); extern RpMaterial *_rpMaterialListGetMaterial(const RpMaterialList *matList, RwInt32 matIndex); extern RpMaterialList * _rpMaterialListSetSize(RpMaterialList * matList, RwInt32 size); extern RpMaterialList *_rpMaterialListCopy(RpMaterialList *matListOut, const RpMaterialList *matListIn); extern RwInt32 _rpMaterialListAppendMaterial(RpMaterialList *matList, RpMaterial *material); extern RwInt32 _rpMaterialListFindMaterialIndex(const RpMaterialList *matList, const RpMaterial *material); /* Binary format */ extern RwUInt32 _rpMaterialListStreamGetSize(const RpMaterialList *matList); extern RpMaterialList *_rpMaterialListStreamRead(RwStream *stream, RpMaterialList *matList); extern const RpMaterialList *_rpMaterialListStreamWrite(const RpMaterialList *matList, RwStream *stream); #ifdef __cplusplus } #endif /* __cplusplus */ #define rpMaterialListInitialize(_matList) \ _rpMaterialListInitialize(_matList) #define rpMaterialListDeinitialize(_matList) \ _rpMaterialListDeinitialize(_matList) #define rpMaterialListGetMaterial(_matList, _matIndex) \ _rpMaterialListGetMaterial(_matList, _matIndex) #define rpMaterialListCopy(_matListOut, _matListIn) \ _rpMaterialListCopy(_matListOut, _matListIn) #define rpMaterialListAppendMaterial(_matList, _material) \ _rpMaterialListAppendMaterial(_matList, _material) #define rpMaterialListStreamRead(_stream, _matList) \ _rpMaterialListStreamRead(_stream, _matList) #define rpMaterialListStreamWrite(_matList, _stream) \ _rpMaterialListStreamWrite(_matList, _stream) /*--- Automatically derived from: c:/daily/rwsdk/world/bamesh.h ---*/ /* * * Purpose: Provide construction and enumeration facilities for meshes. * * Copyright (c) 1998 Criterion Software Ltd. */ #define RPMESHGLOBAL(var) \ (RWPLUGINOFFSET(rpMeshGlobals, \ RwEngineInstance, \ meshModule.globalsOffset)->var) #define rwPRIMTYPEOR \ (rwPRIMTYPELINELIST | \ rwPRIMTYPEPOLYLINE | \ rwPRIMTYPETRILIST | \ rwPRIMTYPETRISTRIP | \ rwPRIMTYPETRIFAN | \ rwPRIMTYPEPOINTLIST) #define rpMESHHEADERPRIMTYPEOR \ (0 /* rpMESHHEADERTRILIST*/ | \ rpMESHHEADERTRISTRIP | \ rpMESHHEADERTRIFAN | \ rpMESHHEADERLINELIST | \ rpMESHHEADERPOLYLINE | \ rpMESHHEADERPOINTLIST) /**************************************************************************** Global variables */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RwModuleInfo meshModule; #ifdef __cplusplus } #endif /* __cplusplus */ /**************************************************************************** Global types */ /** * \ingroup rpworlddatatypes * \typedef RpMeshHeader * typedef for header structure listing all meshes * constituting a single RpGeometry or RpWorldSector */ typedef struct RpMeshHeader RpMeshHeader; /** * \ingroup rpworlddatatypes * \ref RpMeshHeaderFlags * represents the different types of mesh. * \see RpMeshHeader */ enum RpMeshHeaderFlags { /* NOTE: trilists are denoted by absence of any other * primtype flags, so be careful that you test: * (triListFlag == flags&triListFlag) * or: * (0 == flags&rpMESHHEADERPRIMMASK) * and not: * (flags&triListFlag) */ rpMESHHEADERTRISTRIP = 0x0001, /**< Render as tristrips */ rpMESHHEADERTRIFAN = 0x0002, /**< On PS2 these will be converted to trilists */ rpMESHHEADERLINELIST = 0x0004, /**< Render as linelists */ rpMESHHEADERPOLYLINE = 0x0008, /**< On PS2 these will be converted to linelists */ rpMESHHEADERPOINTLIST = 0x0010, /**< Pointlists are supported only if rendered by * custom pipelines; there is no default RenderWare * way to render pointlists. */ rpMESHHEADERPRIMMASK = 0x00FF, /**< All bits reserved for specifying primitive type */ rpMESHHEADERUNINDEXED = 0x0100, /**< Topology is defined implicitly by vertex * order, ergo the mesh contains no indices */ rpMESHHEADERFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; /* * Typedef for RpMeshHeaderFlags enumeration * representing the different types of mesh */ typedef enum RpMeshHeaderFlags RpMeshHeaderFlags; typedef struct rpMeshGlobals rpMeshGlobals; struct rpMeshGlobals { RwInt16 nextSerialNum; RwFreeList *triStripListEntryFreeList; RwUInt8 meshFlagsToPrimType[rpMESHHEADERPRIMTYPEOR]; RwUInt8 primTypeToMeshFlags[rwPRIMTYPEOR]; }; typedef struct RpBuildMeshTriangle RpBuildMeshTriangle; /** * \ingroup rpworlddatatypes * \struct RpBuildMeshTriangle * This type represents an array of indices into * the object vertex array. Used during the construction * of tristrips. * * See API functions * \see RpBuildMeshGeneratePreprocessTriStrip * \see RpBuildMeshGenerateExhaustiveTriStrip * \see RpBuildMeshGenerateTrivialTriStrip * \see RpBuildMeshGenerateDefaultTriStrip * and * \see RpMeshSetTriStripMethod * \see RpMeshGetTriStripMethod */ struct RpBuildMeshTriangle { RwUInt16 vertIndex[3]; /**< indices into object vertex * array. */ RpMaterial *material; /**< pointer to material used to * render the mesh. */ }; typedef struct RpBuildMesh RpBuildMesh; /** * \ingroup rpworlddatatypes * \struct RpBuildMesh * This type represents a mesh ready for tri stripping. * * See API functions * \see RpBuildMeshGeneratePreprocessTriStrip * \see RpBuildMeshGenerateExhaustiveTriStrip * \see RpBuildMeshGenerateTrivialTriStrip * \see RpBuildMeshGenerateDefaultTriStrip * and * \see RpMeshSetTriStripMethod * \see RpMeshGetTriStripMethod */ struct RpBuildMesh { RwUInt32 triangleBufferSize; /**< number of triangles * space has been allocated * for. */ RwUInt32 numTriangles; /**< number of triangles to be * tristripped. */ RpBuildMeshTriangle *meshTriangles; /**< pointer to build mesh * triangles. */ }; typedef struct RpMesh RpMesh; /** * \ingroup rpworlddatatypes * \struct RpMesh * This type represents a single polygon mesh. * A mesh is defined as a collection of triangles derived from an RpGeometry * or RpWorldSector which have a common material. * * See API functions \see RpGeometryForAllMeshes and * \see RpWorldSectorForAllMeshes and * the corresponding function callback types: */ struct RpMesh { RxVertexIndex *indices; /**< vertex indices defining the mesh */ RwUInt32 numIndices; /**< number of vertices in mesh */ RpMaterial *material; /**< pointer to material used to * render the mesh. */ }; /** * \ingroup rpworlddatatypes * \struct RpMeshHeader * Header for all meshes that constitute a single RpGeometry or RpWorldSector */ struct RpMeshHeader { RwUInt32 flags; /**< \see RpMeshHeaderFlags */ RwUInt16 numMeshes; /**< Number of meshes in object */ RwUInt16 serialNum; /**< Determine if mesh has changed * since last instance */ RwUInt32 totalIndicesInMesh; /**< Total triangle index * count in all meshes */ RwUInt32 firstMeshOffset; /**< Offset in bytes from end this * structure RpMeshHeader * to the first mesh */ }; /** * \ingroup rpworlddatatypes * \typedef RpMeshCallBack * \ref RpMeshCallBack is the callback * function supplied to \ref RpGeometryForAllMeshes and * \ref 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. * * \param mesh Pointer to the current mesh, supplied by * iterator. * \param meshHeader Pointer to the meshes header * \param data Pointer to developer-defined data structure. * * \return * Returns a pointer to the current mesh if successful or NULL if an error * occurred. */ typedef RpMesh *(*RpMeshCallBack) (RpMesh * mesh, RpMeshHeader * meshHeader, void *pData); /**************************************************************************** Function prototypes */ #if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) #define RpMeshHeaderGetPrimType(_mshHdr) \ ( (RwPrimitiveType)RPMESHGLOBAL(meshFlagsToPrimType)[(_mshHdr)->flags & \ rpMESHHEADERPRIMMASK] ) #define RpMeshHeaderSetPrimType(_mshHdr, _prmTyp) \ ( (_mshHdr)->flags = \ ((_mshHdr)->flags & ~rpMESHHEADERPRIMMASK) | \ (rpMESHHEADERPRIMMASK & \ RPMESHGLOBAL(primTypeToMeshFlags)[(_prmTyp) & \ rpMESHHEADERPRIMMASK]), \ (_mshHdr) ) #endif /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Opening and closing module */ extern void *_rpMeshOpen(void *instance, RwInt32 offset, RwInt32 size); extern void *_rpMeshClose(void *instance, RwInt32 offset, RwInt32 size); extern RwInt16 _rpMeshGetNextSerialNumber(void); /* Create a build mesh with nothing in */ extern RpBuildMesh *_rpBuildMeshCreate(RwUInt32 bufferSize); /* Destroy a build mesh */ extern RwBool _rpBuildMeshDestroy(RpBuildMesh * mesh); /* Destroy a build mesh */ extern RwBool _rpMeshDestroy(RpMeshHeader * mesh); /* Add a triangle to a mesh */ extern RpBuildMesh *_rpBuildMeshAddTriangle(RpBuildMesh * mesh, RpMaterial * material, RwInt32 vert1, RwInt32 vert2, RwInt32 vert3); #if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) /* Get primtype from a mesh header */ extern RwPrimitiveType RpMeshHeaderGetPrimType(RpMeshHeader * meshHeader); /* Set primtype for a mesh header */ extern RpMeshHeader *RpMeshHeaderSetPrimType(RpMeshHeader * meshHeader, RwPrimitiveType primType); #endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ /* Enumerate meshes within a mesh header */ extern RpMeshHeader *_rpMeshHeaderForAllMeshes(RpMeshHeader * meshHeader, RpMeshCallBack fpCallBack, void *pData); /* Mesh serialisation functions */ extern RwStream *_rpMeshWrite(const RpMeshHeader * meshHeader, const void *object, RwStream * stream, const RpMaterialList * matList); extern RpMeshHeader *_rpMeshRead(RwStream * stream, const void *object, const RpMaterialList * matList); extern RwInt32 _rpMeshSize(const RpMeshHeader *meshHeader, const void *object); /* Mesh header create/destroy functions */ extern void _rpMeshHeaderDestroy(RpMeshHeader * meshHeader); extern RpMeshHeader * _rpMeshHeaderCreate(RwUInt32 size); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: c:/daily/rwsdk/world/basector.h ---*/ /* * Handling atomic sectors * Atomic sectors are use to divide up the world into manageable portions * * Copyright (c) 1998 Criterion Software Ltd. */ /**************************************************************************** Defines */ /* Type ID */ #define rpWorldSector 0xff /* Not a true 'type'! */ #define rpMINDISTANCEBETWEENVERTICES (RwReal)(0.0001) #define RPV3DFROMVERTEXNORMAL(v, n) \ (v).x = (((RwReal)((n).x)) * ( (RwReal)(1.0/128))); \ (v).y = (((RwReal)((n).y)) * ( (RwReal)(1.0/128))); \ (v).z = (((RwReal)((n).z)) * ( (RwReal)(1.0/128))) #define RPVERTEXNORMALFROMRWV3D(n, v) \ { \ RwFixed naTmp[3]; \ \ naTmp[0] = RwRealToFixed((v).x); \ naTmp[1] = RwRealToFixed((v).y); \ naTmp[2] = RwRealToFixed((v).z); \ \ if (naTmp[0] >= RwFixedCast(1)) \ { \ naTmp[0] = RwFixedCast(1)-1; \ } \ if (naTmp[0] <= RwFixedCast(-1)) \ { \ naTmp[0] = RwFixedCast(-1)+1; \ } \ if (naTmp[1] >= RwFixedCast(1)) \ { \ naTmp[1] = RwFixedCast(1)-1; \ } \ if (naTmp[1] <= RwFixedCast(-1)) \ { \ naTmp[1] = RwFixedCast(-1)+1; \ } \ if (naTmp[2] >= RwFixedCast(1)) \ { \ naTmp[2] = RwFixedCast(1)-1; \ } \ if (naTmp[2] <= RwFixedCast(-1)) \ { \ naTmp[2] = RwFixedCast(-1)+1; \ } \ \ (n).x = (RwInt8)(naTmp[0]>>9); \ (n).y = (RwInt8)(naTmp[1]>>9); \ (n).z = (RwInt8)(naTmp[2]>>9); \ } /* RpCollSector access macros - for pre v304 data */ #define RWCOLLSECTORGETTYPE(sect) \ ((sect).cType&0x80) #define RWCOLLSECTORGETPLANE(sect) \ ((((sect).cType)>>3)&0xc) #define RWCOLLSECTORGETON(sect) \ (((sect).cType)&0x1f) #define RWCOLLSECTORGETVERTEX(sect) \ (sect).vertex #define RWCOLLSECTORGETSTART(sect) \ (sect).start #define RWCOLLSECTORGETNOPOLYS(sect) \ (sect).cType #define RWCOLLSECTORSETPOLYGONS(sect,no,st) \ (sect).cType = (RwUInt8)(no); \ (sect).start = (RwUInt8)(st) #define rwMAXCOLLISIONCUTS 7 /**************************************************************************** Global types */ typedef struct RpVertexNormal RpVertexNormal; struct RpVertexNormal { RwInt8 x; RwInt8 y; RwInt8 z; RwUInt8 pad; /* pad character to force alignment */ }; typedef struct RpPolygon RpPolygon; struct RpPolygon { RwUInt16 matIndex; RwUInt16 vertIndex[3]; }; /* RpCollSector - for pre v304 data */ #define RWCOLLSECTORSETPLANE(sect,plane,vert,no,st) \ (sect).cType = (RwUInt8)(0x80|((plane)<<3)|(no)); \ (sect).vertex = (RwUInt8)(vert); \ (sect).start = (RwUInt8)(st) typedef struct RpCollSector RpCollSector; struct RpCollSector { RwUInt8 cType; /* Bit 7 - 1 plane */ /* 0 polygons */ /* Bit 6-5 - plane */ /* Bit 4-0 - amount ON plane */ RwUInt8 vertex; /* Vertex index used for the split */ RwUInt8 start; /* Starting polygon */ }; /** * \ingroup rpworlddatatypes * \typedef RpWorldSector * World Sector object. This should be * considered an opaque type. Use the RpWorldSector API functions to access. */ typedef struct RpWorldSector RpWorldSector; #if (!defined(DOXYGEN)) struct RpWorldSector { RwInt32 type; RpPolygon *polygons; /* Polygons themselves */ RwV3d *vertices; /* Vertex positions */ RpVertexNormal *normals; /* Vertex normals */ RwTexCoords *texCoords[rwMAXTEXTURECOORDS]; /* Texture coordinates */ RwRGBA *preLitLum; /* Pre lit luminances */ /* Pointer to memory allocated for vertex and poly pointers */ RwResEntry *repEntry; /* Atomics in this sectors */ /* The pointers are frigged so they look like they are pointing to Atomics when they are pointing to here */ RwLinkList collAtomicsInWorldSector; /* Coll priority */ RwLinkList noCollAtomicsInWorldSector; /* No Coll priority */ /* Lights in an atomic sector */ RwLinkList lightsInWorldSector; /* Outer bounding box of sector based on BSP planes */ RwBBox boundingBox; /* Bounding box tightly enclosing geometry */ RwBBox tightBoundingBox; /* The root of the bsp collision tree for pre v304 data */ RpCollSector *colSectorRoot; /* The mesh which groups same material polygons together */ RpMeshHeader *mesh; /* The WorldSector object pipeline for this WorldSector */ RxPipeline *pipeline; /* Material list window base * (triangles in a given sector can "see" * the 256 materials from * MatList[matListWindowBase] -> MatList[matListWindowBase + 255]) */ RwUInt16 matListWindowBase; RwUInt16 numVertices; /* Num vertices */ RwUInt16 numPolygons; /* Num polygons */ RwUInt16 pad; }; #endif /* (!defined(DOXYGEN)) */ /** * \ingroup rpworlddatatypes * \typedef RpWorldSectorCallBack \ref RpWorldSectorCallBack * represents the function called from \ref RpWorldForAllWorldSectors, * \ref RpAtomicForAllWorldSectors and \ref RpLightForAllWorldSectors for all * world sectors in a given world or world sectors a given atomic or light lies * in. This function should return a pointer to the current world sector to * indicate success. The callback may return NULL to terminate further * callbacks on the atomic or light. * * \return Pointer to the current world sector. * * \param sector Pointer to the current world sector * \param data Pointer to developer-defined data structure. */ typedef RpWorldSector *(*RpWorldSectorCallBack)(RpWorldSector *worldSector, void *data); typedef struct RpSector RpSector; struct RpSector { RwInt32 type; }; /* NOTE: The left and right pointers can point to an RpPlaneSector or * an RpWorldSector * This is determined what the type is via the type value */ typedef struct RpPlaneSector RpPlaneSector; struct RpPlaneSector { RwInt32 type; RwReal value; RpSector *leftSubTree; /* Sector 'left' (less) of the plane */ RpSector *rightSubTree; /* Sector 'right' (more) of the plane */ RwReal leftValue; RwReal rightValue; }; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RwPluginRegistry sectorTKList; #ifdef __cplusplus } #endif /* __cplusplus */ #define RpWorldSectorGetBBoxMacro(_sctr) (&((_sctr)->boundingBox)) #define RpWorldSectorGetTightBBoxMacro(_sctr) (&((_sctr)->tightBoundingBox)) #if ((!defined(RWDEBUG)) && (!defined(RWSUPPRESSINLINE))) #define RpWorldSectorGetBBox RpWorldSectorGetBBoxMacro #define RpWorldSectorGetTightBBox RpWorldSectorGetTightBBoxMacro #endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ /**************************************************************************** Function prototypes */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Get info from atomic sectors */ extern RwInt32 RpWorldSectorGetNumPolygons(const RpWorldSector *Sector); extern RwInt32 RpWorldSectorGetNumVertices(const RpWorldSector *Sector); /* Instancing and deinstancing sectors */ extern RpWorldSector * RpWorldSectorRender(RpWorldSector *worldSector); extern const RpWorldSector *RpWorldSectorForAllMeshes(const RpWorldSector *sector, RpMeshCallBack fpCallBack, void *pData); #if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) extern const RwBBox *RpWorldSectorGetBBox(const RpWorldSector *sector); extern const RwBBox *RpWorldSectorGetTightBBox(const RpWorldSector *sector); #endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ /* Plugins */ extern RwInt32 RpWorldSectorRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB); extern RwInt32 RpWorldSectorRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB); extern RwInt32 RpWorldSectorSetStreamAlwaysCallBack( RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB); extern RwInt32 RpWorldSectorSetStreamRightsCallBack(RwUInt32 pluginID, RwPluginDataChunkRightsCallBack rightsCB); extern RwInt32 RpWorldSectorGetPluginOffset(RwUInt32 pluginID); extern RwBool RpWorldSectorValidatePlugins(const RpWorldSector *sector); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: c:/daily/rwsdk/world/bameshop.h ---*/ /**************************************************************************** Defines */ /** * \ingroup rpworlddatatypes * \typedef RpTriStripMeshCallBack * \ref RpTriStripMeshCallBack is the callback to generate triangle strips * when the triangle stripped geometries or world sectors are unlocked. * * \param buildMesh pointer to the mesh which the triangle strip will be * generated from. * \param data pointer to user-supplied data to pass to the callback * function. * * \return a pointer to the constructed mesh header. * */ typedef RpMeshHeader * (*RpTriStripMeshCallBack) (RpBuildMesh *buildMesh, void *data); /**************************************************************************** Global types */ /**************************************************************************** Global Variables */ /**************************************************************************** Function prototypes */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Callback mesh generating functions */ extern RpMeshHeader * RpBuildMeshGenerateTrivialTriStrip(RpBuildMesh *buildMesh, void *data); extern RpMeshHeader * RpBuildMeshGenerateDefaultTriStrip(RpBuildMesh *buildmesh, void *data); extern RpMeshHeader * RpBuildMeshGeneratePreprocessTriStrip(RpBuildMesh *buildmesh, void *data); extern RpMeshHeader * RpBuildMeshGenerateExhaustiveTriStrip(RpBuildMesh *buildmesh, void *data); extern RpMeshHeader * RpBuildMeshGenerateDefaultIgnoreWindingTriStrip(RpBuildMesh *buildmesh, void *data); extern RpMeshHeader * RpBuildMeshGeneratePreprocessIgnoreWindingTriStrip(RpBuildMesh *buildmesh, void *data); extern RpMeshHeader * RpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip(RpBuildMesh *buildmesh, void *data); /* Functions to set and get the global mesh tristrip algorithm */ extern RwBool RpMeshSetTriStripMethod(RpTriStripMeshCallBack callback, void *data); extern RwBool RpMeshGetTriStripMethod(RpTriStripMeshCallBack *callback, void **data); extern RpMeshHeader * _rpTriListMeshGenerate(RpBuildMesh *buildMesh, void *data); /* * Optimise the mesh ordering * (sort on material and place transparent materials last) */ extern RpMeshHeader * _rpMeshOptimise(RpBuildMesh *buildmesh, RwUInt32 flags); #ifdef __cplusplus } #endif /* __cplusplus */ #define _rpTriStripMeshTrivialGenerate(_buildMesh, _data) \ RpBuildMeshGenerateTrivialTriStrip(_buildMesh, _data) #define _rpTriStripMeshDefaultGenerate(_buildmesh, _data) \ RpBuildMeshGenerateDefaultTriStrip(_buildmesh, _data) #define _rpTriStripMeshPreprocessGenerate(_buildmesh, _data) \ RpBuildMeshGeneratePreprocessTriStrip(_buildmesh, _data) #define _rpTriStripMeshExhaustiveGenerate(_buildmesh, _data) \ RpBuildMeshGenerateExhaustiveTriStrip(_buildmesh, _data) #define _rpMeshSetTristripMethod(_callback, _data) \ RpMeshSetTriStripMethod(_callback, _data) #define _rpMeshGetTristripMethod(_callback, _data) \ RpMeshGetTriStripMethod(_callback, _data) /*--- Automatically derived from: c:/daily/rwsdk/world/balight.h ---*/ /* * Lighting 3D objects. * Lights are used to illuminate atomics and worlds * * Copyright (c) 1998 Criterion Software Ltd. */ /**************************************************************************** Defines */ /* Binary Light */ typedef struct RpLightChunkInfo RpLightChunkInfo; typedef struct RpLightChunkInfo _rpLight; struct RpLightChunkInfo { RwReal radius; /**< radius */ RwReal red; /**< red */ RwReal green; /**< green */ RwReal blue; /**< blue */ RwReal minusCosAngle; /**< minusCosAngle */ RwUInt32 typeAndFlags; /**< typeAndFlags */ }; /* Type ID */ #define rpLIGHT 3 /* Beyond this the lights must be positioned */ #define rpLIGHTPOSITIONINGSTART 0x80 /** * \ingroup rpworlddatatypes * \ref RpLightType are * light sub types. This type represents the different * types of light source that can be created using the API function \ref RpLightCreate. * Note that lights of types rpLIGHTPOINT, rpLIGHTSPOT and rpLIGHTSPOTSOFT have linear * intensity fall-off with distance from the source, reducing to zero at the light's radius:*/ enum RpLightType { rpNALIGHTTYPE = 0, /* These don't take part in the tie mechanism (no position) */ rpLIGHTDIRECTIONAL, /**radius) #define RpLightGetColorMacro(_light) \ (&((_light)->color)) #define RpLightSetFrameMacro(_light, _frame) \ (rwObjectHasFrameSetFrame((_light), (_frame)), (_light)) #define RpLightGetFrameMacro(_light) \ ((RwFrame *)rwObjectGetParent((_light))) #define RpLightGetTypeMacro(_light) \ ((RpLightType)rwObjectGetSubType((_light))) #define RpLightSetFlagsMacro(_light, _flags) \ ((rwObjectSetFlags((_light), (_flags))), (_light)) #define RpLightGetFlagsMacro(_light) \ (rwObjectGetFlags((_light))) #if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) #define RpLightGetRadius(_light) \ RpLightGetRadiusMacro(_light) #define RpLightGetColor(_light) \ RpLightGetColorMacro(_light) #define RpLightSetFrame(_light, _frame) \ RpLightSetFrameMacro(_light, _frame) #define RpLightGetFrame(_light) \ RpLightGetFrameMacro(_light) #define RpLightGetType(_light) \ RpLightGetTypeMacro(_light) #define RpLightSetFlags(_light, _flags) \ RpLightSetFlagsMacro(_light, _flags) #define RpLightGetFlags(_light) \ RpLightGetFlagsMacro(_light) #endif /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ /**************************************************************************** Function prototypes */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) extern RwReal RpLightGetRadius(const RpLight *light); extern const RwRGBAReal *RpLightGetColor(const RpLight *light); extern RpLight *RpLightSetFrame(RpLight *light, RwFrame *frame); extern RwFrame *RpLightGetFrame(const RpLight *light); extern RpLightType RpLightGetType(const RpLight *light); extern RpLight *RpLightSetFlags(RpLight *light, RwUInt32 flags); extern RwUInt32 RpLightGetFlags(const RpLight *light); #endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ /* API Functions */ extern RpLight *RpLightCreate(RwInt32 type); extern RwBool RpLightDestroy(RpLight *light); extern RpLight *RpLightSetRadius(RpLight *light, RwReal radius); extern RpLight *RpLightSetColor(RpLight *light, const RwRGBAReal *color); extern RwReal RpLightGetConeAngle(const RpLight *light); extern RpLight *RpLightSetConeAngle(RpLight * ight, RwReal angle); extern RwUInt32 RpLightStreamGetSize(const RpLight *light); extern RpLight *RpLightStreamRead(RwStream *stream); extern const RpLight *RpLightStreamWrite(const RpLight *light, RwStream *stream); extern RpLightChunkInfo *_rpLightChunkInfoRead(RwStream *stream, RpLightChunkInfo *lightChunkInfo, RwInt32 *bytesRead); /* Attaching toolkits */ extern RwInt32 RpLightRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB); extern RwInt32 RpLightRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB); extern RwInt32 RpLightSetStreamAlwaysCallBack(RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB); extern RwInt32 RpLightGetPluginOffset(RwUInt32 pluginID); extern RwBool RpLightValidatePlugins(const RpLight * light); #ifdef __cplusplus } #endif /* __cplusplus */ #define RpLightChunkInfoRead(stream, lightChunkInfo, bytesRead) \ _rpLightChunkInfoRead(stream, lightChunkInfo, bytesRead) /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/d3d8/D3D8lights.h ---*/ /** * \ingroup rplightd3d8 * \typedef RpD3D8AttenuationParams * typedef for struct RpD3D8AttenuationParams */ typedef struct RpD3D8AttenuationParams RpD3D8AttenuationParams; /** * \ingroup rplightd3d8 * \struct RpD3D8AttenuationParams * This type represents the attenuation model of a spot or point light. */ struct RpD3D8AttenuationParams { RwReal constant; /**< Constant attenuation coefficient */ RwReal linear; /**< Linear attenuation coefficient */ RwReal quadratic; /**< Quadratic attenuation coefficient */ }; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern void RpD3D8LightSetAttenuationParams(RpLight *light, const RpD3D8AttenuationParams *params); extern void RpD3D8LightGetAttenuationParams(const RpLight *light, RpD3D8AttenuationParams *params); extern RwBool _rwD3D8LightsOpen(void); extern RwBool _rwD3D8LightsGlobalEnable(RpLightFlag flags); extern RwBool _rwD3D8LightDirectionalEnable(RpLight *light); extern RwBool _rwD3D8LightLocalEnable(RpLight *light); extern void _rwD3D8LightsEnable(RwBool enable, RwUInt32 type); extern void _rwD3D8LightsClose(void); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/p2stdclsw.h ---*/ typedef RpLight *RxLight; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RxClusterDefinition RxClLights; /* Uses the RxLight type (see above) */ #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: c:/daily/rwsdk/world/bageomet.h ---*/ /* * Handling atomic's geometry * Geometry describe objects, and are the building blocks for atomics * * Copyright (c) 1998 Criterion Software Ltd. */ /**************************************************************************** Defines */ /* Type ID */ #define rpGEOMETRY 8 /** * \ingroup rpworlddatatypes * 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 \ref RpGeometryCreate * for more details. * * \see RpGeometryCreate(). */ enum RpGeometryFlag { rpGEOMETRYTRISTRIP = 0x00000001, /**boundingSphere), (_sphere)), (_mt)) #define RpMorphTargetGetBoundingSphereMacro(_mt) \ (&((_mt)->boundingSphere)) #define RpGeometryGetNumMorphTargetsMacro(_geometry) \ ((_geometry)->numMorphTargets) #define RpGeometryGetMorphTargetMacro(_geometry, _index) \ (&((_geometry)->morphTarget[(_index)])) #define RpGeometryGetPreLightColorsMacro(_geometry) \ ((_geometry)->preLitLum) #define RpGeometryGetVertexTexCoordsMacro(_geometry, _uvIndex) \ ((_geometry)->texCoords[(_uvIndex) - 1]) #define RpGeometryGetNumTexCoordSetsMacro(_geometry) \ ((_geometry)->numTexCoordSets) #define RpGeometryGetNumVerticesMacro(_geometry) \ ((_geometry)->numVertices) #define RpMorphTargetGetVerticesMacro(_mt) \ ((_mt)->verts) #define RpMorphTargetGetVertexNormalsMacro(_mt) \ ((_mt)->normals) #define RpGeometryGetTrianglesMacro(_geometry) \ ((_geometry)->triangles) #define RpGeometryGetNumTrianglesMacro(_geometry) \ ((_geometry)->numTriangles) #define RpGeometryGetMaterialMacro(_geometry, _num) \ (((_geometry)->matList.materials)[(_num)]) #define RpGeometryGetNumMaterialsMacro(_geometry) \ ((_geometry)->matList.numMaterials) #define RpGeometryGetFlagsMacro(_geometry) \ ((_geometry)->flags) #define RpGeometrySetFlagsMacro(_geometry, _flags) \ (((_geometry)->flags = (_flags)), (_geometry)) #if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) #define RpMorphTargetSetBoundingSphere(_geometry, _sphere) \ RpMorphTargetSetBoundingSphereMacro(_geometry, _sphere) #define RpMorphTargetGetBoundingSphere(_geometry) \ RpMorphTargetGetBoundingSphereMacro(_geometry) #define RpGeometryGetNumMorphTargets(_geometry) \ RpGeometryGetNumMorphTargetsMacro(_geometry) #define RpGeometryGetMorphTarget(_geometry, _index) \ RpGeometryGetMorphTargetMacro(_geometry, _index) #define RpGeometryGetPreLightColors(_geometry) \ RpGeometryGetPreLightColorsMacro(_geometry) #define RpGeometryGetVertexTexCoords(_geometry, _uvIndex) \ RpGeometryGetVertexTexCoordsMacro(_geometry, _uvIndex) #define RpGeometryGetNumTexCoordSets(_geometry) \ RpGeometryGetNumTexCoordSetsMacro(_geometry) #define RpGeometryGetNumVertices(_geometry) \ RpGeometryGetNumVerticesMacro(_geometry) #define RpMorphTargetGetVertices(_mt) \ RpMorphTargetGetVerticesMacro(_mt) #define RpMorphTargetGetVertexNormals(_mt) \ RpMorphTargetGetVertexNormalsMacro(_mt) #define RpGeometryGetTriangles(_geometry) \ RpGeometryGetTrianglesMacro(_geometry) #define RpGeometryGetNumTriangles(_geometry) \ RpGeometryGetNumTrianglesMacro(_geometry) #define RpGeometryGetMaterial(_geometry, _num) \ RpGeometryGetMaterialMacro(_geometry, _num) #define RpGeometryGetNumMaterials(_geometry) \ RpGeometryGetNumMaterialsMacro(_geometry) #define RpGeometryGetFlags(_geometry) \ RpGeometryGetFlagsMacro(_geometry) #define RpGeometrySetFlags(_geometry, _flags) \ RpGeometrySetFlagsMacro(_geometry, _flags) #endif /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ /**************************************************************************** Function prototypes */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Transforms geometry morph target vertices */ extern RpGeometry * RpGeometryTransform(RpGeometry *geometry, const RwMatrix *matrix); /* Create geometry for a 'space' marker */ extern RpGeometry * RpGeometryCreateSpace(RwReal radius); /* Morph targets - Accessing geometry contents */ #if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) extern RpMorphTarget * RpMorphTargetSetBoundingSphere(RpMorphTarget *morphTarget, const RwSphere *boundingSphere); extern RwSphere * RpMorphTargetGetBoundingSphere(RpMorphTarget *morphTarget); #endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ extern const RpMorphTarget * RpMorphTargetCalcBoundingSphere(const RpMorphTarget *morphTarget, RwSphere *boundingSphere); extern RwInt32 RpGeometryAddMorphTargets(RpGeometry *geometry, RwInt32 mtcount); extern RwInt32 RpGeometryAddMorphTarget(RpGeometry *geometry); extern RpGeometry * RpGeometryRemoveMorphTarget(RpGeometry *geometry, RwInt32 morphTarget); #if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) extern RwInt32 RpGeometryGetNumMorphTargets(const RpGeometry *geometry); extern RpMorphTarget * RpGeometryGetMorphTarget(const RpGeometry *geometry, RwInt32 morphTarget); extern RwRGBA * RpGeometryGetPreLightColors(const RpGeometry *geometry); extern RwTexCoords * RpGeometryGetVertexTexCoords(const RpGeometry *geometry, RwTextureCoordinateIndex uvIndex); extern RwInt32 RpGeometryGetNumTexCoordSets(const RpGeometry *geometry); extern RwInt32 RpGeometryGetNumVertices (const RpGeometry *geometry); extern RwV3d * RpMorphTargetGetVertices(const RpMorphTarget *morphTarget); extern RwV3d * RpMorphTargetGetVertexNormals(const RpMorphTarget *morphTarget); extern RpTriangle * RpGeometryGetTriangles(const RpGeometry *geometry); extern RwInt32 RpGeometryGetNumTriangles(const RpGeometry *geometry); extern RpMaterial * RpGeometryGetMaterial(const RpGeometry *geometry, RwInt32 matNum); #endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ extern const RpGeometry * RpGeometryTriangleSetVertexIndices(const RpGeometry *geometry, RpTriangle *triangle, RwUInt16 vert1, RwUInt16 vert2, RwUInt16 vert3); extern RpGeometry * RpGeometryTriangleSetMaterial(RpGeometry *geometry, RpTriangle *triangle, RpMaterial *material); extern const RpGeometry * RpGeometryTriangleGetVertexIndices(const RpGeometry *geometry, const RpTriangle *triangle, RwUInt16 *vert1, RwUInt16 *vert2, RwUInt16 *vert3); extern RpMaterial * RpGeometryTriangleGetMaterial(const RpGeometry *geometry, const RpTriangle *triangle); #if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) extern RwInt32 RpGeometryGetNumMaterials(const RpGeometry *geometry); #endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ extern RpGeometry * RpGeometryForAllMaterials(RpGeometry *geometry, RpMaterialCallBack fpCallBack, void *pData); /* Accessing the inards of geometry */ extern RpGeometry * RpGeometryLock(RpGeometry *geometry, RwInt32 lockMode); extern RpGeometry * RpGeometryUnlock(RpGeometry *geometry); extern const RpGeometry * RpGeometryForAllMeshes(const RpGeometry *geometry, RpMeshCallBack fpCallBack, void *pData); /* Creation and destruction */ extern RpGeometry * RpGeometryCreate(RwInt32 numVert, RwInt32 numTriangles, RwUInt32 format); extern RwBool RpGeometryDestroy(RpGeometry *geometry); extern RpGeometry * _rpGeometryAddRef(RpGeometry *geometry); /* Attaching toolkits */ extern RwInt32 RpGeometryRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB); extern RwInt32 RpGeometryRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB); extern RwInt32 RpGeometrySetStreamAlwaysCallBack(RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB); extern RwInt32 RpGeometryGetPluginOffset(RwUInt32 pluginID); extern RwBool RpGeometryValidatePlugins(const RpGeometry *geometry); /* Binary format */ extern RwUInt32 RpGeometryStreamGetSize(const RpGeometry *geometry); extern const RpGeometry * RpGeometryStreamWrite(const RpGeometry *geometry, RwStream *stream); extern RpGeometry * RpGeometryStreamRead(RwStream *stream); extern RpGeometryChunkInfo * _rpGeometryChunkInfoRead(RwStream *stream, RpGeometryChunkInfo *geometryChunkInfo, RwInt32 *bytesRead); #if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) /* Flags */ extern RwUInt32 RpGeometryGetFlags(const RpGeometry *geometry); extern RpGeometry * RpGeometrySetFlags(RpGeometry *geometry, RwUInt32 flags); #endif /* Lighting characteristics */ extern const RwSurfaceProperties * _rpGeometryGetSurfaceProperties(const RpGeometry *geometry); extern RpGeometry * _rpGeometrySetSurfaceProperties(RpGeometry *geometry, const RwSurfaceProperties *surfaceProperties); #ifdef __cplusplus } #endif /* __cplusplus */ #define RpGeometryGetSurfaceProperties(_geometry) \ _rpGeometryGetSurfaceProperties(_geometry) #define RpGeometrySetSurfaceProperties(_geometry, _surfaceProperties) \ _rpGeometrySetSurfaceProperties(_geometry, _surfaceProperties) #define rpGeometryAddRef(_geometry) \ _rpGeometryAddRef(_geometry) #define RpGeometryChunkInfoRead(stream, geometryChunkInfo, bytesRead) \ _rpGeometryChunkInfoRead(stream, geometryChunkInfo, bytesRead) /*--- Automatically derived from: c:/daily/rwsdk/world/baclump.h ---*/ /* * Clump and atomic handling. * Clumps and atomics are the movable rendered objects in the world * * Copyright (c) 1998 Criterion Software Ltd. */ /**************************************************************************** Defines */ /****************************** Object type ID ******************************/ /* Type IDs */ #define rpATOMIC 1 #define rpCLUMP 2 /* Interpolator flags */ enum RpInterpolatorFlag { rpINTERPOLATORDIRTYINSTANCE = 0x01, rpINTERPOLATORDIRTYSPHERE = 0x02, rpINTERPOLATORNOFRAMEDIRTY = 0x04, rpINTERPOLATORFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RpInterpolatorFlag rpInterpolatorFlag; /** * \ingroup rpworlddatatypes * The bit-field type RpAtomicFlag specifies the options available for * controlling the behavior of atomics. See API function \ref RpAtomicSetFlags. * * \see RpAtomicSetFlags * \see RpAtomicGetFlags * \see RpWorldSectorForAllCollisionAtomics */ enum RpAtomicFlag { rpATOMICCOLLISIONTEST = 0x01, /**renderCallBack(_atomic)) #define RpAtomicGetGeometryMacro(_atomic) \ ((_atomic)->geometry) #if (!defined(RpAtomicSetRenderCallBackMacro)) /* NB "RpAtomicSetRenderCallBack(atom++, callback)" will break it */ #define RpAtomicSetRenderCallBackMacro(_atomic, _callback) \ MACRO_START \ { \ (_atomic)->renderCallBack = (_callback); \ if (!(_atomic)->renderCallBack) \ { \ (_atomic)->renderCallBack = AtomicDefaultRenderCallBack; \ } \ } \ MACRO_STOP #endif /* (!defined(RpAtomicSetRenderCallBackMacro)) */ #define RpAtomicGetRenderCallBackMacro(_atomic) \ ((_atomic)->renderCallBack) #define RpAtomicGetInterpolatorMacro(_atomic) \ (&((_atomic)->interpolator)) #define RpInterpolatorGetStartMorphTargetMacro(_intrp) \ ((_intrp)->startMorphTarget) #define RpInterpolatorGetEndMorphTargetMacro(_intrp) \ ((_intrp)->endMorphTarget) #define RpInterpolatorGetValueMacro(_intrp) \ ((_intrp)->position) #define RpInterpolatorGetScaleMacro(_intrp) \ ((_intrp)->time) /* NB "RpInterpolatorSetStartMorphTarget(interp++, target)" will break it */ #define RpInterpolatorSetStartMorphTargetMacro(_intrp, _target, _atomic)\ ((_intrp)->startMorphTarget = (RwInt16) (_target), \ (_intrp)->flags |= (RwInt32)(rpINTERPOLATORDIRTYINSTANCE | \ rpINTERPOLATORDIRTYSPHERE ), \ ((!((_intrp)->flags & rpINTERPOLATORNOFRAMEDIRTY))? \ ((RpAtomicGetFrame(_atomic))? \ (RwFrameUpdateObjects(RpAtomicGetFrame(_atomic))): \ (0)): \ (0)), \ (_intrp)) /* NB "RpInterpolatorSetEndMorphTarget(interp++, target)" will break it */ #define RpInterpolatorSetEndMorphTargetMacro(_intrp, _target, _atomic) \ ((_intrp)->endMorphTarget = (RwInt16) (_target), \ (_intrp)->flags |= (RwInt32)(rpINTERPOLATORDIRTYINSTANCE | \ rpINTERPOLATORDIRTYSPHERE ), \ ((!((_intrp)->flags & rpINTERPOLATORNOFRAMEDIRTY))? \ ((RpAtomicGetFrame(_atomic))? \ (RwFrameUpdateObjects(RpAtomicGetFrame(_atomic))): \ (0)): \ (0)), \ (_intrp)) /* NB "RpInterpolatorSetValue(interp++, value)" will break it */ #define RpInterpolatorSetValueMacro(_intrp, _value, _atomic) \ ((_intrp)->position = (_value), \ (_intrp)->flags |= (RwInt32)(rpINTERPOLATORDIRTYINSTANCE | \ rpINTERPOLATORDIRTYSPHERE ), \ ((!((_intrp)->flags & rpINTERPOLATORNOFRAMEDIRTY))? \ ((RpAtomicGetFrame(_atomic))? \ (RwFrameUpdateObjects(RpAtomicGetFrame(_atomic))): \ (0)): \ (0)), \ (_intrp)) /* NB "RpInterpolatorSetScale(interp++, *(scale++))" will break it */ #define RpInterpolatorSetScaleMacro(_intrp, _scale, _atomic) \ ((_intrp)->time = (_scale), \ (_intrp)->recipTime = (RwReal) (1.0) / (_scale), \ (_intrp)->flags |= (RwInt32)(rpINTERPOLATORDIRTYINSTANCE | \ rpINTERPOLATORDIRTYSPHERE ), \ ((!((_intrp)->flags & rpINTERPOLATORNOFRAMEDIRTY))? \ ((RpAtomicGetFrame(_atomic))? \ (RwFrameUpdateObjects(RpAtomicGetFrame(_atomic))): \ (0)): \ (0)), \ (_intrp)) #define RpAtomicGetClumpMacro(_atomic) \ ((_atomic)->clump) /* NB "RpAtomicGetBoundingSphere(atomic++)" will break it */ #define RpAtomicGetBoundingSphereMacro(_atomic) \ ((((_atomic)->interpolator.flags & rpINTERPOLATORDIRTYSPHERE)? \ _rpAtomicResyncInterpolatedSphere(_atomic), 0: 0), \ &((_atomic)->boundingSphere)) #define RpAtomicGetFrameMacro(_atomic) \ ((RwFrame *) rwObjectGetParent(_atomic)) /* NB "RpClumpSetFrame(clump++, frame)" will break it */ #if (!defined(RpClumpSetFrameMacro)) #define RpClumpSetFrameMacro(_clump, _frame) \ (rwObjectSetParent(_clump, _frame), \ (_clump)) #endif /* (!defined(RpClumpSetFrameMacro)) */ #if (!defined(RpClumpSetFrameVoidMacro)) #define RpClumpSetFrameVoidMacro(_clump, _frame) \ MACRO_START \ { \ rwObjectSetParent(_clump, _frame); \ } \ MACRO_STOP #endif /* (!defined(RpClumpSetFrameVoidMacro)) */ #define RpClumpGetFrameMacro(_clump) \ ((RwFrame *) rwObjectGetParent(_clump)) /* NB "RpAtomicSetFlags(atomic++, flags)" will break it */ #if (!defined(RpAtomicSetFlagsMacro)) #define RpAtomicSetFlagsMacro(_atomic, _flags) \ (rwObjectSetFlags(_atomic, _flags), \ (_atomic)) #endif /* (!defined(RpAtomicSetFlagsMacro)) */ #define RpAtomicGetFlagsMacro(_atomic) \ (rwObjectGetFlags(_atomic)) #if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) #define RpAtomicRender(_atomic) \ RpAtomicRenderMacro(_atomic) #define RpAtomicGetGeometry(_atomic) \ RpAtomicGetGeometryMacro(_atomic) #define RpAtomicSetRenderCallBack(_atomic, _callback) \ RpAtomicSetRenderCallBackMacro(_atomic, _callback) #define RpAtomicGetRenderCallBack(_atomic) \ RpAtomicGetRenderCallBackMacro(_atomic) #define RpAtomicGetInterpolator(_atomic) \ RpAtomicGetInterpolatorMacro(_atomic) #define RpInterpolatorGetStartMorphTarget(_intrp) \ RpInterpolatorGetStartMorphTargetMacro(_intrp) #define RpInterpolatorGetEndMorphTarget(_intrp) \ RpInterpolatorGetEndMorphTargetMacro(_intrp) #define RpInterpolatorGetValue(_intrp) \ RpInterpolatorGetValueMacro(_intrp) #define RpInterpolatorGetScale(_intrp) \ RpInterpolatorGetScaleMacro(_intrp) #define RpInterpolatorSetStartMorphTarget(_intrp, _target, _atomic) \ RpInterpolatorSetStartMorphTargetMacro(_intrp, _target, _atomic) #define RpInterpolatorSetEndMorphTarget(_intrp, _target, _atomic) \ RpInterpolatorSetEndMorphTargetMacro(_intrp, _target, _atomic) #define RpInterpolatorSetValue(_intrp, _value, _atomic) \ RpInterpolatorSetValueMacro(_intrp, _value, _atomic) #define RpInterpolatorSetScale(_intrp, _scale, _atomic) \ RpInterpolatorSetScaleMacro(_intrp, _scale, _atomic) #define RpAtomicGetClump(_atomic) \ RpAtomicGetClumpMacro(_atomic) #define RpAtomicGetBoundingSphere(_atomic) \ RpAtomicGetBoundingSphereMacro(_atomic) #define RpAtomicGetFrame(_atomic) \ RpAtomicGetFrameMacro(_atomic) #define RpClumpSetFrame(_clump, _frame) \ RpClumpSetFrameMacro(_clump, _frame) #define RpClumpGetFrame(_clump) \ RpClumpGetFrameMacro(_clump) #define RpAtomicSetFlags(_atomic, _flags) \ RpAtomicSetFlagsMacro(_atomic, _flags) #define RpAtomicGetFlags(_atomic) \ RpAtomicGetFlagsMacro(_atomic) #endif /* (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) */ /**************************************************************************** Function prototypes */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Macro version of RpAtomicSetRenderCallBack needs this */ extern RpAtomic * AtomicDefaultRenderCallBack(RpAtomic * atomic); extern void _rpAtomicResyncInterpolatedSphere(RpAtomic * atomic); extern const RwSphere * RpAtomicGetWorldBoundingSphere(RpAtomic * atomic); /* Enumeration */ extern RpClump * RpClumpForAllAtomics(RpClump * clump, RpAtomicCallBack callback, void *pData); extern RpClump * RpClumpForAllLights(RpClump * clump, RpLightCallBack callback, void *pData); extern RpClump * RpClumpForAllCameras(RpClump * clump, RwCameraCallBack callback, void *pData); /* Frames */ extern RpAtomic * RpAtomicSetFrame(RpAtomic * atomic, RwFrame * frame); /* Create a space marking clump */ extern RpClump * RpClumpCreateSpace(const RwV3d * position, RwReal radius); /* Instancing and rendering */ extern RpClump * RpClumpRender(RpClump * clump); extern RpClump * RpClumpRemoveAtomic(RpClump * clump, RpAtomic * atomic); extern RpClump * RpClumpAddAtomic(RpClump * clump, RpAtomic * atomic); extern RpClump * RpClumpRemoveLight(RpClump * clump, RpLight * light); extern RpClump * RpClumpAddLight(RpClump * clump, RpLight * light); extern RpClump * RpClumpRemoveCamera(RpClump * clump, RwCamera * camera); extern RpClump * RpClumpAddCamera(RpClump * clump, RwCamera * camera); /* Creation and destruction of clumps */ extern RwBool RpClumpDestroy(RpClump * clump); extern RpClump * RpClumpCreate(void); extern RpClump * RpClumpClone(RpClump * clump); /* Creation and destruction of atomics*/ extern RwBool RpAtomicDestroy(RpAtomic * atomic); extern RpAtomic * RpAtomicClone(RpAtomic * atomic); extern RpAtomic * RpAtomicCreate(void); /* Setting and getting geometry for an atomic */ extern RpAtomic * RpAtomicSetGeometry(RpAtomic * atomic, RpGeometry * geometry, RwUInt32 flags); /* Frustum callbacks */ extern RpClump * RpClumpSetCallBack(RpClump * clump, RpClumpCallBack callback); extern RpClumpCallBack RpClumpGetCallBack(const RpClump * clump); /* The number of atomics in a clump */ extern RwInt32 RpClumpGetNumAtomics(RpClump * clump); extern RwInt32 RpClumpGetNumLights(RpClump * clump); extern RwInt32 RpClumpGetNumCameras(RpClump * clump); /* Light and camera extensions */ extern RpClump * RpLightGetClump(const RpLight *light); extern RpClump * RwCameraGetClump(const RwCamera *camera); /* Binary format */ extern RwUInt32 RpAtomicStreamGetSize(RpAtomic * atomic); extern RpAtomic * RpAtomicStreamRead(RwStream * stream); extern RpAtomic * RpAtomicStreamWrite(RpAtomic * atomic, RwStream * stream); extern RwUInt32 RpClumpStreamGetSize(RpClump * clump); extern RpClump * RpClumpStreamRead(RwStream * stream); extern RpClump * RpClumpStreamWrite(RpClump * clump, RwStream * stream); extern RpClumpChunkInfo * _rpClumpChunkInfoRead(RwStream * stream, RpClumpChunkInfo * clumpChunkInfo, RwInt32 * bytesRead); /* Attaching toolkits */ extern RwInt32 RpAtomicRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB); extern RwInt32 RpClumpRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB); extern RwInt32 RpAtomicRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB); extern RwInt32 RpAtomicSetStreamAlwaysCallBack(RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB); extern RwInt32 RpAtomicSetStreamRightsCallBack(RwUInt32 pluginID, RwPluginDataChunkRightsCallBack rightsCB); extern RwInt32 RpClumpRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB); extern RwInt32 RpClumpSetStreamAlwaysCallBack(RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB); extern RwInt32 RpAtomicGetPluginOffset(RwUInt32 pluginID); extern RwInt32 RpClumpGetPluginOffset(RwUInt32 pluginID); extern RwBool RpAtomicValidatePlugins(const RpAtomic * atomic); extern RwBool RpClumpValidatePlugins(const RpClump * clump); #if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) extern RwFrame * RpAtomicGetFrame(const RpAtomic * atomic); extern RwFrame * RpClumpGetFrame(const RpClump * clump); extern RpClump * RpClumpSetFrame(RpClump * clump, RwFrame * frame); /* Flags */ extern RpAtomic * RpAtomicSetFlags(RpAtomic * atomic, RwUInt32 flags); extern RwUInt32 RpAtomicGetFlags(const RpAtomic * atomic); extern RwSphere * RpAtomicGetBoundingSphere(RpAtomic * atomic); extern RwInt32 RpInterpolatorGetEndMorphTarget(const RpInterpolator * interpolator); extern RwInt32 RpInterpolatorGetStartMorphTarget(const RpInterpolator * interpolator); extern RwReal RpInterpolatorGetValue(const RpInterpolator * interpolator); extern RwReal RpInterpolatorGetScale(const RpInterpolator * interpolator); extern RpInterpolator * RpInterpolatorSetEndMorphTarget(RpInterpolator * interpolator, RwInt32 morphTarget, RpAtomic * atomic); extern RpInterpolator * RpInterpolatorSetStartMorphTarget(RpInterpolator * interpolator, RwInt32 morphTarget, RpAtomic * atomic); extern RpInterpolator * RpInterpolatorSetValue(RpInterpolator * interpolator, RwReal value, RpAtomic *atomic); extern RpInterpolator * RpInterpolatorSetScale(RpInterpolator * interpolator, RwReal scale, RpAtomic *atomic); extern RpAtomic * RpAtomicRender(RpAtomic * atomic); /* Building clumps */ extern RpClump * RpAtomicGetClump(const RpAtomic * atomic); extern RpInterpolator * RpAtomicGetInterpolator(RpAtomic * atomic); extern RpGeometry * RpAtomicGetGeometry(const RpAtomic * atomic); extern void RpAtomicSetRenderCallBack(RpAtomic * atomic, RpAtomicCallBackRender callback); extern RpAtomicCallBackRender RpAtomicGetRenderCallBack(const RpAtomic * atomic); #endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */ extern RwBool RpAtomicInstance(RpAtomic *atomic); #ifdef __cplusplus } #endif /* __cplusplus */ #define RpClumpChunkInfoRead(stream, clumpChunkInfo, bytesRead) \ _rpClumpChunkInfoRead(stream, clumpChunkInfo, bytesRead) /*--- Automatically derived from: c:/daily/rwsdk/world/baworld.h ---*/ /* * World handling. * World give objects scope, and provide a mechanism for * efficiency static object rendering. * * Copyright (c) 1998 Criterion Software Ltd. * */ /**************************************************************************** Defines */ /* Type ID */ #define rpWORLD 7 /* RpWorld private flags (in RwObject) */ enum RpWorldPrivateFlag { rpWORLDSINGLEMALLOC = 0x01, rpWORLDPRIVATEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RpWorldPrivateFlag RpWorldPrivateFlag; /** * \ingroup rpworlddatatypes * The bit-field type \ref RpWorldFlag specifies the options available * for creating the static geometry component of a world (see API function \ref RpWorldSetFlags): */ enum RpWorldFlag { rpWORLDTRISTRIP = 0x01, /**boundingBox)) #define RpWorldGetOriginMacro(_world) \ (&((_world)->worldOrigin)) #define RpWorldGetNumMaterialsMacro(_world) \ ((_world)->matList.numMaterials) #define RpWorldGetMaterialMacro(_world, _num) \ (((_world)->matList.materials)[(_num)]) #define RpWorldGetNumClumpsMacro(_world) \ ((_world)->numClumpsInWorld) #define RpWorldSetRenderOrderMacro(_world, _renderOrder) \ (((_world)->renderOrder = _renderOrder), (_world)) #define RpWorldGetRenderOrderMacro(_world) \ ((_world)->renderOrder) #define RpWorldSetFlagsMacro(_world, _flags) \ (((_world)->flags = (_flags)), (_world)) #define RpWorldGetFlagsMacro(_world) \ ((_world)->flags) #if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) #define RpWorldGetBBox(_world) \ RpWorldGetBBoxMacro(_world) #define RpWorldGetOrigin(_world) \ RpWorldGetOriginMacro(_world) #define RpWorldGetNumMaterials(_world) \ RpWorldGetNumMaterialsMacro(_world) #define RpWorldGetMaterial(_world, _num) \ RpWorldGetMaterialMacro(_world, _num) #define RpWorldGetNumClumps(_world) \ RpWorldGetNumClumpsMacro(_world) #define RpWorldSetRenderOrder(_world, _renderOrder) \ RpWorldSetRenderOrderMacro(_world, _renderOrder) #define RpWorldGetRenderOrder(_world) \ RpWorldGetRenderOrderMacro(_world) #define RpWorldSetFlags(_world, _flags) \ RpWorldSetFlagsMacro(_world, _flags) #define RpWorldGetFlags(_world) \ RpWorldGetFlagsMacro(_world) #endif /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ /**************************************************************************** Global types */ /** * \ingroup rpworlddatatypes * \ref RpWorldRenderOrder * represents the options available for * the rendering order of world sectors in the camera's view frustum (see * API function \ref RpWorldSetRenderOrder). */ enum RpWorldRenderOrder { rpWORLDRENDERNARENDERORDER = 0, rpWORLDRENDERFRONT2BACK, /**pipeline = _pipeline), _world ) #define RpWorldGetSectorPipelineMacro(_world, _pipeline) \ ( (*(_pipeline) = (_world)->pipeline), _world ) #define RpWorldSectorSetPipelineMacro(_sector, _pipeline) \ ( ((_sector)->pipeline = _pipeline), _sector ) #define RpWorldSectorGetPipelineMacro(_sector, _pipeline) \ ( (*(_pipeline) = (_sector)->pipeline), _sector ) #define RpAtomicGetGenericPipelineMacro() \ (RXPIPELINEGLOBAL(genericAtomicPipeline)) #define RpAtomicGetDefaultPipelineMacro() \ (RXPIPELINEGLOBAL(currentAtomicPipeline)) #define RpAtomicSetPipelineMacro(_atomic, _pipeline) \ ( ((_atomic)->pipeline = _pipeline), _atomic ) #define RpAtomicGetPipelineMacro(_atomic, _pipeline) \ ( (*(_pipeline) = (_atomic)->pipeline), _atomic ) #define RpMaterialGetGenericPipelineMacro() \ (RXPIPELINEGLOBAL(genericMaterialPipeline)) #define RpMaterialGetDefaultPipelineMacro() \ (RXPIPELINEGLOBAL(currentMaterialPipeline)) #define RpMaterialSetPipelineMacro(_material, _pipeline) \ ( ((_material)->pipeline = _pipeline), _material ) #define RpMaterialGetPipelineMacro(_material, _pipeline) \ ( (*(_pipeline) = (_material)->pipeline), _material ) #if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) #define RpWorldGetGenericSectorPipeline RpWorldGetGenericSectorPipelineMacro #define RpWorldGetDefaultSectorPipeline RpWorldGetDefaultSectorPipelineMacro #define RpWorldSetSectorPipeline RpWorldSetSectorPipelineMacro #define RpWorldGetSectorPipeline RpWorldGetSectorPipelineMacro #define RpWorldSectorSetPipeline RpWorldSectorSetPipelineMacro #define RpWorldSectorGetPipeline RpWorldSectorGetPipelineMacro #define RpAtomicGetGenericPipeline RpAtomicGetGenericPipelineMacro #define RpAtomicGetDefaultPipeline RpAtomicGetDefaultPipelineMacro #define RpAtomicSetPipeline RpAtomicSetPipelineMacro #define RpAtomicGetPipeline RpAtomicGetPipelineMacro #define RpMaterialGetGenericPipeline RpMaterialGetGenericPipelineMacro #define RpMaterialGetDefaultPipeline RpMaterialGetDefaultPipelineMacro #define RpMaterialSetPipeline RpMaterialSetPipelineMacro #define RpMaterialGetPipeline RpMaterialGetPipelineMacro #endif /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern RxPipeline *RpWorldSetDefaultSectorPipeline(RxPipeline *pipeline); extern RxPipeline *RpAtomicSetDefaultPipeline(RxPipeline *pipeline); extern RxPipeline *RpMaterialSetDefaultPipeline(RxPipeline *pipeline); #if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) extern RxPipeline *RpWorldGetGenericSectorPipeline(void); extern RxPipeline *RpWorldGetDefaultSectorPipeline(void); extern RpWorld *RpWorldSetSectorPipeline(RpWorld *world, RxPipeline *pipeline); extern RpWorld *RpWorldGetSectorPipeline(RpWorld *world, RxPipeline **pipeline); extern RpWorldSector *RpWorldSectorSetPipeline(RpWorldSector *sector, RxPipeline *pipeline); extern RpWorldSector *RpWorldSectorGetPipeline(RpWorldSector *sector, RxPipeline **pipeline); extern RxPipeline *RpAtomicGetGenericPipeline(void); extern RxPipeline *RpAtomicGetDefaultPipeline(void); extern RpAtomic *RpAtomicSetPipeline(RpAtomic *atomic, RxPipeline *pipeline); extern const RpAtomic *RpAtomicGetPipeline(const RpAtomic *const atomic, RxPipeline **pipeline); extern RxPipeline *RpMaterialGetGenericPipeline(void); extern RxPipeline *RpMaterialGetDefaultPipeline(void); extern RpMaterial *RpMaterialSetPipeline(RpMaterial *material, RxPipeline *pipeline); extern RpMaterial *RpMaterialGetPipeline(RpMaterial *material, RxPipeline **pipeline); #endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ extern const RpGeometry *RpGeometryIsCorrectlySorted(const RpGeometry * geometry, RwBool * result); extern RpGeometry *RpGeometrySortByMaterial(const RpGeometry * geometry, RpGeometrySortByMaterialCallBack callback); #ifdef __cplusplus } #endif /* __cplusplus */ /* LEGACY-SUPPORT macros */ #define RpWorldGetGenericSectorInstancePipeline RpWorldGetGenericSectorPipeline #define RpWorldSetDefaultSectorInstancePipeline RpWorldSetDefaultSectorPipeline #define RpWorldGetDefaultSectorInstancePipeline RpWorldGetDefaultSectorPipeline #define RpWorldSetSectorInstancePipeline RpWorldSetSectorPipeline #define RpWorldGetSectorInstancePipeline RpWorldGetSectorPipeline #define RpWorldSectorSetInstancePipeline RpWorldSectorSetPipeline #define RpWorldSectorGetInstancePipeline RpWorldSectorGetPipeline #define RpAtomicGetGenericInstancePipeline RpAtomicGetGenericPipeline #define RpAtomicGetDefaultInstancePipeline RpAtomicGetDefaultPipeline #define RpAtomicSetDefaultInstancePipeline RpAtomicSetDefaultPipeline #define RpAtomicSetInstancePipeline RpAtomicSetPipeline #define RpAtomicGetInstancePipeline RpAtomicGetPipeline #define RpMaterialGetGenericRenderPipeline RpMaterialGetGenericPipeline #define RpMaterialSetDefaultRenderPipeline RpMaterialSetDefaultPipeline #define RpMaterialGetDefaultRenderPipeline RpMaterialGetDefaultPipeline #define RpMaterialSetRenderPipeline RpMaterialSetPipeline #define RpMaterialGetRenderPipeline RpMaterialGetPipeline /*--- Automatically derived from: c:/daily/rwsdk/world/baworobj.h ---*/ /**************************************************************************** Function prototypes */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Adding and removing cameras to/from the world */ extern RpWorld *RpWorldRemoveCamera(RpWorld *world, RwCamera *camera); extern RpWorld *RpWorldAddCamera(RpWorld *world, RwCamera *camera); extern RpWorld *RwCameraGetWorld(const RwCamera *camera); /* Adding and removing atomics to/from the world */ extern RpWorld *RpWorldRemoveAtomic(RpWorld *world, RpAtomic *atomic); extern RpWorld *RpWorldAddAtomic(RpWorld *world, RpAtomic *atomic); extern RpWorld *RpAtomicGetWorld(const RpAtomic *atomic); /* Adding and removing clumps to/from the world */ extern RpWorld *RpWorldAddClump(RpWorld *world, RpClump *clump); extern RpWorld *RpWorldRemoveClump(RpWorld *world, RpClump *clump); extern RpWorld *RpClumpGetWorld(const RpClump *clump); /* Adding and removing lights to/from the world */ extern RpWorld *RpWorldAddLight(RpWorld *world, RpLight *light); extern RpWorld *RpWorldRemoveLight(RpWorld *world, RpLight *light); extern RpWorld *RpLightGetWorld(const RpLight *light); /* Finding whats in the view frustum */ extern RwCamera *RwCameraForAllClumpsInFrustum(RwCamera *camera, void *data); extern RwCamera *RwCameraForAllClumpsNotInFrustum(RwCamera *camera, RwInt32 numClumps, void *data); extern RwCamera *RwCameraForAllSectorsInFrustum(RwCamera *camera, RpWorldSectorCallBack callBack, void *pData); /* Enumeration involving the world sectors */ extern RpLight *RpLightForAllWorldSectors(RpLight *light, RpWorldSectorCallBack callback, void *data); extern RpAtomic *RpAtomicForAllWorldSectors(RpAtomic *atomic, RpWorldSectorCallBack callback, void *data); extern RpWorldSector *RpWorldSectorForAllAtomics(RpWorldSector *sector, RpAtomicCallBack callback, void *data); extern RpWorldSector *RpWorldSectorForAllCollisionAtomics(RpWorldSector *sector, RpAtomicCallBack callback, void *data); extern RpWorldSector *RpWorldSectorForAllLights(RpWorldSector *sector, RpLightCallBack callback, void *data); #ifdef __cplusplus } #endif /* __cplusplus */ /*--- Automatically derived from: c:/daily/rwsdk/world/babinwor.h ---*/ /**************************************************************************** Global types */ /* Binary Representation * */ typedef struct RpWorldChunkInfoSector RpWorldSectorChunkInfo; typedef struct RpWorldChunkInfoSector _rpWorldSector; struct RpWorldChunkInfoSector { RwInt32 matListWindowBase; RwInt32 numPolygons; RwInt32 numVertices; RwV3d inf; RwV3d sup; RwBool collSectorPresent; RwBool unused; }; typedef struct RpPlaneSectorChunkInfo RpPlaneSectorChunkInfo; typedef struct RpPlaneSectorChunkInfo _rpPlaneSector; struct RpPlaneSectorChunkInfo { RwInt32 type; RwReal value; RwBool leftIsWorldSector; RwBool rightIsWorldSector; RwReal leftValue; RwReal rightValue; }; typedef struct RpWorldChunkInfo RpWorldChunkInfo; typedef struct RpWorldChunkInfo _rpWorld; struct RpWorldChunkInfo { RwBool rootIsWorldSector; RwV3d invWorldOrigin; RwSurfaceProperties surfaceProps; RwInt32 numPolygons; RwInt32 numVertices; RwInt32 numPlaneSectors; RwInt32 numWorldSectors; RwInt32 colSectorSize; RwInt32 format; /* Flags about the world */ }; /**************************************************************************** Function prototypes */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Binary format */ extern RwUInt32 RpWorldStreamGetSize(const RpWorld *world); extern RpWorld *RpWorldStreamRead(RwStream *stream); extern const RpWorld *RpWorldStreamWrite(const RpWorld *world, RwStream *stream); extern RpWorldSectorChunkInfo * _rpWorldSectorChunkInfoRead(RwStream *stream, RpWorldSectorChunkInfo *worldSectorChunkInfo, RwInt32 *bytesRead); extern RpPlaneSectorChunkInfo * _rpPlaneSectorChunkInfoRead(RwStream *stream, RpPlaneSectorChunkInfo *planeSectorChunkInfo, RwInt32 *bytesRead); extern RpWorldChunkInfo * _rpWorldChunkInfoRead(RwStream *stream, RpWorldChunkInfo *worldChunkInfo, RwInt32 *bytesRead); #ifdef __cplusplus } #endif /* __cplusplus */ #define RpWorldSectorChunkInfoRead(stream, worldSectorChunkInfo, bytesRead) \ _rpWorldSectorChunkInfoRead(stream, worldSectorChunkInfo, bytesRead) #define RpPlaneSectorChunkInfoRead(stream, planeSectorChunkInfo, bytesRead) \ _rpPlaneSectorChunkInfoRead(stream, planeSectorChunkInfo, bytesRead) #define RpWorldChunkInfoRead(stream, worldChunkInfo, bytesRead) \ _rpWorldChunkInfoRead(stream, worldChunkInfo, bytesRead) #endif /* RPWORLD_H */