From 9e496100b7baff8834658f577d3138d9f8fc3765 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 18 May 2019 12:39:39 +0200 Subject: more work on CPhysical --- rwsdk/include/d3d8/rwcore.h | 4791 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 4791 insertions(+) create mode 100644 rwsdk/include/d3d8/rwcore.h (limited to 'rwsdk/include/d3d8/rwcore.h') diff --git a/rwsdk/include/d3d8/rwcore.h b/rwsdk/include/d3d8/rwcore.h new file mode 100644 index 00000000..b9214c63 --- /dev/null +++ b/rwsdk/include/d3d8/rwcore.h @@ -0,0 +1,4791 @@ +/******************************************/ +/* */ +/* 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:00 2002 + * + ************************************************************************/ + +#ifndef RWCORE_H +#define RWCORE_H + +/*--- System Header Files ---*/ +#include + + +/*--- Automatically derived from: C:/daily/rwsdk/driver/common/barwasmm.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/p2resort.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/p2macros.h ---*/ + +#define RxClusterDecCursorByStride(_cluster, _stride) \ + ((_cluster)->currentData = \ + (void *)(((RwUInt8 *)(_cluster)->currentData) - \ + (_stride))) + +#define RxClusterDecCursor(_cluster) \ + RxClusterDecCursorByStride(_cluster, (_cluster)->stride) + +#define RxClusterIncCursorByStride(_cluster, _stride) \ + ((_cluster)->currentData = \ + (void *)(((RwUInt8 *)(_cluster)->currentData) + \ + (_stride))) + +#define RxClusterIncCursor(_cluster) \ + RxClusterIncCursorByStride(_cluster, (_cluster)->stride) + +#define RxClusterResetCursor(_cluster) \ + ((_cluster)->currentData = (_cluster)->data) + +#define RxClusterGetCursorData(_cluster, _type) \ + ((_type *)(_cluster)->currentData) + +#define RxClusterGetIndexedData(_cluster, _type, _index) \ + ((_type *)(((RwUInt8 *)(_cluster)->data) + (_cluster)->stride*(_index))) + +#define RxClusterGetFreeIndex(_cluster) ( (_cluster)->numUsed++ ) + +#define RxPipelineClusterAssertAttributeSet(_cluster, _attributeSet) \ + RWASSERT( (_cluster)->clusterRef->attributeSet != NULL && \ + rwstrcmp((_cluster)->clusterRef->attributeSet, \ + (_attributeSet)) == 0 ) + +#define RxPipelineNodeParamGetData(_param) \ + ( (_param)->dataParam ) + +#define RxPipelineNodeParamGetHeap(_param) \ + ( (_param)->heap ) + + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/p2heap.h ---*/ + +#if (defined(RWDEBUG) && (defined(RWMEMDEBUG))) + +#if (!defined(DISABLERWHEAP)) +#define DISABLERWHEAP +#endif /* (!defined(DISABLERWHEAP)) */ + +#endif /* (defined(RWDEBUG) && (defined(RWMEMDEBUG))) */ + +typedef struct rxHeapFreeBlock rxHeapFreeBlock; +typedef struct rxHeapSuperBlockDescriptor rxHeapSuperBlockDescriptor; +typedef struct RxHeap RxHeap; +typedef struct rxHeapBlockHeader rxHeapBlockHeader; + +struct rxHeapFreeBlock +{ + RwUInt32 size; + rxHeapBlockHeader *ptr; +}; + +struct rxHeapSuperBlockDescriptor +{ + void *start; + RwUInt32 size; + rxHeapSuperBlockDescriptor *next; +}; + +/** + * \ingroup rwcoregeneric + * \struct RxHeap + * structure describing a pipeline execution heap + */ +struct RxHeap +{ + RwUInt32 superBlockSize; /**< Granularity of heap growth */ + rxHeapSuperBlockDescriptor *head; /**< Internally used superblock pointer */ + rxHeapBlockHeader *headBlock; /**< Internally used block pointer */ + rxHeapFreeBlock *freeBlocks; /**< Internally used free blocks pointer */ + RwUInt32 entriesAlloced; /**< Number of entries allocated */ + RwUInt32 entriesUsed; /**< Number of entries used */ + RwBool dirty; /**< Internally used boolean, flags whether + * the heap needs resetting or not. */ +}; + +struct rxHeapBlockHeader +{ + /* present in all blocks (used & unused) */ + rxHeapBlockHeader *prev, *next; + RwUInt32 size; + rxHeapFreeBlock *freeEntry; /* (or null) */ + RwUInt32 pad[4]; /* alignment padding to 32 bytes */ +}; + +/* This wrapper cheaply early-outs when a heap doesn't *need* resetting */ +#define RxHeapReset(heap) \ + ((FALSE == (heap)->dirty) ? (TRUE) : (_rxHeapReset(heap))) + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxHeap *RxHeapCreate(RwUInt32 size); +extern void RxHeapDestroy(RxHeap * heap); +extern RwBool _rxHeapReset(RxHeap * heap); +extern void *RxHeapAlloc(RxHeap * heap, RwUInt32 size); +extern void RxHeapFree(RxHeap * heap, void *block); +extern void *RxHeapRealloc(RxHeap * heap, void *block, + RwUInt32 newSize, RwBool allowCopy); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#if (defined(DISABLERWHEAP)) + +typedef struct rxHeapMallocTrace rxHeapMallocTrace; +struct rxHeapMallocTrace +{ + rxHeapMallocTrace *next; + rxHeapBlockHeader *block; +}; + +#endif /* (defined(DISABLERWHEAP)) */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/p2dep.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/p2core.h ---*/ + +extern RwInt32 _rxPipelineMaxNodes; +extern RwInt32 _rxHeapInitialSize; +/* LEGACY-SUPPORT MACRO */ +#define _rwRxHeapInitialSize _rxHeapInitialSize + +/* Beneficial padding of PowerPipe types is still being worked out... */ +#define PADCLUSTERSx + + +/************************************************************* + * Global Defines + */ + +#define RWBOOLTOGGLE(bVar) ((bVar == FALSE)?(bVar = TRUE):(bVar = FALSE)) + +/* Both these currently limited due to the use of RwUInt32 bit-fields */ +#define RXNODEMAXCLUSTERSOFINTEREST 32 +#define RXNODEMAXOUTPUTS 32 + +/* Useful (for memory alloc) to limit this during pipeline construction */ +#define RXPIPELINEDEFAULTMAXNODES 64 + +/* + * Cluster flags + */ + +#define rxCLFLAGS_NULL ((RwUInt16) 0x0000U) +#define rxCLFLAGS_CLUSTERVALID ((RwUInt16) 0x0001U) +#define rxCLFLAGS_EXTERNAL ((RwUInt16) 0x0002U) +#define rxCLFLAGS_EXTERNALMODIFIABLE ((RwUInt16) 0x0004U | 0x0002U) +#define rxCLFLAGS_MODIFIED ((RwUInt16) 0x0008U) + +/* + * Packet flags + */ + +#define rxPKFLAGS_NULL ((RwUInt16) 0x0000U) + +/* + * used in input specification + */ + +/** + * \ingroup rwcoregeneric + * \ref RxClusterValidityReq + * Flags specifying the state requirements for + * a \ref RxCluster on entry to a node */ +enum RxClusterValidityReq +{ + rxCLREQ_DONTWANT = 0, /**inputToClusterSlot[(CLIND)]) + +#define RxClusterLockRead(PKT, CLIND) \ + ( (((RwInt32)RXCLSLOT(PKT, CLIND)) == -1) ? \ + ((RxCluster *)NULL) : \ + (RxClusterResetCursor(&PKT->clusters[RXCLSLOT(PKT, CLIND)]), \ + &PKT->clusters[RXCLSLOT(PKT, CLIND)]) ) + +#endif /* !RWDEBUG */ + +extern RxCluster * +RxClusterLockWrite(RxPacket * packet, + RwUInt32 clusterIndex, + RxPipelineNode * node); + +extern void +RxClusterUnlock(RxCluster * cluster); + +extern RwUInt32 +RxPipelineNodeSendConfigMsg(RxPipelineNode * dest, + RwUInt32 msg, + RwUInt32 intparam, + void *ptrparam); + +extern RxPipelineNode * +RxPipelineNodeForAllConnectedOutputs(RxPipelineNode * node, + RxPipeline * pipeline, + RxPipelineNodeOutputCallBack callbackfn, + void *callbackdata); + +/* Cluster attributes api [pipeline construction time] */ + +extern RxPipelineCluster * +RxPipelineNodeGetPipelineCluster(RxPipelineNode *node, + RwUInt32 clustersOfInterestIndex); + +extern RwUInt32 +RxPipelineClusterGetCreationAttributes(RxPipelineCluster *cluster); + +extern RxPipelineCluster * +RxPipelineClusterSetCreationAttributes(RxPipelineCluster *cluster, + RwUInt32 creationAttributes); + +/* Cluster attributes api [pipeline execution time] */ + +extern RwUInt32 +RxClusterGetAttributes(RxCluster *cluster); + +extern RxCluster * +RxClusterSetAttributes(RxCluster *cluster, RwUInt32 attributes); + + +extern void +_rxEmbeddedPacketBetweenPipelines(RxPipeline * fromPipeline, + RxPipeline * toPipeline); + +extern RxPipelineNode * +_rxEmbeddedPacketBetweenNodes(RxPipeline *pipeline, + RxPipelineNode *nodeFrom, + RwUInt32 whichOutput); + +extern RxExecutionContext _rxExecCtxGlobal; + +/* Summary of dispatch rules: + * o nodes that never fetch are safe to dispatch NULL, whether + * nodes above pass them a packet or not + * o if you destroy the packet you can dispatch(NULL,,) + * o if you fetch/create and dispatch(NULL), it doesn't really + * matter - the packet'll get passed on anyway */ + +/* TODO: there's currently no way to prematurely terminate the pipeline + * without doing so as an error condition. You should create an + * enum for the exit code, either RXNODEEXITCONTINUE, RXNODEEXITTERMINATE + * or RXNODEEXTTERMINATEERROR and then test for RXNODEEXITCONTINUE in + * the below macros rather than FALSE. */ + +/* TODO: _packet redundant here... create a new macro and legacy wrapper */ +#define rxPacketDispatchMacro(_packet, _output, _self) \ +MACRO_START \ +{ \ + RxPipeline *curPipeline = _rxExecCtxGlobal.pipeline; \ + \ + /* _packet is now an obsolete parameter */ \ + \ + if ( FALSE != _rxExecCtxGlobal.exitCode ) \ + { \ + RxPipelineNode *nextNode = \ + _rxEmbeddedPacketBetweenNodes(curPipeline, \ + _self, \ + (_output)); \ + if ( nextNode != NULL ) \ + { \ + RwUInt32 exitCode = \ + nextNode->nodeDef->nodeMethods.nodeBody( \ + nextNode, &(_rxExecCtxGlobal.params)); \ + /* Don't overwrite 'error' with 'success' */ \ + if (FALSE == exitCode) _rxExecCtxGlobal.exitCode = exitCode; \ + } \ + } \ + if ( curPipeline->embeddedPacketState > rxPKST_UNUSED \ + /* !UNUSED and !PACKETLESS */ ) \ + { \ + curPipeline->embeddedPacketState = rxPKST_INUSE; \ + _rxPacketDestroy(curPipeline->embeddedPacket); \ + } \ +} \ +MACRO_STOP + +/* TODO: _self redundant here... create a new macro and legacy wrapper */ +#define rxPacketDispatchToPipelineMacro(_packet, _pipeline, _self) \ +MACRO_START \ +{ \ + RxPipeline *toPipeline = (_pipeline); \ + \ + /* _packet is now an obsolete parameter */ \ + \ + if ( FALSE != _rxExecCtxGlobal.exitCode ) \ + { \ + RwUInt32 exitCode; \ + RxPipeline *fromPipeline = _rxExecCtxGlobal.pipeline; /* save */ \ + _rxEmbeddedPacketBetweenPipelines(fromPipeline, \ + toPipeline); \ + _rxExecCtxGlobal.pipeline = toPipeline; /* modify */ \ + exitCode = \ + toPipeline->nodes[0].nodeDef->nodeMethods.nodeBody( \ + &toPipeline->nodes[0], &(_rxExecCtxGlobal.params)); \ + if ( FALSE == exitCode ) _rxExecCtxGlobal.exitCode = exitCode; \ + _rxExecCtxGlobal.pipeline = fromPipeline; /* restore */ \ + } \ + if ( toPipeline->embeddedPacketState > rxPKST_UNUSED \ + /* !UNUSED and !PACKETLESS */ ) \ + { \ + toPipeline->embeddedPacketState = rxPKST_INUSE; \ + _rxPacketDestroy(toPipeline->embeddedPacket); \ + } \ +} \ +MACRO_STOP + +#define rxPacketFetchMacro(_node) \ + ( ((_rxExecCtxGlobal.pipeline)->embeddedPacketState == rxPKST_PENDING) ?\ + ((_rxExecCtxGlobal.pipeline)->embeddedPacketState = rxPKST_INUSE, \ + (_rxExecCtxGlobal.pipeline)->embeddedPacket) : \ + (NULL) ) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/d3d8/nodeD3D8SubmitNoLight.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/p2define.h ---*/ + +/** + * \ingroup rwcoregeneric + * \typedef RxNodeOutput + * typedef for a reference to an output of a pipeline node */ +typedef RwUInt32 *RxNodeOutput; + +/** + * \ingroup rwcoregeneric + * \typedef RxNodeInput + * typedef for a reference to the input of a pipeline node */ +typedef RxPipelineNode *RxNodeInput; + +/** + * \ingroup rwcoregeneric + * \typedef RxLockedPipe + * typedef for a reference to a locked pipeline + */ +typedef RxPipeline RxLockedPipe; + + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + +/* PIPELINENODE API */ + +extern RxNodeOutput +RxPipelineNodeFindOutputByName(RxPipelineNode *node, + const RwChar *outputname); + +extern RxNodeOutput +RxPipelineNodeFindOutputByIndex(RxPipelineNode *node, + RwUInt32 outputindex); + +extern RxNodeInput +RxPipelineNodeFindInput(RxPipelineNode *node); + +extern RxNodeDefinition * +RxPipelineNodeCloneDefinition(RxPipelineNode *node, + RxClusterDefinition *cluster2add); + +extern RxPipeline * +RxPipelineNodeRequestCluster(RxPipeline *pipeline, + RxPipelineNode *node, + RxClusterDefinition *clusterDef); + +extern RxPipeline * +RxPipelineNodeReplaceCluster(RxPipeline *pipeline, + RxPipelineNode *node, + RxClusterDefinition *oldClusterDef, + RxClusterDefinition *newClusterDef); + +extern void * +RxPipelineNodeGetInitData(RxPipelineNode *node); + +extern void * +RxPipelineNodeCreateInitData(RxPipelineNode *node, + RwUInt32 size); + +/* PIPELINE MANIPULATION API */ + +extern RxPipeline * +RxPipelineClone(RxPipeline *pipeline); + +extern RxPipelineNode * +RxPipelineFindNodeByName(RxPipeline *pipeline, + const RwChar *name, + RxPipelineNode *start, + RwInt32 *nodeIndex); + +extern RxPipelineNode * +RxPipelineFindNodeByIndex(RxPipeline *pipeline, + RwUInt32 nodeindex); + +extern RxLockedPipe * +RxPipelineLock(RxPipeline *pipeline); + +extern RxPipeline * +RxLockedPipeUnlock(RxLockedPipe *pipeline); + + +extern RxLockedPipe * +RxLockedPipeAddFragment(RxLockedPipe *pipeline, + RwUInt32 *firstIndex, + RxNodeDefinition *nodeDef0, + ...); + + +extern RxPipeline * +RxLockedPipeReplaceNode(RxLockedPipe *pipeline, + RxPipelineNode *node, + RxNodeDefinition *nodeDef); + +extern RxPipeline * +RxLockedPipeDeleteNode(RxLockedPipe *pipeline, + RxPipelineNode *node); + + +extern RxPipeline * +RxLockedPipeSetEntryPoint(RxLockedPipe *pipeline, + RxNodeInput in); + + +extern RxPipelineNode * +RxLockedPipeGetEntryPoint(RxLockedPipe *pipeline); + + +extern RxPipeline * +RxLockedPipeAddPath(RxLockedPipe *pipeline, + RxNodeOutput out, + RxNodeInput in); + +extern RxPipeline * +RxLockedPipeDeletePath(RxLockedPipe *pipeline, + RxNodeOutput out, + RxNodeInput in); + + +extern RxPipeline * +RxPipelineInsertDebugNode(RxPipeline *pipeline, + RxPipelineNode *before, + RxPipelineNode *after, + RxNodeDefinition *debugNode); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/p2altmdl.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeTransform.h ---*/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxNodeDefinition *RxNodeDefinitionGetTransform(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeSubmitTriangle.h ---*/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxNodeDefinition * RxNodeDefinitionGetSubmitTriangle(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeSubmitLine.h ---*/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxNodeDefinition * RxNodeDefinitionGetSubmitLine(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeScatter.h ---*/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxNodeDefinition * RxNodeDefinitionGetScatter(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeClone.h ---*/ + +typedef struct RxPacketCacheCluster RxPacketCacheCluster; + +/** + * \ingroup rwcoregeneric + * \struct RxPacketCacheCluster + * structure containing a cache of an \ref RxCluster's + * within an \ref RxPacketCache + */ +struct RxPacketCacheCluster +{ + RwUInt32 slot; /**< A \ref RwUInt32 index into the \ref RxPacketCache's + * array of RxPacketCacheCluster's */ + RwUInt16 flags; /**< A cache of the original cluster's flags */ + RwUInt16 stride; /**< A cache of the original cluster's stride */ + void *data; /**< A cache of the original cluster's data */ + RwUInt32 numAlloced; /**< A cache of the original cluster's numAlloced */ + RwUInt32 numUsed; /**< A cache of the original cluster's numUsed */ + RxPipelineCluster *clusterRef; /**< A cache of the original cluster's \ref RxPipelineCluster */ +}; +typedef struct RxPacketCache RxPacketCache; + +/** + * \ingroup rwcoregeneric + * \struct RxPacketCache + * structure containing a cache of a \ref RxPacket */ +struct RxPacketCache +{ + RwUInt16 packetFlags; /**< A cache of the original packet's flags */ + RwUInt16 pad[1]; /**< Alignment padding */ + RwUInt32 numClusters; /**< The number of present clusters in the + * original packet when it was cloned */ + RwBool lastCloneDone;/**< Once the cache has been cloned by \ref RxPacketCacheClone + * with (lastClone == TRUE), it should not be used again! */ + RwUInt32 pad2[1]; /**< Alignment padding */ + RxPacketCacheCluster clusters[1]; /**< An array of \ref RxPacketCacheCluster's, + * extending beyond 1 element */ +}; + + +typedef struct RxNodeCloneInitData RxNodeCloneInitData; +/** + * \ingroup rwcoregeneric + * \struct RxNodeCloneInitData + * structure with which to initialize + * clone a \ref RxNodeDefinition, + * through \ref RxNodeDefinitionCloneCreate and + * set up cloned \ref RxPipelineNode modes, through + * \ref RxPipelineNodeCloneDefineModes */ +struct RxNodeCloneInitData +{ + RwUInt32 numModes; /**< Specifies the number of modes in + which the node should operate */ + RwUInt32 numOutputs; /**< Specifies the number of outputs of this + Clone node, which is also the maximum + number of outputs to which any one mode + may dispatch packets */ + RwUInt32 *modeSizes; /**< Specifies the number of outputs to which + each mode dispatches packets */ + RwUInt32 **modes; /**< An array of numModes pointers to arrays + (of length numOutputs) specifying the + outputs, in order, to which each mode + should dispatch packets (output zero is + the first output) */ +}; + +/** + * \ingroup rwcoregeneric + * \struct RxNodeCloneData + * structure which is the private + * data of Clone nodes \ref RxPipelineNode */ +typedef struct RxNodeCloneData RxNodeCloneData; +struct RxNodeCloneData +{ + RwBool optimized; /**< \ref RwBool specifying whether \ref RxPipelineNodeCloneOptimize + * has been run on this \ref RxPipelineNode yet */ + RwUInt32 currentMode; /**< \ref RwUInt32 The current mode of operation */ + RxNodeCloneInitData *data;/**< A pointer to \ref RxNodeCloneInitData data + * specifying the modes of operation */ +}; + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxNodeDefinition *RxNodeDefinitionCloneCreate(RxNodeCloneInitData *data); +extern RwBool RxPipelineNodeCloneDefineModes( + RxPipeline *pipeline, + RxPipelineNode *node, + RxNodeCloneInitData *data); +extern RwBool RxNodeDefinitionCloneDestroy(RxNodeDefinition *def); +extern RwBool RxPipelineNodeCloneOptimize(RxPipeline *pipeline, + RxPipelineNode *node); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeImmStash.h ---*/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxNodeDefinition *RxNodeDefinitionGetImmStash(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeImmRenderSetup.h ---*/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxNodeDefinition * RxNodeDefinitionGetImmRenderSetup(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeImmMangleTriangleIndices.h ---*/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxNodeDefinition *RxNodeDefinitionGetImmMangleTriangleIndices(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeImmMangleLineIndices.h ---*/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxNodeDefinition * RxNodeDefinitionGetImmMangleLineIndices(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeImmInstance.h ---*/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxNodeDefinition * RxNodeDefinitionGetImmInstance(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeCullTriangle.h ---*/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxNodeDefinition * RxNodeDefinitionGetCullTriangle(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeClipTriangle.h ---*/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxNodeDefinition *RxNodeDefinitionGetClipTriangle(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeClipLine.h ---*/ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RxNodeDefinition *RxNodeDefinitionGetClipLine(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/driver/d3d8/d3d8texdic.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/driver/d3d8/d3d8rendst.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/driver/d3d8/d3d8raster.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/driver/d3d8/d3d8device.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/driver/d3d8/d3d8convrt.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/driver/d3d8/d3d82drend.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/driver/common/ssematml.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/driver/common/cpuext.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/driver/common/palquant.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/driver/common/datblkcb.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/src/baraster.h ---*/ + +/**************************************************************************** + Defines + */ + +/** + * \ingroup datatypes + * \ref RwRasterLockMode represents the options available for locking + * a raster so that it may be modified (see API function \ref RwRasterLock). An + * application may wish to write to the raster, read from the raster or + * simultaneously write and read a raster (rwRASTERLOCKWRITE | rwRASTERLOCKREAD). + */ +enum RwRasterLockMode +{ + rwRASTERLOCKWRITE = 0x01, /** + *
  • The pixel color format corresponding to one of the following values:- + *
      + *
    • rwRASTERFORMAT1555 + *
    • rwRASTERFORMAT565 + *
    • rwRASTERFORMAT4444 + *
    • rwRASTERFORMATLUM8 + *
    • rwRASTERFORMAT8888 + *
    • rwRASTERFORMAT888 + *
    • rwRASTERFORMAT16 + *
    • rwRASTERFORMAT24 + *
    • rwRASTERFORMAT32 + *
    • rwRASTERFORMAT555 + *
    + * This value may be masked out of the raster format using + * rwRASTERFORMATPIXELFORMATMASK. + *
  • The palette depth if the raster is palettized:- + *
      + *
    • rwRASTERFORMATPAL4 + *
    • rwRASTERFORMATPAL8 + *
    + * In these cases, the color format refers to that of the palette. + *
  • Flag rwRASTERFORMATMIPMAP. Set if the raster contains mipmap levels. + *
  • Flag rwRASTERFORMATAUTOMIPMAP. Set if the mipmap levels were generated + * automatically by RenderWare. + * + */ +enum RwRasterFormat +{ + rwRASTERFORMATDEFAULT = 0x0000, /* Whatever the hardware likes best */ + + rwRASTERFORMAT1555 = 0x0100, /**<16 bits - 1 bit alpha, 5 bits red, green and blue */ + rwRASTERFORMAT565 = 0x0200, /**<16 bits - 5 bits red and blue, 6 bits green */ + rwRASTERFORMAT4444 = 0x0300, /**<16 bits - 4 bits per component */ + rwRASTERFORMATLUM8 = 0x0400, /**width) + +#define RwRasterGetHeightMacro(_raster) \ + ((_raster)->height) + +#define RwRasterGetStrideMacro(_raster) \ + ((_raster)->stride) + +#define RwRasterGetDepthMacro(_raster) \ + ((_raster)->depth) + +#define RwRasterGetFormatMacro(_raster) \ + ((((_raster)->cFormat) & (rwRASTERFORMATMASK >> 8)) << 8) + +#define RwRasterGetTypeMacro(_raster) \ + (((_raster)->cType) & rwRASTERTYPEMASK) + +#define RwRasterGetParentMacro(_raster) \ + ((_raster)->parent) + + +#if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) + +#define RwRasterGetWidth(_raster) \ + RwRasterGetWidthMacro(_raster) + +#define RwRasterGetHeight(_raster) \ + RwRasterGetHeightMacro(_raster) + +#define RwRasterGetStride(_raster) \ + RwRasterGetStrideMacro(_raster) + +#define RwRasterGetDepth(_raster) \ + RwRasterGetDepthMacro(_raster) + +#define RwRasterGetFormat(_raster) \ + RwRasterGetFormatMacro(_raster) + +#define RwRasterGetType(_raster) \ + RwRasterGetTypeMacro(_raster) + +#define RwRasterGetParent(_raster) \ + RwRasterGetParentMacro(_raster) + +#endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ + + +/**************************************************************************** + Function prototypes + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* Creating destroying rasters */ +extern RwRaster *RwRasterCreate(RwInt32 width, RwInt32 height, + RwInt32 depth, RwInt32 flags); +extern RwBool RwRasterDestroy(RwRaster * raster); + +/* Pulling info out of raster structure */ + +#if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) +extern RwInt32 RwRasterGetWidth(const RwRaster *raster); +extern RwInt32 RwRasterGetHeight(const RwRaster *raster); +extern RwInt32 RwRasterGetStride(const RwRaster *raster); +extern RwInt32 RwRasterGetDepth(const RwRaster *raster); +extern RwInt32 RwRasterGetFormat(const RwRaster *raster); +extern RwInt32 RwRasterGetType(const RwRaster *raster); +extern RwRaster *RwRasterGetParent(const RwRaster *raster); +#endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ + +extern RwRaster *RwRasterGetOffset(RwRaster *raster, + RwInt16 *xOffset, RwInt16 *yOffset); + +extern RwInt32 RwRasterGetNumLevels(RwRaster * raster); + +extern RwRaster *RwRasterSubRaster(RwRaster * subRaster, + RwRaster * raster, RwRect * rect); + +extern RwRaster *RwRasterRenderFast(RwRaster * raster, RwInt32 x, + RwInt32 y); +extern RwRaster *RwRasterRender(RwRaster * raster, RwInt32 x, + RwInt32 y); +extern RwRaster *RwRasterRenderScaled(RwRaster * raster, + RwRect * rect); + +/* Raster rendering context */ +extern RwRaster *RwRasterPushContext(RwRaster * raster); +extern RwRaster *RwRasterPopContext(void); +extern RwRaster *RwRasterGetCurrentContext(void); + +/* Clearing rasters */ +extern RwBool RwRasterClear(RwInt32 pixelValue); +extern RwBool RwRasterClearRect(RwRect * rpRect, + RwInt32 pixelValue); + +/* Displaying rasters */ +extern RwRaster *RwRasterShowRaster(RwRaster * raster, void *dev, + RwUInt32 flags); + +/* Locking and releasing */ +extern RwUInt8 *RwRasterLock(RwRaster * raster, RwUInt8 level, + RwInt32 lockMode); +extern RwRaster *RwRasterUnlock(RwRaster * raster); +extern RwUInt8 *RwRasterLockPalette(RwRaster * raster, + RwInt32 lockMode); +extern RwRaster *RwRasterUnlockPalette(RwRaster * raster); + +/* Attaching toolkits */ +extern RwInt32 RwRasterRegisterPlugin(RwInt32 size, + RwUInt32 pluginID, + RwPluginObjectConstructor + constructCB, + RwPluginObjectDestructor + destructCB, + RwPluginObjectCopy copyCB); +extern RwInt32 RwRasterGetPluginOffset(RwUInt32 pluginID); +extern RwBool RwRasterValidatePlugins(const RwRaster * raster); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/driver/d3d8/drvmodel.h ---*/ +#ifndef D3D8_DRVMODEL_H +#define D3D8_DRVMODEL_H + +#if (defined(__ICL)) +/* Avoid voluminous + * 'warning #344: typedef name has already been declared (with same type)' + * warnings from MS include files + */ +#pragma warning( disable : 344 ) +#endif /* (defined(__ICL)) */ + + +#include + +#if (defined(RWDEBUG)) +#if (defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) +#define _CRTDBG_MAP_ALLOC +#endif /* defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) */ +#include +#define ERR_WRAP(A) (_rwRePrintErrorDDD3D((A), __FILE__, __LINE__)) +#endif /* (defined(RWDEBUG)) */ + +#if (!defined(ERR_WRAP)) +#define ERR_WRAP(A) (A) +#endif /* (!defined(ERR_WRAP)) */ + +/**************************************************************************** + Defines + */ + +/* Set true depth information (for fogging, eg) */ +#define RwIm2DVertexSetCameraX(vert, camx) /* Nothing */ +#define RwIm2DVertexSetCameraY(vert, camy) /* Nothing */ +#define RwIm2DVertexSetCameraZ(vert, camz) /* Nothing */ + +#define RwIm2DVertexSetRecipCameraZ(vert, recipz) ((vert)->rhw = recipz) + +#define RwIm2DVertexGetCameraX(vert) (cause an error) +#define RwIm2DVertexGetCameraY(vert) (cause an error) +#define RwIm2DVertexGetCameraZ(vert) (cause an error) +#define RwIm2DVertexGetRecipCameraZ(vert) ((vert)->rhw) + +/* Set screen space coordinates in a device vertex */ +#define RwIm2DVertexSetScreenX(vert, scrnx) ((vert)->x = (scrnx)) +#define RwIm2DVertexSetScreenY(vert, scrny) ((vert)->y = (scrny)) +#define RwIm2DVertexSetScreenZ(vert, scrnz) ((vert)->z = (scrnz)) +#define RwIm2DVertexGetScreenX(vert) ((vert)->x) +#define RwIm2DVertexGetScreenY(vert) ((vert)->y) +#define RwIm2DVertexGetScreenZ(vert) ((vert)->z) + +/* Set texture coordinates in a device vertex */ +#define RwIm2DVertexSetU(vert, texU, recipz) ((vert)->u = (texU)) +#define RwIm2DVertexSetV(vert, texV, recipz) ((vert)->v = (texV)) +#define RwIm2DVertexGetU(vert) ((vert)->u) +#define RwIm2DVertexGetV(vert) ((vert)->v) + +/* Modify the luminance stuff */ +#define RwIm2DVertexSetRealRGBA(vert, red, green, blue, alpha) \ + ((vert)->emissiveColor = \ + (((RwFastRealToUInt32(alpha)) << 24) | \ + ((RwFastRealToUInt32(red)) << 16) | \ + ((RwFastRealToUInt32(green)) << 8) | \ + ((RwFastRealToUInt32(blue))))) + +#define RwIm2DVertexSetIntRGBA(vert, red, green, blue, alpha) \ + ((vert)->emissiveColor = \ + ((((RwUInt32)(alpha)) << 24) | \ + (((RwUInt32)(red)) << 16) | \ + (((RwUInt32)(green)) << 8) | \ + (((RwUInt32)(blue))))) + +#define RwIm2DVertexGetRed(vert) \ + (((vert)->emissiveColor >> 16) & 0xFF) + +#define RwIm2DVertexGetGreen(vert) \ + (((vert)->emissiveColor >> 8) & 0xFF) + +#define RwIm2DVertexGetBlue(vert) \ + ((vert)->emissiveColor & 0xFF) + +#define RwIm2DVertexGetAlpha(vert) \ + (((vert)->emissiveColor >> 24) & 0xFF) + +#define RwIm2DVertexCopyRGBA(dst, src) \ + ((dst)->emissiveColor = (src)->emissiveColor) + +/* Clipper stuff */ + +#define RwIm2DVertexClipRGBA(o, i, n, f) \ +MACRO_START \ +{ \ + const RwInt32 _factor = \ + (RwFastRealToUInt32(i * (RwReal)(255))) & 255; \ + \ + (o)->emissiveColor = \ + (((((RwIm2DVertexGetAlpha(f) - RwIm2DVertexGetAlpha(n)) * \ + _factor) >> 8) + RwIm2DVertexGetAlpha(n)) << 24) | \ + (((((RwIm2DVertexGetRed(f) - RwIm2DVertexGetRed(n)) * \ + _factor) >> 8) + RwIm2DVertexGetRed(n)) << 16) | \ + (((((RwIm2DVertexGetGreen(f) - RwIm2DVertexGetGreen(n)) * \ + _factor) >> 8) + RwIm2DVertexGetGreen(n)) << 8) | \ + (((((RwIm2DVertexGetBlue(f) - RwIm2DVertexGetBlue(n)) * \ + _factor) >> 8) + RwIm2DVertexGetBlue(n))); \ +} \ +MACRO_STOP + +/* LEGACY-SUPPORT macros */ +#define RWIM2DVERTEXSetCameraX(vert, camx) RwIm2DVertexSetCameraX(vert, camx) +#define RWIM2DVERTEXSetCameraY(vert, camy) RwIm2DVertexSetCameraY(vert, camy) +#define RWIM2DVERTEXSetCameraZ(vert, camz) RwIm2DVertexSetCameraZ(vert, camz) +#define RWIM2DVERTEXSetRecipCameraZ(vert, recipz) \ + RwIm2DVertexSetRecipCameraZ(vert, recipz) +#define RWIM2DVERTEXGetCameraX(vert) RwIm2DVertexGetCameraX(vert) +#define RWIM2DVERTEXGetCameraY(vert) RwIm2DVertexGetCameraY(vert) +#define RWIM2DVERTEXGetCameraZ(vert) RwIm2DVertexGetCameraZ(vert) +#define RWIM2DVERTEXGetRecipCameraZ(vert) RwIm2DVertexGetRecipCameraZ(vert) +#define RWIM2DVERTEXSetScreenX(vert, scrnx) RwIm2DVertexSetScreenX(vert, scrnx) +#define RWIM2DVERTEXSetScreenY(vert, scrny) RwIm2DVertexSetScreenY(vert, scrny) +#define RWIM2DVERTEXSetScreenZ(vert, scrnz) RwIm2DVertexSetScreenZ(vert, scrnz) +#define RWIM2DVERTEXGetScreenX(vert) RwIm2DVertexGetScreenX(vert) +#define RWIM2DVERTEXGetScreenY(vert) RwIm2DVertexGetScreenY(vert) +#define RWIM2DVERTEXGetScreenZ(vert) RwIm2DVertexGetScreenZ(vert) +#define RWIM2DVERTEXSetU(vert, u, recipz) RwIm2DVertexSetU(vert, u, recipz) +#define RWIM2DVERTEXSetV(vert, v, recipz) RwIm2DVertexSetV(vert, v, recipz) +#define RWIM2DVERTEXGetU(vert) RwIm2DVertexGetU(vert) +#define RWIM2DVERTEXGetV(vert) RwIm2DVertexGetV(vert) +#define RWIM2DVERTEXSetRealRGBA(vert, red, green, blue, alpha) \ + RwIm2DVertexSetRealRGBA(vert, red, green, blue, alpha) +#define RWIM2DVERTEXSetIntRGBA(vert, red, green, blue, alpha) \ + RwIm2DVertexSetIntRGBA(vert, red, green, blue, alpha) +#define RWIM2DVERTEXGetRed(vert) RwIm2DVertexGetRed(vert) +#define RWIM2DVERTEXGetGreen(vert) RwIm2DVertexGetGreen(vert) +#define RWIM2DVERTEXGetBlue(vert) RwIm2DVertexGetBlue(vert) +#define RWIM2DVERTEXGetAlpha(vert) RwIm2DVertexGetAlpha(vert) +#define RWIM2DVERTEXCopyRGBA(dst, src) RwIm2DVertexCopyRGBA(dst, src) +#define RWIM2DVERTEXClipRGBA(o, i, n, f) RwIm2DVertexClipRGBA(o, i, n, f) + +/**************************************************************************** + Global Types + */ + +/* We use RwD3D8Vertex to drive the hardware in 2D mode */ + +/** + * \ingroup rwcoredriverd3d8 + * \typedef RwD3D8Vertex + * D3D8 vertex structure definition for 2D geometry + */ +typedef struct RwD3D8Vertex RwD3D8Vertex; +/** + * \ingroup rwcoredriverd3d8 + * \struct RwD3D8Vertex + * D3D8 vertex structure definition for 2D geometry + */ +struct RwD3D8Vertex +{ + RwReal x; /**< Screen X */ + RwReal y; /**< Screen Y */ + RwReal z; /**< Screen Z */ + RwReal rhw; /**< Reciprocal of homogeneous W */ + + RwUInt32 emissiveColor; /**< Vertex color */ + + RwReal u; /**< Texture coordinate U */ + RwReal v; /**< Texture coordinate V */ +}; + +/* Define types used */ + +/** + * \ingroup rwcoredriverd3d8 + * \typedef RwIm2DVertex + * Typedef for a RenderWare Graphics Immediate Mode 2D Vertex + */ +typedef RwD3D8Vertex RwIm2DVertex; + +/* LEGACY-SUPPORT macro */ +/** + * \ingroup rwcoredriverd3d8 + * \def RWIM2DVERTEX + * RWIM2DVERTEX is a legacy macro for RwIm2DVertex + */ +#define RWIM2DVERTEX RwIm2DVertex + +/** + * \ingroup rwcoredriverd3d8 + * \typedef RxVertexIndex + * + * Typedef for a RenderWare Graphics PowerPipe Immediate + * Mode Vertex + */ +typedef RwUInt16 RxVertexIndex; + +/** + * \ingroup rwcoredriverd3d8 + * \typedef RwImVertexIndex + * Typedef for a RenderWare Graphics Immediate Mode Vertex. + */ +typedef RxVertexIndex RwImVertexIndex; + +/* LEGACY-SUPPORT macro */ +/** + * \ingroup rwcoredriverd3d8 + * \def RWIMVERTEXINDEX + * RWIMVERTEXINDEX is a legacy macro for RwImVertexIndex + */ +#define RWIMVERTEXINDEX RwImVertexIndex + +/** + * \ingroup rwcoredriverd3d8 + * \struct RwD3D8Metrics + * Structure containing metrics counters + */ +typedef struct +{ + RwUInt32 numRenderStateChanges; /**< Number of Render States changed */ + RwUInt32 numTextureStageStateChanges; /**< Number of Texture Stage States changed */ + RwUInt32 numMaterialChanges; /**< Number of Material changes */ + RwUInt32 numLightsChanged; /**< Number of Lights changed */ +} +RwD3D8Metrics; + +#endif /* D3D8_DRVMODEL_H */ + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/d3d8/pip2model.h ---*/ + + + + + +/**************************************************************************** + Global Defines + */ + +#define RXHEAPPLATFORMDEFAULTSIZE (1 << 12) /* 4k */ + +/**************************************************************************** + Global Types + */ + +/* We use D3D8 formats for the instanced versions, to allow hardware T&L */ + +/** + * \ingroup corep2d3d8 + * \typedef RxObjSpace3DVertex + * Typedef for an RxObjSpace3DVertex. + */ +typedef struct RxObjSpace3DVertex RxObjSpace3DVertex; + +/** + * \ingroup corep2d3d8 + * \struct RxObjSpace3DVertex + * Structure representing object space vertex. + */ +struct RxObjSpace3DVertex +{ + RwV3d objVertex; /**< position */ + RwV3d objNormal; /**< normal */ + RwUInt32 color; /**< emissive color*/ + RwReal u; /**< u */ + RwReal v; /**< v */ +}; + +/* This vertex is non truncatable */ +#define RxObjSpace3DVertexNoUVsNoNormalsSize (sizeof(RxObjSpace3DVertex)) +#define RxObjSpace3DVertexNoUVsSize (sizeof(RxObjSpace3DVertex)) +#define RxObjSpace3DVertexFullSize (sizeof(RxObjSpace3DVertex)) + +/** + * \ingroup corep2d3d8 + * \typedef RxObjSpace3DLitVertex + * Typedef for an RxObjSpace3DLitVertex. + */ +typedef RxObjSpace3DVertex RxObjSpace3DLitVertex; + +/** + * \ingroup corep2d3d8 + * \typedef RwIm3DVertex + * Typedef for an RwIm3DVertex. + */ +typedef RxObjSpace3DLitVertex RwIm3DVertex; + +/* LEGACY-SUPPORT macro */ +#define RWIM3DVERTEX RwIm3DVertex +typedef RwIm2DVertex RxScrSpace2DVertex; + +/**************************************************************************** + Object-space 3D unlit vertex macros + */ + +/* Vertex positions */ +#define RxObjSpace3DVertexGetPos(_vert, _pos) \ + (*(_pos) = (_vert)->objVertex) +#define RxObjSpace3DVertexSetPos(_vert, _pos) \ + ((_vert)->objVertex = *(_pos)) + +/* Pre-lighting colours */ +#define RxObjSpace3DVertexGetPreLitColor(_vert, _col) \ +MACRO_START \ +{ \ + (_col)->alpha = (RwUInt8)((_vert)->color >> 24) & 0xFF; \ + (_col)->red = (RwUInt8)((_vert)->color >> 16) & 0xFF; \ + (_col)->green = (RwUInt8)((_vert)->color >> 8) & 0xFF; \ + (_col)->blue = (RwUInt8)((_vert)->color ) & 0xFF; \ +} \ +MACRO_STOP + +#define RxObjSpace3DVertexSetPreLitColor(_vert, _col) \ + ((_vert)->color = (((RwUInt32)(_col)->alpha) << 24) | \ + (((RwUInt32)(_col)->red) << 16) | \ + (((RwUInt32)(_col)->green) << 8) | \ + (((RwUInt32)(_col)->blue) )) + +/* This uses the same slot as color (they are mutually exclusive) */ +#define RxObjSpace3DVertexGetColor RxObjSpace3DVertexGetPreLitColor + +/* Normals */ +#define RxObjSpace3DVertexGetNormal(_vert, _normal) \ + (*(_normal) = (_vert)->objNormal) +#define RxObjSpace3DVertexSetNormal(_vert, _normal) \ + ((_vert)->objNormal = *(_normal)) + +/* Us and Vs */ +#define RxObjSpace3DVertexGetU(_vert) \ + ((_vert)->u) +#define RxObjSpace3DVertexGetV(_vert) \ + ((_vert)->v) +#define RxObjSpace3DVertexSetU(_vert, _imu) \ + ((_vert)->u = (_imu)) +#define RxObjSpace3DVertexSetV(_vert, _imv) \ + ((_vert)->v = (_imv)) + +/**************************************************************************** + Object-space 3D lit vertex macros + */ + +/* Vertex positions */ +#define RxObjSpace3DLitVertexGetPos(_vert, _pos) \ + (*(_pos) = (_vert)->objVertex) +#define RxObjSpace3DLitVertexSetPos(_vert, _pos) \ + ((_vert)->objVertex = *(_pos)) + +/* Vertex colours */ +#define RxObjSpace3DLitVertexGetColor(_vert, _col) \ +MACRO_START \ +{ \ + (_col)->red = ((_vert)->color >> 16) & 0xFF; \ + (_col)->green = ((_vert)->color >> 8) & 0xFF; \ + (_col)->blue = ((_vert)->color ) & 0xFF; \ + (_col)->alpha = ((_vert)->color >> 24) & 0xFF; \ +} \ +MACRO_STOP +#define RxObjSpace3DLitVertexSetColor(_vert, _col) \ + ((_vert)->color = (((RwUInt32)(_col)->alpha) << 24) | \ + (((RwUInt32)(_col)->red) << 16) | \ + (((RwUInt32)(_col)->green) << 8) | \ + (((RwUInt32)(_col)->blue) )) + +/* Us and Vs */ +#define RxObjSpace3DLitVertexGetU(_vert) \ + ((_vert)->u) +#define RxObjSpace3DLitVertexGetV(_vert) \ + ((_vert)->v) +#define RxObjSpace3DLitVertexSetU(_vert, _imu) \ + ((_vert)->u = (_imu)) +#define RxObjSpace3DLitVertexSetV(_vert, _imv) \ + ((_vert)->v = (_imv)) + +/* LEGACY-SUPPORT for old objvert names - NB does NOT guarantee the + * app will work, because the old IM3DVERTEX macros are NOT correctly + * abstracted - 'Get' will return pointers to RwV3ds inside the + * ObjVert, but you can't assume there are any RwV3ds inside an + * opaque vertex type */ + +#define RwIm3DVertexSetU RxObjSpace3DLitVertexSetU +#define RwIm3DVertexSetV RxObjSpace3DLitVertexSetV +#define RwIm3DVertexGetNext(_vert) ((_vert) + 1) + +#define RwIm2DCameraVertexSetU(_devvert, _camvert, _u, _recipz) \ +MACRO_START \ +{ \ + RwReal _uTmp = _u; \ + _camvert->u = _uTmp; \ + RwIm2DVertexSetU(_devvert, _uTmp, _recipz); \ +} \ +MACRO_STOP +#define RwIm2DCameraVertexSetV(_devvert, _camvert, _v, _recipz) \ +MACRO_START \ +{ \ + RwReal _vTmp = _v; \ + _camvert->v = _vTmp; \ + RwIm2DVertexSetV(_devvert, _vTmp, _recipz); \ +} \ +MACRO_STOP + +#define RwIm3DVertexSetPos(_vert, _imx, _imy, _imz) \ +MACRO_START \ +{ \ + (_vert)->objVertex.x = _imx; \ + (_vert)->objVertex.y = _imy; \ + (_vert)->objVertex.z = _imz; \ +} \ +MACRO_STOP + +#define RwIm3DVertexSetNormal(vert, imx, imy, imz) \ +MACRO_START \ +{ \ + RwV3d packed; \ + packed.x = imx; \ + packed.y = imy; \ + packed.z = imz; \ + RxObjSpace3DVertexSetNormal(vert, &packed); \ +} \ +MACRO_STOP + +#define RwIm3DVertexSetRGBA(_vert, _r, _g, _b, _a) \ +MACRO_START \ +{ \ + ((_vert)->color = ((_a) << 24) | \ + ((_r) << 16) | \ + ((_g) << 8) | \ + ((_b))); \ +} \ +MACRO_STOP + +#define RwIm3DVertexGetPos(_vert) (&((_vert)->objVertex)) +#define RwIm3DVertexGetNormal(vert) (&((vert)->objNormal)) + +#define RwIm3DVertexCopyRGBA(_dst, _src) (((_dst)->color) = ((_src)->color)) + +/* LEGACY-SUPPORT macros */ +#define RWIM2DCAMERAVERTEXSetU(_devvert, _camvert, _u, _recipz) \ + RwIm2DCameraVertexSetU(_devvert, _camvert, _u, _recipz) +#define RWIM2DCAMERAVERTEXSetV(_devvert, _camvert, _v, _recipz) \ + RwIm2DCameraVertexSetV(_devvert, _camvert, _v, _recipz) +#define RWIM3DVERTEXGetNext(vert) RwIm3DVertexGetNext(vert) +#define RWIM3DVERTEXSetPos(vert, imx, imy, imz) RwIm3DVertexSetPos(vert, imx, imy, imz) +#define RWIM3DVERTEXGetPos(vert) RwIm3DVertexGetPos(vert) +#define RWIM3DVERTEXSetU(vert, imu) RwIm3DVertexSetU(vert, imu) +#define RWIM3DVERTEXSetV(vert, imv) RwIm3DVertexSetV(vert, imv) +#define RWIM3DVERTEXSetRGBA(vert, r, g, b, a) RwIm3DVertexSetRGBA(vert, r, g, b, a) +#define RWIM3DVERTEXSetNormal(vert, imx, imy, imz) RwIm3DVertexSetNormal(vert, imx, imy, imz) +#define RWIM3DVERTEXCopyRGBA(dst,src) RwIm3DVertexCopyRGBA(dst,src) +#define RXOBJSPACE3DVERTEXGetPos(_vert, _pos) \ + RxObjSpace3DVertexGetPos(_vert, _pos) +#define RXOBJSPACE3DVERTEXSetPos(_vert, _pos) \ + RxObjSpace3DVertexSetPos(_vert, _pos) +#define RXOBJSPACE3DVERTEXGetPreLitColor(_vert, _col) \ + RxObjSpace3DVertexGetPreLitColor(_vert, _col) +#define RXOBJSPACE3DVERTEXSetPreLitColor(_vert, _col) \ + RxObjSpace3DVertexSetPreLitColor(_vert, _col) +#define RXOBJSPACE3DVERTEXGetColor RxObjSpace3DVertexGetColor +#define RXOBJSPACE3DVERTEXGetNormal(_vert, _normal) \ + RxObjSpace3DVertexGetNormal(_vert, _normal) +#define RXOBJSPACE3DVERTEXSetNormal(_vert, _normal) \ + RxObjSpace3DVertexSetNormal(_vert, _normal) +#define RXOBJSPACE3DVERTEXGetU(_vert) RxObjSpace3DVertexGetU(_vert) +#define RXOBJSPACE3DVERTEXGetV(_vert) RxObjSpace3DVertexGetV(_vert) +#define RXOBJSPACE3DVERTEXSetU(_vert, _imu) \ + RxObjSpace3DVertexSetU(_vert, _imu) +#define RXOBJSPACE3DVERTEXSetV(_vert, _imv) \ + RxObjSpace3DVertexSetV(_vert, _imv) +#define RXOBJSPACE3DLITVERTEXGetPos(vert, pos) \ + RxObjSpace3DLitVertexGetPos(vert, pos) +#define RXOBJSPACE3DLITVERTEXSetPos(vert, pos) \ + RxObjSpace3DLitVertexSetPos(vert, pos) +#define RXOBJSPACE3DLITVERTEXGetColor(vert, col) \ + RxObjSpace3DLitVertexGetColor(vert, col) +#define RXOBJSPACE3DLITVERTEXSetColor(vert, col) \ + RxObjSpace3DLitVertexSetColor(vert, col) +#define RXOBJSPACE3DLITVERTEXGetU(vert) \ + RxObjSpace3DLitVertexGetU(vert) +#define RXOBJSPACE3DLITVERTEXGetV(vert) \ + RxObjSpace3DLitVertexGetV(vert) +#define RXOBJSPACE3DLITVERTEXSetU(vert, imu) \ + RxObjSpace3DLitVertexSetU(vert, imu) +#define RXOBJSPACE3DLITVERTEXSetV(vert, imv) \ + RxObjSpace3DLitVertexSetV(vert, imv) + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/p2renderstate.h ---*/ + +/** + * \ingroup rwcoregeneric + * RxRenderStateFlag + * Flags used in the \ref RxRenderStateVector structure */ +enum RxRenderStateFlag +{ + rxRENDERSTATEFLAG_TEXTUREPERSPECTIVE = 0x00000001, /**stride = (_stride)), (_image)) + +#define RwImageSetPixelsMacro(_image, _pixels) \ + (((_image)->cpPixels = (_pixels)), (_image)) + +#define RwImageSetPaletteMacro(_image, _palette) \ + (((_image)->palette = (_palette)), (_image)) + +#define RwImageGetWidthMacro(_image) \ + ((_image)->width) + +#define RwImageGetHeightMacro(_image) \ + ((_image)->height) + +#define RwImageGetDepthMacro(_image) \ + ((_image)->depth) + +#define RwImageGetStrideMacro(_image) \ + ((_image)->stride) + +#define RwImageGetPixelsMacro(_image) \ + ((_image)->cpPixels) + +#define RwImageGetPaletteMacro(_image) \ + ((_image)->palette) + + +#if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) + +#define RwImageSetStride(_image, _stride) \ + RwImageSetStrideMacro(_image, _stride) + +#define RwImageSetPixels(_image, _pixels) \ + RwImageSetPixelsMacro(_image, _pixels) + +#define RwImageSetPalette(_image, _palette) \ + RwImageSetPaletteMacro(_image, _palette) + +#define RwImageGetWidth(_image) \ + RwImageGetWidthMacro(_image) + +#define RwImageGetHeight(_image) \ + RwImageGetHeightMacro(_image) + +#define RwImageGetDepth(_image) \ + RwImageGetDepthMacro(_image) + +#define RwImageGetStride(_image) \ + RwImageGetStrideMacro(_image) + +#define RwImageGetPixels(_image) \ + RwImageGetPixelsMacro(_image) + +#define RwImageGetPalette(_image) \ + RwImageGetPaletteMacro(_image) + +#endif /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ + +/**************************************************************************** + Function prototypes + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + /* Creating and destroying */ +extern RwImage *RwImageCreate(RwInt32 width, RwInt32 height, + RwInt32 depth); +extern RwBool RwImageDestroy(RwImage * image); + + /* Allocating */ +extern RwImage *RwImageAllocatePixels(RwImage * image); +extern RwImage *RwImageFreePixels(RwImage * image); + + /* Converting images */ +extern RwImage *RwImageCopy(RwImage * destImage, + const RwImage * sourceImage); + + /* Resizing images */ +extern RwImage *RwImageResize(RwImage * image, RwInt32 width, + RwInt32 height); + + /* Producing masks ! */ +extern RwImage *RwImageApplyMask(RwImage * image, + const RwImage * mask); +extern RwImage *RwImageMakeMask(RwImage * image); + + /* Helper functions */ +extern RwImage *RwImageReadMaskedImage(const RwChar * imageName, + const RwChar * maskname); +extern RwImage *RwImageRead(const RwChar * imageName); +extern RwImage *RwImageWrite(RwImage * image, + const RwChar * imageName); + + /* Setting and getting the default path for images */ +extern RwChar *RwImageGetPath(void); +extern const RwChar *RwImageSetPath(const RwChar * path); + + /* Setting */ +#if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) +extern RwImage *RwImageSetStride(RwImage * image, RwInt32 stride); +extern RwImage *RwImageSetPixels(RwImage * image, RwUInt8 * pixels); +extern RwImage *RwImageSetPalette(RwImage * image, RwRGBA * palette); + + /* Getting */ +extern RwInt32 RwImageGetWidth(const RwImage * image); +extern RwInt32 RwImageGetHeight(const RwImage * image); +extern RwInt32 RwImageGetDepth(const RwImage * image); +extern RwInt32 RwImageGetStride(const RwImage * image); +extern RwUInt8 *RwImageGetPixels(const RwImage * image); +extern RwRGBA *RwImageGetPalette(const RwImage * image); +#endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ + + /* Get device dependent pixel value */ +extern RwUInt32 RwRGBAToPixel(RwRGBA * rgbIn, RwInt32 rasterFormat); +extern RwRGBA *RwRGBASetFromPixel(RwRGBA * rgbOut, + RwUInt32 pixelValue, + RwInt32 rasterFormat); + + /* Gamma correction */ +extern RwBool RwImageSetGamma(RwReal gammaValue); +extern RwReal RwImageGetGamma(void); +extern RwImage *RwImageGammaCorrect(RwImage * image); + + /* Adding and removing gamma correction */ +extern RwRGBA *RwRGBAGammaCorrect(RwRGBA * rgb); + + /* Attaching toolkits */ +extern RwInt32 RwImageRegisterPlugin(RwInt32 size, RwUInt32 pluginID, + RwPluginObjectConstructor + constructCB, + RwPluginObjectDestructor + destructCB, + RwPluginObjectCopy copyCB); +extern RwInt32 RwImageGetPluginOffset(RwUInt32 pluginID); +extern RwBool RwImageValidatePlugins(const RwImage * image); + +extern RwBool RwImageRegisterImageFormat(const RwChar * extension, + RwImageCallBackRead + imageRead, + RwImageCallBackWrite + imageWrite); + + /* Finding an extension for an image to load */ +extern const RwChar *RwImageFindFileType(const RwChar * imageName); + + /* Reading and writing images to streams */ +extern RwInt32 RwImageStreamGetSize(const RwImage * image); +extern RwImage *RwImageStreamRead(RwStream * stream); +extern const RwImage *RwImageStreamWrite(const RwImage * image, + RwStream * stream); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/*--- Automatically derived from: C:/daily/rwsdk/src/batextur.h ---*/ + +/**************************************************************************** + Defines + */ + +/* Type ID */ +#define rwTEXDICTIONARY 6 + +/* Mipmap Name generation - maximum number of RwChar characters which can + * be appended to the root name. + */ +#define rwTEXTUREMIPMAPNAMECHARS 16 + +/* We define texture names to be a maximum of 16 ISO chars */ +#define rwTEXTUREBASENAMELENGTH 32 + +#define rwTEXTUREFILTERMODEMASK 0x000000FF +#define rwTEXTUREADDRESSINGUMASK 0x00000F00 +#define rwTEXTUREADDRESSINGVMASK 0x0000F000 +#define rwTEXTUREADDRESSINGMASK (rwTEXTUREADDRESSINGUMASK | \ + rwTEXTUREADDRESSINGVMASK) + +/**************************************************************************** + Global Types + */ + +/** + * \ingroup datatypes + * \typedef RwTexDictionary + * is a texture dictionary containing textures. + * This should be considered an opaque type. + * Use the RwTexDictionary API functions to access. + */ +typedef struct RwTexDictionary RwTexDictionary; + +#if (!defined(DOXYGEN)) +struct RwTexDictionary +{ + RwObject object; /* Homogeneous type */ + RwLinkList texturesInDict; /* List of textures in dictionary */ + RwLLLink lInInstance; /* Link list of all dicts in system */ +}; +/* Information is entirely device dependent */ +#endif /* (!defined(DOXYGEN)) */ + + +/* Parent is the dictionary */ + +/** + * \ingroup datatypes + * \typedef RwTexture + * is a texture object. + * This should be considered an opaque type. + * Use the RwTexture API functions to access. + */ +typedef struct RwTexture RwTexture; + +#if (!defined(DOXYGEN)) +struct RwTexture +{ + RwRaster *raster; /** pointer to RwRaster with data */ + RwTexDictionary *dict; /* Dictionary this texture is in */ + RwLLLink lInDictionary; /* List of textures in this dictionary */ + + RwChar name[rwTEXTUREBASENAMELENGTH]; /* Name of the texture */ + RwChar mask[rwTEXTUREBASENAMELENGTH]; /* Name of the textures mask */ + + /* 31 [xxxxxxxx xxxxxxxx vvvvuuuu ffffffff] 0 */ + RwUInt32 filterAddressing; /* Filtering & addressing mode flags */ + + RwInt32 refCount; /* Reference count, surprisingly enough */ +}; +#endif /* (!defined(DOXYGEN)) */ + +/** + * \ingroup datatypes + * \ref RwTextureCallBackRead + * represents the function used by \ref RwTextureRead to read the specified + * texture from a disk file. This function should return a pointer to the + * texture to indicate success. + * + * \param name Pointer to a string containing the name of + * the texture to read. + * + * \param maskName Pointer to a string containing the name + * of the mask to read and apply to the texture. + * + * \return Pointer to the texture + * + * \see RwTextureSetReadCallBack + * \see RwTextureGetReadCallBack + */ +typedef RwTexture *(*RwTextureCallBackRead)(const RwChar *name, + const RwChar *maskName); + +/** + * \ingroup datatypes + * \ref RwTextureCallBack + * represents the function called from \ref RwTexDictionaryForAllTextures + * for all textures in a given texture dictionary. This function should + * return the current texture to indicate success. The callback may return + * NULL to terminate further callbacks on the texture dictionary. + * + * \param texture Pointer to the current texture. + * + * \param pData User-defined data pointer. + * + * \return Pointer to the current texture + * + * \see RwTexDictionaryForAllTextures + */ +typedef RwTexture *(*RwTextureCallBack)(RwTexture *texture, void *pData); + + +/** + * \ingroup datatypes + * \ref RwTexDictionaryCallBack + * represents the function called from \ref RwTexDictionaryForAllTexDictionaries + * for all texture dictionaries that currently exist. This function should + * return the current texture dictionary to indicate success. The callback may + * return NULL to terminate further callbacks on the texture dictionary. It may + * safely destroy the current texture dictionary without adversely affecting + * the iteration process. + * + * \param dict Pointer to the current texture dictionary. + * + * \param pData User-defined data pointer. + * + * \return Pointer to the current texture dictionary + * + * \see RwTexDictionaryForAllTexdictionaries + */ +typedef RwTexDictionary *(*RwTexDictionaryCallBack)(RwTexDictionary *dict, void *data); + + +/** + * \ingroup datatypes + * \ref RwTextureCallBackMipmapGeneration + * is the callback function supplied to \ref RwTextureSetMipmapGenerationCallBack + * and returned from \ref RwTextureGetMipmapGenerationCallBack. + * + * The supplied function will be passed a pointer to a raster and an image. + * The raster is the target for the generated mipmap levels and the image + * provides the base for their generation. + * + * \param raster Pointer to raster, the target for generated mipmap levels + * \param image Pointer to image, used to generate mipmap levels. + * + * \return + * Returns a pointer to the raster if successful or NULL if an error occurred. + * + * \see RwTextureSetMipmapGenerationCallBack + * \see RwTextureGetMipmapGenerationCallBack + * \see RwTextureSetAutoMipmapping + * \see RwTextureGetAutoMipmapping + */ +typedef RwRaster *(*RwTextureCallBackMipmapGeneration)(RwRaster * raster, + RwImage * image); + +/** + * \ingroup datatypes + * \ref RwTextureCallBackMipmapName + * is the callback function supplied to \ref RwTextureSetMipmapNameCallBack and + * returned from \ref RwTextureGetMipmapNameCallBack. + * + * The supplied function will be passed a pointer to a root name, a maskName, a mipmap + * level and a format. The function returns TRUE if successful and the root name will have been + * modified to equal the mipmap name. + * + * \param name Pointer to a string containing the root name of the texture. The + * mipmap level name is put here. + * \param maskName Pointer to a string containing the root mask name of the texture or + * NULL if no mask name is required. + * \param mipLevel A value equal to the mipmap level for which the name is required. + * \param format A value describing the mipmapping mode. A combination of the bit + * flags rwRASTERFORMATMIPMAP and rwRASTERFORMATAUTOMIPMAP. + * + * \return + * Returns TRUE if the name is generated successfully or FALSE if an error occurred. + * + * \see RwTextureGenerateMipmapName + * \see RwTextureSetMipmapNameCallBack + * \see RwTextureGetMipmapNameCallBack + * \see RwTextureSetAutoMipmapping + * \see RwTextureGetAutoMipmapping + */ +typedef RwBool (*RwTextureCallBackMipmapName)(RwChar *name, + RwChar *maskName, + RwUInt8 mipLevel, + RwInt32 format); + +/**************************************************************************** + raster) + +#define RwTextureAddRefMacro(_tex) \ + (((_tex)->refCount++), (_tex)) + +#define RwTextureAddRefVoidMacro(_tex) \ +MACRO_START \ +{ \ + (_tex)->refCount++; \ +} \ +MACRO_STOP + +#define RwTextureGetNameMacro(_tex) \ + ((_tex)->name) + +#define RwTextureGetMaskNameMacro(_tex) \ + ((_tex)->mask) + +#define RwTextureGetDictionaryMacro(_tex) \ + ((_tex)->dict) + +#define RwTextureSetFilterModeMacro(_tex, _filtering) \ + (((_tex)->filterAddressing = \ + ((_tex)->filterAddressing & ~rwTEXTUREFILTERMODEMASK) | \ + (((RwUInt32)(_filtering)) & rwTEXTUREFILTERMODEMASK)), \ + (_tex)) + +#define RwTextureGetFilterModeMacro(_tex) \ + ((RwTextureFilterMode)((_tex)->filterAddressing & \ + rwTEXTUREFILTERMODEMASK)) + +#define RwTextureSetAddressingMacro(_tex, _addressing) \ + (((_tex)->filterAddressing = \ + ((_tex)->filterAddressing & ~rwTEXTUREADDRESSINGMASK) | \ + (((((RwUInt32)(_addressing)) << 8) & rwTEXTUREADDRESSINGUMASK) | \ + ((((RwUInt32)(_addressing)) << 12) & rwTEXTUREADDRESSINGVMASK))), \ + (_tex)) + +#define RwTextureSetAddressingUMacro(_tex, _addressing) \ + (((_tex)->filterAddressing = \ + ((_tex)->filterAddressing & ~rwTEXTUREADDRESSINGUMASK) | \ + (((RwUInt32)(_addressing) << 8) & rwTEXTUREADDRESSINGUMASK)), \ + (_tex)) + +#define RwTextureSetAddressingVMacro(_tex, _addressing) \ + (((_tex)->filterAddressing = \ + ((_tex)->filterAddressing & ~rwTEXTUREADDRESSINGVMASK) | \ + (((RwUInt32)(_addressing) << 12) & rwTEXTUREADDRESSINGVMASK)), \ + (_tex)) + +#define RwTextureGetAddressingMacro(_tex) \ + (((((_tex)->filterAddressing & rwTEXTUREADDRESSINGUMASK) >> 8) == \ + (((_tex)->filterAddressing & rwTEXTUREADDRESSINGVMASK) >> 12)) ? \ + ((RwTextureAddressMode)(((_tex)->filterAddressing & \ + rwTEXTUREADDRESSINGVMASK) >> 12)) : \ + rwTEXTUREADDRESSNATEXTUREADDRESS) + +#define RwTextureGetAddressingUMacro(_tex) \ + ((RwTextureAddressMode)(((_tex)->filterAddressing & \ + rwTEXTUREADDRESSINGUMASK) >> 8)) + +#define RwTextureGetAddressingVMacro(_tex) \ + ((RwTextureAddressMode)(((_tex)->filterAddressing & \ + rwTEXTUREADDRESSINGVMASK) >> 12)) + + +#if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) + +#define RwTextureGetRaster(_tex) \ + RwTextureGetRasterMacro(_tex) + +#define RwTextureAddRef(_tex) \ + RwTextureAddRefMacro(_tex) + +#define RwTextureGetName(_tex) \ + RwTextureGetNameMacro(_tex) + +#define RwTextureGetMaskName(_tex) \ + RwTextureGetMaskNameMacro(_tex) + +#define RwTextureGetDictionary(_tex) \ + RwTextureGetDictionaryMacro(_tex) + +#define RwTextureSetFilterMode(_tex, _filtering) \ + RwTextureSetFilterModeMacro(_tex, _filtering) + +#define RwTextureGetFilterMode(_tex) \ + RwTextureGetFilterModeMacro(_tex) + +#define RwTextureSetAddressing(_tex, _addressing) \ + RwTextureSetAddressingMacro(_tex, _addressing) + +#define RwTextureSetAddressingU(_tex, _addressing) \ + RwTextureSetAddressingUMacro(_tex, _addressing) + +#define RwTextureSetAddressingV(_tex, _addressing) \ + RwTextureSetAddressingVMacro(_tex, _addressing) + +#define RwTextureGetAddressing(_tex) \ + RwTextureGetAddressingMacro(_tex) + +#define RwTextureGetAddressingU(_tex) \ + RwTextureGetAddressingUMacro(_tex) + +#define RwTextureGetAddressingV(_tex) \ + RwTextureGetAddressingVMacro(_tex) + +#endif /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ + + + +/**************************************************************************** + Function prototypes + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + /* Reading mip maps */ + + /* Setting mip mapping states */ +extern RwBool RwTextureSetMipmapping(RwBool enable); +extern RwBool RwTextureGetMipmapping(void); +extern RwBool RwTextureSetAutoMipmapping(RwBool enable); +extern RwBool RwTextureGetAutoMipmapping(void); + + /* Setting and getting the mipmap generation function */ +extern RwBool +RwTextureSetMipmapGenerationCallBack(RwTextureCallBackMipmapGeneration + callback); +extern RwTextureCallBackMipmapGeneration +RwTextureGetMipmapGenerationCallBack(void); + + /* Setting and getting the mipmap file name generation function */ +extern RwBool +RwTextureSetMipmapNameCallBack(RwTextureCallBackMipmapName callback); +extern RwTextureCallBackMipmapName RwTextureGetMipmapNameCallBack(void); + + /* Generating mipmaps for a raster */ +extern RwBool RwTextureGenerateMipmapName(RwChar * name, + RwChar * maskName, + RwUInt8 mipLevel, + RwInt32 format); +extern RwBool RwTextureRasterGenerateMipmaps(RwRaster * raster, + RwImage * image); + + /* LEGACY-SUPPORT mip mapping */ +extern RwBool _rwTextureSetAutoMipMapState(RwBool enable); +extern RwBool _rwTextureGetAutoMipMapState(void); + + /* Setting and getting the callback function */ +extern RwTextureCallBackRead RwTextureGetReadCallBack(void); +extern RwBool RwTextureSetReadCallBack(RwTextureCallBackRead + fpCallBack); + + /* Texture and mask names */ +extern RwTexture *RwTextureSetName(RwTexture * texture, + const RwChar * name); +extern RwTexture *RwTextureSetMaskName(RwTexture * texture, + const RwChar * maskName); + + /* Creating/destroying dictionaries */ +extern RwTexDictionary *RwTexDictionaryCreate(void); +extern RwBool RwTexDictionaryDestroy(RwTexDictionary * dict); + + /* Textures */ +extern RwTexture *RwTextureCreate(RwRaster * raster); +extern RwBool RwTextureDestroy(RwTexture * texture); + + /* Setting and getting texture map rasters */ +extern RwTexture *RwTextureSetRaster(RwTexture * texture, + RwRaster * raster); + + /* Dictionary access */ +extern RwTexture *RwTexDictionaryAddTexture(RwTexDictionary * dict, + RwTexture * texture); +extern RwTexture *RwTexDictionaryRemoveTexture(RwTexture * texture); +extern RwTexture *RwTexDictionaryFindNamedTexture(RwTexDictionary * + dict, + const RwChar * name); + + /* Reading a texture */ +extern RwTexture *RwTextureRead(const RwChar * name, + const RwChar * maskName); + + /* Setting the current dictionary */ +extern RwTexDictionary *RwTexDictionaryGetCurrent(void); +extern RwTexDictionary *RwTexDictionarySetCurrent(RwTexDictionary * dict); + + /* Enumerating textures */ +extern const RwTexDictionary *RwTexDictionaryForAllTextures(const + RwTexDictionary + * dict, + RwTextureCallBack + fpCallBack, + void *pData); + + /* Enumerating the texture dictionaries currently in the system */ +extern RwBool RwTexDictionaryForAllTexDictionaries( + RwTexDictionaryCallBack fpCallBack, void *pData); + + + /* Attaching toolkits */ +extern RwInt32 RwTextureRegisterPlugin(RwInt32 size, + RwUInt32 pluginID, + RwPluginObjectConstructor + constructCB, + RwPluginObjectDestructor + destructCB, + RwPluginObjectCopy copyCB); +extern RwInt32 RwTexDictionaryRegisterPlugin(RwInt32 size, + RwUInt32 pluginID, + RwPluginObjectConstructor + constructCB, + RwPluginObjectDestructor + destructCB, + RwPluginObjectCopy + copyCB); +extern RwInt32 RwTextureGetPluginOffset(RwUInt32 pluginID); +extern RwInt32 RwTexDictionaryGetPluginOffset(RwUInt32 pluginID); +extern RwBool RwTextureValidatePlugins(const RwTexture * texture); +extern RwBool RwTexDictionaryValidatePlugins(const RwTexDictionary * + dict); + +#if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) +/* Textures */ +extern RwRaster *RwTextureGetRaster(const RwTexture *texture); +extern RwTexture *RwTextureAddRef(RwTexture *texture); + +/* Texture and mask names */ +extern RwChar *RwTextureGetName(RwTexture *texture); +extern RwChar *RwTextureGetMaskName(RwTexture *texture); + +/* Get owner dictionary */ +extern RwTexDictionary *RwTextureGetDictionary(RwTexture *texture); + +/* Filtering */ +extern RwTexture *RwTextureSetFilterMode(RwTexture *texture, + RwTextureFilterMode filtering); + +extern RwTextureFilterMode RwTextureGetFilterMode(const RwTexture *texture); + +/* Addressing */ +extern RwTexture *RwTextureSetAddressing(RwTexture *texture, + RwTextureAddressMode addressing); +extern RwTexture *RwTextureSetAddressingU(RwTexture *texture, + RwTextureAddressMode addressing); +extern RwTexture *RwTextureSetAddressingV(RwTexture *texture, + RwTextureAddressMode addressing); + +extern RwTextureAddressMode RwTextureGetAddressing(const RwTexture *texture); +extern RwTextureAddressMode RwTextureGetAddressingU(const RwTexture *texture); +extern RwTextureAddressMode RwTextureGetAddressingV(const RwTexture *texture); + +#endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#define RwTextureSetAutoMipMapState(_enable) \ + _rwTextureSetAutoMipMapState(_enable) + +#define RwTextureGetAutoMipMapState() \ + _rwTextureGetAutoMipMapState() + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/p2stdcls.h ---*/ + +/* + * Current: + * + * wait on Simon for instructions to do cluster renaming thing, + * or go thru and change all cluster type names and cluster + * names (add CSL?) + * + */ + +/* CamVerts.csl */ + +/* clip flags */ + +/** + * \ingroup rwcoregeneric + * \ref RwClipFlag + * Flags specifying the clipping status of a vertex + */ +enum RwClipFlag +{ + rwXLOCLIP = 0x01, /**col.red = (r)); \ + ((camvert)->col.green = (g)); \ + ((camvert)->col.blue = (b)); \ + ((camvert)->col.alpha = (a)); \ +} \ +MACRO_STOP + +#define RxCamSpace3DVertexAddRGBA(camvert, r, g, b, a) \ +MACRO_START \ +{ \ + ((camvert)->col.red += (r)); \ + ((camvert)->col.green += (g)); \ + ((camvert)->col.blue += (b)); \ + ((camvert)->col.alpha += (a)); \ +} \ +MACRO_STOP + +/* LEGACY-SUPPORT macros */ +#define RXCAMSPACE3DVERTEXSetRGBA(camvert, r, g, b, a) \ + RxCamSpace3DVertexSetRGBA(camvert, r, g, b, a) +#define RXCAMSPACE3DVERTEXAddRGBA(camvert, r, g, b, a) \ + RxCamSpace3DVertexAddRGBA(camvert, r, g, b, a) + +/* MeshState.csl */ + + +/** + * \ingroup rwcoregeneric + * \ref RxGeometryFlag + * Flags describing geometry properties + */ +enum RxGeometryFlag +{ + rxGEOMETRY_TRISTRIP = 0x01, /**=1000) +# pragma pack(push, 1) +# endif /* (_MSC_VER>=1000) */ +#endif /* (defined(_MSC_VER)) */ + +typedef struct RxVStep RxVStep; +/** + * \ingroup rwcoregeneric + * \struct RxVStep + * Structure used by the RxClVStep cluster. + * To use the step values in the RxClVStep cluster, start at the beginning + * of the RxVStep and vertex arrays and proceed as follows: (a) Process one + * vertex, (b) Skip 'step' vertices, (c) Increment the cursor of the RxClVStep + * cluster. Repeat (a)-(c) until the entire vertex array has been processed. + * If the RxVStep array contains valid data, you should not have to bounds-check + * its cursor. + */ +struct RxVStep +{ + RwUInt8 step; /**< \ref RwUInt8 The number of vertices after the current one + * which can be skipped in lighting and other calculations because, + * for example, they belong only to back-facing triangles */ +}; + +#if (defined(_MSC_VER)) +# if (_MSC_VER>=1000) +# pragma pack(pop) +# endif /* (_MSC_VER>=1000) */ +#endif /* (defined(_MSC_VER)) */ + +/* CamNorms.csl */ +/** + * \ingroup rwcoregeneric + * \typedef RxCamNorm + * typedef for \ref RwV3d used by the RxClVStep cluster */ +typedef RwV3d RxCamNorm; + + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* Uses the RxObjSpace3DVertex type (see pipmodel.h) */ +extern RxClusterDefinition RxClObjSpace3DVertices; +/* Uses the RxCamSpace3DVertex type */ +extern RxClusterDefinition RxClCamSpace3DVertices; +/* Uses the RxScrSpace2DVertex type (see pipmodel.h) */ +extern RxClusterDefinition RxClScrSpace2DVertices; +/* Uses the RxInterp type */ +extern RxClusterDefinition RxClInterpolants; +/* Uses the RxMeshStateVector type */ +extern RxClusterDefinition RxClMeshState; +/* Uses the RxRenderStateVector type (p2renderstate.c/h) */ +extern RxClusterDefinition RxClRenderState; +/* Uses the RxVertexIndex type */ +extern RxClusterDefinition RxClIndices; +/* Uses the RxScatter type */ +extern RxClusterDefinition RxClScatter; +/* Uses the RxUV type */ +extern RxClusterDefinition RxClUVs; +/* Uses the RxVStep type */ +extern RxClusterDefinition RxClVSteps; +/* Uses the RwRGBAReal type */ +extern RxClusterDefinition RxClRGBAs; +/* Uses the RxCamNorm type */ +extern RxClusterDefinition RxClCamNorms; + +/* Uses the RxTriPlane type. + * NOTE: this is currently not used in any nodes that ship with the SDK */ +extern RxClusterDefinition RxClTriPlanes; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/baim3d.h ---*/ + +/** + * \ingroup datatypes + * RwIm3DTransformFlags + * The bit-field type RwIm3DTransformFlags + * specifies options available for controlling execution of the 3D immediate + * mode pipeline (see API function \ref RwIm3DTransform):*/ +enum RwIm3DTransformFlags +{ + rwIM3D_VERTEXUV = 1, /**modelling) +#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) +#define RwFrameGetMatrix(_f) RwFrameGetMatrixMacro(_f) +#endif + + + +/**************************************************************************** + Function prototypes + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* Finding what is attached to a frame */ +extern RwFrame * +RwFrameForAllObjects(RwFrame * frame, + RwObjectCallBack callBack, + void *data); + +/* Matrix operations */ +extern RwFrame * +RwFrameTranslate(RwFrame * frame, + const RwV3d * v, + RwOpCombineType combine); + +extern RwFrame * +RwFrameRotate(RwFrame * frame, + const RwV3d * axis, + RwReal angle, + RwOpCombineType combine); + +extern RwFrame * +RwFrameScale(RwFrame * frame, + const RwV3d * v, + RwOpCombineType combine); + +extern RwFrame * +RwFrameTransform(RwFrame * frame, + const RwMatrix * m, + RwOpCombineType combine); + +extern RwFrame * +RwFrameOrthoNormalize(RwFrame * frame); + +extern RwFrame * +RwFrameSetIdentity(RwFrame * frame); + +/* Cloning */ +extern RwFrame * +RwFrameCloneHierarchy(RwFrame * root); + +/* Destruction */ +extern RwBool +RwFrameDestroyHierarchy(RwFrame * frame); + +/* Building a frame */ +extern RwFrame * +RwFrameForAllChildren(RwFrame * frame, + RwFrameCallBack callBack, + void *data); + +extern RwFrame * +RwFrameRemoveChild(RwFrame * child); + +extern RwFrame * +RwFrameAddChild(RwFrame * parent, + RwFrame * child); + +#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) +extern RwFrame * +RwFrameGetParent(const RwFrame * frame); +#endif + +/* Getting the root */ +extern RwFrame * +RwFrameGetRoot(const RwFrame * frame); + +/* Getting Matrices */ +extern RwMatrix * +RwFrameGetLTM(RwFrame * frame); + +#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) +extern RwMatrix * +RwFrameGetMatrix(RwFrame * frame); +#endif + +/* Elements */ +extern RwFrame * +RwFrameUpdateObjects(RwFrame * frame); + +/* Creating destroying frames */ +extern RwFrame * +RwFrameCreate(void); + +extern RwBool +RwFrameInit(RwFrame *frame); + +extern RwBool +RwFrameDeInit(RwFrame *frame); + +extern RwBool +RwFrameDestroy(RwFrame * frame); + +/* internal function used by Create and Init */ +extern void +_rwFrameInit(RwFrame *frame); + +/* internal function used by Destroy and DeInit */ +extern void +_rwFrameDeInit(RwFrame *frame); + +/* Finding a frames state */ +extern RwBool +RwFrameDirty(const RwFrame * frame); + +/* Find the amount of frames in a hierarchy */ +extern RwInt32 +RwFrameCount(RwFrame * frame); + +/* Plugins */ +extern RwBool +RwFrameSetStaticPluginsSize(RwInt32 size); + +extern RwInt32 +RwFrameRegisterPlugin(RwInt32 size, + RwUInt32 pluginID, + RwPluginObjectConstructor constructCB, + RwPluginObjectDestructor destructCB, + RwPluginObjectCopy copyCB); + +extern RwInt32 +RwFrameGetPluginOffset(RwUInt32 pluginID); + +extern RwBool +RwFrameValidatePlugins(const RwFrame * frame); + +/* Cloning */ +extern RwFrame * +_rwFrameCloneAndLinkClones(RwFrame * root); + +extern +RwFrame * +_rwFramePurgeClone(RwFrame *root); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/* Compatibility macros */ + +#define rwFrameGetParent(frame) \ + _rwFrameGetParent(frame) + +#define rwFrameInit(frame) \ + _rwFrameInit(frame) + +#define rwFrameDeInit(frame) \ + _rwFrameDeInit(frame) + +#define rwFrameCloneAndLinkClones(root) \ + _rwFrameCloneAndLinkClones(root) + +#define rwFramePurgeClone(root) \ + _rwFramePurgeClone(root) + +#define rwFrameClose(instance, offset, size) \ + _rwFrameClose(instance, offset, size) + +#define rwFrameOpen(instance, offset, size) \ + _rwFrameOpen(instance, offset, size) + + +/*--- Automatically derived from: C:/daily/rwsdk/src/batypehf.h ---*/ + +typedef struct RwObjectHasFrame RwObjectHasFrame; +typedef RwObjectHasFrame * (*RwObjectHasFrameSyncFunction)(RwObjectHasFrame *object); +struct RwObjectHasFrame +{ + RwObject object; + RwLLLink lFrame; + RwObjectHasFrameSyncFunction sync; +}; + +/**************************************************************************** + Function prototypes + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* Frames */ +extern void _rwObjectHasFrameSetFrame(void *object, RwFrame *frame); +extern void _rwObjectHasFrameReleaseFrame(void *object); + +/* ObjectHASFRAME METHODS */ +#define rwObjectHasFrameInitialize(o, type, subtype, syncFunc) \ +MACRO_START \ +{ \ + rwObjectInitialize(o, type, subtype); \ + ((RwObjectHasFrame *)o)->sync = syncFunc; \ +} \ +MACRO_STOP + +#define rwObjectHasFrameSync(o) \ + ((RwObjectHasFrame *)(o))->sync(o) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/* Compatibility macros */ + +#define rwObjectHasFrameSetFrame(object, frame) \ + _rwObjectHasFrameSetFrame(object, frame) +#define rwObjectHasFrameReleaseFrame(object) \ + _rwObjectHasFrameReleaseFrame(object) + + + +/*--- Automatically derived from: C:/daily/rwsdk/src/basync.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/src/babintex.h ---*/ +/**************************************************************************** + Global types + */ +typedef struct rpTextureChunkInfo RwTextureChunkInfo; +struct rpTextureChunkInfo +{ + RwTextureFilterMode filtering; + RwTextureAddressMode addressingU; + RwTextureAddressMode addressingV; +}; + +/* Bit flags defining properties of textures when stream */ +enum RwTextureStreamFlags +{ + rwNATEXTURESTREAMFLAG = 0x00, + rwTEXTURESTREAMFLAGSUSERMIPMAPS = 0x01, + rwTEXTURESTREAMFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT +}; +typedef enum RwTextureStreamFlags RwTextureStreamFlags; +/**************************************************************************** + Function prototypes + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* Texture binary format */ +extern RwInt32 +RwTextureRegisterPluginStream(RwUInt32 pluginID, + RwPluginDataChunkReadCallBack readCB, + RwPluginDataChunkWriteCallBack writeCB, + RwPluginDataChunkGetSizeCallBack getSizeCB); + +extern RwInt32 +RwTextureSetStreamAlwaysCallBack(RwUInt32 pluginID, + RwPluginDataChunkAlwaysCallBack alwaysCB); + +extern RwUInt32 +RwTextureStreamGetSize(const RwTexture *texture); + +extern RwTexture * +RwTextureStreamRead(RwStream *stream); + +extern const RwTexture * +RwTextureStreamWrite(const RwTexture *texture, + RwStream *stream); + +/* Texture dictionary binary format */ +extern RwInt32 +RwTexDictionaryRegisterPluginStream(RwUInt32 pluginID, + RwPluginDataChunkReadCallBack readCB, + RwPluginDataChunkWriteCallBack writeCB, + RwPluginDataChunkGetSizeCallBack getSizeCB); + +extern RwInt32 +RwTexDictionarySetStreamAlwaysCallBack(RwUInt32 pluginID, + RwPluginDataChunkAlwaysCallBack alwaysCB); + +extern RwUInt32 +RwTexDictionaryStreamGetSize(const RwTexDictionary *texDict); + +extern RwTexDictionary +*RwTexDictionaryStreamRead(RwStream *stream); + +extern const RwTexDictionary * +RwTexDictionaryStreamWrite(const RwTexDictionary *texDict, + RwStream *stream); + +extern RwTextureChunkInfo * +_rwTextureChunkInfoRead(RwStream *stream, + RwTextureChunkInfo *textureChunkInfo, + RwInt32 *bytesRead); + +/* Compatibility macro */ + +#define RwTextureChunkInfoRead(_stream, _textureChunkInfo, _bytesRead) \ + _rwTextureChunkInfoRead(_stream, _textureChunkInfo, _bytesRead) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/babinfrm.h ---*/ +/**************************************************************************** + Global types + */ + +typedef struct rwFrameList rwFrameList; +struct rwFrameList +{ + RwFrame **frames; + RwInt32 numFrames; +}; + +/**************************************************************************** + Global Variables + */ + +/**************************************************************************** + Function prototypes + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* Frame binary format */ + +extern RwInt32 +RwFrameRegisterPluginStream(RwUInt32 pluginID, + RwPluginDataChunkReadCallBack readCB, + RwPluginDataChunkWriteCallBack writeCB, + RwPluginDataChunkGetSizeCallBack getSizeCB); + +extern RwInt32 +RwFrameSetStreamAlwaysCallBack(RwUInt32 pluginID, + RwPluginDataChunkAlwaysCallBack alwaysCB); + + +extern rwFrameList * +_rwFrameListInitialize(rwFrameList *frameList, + RwFrame *frame); + +extern RwBool +_rwFrameListFindFrame(const rwFrameList *frameList, + const RwFrame *frame, + RwInt32 *npIndex); + +extern rwFrameList * +_rwFrameListDeinitialize(rwFrameList *frameList); + +extern RwUInt32 +_rwFrameListStreamGetSize(const rwFrameList *frameList); + +extern rwFrameList * +_rwFrameListStreamRead(RwStream *stream, + rwFrameList *fl); + +extern const rwFrameList * +_rwFrameListStreamWrite(const rwFrameList *frameList, + RwStream *stream); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/* Comparibility macros */ + +#define rwFrameListInitialize(frameList,frame) \ + _rwFrameListInitialize(frameList,frame) + +#define rwFrameListFindFrame(frameList, frame, index) \ + _rwFrameListFindFrame(frameList, frame, index) + +#define rwFrameListDeinitialize(frameList) \ + _rwFrameListDeinitialize(frameList) + +#define rwFrameListStreamGetSize(frameList) \ + _rwFrameListStreamGetSize(frameList) + +#define rwFrameListStreamRead(stream, fl) \ + _rwFrameListStreamRead(stream, fl) + +#define rwFrameListStreamWrite(frameList, stream) \ + _rwFrameListStreamWrite(frameList, stream) + + +/*--- Automatically derived from: C:/daily/rwsdk/src/babbox.h ---*/ +/**************************************************************************** + Global types + */ + +typedef struct RwBBox RwBBox; +/** + * \ingroup datatypes + * \struct RwBBox + * This type represents a 3D axis-aligned bounding-box + * specified by the positions of two corners which lie on a diagonal. + * Typically used to specify a world bounding-box when the world is created + * + * \param sup Supremum vertex (contains largest values) + * \param inf Infimum vertex (contains smallest values) + * + * \see RpWorldCreate + */ +struct RwBBox +{ + /* Must be in this order */ + RwV3d sup; /**< Supremum vertex. */ + RwV3d inf; /**< Infimum vertex. */ +}; + +#if (!defined(RwBBoxAssign)) +#define RwBBoxAssign(_target, _source) \ + ( *(_target) = *(_source) ) +#endif /* (!defined(RwBBoxAssign)) */ + +/**************************************************************************** + Function prototypes + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + +extern RwBBox *RwBBoxCalculate(RwBBox *boundBox, + const RwV3d *verts, + RwInt32 numVerts); +extern RwBBox *RwBBoxInitialize(RwBBox *boundBox, + const RwV3d *vertex); +extern RwBBox *RwBBoxAddPoint(RwBBox *boundBox, + const RwV3d *vertex); +extern RwBool RwBBoxContainsPoint(const RwBBox *boundBox, + const RwV3d *vertex); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/src/bacamera.h ---*/ + +/**************************************************************************** + Defines + */ + +/* Type ID */ +#define rwCAMERA 4 + + + +/**************************************************************************** + viewOffset)) + +#define RwCameraSetRasterMacro(_camera, _raster) \ + (((_camera)->frameBuffer = (_raster)), (_camera)) + +#define RwCameraSetRasterVoidMacro(_camera, _raster) \ +MACRO_START \ +{ \ + (_camera)->frameBuffer = (_raster); \ +} \ +MACRO_STOP + +#define RwCameraGetRasterMacro(_camera) \ + ((_camera)->frameBuffer) + +#define RwCameraSetZRasterMacro(_camera, _raster) \ + (((_camera)->zBuffer = (_raster)), (_camera)) + +#define RwCameraSetZRasterVoidMacro(_camera, _raster) \ +MACRO_START \ +{ \ + (_camera)->zBuffer = (_raster); \ +} \ +MACRO_STOP + +#define RwCameraGetZRasterMacro(_camera) \ + ((_camera)->zBuffer) + +#define RwCameraGetNearClipPlaneMacro(_camera) \ + ((_camera)->nearPlane) + +#define RwCameraGetFarClipPlaneMacro(_camera) \ + ((_camera)->farPlane) + +#define RwCameraSetFogDistanceMacro(_camera, _distance) \ + (((_camera)->fogPlane = (_distance)), (_camera)) + +#define RwCameraGetFogDistanceMacro(_camera) \ + ((_camera)->fogPlane) + +#define RwCameraGetCurrentCameraMacro() \ + ((RwCamera *)RWSRCGLOBAL(curCamera)) + +#define RwCameraGetProjectionMacro(_camera) \ + ((_camera)->projectionType) + +#define RwCameraGetViewWindowMacro(_camera) \ + (&((_camera)->viewWindow)) + +#define RwCameraGetViewMatrixMacro(_camera) \ + (&((_camera)->viewMatrix)) + +#define RwCameraSetFrameMacro(_camera, _frame) \ + (_rwObjectHasFrameSetFrame((_camera), (_frame)), (_camera)) + +#define RwCameraSetFrameVoidMacro(_camera, _frame) \ +MACRO_START \ +{ \ + _rwObjectHasFrameSetFrame((_camera), (_frame)); \ +} \ +MACRO_STOP + + +#define RwCameraGetFrameMacro(_camera) \ + ((RwFrame *)rwObjectGetParent((_camera))) + +#if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) + +#define RwCameraGetViewOffset(_camera) \ + RwCameraGetViewOffsetMacro(_camera) + +#define RwCameraSetRaster(_camera, _raster) \ + RwCameraSetRasterMacro(_camera, _raster) + +#define RwCameraGetRaster(_camera) \ + RwCameraGetRasterMacro(_camera) + +#define RwCameraSetZRaster(_camera, _raster) \ + RwCameraSetZRasterMacro(_camera, _raster) + +#define RwCameraGetZRaster(_camera) \ + RwCameraGetZRasterMacro(_camera) + +#define RwCameraGetNearClipPlane(_camera) \ + RwCameraGetNearClipPlaneMacro(_camera) + +#define RwCameraGetFarClipPlane(_camera) \ + RwCameraGetFarClipPlaneMacro(_camera) + +#define RwCameraSetFogDistance(_camera, _distance) \ + RwCameraSetFogDistanceMacro(_camera, _distance) + +#define RwCameraGetFogDistance(_camera) \ + RwCameraGetFogDistanceMacro(_camera) + +#define RwCameraGetCurrentCamera() \ + RwCameraGetCurrentCameraMacro() + +#define RwCameraGetProjection(_camera) \ + RwCameraGetProjectionMacro(_camera) + +#define RwCameraGetViewWindow(_camera) \ + RwCameraGetViewWindowMacro(_camera) + +#define RwCameraGetViewMatrix(_camera) \ + RwCameraGetViewMatrixMacro(_camera) + +#define RwCameraSetFrame(_camera, _frame) \ + RwCameraSetFrameMacro(_camera, _frame) + +#define RwCameraGetFrame(_camera) \ + RwCameraGetFrameMacro(_camera) + +#endif /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ + + +/**************************************************************************** + Global Types + */ + +/** + * \ingroup datatypes + * RwCameraClearMode + * Camera clear flags */ +enum RwCameraClearMode +{ + rwCAMERACLEARIMAGE = 0x1, /** used for the frustum callback stuff */ + RwUInt16 renderFrame; + RwUInt16 pad; + + /* The clip-planes making up the viewing frustum */ + RwFrustumPlane frustumPlanes[6]; + RwBBox frustumBoundBox; + + /* Points on the tips of the view frustum */ + RwV3d frustumCorners[8]; +}; +#endif /* (!defined(DOXYGEN)) */ + +/** + * \ingroup datatypes + * \typedef RwCameraCallBack + * \ref RwCameraCallBack type represents a function called from any camera + * iterator that may be implemented in plugins. This function should return a + * pointer to the current camera to indicate success. The callback may return + * NULL to terminate further callbacks on other cameras. + * + * \param camera Pointer to the current camera, supplied by iterator. + * \param data Pointer to developer-defined data structure. + */ +typedef RwCamera *(*RwCameraCallBack)(RwCamera *camera, void *data); + + +/**************************************************************************** + Function prototypes + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + /* Rendering */ +extern RwCamera *RwCameraBeginUpdate(RwCamera * camera); +extern RwCamera *RwCameraEndUpdate(RwCamera * camera); + +extern RwCamera *RwCameraClear(RwCamera * camera, RwRGBA * colour, + RwInt32 clearMode); + +/* Displaying results */ +extern RwCamera *RwCameraShowRaster(RwCamera * camera, void *pDev, + RwUInt32 flags); + +/* Creation and destruction */ +extern RwBool RwCameraDestroy(RwCamera * camera); +extern RwCamera *RwCameraCreate(void); +extern RwCamera *RwCameraClone(RwCamera * camera); + +/* Offset */ +extern RwCamera *RwCameraSetViewOffset(RwCamera *camera, + const RwV2d *offset); + +/* View window */ +extern RwCamera *RwCameraSetViewWindow(RwCamera *camera, + const RwV2d *viewWindow); + +/* Projection */ +extern RwCamera *RwCameraSetProjection(RwCamera *camera, + RwCameraProjection projection); + +/* Clip planes */ +extern RwCamera *RwCameraSetNearClipPlane(RwCamera *camera, RwReal nearClip); +extern RwCamera *RwCameraSetFarClipPlane(RwCamera *camera, RwReal farClip); + +/* Attaching toolkits */ +extern RwInt32 RwCameraRegisterPlugin(RwInt32 size, + RwUInt32 pluginID, + RwPluginObjectConstructor + constructCB, + RwPluginObjectDestructor + destructCB, + RwPluginObjectCopy copyCB); +extern RwInt32 RwCameraGetPluginOffset(RwUInt32 pluginID); +extern RwBool RwCameraValidatePlugins(const RwCamera * camera); + +/* Frustum testing */ +extern RwFrustumTestResult RwCameraFrustumTestSphere(const RwCamera * + camera, + const RwSphere * + sphere); + +#if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) + +/* Offset */ +extern const RwV2d *RwCameraGetViewOffset(const RwCamera *camera); + +/* Rasters */ +extern RwCamera *RwCameraSetRaster(RwCamera *camera, RwRaster *raster); +extern RwRaster *RwCameraGetRaster(const RwCamera *camera); +extern RwCamera *RwCameraSetZRaster(RwCamera *camera, RwRaster *zRaster); +extern RwRaster *RwCameraGetZRaster(const RwCamera *camera); + +/* Clip planes */ +extern RwReal RwCameraGetNearClipPlane(const RwCamera *camera); +extern RwReal RwCameraGetFarClipPlane(const RwCamera *camera); +extern RwCamera *RwCameraSetFogDistance(RwCamera *camera, RwReal fogDistance); +extern RwReal RwCameraGetFogDistance(const RwCamera *camera); + +extern RwCamera *RwCameraGetCurrentCamera(void); + +/* Projection */ +extern RwCameraProjection RwCameraGetProjection(const RwCamera *camera); + +/* View window */ +extern const RwV2d *RwCameraGetViewWindow(const RwCamera *camera); + +extern RwMatrix *RwCameraGetViewMatrix(RwCamera *camera); + +/* Frames */ +extern RwCamera *RwCameraSetFrame(RwCamera *camera, RwFrame *frame); +extern RwFrame *RwCameraGetFrame(const RwCamera *camera); +#endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/*--- Automatically derived from: C:/daily/rwsdk/driver/common/barwtyp.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/src/bacamval.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/bapipe.h ---*/ + +struct rwPipeGlobals +{ + RwFreeList *pipesFreeList; /* Save mallocs, use a freelist */ + RxRenderStateVector defaultRenderState; + RwLinkList allPipelines; /* Unused as of yet, meant to be used to keep track of all + * created pipelines (for CBs and maybe cleanup) */ + RwUInt32 maxNodesPerPipe; /* Initialised from _rxPipelineMaxNodes at startup. Used to + * allow conservative, single allocations during pipelock */ + + /* NOTE: Rw and RpWorld PowerPipe globals kept together for simplicity */ + + /* The current default pipelines (used if pipe == NULL for an object) */ + RxPipeline *currentAtomicPipeline; + RxPipeline *currentWorldSectorPipeline; + RxPipeline *currentMaterialPipeline; + /* Generic C-based pipes that run on all platforms + * - these are set as the current pipes at startup unless + * platform-specific pipes (below) are created */ + RxPipeline *genericAtomicPipeline; + RxPipeline *genericWorldSectorPipeline; + RxPipeline *genericMaterialPipeline; + /* Platforms that have their own non-generic pipelines + * (OPENGL, D3D7, SKY2, KAMUI2, DOLPHIN) put them here: */ + RxPipeline *platformAtomicPipeline; + RxPipeline *platformWorldSectorPipeline; + RxPipeline *platformMaterialPipeline; +#if (defined(SKY2_DRVMODEL_H)) + /* We have extra flavours of pipe under SKY2. + * PS2All and PS2AllMat are the defaults. + * - see RpWorldSectorSkyGetPS2AllPipeline, etc */ + RxPipeline *ps2ManagerAtomicPipeline; + RxPipeline *allInOneAtomicPipeline; + RxPipeline *vanillaAtomicPipeline; + RxPipeline *ps2ManagerWorldSectorPipeline; + RxPipeline *allInOneWorldSectorPipeline; + RxPipeline *vanillaWorldSectorPipeline; + RxPipeline *vanillaMaterialPipeline; +#endif /* (SKY2_DRVMODEL_H) */ + +}; + +typedef struct rwPipeGlobals rwPipeGlobals; + +#define RXPIPELINEGLOBAL(var) (RWPLUGINOFFSET(rwPipeGlobals, RwEngineInstance, _rxPipelineGlobalsOffset)->var) + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +extern RwInt32 _rxPipelineGlobalsOffset; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/*--- Automatically derived from: C:/daily/rwsdk/driver/common/imrascnv.h ---*/ + +/*--- Automatically derived from: C:/daily/rwsdk/src/babincam.h ---*/ +/**************************************************************************** + Global types + */ + +/* Camera stream format */ + +/** + * \ingroup datatypes + * \typedef RwCameraChunkInfo + * + * \ref RwCameraChunkInfo is typedef'd to a structure that holds camera + * data. This should be considered an opaque type. Use the RwCamera + * API functions to access it. + */ + +typedef struct rwStreamCamera RwCameraChunkInfo; +typedef struct rwStreamCamera rwStreamCamera; +struct rwStreamCamera +{ + RwV2d viewWindow; + RwV2d viewOffset; + RwReal nearPlane, farPlane; + RwReal fogPlane; + RwUInt32 projection; +}; + +/**************************************************************************** + Function prototypes + */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* Camera binary format */ +extern RwInt32 RwCameraRegisterPluginStream(RwUInt32 pluginID, + RwPluginDataChunkReadCallBack readCB, + RwPluginDataChunkWriteCallBack writeCB, + RwPluginDataChunkGetSizeCallBack getSizeCB); +extern RwInt32 RwCameraSetStreamAlwaysCallBack( + RwUInt32 pluginID, + RwPluginDataChunkAlwaysCallBack alwaysCB); +extern RwUInt32 RwCameraStreamGetSize(const RwCamera *camera); +extern RwCamera *RwCameraStreamRead(RwStream *stream); +extern const RwCamera *RwCameraStreamWrite(const RwCamera *camera, + RwStream *stream); +extern RwCameraChunkInfo * RwCameraChunkInfoRead(RwStream *stream, + RwCameraChunkInfo *cameraChunkInfo, + RwInt32 *bytesRead); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* RWCORE_H */ -- cgit v1.2.3