summaryrefslogtreecommitdiffstats
path: root/sdk/rwsdk
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-08-02 18:49:12 +0200
committerSergeanur <s.anureev@yandex.ua>2020-08-02 18:49:12 +0200
commit3e24ae8812ca4a0031d82ea7f7393605b8a4283a (patch)
tree5cc79378e86970d3b63cbed173d627410ea90ca6 /sdk/rwsdk
parentMerge pull request #669 from erorcun/miami (diff)
parentMove sdk and eax (diff)
downloadre3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.tar
re3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.tar.gz
re3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.tar.bz2
re3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.tar.lz
re3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.tar.xz
re3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.tar.zst
re3-3e24ae8812ca4a0031d82ea7f7393605b8a4283a.zip
Diffstat (limited to 'sdk/rwsdk')
-rw-r--r--sdk/rwsdk/include/d3d8/errcom.def60
-rw-r--r--sdk/rwsdk/include/d3d8/errcore.def117
-rw-r--r--sdk/rwsdk/include/d3d8/rpanisot.h54
-rw-r--r--sdk/rwsdk/include/d3d8/rpanisot.rpe173
-rw-r--r--sdk/rwsdk/include/d3d8/rpcollis.h372
-rw-r--r--sdk/rwsdk/include/d3d8/rpcollis.rpe171
-rw-r--r--sdk/rwsdk/include/d3d8/rpcriter.h106
-rw-r--r--sdk/rwsdk/include/d3d8/rpdbgerr.c90
-rw-r--r--sdk/rwsdk/include/d3d8/rpdbgerr.h293
-rw-r--r--sdk/rwsdk/include/d3d8/rpdmorph.h311
-rw-r--r--sdk/rwsdk/include/d3d8/rpdmorph.rpe173
-rw-r--r--sdk/rwsdk/include/d3d8/rperror.h32
-rw-r--r--sdk/rwsdk/include/d3d8/rphanim.h641
-rw-r--r--sdk/rwsdk/include/d3d8/rphanim.rpe173
-rw-r--r--sdk/rwsdk/include/d3d8/rplodatm.h134
-rw-r--r--sdk/rwsdk/include/d3d8/rplodatm.rpe176
-rw-r--r--sdk/rwsdk/include/d3d8/rplogo.h83
-rw-r--r--sdk/rwsdk/include/d3d8/rplogo.rpe173
-rw-r--r--sdk/rwsdk/include/d3d8/rpltmap.h99
-rw-r--r--sdk/rwsdk/include/d3d8/rpltmap.rpe172
-rw-r--r--sdk/rwsdk/include/d3d8/rpmatfx.h241
-rw-r--r--sdk/rwsdk/include/d3d8/rpmatfx.rpe172
-rw-r--r--sdk/rwsdk/include/d3d8/rpmipkl.h62
-rw-r--r--sdk/rwsdk/include/d3d8/rpmipkl.rpe173
-rw-r--r--sdk/rwsdk/include/d3d8/rpmorph.h137
-rw-r--r--sdk/rwsdk/include/d3d8/rpmorph.rpe175
-rw-r--r--sdk/rwsdk/include/d3d8/rppatch.h695
-rw-r--r--sdk/rwsdk/include/d3d8/rppatch.rpe172
-rw-r--r--sdk/rwsdk/include/d3d8/rpprtstd.h1073
-rw-r--r--sdk/rwsdk/include/d3d8/rpprtstd.rpe173
-rw-r--r--sdk/rwsdk/include/d3d8/rpptank.h828
-rw-r--r--sdk/rwsdk/include/d3d8/rpptank.rpe177
-rw-r--r--sdk/rwsdk/include/d3d8/rppvs.h398
-rw-r--r--sdk/rwsdk/include/d3d8/rppvs.rpe174
-rw-r--r--sdk/rwsdk/include/d3d8/rprandom.h65
-rw-r--r--sdk/rwsdk/include/d3d8/rprandom.rpe172
-rw-r--r--sdk/rwsdk/include/d3d8/rpskin.h276
-rw-r--r--sdk/rwsdk/include/d3d8/rpskin.rpe172
-rw-r--r--sdk/rwsdk/include/d3d8/rpspline.h141
-rw-r--r--sdk/rwsdk/include/d3d8/rpspline.rpe176
-rw-r--r--sdk/rwsdk/include/d3d8/rpusrdat.h124
-rw-r--r--sdk/rwsdk/include/d3d8/rpusrdat.rpe173
-rw-r--r--sdk/rwsdk/include/d3d8/rpworld.h3758
-rw-r--r--sdk/rwsdk/include/d3d8/rpworld.rpe63
-rw-r--r--sdk/rwsdk/include/d3d8/rt2d.h1028
-rw-r--r--sdk/rwsdk/include/d3d8/rt2d.rpe164
-rw-r--r--sdk/rwsdk/include/d3d8/rt2danim.h1107
-rw-r--r--sdk/rwsdk/include/d3d8/rt2danim.rpe163
-rw-r--r--sdk/rwsdk/include/d3d8/rtanim.h638
-rw-r--r--sdk/rwsdk/include/d3d8/rtanim.rpe168
-rw-r--r--sdk/rwsdk/include/d3d8/rtbary.h141
-rw-r--r--sdk/rwsdk/include/d3d8/rtbary.rpe179
-rw-r--r--sdk/rwsdk/include/d3d8/rtbezpat.h396
-rw-r--r--sdk/rwsdk/include/d3d8/rtbezpat.rpe163
-rw-r--r--sdk/rwsdk/include/d3d8/rtbmp.h51
-rw-r--r--sdk/rwsdk/include/d3d8/rtbmp.rpe163
-rw-r--r--sdk/rwsdk/include/d3d8/rtcharse.h111
-rw-r--r--sdk/rwsdk/include/d3d8/rtcharse.rpe163
-rw-r--r--sdk/rwsdk/include/d3d8/rtgncpip.h256
-rw-r--r--sdk/rwsdk/include/d3d8/rtgncpip.rpe172
-rw-r--r--sdk/rwsdk/include/d3d8/rtimport.h1338
-rw-r--r--sdk/rwsdk/include/d3d8/rtimport.rpe174
-rw-r--r--sdk/rwsdk/include/d3d8/rtintsec.h138
-rw-r--r--sdk/rwsdk/include/d3d8/rtintsec.rpe162
-rw-r--r--sdk/rwsdk/include/d3d8/rtltmap.h644
-rw-r--r--sdk/rwsdk/include/d3d8/rtltmap.rpe172
-rw-r--r--sdk/rwsdk/include/d3d8/rtmipk.h58
-rw-r--r--sdk/rwsdk/include/d3d8/rtmipk.rpe162
-rw-r--r--sdk/rwsdk/include/d3d8/rtpick.h59
-rw-r--r--sdk/rwsdk/include/d3d8/rtpick.rpe162
-rw-r--r--sdk/rwsdk/include/d3d8/rtpitexd.h74
-rw-r--r--sdk/rwsdk/include/d3d8/rtpitexd.rpe216
-rw-r--r--sdk/rwsdk/include/d3d8/rtpng.h49
-rw-r--r--sdk/rwsdk/include/d3d8/rtpng.rpe163
-rw-r--r--sdk/rwsdk/include/d3d8/rtquat.h646
-rw-r--r--sdk/rwsdk/include/d3d8/rtquat.rpe179
-rw-r--r--sdk/rwsdk/include/d3d8/rtras.h54
-rw-r--r--sdk/rwsdk/include/d3d8/rtras.rpe163
-rw-r--r--sdk/rwsdk/include/d3d8/rtray.h63
-rw-r--r--sdk/rwsdk/include/d3d8/rtray.rpe162
-rw-r--r--sdk/rwsdk/include/d3d8/rtskinsp.h57
-rw-r--r--sdk/rwsdk/include/d3d8/rtskinsp.rpe163
-rw-r--r--sdk/rwsdk/include/d3d8/rtslerp.h262
-rw-r--r--sdk/rwsdk/include/d3d8/rtslerp.rpe180
-rw-r--r--sdk/rwsdk/include/d3d8/rtsplpvs.h65
-rw-r--r--sdk/rwsdk/include/d3d8/rtsplpvs.rpe162
-rw-r--r--sdk/rwsdk/include/d3d8/rttiff.h47
-rw-r--r--sdk/rwsdk/include/d3d8/rttiff.rpe163
-rw-r--r--sdk/rwsdk/include/d3d8/rttilerd.h70
-rw-r--r--sdk/rwsdk/include/d3d8/rttilerd.rpe163
-rw-r--r--sdk/rwsdk/include/d3d8/rttoc.h102
-rw-r--r--sdk/rwsdk/include/d3d8/rttoc.rpe163
-rw-r--r--sdk/rwsdk/include/d3d8/rtvcat.h38
-rw-r--r--sdk/rwsdk/include/d3d8/rtvcat.rpe163
-rw-r--r--sdk/rwsdk/include/d3d8/rtworld.h85
-rw-r--r--sdk/rwsdk/include/d3d8/rtworld.rpe162
-rw-r--r--sdk/rwsdk/include/d3d8/rwcore.h4428
-rw-r--r--sdk/rwsdk/include/d3d8/rwplcore.h6271
98 files changed, 36018 insertions, 0 deletions
diff --git a/sdk/rwsdk/include/d3d8/errcom.def b/sdk/rwsdk/include/d3d8/errcom.def
new file mode 100644
index 00000000..25f44e1e
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/errcom.def
@@ -0,0 +1,60 @@
+RWECODE(E_RW_BADENGINESTATE,
+ "Engine in incorrect state for this operation")
+RWECODE(E_RW_BADOPEN,
+ "Error opening the file %s")
+RWECODE(E_RW_BADPARAM,
+ "Invalid Parameter passed. %s")
+RWECODE(E_RW_BADVERSION,
+ "The binary file format version is incompatible with this library")
+RWECODE(E_RW_DEBUGSTACK,
+ "Debug Library has Stack Depth mismatch")
+RWECODE(E_RW_DEFAULTPIPELINECREATION,
+ "Creation of a default pipeline (%s) failed")
+RWECODE(E_RW_FRAMENOMATRIX,
+ "The frame does not have an associated matrix")
+RWECODE(E_RW_INVIMAGEDEPTH,
+ "Invalid Image Depth")
+RWECODE(E_RW_INVIMAGEFORMAT,
+ "Image has no pixel memory allocated")
+RWECODE(E_RW_INVIMAGEMASK,
+ "The mask and image are not the same size")
+RWECODE(E_RW_INVIMAGESIZE,
+ "Destination and source images are of differing sizes")
+RWECODE(E_RW_INVRASTERDEPTH,
+ "Invalid Raster depth")
+RWECODE(E_RW_INVRASTERFORMAT,
+ "Unrecognized raster format")
+RWECODE(E_RW_INVRASTERLOCKREQ,
+ "Invalid Raster lock request")
+RWECODE(E_RW_INVRASTERMIPLEVEL,
+ "Invalid Raster mipmap level")
+RWECODE(E_RW_INVRASTERSIZE,
+ "Invalid Raster size")
+RWECODE(E_RW_INVRASTERUNLOCKREQ,
+ "Invalid Raster unlock request")
+RWECODE(E_RW_NOFRAME,
+ "Unable to find Frame")
+RWECODE(E_RW_NOMEM,
+ "Unable to allocate %d bytes of memory")
+RWECODE(E_RW_NOMIPMAPGENERATIONCALLBACK,
+ "No Mipmap generation callback set - use RtMipmapUseDefaultMipmapGenerationCallback")
+RWECODE(E_RW_NOTSSEENABLEDCPU,
+ "Not SSE enabled CPU")
+RWECODE(E_RW_NULLP,
+ "NULL pointer passed to library routine")
+RWECODE(E_RW_PLUGININIT,
+ "Plugin has already been initialized")
+RWECODE(E_RW_PLUGINNOTINIT,
+ "Plugin not initialized")
+RWECODE(E_RW_RANGE,
+ "A supplied parameter was outside the expected range")
+RWECODE(E_RW_READ,
+ "Read error on stream")
+RWECODE(E_RW_REDUNDANT_FUNCTION,
+ "Call to redundant function - scheduled to be dropped from future releases")
+RWECODE(E_RW_WRITE,
+ "Write error on stream")
+RWECODE(E_RX_MESHES_RANGES_OVERLAP,
+ "\n Geometry is in an invalid format for RxPipeline rendering.\n There may be visible artifacts and/or decreased performance.\n Use RpGeometrySortByMaterial.\n [stream %p type %s]")
+RWECODE(E_RW_STRING_TRUNCATION,
+ "strlen(%s) >= %d; truncating at character #%d == %c")
diff --git a/sdk/rwsdk/include/d3d8/errcore.def b/sdk/rwsdk/include/d3d8/errcore.def
new file mode 100644
index 00000000..c71eed5a
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/errcore.def
@@ -0,0 +1,117 @@
+RWECODE(E_RW_BADWINDOW,
+ "Invalid view window dimensions supplied")
+RWECODE(E_RW_CHUNKTYPEGET,
+ "Unable to get a chunk of the given type")
+RWECODE(E_RW_DEVICEERROR,
+ "Device specific error: %s")
+RWECODE(E_RW_DEVICEOPEN,
+ "Request to open device system refused")
+RWECODE(E_RW_DEVICESTART,
+ "Attempt to start Device failed")
+RWECODE(E_RW_ENDOFSTREAM,
+ "At the end of the stream.")
+RWECODE(E_RW_FRAMEDESTROYSTATIC,
+ "RwFrameDestroy called on static frame.")
+RWECODE(E_RW_FRAMEBUFFERMISMATCH,
+ "Resolutions of parent rasters of frame buffer and Z buffer are different")
+RWECODE(E_RW_FREELISTFREED,
+ "Free List value already on the free list")
+RWECODE(E_RW_FREELISTINVADDRESS,
+ "Invalid Free List memory address")
+RWECODE(E_RW_FREELISTINVMEMBOUND,
+ "Invalid Free List memory boundary")
+RWECODE(E_RW_FREELISTTRASH,
+ "An unused Free List entry has been overwritten")
+RWECODE(E_RW_INSUFFICIENTRESOURCES,
+ "Insufficient resources to satisfy the allocation of %d bytes.")
+RWECODE(E_RW_INVSTREAMACCESSTYPE,
+ "Invalid stream access type.")
+RWECODE(E_RW_INVSTREAMTYPE,
+ "Invalid stream type.")
+RWECODE(E_RW_NEGCLIPPLANE,
+ "Negative positioned clip planes are invalid")
+RWECODE(E_RW_NOCAMERA,
+ "Cannot render until a Camera has been created")
+RWECODE(E_RW_NOFRAMEBUFFER,
+ "Camera has no frame buffer raster")
+RWECODE(E_RW_NOPARENT,
+ "The given object has no parent")
+RWECODE(E_RW_RASTERRECT,
+ "Rectangle is not totally within Raster")
+RWECODE(E_RW_RASTERSTACK,
+ "Insufficient Raster stack space available")
+RWECODE(E_RW_RASTERSTACKEMPTY,
+ "No Raster Currently on Stack")
+RWECODE(E_RW_READTEXMASK,
+ "Unable to read Texture %s / Mask %s")
+RWECODE(E_RW_STREAMOPEN,
+ "Unable to open stream : %s")
+RWECODE(E_RW_SYSTEMREQUEST,
+ "A system request call has failed, request code : 0x%x")
+RWECODE(E_RW_ZEROLENGTH,
+ "A Vector of Zero Length was passed for normalizing")
+RWECODE(E_RX_CANNOT_TRANSFER_BETWEEN_NODES,
+ "Node %s cannot output to node %s")
+RWECODE(E_RX_CANNOT_TRANSFER_FROM_NODE_TO_PIPELINE,
+ "Node %s cannot output to specified pipeline")
+RWECODE(E_RX_CYCLICPIPELINE,
+ "Pipeline contains cycles; illegal")
+RWECODE(E_RX_DEP_DEPENDENCIESMISMATCH,
+ "\n"
+ "*** dependencies cannot be satisfied.\n"
+ "*** rxCLREQ_REQUIRED on cluster %s, originating\n"
+ "*** with node %s, not serviced by a rxCLVALID_VALID -\n"
+ "*** blocked at node %s, output #%ld (\"%s\").")
+RWECODE(E_RX_DEP_DUPLICATECLUSTERDEFS,
+ "\n"
+ "*** Node %s specifies RxClusterDefinition for cluster %s more than once in\n"
+ "*** clusters of interest array. Distinct clusters within a pipeline must reference\n"
+ "*** distinct RxClusterDefinitions, even if the clusters contain the same data type\n")
+RWECODE(E_RX_DEP_NULLCLUSTERDEF,
+ "Node %s specified with RxClusterDefinition pointer NULL for cluster of interest %d\n")
+RWECODE(E_RX_DEP_OUTOFMEMORY,
+ "Dependency chasing; memory alloc failed")
+RWECODE(E_RX_EMPTYPIPELINE,
+ "RwPipeline2Execute cannot execute a pipeline with no nodes :)")
+RWECODE(E_RX_FRAGMENTEDPIPELINE,
+ "Pipeline forms two or more unconnected graphs; illegal")
+RWECODE(E_RX_IM3DNOTACTIVE,
+ "Cannot render Im3D primitives outside of a RwIm3dTransform()/RwIm3dEnd() pair")
+RWECODE(E_RX_INVALIDENTRYPOINT,
+ "Pipeline has an invalid entry point")
+RWECODE(E_RX_INVALIDPRIMTYPE,
+ "Unknown primitive type %d")
+RWECODE(E_RX_INVALIDRESUMEPIPELINE,
+ "RwPipeline2Execute cannot resume a different pipeline to the one previously interrupted")
+RWECODE(E_RX_LOCKEDPIPE,
+ "Illegal operation on a locked pipeline")
+RWECODE(E_RX_NODETOOMANYCLUSTERSOFINTEREST,
+ "Node contains more than RXNODEMAXCLUSTERSOFINTEREST clusters of interest; illegal")
+RWECODE(E_RX_NODETOOMANYOUTPUTS,
+ "Node contains more than RXNODEMAXOUTPUTS outputs; illegal")
+RWECODE(E_RX_PIPELINETOOMANYNODES,
+ "Maximum nodes per pipeline exceeded! You may increase the limit by changing the value of _rxPipelineMaxNodes BEFORE starting RenderWare")
+RWECODE(E_RX_NODE_EXECUTION_FAILED,
+ "Node execution failed - %s")
+RWECODE(E_RX_NOVERTS,
+ "Cannot render Im3D primitive - not enough vertices transformed")
+RWECODE(E_RX_PACKETPTRINVALID,
+ "Value of input/output interruption packets pointer not as expected")
+RWECODE(E_RX_PACKETSCOPYFAILED,
+ "Failed to make copies of packets input to RxPipelineExecute()")
+RWECODE(E_RX_RUNFROMNOTVALID,
+ "RunFrom node not a member of the specified pipeline")
+RWECODE(E_RX_RUNTOANDRUNFROM,
+ "RwPipeline2Execute cannot accept both RunTo *and* RunFrom")
+RWECODE(E_RX_RUNTONOTVALID,
+ "RunTo node not a member of the specified pipeline")
+RWECODE(E_RX_TOOMANYVERTS,
+ "More than 65536 vertices passed to RwIm3DTransform; illegal")
+RWECODE(E_RX_UNFINISHEDPIPELINE,
+ "RwPipeline2Execute must resume and finish an interrupted pipeline")
+RWECODE(E_RX_UNLOCKEDPIPE,
+ "Illegal operation on an unlocked pipeline")
+RWECODE(E_RX_UNPROCESSED_PACKETS,
+ "Unprocessed packets found in finished execution context")
+RWECODE(E_RX_UNSATISFIED_REQUIREMENTS,
+ "Cannot send packet between pipelines, requirements not satisfied. Cluster '%s' is missing")
diff --git a/sdk/rwsdk/include/d3d8/rpanisot.h b/sdk/rwsdk/include/d3d8/rpanisot.h
new file mode 100644
index 00000000..323786f4
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpanisot.h
@@ -0,0 +1,54 @@
+/**
+ * Anisotropic Texture Sampling Plugin for RenderWare.
+ */
+
+#ifndef RPANISOTPLUGIN_H
+#define RPANISOTPLUGIN_H
+
+/**
+ * \defgroup rpanisot RpAnisot
+ * \ingroup mipmapping
+ *
+ * Anisotropic Texture Sampling Plugin for RenderWare Graphics.
+ */
+
+/**
+ * \ingroup rpanisot
+ * \page rpanisotoverview RpAnisot Plugin Overview
+ *
+ * \par Requirements
+ * \li \b Headers: rwcore.h, rpworld.h, rpanisot.h
+ * \li \b Libraries: rwcore, rpworld, rpanisot
+ * \li \b Plugin \b attachments: \ref RpWorldPluginAttach, \ref RpAnisotPluginAttach
+ *
+ * \subsection anisotoverview Overview
+ * The RpAnisot plugin is used to extend an \ref RwTexture with a maximum
+ * anisotropy value that will be used when a particular texture is drawn.
+ * When textured polygons are viewed nearly edge on, for example when looking
+ * dowm a road or a football pitch, distant pixels are not sampled very well
+ * by trilinear mipmapping and the texture looks smeary.
+ * Anisotropic sampling takes additional samples, resulting in sharper looking
+ * textures. Higher numbers of samples will produce better quality results but
+ * run slower, so should be used in moderation.
+ *
+ */
+
+#include <rwcore.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+extern RwInt8 RpAnisotGetMaxSupportedMaxAnisotropy(void);
+
+extern RwTexture *RpAnisotTextureSetMaxAnisotropy(RwTexture *tex, RwInt8 val);
+extern RwInt8 RpAnisotTextureGetMaxAnisotropy(RwTexture *tex);
+
+extern RwBool RpAnisotPluginAttach(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RPANISOTPLUGIN_H */
diff --git a/sdk/rwsdk/include/d3d8/rpanisot.rpe b/sdk/rwsdk/include/d3d8/rpanisot.rpe
new file mode 100644
index 00000000..0464081f
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpanisot.rpe
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionLabel
+{
+
+
+
+ e_rwdb_CriterionLabelLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionLabel e_rwdb_CriterionLabel;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpcollis.h b/sdk/rwsdk/include/d3d8/rpcollis.h
new file mode 100644
index 00000000..23e67f35
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpcollis.h
@@ -0,0 +1,372 @@
+
+/*****************************************************************************
+ *
+ * File : rpcollis.h
+ *
+ * Abstract : World collision plugin for Renderware.
+ *
+ *****************************************************************************
+ *
+ * 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. will not, under any
+ * circumstances, be liable for any lost revenue or other damages arising
+ * from the use of this file.
+ *
+ * Copyright (c) 2000 Criterion Software Ltd.
+ * All Rights Reserved.
+ *
+ * RenderWare is a trademark of Canon Inc.
+ *
+ *****************************************************************************/
+
+#ifndef RPCOLLIS_H
+#define RPCOLLIS_H
+
+/* Doxygen plugin groups. */
+
+/**
+ * \defgroup rpcollis RpCollision
+ * \ingroup collisiondetection
+ *
+ * Collision Plugin for RenderWare Graphics.
+ */
+
+/******************************************************************************
+ * Include files
+ */
+
+#include <rwcore.h>
+#include <rpworld.h>
+
+#include "rpcollis.rpe" /* automatically generated header file */
+
+/******************************************************************************
+ * Global Types
+ */
+
+/**
+ * \ingroup rpcollis
+ * RpIntersectType, this type represents the different types of
+ * primitives that can be used to intersect with an object (for example, see
+ * \ref RpCollisionWorldForAllIntersections):
+ */
+enum RpIntersectType
+{
+ rpINTERSECTNONE = 0,
+ rpINTERSECTLINE, /**<Line Intersection */
+ rpINTERSECTPOINT, /**<Point Intersection */
+ rpINTERSECTSPHERE, /**<Sphere Intersection */
+ rpINTERSECTBOX, /**<Box intersection */
+ rpINTERSECTATOMIC, /**<Atomic Intersection based on bounding sphere */
+ rpINTERSECTTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpIntersectType RpIntersectType;
+
+typedef union RpIntersectData RpIntersectData;
+/**
+ * \ingroup rpcollis
+ * RpIntersectData, this union type is used to specify the parameters
+ * for an intersection primitive of the desired type (\ref RpIntersectType)
+ */
+union RpIntersectData
+{
+ RwLine line; /**<For type rpINTERSECTLINE */
+ RwV3d point; /**<For type rpINTERSECTPOINT */
+ RwSphere sphere; /**<For type rpINTERSECTSPHERE */
+ RwBBox box; /**<For type rpINTERSECTBOX */
+ void *object; /**<For type rpINTERSECTATOMIC - this
+ * should hold a pointer to the atomic */
+};
+
+typedef struct RpIntersection RpIntersection;
+/**
+ * \ingroup rpcollis
+ * \struct RpIntersection
+ * Intersection Object. This type represents data for an
+ * intersection primitive. It specifies the intersection type
+ * (line, sphere, etc.) (type) and parameters describing the given type (t):
+ */
+struct RpIntersection
+{
+ RpIntersectData t; /**< Intersection data. Union type - one
+ * of line, point, sphere or RW object */
+ RpIntersectType type; /**< Intersection type - see
+ * \ref RpIntersectType */
+};
+
+typedef struct RpCollisionTriangle RpCollisionTriangle;
+/**
+ * \ingroup rpcollis
+ * \struct RpCollisionTriangle
+ * A structure representing a collision between
+ * an \ref RpIntersection primitive and a triangle.
+ * The collision is specified by the triangle's plane normal
+ * (normal), the first triangle vertex (point), an index to the triangle in
+ * the object geometry's triangle list (index) and the positions of the
+ * triangle's vertices (vertices). Note all vector components are in object
+ * space.
+ *
+ * \see RpCollisionWorldForAllIntersections
+ * \see RpCollisionGeometryForAllIntersections
+ * \see RpAtomicForAllIntersections
+ * \see RpIntersectionCallBackWorldTriangle
+ * \see RpIntersectionCallBackGeometryTriangle
+ */
+struct RpCollisionTriangle
+{
+ RwV3d normal; /**< Triangle normal */
+ RwV3d point; /**< First triangle vertex */
+ RwInt32 index; /**< Index of triangle in object (if applicable) */
+ RwV3d *vertices[3]; /**< Pointers to three triangle vertices */
+};
+
+typedef struct RpCollisionBuildParam RpCollisionBuildParam;
+/**
+ * \ingroup rpcollis
+ * \struct RpCollisionBuildParam
+ * This structure is a place-holder for parameters that may be
+ * introduced in future to control the generation of collision data when using
+ * the functions \ref RpCollisionWorldSectorBuildData,
+ * \ref RpCollisionWorldBuildData or \ref RpCollisionGeometryBuildData.
+ * Currently, a NULL pointer should be passed to these functions, as no
+ * parameters are defined. If parameters are introduced, a NULL pointer will
+ * indicate that default values should be used.
+ */
+struct RpCollisionBuildParam
+{
+ RwInt32 dummy; /**< Not used */
+};
+
+/**
+ * \ingroup rpcollis
+ * \ref RpIntersectionCallBackWorldTriangle represents the function called
+ * from \ref RpCollisionWorldForAllIntersections for all intersections between
+ * the specified primitive and the static geometry in a given world. This
+ * function should return a pointer to the current collision triangle to
+ * indicate success. The callback may return NULL to terminate further
+ * callbacks on the world.
+ *
+ * \note The memory pointed to by collTriangle is stored on the stack.
+ * This memory should be considered volatile. To use this data outside
+ * of the iterator, copy the contents.
+ *
+ * \param intersection Pointer to the intersection primitive.
+ * \param sector Pointer to the world sector containing the triangle.
+ * \param collTriangle Pointer to the \ref RpCollisionTriangle representing
+ * the triangle in the world's static geometry that is intersected.
+ * \param distance The distance to the intersection point(s).
+ * Note that the distance returned depends on the intersection type and is
+ * normalized for the given intersection primitive.
+ * \li rpINTERSECTLINE Distance from start of line to collision
+ * triangle, normalized to length of line.
+ * \li rpINTERSECTSPHERE Distance of sphere's center from the collision
+ * triangle along the direction of the normal, and normalized
+ * to the sphere's radius (may be negative if the sphere center
+ * is behind the triangle's plane with respect to the direction
+ * of the normal).
+ * \li rpINTERSECTBOX Distance is undefined.
+ * \li rpINTERSECTATOMIC Distance of atomic's bounding-sphere center
+ * from the collision triangle along the direction of the normal
+ * and normalized to sphere's radius.
+ * \param data User defined data pointer
+ *
+ * \return Pointer to the current collision triangle.
+ */
+typedef RpCollisionTriangle *(*RpIntersectionCallBackWorldTriangle)
+ (RpIntersection * intersection,
+ RpWorldSector * sector,
+ RpCollisionTriangle * collTriangle, RwReal distance, void *data);
+
+/**
+ * \ingroup rpcollis
+ * \ref RpIntersectionCallBackAtomic represents the function called from
+ * \ref RpWorldForAllAtomicIntersections for all intersections between the
+ * specified primitive and collision atomics in a given world. This function
+ * should return the current atomic to indicate success. The callback may
+ * return NULL to terminate further callbacks on the world.
+ *
+ * \param intersection Pointer to the intersection primitive.
+ * \param sector Pointer to the world sector containing
+ * the intersected triangles.
+ * \param atomic Pointer to the intersected atomic.
+ * \param distance The collision distance. The distance returned
+ * depends on the intersection type which is defined in \ref RpIntersectType.
+ * \li rpINTERSECTPOINT Distance of point from atomic's bounding
+ * sphere center, normalized to sphere's radius.
+ * \li rpINTERSECTLINE Distance of atomic's bounding-sphere center from
+ * start of line, projected onto the line, normalized to length of line.
+ * Note that by this definition, if the line starts or ends inside the
+ * sphere, this distance maybe negative or greater than one.
+ * \li rpINTERSECTSPHERE Distance of atomic's bounding-sphere center
+ * from sphere's center, normalized to sum of spheres' radii.
+ * \li rpINTERSECTBOX Distance undefined.
+ * \li rpINTERSECTATOMIC Distance between atomics' bounding-sphere
+ * centers, normalized to sum of spheres' radii.
+ * \param data User defined data pointer.
+ *
+ * \return Pointer to the current atomic.
+ */
+typedef RpAtomic *(*RpIntersectionCallBackAtomic)
+ (RpIntersection * intersection,
+ RpWorldSector * sector, RpAtomic * atomic, RwReal distance, void *data);
+
+/**
+ * \ingroup rpcollis
+ * \ref RpIntersectionCallBackWorldSector represents the function called from
+ * \ref RpWorldForAllWorldSectorIntersections for all intersections between the
+ * specified primitive and world sectors in a given world. This function should
+ * return the current world sector to indicate success. The callback may return
+ * NULL to terminate further callbacks on the world.
+ *
+ * \param intersection Pointer to the intersection primitive.
+ * \param sector Pointer to the world sector containing the intersected
+ * polygons.
+ * \param data User defined data pointer
+ *
+ * \return Pointer to the current world sector.
+ */
+typedef RpWorldSector *(*RpIntersectionCallBackWorldSector)
+ (RpIntersection * intersection, RpWorldSector * worldSector, void *data);
+
+/**
+ * \ingroup rpcollis
+ * \ref RpIntersectionCallBackGeometryTriangle represents the function called
+ * from \ref RpAtomicForAllIntersections and
+ * \ref RpCollisionGeometryForAllIntersections
+ * for all intersections between the specified primitive and a given atomic.
+ * This function should return a pointer to the current collision triangle to
+ * indicate success. The callback may return NULL to terminate further
+ * callbacks on the atomic.
+ *
+ * Note that the vertices and normal of the collision triangle are given
+ * in the coordinate space of the geometry. If they are required in world
+ * coordinates, they must be transformed using \ref RwV3dTransformPoints and
+ * \ref RwV3dTransformVectors with the LTM of the atomic's frame. This must
+ * be passed via the user-defined data if required.
+ *
+ * \param intersection Pointer to the intersection primitive.
+ * \param collTri Pointer to the \ref RpCollisionTriangle
+ * representing the triangle in the atomic that is intersected.
+ * \param distance The distance to the intersection point(s).
+ * Note that the distance returned depends on the intersection type and is
+ * normalized for the given intersection primitive.
+ * \li rpINTERSECTLINE Distance from start of line to collision
+ * triangle, normalized to length of line.
+ * \li rpINTERSECTSPHERE Distance of sphere's center from the collision
+ * triangle along the direction of the normal, and normalized
+ * to the sphere's radius (may be negative if the sphere center
+ * is behind the triangle's plane with respect to the direction
+ * of the normal).
+ * \li rpINTERSECTATOMIC Distance of atomic's bounding-sphere center
+ * from the collision triangle along the direction of the normal, and
+ * normalized to sphere's radius.
+ * \param data User defined data pointer
+ *
+ * \return Pointer to the current collision triangle.
+ */
+typedef RpCollisionTriangle *(*RpIntersectionCallBackGeometryTriangle)
+ (RpIntersection *intersection, RpCollisionTriangle *collTriangle,
+ RwReal distance, void *data);
+
+
+/******************************************************************************
+ * Plugin API Functions
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Plugin attachment */
+extern RwBool
+RpCollisionPluginAttach(void);
+
+/* World collisions */
+extern RpWorldSector *
+RpCollisionWorldSectorBuildData(
+ RpWorldSector *worldSector,
+ RpCollisionBuildParam *param);
+
+extern RpWorldSector *
+RpCollisionWorldSectorDestroyData(
+ RpWorldSector *worldSector);
+
+extern RwBool
+RpCollisionWorldSectorQueryData(
+ RpWorldSector *worldSector);
+
+extern RpWorld *
+RpCollisionWorldBuildData(
+ RpWorld *world,
+ RpCollisionBuildParam *param);
+
+extern RpWorld *
+RpCollisionWorldDestroyData(
+ RpWorld *world);
+
+extern RwBool
+RpCollisionWorldQueryData(
+ RpWorld *world);
+
+
+extern RpWorld *
+RpWorldForAllWorldSectorIntersections(
+ RpWorld *world,
+ RpIntersection *intersection,
+ RpIntersectionCallBackWorldSector callBack,
+ void *data);
+
+extern RpWorld *
+RpWorldForAllAtomicIntersections(
+ RpWorld *world,
+ RpIntersection *intersection,
+ RpIntersectionCallBackAtomic callBack,
+ void *data);
+
+extern RpWorld *
+RpCollisionWorldForAllIntersections(
+ RpWorld *world,
+ RpIntersection *intersection,
+ RpIntersectionCallBackWorldTriangle callBack,
+ void *data);
+
+/* Geometry and atomic collisions */
+extern RpGeometry *
+RpCollisionGeometryBuildData(
+ RpGeometry *geometry,
+ RpCollisionBuildParam *param);
+
+extern RwBool
+RpCollisionGeometryQueryData(
+ RpGeometry *geometry);
+
+extern RpGeometry *
+RpCollisionGeometryDestroyData(
+ RpGeometry *geometry);
+
+extern RpGeometry *
+RpCollisionGeometryForAllIntersections(
+ RpGeometry *geometry,
+ RpIntersection *intersection,
+ RpIntersectionCallBackGeometryTriangle callBack,
+ void *data);
+
+extern RpAtomic *
+RpAtomicForAllIntersections(
+ RpAtomic *atomic,
+ RpIntersection *intersection,
+ RpIntersectionCallBackGeometryTriangle callBack,
+ void *data);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RPCOLLIS_H */
+
diff --git a/sdk/rwsdk/include/d3d8/rpcollis.rpe b/sdk/rwsdk/include/d3d8/rpcollis.rpe
new file mode 100644
index 00000000..49ad286f
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpcollis.rpe
@@ -0,0 +1,171 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionCollis
+{
+
+E_RP_COLLIS_INV_INTERSECTION,
+
+ e_rwdb_CriterionCollisLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionCollis e_rwdb_CriterionCollis;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpcriter.h b/sdk/rwsdk/include/d3d8/rpcriter.h
new file mode 100644
index 00000000..de55389f
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpcriter.h
@@ -0,0 +1,106 @@
+#ifdef DOXYGEN
+#include "doxygen.h"
+#endif /* DOXYGEN */
+
+/* These are plugins */
+#define rwID_METRICSPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x01)
+#define rwID_SPLINEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x02)
+#define rwID_STEREOPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x03)
+#define rwID_VRMLPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x04)
+#define rwID_MORPHPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x05)
+#define rwID_PVSPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x06)
+#define rwID_MEMLEAKPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x07)
+#define rwID_ANIMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x08)
+#define rwID_GLOSSPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x09)
+#define rwID_LOGOPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x0a)
+#define rwID_MEMINFOPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x0b)
+#define rwID_RANDOMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x0c)
+#define rwID_PNGIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x0d)
+#define rwID_BONEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x0e)
+#define rwID_VRMLANIMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x0f)
+#define rwID_SKYMIPMAPVAL MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x10)
+#define rwID_MRMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x11)
+#define rwID_LODATMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x12)
+#define rwID_MEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x13)
+#define rwID_LTMAPPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x14)
+#define rwID_REFINEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x15)
+#define rwID_SKINPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x16)
+#define rwID_LABELPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x17)
+#define rwID_PARTICLESPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x18)
+#define rwID_GEOMTXPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x19)
+#define rwID_SYNTHCOREPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x1a)
+#define rwID_STQPPPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x1b)
+#define rwID_PARTPPPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x1c)
+#define rwID_COLLISPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x1d)
+#define rwID_HANIMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x1e)
+#define rwID_USERDATAPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x1f)
+#define rwID_MATERIALEFFECTSPLUGIN \
+ MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x20)
+#define rwID_PARTICLESYSTEMPLUGIN \
+ MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x21)
+#define rwID_DMORPHPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x22)
+#define rwID_PATCHPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x23)
+#define rwID_TEAMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x24)
+#define rwID_CROWDPPPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x25)
+#define rwID_MIPSPLITPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x26)
+#define rwID_ANISOTPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x27)
+/* #define THIS SPACE FREE! MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x28) */
+#define rwID_GCNMATPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x29)
+#define rwID_GPVSPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2a)
+#define rwID_XBOXMATPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2b)
+#define rwID_MULTITEXPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2c)
+#define rwID_CHAINPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2d)
+#define rwID_TOONPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2e)
+#define rwID_PTANKPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2f)
+#define rwID_PRTSTDPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x30)
+#define rwID_PDSPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x31)
+#define rwID_PRTADVPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x32)
+
+/* These are toolkits */
+#define rwID_CHARSEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x80)
+#define rwID_NOHSWORLDPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x81)
+#define rwID_IMPUTILPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x82)
+#define rwID_SLERPPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x83)
+#define rwID_OPTIMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x84)
+#define rwID_TLWORLDPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x85)
+#define rwID_DATABASEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x86)
+#define rwID_RAYTRACEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x87)
+#define rwID_RAYPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x88)
+#define rwID_LIBRARYPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x89)
+#define rwID_2DPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x90)
+#define rwID_TILERENDPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x91)
+#define rwID_JPEGIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x92)
+#define rwID_TGAIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x93)
+#define rwID_GIFIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x94)
+#define rwID_QUATPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x95)
+#define rwID_SPLINEPVSPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x96)
+#define rwID_MIPMAPPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x97)
+#define rwID_MIPMAPKPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x98)
+#define rwID_2DFONT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x99)
+#define rwID_INTSECPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x9a)
+#define rwID_TIFFIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x9b)
+#define rwID_PICKPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x9c)
+#define rwID_BMPIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x9d)
+#define rwID_RASIMAGEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x9e)
+#define rwID_SKINFXPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x9f)
+#define rwID_VCATPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa0)
+#define rwID_2DPATH MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa1)
+#define rwID_2DBRUSH MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa2)
+#define rwID_2DOBJECT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa3)
+#define rwID_2DSHAPE MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa4)
+#define rwID_2DSCENE MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa5)
+#define rwID_2DPICKREGION MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa6)
+#define rwID_2DOBJECTSTRING MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa7)
+#define rwID_2DANIMPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa8)
+#define rwID_2DANIM MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xa9)
+#define rwID_2DKEYFRAME MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb0)
+#define rwID_2DMAESTRO MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb1)
+#define rwID_BARYCENTRIC MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb2)
+#define rwID_PITEXDICTIONARYTK MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb3)
+#define rwID_TOCTOOLKIT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb4)
+#define rwID_TPLTOOLKIT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb5)
+#define rwID_ALTPIPETOOLKIT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb6)
+#define rwID_ANIMTOOLKIT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb7)
+#define rwID_SKINSPLITTOOKIT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb8)
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpdbgerr.c b/sdk/rwsdk/include/d3d8/rpdbgerr.c
new file mode 100644
index 00000000..70bc941d
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpdbgerr.c
@@ -0,0 +1,90 @@
+/*
+ * Debug handling
+ *
+ ****************************************************************************
+ *
+ * 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. will not, under any
+ * circumstances, be liable for any lost revenue or other damages arising
+ * from the use of this file.
+ *
+ * Copyright (c) 1998 Criterion Software Ltd.
+ * All Rights Reserved.
+ *
+ * RenderWare is a trademark of Canon Inc.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ Includes
+ */
+
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <rwcore.h>
+#include <rpdbgerr.h>
+
+static const char rcsid[] __RWUNUSED__ = "@@(#)$Id: rpdbgerr.c,v 1.2 2004/08/31 17:40:34 gtristram Exp $";
+
+#ifdef RWDEBUG
+
+/****************************************************************************
+ Defines
+ */
+
+ /****************************************************************************
+ Local (static) Globals
+ */
+
+/* The strings used in the debug error reporting are derived from the
+ * .def files
+ */
+
+#define RWECODE(a,b) RWSTRING(b),
+
+static const RwChar *rw_err_str[] =
+{
+#include "rperror.def"
+ RWSTRING("Last Error")
+};
+
+#undef RWECODE
+#define RWECODE(a,b) RWSTRING(#a),
+
+static const RwChar *rw_err_cstr[] =
+{
+#include "rperror.def"
+ RWSTRING("E_RW_LAST")
+};
+
+#undef RWECODE
+
+static RwChar dberr[512];
+
+RwChar *
+rwPLUGIN_ERRFUNC(RwInt32 code,...)
+{
+ va_list ap;
+
+#if (0)
+ RWFUNCTION(RWSTRING("rwPLUGIN_ERRFUNC"));
+#endif /* (0) */
+
+ va_start(ap, code);
+
+ rwstrcpy(dberr, rw_err_cstr[code]);
+ rwstrcat(dberr, RWSTRING(" : "));
+ rwvsprintf(&dberr[rwstrlen(dberr)], rw_err_str[code], ap);
+ va_end(ap);
+ return dberr;
+}
+
+#endif /* RWDEBUG */
+
diff --git a/sdk/rwsdk/include/d3d8/rpdbgerr.h b/sdk/rwsdk/include/d3d8/rpdbgerr.h
new file mode 100644
index 00000000..e0500057
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpdbgerr.h
@@ -0,0 +1,293 @@
+/***************************************************************************
+ * *
+ * Module : badebug.h *
+ * *
+ * Purpose : Debug handling *
+ * *
+ **************************************************************************/
+
+#ifndef RWDEBUG_H
+#define RWDEBUG_H
+
+#if (defined(RWDEBUG) && defined(RWVERBOSE))
+#if (defined(_MSC_VER))
+#if (_MSC_VER>=1000)
+
+/* Pick up _ASSERTE macro */
+#ifdef _XBOX
+#include <xtl.h>
+#endif /* _XBOX */
+#if (defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC))
+#define _CRTDBG_MAP_ALLOC
+#endif /* defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) */
+#include <crtdbg.h>
+#undef RWASSERTE
+#define RWASSERTE(_condition) _ASSERTE(_condition)
+#endif /* (_MSC_VER>=1000) */
+#endif /* (defined(_MSC_VER)) */
+#endif /* (defined(RWDEBUG) && defined(RWVERBOSE)) */
+
+#if (!defined(RWASSERTE))
+#define RWASSERTE(_condition) /* No-Op */
+#endif /* (!defined(RWASSERTE)) */
+
+#if (!defined(RWPENTER))
+#define RWPENTER(_func) /* No-Op */
+#endif /* (!defined(RWPENTER)) */
+
+#if (!defined(RWPEXIT))
+#define RWPEXIT(_func) /* No-Op */
+#endif /* (!defined(RWPEXIT)) */
+
+/****************************************************************************
+ Includes
+ */
+
+#include <rwcore.h>
+
+#include "rpplugin.h"
+
+/****************************************************************************
+ Defines
+ */
+
+#ifdef RWDEBUG
+
+#if (!(defined(RWDEBUGSTACKDEPTH)))
+#define RWDEBUGSTACKDEPTH (RWSRCGLOBAL(debugStackDepth))
+#endif /* (!(defined(RWDEBUGSTACKDEPTH))) */
+
+/* Message macros */
+
+#ifdef RWTRACE
+
+/* Note RWTRACE should only be defined for internal builds. It should
+ * also only be used rarely. It will cause the generation of Trace
+ * messages for all functions. Not just those directly called from
+ * the application
+ */
+
+#define RWAPIFUNCTION(function) \
+static const RwChar __dbFunctionName[] = function; \
+const RwInt32 startstackdepth = RWDEBUGSTACKDEPTH++; \
+RWPENTER(__dbFunctionName); \
+if (RWSRCGLOBAL(debugTrace)) \
+{ \
+ RwDebugSendMessage(rwDEBUGTRACE, \
+ __dbFunctionName, \
+ _rwdbsprintf("Enter %s [Depth %d]", \
+ (startstackdepth)?"SPI":"API", \
+ (int)startstackdepth)); \
+}
+
+#define RWFUNCTION(function) RWAPIFUNCTION(function)
+
+#define RWRETURN(result) \
+do \
+{ \
+ RwInt32 _validateStackDepth = --RWDEBUGSTACKDEPTH; \
+ if (_validateStackDepth != startstackdepth) \
+ { \
+ RwDebugSendMessage(rwDEBUGERROR, \
+ __dbFunctionName, \
+ _rwdberrcommon(E_RW_DEBUGSTACK)); \
+ RWDEBUGSTACKDEPTH = startstackdepth; \
+ } \
+ if (RWSRCGLOBAL(debugTrace)) \
+ { \
+ RwDebugSendMessage(rwDEBUGTRACE, \
+ __dbFunctionName, RWSTRING("Exit")); \
+ } \
+ RWASSERTE(_validateStackDepth == startstackdepth); \
+ RWPEXIT(__dbFunctionName); \
+ return (result); \
+} \
+while (0)
+
+#define RWRETURNVOID() \
+do \
+{ \
+ RwInt32 _validateStackDepth = --RWDEBUGSTACKDEPTH; \
+ if (_validateStackDepth != startstackdepth) \
+ { \
+ RwDebugSendMessage(rwDEBUGERROR, \
+ __dbFunctionName, \
+ _rwdberrcommon (E_RW_DEBUGSTACK)); \
+ RWDEBUGSTACKDEPTH = startstackdepth; \
+ } \
+ if (RWSRCGLOBAL(debugTrace)) \
+ { \
+ RwDebugSendMessage(rwDEBUGTRACE, \
+ __dbFunctionName, RWSTRING("Exit")); \
+ } \
+ RWASSERTE(_validateStackDepth == startstackdepth); \
+ RWPEXIT(__dbFunctionName); \
+ return; \
+} \
+while(0)
+
+#else /* RWTRACE */
+
+#define RWAPIFUNCTION(function) \
+static const RwChar __dbFunctionName[] = function; \
+const RwInt32 startstackdepth = RWDEBUGSTACKDEPTH++; \
+RWPENTER(__dbFunctionName); \
+if (RWSRCGLOBAL(debugTrace) && !startstackdepth) \
+{ \
+ RwDebugSendMessage(rwDEBUGTRACE, \
+ __dbFunctionName, RWSTRING("Enter")); \
+}
+
+#define RWFUNCTION(function) RWAPIFUNCTION(function)
+
+#define RWRETURN(result) \
+do \
+{ \
+ RwInt32 _validateStackDepth = --RWDEBUGSTACKDEPTH; \
+ if (_validateStackDepth != startstackdepth) \
+ { \
+ RwDebugSendMessage(rwDEBUGERROR, \
+ __dbFunctionName, \
+ _rwdberrcommon(E_RW_DEBUGSTACK)); \
+ RWDEBUGSTACKDEPTH = startstackdepth; \
+ } \
+ if (RWSRCGLOBAL(debugTrace) && (!startstackdepth)) \
+ { \
+ RwDebugSendMessage(rwDEBUGTRACE, \
+ __dbFunctionName, RWSTRING("Exit")); \
+ } \
+ RWASSERTE(_validateStackDepth == startstackdepth); \
+ RWPEXIT(__dbFunctionName); \
+ return (result); \
+} \
+while (0)
+
+#define RWRETURNVOID() \
+do \
+{ \
+ RwInt32 _validateStackDepth = --RWDEBUGSTACKDEPTH; \
+ if (_validateStackDepth != startstackdepth) \
+ { \
+ RwDebugSendMessage(rwDEBUGERROR, \
+ __dbFunctionName, \
+ _rwdberrcommon (E_RW_DEBUGSTACK)); \
+ RWDEBUGSTACKDEPTH = startstackdepth; \
+ } \
+ if (RWSRCGLOBAL(debugTrace) && (!startstackdepth)) \
+ { \
+ RwDebugSendMessage(rwDEBUGTRACE, \
+ __dbFunctionName, RWSTRING("Exit")); \
+ } \
+ RWASSERTE(_validateStackDepth == startstackdepth); \
+ RWPEXIT(__dbFunctionName); \
+ return; \
+} \
+while(0)
+
+#endif /* RWTRACE */
+
+#define RWERROR(ecode) \
+do \
+{ \
+ RwError _rwErrorCode; \
+ \
+ _rwErrorCode.pluginID = rwPLUGIN_ID; \
+ _rwErrorCode.errorCode = _rwerror ecode; \
+ \
+ RwErrorSet(&_rwErrorCode); \
+ \
+ if (_rwErrorCode.errorCode & 0x80000000) \
+ { \
+ RwDebugSendMessage(rwDEBUGERROR, \
+ __dbFunctionName, \
+ _rwdberrcommon ecode); \
+ } \
+ else \
+ { \
+ RwDebugSendMessage(rwDEBUGERROR, \
+ __dbFunctionName, \
+ rwPLUGIN_ERRFUNC ecode); \
+ } \
+} \
+while(0);
+
+#define RWMESSAGE(args) \
+do \
+{ \
+ RwDebugSendMessage(rwDEBUGMESSAGE, \
+ __dbFunctionName, \
+ _rwdbsprintf args); \
+} \
+while (0)
+
+#define RWASSERT(condition) \
+do \
+{ \
+ if (!(condition)) \
+ { \
+ RwDebugSendMessage(rwDEBUGASSERT, \
+ __dbFunctionName, \
+ RWSTRING(#condition)); \
+ } \
+ RWASSERTE(condition); \
+} \
+while (0)
+
+#define RWASSERTM(condition, messageArgs) \
+do \
+{ \
+ if (!(condition)) \
+ { \
+ RwDebugSendMessage(rwDEBUGASSERT, \
+ __dbFunctionName, \
+ RWSTRING(#condition)); \
+ RwDebugSendMessage(rwDEBUGMESSAGE, \
+ __dbFunctionName, \
+ _rwdbsprintf messageArgs); \
+ } \
+ RWASSERTE(condition); \
+} \
+while (0)
+
+#else /* RWDEBUG */
+
+#define RWRETURN(value) return(value)
+#define RWRETURNVOID() return
+#define RWERROR(errorcode) \
+do \
+{ \
+ RwError _rwErrorCode; \
+ \
+ _rwErrorCode.pluginID = rwPLUGIN_ID; \
+ _rwErrorCode.errorCode = _rwerror errorcode; \
+ \
+ RwErrorSet(&_rwErrorCode); \
+} \
+while (0)
+#define RWFUNCTION(name)
+#define RWAPIFUNCTION(name)
+#define RWASSERT(condition)
+#define RWASSERTM(condition, messageArgs)
+#define RWMESSAGE(args)
+
+#endif
+
+#define RWVALIDATEDEBUGSTACKDEPTH() \
+ RWASSERT(1 == (RWDEBUGSTACKDEPTH - startstackdepth))
+
+/****************************************************************************
+ Functions
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+RwChar *rwPLUGIN_ERRFUNC(RwInt32 code, ...);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RWDEBUG_H */
diff --git a/sdk/rwsdk/include/d3d8/rpdmorph.h b/sdk/rwsdk/include/d3d8/rpdmorph.h
new file mode 100644
index 00000000..89c51b31
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpdmorph.h
@@ -0,0 +1,311 @@
+/*****************************************************************************
+ *
+ * File : rpdmorph.h
+ *
+ * Abstract : DeltaMorph plugin for Renderware.
+ *
+ *****************************************************************************
+ *
+ * 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. will not, under any
+ * circumstances, be liable for any lost revenue or other damages arising
+ * from the use of this file.
+ *
+ * Copyright (c) 2000 Criterion Software Ltd.
+ * All Rights Reserved.
+ *
+ * RenderWare is a trademark of Canon Inc.
+ *
+ *****************************************************************************/
+
+#ifndef RPDMORPH_H
+#define RPDMORPH_H
+
+/**
+ * \defgroup rpdmorph RpDMorph
+ * \ingroup deltamorphing
+ * \file rpdmorph.h
+ *
+ * Delta Morphing Plugin for RenderWare Graphics.
+ */
+
+/*===========================================================================*
+ *--- Include files ---------------------------------------------------------*
+ *===========================================================================*/
+#include <rwcore.h>
+#include <rpworld.h>
+
+#include "rpdmorph.rpe" /* automatically generated header file */
+
+
+/*===========================================================================*
+ *--- Global Types ----------------------------------------------------------*
+ *===========================================================================*/
+
+/**
+ * \ingroup rpdmorph
+ * \struct RpDMorphTarget
+ * Delta morph target object for defining a target for
+ * a base geometry.
+ * This should be considered an opaque type.
+ * Use the RpDMorphGeometry and RpDMorphTarget API
+ * functions to access.
+ */
+typedef struct RpDMorphTarget RpDMorphTarget;
+
+/**
+ * \ingroup rpdmorph
+ * \struct RpDMorphAnimation
+ * Contains frame sequences for animating delta
+ * morph target objects.
+ * This should be considered an opaque type.
+ * Use the RpDMorphAnimation API
+ * functions to access.
+ */
+typedef struct RpDMorphAnimation RpDMorphAnimation;
+
+#define rpDMORPHNULLFRAME ((RwUInt32)~0)
+
+/*===========================================================================*
+ *--- Global variables ------------------------------------------------------*
+ *===========================================================================*/
+
+extern RwModuleInfo rpDMorphModule;
+
+/*===========================================================================*
+ *--- Plugin API Functions --------------------------------------------------*
+ *===========================================================================*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/*--- DMorphPlugin functions ------------------------------------------------*/
+extern RwBool
+RpDMorphPluginAttach( void );
+
+/*--- DMorphGeometry functions ----------------------------------------------
+ *
+ * These functios work on the DMorphGeometry level.
+ * Each DMorphGeometry has a list of DMorphTargets.
+ */
+extern RpGeometry *
+RpDMorphGeometryCreateDMorphTargets( RpGeometry *geometry,
+ RwUInt32 number );
+
+extern RpGeometry *
+RpDMorphGeometryDestroyDMorphTargets( RpGeometry *geometry );
+
+extern RpGeometry *
+RpDMorphGeometryAddDMorphTarget( RpGeometry *geometry,
+ RwUInt32 index,
+ RwV3d *vertices,
+ RwV3d *normals,
+ RwRGBA *preLightColors,
+ RwTexCoords *texCoords,
+ RwUInt32 flags );
+
+extern RpGeometry *
+RpDMorphGeometryRemoveDMorphTarget( RpGeometry *geometry,
+ RwUInt32 index );
+
+extern RpDMorphTarget *
+RpDMorphGeometryGetDMorphTarget( const RpGeometry *geometry,
+ RwUInt32 index );
+
+extern RwUInt32
+RpDMorphGeometryGetNumDMorphTargets( const RpGeometry *geometry );
+
+extern RpGeometry *
+RpDMorphGeometryTransformDMorphTargets( RpGeometry *geometry,
+ const RwMatrix *matrix );
+
+/*--- DMorphTarget functions ------------------------------------------------
+ *
+ * These functios work on the DMorphGeometry level.
+ * Each DMorphGeometry has a list of DMorphTargets.
+ */
+
+extern const RwSphere *
+RpDMorphTargetGetBoundingSphere( const RpDMorphTarget *dMorphTarget );
+
+extern RpDMorphTarget *
+RpDMorphTargetSetName( RpDMorphTarget *dMorphTarget,
+ RwChar *name );
+
+extern RwChar *
+RpDMorphTargetGetName( RpDMorphTarget *dMorphTarget );
+
+extern RpGeometryFlag
+RpDMorphTargetGetFlags( RpDMorphTarget *dMorphTarget );
+
+
+/*--- ANIMATION SYSTEM ------------------------------------------------------
+ */
+
+/*--- DMorphAtomic functions ------------------------------------------------
+ *
+ * These functions work at the DMorphAtomic level.
+ */
+extern RpAtomic *
+RpDMorphAtomicInitialize( RpAtomic *atomic );
+
+extern RwReal *
+RpDMorphAtomicGetDMorphValues( RpAtomic *atomic );
+
+extern RpAtomic *
+RpDMorphAtomicSetAnimation( RpAtomic *atomic,
+ RpDMorphAnimation *animation );
+
+extern RpDMorphAnimation *
+RpDMorphAtomicGetAnimation( const RpAtomic *atomic );
+
+extern RpAtomic *
+RpDMorphAtomicAddTime( RpAtomic *atomic,
+ RwReal time );
+
+extern RwReal
+RpDMorphAtomicGetAnimTime( const RpAtomic *atomic );
+
+extern RpAtomic *
+RpDMorphAtomicSetAnimLoopCallBack( RpAtomic *atomic,
+ RpAtomicCallBack callBack,
+ void *data );
+
+extern RpAtomicCallBack
+RpDMorphAtomicGetAnimLoopCallBack( const RpAtomic *atomic,
+ void **callBackData );
+
+extern RpAtomic *
+RpDMorphAtomicSetAnimFrame( RpAtomic *atomic,
+ RwUInt32 dMorphTargetIndex,
+ RwUInt32 index );
+
+extern RwUInt32
+RpDMorphAtomicGetAnimFrame( const RpAtomic *atomic,
+ RwUInt32 dMorphTargetIndex );
+
+
+extern RpAtomic *
+RpDMorphAtomicSetAnimFrameTime( RpAtomic *atomic,
+ RwUInt32 dMorphTargetIndex,
+ RwReal time );
+
+extern RwReal
+RpDMorphAtomicGetAnimFrameTime( const RpAtomic *atomic,
+ RwUInt32 dMorphTargetIndex );
+
+/*--- Animation Functions --------------------------------------------------
+ */
+extern RpDMorphAnimation *
+RpDMorphAnimationCreate(RwUInt32 numDMorphTargets);
+
+extern RpDMorphAnimation *
+RpDMorphAnimationDestroy(RpDMorphAnimation *anim);
+
+extern RwUInt32
+RpDMorphAnimationGetNumDMorphTargets(RpDMorphAnimation *animation);
+
+/* Animation Frames */
+extern RpDMorphAnimation *
+RpDMorphAnimationCreateFrames(RpDMorphAnimation *anim,
+ RwUInt32 dMorphTargetIndex,
+ RwUInt32 numFrames);
+
+extern RpDMorphAnimation *
+RpDMorphAnimationDestroyFrames(RpDMorphAnimation *anim,
+ RwUInt32 dMorphTargetIndex);
+
+extern RwUInt32
+RpDMorphAnimationGetNumFrames(RpDMorphAnimation *animation,
+ RwUInt32 dMorphTargetIndex);
+
+/* Stream I/O */
+extern RpDMorphAnimation *
+RpDMorphAnimationStreamRead(RwStream *stream);
+
+extern RpDMorphAnimation *
+RpDMorphAnimationStreamWrite(RpDMorphAnimation *animation,
+ RwStream *stream);
+
+extern RwUInt32
+RpDMorphAnimationStreamGetSize(RpDMorphAnimation *animation);
+
+extern RpDMorphAnimation *
+RpDMorphAnimationRead(const RwChar *filename);
+
+extern RpDMorphAnimation *
+RpDMorphAnimationWrite(RpDMorphAnimation *animation, const RwChar *filename);
+
+/*--- Animation Frame Functions --------------------------------------------
+ *
+ * These functions work on the DMorphAnimationFrame level.
+ * Each Frame can have a reference to the next Frame for the
+ * DMorphTarget.
+ */
+extern RpDMorphAnimation *
+RpDMorphAnimationFrameSetNext(RpDMorphAnimation *anim,
+ RwUInt32 dMorphTargetIndex,
+ RwUInt32 frameIndex,
+ RwUInt32 nextFrame );
+
+extern RwUInt32
+RpDMorphAnimationFrameGetNext(RpDMorphAnimation *anim,
+ RwUInt32 dMorphTargetIndex,
+ RwUInt32 frameIndex );
+
+extern RpDMorphAnimation *
+RpDMorphAnimationFrameSet(RpDMorphAnimation *anim,
+ RwUInt32 dMorphTargetIndex,
+ RwUInt32 frameIndex,
+ RwReal startValue,
+ RwReal endValue,
+ RwReal duration,
+ RwUInt32 nextFrame );
+
+extern RpDMorphAnimation *
+RpDMorphAnimationFrameSetStartValue(RpDMorphAnimation *anim,
+ RwUInt32 dMorphTargetIndex,
+ RwUInt32 frameIndex,
+ RwReal startValue );
+
+extern RwReal
+RpDMorphAnimationFrameGetStartValue(RpDMorphAnimation *anim,
+ RwUInt32 dMorphTargetIndex,
+ RwUInt32 frameIndex );
+
+extern RpDMorphAnimation *
+RpDMorphAnimationFrameSetEndValue(RpDMorphAnimation *anim,
+ RwUInt32 dMorphTargetIndex,
+ RwUInt32 frameIndex,
+ RwReal endValue );
+
+extern RwReal
+RpDMorphAnimationFrameGetEndValue(RpDMorphAnimation *anim,
+ RwUInt32 dMorphTargetIndex,
+ RwUInt32 frameIndex );
+
+extern RpDMorphAnimation *
+RpDMorphAnimationFrameSetDuration(RpDMorphAnimation *anim,
+ RwUInt32 dMorphTargetIndex,
+ RwUInt32 frameIndex,
+ RwReal duration );
+
+extern RwReal
+RpDMorphAnimationFrameGetDuration(RpDMorphAnimation *anim,
+ RwUInt32 dMorphTargetIndex,
+ RwUInt32 frameIndex );
+
+/*--------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RPDMORPH_H */
+
diff --git a/sdk/rwsdk/include/d3d8/rpdmorph.rpe b/sdk/rwsdk/include/d3d8/rpdmorph.rpe
new file mode 100644
index 00000000..b35acc4e
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpdmorph.rpe
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionDMorph
+{
+
+
+
+ e_rwdb_CriterionDMorphLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionDMorph e_rwdb_CriterionDMorph;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rperror.h b/sdk/rwsdk/include/d3d8/rperror.h
new file mode 100644
index 00000000..2a8c5630
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rperror.h
@@ -0,0 +1,32 @@
+/***************************************************************************
+ * *
+ * Module : rperror.h *
+ * *
+ * Purpose : Used to generate error codes *
+ * *
+ **************************************************************************/
+
+#ifndef RPERROR_H
+#define RPERROR_H
+
+/****************************************************************************
+ Includes
+ */
+
+#include "rpplugin.h"
+
+/****************************************************************************
+ Defines
+ */
+
+#define RWECODE(a,b) a,
+
+enum rwPLUGIN_ERRENUM
+{
+#include "rperror.def"
+ rwPLUGIN_ERRENUMLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum rwPLUGIN_ERRENUM rwPLUGIN_ERRENUM;
+
+#endif /* RPERROR_H */
diff --git a/sdk/rwsdk/include/d3d8/rphanim.h b/sdk/rwsdk/include/d3d8/rphanim.h
new file mode 100644
index 00000000..0d1bba7a
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rphanim.h
@@ -0,0 +1,641 @@
+/******************************************
+ * *
+ * 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) 1998. Criterion Software Ltd.
+ * All Rights Reserved.
+ */
+
+/***************************************************************************
+ * *
+ * Module : rpanim.h *
+ * *
+ * Purpose : Hierarchical animation *
+ * *
+ **************************************************************************/
+#ifndef RPHANIM_H
+#define RPHANIM_H
+
+/**
+ * Hierarchal animation plugin
+ */
+
+/* Doxygen plugin groups. */
+
+/**
+ * \defgroup rphanim RpHAnim
+ * \ingroup objectframehanim
+ *
+ * Hierarchical Animation Plugin for RenderWare Graphics.
+ */
+
+/**
+ * \defgroup rphanimchanges RpHAnim Changes
+ * \ingroup rphanim
+ *
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <rwcore.h>
+#include <rpworld.h>
+
+#include <rpcriter.h> /* Note: each vendor can choose their own method for
+ * allocation of unique ID's. This file defines
+ * the ID's used by Criterion.
+ */
+#include <rphanim.rpe> /* automatically generated header file */
+#include <rtquat.h>
+#include <rtanim.h>
+
+#define rpHANIMSTREAMCURRENTVERSION 0x100
+
+#if (!defined(DOXYGEN))
+
+typedef struct RpHAnimAtomicGlobalVars RpHAnimAtomicGlobalVars;
+
+struct RpHAnimAtomicGlobalVars
+{
+ RwInt32 engineOffset;
+ RwFreeList *HAnimFreeList;
+};
+
+#endif /* (!defined(DOXYGEN)) */
+
+#define rpHANIMSTDKEYFRAMESIZE sizeof(RpHAnimKeyFrame)
+#define rpHANIMSTDKEYFRAMETYPEID 0x1
+
+#define RpV3dInterpolate(o,a,s,b) \
+MACRO_START \
+{ \
+ (o)->x = (((a)->x) + ((s)) * (((b)->x) - ((a)->x))); \
+ (o)->y = (((a)->y) + ((s)) * (((b)->y) - ((a)->y))); \
+ (o)->z = (((a)->z) + ((s)) * (((b)->z) - ((a)->z))); \
+} \
+MACRO_STOP
+
+
+/**
+ * \ingroup rphanim
+ * \ref RpHAnimKeyFrame
+ * typedef for struct RpHAnimKeyFrame. Based on \ref RtAnimKeyFrameHeader.
+ */
+typedef struct RpHAnimKeyFrame RpHAnimKeyFrame;
+
+/**
+ * \ingroup rphanim
+ * \struct RpHAnimKeyFrame
+ * A structure representing the standard keyframe data. Sequences of
+ * such keyframes in an \ref RtAnimAnimation defines the animation of each
+ * node in a hierarchy.
+ */
+struct RpHAnimKeyFrame
+{
+ RpHAnimKeyFrame *prevFrame; /**< Pointer to the previous keyframe */
+ RwReal time; /**< Time at keyframe */
+ RtQuat q; /**< Quaternion rotation at keyframe */
+ RwV3d t; /**< Translation at keyframe */
+};
+
+/**
+ * \ingroup rphanim
+ * \ref RpHAnimInterpFrame
+ * typedef for struct RpHAnimInterpFrame. Based on \ref RtAnimInterpFrameHeader.
+ */
+typedef struct RpHAnimInterpFrame RpHAnimInterpFrame;
+
+/**
+ * \ingroup rphanim
+ * \struct RpHAnimInterpFrame
+ * A structure representing an interpolated keyframe. The initial part of the
+ * structure matches \ref RtAnimInterpFrameHeader.
+ */
+struct RpHAnimInterpFrame
+{
+ RpHAnimKeyFrame *keyFrame1;
+ /**< Pointer to 1st keyframe of current interpolation pair */
+ RpHAnimKeyFrame *keyFrame2;
+ /**< Pointer to 2nd keyframe of current interpolation pair */
+ RtQuat q; /**< Quaternion rotation */
+ RwV3d t; /**< Translation */
+};
+
+/**
+ * \ingroup rphanim
+ * \ref RpHAnimHierarchy typedef for struct RpHAnimHierarchy
+ */
+typedef struct RpHAnimHierarchy RpHAnimHierarchy;
+
+/* Flags for FrameInfos */
+
+#define rpHANIMPOPPARENTMATRIX 0x01
+#define rpHANIMPUSHPARENTMATRIX 0x02
+
+/**
+ * \ingroup rphanim
+ * \ref RpHAnimNodeInfo
+ * typedef for struct RpHAnimNodeInfo
+ */
+typedef struct RpHAnimNodeInfo RpHAnimNodeInfo;
+
+/**
+ * \ingroup rphanim
+ * \struct RpHAnimNodeInfo
+ *
+ * Used to describe a hierarchy toplogy.
+ * It holds flags representing its position in the
+ * hierarchy as well as a pointer to the matching \ref RwFrame if the
+ * hierarchy has been attached to a \ref RwFrame hierarchy.
+ *
+ */
+struct RpHAnimNodeInfo
+{
+ RwInt32 nodeID; /**< User defined ID for this node */
+ RwInt32 nodeIndex; /**< Array index of node */
+ RwInt32 flags; /**< Matrix push/pop flags */
+ RwFrame * pFrame; /**< Pointer to an attached RwFrame (see \ref RpHAnimHierarchyAttach) */
+};
+
+/**
+ * \ingroup rphanim
+ * \ref RpHAnimHierarchyFlag defines type and update modes in HAnimHierarchies
+ */
+enum RpHAnimHierarchyFlag
+{
+ /* creation flags */
+ rpHANIMHIERARCHYSUBHIERARCHY = 0x01, /**< This hierarchy is a sub-hierarchy */
+ rpHANIMHIERARCHYNOMATRICES = 0x02, /**< This hierarchy has no local matrices */
+
+ /* update flags */
+ rpHANIMHIERARCHYUPDATEMODELLINGMATRICES = 0x1000, /**< This hierarchy updates modeling matrices */
+ rpHANIMHIERARCHYUPDATELTMS = 0x2000, /**< This hierarchy updates LTMs */
+ rpHANIMHIERARCHYLOCALSPACEMATRICES = 0x4000, /**< This hierarchy calculates matrices in a space
+ relative to its root */
+
+ rpHANIMHIERARCHYFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+/*
+ * These flags are used to control the creation and
+ * update status of the hierarchy
+ */
+typedef enum RpHAnimHierarchyFlag RpHAnimHierarchyFlag;
+
+/**
+ * \ingroup rphanim
+ * \struct RpHAnimHierarchy
+ * An RpHAnimHierarchy is used to "play back" an animation.
+ *
+ * The structure of a hierarchy is defined by an array
+ * of \ref RpHAnimNodeInfo structures.
+ *
+ * The hierarchy is defined by running through the node array in order,
+ * pushing the parent-node's matrix whenever a child is reached that has
+ * more than one sibling, and popping the parent matrix when a "leaf"
+ * node is encountered.
+ *
+ */
+struct RpHAnimHierarchy
+{
+ RwInt32 flags; /**< Flags for the hierarchy */
+ RwInt32 numNodes; /**< Number of nodes in the hierarchy */
+
+ RwMatrix *pMatrixArray; /**< Pointer to node matrices*/
+ void *pMatrixArrayUnaligned; /**< Pointer to memory used for node matrices
+ * from which the aligned pMatrixArray is allocated */
+ RpHAnimNodeInfo *pNodeInfo; /**< Array of node information (push/pop flags etc) */
+ RwFrame *parentFrame; /**< Pointer to the Root RwFrame of the hierarchy this
+ * RpHAnimHierarchy represents */
+ RpHAnimHierarchy *parentHierarchy; /**< Internal use */
+ RwInt32 rootParentOffset; /**< Internal use */
+
+ RtAnimInterpolator *currentAnim; /**< Internal use */
+};
+
+/**
+ * \ingroup rphanim
+ * \ref RpHAnimFrameExtension typedef for struct RpHAnimFrameExtension
+ */
+
+typedef struct RpHAnimFrameExtension RpHAnimFrameExtension;
+
+/**
+ * \ingroup rphanim
+ * \struct RpHAnimFrameExtension
+ *
+ * Used to extend \ref RwFrame objects, and thus
+ * allow the mapping between animation hierarchy node ID and \ref RwFrame.
+ *
+ */
+struct RpHAnimFrameExtension
+{
+ RwInt32 id; /**< ID given to this RwFrame (default of -1) */
+ RpHAnimHierarchy *hierarchy; /**< Pointer to Animation hierarchy attached to this RwFrame */
+};
+
+/*--- Plugin API Functions ---*/
+
+#define RpHAnimHierarchySetFlagsMacro(hierarchy,_flags) \
+MACRO_START \
+{ \
+ (hierarchy)->flags = _flags; \
+} \
+MACRO_STOP
+
+#define RpHAnimHierarchyGetFlagsMacro(hierarchy) \
+ ((hierarchy)->flags)
+
+#define RpHAnimKeyFrameToMatrixMacro(_matrix,_voidIFrame) \
+MACRO_START \
+{ \
+ RpHAnimInterpFrame * iFrame = (RpHAnimInterpFrame *)(_voidIFrame); \
+ \
+ /* \
+ * RpHAnim uses the same types of quaternion as RtQuat \
+ * hence no conjugate call as in RpSkin \
+ */ \
+ \
+ RtQuatUnitConvertToMatrix(&iFrame->q,(_matrix)); \
+ \
+ (_matrix)->pos.x = iFrame->t.x; \
+ (_matrix)->pos.y = iFrame->t.y; \
+ (_matrix)->pos.z = iFrame->t.z; \
+} \
+MACRO_STOP
+
+
+
+#if (! defined(RWDEBUG))
+
+#define RpHAnimHierarchySetFlags(hierarchy,_flags) \
+ RpHAnimHierarchySetFlagsMacro(hierarchy,_flags)
+
+#define RpHAnimHierarchyGetFlags(hierarchy) \
+ (RpHAnimHierarchyFlag)RpHAnimHierarchyGetFlagsMacro(hierarchy)
+#endif /* (! defined(RWDEBUG)) */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RpHAnimAtomicGlobalVars RpHAnimAtomicGlobals;
+
+#if (defined(RWDEBUG))
+
+extern RpHAnimHierarchy *
+RpHAnimHierarchySetFlags(RpHAnimHierarchy *hierarchy,
+ RpHAnimHierarchyFlag flags);
+
+extern RpHAnimHierarchyFlag
+RpHAnimHierarchyGetFlags(RpHAnimHierarchy *hierarchy);
+
+#endif /* (defined(RWDEBUG)) */
+
+/* Animation hierarchy creation */
+extern void
+RpHAnimHierarchySetFreeListCreateParams(RwInt32 blockSize,RwInt32 numBlocksToPrealloc);
+
+extern RpHAnimHierarchy *
+RpHAnimHierarchyCreate(RwInt32 numNodes,
+ RwUInt32 *nodeFlags,
+ RwInt32 *nodeIDs,
+ RpHAnimHierarchyFlag flags,
+ RwInt32 maxKeyFrameSize);
+
+extern RpHAnimHierarchy *
+RpHAnimHierarchyCreateFromHierarchy(RpHAnimHierarchy *hierarchy,
+ RpHAnimHierarchyFlag flags,
+ RwInt32 maxKeyFrameSize);
+
+extern RpHAnimHierarchy *
+RpHAnimHierarchyDestroy(RpHAnimHierarchy *hierarchy);
+
+extern RpHAnimHierarchy *
+RpHAnimHierarchyCreateSubHierarchy(RpHAnimHierarchy *parentHierarchy,
+ RwInt32 startNode,
+ RpHAnimHierarchyFlag flags,
+ RwInt32 maxKeyFrameSize);
+
+extern RpHAnimHierarchy *
+RpHAnimHierarchyAttach(RpHAnimHierarchy *hierarchy);
+
+extern RpHAnimHierarchy *
+RpHAnimHierarchyDetach(RpHAnimHierarchy *hierarchy);
+
+extern RpHAnimHierarchy *
+RpHAnimHierarchyAttachFrameIndex(RpHAnimHierarchy *hierarchy,
+ RwInt32 nodeIndex);
+
+extern RpHAnimHierarchy *
+RpHAnimHierarchyDetachFrameIndex(RpHAnimHierarchy *hierarchy,
+ RwInt32 nodeIndex);
+
+extern RwBool
+RpHAnimFrameSetHierarchy(RwFrame *frame,
+ RpHAnimHierarchy *hierarchy);
+
+extern RpHAnimHierarchy *
+RpHAnimFrameGetHierarchy(RwFrame *frame);
+
+/* Macros for legacy support of old function names */
+#define RpHAnimSetHierarchy(frame,hierarchy) \
+ RpHAnimFrameSetHierarchy(frame,hierarchy)
+#define RpHAnimGetHierarchy(frame) RpHAnimFrameGetHierarchy(frame)
+
+extern RwMatrix *
+RpHAnimHierarchyGetMatrixArray(RpHAnimHierarchy *hierarchy);
+
+extern RwBool
+RpHAnimHierarchyUpdateMatrices(RpHAnimHierarchy *hierarchy);
+
+/* Macro for legacy support of old function name */
+#define RpHAnimUpdateHierarchyMatrices RpHAnimHierarchyUpdateMatrices
+
+extern RwInt32
+RpHAnimIDGetIndex(RpHAnimHierarchy *hierarchy,
+ RwInt32 ID);
+
+/* Plugin support */
+
+extern RwBool
+RpHAnimPluginAttach(void);
+
+/* Hanim keyframe functions */
+
+extern void
+RpHAnimKeyFrameApply(void *matrix,
+ void *voidIFrame);
+
+extern void
+RpHAnimKeyFrameBlend(void *voidOut,
+ void *voidIn1,
+ void *voidIn2,
+ RwReal alpha);
+
+extern void
+RpHAnimKeyFrameInterpolate(void *voidOut,
+ void *voidIn1,
+ void *voidIn2,
+ RwReal time);
+
+extern void
+RpHAnimKeyFrameAdd(void *voidOut,
+ void *voidIn1,
+ void *voidIn2);
+
+extern void
+RpHAnimKeyFrameMulRecip(void *voidFrame,
+ void *voidStart);
+
+extern RtAnimAnimation *
+RpHAnimKeyFrameStreamRead(RwStream *stream,
+ RtAnimAnimation *animation);
+
+extern RwBool
+RpHAnimKeyFrameStreamWrite(RtAnimAnimation *animation,
+ RwStream *stream);
+
+extern RwInt32
+RpHAnimKeyFrameStreamGetSize(RtAnimAnimation *animation);
+
+/* Access to RwFrame ID's */
+
+extern RwBool
+RpHAnimFrameSetID(RwFrame *frame,
+ RwInt32 id);
+
+extern RwInt32
+RpHAnimFrameGetID(RwFrame *frame);
+
+/*
+ * Utility Functions
+ */
+#define RpHAnimHierarchySetCurrentAnimMacro(hierarchy,anim)\
+ RtAnimInterpolatorSetCurrentAnim((hierarchy)->currentAnim,anim)
+
+#define RpHAnimHierarchyGetCurrentAnimMacro(hierarchy)\
+ RtAnimInterpolatorGetCurrentAnim((hierarchy)->currentAnim)
+
+#define RpHAnimHierarchySetCurrentAnimTimeMacro(hierarchy,time)\
+ RtAnimInterpolatorSetCurrentTime((hierarchy)->currentAnim,time)
+
+#define RpHAnimHierarchyAddAnimTimeMacro(hierarchy,time)\
+ RtAnimInterpolatorAddAnimTime((hierarchy)->currentAnim,time)
+
+#define RpHAnimHierarchySubAnimTimeMacro(hierarchy,time)\
+ RtAnimInterpolatorSubAnimTime((hierarchy)->currentAnim,time)
+
+#define RpHAnimHierarchySetKeyFrameCallBacksMacro(hierarchy,keyFrameTypeID) \
+ RtAnimInterpolatorSetKeyFrameCallBacks((hierarchy)->currentAnim,\
+ keyFrameTypeID)
+
+#define RpHAnimHierarchyBlendMacro(outHierarchy,inHierarchy1,inHierarchy2,alpha)\
+ RtAnimInterpolatorBlend((outHierarchy)->currentAnim,\
+ (inHierarchy1)->currentAnim,\
+ (inHierarchy2)->currentAnim,\
+ alpha)
+
+#define RpHAnimHierarchyAddTogetherMacro(outHierarchy,inHierarchy1,inHierarchy2)\
+ RtAnimInterpolatorAddTogether((outHierarchy)->currentAnim,\
+ (inHierarchy1)->currentAnim,\
+ (inHierarchy2)->currentAnim)
+
+
+#define RpHAnimHierarchySetAnimCallBackMacro(hierarchy,callBack,time,data)\
+ RtAnimInterpolatorSetAnimCallBack((hierarchy)->currentAnim,callBack,time,data)
+
+#define RpHAnimHierarchySetAnimLoopCallBackMacro(hierarchy,callBack,data)\
+ RtAnimInterpolatorSetAnimLoopCallBack((hierarchy)->currentAnim,callBack,data)
+
+#define RpHAnimHierarchyBlendSubHierarchyMacro(outHierarchy,inHierarchy1,inHierarchy2,alpha)\
+ RtAnimInterpolatorBlendSubInterpolator((outHierarchy)->currentAnim,(inHierarchy1)->currentAnim,(inHierarchy2)->currentAnim,alpha)
+
+#define RpHAnimHierarchyAddSubHierarchyMacro(outHierarchy,mainHierarchy,subHierarchy)\
+ RtAnimInterpolatorAddSubInterpolator((outHierarchy)->currentAnim,(mainHierarchy)->currentAnim,(subHierarchy)->currentAnim)
+
+#define RpHAnimHierarchyCopyMacro(outHierarchy,inHierarchy)\
+ RtAnimInterpolatorCopy((outHierarchy)->currentAnim,(inHierarchy)->currentAnim)
+
+
+
+#ifdef RWDEBUG
+extern RwBool
+RpHAnimHierarchySetCurrentAnim(RpHAnimHierarchy *hierarchy,
+ RtAnimAnimation *anim);
+
+extern RtAnimAnimation *
+RpHAnimHierarchyGetCurrentAnim(RpHAnimHierarchy *hierarchy);
+
+extern RwBool
+RpHAnimHierarchySetCurrentAnimTime(RpHAnimHierarchy *hierarchy,
+ RwReal time);
+
+extern RwBool
+RpHAnimHierarchyAddAnimTime(RpHAnimHierarchy *hierarchy,
+ RwReal time);
+
+extern RwBool
+RpHAnimHierarchySubAnimTime(RpHAnimHierarchy *hierarchy,
+ RwReal time);
+
+extern RwBool
+RpHAnimHierarchySetKeyFrameCallBacks(RpHAnimHierarchy *hierarchy,
+ RwInt32 keyFrameTypeID);
+
+extern void
+RpHAnimHierarchySetAnimCallBack(RpHAnimHierarchy *hierarchy,
+ RtAnimCallBack callBack,
+ RwReal time,
+ void *data);
+
+extern RwBool
+RpHAnimHierarchyBlend(RpHAnimHierarchy *outHierarchy,
+ RpHAnimHierarchy *inHierarchy1,
+ RpHAnimHierarchy *inHierarchy2,
+ RwReal alpha);
+
+extern RwBool
+RpHAnimHierarchyAddTogether(RpHAnimHierarchy *outHierarchy,
+ RpHAnimHierarchy *inHierarchy1,
+ RpHAnimHierarchy *inHierarchy2);
+
+extern void
+RpHAnimHierarchySetAnimLoopCallBack(RpHAnimHierarchy *hierarchy,
+ RtAnimCallBack callBack,
+ void *data);
+extern RwBool
+RpHAnimHierarchyBlendSubHierarchy(RpHAnimHierarchy *outHierarchy,
+ RpHAnimHierarchy *inHierarchy1,
+ RpHAnimHierarchy *inHierarchy2,
+ RwReal alpha);
+extern RwBool
+RpHAnimHierarchyAddSubHierarchy(RpHAnimHierarchy *outHierarchy,
+ RpHAnimHierarchy *mainHierarchy1,
+ RpHAnimHierarchy *subHierarchy2);
+extern RwBool
+RpHAnimHierarchyCopy(RpHAnimHierarchy *outHierarchy,
+ RpHAnimHierarchy *inHierarchy);
+
+#else
+
+#define RpHAnimHierarchySetCurrentAnim(hierarchy,anim) \
+ RpHAnimHierarchySetCurrentAnimMacro((hierarchy),(anim))
+
+#define RpHAnimHierarchyGetCurrentAnim(hierarchy) \
+ RpHAnimHierarchyGetCurrentAnimMacro((hierarchy))
+
+#define RpHAnimHierarchySetCurrentAnimTime(hierarchy,time) \
+ RpHAnimHierarchySetCurrentAnimTimeMacro((hierarchy),(time))
+
+#define RpHAnimHierarchyAddAnimTime(hierarchy,time) \
+ RpHAnimHierarchyAddAnimTimeMacro((hierarchy),(time))
+
+#define RpHAnimHierarchySubAnimTime(hierarchy,time) \
+ RpHAnimHierarchySubAnimTimeMacro((hierarchy),(time))
+
+#define RpHAnimHierarchySetKeyFrameCallBacks(hierarchy,keyFrameTypeID) \
+ RpHAnimHierarchySetKeyFrameCallBacksMacro((hierarchy),(keyFrameTypeID))
+
+#define RpHAnimHierarchyBlend(outHierarchy,inHierarchy1,inHierarchy2,alpha) \
+ RpHAnimHierarchyBlendMacro((outHierarchy),(inHierarchy1),(inHierarchy2),(alpha))
+
+#define RpHAnimHierarchyAddTogether(outHierarchy,inHierarchy1,inHierarchy2) \
+ RpHAnimHierarchyAddTogetherMacro((outHierarchy),(inHierarchy1),(inHierarchy2))
+
+#define RpHAnimHierarchySetAnimCallBack(hierarchy,callBack,time,data)\
+ RpHAnimHierarchySetAnimCallBackMacro((hierarchy),(callBack),(time),(data))
+
+#define RpHAnimHierarchySetAnimLoopCallBack(hierarchy,callBack,data)\
+ RpHAnimHierarchySetAnimLoopCallBackMacro((hierarchy),(callBack),(data))
+
+#define RpHAnimHierarchyBlendSubHierarchy(outHierarchy,inHierarchy1,inHierarchy2,alpha)\
+ RpHAnimHierarchyBlendSubHierarchyMacro((outHierarchy),(inHierarchy1),(inHierarchy2),(alpha))
+
+#define RpHAnimHierarchyAddSubHierarchy(outHierarchy,mainHierarchy,subHierarchy)\
+ RpHAnimHierarchyAddSubHierarchyMacro((outHierarchy),(mainHierarchy),(subHierarchy))
+
+#define RpHAnimHierarchyCopy(outHierarchy,inHierarchy)\
+ RpHAnimHierarchyCopyMacro((outHierarchy),(inHierarchy))
+
+#endif /* RWDEBUG */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* Legacy TypeDef */
+
+
+typedef RtAnimAnimation RpHAnimAnimation;
+typedef RpHAnimKeyFrame RpHAnimStdKeyFrame;
+
+/* Legacy Macros */
+
+
+/* Animations */
+
+
+#define RpHAnimAnimationCreate(typeID,numFrames,flags,duration)\
+ RtAnimAnimationCreate((typeID),(numFrames),(flags),(duration))
+
+
+#define RpHAnimAnimationDestroy(animation)\
+ RtAnimAnimationDestroy((animation))
+
+#define RpHAnimAnimationGetTypeID(animation)\
+ RtAnimAnimationGetTypeID((animation))
+
+
+#define RpHAnimAnimationRead(filename)\
+ RtAnimAnimationRead((filename))
+
+
+#define RpHAnimAnimationWrite(animation,filename)\
+ RtAnimAnimationWrite((animation),(filename))
+
+
+#define RpHAnimAnimationStreamRead(stream)\
+ RtAnimAnimationStreamRead((stream))
+
+
+#define RpHAnimAnimationStreamWrite(animation,stream)\
+ RtAnimAnimationStreamWrite((animation),(stream))
+
+
+#define RpHAnimAnimationStreamGetSize(animation)\
+ RtAnimAnimationStreamGetSize((animation))
+
+
+#define RpHAnimAnimationMakeDelta(animation,numNodes,time)\
+ RtAnimAnimationMakeDelta((animation),(numNodes),(time))
+
+
+/* Animation Interpolator */
+
+#define RpHAnimHierarchyStdKeyFrameAddAnimTime(hierarchy,time)\
+ RpHAnimHierarchyHAnimKeyFrameAddAnimTime((hierarchy),(time))
+
+#define RpHAnimHierarchyHAnimKeyFrameAddAnimTime(hierarchy,time)\
+ RpHAnimHierarchyAddAnimTime((hierarchy),(time))
+
+#endif /* RPHANIM_H */
diff --git a/sdk/rwsdk/include/d3d8/rphanim.rpe b/sdk/rwsdk/include/d3d8/rphanim.rpe
new file mode 100644
index 00000000..1c05d0e9
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rphanim.rpe
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionHANIM
+{
+
+
+
+ e_rwdb_CriterionHANIMLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionHANIM e_rwdb_CriterionHANIM;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rplodatm.h b/sdk/rwsdk/include/d3d8/rplodatm.h
new file mode 100644
index 00000000..4e9c8648
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rplodatm.h
@@ -0,0 +1,134 @@
+
+/******************************************
+ * *
+ * 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) 1998. Criterion Software Ltd.
+ * All Rights Reserved.
+ */
+
+/***************************************************************************
+ * *
+ * Module : rplodatm.h *
+ * *
+ * Purpose : LODATM Geometry *
+ * *
+ **************************************************************************/
+
+#ifndef RPLODATM_H
+#define RPLODATM_H
+
+
+/**
+ * \defgroup rplodatm RpLODAtomic
+ * \ingroup scenemanagement
+ *
+ * Level of Detail Management Plugin for RenderWare Graphics.
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+#include "rwcore.h"
+#include "rpworld.h"
+
+#include "rpcriter.h" /* Note: each vendor can choose their own method for
+ * allocation of unique ID's. This file defines
+ * the ID's used by Criterion.
+ */
+#include "rplodatm.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Defines
+ */
+#define RPLODATOMICMAXLOD 10
+
+
+/****************************************************************************
+ Type defs
+ */
+typedef RwInt32 (*RpLODAtomicLODCallBack)( RpAtomic *atomic );
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+ extern void
+ RpLODAtomicCacheSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+ extern RwBool
+ RpLODAtomicPluginAttach( void );
+
+ extern RpAtomic *
+ RpLODAtomicSetGeometry(
+ RpAtomic *atomic, RwInt32 lodIdx, RpGeometry *geometry );
+
+ extern RpGeometry *
+ RpLODAtomicGetGeometry(
+ RpAtomic *atomic, RwInt32 lodIdx );
+
+ extern RpAtomic *
+ RpLODAtomicSetCurrentLOD(
+ RpAtomic *atomic, RwInt32 lodIdx );
+
+ extern RwInt32
+ RpLODAtomicGetCurrentLOD(
+ RpAtomic *atomic );
+
+ extern RpAtomic *
+ RpLODAtomicSetRange(
+ RpAtomic *atomic, RwReal farRange );
+
+ extern RwReal
+ RpLODAtomicGetRange(
+ RpAtomic *atomic );
+
+ extern void
+ RpLODAtomicSetCamera(
+ RwCamera *camera );
+
+ extern RpAtomic *
+ RpLODAtomicSetLODCallBack(
+ RpAtomic *atomic, RpLODAtomicLODCallBack callback );
+
+ extern RpAtomic *
+ RpLODAtomicSelectLOD(
+ RpAtomic *atomic );
+
+ extern RpAtomic *
+ RpLODAtomicForAllLODGeometries(
+ RpAtomic *atomic, RpGeometryCallBack callback, void *pData );
+
+ extern RpAtomic *
+ RpLODAtomicHookRender(
+ RpAtomic *atomic );
+
+ extern RpAtomic *
+ RpLODAtomicUnHookRender(
+ RpAtomic *atomic );
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RPLODATM_H */
+
diff --git a/sdk/rwsdk/include/d3d8/rplodatm.rpe b/sdk/rwsdk/include/d3d8/rplodatm.rpe
new file mode 100644
index 00000000..a5764cfc
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rplodatm.rpe
@@ -0,0 +1,176 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionLODATM
+{
+
+
+
+ e_rwdb_CriterionLODATMLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionLODATM e_rwdb_CriterionLODATM;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rplogo.h b/sdk/rwsdk/include/d3d8/rplogo.h
new file mode 100644
index 00000000..a46823ac
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rplogo.h
@@ -0,0 +1,83 @@
+/**
+ * Logo plugin
+ */
+
+
+/**********************************************************************
+ *
+ * File : rplogo.h
+ *
+ * Abstract : Add CSL Logo
+ *
+ **********************************************************************
+ *
+ * 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. will not, under any
+ * circumstances, be liable for any lost revenue or other damages arising
+ * from the use of this file.
+ *
+ * Copyright (c) 1998 Criterion Software Ltd.
+ * All Rights Reserved.
+ *
+ * RenderWare is a trademark of Canon Inc.
+ *
+ ************************************************************************/
+
+#ifndef RPLOGO_H
+#define RPLOGO_H
+
+/**
+ * \defgroup rplogo RpLogo
+ * \ingroup 2dtools
+ *
+ * Logo Plugin for RenderWare Graphics.
+ */
+
+/*--- Include files ---*/
+#include "rwcore.h"
+
+#include "rplogo.rpe" /* automatically generated header file */
+
+/*--- Global Structures ---*/
+
+enum RpLogoPosition
+{
+ rpNALOGOPOSITION = 0,
+ rpLOGOTOP,
+ rpLOGOCENTER,
+ rpLOGOBOTTOM,
+ rpLOGOLEFT,
+ rpLOGORIGHT,
+ rpLOGOTOPLEFT,
+ rpLOGOTOPRIGHT,
+ rpLOGOBOTTOMLEFT,
+ rpLOGOBOTTOMRIGHT,
+ rpLOGOPOSITIONFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpLogoPosition RpLogoPosition;
+
+/*--- Plugin API Functions ---*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+ RwBool RpLogoPluginAttach(void);
+ RwBool RpLogoSetPosition(RpLogoPosition pos);
+ RpLogoPosition RpLogoGetPosition(void);
+ RwBool RpLogoSetState(RwCamera * cam, RwBool state);
+ RwBool RpLogoGetState(RwCamera * cam);
+ RwRect *RpLogoGetRenderingRect(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RPLOGO_H */
+
diff --git a/sdk/rwsdk/include/d3d8/rplogo.rpe b/sdk/rwsdk/include/d3d8/rplogo.rpe
new file mode 100644
index 00000000..a7f66565
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rplogo.rpe
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionLogo
+{
+
+
+
+ e_rwdb_CriterionLogoLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionLogo e_rwdb_CriterionLogo;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpltmap.h b/sdk/rwsdk/include/d3d8/rpltmap.h
new file mode 100644
index 00000000..18c91955
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpltmap.h
@@ -0,0 +1,99 @@
+
+/**
+ * \defgroup rpltmap RpLtMap
+ * \ingroup lighting
+ *
+ * Lightmap Plugin for RenderWare Graphics.
+ */
+
+#ifndef RPLTMAP_H
+#define RPLTMAP_H
+
+/*===========================================================================*
+ *--- Includes --------------------------------------------------------------*
+ *===========================================================================*/
+
+#include "rwcore.h"
+#include "rpworld.h"
+
+
+/* Used during lightmap illumination (sliver triangles are skipped
+ * (their texels should be filled by dilate()), because their normals
+ * can't be accurately calculated) */
+#define rpLTMAPDEFAULTSLIVERAREATHRESHOLD (0.001f)
+
+/* Used during lightmap UV calculation (polySets may be
+ * joined on the basis of vertices with equal positions) */
+#define rpLTMAPDEFAULTVERTEXWELDTHRESHOLD (0.1f)
+
+#define rpLTMAPDEFAULTLIGHTMAPSIZE 128
+#define rpLTMAPMINLIGHTMAPSIZE 16
+#define rpLTMAPMAXLIGHTMAPSIZE 512/*?? any better way of determining this ??*/
+
+#define rpLTMAPMAXPREFIXSTRINGLENGTH 4
+
+#define rpLTMAPDEFAULTMAXAREALIGHTSAMPLESPERMESH 256
+/* The default tolerance for errors induced by area light ROIs is 1
+ * (being the smallest difference in lightmap colour values) */
+#define rpLTMAPDEFAULTAREALIGHTROICUTOFF (1.0f)
+
+
+/**
+ * \ingroup rpltmap
+ * \ref RpLtMapStyle
+ * Flags specifying the rendering style of the lightmap plugin.
+ *
+ * \see RpLtMapGetRenderStyle
+ * \see RpLtMapSetRenderStyle
+ */
+enum RpLtMapStyle
+{
+ rpLTMAPSTYLENASTYLE = 0x0,
+
+ rpLTMAPSTYLERENDERBASE = 0x1, /**< The base texture should be rendered */
+ rpLTMAPSTYLERENDERLIGHTMAP = 0x2, /**< The lightmap should be rendered */
+ rpLTMAPSTYLEPOINTSAMPLE = 0x4, /**< The lightmap should be point-sampled */
+
+ rpLTMAPSTYLEFORCEENUMSIZEINT = 0x7FFFFFFF
+};
+typedef enum RpLtMapStyle RpLtMapStyle;
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+extern RwBool
+RpLtMapPluginAttach(void);
+
+extern RxPipeline *
+RpLtMapGetPlatformAtomicPipeline(void);
+extern RxPipeline *
+RpLtMapGetPlatformWorldSectorPipeline(void);
+
+extern RwBool
+RpLtMapSetRenderStyle(RpLtMapStyle style, RpWorld *world);
+extern RpLtMapStyle
+RpLtMapGetRenderStyle(void);
+
+extern RwUInt32
+RpLtMapWorldLightMapsQuery(RpWorld *world);
+
+extern RwTexture *
+RpLtMapWorldSectorGetLightMap(RpWorldSector *sector);
+extern RpWorldSector *
+RpLtMapWorldSectorSetLightMap(RpWorldSector *sector, RwTexture *lightMap);
+extern RwTexture *
+RpLtMapAtomicGetLightMap(RpAtomic *atomic);
+extern RpAtomic *
+RpLtMapAtomicSetLightMap(RpAtomic *atomic, RwTexture *lightMap);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RPLTMAP_H */
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpltmap.rpe b/sdk/rwsdk/include/d3d8/rpltmap.rpe
new file mode 100644
index 00000000..6e58b62b
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpltmap.rpe
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionLTMAP
+{
+
+
+
+ e_rwdb_CriterionLTMAPLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionLTMAP e_rwdb_CriterionLTMAP;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpmatfx.h b/sdk/rwsdk/include/d3d8/rpmatfx.h
new file mode 100644
index 00000000..fb7ade45
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpmatfx.h
@@ -0,0 +1,241 @@
+
+#ifndef RPMATFX_H
+#define RPMATFX_H
+
+/*===========================================================================*
+ *--- Include files ---------------------------------------------------------*
+ *===========================================================================*/
+
+#include "rwcore.h"
+#include "rpworld.h"
+
+/*---- start: ./matfx.h----*/
+
+#ifndef RPMATFX_MATFX_H
+#define RPMATFX_MATFX_H
+
+
+/**
+ * \defgroup rpmatfx RpMatFX
+ * \ingroup materials
+ *
+ * Material Effects Plugin for RenderWare Graphics.
+ */
+
+/*===========================================================================*
+ *--- Global Types ----------------------------------------------------------*
+ *===========================================================================*/
+
+/**
+ * \ingroup rpmatfx
+ * RpMatFXMaterialFlags, this type represents the different types of
+ * material effects that can be used on a material. The effects are
+ * initialized with \ref RpMatFXMaterialSetEffects:
+ */
+enum RpMatFXMaterialFlags
+{
+ rpMATFXEFFECTNULL = 0,
+ rpMATFXEFFECTBUMPMAP = 1, /**<Bump mapping */
+ rpMATFXEFFECTENVMAP = 2, /**<Environment mapping */
+ rpMATFXEFFECTBUMPENVMAP = 3, /**<Bump and environment mapping */
+ rpMATFXEFFECTDUAL = 4, /**<Dual pass */
+
+ rpMATFXEFFECTMAX,
+ rpMATFXNUMEFFECTS = rpMATFXEFFECTMAX - 1,
+
+ rpMATFXFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpMatFXMaterialFlags RpMatFXMaterialFlags;
+
+
+/*===========================================================================*
+ *--- Plugin API Functions --------------------------------------------------*
+ *===========================================================================*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/*--- Plugin functions ------------------------------------------------------*/
+extern void
+RpMatFXMaterialDataSetFreeListCreateParams( RwInt32 blockSize,
+ RwInt32 numBlocksToPrealloc );
+
+extern RwBool
+RpMatFXPluginAttach( void );
+
+/*--- Setup functions -------------------------------------------------------*/
+extern RpAtomic *
+RpMatFXAtomicEnableEffects( RpAtomic *atomic );
+
+extern RwBool
+RpMatFXAtomicQueryEffects( RpAtomic *atomic );
+
+extern RpWorldSector *
+RpMatFXWorldSectorEnableEffects( RpWorldSector *worldSector );
+
+extern RwBool
+RpMatFXWorldSectorQueryEffects( RpWorldSector *worldSector );
+
+extern RpMaterial *
+RpMatFXMaterialSetEffects( RpMaterial *material,
+ RpMatFXMaterialFlags flags );
+
+
+/*--- Setup Effects ---------------------------------------------------------*/
+extern RpMaterial *
+RpMatFXMaterialSetupBumpMap( RpMaterial *material,
+ RwTexture *texture,
+ RwFrame *frame,
+ RwReal coef );
+
+extern RpMaterial *
+RpMatFXMaterialSetupEnvMap( RpMaterial *material,
+ RwTexture *texture,
+ RwFrame *frame,
+ RwBool useFrameBufferAlpha,
+ RwReal coef );
+
+extern RpMaterial *
+RpMatFXMaterialSetupDualTexture( RpMaterial *material,
+ RwTexture *texture,
+ RwBlendFunction srcBlendMode,
+ RwBlendFunction dstBlendMode );
+
+/*--- Tinker with effects ---------------------------------------------------*/
+extern RpMatFXMaterialFlags
+RpMatFXMaterialGetEffects( const RpMaterial *material );
+
+/*--- Bump Map --------------------------------------------------------------*/
+extern RpMaterial *
+RpMatFXMaterialSetBumpMapTexture( RpMaterial *material,
+ RwTexture *texture );
+
+extern RpMaterial *
+RpMatFXMaterialSetBumpMapFrame( RpMaterial *material,
+ RwFrame *frame );
+
+extern RpMaterial *
+RpMatFXMaterialSetBumpMapCoefficient( RpMaterial *material,
+ RwReal coef );
+extern RwTexture *
+RpMatFXMaterialGetBumpMapTexture( const RpMaterial *material );
+
+extern RwTexture *
+RpMatFXMaterialGetBumpMapBumpedTexture( const RpMaterial *material );
+
+extern RwFrame *
+RpMatFXMaterialGetBumpMapFrame( const RpMaterial *material );
+
+extern RwReal
+RpMatFXMaterialGetBumpMapCoefficient( const RpMaterial *material );
+
+/*--- Env Map ---------------------------------------------------------------*/
+extern RpMaterial *
+RpMatFXMaterialSetEnvMapTexture( RpMaterial *material,
+ RwTexture *texture );
+
+extern RpMaterial *
+RpMatFXMaterialSetEnvMapFrame( RpMaterial *material,
+ RwFrame *frame );
+
+extern RpMaterial *
+RpMatFXMaterialSetEnvMapFrameBufferAlpha( RpMaterial *material,
+ RwBool useFrameBufferAlpha );
+
+extern RpMaterial *
+RpMatFXMaterialSetEnvMapCoefficient( RpMaterial *material,
+ RwReal coef );
+
+extern RwTexture *
+RpMatFXMaterialGetEnvMapTexture( const RpMaterial *material );
+
+extern RwFrame *
+RpMatFXMaterialGetEnvMapFrame( const RpMaterial *material );
+
+extern RwBool
+RpMatFXMaterialGetEnvMapFrameBufferAlpha( const RpMaterial *material );
+
+extern RwReal
+RpMatFXMaterialGetEnvMapCoefficient( const RpMaterial *material );
+
+/*--- Dual Pass -------------------------------------------------------------*/
+extern RpMaterial *
+RpMatFXMaterialSetDualTexture( RpMaterial *material,
+ RwTexture *texture );
+
+extern RpMaterial *
+RpMatFXMaterialSetDualBlendModes( RpMaterial *material,
+ RwBlendFunction srcBlendMode,
+ RwBlendFunction dstBlendMode );
+
+extern RwTexture *
+RpMatFXMaterialGetDualTexture( const RpMaterial *material );
+
+extern const RpMaterial *
+RpMatFXMaterialGetDualBlendModes( const RpMaterial *material,
+ RwBlendFunction *srcBlendMode,
+ RwBlendFunction *dstBlendMode );
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* RPMATFX_MATFX_H */
+
+/*---- end: ./matfx.h----*/
+
+/*---- start: c:/daily/rwsdk/plugin/matfx/d3d8/matfxplatform.h----*/
+
+/**
+ * \defgroup rpmatfxd3d8 D3D8
+ * \ingroup rpmatfx
+ *
+ * D3D8 specific documentation.
+ */
+
+
+/******************************************************************************
+ * Enum types
+ */
+
+/**
+ * \ingroup rpmatfxd3d8
+ * \ref RpMatFXD3D8Pipeline
+ */
+enum RpMatFXD3D8Pipeline
+{
+ rpNAMATFXD3D8PIPELINE = 0,
+ rpMATFXD3D8ATOMICPIPELINE = 1, /**<D3D8 atomic material effect rendering pipeline. */
+ rpMATFXD3D8WORLDSECTORPIPELINE = 2, /**<D3D8 world sector material effect rendering pipeline. */
+ rpMATFXD3D8PIPELINEMAX,
+ rpMATFXD3D8PIPELINEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpMatFXD3D8Pipeline RpMatFXD3D8Pipeline;
+
+/******************************************************************************
+ * Global types
+ */
+
+/******************************************************************************
+ * Functions
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RxPipeline *
+RpMatFXGetD3D8Pipeline( RpMatFXD3D8Pipeline d3d8Pipeline );
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/*---- end: c:/daily/rwsdk/plugin/matfx/d3d8/matfxplatform.h----*/
+
+#endif /* RPMATFX_H */
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpmatfx.rpe b/sdk/rwsdk/include/d3d8/rpmatfx.rpe
new file mode 100644
index 00000000..ba83d96a
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpmatfx.rpe
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionMATERIALEFFECTS
+{
+
+
+
+ e_rwdb_CriterionMATERIALEFFECTSLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionMATERIALEFFECTS e_rwdb_CriterionMATERIALEFFECTS;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpmipkl.h b/sdk/rwsdk/include/d3d8/rpmipkl.h
new file mode 100644
index 00000000..82ad7f03
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpmipkl.h
@@ -0,0 +1,62 @@
+/**
+ * PS2 Mipmap K&L plugin for Renderware.
+ */
+
+#ifndef RPMIPMAPKLPLUGIN_H
+#define RPMIPMAPKLPLUGIN_H
+
+/**
+ * \defgroup rpmipkl RpMipmapKL
+ * \ingroup mipmapping
+ *
+ * PlayStation 2 / MipMap KL Value Plugin for RenderWare Graphics.
+ */
+
+#include <rwcore.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#if (defined(SKY2_DRVMODEL_H)) || (defined(NULLSKY_DRVMODEL_H))
+
+#define RpMipmapKLTextureSetDefaultK RpSkyTextureSetDefaultMipmapK
+
+#define RpMipmapKLTextureSetDefaultL RpSkyTextureSetDefaultMipmapL
+
+#define RpMipmapKLTextureGetDefaultK RpSkyTextureGetDefaultMipmapK
+
+#define RpMipmapKLTextureGetDefaultL RpSkyTextureGetDefaultMipmapL
+
+#define RpMipmapKLTextureSetK RpSkyTextureSetMipmapK
+
+#define RpMipmapKLTextureSetL RpSkyTextureSetMipmapL
+
+#define RpMipmapKLTextureGetK RpSkyTextureGetMipmapK
+
+#define RpMipmapKLTextureGetL RpSkyTextureGetMipmapL
+
+#define RpMipmapKLPluginAttach() (TRUE)
+
+#else /* (defined(SKY2_DRVMODEL_H)) || (defined(NULLSKY_DRVMODEL_H)) */
+
+extern RwReal RpMipmapKLTextureSetDefaultK(RwReal val);
+extern RwUInt32 RpMipmapKLTextureSetDefaultL(RwUInt32 val);
+extern RwReal RpMipmapKLTextureGetDefaultK(void);
+extern RwUInt32 RpMipmapKLTextureGetDefaultL(void);
+
+extern RwTexture *RpMipmapKLTextureSetK(RwTexture *tex, RwReal val);
+extern RwTexture *RpMipmapKLTextureSetL(RwTexture *tex, RwUInt32 val);
+extern RwReal RpMipmapKLTextureGetK(RwTexture *tex);
+extern RwUInt32 RpMipmapKLTextureGetL(RwTexture *tex);
+
+extern RwBool RpMipmapKLPluginAttach(void);
+
+#endif /* (defined(SKY2_DRVMODEL_H)) || (defined(NULLSKY_DRVMODEL_H)) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RPMIPMAPKLPLUGIN_H */
diff --git a/sdk/rwsdk/include/d3d8/rpmipkl.rpe b/sdk/rwsdk/include/d3d8/rpmipkl.rpe
new file mode 100644
index 00000000..0464081f
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpmipkl.rpe
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionLabel
+{
+
+
+
+ e_rwdb_CriterionLabelLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionLabel e_rwdb_CriterionLabel;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpmorph.h b/sdk/rwsdk/include/d3d8/rpmorph.h
new file mode 100644
index 00000000..52ea70df
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpmorph.h
@@ -0,0 +1,137 @@
+
+/******************************************/
+/* */
+/* 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) 1998. Criterion Software Ltd.
+ * All Rights Reserved.
+ */
+
+
+/****************************************************************************
+ *
+ * Morph animation controller
+ * Copyright (C) 1998 Criterion Technologies
+ *
+ * Module : rpmorph.h
+ *
+ * Purpose : Functions for controlling morph target animation
+ *
+ ****************************************************************************/
+
+#ifndef RPMORPH_H
+#define RPMORPH_H
+
+
+/**
+ * \defgroup rpmorph RpMorph
+ * \ingroup morphing
+ *
+ * Morphing Plugin for RenderWare Graphics.
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+#include "rwcore.h"
+#include "rpworld.h"
+
+#include "rpmorph.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Global Types
+ */
+typedef struct RpMorphInterpolator RpMorphInterpolator;
+
+/**
+ * \ingroup rpmorph
+ * \struct RpMorphInterpolator
+ * structure describing morph interpolator
+ */
+struct RpMorphInterpolator
+{
+ RwInt32 flags; /**< flags */
+ RwInt16 startMorphTarget; /**< startMorphTarget */
+ RwInt16 endMorphTarget; /**< endMorphTarget */
+ RwReal time; /**< time */
+ RwReal recipTime; /**< recipTime */
+ RpMorphInterpolator *next; /**< next */
+};
+
+/* Morph Animation */
+
+/**
+ * \ingroup rpmorph
+ * This is the callback function supplied to \ref RpMorphGeometrySetCallBack
+ * and returned from \ref RpMorphGeometryGetCallBack.
+ * The supplied function will be passed a pointer to the geometry's parent atomic,
+ * and the position of the current interpolator.
+ * The function will only be called when the position of the geometry's current
+ * interpolator moves out of the current range.
+ *
+ * \param atomic Pointer to the geometry's parent atomic.
+ * \param position Value of the current interpolator.
+ *
+ * \return
+ *
+ * \see RpMorphGeometrySetCallBack
+ * \see RpMorphGeometryGetCallBack
+ */
+typedef RwReal (*RpMorphGeometryCallBack)(RpAtomic *atomic, RwReal position);
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwBool RpMorphPluginAttach(void);
+
+/* Morph Animation */
+extern RpGeometry *RpMorphGeometryCreateInterpolators(RpGeometry *geometry, RwInt32 numInterps);
+extern RpGeometry *RpMorphGeometrySetInterpolator(RpGeometry *geometry,
+ RwInt32 interpNum,
+ RwInt32 startKey, RwInt32 endKey, RwReal time);
+extern RpGeometry *RpMorphGeometrySetNextInterpolator(RpGeometry *geometry,
+ RwInt32 interpNum, RwInt32 interpNumNext);
+extern RpGeometry *RpMorphGeometrySetCallBack(RpGeometry *geometry, RpMorphGeometryCallBack animCB);
+extern RpMorphGeometryCallBack RpMorphGeometryGetCallBack(const RpGeometry *geometry);
+
+extern RpAtomic *RpMorphAtomicSetCurrentInterpolator(RpAtomic *atomic, RwInt32 interpNum);
+extern RwInt32 RpMorphAtomicGetCurrentInterpolator(RpAtomic *atomic);
+
+extern RpMorphInterpolator *RpMorphGeometryGetInterpolator(RpGeometry *geometry, RwInt32 interpNum);
+
+extern RpAtomic *RpMorphAtomicSetTime(RpAtomic *atomic, RwReal time);
+extern RpAtomic *RpMorphAtomicAddTime(RpAtomic *atomic, RwReal time);
+
+
+/* LEGACY-SUPPORT version: */
+extern RpMorphInterpolator *_rpMorphAtomicGetInterpolator(RpAtomic *atomic, RwInt32 interpNum);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#define RpMorphAtomicGetInterpolator(_atomic, _interpNum) \
+ _rpMorphAtomicGetInterpolator(_atomic, _interpNum)
+
+#endif /* RPMORPH_H */
+
diff --git a/sdk/rwsdk/include/d3d8/rpmorph.rpe b/sdk/rwsdk/include/d3d8/rpmorph.rpe
new file mode 100644
index 00000000..47834a81
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpmorph.rpe
@@ -0,0 +1,175 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionMorph
+{
+
+
+E_RP_MORPH_INVALIDINTERP,
+
+E_RP_MORPH_NOGEOMETRY,
+
+ e_rwdb_CriterionMorphLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionMorph e_rwdb_CriterionMorph;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rppatch.h b/sdk/rwsdk/include/d3d8/rppatch.h
new file mode 100644
index 00000000..0b54fb1b
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rppatch.h
@@ -0,0 +1,695 @@
+
+#ifndef RPPATCH_H
+#define RPPATCH_H
+
+/**
+ * \defgroup rppatch RpPatch
+ * \ingroup bezierpatches
+ *
+ * Bezier patch library
+ *
+ * This library provides efficient evaluation of patches.
+ */
+
+/*===========================================================================*
+ *--- Include files ---------------------------------------------------------*
+ *===========================================================================*/
+#include "rwcore.h"
+#include "rpworld.h"
+
+#include "rpcriter.h"
+#include "rppatch.rpe"
+
+/*===========================================================================*
+ *--- Defines ---------------------------------------------------------------*
+ *===========================================================================*/
+
+/**
+ * \ingroup rppatch
+ * \def rpQUADPATCHNUMCONTROLPOINTS defines the number of control points in
+ * a quadrilateral patch.
+ *
+ * \see RpQuadPatch
+ * \see rpQUADPATCHNUMCONTROLINDICES
+ * \see RpPatchMeshSetQuadPatch
+ */
+#define rpQUADPATCHNUMCONTROLPOINTS (16)
+
+/**
+ * \ingroup rppatch
+ * \def rpTRIPATCHNUMCONTROLPOINTS defines the number of control points in
+ * a triangular patch.
+ *
+ * \see RpTriPatch
+ * \see rpTRIPATCHNUMCONTROLINDICES
+ * \see RpPatchMeshSetTriPatch
+ */
+#define rpTRIPATCHNUMCONTROLPOINTS (10)
+
+/**
+ * \ingroup rppatch
+ * \def rpQUADPATCHNUMCONTROLINDICES defines the number of control point
+ * indices in a \ref RpQuadPatch quadrilateral patch.
+ *
+ * \see rpQUADPATCHNUMCONTROLPOINTS
+ * \see RpPatchMeshSetQuadPatch
+ */
+#define rpQUADPATCHNUMCONTROLINDICES rpQUADPATCHNUMCONTROLPOINTS
+
+/**
+ * \ingroup rppatch
+ * \def rpTRIPATCHNUMCONTROLINDICES defines the number of control points
+ * indices in a \ref RpTriPatch triangular patch.
+ *
+ * \see rpTRIPATCHNUMCONTROLPOINTS
+ * \see RpPatchMeshSetTriPatch
+ */
+#define rpTRIPATCHNUMCONTROLINDICES rpTRIPATCHNUMCONTROLPOINTS
+
+/**
+ * \ingroup rppatch
+ * \def rpPATCHLODMAXVALUE defines the maximum value that can be returned for
+ * the patch evaluation LOD.
+ *
+ * \see rpPATCHSKINLODMAXVALUE
+ * \see rpPATCHLODMINVALUE
+ * \see RpPatchLODCallBack
+ */
+#define rpPATCHLODMAXVALUE (20)
+
+/**
+ * \ingroup rppatch
+ * \def rpPATCHSKINLODMAXVALUE defines the maximum value that can be returned
+ * for the skinned patch evaluation LOD.
+ *
+ * \see rpPATCHLODMAXVALUE
+ * \see rpPATCHLODMINVALUE
+ * \see RpPatchLODCallBack
+ */
+#define rpPATCHSKINLODMAXVALUE (18)
+
+/**
+ * \ingroup rppatch
+ * \def rpPATCHLODMINVALUE defines the minimum value that can be returned for
+ * the patch evaluation LOD.
+ *
+ * \see rpPATCHSKINLODMAXVALUE
+ * \see rpPATCHLODMAXVALUE
+ * \see RpPatchLODCallBack
+ */
+#define rpPATCHLODMINVALUE (4)
+
+/**
+ * \ingroup rppatch
+ * \def rpPATCHMESHTEXCOORDSETS Multi texture coordinate format specifier
+ * for \ref RpPatchMeshCreate(). This should be OR'd into the
+ * \ref RpPatchMeshFlag .
+ */
+#define rpPATCHMESHTEXCOORDSETS(_num) \
+ ((_num & 0xff) << 16)
+
+/**
+ * \ingroup rppatch
+ * \def rpPATCHMESHLOCKTEXCOORDSIDX
+ * Convenience macro for generating a texture coordinate lock flag.
+ */
+#define rpPATCHMESHLOCKTEXCOORDSIDX(_idx) \
+ (rpPATCHMESHLOCKTEXCOORDS1 << (_idx))
+
+/*===========================================================================*
+ *--- Global Types ----------------------------------------------------------*
+ *===========================================================================*/
+
+/**
+ * \ingroup rppatch
+ * \ref RpPatchMeshFlag
+ * When creating a \ref RpPatchMesh, these flags can be OR'ed together to
+ * specify the format along with the \ref rpPATCHMESHTEXCOORDSETS(num) macro
+ * to specify the number of texture coordinate sets required.
+ *
+ * \see RpPatchMeshCreate
+ */
+enum RpPatchMeshFlag
+{
+ rpNAPATCHMESHFLAG = 0,
+ rpPATCHMESHPOSITIONS = 0x01, /**<Patch mesh contains control point
+ positions. */
+ rpPATCHMESHNORMALS = 0x02, /**<Patch mesh contains control point
+ normals. */
+ rpPATCHMESHPRELIGHTS = 0x04, /**<Patch mesh contains control point
+ pre-light color values. */
+ rpPATCHMESHTEXTURED = 0x08, /**<Patch mesh is textured. The number
+ of texture sets must also be
+ defined. */
+ rpPATCHMESHLIGHT = 0x10, /**<Patch mesh will be lit. */
+ rpPATCHMESHMODULATEMATERIALCOLOR = 0x20,
+ /**<Control point color will be
+ modulated with the material color. */
+ rpPATCHMESHSMOOTHNORMALS = 0x40,
+ /**<Patch mesh normals will be
+ smoothed automatically. */
+ rpPATCHMESHFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpPatchMeshFlag RpPatchMeshFlag;
+
+/**
+ * \ingroup rppatch
+ * \ref RpPatchMeshLockMode patch mesh lock flags.
+ *
+ * \see rpPATCHMESHLOCKTEXCOORDSIDX
+ */
+enum RpPatchMeshLockMode
+{
+ rpNAPATCHMESHLOCKMODE = 0,
+ rpPATCHMESHLOCKPATCHES = 0x0001, /**<Lock the mesh patches. */
+ rpPATCHMESHLOCKPOSITIONS = 0x0002, /**<Lock the control point
+ positions. */
+ rpPATCHMESHLOCKNORMALS = 0x0004, /**<Lock the control point
+ normals. */
+ rpPATCHMESHLOCKPRELIGHTS = 0x0008, /**<Lock the control point
+ pre-light color values. */
+ rpPATCHMESHLOCKTEXCOORDS1 = 0x0100, /**<Lock the texture coordinates
+ set 1. */
+ rpPATCHMESHLOCKTEXCOORDS2 = 0x0200, /**<Lock the texture coordinates
+ set 2. */
+ rpPATCHMESHLOCKTEXCOORDS3 = 0x0400, /**<Lock the texture coordinates
+ set 3. */
+ rpPATCHMESHLOCKTEXCOORDS4 = 0x0800, /**<Lock the texture coordinates
+ set 4. */
+ rpPATCHMESHLOCKTEXCOORDS5 = 0x1000, /**<Lock the texture coordinates
+ set 5. */
+ rpPATCHMESHLOCKTEXCOORDS6 = 0x2000, /**<Lock the texture coordinates
+ set 6. */
+ rpPATCHMESHLOCKTEXCOORDS7 = 0x4000, /**<Lock the texture coordinates
+ set 7. */
+ rpPATCHMESHLOCKTEXCOORDS8 = 0x8000, /**<Lock the texture coordinates
+ set 8. */
+ rpPATCHMESHLOCKTEXCOORDSALL = 0xff00, /**<Lock all texture coordinate
+ sets. */
+ rpPATCHMESHLOCKALL = 0xffff, /**<Combination of all the
+ above. */
+ rpPATCHMESHLOCKMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpPatchMeshLockMode RpPatchMeshLockMode;
+
+typedef struct RpPatchMeshDefinition RpPatchMeshDefinition;
+/**
+ * \ingroup rppatch
+ * \struct RpPatchMeshDefinition
+ * holds the definition sizes of the patch mesh. This data should be considered
+ * read only.
+ */
+struct RpPatchMeshDefinition
+{
+ RwUInt32 flag; /**<Patch mesh definition flag. */
+ RwUInt32 numControlPoints; /**<Number of control points. */
+ RwUInt32 numTriPatches; /**<Number of tri patches. */
+ RwUInt32 numQuadPatches; /**<Number of quad patches. */
+ RwUInt32 numTexCoordSets; /**<Number of sets of texture coordinates. */
+};
+
+typedef struct RpPatchMesh RpPatchMesh;
+/**
+ * \ingroup rppatch
+ * \struct RpPatchMesh
+ * holds the control point data for a patch mesh. The patch mesh should be
+ * created with \ref RpPatchMeshCreate. The patch mesh should be locked with
+ * \ref RpPatchMeshLock before the data is edited. Quadrilateral and triangle
+ * patches can be defined from the control points with
+ * \ref RpPatchMeshSetQuadPatch and \ref RpPatchMeshSetTriPatch respectively.
+ * The patch mesh should be unlocked with \ref RpPatchMeshUnlock before it is
+ * added to an \ref RpAtomic with \ref RpPatchAtomicSetPatchMesh.
+ *
+ * \see RpPatchMeshDefinition
+ */
+struct RpPatchMesh
+{
+ RwV3d *positions; /**<Control point positions. */
+ RwV3d *normals; /**<Control point normals. */
+ RwRGBA *preLightColors; /**<Control point pre-light colors. */
+ RwTexCoords *texCoords[rwMAXTEXTURECOORDS];
+ /**<Control point texture coordinates. */
+ RpPatchMeshDefinition definition; /**<Patch mesh definition data. */
+};
+
+typedef struct RpQuadPatch RpQuadPatch;
+/**
+ * \ingroup rppatch
+ * \struct RpQuadPatch
+ * holds the control point indices for a quadrilateral patch. There are
+ * \ref rpQUADPATCHNUMCONTROLINDICES indices for a quadrilateral patch.
+ *
+ * \see RpPatchMeshSetQuadPatch
+ */
+struct RpQuadPatch
+{
+ RwUInt32 cpIndices[rpQUADPATCHNUMCONTROLINDICES]; /**<Control point
+ indices. */
+};
+
+typedef struct RpTriPatch RpTriPatch;
+/**
+ * \ingroup rppatch
+ * \struct RpTriPatch
+ * holds the control point indices for a triangle patch. There are
+ * \ref rpTRIPATCHNUMCONTROLINDICES indices for a triangular patch.
+ *
+ * \see RpPatchMeshSetTriPatch
+ */
+struct RpTriPatch
+{
+ RwUInt32 cpIndices[rpTRIPATCHNUMCONTROLINDICES]; /**<Control point
+ indices. */
+};
+
+typedef struct RpPatchLODRange RpPatchLODRange;
+/**
+ * \ingroup rppatch
+ * \struct RpPatchLODRange
+ * holds the variables used by the default atomic LOD call back function.
+ */
+struct RpPatchLODRange
+{
+ RwUInt32 minLod; /**<Minimum LOD value. */
+ RwUInt32 maxLod; /**<Maximum LOD value. */
+ RwReal minRange; /**<Minimum LOD range. */
+ RwReal maxRange; /**<Maximum LOD range. */
+};
+
+/**
+ * \ingroup rppatch
+ * \ref RpPatchLODUserData
+ * typedef for the user data passed to the \ref RpPatchLODCallBack
+ * function which calculates the atomics' LOD.
+ *
+ * \see RpPatchAtomicSetPatchLODCallBack
+ * \see RpPatchAtomicGetPatchLODCallBack
+ */
+typedef void *RpPatchLODUserData;
+
+/**
+ * \ingroup rppatch
+ * \ref RpPatchLODCallBack
+ * typedef for the patch atomic LOD calculation function.
+ *
+ * \param atomic
+ * \param userData
+ *
+ * \return
+ *
+ * \see RpPatchAtomicSetPatchLODCallBack
+ * \see RpPatchAtomicGetPatchLODCallBack
+ */
+typedef RwUInt32 (* RpPatchLODCallBack)( RpAtomic *atomic,
+ RpPatchLODUserData userData );
+
+/*===========================================================================*
+ *--- Plugin API Functions --------------------------------------------------*
+ *===========================================================================*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/*---------------------------------------------------------------------------*
+ *- Plugin functions -*
+ *---------------------------------------------------------------------------*/
+extern void
+RpPatchGeometrySetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern void
+RpPatchAtomicSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+
+extern RwBool
+RpPatchPluginAttach(void);
+
+/*---------------------------------------------------------------------------*
+ *- Patch Mesh functions -*
+ *---------------------------------------------------------------------------*/
+extern RpPatchMesh *
+RpPatchMeshCreate( RwUInt32 numQuadPatches,
+ RwUInt32 numTriPatches,
+ RwUInt32 numControlPoints,
+ RwUInt32 definitionFlag );
+
+extern RwBool
+RpPatchMeshDestroy( RpPatchMesh *patchMesh );
+
+extern RpPatchMesh *
+RpPatchMeshLock( RpPatchMesh *patchMesh,
+ RwUInt32 lockMode );
+
+extern RpPatchMesh *
+RpPatchMeshUnlock( RpPatchMesh *patchMesh );
+
+/*---------------------------------------------------------------------------*
+ *- Patch mesh helper functions -*
+ *---------------------------------------------------------------------------*/
+
+extern RpPatchMesh *
+RpPatchMeshTransform( RpPatchMesh *patchMesh,
+ const RwMatrix *matrix );
+
+/*---------------------------------------------------------------------------*/
+#define RpPatchMeshGetFlagsMacro(patchMesh) \
+ (patchMesh->definition.flag)
+
+#define RpPatchMeshSetFlagsMacro(patchMesh, flags) \
+ (patchMesh->definition.flag = flags)
+
+#define RpPatchMeshGetNumControlPointsMacro(patchMesh) \
+ (patchMesh->definition.numControlPoints)
+
+#define RpPatchMeshGetNumTriPatchesMacro(patchMesh) \
+ (patchMesh->definition.numTriPatches)
+
+#define RpPatchMeshGetNumQuadPatchesMacro(patchMesh) \
+ (patchMesh->definition.numQuadPatches)
+
+#define RpPatchMeshGetNumTexCoordSetsMacro(patchMesh) \
+ (patchMesh->definition.numTexCoordSets)
+
+#define RpPatchMeshGetPositionsMacro(patchMesh) \
+ (patchMesh->positions)
+
+#define RpPatchMeshGetNormalsMacro(patchMesh) \
+ (patchMesh->normals)
+
+#define RpPatchMeshGetPreLightColorsMacro(patchMesh) \
+ (patchMesh->preLightColors)
+
+#define RpPatchMeshGetTexCoordsMacro(patchMesh, index) \
+ (patchMesh->texCoords[index - 1])
+/*---------------------------------------------------------------------------*/
+
+#if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE))
+
+/*---------------------------------------------------------------------------*/
+extern RwUInt32
+RpPatchMeshGetFlags( const RpPatchMesh *patchMesh );
+
+extern RpPatchMesh *
+RpPatchMeshSetFlags( RpPatchMesh *patchMesh,
+ RwUInt32 flags );
+
+extern RwUInt32
+RpPatchMeshGetNumControlPoints( const RpPatchMesh *patchMesh );
+
+extern RwUInt32
+RpPatchMeshGetNumTriPatches( const RpPatchMesh *patchMesh );
+
+extern RwUInt32
+RpPatchMeshGetNumQuadPatches( const RpPatchMesh *patchMesh );
+
+extern RwUInt32
+RpPatchMeshGetNumTexCoordSets( const RpPatchMesh *patchMesh );
+
+extern RwV3d *
+RpPatchMeshGetPositions( const RpPatchMesh *patchMesh );
+
+extern RwV3d *
+RpPatchMeshGetNormals( const RpPatchMesh *patchMesh );
+
+extern RwRGBA *
+RpPatchMeshGetPreLightColors( const RpPatchMesh *patchMesh );
+
+extern RwTexCoords *
+RpPatchMeshGetTexCoords( const RpPatchMesh *patchMesh,
+ RwTextureCoordinateIndex index );
+/*---------------------------------------------------------------------------*/
+
+#else /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */
+
+/*---------------------------------------------------------------------------*/
+#define RpPatchMeshGetFlags(patchMesh) \
+ RpPatchMeshGetFlagsMacro(patchMesh)
+
+#define RpPatchMeshSetFlags(patchMesh, flags) \
+ RpPatchMeshSetFlagsMacro(patchMesh, flags)
+
+#define RpPatchMeshGetNumControlPoints(patchMesh) \
+ RpPatchMeshGetNumControlPointsMacro(patchMesh)
+
+#define RpPatchMeshGetNumTriPatches(patchMesh) \
+ RpPatchMeshGetNumTriPatchesMacro(patchMesh)
+
+#define RpPatchMeshGetNumQuadPatches(patchMesh) \
+ RpPatchMeshGetNumQuadPatchesMacro(patchMesh)
+
+#define RpPatchMeshGetNumTexCoordSets(patchMesh) \
+ RpPatchMeshGetNumTexCoordSetsMacro(patchMesh)
+
+#define RpPatchMeshGetPositions(patchMesh) \
+ RpPatchMeshGetPositionsMacro(patchMesh)
+
+#define RpPatchMeshGetNormals(patchMesh) \
+ RpPatchMeshGetNormalsMacro(patchMesh)
+
+#define RpPatchMeshGetPreLightColors(patchMesh) \
+ RpPatchMeshGetPreLightColorsMacro(patchMesh)
+
+#define RpPatchMeshGetTexCoords(patchMesh, index) \
+ RpPatchMeshGetTexCoordsMacro(patchMesh, index)
+/*---------------------------------------------------------------------------*/
+
+#endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */
+
+/*---------------------------------------------------------------------------*
+ *- Patch streaming functions -*
+ *---------------------------------------------------------------------------*/
+extern RwUInt32
+RpPatchMeshStreamGetSize( const RpPatchMesh *patchMesh );
+
+extern RpPatchMesh *
+RpPatchMeshStreamRead( RwStream *stream );
+
+extern const RpPatchMesh *
+RpPatchMeshStreamWrite( const RpPatchMesh *patchMesh,
+ RwStream *stream );
+
+/*---------------------------------------------------------------------------*
+ *- Patch Mesh patch functions -*
+ *---------------------------------------------------------------------------*/
+extern RpPatchMesh *
+RpPatchMeshSetQuadPatch( RpPatchMesh *patchMesh,
+ RwUInt32 quadIndex,
+ RpQuadPatch *quadPatch );
+
+extern RpPatchMesh *
+RpPatchMeshSetTriPatch( RpPatchMesh *patchMesh,
+ RwUInt32 triIndex,
+ RpTriPatch *triPatch );
+
+extern const RpQuadPatch *
+RpPatchMeshGetQuadPatch( const RpPatchMesh *patchMesh,
+ RwUInt32 quadIndex );
+
+extern const RpTriPatch *
+RpPatchMeshGetTriPatch( const RpPatchMesh *patchMesh,
+ RwUInt32 triIndex );
+
+/*---------------------------------------------------------------------------*
+ *- Patch Mesh material functions -*
+ *---------------------------------------------------------------------------*/
+extern RpPatchMesh *
+RpPatchMeshSetQuadPatchMaterial( RpPatchMesh *patchMesh,
+ RwUInt32 quadIndex,
+ RpMaterial *material );
+
+extern RpPatchMesh *
+RpPatchMeshSetTriPatchMaterial( RpPatchMesh *patchMesh,
+ RwUInt32 triIndex,
+ RpMaterial *material );
+
+extern RpMaterial *
+RpPatchMeshGetQuadPatchMaterial( const RpPatchMesh *patchMesh,
+ RwUInt32 quadIndex );
+
+extern RpMaterial *
+RpPatchMeshGetTriPatchMaterial( const RpPatchMesh *patchMesh,
+ RwUInt32 triIndex );
+
+extern const RpPatchMesh *
+RpPatchMeshForAllMaterials( const RpPatchMesh *patchMesh,
+ RpMaterialCallBack callBack,
+ void *userData );
+
+extern RwUInt32
+RpPatchMeshGetNumMaterials( const RpPatchMesh *patchMesh );
+
+extern RpMaterial *
+RpPatchMeshGetMaterial( const RpPatchMesh *patchMesh,
+ RwUInt32 materialIndex );
+
+/*---------------------------------------------------------------------------*
+ *- Patch Skin functions -*
+ *---------------------------------------------------------------------------*/
+#if (defined(RPSKIN_H))
+
+extern RpSkin *
+RpPatchMeshGetSkin( RpPatchMesh *patchMesh );
+
+extern RpPatchMesh *
+RpPatchMeshSetSkin( RpPatchMesh *patchMesh,
+ RpSkin *skin );
+
+#endif /* (defined(RPSKIN_H)) */
+
+/*---------------------------------------------------------------------------*
+ *- Patch Atomic functions -*
+ *---------------------------------------------------------------------------*/
+extern RpAtomic *
+RpPatchAtomicSetPatchMesh( RpAtomic *atomic,
+ RpPatchMesh *patchMesh );
+
+extern RpPatchMesh *
+RpPatchAtomicGetPatchMesh( const RpAtomic *atomic );
+
+/*---------------------------------------------------------------------------*
+ *- Patch Atomic LOD functions -*
+ *---------------------------------------------------------------------------*/
+extern RwBool
+RpPatchAtomicSetPatchLODCallBack( RpAtomic *atomic,
+ RpPatchLODCallBack callback,
+ RpPatchLODUserData userData );
+
+extern RwBool
+RpPatchAtomicGetPatchLODCallBack( const RpAtomic *atomic,
+ RpPatchLODCallBack *callback,
+ RpPatchLODUserData *userData );
+
+/*---------------------------------------------------------------------------*
+ *- Patch default LOD range -*
+ *---------------------------------------------------------------------------*/
+extern RwBool
+RpPatchSetDefaultLODCallBackRange( RpPatchLODRange *lodRange );
+
+extern RwBool
+RpPatchGetDefaultLODCallBackRange( RpPatchLODRange *lodRange );
+
+/*---------------------------------------------------------------------------*
+ *- Patch pipeline -*
+ *---------------------------------------------------------------------------*/
+
+/**
+ * \ingroup rppatch
+ * \ref RpPatchType defines the different ways a patch atomic can be rendered.
+ * Once a \ref RpPatchMesh has been attached to an \ref RpAtomic with
+ * \ref RpPatchAtomicSetPatchMesh the atomic must be setup with the correct
+ * rendering pipeline with \ref RpPatchAtomicSetType .
+ *
+ * The patch plugin makes no assumptions about how to render the
+ * patch atomics. Once an \ref RpPatchMesh has been attached to an
+ * \ref RpAtomic it is necessary to attach a suitable patch
+ * rendering pipeline. The patch plugin supports four different
+ * rendering types, these are defined in the \ref RpPatchType
+ * enumeration:-
+ * \li \ref rpPATCHTYPEGENERIC
+ * The patch \ref RpAtomic will be rendered with the
+ * default generic patch rendering pipeline.
+ * \li \ref rpPATCHTYPESKIN
+ * The patch \ref RpAtomic will be rendered with a
+ * custom pipeline for rendering skinning patches. Make sure
+ * an \ref RpSkin has been attached to the \ref RpPatchMesh
+ * and an \ref RpHAnimHierarchy has been attached to the
+ * \ref RpAtomic.
+ * \li \ref rpPATCHTYPEMATFX
+ * The patch \ref RpAtomic will be rendered with a
+ * custom pipeline for rendering the material effects
+ * of patches. The
+ * patch matfx pipeline supports all the material effects
+ * defined in the \ref rpmatfx plugin. The patches
+ * materials should be setup as usual.
+ * \li \ref rpPATCHTYPESKINMATFX
+ * The patch \ref RpAtomic will be rendered with a
+ * custom skinned material effects patch rendering pipeline.
+ * The \ref RpPatchMesh, \ref RpAtomic and the patches'
+ * \ref RpMaterial's must be setup correctly.
+ */
+enum RpPatchType
+{
+ rpNAPATCHTYPE = 0, /**<Invalid patch pipeline. */
+ rpPATCHTYPEGENERIC = 1, /**<Generic patch rendering. */
+ rpPATCHTYPESKIN = 2, /**<Skinned patch rendering. */
+ rpPATCHTYPEMATFX = 3, /**<Material effects patch rendering. */
+ rpPATCHTYPESKINMATFX = 4, /**<Skinned material effects patch rendering. */
+ rpPATCHTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpPatchType RpPatchType;
+
+extern RpAtomic *
+RpPatchAtomicSetType( RpAtomic *atomic,
+ RpPatchType type );
+
+extern RpPatchType
+RpPatchAtomicGetType( const RpAtomic *atomic );
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/*---- start: ./d3d8/patchplatform.h----*/
+
+/**
+ * \defgroup rppatchd3d8 D3D8
+ * \ingroup rppatch
+ *
+ * D3D8 patch pipeline extension.
+ */
+
+
+/*===========================================================================*
+ *--- D3D8 Defines -----------------------------------------------------------*
+ *===========================================================================*/
+
+/*===========================================================================*
+ *--- D3D8 Global Types ------------------------------------------------------*
+ *===========================================================================*/
+
+/**
+ * \ingroup rppatchd3d8
+ * \ref RpPatchD3D8Pipeline rendering pipelines available within the
+ * \ref rppatch plugin. Use \ref RpPatchGetD3D8Pipeline to retrieve
+ * the \ref RxPipeline s.
+ */
+enum RpPatchD3D8Pipeline
+{
+ rpPATCHD3D8PIPELINEGENERIC = 0, /**<D3D8 generic
+ patch rendering pipeline. */
+ rpPATCHD3D8PIPELINEMATFX = 1, /**<D3D8 material effect
+ (single set of texture coordinates)
+ patch rendering pipeline. */
+ rpPATCHD3D8PIPELINESKINNED = 2, /**<D3D8 skinned
+ patch rendering pipeline. */
+ rpPATCHD3D8PIPELINESKINMATFX = 3, /**<D3D8 skinned material effect
+ (single set of texture coordinates)
+ patch rendering pipeline. */
+ rpPATCHD3D8PIPELINEMAX,
+ rpPATCHD3D8PIPELINEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpPatchD3D8Pipeline RpPatchD3D8Pipeline;
+
+/*===========================================================================*
+ *--- D3D8 Plugin API Functions ----------------------------------------------*
+ *===========================================================================*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+/*---------------------------------------------------------------------------*/
+
+extern RxPipeline *
+RpPatchGetD3D8Pipeline( RpPatchD3D8Pipeline d3d8Pipeline );
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/*---- end: ./d3d8/patchplatform.h----*/
+
+#endif /* RPPATCH_H */
+
+
diff --git a/sdk/rwsdk/include/d3d8/rppatch.rpe b/sdk/rwsdk/include/d3d8/rppatch.rpe
new file mode 100644
index 00000000..85dca470
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rppatch.rpe
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionPATCH
+{
+
+
+
+ e_rwdb_CriterionPATCHLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionPATCH e_rwdb_CriterionPATCH;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpprtstd.h b/sdk/rwsdk/include/d3d8/rpprtstd.h
new file mode 100644
index 00000000..ba0bf1d6
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpprtstd.h
@@ -0,0 +1,1073 @@
+
+#ifndef RPPRTSTD_H
+#define RPPRTSTD_H
+
+/*===========================================================================*
+ *--- Include files ---------------------------------------------------------*
+ *===========================================================================*/
+
+#include "rwcore.h"
+#include "rpworld.h"
+
+
+/*---- start: ./prtstd.h----*/
+
+#include "rwcore.h"
+#include "rpworld.h"
+#include "rpptank.h"
+
+#include "rpprtstd.rpe"
+
+
+
+/************************************************************************
+ *
+ *
+ *
+ ************************************************************************/
+
+/**
+ * \defgroup rpprtstd RpPrtStd
+ * \ingroup particles
+ *
+ * Particle Animation Plugin for RenderWare Graphics.
+ */
+
+/*
+ * Current version stamp
+ */
+#define rpPRTSTDVERSIONSTAMP 2
+
+/*
+ * Random Number Generation Macros
+ */
+#define PRTSTD_SRAND_MAX 0xFFFFFFFF
+#define PRTSTD_SRAND_IMAX ((RwReal) 1.0 / (RwReal) PRTSTD_SRAND_MAX)
+
+#define PRTSTD_SRAND(_seed) ((_seed) = ((_seed) * 196314165 + 907633515))
+
+/* Real rand -1.0 .. + 1.0 */
+#define PRTSTD_RSRAND(_seed) (((RwReal)((RwUInt32) (_seed) * PRTSTD_SRAND_IMAX) * \
+ (RwReal) 2.0) - (RwReal) 1.0)
+
+
+
+#define PRTSTD_2RSRAND2(_seed) (((RwReal)((RwReal) (_seed) * PRTSTD_SRAND_IMAX) * \
+ (RwReal)1.0))
+
+/**
+ * \ingroup rpprtstd
+ * \ref RpPrtStdParticleFlags, this type represents the different properties of
+ * a particle.
+ */
+enum RpPrtStdParticleFlags
+{
+ rpPRTSTDPARTICLEFLAGEMITTER = 0x00000001, /**<Particle is an emitter. */
+
+ rpPRTSTDPARTICLEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+typedef enum RpPrtStdParticleFlags RpPrtStdParticleFlags;
+
+/**
+ * \ingroup rpprtstd
+ * \ref RpPrtStdEmitterFlags, this type represents the different properties of
+ * an emitter.
+ */
+enum RpPrtStdEmitterFlags
+{
+ rpPRTSTDEMITTERFLAGALIVE = 0x00000001, /**< The emitter is alive and should not be removed */
+ rpPRTSTDEMITTERFLAGACTIVE = 0x00000002, /**< This indicates the emitter is active or idle */
+ rpPRTSTDEMITTERFLAGPTANK = 0x00000004, /**< The emitter uses the \ref rpptank */
+ rpPRTSTDEMITTERFLAGEMIT = 0x00000008, /**< This indicates the emitter can emit new particles */
+ rpPRTSTDEMITTERFLAGUPDATE = 0x00000010, /**< This indicates if the emitter is to be updated. */
+ rpPRTSTDEMITTERFLAGUPDATEPARTICLE = 0x00000020, /**< This indicated if the emitter's particles are updated. */
+ rpPRTSTDEMITTERFLAGRENDER = 0x00000040, /**< This indicates if the emitter is rendered. */
+ rpPRTSTDEMITTERFLAGRENDERPARTICLE = 0x00000080, /**< This indicates if the emitter's particles are rendered. */
+ rpPRTSTDEMITTERFLAGNOBUFFERSWAP = 0x00000100, /**< Internal usage */
+ rpPRTSTDEMITTERFLAGSTREAMREAD = 0x00000200, /**< Internal usage */
+ rpPRTSTDEMITTERFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+typedef enum RpPrtStdEmitterFlags RpPrtStdEmitterFlags;
+
+/************************************************************************
+ *
+ *
+ *
+ ************************************************************************/
+
+#define rpPRTSTDPARTICLECALLBACKMAX 7
+
+/**
+ * \ingroup rpprtstd
+ * \ref RpPrtStdParticleCallBackCode, this type represents the different callbacks for
+ * processing a \ref RpPrtStdParticleBatch. These callbacks will be called at various point for
+ * processing the particle's custom data.
+ */
+enum RpPrtStdParticleCallBackCode
+{
+ rpPRTSTDPARTICLECALLBACKUPDATE = 0, /**< Particle update callback */
+ rpPRTSTDPARTICLECALLBACKRENDER, /**< Particle render callback */
+ rpPRTSTDPARTICLECALLBACKCREATE, /**< Particle create callback */
+ rpPRTSTDPARTICLECALLBACKDESTROY, /**< Particle destroy callback */
+ rpPRTSTDPARTICLECALLBACKFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+typedef enum RpPrtStdParticleCallBackCode RpPrtStdParticleCallBackCode;
+
+#define rpPRTSTDEMITTERCALLBACKMAX 11
+
+/**
+ * \ingroup rpprtstd
+ * \ref RpPrtStdEmitterCallBackCode, this type represents the different callbacks for
+ * processing a \ref RpPrtStdEmitter. These callbacks will be called at various point for
+ * processing the emitter's custom data.
+ */
+enum RpPrtStdEmitterCallBackCode
+{
+ rpPRTSTDEMITTERCALLBACKEMIT = 0, /**< Emitter particle emission callback */
+ rpPRTSTDEMITTERCALLBACKBEGINUPDATE, /**< Emitter begin update call back */
+ rpPRTSTDEMITTERCALLBACKENDUPDATE, /**< Emitter end update callback */
+ rpPRTSTDEMITTERCALLBACKBEGINRENDER, /**< Emitter begin render callback */
+ rpPRTSTDEMITTERCALLBACKENDRENDER, /**< Emitter end render callback */
+ rpPRTSTDEMITTERCALLBACKCREATE, /**< Emitter create callback */
+ rpPRTSTDEMITTERCALLBACKDESTROY, /**< Emitter destroy callback */
+ rpPRTSTDEMITTERCALLBACKSTREAMREAD, /**< Emitter stream input callback */
+ rpPRTSTDEMITTERCALLBACKSTREAMWRITE, /**< Emitter stream output callback */
+ rpPRTSTDEMITTERCALLBACKSTREAMGETSIZE, /**< Emitter stream get size callback */
+ rpPRTSTDEMITTERCALLBACKCLONE, /**< Emitter clone callback */
+ rpPRTSTDEMITTERCALLBACKFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+typedef enum RpPrtStdEmitterCallBackCode RpPrtStdEmitterCallBackCode;
+
+typedef RwInt32 RpPrtStdPropertyCode;
+
+/************************************************************************
+ *
+ *
+ *
+ ************************************************************************/
+
+typedef struct RpPrtStdEmitter RWALIGN(RpPrtStdEmitter, rwMATRIXALIGNMENT);
+
+/**
+ * \ingroup rpprtstd
+ * \ref RpPrtStdEmitterCallBack
+ * \ref RpPrtStdEmitterCallBack represents the function called for processing
+ * a \ref RpPrtStdEmitter. There can several types of the functions, each performing a
+ * specific task defined by \ref RpPrtStdEmitterCallBackCode.
+ *
+ * \param atomic A pointer to the emitter's parent atomic.
+ * \param emt A pointer to the emitter.
+ * \param data A pointer to user data.
+ *
+ * \return A pointer to the emitter on success. NULL otherwise.
+ */
+typedef RpPrtStdEmitter *
+ (*RpPrtStdEmitterCallBack)
+ (RpAtomic *atomic, RpPrtStdEmitter *emt, void *data);
+
+typedef struct RpPrtStdParticleBatch RWALIGN(RpPrtStdParticleBatch, rwMATRIXALIGNMENT);
+/**
+ * \ingroup rpprtstd
+ * \ref RpPrtStdParticleCallBack represents the function called for processing
+ * a \ref RpPrtStdParticleBatch. There can be several types of the functions, each
+ * performing a specific task defined by \ref RpPrtStdParticleCallBackCode.
+ *
+ * \param emt A pointer to the particle batch's parent emitter.
+ * \param prtBatch A pointer to the particle batch.
+ * \param data A pointer to user data.
+ *
+ * \return A pointer to the particle batch on success. NULL otherwise.
+ */
+typedef RpPrtStdParticleBatch *
+ (*RpPrtStdParticleCallBack)
+ (RpPrtStdEmitter *emt, RpPrtStdParticleBatch *prtBatch, void *data);
+
+/**
+ * \ingroup rpprtstd
+ * \ref RpPrtStdEmitterCallBackArray represents a set of callback functions for
+ * processing a \ref RpPrtStdEmitter. All the functions are of the type \ref
+ * RpPrtStdEmitterCallBack.
+ *
+ * \see RpPrtStdEmitterCallBackCode
+ */
+typedef RpPrtStdEmitterCallBack
+ RpPrtStdEmitterCallBackArray[rpPRTSTDEMITTERCALLBACKMAX];
+
+/**
+ * \ingroup rpprtstd
+ * \ref RpPrtStdParticleCallBackArray represents a set of callback functions for
+ * processing a \ref RpPrtStdParticleBatch. All the functions are of the type \ref
+ * RpPrtStdParticleCallBack.
+ *
+ * \see RpPrtStdParticleCallBackCode
+ */
+typedef RpPrtStdParticleCallBack
+ RpPrtStdParticleCallBackArray[rpPRTSTDPARTICLECALLBACKMAX];
+
+
+/************************************************************************
+ *
+ *
+ *
+ ************************************************************************/
+
+typedef struct RpPrtStdEmitterClass RpPrtStdEmitterClass;
+/**
+ * \ingroup rpprtstd
+ * \ref RpPrtStdEClassSetupCallBack represents the function called for setting up an
+ * emitter class's set of callback function. The callback function is called
+ * after an emitter class is streamed in.
+ *
+ * \param eClass A pointer to an emitter class.
+ *
+ * \return A pointer to the emitter class on success. NULL otherwise.
+ */
+typedef RpPrtStdEmitterClass *
+ (*RpPrtStdEClassSetupCallBack)
+ (RpPrtStdEmitterClass *eClass);
+
+typedef struct RpPrtStdParticleClass RpPrtStdParticleClass;
+/**
+ * \ingroup rpprtstd
+ * \ref RpPrtStdPClassSetupCallBack represents the function called for setting up an
+ * emitter class's set of callback function. The callback function is called
+ * after an emitter class is streamed in.
+ *
+ * \param pClass A pointer to a particle class.
+ *
+ * \return A pointer to the particle class on success. NULL otherwise.
+ */
+typedef RpPrtStdParticleClass *
+ (*RpPrtStdPClassSetupCallBack)
+ (RpPrtStdParticleClass *pClass);
+
+/************************************************************************
+ *
+ *
+ *
+ ************************************************************************/
+
+typedef struct RpPrtStdPropertyTable RpPrtStdPropertyTable;
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdPropertyTable
+ * A structure representing properties's data present in an emitter or
+ * particle.
+ * An emitter, or particle, are treated as a single block of memory. The
+ * property table is used to describe the data presents in the memory block.
+ * It stores the property's id, offset entry from the start of the memory
+ * block and size in bytes.
+ */
+struct RpPrtStdPropertyTable
+{
+ RwUInt32 *propPtr; /**< Internal usage */
+ RpPrtStdPropertyTable *next; /**< Internal usage */
+
+ RwInt32 id; /**< Property table's id */
+ RwInt32 refCount; /**< Reference count. Internal usage */
+
+ RwInt32 numProp; /**< Number of properties in the table */
+ RwInt32 maxProp; /**< Internal usage */
+ RwInt32 *propID; /**< Array of properties's id */
+ RwInt32 *propOffset; /**< Array of properties's offset */
+ RwInt32 *propSize; /**< Array of properties's size */
+ RwInt32 *propSizeUA; /**< Internal usage */
+};
+
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdEmitterClass
+ * A structure representing the collection of data and callbacks for an emitter. An emitter
+ * class is used to create emitters that share the same properties and callback functions.
+ * Once created, an emitter class cannot be altered. An emitter class should also not be
+ * destroyed if emitters of the class are still in use.
+ */
+struct RpPrtStdEmitterClass
+{
+ RpPrtStdEmitterClass *next; /**< Internal usage */
+
+ RwInt32 id; /**< Emitter class's id */
+ RwInt32 refCount; /**< Reference count. Internal usage */
+
+ RwInt32 objSize; /**< Size of the emitter */
+ RpPrtStdPropertyTable *propTab; /**< Reference to a table of emitter properties */
+
+ RwInt32 numCallback; /**< Number of callback arrays */
+ RpPrtStdEmitterCallBackArray *callback; /**< Array of emitter callback functions */
+};
+
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdParticleClass
+ * A structure representing the collection of data and callbacks for a particle. A particle
+ * class is used to create particle that share the same properties and callback functions.
+ * Once created, a particle class cannot be altered. A particle class should also not be
+ * destroyed if particles of the class are still in use.
+ */
+struct RpPrtStdParticleClass
+{
+ RpPrtStdParticleClass *next; /**< Internal usage */
+
+ RwInt32 id; /**< Particle class's id */
+ RwInt32 refCount; /**< Reference count. Internal usage */
+
+ RwInt32 objSize; /**< Size of a particle */
+ RpPrtStdPropertyTable *propTab; /**< Reference to a table of particle properties */
+
+ RwInt32 numCallback; /**< Number of callback sets */
+ RpPrtStdParticleCallBackArray *callback; /**< Array of particle batch callback functions */
+};
+
+
+/************************************************************************
+ *
+ *
+ *
+ ************************************************************************/
+
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdParticleBatch
+ * A structure repsenting a group of particles. For efficient, particles are stored
+ * in batches rather than individually. All live particles are stored at the head
+ * of batch with no gaps of dead particles. A counter is used to record the number of
+ * live particles in the batch. Once a batch has 0 live particles, it will removed
+ * from the emitter's active particle list to the inactive list.
+ * The first particle of the batch is given by an offset from the start of the
+ * particle batch.
+ */
+struct RpPrtStdParticleBatch
+{
+ RpPrtStdParticleBatch *next; /**< Pointer to the next particle batch */
+
+ RpPrtStdParticleClass *prtClass; /**< Pointer to the particle's class */
+
+ RwInt32 numPrt; /**< Number of particles in the batch */
+ RwInt32 maxPrt; /**< Maxium number of particles in batch */
+ RwInt32 newPrt; /**< Start of newly emitted particles in the batch */
+
+ RwInt32 offset; /**< Offset to the first particle, from the start of the
+ * particle batch */
+};
+
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdEmitter
+ * A structure repsenting the mandatory data set for any emitter. Each emitter contains information of
+ * itself and its particles, via the emitter class and particle class respectively. It also contains the
+ * list of particles, in batches, it had emitted.
+ * Optional data are stored immediately after the mandatory set. The contents of the optional data are
+ * described in the emitter class's property table. The offset from the property table are from the start
+ * of the emitter.
+ *
+ * The type of particles emitted are given by the particle class. Each emitter may have only emitter class
+ * and particle class and these should not be changed during the lifetime of the emitter and its particles.
+ * The emitter maintains two lists of particle batches, an acitive list, contain still active particles,
+ * and an inactive list. The maximum number of particles in each batch is given by the prtBatchMaxPrt field.
+ */
+struct RpPrtStdEmitter
+{
+ RpPrtStdEmitter *next; /**< Pointer to the next emitter */
+
+ RwUInt32 flag; /**< Emitter's property flag */
+
+ RpAtomic *atomic; /**< Pointer to emitter's parent atomic */
+
+ RpPrtStdEmitterClass *emtClass; /**< Pointer the emitter's class */
+
+ RwInt32 prtActive; /**< Number of particles emitted */
+ RwInt32 prtBatchMaxPrt; /**< Maximum number of particles per batch */
+ RpPrtStdParticleClass *prtClass; /**< Pointer to the particle's class */
+
+ RpPrtStdParticleBatch *inactiveBatch, /**< Circular linked list of inactive particle batches */
+ *activeBatch; /**< Circular linked list of active particle batches */
+
+ RwReal boundingSphere; /**< Emitter's bounding sphere. */
+};
+
+
+
+/************************************************************************
+ *
+ *
+ *
+ ************************************************************************/
+
+#define rpPRTSTDPROPERTYCODEEMITTER 0
+#define rpPRTSTDPROPERTYCODEEMITTERSTANDARD 1
+#define rpPRTSTDPROPERTYCODEEMITTERPRTCOLOR 2
+#define rpPRTSTDPROPERTYCODEEMITTERPRTTEXCOORDS 3
+#define rpPRTSTDPROPERTYCODEEMITTERPRTSIZE 5
+#define rpPRTSTDPROPERTYCODEEMITTERPTANK 6
+#define rpPRTSTDPROPERTYCODEEMITTERPRTVELOCITY 7
+#define rpPRTSTDPROPERTYCODEEMITTERPRTMATRIX 8
+
+#define rpPRTSTDEMITTERPROPERTYCOUNT 9
+
+#define rpPRTSTDEMITTERDATAFLAGSTANDARD 0x00000001
+#define rpPRTSTDEMITTERDATAFLAGPRTCOLOR 0x00000002
+#define rpPRTSTDEMITTERDATAFLAGPRTTEXCOORDS 0x00000004
+#define rpPRTSTDEMITTERDATAFLAGPRTSIZE 0x00000010
+#define rpPRTSTDEMITTERDATAFLAGPTANK 0x00000020
+#define rpPRTSTDEMITTERDATAFLAGPRTMATRIX 0x00000040
+
+
+typedef struct RpPrtStdEmitterStandard RpPrtStdEmitterStandard;
+
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdEmitterStandard
+ * A structure represent the set of properties for a basic emitter. The structure is stored as
+ * a single optional data in the emitter property table.
+ *
+ * The basic emitter uses a 'time' variable to control particle emissions. A large time gap between
+ * emission can give pulse effects where as a small time gap produces a streaming effects. Particles
+ * can be emitted from a single point, line, area or a volume.
+ *
+ * Particles emitted from an emitter are of the same type. An emitter cannot emit different types of
+ * particles. Once an emitter has reached its maximum number of particles, no further particles are
+ * emitted until some of the existing particles have died.
+ *
+ * Most properties have a bias value to vary the property's value. This uses the seed field
+ * to give a degreee of randomness.
+ */
+struct RpPrtStdEmitterStandard
+{
+ RwInt32 seed; /**< Seed for random number generator */
+
+ RwInt32 maxPrt; /**< Maximum number of active particles */
+
+ RwReal currTime, /**< Current timestamp for emitter */
+ prevTime; /**< Previous timestamp for emitter */
+ RwV3d force; /**< External force applied to particles */
+
+ RwV3d emtPos, /**< Emitter position */
+ emtSize; /**< Emitter size. This is the volume where new particles
+ * are emitted */
+ RwReal emtEmitGap, /**< Time gap between emission */
+ emtEmitGapBias, /**< Time gap bias */
+ emtPrevEmitTime, /**< Previous particle emission time */
+ emtEmitTime; /**< Next particle emission time */
+ RwInt32 emtPrtEmit, /**< Number of particle emit per emission */
+ emtPrtEmitBias; /**< Particle emission bias */
+
+ RwReal prtInitVel, /**< Particle's initial speed */
+ prtInitVelBias; /**< Particle's initial speed bias */
+ RwReal prtLife, /**< Particle's duration */
+ prtLifeBias; /**< Particle's duration bias */
+
+ RwV3d prtInitDir, /**< Particle's initial direction */
+ prtInitDirBias; /**< particle's initial direction bias */
+
+ RwV2d prtSize; /**< Particle's size */
+
+ RwRGBA prtColor; /**< Particle's color */
+
+ RwTexCoords prtUV[4]; /**< Particle's texture coordindates */
+ RwTexture *texture; /**< Particle's texture */
+
+ RwMatrix *ltm; /**< LTM to transform particle coordinates from local space
+ * to world space */
+};
+
+typedef struct RpPrtStdEmitterPrtColor RpPrtStdEmitterPrtColor;
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdEmitterPrtColor
+ * An optional structure to represent the change in color of a particle from birth to death.
+ * The particles will start with the prtStartCol and ends with endPrtColor. The particle's
+ * life is used to interpolate the colors.
+ *
+ * If this structure is not present, then the particles will have a constant color.
+ */
+struct RpPrtStdEmitterPrtColor
+{
+ RwRGBAReal prtStartCol, /**< Particle start color */
+ prtStartColBias; /**< Particle start color bias */
+ RwRGBAReal prtEndCol, /**< Particle end color */
+ prtEndColBias; /**< Particle end color bias */
+};
+
+typedef struct RpPrtStdEmitterPrtTexCoords RpPrtStdEmitterPrtTexCoords;
+
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdEmitterPrtTexCoords
+ * An optional structure to represent the change in texcoords of a particle from birth to death.
+ * The particles will start with prtStartUV0 and prtStartUV1 and ends with endPrtEndUV0 and endPrtEndUV1.
+ * The particle's life is used to interpolate the texcoords.
+ *
+ * A particle can have two texcoords representing the top left and bottom right respectively. By varying
+ * the texcoords can give an animated texture effect on a particle.
+ *
+ * If this structure is not present, then the particles will have a constant texcoords.
+ */
+struct RpPrtStdEmitterPrtTexCoords
+{
+ RwTexCoords prtStartUV0, /**< Particle start top left texcoords */
+ prtStartUV0Bias; /**< Particle start top left texcoords bias */
+ RwTexCoords prtEndUV0, /**< Particle end top left texcoords */
+ prtEndUV0Bias; /**< Particle end top left texcoords bias */
+ RwTexCoords prtStartUV1, /**< Particle start bottom right texcoords */
+ prtStartUV1Bias; /**< Particle start botton right texcoords bias */
+ RwTexCoords prtEndUV1, /**< Particle end bottom right texcoords */
+ prtEndUV1Bias; /**< Particle end bottom right texcoords bias */
+};
+
+typedef struct RpPrtStdEmitterPrtSize RpPrtStdEmitterPrtSize;
+
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdEmitterPrtSize
+ * An optional structure to represent the change in size of a particle from birth to death.
+ * The particles will start with prtStartSize and ends with prtEndSize. The particle's life
+ * is used to interpolate the size.
+ *
+ * If this structure is not present, then the particles will have a constant size.
+ */
+struct RpPrtStdEmitterPrtSize
+{
+ RwV2d prtStartSize, /**< Particle start size */
+ prtStartSizeBias; /**< Particle start size bias */
+ RwV2d prtEndSize, /**< Particle end size */
+ prtEndSizeBias; /**< Particle end size bias */
+};
+
+
+/**
+ * \ingroup rpprtstd
+ * A set of flag settings for use in the \ref RpPrtStdEmitterPrtMatrix flag
+ */
+enum RpPrtStdEmitterPrtMatrixFlags
+{
+ rpPRTSTDEMITTERPRTMTXFLAGSCNSMTX = 0x00000001, /**< Apply the prtCnsMtx matrix to
+ * each particle if set */
+ RPPRTSTDEMITTERPRTMTXFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+typedef enum RpPrtStdEmitterPrtMatrixFlags RpPrtStdEmitterPrtMatrixFlags;
+
+typedef struct RpPrtStdEmitterPrtMatrix RWALIGN(RpPrtStdEmitterPrtMatrix, rwMATRIXALIGNMENT);
+
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdEmitterPrtMatrix
+ *
+ * An optional structure to construct a matrix for each particle during emissions. A particle
+ * can be represented as a single matrix. This gives the particles an orientation rather than
+ * just a simple position.
+ *
+ * This allows transformation to be applied to the particles, such as rotation. If
+ * \ref rpPRTSTDEMITTERPRTMTXFLAGSCNSMTX is set in the flag, then the prtCnsMatrix is applied to each
+ * particle during particle update.
+ *
+ * If this structure is not present, then it assumes the particles will have just a position
+ * property.
+ */
+struct RpPrtStdEmitterPrtMatrix
+{
+ RwMatrix prtCnsMtx; /**< Transformation matrix to be applied to each particle */
+
+ RwV3d prtPosMtxAt, /**< Particle initial look at vector */
+ prtPosMtxAtBias; /**< Particle initial look at vector bias */
+ RwV3d prtPosMtxUp, /**< Particle initial up vector. */
+ prtPosMtxUpBias; /**< Particle initial up vector bias */
+
+ RwInt32 flags; /**< Particle matrix flag. See \ref RpPrtStdEmitterPrtMatrixFlags */
+};
+
+/************************************************************************
+ *
+ *
+ *
+ ************************************************************************/
+
+
+
+enum RpPrtStdPTankPropertyCode
+{
+ rpPRTSTDPTANKPROPPARTICLESMAX = 0,
+ rpPRTSTDPTANKPROPDATAFLAGS,
+ rpPRTSTDPTANKPROPPLATFORMFLAGS,
+ rpPRTSTDPTANKPROPPTANK,
+ rpPRTSTDPTANKPROPFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+typedef enum RpPrtStdPTankPropertyCode RpPrtStdPTankPropertyCode;
+
+typedef struct RpPrtStdEmitterPTank RpPrtStdEmitterPTank;
+
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdEmitterPTank
+ *
+ * A structure for storing the data required to create a RpPTank for use
+ * with the emitter. The structure allows the user to create a RpPTank
+ * manually.
+ */
+struct RpPrtStdEmitterPTank
+{
+ RwUInt32 dataFlags, /**< Data flag used in RpPTank creation. See
+ * \ref RpPTankAtomicCreate */
+ platFlags, /**< Platform flag used in RpPTank creation. See
+ * \ref RpPTankAtomicCreate */
+ numPrt, /**< An integer representing the current number of active
+ * particles */
+ maxPrt, /**< An integer representing the maxiumum number of particles
+ * stored in the RpPTank */
+ updateFlags, /**< A flag representing the properties to be updated by
+ * the particle emiiter during update. A user may select to
+ * update some properties manually by unsetting the relevant
+ * bits in the flag.
+ * The flag settings are the same as \ref RpPTankDataFlags */
+ emitFlags; /**< A flag representing the properties to be initialised
+ * by the particle emitter during particles emission. A user
+ * may select to initialise some properties manually by
+ * unsetting the relevant bits in the flag.
+ * The flag settings are the same as \ref RpPTankDataFlags */
+ RpAtomic *pTank; /**< Pointer to the RpPTank */
+ RwChar **dataInPtrs, /**< Internal usage */
+ **dataOutPtrs; /**< Internal usage */
+ RwInt32 *dataStride; /**< Internal usage */
+ RwUInt32 strSrcBlend; /**< Internal usage */
+ RwUInt32 strDstBlend; /**< Internal usage */
+ RwBool strVtxABlend; /**< Internal usage */
+};
+
+/************************************************************************
+ *
+ *
+ *
+ ************************************************************************/
+
+#define rpPRTSTDPROPERTYCODEPARTICLESTANDARD 0
+#define rpPRTSTDPROPERTYCODEPARTICLEPOSITION 1
+#define rpPRTSTDPROPERTYCODEPARTICLECOLOR 2
+#define rpPRTSTDPROPERTYCODEPARTICLETEXCOORDS 3
+#define rpPRTSTDPROPERTYCODEPARTICLESIZE 5
+#define rpPRTSTDPROPERTYCODEPARTICLEVELOCITY 6
+#define rpPRTSTDPROPERTYCODEPARTICLEMATRIX 7
+
+#define rpPRTSTDPARTICLEPROPERTYCOUNT 8
+
+#define rpPRTSTDPARTICLEDATAFLAGSTANDARD 0x00000001
+#define rpPRTSTDPARTICLEDATAFLAGPOSITION 0x00000002
+#define rpPRTSTDPARTICLEDATAFLAGCOLOR 0x00000004
+#define rpPRTSTDPARTICLEDATAFLAGTEXCOORDS 0x00000008
+#define rpPRTSTDPARTICLEDATAFLAGSIZE 0x00000020
+#define rpPRTSTDPARTICLEDATAFLAGVELOCITY 0x00000040
+#define rpPRTSTDPARTICLEDATAFLAGMATRIX 0x00000080
+
+
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdParticleStandard
+ * A structure represent the set of properties for a basic particle. This structure is mandatory
+ * for all particles.
+ * The structure contain the life duration of the particle. The particle will be removed when the current
+ * time is greater than the end time. The particle timer always starts at zero.
+ *
+ * The inverted end time is for interpolating optional particle properties.
+ */
+typedef struct RpPrtStdParticleStandard RpPrtStdParticleStandard;
+struct RpPrtStdParticleStandard
+{
+ RwInt32 flag; /**< Particle's property flag */
+ RwReal currTime, /**< Particle's curr time */
+ endTime, /**< Particle's end time */
+ invEndTime; /**< Particle's inv end for interpolation */
+};
+
+
+typedef struct RpPrtStdParticleColor RpPrtStdParticleColor;
+
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdParticleColor
+ * A structure representing the change in a particle's color during its life time. The structure is optional
+ * and should not be used if particles have a constant color.
+ */
+struct RpPrtStdParticleColor
+{
+ RwRGBAReal startCol, /**< Particle's end size bias */
+ deltaCol; /**< Particle's color rate of change */
+};
+
+typedef struct RpPrtStdParticleTexCoords RpPrtStdParticleTexCoords;
+
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdParticleTexCoords
+ * A structure representing the change in a particle's texcoords during its life time. The structure is optional
+ * and should not be used if particles have a constant texcoords.
+ */
+struct RpPrtStdParticleTexCoords
+{
+ RwTexCoords startUV0, /**< Particle's starting top left texcoords */
+ startUV1; /**< Particle's starting bottom right texcoords */
+ RwTexCoords deltaUV0, /**< Particle's top left texcoords rate of change */
+ deltaUV1; /**< Particle's bottom right texcoords rate of change */
+};
+
+typedef struct RpPrtStdParticleSize RpPrtStdParticleSize;
+
+/**
+ * \ingroup rpprtstd
+ * \struct RpPrtStdParticleSize
+ * A structure representing the change in a particle's size during its life time. The structure is optional
+ * and should not be used if particles have a constant size.
+ */
+struct RpPrtStdParticleSize
+{
+ RwV2d startSize, /**< Particle's starting size */
+ deltaSize; /**< Particle's size rate of change */
+ RwV2d currSize, /**< Particle's current size. Internal use only */
+ invCurrSize; /**< Particle's inverse current size. Internal use only */
+};
+
+/************************************************************************
+ *
+ *
+ *
+ ************************************************************************/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/************************************************************************/
+
+extern RwBool
+RpPrtStdPluginAttach( void );
+
+/************************************************************************/
+
+extern RwBool
+RpAtomicIsParticleEmitter(RpAtomic *atomic);
+
+extern RpAtomic *
+RpPrtStdAtomicCreate(RpPrtStdEmitterClass *eClass, void *data);
+
+extern RpAtomic *
+RpPrtStdAtomicUpdate(RpAtomic *atomic, void *data);
+
+extern RpAtomic *
+RpPrtStdAtomicSetEmitter(RpAtomic *atomic, RpPrtStdEmitter *emt);
+
+extern RpPrtStdEmitter *
+RpPrtStdAtomicGetEmitter(RpAtomic *atomic);
+
+extern RpAtomic *
+RpPrtStdAtomicForAllEmitter(RpAtomic *atomic,
+ RpPrtStdEmitterCallBack callback,
+ void *data);
+
+extern RpAtomic *
+RpPrtStdAtomicAddEmitter(RpAtomic *,
+ RpPrtStdEmitter *emt);
+
+
+/************************************************************************/
+
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterCreate(RpPrtStdEmitterClass *eClass);
+
+extern RwBool
+RpPrtStdEmitterDestroy(RpPrtStdEmitter *emt);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterClone(RpPrtStdEmitter *emt);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterForAllParticleBatch(RpPrtStdEmitter *emt,
+ RpPrtStdParticleCallBack callback,
+ void * data);
+
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterAddEmitter(RpPrtStdEmitter *emtHead,
+ RpPrtStdEmitter *emt);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterLinkPTank(RpPrtStdEmitter *emt,RpAtomic *ptank);
+
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterDestroyParticleBatch(RpPrtStdEmitter *emt);
+
+extern RpPrtStdParticleBatch *
+RpPrtStdEmitterNewParticleBatch(RpPrtStdEmitter *emt);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterAddParticleBatch(RpPrtStdEmitter *emt,
+ RpPrtStdParticleBatch *prtBatch);
+
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterSetPClass(RpPrtStdEmitter *emt,
+ RpPrtStdParticleClass *pClass,
+ RwInt32 maxPrt);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterGetPClass(RpPrtStdEmitter *emt,
+ RpPrtStdParticleClass **pClass,
+ RwInt32 *maxPrt);
+
+
+/************************************************************************/
+
+extern RpPrtStdParticleBatch *
+RpPrtStdParticleBatchCreate(RpPrtStdParticleClass *pClass, RwInt32 maxPrt);
+
+extern RwBool
+RpPrtStdParticleBatchDestroy(RpPrtStdParticleBatch *prtBatch);
+
+extern RpPrtStdParticleBatch *
+RpPrtStdParticleBatchAddBatch(RpPrtStdParticleBatch *prtBatchHead,
+ RpPrtStdParticleBatch *prtBatch);
+
+/************************************************************************/
+
+extern RpPrtStdPropertyTable *
+RpPrtStdPropTabCreate(RwInt32 numProp,
+ RwInt32 *propID, RwInt32 *propStride);
+
+extern RwBool
+RpPrtStdPropTabDestroy(RpPrtStdPropertyTable *propTab);
+
+
+extern RpPrtStdPropertyTable *
+RpPrtStdPropTabGetProperties(RpPrtStdPropertyTable *propTab,
+ RwInt32 *numProp,
+ RwInt32 **propID,
+ RwInt32 **propOffset,
+ RwInt32 **propSize);
+
+extern RwInt32
+RpPrtStdPropTabGetPropOffset(RpPrtStdPropertyTable *propTab,
+ RwInt32 propID);
+
+extern RwInt32
+RpPrtStdPropTabGetPropIndex(RpPrtStdPropertyTable *propTab,
+ RwInt32 propID);
+
+
+extern RpPrtStdPropertyTable *
+RpPrtStdPropTabGet(RwInt32 id);
+
+extern RpPrtStdPropertyTable *
+RpPrtStdPropTabStreamRead(RwStream *stream);
+
+extern RpPrtStdPropertyTable *
+RpPrtStdPropTabStreamWrite(RpPrtStdPropertyTable *eClass,
+ RwStream *stream);
+
+extern RwInt32
+RpPrtStdPropTabStreamGetSize(RpPrtStdPropertyTable *eClass);
+/************************************************************************/
+
+extern RwBool
+RpPrtStdEClassDestroy(RpPrtStdEmitterClass *eClass);
+
+extern RpPrtStdEmitterClass *
+RpPrtStdEClassCreate( void );
+
+extern RpPrtStdEmitterClass *
+RpPrtStdEClassSetCallBack(RpPrtStdEmitterClass *eClass,
+ RwInt32 numCallback,
+ RpPrtStdEmitterCallBackArray *emtCB);
+
+extern RpPrtStdEmitterClass *
+RpPrtStdEClassGetCallBack(RpPrtStdEmitterClass *eClass,
+ RwInt32 *numCallback,
+ RpPrtStdEmitterCallBackArray **emtCB);
+
+extern RpPrtStdEmitterClass *
+RpPrtStdEClassSetPropTab(RpPrtStdEmitterClass *eClass,
+ RpPrtStdPropertyTable *propTab);
+
+extern RpPrtStdEmitterClass *
+RpPrtStdEClassGetPropTab(RpPrtStdEmitterClass *eClass,
+ RpPrtStdPropertyTable **propTab);
+
+
+extern RpPrtStdEmitterClass *
+RpPrtStdEClassGet(RwInt32 id);
+
+extern RpPrtStdEmitterClass *
+RpPrtStdEClassStreamRead(RwStream *stream);
+
+extern RpPrtStdEmitterClass *
+RpPrtStdEClassStreamWrite(RpPrtStdEmitterClass *eClass,
+ RwStream *stream);
+
+extern RwInt32
+RpPrtStdEClassStreamGetSize(RpPrtStdEmitterClass *eClass);
+
+/************************************************************************/
+
+extern RpPrtStdParticleClass *
+RpPrtStdPClassCreate( void );
+
+extern RwBool
+RpPrtStdPClassDestroy(RpPrtStdParticleClass *pClass);
+
+extern RpPrtStdParticleClass *
+RpPrtStdPClassSetCallBack(RpPrtStdParticleClass *pClass,
+ RwInt32 numCallback,
+ RpPrtStdParticleCallBackArray *prtCB);
+
+extern RpPrtStdParticleClass *
+RpPrtStdPClassGetCallBack(RpPrtStdParticleClass *pClass,
+ RwInt32 *numCallback,
+ RpPrtStdParticleCallBackArray **prtCB);
+
+extern RpPrtStdParticleClass *
+RpPrtStdPClassSetPropTab(RpPrtStdParticleClass *pClass,
+ RpPrtStdPropertyTable *propTab);
+
+extern RpPrtStdParticleClass *
+RpPrtStdPClassGetPropTab(RpPrtStdParticleClass *pClass,
+ RpPrtStdPropertyTable **propTab);
+
+extern RpPrtStdParticleClass *
+RpPrtStdPClassGet(RwInt32 id);
+
+extern RpPrtStdParticleClass *
+RpPrtStdPClassStreamRead(RwStream *stream);
+
+extern RpPrtStdParticleClass *
+RpPrtStdPClassStreamWrite(RpPrtStdParticleClass *pClass,
+ RwStream *stream);
+
+extern RwInt32
+RpPrtStdPClassStreamGetSize(RpPrtStdParticleClass *pClass);
+
+/************************************************************************/
+
+extern RwBool
+RpPrtStdSetEClassSetupCallBack(RpPrtStdEClassSetupCallBack emtCB);
+
+extern RwBool
+RpPrtStdGetEClassSetupCallBack(RpPrtStdEClassSetupCallBack *emtCB);
+
+extern RwBool
+RpPrtStdSetPClassSetupCallBack(RpPrtStdPClassSetupCallBack prtCB);
+
+extern RwBool
+RpPrtStdGetPClassSetupCallBack(RpPrtStdPClassSetupCallBack *prtCB);
+
+/************************************************************************/
+
+
+extern RwStream *
+RpPrtStdGlobalDataStreamRead(RwStream *stream);
+
+extern RwStream *
+RpPrtStdGlobalDataStreamWrite(RwStream *stream);
+
+extern RwInt32
+RpPrtStdGlobalDataStreamGetSize( void );
+
+extern void
+RpPrtStdGlobalDataSetStreamEmbedded( RwBool embedded );
+
+extern RwBool
+RpPrtStdGlobalDataGetStreamEmbedded( void );
+
+/************************************************************************/
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterDefaultCB(RpAtomic * atomic,
+ RpPrtStdEmitter *prtEmt, void * data);
+
+
+extern RpPrtStdParticleBatch *
+RpPrtStdParticleDefaultCB(RpPrtStdEmitter * prtEmt,
+ RpPrtStdParticleBatch *prtBatch, void * data);
+
+/************************************************************************/
+
+extern RpPrtStdParticleBatch *
+RpPrtStdParticleStdUpdateCB(RpPrtStdEmitter *emt,
+ RpPrtStdParticleBatch *prtBatch, void *data);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterStdEmitCB(RpAtomic *atomic,
+ RpPrtStdEmitter *emt, void *data);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterStdCloneCB(RpAtomic *atomic,
+ RpPrtStdEmitter *emt, void *data);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterStdCreateCB(RpAtomic *atomic,
+ RpPrtStdEmitter *emt, void *data);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterStdDestroyCB(RpAtomic *atomic,
+ RpPrtStdEmitter *emt, void *data);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterStdBeginUpdateCB(RpAtomic *atomic,
+ RpPrtStdEmitter *emt, void *data);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterStdEndUpdateCB(RpAtomic *atomic,
+ RpPrtStdEmitter *emt, void *data);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterStdRenderCB(RpAtomic *atomic,
+ RpPrtStdEmitter *emt, void *data);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterStdStreamReadCB(RpAtomic *atomic,
+ RpPrtStdEmitter *emt, void *data);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterStdStreamWriteCB(RpAtomic *atomic,
+ RpPrtStdEmitter *emt, void *data);
+
+extern RpPrtStdEmitter *
+RpPrtStdEmitterStdStreamGetSizeCB(RpAtomic *atomic,
+ RpPrtStdEmitter *emt, void *data);
+
+
+
+extern RpPrtStdEmitterClass *
+RpPrtStdEClassStdCreate( RwInt32 dataFlag );
+
+extern RwInt32
+RpPrtStdEClassStdCreateID( RwInt32 dataFlag );
+
+extern RpPrtStdParticleClass *
+RpPrtStdPClassStdCreate( RwInt32 dataFlag );
+
+extern RwInt32
+RpPrtStdPClassStdCreateID( RwInt32 dataFlag );
+
+extern RpPrtStdEmitterClass *
+RpPrtStdEClassStdSetupCB(RpPrtStdEmitterClass *eClass);
+
+extern RpPrtStdParticleClass *
+RpPrtStdPClassStdSetupCB(RpPrtStdParticleClass *pClass);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/*---- end: ./prtstd.h----*/
+
+/*---- start: c:/daily/rwsdk/plugin/prtstd/d3d8/prtstdplatform.h----*/
+/*---- end: c:/daily/rwsdk/plugin/prtstd/d3d8/prtstdplatform.h----*/
+
+#endif /* RPPRTSTD_H */
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpprtstd.rpe b/sdk/rwsdk/include/d3d8/rpprtstd.rpe
new file mode 100644
index 00000000..d628c6c0
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpprtstd.rpe
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionPrtStandard
+{
+
+
+
+ e_rwdb_CriterionPrtStandardLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionPrtStandard e_rwdb_CriterionPrtStandard;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpptank.h b/sdk/rwsdk/include/d3d8/rpptank.h
new file mode 100644
index 00000000..d4c1116d
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpptank.h
@@ -0,0 +1,828 @@
+
+#ifndef RPPTANK_H
+#define RPPTANK_H
+
+/*===========================================================================*
+ *--- Include files ---------------------------------------------------------*
+ *===========================================================================*/
+
+#include "rwcore.h"
+#include "rpworld.h"
+
+/*---- start: ./ptank.h----*/
+
+/**
+ * \defgroup rpptank RpPTank
+ * \ingroup particles
+ *
+ * PTank Plugin for RenderWare.
+ */
+
+/*--- Include files ---*/
+
+#include <string.h>
+
+#include "rwcore.h"
+
+#include "rpptank.rpe" /* automatically generated header file */
+
+/******************************************************************************
+ * Global Types
+ */
+
+/**
+ * \ingroup rpptank
+ * Passed to \ref RpPTankAtomicCreate, these flags specify
+ * the type and properties held by the particles.
+ * Some flags are mutually exclusive and should not be mixed.
+ * The debug version of the library will assert and signal these problems.
+ */
+enum RpPTankDataFlags
+{
+ rpPTANKDFLAGNONE = ((int)0x00000000),
+ rpPTANKDFLAGPOSITION = ((int)0x00000001), /**<Uses a position per particle*/
+ rpPTANKDFLAGCOLOR = ((int)0x00000002), /**<Uses a color per particle*/
+ rpPTANKDFLAGSIZE = ((int)0x00000004), /**<Uses a size per particle*/
+ rpPTANKDFLAGMATRIX = ((int)0x00000008), /**<Uses a matrix per particle*/
+ rpPTANKDFLAGNORMAL = ((int)0x00000010), /**<Uses a normal per particle*/
+ rpPTANKDFLAG2DROTATE = ((int)0x00000020), /**<Uses a 2D rotation per particle*/
+ rpPTANKDFLAGVTXCOLOR = ((int)0x00000040), /**<Uses a color per Billboard vertex*/
+ rpPTANKDFLAGVTX2TEXCOORDS = ((int)0x00000080), /**<Uses Top-Left and Bottom-Right Texture coordinates*/
+ rpPTANKDFLAGVTX4TEXCOORDS = ((int)0x00000100), /**<Uses a texture UV per vertex*/
+/* free = ((int)0x00000200), */
+/* free = ((int)0x00000400), */
+/* free = ((int)0x00000800), */
+/* free = ((int)0x00001000), */
+/* free = ((int)0x00002000), */
+/* free = ((int)0x00004000), */
+ rpPTANKDFLAGCNSMATRIX = ((int)0x00008000), /**<Uses a constant matrix*/
+ rpPTANKDFLAGCNSNORMAL = ((int)0x00010000), /**<Uses a constant normal*/
+ rpPTANKDFLAGCNS2DROTATE = ((int)0x00020000), /**<Uses a constant 2D rotation*/
+ rpPTANKDFLAGCNSVTXCOLOR = ((int)0x00040000), /**<Uses a constant color per Billboard vertex*/
+ rpPTANKDFLAGCNSVTX2TEXCOORDS = ((int)0x00080000), /**<Uses constant Top-Left and Bottom-Right Texture coordinates*/
+ rpPTANKDFLAGCNSVTX4TEXCOORDS = ((int)0x00100000), /**<Uses a constant texture UV per vertex*/
+/* free = ((int)0x00200000), */
+/* free = ((int)0x00400000), */
+/* free = ((int)0x00800000), */
+ rpPTANKDFLAGUSECENTER = ((int)0x01000000), /**<The position of the particles are shifted*/
+/* free = ((int)0x04000000), */
+/* free = ((int)0x08000000), */
+ rpPTANKDFLAGARRAY = ((int)0x10000000), /**<Data is organized in an array */
+ rpPTANKDFLAGSTRUCTURE = ((int)0x20000000), /**<Data is organized in a structure */
+
+ RPPTANKDATAFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpPTankDataFlags RpPTankDataFlags;
+
+#define rpPTANKDFLAGTHINPARTICLES (rpPTANKDFLAGPOSITION)
+#define rpPTANKDFLAGFATPARTICLES ( rpPTANKDFLAGPOSITION | rpPTANKDFLAGSIZE \
+ | rpPTANKDFLAG2DROTATE | rpPTANKDFLAGVTXCOLOR \
+ | rpPTANKDFLAGVTX4TEXCOORDS)
+
+
+/**
+ * \ingroup rpptank
+ * Passed to \ref RpPTankAtomicLock, these flags specify
+ * the data accessed.
+ * those flags are mutually exclusive and should not be mixed.
+ */
+enum RpPTankDataLockFlags
+{
+ rpPTANKLFLAGNONE = ((int)0x00000000),
+ rpPTANKLFLAGPOSITION = ((int)0x00000001), /**<Access the positions buffer*/
+ rpPTANKLFLAGCOLOR = ((int)0x00000002), /**<Access the colors buffer*/
+ rpPTANKLFLAGSIZE = ((int)0x00000004), /**<Access the sizes buffer*/
+ rpPTANKLFLAGMATRIX = ((int)0x00000008), /**<Access the matrixes buffer*/
+ rpPTANKLFLAGNORMAL = ((int)0x00000010), /**<Access the normals buffer*/
+ rpPTANKLFLAG2DROTATE = ((int)0x00000020), /**<Access the 2D rotations buffer*/
+ rpPTANKLFLAGVTXCOLOR = ((int)0x00000040), /**<Access the colors buffer (when using a color per vertex) */
+ rpPTANKLFLAGVTX2TEXCOORDS = ((int)0x00000080), /**<Access the Top-Left and Bottom-Right Texture coordinates buffer*/
+ rpPTANKLFLAGVTX4TEXCOORDS = ((int)0x00000100), /**<Access the texture UVs Buffer (when using a color per vertex)*/
+
+ RPPTANKLOCKFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpPTankDataLockFlags RpPTankDataLockFlags;
+
+
+#if (!defined(DOXYGEN))
+
+/**
+ * \ingroup rpptank
+ * RpPTankInstanceFlags
+ */
+enum RpPTankInstanceFlags
+{
+ rpPTANKIFLAGNONE = ((int)0x00000000),
+ rpPTANKIFLAGPOSITION = ((int)0x00000001), /**<Particles position changed*/
+ rpPTANKIFLAGCOLOR = ((int)0x00000002), /**<Particles color changed*/
+ rpPTANKIFLAGSIZE = ((int)0x00000004), /**<Particles size changed*/
+ rpPTANKIFLAGMATRIX = ((int)0x00000008), /**<Particles matrix changed*/
+ rpPTANKIFLAGNORMAL = ((int)0x00000010), /**<Particles normal changed*/
+ rpPTANKIFLAG2DROTATE = ((int)0x00000020), /**<Particles 2D rotation changed*/
+ rpPTANKIFLAGVTXCOLOR = ((int)0x00000040), /**<Vertex color changed*/
+ rpPTANKIFLAGVTX2TEXCOORDS = ((int)0x00000080), /**<Vertex 2 Texture coordinates changed*/
+ rpPTANKIFLAGVTX4TEXCOORDS = ((int)0x00000100), /**<Vertex 4 Texture coordinates changed*/
+/* free = ((int)0x00000200), */
+/* free = ((int)0x00000400), */
+/* free = ((int)0x00000800), */
+/* free = ((int)0x00001000), */
+ rpPTANKIFLAGCNSCOLOR = ((int)0x00002000), /**<Constant color changed*/
+ rpPTANKIFLAGCNSSIZE = ((int)0x00004000), /**<Constant size changed*/
+ rpPTANKIFLAGCNSMATRIX = ((int)0x00008000), /**<Constant matrix changed*/
+ rpPTANKIFLAGCNSNORMAL = ((int)0x00010000), /**<Constant normal changed*/
+ rpPTANKIFLAGCNS2DROTATE = ((int)0x00020000), /**<Constant 2D rotation changed*/
+ rpPTANKIFLAGCNSVTXCOLOR = ((int)0x00040000), /**<Constant vertex color changed*/
+ rpPTANKIFLAGCNSVTX2TEXCOORDS = ((int)0x00080000), /**<Constant vertex 2 Texture coordinates changed*/
+ rpPTANKIFLAGCNSVTX4TEXCOORDS = ((int)0x00100000), /**<Constant vertex 4 Texture coordinates changed*/
+/* free = ((int)0x00200000), */
+/* free = ((int)0x00400000), */
+ rpPTANKIFLAGACTNUMCHG = ((int)0x00800000), /**<Number of active particle changed*/
+ rpPTANKIFLAGCENTER = ((int)0x01000000), /**<Center position changed*/
+/* free = ((int)0x04000000), */
+/* free = ((int)0x08000000), */
+ rpPTANKIFLAGALPHABLENDING = ((int)0x10000000), /**<Internal Use*/
+ rpPTANKIFLAGALL = ((int)0xFFFFFFFF),
+
+ RPPTANKINSTANCEFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+typedef enum RpPTankInstanceFlags RpPTankInstanceFlags;
+
+#endif
+
+/**
+ * \ingroup rpptank
+ * Passed to \ref RpPTankAtomicLock to specify the type of access needed.
+ *
+ * Accessing data using \ref rpPTANKLOCKWRITE will force the PTank object to reinstance
+ * the rendered data. The instantiation of this data takes place at rendering
+ * time and is done once per frame.
+ */
+enum RpPTankLockFlags
+{
+ rpPTANKLOCKWRITE = ((int)0x40000000), /**<Lock data for writing. */
+ rpPTANKLOCKREAD = ((int)0x80000000) /**<Lock data for reading. */
+};
+
+typedef enum RpPTankLockFlags RpPTankLockFlags;
+
+typedef struct RpPTankLockStruct RpPTankLockStruct;
+
+/**
+ * \ingroup rpptank
+ * \struct RpPTankLockStruct
+ * Returned by \ref RpPTankAtomicLock
+ */
+struct RpPTankLockStruct{
+ RwUInt8 *data; /**<Pointer to the locked data. */
+ RwInt32 stride; /**<Stride of the data accessed. */
+};
+
+typedef struct RpPTankFormatDescriptor RpPTankFormatDescriptor;
+
+/**
+ * \ingroup rpptank
+ * \struct RpPTankFormatDescriptor
+ * Returned by \ref RpPTankAtomicGetDataFormat
+ */
+struct RpPTankFormatDescriptor
+{
+ RwInt32 numClusters; /**<Number of clusters */
+ RwInt32 stride; /**<Size of a single structure when using
+ * structure organization, 0 otherwise */
+ RwInt32 dataFlags; /**<flags passed to \ref RpPTankAtomicCreate */
+};
+
+#if (!defined(DOXYGEN))
+
+typedef struct RpPTankData RpPTankData;
+
+struct RpPTankData
+{
+ void *data; /* PI data array
+ * in the A form :
+ * Point to the ptrList table
+ * in the S form :
+ * point to the structure
+ *
+ */
+ RpPTankLockStruct clusters[9];
+
+ void *userData; /* void pointer for platform use */
+
+ RpPTankFormatDescriptor format;
+
+ /* constant values */
+ RwUInt32 srcBlend;
+ RwUInt32 dstBlend;
+ RwBool vertexAlphaBlend;
+
+ RwV2d cCenter;
+ RwV2d cSize;
+ RwReal cRotate;
+ RwRGBA cColor;
+ RwRGBA cVtxColor[4];
+ RwTexCoords cUV[4];
+ RwMatrix cMatrix;
+};
+
+
+
+
+/* data piece size */
+extern const RwInt32 datasize[];
+
+#define RPPTANKSIZEPOSITION 0
+#define RPPTANKSIZEMATRIX 1
+#define RPPTANKSIZENORMAL 2
+#define RPPTANKSIZESIZE 3
+#define RPPTANKSIZECOLOR 4
+#define RPPTANKSIZEVTXCOLOR 5
+#define RPPTANKSIZE2DROTATE 6
+#define RPPTANKSIZEVTX2TEXCOORDS 7
+#define RPPTANKSIZEVTX4TEXCOORDS 8
+
+
+/**
+ * \ingroup rpptank
+ * \ref RpPTankAllocCallBack
+ *
+ * ...
+ */
+typedef void *(* RpPTankAllocCallBack)(RpPTankData *ptankGlobal,
+ RwInt32 maxPCount,
+ RwUInt32 dataFlags,
+ RwUInt32 platFlags);
+
+/**
+ * \ingroup rpptank
+ * \ref RpPTankCreateCallBack
+ *
+ * ...
+ */
+typedef RwBool (* RpPTankCreateCallBack)(RpAtomic *atomic,
+ RpPTankData *ptankGlobal,
+ RwInt32 maxPCount,
+ RwUInt32 dataFlags,
+ RwUInt32 platFlags);
+
+/**
+ * \ingroup rpptank
+ * \ref RpPTankInstanceCallBack
+ * ...
+ */
+typedef RwBool (* RpPTankInstanceCallBack)(RpAtomic *atomic,
+ RpPTankData *ptankGlobal,
+ RwInt32 actPCount,
+ RwUInt32 instFlags);
+
+/**
+ * \ingroup rpptank
+ * \ref RpPTankRenderCallBack
+ * ...
+ */
+typedef RwBool (* RpPTankRenderCallBack)(RpAtomic *atomic,
+ RpPTankData *ptankGlobal,
+ RwInt32 actPCount);
+
+typedef struct RpPTankCallBacks RpPTankCallBacks;
+
+struct RpPTankCallBacks
+{
+ RpPTankAllocCallBack alloc;
+ RpPTankCreateCallBack create;
+ RpPTankInstanceCallBack instance;
+ RpPTankRenderCallBack render;
+};
+
+/* private typedefs */
+typedef struct RpPTANKInstanceSetupData RpPTANKInstanceSetupData;
+
+struct RpPTANKInstanceSetupData
+{
+ RwBool instancePositions;
+ RwBool instanceUVs;
+ RwBool instanceColors;
+ RwBool instanceNormals;
+
+ RpPTankLockStruct positionOut;
+ RpPTankLockStruct UVOut;
+ RpPTankLockStruct colorsOut;
+ RpPTankLockStruct normalsOut;
+
+ RwV3d right;
+ RwV3d up;
+
+};
+
+typedef void (* RpPTankGENInstancePosCallback)(
+ RpPTankLockStruct *dstCluster,
+ RwV3d *right,
+ RwV3d *up,
+ RwInt32 pCount,
+ RpPTankData *ptankGlobal);
+
+typedef void (* RpPTankGENInstanceCallback)(
+ RpPTankLockStruct *dstCluster,
+ RwInt32 pCount,
+ RpPTankData *ptankGlobal);
+
+typedef void (* RpPTankGENInstanceSetupCallback)(
+ RpPTANKInstanceSetupData *data,
+ RpAtomic *atomic,
+ RpPTankData *ptankGlobal,
+ RwInt32 actPCount,
+ RwUInt32 instFlags);
+
+typedef void (* RpPTankGENInstanceEndingCallback)(
+ RpPTANKInstanceSetupData *data,
+ RpAtomic *atomic,
+ RpPTankData *ptankGlobal,
+ RwInt32 actPCount,
+ RwUInt32 instFlags);
+
+typedef struct RpPTankAtomicExtPrv RpPTankAtomicExtPrv;
+
+struct RpPTankAtomicExtPrv
+{
+ RwInt32 maxPCount; /* max number of particles */
+ RwInt32 actPCount; /* number of actives particles */
+
+ RwBool isAStructure; /* is in a structure of array form */
+ void *rawdata; /* unaligned pointer to the PI data */
+
+ /* Rendering callback */
+ RpAtomicCallBackRender defaultRenderCB;
+
+ RpPTankCallBacks ptankCallBacks;
+
+ /* Instancing CallBacks */
+ RpPTankGENInstanceSetupCallback insSetupCB;
+ RpPTankGENInstancePosCallback insPosCB;
+ RpPTankGENInstanceCallback insUVCB;
+ RpPTankGENInstanceCallback insColorsCB;
+ RpPTankGENInstanceCallback insNormalsCB;
+ RpPTankGENInstanceEndingCallback insEndingCB;
+
+ RwUInt32 lockFlags;
+ RwUInt32 instFlags;
+ RwUInt32 platFlags;
+
+ RpPTankData publicData;
+};
+
+/*--- Plugin API Functions ---*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* private globals */
+extern RwInt32 _rpPTankAtomicDataOffset; /* Offset in RpAtomic */
+
+extern RwInt32 _rpPTankGlobalsOffset; /* Offset in RwEngine */
+
+/* Macro tools */
+#define RPATOMICPTANKPLUGINDATA(atomic) \
+ (*RWPLUGINOFFSET(RpPTankAtomicExtPrv *, (atomic), _rpPTankAtomicDataOffset))
+
+#define GLOBALPTANKPLUGINDATA() \
+ (*RWPLUGINOFFSET(void *, RwEngineInstance, _rpPTankGlobalsOffset))
+
+#endif
+
+
+extern RwBool
+RpPTankPluginAttach(void);
+
+
+/*
+ * PTank Management API ******************************************************
+ */
+
+extern RpAtomic *
+RpPTankAtomicCreate(RwInt32 maxParticleNum,
+ RwUInt32 dataFlags,
+ RwUInt32 platFlags);
+
+extern void
+RpPTankAtomicDestroy(RpAtomic *ptank);
+
+extern RwBool
+RpAtomicIsPTank(RpAtomic *atomic);
+
+extern const RpPTankFormatDescriptor *
+RpPTankAtomicGetDataFormat(RpAtomic *atomic);
+
+/*
+ * Particles Management API **************************************************
+ */
+
+#define RpPTankAtomicGetActiveParticlesCountMacro(_atm)\
+ (RPATOMICPTANKPLUGINDATA(_atm)->actPCount)
+
+#define RpPTankAtomicGetMaximumParticlesCountMacro(_atm)\
+ (RPATOMICPTANKPLUGINDATA(_atm)->maxPCount)
+
+#define RpPTankAtomicSetActiveParticlesCountMacro(atm_,cnt_)\
+MACRO_START\
+{\
+ RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGACTNUMCHG;\
+ RPATOMICPTANKPLUGINDATA(atm_)->actPCount = cnt_;\
+}\
+MACRO_STOP
+
+#define RpPTankAtomicSetTextureMacro(atm_, tex_)\
+MACRO_START\
+{\
+RpMaterialSetTexture(RpGeometryGetMaterial(RpAtomicGetGeometry(atm_),0), tex_);\
+}\
+MACRO_STOP
+
+#define RpPTankAtomicGetTextureMacro(atm_)\
+ (RpMaterialGetTexture(RpGeometryGetMaterial(RpAtomicGetGeometry(atm_),0)))
+
+#define RpPTankAtomicGetMaterialMacro(atm_)\
+ (RpGeometryGetMaterial(RpAtomicGetGeometry(atm_),0))
+
+#define RpPTankAtomicSetBlendModesMacro(atm_,src_,dst_)\
+MACRO_START\
+{\
+ RPATOMICPTANKPLUGINDATA(atm_)->publicData.srcBlend = src_;\
+ RPATOMICPTANKPLUGINDATA(atm_)->publicData.dstBlend = dst_;\
+}\
+MACRO_STOP
+
+#define RpPTankAtomicGetBlendModesMacro(atm_,src_,dst_)\
+MACRO_START\
+{\
+ *src_ =\
+ (RwBlendFunction)(RPATOMICPTANKPLUGINDATA(atm_)->publicData.srcBlend);\
+ *dst_ =\
+ (RwBlendFunction)(RPATOMICPTANKPLUGINDATA(atm_)->publicData.dstBlend);\
+}\
+MACRO_STOP
+
+#define RpPTankAtomicSetVertexAlphaMacro(atm_, vas_)\
+MACRO_START\
+{\
+ RPATOMICPTANKPLUGINDATA(atm_)->publicData.vertexAlphaBlend = vas_;\
+}\
+MACRO_STOP
+
+#define RpPTankAtomicGetVertexAlphaMacro(atm_)\
+ (RPATOMICPTANKPLUGINDATA(atm_)->publicData.vertexAlphaBlend)
+
+#define RpPTankAtomicSetConstantCenterMacro(atm_, ctr_)\
+MACRO_START\
+{\
+ RPATOMICPTANKPLUGINDATA(atm_)->publicData.cCenter = *ctr_;\
+ RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCENTER;\
+}\
+MACRO_STOP
+
+#define RpPTankAtomicGetConstantCenterMacro(atm_)\
+ (&(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cCenter))
+
+
+#define RpPTankAtomicSetConstantSizeMacro(atm_, size_)\
+MACRO_START\
+{\
+ RPATOMICPTANKPLUGINDATA(atm_)->publicData.cSize = *size_;\
+ RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNSSIZE;\
+}\
+MACRO_STOP
+
+#define RpPTankAtomicGetConstantSizeMacro(atm_)\
+ (&RPATOMICPTANKPLUGINDATA(atm_)->publicData.cSize)
+
+#define RpPTankAtomicSetConstantRotateMacro(atm_, rot_)\
+MACRO_START\
+{\
+ RPATOMICPTANKPLUGINDATA(atm_)->publicData.cRotate = rot_;\
+ RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNS2DROTATE;\
+}\
+MACRO_STOP
+
+#define RpPTankAtomicGetConstantRotateMacro(atm_)\
+ (RPATOMICPTANKPLUGINDATA(atm_)->publicData.cRotate)
+
+#define RpPTankAtomicSetConstantMatrixMacro(atm_, mtx_)\
+MACRO_START\
+{\
+ RwMatrixCopy(&(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cMatrix),mtx_);\
+ RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNSMATRIX;\
+}\
+MACRO_STOP
+
+#define RpPTankAtomicGetConstantMatrixMacro(atm_)\
+ (&(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cMatrix))
+
+#define RpPTankAtomicSetConstantColorMacro(atm_, col_)\
+MACRO_START\
+{\
+ RPATOMICPTANKPLUGINDATA(atm_)->publicData.cColor = *col_;\
+ if( RpGeometryGetMaterial(RpAtomicGetGeometry(atm_),0) )\
+ {\
+ (void)RpMaterialSetColor(\
+ RpGeometryGetMaterial(RpAtomicGetGeometry(atm_),0),\
+ &RPATOMICPTANKPLUGINDATA(atm_)->publicData.cColor);\
+ }\
+ RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNSCOLOR;\
+}\
+MACRO_STOP
+
+#define RpPTankAtomicGetConstantColorMacro(atm_)\
+ (&(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cColor))
+
+#define RpPTankAtomicSetConstantVtxColorMacro(atm_, col_)\
+MACRO_START\
+{\
+ memcpy(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cVtxColor,\
+ col_,\
+ sizeof(RwRGBA)*4);\
+ RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNSVTXCOLOR;\
+}\
+MACRO_STOP
+
+#define RpPTankAtomicGetConstantVtxColorMacro(atm_)\
+ (RPATOMICPTANKPLUGINDATA(atm_)->publicData.cVtxColor)
+
+#define RpPTankAtomicSetConstantVtx2TexCoordsMacro(atm_, uv_)\
+MACRO_START\
+{\
+ memcpy(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cUV,\
+ uv_,\
+ sizeof(RwTexCoords)*2);\
+ RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNSVTX2TEXCOORDS;\
+}\
+MACRO_STOP
+
+#define RpPTankAtomicGetConstantVtx2TexCoordsMacro(atm_)\
+ (RPATOMICPTANKPLUGINDATA(atm_)->publicData.cUV)
+
+#define RpPTankAtomicSetConstantVtx4TexCoordsMacro(atm_, uv_)\
+MACRO_START\
+{\
+ memcpy(RPATOMICPTANKPLUGINDATA(atm_)->publicData.cUV,\
+ uv_,\
+ sizeof(RwTexCoords)*4);\
+ RPATOMICPTANKPLUGINDATA(atm_)->instFlags |= rpPTANKIFLAGCNSVTX4TEXCOORDS;\
+}\
+MACRO_STOP
+
+#define RpPTankAtomicGetConstantVtx4TexCoordsMacro(atm_)\
+ (RPATOMICPTANKPLUGINDATA(atm_)->publicData.cUV)
+
+#if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE))
+extern RwInt32
+RpPTankAtomicGetActiveParticlesCount(RpAtomic *atomic);
+
+extern RwInt32
+RpPTankAtomicGetMaximumParticlesCount(RpAtomic *atomic);
+
+extern void
+RpPTankAtomicSetActiveParticlesCount(RpAtomic *atomic, RwInt32 count);
+
+extern void
+RpPTankAtomicSetTexture(RpAtomic *atomic, RwTexture *texture);
+
+extern RwTexture *
+RpPTankAtomicGetTexture(RpAtomic *atomic);
+
+extern RpAtomic *
+RpPTankAtomicSetMaterial(RpAtomic *atomic, RpMaterial *material);
+
+extern RpMaterial *
+RpPTankAtomicGetMaterial(RpAtomic *atomic);
+
+extern void
+RpPTankAtomicSetBlendModes(RpAtomic *atomic,
+ RwBlendFunction srcBlendMode,
+ RwBlendFunction dstBlendMode );
+
+extern void
+RpPTankAtomicGetBlendModes(RpAtomic *atomic,
+ RwBlendFunction *srcBlendMode,
+ RwBlendFunction *dstBlendMode );
+
+extern void
+RpPTankAtomicSetVertexAlpha(RpAtomic *atomic, RwBool vtxAlphaState);
+
+extern RwBool
+RpPTankAtomicGetVertexAlpha(RpAtomic *atomic);
+
+extern void
+RpPTankAtomicSetConstantCenter(RpAtomic *atomic, RwV2d *center);
+
+const RwV2d *
+RpPTankAtomicGetConstantCenter(RpAtomic *atomic);
+
+extern void
+RpPTankAtomicSetConstantSize(RpAtomic *atomic, RwV2d *size);
+
+extern const RwV2d *
+RpPTankAtomicGetConstantSize(RpAtomic *atomic);
+
+extern void
+RpPTankAtomicSetConstantRotate(RpAtomic *atomic, RwReal rotate);
+
+extern RwReal
+RpPTankAtomicGetConstantRotate(RpAtomic *atomic);
+
+extern void
+RpPTankAtomicSetConstantMatrix(RpAtomic *atomic, RwMatrix *matrix);
+
+extern const RwMatrix *
+RpPTankAtomicGetConstantMatrix(RpAtomic *atomic);
+
+extern void
+RpPTankAtomicSetConstantColor(RpAtomic *atomic, RwRGBA *color);
+
+extern const RwRGBA *
+RpPTankAtomicGetConstantColor(RpAtomic *atomic);
+
+extern void
+RpPTankAtomicSetConstantVtxColor(RpAtomic *atomic, RwRGBA *color);
+
+extern const RwRGBA *
+RpPTankAtomicGetConstantVtxColor(RpAtomic *atomic);
+
+extern void
+RpPTankAtomicSetConstantVtx2TexCoords(RpAtomic *atomic, RwTexCoords *UVs);
+
+extern const RwTexCoords *
+RpPTankAtomicGetConstantVtx2TexCoords(RpAtomic *atomic);
+
+extern void
+RpPTankAtomicSetConstantVtx4TexCoords(RpAtomic *atomic, RwTexCoords *UVs);
+
+extern const RwTexCoords *
+RpPTankAtomicGetConstantVtx4TexCoords(RpAtomic *atomic);
+#else
+
+#define RpPTankAtomicGetActiveParticlesCount(atm_)\
+ RpPTankAtomicGetActiveParticlesCountMacro(atm_)
+
+#define RpPTankAtomicGetMaximumParticlesCount(atm_)\
+ RpPTankAtomicGetMaximumParticlesCountMacro(atm_)
+
+#define RpPTankAtomicSetActiveParticlesCount(atm_,cnt_)\
+ RpPTankAtomicSetActiveParticlesCountMacro(atm_,cnt_)
+
+
+#define RpPTankAtomicSetTexture(atm_,tex_)\
+ RpPTankAtomicSetTextureMacro(atm_,tex_)
+
+#define RpPTankAtomicGetTexture(atm_)\
+ RpPTankAtomicGetTextureMacro(atm_)
+
+extern RpAtomic *
+RpPTankAtomicSetMaterial(RpAtomic *atomic, RpMaterial *material);
+
+#define RpPTankAtomicGetMaterial(atm_)\
+ RpPTankAtomicGetMaterialMacro(atm_)
+
+#define RpPTankAtomicSetBlendModes(atm_,src_,dst_)\
+ RpPTankAtomicSetBlendModesMacro(atm_,src_,dst_)
+
+#define RpPTankAtomicGetBlendModes(atm_,src_,dst_)\
+ RpPTankAtomicGetBlendModesMacro(atm_,src_,dst_)
+
+#define RpPTankAtomicSetVertexAlpha(atm_, vas_)\
+ RpPTankAtomicSetVertexAlphaMacro(atm_, vas_)
+
+#define RpPTankAtomicGetVertexAlpha(atm_)\
+ RpPTankAtomicGetVertexAlphaMacro(atm_)
+
+#define RpPTankAtomicSetConstantCenter(atm_, ctr_)\
+ RpPTankAtomicSetConstantCenterMacro(atm_, ctr_)
+
+#define RpPTankAtomicGetConstantCenter(atm_)\
+ RpPTankAtomicGetConstantCenterMacro(atm_)
+
+#define RpPTankAtomicSetConstantSize(atm_, size_)\
+ RpPTankAtomicSetConstantSizeMacro(atm_, size_)
+
+#define RpPTankAtomicGetConstantSize(atm_)\
+ RpPTankAtomicGetConstantSizeMacro(atm_)
+
+#define RpPTankAtomicSetConstantRotate(atm_, rot_)\
+ RpPTankAtomicSetConstantRotateMacro(atm_, rot_)
+
+#define RpPTankAtomicGetConstantRotate(atm_)\
+ RpPTankAtomicGetConstantRotateMacro(atm_)
+
+#define RpPTankAtomicSetConstantMatrix(atm_, mtx_)\
+ RpPTankAtomicSetConstantMatrixMacro(atm_, mtx_)
+
+#define RpPTankAtomicGetConstantMatrix(atm_)\
+ RpPTankAtomicGetConstantMatrixMacro(atm_)
+
+#define RpPTankAtomicSetConstantColor(atm_, col_)\
+ RpPTankAtomicSetConstantColorMacro(atm_, col_)
+
+#define RpPTankAtomicGetConstantColor(atm_)\
+ RpPTankAtomicGetConstantColorMacro(atm_)
+
+#define RpPTankAtomicSetConstantVtxColor(atm_, _col)\
+ RpPTankAtomicSetConstantVtxColorMacro(atm_, _col)
+
+#define RpPTankAtomicGetConstantVtxColor(atm_)\
+ RpPTankAtomicGetConstantVtxColorMacro(atm_)
+
+#define RpPTankAtomicSetConstantVtx2TexCoords(atm_, uv_)\
+ RpPTankAtomicSetConstantVtx2TexCoordsMacro(atm_, uv_)
+
+#define RpPTankAtomicGetConstantVtx2TexCoords(atm_)\
+ RpPTankAtomicGetConstantVtx2TexCoordsMacro(atm_)\
+
+#define RpPTankAtomicSetConstantVtx4TexCoords(atm_, uv_)\
+ RpPTankAtomicSetConstantVtx4TexCoordsMacro(atm_, uv_)
+
+#define RpPTankAtomicGetConstantVtx4TexCoords(atm_)\
+ RpPTankAtomicGetConstantVtx4TexCoordsMacro(atm_)
+
+#endif
+
+/*
+ * Data access API ***********************************************************
+ */
+
+extern RwBool
+RpPTankAtomicLock(RpAtomic *atomic, RpPTankLockStruct *dst,
+ RwUInt32 dataFlags, RpPTankLockFlags lockFlag);
+
+extern void *
+RpPTankAtomicLockByIndex(RpAtomic *atomic, RwInt32 idx, RwUInt32 dataFlags, RpPTankLockFlags lockFlag);
+
+extern RpAtomic *
+RpPTankAtomicUnlock(RpAtomic *atomic);
+
+
+/*
+ * Stealth functions *********************************************************
+ */
+RpAtomic*
+_rpPTankAtomicCreateCustom(RwInt32 maxParticleNum,
+ RwUInt32 dataFlags, RwUInt32 platFlags,
+ RpPTankCallBacks *callbacks);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/*---- end: ./ptank.h----*/
+
+/*---- start: c:/daily/rwsdk/plugin/ptank/d3d8/ptankplatform.h----*/
+
+/**
+ * \defgroup rpptankd3d8 D3D8
+ * \ingroup rpptank
+ *
+ * D3D8 specific documentation.
+ */
+
+/**
+ * \ingroup rpptankd3d8
+ * \par D3D8 specific data flags
+ *
+ * <ul>
+ * <li> rpPTANKD3D8FLAGSUSEPOINTSPRITES selects the D3D8 optimized pipeline. At the
+ * moment, this pipeline use point sprites when the hardware supports them,
+ * which don't allow use of all the PTank flags. Only the following flags are
+ * supported when using the D3D8 optimized pipes:
+ *
+ * <ul>
+ * <li> rpPTANKDFLAGPOSITION
+ * <li> rpPTANKDFLAGNORMAL
+ * <li> rpPTANKDFLAGSIZE (if the hardware supports the D3DFVF_PSIZE vertex format flag)
+ * <li> rpPTANKDFLAGCOLOR
+ * <li> rpPTANKDFLAGUSECENTER
+ * <li> rpPTANKDFLAGARRAY
+ * <li> rpPTANKDFLAGSTRUCTURE
+ * </ul>
+ *
+ * The texture coordinates are generated by the hardware and can't be specified.
+ * </ul>
+ *
+ * If the hardware does not support point sprites, the default pipeline is used
+ * instead.
+ *
+ */
+
+enum RpPTankD3D8Flags
+{
+ rpPTANKD3D8FLAGSUSEPOINTSPRITES = 0x00000001,
+
+ rpPTANKD3D8FLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+typedef enum RpPTankD3D8Flags RpPTankD3D8Flags;
+
+/*---- end: c:/daily/rwsdk/plugin/ptank/d3d8/ptankplatform.h----*/
+
+#endif /* RPPTANK_H */
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpptank.rpe b/sdk/rwsdk/include/d3d8/rpptank.rpe
new file mode 100644
index 00000000..2a9b45d3
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpptank.rpe
@@ -0,0 +1,177 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionPTank
+{
+
+
+
+ e_rwdb_CriterionPTankLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionPTank e_rwdb_CriterionPTank;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rppvs.h b/sdk/rwsdk/include/d3d8/rppvs.h
new file mode 100644
index 00000000..08738933
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rppvs.h
@@ -0,0 +1,398 @@
+/*
+ * Potentially Visible Set plug-in
+ */
+
+/**********************************************************************
+ *
+ * file : rppvs.h
+ *
+ * abstract : handle culling of worldsectors in RenderWare
+ *
+ **********************************************************************
+ *
+ * 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. will not, under any
+ * circumstances, be liable for any lost revenue or other damages arising
+ * from the use of this file.
+ *
+ * Copyright (c) 2001 Criterion Software Ltd.
+ * All Rights Reserved.
+ *
+ * RenderWare is a trademark of Canon Inc.
+ *
+ ************************************************************************/
+
+#ifndef _RPPVS_H
+#define _RPPVS_H
+
+/**
+ * \defgroup rppvs RpPVS
+ * \ingroup pvs
+ *
+ * Geometric Potentially Visible Set Plugin for RenderWare Graphics.
+ */
+
+/****************************************************************************
+ Defines
+ */
+
+typedef RwUInt8 RpPVSVisMap;
+
+#define PVSFROMWORLDSECTOR(sector) \
+ ((RpPVS *)(((char *)(sector))+rpPVSGlobals.sectorOffset))
+
+#define WORLDSECTORFROMPVS(pvs) \
+ ((RpWorldSector *)(((char *)(pvs))-rpPVSGlobals.sectorOffset))
+
+#define PVSFROMCONSTWORLDSECTOR(sector) \
+ ((const RpPVS *)(((const char *)(sector))+rpPVSGlobals.sectorOffset))
+
+
+#define PVSCACHEFROMWORLD(world) \
+ ((RpPVSCache *)(((char *)(world))+rpPVSGlobals.worldOffset))
+#define PVSCACHEFROMCONSTWORLD(world) \
+ ((const RpPVSCache *)(((const char *)(world))+rpPVSGlobals.worldOffset))
+
+#define PVSVISMAPSETSECTOR(_vismap, _id) \
+ (_vismap)[(_id) >> 3] |= (1 << ((_id) & 7))
+
+#define PVSVISMAPUNSETSECTOR(_vismap, _id) \
+ (_vismap)[(_id) >> 3] ^= (1 << ((_id) & 7))
+
+#define PVSVISMAPGETSECTOR(_vismap, _id) \
+ ((_vismap)[(_id) >> 3] & (1 << ((_id) & 7)))
+
+#define PVSVISMAPLENGTH(_vismaplength, _nosectors) \
+ (_vismaplength) = ((_nosectors + 7) >> 3)
+
+
+/* Progress callback message types */
+#define rpPVSPROGRESSSTART 20
+#define rpPVSPROGRESSUPDATE 12
+#define rpPVSPROGRESSEND 22
+
+/**
+ * \ingroup rppvs
+ * \ref RpPVSProgressCallBack
+ * This typedef sets the callback function for sampling within a world sector.
+ *
+ * \param value A value between 0.0 and 100.0 to represent the percentage completion.
+ * \param msg The message may take one of the following:
+ *
+ * \li rpPVSPROGRESSSTART
+ * The PVS creation process is about to start. The argument value is equal to 0.0.
+ *
+ * \li rpPVSPROGRESSUPDATE
+ * The PVS creation process has finished processing a subsection of the world.
+ * The argument value is equal to the percentage of the world processed up to this point.
+ *
+ * \li rpPVSPROGRESSEND
+ * The PVS creation process has ended. All world sectors have been processed.
+ * The argument value is equal to 100.0.
+ *
+ * The progress callback may return FALSE to indicate that the generation of PVS data
+ * should terminate. Otherwise, return TRUE to continue.
+ *
+ * The PVS plugin must be attached before using this function.
+ *
+ *
+ */
+typedef RwBool(*RpPVSProgressCallBack) (RwInt32 msg,
+ RwReal value);
+
+
+/**
+ * \ingroup rppvs
+ * \ref RpPVSCallBack
+ * This typedef sets the callback function for sampling within a world sector.
+ *
+ * \param worldSector A pointer to the \ref RpWorldSector being sampled.
+ * \param box The bounding box of the region being sampled.
+ * \param pData A pointer to private data for the sampling function.
+ */
+typedef RpWorldSector *(*RpPVSCallBack) (RpWorldSector * worldSector,
+ const RwBBox * box,
+ void *pData);
+
+#define RpPVSCallback RpPVSCallBack
+
+typedef struct _RpPVSCallBack _RpPVSCallBack;
+
+#if (!defined(DOXYGEN))
+struct _RpPVSCallBack
+{
+ RpPVSCallBack callback;
+ void *data;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+enum _rpPVSPartitionId
+{
+ rpNAPVSPARTITIONID = 0,
+ rpPVSFRONT,
+ rpPVSBACK,
+ rpPVSSPLIT,
+ rpPVSCOPLANAR,
+ rpPVSPARTITIONIDFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum _rpPVSPartitionId _rpPVSPartitionId;
+
+typedef struct _rpPVSPolyList _rpPVSPolyList;
+typedef struct _rpPVSPolyList *_rpPVSPolyListPtr;
+
+typedef struct _rpPVSPoly _rpPVSPoly;
+typedef struct _rpPVSPoly *_rpPVSPolyPtr;
+
+#if (!defined(DOXYGEN))
+typedef struct _rpPVSPlaneEq _rpPVSPlaneEq;
+struct _rpPVSPlaneEq
+{
+ RwReal x;
+ RwReal y;
+ RwReal z;
+ RwReal w;
+
+ RwReal l; /* recip of length of the normal */
+
+ _rpPVSPartitionId lastresult; /* temp: stores result of last polygon wrt this plane */
+};
+
+typedef struct RwV3i RwV3i;
+struct RwV3i
+{
+ RwInt32 x;
+ RwInt32 y;
+ RwInt32 z;
+};
+
+typedef struct _rpPVSPolyRecord _rpPVSPolyRecord;
+struct _rpPVSPolyRecord
+{
+ RwBool original; /* True if not a fragment */
+ RwReal priority; /* Used for sorting, lower values higher priority */
+ _rpPVSPolyListPtr parent; /* Unique pointer to original parent */
+ _rpPVSPolyPtr geom; /* corners of the poly */
+ _rpPVSPlaneEq plane; /* plane equation of the poly */
+ RwInt32 home; /* world sector id in range 0..numsectors */
+ RpWorldSector *homeaddr; /* world sector pointer */
+ RwBool translucent;
+
+ RwBool hasbeenclipper; /* Used during WA creation */
+
+ /* used by proximity culling, calculated once */
+ RwV3d centroid;
+ RwReal radius;
+ RwV3d extreme; /* the vertex furthest away from the centroid */
+
+ RwReal coneRadius; /* Used during clipping only */
+
+};
+
+struct _rpPVSPoly
+{
+ RwV3d v;
+ _rpPVSPoly *next;
+
+ RwInt32 pscalar; /* Used during clipping only */
+ RwReal scalar; /* Used during clipping only */
+ _rpPVSPlaneEq shadowPlane; /* Used during clipping only */
+};
+
+struct _rpPVSPolyList
+{
+ _rpPVSPolyRecord data;
+ _rpPVSPolyList *next;
+};
+
+typedef struct RpPVS RpPVS;
+
+struct RpPVS
+{
+ RwInt32 sectorID;
+ RwInt32 vismaplength;
+ RwInt32 sampleKey;
+
+ RpPVSVisMap *vismap;
+
+ _rpPVSPolyListPtr sectailpoly;
+ _rpPVSPartitionId potential;
+
+ RwUInt32 numpols;
+ RwBBox sbox;
+ RwBBox gbox;
+ RwReal diagonal;
+ RwV3d centre;
+ RwInt32 axessig[3];
+};
+
+typedef struct RpPVSCache RpPVSCache;
+struct RpPVSCache
+{
+ RwBool processed;
+ RwBool formatted;
+ RwInt32 NumWorldSectors;
+
+ RwInt32 ptotal;
+ RwInt32 paccept;
+
+ RwBool hooked;
+
+ RwUInt32 nextID;
+
+ RwInt32 viscount;
+
+ RpPVSProgressCallBack progressCallBack;
+
+ _rpPVSPolyListPtr polygons;
+
+ RpWorldSectorCallBackRender renderCallBack;
+};
+
+typedef struct RpPVSGlobalVars RpPVSGlobalVars;
+struct RpPVSGlobalVars
+{
+ RpWorld *World;
+
+ RwInt32 worldOffset;
+ RwInt32 sectorOffset;
+
+ RwBool collis;
+ RwBool bfc;
+
+
+ RwInt32 progress_count;
+ RwReal diagonal;
+
+ RwReal gran;
+
+ RwInt32 InSector;
+ RwV3d ViewPos;
+ RpPVS *CurrPVS;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RpPVSGlobalVars rpPVSGlobals;
+
+extern RpWorld *
+RpPVSSetProgressCallBack(RpWorld * wpWorld,
+ RpPVSProgressCallBack
+ callback);
+
+extern RpWorldSector *
+RpPVSSetViewPosition(RpWorld * wpWorld,
+ RwV3d * pos);
+
+extern RpWorldSector *
+RpPVSSetViewSector(RpWorld * wpWorld, RpWorldSector * spSect);
+
+extern RpWorldSector *
+RpPVSSetWorldSectorPairedVisibility(RpWorldSector * spSectA,
+ RpWorldSector * spSectB,
+ RwBool visible,
+ RwBool mutual);
+
+extern RpWorld *
+RpPVSDestroy(RpWorld * wpWorld);
+
+extern RwBool
+RpPVSWorldSectorVisible(RpWorldSector * spSect);
+
+extern RwBool
+RpPVSPluginAttach(void);
+
+extern RwBool
+RpPVSQuery(RpWorld * wpWorld);
+
+extern RwBool
+RpPVSAtomicVisible(RpAtomic * atom);
+
+extern RpWorld *
+RpPVSStatisticsGet(RpWorld * wpWorld,
+ RwInt32 * ptotal,
+ RwInt32 * paccept);
+
+extern RpPVSProgressCallBack
+RpPVSGetProgressCallBack(RpWorld *
+ wpWorld);
+
+extern RpWorld *
+RpPVSConstruct(RpWorld * wpWorld,
+ RpPVSCallBack callback,
+ void *pData);
+
+extern RpWorld*
+RpPVSConstructSector(RpWorld * wpWorld,
+ RpWorldSector * spSector,
+ RpPVSCallBack callback,
+ void *pData);
+
+
+extern RpWorldSector *
+RpPVSGeneric(RpWorldSector * spSect,
+ const RwBBox __RWUNUSED__ * box,
+ void *data);
+
+extern RwBool
+RpPVSSetCollisionDetection(RwBool collis);
+
+extern RwBool
+RpPVSSetBackFaceCulling(RwBool bfc);
+
+extern RpWorld *
+RpPVSUnhook(RpWorld * wpWorld);
+
+extern RpWorld *
+RpPVSHook(RpWorld * wpWorld);
+
+extern RpWorldSector *
+RpPVSSetWorldSectorVisibility(RpWorldSector * spSect,
+ RwBool visible);
+
+extern RwBool
+RpPVSSamplePOV(RwV3d * pos,
+ RwBool colltest);
+
+extern RxNodeDefinition *
+RxNodeDefinitionGetPVSWorldSectorCSL(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* These functions are added for backwards compatibility... */
+#define RpPVSCreate(_wpWorld, \
+ _raster, _zraster, _mindist, \
+ _maxdist, _maxdepth, _callback, _pData) \
+ RpPVSConstruct(_wpWorld, _callback, _pData)
+
+#define RpPVSAddPOV(_pos) \
+ RpPVSSamplePOV(_pos, FALSE)
+
+#define RpPVSAddWorldSector(_sector) \
+ RpPVSSetWorldSectorVisibility(_sector, TRUE)
+
+#define RpPVSAddExtraPOV(_world, _raster, _zraster, _mindist, _mazdist, _matrix) \
+MACRO_START \
+{ \
+ rpPVSGlobals.World = (_world); \
+ RpPVSSamplePOV(&((_matrix)->pos), TRUE); \
+} \
+MACRO_STOP
+
+
+#endif /* _RPPVS_H */
diff --git a/sdk/rwsdk/include/d3d8/rppvs.rpe b/sdk/rwsdk/include/d3d8/rppvs.rpe
new file mode 100644
index 00000000..62c983b0
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rppvs.rpe
@@ -0,0 +1,174 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionGPVS
+{
+
+
+
+ e_rwdb_CriterionGPVSLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionGPVS e_rwdb_CriterionGPVS;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rprandom.h b/sdk/rwsdk/include/d3d8/rprandom.h
new file mode 100644
index 00000000..aebbfed9
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rprandom.h
@@ -0,0 +1,65 @@
+/**********************************************************************
+ *
+ * File : rprandom.h
+ *
+ * Abstract : Random Number Generator
+ *
+ **********************************************************************
+ *
+ * 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. will not, under any
+ * circumstances, be liable for any lost revenue or other damages arising
+ * from the use of this file.
+ *
+ * Copyright (c) 1998 Criterion Software Ltd.
+ * All Rights Reserved.
+ *
+ * RenderWare is a trademark of Canon Inc.
+ *
+ ************************************************************************/
+
+#ifndef RPRANDOM_H
+#define RPRANDOM_H
+
+/**
+ * \defgroup rprandom RpRandom
+ * \ingroup mathtools
+ *
+ * Random Number Generation Plugin for RenderWare Graphics.
+ */
+
+/*--- Include files ---*/
+#include "rwcore.h"
+
+#include "rprandom.rpe" /* automatically generated header file */
+
+/*--- Plugin API Functions ---*/
+
+#define RPRANDMAX (~((~0)<<31))
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+RwBool RpRandomPluginAttach(void);
+
+/* Getting values */
+
+extern RwUInt32 RpRandom(void);
+extern void RpRandomSeed(RwUInt32 seed);
+
+extern RwUInt32 RpRandomMT(void);
+extern void RpRandomSeedMT(RwUInt32 seed);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RPRANDOM_H */
+
diff --git a/sdk/rwsdk/include/d3d8/rprandom.rpe b/sdk/rwsdk/include/d3d8/rprandom.rpe
new file mode 100644
index 00000000..d3fe964b
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rprandom.rpe
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionRandom
+{
+
+
+
+ e_rwdb_CriterionRandomLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionRandom e_rwdb_CriterionRandom;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpskin.h b/sdk/rwsdk/include/d3d8/rpskin.h
new file mode 100644
index 00000000..8a6ea204
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpskin.h
@@ -0,0 +1,276 @@
+
+#ifndef RPSKIN_H
+#define RPSKIN_H
+
+/**
+ * \defgroup rpskin RpSkin
+ * \ingroup skinning
+ *
+ * Skin Plugin for RenderWare Graphics.
+ */
+
+/*===========================================================================*
+ *--- Include files ---------------------------------------------------------*
+ *===========================================================================*/
+#include "rwcore.h"
+#include "rpworld.h"
+
+#include "rpcriter.h"
+#include "rpskin.rpe"
+
+#include "rphanim.h"
+
+/*===========================================================================*
+ *--- Global Types ----------------------------------------------------------*
+ *===========================================================================*/
+typedef struct RwMatrixWeights RwMatrixWeights;
+
+/**
+ * \ingroup rpskin
+ * \struct RwMatrixWeights
+ * A structure for defining up to four matrix weights per vertex.
+ * Not all entries need to be used.
+ *
+ * \note
+ * Values should be sorted, such that any zero 0.0f entries appear
+ * after the valid weights. Any weights that appear after a zero
+ * entry will be ignored.
+ *
+ * \see RpSkinCreate
+ */
+struct RwMatrixWeights
+{
+ RwReal w0; /**< The first matrix weight. */
+ RwReal w1; /**< The second matrix weight. */
+ RwReal w2; /**< The third matrix weight. */
+ RwReal w3; /**< The fourth matrix weight. */
+};
+
+/**
+ * \ingroup rpskin
+ * \struct RpSkin
+ *
+ * Skin object. This should be considered an opaque type.
+ * Use the RpSkin API functions to access.
+ *
+ * \see RpSkinCreate
+ * \see RpSkinDestroy
+ */
+typedef struct RpSkin RpSkin;
+
+/*===========================================================================*
+ *--- Plugin API Functions --------------------------------------------------*
+ *===========================================================================*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/*---------------------------------------------------------------------------*
+ *- Plugin functions -*
+ *---------------------------------------------------------------------------*/
+extern void RpSkinSetFreeListCreateParams(
+ RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern RwBool
+RpSkinPluginAttach(void);
+
+/*---------------------------------------------------------------------------*
+ *- Skin Atomic functions -*
+ *---------------------------------------------------------------------------*/
+extern RpAtomic *
+RpSkinAtomicSetHAnimHierarchy( RpAtomic *atomic,
+ RpHAnimHierarchy *hierarchy );
+
+extern RpHAnimHierarchy *
+RpSkinAtomicGetHAnimHierarchy( const RpAtomic *atomic );
+
+/*---------------------------------------------------------------------------*
+ *- Skin Geometry functions -*
+ *---------------------------------------------------------------------------*/
+extern RpGeometry *
+RpSkinGeometrySetSkin( RpGeometry *geometry,
+ RpSkin *skin );
+
+extern RpSkin *
+RpSkinGeometryGetSkin( RpGeometry *geometry );
+
+extern RpSkin *
+RpSkinCreate( RwUInt32 numVertices,
+ RwUInt32 numBones,
+ RwMatrixWeights *vertexWeights,
+ RwUInt32 *vertexIndices,
+ RwMatrix *inverseMatrices );
+
+extern RpSkin *
+RpSkinDestroy( RpSkin *skin );
+
+extern RwUInt32
+RpSkinGetNumBones( RpSkin *skin );
+
+extern const RwMatrixWeights *
+RpSkinGetVertexBoneWeights( RpSkin *skin );
+
+extern const RwUInt32 *
+RpSkinGetVertexBoneIndices( RpSkin *skin );
+
+extern const RwMatrix *
+RpSkinGetSkinToBoneMatrices( RpSkin *skin );
+
+extern RwBool
+RpSkinIsSplit( RpSkin *skin );
+
+/*---------------------------------------------------------------------------*
+ *- Skin pipeline -*
+ *---------------------------------------------------------------------------*/
+
+/**
+ * \ingroup rpskin
+ * \ref RpSkinType defines the different ways a skinned atomic can
+ * be rendered. Once a skinned \ref RpGeometry has been attached to
+ * an \ref RpAtomic the atomic must be setup with the correct skin
+ * rendering pipeline with \ref RpSkinAtomicSetType.
+ */
+enum RpSkinType
+{
+ rpNASKINTYPE = 0, /**<Invalid skin pipeline. */
+ rpSKINTYPEGENERIC = 1, /**<Generic skin rendering. */
+ rpSKINTYPEMATFX = 2, /**<Material effects skin rendering. */
+ rpSKINTYPETOON = 3, /**<Toon skin rendering. */
+ rpSKINTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpSkinType RpSkinType;
+
+extern RpAtomic *
+RpSkinAtomicSetType( RpAtomic *atomic,
+ RpSkinType type );
+
+extern RpSkinType
+RpSkinAtomicGetType( RpAtomic *atomic );
+
+/*---------------------------------------------------------------------------*
+ *- Internal API -*
+ *---------------------------------------------------------------------------*/
+extern RpGeometry *
+_rpSkinInitialize(RpGeometry *geometry);
+
+extern RpGeometry *
+_rpSkinDeinitialize(RpGeometry *geometry);
+
+extern RwUInt8 *
+_rpSkinGetMeshBoneRemapIndices( RpSkin *skin );
+
+extern RwUInt8 *
+_rpSkinGetMeshBoneRLECount( RpSkin *skin );
+
+extern RwUInt8 *
+_rpSkinGetMeshBoneRLE( RpSkin *skin );
+
+extern RpSkin *
+_rpSkinSplitDataCreate( RpSkin *skin, RwUInt32 boneLimit,
+ RwUInt32 numMatrices, RwUInt32 numMeshes,
+ RwUInt32 numRLE );
+
+extern RwBool
+_rpSkinSplitDataDestroy( RpSkin *skin );
+
+/*---------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/*---------------------------------------------------------------------------*
+ *- Backwards macros -*
+ *---------------------------------------------------------------------------*/
+
+#define RpSkinAtomicGetSkin(_a) \
+ RpSkinGeometryGetSkin(RpAtomicGetGeometry(_a))
+
+/*---------------------------------------------------------------------------*/
+
+/*---- start: ./d3d8/skinplatform.h----*/
+
+/**
+ * \defgroup rpskind3d8 D3D8
+ * \ingroup rpskin
+ *
+ * D3D8 skin pipeline extension.
+ */
+
+/**
+ * \defgroup rpskind3d8features Features
+ * \ingroup rpskind3d8
+ *
+ * D3D8 skin pipeline features.
+ */
+
+/**
+ * \defgroup rpskind3d8restrictions Restrictions
+ * \ingroup rpskind3d8
+ *
+ * D3D8 skin pipeline restrictions.
+ */
+
+/**
+ * \defgroup rpskinbonelimit Bone limit
+ * \ingroup rpskind3d8restrictions
+ *
+ * \par Bone limit
+ * The bone limit is 256 as skinning is performed on the CPU.
+ *
+ */
+
+
+/*===========================================================================*
+ *--- D3D8 Defines -----------------------------------------------------------*
+ *===========================================================================*/
+
+/*===========================================================================*
+ *--- D3D8 Global Types ------------------------------------------------------*
+ *===========================================================================*/
+
+/**
+ * \ingroup rpskind3d8
+ * \ref RpSkinD3D8Pipeline rendering pipelines available within
+ * the \ref RpSkin plugin. Use \ref RpSkinGetD3D8Pipeline to
+ * retrieve the \ref RxPipeline's.
+ */
+enum RpSkinD3D8Pipeline
+{
+ rpNASKIND3D8PIPELINE = 0,
+ rpSKIND3D8PIPELINEGENERIC = 1,
+ /**<D3D8 generic skin rendering pipeline. */
+ rpSKIND3D8PIPELINEMATFX = 2,
+ /**<D3D8 material effect skin rendering pipeline. */
+ rpSKIND3D8PIPELINETOON = 3,
+ /**<D3D8 toon skin rendering pipeline. */
+ rpSKIND3D8PIPELINEMATFXTOON = 4,
+ /**<D3D8 toon matfx skin rendering pipeline not supported */
+ rpSKIND3D8PIPELINEMAX,
+ rpSKIND3D8PIPELINEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpSkinD3D8Pipeline RpSkinD3D8Pipeline;
+
+/*===========================================================================*
+ *--- D3D8 Plugin API Functions ----------------------------------------------*
+ *===========================================================================*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+/*---------------------------------------------------------------------------*/
+
+extern RxPipeline *
+RpSkinGetD3D8Pipeline( RpSkinD3D8Pipeline D3D8Pipeline );
+
+/*---------------------------------------------------------------------------*/
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/*---- end: ./d3d8/skinplatform.h----*/
+
+#endif /* RPSKIN_H */
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpskin.rpe b/sdk/rwsdk/include/d3d8/rpskin.rpe
new file mode 100644
index 00000000..02d7e162
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpskin.rpe
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionSKIN
+{
+
+
+
+ e_rwdb_CriterionSKINLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionSKIN e_rwdb_CriterionSKIN;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpspline.h b/sdk/rwsdk/include/d3d8/rpspline.h
new file mode 100644
index 00000000..df3a21d9
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpspline.h
@@ -0,0 +1,141 @@
+/*
+ * Structure for splines
+ *
+ *
+ * Copyright (c) Criterion Software Limited
+ */
+
+/******************************************/
+/* */
+/* 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) 1998. Criterion Software Ltd.
+ * All Rights Reserved.
+ */
+
+/***************************************************************************
+ * *
+ * Module : rpspline.h *
+ * *
+ * Purpose : Spline operations *
+ * *
+ **************************************************************************/
+
+#ifndef RPSPLINE_H
+#define RPSPLINE_H
+
+/**
+ * \defgroup rpspline RpSpline
+ * \ingroup mathtools
+ *
+ * Spline Plugin for RenderWare Graphics.
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+/*--- Include files ---*/
+#include "rwcore.h"
+#include "rpworld.h"
+
+#include "rpspline.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Global Types
+ */
+
+#define rpSPLINENAMELENGTH (32)
+
+typedef struct RpSpline RpSpline;
+/**
+ * \ingroup rpspline
+ * \struct RpSpline
+ * Spline object. This should be considered an opaque type.
+ * Use the RpSpline API functions to access.
+ */
+struct RpSpline
+{
+ RwObject tType; /**< Internal Use */
+ RwInt32 numCtrlPoints; /**< Internal Use */
+ RwInt32 nSplineType; /**< Internal Use */
+ void *pUser; /**< Internal Use */
+ RwV3d *ctrlPoints; /**< Internal Use */
+ RwChar caName[rpSPLINENAMELENGTH]; /**< Internal Use */
+ /* Keep this at tail */
+ RwV3d vPts[1]; /**< Internal Use */
+};
+
+/* Spline types */
+#define rpSPLINETYPEOPENLOOPBSPLINE (1) /* Bezier spline, open loop */
+#define rpSPLINETYPECLOSEDLOOPBSPLINE (2) /* Bezier spline, closed loop */
+
+/* Spline path types */
+#define rpSPLINEPATHSMOOTH (10) /* Normal */
+#define rpSPLINEPATHNICEENDS (11) /* Slows down the path at the ends */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Opening the spline plugin */
+extern RwBool RpSplinePluginAttach(void);
+
+/* Creating and destroying splines */
+extern RpSpline *RpSplineCreate(RwInt32 numCtrlPoints, RwInt32 type, RwV3d *ctrlPoints);
+extern RwBool RpSplineDestroy(RpSpline *spline);
+
+/* Finding a point and its tangent vector on the spline */
+extern RwV3d *RpSplineFindPosition(RpSpline *spline, RwInt32 path, RwReal where, RwV3d *pos, RwV3d *tangent);
+
+/* Finding a frame on the spline */
+extern RwReal RpSplineFindMatrix(RpSpline *spline, RwInt32 path, RwReal where, RwV3d *up, RwMatrix *matrix);
+/* LEGACY-SUPPORT MACRO */
+#define RpSplineFindFrame RpSplineFindMatrix
+
+/* Getting and setting the control points */
+extern RwInt32 RpSplineGetNumControlPoints(const RpSpline *spline);
+extern RwV3d *RpSplineGetControlPoint(RpSpline *spline, RwInt32 control, RwV3d *point);
+extern RpSpline *RpSplineSetControlPoint(RpSpline *spline, RwInt32 control, RwV3d * point);
+
+/* Copy a spline */
+extern RpSpline *RpSplineClone(RpSpline *spline);
+
+/* Spline reading and writing helper functions */
+extern RpSpline *RpSplineRead(RwChar *name);
+extern RwBool RpSplineWrite(RpSpline *spline, RwChar *name);
+
+/* Binary format */
+extern RwUInt32 RpSplineStreamGetSize(const RpSpline *spline);
+extern RpSpline *RpSplineStreamRead(RwStream *stream);
+extern const RpSpline *RpSplineStreamWrite(const RpSpline *spline, RwStream *stream);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RPSPLINE_H */
+
+
+
+
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpspline.rpe b/sdk/rwsdk/include/d3d8/rpspline.rpe
new file mode 100644
index 00000000..55748bdd
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpspline.rpe
@@ -0,0 +1,176 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionSpline
+{
+
+E_RP_SPLINE_INVNAME,
+E_RP_SPLINE_INVTYPE,
+E_RP_SPLINE_INVCONTROLS,
+E_RP_SPLINE_OPEN,
+E_RP_SPLINE_PLUGINNOTINIT,
+
+ e_rwdb_CriterionSplineLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionSpline e_rwdb_CriterionSpline;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpusrdat.h b/sdk/rwsdk/include/d3d8/rpusrdat.h
new file mode 100644
index 00000000..92a56e31
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpusrdat.h
@@ -0,0 +1,124 @@
+#ifndef RPUSERDATAPLUGIN_H
+#define RPUSERDATAPLUGIN_H
+
+/**
+ * \defgroup rpuserdata RpUserData
+ * \ingroup scenemanagement
+ *
+ * User Data Plugin for RenderWare Graphics.
+ */
+
+/*
+ * UserData plugin
+ */
+
+#include <rwcore.h>
+#include <rpworld.h>
+
+/**
+ * \ingroup rpuserdata
+ * User data formats
+ */
+enum RpUserDataFormat
+{
+ rpNAUSERDATAFORMAT = 0,
+ rpINTUSERDATA, /**< 32 bit int data */
+ rpREALUSERDATA, /**< 32 bit float data */
+ rpSTRINGUSERDATA, /**< unsigned byte pointer data */
+ rpUSERDATAFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpUserDataFormat RpUserDataFormat;
+
+typedef struct RpUserDataArray RpUserDataArray;
+
+/**
+ * \ingroup rpuserdata
+ * \struct RpUserDataArray
+ * A structure representing an array of user data values
+ */
+
+struct RpUserDataArray
+{
+ RwChar *name; /**< Identifier for this data array */
+ RpUserDataFormat format; /**< Data format of this array */
+ RwInt32 numElements; /**< Number of elements in this array */
+ void *data; /**< Pointer to the array data */
+};
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Plugin API */
+extern RwBool RpUserDataPluginAttach(void);
+
+/* Geometry API */
+extern RwInt32 RpGeometryAddUserDataArray(RpGeometry *geometry, RwChar *name,
+ RpUserDataFormat format, RwInt32 numElements);
+extern RpGeometry *RpGeometryRemoveUserDataArray(RpGeometry *geometry, RwInt32 index);
+extern RpUserDataArray *RpGeometryGetUserDataArray(const RpGeometry *geometry, RwInt32 data);
+extern RwInt32 RpGeometryGetUserDataArrayCount(const RpGeometry *geometry);
+
+/* World Sector API */
+extern RwInt32 RpWorldSectorAddUserDataArray(RpWorldSector *sector, RwChar *name,
+ RpUserDataFormat format, RwInt32 numElements);
+extern RpWorldSector *RpWorldSectorRemoveUserDataArray(RpWorldSector *sector, RwInt32 index);
+extern RpUserDataArray *RpWorldSectorGetUserDataArray(const RpWorldSector *sector, RwInt32 data);
+extern RwInt32 RpWorldSectorGetUserDataArrayCount(const RpWorldSector *sector);
+
+/* RwFrame API */
+extern RwInt32 RwFrameAddUserDataArray(RwFrame *frame, RwChar *name,
+ RpUserDataFormat format, RwInt32 numElements);
+extern RwFrame *RwFrameRemoveUserDataArray(RwFrame *frame, RwInt32 index);
+extern RpUserDataArray *RwFrameGetUserDataArray(const RwFrame *frame, RwInt32 data);
+extern RwInt32 RwFrameGetUserDataArrayCount(const RwFrame *frame);
+
+/* RwCamera API */
+extern RwInt32 RwCameraAddUserDataArray(RwCamera *camera, RwChar *name,
+ RpUserDataFormat format, RwInt32 numElements);
+extern RwCamera *RwCameraRemoveUserDataArray(RwCamera *camera, RwInt32 index);
+extern RpUserDataArray *RwCameraGetUserDataArray(const RwCamera *camera, RwInt32 data);
+extern RwInt32 RwCameraGetUserDataArrayCount(const RwCamera *camera);
+
+/* RpLight API */
+extern RwInt32 RpLightAddUserDataArray(RpLight *light, RwChar *name,
+ RpUserDataFormat format, RwInt32 numElements);
+extern RpLight *RpLightRemoveUserDataArray(RpLight *light, RwInt32 index);
+extern RpUserDataArray *RpLightGetUserDataArray(const RpLight *light, RwInt32 data);
+extern RwInt32 RpLightGetUserDataArrayCount(const RpLight *light);
+
+/* RpMaterial API */
+extern RwInt32 RpMaterialAddUserDataArray(RpMaterial *material, RwChar *name,
+ RpUserDataFormat format, RwInt32 numElements);
+extern RpMaterial *RpMaterialRemoveUserDataArray(RpMaterial *material, RwInt32 index);
+extern RpUserDataArray *RpMaterialGetUserDataArray(const RpMaterial *material, RwInt32 data);
+extern RwInt32 RpMaterialGetUserDataArrayCount(const RpMaterial *material);
+
+/* RwTexture API */
+extern RwInt32 RwTextureAddUserDataArray(RwTexture *texture, RwChar *name,
+ RpUserDataFormat format, RwInt32 numElements);
+extern RwTexture *RwTextureRemoveUserDataArray(RwTexture *texture, RwInt32 index);
+extern RpUserDataArray *RwTextureGetUserDataArray(const RwTexture *texture, RwInt32 data);
+extern RwInt32 RwTextureGetUserDataArrayCount(const RwTexture *texture);
+
+/* User Data Array API */
+extern RwChar *RpUserDataArrayGetName(RpUserDataArray *userData);
+extern RpUserDataFormat RpUserDataArrayGetFormat(RpUserDataArray *userData);
+extern RwInt32 RpUserDataArrayGetNumElements(RpUserDataArray *userData);
+
+extern RwInt32 RpUserDataArrayGetInt(RpUserDataArray *userData, RwInt32 index);
+extern RwReal RpUserDataArrayGetReal(RpUserDataArray *userData, RwInt32 index);
+extern RwChar *RpUserDataArrayGetString(RpUserDataArray *userData, RwInt32 index);
+
+extern void RpUserDataArraySetInt(RpUserDataArray *userData, RwInt32 index, RwInt32 value);
+extern void RpUserDataArraySetReal(RpUserDataArray *userData, RwInt32 index, RwReal value);
+extern void RpUserDataArraySetString(RpUserDataArray *userData, RwInt32 index, RwChar *value);
+
+extern RwInt32 RpUserDataGetFormatSize(RpUserDataFormat format);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RPUSERDATAPLUGIN_H */
diff --git a/sdk/rwsdk/include/d3d8/rpusrdat.rpe b/sdk/rwsdk/include/d3d8/rpusrdat.rpe
new file mode 100644
index 00000000..f5879a00
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpusrdat.rpe
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionUserData
+{
+
+
+
+ e_rwdb_CriterionUserDataLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionUserData e_rwdb_CriterionUserData;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rpworld.h b/sdk/rwsdk/include/d3d8/rpworld.h
new file mode 100644
index 00000000..0d0489ce
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpworld.h
@@ -0,0 +1,3758 @@
+/******************************************/
+/* */
+/* 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: <C:/daily/rwsdk/include/d3d8/rpworld.h>
+ * Automatically Generated on: Thu Jan 23 11:06:24 2003
+ *
+ ************************************************************************/
+
+#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 <stdarg.h>
+#include <stdlib.h>
+
+/*--- 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 */
+
+extern void RwD3D8VertexBufferManagerChangeDefaultSize(RwUInt32 defaultSize);
+
+extern RwBool _rxD3D8VertexBufferManagerCreate(RwUInt32 fvf,
+ RwUInt32 size,
+ void **vertexBuffer,
+ RwUInt32 *baseIndex);
+
+extern void _rxD3D8VertexBufferManagerDestroy(RwUInt32 fvf,
+ RwUInt32 size,
+ void *vertexBuffer,
+ RwUInt32 baseIndex);
+
+extern RwBool _rxD3D8VertexBufferManagerCreateNoFVF(RwUInt32 stride,
+ RwUInt32 size,
+ void **vertexBuffer,
+ RwUInt32 *baseIndex);
+
+extern void _rxD3D8VertexBufferManagerDestroyNoFVF(RwUInt32 stride,
+ RwUInt32 size,
+ void *vertexBuffer,
+ RwUInt32 baseIndex);
+
+#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;
+
+#if (!defined(DOXYGEN))
+struct RpMaterialChunkInfo
+{
+ RwInt32 flags; /* Material flags - unused currently -
+ * for future expansion */
+ RwRGBA color; /* Color of material. */
+ RwInt32 unused; /* Not used */
+ RwBool textured; /* Are we textured? */
+ RwSurfaceProperties surfaceProps;/* Surface properties */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+#if (!defined(RwMaterialAssign))
+#define RwMaterialAssign(_target, _source) \
+ ( *(_target) = *(_source) )
+#endif /* (!defined(RwMaterialAssign)) */
+
+/**
+ * \ingroup rpmaterial
+ * \struct 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 rpmaterial
+ * \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);
+
+/****************************************************************************
+ <macro/inline functionality
+ */
+
+#define RpMaterialAddRefMacro(_material) \
+ (((_material)->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 */
+
+
+extern void RpMaterialSetFreeListCreateParams( RwInt32 blockSize,
+ RwInt32 numBlocksToPrealloc );
+
+/* 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 RpMaterialSetStreamRightsCallBack(RwUInt32 pluginID,
+ RwPluginDataChunkRightsCallBack rightsCB);
+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;
+
+#if (!defined(DOXYGEN))
+struct RpMaterialList
+{
+ RpMaterial **materials;
+ RwInt32 numMaterials;
+ RwInt32 space;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/****************************************************************************
+ 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
+ */
+
+/*
+ * typedef for header structure listing all meshes
+ * constituting a single RpGeometry or RpWorldSector
+ */
+typedef struct RpMeshHeader RpMeshHeader;
+
+/**
+ * \ingroup rpmesh
+ * \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 PlayStation 2 these will be converted to trilists */
+ rpMESHHEADERLINELIST = 0x0004, /**< Render as linelists */
+ rpMESHHEADERPOLYLINE = 0x0008, /**< On PlayStation 2 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;
+
+#if (!defined(DOXYGEN))
+struct rpMeshGlobals
+{
+ RwInt16 nextSerialNum;
+ RwFreeList *triStripListEntryFreeList;
+ RwUInt8 meshFlagsToPrimType[rpMESHHEADERPRIMTYPEOR];
+ RwUInt8 primTypeToMeshFlags[rwPRIMTYPEOR];
+};
+#endif /* (!defined(DOXYGEN)) */
+
+typedef struct RpBuildMeshTriangle RpBuildMeshTriangle;
+
+/**
+ * \ingroup rpmesh
+ * \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 rpmesh
+ * \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 rpmesh
+ * \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 rpmesh
+ * \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 rpmesh
+ * \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] >= RwIntToFixed(1)) \
+ { \
+ naTmp[0] = RwIntToFixed(1)-1; \
+ } \
+ if (naTmp[0] <= RwIntToFixed(-1)) \
+ { \
+ naTmp[0] = RwIntToFixed(-1)+1; \
+ } \
+ if (naTmp[1] >= RwIntToFixed(1)) \
+ { \
+ naTmp[1] = RwIntToFixed(1)-1; \
+ } \
+ if (naTmp[1] <= RwIntToFixed(-1)) \
+ { \
+ naTmp[1] = RwIntToFixed(-1)+1; \
+ } \
+ if (naTmp[2] >= RwIntToFixed(1)) \
+ { \
+ naTmp[2] = RwIntToFixed(1)-1; \
+ } \
+ if (naTmp[2] <= RwIntToFixed(-1)) \
+ { \
+ naTmp[2] = RwIntToFixed(-1)+1; \
+ } \
+ \
+ (n).x = (RwInt8)(naTmp[0]>>9); \
+ (n).y = (RwInt8)(naTmp[1]>>9); \
+ (n).z = (RwInt8)(naTmp[2]>>9); \
+ }
+
+/****************************************************************************
+ Global types
+ */
+
+typedef struct RpVertexNormal RpVertexNormal;
+
+#if (!defined(DOXYGEN))
+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];
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/**
+ * \ingroup rpworldsector
+ * \struct 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 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 rpworldsector
+ * \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.
+ *
+ * \param sector Pointer to the current world sector
+ * \param data Pointer to developer-defined data structure.
+ *
+ * \return Pointer to the current world sector.
+ *
+ */
+typedef RpWorldSector *(*RpWorldSectorCallBack)(RpWorldSector *worldSector, void *data);
+
+typedef struct RpSector RpSector;
+
+#if (!defined(DOXYGEN))
+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;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+#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
+ */
+
+#define RPTRISTRIPPOLYGONMAXEDGES 3
+
+/**
+ * \ingroup rpmesh
+ * \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
+ */
+
+typedef struct RpTriStripEdge RpTriStripEdge;
+
+typedef struct RpTriStripPolygon RpTriStripPolygon;
+/**
+ * \ingroup rpmesh
+ * \struct RpTriStripPolygon
+ * This type represents a polygon.
+ *
+ * \see RpTriStripPolygonFollowStrip
+ * \see RpBuildMeshGenerateTriStrip
+ * \see RpTriStripMeshTunnel
+ */
+struct RpTriStripPolygon
+{
+ RwLLLink inEndLink; /**< link for list of polygons joined by fewer than
+ 2 strip edges */
+ RwLLLink inUsedLink; /**< link for list of used polygons */
+ RwLLLink inFreeLink; /**< link for list of free polygons */
+ RwUInt32 numEdges; /**< number of edges */
+ RpTriStripEdge *edges[RPTRISTRIPPOLYGONMAXEDGES]; /**< polygon edges */
+ RxVertexIndex vertIndex[RPTRISTRIPPOLYGONMAXEDGES]; /**< polygon vertex
+ indices */
+ RwUInt32 testFrame; /**< used to prevent a tri-strip being counted by
+ the cost function more than once */
+};
+
+/**
+ * \ingroup rpmesh
+ * \struct RpTriStripEdge
+ * This type represents a polygon edge which may be part of a tri-strip.
+ *
+ * \see RpTriStripPolygonFollowStrip
+ * \see RpBuildMeshGenerateTriStrip
+ * \see RpTriStripMeshTunnel
+ */
+struct RpTriStripEdge
+{
+ RwLLLink inUsedLink; /**< link for list of used edges */
+ RwLLLink inFreeLink; /**< link for list of free edges */
+ RpTriStripPolygon *poly1; /**< first polygon including this edge */
+ RpTriStripPolygon *poly2; /**< second polygon including this edge or NULL
+ if this edge is only included in one */
+ RxVertexIndex vert1; /**< index of first vertex of edge */
+ RxVertexIndex vert2; /**< index of second vertex of edge */
+ RwBool strip; /**< TRUE if the edge is part of a tri-strip */
+};
+
+typedef struct RpTriStripMesh RpTriStripMesh;
+/**
+ * \ingroup rpmesh
+ * \struct RpTriStripMesh
+ * This type represents a mesh and the tri-strips it contains.
+ *
+ * \see RpBuildMeshGenerateTriStrip
+ * \see RpTriStripMeshTunnel
+ */
+struct RpTriStripMesh
+{
+ RwUInt32 numPolygons; /**< the number of polygons in the mesh */
+ RwLinkList polygonEndList; /**< linked list of polygons joined by fewer
+ than 2 strip edges. */
+ RwLinkList polygonUsedList; /**< linked list of used polygons */
+ RwLinkList polygonFreeList; /**< linked list of free polygons */
+ RwLinkList edgeUsedList; /**< linked list of used edges */
+ RwLinkList edgeFreeList; /**< linked list of free edges */
+};
+
+/**
+ * \ingroup rpmesh
+ * \ref RpTriStripMeshStripCallBack represents the callback function to
+ * tri-strip a mesh.
+ *
+ * \param mesh Pointer to the mesh to tri-strip.
+ * \param data Pointer to user-supplied data.
+ *
+ * \return Returns a pointer to the current mesh if successful or NULL if an
+ * error occurred.
+ */
+typedef RpTriStripMesh *
+(*RpTriStripMeshStripCallBack) (RpTriStripMesh *mesh, void *data);
+
+typedef struct RpTriStripData RpTriStripData;
+/**
+ * \ingroup rpmesh
+ * \struct RpTriStripData
+ * This type represents the data required by the
+ * \ref RpBuildMeshGenerateTriStrip function to tri-strip a mesh. This data must
+ * be the user-supplied data passed into RpMeshSetTriStripMethod when using
+ * \ref RpBuildMeshGenerateTriStrip.
+ *
+ * \see RpMeshGetTriStripMethod
+ * \see RpMeshSetTriStripMethod
+ * \see RpBuildMeshGenerateTriStrip
+ * \see RpTriStripMeshTunnel
+ */
+struct RpTriStripData
+{
+ RwBool ignoreWinding; /**< TRUE to ignore winding order */
+ RpTriStripMeshStripCallBack stripCB; /**< callback to tri-strip mesh */
+ void *data; /**< data to supply to callback */
+};
+
+/**
+ * \ingroup rpmesh
+ * \ref RpTriStripCostCallBack represents the callback function used by the
+ * tunnelling tri-stripper to determine the cost of a tri-strip.
+ *
+ * \param startPolygon Pointer to polygon at the start of the tri-strip.
+ * \param testFrame Value that must be written to the testFrame of all
+ * polygons in the tri-strip
+ * \param data Pointer to user-supplied data.
+ *
+ * \return Returns the cost of the tri-strip.
+ */
+typedef RwUInt32
+(*RpTriStripCostCallBack) (RpTriStripPolygon *startPolygon, RwUInt32 testFrame, void *data);
+
+typedef struct RpTriStripTunnelData RpTriStripTunnelData;
+/**
+ * \ingroup rpmesh
+ * \struct RpTriStripTunnelData
+ * This type represents the data required by the
+ * \ref RpTriStripMeshTunnel function to tri-strip a mesh. This data must
+ * be the user-supplied data in the RpTriStripData structure passed into
+ * \ref RpMeshSetTriStripMethod as the user-supplied data when using
+ * \ref RpTriStripMeshTunnel.
+ *
+ * \see RpMeshGetTriStripMethod
+ * \see RpMeshSetTriStripMethod
+ * \see RpBuildMeshGenerateTriStrip
+ * \see RpTriStripMeshTunnel
+ * \see RpTriStripDefaultCost
+ */
+struct RpTriStripTunnelData
+{
+ RwReal quality; /**< the higher the value the better the
+ output but the longer it will take;
+ values greater than 1 are unlikely to
+ be useful */
+ RwUInt32 lengthLimit; /**< the maximum tunnel length to use */
+ RpTriStripCostCallBack costCB; /**< callback to determine tri-strip cost */
+ void *data; /**< data to supply to callbacks */
+};
+
+
+
+/****************************************************************************
+ Global Variables
+ */
+
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Tri-strip manipulating functions */
+extern RpTriStripPolygon *
+RpTriStripPolygonFollowStrip(RpTriStripPolygon *curr, RpTriStripPolygon *prev);
+
+/* Callback strip costing functions */
+extern RwUInt32
+RpTriStripDefaultCost(RpTriStripPolygon *startPolygon, RwUInt32 testFrame,
+ void *data);
+
+/* Callback mesh stripping functions */
+extern RpTriStripMesh *
+RpTriStripMeshTunnel(RpTriStripMesh *mesh, void *data);
+
+extern RpTriStripMesh *
+RpTriStripMeshQuick(RpTriStripMesh *mesh, void *data);
+
+/* New callback mesh generating function */
+extern RpMeshHeader *
+RpBuildMeshGenerateTriStrip(RpBuildMesh *buildMesh, void *data);
+
+/* Old callback mesh generating functions. Probably obsolete */
+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 tri-strip 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;
+
+#if (!defined(DOXYGEN))
+struct RpLightChunkInfo
+{
+ RwReal radius; /**< radius */
+ RwReal red; /**< red */
+ RwReal green; /**< green */
+ RwReal blue; /**< blue */
+ RwReal minusCosAngle; /**< minusCosAngle */
+ RwUInt32 typeAndFlags; /**< typeAndFlags */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/* Type ID */
+#define rpLIGHT 3
+
+/* Beyond this the lights must be positioned */
+#define rpLIGHTPOSITIONINGSTART 0x80
+
+/**
+ * \ingroup rplight
+ * \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, /**<Directional Light */
+ rpLIGHTAMBIENT, /**<Ambient Light */
+
+ /* These do take part in the tie mechanism (do have position) */
+ rpLIGHTPOINT = rpLIGHTPOSITIONINGSTART, /**<Point Light */
+ rpLIGHTSPOT, /**<Spot Light */
+ rpLIGHTSPOTSOFT, /**<Soft Spot Light */
+ rpLIGHTTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpLightType RpLightType;
+
+#define rpLIGHTMINCONEANGLE ((RwReal)0.0f)
+
+#if (defined(XBOX_DRVMODEL_H))
+#define rpLIGHTMAXCONEANGLE (rwPIOVER2)
+#elif (defined(OPENGL_DRVMODEL_H))
+#define rpLIGHTMAXCONEANGLE (rwPIOVER2)
+#elif (defined(GCN_DRVMODEL_H))
+#define rpLIGHTMAXCONEANGLE (rwPIOVER2)
+#elif (defined(D3D8_DRVMODEL_H))
+#define rpLIGHTMAXCONEANGLE (rwPIOVER2)
+#else
+#define rpLIGHTMAXCONEANGLE (rwPI)
+#endif
+
+/*************/
+
+/*** FLAGS ***/
+
+/*************/
+
+/**
+ * \ingroup rplight
+ * \ref RpLightFlag defines what geometry is influenced by the light.
+ * The bit-field RpLightFlag specifies the options available for controlling the scope
+ * of a light source (see API function \ref RpLightSetFlags):*/
+enum RpLightFlag
+{
+ rpLIGHTLIGHTATOMICS = 0x01, /**<The light source illuminates all atomics in a world */
+ rpLIGHTLIGHTWORLD = 0x02, /**<The light source illuminates all static geometry in a world */
+ rpLIGHTFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpLightFlag RpLightFlag;
+
+/* rpLIGHTPRIVATENOCHROMA - turns on optimisations to do with
+ * lights which are a shade of grey
+ */
+enum rpLightPrivateFlag
+{
+ rpLIGHTPRIVATENOCHROMA = 0x01,
+ rpLIGHTPRIVATEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum rpLightPrivateFlag rpLightPrivateFlag;
+
+/*********************/
+
+
+#define RWMINUSCOSFROMTAN(_minusCosAngle, _tanAngle) \
+MACRO_START \
+{ \
+ const RwReal TanAngle2 = (_tanAngle) * (_tanAngle); \
+ const RwReal CosAngle2 = ((RwReal)1) / ( ((RwReal)1) + TanAngle2); \
+ RwReal CosAngle; \
+ rwSqrtMacro(&CosAngle, CosAngle2); \
+ (_minusCosAngle) = - CosAngle; \
+} \
+MACRO_STOP
+
+#define RWTANFROMMINUSCOS(_tanAngle, _minusCosAngle) \
+MACRO_START \
+{ \
+ const RwReal CosAngle2 = (_minusCosAngle) * (_minusCosAngle); \
+ const RwReal TanAngle2 = (((RwReal)1) - (CosAngle2)) / (CosAngle2); \
+ rwSqrtMacro(&_tanAngle, TanAngle2); \
+} \
+MACRO_STOP
+
+
+/**
+ * \ingroup rplight
+ * \struct RpLight
+ * Light object. This should be
+ * considered an opaque type. Use the RpLight API functions to access.
+ */
+typedef struct RpLight RpLight;
+
+#if (!defined(DOXYGEN))
+struct RpLight
+{
+ RwObjectHasFrame object; /**< object */
+ RwReal radius; /**< radius */
+ RwRGBAReal color; /**< color */ /* Light color */
+ RwReal minusCosAngle; /**< minusCosAngle */
+ RwLinkList WorldSectorsInLight; /**< WorldSectorsInLight */
+ RwLLLink inWorld; /**< inWorld */
+ RwUInt16 lightFrame; /**< lightFrame */
+ RwUInt16 pad;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/**
+ * \ingroup rplight
+ * \ref RpLightCallBack
+ * represents the function called from \ref RpWorldForAllLights and
+ * \ref RpWorld SectorForAllLights for all lights in a given world or world
+ * sector. This function should return a pointer to the current light to
+ * indicate success. The callback may return NULL to terminate further
+ * callbacks on the world sector.
+ *
+ * \param light Pointer to the current light in the world
+ * sector.
+ * \param data Pointer to developer-defined data structure.
+ *
+ * \return Pointer to the current light.
+ */
+typedef RpLight *(*RpLightCallBack) (RpLight * light, void *data);
+
+typedef struct RpLightTie RpLightTie;
+
+/**
+ * \ingroup rplight
+ * \struct RpLightTie
+ *
+ * RpLightTie is a linked list of lights inside world sectors. These are
+ * created when frame hierarchies are updated as part of an \ref RwCameraBeginUpdate.
+ * This is used for determining which lights influence a world sector and the atomics inside it.
+ * Creation and destruction of RpLightTies is internal to the world plugin.
+ */
+struct RpLightTie
+{
+ /* Information for an atomic sector */
+ RwLLLink lightInWorldSector; /**< Lights IN this ATOMIC SECTOR */
+ RpLight *light; /**< A pointer to a light */
+
+ /* Information for a atomic */
+ RwLLLink WorldSectorInLight; /**< Atomic sectors HOLDING this Light */
+ RpWorldSector *sect; /**< A pointer to a world sector */
+};
+
+
+/****************************************************************************
+ <macro/inline functionality
+ */
+
+#define RpLightGetRadiusMacro(_light) \
+ ((_light)->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 void RpLightSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+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 ---*/
+/*
+ * 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/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 rpgeometry
+ * 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, /**<This geometry's meshes can be
+ rendered as strips.
+ \ref RpMeshSetTriStripMethod is
+ used to change this method.*/
+ rpGEOMETRYPOSITIONS = 0x00000002, /**<This geometry has positions */
+ rpGEOMETRYTEXTURED = 0x00000004, /**<This geometry has only one set of
+ texture coordinates. Texture
+ coordinates are specified on a per
+ vertex basis */
+ rpGEOMETRYPRELIT = 0x00000008, /**<This geometry has pre-light colors */
+ rpGEOMETRYNORMALS = 0x00000010, /**<This geometry has vertex normals */
+ rpGEOMETRYLIGHT = 0x00000020, /**<This geometry will be lit */
+ rpGEOMETRYMODULATEMATERIALCOLOR = 0x00000040, /**<Modulate material color
+ with vertex colors
+ (pre-lit + lit) */
+
+ rpGEOMETRYTEXTURED2 = 0x00000080, /**<This geometry has at least 2 sets of
+ texture coordinates. */
+
+ /*
+ * These above flags were stored in the flags field in an RwObject, they
+ * are now stored in the flags file of the RpGeometry.
+ */
+
+ rpGEOMETRYNATIVE = 0x01000000,
+ rpGEOMETRYNATIVEINSTANCE = 0x02000000,
+
+ rpGEOMETRYFLAGSMASK = 0x000000FF,
+ rpGEOMETRYNATIVEFLAGSMASK = 0x0F000000,
+
+ rpGEOMETRYFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpGeometryFlag RpGeometryFlag;
+
+/* Multi texture coordinate format specifier for RpGeometryCreate() */
+#define rpGEOMETRYTEXCOORDSETS(_num) ((_num & 0xff) << 16)
+
+/**
+ * \ingroup rpgeometry
+ * RpGeometryLockMode
+ * Geometry lock flags
+ */
+enum RpGeometryLockMode
+{
+ rpGEOMETRYLOCKPOLYGONS = 0x01, /**<Lock the polygons (triangle list) */
+ rpGEOMETRYLOCKVERTICES = 0x02, /**<Lock the vertex positional data */
+ rpGEOMETRYLOCKNORMALS = 0x04, /**<Lock the vertex normal data */
+ rpGEOMETRYLOCKPRELIGHT = 0x08, /**<Lock the pre-light values */
+ rpGEOMETRYLOCKTEXCOORDS = 0x10, /**<Lock the texture coordinates set 1*/
+ rpGEOMETRYLOCKTEXCOORDS1 = 0x10, /**<Lock the texture coordinates set 1*/
+ rpGEOMETRYLOCKTEXCOORDS2 = 0x20, /**<Lock the texture coordinates set 2*/
+ rpGEOMETRYLOCKTEXCOORDS3 = 0x40, /**<Lock the texture coordinates set 3*/
+ rpGEOMETRYLOCKTEXCOORDS4 = 0x80, /**<Lock the texture coordinates set 4*/
+ rpGEOMETRYLOCKTEXCOORDS5 = 0x0100, /**<Lock the texture coordinates set 5*/
+ rpGEOMETRYLOCKTEXCOORDS6 = 0x0200, /**<Lock the texture coordinates set 6*/
+ rpGEOMETRYLOCKTEXCOORDS7 = 0x0400, /**<Lock the texture coordinates set 7*/
+ rpGEOMETRYLOCKTEXCOORDS8 = 0x0800, /**<Lock the texture coordinates set 8*/
+ rpGEOMETRYLOCKTEXCOORDSALL = 0x0ff0, /**<Lock all texture coordinate sets*/
+ rpGEOMETRYLOCKALL = 0x0fff, /**<Combination of all the above */
+
+ rpGEOMETRYLOCKMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpGeometryLockMode RpGeometryLockMode;
+
+/* Convenience macro for generating a tex coord lock flag */
+#define rpGEOMETRYLOCKTEXCOORDSIDX(_idx) (rpGEOMETRYLOCKTEXCOORDS1 << (_idx))
+
+
+/****************************************************************************
+ Global Types
+ */
+
+typedef struct rpGeometryGlobals rpGeometryGlobals;
+
+#if (!defined(DOXYGEN))
+struct rpGeometryGlobals
+{
+ RwFreeList *geomFreeList;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/**
+ * \ingroup rpgeometry
+ * \struct RpGeometry
+ * Geometry object. This should be considered an opaque type.
+ * Use the RpGeometry API functions to access.
+ */
+typedef struct RpGeometry RpGeometry;
+
+/**
+ * \ingroup rpmorphtarget
+ * \struct RpMorphTarget
+ * Morph target -- vertex positions and normals.
+ * This should be considered an opaque type.
+ * Use RpMorphTarget API functions to access.
+ */
+typedef struct RpMorphTarget RpMorphTarget;
+
+#if (!defined(DOXYGEN))
+struct RpMorphTarget
+{
+ RpGeometry *parentGeom;
+ RwSphere boundingSphere;
+ RwV3d *verts;
+ RwV3d *normals;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+typedef struct RpTriangle RpTriangle;
+
+/**
+ * \ingroup rpgeometry
+ * \struct RpTriangle
+ * This type represents a triangle in a geometry specified
+ * by three indices into the geometry's vertex list (vertIndex)
+ * together with an index in to the geometry's
+ * material list (matIndex) (see API function \ref RpGeometryGetTriangles)
+ */
+struct RpTriangle
+{
+ RwUInt16 vertIndex[3]; /**< vertex indices */
+ RwInt16 matIndex; /**< Index into material list */
+};
+
+#if (!defined(DOXYGEN))
+struct RpGeometry
+{
+ RwObject object; /* Generic type */
+
+ RwUInt32 flags; /* Geometry flags */
+
+ RwUInt16 lockedSinceLastInst; /* What has been locked since we last instanced - for re-instancing */
+ RwInt16 refCount; /* Reference count (for keeping track of atomics referencing geometry) */
+
+ RwInt32 numTriangles; /* Quantity of various things (polys, verts and morph targets) */
+ RwInt32 numVertices;
+ RwInt32 numMorphTargets;
+ RwInt32 numTexCoordSets;
+
+ RpMaterialList matList;
+
+ RpTriangle *triangles; /* The triangles */
+
+ RwRGBA *preLitLum; /* The pre-lighting values */
+
+ RwTexCoords *texCoords[rwMAXTEXTURECOORDS]; /* Texture coordinates */
+
+ RpMeshHeader *mesh; /* The mesh - groups polys of the same material */
+
+ RwResEntry *repEntry; /* Information for an instance */
+
+ RpMorphTarget *morphTarget; /* The Morph Target */
+};
+
+typedef struct RpGeometryChunkInfo RpGeometryChunkInfo;
+typedef struct RpGeometryChunkInfo _rpGeometry;
+
+struct RpGeometryChunkInfo
+{
+ RwInt32 format; /* Compression flags and number of texture coord sets */
+
+ RwInt32 numTriangles;
+ RwInt32 numVertices;
+
+ RwInt32 numMorphTargets;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/* Callbacks */
+
+/**
+ * \ingroup rpgeometry
+ * \ref RpGeometryCallBack represents the simple callback function for the \ref RpGeometry object.
+ * The callback may return NULL to terminate further callbacks on
+ * the geometry.
+ *
+ * \param geometry Pointer to the current geometry, supplied by iterator.
+ * \param data Pointer to developer-defined data structure.
+ *
+ * \return
+ */
+typedef RpGeometry *(*RpGeometryCallBack)(RpGeometry *geometry, void *data);
+
+/**
+ * \ingroup rpgeometry
+ * \ref RpGeometrySortByMaterialCallBack
+ * \ref RpGeometrySortByMaterialCallBack is used by
+ * \ref RpGeometrySortByMaterial in order to preserve the validity of plugin
+ * data when the vertices in an \ref RpGeometry are sorted (and some possibly
+ * duplicated).
+ *
+ * A vertex map table is provided to the callback - this contains, for each
+ * vertex in the new geometry, the index of the corresponding vertex in the
+ * original geometry.
+ *
+ * \param oldGeom Pointer to the source geometry.
+ * \param newGeom Pointer to the new, sorted geometry.
+ * \param remapTable Pointer to the vertex map table
+ * \param numberOfEntries Number of vertices in the new
+ * geometry (size of the map table)
+ */
+typedef void (*RpGeometrySortByMaterialCallBack)(const RpGeometry *oldGeom,
+ RpGeometry *newGeom,
+ RwUInt16 *remapTable,
+ RwUInt16 numberOfEntries);
+
+
+/****************************************************************************
+ <macro/inline functionality
+ */
+
+#define RpMorphTargetSetBoundingSphereMacro(_mt, _sphere) \
+ (RwSphereAssign(&((_mt)->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
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#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 rpatomic
+ * 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, /**<A generic collision flag to indicate
+ * that the atomic should be considered
+ * in collision tests.
+ */
+ rpATOMICRENDER = 0x04, /**<The atomic is rendered if it is
+ * in the view frustum.
+ */
+
+ rpATOMICFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpAtomicFlag RpAtomicFlag;
+
+/**
+ * \ingroup rpatomic
+ * \ref RpAtomicSetGeomFlag defines how an atomic references a new geometry
+ *
+ * \see RpAtomicSetGeometry
+ */
+enum RpAtomicSetGeomFlag
+{
+ rpATOMICSAMEBOUNDINGSPHERE = 0x01, /**<The bounding-sphere for the
+ * new geometry is assumed to be the
+ * same as the old one, if any, and
+ * should not be recalculated.
+ */
+
+ rpATOMICSETGEOMFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpAtomicSetGeomFlag RpAtomicSetGeomFlag;
+
+enum RpAtomicPrivateFlag
+{
+ rpATOMICPRIVATEWORLDBOUNDDIRTY = 0x01,
+ rpATOMICPRIVATEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpAtomicPrivateFlag rpAtomicPrivateFlag;
+
+
+/**
+ * \ingroup rpatomic
+ * \struct RpAtomic
+ * Atomic Geometry object. This should be
+ * considered an opaque type. Use the RpAtomic API functions to access.
+ */
+typedef struct RpAtomic RpAtomic;
+
+/**
+ * \ingroup rpinterpolator
+ * \struct RpInterpolator
+ * Morph Target Interpolator.
+ * This should be considered an opaque type.
+ * Use the RpInterpolator API functions to access.
+ */
+typedef struct RpInterpolator RpInterpolator;
+
+#if (!defined(DOXYGEN))
+struct RpInterpolator
+{
+ RwInt32 flags; /**< flags */
+ RwInt16 startMorphTarget; /**< startMorphTarget */
+ RwInt16 endMorphTarget; /**< endMorphTarget */
+ RwReal time; /**< time */
+ RwReal recipTime; /**< recipTime */
+ RwReal position; /**< position */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/* More callbacks */
+
+/**
+ * \ingroup rpclump
+ * \struct RpClump
+ * Clump Geometry object. This should be
+ * considered an opaque type. Use the RpClump API functions to access.
+ */
+typedef struct RpClump RpClump;
+
+/**
+ * \ingroup rpclump
+ * \ref RpClumpCallBack represents the
+ * function called from \ref RwCameraForAllClumpsInFrustum and
+ * \ref RwCameraForAllClumpsNotInFrustum when a clump lies inside the current camera's
+ * view frustum. It is also called from \ref RpWorldForAllClumps. This function should
+ * return a pointer to the current clump to indicate success. The callback may return
+ * NULL to terminate further callbacks on the clumps.
+ *
+ * \param clump Pointer to the current clump, supplied by
+ * iterator.
+ * \param data Pointer to developer-defined data structure.
+ *
+ * \return Pointer to the current clump.
+ *
+ * \see RpWorldForAllClumps
+ * \see RpClumpGetCallBack
+ * \see RpClumpSetCallBack
+ * \see RwCameraForAllClumpsInFrustum
+ * \see RwCameraForAllClumpsNotInFrustum
+ */
+typedef RpClump *(*RpClumpCallBack) (RpClump * clump, void *data);
+
+#if (!defined(DOXYGEN))
+struct RpClump
+{
+ RwObject object;
+
+ /* Information about all the Atomics */
+ RwLinkList atomicList;
+
+ /* Lists of lights and cameras */
+ RwLinkList lightList;
+ RwLinkList cameraList;
+
+ /* The clump in the world */
+ RwLLLink inWorldLink;
+
+ /* Clump callback */
+ RpClumpCallBack callback;
+
+ /* Render frame - used to prevent multiple invocations
+ * of the clump frustum callback
+ */
+ RwUInt16 renderFrame;
+ RwUInt16 pad;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/**
+ * \ingroup rpatomic
+ * \ref RpAtomicCallBackRender represents the function called from
+ * \ref RpAtomicRender when the specified atomic
+ * lies inside the current camera's view frustum. The default callback
+ * initiates execution of the atomic rendering pipeline. This function should
+ * return a pointer to the atomic to indicate success.
+ *
+ * \param atomic Pointer to the current atomic, supplied by
+ * iterator.
+ *
+ * \return Returns a pointer to the atomic to indicate success.
+ *
+ * \see RpAtomicRender
+ */
+
+typedef RpAtomic *(*RpAtomicCallBackRender) (RpAtomic * atomic);
+
+#if (!defined(DOXYGEN))
+struct RpAtomic
+{
+ RwObjectHasFrame object;
+
+ /* Information for an instance */
+ RwResEntry *repEntry;
+
+ /* Triangles making the object */
+ RpGeometry *geometry;
+
+ /* Interpolated bounding sphere (in object space and world space) */
+ RwSphere boundingSphere;
+ RwSphere worldBoundingSphere;
+
+ /* Connections to other atomics */
+ RpClump *clump;
+ RwLLLink inClumpLink;
+
+ /* callbacks */
+ RpAtomicCallBackRender renderCallBack;
+
+ /* Interpolation animation pointer */
+ RpInterpolator interpolator;
+
+ /* Counter for checks of "render has occurred already" */
+ RwUInt16 renderFrame;
+ RwUInt16 pad;
+
+ /* Connections to sectors */
+ RwLinkList llWorldSectorsInAtomic;
+
+ /* The Atomic object pipeline for this Atomic */
+ RxPipeline *pipeline;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/**
+ * \ingroup rpatomic
+ * \ref RpAtomicCallBack represents the function called from \ref RpWorldSectorForAllAtomics and
+ * \ref RpClumpForAllAtomics for all atomics in a given world sector or clump.
+ * This function should return a pointer to the current atomic to indicate
+ * success. The callback may return NULL to terminate further callbacks on
+ * the world sector.
+ *
+ * \param atomic Pointer to the current atomic, supplied by
+ * iterator.
+ * \param data Pointer to developer-defined data structure.
+ *
+ * \return Returns a pointer to the current atomic
+ */
+typedef RpAtomic *(*RpAtomicCallBack) (RpAtomic * atomic, void *data);
+
+typedef struct RpTie RpTie;
+
+/**
+ * \ingroup rpatomic
+ * \struct RpTie
+ *
+ * RpTie is a linked list of atomics inside world sectors. These are
+ * created when frame hierarchies are updated as part of an \ref RwCameraBeginUpdate.
+ * This is used for frustum culling atomics by world sector.
+ * Creation and destruction of RpTies is internal to the world plugin.
+ */
+struct RpTie
+{
+ /* Information for an atomic sector */
+ RwLLLink lAtomicInWorldSector; /**< Atomics IN this ATOMIC SECTOR */
+ RpAtomic *apAtom; /**< An atomic */
+
+ /* Information for a atomic */
+ RwLLLink lWorldSectorInAtomic; /**< Atomic sectors HOLDING this atomic */
+ RpWorldSector *worldSector; /**< A world sector */
+};
+
+typedef struct RpClumpChunkInfo RpClumpChunkInfo;
+typedef struct RpClumpChunkInfo _rpClump;
+typedef struct RpClumpChunkInfo33000 _rpClump33000;
+
+#if (!defined(DOXYGEN))
+struct RpClumpChunkInfo
+{
+ RwInt32 numAtomics;
+ RwInt32 numLights;
+ RwInt32 numCameras;
+};
+
+struct RpClumpChunkInfo33000
+{
+ RwInt32 numAtomics;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/****************************************************************************
+ <macro/inline functionality
+
+ */
+
+/* NB "RpAtomicRender(atom++) will break it */
+#define RpAtomicRenderMacro(_atomic) \
+ ((_atomic)->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 */
+
+
+extern void
+RpAtomicSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern void
+RpClumpSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+/* 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 rpworldsub
+ * 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, /**<This world's meshes can be rendered
+ as tri strips */
+ rpWORLDPOSITIONS = 0x02, /**<This world has positions */
+ rpWORLDTEXTURED = 0x04, /**<This world has only one set of texture coordinates */
+ rpWORLDPRELIT = 0x08, /**<This world has luminance values */
+ rpWORLDNORMALS = 0x10, /**<This world has normals */
+ rpWORLDLIGHT = 0x20, /**<This world will be lit */
+ rpWORLDMODULATEMATERIALCOLOR = 0x40,
+ /**<Modulate material color with vertex colors
+ (pre-lit + lit) */
+ rpWORLDTEXTURED2 = 0x80, /**<This world has 2 or more sets of texture coordinates */
+
+ /*
+ * These above flags were stored in the flags field in an RwObject, they
+ * are now stored in the flags file of the RpWorld.
+ */
+
+ rpWORLDNATIVE = 0x01000000,
+ rpWORLDNATIVEINSTANCE = 0x02000000,
+
+ rpWORLDFLAGSMASK = 0x000000FF,
+ rpWORLDNATIVEFLAGSMASK = 0x0F000000,
+
+ rpWORLDSECTORSOVERLAP = 0x40000000,
+
+ rpWORLDFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpWorldFlag RpWorldFlag;
+
+/* Multi texture coordinate format specifier */
+#define rpWORLDTEXCOORDSETS(_num) ((_num & 0xff) << 16)
+
+/* Maximum depth of BSP tree */
+#define rpWORLDMAXBSPDEPTH 64
+
+
+/* macro/inline functionality */
+#define RpWorldGetBBoxMacro(_world) \
+ (&((_world)->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 rpworldsub
+ * \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, /**<Renders nearest sectors first */
+ rpWORLDRENDERBACK2FRONT, /**<Renders furthest sectors first */
+ rpWORLDRENDERORDERFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RpWorldRenderOrder RpWorldRenderOrder;
+
+/**
+ * \ingroup rpworldsector
+ * \ref RpWorldSectorCallBackRender represents the function called from
+ * \ref RpWorldSectorRender when the specified world sector lies inside the
+ * current camera's view frustum. The default callback initiates execution of
+ * the world sector rendering pipeline. This function should return a pointer
+ * to the world sector to indicate success
+ *
+ * \param worldSector Pointer to the world sector to be
+ * rendered
+ *
+ * \return Pointer to the world sector.
+ *
+ */
+typedef RpWorldSector *(*RpWorldSectorCallBackRender) (RpWorldSector *
+ worldSector);
+
+/**
+ * \ingroup rpworldsub
+ * \struct RpWorld
+ * World object. This should be considered an opaque type.
+ * Use the RpWorld API functions to access.
+ */
+typedef struct RpWorld RpWorld;
+
+#if (!defined(DOXYGEN))
+struct RpWorld
+{
+ RwObject object;
+
+ RwUInt32 flags;
+
+ RpWorldRenderOrder renderOrder;
+
+ /* Materials */
+ RpMaterialList matList;
+
+ /* The world stored as a BSP tree */
+ RpSector *rootSector;
+
+ /* The number of texture coordinate sets in each sector */
+ RwInt32 numTexCoordSets;
+
+ /* Render frame used when last rendered */
+ RwInt32 numClumpsInWorld;
+ RwLLLink *currentClumpLink;
+
+ /* All the clumps in the world */
+ RwLinkList clumpList;
+
+ /* All of the lights in the world */
+ RwLinkList lightList;
+
+ /* Directional lights in the world */
+ RwLinkList directionalLightList;
+
+ /* The worlds origin offset */
+ RwV3d worldOrigin;
+
+ /* Bounding box around the whole world */
+ RwBBox boundingBox;
+
+ /* The callbacks functions */
+ RpWorldSectorCallBackRender renderCallBack;
+
+ RxPipeline *pipeline;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/****************************************************************************
+ Global Variables
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwPluginRegistry worldTKList;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwBool _rpWorldFindBBox(RpWorld * world,
+ RwBBox * boundingBox);
+
+/* Generate sector bounding boxes from BSP planes (not tight boxes) */
+extern RpWorld *_rpWorldSetupSectorBoundingBoxes(RpWorld *world);
+
+
+/* These stealth-API */
+extern RwBool _rpWorldForAllGlobalLights(RpLightCallBack callBack,
+ void *pData);
+extern RpWorldSector *_rpWorldSectorForAllLocalLights(RpWorldSector *
+ sector,
+ RpLightCallBack
+ callBack,
+ void *pData);
+
+extern RpWorldSector *_rpSectorDefaultRenderCallBack(RpWorldSector *
+ sector);
+
+/* Accessing worlds geometry */
+extern RpWorld *RpWorldLock(RpWorld * world);
+extern RpWorld *RpWorldUnlock(RpWorld * world);
+
+/* Managing a list of the worlds */
+extern void _rpWorldRegisterWorld(RpWorld * world,
+ RwUInt32 memorySize);
+extern void _rpWorldUnregisterWorld(RpWorld * world);
+
+/* Hook into world management */
+extern RwBool RpWorldPluginAttach(void);
+
+/* Enumerating objects in the world */
+extern RpWorld *RpWorldForAllClumps(RpWorld * world,
+ RpClumpCallBack fpCallBack,
+ void *pData);
+extern RpWorld *RpWorldForAllMaterials(RpWorld * world,
+ RpMaterialCallBack fpCallBack,
+ void *pData);
+extern RpWorld *RpWorldForAllLights(RpWorld * world,
+ RpLightCallBack fpCallBack,
+ void *pData);
+extern RpWorld *RpWorldForAllWorldSectors(RpWorld * world,
+ RpWorldSectorCallBack
+ fpCallBack, void *pData);
+
+/* Rendering */
+extern RpWorld *RpWorldRender(RpWorld * world);
+
+/* Creation/destruction */
+extern RwBool RpWorldDestroy(RpWorld * world);
+extern RpWorld *RpWorldCreate(RwBBox * boundingBox);
+extern RwBool RpWorldInstance(RpWorld *world);
+
+/* Sector callbacks */
+extern RpWorld *RpWorldSetSectorRenderCallBack(RpWorld * world,
+ RpWorldSectorCallBackRender
+ fpCallBack);
+extern RpWorldSectorCallBackRender RpWorldGetSectorRenderCallBack(const
+ RpWorld
+ *
+ world);
+
+/* Getting world from sector */
+extern RpWorld *RpWorldSectorGetWorld(const RpWorldSector * sector);
+
+extern RwInt32 RpWorldRegisterPlugin(RwInt32 size, RwUInt32 pluginID,
+ RwPluginObjectConstructor
+ constructCB,
+ RwPluginObjectDestructor
+ destructCB,
+ RwPluginObjectCopy copyCB);
+extern RwInt32 RpWorldRegisterPluginStream(RwUInt32 pluginID,
+ RwPluginDataChunkReadCallBack
+ readCB,
+ RwPluginDataChunkWriteCallBack
+ writeCB,
+ RwPluginDataChunkGetSizeCallBack
+ getSizeCB);
+extern RwInt32 RpWorldSetStreamAlwaysCallBack(
+ RwUInt32 pluginID,
+ RwPluginDataChunkAlwaysCallBack alwaysCB);
+extern RwInt32 RpWorldSetStreamRightsCallBack(RwUInt32 pluginID,
+ RwPluginDataChunkRightsCallBack rightsCB);
+extern RwInt32 RpWorldGetPluginOffset(RwUInt32 pluginID);
+extern RwBool RpWorldValidatePlugins(RpWorld * world);
+
+
+#if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE))
+
+/* Getting/setting */
+extern const RwBBox *RpWorldGetBBox(const RpWorld *world);
+extern const RwV3d *RpWorldGetOrigin(const RpWorld *world);
+
+/* Accessing a worlds materials */
+extern RwInt32 RpWorldGetNumMaterials(const RpWorld *world);
+extern RpMaterial *RpWorldGetMaterial(const RpWorld *world, RwInt32 matNum);
+
+/* Clumps */
+extern RwInt32 RpWorldGetNumClumps(RpWorld *world);
+
+/* Render order */
+extern RpWorld *RpWorldSetRenderOrder(RpWorld *world,
+ RpWorldRenderOrder renderOrder);
+extern RpWorldRenderOrder RpWorldGetRenderOrder(const RpWorld *world);
+
+/* Flags */
+extern RpWorld *RpWorldSetFlags(RpWorld *world, RwUInt32 flags);
+extern RwUInt32 RpWorldGetFlags(const RpWorld *world);
+
+#endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#define rpWorldFindBBox(_world, _boundingBox) \
+ _rpWorldFindBBox(_world, _boundingBox)
+
+#define rpWorldForAllGlobalLights(_callBack, _pData) \
+ _rpWorldForAllGlobalLights(_callBack, _pData)
+
+#define rpWorldSectorForAllLocalLights(_sector, _callBack, _pData) \
+ _rpWorldSectorForAllLocalLights(_sector, _callBack, _pData)
+
+#define _rpWorldLock(_world) \
+ RpWorldLock(_world)
+
+#define _rpWorldUnlock(_world) \
+ RpWorldUnlock(_world)
+
+#define rpWorldLock(_world) \
+ RpWorldLock(_world)
+
+#define rpWorldUnlock(_world) \
+ RpWorldUnlock(_world)
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/d3d8/D3D8pipe.h ---*/
+
+typedef struct RxD3D8ResEntryHeader RxD3D8ResEntryHeader;
+/**
+ * \ingroup worldextensionsd3d8
+ * \struct RxD3D8ResEntryHeader
+ * This structure contains D3D8 resource specific components.
+ */
+struct RxD3D8ResEntryHeader
+{
+ RwUInt16 serialNumber; /**< The mesh headers serial number */
+ RwUInt16 numMeshes; /**< The number of meshes */
+};
+
+/* This is what I keep in memory as part of the instance data setup */
+typedef struct RxD3D8InstanceData RxD3D8InstanceData;
+/**
+ * \ingroup worldextensionsd3d8
+ * \struct RxD3D8InstanceData
+ * This structure contains D3D8 resource specific components.
+ */
+struct RxD3D8InstanceData
+{
+ RwUInt32 minVert; /**< The vertex index where the
+ meshes vertices begin. Needed for
+ reinstancing, not for rendering */
+
+ RwInt32 stride; /**< Stride of vertex */
+
+ RwInt32 numVertices; /**< Number of vertices in the vertex buffer */
+ RwInt32 numIndices; /**< Number of indices to render the primitive */
+
+ RpMaterial *material; /**< The material for this instanced data */
+
+ RwUInt32 vertexShader; /**< Vertex shader or FVF flags */
+
+ RwUInt32 primType; /**< Primitive type */
+
+ void *indexBuffer; /**< Index buffer */
+ void *vertexBuffer; /**< Vertex buffer */
+
+ RwUInt32 baseIndex; /**< Needed if we share the vertex buffer */
+
+ RwUInt8 vertexAlpha; /**< The prelight data contains alpha */
+ RwUInt8 managed; /**< Created by the Vertex Buffer Manager */
+ RwUInt8 remapped; /**< Vertices where remapped to save VB space */
+};
+
+/**
+ * \ingroup worldextensionsd3d8
+ * \ref RxD3D8AllInOneInstanceCallBack callback function.
+ *
+ * \param object Pointer to the object.
+ * \param instancedData Pointer to \ref RxD3D8InstanceData.
+ * \param reinstance Boolean whether to reinstance.
+ *
+ * \see RxD3D8AllInOneSetInstanceCallBack
+ * \see RxD3D8AllInOneGetInstanceCallBack
+ * \see RxNodeDefinitionGetD3D8AtomicAllInOne
+ * \see RxNodeDefinitionGetD3D8WorldSectorAllInOne
+ */
+typedef RwBool (*RxD3D8AllInOneInstanceCallBack)(void *object,
+ RxD3D8InstanceData *instancedData,
+ RwBool reinstance);
+
+/**
+ * \ingroup worldextensionsd3d8
+ * \ref RxD3D8AllInOneReinstanceCallBack callback function.
+ *
+ * \param object Pointer to the object.
+ * \param meshHeader Const pointer to \ref RpMeshHeader.
+ * \param resEntry Pointer to \ref RxD3D8ResEntryHeader.
+ * \param instanceCallback Pointer to \ref RxD3D8AllInOneInstanceCallBack.
+ *
+ * \see RxD3D8AllInOneSetReinstanceCallBack
+ * \see RxD3D8AllInOneGetReinstanceCallBack
+ * \see RxNodeDefinitionGetD3D8AtomicAllInOne
+ * \see RxNodeDefinitionGetD3D8WorldSectorAllInOne
+ */
+typedef RwBool (*RxD3D8AllInOneReinstanceCallBack)(void *object,
+ RwResEntry *resEntry,
+ const RpMeshHeader *meshHeader,
+ RxD3D8AllInOneInstanceCallBack instanceCallback);
+
+/**
+ * \ingroup worldextensionsd3d8
+ * \ref RxD3D8AllInOneLightingCallBack callback function.
+ *
+ * \param object Void pointer to the object.
+ *
+ * \see RxD3D8AllInOneSetLightingCallBack
+ * \see RxD3D8AllInOneGetLightingCallBack
+ * \see RxNodeDefinitionGetD3D8AtomicAllInOne
+ * \see RxNodeDefinitionGetD3D8WorldSectorAllInOne
+ */
+typedef void (*RxD3D8AllInOneLightingCallBack)(void *object);
+
+/**
+ * \ingroup worldextensionsd3d8
+ * \ref RxD3D8AllInOneRenderCallBack callback function.
+ *
+ * \param repEntry Pointer to a resource entry.
+ * \param object Pointer to a object that the resource entry belongs to.
+ * \param type rpATOMIC or rwSECTORATOMIC.
+ * \param flags \ref RpGeometryFlag's or \ref RpWorldFlag's.
+ *
+ * \see RxD3D8AllInOneSetRenderCallBack
+ * \see RxD3D8AllInOneGetRenderCallBack
+ * \see RxNodeDefinitionGetD3D8AtomicAllInOne
+ * \see RxNodeDefinitionGetD3D8WorldSectorAllInOne
+ */
+typedef void (*RxD3D8AllInOneRenderCallBack)(RwResEntry *repEntry,
+ void *object,
+ RwUInt8 type,
+ RwUInt32 flags);
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+extern void
+RxD3D8AllInOneSetInstanceCallBack(RxPipelineNode *node,
+ RxD3D8AllInOneInstanceCallBack callback);
+
+extern RxD3D8AllInOneInstanceCallBack
+RxD3D8AllInOneGetInstanceCallBack(RxPipelineNode *node);
+
+extern void
+RxD3D8AllInOneSetReinstanceCallBack(RxPipelineNode *node,
+ RxD3D8AllInOneReinstanceCallBack callback);
+
+extern RxD3D8AllInOneReinstanceCallBack
+RxD3D8AllInOneGetReinstanceCallBack(RxPipelineNode *node);
+
+extern void
+RxD3D8AllInOneSetLightingCallBack(RxPipelineNode *node,
+ RxD3D8AllInOneLightingCallBack callback);
+
+extern RxD3D8AllInOneLightingCallBack
+RxD3D8AllInOneGetLightingCallBack(RxPipelineNode *node);
+
+extern void
+RxD3D8AllInOneSetRenderCallBack(RxPipelineNode *node,
+ RxD3D8AllInOneRenderCallBack callback);
+
+extern RxD3D8AllInOneRenderCallBack
+RxD3D8AllInOneGetRenderCallBack(RxPipelineNode *node);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/bapipew.h ---*/
+
+#define RpWorldGetDefaultSectorPipelineMacro() \
+ (RXPIPELINEGLOBAL(currentWorldSectorPipeline))
+
+#define RpWorldSetSectorPipelineMacro(_world, _pipeline) \
+ ( ((_world)->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 RpAtomicGetDefaultPipelineMacro() \
+ (RXPIPELINEGLOBAL(currentAtomicPipeline))
+
+#define RpAtomicSetPipelineMacro(_atomic, _pipeline) \
+ ( ((_atomic)->pipeline = _pipeline), _atomic )
+
+#define RpAtomicGetPipelineMacro(_atomic, _pipeline) \
+ ( (*(_pipeline) = (_atomic)->pipeline), _atomic )
+
+#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 RpWorldGetDefaultSectorPipeline RpWorldGetDefaultSectorPipelineMacro
+#define RpWorldSetSectorPipeline RpWorldSetSectorPipelineMacro
+#define RpWorldGetSectorPipeline RpWorldGetSectorPipelineMacro
+#define RpWorldSectorSetPipeline RpWorldSectorSetPipelineMacro
+#define RpWorldSectorGetPipeline RpWorldSectorGetPipelineMacro
+
+#define RpAtomicGetDefaultPipeline RpAtomicGetDefaultPipelineMacro
+#define RpAtomicSetPipeline RpAtomicSetPipelineMacro
+#define RpAtomicGetPipeline RpAtomicGetPipelineMacro
+
+#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 RpWorldSetDefaultSectorInstancePipeline RpWorldSetDefaultSectorPipeline
+#define RpWorldGetDefaultSectorInstancePipeline RpWorldGetDefaultSectorPipeline
+#define RpWorldSetSectorInstancePipeline RpWorldSetSectorPipeline
+#define RpWorldGetSectorInstancePipeline RpWorldGetSectorPipeline
+#define RpWorldSectorSetInstancePipeline RpWorldSectorSetPipeline
+#define RpWorldSectorGetInstancePipeline RpWorldSectorGetPipeline
+
+#define RpAtomicGetDefaultInstancePipeline RpAtomicGetDefaultPipeline
+#define RpAtomicSetDefaultInstancePipeline RpAtomicSetDefaultPipeline
+#define RpAtomicSetInstancePipeline RpAtomicSetPipeline
+#define RpAtomicGetInstancePipeline RpAtomicGetPipeline
+
+#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 */
+
+extern void RpTieSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+extern void RpLightTieSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+/* 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;
+
+#if (!defined(DOXYGEN))
+struct RpWorldChunkInfoSector
+{
+ RwInt32 matListWindowBase;
+ RwInt32 numPolygons;
+ RwInt32 numVertices;
+ RwV3d inf;
+ RwV3d sup;
+ RwBool collSectorPresent; /* unused but retains same struct size */
+ 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;
+
+ RwInt32 numPolygons;
+ RwInt32 numVertices;
+ RwInt32 numPlaneSectors;
+ RwInt32 numWorldSectors;
+ RwInt32 colSectorSize;
+
+ RwInt32 format; /* Flags about the world */
+
+ /* Added in 34003 */
+ RwBBox boundingBox;
+};
+
+typedef struct rpWorldChunkInfo34000 rpWorldChunkInfo34000;
+
+struct rpWorldChunkInfo34000
+{
+ RwBool rootIsWorldSector;
+
+ RwV3d invWorldOrigin;
+
+ RwSurfaceProperties surfaceProps;
+
+ RwInt32 numPolygons;
+ RwInt32 numVertices;
+ RwInt32 numPlaneSectors;
+ RwInt32 numWorldSectors;
+ RwInt32 colSectorSize;
+
+ RwInt32 format; /* Flags about the world */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/****************************************************************************
+ 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 */
diff --git a/sdk/rwsdk/include/d3d8/rpworld.rpe b/sdk/rwsdk/include/d3d8/rpworld.rpe
new file mode 100644
index 00000000..080eefa5
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rpworld.rpe
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionWorld
+{
+
+
+E_RP_WORLD_INVSPHERE,
+
+E_RP_WORLD_INVINTERSECTION,
+
+E_RP_WORLD_MATRANGE,
+
+E_RP_WORLD_CLUMPINWORLD,
+
+E_RP_WORLD_CLUMPNOTINWORLD,
+
+E_RP_WORLD_ATOMICNOFRAME,
+
+E_RP_WORLD_TOOMANYVERTICES,
+
+ e_rwdb_CriterionWorldLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionWorld e_rwdb_CriterionWorld;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rt2d.h b/sdk/rwsdk/include/d3d8/rt2d.h
new file mode 100644
index 00000000..0584d3a5
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rt2d.h
@@ -0,0 +1,1028 @@
+/*
+ * Data structures for 2d toolkit
+ *
+ * Copyright (c) Criterion Software Limited
+ */
+
+/***************************************************************************
+ * *
+ * Module : rt2d.h *
+ * *
+ * Purpose : *
+ * *
+ **************************************************************************/
+
+#ifndef RT2D_H
+#define RT2D_H
+
+/**
+ * \defgroup rt2d Rt2d
+ * \ingroup 2dtools
+ *
+ * 2D Rendering Toolkit for RenderWare.
+ */
+
+/**
+ * \defgroup rt2ddatatypes Data Types
+ * \ingroup rt2d
+ *
+ * Basic Data Types
+ */
+
+/**
+ * \defgroup rt2dsub Rt2d
+ * \ingroup rt2d
+ *
+ * Rt2d functions
+ */
+
+/**
+ * \defgroup rt2dbrush Rt2dBrush
+ * \ingroup rt2d
+ *
+ * Brush functions
+ */
+
+/**
+ * \defgroup rt2dctm Rt2dCTM
+ * \ingroup rt2d
+ *
+ * Current Transformation Matrix (CTM)
+ */
+
+/**
+ * \defgroup rt2ddevice Rt2dDevice
+ * \ingroup rt2d
+ *
+ * Camera device functions
+ */
+
+/**
+ * \defgroup rt2dfont Rt2dFont
+ * \ingroup rt2d
+ *
+ * Font functions
+ */
+
+/**
+ * \defgroup rt2dobject Rt2dObject
+ * \ingroup rt2d
+ *
+ * Objects
+ */
+
+/**
+ * \defgroup rt2dobjectstring Rt2dObjectString
+ * \ingroup rt2d
+ *
+ * String functions
+ */
+
+/**
+ * \defgroup rt2dpath Rt2dPath
+ * \ingroup rt2d
+ *
+ * Path functions
+ */
+
+/**
+ * \defgroup rt2dpickregion Rt2dPickRegion
+ * \ingroup rt2d
+ *
+ * Pick regions
+ */
+
+/**
+ * \defgroup rt2dscene Rt2dScene
+ * \ingroup rt2d
+ *
+ * Scenes
+ */
+
+/**
+ * \defgroup rt2dshape Rt2dShape
+ * \ingroup rt2d
+ *
+ * Shapes
+ */
+
+/**
+ * \defgroup rt2drwv2d RwV2d
+ * \ingroup rt2d
+ *
+ * Rt2d plugin directly extends the Core Library's RwV2d API functions.
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+#include "rpworld.h"
+#include "rt2d.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Defines
+ */
+
+#define Rt2dBrushSetWidthMacro(_brush, _width) \
+ ( ( (_brush)->halfwidth = ((_width) * 0.5f) ), (_brush) )
+
+#define Rt2dBrushGetWidthMacro(_brush) \
+ ( (_brush)->halfwidth * 2.0f )
+
+#define Rt2dCTMReadMacro(_result) \
+ (RwMatrixCopy((_result), _rt2dCTMGet()), (_result))
+
+#if defined (GCN_DRVMODEL_H)
+ #define VERTEXCACHESIZE 64
+#else
+ #define VERTEXCACHESIZE 256
+#endif
+
+
+/****************************************************************************
+ Global Types
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/*
+ * rt2dShadeParameters
+ * typedef for a structure describing Shade Parameters
+ */
+typedef struct rt2dShadeParameters rt2dShadeParameters;
+
+/*
+ *
+ * rt2dShadeParameters
+ * describes Shade Parameters
+ */
+
+#if (!defined(DOXYGEN))
+struct rt2dShadeParameters
+{
+ RwRGBAReal col; /* col */
+ RwV2d uv; /* uv */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/**
+ * \ingroup rt2ddatatypes
+ * \struct Rt2dBrush
+ * Brush object.
+ * This should be considered an opaque type.
+ * Use Rt2dBrush API functions to access.
+ */
+typedef struct Rt2dBrush Rt2dBrush;
+
+/*
+ * Rt2dBrush
+ * structure describing a Brush
+ */
+#if (!defined(DOXYGEN))
+struct Rt2dBrush
+{
+ rt2dShadeParameters top;
+ rt2dShadeParameters dtop;
+ rt2dShadeParameters bottom;
+ rt2dShadeParameters dbottom;
+ RwRGBA colorCache;
+ RwInt32 flag;
+ RwTexture *texture;
+ RpMaterial *material;
+ RwReal halfwidth;
+ RwInt32 refCount;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/**
+ * \ingroup rt2ddatatypes
+ * \struct Rt2dPath
+ * Path object.
+ * This should be considered an opaque type.
+ * Use Rt2dPath API functions to access.
+ */
+typedef struct Rt2dPath Rt2dPath;
+
+/**
+ * \ingroup rt2ddatatypes
+ * \struct Rt2dFont
+ * Font object.
+ * This should be considered an opaque type.
+ * Use Rt2dFont API functions to access.
+ */
+typedef struct Rt2dFont Rt2dFont;
+
+/*
+ * typedef used for referencing a spot in a font dictionary
+ */
+typedef struct _rt2dFontDictionaryNode _rt2dFontDictionaryNode;
+
+
+typedef struct Rt2dBBox Rt2dBBox;
+/**
+* \ingroup rt2ddatatypes
+ * \struct Rt2dBBox
+ * structure describing a Bounding Box
+ */
+struct Rt2dBBox
+{
+ RwReal x; /**< x-coordinate of lower-left corner */
+ RwReal y; /**< y-coordinate of lower-left corner */
+ RwReal w; /**< Width */
+ RwReal h; /**< Height */
+};
+
+/**
+ * \ingroup rt2ddatatypes
+ * \struct Rt2dObject
+ * Structure describing a 2d Object
+ * This should be considered an opaque type.
+ * Use Rt2dObject, Rt2dScene, Rt2dShape, Rt2dPickRegion or Rt2dObjectString
+ * API functions to access.
+ */
+typedef struct Rt2dObject Rt2dObject;
+
+/*
+ * typedef for a structure describing a scene of shapes (opaque)
+ */
+typedef struct _rt2dScene _rt2dScene;
+
+/*
+ * typedef for a structure describing the depth of an object
+ */
+typedef struct _rt2dDepthOfObject _rt2dDepthOfObject;
+
+#if (!defined(DOXYGEN))
+/*
+ * typedef for a structure describing the depth of an object
+ */
+struct _rt2dDepthOfObject
+{
+ Rt2dObject *object;
+ RwInt32 depth;
+};
+
+/*
+ * structure describing a scene of shapes
+ */
+struct _rt2dScene
+{
+ RwSList *objects; /* collection of objects in scene */
+ RwInt32 objectCount; /* number of objects */
+ RwSList *depths; /* depths for depthsort */
+ RwBool isDirtyDepths; /* depthsort needs updating */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/*
+ * typedef for a structure describing a shape (opaque)
+ */
+typedef struct _rt2dShape _rt2dShape;
+
+#if (!defined(DOXYGEN))
+typedef struct _rt2dShapeRep _rt2dShapeRep;
+struct _rt2dShapeRep
+{
+ RwSList *nodes; /* individual stroked/filled regions of the shape */
+ RwUInt32 refCount; /* number of shapes referencing this rep */
+ RpGeometry *geometry; /* Shareable geometry */
+};
+
+extern _rt2dShapeRep *
+ _rt2dShapeRepCreate();
+
+extern RwBool
+_rt2dShapeRepDestroy(_rt2dShapeRep *);
+
+extern RwUInt32
+_rt2dShapeRepAddRef(_rt2dShapeRep *);
+
+typedef struct _rt2dSceneResourcePool _rt2dSceneResourcePool;
+struct _rt2dSceneResourcePool
+{
+ _rt2dShapeRep **shapeReps;
+ RwUInt32 numShapeReps;
+};
+
+extern RwBool
+_rt2dSceneResourcePoolFindShapeRep(const _rt2dSceneResourcePool * pool,
+ const _rt2dShapeRep * rep, RwInt32 * npIndex);
+
+struct _rt2dShape
+{
+ _rt2dShapeRep *rep;
+ RwRGBA *colorCache; /* Shape's color cache */
+ RpAtomic *atomic; /* Atomic repn */
+};
+
+/*
+ * typedef for a structure describing a pick region that can be tested for point inclusion (opaque)
+ */
+typedef struct _rt2dPickRegion _rt2dPickRegion;
+
+/*
+ * structure describing a pick region that can be tested for point inclusion
+ */
+struct _rt2dPickRegion
+{
+ Rt2dPath *path; /* path that defines region for testing */
+ Rt2dBBox bbox; /* bounding box of path */
+ RwMatrix transformation;
+ /* ivnert transformation used to place the pick region */
+};
+
+/*
+ * structure describing a renderable text string
+ */
+
+struct _rt2dObjectString
+{
+ RwChar *textString; /* Text string to be rendered */
+ Rt2dBrush *brush; /* Brush to be used to draw text */
+ RwInt32 maxLength; /* Maximum string length before reallocation, excluding null */
+ RwReal height; /* Font rendering Height */
+ _rt2dFontDictionaryNode *font; /* Dictionary node identifying font to be used */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/*
+ * typedef for a renderable string
+ */
+typedef struct _rt2dObjectString _rt2dObjectString;
+/**
+ * \ingroup rt2ddatatypes
+ * \ref Rt2dObjectTypeEnum
+ * enumeration describing types of Rt2dObject
+ */
+enum Rt2dObjectTypeEnum {
+ rt2DOBJECTTYPEOBJECT=0, /**<An untyped (yet) object */
+ rt2DOBJECTTYPESCENE, /**<Container of objects */
+ rt2DOBJECTTYPESHAPE, /**<Shape object */
+ rt2DOBJECTTYPEPICKREGION, /**<Pick region object */
+ rt2DOBJECTTYPEOBJECTSTRING, /**<Text string object */
+ rt2DOBJECTTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT /* Ensures sizeof(enum) == sizeof(RwInt32)) */
+};
+
+typedef union _rt2dObjectdata _rt2dObjectdata;
+
+#if (!defined(DOXYGEN))
+union _rt2dObjectdata
+{
+ _rt2dShape shape;
+ _rt2dScene scene;
+ _rt2dPickRegion pickRegion;
+ _rt2dObjectString objectString;
+};
+
+/*
+ * A base structure for forming a hierarchy of 2D shapes
+ */
+
+#define Rt2dObjectIsLocked 0x00000001
+#define Rt2dObjectDirtyLTM 0x00000002
+#define Rt2dObjectVisible 0x00000004
+#define Rt2dObjectDirtyColor 0x00000008
+
+#define Rt2dObjectStringGotNoFonts 0x01000000
+
+struct Rt2dObject
+{
+ RwInt32 type; /* tag identifying type of object */
+ RwInt32 depth; /* z-order of object under parent */
+ RwInt32 flag; /* ... */
+ RwMatrix MTM; /* local transformation matrix for object */
+ RwMatrix LTM; /* global transformation matrix for object */
+ RwRGBAReal colorMult; /* color multiply applied to object */
+ RwRGBAReal colorOffs; /* color offset applied to object */
+ _rt2dObjectdata data;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+
+/**
+ * \ingroup rt2ddatatypes
+ * \ref Rt2dObjectCallBack
+ * typedef for a callback on an object in a collection
+ *
+ * \param object is a specific object
+ * \param parent is the containing scene
+ * \param data is user data
+ *
+ * \return return value is ignored
+ */
+typedef Rt2dObject *(* Rt2dObjectCallBack)(Rt2dObject *object, Rt2dObject *parent, void *data);
+
+/**
+ * \ingroup rt2ddatatypes
+ * \ref Rt2dFontCallBackRead
+ * Rt2dFontCallBackRead represents the function used by Rt2dFontRead to read
+ * the specified font from a disk file. This function should return a
+ * pointer to the font to indicate success. The returned font is owned by
+ * the Rt2d internal font dictionary, and is destroyed on calling
+ * \ref Rt2dClose
+ *
+ * \param name is the name of the font to read
+ *
+ * \return return the font if successful, NULL otherwise
+ *
+ * \see Rt2dFontSetReadCallBack
+ * \see Rt2dFontGetReadCallBack
+ */
+typedef Rt2dFont*(* Rt2dFontCallBackRead)(const RwChar *name);
+
+/**
+ * \ingroup rt2ddatatypes
+ * \ref Rt2dJustificationType
+ * enumeration describing Justification
+ */
+enum Rt2dJustificationType
+{
+ rt2dJUSTIFYLEFT, /**<Left-justification */
+ rt2dJUSTIFYCENTER, /**<Center-justification */
+ rt2dJUSTIFYRIGHT, /**<Right-justification */
+ rt2DJUSTIFICATIONTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT /* Ensures sizeof(enum) == sizeof(RwInt32)) */
+};
+
+/*
+ * Rt2dObjectEnum
+ * typedef for a enumeration describing an object type enclosed by Rt2dObject
+ */
+typedef enum Rt2dJustificationType Rt2dJustificationType;
+
+/**
+ * \ingroup rt2ddatatypes
+ * \ref Rt2dShapeNodeFlag
+ * Passed to \ref Rt2dShapeAddNode, these flags specify
+ * the type and properties of the path.
+ */
+enum Rt2dShapeNodeFlag
+{
+ rt2dSHAPENODEFLAGNONE = 0x0000,
+ rt2dSHAPENODEFLAGSOLID = 0x0001, /**< Shape's node is a solid, not outline */
+ rt2dSHAPENODEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT /* Ensure sizeof(enum) == sizeof(RwInt32) */
+};
+
+
+#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ))
+
+#define Rt2dBrushSetWidth(_brush, _width) \
+ Rt2dBrushSetWidthMacro(_brush, _width)
+
+#define Rt2dBrushGetWidth(_brush) \
+ Rt2dBrushGetWidthMacro(_brush)
+
+#define Rt2dCTMRead(_result) \
+ Rt2dCTMReadMacro(_result)
+
+#endif /* (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) */
+
+/****************************************************************************
+ Function prototypes
+ */
+extern void
+Rt2dBrushSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern void
+Rt2dFontSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern void
+Rt2dFontDictNodeSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern void
+Rt2dObjectSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern void
+Rt2dPathSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+/*
+ * INITIALIZE
+ */
+extern void
+Rt2dOpen(RwCamera *cam);
+
+extern void
+Rt2dClose(void);
+
+extern void
+Rt2dTriVertSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern void
+Rt2dTriPolySetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+/*
+ * PATHS
+ */
+extern Rt2dPath *
+Rt2dPathCreate(void);
+
+extern RwBool
+Rt2dPathDestroy(Rt2dPath *path);
+
+extern Rt2dPath *
+Rt2dPathLock(Rt2dPath *path);
+
+extern Rt2dPath *
+Rt2dPathUnlock(Rt2dPath *path);
+
+extern RwBool
+Rt2dPathIsLocked(Rt2dPath *path);
+
+extern RwUInt32
+Rt2dPathStreamGetSize(Rt2dPath *path);
+
+extern Rt2dPath *
+Rt2dPathStreamWrite(Rt2dPath *path, RwStream *stream);
+
+extern Rt2dPath *
+Rt2dPathStreamRead(RwStream *stream);
+
+extern Rt2dPath *
+Rt2dPathEmpty(Rt2dPath *path);
+
+extern Rt2dPath *
+Rt2dPathCopy(Rt2dPath *dst, const Rt2dPath *src);
+
+extern Rt2dPath *
+Rt2dPathInset(Rt2dPath *path, RwReal inset);
+
+extern Rt2dPath *
+Rt2dPathMoveto(Rt2dPath *path, RwReal x, RwReal y);
+
+extern Rt2dPath *
+Rt2dPathLineto(Rt2dPath *path, RwReal x, RwReal y);
+
+extern Rt2dPath *
+Rt2dPathRLineto(Rt2dPath *path, RwReal x, RwReal y);
+
+extern Rt2dPath *
+Rt2dPathCurveto(Rt2dPath *path, RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal x3, RwReal y3);
+
+extern Rt2dPath *
+Rt2dPathRCurveto(Rt2dPath *path, RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal x3, RwReal y3);
+
+extern Rt2dPath *
+Rt2dPathClose(Rt2dPath *path);
+
+extern Rt2dPath *
+Rt2dPathRect(Rt2dPath *path, RwReal x, RwReal y, RwReal w, RwReal h);
+
+extern Rt2dPath *
+Rt2dPathRoundRect(Rt2dPath *path, RwReal x, RwReal y, RwReal w, RwReal h, RwReal radius);
+
+extern Rt2dPath *
+Rt2dPathOval(Rt2dPath *path, RwReal x, RwReal y, RwReal w, RwReal h);
+
+extern Rt2dPath *
+Rt2dPathFlatten(Rt2dPath *path);
+
+extern const Rt2dPath *
+Rt2dPathGetBBox(const Rt2dPath *path, Rt2dBBox *bbox);
+
+extern Rt2dPath *
+Rt2dPathCreateMorphResultPath(Rt2dPath *path);
+
+extern Rt2dPath *
+Rt2dPathMorph(Rt2dPath *result, Rt2dPath *source, Rt2dPath *destination, RwReal alpha);
+
+/*
+ * BRUSHES
+ */
+extern Rt2dBrush *
+Rt2dBrushCreate(void);
+
+extern RwBool
+Rt2dBrushDestroy(Rt2dBrush * brush);
+
+extern Rt2dBrush *
+Rt2dBrushSetRGBA(Rt2dBrush *brush, RwRGBA * col0, RwRGBA * col1, RwRGBA * col2, RwRGBA * col3);
+
+extern Rt2dBrush *
+Rt2dBrushSetUV(Rt2dBrush *brush, RwV2d *uv0, RwV2d *uv1, RwV2d *uv2, RwV2d *uv3);
+
+extern Rt2dBrush *
+Rt2dBrushSetTexture(Rt2dBrush* brush, RwTexture* texture);
+
+extern RwUInt32
+Rt2dBrushStreamGetSize(Rt2dBrush *brush);
+
+extern Rt2dBrush *
+Rt2dBrushStreamWrite(Rt2dBrush *brush, RwStream *stream);
+
+extern Rt2dBrush *
+Rt2dBrushStreamRead(RwStream *stream);
+
+/*
+ * FONTS
+ */
+extern const RwChar *
+Rt2dFontSetPath(const RwChar *path);
+
+extern Rt2dFont *
+Rt2dFontRead(const RwChar *name);
+
+extern RwBool
+Rt2dFontSetReadCallBack(Rt2dFontCallBackRead fpCallBack);
+
+extern Rt2dFontCallBackRead
+Rt2dFontGetReadCallBack (void);
+
+extern RwUInt32
+_rt2dFontStreamGetSize(Rt2dFont *font);
+
+extern Rt2dFont *
+_rt2dFontStreamWrite(Rt2dFont *font, RwStream *stream);
+
+extern Rt2dFont *
+_rt2dFontStreamRead(RwStream *stream);
+
+extern RwBool
+Rt2dFontDestroy(Rt2dFont *font);
+
+extern RwReal
+Rt2dFontGetHeight(Rt2dFont *font);
+
+extern RwReal
+Rt2dFontGetStringWidth(Rt2dFont *font, const RwChar *string, RwReal height);
+
+extern Rt2dFont *
+Rt2dFontShow(Rt2dFont *font, const RwChar *string, RwReal height, RwV2d *anchor, Rt2dBrush *brush);
+
+extern Rt2dFont *
+Rt2dFontFlow(Rt2dFont* font, RwChar* string, RwReal height, Rt2dBBox* bbox, Rt2dJustificationType format, Rt2dBrush* brush);
+
+extern Rt2dFont *
+Rt2dFontSetIntergapSpacing(Rt2dFont *font, RwReal gap);
+
+
+extern RwBool
+Rt2dFontCacheFlush(void);
+
+
+/*
+ * FILLING
+ */
+extern Rt2dPath *
+Rt2dPathFill(Rt2dPath *path, Rt2dBrush *brush);
+/*
+ * STROKING
+ */
+extern Rt2dPath *
+Rt2dPathStroke(Rt2dPath *path, Rt2dBrush *brush);
+
+/*
+ * TRANSFORMS
+ */
+extern RwBool
+Rt2dCTMPush(void);
+
+extern RwBool
+Rt2dCTMPop(void);
+
+extern RwBool
+Rt2dCTMSetIdentity(void);
+
+extern RwBool
+Rt2dCTMScale(RwReal x, RwReal y);
+
+extern RwBool
+Rt2dCTMTranslate(RwReal x, RwReal y);
+
+extern RwBool
+Rt2dCTMRotate(RwReal theta);
+
+extern RwBool
+RwV2dIsInPath(RwV2d *point, Rt2dPath *path);
+
+extern RwV2d *
+RwV2dInvertTransform(RwV2d *pointOut, RwV2d *pointIn);
+
+
+/*
+ * DEVICE SETTINGS
+ */
+extern RwBool
+Rt2dDeviceSetCamera(RwCamera *cam);
+
+extern RwCamera *
+Rt2dDeviceGetCamera(void);
+
+extern RwBool
+Rt2dDeviceGetStep(RwV2d *xstep, RwV2d *ystep, RwV2d *origin);
+
+extern RwBool
+Rt2dDeviceSetMetric(RwReal x, RwReal y, RwReal w, RwReal h);
+
+extern RwBool
+Rt2dDeviceGetMetric(RwReal *x, RwReal *y, RwReal *w, RwReal *h);
+
+extern RwBool
+Rt2dDeviceSetFlat(RwReal r);
+
+extern RwBool
+Rt2dDeviceGetClippath(Rt2dPath *path);
+
+extern RwBool
+Rt2dVisible(RwReal x, RwReal y, RwReal w, RwReal h);
+
+extern RwBool
+Rt2dDeviceSetLayerDepth(RwReal depth);
+
+extern RwBool
+Rt2dSetPipelineFlags(RwUInt32 flags);
+
+/*
+ * HIERARCHICAL SCENE FUNCTIONS - OBJECT MANIPULATION
+ */
+
+extern Rt2dObject *
+Rt2dObjectSetVisible(Rt2dObject *object,RwBool visible);
+
+extern RwBool
+Rt2dObjectIsVisible(Rt2dObject *object);
+
+extern void
+Rt2dObjectMTMChanged(Rt2dObject *object);
+
+extern RwMatrix *
+Rt2dObjectGetLTM(Rt2dObject *object);
+
+extern RwMatrix *
+Rt2dObjectGetMTM(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dObjectSetMTM(Rt2dObject *object, RwMatrix *mtm);
+
+extern void
+Rt2dObjectApplyCTM(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dObjectMTMSetIdentity(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dObjectMTMScale(Rt2dObject *object, RwReal x, RwReal y);
+
+extern Rt2dObject *
+Rt2dObjectMTMTranslate(Rt2dObject *object, RwReal x, RwReal y);
+
+extern Rt2dObject *
+Rt2dObjectMTMRotate(Rt2dObject *object, RwReal theta);
+
+extern RwRGBAReal *
+Rt2dObjectGetColorMultiplier(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dObjectSetColorMultiplier(Rt2dObject *object, RwRGBAReal *multCol);
+
+extern RwRGBAReal *
+Rt2dObjectGetColorOffset(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dObjectSetColorOffset(Rt2dObject *object, RwRGBAReal *oofsCol);
+
+extern RwInt32
+Rt2dObjectGetObjectType(Rt2dObject *object);
+
+extern RwInt32
+Rt2dObjectGetDepth(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dObjectSetDepth(Rt2dObject *object, RwInt32 depth);
+
+extern RwBool
+Rt2dObjectIsScene(Rt2dObject *object);
+
+extern RwBool
+Rt2dObjectIsShape(Rt2dObject *object);
+
+extern RwBool
+Rt2dObjectIsPickRegion(Rt2dObject *object);
+
+extern RwBool
+Rt2dObjectIsObjectString(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dObjectCopy(Rt2dObject *dst, Rt2dObject *src);
+
+/* in-place dst version, destruction not req */
+extern Rt2dObject *
+_rt2dObjectCopy(Rt2dObject *dst, Rt2dObject *src);
+
+/*
+ * HIERARCHICAL SCENE FUNCTIONS - SCENE
+ */
+extern Rt2dObject *
+Rt2dSceneCreate(void);
+
+extern RwBool
+Rt2dSceneDestroy(Rt2dObject *scene);
+
+extern Rt2dObject *
+Rt2dSceneLock(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dSceneUnlock(Rt2dObject *object);
+
+extern RwInt32
+Rt2dSceneGetChildCount(Rt2dObject *scene);
+
+extern Rt2dObject *
+Rt2dSceneGetChildByIndex(Rt2dObject *scene, RwInt32 index);
+
+extern RwV2d
+Rt2dSceneGetCoordFromScreen(Rt2dObject *scene,RwV2d screenCoord );
+
+extern Rt2dObject *
+Rt2dSceneAddChild(Rt2dObject *scene, Rt2dObject *object);
+
+/* Those are keeped for compatiblity with the present code */
+extern Rt2dObject *
+Rt2dSceneGetNewChildScene(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dSceneGetNewChildShape(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dSceneGetNewChildPickRegion(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dSceneGetNewChildObjectString(Rt2dObject *object, const RwChar *text,
+ const RwChar *font);
+
+extern Rt2dObject *
+Rt2dSceneStreamWrite(Rt2dObject *shape, RwStream *stream);
+
+extern RwUInt32
+Rt2dSceneStreamGetSize(Rt2dObject *scene);
+
+extern Rt2dObject *
+Rt2dSceneStreamRead(RwStream *stream);
+
+extern Rt2dObject *
+Rt2dSceneRender(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dSceneForAllChildren(Rt2dObject *scene, Rt2dObjectCallBack callback, void *pData );
+
+extern Rt2dObject *
+Rt2dSceneSetDepthDirty(Rt2dObject *scene);
+
+extern Rt2dObject *
+Rt2dSceneUpdateLTM(Rt2dObject *scene);
+
+/*
+ * HIERARCHICAL SCENE FUNCTIONS - SHAPE
+ */
+extern Rt2dObject *
+Rt2dShapeCreate(void);
+
+extern RwBool
+Rt2dShapeDestroy(Rt2dObject * shape);
+
+extern Rt2dObject *
+Rt2dShapeAddNode(Rt2dObject *shape, RwUInt32 flag, Rt2dPath *path, Rt2dBrush *brush );
+
+extern RwInt32
+Rt2dShapeGetNodeCount(Rt2dObject *shape);
+
+extern Rt2dObject *
+Rt2dShapeStreamWrite(Rt2dObject *shape, RwStream *stream);
+
+extern RwUInt32
+Rt2dShapeStreamGetSize(Rt2dObject *shape);
+
+extern Rt2dObject *
+Rt2dShapeStreamRead(RwStream *stream);
+
+extern Rt2dObject *
+Rt2dShapeRender(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dShapeMorph(Rt2dObject *result,
+ Rt2dObject *source,
+ Rt2dObject *destination,
+ RwReal alpha);
+
+extern Rt2dObject *
+Rt2dShapeLock(Rt2dObject * shape);
+
+extern Rt2dObject *
+Rt2dShapeUnlock(Rt2dObject * shape);
+
+/*
+ * HIERARCHICAL SCENE FUNCTIONS - PICK REGION
+ */
+extern Rt2dObject *
+Rt2dPickRegionCreate(void);
+
+extern RwBool
+Rt2dPickRegionDestroy(Rt2dObject *pickRegion);
+
+extern Rt2dPath *
+Rt2dPickRegionGetPath(Rt2dObject *pickRegion);
+
+extern RwBool
+Rt2dPickRegionIsPointIn(Rt2dObject *pickRegion, RwV2d *point);
+
+extern Rt2dObject *
+Rt2dPickRegionStreamWrite(Rt2dObject *pickRegion, RwStream *stream);
+
+extern RwUInt32
+Rt2dPickRegionStreamGetSize(Rt2dObject *pickRegion);
+
+extern Rt2dObject *
+Rt2dPickRegionStreamRead(RwStream *stream);
+
+/*
+ * HIERARCHICAL SCENE FUNCTIONS - TEXT STRINGS
+ */
+extern Rt2dObject *
+Rt2dObjectStringCreate(const RwChar *textString, const RwChar *font);
+
+extern RwBool
+Rt2dObjectStringDestroy(Rt2dObject *object);
+
+extern Rt2dBrush *
+Rt2dObjectStringGetBrush(Rt2dObject *object);
+
+extern RwChar *
+Rt2dObjectStringGetText(Rt2dObject *object);
+
+extern RwChar *
+Rt2dObjectStringGetFont(Rt2dObject *object);
+
+extern RwReal
+Rt2dObjectStringGetHeight(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dObjectStringSetBrush(Rt2dObject *object, Rt2dBrush *);
+
+extern Rt2dObject *
+Rt2dObjectStringSetText(Rt2dObject *object, const RwChar *text);
+
+extern Rt2dObject *
+Rt2dObjectStringSetFont(Rt2dObject *object, const RwChar *font);
+
+extern Rt2dObject *
+Rt2dObjectStringSetHeight(Rt2dObject *object, const RwReal height);
+
+extern Rt2dObject *
+Rt2dObjectStringStreamRead(RwStream *stream);
+
+extern Rt2dObject *
+Rt2dObjectStringStreamWrite(Rt2dObject *object, RwStream *stream);
+
+extern RwUInt32
+Rt2dObjectStringStreamGetSize(Rt2dObject *object);
+
+extern Rt2dObject *
+Rt2dObjectStringRender(Rt2dObject *object);
+
+
+/*
+ * SPI for macros
+ */
+
+extern RwBool
+_rt2dCTMPush(RwMatrix *matrix);
+
+extern RwBool
+_rt2dCTMSet(RwMatrix *matrix);
+
+extern RwMatrix *
+_rt2dCTMGet(void);
+
+extern RwMatrix *
+_rt2dCTMGetDirect(void);
+
+
+#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )
+
+extern Rt2dBrush *
+Rt2dBrushSetWidth(Rt2dBrush *brush, RwReal width);
+extern RwReal
+Rt2dBrushGetWidth(Rt2dBrush * brush);
+
+extern RwMatrix *
+Rt2dCTMRead(RwMatrix * result);
+
+#endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#define Rt2dFontStreamGetSize(_font) \
+ _rt2dFontStreamGetSize(_font)
+
+#define Rt2dFontStreamWrite(_font,_stream) \
+ _rt2dFontStreamWrite(_font,_stream)
+
+#define Rt2dFontStreamRead(_stream) \
+ _rt2dFontStreamRead(_stream)
+
+#endif /* RT2D_H */
diff --git a/sdk/rwsdk/include/d3d8/rt2d.rpe b/sdk/rwsdk/include/d3d8/rt2d.rpe
new file mode 100644
index 00000000..b18db155
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rt2d.rpe
@@ -0,0 +1,164 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_Criterion2D
+{
+
+
+E_RW_FONTNOTFOUND,
+
+ e_rwdb_Criterion2DLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_Criterion2D e_rwdb_Criterion2D;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rt2danim.h b/sdk/rwsdk/include/d3d8/rt2danim.h
new file mode 100644
index 00000000..996262af
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rt2danim.h
@@ -0,0 +1,1107 @@
+/***************************************************************************
+ * *
+ * Module : rt2danim.h *
+ * *
+ * Purpose : . *
+ * *
+ **************************************************************************/
+
+#ifndef RT2DANIM_H
+#define RT2DANIM_H
+
+/**
+ * \defgroup rt2danim Rt2dAnim (inc. Maestro)
+ * \ingroup 2dtools
+ *
+ * A toolkit to coordinate the display, storage and manipulation of 2D
+ * animations.
+ */
+
+/**
+ * \defgroup rt2danimsub Rt2dAnim
+ * \ingroup rt2danim
+ *
+ * Animation functions
+ */
+
+/**
+ * \defgroup rt2dmaestro Rt2dMaestro
+ * \ingroup rt2danim
+ *
+ * Maestro functions
+ */
+
+/**
+ * \defgroup rt2dstringlabel Rt2dStringLabel
+ * \ingroup rt2danim
+ *
+ * String labels
+ */
+
+/**
+ * \defgroup rt2dmessage Rt2dMessage
+ * \ingroup rt2danim
+ *
+ * Messages
+ */
+
+/**
+ * \defgroup rt2dbutton Rt2dButton
+ * \ingroup rt2danim
+ *
+ * Buttons
+ */
+
+/**
+ * \defgroup rt2dcel Rt2dCel
+ * \ingroup rt2danim
+ *
+ * Cels
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+#include <rwcore.h>
+#include "rt2danim.rpe" /* automatically generated header file */
+#include "rt2d.h"
+#include "rpcriter.h"
+/****************************************************************************
+ Defines
+ */
+
+/****************************************************************************
+ Global Types
+ */
+
+/* RWPUBLIC */
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#define RT2D_BUTTON_MAX_STATES 4
+#define RT2D_BUTTON_MAX_STATE_TRANSITIONS 32
+
+/* Button state flags. */
+
+#define rt2dANIMBUTTONSTATEPICKREGION 0x0001
+#define rt2dANIMBUTTONSTATEUP 0x0002
+#define rt2dANIMBUTTONSTATEDOWN 0x0004
+#define rt2dANIMBUTTONSTATEOVER 0x0008
+
+#define rt2dANIMBUTTONSTATEIDLETOOVERUP 0x0010
+#define rt2dANIMBUTTONSTATEOVERUPTOIDLE 0x0020
+#define rt2dANIMBUTTONSTATEOVERUPTOOVERDOWN 0x0040
+#define rt2dANIMBUTTONSTATEOVERDOWNTOOVERUP 0x0080
+#define rt2dANIMBUTTONSTATEOVERDOWNTOOUTDOWN 0x0100
+#define rt2dANIMBUTTONSTATEOUTDOWNTOOVERDOWN 0x0200
+#define rt2dANIMBUTTONSTATEOUTDOWNTOIDLE 0x0400
+#define rt2dANIMBUTTONSTATEIDLETOOVERDOWN 0x0800
+#define rt2dANIMBUTTONSTATEOVERDOWNTOIDLE 0x1000
+
+
+/* Mask to separate trans state in state flag. */
+#define rt2dANIMBUTTONSTATEMASK \
+ (rt2dANIMBUTTONSTATEPICKREGION | \
+ rt2dANIMBUTTONSTATEPICKUP | \
+ rt2dANIMBUTTONSTATEPICKDOWN | \
+ rt2dANIMBUTTONSTATEPICKOVER)
+
+/* Basic enumerations */
+
+/**
+ * \ingroup rt2dmessage
+ * \ref Rt2dMessageType, this type represents the different types of
+ * messages that are available.
+ */
+
+enum Rt2dMessageType
+{
+ rt2dMESSAGETYPENULL = 0, /**< Empty message. */
+ rt2dMESSAGETYPEPLAY, /**< Play animation. */
+ rt2dMESSAGETYPESTOP, /**< Stop animation. */
+ rt2dMESSAGETYPENEXTFRAME, /**< Advance to next frame. */
+ rt2dMESSAGETYPEPREVFRAME, /**< Rewind to previouse frame. */
+ rt2dMESSAGETYPEGOTOFRAME, /**< Advance to frame by index. */
+ rt2dMESSAGETYPEGOTOLABEL, /**< Advance to frame by label. */
+ rt2dMESSAGETYPEGETURL, /**< Get URL */
+ rt2dMESSAGETYPEDOACTION, /* Perform action. */
+ rt2dMESSAGETYPEFOREIGN, /**< Application specific message. */
+ rt2dMESSAGETYPEMOUSEMOVETO, /**< Move mouse. */
+ rt2dMESSAGETYPEMOUSEBUTTONSTATE, /**< Mouse button up or down. */
+ rt2dMESSAGETYPESPECIALTELLTARGET, /* Change target while queueing */
+ rt2dMESSAGETYPEBUTTONBYLABEL, /**< Mouse button transition by label */
+ rt2dMESSAGETYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+typedef enum Rt2dMessageType Rt2dMessageType;
+
+/**
+ * \ingroup rt2dstringlabel
+ * \ref Rt2dStringLabelType, this type represents the different types of
+ * object that can be labelled in the maestro's label table.
+ */
+
+enum Rt2dStringLabelType
+{
+ rt2dANIMLABELTYPENONE = 0,
+ rt2dANIMLABELTYPEANIM, /**< Animation label. */
+ rt2dANIMLABELTYPEFRAME, /**< Frame or cel label. */
+ rt2dANIMLABELTYPEBUTTON, /**< Button label. */
+ rt2dANIMLABELTYPEFOREIGN, /**< Application specific. */
+ rt2dANIMLABELTYPESHAPE, /**< Shape label. */
+ rt2dANIMLABELTYPEURL, /**< URL label. */
+ rt2dANIMLABELTYPEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+typedef enum Rt2dStringLabelType Rt2dStringLabelType;
+
+/* Basic animation structures */
+
+/**
+ * \ingroup rt2danimsub
+ * \struct Rt2dAnimProps
+ * Structure describing the current state of a scene.
+ * This should be considered an opaque type. Use the
+ * Rt2dAnim API functions to access.
+ */
+typedef struct Rt2dAnimProps Rt2dAnimProps;
+
+/**
+ * \ingroup rt2danimsub
+ * \struct Rt2dKeyFrameList
+ * Structure describing an entire list of keyframes
+ * This should be considered an opaque type. Use the
+ * Rt2dKeyFrameList API functions to access.
+ */
+typedef struct Rt2dKeyFrameList Rt2dKeyFrameList;
+
+/**
+ * \ingroup rt2danimsub
+ * \struct Rt2dKeyFrameSet
+ * structure describing a set of keyframe actions to be applied to a 2D object.
+ * This should be considered an opaque type. Use the
+ * Rt2dAnim API functions to access.
+ */
+typedef struct Rt2dKeyFrameSet Rt2dKeyFrameSet;
+
+/**
+ * \ingroup rt2danimsub
+ * \struct Rt2dAnimObjectUpdate
+ * Structure describing an unoptimized update to an object
+ * This should be considered an opaque type. Use the
+ * Rt2dAnim API functions to access.
+ */
+typedef struct Rt2dAnimObjectUpdate Rt2dAnimObjectUpdate;
+
+/**
+ * \ingroup rt2danimsub
+ * \struct Rt2dKeyFrameTransform
+ * Structure describing a transform change to a 2d object.
+ * This should be considered an opaque type. Use the
+ * Rt2dAnim API functions to access.
+ */
+typedef struct Rt2dKeyFrameTransform Rt2dKeyFrameTransform;
+
+/*
+ * Typedef for struct Rt2dKeyFrameColor describing a color
+ * change to a 2d object.
+ */
+typedef struct Rt2dKeyFrameColor Rt2dKeyFrameColor;
+
+/*
+ * Structure describing a displayable or depth change to a 2d object.
+ */
+typedef struct Rt2dKeyFrameShow Rt2dKeyFrameShow;
+
+/*
+ * Structure describing a morph change to a 2d object.
+ */
+typedef struct Rt2dKeyFrameMorph Rt2dKeyFrameMorph;
+
+/**
+ * \ingroup rt2danimsub
+ * \struct Rt2dAnim
+ * Structure describing a 2d animation.
+ * This should be considered an opaque type. Use the
+ * Rt2dAnim API functions to access.
+ */
+typedef struct Rt2dAnim Rt2dAnim;
+
+/**
+ * \ingroup rt2dbutton
+ * \struct Rt2dButton
+ * Structure describing a button.
+ * This should be considered an opaque type. Use the
+ * Rt2dButton API functions to access.
+ */
+typedef struct Rt2dButton Rt2dButton;
+
+/**
+ * \ingroup rt2dcel
+ * \struct Rt2dCel
+ * Structure describing a cel.
+ * This should be considered an opaque type. Use the
+ * Rt2dCel API functions to access.
+ */
+typedef struct Rt2dCel Rt2dCel;
+
+/**
+ * \ingroup rt2dcel
+ * \struct Rt2dCelList
+ * Structure describing a cel list.
+ * This should be considered an opaque type. Use the
+ * Rt2dCel API functions to access.
+ */
+typedef struct Rt2dCelList Rt2dCelList;
+
+/**
+ * \ingroup rt2dmaestro
+ * \struct Rt2dMaestro
+ * Structure describing a maestro.
+ * This should be considered an opaque type. Use the
+ * Rt2dMaestro API functions to access.
+ */
+typedef struct Rt2dMaestro Rt2dMaestro;
+
+/*
+ * Structure describing a message.
+ */
+typedef struct Rt2dMessage Rt2dMessage;
+
+/**
+ * \ingroup rt2dmessage
+ * \struct Rt2dMessageList
+ * Structure describing a message.
+ * This should be considered an opaque type. Use the
+ * Rt2dMessage API functions to access.
+ */
+typedef struct Rt2dMessageList Rt2dMessageList;
+
+/**
+ * \ingroup rt2dstringlabel
+ * \struct Rt2dStringLabel
+ * Structure used to store and access named data, either internal or user.
+ * A type and a name may be used to access internal and user data.
+ *
+ * This should be considered an opaque type. Use the
+ * Rt2dStringLabel API functions to access.
+ */
+typedef struct Rt2dStringLabel Rt2dStringLabel;
+
+/**
+ * \ingroup rt2danimsub
+ * \struct Rt2dKeyFrame
+ * structure describing a transforming action
+ */
+struct Rt2dKeyFrameTransform
+{
+ RwMatrix matrix; /**< Transform to be applied */ /*64*/
+};
+
+/**
+ * \ingroup rt2danimsub
+ * \struct Rt2dKeyFrameColor
+ * Structure describing a color
+ * change to a 2d object.
+ */
+struct Rt2dKeyFrameColor
+{
+ RwRGBAReal color; /**< Color value for a keyframe */ /*16*/
+};
+
+/**
+ * \ingroup rt2danimsub
+ * \struct Rt2dKeyFrameShow
+ * Structure describing a show/hide change and a depth change to a 2d object.
+ */
+struct Rt2dKeyFrameShow
+{
+ RwBool show; /**< visibility flag */ /*4*/
+ RwInt32 depth; /**< Depth order (reverse-z) */ /*4*/
+ RwUInt8 pad1[8]; /**< Alignment padding */ /*8*/
+};
+
+/**
+ * \ingroup rt2danimsub
+ * \struct Rt2dKeyFrameMorph
+ * Structure describing a morph change to a 2d object.
+ */
+struct Rt2dKeyFrameMorph
+{
+ Rt2dObject *source; /**< start object */ /*4*/
+ Rt2dObject *destination; /**< end object */ /*4*/
+ RwReal alpha; /**< interpolation value (0.0f-1.0f) */ /*4*/
+ RwInt32 pad1; /**< Alignment padding */ /*4*/
+};
+
+/**
+ * \ingroup rt2dmessage
+ * \struct Rt2dMessage
+ * Structure describing a message. A message must have a valid message type, (\ref Rt2dMessageType)
+ * and animation index. The animation index identifies which animation the message applies to.
+ * A -1 indicates the currently active animation. A message can have none, one or two additional
+ * \ref RwInt32 parameters, depending on the message type.
+ */
+struct Rt2dMessage
+{
+ RwUInt32 messageType; /**< message identifier
+ (\ref Rt2dMessageType) */
+ RwInt32 index; /**< animation to apply any
+ actions to */
+ RwInt32 intParam1; /**< first param (message dependant) */
+ RwInt32 intParam2; /**< second param (message dependant) */
+};
+
+#define _rt2dMessageGetMessageTypeMacro(_message) \
+ ((_message)->messageType);
+
+#define _rt2dMessageSetMessageTypeMacro(_message, _messageType) \
+ ((_message)->messageType = (_messageType));
+
+#define _rt2dMessageGetIndexMacro(_message) \
+ ((_message)->index);
+
+#define _rt2dMessageSetIndexMacro(_message, _index) \
+ ((_message)->index = (_index));
+
+#define _rt2dMessageSetParamMacro(_message, _param1, _param2) \
+MACRO_START \
+{ \
+ ((_message)->intParam1 = (_param1)); \
+ ((_message)->intParam2 = (_param2)); \
+} \
+MACRO_STOP
+
+#define _rt2dMessageGetParamMacro(_message, _param1, _param2) \
+MACRO_START \
+{ \
+ (*(_param1) = (_message)->intParam1); \
+ (*(_param2) = (_message)->intParam2); \
+} \
+MACRO_STOP
+
+/*
+ * structure containing label information. The entityType identifies the type
+ * of the label. The label's name is stored as an index
+ * in common storage area. The entityType and name of the label are used as keys
+ * during a search. Additional internal and user data can be stored with the
+ * label.
+ */
+
+#if (!defined(DOXYGEN))
+struct Rt2dStringLabel
+{
+ RwUInt32 entityType; /* type of the label
+ (see Rt2dStringLabelType) */
+ RwInt32 nameIndex; /* index of name in internal data
+ area */
+ void *internalData; /* internal data */
+ void *userData; /* customizable data */
+
+};
+
+#endif /* (!defined(DOXYGEN)) */
+
+#define _rt2dStringLabelGetStringLabelTypeMacro(_strLabel) \
+ ((_strLabel)->entityType)
+
+#define _rt2dStringLabelSetStringLabelTypeMacro(_strLabel, _entityType) \
+ ((_strLabel)->entityType = (_entityType))
+
+#define _rt2dStringLabelGetNameIndexMacro(_strLabel) \
+ ((_strLabel)->nameIndex)
+
+#define _rt2dStringLabelSetNameIndexMacro(_strLabel, _index) \
+ ((_strLabel)->nameIndex = (_index))
+
+#define _rt2dStringLabelGetInternalDataMacro(_strLabel) \
+ ((_strLabel)->internalData)
+
+#define _rt2dStringLabelSetInternalDataMacro(_strLabel, _internalData) \
+ ((_strLabel)->internalData = (_internalData))
+
+#define _rt2dStringLabelGetUserDataMacro(_strLabel) \
+ ((_strLabel)->userData)
+
+#define _rt2dStringLabelSetUserDataMacro(_strLabel, _userData) \
+ ((_strLabel)->userData = (_userData))
+
+/*
+ * structure containing cel information. The name of the cel is stored as an
+ * index into a label table. The buttons in the cel are stored as indices. These
+ * reference a list of buttons held by the cel's parent maestro. Any messages
+ * to be process when the cel is active is stored as index into the parent's
+ * maestro's message storage area.
+ */
+
+#if (!defined(DOXYGEN))
+struct Rt2dCel
+{
+ RwInt32 strLabelIndex; /* Frame label */
+ RwInt32 celIndex; /* Frame number */
+ RwSList *buttonIndices; /* List of buttons active in
+ this frame */
+ RwInt32 messageListIndex; /* Messages to be posted after
+ displaying this frame */
+};
+
+#endif /* (!defined(DOXYGEN)) */
+
+#define _rt2dCelGetStringLabelIndexMacro(_cel) \
+ ((_cel)->strLabelIndex);
+
+#define _rt2dCelSetStringLabelIndexMacro(_cel, _index) \
+ ((_cel)->strLabelIndex = (_index));
+
+#define _rt2dCelGetCelIndexMacro(_cel) \
+ ((_cel)->celIndex);
+
+#define _rt2dCelSetCelIndexMacro(_cel, _index) \
+ ((_cel)->celIndex = (_index));
+
+#define _rt2dCelGetMessageListIndexMacro(_cel) \
+ ((_cel)->messageListIndex);
+
+#define _rt2dCelSetMessageListIndexMacro(_cel, _index) \
+ ((_cel)->messageListIndex = (_index));
+
+/* Callback typedefs */
+
+typedef Rt2dAnim *(*Rt2dAnimCallBack)(Rt2dAnim *object,
+ Rt2dAnimProps *props,
+ void *data);
+/**
+ * \ingroup rt2danimsub
+ * \ref Rt2dKeyFrameListCallBack
+ * This typedef defines a callback function to apply to a frame list.
+ *
+ * \param anim Pointer to the animation
+ * \param props Pointer to the props that the animation acts upon
+ * \param keyframeList The key frame list
+ * \param keyframeListTime The key frame list time
+ * \param data User defined data
+ *
+ * \return return value is ignored
+ */
+typedef Rt2dKeyFrameList *(Rt2dKeyFrameListCallBack)(
+ Rt2dAnim *anim,
+ Rt2dAnimProps *props,
+ Rt2dKeyFrameList *keyframeList,
+ RwReal keyframeListTime,
+ void *data);
+
+/**
+ * \ingroup rt2danimsub
+ * \ref Rt2dAnimOnEndReachedCallBack
+ * This typedef defines a callback function called at the end of an animation.
+ *
+ * \param anim Pointer to the animation ending
+ * \param props Pointer to the props that the animation acts upon
+ * \param remainingDeltaTime Remaining time
+ *
+ * \return return value is ignored
+ */
+typedef Rt2dAnim *(*Rt2dAnimOnEndReachedCallBack)(Rt2dAnim *anim,
+ Rt2dAnimProps *props,
+ RwReal remainingDeltaTime);
+
+/**
+ * \ingroup rt2dmaestro
+ * \ref Rt2dMaestroAnimationsCallBack
+ * \ref Rt2dMaestroAnimationsCallBack represents the function called from
+ * \ref Rt2dMaestroForAllAnimations for all animations in the maestro.
+ * This function
+ * should return the current maestro to indicate success. The callback may
+ * return NULL to terminate further callbacks on the maestro.
+ *
+ * \param maestro Pointer to parent maestro.
+ * \param anim Pointer to the animation.
+ * \param props Pointer to the anim's props.
+ * \param pData Pointer to private data.
+ *
+ * \return Pointer to the maestro.
+ */
+
+typedef Rt2dMaestro *(*Rt2dMaestroAnimationsCallBack)
+ (Rt2dMaestro *maestro, Rt2dAnim *anim, Rt2dAnimProps *props, void * pData);
+
+/**
+ * \ingroup rt2dmessage
+ * \ref Rt2dMessageHandlerCallBack represents the function called from
+ * \ref Rt2dMaestroProcessMessages for all messages in the maestro's
+ * process message queue. The maestro does not filter any messages. The
+ * handler may process or ignore any messages it is given.
+ *
+ * This function should return the current message to indicate success. The
+ * callback may return NULL to terminate further callbacks on the maestro.
+ *
+ * \param maestro Pointer to parent maestro.
+ * \param message Pointer to the message.
+ *
+ * \return Pointer to the message.
+ */
+
+typedef Rt2dMessage *(*Rt2dMessageHandlerCallBack)
+ (Rt2dMaestro *maestro, Rt2dMessage *message);
+
+/* Message streaming call backs. */
+
+typedef RwInt32
+(*Rt2dMessageStreamGetSizeCallBack)
+ (Rt2dMaestro *maestro, Rt2dMessage *message);
+
+typedef Rt2dMessage *
+(*Rt2dMessageStreamReadCallBack)
+ (Rt2dMaestro *maestro, Rt2dMessage *message, RwStream *stream);
+
+typedef Rt2dMessage *
+(*Rt2dMessageStreamWriteCallBack)
+ (Rt2dMaestro *maestro, Rt2dMessage *message, RwStream *stream);
+
+/*
+ * Data access macros.
+ */
+
+/*
+ * Toolkit-level initialization / finalization
+ */
+/*
+ * INITIALIZE
+ */
+extern void
+Rt2dAnimOpen(void);
+
+extern void
+Rt2dAnimClose(void);
+
+/*
+ * Rt2dAnim
+ */
+
+/* General */
+
+extern Rt2dAnimOnEndReachedCallBack
+Rt2dAnimSetOnEndReachedCallBack(Rt2dAnimOnEndReachedCallBack callback);
+
+extern Rt2dAnimOnEndReachedCallBack
+Rt2dAnimGetOnEndReachedCallBack(void);
+
+
+extern Rt2dAnim *
+Rt2dAnimOnEndReachedCallBackLoop(Rt2dAnim *anim, Rt2dAnimProps *props,
+ RwReal remainingDeltaTime);
+
+extern Rt2dAnim *
+Rt2dAnimOnEndReachedCallBackStop(Rt2dAnim *anim, Rt2dAnimProps *props,
+ RwReal remainingDeltaTime);
+
+/* Management */
+extern Rt2dAnim *
+Rt2dAnimCreate(void);
+
+extern RwBool
+Rt2dAnimDestroy(Rt2dAnim *anim, Rt2dAnimProps *props);
+
+extern Rt2dAnim *
+Rt2dAnimLock(Rt2dAnim *anim, Rt2dAnimProps *props);
+
+extern Rt2dAnim *
+Rt2dAnimUnlock(Rt2dAnim *anim, Rt2dAnimProps *props);
+
+extern Rt2dAnim *
+Rt2dAnimAddKeyFrameList(Rt2dAnim *anim,
+ Rt2dKeyFrameList *keyframeList,
+ RwReal time);
+
+
+extern Rt2dAnim *
+Rt2dAnimCopy(Rt2dAnim *srcAnim, Rt2dAnimProps *srcProps);
+
+/* Streaming */
+extern RwUInt32
+Rt2dAnimStreamGetSize( Rt2dAnim *anim,
+ Rt2dAnimProps *props);
+
+extern Rt2dAnim *
+Rt2dAnimStreamRead(RwStream *stream,
+ Rt2dAnimProps *props);
+
+extern Rt2dAnim *
+Rt2dAnimStreamReadTo(RwStream *dest,
+ RwStream *stream,
+ Rt2dAnimProps *props);
+
+extern Rt2dAnim *
+Rt2dAnimStreamWrite(Rt2dAnim *anim, RwStream *stream,
+ Rt2dAnimProps *data);
+
+/* Playback */
+extern RwBool
+Rt2dAnimIsInterpolated(Rt2dAnim *anim);
+
+extern Rt2dAnim *
+Rt2dAnimSetInterpolate(Rt2dAnim *anim, RwBool interpolate);
+
+extern Rt2dAnim *
+Rt2dAnimReset(Rt2dAnim *anim, Rt2dAnimProps *props);
+
+extern Rt2dAnim *
+Rt2dAnimSetDeltaTimeScale(Rt2dAnim *anim, RwReal timeScale);
+
+extern Rt2dAnim *
+Rt2dAnimAddDeltaTime(Rt2dAnim *anim, Rt2dAnimProps *props,
+ RwReal deltaTime);
+
+extern Rt2dAnim *
+Rt2dAnimAddDeltaFrameIndex(Rt2dAnim *anim, Rt2dAnimProps *props,
+ RwInt32 deltaFrame);
+
+extern Rt2dAnim *
+Rt2dAnimTimeUpdate(Rt2dAnim *anim, Rt2dAnimProps *props);
+
+extern Rt2dAnim *
+Rt2dAnimGotoKeyFrameListByTime(Rt2dAnim *anim, Rt2dAnimProps *props,
+ RwReal time);
+
+extern Rt2dAnim *
+Rt2dAnimGotoKeyFrameListByIndex(Rt2dAnim *anim, Rt2dAnimProps *props,
+ RwInt32 frameIndex);
+
+/* Utilities */
+extern Rt2dAnim *
+Rt2dAnimForAllKeyFrameLists(Rt2dAnim *anim, Rt2dKeyFrameListCallBack callBack,
+ Rt2dAnimProps *props, void *data);
+
+/* Interrogation */
+extern RwInt32
+Rt2dAnimGetNumberOfKeyFrames(Rt2dAnim *anim);
+
+extern Rt2dKeyFrameList *
+Rt2dAnimGetKeyFrameListByIndex(Rt2dAnim *anim, RwUInt32 frameIndex);
+
+extern RwReal
+Rt2dAnimGetCurrentTime(Rt2dAnim *anim);
+
+extern RwReal
+Rt2dAnimGetFinalKeyFrameListTime(Rt2dAnim *anim);
+
+extern RwInt32
+Rt2dAnimGetPrevFrameIndex(Rt2dAnim *anim);
+
+extern RwReal
+Rt2dAnimGetPrevFrameTime(Rt2dAnim *anim);
+
+extern RwInt32
+Rt2dAnimGetNextFrameIndex(Rt2dAnim *anim);
+
+extern RwReal
+Rt2dAnimGetNextFrameTime(Rt2dAnim *anim);
+
+/* KeyFrameList Management */
+extern Rt2dKeyFrameList *
+Rt2dKeyFrameListCreate(Rt2dAnimProps *props);
+
+extern RwBool
+Rt2dKeyFrameListDestroy(Rt2dKeyFrameList *keyframeList);
+
+extern Rt2dKeyFrameList *
+Rt2dKeyFrameListLock(Rt2dKeyFrameList *keyframeList, Rt2dAnimProps *props);
+
+extern Rt2dKeyFrameList *
+Rt2dKeyFrameListUnlock(Rt2dKeyFrameList *keyframeList,
+ Rt2dAnimProps *props);
+
+extern Rt2dKeyFrameList*
+Rt2dKeyFrameListAddUpdateObject(Rt2dKeyFrameList *keyframeList,
+ Rt2dAnimObjectUpdate *update);
+
+/* KeyFrameList Streaming */
+extern Rt2dKeyFrameList *
+Rt2dKeyFrameListStreamRead(RwStream *stream);
+
+extern RwUInt32
+Rt2dKeyFrameListStreamGetSize(Rt2dKeyFrameList *keyframeList);
+
+extern Rt2dKeyFrameList *
+Rt2dKeyFrameListStreamWrite(Rt2dKeyFrameList *keyframeList,
+ RwStream *stream);
+
+/* KeyFrameList Playback */
+extern Rt2dKeyFrameList *
+Rt2dKeyFrameListAdvance(Rt2dKeyFrameList *keyframeList,
+ Rt2dAnimProps *props);
+
+extern Rt2dKeyFrameList *
+Rt2dKeyFrameListApply(Rt2dKeyFrameList *keyframeList, Rt2dAnimProps *props,
+ RwReal alpha);
+
+/* KeyFrameList edition object */
+extern Rt2dAnimObjectUpdate *
+Rt2dAnimObjectUpdateCreate(Rt2dObject *object);
+
+extern RwBool
+Rt2dAnimObjectUpdateDestroy(Rt2dAnimObjectUpdate *update);
+
+extern Rt2dAnimObjectUpdate *
+Rt2dAnimObjectUpdateClear(Rt2dAnimObjectUpdate *update);
+
+extern Rt2dAnimObjectUpdate*
+Rt2dAnimObjectUpdateSetTransform(Rt2dAnimObjectUpdate *update,
+ Rt2dKeyFrameTransform *transform);
+
+extern Rt2dAnimObjectUpdate*
+Rt2dAnimObjectUpdateSetColorOffs(Rt2dAnimObjectUpdate *update,
+ Rt2dKeyFrameColor *colorOffs);
+
+extern Rt2dAnimObjectUpdate*
+Rt2dAnimObjectUpdateSetColorMult(Rt2dAnimObjectUpdate *update,
+ Rt2dKeyFrameColor *colorMult);
+
+extern Rt2dAnimObjectUpdate*
+Rt2dAnimObjectUpdateSetShow(Rt2dAnimObjectUpdate *update,
+ Rt2dKeyFrameShow *show);
+
+extern Rt2dAnimObjectUpdate*
+Rt2dAnimObjectUpdateSetMorph(Rt2dAnimObjectUpdate *update,
+ Rt2dKeyFrameMorph *morph);
+
+extern Rt2dAnimObjectUpdate *
+Rt2dAnimObjectUpdateSetObject(Rt2dAnimObjectUpdate *update,
+ Rt2dObject *object);
+
+/* Props management */
+extern Rt2dAnimProps *
+Rt2dAnimPropsCreate(Rt2dObject *scene);
+
+extern RwBool
+Rt2dAnimPropsDestroy(Rt2dAnimProps *props);
+
+/*
+ * Rt2dButton
+ */
+
+extern Rt2dMaestro *
+Rt2dMaestroAddButton(Rt2dMaestro *maestro, RwInt32 strLabelIdx, RwInt32 objectIdx,
+ RwUInt32 stateFlag, RwInt32 *actionListIdx,
+ RwInt32 *index);
+
+/*
+ * Rt2dCel & Rt2dCelList
+ */
+
+extern Rt2dCel *
+Rt2dCelCreate(Rt2dMaestro *maestro,
+ const RwChar *name,
+ RwInt32 celIndex, RwInt32 messageListIndex);
+
+extern Rt2dCelList *
+Rt2dCelListCreate( void );
+
+extern RwBool
+Rt2dCelDestroy(Rt2dMaestro *maestro, Rt2dCel *cel);
+
+extern Rt2dCel *
+Rt2dCelAddButtonIndex(Rt2dCel * cel, RwInt32 buttonIndex, RwInt32 *index);
+
+#if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE))
+
+#define Rt2dCelGetStringLabelIndex(_cel) \
+ _rt2dCelGetStringLabelIndexMacro((_cel));
+
+#define Rt2dCelSetStringLabelIndex(_cel, _index) \
+ _rt2dCelSetStringLabelIndexMacro((_cel), (_index));
+
+#define Rt2dCelGetCelIndex(_cel) \
+ _rt2dCelGetCelIndexMacro((_cel));
+
+#define Rt2dCelSetCelIndex(_cel, _index) \
+ _rt2dCelSetCelIndexMacro((_cel), (_index));
+
+#define Rt2dCelGetMessageListIndex(_cel) \
+ _rt2dCelGetMessageListIndexMacro((_cel));
+
+#define Rt2dCelSetMessageListIndex(_cel, _index) \
+ _rt2dCelSetMessageListIndexMacro((_cel), (_index));
+
+#else /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */
+
+extern RwInt32
+Rt2dCelGetStringLabelIndex(Rt2dCel *cel);
+
+extern void
+Rt2dCelSetStringLabelIndex(Rt2dCel *cel, RwInt32 index);
+
+extern RwInt32
+Rt2dCelGetCelIndex(Rt2dCel *cel);
+
+extern void
+Rt2dCelSetCelIndex(Rt2dCel *cel, RwInt32 index);
+
+extern RwInt32
+Rt2dCelGetMessageListIndex(Rt2dCel *cel);
+
+extern void
+Rt2dCelSetMessageListIndex(Rt2dCel *cel, RwInt32 index);
+
+#endif /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */
+
+extern RwBool
+Rt2dCelListDestroy(Rt2dCelList *celList);
+
+extern Rt2dCelList *
+Rt2dCelListLock(Rt2dCelList *celList);
+
+extern Rt2dCelList *
+Rt2dCelListUnlock(Rt2dCelList * celList);
+
+extern Rt2dCelList *
+Rt2dCelListCopy(Rt2dCelList *srcCelList);
+
+extern Rt2dCelList *
+Rt2dCelListAddCel(Rt2dCelList *celList, Rt2dCel *cel, RwInt32 *index);
+
+extern Rt2dCelList *
+Rt2dCelListCelGetStringLabelIndex(Rt2dCelList *celList, RwInt32 celIndex, RwInt32 *index);
+
+extern Rt2dCelList *
+Rt2dCelListCelButtonGetDisplayVersion(Rt2dMaestro *maestro, Rt2dCelList * celList,
+ RwInt32 celIndex, RwInt32 celButtonIndex, RwInt32 *index);
+
+/*
+ * Rt2dMaestro
+ */
+extern Rt2dMaestro *
+Rt2dMaestroCreate(void);
+
+extern RwBool
+Rt2dMaestroDestroy(Rt2dMaestro *maestro);
+
+extern RwUInt32
+Rt2dMaestroStreamGetSize(Rt2dMaestro *maestro);
+
+extern Rt2dMaestro *
+Rt2dMaestroStreamRead(Rt2dMaestro *maestro, RwStream *stream);
+
+extern Rt2dMaestro *
+Rt2dMaestroStreamWrite(Rt2dMaestro *maestro, RwStream *stream);
+
+
+extern Rt2dMaestro *
+Rt2dMaestroForAllAnimations(Rt2dMaestro *maestro,
+ Rt2dMaestroAnimationsCallBack callback, void *data);
+
+extern Rt2dMaestro *
+Rt2dMaestroForAllVisibleAnimations(Rt2dMaestro *maestro,
+ Rt2dMaestroAnimationsCallBack callback, void *data);
+
+extern Rt2dMaestro *
+Rt2dMaestroAddAnimations(Rt2dMaestro *maestro,
+ RwInt32 parent, RwInt32 posInParentScene,
+ Rt2dAnim *anim, Rt2dAnimProps *animProps, Rt2dCelList *celList,
+ RwInt32 *index);
+
+extern Rt2dAnim *
+Rt2dMaestroGetAnimationsByIndex(Rt2dMaestro *maestro, RwInt32 index);
+
+extern Rt2dAnimProps *
+Rt2dMaestroGetAnimPropsByIndex(Rt2dMaestro *maestro, RwInt32 index);
+
+extern Rt2dMaestro *
+Rt2dMaestroUpdateAnimations(Rt2dMaestro *maestro);
+
+extern Rt2dMaestro *
+Rt2dMaestroAddDeltaTime(Rt2dMaestro *maestro, RwReal deltaTime);
+
+extern Rt2dMaestro *
+Rt2dMaestroLock(Rt2dMaestro * maestro);
+
+extern Rt2dMaestro *
+Rt2dMaestroUnlock(Rt2dMaestro *maestro);
+
+extern Rt2dObject *
+Rt2dMaestroGetScene(Rt2dMaestro *maestro);
+
+extern Rt2dMaestro *
+Rt2dMaestroSetScene(Rt2dMaestro *maestro, Rt2dObject *scene);
+
+extern Rt2dObject *
+Rt2dMaestroGetAnimSceneByIndex(Rt2dMaestro *maestro, RwInt32 index);
+
+extern Rt2dMaestro *
+Rt2dMaestroRender(Rt2dMaestro *maestro);
+
+extern Rt2dBBox *
+Rt2dMaestroGetBBox(Rt2dMaestro *maestro);
+
+extern Rt2dMaestro *
+Rt2dMaestroSetBBox(Rt2dMaestro *maestro, Rt2dBBox *bbox);
+
+
+/*
+ * Message & Message handlers.
+ */
+extern Rt2dMessageHandlerCallBack
+Rt2dMaestroGetMessageHandler(Rt2dMaestro *maestro);
+
+extern Rt2dMaestro *
+Rt2dMaestroSetMessageHandler(Rt2dMaestro *maestro, Rt2dMessageHandlerCallBack handler);
+
+extern Rt2dMaestro *
+Rt2dMaestroAddMessageList(Rt2dMaestro *maestro,
+ Rt2dMessage *message, RwInt32 num, RwInt32 *index);
+
+extern Rt2dMaestro *
+Rt2dMaestroPostMessages(Rt2dMaestro *maestro, Rt2dMessage *message, RwInt32 num);
+
+extern Rt2dMaestro *
+Rt2dMaestroProcessMessages(Rt2dMaestro *maestro);
+
+#if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE))
+
+#define Rt2dMessageGetMessageType(_message) \
+ _rt2dMessageGetMessageTypeMacro((_message));
+
+#define Rt2dMessageSetMessageTypeMacro(_message, _messageType) \
+ _rt2dMessageSetMessageTypeMacro((_message), (_messageType));
+
+#define Rt2dMessageGetIndex(_message) \
+ _rt2dMessageGetIndexMacro((_message));
+
+#define Rt2dMessageSetIndex(_message, _index) \
+ _rt2dMessageSetIndexMarco((_message), (_index));
+
+#define Rt2dMessageSetParam(_message, _param1, _param2) \
+ _rt2dMessageSetParamMacro((_message), (_param1), (_param2));
+
+#define Rt2dMessageGetParam(_message, _param1, _param2) \
+ _rt2dMessageGetParamMacro((_message), (_param1), (_param2));
+
+#else /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */
+
+extern Rt2dMessageType
+Rt2dMessageGetMessageType(Rt2dMessage *message);
+
+extern void
+Rt2dMessageSetMessageType(Rt2dMessage *message, Rt2dMessageType messageType);
+
+extern RwInt32
+Rt2dMessageGetIndex(Rt2dMessage *message);
+
+extern void
+Rt2dMessageSetIndex(Rt2dMessage *message, RwInt32 index);
+
+extern void
+Rt2dMessageGetParam(Rt2dMessage *message, RwInt32 *param1, RwInt32 *param2);
+
+extern void
+Rt2dMessageSetParam(Rt2dMessage *message, RwInt32 param1, RwInt32 param2);
+
+#endif /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */
+
+/*
+ * Default message handler.
+ */
+extern Rt2dMessage *
+Rt2dMessageHandlerDefaultCallBack(Rt2dMaestro *maestro, Rt2dMessage *message);
+
+
+/*
+ * Labels.
+ */
+extern Rt2dStringLabel *
+Rt2dMaestroFindStringLabel(Rt2dMaestro *maestro,
+ Rt2dStringLabelType entityType, const RwChar *lookupName,
+ RwInt32 *index);
+
+extern Rt2dStringLabel *
+Rt2dMaestroGetStringLabelByIndex(Rt2dMaestro *maestro, RwInt32 index);
+
+extern Rt2dMaestro *
+Rt2dMaestroAddStringLabel(Rt2dMaestro *maestro,
+ Rt2dStringLabelType entityType, const RwChar *name,
+ void *internalData, RwInt32 *index);
+
+extern const RwChar *
+Rt2dMaestroGetStringLabelName(Rt2dMaestro *maestro,
+ Rt2dStringLabel *strLabel);
+
+
+#if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE))
+
+#define Rt2dStringLabelGetStringLabelType(_strLabel) \
+ _rt2dStringLabelGetStringLabelTypeMacro((_strLabel))
+
+#define Rt2dStringLabelSetStringLabelType(_strLabel, _entityType) \
+ _rt2dStringLabelSetStringLabelTypeMacro((_strLabel), (_entityType))
+
+#define Rt2dStringLabelGetNameIndex(_strLabel) \
+ _rt2dStringLabelGetNameIndexMacro((_strLabel))
+
+#define Rt2dStringLabelSetNameIndex(_strLabel, _index) \
+ _rt2dStringLabelSetNameIndexMacro((_strLabel), (_index))
+
+#define Rt2dStringLabelGetInternalData(_strLabel) \
+ _rt2dStringLabelGetInternalDataMacro((_strLabel))
+
+#define Rt2dStringLabelSetInternalData(_strLabel, _internalData) \
+ _rt2dStringLabelSetInternalDataMacro((_strLabel), (_internalData))
+
+#define Rt2dStringLabelGetUserData(_strLabel) \
+ _rt2dStringLabelGetUserDataMacro((_strLabel))
+
+#define Rt2dStringLabelSetUserData(_strLabel, _userData) \
+ _rt2dStringLabelSetUserDataMacro((_strLabel), (_userData))
+
+#else /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */
+
+extern Rt2dStringLabelType
+Rt2dStringLabelGetStringLabelType(Rt2dStringLabel *strLabel);
+
+extern void
+Rt2dStringLabelSetStringLabelType(Rt2dStringLabel *strLabel,
+ Rt2dStringLabelType entityType);
+
+extern RwInt32
+Rt2dStringLabelGetNameIndex(Rt2dStringLabel *strLabel);
+
+extern void
+Rt2dStringLabelSetNameIndex(Rt2dStringLabel *strLabel, RwInt32 index);
+
+extern void *
+Rt2dStringLabelGetInternalData(Rt2dStringLabel *strLabel);
+
+extern void
+Rt2dStringLabelSetInternalData(Rt2dStringLabel *strLabel, void *internalData);
+
+extern void *
+Rt2dStringLabelGetUserData(Rt2dStringLabel *strLabel);
+
+extern void
+Rt2dStringLabelSetUserData(Rt2dStringLabel *strLabel, void *userData);
+
+#endif /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */
+
+
+
+
+/*
+ * Cels & Cel Lists
+ */
+extern Rt2dCelList *
+Rt2dMaestroGetCelListByIndex(Rt2dMaestro *maestro, RwInt32 index);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* RWPUBLICEND */
+
+#endif /* RT2DANIM_H*/
diff --git a/sdk/rwsdk/include/d3d8/rt2danim.rpe b/sdk/rwsdk/include/d3d8/rt2danim.rpe
new file mode 100644
index 00000000..0e61ec5c
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rt2danim.rpe
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_Criterion2DAnim
+{
+
+
+
+ e_rwdb_Criterion2DAnimLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_Criterion2DAnim e_rwdb_Criterion2DAnim;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtanim.h b/sdk/rwsdk/include/d3d8/rtanim.h
new file mode 100644
index 00000000..4def7f1f
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtanim.h
@@ -0,0 +1,638 @@
+#ifndef RTANIM_H
+#define RTANIM_H
+
+#include <rtanim.rpe> /* automatically generated header file */
+
+#define rtANIMSTREAMCURRENTVERSION 0x100
+
+/* Doxygen plugin groups. */
+
+/**
+ * \defgroup rtanim RtAnim
+ * \ingroup animtools
+ *
+ * Animation Toolkit for RenderWare Graphics.
+ */
+
+/**
+ * \ingroup rtanim
+ * Typedef for struct \ref RtAnimAnimation.
+ */
+typedef struct RtAnimAnimation RtAnimAnimation;
+
+/*
+ * The following CallBacks are needed for each interpolation scheme.
+ * See RtAnimInterpolatorInfo.
+ */
+
+/**
+ * \ingroup rtanim
+ * \ref RtAnimKeyFrameApplyCallBack
+ * defines a callback function for converting
+ * an interpolated animation keyframe into the required result.
+ *
+ * \param result Void pointer to store the output of the conversion.
+ * \param voidIFrame Void pointer to the keyframe and should be cast
+ * to the interpolated keyframe type this callback
+ * is for.
+ */
+typedef void (*RtAnimKeyFrameApplyCallBack) (void *result, void *voidIFrame);
+
+/**
+ * \ingroup rtanim
+ * \ref RtAnimKeyFrameBlendCallBack
+ * defines a callback function for blending between two
+ * interpolated keyframes by the given blend factor. This is used for
+ * blending the states of two different \ref RtAnimInterpolator objects.
+ * The \ref RtAnimKeyFrameInterpolateCallBack is used for interpolating
+ * actual animation keyframes into an interpolated frame.
+ *
+ * \param voidOut Void pointer to store the output of the blend.
+ * \param voidIn1 Void pointer containing the first input
+ * interpolated keyframe.
+ * \param voidIn2 Void pointer containing the second input
+ * interpolated keyframe.
+ * \param alpha \ref RwReal containing the blend factor.
+ */
+typedef void (*RtAnimKeyFrameBlendCallBack) (void *voidOut, void *voidIn1,
+ void *voidIn2, RwReal alpha);
+
+/**
+ * \ingroup rtanim
+ * \ref RtAnimKeyFrameInterpolateCallBack
+ * defines a callback function for interpolating between two
+ * animation keyframes according to the given time. The output is
+ * an interpolated frame object residing in an \ref RtAnimInterpolator
+ * and will usually have the same structure as the keyframe apart from
+ * the header data (\ref RtAnimInterpFrameHeader).
+ *
+ * \param voidOut Void pointer for the output of the interpolation.
+ * \param voidIn1 Void pointer containing the first input keyframe.
+ * \param voidIn2 Void pointer containing the second input keyframe.
+ * \param time \ref RwReal containing the time at which to interpolate.
+ */
+typedef void (*RtAnimKeyFrameInterpolateCallBack) (void *voidOut, void *voidIn1,
+ void *voidIn2, RwReal time);
+
+/**
+ * \ingroup rtanim
+ * \ref RtAnimKeyFrameAddCallBack
+ * defines a callback function for adding two interpolated
+ * keyframes together. This is used when adding the states of two
+ * \ref RtAnimInterpolator objects, such as when adding a delta animation
+ * to a base animation.
+ *
+ * \param voidOut Void pointer for the output interpolated frame.
+ * \param voidIn1 Void pointer containing the first input
+ * interpoalted keyframe.
+ * \param voidIn2 Void pointer containing the second input
+ * interpolated keyframe.
+ */
+typedef void (*RtAnimKeyFrameAddCallBack) (void *voidOut, void *voidIn1,
+ void *voidIn2);
+
+/**
+ * \ingroup rtanim
+ * \ref RtAnimKeyFrameMulRecipCallBack
+ * defines a callback function for multiplying a keyframe
+ * by the inverse of another keyframe. This is used for creating delta
+ * animations.
+ *
+ * \param voidFrame Void pointer for the keyframe to be modified.
+ * \param voidStart Void pointer for the start keyframe to take the reciprocal of.
+ */
+typedef void (*RtAnimKeyFrameMulRecipCallBack)
+ (void *voidFrame, void *voidStart);
+
+/**
+ * \ingroup rtanim
+ * \ref RtAnimKeyFrameStreamReadCallBack
+ * defines a callback function for reading in keyframes
+ * from an \ref RwStream for the given animation.
+ *
+ * \param stream Pointer to the \ref RwStream to read the keyframes from.
+ * \param animation Pointer to the \ref RtAnimAnimation to read the keyframes into.
+ *
+ * \return Pointer to the \ref RtAnimAnimation.
+ */
+typedef RtAnimAnimation * (*RtAnimKeyFrameStreamReadCallBack)
+ (RwStream *stream, RtAnimAnimation *animation);
+
+/**
+ * \ingroup rtanim
+ * \ref RtAnimKeyFrameStreamWriteCallBack
+ * defines a callback function for writing keyframes from the
+ * given animation to an \ref RwStream.
+ *
+ * \param animation Pointer to the \ref RtAnimAnimation to write out from.
+ * \param stream Pointer to the \ref RwStream to write the keyframes to.
+ *
+ * \return \ref RwBool, TRUE if successful.
+ */
+typedef RwBool (*RtAnimKeyFrameStreamWriteCallBack)
+ (RtAnimAnimation *animation, RwStream *stream);
+
+/**
+ * \ingroup rtanim
+ * \ref RtAnimKeyFrameStreamGetSizeCallBack
+ * defines a callback function for calculating the binary stream
+ * size of keyframe data within an animation.
+ *
+ * \param animation Pointer to the \ref RtAnimAnimation to calculate sizes from.
+ *
+ * \return \ref RwInt32 containing the size, in bytes, of the keyframe data.
+ */
+typedef RwInt32 (*RtAnimKeyFrameStreamGetSizeCallBack)
+ (RtAnimAnimation *animation);
+
+/**
+ * \ingroup rtanim
+ * \ref RtAnimInterpolatorInfo
+ * Typedef for struct \ref RtAnimInterpolatorInfo
+ */
+typedef struct RtAnimInterpolatorInfo RtAnimInterpolatorInfo;
+
+/**
+ * \ingroup rtanim
+ * \struct RtAnimInterpolatorInfo
+ * This structure is used to hold information for a keyframe interpolation scheme.
+ *
+ * \see RtAnimRegisterInterpolationScheme
+ * \see RtAnimGetInterpolatorInfo
+ */
+struct RtAnimInterpolatorInfo
+{
+ RwInt32 typeID;
+ /**< The ID of the interpolation scheme. */
+ RwInt32 keyFrameSize;
+ /**< Size, in bytes, of the keyframe structure. */
+ RtAnimKeyFrameApplyCallBack keyFrameApplyCB;
+ /**< Pointer to a function that converts a keyframe to the needed
+ * format. This function is never called from the \ref rtanim
+ * toolkit (as the toolit doesn't know the data layout of the
+ * results) but is stored to ease the creation of overloaded
+ * interpolators. */
+ RtAnimKeyFrameBlendCallBack keyFrameBlendCB;
+ /**< Pointer to a function that blends between two
+ * interpolated keyframes, for the purpose of blending
+ * between the states of two \ref RtAnimInterpolator objects. */
+ RtAnimKeyFrameInterpolateCallBack keyFrameInterpolateCB;
+ /**< Pointer to a function that interpolates between two keyframes
+ * for a given time in between. */
+ RtAnimKeyFrameAddCallBack keyFrameAddCB;
+ /**< Pointer to a function that adds two interpolated keyframes
+ * for the purpose of adding the states of two
+ * \ref RtAnimInterpolator objects. */
+ RtAnimKeyFrameMulRecipCallBack keyFrameMulRecipCB;
+ /**< Pointer to a function that multiplies a keyframe by the
+ * reciprocal of another. */
+ RtAnimKeyFrameStreamReadCallBack keyFrameStreamReadCB;
+ /**< Pointer to a function that reads the keyframes from a stream
+ * for a given animation. */
+ RtAnimKeyFrameStreamWriteCallBack keyFrameStreamWriteCB;
+ /**< Pointer to a function that writes the keyframes to a stream for
+ * a given animation. */
+ RtAnimKeyFrameStreamGetSizeCallBack keyFrameStreamGetSizeCB;
+ /**< Pointer to a function that returns the binary stream size of
+ * the keyframes for a given animation. */
+};
+
+
+/**
+ * \ingroup rtanim
+ * \struct RtAnimAnimation
+ * A keyframed animation consists of an array of keyframe structures,
+ * along with some flags and a duration.
+ *
+ * The keyframes should be presented in the order they are needed
+ * to animate forwards through time. That is, the next keyframe
+ * at some point in the sequence should correspond to the node whose
+ * previous two keyframes are next to expire as an interpolation
+ * pair.
+ *
+ * Put another way, the correct ordering can be achieved by sorting
+ * an unordered keyframe array using the following primary and secondary
+ * sort keys:-
+ *
+ * - time of previous keyframe for node
+ * - node index
+ *
+ * An example is shown in the following diagram, where each vertical bar
+ * indicates a keyframe point in time. The position of the keyframe
+ * within the animation sequence is shown by an index to the left of
+ * each bar.
+ *
+ * \verbatim
+
+ t=0 t=duration
+ node 0 kf0..| kf3.......| kf8....| kf10....|
+ node 1 kf1..| kf4...| kf6........| kf11....|
+ node 2 kf2..| kf5.....| kf7..| kf9.........|
+
+ \endverbatim
+ *
+ * Each node MUST have an initial keyframe at time = 0.0, and a terminal
+ * keyframe at time = duration of the animation.
+ *
+ * Pointers link all of the keyframes for a particular node backwards
+ * through time in a list.
+ *
+ * \see RtAnimAnimationCreate
+ */
+struct RtAnimAnimation
+{
+ RtAnimInterpolatorInfo *interpInfo;
+ /**< Pointer to interpolation scheme information */
+ RwInt32 numFrames;
+ /**< Number of keyframes in the animation */
+ RwInt32 flags;
+ /**< Specifies details about animation,
+ * relative translation modes etc. */
+ RwReal duration;
+ /**< Duration of animation in seconds */
+ void *pFrames;
+ /**< Pointer to the animation keyframes */
+};
+
+/**
+ * \ingroup rtanim
+ * \ref RtAnimKeyFrameHeader
+ * Typedef for struct RtAnimKeyFrameHeader
+ */
+typedef struct RtAnimKeyFrameHeader RtAnimKeyFrameHeader;
+
+/**
+ * \ingroup rtanim
+ * \struct RtAnimKeyFrameHeader
+ * holds header information for a keyframe. All keyframe structures used with
+ * the overloadable interpolation system should start with this data.
+ *
+ * \see RtAnimRegisterInterpolationScheme
+ */
+struct RtAnimKeyFrameHeader
+{
+ void *prevFrame;
+ /**< Previous keyframe for particular hierarchy node */
+ RwReal time;
+ /**< Time at keyframe */
+};
+
+/**
+ * \ingroup rtanim
+ * \ref RtAnimInterpFrameHeader
+ * Typedef for struct RtAnimInterpFrameHeader
+ */
+typedef struct RtAnimInterpFrameHeader RtAnimInterpFrameHeader;
+
+/**
+ * \ingroup rtanim
+ * \struct RtAnimInterpFrameHeader
+ * is the header for an interpolated animation frame, intermediate
+ * between a keyframe pair. This structure is intentionally the same size as an
+ * \ref RtAnimKeyFrameHeader, so that an interpolated frame and key frame data
+ * block can be otherwise identical. It relies on the
+ * fact that the prevFrame and time fields of a keyframe header are not
+ * relevant to an interpolated frame. These fields should therefore not be
+ * be modified by a custom keyframe interpolator.
+ *
+ * \see RtAnimRegisterInterpolationScheme
+ */
+struct RtAnimInterpFrameHeader
+{
+ RtAnimKeyFrameHeader *keyFrame1;
+ /**< Pointer to the first of the current pair of keyframes in
+ the associated \ref RtAnimAnimation */
+ RtAnimKeyFrameHeader *keyFrame2;
+ /**< Pointer to the second of the current pair of keyframes in
+ the associated \ref RtAnimAnimation */
+};
+
+/**
+ * \ingroup rtanim
+ * \ref RtAnimInterpolator
+ * Typedef for struct \ref RtAnimInterpolator
+ */
+typedef struct RtAnimInterpolator RtAnimInterpolator;
+
+/**
+ * \ingroup rtanim
+ * \ref RtAnimCallBack
+ * defines a callback function for use with the
+ * \ref RtAnimInterpolatorSetAnimCallBack and
+ * \ref RtAnimInterpolatorSetAnimLoopCallBack functions.
+ *
+ * \param animInstance
+ * A pointer to the \ref RtAnimInterpolator structure.
+ *
+ * \param data Void pointer for user-defined data.
+ * You can use this to pass your own data
+ * structure(s) to the callback function.
+ *
+ * \see RtAnimInterpolatorSetAnimCallBack
+ * \see RtAnimInterpolatorSetAnimLoopCallBack
+ *
+ */
+
+typedef RtAnimInterpolator * (*RtAnimCallBack)
+ (RtAnimInterpolator *animInstance,
+ void *data);
+
+/**
+ * \ingroup rtanim
+ * \struct RtAnimInterpolator
+ * holds the current state for a particular instance of an animation,
+ * corresponding to a specific point in time.
+ *
+ * The current interpolated keyframes are stored in an array after the
+ * end of this structure. For advanced use, these may be accessed
+ * using the macro rtANIMGETINTERPFRAME(interpolator, nodeIndex)
+ * which takes a pointer to the interpolator and the node index
+ * for the interpolated keyframe required.
+ *
+ * \see \ref RtAnimInterpolatorCreate
+ * \see \ref RtAnimInterpolatorDestroy
+ * \see \ref RtAnimInterpolatorSetCurrentAnim
+ * \see \ref RtAnimInterpolatorGetCurrentAnim
+ * \see \ref RtAnimInterpolatorSetKeyFrameCallBacks
+ * \see \ref RtAnimInterpolatorSetAnimLoopCallBack
+ * \see \ref RtAnimInterpolatorSetAnimCallBack
+ * \see \ref RtAnimInterpolatorCopy
+ * \see \ref RtAnimInterpolatorSubAnimTime
+ * \see \ref RtAnimInterpolatorAddAnimTime
+ * \see \ref RtAnimInterpolatorSetCurrentTime
+ * \see \ref RtAnimCallBack
+ */
+struct RtAnimInterpolator
+{
+ RtAnimAnimation *pCurrentAnim;
+ /**< Current \ref RtAnimAnimation applied */
+ RwReal currentTime;
+ /**< Current animation time */
+ void *pNextFrame;
+ /**< Next animation keyframe to be played */
+ RtAnimCallBack pAnimCallBack;
+ /**< Animation callback function pointer */
+ void *pAnimCallBackData;
+ /**< Animation callback function user data */
+ RwReal animCallBackTime;
+ /**< Trigger time for callback function */
+ RtAnimCallBack pAnimLoopCallBack;
+ /**< Animation loop callback function pointer */
+ void *pAnimLoopCallBackData;
+ /**< Animation loop callback function data */
+ RwInt32 maxKeyFrameSize;
+ /**< Maximum size of keyframes usable on
+ * this animation (set at creation time) */
+ RwInt32 currentKeyFrameSize;
+ /**< Size of keyframes in the current
+ * animation */
+ RwInt32 numNodes;
+ /**< Number of nodes driven by the animation */
+ RwBool isSubInterpolator;
+ /**< Internal use */
+ RwInt32 offsetInParent;
+ /**< Internal use */
+ RtAnimInterpolator *parentAnimation;
+ /**< Internal use */
+
+ RtAnimKeyFrameApplyCallBack keyFrameApplyCB;
+ /**< Internal use */
+ RtAnimKeyFrameBlendCallBack keyFrameBlendCB;
+ /**< Internal use */
+ RtAnimKeyFrameInterpolateCallBack keyFrameInterpolateCB;
+ /**< Internal use */
+ RtAnimKeyFrameAddCallBack keyFrameAddCB;
+ /**< Internal use */
+};
+
+/* Access to array of interpolated frames occupying a block of memory
+ * after the end of the RtAnimInterpolator structure.
+ */
+#define rtANIMGETINTERPFRAME( anim, nodeIndex ) \
+ ( (void *)( ( (RwUInt8 *)&(anim[1]) + \
+ ((nodeIndex) * \
+ anim->currentKeyFrameSize) ) ) )
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+/* Engine functions */
+extern void
+RtAnimAnimationFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern RwBool
+RtAnimInitialize(void);
+
+extern RwBool
+RtAnimRegisterInterpolationScheme(RtAnimInterpolatorInfo *interpolatorInfo);
+
+extern RtAnimInterpolatorInfo *
+RtAnimGetInterpolatorInfo(RwInt32 typeID);
+
+/* RtAnimAnimation */
+extern RtAnimAnimation *
+RtAnimAnimationCreate(RwInt32 typeID,
+ RwInt32 numFrames,
+ RwInt32 flags,
+ RwReal duration);
+
+extern RtAnimAnimation *
+RtAnimAnimationDestroy(RtAnimAnimation *animation);
+
+extern RtAnimAnimation *
+RtAnimAnimationRead(const RwChar * filename);
+
+extern RwBool
+RtAnimAnimationWrite(RtAnimAnimation *animation,
+ const RwChar * filename);
+
+extern RtAnimAnimation *
+RtAnimAnimationStreamRead(RwStream *stream);
+
+extern RwBool
+RtAnimAnimationStreamWrite(RtAnimAnimation *animation,
+ RwStream *stream);
+
+extern RwInt32
+RtAnimAnimationStreamGetSize(RtAnimAnimation *animation);
+
+extern RwUInt32
+RtAnimAnimationGetNumNodes(RtAnimAnimation *animation);
+
+#ifdef RWDEBUG
+
+extern RwInt32
+RtAnimAnimationGetTypeID(RtAnimAnimation *animation);
+
+#else /* RWDEBUG */
+
+#define RtAnimAnimationGetTypeID(animation) \
+ (animation->interpInfo->typeID)
+
+#endif /* RWDEBUG */
+
+/* RtAnimInterpolator */
+extern RtAnimInterpolator *
+RtAnimInterpolatorCreate(RwInt32 numNodes,
+ RwInt32 maxKeyFrameSize);
+
+extern void
+RtAnimInterpolatorDestroy(RtAnimInterpolator *anim);
+
+extern RwBool
+RtAnimInterpolatorSetCurrentAnim(RtAnimInterpolator *animI,
+ RtAnimAnimation *anim);
+
+
+#ifdef RWDEBUG
+
+extern RtAnimAnimation *
+RtAnimInterpolatorGetCurrentAnim(RtAnimInterpolator *animI);
+
+#else /* RWDEBUG */
+
+#define RtAnimInterpolatorGetCurrentAnim(animI) \
+ (animI->pCurrentAnim)
+
+#endif /* RWDEBUG */
+
+
+extern RwBool
+RtAnimInterpolatorSetKeyFrameCallBacks(RtAnimInterpolator *anim,
+ RwInt32 keyFrameTypeID);
+
+
+extern void
+RtAnimInterpolatorSetAnimLoopCallBack(RtAnimInterpolator *anim,
+ RtAnimCallBack callBack,
+ void *data );
+
+extern void
+RtAnimInterpolatorSetAnimCallBack(RtAnimInterpolator *anim,
+ RtAnimCallBack callBack,
+ RwReal time,
+ void *data );
+
+extern RwBool
+RtAnimInterpolatorCopy(RtAnimInterpolator *outAnim,
+ RtAnimInterpolator *inAnim);
+
+extern RwBool
+RtAnimInterpolatorSubAnimTime(RtAnimInterpolator *anim,
+ RwReal time);
+
+extern RwBool
+RtAnimInterpolatorAddAnimTime(RtAnimInterpolator *anim,
+ RwReal time);
+
+extern RwBool
+RtAnimInterpolatorSetCurrentTime(RtAnimInterpolator *anim,
+ RwReal time);
+
+extern RwBool
+RtAnimAnimationMakeDelta(RtAnimAnimation *animation,
+ RwInt32 numNodes,
+ RwReal time);
+
+
+extern RwBool
+RtAnimInterpolatorBlend(RtAnimInterpolator *outAnim,
+ RtAnimInterpolator *inAnim1,
+ RtAnimInterpolator *inAnim2,
+ RwReal alpha);
+
+extern RwBool
+RtAnimInterpolatorAddTogether(RtAnimInterpolator *outAnim,
+ RtAnimInterpolator *inAnim1,
+ RtAnimInterpolator *inAnim2);
+
+#define RtAnimKeyFrameApplyMacro(animation, out, in) \
+MACRO_START \
+{ \
+ (anim)->keyFrameApplyCB((out), (in1), (in2), (time)); \
+} \
+MACRO_STOP
+
+
+#define RtAnimKeyFrameInterpolateMacro(anim, out, in1, in2, time) \
+MACRO_START \
+{ \
+ (anim)->keyFrameInterpolateCB((out), (in1), (in2), (time)); \
+} \
+MACRO_STOP
+
+#define RtAnimKeyFrameBlendMacro(anim, out, in1, in2, fAlpha) \
+MACRO_START \
+{ \
+ (anim)->keyFrameBlendCB((out), (in1), (in2), (fAlpha)); \
+} \
+MACRO_STOP
+
+#define RtAnimKeyFrameAddTogetherMacro(anim, out, in1, in2) \
+MACRO_START \
+{ \
+ (anim)->keyFrameAddCB((out), (in1), (in2)); \
+} \
+MACRO_STOP
+
+#ifdef RWDEBUG
+extern void
+RtAnimKeyFrameApply(RtAnimInterpolator *animation,
+ void *result, void *iFrame);
+
+extern void
+RtAnimKeyFrameInterpolate(RtAnimInterpolator *animation,
+ void *out, void *in1,
+ void *in2, RwReal time);
+
+extern void
+RtAnimKeyFrameBlend(RtAnimInterpolator *animation,
+ void *out,
+ void *in1,
+ void *in2,
+ RwReal alpha);
+
+extern void
+RtAnimKeyFrameAddTogether(RtAnimInterpolator *animation,
+ void *out, void *in1, void *in2);
+
+#else /* RWDEBUG */
+#define RtAnimKeyFrameApply(animation, out, in) \
+ RtAnimKeyFrameApplyMacro(animation, out, in)
+
+#define RtAnimKeyFrameInterpolate(animation, out, in1, in2, time) \
+ RtAnimKeyFrameInterpolateMacro(animation, out, in1, in2, time)
+
+#define RtAnimKeyFrameBlend(animation, out, in1, in2, alpha) \
+ RtAnimKeyFrameBlendMacro(animation, out, in1, in2, alpha)
+
+#define RtAnimKeyFrameAddTogether(animation, out, in1, in2) \
+ RtAnimKeyFrameAddTogetherMacro(animation, out, in1, in2)
+#endif /* RWDEBUG */
+
+extern RtAnimInterpolator *
+RtAnimInterpolatorCreateSubInterpolator(
+ RtAnimInterpolator *parentAnim,
+ RwInt32 startNode,
+ RwInt32 numNodes,
+ RwInt32 maxKeyFrameSize);
+
+extern RwBool
+RtAnimInterpolatorBlendSubInterpolator(RtAnimInterpolator *outAnim,
+ RtAnimInterpolator *inAnim1,
+ RtAnimInterpolator *inAnim2,
+ RwReal alpha);
+
+extern RwBool
+RtAnimInterpolatorAddSubInterpolator(RtAnimInterpolator *outAnim,
+ RtAnimInterpolator *mainAnim,
+ RtAnimInterpolator *subAnim);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RTANIM_H */
diff --git a/sdk/rwsdk/include/d3d8/rtanim.rpe b/sdk/rwsdk/include/d3d8/rtanim.rpe
new file mode 100644
index 00000000..ae8fcf33
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtanim.rpe
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionAnim
+{
+
+
+E_RT_ANIM_INTERP_IDINUSE,
+
+E_RT_ANIM_INTERP_BLOCKFULL,
+
+E_RT_ANIM_INTERP_IDUNKNOWN,
+
+ e_rwdb_CriterionAnimLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionAnim e_rwdb_CriterionAnim;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtbary.h b/sdk/rwsdk/include/d3d8/rtbary.h
new file mode 100644
index 00000000..2531914d
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtbary.h
@@ -0,0 +1,141 @@
+/***************************************************************************
+ * *
+ * Module : rtbary.h *
+ * *
+ * Purpose : Barycentric operations *
+ * *
+ **************************************************************************/
+
+#ifndef RTBARY_H
+#define RTBARY_H
+
+/**
+ * \defgroup rtbary RtBary
+ * \ingroup mathtools
+ *
+ * Barycentric Toolkit for RenderWare.
+ */
+
+
+/****************************************************************************
+ Includes
+ */
+
+#include <rwcore.h>
+
+#include <rtbary.rpe> /* automatically generated header file */
+
+
+/****************************************************************************
+ Global types
+ */
+
+/**
+ * \ingroup rtbary
+ * \ref RtBaryV4d
+ * typedef for the 4 element homogeneous row of a transform matrix mapping
+ * a point from Cartesian space to the barycentric space defined by a triangle.
+ */
+typedef RwReal RtBaryV4d[4];
+
+/**
+ * \ingroup rtbary
+ * \ref RtBaryTransform
+ * typedef for the 4x4 homogeneous transform matrix mapping a point
+ * from Cartesian space to the barycentric space defined by a triangle.
+ */
+typedef RtBaryV4d RtBaryTransform[4];
+
+/****************************************************************************
+ Defines
+ */
+
+#define RtBaryV3dFromWeightsMacro(_out, _b, _v0, _v1, _v2) \
+MACRO_START \
+{ \
+ (_out)->x = (RwReal)( ((_v0)->x * (_b)[0]) + \
+ ((_v1)->x * (_b)[1]) + \
+ ((_v2)->x * (_b)[2]) ); \
+ (_out)->y = (RwReal)( ((_v0)->y * (_b)[0]) + \
+ ((_v1)->y * (_b)[1]) + \
+ ((_v2)->y * (_b)[2]) ); \
+ (_out)->z = (RwReal)( ((_v0)->z * (_b)[0]) + \
+ ((_v1)->z * (_b)[1]) + \
+ ((_v2)->z * (_b)[2]) ); \
+} \
+MACRO_STOP
+
+#define RtBaryWeightsFromV3dMacro(_out, _m, _in) \
+MACRO_START \
+{ \
+ (_out)[0] = ( (_m)[0][0] * (_in)->x + \
+ (_m)[1][0] * (_in)->y + \
+ (_m)[2][0] * (_in)->z + \
+ (_m)[3][0] ); \
+ (_out)[1] = ( (_m)[0][1] * (_in)->x + \
+ (_m)[1][1] * (_in)->y + \
+ (_m)[2][1] * (_in)->z + \
+ (_m)[3][1] ); \
+ (_out)[2] = ( (_m)[0][2] * (_in)->x + \
+ (_m)[1][2] * (_in)->y + \
+ (_m)[2][2] * (_in)->z + \
+ (_m)[3][2] ); \
+ (_out)[3] = ( (_m)[0][3] * (_in)->x + \
+ (_m)[1][3] * (_in)->y + \
+ (_m)[2][3] * (_in)->z + \
+ (_m)[3][3] ); \
+} \
+MACRO_STOP
+
+#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ))
+
+#define RtBaryV3dFromWeights(_out, _b, _v0, _v1, _v2) \
+ RtBaryV3dFromWeightsMacro(_out, _b, _v0, _v1, _v2)
+
+#define RtBaryWeightsFromV3d(_out, _m, _in) \
+ RtBaryWeightsFromV3dMacro(_out, _m, _in)
+
+#endif /* (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwBool
+RtBaryGetTransform(RtBaryTransform m,
+ RwReal * const area,
+ const RwV3d * const v0,
+ const RwV3d * const v1,
+ const RwV3d * const v2);
+
+#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )
+
+extern void
+RtBaryV3dFromWeights(RwV3d * const out,
+ const RtBaryV4d weights,
+ const RwV3d * const v0,
+ const RwV3d * const v1,
+ const RwV3d * const v2);
+
+extern void
+RtBaryWeightsFromV3d(RtBaryV4d out,
+ RtBaryTransform mat,
+ const RwV3d * const in);
+
+extern void
+_rtImportWorldBaryFromEdge(RtBaryV4d out,
+ RtBaryTransform mat,
+ const RwV3d * const in);
+
+#endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RTBARY_H */
diff --git a/sdk/rwsdk/include/d3d8/rtbary.rpe b/sdk/rwsdk/include/d3d8/rtbary.rpe
new file mode 100644
index 00000000..0fec6a77
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtbary.rpe
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionBary
+{
+
+
+
+ e_rwdb_CriterionBaryLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionBary e_rwdb_CriterionBary;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtbezpat.h b/sdk/rwsdk/include/d3d8/rtbezpat.h
new file mode 100644
index 00000000..f25f5ce9
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtbezpat.h
@@ -0,0 +1,396 @@
+/*
+ * Data structures for rtbezpat toolkit
+ * Copyright (c) Criterion Software Limited
+ */
+
+#if (!defined(RTBEZPAT_H))
+#define RTBEZPAT_H
+
+/**
+ * \defgroup rtbezpatch RtBezPat
+ * \ingroup mathtools
+ *
+ * The Bezier Patch Toolkit is a group of functions that support the way
+ * RenderWare processes patches.
+ */
+
+typedef struct RtBezierV4d RtBezierV4d;
+
+/**
+ * \ingroup rtbezpatch
+ * \struct RtBezierV4d
+ * This type represents 4d points and vectors specified by
+ * the (x, y, z, w) coordinates of a 4d point or
+ * the (x, y, z, w) components of a 4d vector.
+ */
+struct RtBezierV4d
+{
+ RwReal x;
+ /**< X value */
+ RwReal y;
+ /**< Y value */
+ RwReal z;
+ /**< Z value */
+ RwReal w;
+ /**< W value */
+};
+
+/**
+ * \ingroup rtbezpatch
+ * \ref RtBezierRow
+ * typedef for a row of vectors.
+ * RtBezierRow is an array of 4 vectors
+ */
+typedef RtBezierV4d RtBezierRow[4];
+
+/**
+ * \ingroup rtbezpatch
+ * \ref RtBezierMatrix
+ * typedef for a matrix of 4*4 vectors.
+ * RtBezierMatrix is an array of 4 rows.
+ */
+typedef RtBezierRow RtBezierMatrix[4];
+
+/*
+ * Bernstein polynomials;
+ */
+
+#define RtBern03(_u, _cu) ( (_cu) * (_cu) * (_cu) )
+#define RtBern13(_u, _cu) ( 3 * (_u) * (_cu) * (_cu) )
+#define RtBern23(_u, _cu) ( 3 * (_u) * (_u) * (_cu) )
+#define RtBern33(_u, _cu) ( (_u) * (_u) * (_u) )
+
+#define RtBezierQuadSample3dMacro(_out, _P, _u, _v) \
+MACRO_START \
+{ \
+ const RtBezierV4d * const P0 = &(_P)[0][0]; \
+ const RtBezierV4d * const P1 = &(_P)[1][0]; \
+ const RtBezierV4d * const P2 = &(_P)[2][0]; \
+ const RtBezierV4d * const P3 = &(_P)[3][0]; \
+ const RwReal _pu = (_u); \
+ const RwReal _cu = ((RwReal)1) - _pu; \
+ const RwReal B03u = RtBern03(_pu,_cu); \
+ const RwReal B13u = RtBern13(_pu,_cu); \
+ const RwReal B23u = RtBern23(_pu,_cu); \
+ const RwReal B33u = RtBern33(_pu,_cu); \
+ const RwReal _pv = (_v); \
+ const RwReal _cv = ((RwReal)1) - _pv; \
+ const RwReal B03v = RtBern03(_pv,_cv); \
+ const RwReal B13v = RtBern13(_pv,_cv); \
+ const RwReal B23v = RtBern23(_pv,_cv); \
+ const RwReal B33v = RtBern33(_pv,_cv); \
+ RtBezierRow A; \
+ \
+ A[0].x = B03u*P0[0].x + B13u*P1[0].x + B23u*P2[0].x + B33u*P3[0].x; \
+ A[0].y = B03u*P0[0].y + B13u*P1[0].y + B23u*P2[0].y + B33u*P3[0].y; \
+ A[0].z = B03u*P0[0].z + B13u*P1[0].z + B23u*P2[0].z + B33u*P3[0].z; \
+ A[1].x = B03u*P0[1].x + B13u*P1[1].x + B23u*P2[1].x + B33u*P3[1].x; \
+ A[1].y = B03u*P0[1].y + B13u*P1[1].y + B23u*P2[1].y + B33u*P3[1].y; \
+ A[1].z = B03u*P0[1].z + B13u*P1[1].z + B23u*P2[1].z + B33u*P3[1].z; \
+ A[2].x = B03u*P0[2].x + B13u*P1[2].x + B23u*P2[2].x + B33u*P3[2].x; \
+ A[2].y = B03u*P0[2].y + B13u*P1[2].y + B23u*P2[2].y + B33u*P3[2].y; \
+ A[2].z = B03u*P0[2].z + B13u*P1[2].z + B23u*P2[2].z + B33u*P3[2].z; \
+ A[3].x = B03u*P0[3].x + B13u*P1[3].x + B23u*P2[3].x + B33u*P3[3].x; \
+ A[3].y = B03u*P0[3].y + B13u*P1[3].y + B23u*P2[3].y + B33u*P3[3].y; \
+ A[3].z = B03u*P0[3].z + B13u*P1[3].z + B23u*P2[3].z + B33u*P3[3].z; \
+ \
+ (_out)->x = A[0].x*B03v + A[1].x*B13v + A[2].x*B23v + A[3].x*B33v; \
+ (_out)->y = A[0].y*B03v + A[1].y*B13v + A[2].y*B23v + A[3].y*B33v; \
+ (_out)->z = A[0].z*B03v + A[1].z*B13v + A[2].z*B23v + A[3].z*B33v; \
+} \
+MACRO_STOP
+
+#define RtBezierQuadDifferenceStepU3dMacro(_row) \
+MACRO_START \
+{ \
+ (_row)[0].x += (_row)[1].x; \
+ (_row)[0].y += (_row)[1].y; \
+ (_row)[0].z += (_row)[1].z; \
+ \
+ (_row)[1].x += (_row)[2].x; \
+ (_row)[1].y += (_row)[2].y; \
+ (_row)[1].z += (_row)[2].z; \
+ \
+ (_row)[2].x += (_row)[3].x; \
+ (_row)[2].y += (_row)[3].y; \
+ (_row)[2].z += (_row)[3].z; \
+ \
+} \
+MACRO_STOP
+
+#define RtBezierQuadDifferenceStepU4dMacro(_row) \
+MACRO_START \
+{ \
+ (_row)[0].x += (_row)[1].x; \
+ (_row)[0].y += (_row)[1].y; \
+ (_row)[0].z += (_row)[1].z; \
+ (_row)[0].w += (_row)[1].w; \
+ \
+ (_row)[1].x += (_row)[2].x; \
+ (_row)[1].y += (_row)[2].y; \
+ (_row)[1].z += (_row)[2].z; \
+ (_row)[1].w += (_row)[2].w; \
+ \
+ (_row)[2].x += (_row)[3].x; \
+ (_row)[2].y += (_row)[3].y; \
+ (_row)[2].z += (_row)[3].z; \
+ (_row)[2].w += (_row)[3].w; \
+ \
+} \
+MACRO_STOP
+
+#define RtBezierQuadDifferenceStepV3dMacro(_mat) \
+MACRO_START \
+{ \
+ RtBezierV4d * const m0 = &(_mat)[0][0]; \
+ RtBezierV4d * const m1 = &(_mat)[1][0]; \
+ RtBezierV4d * const m2 = &(_mat)[2][0]; \
+ RtBezierV4d * const m3 = &(_mat)[3][0]; \
+ \
+ /* (_row) 0 */ \
+ m0[0].x += m1[0].x; \
+ m0[0].y += m1[0].y; \
+ m0[0].z += m1[0].z; \
+ \
+ m0[1].x += m1[1].x; \
+ m0[1].y += m1[1].y; \
+ m0[1].z += m1[1].z; \
+ \
+ m0[2].x += m1[2].x; \
+ m0[2].y += m1[2].y; \
+ m0[2].z += m1[2].z; \
+ \
+ m0[3].x += m1[3].x; \
+ m0[3].y += m1[3].y; \
+ m0[3].z += m1[3].z; \
+ \
+ /* (_row) 1 */ \
+ m1[0].x += m2[0].x; \
+ m1[0].y += m2[0].y; \
+ m1[0].z += m2[0].z; \
+ \
+ m1[1].x += m2[1].x; \
+ m1[1].y += m2[1].y; \
+ m1[1].z += m2[1].z; \
+ \
+ m1[2].x += m2[2].x; \
+ m1[2].y += m2[2].y; \
+ m1[2].z += m2[2].z; \
+ \
+ m1[3].x += m2[3].x; \
+ m1[3].y += m2[3].y; \
+ m1[3].z += m2[3].z; \
+ \
+ /* (_row) 2 */ \
+ m2[0].x += m3[0].x; \
+ m2[0].y += m3[0].y; \
+ m2[0].z += m3[0].z; \
+ \
+ m2[1].x += m3[1].x; \
+ m2[1].y += m3[1].y; \
+ m2[1].z += m3[1].z; \
+ \
+ m2[2].x += m3[2].x; \
+ m2[2].y += m3[2].y; \
+ m2[2].z += m3[2].z; \
+ \
+ m2[3].x += m3[3].x; \
+ m2[3].y += m3[3].y; \
+ m2[3].z += m3[3].z; \
+} \
+MACRO_STOP
+
+#define RtBezierQuadDifferenceStepV4dMacro(_mat) \
+MACRO_START \
+{ \
+ RtBezierV4d * const m0 = &(_mat)[0][0]; \
+ RtBezierV4d * const m1 = &(_mat)[1][0]; \
+ RtBezierV4d * const m2 = &(_mat)[2][0]; \
+ RtBezierV4d * const m3 = &(_mat)[3][0]; \
+ \
+ /* (_row) 0 */ \
+ m0[0].x += m1[0].x; \
+ m0[0].y += m1[0].y; \
+ m0[0].z += m1[0].z; \
+ m0[0].w += m1[0].w; \
+ \
+ m0[1].x += m1[1].x; \
+ m0[1].y += m1[1].y; \
+ m0[1].z += m1[1].z; \
+ m0[1].w += m1[1].w; \
+ \
+ m0[2].x += m1[2].x; \
+ m0[2].y += m1[2].y; \
+ m0[2].z += m1[2].z; \
+ m0[2].w += m1[2].w; \
+ \
+ m0[3].x += m1[3].x; \
+ m0[3].y += m1[3].y; \
+ m0[3].z += m1[3].z; \
+ m0[3].w += m1[3].w; \
+ \
+ /* (_row) 1 */ \
+ m1[0].x += m2[0].x; \
+ m1[0].y += m2[0].y; \
+ m1[0].z += m2[0].z; \
+ m1[0].w += m2[0].w; \
+ \
+ m1[1].x += m2[1].x; \
+ m1[1].y += m2[1].y; \
+ m1[1].z += m2[1].z; \
+ m1[1].w += m2[1].w; \
+ \
+ m1[2].x += m2[2].x; \
+ m1[2].y += m2[2].y; \
+ m1[2].z += m2[2].z; \
+ m1[2].w += m2[2].w; \
+ \
+ m1[3].x += m2[3].x; \
+ m1[3].y += m2[3].y; \
+ m1[3].z += m2[3].z; \
+ m1[3].w += m2[3].w; \
+ \
+ /* (_row) 2 */ \
+ m2[0].x += m3[0].x; \
+ m2[0].y += m3[0].y; \
+ m2[0].z += m3[0].z; \
+ m2[0].w += m3[0].w; \
+ \
+ m2[1].x += m3[1].x; \
+ m2[1].y += m3[1].y; \
+ m2[1].z += m3[1].z; \
+ m2[1].w += m3[1].w; \
+ \
+ m2[2].x += m3[2].x; \
+ m2[2].y += m3[2].y; \
+ m2[2].z += m3[2].z; \
+ m2[2].w += m3[2].w; \
+ \
+ m2[3].x += m3[3].x; \
+ m2[3].y += m3[3].y; \
+ m2[3].z += m3[3].z; \
+ m2[3].w += m3[3].w; \
+} \
+MACRO_STOP
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+extern void
+RtBezierQuadControlFit3d(RtBezierMatrix B,
+ RtBezierMatrix P);
+
+extern void
+RtBezierQuadBernsteinWeight3d(RtBezierMatrix W,
+ RtBezierMatrix B);
+
+extern void
+RtBezierQuadBernsteinWeight4d(RtBezierMatrix W,
+ RtBezierMatrix B);
+
+extern void
+RtBezierQuadPointDifference3d(RtBezierMatrix D,
+ RtBezierMatrix W,
+ RwReal PointU,
+ RwReal PointV,
+ RwReal StepU,
+ RwReal stepV);
+
+extern void
+RtBezierQuadPointDifference4d(RtBezierMatrix D,
+ RtBezierMatrix W,
+ RwReal PointU,
+ RwReal PointV,
+ RwReal StepU,
+ RwReal stepV);
+
+extern void
+RtBezierQuadOriginDifference3d(RtBezierMatrix D,
+ RtBezierMatrix W,
+ RwReal stepU,
+ RwReal setpV);
+
+extern void
+RtBezierQuadOriginDifference4d(RtBezierMatrix D,
+ RtBezierMatrix W,
+ RwReal stepU,
+ RwReal setpV);
+
+#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )
+
+extern void
+RtBezierQuadSample3d(RwV3d * out,
+ RtBezierMatrix B,
+ RwReal u,
+ RwReal v);
+
+extern void RtBezierQuadDifferenceStepU3d(RtBezierRow row);
+extern void RtBezierQuadDifferenceStepU4d(RtBezierRow row);
+
+extern void RtBezierQuadDifferenceStepV3d(RtBezierMatrix mat);
+extern void RtBezierQuadDifferenceStepV4d(RtBezierMatrix mat);
+
+
+#else /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
+
+#define RtBezierQuadSample3d(_out, _P, _u, _v) \
+ RtBezierQuadSample3dMacro(_out, _P, _u, _v)
+
+#define RtBezierQuadDifferenceStepU3d(_row) \
+ RtBezierQuadDifferenceStepU3dMacro(_row)
+
+#define RtBezierQuadDifferenceStepU4d(_row) \
+ RtBezierQuadDifferenceStepU4dMacro(_row)
+
+#define RtBezierQuadDifferenceStepV3d(_mat) \
+ RtBezierQuadDifferenceStepV3dMacro(_mat)
+
+#define RtBezierQuadDifferenceStepV4d(_mat) \
+ RtBezierQuadDifferenceStepV4dMacro(_mat)
+
+#endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
+
+/*
+ *
+ */
+
+extern void
+RtBezierTriangleControlFit3d(RtBezierMatrix T, RtBezierMatrix P);
+
+extern void
+RtBezierQuadFromTriangle(RtBezierMatrix Q, RtBezierMatrix T);
+
+extern void
+RtBezierQuadTangent(RtBezierMatrix D,
+ RwReal theta,
+ RtBezierMatrix P);
+
+extern void
+RtBezierQuadTangentPair(RtBezierMatrix Dt,
+ RtBezierMatrix Dp,
+ RwReal theta,
+ RtBezierMatrix P);
+
+extern void
+RtBezierQuadGetNormals(RtBezierMatrix N,
+ RtBezierMatrix B);
+
+#if (defined(RWDEBUG) && defined(RWVERBOSE))
+
+extern void
+_rtBezierGnuPlot(RtBezierMatrix B,
+ RwChar * name,
+ RwChar * title);
+
+#else /* (defined(RWDEBUG) && defined(RWVERBOSE)) */
+
+#define _rtBezierGnuPlot(B, name, title) /* No-op */
+
+#endif /* (defined(RWDEBUG) && defined(RWVERBOSE)) */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* (!defined(RTBEZPAT_H)) */
diff --git a/sdk/rwsdk/include/d3d8/rtbezpat.rpe b/sdk/rwsdk/include/d3d8/rtbezpat.rpe
new file mode 100644
index 00000000..0f6dc700
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtbezpat.rpe
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionBEZPATCH
+{
+
+
+
+ e_rwdb_CriterionBEZPATCHLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionBEZPATCH e_rwdb_CriterionBEZPATCH;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtbmp.h b/sdk/rwsdk/include/d3d8/rtbmp.h
new file mode 100644
index 00000000..c3bb5c95
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtbmp.h
@@ -0,0 +1,51 @@
+
+/***************************************************************************
+ * *
+ * Module : rtBMP.h *
+ * *
+ * Purpose : Load BMP format files *
+ * *
+ **************************************************************************/
+
+#ifndef RTBMP_H
+#define RTBMP_H
+
+/**
+ * \defgroup rtbmp RtBMP
+ * \ingroup imageconversiontools
+ *
+ * BMP Image Format Toolkit for RenderWare.
+ *
+ * See also http://www.daubnet.com/formats/BMP.html
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+/*--- Include files ---*/
+#include "rwcore.h"
+
+#include "rtbmp.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwImage *RtBMPImageWrite(RwImage * image,
+ const RwChar * imageName);
+extern RwImage *RtBMPImageRead(const RwChar * imageName);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* RWPUBLICEND */
+
+#endif /* RTBMP_H */
diff --git a/sdk/rwsdk/include/d3d8/rtbmp.rpe b/sdk/rwsdk/include/d3d8/rtbmp.rpe
new file mode 100644
index 00000000..37c546f9
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtbmp.rpe
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionBMP
+{
+
+
+
+ e_rwdb_CriterionBMPLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionBMP e_rwdb_CriterionBMP;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtcharse.h b/sdk/rwsdk/include/d3d8/rtcharse.h
new file mode 100644
index 00000000..6c7a3902
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtcharse.h
@@ -0,0 +1,111 @@
+/*
+ *
+ * Data structures for the charse toolkit
+ */
+
+/***************************************************************************
+ * *
+ * Module : rtcharse.h *
+ * *
+ * Purpose : Charset handling *
+ * *
+ **************************************************************************/
+
+#ifndef RTCHARSE_H
+#define RTCHARSE_H
+
+/**
+ * \defgroup rtcharset RtCharset
+ * \ingroup 2dtools
+ *
+ * Character Set/Foot Toolkit for RenderWare.
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+#include <rwcore.h>
+
+/****************************************************************************
+ Global Types
+ */
+
+/* RWPUBLIC */
+
+typedef struct RtCharsetDesc RtCharsetDesc;
+
+/**
+ * \ingroup rtcharset
+ * \struct RtCharsetDesc
+ * Holds information about a character set.
+ */
+struct RtCharsetDesc
+{
+ RwInt32 width;
+ /**< Pixel-width of each character. */
+ RwInt32 height;
+ /**< Pixel-height of each character. */
+ RwInt32 width_internal;
+ /**< Pixel-width used internally, this is usually width+1 to add a border */
+ RwInt32 height_internal;
+ /**< Pixel-height used internally, this is usually height+1 to add a border */
+ RwInt32 count;
+ /**< Number of characters in the set. */
+ RwInt32 tilewidth;
+ /**< Width of raster in characters. */
+ RwInt32 tileheight;
+ /**< Height of raster in characters. */
+
+};
+
+/**
+ * \ingroup rtcharset
+ * \ref RtCharset
+ * typedef for a structure defining a character set (opaque).
+ * \see RtCharsetCreate
+ */
+typedef RwRaster RtCharset;
+
+/* RWPUBLICEND */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+/* RWPUBLIC */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwBool RtCharsetOpen(void);
+extern void RtCharsetClose(void);
+
+extern RtCharset *RtCharsetPrint(RtCharset * charSet,
+ const RwChar * string,
+ RwInt32 x, RwInt32 y);
+extern RtCharset *RtCharsetPrintBuffered(RtCharset * charSet,
+ const RwChar * string,
+ RwInt32 x, RwInt32 y,
+ RwBool hideSpaces);
+extern RwBool RtCharsetBufferFlush(void);
+
+extern RtCharset *RtCharsetSetColors(RtCharset * charSet,
+ const RwRGBA * foreGround,
+ const RwRGBA * backGround);
+extern RtCharset *RtCharsetGetDesc(RtCharset * charset,
+ RtCharsetDesc * desc);
+
+extern RtCharset *RtCharsetCreate(const RwRGBA * foreGround,
+ const RwRGBA * backGround);
+extern RwBool RtCharsetDestroy(RtCharset * charSet);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* RWPUBLICEND */
+
+#endif /* RTCHARSE_H */
diff --git a/sdk/rwsdk/include/d3d8/rtcharse.rpe b/sdk/rwsdk/include/d3d8/rtcharse.rpe
new file mode 100644
index 00000000..30c5ff4d
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtcharse.rpe
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionCharset
+{
+
+
+
+ e_rwdb_CriterionCharsetLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionCharset e_rwdb_CriterionCharset;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtgncpip.h b/sdk/rwsdk/include/d3d8/rtgncpip.h
new file mode 100644
index 00000000..b18f2bb7
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtgncpip.h
@@ -0,0 +1,256 @@
+/* *INDENT-OFF* */
+
+/* RWPUBLIC */
+
+/****************************************************************************
+ *
+ * File: rwg/rwsdk/tool/gencpipe/rtgncpip.h
+ *
+ * Copyright (C) 2002 Criterion Technologies.
+ *
+ * Purpose: Toolkit containing generic C rendering pipeline nodes.
+ *
+ ****************************************************************************/
+
+#if (!defined(_RTGNCPIP_H))
+#define _RTGNCPIP_H
+
+/*===========================================================================*
+ *--- Include files ---------------------------------------------------------*
+ *===========================================================================*/
+
+#include "rwcore.h"
+#include "rpworld.h"
+
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+/****************************************************************************
+ global types
+ */
+
+typedef RpLight *RxLight;
+
+
+/* RGBA Interpolation node structures */
+#if (!defined(DOXYGEN))
+struct NodeRGBAInterpData
+{
+ RwBool rgbaInterpOn;
+ RxRenderStateVector state;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+typedef struct NodeRGBAInterpData NodeRGBAInterpData;
+
+/* UV Interpolation node structures */
+typedef struct RxNodeUVInterpSettings RxNodeUVInterpSettings;
+
+/**
+ * \ingroup rtgencpipe
+ * \struct RxNodeUVInterpSettings
+ *
+ * TODO
+ */
+struct RxNodeUVInterpSettings
+{
+ RwBool uvInterpOn; /**< TODO */
+ RxRenderStateVector state; /**< TODO */
+};
+
+/* Cloning node structures */
+typedef struct RxPacketCacheCluster RxPacketCacheCluster;
+
+/**
+ * \ingroup rtgencpipe
+ * \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 rtgencpipe
+ * \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 rtgencpipe
+ * \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 rtgencpipe
+ * \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 */
+};
+
+/****************************************************************************
+ global prototypes
+ */
+
+extern RxClusterDefinition RxClLights; /* Uses the RxLight type (see above) */
+
+
+/*********************************************************************************
+
+ Generic Nodes
+
+ *******************************************************************************/
+
+extern RxNodeDefinition *RxNodeDefinitionGetAtomicInstance(void);
+extern RxNodeDefinition *RxNodeDefinitionGetClipLine(void);
+extern RxNodeDefinition *RxNodeDefinitionGetClipTriangle(void);
+extern RxNodeDefinition *RxNodeDefinitionGetWorldSectorEnumerateLights(void);
+extern RxNodeDefinition *RxNodeDefinitionGetCullTriangle(void);
+extern RxNodeDefinition *RxNodeDefinitionGetFastPathSplitter(void);
+extern RxNodeDefinition *RxNodeDefinitionGetImmInstance(void);
+extern RxNodeDefinition *RxNodeDefinitionGetImmMangleLineIndices(void);
+extern RxNodeDefinition *RxNodeDefinitionGetImmMangleTriangleIndices(void);
+extern RxNodeDefinition *RxNodeDefinitionGetImmRenderSetup(void);
+extern RxNodeDefinition *RxNodeDefinitionGetImmStash(void);
+extern RxNodeDefinition *RxNodeDefinitionGetLight(void);
+extern RxNodeDefinition *RxNodeDefinitionGetMaterialScatter(void);
+extern RxNodeDefinition *RxNodeDefinitionGetPostLight(void);
+extern RxNodeDefinition *RxNodeDefinitionGetPreLight(void);
+extern RxNodeDefinition *RxNodeDefinitionGetRGBAInterp(void);
+extern RxNodeDefinition *RxNodeDefinitionGetUVInterp(void);
+extern RxNodeDefinition *RxNodeDefinitionGetScatter(void);
+extern RxNodeDefinition *RxNodeDefinitionGetSubmitLine(void);
+extern RxNodeDefinition *RxNodeDefinitionGetSubmitTriangle(void);
+extern RxNodeDefinition *RxNodeDefinitionGetTransform(void);
+extern RxNodeDefinition *RxNodeDefinitionGetAtomicEnumerateLights(void);
+extern RxNodeDefinition *RxNodeDefinitionGetWorldSectorInstance(void);
+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);
+
+
+/*********************************************************************************
+
+ Generic Core Pipes
+
+ *******************************************************************************/
+
+
+extern RwBool RtGenCPipeCreateGenericIm3DTransformPipeline(void);
+extern void RtGenCPipeDestroyGenericIm3DTransformPipeline(void);
+extern RwBool RtGenCPipeCreateGenericIm3DRenderPipelines(void);
+extern void RtGenCPipeDestroyGenericIm3DRenderPipelines(void);
+
+extern RxPipeline *RwIm3DGetGenericTransformPipeline(void);
+extern RxPipeline *RwIm3DGetGenericRenderPipeline(RwPrimitiveType primType);
+
+
+/*********************************************************************************
+
+ Generic World Pipes
+
+ *******************************************************************************/
+
+extern RwBool RtGenCPipeCreateGenericWorldPipelines(void);
+extern void RtGenCPipeDestroyGenericWorldPipelines(void);
+
+#define RpWorldGetGenericSectorPipelineMacro() \
+ (RXPIPELINEGLOBAL(genericWorldSectorPipeline))
+
+#define RpAtomicGetGenericPipelineMacro() \
+ (RXPIPELINEGLOBAL(genericAtomicPipeline))
+
+#define RpMaterialGetGenericPipelineMacro() \
+ (RXPIPELINEGLOBAL(genericMaterialPipeline))
+
+
+#if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE))
+
+#define RpWorldGetGenericSectorPipeline RpWorldGetGenericSectorPipelineMacro
+#define RpAtomicGetGenericPipeline RpAtomicGetGenericPipelineMacro
+#define RpMaterialGetGenericPipeline RpMaterialGetGenericPipelineMacro
+
+#endif /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */
+
+
+#if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE))
+
+extern RxPipeline *RpWorldGetGenericSectorPipeline(void);
+
+extern RxPipeline *RpAtomicGetGenericPipeline(void);
+
+extern RxPipeline *RpMaterialGetGenericPipeline(void);
+
+#endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* (!defined(_RTGNCPIP_H)) */
+
+/* RWPUBLICEND */
+
+/* *INDENT-ON* */
diff --git a/sdk/rwsdk/include/d3d8/rtgncpip.rpe b/sdk/rwsdk/include/d3d8/rtgncpip.rpe
new file mode 100644
index 00000000..4f676526
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtgncpip.rpe
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionGENCPIPETOOL
+{
+
+
+
+ e_rwdb_CriterionGENCPIPETOOLLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionGENCPIPETOOL e_rwdb_CriterionGENCPIPETOOL;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtimport.h b/sdk/rwsdk/include/d3d8/rtimport.h
new file mode 100644
index 00000000..2cc6383b
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtimport.h
@@ -0,0 +1,1338 @@
+/***************************************************************************
+ * *
+ * Module : rtimport.h *
+ * *
+ * Purpose : World handling functions. *
+ * *
+ **************************************************************************/
+
+#ifndef RTIMPORT_H
+#define RTIMPORT_H
+
+/**
+ * \defgroup rtworldimport RtWorldImport
+ * \ingroup basicgeometry
+ *
+ * World Import Toolkit for RenderWare.
+ */
+
+/**
+ * \defgroup selectors RtWorldImportPartitionSelectors
+ * \ingroup rtworldimport
+ *
+ * The set of provided RtWorldImportPartitionSelectors:
+ * Selects a good partition by calling one of the
+ * \ref iterators and then
+ * one of the \ref evaluators to
+ * see which is best.
+ */
+
+/**
+ * \defgroup iterators RtWorldImportPartitionIterators
+ * \ingroup rtworldimport
+ *
+ * The set of provided RtWorldImportPartitionIterators:
+ * Iterates through a set of candidate partitions, possibly
+ * using the geometric information in the build sector, or perhaps
+ * using some other criteria.
+ */
+
+/**
+ * \defgroup evaluators RtWorldImportPartitionEvaluators
+ * \ingroup rtworldimport
+ *
+ * The set of provided RtWorldImportPartitionEvaluators:
+ * Uses a combination of statistics, build sector, build status, and
+ * possibly other criteria to evaluate a partition. While the value
+ * returned can be any real value, all provided evaluators are return
+ * lower values for better partitioners, and are in the range [0..1]
+ * where appropriate
+ */
+
+/**
+ * \defgroup terminators RtWorldImportPartitionTerminators
+ * \ingroup rtworldimport
+ *
+ * The set of provided RtWorldImportPartitionTerminators:
+ * Checks given criteria about the statistics, build sector, build status, and
+ * possibly other criteria to see whether the building process should be
+ * allowed to terminate, or whether more parititoning is necessary.
+ */
+
+/**
+ * \defgroup kd RtWorldImportGuideKD
+ * \ingroup rtworldimport
+ *
+ * Tools to manipulate the \ref RtWorldImportGuideKDTree that is used to
+ * manually build the sectors of a world.
+ */
+
+/**
+ * \defgroup hints RtWorldImportHints
+ * \ingroup rtworldimport
+ *
+ * Tools to aid the build process by giving hints as to what geometry should
+ * not be split, and what geometry makes for a good partitioning guide.
+ */
+
+/****************************************************************************
+ Includes
+ */
+#include "rwcore.h"
+#include "rpworld.h"
+
+#include "rtimport.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Defines
+ */
+
+/* Progress callback message types */
+#define rtWORLDIMPORTPROGRESSBSPBUILDSTART 0
+#define rtWORLDIMPORTPROGRESSBSPBUILDUPDATE 1
+#define rtWORLDIMPORTPROGRESSBSPBUILDEND 2
+#define rtWORLDIMPORTPROGRESSBSPCOMPRESSSTART 3
+#define rtWORLDIMPORTPROGRESSBSPCOMPRESSUPDATE 4
+#define rtWORLDIMPORTPROGRESSBSPCOMPRESSEND 5
+
+/**
+ * \ingroup rtworldimport
+ * \def rtWORLDIMPORTINVALIDPARTITION
+ *
+ * This value means that no partition was found, or that the partition was
+ * invalid or impractical. The value represents infinity.
+ */
+#define rtWORLDIMPORTINVALIDPARTITION RwRealMAXVAL
+
+/* maintained in Bin-tree */
+#define CONGRUENTVERTEXCHILDREN 2
+
+/* maintained in Quad-tree */
+#define WELDVERTEXCHILDREN 4
+
+/****************************************************************************
+ Global types
+ */
+#if (!defined(DOXYGEN))
+typedef struct RtWorldImportVertex RtWorldImportVertex;
+
+typedef struct RtWorldImportWeldVertex RtWorldImportWeldVertex;
+
+typedef struct RtWorldImportBuildVertex RtWorldImportBuildVertex;
+
+/* Internal use only */
+typedef union RtWorldImportVertexState RtWorldImportVertexState;
+
+/* Internal use only */
+union RtWorldImportVertexState
+{
+ /* clipFlags, two types, first is based on partition only, 2nd is
+ * also based on partition, but takes overlaps into consideration. i.e.
+ * number splits is usually higher in clipFlags[0] than [1] */
+ RwInt32 clipFlags[2]; /* Internal use only */
+ RwInt32 forwardingAddress; /* Internal use only */
+ RtWorldImportVertex *vpVert; /* Internal use only */
+ RtWorldImportWeldVertex *vpWeldVert; /* Internal use only */
+ RtWorldImportBuildVertex *vpBuildVert; /* Internal use only */
+ RwSList *slist; /* Internal use only */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportVertex
+ * Holds data for each vertex in the import world.
+ *
+ */
+struct RtWorldImportVertex
+{
+ RwV3d OC; /**< World space vertex position */
+ RwV3d normal; /**< World space vertex normal */
+ RwRGBA preLitCol; /**< Vertex Prelight color */
+ RwTexCoords texCoords[rwMAXTEXTURECOORDS];
+ /**< Vertex texture coordinates */
+ RtWorldImportVertexState state; /**< Internal use only */
+ RwInt32 matIndex; /**< Vertex material index */
+ void *pUserdata; /**< Pointer to unspecified per vertex user data */
+};
+
+typedef struct RtWorldImportBuildPolyInfo RtWorldImportBuildPolyInfo;
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportBuildPolyInfo
+ *
+ * Information about a polygon
+ */
+struct RtWorldImportBuildPolyInfo
+{
+ RwInt16 matIndex;
+ /**< The material index */
+ RwUInt8 clipFlags;
+ /**< Clipping flags */
+ RwUInt8 hasAlpha;
+ /**< Alpha status */
+ void *pUserdata;
+ /**< Userdata */
+};
+
+typedef union RtWorldImportBuildVertexMode RtWorldImportBuildVertexMode;
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportBuildVertexMode
+ *
+ * Mode of the vertex.
+ *
+ */
+union RtWorldImportBuildVertexMode
+{
+ RtWorldImportVertex *vpVert;
+ /**< The vertex */
+ RwInt32 index;
+ /**< The index */
+};
+
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportBuildVertex
+ *
+ * A list of polygons as a list of vertices where the end of poly boundary
+ * is marked by mode.vpVert == NULL.
+ *
+ */
+struct RtWorldImportBuildVertex
+{
+ RtWorldImportBuildVertexMode mode;
+ /**< The mode of the element */
+
+ RtWorldImportBuildPolyInfo pinfo;
+ /**< we store some poly info in the end marker of a boundary */
+};
+
+/* NB Merged RtWorldImportPartition with RtWorldImportBuildClipStatistics because
+ * there was a unique one-to-one relationship between them, and it made things easier
+ * just updating one stucture, without having to update both in sequence...
+ */
+
+
+typedef struct RtWorldImportBuildClipStatistics RtWorldImportBuildClipStatistics;
+
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportBuildClipStatistics
+ *
+ * Holds statistics about a partition or candidate partition during
+ * the build process.
+ */
+struct RtWorldImportBuildClipStatistics
+{
+ RwInt32 numPotentialSplit;
+ /**< The number of polygons split by the partition,
+ * disregarding overlaps */
+
+ RwInt32 numPotentialLeft;
+ /**< The number of potential polygons and fragments on the
+ * left of the partition, disregarding overlaps */
+
+ RwInt32 numPotentialRight;
+ /**< The number of potential polygons and fragments on the
+ * right of the partition, disregarding overlaps */
+
+
+ RwInt32 numActualSplit;
+ /**< The number of polygons split by the partition */
+
+ RwInt32 numActualLeft;
+ /**< The number of polygons and fragments on the
+ * left of the partition */
+
+ RwInt32 numActualRight;
+ /**< The number of polygons and fragments on the
+ * right of the partition */
+
+
+ RwInt32 numMaterialLeft;
+ /**< The number of materials on the left of the partition */
+
+ RwInt32 numMaterialRight;
+ /**< The number of materials on the right of the partition */
+
+ RwInt32 numMaterialSplits;
+ /**< The number of materials split by the partition */
+
+
+ RwInt32 numMaterialSector;
+ /**< The total number of materials in the sector containing
+ * the partition */
+
+
+ RwReal overlapLeft;
+ /**< The actual, relative size of the overlap on the left of the partition */
+
+ RwReal overlapRight;
+ /**< The actual, relative size of the overlap on the right of the partition */
+};
+
+/*
+ * typedef for struct RtWorldImportPartition
+ */
+typedef struct RtWorldImportPartition RtWorldImportPartition;
+
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportPartition
+ *
+ * A partitioning plane.
+ */
+struct RtWorldImportPartition
+{
+ RwInt32 type;
+ /**< Plane type, i.e. 0,4,8 for being normal to the x,y,z axes respectively. */
+
+ RwReal value;
+ /**< The distance of the plane from the origin */
+
+ RwReal maxLeftValue;
+ /**< The maximum value of the left face of the overlap. This is derived
+ * from the maxOverlapPercent value in \ref RtWorldImportParameters
+ */
+
+ RwReal maxRightValue;
+ /**< The maximum value of the right face of the overlap. This is derived
+ * from the maxOverlapPercent value in \ref RtWorldImportParameters
+ */
+
+ RtWorldImportBuildClipStatistics buildStats;
+ /**< The statistics for the partition */
+};
+
+/*
+ * typedef for struct \ref RtWorldImportGuideKDTree
+ */
+typedef struct RtWorldImportGuideKDTree RtWorldImportGuideKDTree;
+
+
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportGuideKDTree
+ * Represents the structure of a binary tree with
+ * no contents per se. It is used to build a BSP in a user specified
+ * manner instead of using any heuristic.
+ *
+ */
+struct RtWorldImportGuideKDTree
+{
+ RtWorldImportPartition partition;
+ /**< A partitioning plane */
+
+ RwBBox bbox;
+ /**< Bounding box of the sector or super-sector */
+
+ RtWorldImportGuideKDTree *parent;
+ /**< Pointer to its parent */
+
+ RwInt32 order;
+ /**< Relationship information - 0 for left child, 1 for right child */
+
+ RtWorldImportGuideKDTree *left;
+ /**< Left child */
+
+ RtWorldImportGuideKDTree *right;
+ /**< Right child */
+};
+
+typedef struct _rtWorldImportGuideKDStackElement _rtWorldImportGuideKDStackElement;
+
+#if (!defined(DOXYGEN))
+struct _rtWorldImportGuideKDStackElement
+{
+ RwBool terminal;
+ RtWorldImportGuideKDTree *node;
+ _rtWorldImportGuideKDStackElement *next;
+};
+
+typedef struct _rtWorldImportGuideKDStack _rtWorldImportGuideKDStack;
+
+struct _rtWorldImportGuideKDStack
+{
+ _rtWorldImportGuideKDStackElement *top;
+ _rtWorldImportGuideKDStackElement *current;
+ _rtWorldImportGuideKDStackElement *bottom;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/*
+ * typedef for struct RtWorldImportBuildSector
+ */
+typedef struct RtWorldImportBuildSector RtWorldImportBuildSector;
+
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportBuildSector
+ *
+ * Holds information about the sector that is being subdivided
+ */
+struct RtWorldImportBuildSector
+{
+ RwInt32 type;
+ /**< Sector type (so can handle in an RpWorld) */
+
+ RtWorldImportVertex *vertices;
+ /**< A pointer to the list of vertices */
+
+ RwInt32 numVertices;
+ /**< The number of vertices */
+
+ RtWorldImportBuildVertex *boundaries;
+ /**< A list of boundaries \see RtWorldImportBuildVertex */
+
+ RwInt32 numBoundaries;
+ /**< The number of boundaries */
+
+ RwInt32 numPolygons;
+ /**< The number of polygons (triangles) */
+
+ RwBBox boundingBox;
+ /**< Sector's bounding box */
+
+ RwReal overlap;
+ /**< The percentage that the sector overlaps with its neighbour */
+
+ RwUInt32 maxNumMaterials;
+ /**< Maximum number of materials in the in the world */
+};
+
+/*
+ * typedef for struct RtWorldImportBuildStatus
+ */
+typedef struct RtWorldImportBuildStatus RtWorldImportBuildStatus;
+
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportBuildStatus
+ * World Import Build Status Structure
+ * Used to store the current tree's build status
+ */
+struct RtWorldImportBuildStatus
+{
+ RwInt32 depth; /**< current depth in the tree */
+};
+
+typedef struct RwRGBAUInt32 RwRGBAUInt32;
+
+#if (!defined(DOXYGEN))
+struct RwRGBAUInt32
+{
+ RwUInt32 red, green, blue, alpha;
+};
+
+typedef struct RtWorldImportCongruentVertex RtWorldImportCongruentVertex;
+
+struct RtWorldImportCongruentVertex
+{
+ RwInt32 destIdx;
+ RtWorldImportVertex vertex;
+ RtWorldImportVertex Mean;
+ RwRGBAUInt32 preLitMean;
+ RwInt32 refCount;
+ RtWorldImportCongruentVertex *child[CONGRUENTVERTEXCHILDREN];
+};
+
+struct RtWorldImportWeldVertex
+{
+ RtWorldImportVertex *sourcePtr;
+ RtWorldImportCongruentVertex *CongruentVertex;
+ RtWorldImportWeldVertex *child[WELDVERTEXCHILDREN];
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/*
+ * Holds data for each triangle in the import world.
+ */
+typedef struct RtWorldImportTriangle RtWorldImportTriangle;
+
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportTriangle
+ * Holds data for each triangle in the import world.
+ *
+ * \see RtWorldImportTriangle
+ */
+struct RtWorldImportTriangle
+{
+ RwInt32 matIndex; /**< Index into material list */
+ RwInt32 vertIndex[3]; /**< Indices into vertex list */
+ void *pUserdata; /**< Pointer to unspecified per triangle user data */
+};
+
+
+
+
+/*
+ * typedef for struct RtWorldImportBBoxHintDesc
+ */
+typedef struct RtWorldImportBBoxHintDesc RtWorldImportBBoxHintDesc;
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportBBoxHintDesc
+ * Bounding box hints and (priority) values used to control the world
+ * sectorization process.
+ */
+struct RtWorldImportBBoxHintDesc
+{
+ RwBBox bBox; /**< The (necessarily orthogonal) bounding box */
+ RwReal value; /**< The value or priority of the hint (highest is most important) */
+};
+
+/*
+ * typedef for struct RtWorldImportHints
+ */
+typedef struct RtWorldImportHints RtWorldImportHints;
+
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportHints
+ * Bounding box hints used to control the world sectorization process.
+ * \see RtWorldImportHintsSet
+ */
+struct RtWorldImportHints
+{
+ RtWorldImportBBoxHintDesc *boundingBoxes; /**< The bounding box hints */
+ RwInt32 numBoundingBoxes; /**< The number of bounding box hints */
+};
+
+
+/**
+ * \ingroup rtworldimport
+ * \ref RtWorldImportHintGroup
+ *
+ * An enumeration that can be passed to
+ * \ref RtWorldImportHintsSetGroup and \ref RtWorldImportHintsGetGroup to determine
+ * whether hints will contribute towards the shield hint group or partition hint group
+ */
+typedef enum
+{
+ rtWORLDIMPORTSHIELDHINT = 0,
+ rtWORLDIMPORTPARTITIONHINT,
+
+ rtWORLDIMPORTFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+}
+RtWorldImportHintGroup;
+
+
+
+
+/*
+ * typedef for struct \ref RtWorldImportParameters
+ */
+typedef struct RtWorldImportParameters RtWorldImportParameters;
+
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportParameters
+ * Parameters used with \ref RtWorldImportCreateWorld.
+ * They are initialized to default values using \ref RtWorldImportParametersInit.
+ *
+ */
+struct RtWorldImportParameters
+{
+ RwReal worldSectorMaxSize;
+ /**< The maximum world sector size. */
+ RwInt32 maxWorldSectorPolygons;
+ /**< The maximum number of polygons in a world sector. */
+ RwReal maxOverlapPercent;
+ /**< Total fraction of world sector overlap allowed. */
+ RwReal weldThreshold;
+ /**< Threshold for welding vertices. */
+ RwReal angularThreshold;
+ /**< Angular threshold for welding vertex normals */
+ RwBool calcNormals;
+ /**< If TRUE then importer creates normals. */
+ RwBool conditionGeometry;
+ /**< If TRUE perform vertex welding and degenerate triangle removal.*/
+ RwBool userSpecifiedBBox;
+ /**< If TRUE allows user to specify minimum bounding-box for the
+ * world using the userBBox parameter. */
+ RwBBox userBBox;
+ /**< User specified world bounding-box if userSpecifiedBBox is TRUE.*/
+ RwReal uvLimit;
+ /**< If conditionGeometry is TRUE limit texture coordinates to this
+ * value. */
+ RwBool retainCreases;
+ /**< If TRUE then duplicate vertices with differing normals will not
+ * be merged. */
+ RwBool fixTJunctions;
+ /**< If TRUE then T-junctions are fixed in the geometry (slow). */
+ RwBool weldPolygons;
+ /**< If TRUE then polygons are welded where possible to reduce the
+ * polygon count. */
+ RwInt32 flags;
+ /**< Conversion flags (see RpWorldFlag). */
+ RwTextureAddressMode mode;
+ /**< If \ref rwTEXTUREADDRESSWRAP than weld vertices according to
+ * mod(1) congruent texture coordinates */
+ RwBool sortPolygons;
+ /**< If TRUE then polygons are sorted by their centroid */
+ RwBool cullZeroAreaPolygons;
+ /**< If TRUE then zero-area polygons are culled */
+ RwInt32 numTexCoordSets;
+ /**< The number of texture coordinate sets to use. If set to zero, then
+ * the number is taken from the flags parameter which, for backward
+ * compatibility, can include the \ref rpWORLDTEXTURED or \ref rpWORLDTEXTURED2
+ * flags. These specify one or two sets respectively. */
+ RwBool terminatorCheck;
+ /**< If TRUE the world will be checked for validity during the build process. */
+};
+
+/*
+ * typedef for struct RtWorldImport
+ */
+typedef struct RtWorldImport RtWorldImport;
+
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImport
+ * World Import State Structure
+ */
+struct RtWorldImport
+{
+ RpMaterialList matList; /**< Material list */
+ RtWorldImportVertex *vertices; /**< Vertex array */
+ RwInt32 numVertices; /**< Vertex count */
+
+ RtWorldImportTriangle *polygons; /**< Triangle array */
+ RwInt32 numPolygons; /**< Triangle count */
+};
+
+/**
+ * \ingroup rtworldimport
+ * \ref RtWorldImportProgressCallBack is the type for the callback function supplied to
+ * \ref RtWorldImportSetProgressCallBack.
+ *
+ * \param msg Message type corresponding to one of the following:
+ * \li rtWORLDIMPORTPROGRESSBSPBUILDSTART -
+ * The BSP creation process is about to start.
+ * The argument value is equal to 0.0.
+ * \li rtWORLDIMPORTPROGRESSBSPBUILDUPDATE -
+ * The BSP creation process has finished processing a subsection of
+ * the world. The argument value is equal to the percentage of the
+ * world processed up to this point.
+ * \li rtWORLDIMPORTPROGRESSBSPBUILDEND -
+ * The BSP creation process has ended.
+ * The argument value is equal to 100.0.
+ * \li rtWORLDIMPORTPROGRESSBSPCOMPRESSSTART -
+ * The BSP compression process is about to start. The argument value
+ * is equal to 0.0.
+ * \li rtWORLDIMPORTPROGRESSBSPCOMPRESSUPDATE -
+ * The BSP compression has finished processing a subsection of the
+ * world. The argument value is equal to the percentage of the world
+ * processed up to this point.
+ * \li rtWORLDIMPORTPROGRESSBSPCOMPRESSEND -
+ * The BSP compression process has ended. The argument value is equal
+ * to 100.0.
+ *
+ * \param value The percentage of the progress made in either BSP
+ * building or BSP compression.
+ *
+ * \return TRUE to continue BSP processing, FALSE to abort.
+ *
+ * \see RtWorldImportSetProgressCallBack
+ */
+typedef RwBool (*RtWorldImportProgressCallBack)(RwInt32 msg, RwReal value);
+
+/**
+ * \ingroup rtworldimport
+ * \ref RtWorldImportDestroyVertexUserdataCallBack
+ *
+ * A pointer to the CallBack function that will be called during
+ * vertex destruction.
+ *
+ * \param pUserdata
+ *
+ * \return
+ */
+typedef RwBool (*RtWorldImportDestroyVertexUserdataCallBack)(void **pUserdata);
+
+/**
+ * \ingroup rtworldimport
+ * \ref RtWorldImportCloneVertexUserdataCallBack
+ *
+ * A pointer to the CallBack function that will be called during
+ * vertex cloning.
+ *
+ * \param pUserdataDst
+ * \param pUserdataSrc
+ *
+ * \return
+ */
+typedef RwBool (*RtWorldImportCloneVertexUserdataCallBack)(void **pUserdataDst, void **pUserdataSrc);
+
+/**
+ * \ingroup rtworldimport
+ * \ref RtWorldImportInterpVertexUserdataCallBack
+ *
+ * A pointer to the CallBack function that will be called during
+ * vertex interpolation.
+ *
+ * \param pUserdataDst
+ * \param pUserdata1
+ * \param pUserdata2
+ * \param delta
+ *
+ * \return
+ */
+typedef RwBool (*RtWorldImportInterpVertexUserdataCallBack)(void **pUserdataDst, void **pUserdata1, void **pUserdata2, RwReal delta);
+
+/**
+ * \ingroup rtworldimport
+ * \ref RtWorldImportDestroyPolygonUserdataCallBack
+ *
+ * A pointer to the CallBack function that will be called during
+ * polygon destruction.
+ *
+ * \param pUserdata
+ *
+ * \return
+ */
+typedef RwBool (*RtWorldImportDestroyPolygonUserdataCallBack)(void **pUserdata);
+
+/**
+ * \ingroup rtworldimport
+ * \ref RtWorldImportSplitPolygonUserdataCallBack
+ *
+ * A pointer to the CallBack function that will be called during
+ * polygon division.
+ *
+ * \param pUserdataDst
+ * \param pUserdataSrc
+ *
+ * \return
+ */
+typedef RwBool (*RtWorldImportSplitPolygonUserdataCallBack)(void **pUserdataDst, void **pUserdataSrc);
+
+/**
+ * \ingroup rtworldimport
+ * \ref RtWorldImportSectorSetVertexUserdataCallBack
+ *
+ * A pointer to the CallBack function that will be called during
+ * the setting of the vertex user data.
+ *
+ * \param pUserdata
+ * \param sector
+ * \param index
+ *
+ * \return
+ */
+typedef RwBool (*RtWorldImportSectorSetVertexUserdataCallBack)(void **pUserdata, RpWorldSector *sector, RwInt32 index);
+
+/**
+ * \ingroup rtworldimport
+ * \ref RtWorldImportSectorSetPolygonUserdataCallBack
+ *
+ * A pointer to the CallBack function that will be called during
+ * the setting of the polygon user data.
+ *
+ * \param pUserdata
+ * \param sector
+ * \param index
+ *
+ * \return
+ */
+typedef RwBool (*RtWorldImportSectorSetPolygonUserdataCallBack)(void **pUserdata, RpWorldSector *sector, RwInt32 index);
+
+
+
+
+/**
+ * \ingroup rtworldimport
+ * \ref RtWorldImportTerminationBuildCallBack
+ *
+ * A pointer to the function that will be called during the
+ * build process to determine whether the current sector should
+ * be subdivided further, or terminated.
+ *
+ * \param buildSector
+ * \param buildStatus
+ * \param pData
+ *
+ * \return
+ */
+typedef RwBool (*RtWorldImportTerminationBuildCallBack)
+ (RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ void *pData);
+
+/**
+ * \ingroup rtworldimport
+ * \ref RtWorldImportPartitionBuildCallBack
+ *
+ * A pointer to the function that will be called during the
+ * build process to select a suitable sector partition.
+ *
+ * \param buildSector
+ * \param buildStatus
+ * \param partition
+ *
+ * \return
+ */
+typedef RwReal (*RtWorldImportPartitionBuildCallBack)
+ (RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void *pData);
+
+/*
+ * typedef for struct \ref RtWorldImportBuildCallBacks
+ */
+typedef struct RtWorldImportBuildCallBacks RtWorldImportBuildCallBacks; /* MAYBE: rename to SectorCallBacks ?*/
+
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportBuildCallBacks
+ * Sectorization callbacks
+ */
+struct RtWorldImportBuildCallBacks
+{
+ RtWorldImportPartitionBuildCallBack partitionBuild;
+ /**< Callback for choosing partition */
+ void *partitionUserData;
+ /**< Partition callback user data */
+ RtWorldImportTerminationBuildCallBack terminationBuild;
+ /**< Callback for termination of further partitioning */
+ void *terminationUserData;
+ /**< Termination callback user data */
+};
+
+/*
+ * typedef for struct \ref RtWorldImportUserdataCallBacks
+ */
+typedef struct RtWorldImportUserdataCallBacks RtWorldImportUserdataCallBacks;
+
+/**
+ * \ingroup rtworldimport
+ * \struct RtWorldImportUserdataCallBacks
+ * Bundle of callbacks
+ */
+struct RtWorldImportUserdataCallBacks
+{
+ RtWorldImportDestroyVertexUserdataCallBack destroyVertexUserdata;
+ /**< Callback on vertex destruction */
+ RtWorldImportCloneVertexUserdataCallBack cloneVertexUserdata;
+ /**< Callback on vertex cloning */
+ RtWorldImportInterpVertexUserdataCallBack interpVertexUserdata;
+ /**< Callback on vertex interpolation */
+ RtWorldImportDestroyPolygonUserdataCallBack destroyPolygonUserdata;
+ /**< Callback on polygon destruction */
+ RtWorldImportSplitPolygonUserdataCallBack splitPolygonUserdata;
+ /**< Callback on polygon division */
+ RtWorldImportSectorSetVertexUserdataCallBack sectorSetVertexUserdata;
+ /**< Callback on setting vertex user data */
+ RtWorldImportSectorSetPolygonUserdataCallBack sectorSetPolygonUserdata;
+ /**< Callback on setting polygon user data */
+};
+
+/**
+ * \ingroup rtworldimport
+ * \ref RtWorldImportBuildPartitionSelector
+ *
+ * An enumeration that can be passed to
+ * \ref RtWorldImportSetStandardBuildPartitionSelector to determine
+ * whether partitioning will be achieved automatically, using the
+ * default partition selected, or manually using the \ref RtWorldImportGuideKDTree
+ */
+typedef enum
+{
+ rwBUILDPARTITIONSELECTOR_DEFAULT,
+ /**< Sets the default automated process */
+ rwBUILDPARTITIONSELECTOR_GUIDED
+ /**< Sets the guided manual process */
+}
+RtWorldImportBuildPartitionSelector;
+
+
+
+
+/* Builds overlaps from plane and conversion params */
+#define BuildSectorSetOverlapsMacro(_boundingBox, _partition, _conversionParams) \
+MACRO_START \
+{ \
+ RwReal sup = GETCOORD((_boundingBox).sup, (_partition).type); \
+ RwReal inf = GETCOORD((_boundingBox).inf, (_partition).type); \
+ \
+ (_partition).maxLeftValue = \
+ (_partition).value + \
+ ((sup - (_partition).value) * (_conversionParams).maxOverlapPercent); \
+ \
+ (_partition).maxRightValue = \
+ (_partition).value - \
+ ((((_partition).value) - inf) * (_conversionParams).maxOverlapPercent); \
+} \
+MACRO_STOP
+
+/*****************************************************************************
+ * Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwBool
+_rtImportBuildSectorFindBBox(RtWorldImportBuildSector *buildSector, RwBBox *bbpOut);
+
+extern void
+ _rtWorldImportGuideKDCopy(RtWorldImportGuideKDTree *KD, RpSector *spSector, RwInt32 depth);
+extern void _rtWorldImportGuideKDStackDestroy(_rtWorldImportGuideKDStack *stack);
+extern void
+_rtWorldImportGuideKDEncodeAsStack(RtWorldImportGuideKDTree *tree, _rtWorldImportGuideKDStack *stack);
+
+extern RtWorldImportGuideKDTree *RtWorldImportGuideKDCreate(RwBBox *bbox);
+extern RtWorldImportGuideKDTree *RtWorldImportGuideKDAddPartition
+ (RtWorldImportGuideKDTree *KD, RwInt32 type, RwReal value);
+extern void RtWorldImportGuideKDDeletePartition(RtWorldImportGuideKDTree *KD);
+extern void RtWorldImportGuideKDDestroy(RtWorldImportGuideKDTree *KD);
+
+extern RtWorldImportGuideKDTree *RtWorldImportGuideKDWrite(
+ RtWorldImportGuideKDTree *guideKD, const RwChar *filename);
+extern RtWorldImportGuideKDTree * RtWorldImportGuideKDRead(
+ const RwChar *filename, const RwBBox *bbox);
+
+/*****************************************************************************
+ * PARTITION SELECTORS - These callbacks for used to select a partition
+ * from a sector.
+ */
+
+extern RwReal
+RtWorldImportBalancedCullPartitionSelector(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void *userData);
+
+extern RwReal
+RtWorldImportMaterialCountPartitionSelector(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void *userData);
+
+extern RwReal
+RtWorldImportMaterialSeparatePartitionSelector(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void *userData);
+extern RwReal
+RtWorldImportPartitionHintPartitionSelector(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * __RWUNUSED__ userData);
+
+
+extern RwReal
+RtWorldImportMaximumOccluderPartitionSelector(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+extern RwReal
+RtWorldImportDisjointOccluderPartitionSelector(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+extern RwReal
+RtWorldImportLeastCutAndBalancedPartitionSelector(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+extern RwReal
+RtWorldImportMaximumExtentPartitionSelector(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+extern RwReal
+RtWorldImportCullMiddleSpacePartitionSelector(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void *userData);
+
+extern RwReal
+RtWorldImportCullEndSpacePartitionSelector(RtWorldImportBuildSector * buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void *userData);
+
+extern RwReal
+RtWorldImportCullSpacePartitionSelector(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void *userData);
+
+extern RwReal
+RtWorldImportHintBBoxPartitionSelector(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void *userData);
+
+extern RwReal
+RtWorldImportGeneralOccluderPartitionSelector(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+extern RwReal
+RtWorldImportBalancedTreePartitionSelector(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+/*****************************************************************************
+ * PARTITION ITERATORS - These callbacks iterate though a set of partitions
+ */
+
+extern RwBool
+RtWorldImportOrthogonalAutoPartitionIterator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData,
+ RwInt32* loopCounter);
+
+
+extern RwBool
+RtWorldImportRegularIntervalPartitionIterator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData,
+ RwInt32* loopCounter);
+
+
+extern RwBool
+RtWorldImportMiddleAxisPartitionIterator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData,
+ RwInt32 * loopCounter);
+
+
+extern RwBool
+RtWorldImportMedianPercentagePartitionIterator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void *userData,
+ RwInt32 *loopCounter);
+
+
+extern RwBool
+RtWorldImportHintBBoxPartitionIterator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData,
+ RwInt32* loopCounter);
+
+extern RwBool
+RtWorldImportHighestVertexAccommodatingPlanePartitionIterator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus * buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData,
+ RwInt32* loopCounter);
+
+extern RwBool
+RtWorldImportMaterialBoundsPartitionIterator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus * buildStatus,
+ RtWorldImportPartition *partition,
+ void *userData,
+ RwInt32 *loopCounter);
+
+/*****************************************************************************
+ * PARTITION EVALUATORS - These callbacks iterate though a set of partitions
+ */
+
+extern RwReal
+RtWorldImportFuzzyBalancedPartitionEvaluator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void *userData);
+
+
+extern RwReal
+RtWorldImportPotentialSplitPartitionEvaluator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+
+extern RwReal
+RtWorldImportBalancedPartitionEvaluator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+
+extern RwReal
+RtWorldImportExtentPartitionEvaluator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+
+extern RwReal
+RtWorldImportOccluderPartitionEvaluator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+
+extern RwReal
+RtWorldImportWeightedOccluderPartitionEvaluator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+extern RwReal
+RtWorldImportHintBBoxPartitionEvaluator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void *userData);
+
+extern RwReal
+RtWorldImportVolumeBalancedPartitionEvaluator(RtWorldImportBuildSector * buildSector,
+ RtWorldImportBuildStatus * buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+extern RwReal
+RtWorldImportWeightedDisjointOccluderPartitionEvaluator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+extern RwReal
+RtWorldImportMaterialCutsPartitionEvaluator(RtWorldImportBuildSector * buildSector,
+ RtWorldImportBuildStatus * buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+extern RwReal
+RtWorldImportMaterialBalancedPartitionEvaluator(RtWorldImportBuildSector * buildSector,
+ RtWorldImportBuildStatus *buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+extern RwReal
+RtWorldImportAspectPartitionEvaluator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportBuildStatus * buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+
+extern RwReal
+RtWorldImportMaterialSeparatorPartitionEvaluator(RtWorldImportBuildSector * buildSector,
+ RtWorldImportBuildStatus * buildStatus,
+ RtWorldImportPartition *partition,
+ void * userData);
+/*****************************************************************************
+ * PARTITION TERMINATORS - These callbacks are used to decide when
+ * partitioning of a sector should stop
+ */
+extern RwBool
+RtWorldImportNeverPartitionTerminator(RtWorldImportBuildSector * buildSector,
+ RtWorldImportBuildStatus * buildStatus,
+ void * userData);
+
+extern RwBool
+RtWorldImportMaximumLegalPartitionTerminator(RtWorldImportBuildSector * buildSector,
+ RtWorldImportBuildStatus * __RWUNUSED__ buildStatus,
+ void * __RWUNUSED__ userData);
+
+extern RwBool
+RtWorldImportDefaultPartitionTerminator(RtWorldImportBuildSector * buildSector,
+ RtWorldImportBuildStatus * buildStatus,
+ void * pData);
+
+
+extern RwBool
+RtWorldImportDepthPartitionTerminator(RtWorldImportBuildSector * buildSector,
+ RtWorldImportBuildStatus * buildStatus,
+ void * userData);
+
+
+extern RwBool
+RtWorldImportSectorHeightPartitionTerminator(RtWorldImportBuildSector * buildSector,
+ RtWorldImportBuildStatus * buildStatus,
+ void * userData);
+
+extern RwBool
+RtWorldImportSizePartitionTerminator(RtWorldImportBuildSector * buildSector,
+ RtWorldImportBuildStatus * buildStatus,
+ void * userData);
+
+extern RwBool
+RtWorldImportSectorAspectSizePartitionTerminator(RtWorldImportBuildSector * buildSector,
+ RtWorldImportBuildStatus * buildStatus,
+ void * userData);
+
+
+
+
+/* WorldImport hints */
+extern void
+RtWorldImportHintsSetGroup(RtWorldImportHints *hints, RtWorldImportHintGroup group);
+
+extern RtWorldImportHints *
+RtWorldImportHintsGetGroup(RtWorldImportHintGroup group);
+
+extern RtWorldImportHints *
+RtWorldImportHintsCreate(void);
+
+extern RwBool
+RtWorldImportHintsDestroy(RtWorldImportHints *hints);
+
+extern RtWorldImportHints *
+RtWorldImportHintsAddBoundingBoxes(RtWorldImportHints *hints, RwInt32 numBoundingBoxes);
+
+extern void
+RtWorldImportMaterialGroupHintGenerator(RtWorldImportBuildSector *buildSector,
+ RtWorldImportHints *materialGroupHints);
+
+/* Initializing the conversion structure */
+extern RtWorldImportParameters *RtWorldImportParametersInit(void);
+extern void RtWorldImportParametersSet(RtWorldImportParameters *params);
+extern RtWorldImportParameters *RtWorldImportParametersGet(void);
+
+
+extern RpWorld *RtWorldImportCreateWorld(RtWorldImport *
+ nohsworld,
+ RtWorldImportParameters
+ * conversionParams);
+
+extern RpGeometry *RtWorldImportCreateGeometry(RtWorldImport *
+ nohsworld,
+ RtWorldImportParameters
+ * conversionParams);
+
+extern RtWorldImport *RtWorldImportCreate(void);
+
+extern RwBool RtWorldImportDestroy(RtWorldImport * nohsworld);
+
+extern RtWorldImport *RtWorldImportAddNumVertices(RtWorldImport *
+ nohsworld,
+ RwInt32
+ numNewVertices);
+
+extern RtWorldImport *RtWorldImportAddNumTriangles(RtWorldImport *
+ nohsworld,
+ RwInt32
+ numNewTriangles);
+
+extern RpMaterial *RtWorldImportGetMaterial(RtWorldImport *
+ nohsworld,
+ RwInt32 matInd);
+
+extern RwInt32 RtWorldImportGetNumVertices(RtWorldImport * nohsworld);
+
+extern RtWorldImportVertex *RtWorldImportGetVertices(RtWorldImport *
+ nohsworld);
+
+extern RwInt32 RtWorldImportGetNumTriangles(RtWorldImport * nohsworld);
+
+extern RtWorldImportTriangle *
+RtWorldImportGetTriangles(RtWorldImport * nohsworld);
+
+
+/* Progress callbacks */
+extern void
+RtWorldImportSetProgressCallBack(RtWorldImportProgressCallBack CB);
+
+extern RpWorldSector * RtWorldImportGetNumMaterials(RpWorldSector *worldSector, void *data);
+
+extern void
+_rtImportWorldSendProgressMessage(RwInt32 msgtype, RwReal value);
+
+/* Reading and Writing */
+
+extern RtWorldImport *RtWorldImportWrite(RtWorldImport * world,
+ RwChar * filename);
+
+extern RtWorldImport *RtWorldImportRead(RwChar * filename);
+
+extern RwInt32 RtWorldImportAddMaterial(RtWorldImport * nohsworld,
+ RpMaterial * material);
+
+extern RwInt32 RtWorldImportGetMaterialIndex(RtWorldImport * nohsworld,
+ RpMaterial * material);
+
+extern RtWorldImport *RtWorldImportForAllMaterials(RtWorldImport *
+ nohsworld,
+ RpMaterialCallBack
+ fpCallBack,
+ void *pData);
+
+extern void
+RtWorldImportSetUserdataCallBacks(RtWorldImportDestroyVertexUserdataCallBack
+ destroyVertexUserdataCB,
+ RtWorldImportCloneVertexUserdataCallBack
+ cloneVertexUserdataCB,
+ RtWorldImportInterpVertexUserdataCallBack
+ interpVertexUserdataCB,
+ RtWorldImportSectorSetVertexUserdataCallBack
+ sectorSetVertexUserdata,
+ RtWorldImportDestroyPolygonUserdataCallBack
+ destroyPolygonUserdataCB,
+ RtWorldImportSplitPolygonUserdataCallBack
+ splitPolygonUserdataCB,
+ RtWorldImportSectorSetPolygonUserdataCallBack
+ sectorSetPolygonUserdata);
+
+extern void
+RtWorldImportSetBuildCallBacks(RtWorldImportPartitionBuildCallBack
+ partitionBuildCB,
+ RtWorldImportTerminationBuildCallBack
+ terminationBuildCB);
+
+extern void
+RtWorldImportSetPartitionStatistics(RtWorldImportBuildSector * buildSector,
+ RtWorldImportPartition * partition);
+
+extern void
+RtWorldImportSetBuildCallBacksUserData(void *partitionUserData,
+ void *terminateUserData);
+
+
+extern void
+RtWorldImportSetStandardBuildPartitionSelector(RtWorldImportBuildPartitionSelector partitionSelector, void* userData);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#define RtWorldImportParametersInitialize(_paramsPtr) \
+ *(_paramsPtr) = *RtWorldImportParametersInit();
+
+/* Back compatibility with former hints which only permitted type zero (shield) hints... */
+#define RtWorldImportHintsSet(_hints) \
+RtWorldImportHintsSetGroup(_hints, rtWORLDIMPORTSHIELDHINT);
+
+#define RtWorldImportHintsGet() \
+RtWorldImportHintsGetGroup(rtWORLDIMPORTSHIELDHINT);
+
+
+#endif /* RTIMPORT_H */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtimport.rpe b/sdk/rwsdk/include/d3d8/rtimport.rpe
new file mode 100644
index 00000000..ff8d3d5c
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtimport.rpe
@@ -0,0 +1,174 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionNoHSWorld
+{
+
+
+E_RW_SECTORDEGENERATE,
+
+E_RW_SECTORINVNOPOLYGONS,
+
+E_RW_NOPLANE,
+
+E_RW_SECTORINVPOLY,
+
+E_RW_SECTORUSED,
+
+E_RW_MAXBSPDEPTHEXCEEDED,
+
+
+ e_rwdb_CriterionNoHSWorldLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionNoHSWorld e_rwdb_CriterionNoHSWorld;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtintsec.h b/sdk/rwsdk/include/d3d8/rtintsec.h
new file mode 100644
index 00000000..a2e4c3d6
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtintsec.h
@@ -0,0 +1,138 @@
+/***************************************************************************
+ * *
+ * Module : rtintsec.h *
+ * *
+ * Purpose : Intersection tests on geometry primitives. *
+ * *
+ **************************************************************************/
+
+#ifndef RTINTSEC_H
+#define RTINTSEC_H
+
+/**
+ * \defgroup rtintersection RtIntersection
+ * \ingroup mathtools
+ *
+ * Object Intersection Toolkit for RenderWare.
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+#include <rwcore.h>
+#include "rtintsec.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Defines
+ */
+
+#define RTINTSECEPSILON (RwReal)(1e-8)
+#define RTINTSECEDGEEPS (RwReal)(1e-5)
+
+#define RtIntersectionLineTriangleMacro(_result, \
+ _lineStart, _lineDelta, \
+ _v0, _v1, _v2, \
+ _distance) \
+MACRO_START \
+{ \
+ RwV3d edge1, edge2, tVec, pVec, qVec; \
+ RwReal det; \
+ \
+ /* Find vectors for two edges sharing vert0 */ \
+ RwV3dSubMacro(&edge1, (_v1), (_v0)); \
+ RwV3dSubMacro(&edge2, (_v2), (_v0)); \
+ \
+ /* Begin calculating determinant \
+ * - also used to calculate U parameter */ \
+ RwV3dCrossProductMacro(&pVec, (_lineDelta), &edge2); \
+ \
+ /* If determinant is \
+ * + near zero, ray lies in plane of \
+ * triangle \
+ * + negative, triangle is backfacing \
+ */ \
+ det = RwV3dDotProductMacro(&edge1, &pVec); \
+ (_result) = (det > RTINTSECEPSILON); \
+ \
+ if ((_result)) \
+ { \
+ RwReal lo, hi, u; \
+ \
+ /* Calculate bounds for parameters with tolerance */ \
+ lo = - det*RTINTSECEDGEEPS; \
+ hi = det - lo; \
+ \
+ /* Calculate U parameter and test bounds */ \
+ RwV3dSubMacro(&tVec, (_lineStart), (_v0)); \
+ u = RwV3dDotProductMacro(&tVec, &pVec); \
+ (_result) = (u >= lo && u <= hi); \
+ \
+ if ((_result)) \
+ { \
+ RwReal v; \
+ \
+ /* Calculate V parameter and test bounds */ \
+ RwV3dCrossProductMacro(&qVec, &tVec, &edge1); \
+ v = RwV3dDotProductMacro((_lineDelta), &qVec); \
+ (_result) = (v >= lo && (u + v) <= hi); \
+ \
+ if ((_result)) \
+ { \
+ /* Calculate t, \
+ * and make sure intersection is in bounds of line */ \
+ *(_distance) = RwV3dDotProductMacro(&edge2, &qVec); \
+ \
+ /* Within bounds of line? */ \
+ (_result) = (*(_distance) >= lo && *(_distance) <= hi); \
+ \
+ if ((_result)) \
+ { \
+ *(_distance) = ((*(_distance)) / (det)); \
+ } \
+ } \
+ } \
+ } \
+} \
+MACRO_STOP
+
+
+/****************************************************************************
+ Global Types
+ */
+
+
+/* RWPUBLIC */
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Line intersections */
+extern RwBool
+RtIntersectionLineTriangle(RwV3d *lineStart, RwV3d *lineDelta,
+ RwV3d *v0, RwV3d *v1, RwV3d *v2,
+ RwReal *distance);
+
+/* Sphere intersections */
+extern RwBool
+RtIntersectionSphereTriangle(RwSphere *sphere,
+ RwV3d *v0, RwV3d *v1, RwV3d *v2,
+ RwV3d *normal,
+ RwReal *distance);
+
+/* BBox intersections */
+extern RwBool
+RtIntersectionBBoxTriangle(RwBBox *bbox, RwV3d *v0, RwV3d *v1, RwV3d *v2);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* RWPUBLICEND */
+
+#endif /* RTINTSEC_H */
diff --git a/sdk/rwsdk/include/d3d8/rtintsec.rpe b/sdk/rwsdk/include/d3d8/rtintsec.rpe
new file mode 100644
index 00000000..3c7f7bf3
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtintsec.rpe
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionIntsec
+{
+
+
+
+ e_rwdb_CriterionIntsecLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionIntsec e_rwdb_CriterionIntsec;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtltmap.h b/sdk/rwsdk/include/d3d8/rtltmap.h
new file mode 100644
index 00000000..8ee15a43
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtltmap.h
@@ -0,0 +1,644 @@
+
+/**
+ * \defgroup rtltmap RtLtMap
+ * \ingroup lighting
+ *
+ * Lightmap Generation Toolkit for RenderWare.
+ */
+
+#ifndef RTLTMAP_H
+#define RTLTMAP_H
+
+/*===========================================================================*
+ *--- Includes --------------------------------------------------------------*
+ *===========================================================================*/
+
+#include "rwcore.h"
+#include "rpworld.h"
+
+#include "rpltmap.h"
+
+
+/**
+ * \ingroup rtltmap
+ * \ref RtLtMapIlluminateSampleCallBack is the callback to be called, from
+ * within \ref RtLtMapIlluminate, for groups of samples in the objects
+ * currently being illuminated.
+ *
+ * For lightmapped objects, samples are grouped on a per-polygon basis and
+ * for vertex-lit objects, samples are grouped on a per-object basis (see
+ * \ref RtLtMapObjectFlags).
+ *
+ * This callback will receive an array of color values to fill in, each
+ * representing one sample in the current object - this may correspond to
+ * a texel in the current object's lightmap or the prelight color of a
+ * vertex, depending on whether the object is lightmapped and/or vertex-lit.
+ * It will receive positions (in world-space) for each sample and the normal
+ * vector (again, in world-space) of each sample (normals are interpolated
+ * across polygons for non-flat-shaded materials. See \ref RtLtMapMaterialFlags).
+ * For lightmap samples (not vertex-lighting samples), it will receive
+ * barycentric coordinates within the current polygon. It will also receive
+ * a list of RpLights affecting the current object.
+ *
+ * The barycentric coordinates may be used, for example, to allow a callback
+ * to easily import existing lighting data (e.g from previously generated
+ * lightmaps in a different format, or from an art package with lighting
+ * functionality).
+ *
+ * NOTE: The alpha channel of the RwRGBA results array must NOT be modified.
+ * These values are used internally and their modification may result in
+ * unwanted visual artifacts in the resulting lighting solution.
+ *
+ * The default RtLtMapIlluminateSampleCallBacks supplied with RtLtMap is
+ * \ref RtLtMapDefaultSampleCallBack. This callback performs point and area
+ * lighting (the area lights use are those passed to \ref RtLtMapIlluminate).
+ *
+ * \param results A pointer to an array of \ref RwRGBA sample color values
+ * \param samplePositions A pointer to an array of \ref RwV3d values specifying the
+ * world-space positions of each of the samples in the results array
+ * \param baryCoords A pointer to an array of \ref RwV3d values specifying the
+ * barycentric coordinates (within the current polygon) of
+ * each of the samples in the results array
+ * \param numSamples The length of the results, samplePositions, baryCoords and normals arrays
+ * \param lights An array of pointers to \ref RpLight's affecting the current object
+ * \param numLights The length of the lights array
+ * \param normals A pointer to an array of \ref RwV3d values specifying the
+ * world-space, unit normals of each of the samples in the results array
+ *
+ * \return A pointer to the results array on success, NULL otherwise
+ *
+ * \see RtLtMapIlluminate
+ * \see RtLtMapIlluminateVisCallBack
+ * \see RtLtMapIlluminateProgressCallBack
+ */
+typedef RwRGBA *(*RtLtMapIlluminateSampleCallBack)(RwRGBA *results,
+ RwV3d *samplePositions,
+ RwV3d *baryCoords,
+ RwUInt32 numSamples,
+ RpLight **lights,
+ RwUInt32 numLights,
+ RwV3d *normals);
+
+/**
+ * \ingroup rtltmap
+ * \ref RtLtMapIlluminateVisCallBack is the callback to be called, from
+ * within \ref RtLtMapIlluminate, to determine the visibility between a
+ * sample and a light.
+ *
+ * This callback is called for all samples in the current
+ * \ref RtLtMapLightingSession and for each light source which may
+ * potentially affect each of those samples (this may not be all the
+ * lights in the scene, as some hierarchical culling is performed).
+ * Each sample may represent a texel in the current object's lightmap
+ * or the prelight color of a vertex, depending on whether the object
+ * is lightmapped and/or vertex-lit (see \ref RtLtMapObjectFlags).
+ *
+ * The callback will receive a pointer to the world of the current
+ * \ref RtLtMapLightingSession (this may be used to perform intersection
+ * tests), the world-space position of the sample, the world-space
+ * position of the light, a pointer to a light and a pointer to an
+ * \ref RwRGBAReal result value.
+ *
+ * If the light pointer is NULL, this means that the current light
+ * is an area light (as opposed to an \ref RpLight), of an internal
+ * format. The area lights use are those passed to \ref RtLtMapIlluminate.
+ *
+ * The callback should return FALSE to signify that the light is wholly
+ * occluded w.r.t the sample position, otherwise it should return TRUE.
+ * Partial degrees of (color-frequency-dependent) occlusion may be
+ * expressed by modifying the RwRGBAReal value. This defaults to bright
+ * white but may be reduced to signify that the light from the light
+ * source should be attenuated. This could be used to take into account
+ * light-filtering objects in the scene (such as colored glass or fog).
+ *
+ * The default RtLtMapIlluminateVisCallBack supplied with RtLtMap is
+ * \ref RtLtMapDefaultVisCallBack. This callback performs visibility
+ * tests using the line-intersection tests from \ref rtintersection. It tests
+ * for occlusion by RpWorldSectors and RpAtomics and it respects the
+ * relevant \ref RtLtMapObjectFlags and \ref RtLtMapMaterialFlags but it
+ * does not filter light; visibility is determined to be either one or zero.
+ *
+ * \param world The world of the current RtLtMapLightingSession
+ * \param result An RwRGBAReal value to attentuate this light's
+ * contribution to the current sample
+ * \param samplePos The world-space positiuon of the sample
+ * \param lightPos The world-space positiuon of the light
+ * \param light A pointer to the light (NULL if it is an are light)
+ *
+ * \return TRUE if the light is visible from the sample, FALSE if it is occluded
+ *
+ * \see RtLtMapIlluminate
+ * \see RtLtMapIlluminateSampleCallBack
+ * \see RtLtMapIlluminateProgressCallBack
+ */
+typedef RwBool (*RtLtMapIlluminateVisCallBack)(RpWorld *world,
+ RwRGBAReal *result,
+ RwV3d *samplePos,
+ RwV3d *lightPos,
+ RpLight *light);
+
+/**
+ * \ingroup rtltmap
+ * \ref RtLtMapIlluminateProgressCallBack is the callback to be called, from
+ * within \ref RtLtMapIlluminate, to allow a user to track lighting progress.
+ *
+ * The progress callback will be called at several stages during lighting,
+ * with a different 'message' parameter value used at each stage (see
+ * \ref RtLtMapProgressMessage). It will be called at the very start of
+ * lighting (for a given \ref RtLtMapLightingSession), before any samples
+ * are lit. It will also be called at the very end of lighting, after all
+ * samples have been lit. It will be called before and after each lighting
+ * 'slice' (see \ref RtLtMapIlluminate) and also after each group of
+ * samples have been lit.
+ *
+ * For lightmapped objects, samples are grouped on a per-polygon basis and
+ * for vertex-lit objects, samples are grouped on a per-object basis (see
+ * \ref RtLtMapObjectFlags).
+ *
+ * The progress callback will receive a RwReal value specifying the percentage
+ * of samples already lit in the current \ref RtLtMapLightingSession (see
+ * \ref RtLtMapLightingSessionGetNumSamples).
+ *
+ * By returning FALSE, the progress callback may cause early termination of
+ * the current lighting 'slice' (this may be used, for example, to keep
+ * the time spent lighting each slice fairly constant).
+ *
+ * There is no default progress callback supplied with RtLtMap.
+ *
+ * \param message A \ref RtLtMapProgressMessage identifying the stage
+ * of the current call to the progress callback
+ * \param value The percentage of samples already lit in the
+ * current \ref RtLtMapLightingSession
+ *
+ * \return FALSE to immediately terminate lighting, otherwise TRUE
+ *
+ * \see RtLtMapIlluminate
+ * \see RtLtMapIlluminateSampleCallBack
+ * \see RtLtMapIlluminateVisCallBack
+ */
+typedef RwBool (*RtLtMapIlluminateProgressCallBack)(RwInt32 message,
+ RwReal value);
+
+
+/**
+ * \ingroup rtltmap
+ * \ref RtLtMapProgressMessage is an enumerated type identifying the different
+ * stages at which the \ref RtLtMapIlluminateProgressCallBack may be called
+ * from within \ref RtLtMapIlluminate.
+ *
+ * \see RtLtMapIlluminateProgressCallBack
+ * \see RtLtMapIlluminate
+ */
+enum RtLtMapProgressMessage
+{
+ rtLTMAPPROGRESSNAMESSAGE = 0,
+
+ rtLTMAPPROGRESSSTART = 1, /**< This is issued at the beginning of
+ * an incremental lighting session */
+ rtLTMAPPROGRESSSTARTSLICE = 2, /**< This is issued at the beginning of every
+ * slice in an incremental lighting session */
+ rtLTMAPPROGRESSUPDATE = 3, /**< This is issued after the lighting of each
+ * lightmapped triangle or vertex-lit object */
+ rtLTMAPPROGRESSENDSLICE = 4, /**< This is issued at the end of every slice
+ * in an incremental lighting session */
+ rtLTMAPPROGRESSEND = 5, /**< This is issued at the end of an
+ * incremental lighting session */
+
+ rtLTMAPPROGRESSFORCEENUMSIZEINT = 0x7FFFFFFF
+};
+typedef enum RtLtMapProgressMessage RtLtMapProgressMessage;
+
+typedef struct RtLtMapLightingSession RtLtMapLightingSession;
+/**
+ * \ingroup rtltmap
+ * \struct RtLtMapLightingSession
+ * The RtLtMapLightingSession structure holds information to be passed to
+ * \ref RtLtMapIlluminate. It is used to parameterize the lighting process.
+ *
+ * The RtLtMapLightingSession structure encapsulates a set of objects and
+ * keeps track of the proportion of samples, within that set, that have already
+ * been lit by calls to \ref RtLtMapIlluminate. Each call performs lighting for
+ * one 'slice' of the whole 'session'. If the camera member is non-NULL, it is
+ * important that the camera is not moved between lighting slices.
+ *
+ * The RtLtMapLightingSession is also passed to
+ * \ref RtLtMapLightMapsCreate, \ref RtLtMapLightMapsClear,
+ * \ref RtLtMapLightMapsDestroy and \ref RtLtMapAreaLightGroupCreate,
+ * though not all of the session structure's member will be used in
+ * each of these cases.
+ *
+ * \see RtLtMapIlluminate
+ * \see RtLtMapLightMapsCreate
+ * \see RtLtMapLightMapsClear
+ * \see RtLtMapLightMapsDestroy
+ * \see RtLtMapAreaLightGroupCreate
+ */
+struct RtLtMapLightingSession
+{
+ RpWorld *world; /**< This world is that in which collisions are performed
+ * during illumination (for the purposes of lighting
+ * visibility determination) */
+ RwCamera *camera; /**< An optional pointer to a camera. The camera's frustum
+ * may be used to cull objects and/or triangles from the
+ * set of those to be processed. */
+ RpWorldSector **sectorList; /**< An optional array of \ref RpWorldSector pointers,
+ * specifying which sectors in the world to light. If
+ * this is NULL, then all sectors in the world (or those
+ * inside the optional camera's frustum) will be lit. */
+ RwInt32 numSectors; /**< The length of the sectorList array. If this is set to
+ * '-1' then none of the sectors in the world will be lit. */
+ RpAtomic **atomicList; /**< An optional array of \ref RpAtomic pointers,
+ * specifying which atomics to light. If this is NULL
+ * then all atomics in the world (or those inside the
+ * optional camera's frustum) will be lit. */
+ RwInt32 numAtomics; /**< The length of the atomicList array. If this is set to
+ * '-1' then none of the atomics in the world will be lit. */
+ RwUInt32 startSample; /**< Lighting for the current 'slice' should begin with this
+ * sample. It is the user's responsibility to increment this
+ * value after each slice. Note that partial lighting is
+ * quantized to be per-polygon (for lightmapped objects).
+ * startSample will always be rounded down, not up. */
+ RwUInt32 numSamples; /**< This specifies how many lightmap samples should be lit.
+ * If it is left zero then all samples in the current set
+ * of objects will be lit. Note that partial lighting is
+ * quantized to be per-polygon (for lightmapped objects).
+ * numSamples will always be rounded up, not down. */
+ RwUInt32 totalSamples;/**< This specifies how many lightmap samples will be lit in
+ * total for the world specified (this is filled in by
+ * \ref RtLtMapIlluminate, not the calling function). */
+ RtLtMapIlluminateSampleCallBack sampleCallBack; /**< A \ref RtLtMapIlluminateSampleCallBack
+ * to use during lighting. If this is left
+ * NULL, the default callback will be used. */
+ RtLtMapIlluminateVisCallBack visCallBack; /**< A \ref RtLtMapIlluminateVisCallBack
+ * to use during lighting. If this is left
+ * NULL, the default callback will be used. */
+ RtLtMapIlluminateProgressCallBack progressCallBack; /**< A \ref RtLtMapIlluminateProgressCallBack
+ * to use during lighting. If this is left
+ * NULL, no progress callback will be used. */
+};
+
+/**
+ * \ingroup rtltmap
+ * \ref RtLtMapMaterialFlags is an enumerated type specifying the different
+ * lightmap-related flags which may be applied to materials. These values
+ * will be taken into consideration within \ref RtLtMapIlluminate.
+ *
+ * \see RtLtMapMaterialGetFlags
+ * \see RtLtMapMaterialSetFlags
+ * \see RtLtMapMaterialGetAreaLightColor
+ * \see RtLtMapMaterialSetAreaLightColor
+ * \see RtLtMapMaterialGetLightMapDensityModifier
+ * \see RtLtMapMaterialSetLightMapDensityModifier
+ * \see RtLtMapMaterialGetAreaLightDensityModifier
+ * \see RtLtMapMaterialSetAreaLightDensityModifier
+ * \see RtLtMapMaterialSetAreaLightRadiusModifier
+ * \see RtLtMapMaterialGetAreaLightRadiusModifier
+ * \see RtLtMapIlluminate
+ * \see RtLtMapAreaLightGroupCreate
+ * \see RtLtMapIlluminateVisCallBack
+ */
+enum RtLtMapMaterialFlags
+{
+ rtLTMAPMATERIALNAFLAG = 0,
+
+ rtLTMAPMATERIALLIGHTMAP = 1, /**< This material should be lightmapped
+ * [for non-lightmapped materials within lightmapped objects,
+ * texel values will be set to (0, 0, 0) (or (255, 255, 255) if
+ * the rtLTMAPMATERIALAREALIGHT flag is present, so that light-
+ * emitting textures appear as bright as the light which they are
+ * emittering) and the mesh may be 'shrunk' in UV-space so as not
+ * to waste lightmap texels] */
+ rtLTMAPMATERIALAREALIGHT = 2, /**< This material is an area light emitter
+ * (see \ref RtLtMapAreaLightGroupCreate) */
+ rtLTMAPMATERIALNOSHADOW = 4, /**< This material does not block light */
+ rtLTMAPMATERIALSKY = 8, /**< This material blocks everything but directional
+ * lights, to allow sky polygons to occlude geometry
+ * and yet emit directional light (sky or sun light,
+ * being as if cast from an infinite distance) */
+ rtLTMAPMATERIALFLATSHADE = 16, /**< This material will be lit as if flat-shaded
+ * (polygon normals will be used during illumination) */
+
+ rtLTMAPMATERIALFLAGFORCEENUMSIZEINT = 0x7FFFFFFF
+};
+typedef enum RtLtMapMaterialFlags RtLtMapMaterialFlags;
+
+/**
+ * \ingroup rtltmap
+ * RtLtMapObjectFlags is an enumerated type specifying the different
+ * lightmap-related flags which may be applied to world sectors and
+ * atomics. These values will be taken into consideration within
+ * \ref RtLtMapLightMapsCreate and \ref RtLtMapIlluminate.
+ *
+ * \see RtLtMapAtomicGetFlags
+ * \see RtLtMapAtomicSetFlags
+ * \see RtLtMapWorldSectorGetFlags
+ * \see RtLtMapWorldSectorSetFlags
+ * \see RtLtMapLightMapsCreate
+ * \see RtLtMapIlluminate
+ * \see RtLtMapIlluminateVisCallBack
+ */
+enum RtLtMapObjectFlags
+{
+ rtLTMAPOBJECTNAFLAG = 0,
+
+ rtLTMAPOBJECTLIGHTMAP = 1, /**< This object is to be lightmapped */
+ rtLTMAPOBJECTVERTEXLIGHT = 2, /**< This object's vertex prelight colors should
+ be lit within \ref RtLtMapIlluminate. */
+ rtLTMAPOBJECTNOSHADOW = 4, /**< This object does not cast shadows (useful, for
+ example, for moving objects for which dynamic
+ shadows are to be rendered - such as doors) */
+
+ rtLTMAPOBJECTFLAGFORCEENUMSIZEINT = 0x7FFFFFFF
+};
+typedef enum RtLtMapObjectFlags RtLtMapObjectFlags;
+
+/* Area-lighting stuff:*
+ ***********************/
+
+
+typedef struct RtLtMapAreaLightGroup RtLtMapAreaLightGroup;
+
+/**
+ * \ingroup rtltmap
+ * \struct RtLtMapAreaLightGroup
+ * RtLtMapAreaLightGroup is a structure which acts as a container
+ * for area lights created by a call to \ref RtLtMapAreaLightGroupCreate.
+ * The containers may be chained and passed to \ref RtLtMapIlluminate.
+ * Each container has an optional pointer to a RwFrame which is used to
+ * transform the contained area lights relative to the world of the current
+ * \ref RtLtMapLightingSession and relative to each other (such that, for
+ * example, lights from multiple worlds, which are connected by portals,
+ * or which are composed of atomics and not world sectors, may be used
+ * within a single call to \ref RtLtMapIlluminate).
+ *
+ * \see RtLtMapAreaLightGroupCreate
+ * \see RtLtMapAreaLightGroupDestroy
+ * \see RtLtMapIlluminate
+ * \see RtLtMapIlluminateVisCallBack
+ */
+struct RtLtMapAreaLightGroup
+{
+ RwSList *meshes; /**< A list of hierarchically-grouped area lights */
+ RwFrame *frame; /**< An (optional) pointer to a frame (owned by something else)
+ * whose LTM specifies the coordinate system of this container,
+ * relative to the world of the current \ref RtLtMapLightingSession. */
+ RtLtMapAreaLightGroup *next; /**< A pointer for chaining are light groups together */
+};
+
+/* Area light triangles are grouped by source mesh (this may change) */
+typedef struct LtMapAreaLightMesh LtMapAreaLightMesh;
+
+#if (!defined(DOXYGEN))
+struct LtMapAreaLightMesh
+{
+ RwUInt32 flags; /* To hold hierarchical visibility culling flags,
+ * relevant to the object/triangle *currently* being lit. */
+ RpMaterial *material; /* The emitter material, containing color, etc */
+ RwSphere sphere; /* Each mesh has an associated center and radius */
+ RwReal ROI; /* Centered on the above sphere, the R.O.I. of the
+ * samples in this mesh (a conservative estimate) */
+ RwSList *triangles; /* A list of the area light triangles in this mesh */
+};
+
+/* Area light samples are grouped by source triangle */
+typedef struct LtMapAreaLight LtMapAreaLight;
+struct LtMapAreaLight
+{
+ RwUInt16 flags; /* To hold hierarchical visibility culling flags,
+ * relevant to the object/triangle *currently* being lit. */
+ RwUInt16 numSamples; /* Number of area light samples in this triangle */
+ RwReal areaPerSample; /* (triangleArea / numSamples) for this triangle */
+ RwPlane plane; /* This 'area light' is a triangle, this is its plane. */
+ RwSphere sphere; /* This bounds the triangle's points in world-space (it's
+ * not worth storing 3 points, coarse culling is fine) */
+ RwV3d *lights; /* Array of area light sample positions (in world-space) */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+#if (defined(SKY2_DRVMODEL_H) || defined(NULLSKY_DRVMODEL_H))
+
+/**
+ * \ingroup rtltmapps2
+ * \ref RtLtMapSkyLumCalcCallBack is the callback to be called, from
+ * within \ref RtLtMapSkyBaseTextureProcess, to allow a user to select the
+ * function to process the textures for rendering on the PlayStation 2.
+ *
+ * The function is called for each span of a full color image, or for the
+ * CLUT in a palettised image, to compute the luminance and stores it in
+ * the alpha component of the texel.
+ *
+ * \param scanline A pointer to a scanline of \ref RwRGBA data.
+ * \param width Width of the scanline, in pixels.
+ *
+ * \return A pointer to the scanline on success, NULL otherwise.
+ *
+ * \see RtLtMapSkyBaseTextureProcess
+ * \see RtLtMapSkyLightingSessionBaseTexturesProcess
+ * \see RtLtMapSkyLightMapMakeDarkMap
+ * \see RtLtMapSkyLumCalcMaxCallBack
+ * \see RtLtMapSkyLumCalcSigmaCallBack
+ * \see RtLtMapSkySetLumCalcCallBack
+ * \see RtLtMapSkyGetLumCalcCallBack
+ */
+typedef RwRGBA *(*RtLtMapSkyLumCalcCallBack)(RwRGBA *scanline,
+ RwUInt32 width );
+
+#endif /* (defined(SKY2_DRVMODEL_H) || defined(NULLSKY_DRVMODEL_H)) */
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+/* Lightmap creation functionality: */
+extern RtLtMapLightingSession *
+RtLtMapLightMapsCreate(RtLtMapLightingSession *session,
+ RwReal density, RwRGBA *color);
+
+extern void
+RtLtMapLightMapsDestroy(RtLtMapLightingSession *session);
+extern RpAtomic *
+RtLtMapAtomicLightMapDestroy(RpAtomic *atomic);
+extern RpWorldSector *
+RtLtMapWorldSectorLightMapDestroy(RpWorldSector *sector);
+
+extern RwReal
+RtLtMapGetVertexWeldThreshold(void);
+extern RwBool
+RtLtMapSetVertexWeldThreshold(RwReal threshold);
+
+extern RwUInt32
+RtLtMapLightMapGetDefaultSize(void);
+extern RwBool
+RtLtMapLightMapSetDefaultSize(RwUInt32 size);
+
+extern RwUInt32
+RtLtMapAtomicGetLightMapSize(RpAtomic *atomic);
+extern RpAtomic *
+RtLtMapAtomicSetLightMapSize(RpAtomic *atomic, RwUInt32 size);
+extern RwUInt32
+RtLtMapWorldSectorGetLightMapSize(RpWorldSector *sector);
+extern RpWorldSector *
+RtLtMapWorldSectorSetLightMapSize(RpWorldSector *sector, RwUInt32 size);
+
+extern RwUInt32
+RtLtMapAtomicGetFlags(RpAtomic *atomic);
+extern RpAtomic *
+RtLtMapAtomicSetFlags(RpAtomic *atomic, RwUInt32 flags);
+extern RwUInt32
+RtLtMapWorldSectorGetFlags(RpWorldSector *sector);
+extern RpWorldSector *
+RtLtMapWorldSectorSetFlags(RpWorldSector *sector, RwUInt32 flags);
+
+
+/* Lightmap illumination functionality: */
+extern RwUInt32
+RtLtMapIlluminate(RtLtMapLightingSession *session,
+ RtLtMapAreaLightGroup *lights);
+
+extern RwReal
+RtLtMapGetSliverAreaThreshold(void);
+extern RwBool
+RtLtMapSetSliverAreaThreshold(RwReal threshold);
+
+extern RwRGBA *
+RtLtMapDefaultSampleCallBack(RwRGBA *results,
+ RwV3d *samplePositions,
+ RwV3d * __RWUNUSED__ baryCoords,
+ RwUInt32 numSamples,
+ RpLight **lights,
+ RwUInt32 numLights,
+ RwV3d *normals);
+
+extern RwBool
+RtLtMapDefaultVisCallBack(RpWorld *world,
+ RwRGBAReal __RWUNUSED__ *result,
+ RwV3d *samplePos,
+ RwV3d *lightPos,
+ RpLight __RWUNUSED__ *light);
+
+extern void
+RtLtMapSetVisCallBackCollisionScalar(RwReal scalar);
+
+extern RwReal
+RtLtMapGetVisCallBackCollisionScalar(void);
+
+extern RtLtMapLightingSession *
+RtLtMapLightingSessionInitialize(RtLtMapLightingSession *session,
+ RpWorld *world);
+
+extern RwInt32
+RtLtMapLightingSessionGetNumSamples(RtLtMapLightingSession *session);
+extern RwInt32
+RtLtMapWorldSectorGetNumSamples(RpWorldSector *sector);
+extern RwInt32
+RtLtMapAtomicGetNumSamples(RpAtomic *atomic);
+
+extern RtLtMapLightingSession *
+RtLtMapImagesPurge(RtLtMapLightingSession *session);
+extern RpAtomic *
+RtLtMapAtomicImagePurge(RpAtomic *atomic);
+extern RpWorldSector *
+RtLtMapWorldSectorImagePurge(RpWorldSector *sector);
+
+extern RtLtMapLightingSession *
+RtLtMapLightMapsClear(RtLtMapLightingSession *session, RwRGBA *color);
+extern RpAtomic *
+RtLtMapAtomicLightMapClear(RpAtomic *atomic, RwRGBA *color);
+extern RpWorldSector *
+RtLtMapWorldSectorLightMapClear(RpWorldSector *sector, RwRGBA *color);
+
+
+/* Material/area-lighting functionality: */
+extern RtLtMapAreaLightGroup *
+RtLtMapAreaLightGroupCreate(RtLtMapLightingSession *session, RwReal density);
+extern RwBool
+RtLtMapAreaLightGroupDestroy(RtLtMapAreaLightGroup *lights);
+
+extern RwUInt32
+RtLtMapMaterialGetFlags(RpMaterial *material);
+extern RpMaterial *
+RtLtMapMaterialSetFlags(RpMaterial *material, RwUInt32 flags);
+
+extern RwReal
+RtLtMapMaterialGetLightMapDensityModifier(RpMaterial *material);
+extern RpMaterial *
+RtLtMapMaterialSetLightMapDensityModifier(RpMaterial *material, RwReal modifier);
+
+extern RwRGBA
+RtLtMapMaterialGetAreaLightColor(RpMaterial *material);
+extern RpMaterial *
+RtLtMapMaterialSetAreaLightColor(RpMaterial *material, RwRGBA color);
+
+extern RwReal
+RtLtMapMaterialGetAreaLightDensityModifier(RpMaterial *material);
+extern RpMaterial *
+RtLtMapMaterialSetAreaLightDensityModifier(RpMaterial *material, RwReal modifier);
+
+extern RwReal
+RtLtMapMaterialGetAreaLightRadiusModifier(RpMaterial *material);
+extern RpMaterial *
+RtLtMapMaterialSetAreaLightRadiusModifier(RpMaterial *material, RwReal modifier);
+
+extern RwUInt32
+RtLtMapGetMaxAreaLightSamplesPerMesh(void);
+extern RwBool
+RtLtMapSetMaxAreaLightSamplesPerMesh(RwUInt32 maxSamples);
+extern RwReal
+RtLtMapGetAreaLightDensityModifier(void);
+extern RwBool
+RtLtMapSetAreaLightDensityModifier(RwReal modifier);
+extern RwReal
+RtLtMapGetAreaLightRadiusModifier(void);
+extern RwBool
+RtLtMapSetAreaLightRadiusModifier(RwReal modifier);
+extern RwReal
+RtLtMapGetAreaLightErrorCutoff(void);
+extern RwBool
+RtLtMapSetAreaLightErrorCutoff(RwReal tolerance);
+
+
+/* Texture-saving functionality: */
+extern RwTexDictionary *
+RtLtMapTexDictionaryCreate(RtLtMapLightingSession *session);
+
+extern const RwChar *
+RtLtMapGetDefaultPrefixString(void);
+extern RwBool
+RtLtMapSetDefaultPrefixString(RwChar *string);
+
+extern RwUInt32
+RtLtMapGetLightMapCounter(void);
+extern RwBool
+RtLtMapSetLightMapCounter(RwUInt32 value);
+
+
+#if (defined(SKY2_DRVMODEL_H) || defined(NULLSKY_DRVMODEL_H))
+
+/* PS2-specific functionality: */
+extern RwTexture *RtLtMapSkyLightMapMakeDarkMap(RwTexture *lightMap);
+
+extern RwTexture *RtLtMapSkyBaseTextureProcess(RwTexture *texture);
+extern RpAtomic *RtLtMapSkyAtomicBaseTexturesProcess(RpAtomic *atomic);
+extern RpWorldSector *
+RtLtMapSkyWorldSectorBaseTexturesProcess(RpWorldSector *sector);
+extern RtLtMapLightingSession *
+RtLtMapSkyLightingSessionBaseTexturesProcess(RtLtMapLightingSession *session);
+
+extern RwRGBA *RtLtMapSkyLumCalcMaxCallBack( RwRGBA *scanline, RwUInt32 width );
+extern RwRGBA *RtLtMapSkyLumCalcSigmaCallBack( RwRGBA *scanline, RwUInt32 width );
+
+extern RwBool RtLtMapSkySetLumCalcCallBack(RtLtMapSkyLumCalcCallBack cback);
+extern RtLtMapSkyLumCalcCallBack RtLtMapSkyGetLumCalcCallBack( void );
+
+#endif /* (defined(SKY2_DRVMODEL_H) || defined(NULLSKY_DRVMODEL_H)) */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RTLTMAP_H */
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtltmap.rpe b/sdk/rwsdk/include/d3d8/rtltmap.rpe
new file mode 100644
index 00000000..fb171c51
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtltmap.rpe
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionLTMAPTOOL
+{
+
+
+
+ e_rwdb_CriterionLTMAPTOOLLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionLTMAPTOOL e_rwdb_CriterionLTMAPTOOL;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtmipk.h b/sdk/rwsdk/include/d3d8/rtmipk.h
new file mode 100644
index 00000000..6c777b41
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtmipk.h
@@ -0,0 +1,58 @@
+/**
+ * Mipmap K toolkit
+ */
+
+/***************************************************************************
+ * *
+ * Module : rtmipk.h *
+ * *
+ * Purpose : To calculate mipmap K values for Sky *
+ * *
+ **************************************************************************/
+
+#ifndef RTMIPK_H
+#define RTMIPK_H
+
+/**
+ * \defgroup rtmipk RtMipmapK
+ * \ingroup mipmapping
+ *
+ * PlayStation 2 / Mipmap K Value Toolkit for RenderWare.
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+#include "rwcore.h"
+#include "rpworld.h"
+
+/* RWPUBLIC */
+
+/****************************************************************************
+ Defines
+ */
+
+/****************************************************************************
+ Global Types
+ */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern void RtMipKWorldCalculateKValues(RpWorld *world, RwCamera *camera);
+extern void RtMipKClumpCalculateKValues(RpClump *clump, RwCamera *camera);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* RWPUBLICEND */
+
+#endif /* RTMIPK_H */
diff --git a/sdk/rwsdk/include/d3d8/rtmipk.rpe b/sdk/rwsdk/include/d3d8/rtmipk.rpe
new file mode 100644
index 00000000..04500e1d
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtmipk.rpe
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionMipmapK
+{
+
+
+
+ e_rwdb_CriterionMipmapKLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionMipmapK e_rwdb_CriterionMipmapK;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtpick.h b/sdk/rwsdk/include/d3d8/rtpick.h
new file mode 100644
index 00000000..62f564a3
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtpick.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ * *
+ * Module : rtpick.h *
+ * *
+ * Purpose : Utils for picking atomics. *
+ * *
+ **************************************************************************/
+
+#ifndef RTPICK_H
+#define RTPICK_H
+
+/**
+ * \defgroup rtpick RtPick
+ * \ingroup collisiondetection
+ *
+ * Picking Toolkit for RenderWare.
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+#include "rwcore.h"
+#include "rtpick.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Defines
+ */
+
+/****************************************************************************
+ Global Types
+ */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Camera pixel ray */
+extern const RwCamera *RwCameraCalcPixelRay(const RwCamera *camera,
+ RwLine *line,
+ const RwV2d *pixel);
+
+/* Picking atomics */
+extern RpAtomic *RpWorldPickAtomicOnLine(RpWorld *world,
+ const RwLine *line);
+extern RpAtomic *RwCameraPickAtomicOnPixel(const RwCamera *camera,
+ const RwV2d *pixel);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* RTPICK_H */
diff --git a/sdk/rwsdk/include/d3d8/rtpick.rpe b/sdk/rwsdk/include/d3d8/rtpick.rpe
new file mode 100644
index 00000000..779e2f9a
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtpick.rpe
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionPick
+{
+
+
+
+ e_rwdb_CriterionPickLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionPick e_rwdb_CriterionPick;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtpitexd.h b/sdk/rwsdk/include/d3d8/rtpitexd.h
new file mode 100644
index 00000000..602c608a
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtpitexd.h
@@ -0,0 +1,74 @@
+/***********************************************************************
+ *
+ * Module: rtpitexd.h
+ *
+ * Purpose: Platform Independent Texture Dictionaries
+ *
+ ***********************************************************************/
+
+#if !defined( RTPITEXD_H )
+#define RTPITEXD_H
+
+/**
+ * \defgroup rtpitexd RtPITexD
+ * \ingroup texturedictionaries
+ *
+ * Platform Independent Texture Dictionaries
+ *
+ */
+
+
+/* =====================================================================
+ * Includes
+ * ===================================================================== */
+#include <rwcore.h>
+#include <rtpitexd.rpe> /* automatically generated */
+
+
+/* =====================================================================
+ * Defines
+ * ===================================================================== */
+
+
+/* =====================================================================
+ * Module specific type definitions
+ * ===================================================================== */
+
+/* =====================================================================
+ * Extern variables
+ * ===================================================================== */
+
+
+/* =====================================================================
+ * Extern function prototypes
+ * ===================================================================== */
+
+#if defined( __cplusplus )
+extern "C"
+{
+#endif /* defined( __cplusplus ) */
+
+/* RWPUBLIC */
+
+extern RwUInt32
+RtPITexDictionaryStreamGetSize( const RwTexDictionary *texDict );
+
+extern RwTexDictionary *
+RtPITexDictionaryStreamRead( RwStream *stream );
+
+extern RwTexDictionary *
+RtPITexDictionaryStreamWrite( RwTexDictionary *texDict,
+ RwStream *stream );
+
+/* RWPUBLICEND */
+
+extern void
+_rwImageGammaUnCorrectArrayOfRGBA( RwRGBA * rgbaOut,
+ RwRGBA * rgbaIn,
+ RwInt32 numEls );
+
+#if defined( __cplusplus )
+}
+#endif /* defined( __cplusplus ) */
+
+#endif /* !defined( RTPITEXD_H ) */
diff --git a/sdk/rwsdk/include/d3d8/rtpitexd.rpe b/sdk/rwsdk/include/d3d8/rtpitexd.rpe
new file mode 100644
index 00000000..290ac864
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtpitexd.rpe
@@ -0,0 +1,216 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionPITexDict
+{
+
+
+
+ e_rwdb_CriterionPITexDictLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionPITexDict e_rwdb_CriterionPITexDict;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtpng.h b/sdk/rwsdk/include/d3d8/rtpng.h
new file mode 100644
index 00000000..4ba8cf0f
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtpng.h
@@ -0,0 +1,49 @@
+
+/***************************************************************************
+ * *
+ * Module : rtPng.h *
+ * *
+ * Purpose : Load PNG format files *
+ * *
+ **************************************************************************/
+
+#ifndef RTPNG_H
+#define RTPNG_H
+
+/**
+ * \defgroup rtpng RtPNG
+ * \ingroup imageconversiontools
+ *
+ * PNG/Portable Network Graphics Image Format Toolkit for RenderWare.
+ *
+ * See also http://www.libpng.org/pub/png/
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+/*--- Include files ---*/
+#include "rwcore.h"
+
+#include "rtpng.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwImage *RtPNGImageWrite(RwImage * image, const RwChar * imageName);
+extern RwImage *RtPNGImageRead(const RwChar * imageName);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* RWPUBLICEND */
+
+#endif /* RTPNG_H */
diff --git a/sdk/rwsdk/include/d3d8/rtpng.rpe b/sdk/rwsdk/include/d3d8/rtpng.rpe
new file mode 100644
index 00000000..e3f6f0d7
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtpng.rpe
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionPNG
+{
+
+
+
+ e_rwdb_CriterionPNGLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionPNG e_rwdb_CriterionPNG;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtquat.h b/sdk/rwsdk/include/d3d8/rtquat.h
new file mode 100644
index 00000000..a0a6e89d
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtquat.h
@@ -0,0 +1,646 @@
+/*
+ * Data structures for Quaternions
+ * See http://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Hamilton.html
+ *
+ * Copyright (c) Criterion Software Limited
+ */
+
+#ifndef RTQUAT_H
+#define RTQUAT_H
+
+/**
+ * \defgroup rtquat RtQuat
+ * \ingroup mathtools
+ *
+ * Quaternion Toolkit for RenderWare.
+ *
+ * See also http://www.gamasutra.com/features/19980703/quaternions_01.htm
+ */
+
+/*
+ * See http://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Hamilton.html
+ * On 16 October 1843 (a Monday) Hamilton was walking in along the Royal
+ * Canal with his wife to preside at a Council meeting of the Royal Irish
+ * Academy.
+ *
+ * Although his wife talked to him now and again Hamilton hardly
+ * heard, for the discovery of the quaternions, the first noncommutative
+ * algebra to be studied, was taking shape in his mind:-
+ *
+ * "And here there dawned on me the notion that we must admit, in
+ * some sense, a fourth dimension of space for the purpose of calculating
+ * with triples ... An electric circuit seemed to close, and a spark
+ * flashed forth."
+ */
+
+
+/****************************************************************************
+ Includes
+ */
+
+#include <math.h>
+/* renderware */
+#include "rwcore.h"
+
+#include "rtquat.rpe" /* automatically generated header file */
+
+#define RW_TOL_ORTHONORMAL ((RwReal)0.01)
+
+/****************************************************************************
+ Global Types
+ */
+
+
+typedef struct RtQuat RtQuat;
+/**
+ * \ingroup rtquat
+ * \struct RtQuat
+ * A structure describing a Quaternion
+ *
+*/
+struct RtQuat
+{
+ RwV3d imag; /**< The imaginary part(s) */
+ RwReal real; /**< The real part */
+};
+
+
+/****************************************************************************
+ Defines
+ */
+
+#define RtQuatInitMacro( result, _x, _y, _z, _w) \
+MACRO_START \
+{ \
+ (result)->real = (_w); \
+ (result)->imag.x = (_x); \
+ (result)->imag.y = (_y); \
+ (result)->imag.z = (_z); \
+} \
+MACRO_STOP
+
+#if (!defined(RtQuatAssignMacro))
+#define RtQuatAssignMacro(_target, _source) \
+ ( *(_target) = *(_source) )
+#endif /* (!defined(RtQuatAssignMacro)) */
+
+#define RtQuatAddMacro( result, q1, q2 ) \
+MACRO_START \
+{ \
+ (result)->real = (q1)->real + (q2)->real; \
+ RwV3dAddMacro(&(result)->imag, &(q1)->imag, &(q2)->imag); \
+} \
+MACRO_STOP
+
+#define RtQuatIncrementRealPartMacro(result, s, q) \
+MACRO_START \
+{ \
+ (result)->real = (q)->real + s; \
+ (result)->imag.x = (q)->imag.x; \
+ (result)->imag.y = (q)->imag.y; \
+ (result)->imag.z = (q)->imag.z; \
+} \
+MACRO_STOP
+
+#define RtQuatDecrementRealPartMacro(result, s, q) \
+MACRO_START \
+{ \
+ (result)->real = (q)->real - s; \
+ (result)->imag.x = (q)->imag.x; \
+ (result)->imag.y = (q)->imag.y; \
+ (result)->imag.z = (q)->imag.z; \
+} \
+MACRO_STOP
+
+#define RtQuatIncrementMacro( result, dq ) \
+MACRO_START \
+{ \
+ (result)->real = (result)->real + (dq)->real; \
+ RwV3dAddMacro(&(result)->imag, &(result)->imag, &(dq)->imag); \
+} \
+MACRO_STOP
+
+#define RtQuatSubMacro( result, q1, q2 ) \
+MACRO_START \
+{ \
+ (result)->real = (q1)->real - (q2)->real; \
+ RwV3dSubMacro(&(result)->imag, &(q1)->imag, &(q2)->imag); \
+} \
+MACRO_STOP
+
+#define RtQuatNegateMacro( result, q ) \
+MACRO_START \
+{ \
+ (result)->real = -(q)->real; \
+ (result)->imag.x = -(q)->imag.x; \
+ (result)->imag.y = -(q)->imag.y; \
+ (result)->imag.z = -(q)->imag.z; \
+} \
+MACRO_STOP
+
+#define RtQuatConjugateMacro( result, q) \
+MACRO_START \
+{ \
+ (result)->real = (q)->real; \
+ (result)->imag.x = -(q)->imag.x; \
+ (result)->imag.y = -(q)->imag.y; \
+ (result)->imag.z = -(q)->imag.z; \
+} \
+MACRO_STOP
+
+#define RtQuatScaleMacro(result, q, scale ) \
+MACRO_START \
+{ \
+ (result)->real = (q)->real * scale; \
+ RwV3dScaleMacro(&(result)->imag, &(q)->imag, scale); \
+} \
+MACRO_STOP
+
+#define RtQuatModulusSquaredMacro( q ) \
+ ((q)->real * (q)->real + \
+ RwV3dDotProductMacro(&(q)->imag, &(q)->imag))
+
+#define RtQuatModulusMacro( result, q ) \
+MACRO_START \
+{ \
+ (result) = RtQuatModulusSquaredMacro(q); \
+ rwSqrtMacro(&result, result); \
+} \
+MACRO_STOP
+
+#define RtQuatMultiplyMacro( result, q1, q2) \
+MACRO_START \
+{ \
+ /* \
+ * Assumes q1 != result != q2 \
+ */ \
+ (result)->real = \
+ (q1)->real * (q2)->real - \
+ RwV3dDotProductMacro(&(q1)->imag,&(q2)->imag); \
+ RwV3dCrossProductMacro(&(result)->imag, &(q1)->imag, &(q2)->imag); \
+ RwV3dIncrementScaledMacro(&(result)->imag, &(q2)->imag, (q1)->real); \
+ RwV3dIncrementScaledMacro(&(result)->imag, &(q1)->imag, (q2)->real); \
+} \
+MACRO_STOP
+
+#define RtQuatReciprocalMacro( result, q) \
+MACRO_START \
+{ \
+ /* \
+ * Assumes result != q \
+ */ \
+ RwReal val = RtQuatModulusSquaredMacro(q); \
+ \
+ if (val > (RwReal) 0) \
+ { \
+ val = ((RwReal)1) / val; \
+ (result)->real = (q)->real * val; \
+ val = -val; \
+ RwV3dScaleMacro(&(result)->imag, &(q)->imag, val); \
+ } \
+} \
+MACRO_STOP
+
+#define RtQuatSquareMacro( result, q ) \
+MACRO_START \
+{ \
+ /* \
+ * Assumes result != q \
+ */ \
+ RwReal val = ((RwReal)2) * (q)->real ; \
+ \
+ (result)->real = \
+ (q)->real * (q)->real - \
+ RwV3dDotProductMacro(&(q)->imag, &(q)->imag); \
+ RwV3dScaleMacro(&(result)->imag, &(q)->imag, val); \
+} \
+MACRO_STOP
+
+#define RtQuatSquareRootMacro( result, q ) \
+MACRO_START \
+{ \
+ /* \
+ * Assumes result != q \
+ * other root is of course -result \
+ */ \
+ RwReal val; \
+ \
+ RtQuatModulusMacro(val,q); \
+ val = ((q)->real + val) * ((RwReal) 0.5); \
+ \
+ if (val > ((RwReal)0)) \
+ { \
+ rwSqrtMacro(&val, val); \
+ (result)->real = val; \
+ val = ((RwReal)0.5) / val; \
+ RwV3dScale(&(result)->imag, &(q)->imag, val); \
+ } \
+ else \
+ { \
+ result->imag.x = -(q)->real; \
+ rwSqrtMacro(&(result->imag.x), result->imag.x); \
+ result->imag.y = ((RwReal)0); \
+ result->imag.x = ((RwReal)0); \
+ result->real = ((RwReal)0); \
+ } \
+} \
+MACRO_STOP
+
+#define RtQuatLogMacro(result, q) \
+MACRO_START \
+{ \
+ /* \
+ * Assumes result != q \
+ */ \
+ const RwReal mod2 = RtQuatModulusSquaredMacro(q); \
+ RwReal sin_b; \
+ RwReal radians; \
+ RwReal factor; \
+ \
+ sin_b = RwV3dDotProduct(&(q)->imag, &(q)->imag); \
+ rwSqrtMacro(&sin_b, sin_b); \
+ radians = (RwReal) RwATan2(sin_b, (q)->real); \
+ factor = (sin_b > (RwReal) 0) ? (((RwReal)radians) / sin_b) : 0 ; \
+ \
+ RwV3dScaleMacro(&(result)->imag, &(q)->imag, factor); \
+ (result)->real = ((RwReal) RwLog(mod2)) * ((RwReal) 0.5); \
+ \
+} \
+MACRO_STOP
+
+#define RtQuatExpMacro(result, q) \
+MACRO_START \
+{ \
+ /* \
+ * Assumes result != q \
+ */ \
+ const RwReal exp_a = (RwReal)RwExp((q)->real); \
+ RwReal mod_b; \
+ RwReal factor; \
+ \
+ mod_b = RwV3dDotProduct(&(q)->imag, &(q)->imag); \
+ rwSqrtMacro(&mod_b, mod_b); \
+ factor = ( (mod_b > (RwReal) 0) ? \
+ (exp_a * ((RwReal)RwSin(mod_b)) / mod_b) : \
+ 0 ) ; \
+ \
+ RwV3dScaleMacro(&(result)->imag, &(q)->imag, factor); \
+ (result)->real = exp_a * (RwReal)RwCos(mod_b); \
+} \
+MACRO_STOP
+
+#define RtQuatPowMacro( result, q, e) \
+MACRO_START \
+{ \
+ RtQuat qLog; \
+ \
+ RtQuatLogMacro(&qLog, q); \
+ RtQuatScaleMacro(&qLog, &qLog, e); \
+ RtQuatExpMacro(result, &qLog); \
+} \
+MACRO_STOP
+
+#define RtQuatUnitLogMacro(result, q) \
+MACRO_START \
+{ \
+ /* \
+ * Assumes result != q \
+ */ \
+ RwReal sin_b ; \
+ RwReal radians ; \
+ RwReal factor ; \
+ \
+ sin_b = RwV3dDotProduct(&(q)->imag, &(q)->imag); \
+ rwSqrtMacro(&sin_b, sin_b); \
+ radians = (RwReal)RwATan2(sin_b, (q)->real); \
+ factor = (sin_b > (RwReal) 0) ? (((RwReal)radians) / sin_b) : 0 ; \
+ \
+ RwV3dScaleMacro(&(result)->imag, &(q)->imag, factor); \
+ (result)->real = (RwReal)0; \
+ \
+} \
+MACRO_STOP
+
+#define RtQuatUnitExpMacro(result, q) \
+MACRO_START \
+{ \
+ /* \
+ * Assumes result != q \
+ */ \
+ RwReal mod_b; \
+ RwReal factor; \
+ \
+ mod_b = RwV3dDotProduct(&(q)->imag, &(q)->imag); \
+ rwSqrtMacro(&mod_b, mod_b); \
+ factor = (mod_b > (RwReal) 0) ? (((RwReal)RwSin(mod_b)) / mod_b) : 0 ; \
+ \
+ RwV3dScaleMacro(&(result)->imag, &(q)->imag, factor); \
+ (result)->real = (RwReal)RwCos(mod_b); \
+ \
+} \
+MACRO_STOP
+
+#define RtQuatUnitPowMacro( result, q, e) \
+MACRO_START \
+{ \
+ RtQuat qLog; \
+ \
+ RtQuatUnitLogMacro(&qLog, q); \
+ RwV3dScaleMacro(&qLog.imag, &qLog.imag, e); \
+ RtQuatUnitExpMacro(result, &qLog); \
+} \
+MACRO_STOP
+
+#define RtQuatConvertToMatrixMacro(qpQuat, mpMatrix) \
+MACRO_START \
+{ \
+ RwReal rS; \
+ RwV3d rV; \
+ RwV3d rW; \
+ RwV3d square; \
+ RwV3d cross; \
+ \
+ rS = ((RwReal) 2) / RtQuatModulusSquaredMacro((qpQuat)); \
+ \
+ RwV3dScale(&rV, &(qpQuat)->imag, rS); \
+ RwV3dScale(&rW, &rV, (qpQuat)->real); \
+ \
+ square.x = (qpQuat)->imag.x * rV.x; \
+ square.y = (qpQuat)->imag.y * rV.y; \
+ square.z = (qpQuat)->imag.z * rV.z; \
+ \
+ cross.x = (qpQuat)->imag.y * rV.z; \
+ cross.y = (qpQuat)->imag.z * rV.x; \
+ cross.z = (qpQuat)->imag.x * rV.y; \
+ \
+ (mpMatrix)->right.x = ((RwReal) 1) - (square.y + square.z); \
+ (mpMatrix)->right.y = cross.z + rW.z; \
+ (mpMatrix)->right.z = cross.y - rW.y; \
+ \
+ (mpMatrix)->up.x = cross.z - rW.z; \
+ (mpMatrix)->up.y = ((RwReal) 1) - (square.z + square.x); \
+ (mpMatrix)->up.z = cross.x + rW.x; \
+ \
+ (mpMatrix)->at.x = cross.y + rW.y; \
+ (mpMatrix)->at.y = cross.x - rW.x; \
+ (mpMatrix)->at.z = ((RwReal) 1) - (square.x + square.y); \
+ \
+ /* Set position */ \
+ (mpMatrix)->pos.x = ((RwReal) 0); \
+ (mpMatrix)->pos.y = ((RwReal) 0); \
+ (mpMatrix)->pos.z = ((RwReal) 0); \
+ \
+ /* Matrix is orthogonal */ \
+ rwMatrixSetFlags((mpMatrix), \
+ (rwMATRIXTYPEORTHOGONAL & \
+ ~rwMATRIXINTERNALIDENTITY) ); \
+ \
+} \
+MACRO_STOP
+
+#define RtQuatUnitConvertToMatrixMacro(qpQuat, mpMatrix) \
+MACRO_START \
+{ \
+ const RwReal x = (qpQuat)->imag.x; \
+ const RwReal y = (qpQuat)->imag.y; \
+ const RwReal z = (qpQuat)->imag.z; \
+ const RwReal w = (qpQuat)->real; \
+ RwV3d square; \
+ RwV3d cross; \
+ RwV3d wimag; \
+ \
+ square.x = x * x; \
+ square.y = y * y; \
+ square.z = z * z; \
+ \
+ cross.x = y * z; \
+ cross.y = z * x; \
+ cross.z = x * y; \
+ \
+ wimag.x = w * x; \
+ wimag.y = w * y; \
+ wimag.z = w * z; \
+ \
+ (mpMatrix)->right.x = 1 - 2 * (square.y + square.z); \
+ (mpMatrix)->right.y = 2 * (cross.z + wimag.z); \
+ (mpMatrix)->right.z = 2 * (cross.y - wimag.y); \
+ \
+ (mpMatrix)->up.x = 2 * (cross.z - wimag.z); \
+ (mpMatrix)->up.y = 1 - 2 * (square.x + square.z); \
+ (mpMatrix)->up.z = 2 * (cross.x + wimag.x); \
+ \
+ (mpMatrix)->at.x = 2 * (cross.y + wimag.y); \
+ (mpMatrix)->at.y = 2 * (cross.x - wimag.x); \
+ (mpMatrix)->at.z = (1 - 2 * (square.x + square.y)); \
+ \
+ /* Set position */ \
+ (mpMatrix)->pos.x = ((RwReal) 0); \
+ (mpMatrix)->pos.y = ((RwReal) 0); \
+ (mpMatrix)->pos.z = ((RwReal) 0); \
+ \
+ /* Matrix is orthonormal */ \
+ rwMatrixSetFlags((mpMatrix), \
+ (rwMATRIXTYPEORTHONORMAL & \
+ ~rwMATRIXINTERNALIDENTITY) ); \
+} \
+MACRO_STOP
+
+#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ))
+
+#define RtQuatInit( result, _x, _y, _z, _w) \
+ RtQuatInitMacro( result, _x, _y, _z, _w)
+
+#define RtQuatAssign( to, from ) \
+ RtQuatAssignMacro( to, from )
+
+#define RtQuatAdd( result, q1, q2 ) \
+ RtQuatAddMacro( result, q1, q2 )
+
+#define RtQuatIncrementRealPart(result, s, q) \
+ RtQuatIncrementRealPartMacro(result, s, q)
+
+#define RtQuatDecrementRealPart(result, s, q) \
+ RtQuatDecrementRealPartMacro(result, s, q)
+
+#define RtQuatIncrement( result, dq ) \
+ RtQuatIncrementMacro( result, dq )
+
+#define RtQuatSub( result, q1, q2 ) \
+ RtQuatSubMacro( result, q1, q2 )
+
+#define RtQuatNegate( result, q ) \
+ RtQuatNegateMacro( result, q )
+
+#define RtQuatConjugate( result, q) \
+ RtQuatConjugateMacro( result, q)
+
+#define RtQuatScale(result, q, scale ) \
+ RtQuatScaleMacro(result, q, scale )
+
+#define RtQuatModulusSquared( q ) \
+ RtQuatModulusSquaredMacro( q )
+
+#define RtQuatMultiply( result, q1, q2) \
+ RtQuatMultiplyMacro( result, q1, q2)
+
+#define RtQuatReciprocal( result, q) \
+ RtQuatReciprocalMacro( result, q)
+
+#define RtQuatSquare( result, q ) \
+ RtQuatSquareMacro( result, q )
+
+#define RtQuatSquareRoot( result, q ) \
+ RtQuatSquareRootMacro( result, q )
+
+#define RtQuatLog( result, q ) \
+ RtQuatLogMacro( result, q )
+
+#define RtQuatExp( result, q ) \
+ RtQuatExpMacro( result, q )
+
+#define RtQuatPow( result, q, e ) \
+ RtQuatPowMacro( result, q, e )
+
+#define RtQuatUnitLog( result, q ) \
+ RtQuatUnitLogMacro( result, q )
+
+#define RtQuatUnitExp( result, q ) \
+ RtQuatUnitExpMacro( result, q )
+
+#define RtQuatUnitPow( result, q, e ) \
+ RtQuatUnitPowMacro( result, q, e )
+
+#define RtQuatConvertToMatrix(qpQuat, mpMatrix) \
+ RtQuatConvertToMatrixMacro(qpQuat, mpMatrix)
+
+#define RtQuatUnitConvertToMatrix(qpQuat, mpMatrix) \
+ RtQuatUnitConvertToMatrixMacro(qpQuat, mpMatrix)
+
+#endif /* (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) */
+
+/****************************************************************************
+ Function prototypes
+ */
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwBool
+RtQuatConvertFromMatrix(RtQuat * const qpQuat,
+ const RwMatrix * const mpMatrix);
+
+extern RtQuat *
+RtQuatRotate(RtQuat * quat,
+ const RwV3d * axis,
+ RwReal angle,
+ RwOpCombineType combineOp);
+
+extern const RtQuat *
+RtQuatQueryRotate(const RtQuat *quat,
+ RwV3d * unitAxis,
+ RwReal * angle);
+
+extern RwV3d *
+RtQuatTransformVectors(RwV3d * vectorsOut,
+ const RwV3d * vectorsIn,
+ const RwInt32 numPoints,
+ const RtQuat *quat);
+
+extern RwReal
+RtQuatModulus(RtQuat * q);
+
+#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )
+
+extern void
+RtQuatInit(RtQuat * result, RwReal x, RwReal y, RwReal z, RwReal w);
+
+extern void
+RtQuatAssign(RtQuat * to, RtQuat * from);
+
+extern void
+RtQuatAdd(RtQuat * result, RtQuat * q1, RtQuat * q2);
+
+extern void
+RtQuatIncrementRealPart(RtQuat * result, RwReal s, RtQuat * q);
+
+extern void
+RtQuatDecrementRealPart(RtQuat * result, RwReal s, RtQuat * q);
+
+extern void
+RtQuatIncrement(RtQuat * result, RtQuat * dq);
+
+extern void
+RtQuatSub(RtQuat * result, RtQuat * q1, RtQuat * q2);
+
+extern void
+RtQuatNegate(RtQuat * result, RtQuat * q);
+
+extern void
+RtQuatConjugate(RtQuat * result, RtQuat * q);
+
+extern void
+RtQuatScale(RtQuat * result, RtQuat * q, RwReal scale);
+
+extern RwReal
+RtQuatModulusSquared(RtQuat * q);
+
+extern void
+RtQuatMultiply(RtQuat * result, RtQuat * q1, RtQuat * q2);
+
+extern void
+RtQuatReciprocal(RtQuat * result, RtQuat * q);
+
+extern void
+RtQuatSquare(RtQuat * result, RtQuat * q);
+
+extern void
+RtQuatSquareRoot(RtQuat * result, RtQuat * q);
+
+extern void
+RtQuatLog(RtQuat * result, RtQuat * q);
+
+extern void
+RtQuatExp(RtQuat * result, RtQuat * q);
+
+extern void
+RtQuatPow(RtQuat * result, RtQuat * q, RwReal e);
+
+extern void
+RtQuatUnitLog(RtQuat * result, RtQuat * q);
+
+extern void
+RtQuatUnitExp(RtQuat * result, RtQuat * q);
+
+extern void
+RtQuatUnitPow(RtQuat * result, RtQuat * q, RwReal e);
+
+extern void
+RtQuatConvertToMatrix(const RtQuat * const qpQuat,
+ RwMatrix * const mpMatrix);
+
+extern void
+RtQuatUnitConvertToMatrix(const RtQuat * const qpQuat,
+ RwMatrix * const mpMatrix);
+
+#endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/*
+ * Backwards compatibility code
+ */
+
+typedef RtQuat RpQuat;
+
+#define RpAnimQuatConvertFromMatrix(qpQuat, mpMatrix) \
+ RtQuatConvertFromMatrix(qpQuat, mpMatrix)
+
+#define RpAnimQuatConvertToMatrix(qpQuat,mpMatrix) \
+ RtQuatUnitConvertToMatrix(qpQuat,mpMatrix)
+
+
+#endif /* RTQUAT_H */
+
diff --git a/sdk/rwsdk/include/d3d8/rtquat.rpe b/sdk/rwsdk/include/d3d8/rtquat.rpe
new file mode 100644
index 00000000..b239aba0
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtquat.rpe
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionQuat
+{
+
+
+
+ e_rwdb_CriterionQuatLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionQuat e_rwdb_CriterionQuat;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtras.h b/sdk/rwsdk/include/d3d8/rtras.h
new file mode 100644
index 00000000..957e21e6
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtras.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ * *
+ * Module : rtRAS.h *
+ * *
+ * Purpose : Load RAS format files *
+ * *
+ **************************************************************************/
+
+#ifndef RTRAS_H
+#define RTRAS_H
+
+/**
+ * \defgroup rtras RtRAS
+ * \ingroup imageconversiontools
+ *
+ * RAS/Sun Raster Fule Format Image Format Toolkit for RenderWare.
+ *
+ * See also http://www.sworks.com/hollasch/cgindex/formats/sunraster.html
+ *
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+/*--- Include files ---*/
+#include "rwcore.h"
+
+#include "rtras.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwImage *RtRASImageWrite(RwImage * image,
+ const RwChar * imageName);
+extern RwImage *RtRASImageRead(const RwChar * imageName);
+
+extern void _rwImageGammaUnCorrectArrayOfRGBA(RwRGBA * rgbaOut,
+ RwRGBA * rgbaIn,
+ RwInt32 numEls);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* RWPUBLICEND */
+
+#endif /* RTRAS_H */
diff --git a/sdk/rwsdk/include/d3d8/rtras.rpe b/sdk/rwsdk/include/d3d8/rtras.rpe
new file mode 100644
index 00000000..a242ef49
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtras.rpe
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionRAS
+{
+
+
+
+ e_rwdb_CriterionRASLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionRAS e_rwdb_CriterionRAS;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtray.h b/sdk/rwsdk/include/d3d8/rtray.h
new file mode 100644
index 00000000..b2f3d4bc
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtray.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+ * *
+ * Module : rtray.h *
+ * *
+ * Purpose : Picking with rays *
+ * *
+ **************************************************************************/
+
+#ifndef RTRAY_H
+#define RTRAY_H
+
+/**
+ * \defgroup rtray RtRay
+ * \ingroup mathtools
+ *
+ * Line Toolkit for RenderWare.
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+#include "rwcore.h"
+#include "rtray.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Defines
+ */
+
+
+ /****************************************************************************
+ Global Types
+ */
+
+
+/* RWPUBLIC */
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Line intersections */
+extern RwReal RtLineTriangleIntersectionTest(RwLine *line, RwV3d *normal,
+ RwV3d *v0, RwV3d *v1, RwV3d *v2);
+extern RwBool RtLineSphereIntersectionTest(RwLine *line,
+ RwSphere *sphere,
+ RwReal *centerDist);
+
+/* Line clipping */
+extern RwLine *RtLineClipPlane(RwLine *line, RwPlane *plane);
+extern RwLine *RtLineClipBBox(RwLine *line, RwBBox *box);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* RWPUBLICEND */
+
+#endif /* RTRAY_H */
diff --git a/sdk/rwsdk/include/d3d8/rtray.rpe b/sdk/rwsdk/include/d3d8/rtray.rpe
new file mode 100644
index 00000000..c1ff4458
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtray.rpe
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionRay
+{
+
+
+
+ e_rwdb_CriterionRayLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionRay e_rwdb_CriterionRay;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtskinsp.h b/sdk/rwsdk/include/d3d8/rtskinsp.h
new file mode 100644
index 00000000..7e40c13f
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtskinsp.h
@@ -0,0 +1,57 @@
+/***************************************************************************
+ * *
+ * Module : *
+ * *
+ * Purpose : *
+ * *
+ **************************************************************************/
+
+/* RWPUBLIC */
+
+#ifndef RTSKINSP_H
+#define RTSKINSP_H
+
+/**
+ * \defgroup rtskinsplit RtSkinSplit
+ * \ingroup skinning
+ *
+ * Skin Splitting Toolkit for RenderWare Graphics.
+ */
+
+/****************************************************************************
+ Includes
+ */
+#include <rwcore.h>
+#include <rpworld.h>
+
+/****************************************************************************
+ Defines
+ */
+
+/****************************************************************************
+ Global Types
+ */
+
+/****************************************************************************
+ Global variables (across program)
+ */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cpluscplus */
+
+extern RpAtomic *
+RtSkinSplitAtomicSplitGeometry( RpAtomic *atomic, RwUInt32 boneLimit );
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RTSKINSP_H */
+
+/* RWPUBLICEND */
diff --git a/sdk/rwsdk/include/d3d8/rtskinsp.rpe b/sdk/rwsdk/include/d3d8/rtskinsp.rpe
new file mode 100644
index 00000000..f86623b4
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtskinsp.rpe
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionSkinSplit
+{
+
+
+
+ e_rwdb_CriterionSkinSplitLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionSkinSplit e_rwdb_CriterionSkinSplit;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtslerp.h b/sdk/rwsdk/include/d3d8/rtslerp.h
new file mode 100644
index 00000000..4262b894
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtslerp.h
@@ -0,0 +1,262 @@
+/*
+ * Data Structures for Slerps/Spherical Linear Interpolations
+ * See also GemsIII/quatspin.c in
+ * http://www.acm.org/pubs/tog/GraphicsGems/gemsiii.zip
+ * Copyright (c) Criterion Software Limited
+ */
+
+/***************************************************************************
+ * *
+ * Module : rtslerp.h *
+ * *
+ * Purpose : Slerp functionality *
+ * *
+ **************************************************************************/
+
+#ifndef RTSLERP_H
+#define RTSLERP_H
+
+/**
+ * \defgroup rtslerp RtSlerp
+ * \ingroup mathtools
+ *
+ * Slerp/Spherical Linear Interpolations Toolkit for RenderWare.
+ *
+ * See also http://www.cis.ohio-state.edu/~parent/book/Full.html
+ */
+
+#include "rwcore.h"
+#include "rtquat.h"
+
+/****************************************************************************
+ Includes
+ */
+
+#include "rtslerp.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Defines
+ */
+
+/* Masks for specifying which matrices to store by reference */
+#define rtSLERPREFNONE 0x00
+#define rtSLERPREFSTARTMAT 0x01
+#define rtSLERPREFENDMAT 0x02
+#define rtSLERPREFALL (~rtSLERPREFNONE)
+
+/****************************************************************************
+ Global Types
+ */
+
+
+typedef struct RtSlerp RtSlerp;
+/**
+ * \ingroup rtslerp
+ * \struct RtSlerp
+ * structure describing a Slerps/Spherical Linear Interpolations.
+ * See also GemsIII/quatspin.c in
+ * http://www.acm.org/pubs/tog/GraphicsGems/gemsiii.zip
+ */
+struct RtSlerp
+{
+ RwInt32 matRefMask; /**< Which matrices do we NOT own */
+ RwMatrix *startMat; /**< The start matrix */
+ RwMatrix *endMat; /**< The end matrix */
+ RwV3d axis; /**< The axis of rotation for the slerp */
+ RwReal angle; /**< The angle (in degrees) between src & dest */
+
+ /* Though a slerp may be a bad idea and opting for a lerp is better */
+ RwBool useLerp; /**< Do we want to use lerps? */
+};
+
+/* static frame sequence animation - contains no state */
+
+
+typedef struct RtQuatSlerpCache RtQuatSlerpCache;
+/**
+ * \ingroup rtslerp
+ * \struct RtQuatSlerpCache
+ * structure describing a SlerpCache,
+ * which should be initialized with \ref RtQuatSetupSlerpCache.
+ */
+struct RtQuatSlerpCache
+{
+ RtQuat raFrom; /**< Scaled initial quaternion */
+ RtQuat raTo; /**< Scaled final quaternion */
+ RwReal omega; /**< Angular displacement in radians */
+ RwBool nearlyZeroOm; /**< Flags near-zero angular
+ displacement*/
+};
+
+
+typedef struct RtQuatSlerpArgandCache RtQuatSlerpArgandCache;
+/**
+ * \ingroup rtslerp
+ * \struct RtQuatSlerpArgandCache
+ * a structure describing
+ * an Argand SlerpCache which should be
+ * initialized with \ref RtQuatSetupSlerpArgandCache.
+ * See http://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Argand.html
+ * Jean Argand was an accountant and amateur mathematician.
+ * He is famed for his geometrical interpretation of the complex numbers
+ * where i is interpreted as a rotation through 90.
+ */
+struct RtQuatSlerpArgandCache
+{
+ RtQuat logTo; /**< field Logarithm of final quaternion */
+ RtQuat logBase; /**< Logarithm of initial relative to final quaternion */
+};
+
+#define RtQuatSlerpMacro(qpResult, qpFrom, qpTo, rT, sCache) \
+MACRO_START \
+{ \
+ if ((rT) <= ((RwReal) 0)) \
+ { \
+ /* t is before start */ \
+ *(qpResult) = *(qpFrom); \
+ } \
+ else if (((RwReal) 1) <= (rT)) \
+ { \
+ \
+ /* t is after end */ \
+ *(qpResult) = *(qpTo); \
+ } \
+ else \
+ { \
+ /* ... so t must be in the interior then */ \
+ /* Calc coefficients rSclFrom, rSclTo */ \
+ RwReal rSclFrom = ((RwReal) 1) - (rT); \
+ RwReal rSclTo = (rT); \
+ \
+ if (!((sCache)->nearlyZeroOm)) \
+ { \
+ /* Standard case: slerp */ \
+ /* SLERPMESSAGE(("Neither nearly ZERO nor nearly PI")); */ \
+ \
+ rSclFrom *= (sCache)->omega; \
+ RwSinMinusPiToPiMacro(rSclFrom, rSclFrom); \
+ rSclTo *= (sCache)->omega; \
+ RwSinMinusPiToPiMacro(rSclTo, rSclTo); \
+ } \
+ \
+ /* Calc final values */ \
+ RwV3dScaleMacro(&(qpResult)->imag, \
+ &(sCache)->raFrom.imag, rSclFrom); \
+ RwV3dIncrementScaledMacro(&(qpResult)->imag, \
+ &(sCache)->raTo.imag, rSclTo); \
+ (qpResult)->real = \
+ ((sCache)->raFrom.real * rSclFrom) + \
+ ((sCache)->raTo.real * rSclTo); \
+ } \
+} \
+MACRO_STOP
+
+#define RtQuatSlerpArgandMacro(qpResult, qpFrom, qpTo, rT, sArgandCache) \
+MACRO_START \
+{ \
+ if ((rT) <= ((RwReal) 0)) \
+ { \
+ /* t is before start */ \
+ *(qpResult) = *(qpFrom); \
+ } \
+ else if (((RwReal) 1) <= (rT)) \
+ { \
+ /* t is after end */ \
+ *(qpResult) = *(qpTo); \
+ } \
+ else \
+ { \
+ RtQuat logBlend; \
+ \
+ /* ... so t must be in the interior then */ \
+ \
+ logBlend.imag.x = \
+ (sArgandCache)->logBase.imag.x + \
+ (rT) * (sArgandCache)->logTo.imag.x; \
+ logBlend.imag.y = \
+ (sArgandCache)->logBase.imag.y + \
+ (rT) * (sArgandCache)->logTo.imag.y; \
+ logBlend.imag.z = \
+ (sArgandCache)->logBase.imag.z + \
+ (rT) * (sArgandCache)->logTo.imag.z; \
+ logBlend.real = 0; \
+ \
+ RtQuatUnitExpMacro((qpResult), &logBlend); \
+ \
+ } \
+} \
+MACRO_STOP
+
+#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ))
+
+#define RtQuatSlerp(qpResult, qpFrom, qpTo, rT, sCache) \
+ RtQuatSlerpMacro(qpResult, qpFrom, qpTo, rT, sCache)
+
+#define RtQuatSlerpArgand(qpResult, qpFrom, qpTo, rT, sArgandCache) \
+ RtQuatSlerpArgandMacro(qpResult, qpFrom, qpTo, rT, sArgandCache)
+
+#endif /* (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Creating and destroying slerps */
+
+extern RtSlerp *RtSlerpCreate(RwInt32 nMatRefMask);
+
+extern void RtSlerpDestroy(RtSlerp * spSlerp);
+
+/* setting up a slerp */
+extern RtSlerp *RtSlerpInitialize(RtSlerp * spSlerp,
+ RwMatrix * mpMat1,
+ RwMatrix * mpMat2);
+
+/* Get a matrix */
+extern RwMatrix *RtSlerpGetMatrix(RtSlerp * spSlerp,
+ RwMatrix * mpResultMat,
+ RwReal nDelta);
+
+/* Set if lerp or slerp */
+extern RtSlerp *RtSlerpSetLerp(RtSlerp * spSlerp,
+ RwBool bUseLerp);
+
+extern void
+RtQuatSetupSlerpCache(RtQuat * qpFrom,
+ RtQuat * qpTo,
+ RtQuatSlerpCache * sCache);
+
+extern void
+RtQuatSetupSlerpArgandCache(RtQuat * qpFrom,
+ RtQuat * qpTo,
+ RtQuatSlerpArgandCache * sArgandCache);
+
+#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )
+
+extern void
+RtQuatSlerp(RtQuat * qpResult,
+ RtQuat * qpFrom,
+ RtQuat * qpTo,
+ RwReal rT,
+ RtQuatSlerpCache * sCache);
+
+extern void
+RtQuatSlerpArgand(RtQuat * qpResult,
+ RtQuat * qpFrom,
+ RtQuat * qpTo,
+ RwReal rT,
+ RtQuatSlerpArgandCache * sArgandCache);
+
+#endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RTSLERP_H */
+
diff --git a/sdk/rwsdk/include/d3d8/rtslerp.rpe b/sdk/rwsdk/include/d3d8/rtslerp.rpe
new file mode 100644
index 00000000..64bd7571
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtslerp.rpe
@@ -0,0 +1,180 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionSlerp
+{
+
+
+
+ e_rwdb_CriterionSlerpLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionSlerp e_rwdb_CriterionSlerp;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtsplpvs.h b/sdk/rwsdk/include/d3d8/rtsplpvs.h
new file mode 100644
index 00000000..419717a1
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtsplpvs.h
@@ -0,0 +1,65 @@
+
+/***************************************************************************
+ * *
+ * Module : rtsplpvs.h *
+ * *
+ * Purpose : To generate pvs data for a world froma spline *
+ * *
+ **************************************************************************/
+
+#ifndef RTSPLINEPVS_H
+#define RTSPLINEPVS_H
+
+/**
+ * \defgroup rtsplinepvs RtSplinePVS
+ * \ingroup pvs
+ *
+ * Spline PVS Toolkit for RenderWare.
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+#include "rwcore.h"
+#include "rpworld.h"
+#include "rpspline.h"
+
+/* RWPUBLIC */
+
+/****************************************************************************
+ Defines
+ */
+
+/****************************************************************************
+ Global Types
+ */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RpWorld *
+RtSplinePVSConstruct(RpWorld * world,
+ RpSpline *spline, RwInt32 samples);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* RWPUBLICEND */
+
+/* for back compatibility */
+#define RtSplinePVSCreate(_world, _raster, _zraster, \
+ _mindist, _maxdist, _spline, _samples) \
+ RtSplinePVSConstruct(_world, \
+ _spline, _samples)
+
+
+#endif /* RTSPLINEPVS_H */
diff --git a/sdk/rwsdk/include/d3d8/rtsplpvs.rpe b/sdk/rwsdk/include/d3d8/rtsplpvs.rpe
new file mode 100644
index 00000000..9736cbbc
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtsplpvs.rpe
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionSplinePVS
+{
+
+
+
+ e_rwdb_CriterionSplinePVSLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionSplinePVS e_rwdb_CriterionSplinePVS;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rttiff.h b/sdk/rwsdk/include/d3d8/rttiff.h
new file mode 100644
index 00000000..b5d0ec00
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rttiff.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * *
+ * Module : rttiff.h *
+ * *
+ * Purpose : Load TIFF format files *
+ * *
+ **************************************************************************/
+
+#ifndef RWTIFF_H
+#define RWTIFF_H
+
+/**
+ * \defgroup rttiff RtTIFF
+ * \ingroup imageconversiontools
+ *
+ * TIFF/Tag Image File Format Image Format Toolkit for RenderWare.
+ *
+ * See also http://www.libtiff.org
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+/*--- Include files ---*/
+#include "rwcore.h"
+
+#include "rttiff.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwImage *RtTIFFImageRead(const RwChar *imageName);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* RWPUBLICEND */
+
+#endif /* RWTIFF_H */
diff --git a/sdk/rwsdk/include/d3d8/rttiff.rpe b/sdk/rwsdk/include/d3d8/rttiff.rpe
new file mode 100644
index 00000000..260b2329
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rttiff.rpe
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionTIFF
+{
+
+
+
+ e_rwdb_CriterionTIFFLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionTIFF e_rwdb_CriterionTIFF;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rttilerd.h b/sdk/rwsdk/include/d3d8/rttilerd.h
new file mode 100644
index 00000000..7cb8f887
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rttilerd.h
@@ -0,0 +1,70 @@
+/***************************************************************************
+ * *
+ * Module : rttilerd.h *
+ * *
+ * Purpose : Tile renderer *
+ * *
+ **************************************************************************/
+
+#ifndef RTTILERD_H
+#define RTTILERD_H
+
+/**
+ * \defgroup rttilerender RtTileRender
+ * \ingroup cameras
+ *
+ * Tile renderer - e.g. grabbing screen shots - Toolkit for RenderWare.
+ */
+
+/****************************************************************************
+ Includes
+ */
+#include "rwcore.h"
+
+#include "rpcriter.h"
+
+/****************************************************************************
+ Defines
+ */
+
+/****************************************************************************
+ Global Types
+ */
+
+typedef RwCamera * (*RtTileRenderCallBack)(RwCamera *camera,
+ RwInt32 x, RwInt32 y,
+ void *pData);
+
+typedef RwImage * (*RtTileArchiveCallBack)(RwImage *image,
+ RwInt32 x, RwInt32 y,
+ void *pData);
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Tile renderer */
+
+extern RwCamera *
+RtTileRender(RwCamera *camera,
+ RwInt32 imageWidth, RwInt32 imageHeight,
+ RwInt32 tileWidth, RwInt32 tileHeight,
+ RtTileRenderCallBack renderCallBack,
+ RtTileArchiveCallBack archiveCallBack,
+ void *pData);
+
+extern RwImage *
+RtTileDefaultArchive(RwImage *image,
+ RwInt32 x, RwInt32 y, void *pData);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RTTILERD_H */
diff --git a/sdk/rwsdk/include/d3d8/rttilerd.rpe b/sdk/rwsdk/include/d3d8/rttilerd.rpe
new file mode 100644
index 00000000..15c929f9
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rttilerd.rpe
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionTileRend
+{
+
+
+
+ e_rwdb_CriterionTileRendLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionTileRend e_rwdb_CriterionTileRend;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rttoc.h b/sdk/rwsdk/include/d3d8/rttoc.h
new file mode 100644
index 00000000..88926062
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rttoc.h
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * *
+ * Module : rttoc.h *
+ * *
+ * Purpose : Table Of Contents (TOC) *
+ * *
+ ******************************************************************************/
+
+#ifndef RTTOC_H
+#define RTTOC_H
+
+/**
+ * \defgroup rttoc RtTOC
+ * \ingroup streaming
+ *
+ * Table Of Contents (TOC) - creating a TOC for a stream.
+ */
+
+/******************************************************************************
+ Includes
+ */
+#include "rwcore.h"
+
+#include "rpcriter.h"
+
+/******************************************************************************
+ Defines
+ */
+
+/******************************************************************************
+ Global Types
+ */
+
+typedef struct _rtTOCGUID _rtTOCGUID;
+#if (!defined(DOXYGEN))
+struct _rtTOCGUID
+{
+ RwUInt32 data1;
+ RwUInt16 data2;
+ RwUInt16 data3;
+ RwUInt8 data4[8];
+};
+#endif /* (!defined(DOXYGEN)) */
+
+typedef struct RtTOCEntry RtTOCEntry;
+/**
+ * \ingroup rttoc
+ * \struct RtTOCEntry
+ *
+ * A Table Of Contents (TOC) entry structure.
+ */
+struct RtTOCEntry
+{
+ RwCorePluginID id; /**< Chunk ID */
+ RwUInt32 gid; /**< Game ID */
+ RwUInt32 offset; /**< Offset of chunk from the start of the file
+ including TOC */
+ _rtTOCGUID guid; /**< GUID */
+};
+
+typedef struct RtTOC RtTOC;
+
+/**
+ * \ingroup rttoc
+ * \struct RtTOC
+ *
+ * Table Of Contents (TOC) structure.
+ */
+struct RtTOC
+{
+ RwInt32 numEntries; /**< Number of entries */
+ RtTOCEntry entry[1]; /**< Entry */
+};
+
+/******************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Create/Destroy */
+extern RtTOC *RtTOCCreate(RwStream *stream);
+extern void RtTOCDestroy(RtTOC *toc);
+
+/* Access */
+extern RwInt32 RtTOCGetNumEntries(const RtTOC *toc);
+extern RtTOCEntry *RtTOCGetEntry(RtTOC *toc, RwInt32 entry);
+
+/* Serialization */
+extern RwUInt32 RtTOCStreamGetSize(const RtTOC *toc);
+extern const RtTOC *RtTOCStreamWrite(RtTOC *toc, RwStream *stream);
+extern RtTOC *RtTOCStreamRead(RwStream *stream);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RTTOC_H */
diff --git a/sdk/rwsdk/include/d3d8/rttoc.rpe b/sdk/rwsdk/include/d3d8/rttoc.rpe
new file mode 100644
index 00000000..706372f2
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rttoc.rpe
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionTOC
+{
+
+
+
+ e_rwdb_CriterionTOCLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionTOC e_rwdb_CriterionTOC;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtvcat.h b/sdk/rwsdk/include/d3d8/rtvcat.h
new file mode 100644
index 00000000..474095e1
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtvcat.h
@@ -0,0 +1,38 @@
+
+/***************************************************************************
+ * *
+ * Module : rtvcat.h *
+ * *
+ * Purpose : Tristripping callback for vertex cache aware strips *
+ * *
+ **************************************************************************/
+
+#ifndef RTVCAT_H
+#define RTVCAT_H
+
+/****************************************************************************
+ Includes
+ */
+
+/*--- Include files ---*/
+#include "rwcore.h"
+
+#include "rtvcat.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern RpMeshHeader *
+RpBuildMeshGenerateCacheAwareTriStrip(RpBuildMesh *buildMesh,
+ void *data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTVCAT_H */
diff --git a/sdk/rwsdk/include/d3d8/rtvcat.rpe b/sdk/rwsdk/include/d3d8/rtvcat.rpe
new file mode 100644
index 00000000..ef5e286e
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtvcat.rpe
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionVextexCacheStrip
+{
+
+
+
+ e_rwdb_CriterionVextexCacheStripLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionVextexCacheStrip e_rwdb_CriterionVextexCacheStrip;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rtworld.h b/sdk/rwsdk/include/d3d8/rtworld.h
new file mode 100644
index 00000000..727d8122
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtworld.h
@@ -0,0 +1,85 @@
+/*
+ * World toolkit.
+ */
+/***************************************************************************
+ * *
+ * Module : rtworld.h *
+ * *
+ * Purpose : World tool helper functions header *
+ * *
+ **************************************************************************/
+
+#ifndef RTWORLD_H
+#define RTWORLD_H
+
+/**
+ * \defgroup rtworld RtWorld
+ * \ingroup basicgeometry
+ *
+ * World Import Toolkit for RenderWare.
+ */
+
+/****************************************************************************
+ Includes
+ */
+
+#include "rpworld.h"
+
+#include "rtworld.rpe" /* automatically generated header file */
+
+/****************************************************************************
+ Defines
+ */
+
+/* RWPUBLIC */
+/****************************************************************************
+ Global Types
+ */
+
+/* RWPUBLICEND */
+
+/****************************************************************************
+ Exported globals
+ */
+
+/* RWPUBLIC */
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Get the number of various things in the world */
+extern RwInt32 RtWorldGetNumWorldSectors(RpWorld *world);
+extern RwInt32 RtWorldGetNumVertices(RpWorld *world);
+extern RwInt32 RtWorldGetNumPolygons(RpWorld *world);
+
+/* Find things out about materials in the world */
+extern RwInt32 RtWorldFindMaterialNum(RpWorld *world, RpMaterial *material);
+extern RpMaterial *RtWorldFindMaterialWithTextureName(RpWorld *world, RwChar *name);
+
+/* Optimisation functions in optimise.c */
+extern RpClump *RtClumpOptimize(RpClump *clump, RwReal dist);
+extern RpAtomic *RtAtomicOptimize(RpAtomic *atomic, RwReal dist);
+
+/*
+ * This function has been removed, however it still exists as a stealth
+ * function, _rtGeometryOptimize.
+ */
+#define RtGeometryOptimize(geometry, dist) (geometry)
+
+extern RpGeometry *_rtGeometryOptimize(RpGeometry *geometry, RwReal dist);
+
+/* Import utility functions from imputil.c */
+extern RpGeometry *RtGeometryCalculateVertexNormals(RpGeometry *geometry);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* RWPUBLICEND */
+
+#endif /* RWTLWRLD_H */
diff --git a/sdk/rwsdk/include/d3d8/rtworld.rpe b/sdk/rwsdk/include/d3d8/rtworld.rpe
new file mode 100644
index 00000000..83449720
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rtworld.rpe
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum e_rwdb_CriterionTlWorld
+{
+
+
+
+ e_rwdb_CriterionTlWorldLAST = RWFORCEENUMSIZEINT
+};
+
+typedef enum e_rwdb_CriterionTlWorld e_rwdb_CriterionTlWorld;
+
+
diff --git a/sdk/rwsdk/include/d3d8/rwcore.h b/sdk/rwsdk/include/d3d8/rwcore.h
new file mode 100644
index 00000000..583de35f
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rwcore.h
@@ -0,0 +1,4428 @@
+/******************************************/
+/* */
+/* 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: <C:/daily/rwsdk/include/d3d8/rwcore.h>
+ * Automatically Generated on: Thu Jan 23 11:06:24 2003
+ *
+ ************************************************************************/
+
+#ifndef RWCORE_H
+#define RWCORE_H
+
+/*--- System Header Files ---*/
+#include <rwplcore.h>
+
+
+/*--- 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;
+
+#if (!defined(DOXYGEN))
+struct rxHeapFreeBlock
+{
+ RwUInt32 size;
+ rxHeapBlockHeader *ptr;
+};
+
+struct rxHeapSuperBlockDescriptor
+{
+ void *start;
+ RwUInt32 size;
+ rxHeapSuperBlockDescriptor *next;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/**
+ * \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. */
+};
+
+#if (!defined(DOXYGEN))
+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 */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/* 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, /**<The cluster is required but any data within it is
+ * not wanted and will be overwritten */
+ rxCLREQ_REQUIRED = 1, /**<The cluster is required and it must contain
+ * valid data */
+ rxCLREQ_OPTIONAL = 2, /**<The cluster will be used if it is present and
+ * contains valid data, otherwise the node will
+ * make do without it. */
+ rxCLUSTERVALIDITYREQFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+
+/**
+ * \ingroup rwcoregeneric
+ * \ref RxClusterValid
+ * Flags specifying the state requirements for
+ * a \ref RxCluster on exit from a node */
+enum RxClusterValid
+{
+ rxCLVALID_NOCHANGE = 0, /**<The cluster and its data will not change in
+ * validity on passing through this node */
+ rxCLVALID_VALID = 1, /**<The cluster and its data will be valid on
+ * exit from this node */
+ rxCLVALID_INVALID = 2, /**<The cluster's data will be invalid on
+ * exit from this node */
+ rxCLUSTERVALIDFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+/****************************************************************************
+ Global Types
+ */
+
+typedef struct RxClusterDefinition RxClusterDefinition;
+
+typedef struct rxReq rxReq;
+
+typedef enum RxClusterValidityReq RxClusterValidityReq;
+typedef enum RxClusterValid RxClusterValid;
+typedef struct RxOutputSpec RxOutputSpec;
+typedef struct RxClusterRef RxClusterRef;
+typedef struct RxIoSpec RxIoSpec;
+
+typedef struct RxNodeMethods RxNodeMethods;
+typedef struct RxNodeDefinition RxNodeDefinition;
+
+typedef struct RxCluster RxCluster;
+typedef struct RxPipelineCluster RxPipelineCluster;
+typedef struct RxPacket RxPacket;
+typedef struct RxPipelineNode RxPipelineNode;
+typedef struct RxPipelineNodeTopSortData RxPipelineNodeTopSortData;
+typedef struct RxPipelineNode RxPipelineNodeInstance;
+typedef struct RxPipelineNodeParam RxPipelineNodeParam;
+typedef struct RxExecutionContext RxExecutionContext;
+typedef struct RxPipelineRequiresCluster RxPipelineRequiresCluster;
+typedef struct RxPipeline RxPipeline;
+
+/***************************************************************************
+ *
+ * C L U S T E R D E F I N I T I O N
+ *
+ ***************************************************************************/
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxClusterDefinition
+ * Structure describing a cluster */
+struct RxClusterDefinition
+{
+ RwChar *name; /**< Name */
+ RwUInt32 defaultStride; /**< Default stride */
+ RwUInt32 defaultAttributes; /**< Default attributes */
+ const RwChar *attributeSet; /**< Attribute set */
+};
+
+
+/***************************************************************************
+ *
+ * N O D E D E F I N I T I O N S T R U C T S
+ *
+ ***************************************************************************/
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxOutputSpec
+ * Structure describing an output specification of a node */
+struct RxOutputSpec
+{
+ RwChar *name; /**< Name */
+ RxClusterValid *outputClusters; /**< States of clusters of interest on output */
+ RxClusterValid allOtherClusters; /**< States of clusters not of interest on output */
+};
+
+
+
+/**
+ * \ingroup rwcoregeneric
+ * \ref RxClusterForcePresent
+ * Flags specifying whether an \ref RxCluster
+ * should be forced to be present in an \ref RxPipelineNode */
+enum RxClusterForcePresent
+{
+ rxCLALLOWABSENT = FALSE, /**<The cluster is allowed to be absent if no prior
+ * nodes create it and no subsequent nodes require it */
+ rxCLFORCEPRESENT = TRUE, /**<The cluster must be present even if no prior
+ * nodes create it and no subsequent nodes require it */
+
+ rxCLUSTERFORCEPRESENTFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RxClusterForcePresent RxClusterForcePresent;
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxClusterRef
+ * Structure describing a cluster reference */
+struct RxClusterRef
+{
+ RxClusterDefinition *clusterDef; /**< Cluster definition */
+ RxClusterForcePresent forcePresent; /**< Specifies whether the cluster should be forced present */
+ RwUInt32 reserved; /**< Omit or initialize to zero */
+};
+
+#define rxCLRESERVED ((RwUInt32)0)
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxIoSpec
+ * Structure describing an input/output specification of a node */
+struct RxIoSpec
+{
+ RwUInt32 numClustersOfInterest;/**< Number of Clusters of interest */
+ RxClusterRef *clustersOfInterest; /**< Clusters of interest array */
+ RxClusterValidityReq *inputRequirements; /**< Requirements of the clusters of interest on input to the node */
+ RwUInt32 numOutputs; /**< Number of outputs from the node */
+ RxOutputSpec *outputs; /**< Output specification array */
+};
+
+/**
+ * \ingroup rwcoregeneric
+ * \ref RxNodeBodyFn is the callback to be
+ * called during pipeline execution -- and, typically, process
+ * \ref RxPacket's -- for the owning pipeline node.
+ *
+ * \param self A pointer to the pipeline node being executed
+ * \param params A pointer to a parameter structure
+ *
+ * \return TRUE on success, FALSE otherwise.
+ *
+ * \see RxNodeMethods
+ */
+typedef RwBool (*RxNodeBodyFn) (RxPipelineNode * self,
+ const RxPipelineNodeParam *params);
+
+/**
+ * \ingroup rwcoregeneric
+ * \ref RxNodeInitFn
+ * is the callback to be called,
+ * for the owning node definition, the first time an \ref RxPipeline
+ * referencing that node definition is unlocked.
+ *
+ * \param self A pointer to the node definition
+ *
+ * \return TRUE on success, FALSE otherwise.
+ *
+ * \see RxNodeMethods
+ */
+typedef RwBool (*RxNodeInitFn) (RxNodeDefinition * self);
+
+/**
+ * \ingroup rwcoregeneric
+ * \ref RxNodeTermFn
+ * is the callback to be called,
+ * for the owning node definition, the last time an \ref RxPipeline
+ * referencing that node definition is destroyed or locked.
+ *
+ * \param self A pointer to the node definition
+ *
+ * \return None
+ *
+ * \see RxNodeMethods
+ */
+typedef void (*RxNodeTermFn) (RxNodeDefinition * self);
+
+/**
+ * \ingroup rwcoregeneric
+ * \ref RxPipelineNodeInitFn
+ * is the callback to be called, for the owning pipeline node, whenever a
+ * \ref RxPipeline containing that that pipeline node is unlocked.
+ *
+ * \param self A pointer to the pipeline node
+ *
+ * \return TRUE on success, FALSE otherwise.
+ *
+ * \see RxNodeMethods
+ */
+typedef RwBool (*RxPipelineNodeInitFn) (RxPipelineNode * self);
+
+/**
+ * \ingroup rwcoregeneric
+ * \ref RxPipelineNodeTermFn
+ * is the callback to be called, for the owning pipeline node, whenever a
+ * \ref RxPipeline containing that that pipeline node is locked or
+ * destroyed.
+ *
+ * \param self A pointer to the pipeline node
+ *
+ * \return None
+ *
+ * \see RxNodeMethods
+ */
+typedef void (*RxPipelineNodeTermFn) (RxPipelineNode * self);
+
+/**
+ * \ingroup rwcoregeneric
+ * \ref RxPipelineNodeConfigFn
+ * is the callback to be called, for the owning pipeline node, whenever a
+ * \ref RxPipeline containing that that pipeline node is unlocked,
+ * *after* all \ref RxPipelineNodeInitFn's have been called for the
+ * pipeline in question. This func is to be used as described in
+ * RxPipelineNodeSendConfigMsg.
+ *
+ * \param self A pointer to the pipeline node
+ * \param pipeline A pointer to the containing pipeline
+ *
+ * \return TRUE on success, FALSE otherwise.
+ *
+ * \see RxNodeMethods
+ */
+typedef RwBool (*RxPipelineNodeConfigFn) (RxPipelineNode * self,
+ RxPipeline * pipeline);
+
+/**
+ * \ingroup rwcoregeneric
+ * \ref RxConfigMsgHandlerFn
+ * is the callback to be called, for the owning pipeline node, whenever
+ * a message is sent to it by the \ref RxPipelineNodeConfigFn of another
+ * pipeline node in the same pipeline. See \ref RxPipelineNodeSendConfigMsg.
+ *
+ * \param self A pointer to the pipeline node
+ * \param msg Message ID
+ * \param intparam Meaning is message-specific
+ * \param ptrparam Meaning is message-specific
+ *
+ * \return A RwInt32 value, 0: unserviced; -ve: error; +ve: informative success
+ *
+ * \see RxNodeMethods
+ */
+typedef RwUInt32 (*RxConfigMsgHandlerFn) (RxPipelineNode * self,
+ RwUInt32 msg,
+ RwUInt32 intparam,
+ void *ptrparam);
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxNodeMethods
+ * A structure describing a set
+ * of node methods
+ *
+ * \see RxNodeBodyFn
+ * \see RxNodeInitFn
+ * \see RxNodeTermFn
+ * \see RxPipelineNodeInitFn
+ * \see RxPipelineNodeTermFn
+ * \see RxPipelineNodeConfigFn
+ * \see RxConfigMsgHandlerFn
+ */
+struct RxNodeMethods
+{
+ RxNodeBodyFn nodeBody; /**< Node body function */
+ RxNodeInitFn nodeInit; /**< Node initialization function */
+ RxNodeTermFn nodeTerm; /**< Node termination function */
+ RxPipelineNodeInitFn pipelineNodeInit; /**< Pipeline node initialization function */
+ RxPipelineNodeTermFn pipelineNodeTerm; /**< Pipeline node termination function */
+ RxPipelineNodeConfigFn pipelineNodeConfig; /**< Pipleline node configuation function */
+ RxConfigMsgHandlerFn configMsgHandler; /**< Configuaraton message handler function */
+};
+
+/**
+ * \ingroup rwcoregeneric
+ * \ref RxNodeDefEditable
+ * Flags specifying whether an \ref RxNodeDefinition
+ * is editable or not (\ref RxPipelineNodeCloneDefinition,
+ * \ref RxPipelineNodeReplaceCluster and \ref RxPipelineNodeRequestCluster
+ * create editable copies of node definitions as the originals may be
+ * static definitions). */
+enum RxNodeDefEditable
+{
+ /**<This node definition should not be freed */
+ rxNODEDEFCONST = FALSE,
+ /**< This node definition is a temporary,
+ * modified copy of another and can be freed */
+ rxNODEDEFEDITABLE = TRUE,
+ rxNODEDEFEDITABLEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RxNodeDefEditable RxNodeDefEditable;
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxNodeDefinition
+ * A structure describing a node definition */
+struct RxNodeDefinition
+{
+ RwChar *name; /**< Name */
+ RxNodeMethods nodeMethods; /**< Node methods */
+ RxIoSpec io; /**< Input/output specification */
+ RwUInt32 pipelineNodePrivateDataSize; /**< Size in bytes of node's private data */
+ RxNodeDefEditable editable; /**< Flags whether a node is editable */
+ RwInt32 InputPipesCnt; /**< Count of the unlocked pipelines containing this node */
+};
+
+/***************************************************************************
+ *
+ * P I P E L I N E - E X E C U T I O N - T I M E S T R U C T S
+ *
+ ***************************************************************************/
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxPipelineCluster
+ * A structure describing a pipeline cluster;
+ * that is, an \ref RxClusterDefinition in the context of a specific \ref RxPipeline
+ * (in the same way as an \ref RxPipelineNode is an \ref RxNodeDefinition in the
+ * context of a specific \ref RxPipeline). The \ref RxCluster is the structure
+ * representing this and the \ref RxClusterDefinition within \ref RxPacket's at
+ * pipeline-execution-time */
+struct RxPipelineCluster
+{
+ RxClusterDefinition *clusterRef; /**< Cluster refererence */
+ RwUInt32 creationAttributes; /**< Creation Attributes */
+};
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxCluster
+ * A structure describing a cluster; this is
+ * the representative of an \ref RxClusterDefinition and \ref RxPipelineCluster
+ * within \ref RxPacket's at pipeline-execution-time. */
+struct RxCluster
+{
+ RwUInt16 flags; /**< Bitfield of flags e.g. modification permissions */
+ RwUInt16 stride; /**< Stride in bytes of the cluster's data */
+ void *data; /**< The Cluster's data */
+ void *currentData; /**< A 'cursor', referencing the current element in the data */
+ RwUInt32 numAlloced; /**< Allocated count */
+ RwUInt32 numUsed; /**< Used count */
+ RxPipelineCluster *clusterRef; /**< Valid after a cluster has been locked for writing,
+ * otherwise NULL. Analog of \ref RxPipelineNode and
+ * its 'nodeDef' member. */
+ RwUInt32 attributes; /**< Attributes */
+#ifdef PADCLUSTERS
+ RwUInt32 pad[1]; /**< Alignment padding */
+#endif
+};
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxPacket
+ * A structure describing a packet header */
+struct RxPacket
+{
+ RwUInt16 flags; /**< Flags to guide pipeline execution */
+ RwUInt16 numClusters; /**< Maximum number of clusters simultanesouly present in the current pipeline */
+ RxPipeline *pipeline; /**< The pipeline in which this packet is embedded (the current pipeline) */
+ RwUInt32 *inputToClusterSlot; /**< LUT to locate clusters of interest in the packet */
+ RwUInt32 *slotsContinue; /**< Bitfields specifying clusters persisting to output node */
+ RxPipelineCluster **slotClusterRefs; /**< Internal Use */
+#ifdef PADCLUSTERS
+ RwUInt32 pad[3]; /**< Alignment padding */
+#endif
+ RxCluster clusters[1]; /**< Cluster array large enough for widest part of the pipeline */
+};
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxPipelineNode
+ * Structure describing a pipeline Node;
+ * that is an \ref RxNodeDefinition in the context
+ * of a specific \ref RxPipeline.
+ */
+struct RxPipelineNode
+{
+ RxNodeDefinition *nodeDef; /**< Node definition reference */
+ RwUInt32 numOutputs; /**< Output count */
+ RwUInt32 *outputs; /**< Output array, indexing the pipeline's array of pipeline nodes */
+ RxPipelineCluster **slotClusterRefs; /**< For packets passing through this node, SlotClusterRefs[n]
+ * identifies the cluster to be found at index n in the packet's
+ * Clusters[] array. These assignments are determined at pipeline
+ * Unlock() time and are good for the life of the pipeline. */
+ RwUInt32 *slotsContinue; /**< Cluster persistence table for the node's outputs */
+ void *privateData; /**< Pointer to the pipeline Node's private data */
+ RwUInt32 *inputToClusterSlot; /**< LUT to locate clusters of interest in packets passing through this pipeline Node */
+ RxPipelineNodeTopSortData *topSortData; /**< Internal Use */
+ void *initializationData; /**< Used by the pipeline node initialisation
+ * function in setting up the Private data. */
+ RwUInt32 initializationDataSize; /**< Present so that if the node is cloned
+ * we can copy the initialisation data. */
+};
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxPipelineNodeTopSortData
+ * Structure describing data used during topological sorting
+ * during \ref RxLockedPipeUnlock ;
+ * RenderWare users do not need to understand this */
+struct RxPipelineNodeTopSortData
+{
+ RwUInt32 numIns; /**< Input count */
+ RwUInt32 numInsVisited; /**< Count of inputs visited during dependencies
+ * propagation/cluster slot allocation */
+ rxReq *req; /**< Req used in dependencies propagation/cluster
+ * slot allocation */
+};
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxPipelineNodeParam
+ * Structure holding parameters
+ * to pass to node body functions */
+struct RxPipelineNodeParam
+{
+ void *dataParam; /**< The data pointer passed in to \ref RxPipelineExecute */
+ RxHeap *heap; /**< The heap associated with the current pipeline exeuction */
+};
+
+enum rxEmbeddedPacketState
+{
+ rxPKST_PACKETLESS = 0, /* Packet not created */
+ rxPKST_UNUSED = 1, /* Packet created and then destroyed */
+ rxPKST_INUSE = 2, /* Packet created but not yet destroyed and fetched but not yet dispatched */
+ rxPKST_PENDING = 3, /* Packet created but not destroyed and dispatched but not yet fetched */
+ rxEMBEDDEDPACKETSTATEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum rxEmbeddedPacketState rxEmbeddedPacketState;
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxExecutionContext
+ * Structure describing an execution context */
+struct RxExecutionContext
+{
+ RxPipeline *pipeline; /**< Currently executing pipeline */
+ RxPipelineNode *currentNode; /**< Currently executing node */
+ RwInt32 exitCode; /**< Used internally for nodes returning error codes on exit */
+ RwUInt32 pad; /**< Alignment padding */
+ RxPipelineNodeParam params; /**< The parameters passed to node bodies */
+ /*RwUInt32 pad[2];*/
+};
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxPipelineRequiresCluster
+ * Structure describing a pipeline requirement of a cluster */
+struct RxPipelineRequiresCluster
+{
+ RxClusterDefinition *clusterDef; /**< Reference to a Cluster definition */
+ RxClusterValidityReq rqdOrOpt; /**< Cluster validity requirement (rxCLREQ_DONTWANT, rxCLREQ_REQUIRED or rxCLREQ_OPTIONAL) */
+ RwUInt32 slotIndex; /**< Index into the packet's cluster array within this pipeline */
+};
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxPipeline
+ * Structure describing a pipeline */
+struct RxPipeline
+{
+ RwBool locked; /**< Flags whether the pipeline is locked for editing */
+ RwUInt32 numNodes; /**< Node count */
+ RxPipelineNode *nodes; /**< Topologically sorted array of pipeline nodes */
+ RwUInt32 packetNumClusterSlots; /**< Number of slots allocated for clusters */
+ rxEmbeddedPacketState embeddedPacketState; /**< The state of this pipeline's embedded packet */
+ RxPacket *embeddedPacket; /**< This pipeline's embedded packet */
+
+ RwUInt32 numInputRequirements; /**< Input requirements count */
+ RxPipelineRequiresCluster *inputRequirements; /**< Input requirements array */
+
+ void *superBlock; /**< Internally used block of memory */
+ RwUInt32 superBlockSize; /**< Internally used block of memory */
+
+ RwUInt32 entryPoint; /**< The index of the node which is the entry point of this pipeline */
+ RwUInt32 pluginId; /**< If required, the Id of the plugin owning this pipeline, or 0 */
+ RwUInt32 pluginData; /**< Rights callback extra data */
+};
+
+/****************************************************************************
+ * Global Prototypes
+ */
+
+/**
+ * \ingroup rwcoregeneric
+ * \ref RxPipelineNodeOutputCallBack
+ * is the callback function supplied
+ * to \ref RxPipelineNodeForAllConnectedOutputs.
+ *
+ * The callback will be passed a pointer to the \ref RxPipelineNode whose
+ * outputs are being traversed and a pointer to the current output
+ * \ref RxPipelineNode, as well as a pointer to an optional user-defined
+ * data structure (callbackdata). If no such structure was specified, this
+ * will be NULL.
+ *
+ * \param node A pointer to the pipeline node whose outputs
+ * are being traversed
+ * \param outputnode A pointer to the current output
+ * pipeline node
+ * \param callbackdata A pointer to optional user-supplied data
+ *
+ * \return Returns a pointer to the \ref RxPipelineNode whose outputs are being
+ * traversed, or NULL to terminate traversal
+ */
+typedef RxPipelineNode * (*RxPipelineNodeOutputCallBack) (RxPipelineNode * node,
+ RxPipelineNode * outputnode,
+ void *callbackdata);
+
+#ifdef RWDEBUG
+#define RXCHECKFORUSERTRAMPLING(_pipeline) \
+ ( _rwPipelineCheckForTramplingOfNodePrivateSpace(_pipeline) )
+#endif /* RWDEBUG */
+
+#if (!defined(RXCHECKFORUSERTRAMPLING))
+#define RXCHECKFORUSERTRAMPLING(_pipeline) /* No op */
+#endif /* (!defined(RXCHECKFORUSERTRAMPLING)) */
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern void
+RxPipelineSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern RwBool
+_rxPipelineOpen(void);
+
+extern RwBool
+_rxPipelineClose(void);
+
+extern RwBool
+rxPipelinePluginsAttach(void);
+
+extern RxPipeline *
+RxPipelineCreate(void);
+
+
+extern void
+_rxPipelineDestroy(RxPipeline * Pipeline);
+
+#define _RxPipelineDestroy(_ppln) _rxPipelineDestroy(_ppln)
+#define RxPipelineDestroy(_ppln) (_rxPipelineDestroy(_ppln), TRUE)
+
+extern RxHeap *
+RxHeapGetGlobalHeap(void);
+
+extern RxPipeline *
+RxPipelineExecute(RxPipeline * pipeline,
+ void * data,
+ RwBool heapReset);
+
+extern RxPacket *
+RxPacketCreate(RxPipelineNode * node);
+
+extern RxCluster *
+RxClusterSetStride(RxCluster * cluster,
+ RwInt32 stride);
+
+extern RxCluster *
+RxClusterSetExternalData(RxCluster * cluster,
+ void *data,
+ RwInt32 stride,
+ RwInt32 numElements);
+
+extern RxCluster *
+RxClusterSetData(RxCluster * cluster,
+ void *data,
+ RwInt32 stride,
+ RwInt32 numElements);
+
+/* underlying PacketDestroy function */
+extern void
+_rxPacketDestroy(RxPacket * Packet);
+
+/* more convenient parameterization */
+#define RxPacketDestroy(pk, self) \
+ ( _rxPacketDestroy(pk) )
+
+#if (defined(RWDEBUG))
+extern RxPacket *RxPacketFetch(RxPipelineNode * Node);
+extern void RxPacketDispatch(RxPacket * packet,
+ RwUInt32 output,
+ RxPipelineNode * self);
+extern void RxPacketDispatchToPipeline(RxPacket * packet,
+ RxPipeline * dest,
+ RxPipelineNode * self);
+#else /* (defined(RWDEBUG)) */
+#define RxPacketFetch(_self) \
+ rxPacketFetchMacro(_self)
+#define RxPacketDispatch( _packet, _output, _self) \
+ rxPacketDispatchMacro(_packet, _output, _self)
+#define RxPacketDispatchToPipeline( _packet, _pipeline, _self) \
+ rxPacketDispatchToPipelineMacro(_packet, _pipeline, _self)
+#endif /* (defined(RWDEBUG)) */
+
+#define RxClusterInitialiseData(_clstr, _nmlmnts, _strd) \
+ ( RxClusterInitializeData((_clstr), (_nmlmnts), (_strd)) )
+extern RxCluster *
+RxClusterInitializeData(RxCluster *cluster, RwUInt32 numElements, RwUInt16 stride);
+
+extern RxCluster *
+RxClusterResizeData(RxCluster *CurrentCluster, RwUInt32 NumElements);
+
+extern RxCluster *
+RxClusterDestroyData(RxCluster *CurrentCluster);
+
+#if (defined(RWDEBUG))
+
+extern RxCluster *RxClusterLockRead(RxPacket * packet, RwUInt32 clusterIndex);
+
+#else /* !RWDEBUG */
+
+#define RXCLSLOT(PKT, CLIND) \
+ ((PKT)->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
+ * \ref RxNodeOutput
+ * typedef for a reference to an output of a pipeline node */
+typedef RwUInt32 *RxNodeOutput;
+
+/**
+ * \ingroup rwcoregeneric
+ * \ref RxNodeInput
+ * typedef for a reference to the input of a pipeline node */
+typedef RxPipelineNode *RxNodeInput;
+
+/**
+ * \ingroup rwcoregeneric
+ * \ref 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/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 rwraster
+ * \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, /**<Lock for writing */
+ rwRASTERLOCKREAD = 0x02, /**<Lock for reading */
+ rwRASTERLOCKNOFETCH = 0x04, /**<When used in combination with
+ * rwRASTERLOCKWRITE, asks the driver not to
+ * fetch the pixel data. This is only useful
+ * if it is known that ALL the raster data is
+ * going to be overwritten before the raster
+ * is unlocked, i.e. from an
+ * \ref RwRasterSetFromImage call. This flag
+ * is not supported by all drivers. */
+ rwRASTERLOCKRAW = 0x08, /**<When used in combination with
+ rwRASTERLOCKWRITE or rwRASTERLOCKREAD
+ allows access to the raw platform specific
+ pixel format */
+ rwRASTERLOCKMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+#define rwRASTERLOCKREADWRITE (rwRASTERLOCKREAD|rwRASTERLOCKWRITE)
+
+typedef enum RwRasterLockMode RwRasterLockMode;
+
+/**
+ * \ingroup rwraster
+ * \ref RwRasterFlipMode represents
+ * raster flip modes */
+enum RwRasterFlipMode
+{
+ rwRASTERFLIPDONTWAIT = 0, /**<Don't wait for VSync */
+ rwRASTERFLIPWAITVSYNC = 1, /**<Flip on VSync */
+ rwRASTERFLIPMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwRasterFlipMode RwRasterFlipMode;
+
+/**
+ * \ingroup rwraster
+ * RwRasterType
+ * This type represents the options available for creating a new
+ * raster (se API function \ref RwRasterCreate)*/
+enum RwRasterType
+{
+ rwRASTERTYPENORMAL = 0x00, /**<Normal */
+ rwRASTERTYPEZBUFFER = 0x01, /**<Z Buffer */
+ rwRASTERTYPECAMERA = 0x02, /**<Camera */
+ rwRASTERTYPETEXTURE = 0x04, /**<Texture */
+ rwRASTERTYPECAMERATEXTURE = 0x05, /**<Camera texture */
+ rwRASTERTYPEMASK = 0x07, /**<Mask for finding type */
+
+ rwRASTERDONTALLOCATE = 0x80, /**<If set the raster is not allocated */
+ rwRASTERTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwRasterType RwRasterType;
+
+/**
+ * \ingroup rwraster
+ * \ref RwRasterFormat is a set of values and flags which may be combined to
+ * specify a raster format. The format chosen for a particular raster depends
+ * on the hardware device and the raster type specified at creation time
+ * (see API function \ref RwRasterCreate). The format may be retrieved using
+ * API function \ref RwRasterGetFormat.
+ *
+ * The raster format is a packed set of bits which contains the following
+ * four pieces of information (these may be combined with bitwise OR):-
+ *
+ * <ol>
+ * <li> The pixel color format corresponding to one of the following values:-
+ * <ul>
+ * <li> rwRASTERFORMAT1555
+ * <li> rwRASTERFORMAT565
+ * <li> rwRASTERFORMAT4444
+ * <li> rwRASTERFORMATLUM8
+ * <li> rwRASTERFORMAT8888
+ * <li> rwRASTERFORMAT888
+ * <li> rwRASTERFORMAT16
+ * <li> rwRASTERFORMAT24
+ * <li> rwRASTERFORMAT32
+ * <li> rwRASTERFORMAT555
+ * </ul>
+ * This value may be masked out of the raster format using
+ * rwRASTERFORMATPIXELFORMATMASK.
+ * <li> The palette depth if the raster is palettized:-
+ * <ul>
+ * <li> rwRASTERFORMATPAL4
+ * <li> rwRASTERFORMATPAL8
+ * </ul>
+ * In these cases, the color format refers to that of the palette.
+ * <li> Flag rwRASTERFORMATMIPMAP. Set if the raster contains mipmap levels.
+ * <li> Flag rwRASTERFORMATAUTOMIPMAP. Set if the mipmap levels were generated
+ * automatically by RenderWare.
+ * </ol>
+ */
+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, /**<Gray scale */
+ rwRASTERFORMAT8888 = 0x0500, /**<32 bits - 8 bits per component */
+ rwRASTERFORMAT888 = 0x0600, /**<24 bits - 8 bits per component */
+ rwRASTERFORMAT16 = 0x0700, /**<16 bits - undefined: useful for things like Z buffers */
+ rwRASTERFORMAT24 = 0x0800, /**<24 bits - undefined: useful for things like Z buffers */
+ rwRASTERFORMAT32 = 0x0900, /**<32 bits - undefined: useful for things like Z buffers */
+ rwRASTERFORMAT555 = 0x0a00, /**<16 bits - 5 bits red, green and blue */
+
+ rwRASTERFORMATAUTOMIPMAP = 0x1000, /**<RenderWare generated the mip levels */
+
+ rwRASTERFORMATPAL8 = 0x2000, /**<8 bit palettised */
+ rwRASTERFORMATPAL4 = 0x4000, /**<4 bit palettised */
+
+ rwRASTERFORMATMIPMAP = 0x8000, /**<Mip mapping on */
+
+ rwRASTERFORMATPIXELFORMATMASK = 0x0f00, /**<The pixel color format
+ * (excluding palettised bits) */
+ rwRASTERFORMATMASK = 0xff00 /**<The whole format */ ,
+ rwRASTERFORMATFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwRasterFormat RwRasterFormat;
+
+enum RwRasterPrivateFlag
+{
+ rwRASTERGAMMACORRECTED = 0x01,
+ rwRASTERPIXELLOCKEDREAD = 0x02, /* pixels are locked for reading */
+ rwRASTERPIXELLOCKEDWRITE = 0x04, /* pixels are locked for writing */
+ rwRASTERPALETTELOCKEDREAD = 0x08, /* palette is locked for reading */
+ rwRASTERPALETTELOCKEDWRITE = 0x10, /* palette is locked for writing */
+ rwRASTERPIXELLOCKEDRAW = 0x20, /* the pixels are in platform specific
+ format, used in combination with
+ rwRASTERPIXELLOCKEDREAD &
+ rwRASTERPIXELLOCKEDWRITE */
+ rwRASTERPRIVATEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwRasterPrivateFlag RwRasterPrivateFlag;
+
+#define rwRASTERPIXELLOCKED (rwRASTERPIXELLOCKEDREAD | rwRASTERPIXELLOCKEDWRITE)
+#define rwRASTERPALETTELOCKED (rwRASTERPALETTELOCKEDREAD | rwRASTERPALETTELOCKEDWRITE)
+#define rwRASTERLOCKED (rwRASTERPIXELLOCKED|rwRASTERPALETTELOCKED)
+
+/* How big is my stack!!! */
+#define rwRASTERCONTEXTSTACKSIZE 10
+
+/****************************************************************************
+ Global Types
+ */
+
+/**
+ * \ingroup rwraster
+ * \struct RwRaster
+ * Raster containing device-dependent pixels.
+ * This should be considered an opaque type.
+ * Use the RwRaster API functions to access.
+ */
+typedef struct RwRaster RwRaster;
+
+#if (!defined(DOXYGEN))
+struct RwRaster
+{
+ RwRaster *parent; /* Top level raster if a sub raster */
+ RwUInt8 *cpPixels; /* Pixel pointer when locked */
+ RwUInt8 *palette; /* Raster palette */
+ RwInt32 width, height, depth; /* Dimensions of raster */
+ RwInt32 stride; /* Lines bytes of raster */
+ RwInt16 nOffsetX, nOffsetY; /* Sub raster offset */
+ RwUInt8 cType; /* Type of raster */
+ RwUInt8 cFlags; /* Raster flags */
+ RwUInt8 privateFlags; /* Raster private flags */
+ RwUInt8 cFormat; /* Raster format */
+
+ RwUInt8 *originalPixels;
+ RwInt32 originalWidth;
+ RwInt32 originalHeight;
+ RwInt32 originalStride;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+
+/****************************************************************************
+ <macro/inline functionality
+ */
+
+#define RwRasterGetWidthMacro(_raster) \
+ ((_raster)->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 void RwRasterSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+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)) */
+
+
+#if (defined(RWDEBUG))
+#if (defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC))
+#define _CRTDBG_MAP_ALLOC
+#endif /* defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) */
+#include <crtdbg.h>
+#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
+
+/****************************************************************************
+ Global Types
+ */
+
+/* We use RwD3D8Vertex to drive the hardware in 2D mode */
+
+/*
+ * D3D8 vertex structure definition for 2D geometry
+ */
+#if !defined(RWADOXYGENEXTERNAL)
+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 */
+};
+#endif /* !defined(RWADOXYGENEXTERNAL) */
+
+/* Define types used */
+
+#if !defined(RWADOXYGENEXTERNAL)
+/**
+ * \ingroup rwcoredriverd3d8
+ * \ref RwIm2DVertex
+ * Typedef for a RenderWare Graphics Immediate Mode 2D Vertex
+ */
+typedef RwD3D8Vertex RwIm2DVertex;
+#endif /* !defined(RWADOXYGENEXTERNAL) */
+
+#if !defined(RWADOXYGENEXTERNAL)
+/**
+ * \ingroup rwcoredriverd3d8
+ * \ref RxVertexIndex
+ *
+ * Typedef for a RenderWare Graphics PowerPipe Immediate
+ * Mode Vertex
+ */
+typedef RwUInt16 RxVertexIndex;
+#endif /* !defined(RWADOXYGENEXTERNAL) */
+
+#if !defined(RWADOXYGENEXTERNAL)
+
+/**
+ * \ingroup rwcoredriverd3d8
+ * \ref RwImVertexIndex
+ * Typedef for a RenderWare Graphics Immediate Mode Vertex.
+ */
+typedef RxVertexIndex RwImVertexIndex;
+#endif /* !defined(RWADOXYGENEXTERNAL) */
+
+#if !defined(RWADOXYGENEXTERNAL)
+
+/**
+ * \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 */
+ RwUInt32 numVBSwitches; /**< Number of Vertex Buffer switches */
+}
+RwD3D8Metrics;
+#endif /* !defined(RWADOXYGENEXTERNAL) */
+
+#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 */
+
+/*
+ * Typedef for an RxObjSpace3DVertex.
+ */
+typedef struct RxObjSpace3DVertex RxObjSpace3DVertex;
+
+/**
+ * \ingroup cored3d8
+ * \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 cored3d8
+ * \ref RxObjSpace3DLitVertex
+ * Typedef for an RxObjSpace3DLitVertex.
+ */
+typedef RxObjSpace3DVertex RxObjSpace3DLitVertex;
+
+/**
+ * \ingroup cored3d8
+ * \ref RwIm3DVertex
+ * Typedef for an RwIm3DVertex.
+ */
+typedef RxObjSpace3DLitVertex RwIm3DVertex;
+
+/* LEGACY-SUPPORT macro */
+/**
+ * \ingroup cored3d8
+ * \ref RxScrSpace2DVertex
+ * Typedef for an RxScrSpace2DVertex structure
+ */
+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))
+
+
+/*--- 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, /**<Perspective texturing is to be enabled */
+ rxRENDERSTATEFLAG_ZTESTENABLE = 0x00000002, /**<Z-Buffer testing is to be performed */
+ rxRENDERSTATEFLAG_ZWRITEENABLE = 0x00000004, /**<Z-Buffer writing is to be enabled */
+ rxRENDERSTATEFLAG_VERTEXALPHAENABLE = 0x00000008, /**<Vertex alpha is to be enabled */
+ rxRENDERSTATEFLAG_FOGENABLE = 0x00000010, /**<Fog is to be enabled */
+ rxRENDERSTATEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RxRenderStateFlag RxRenderStateFlag;
+
+typedef struct RxRenderStateVector RxRenderStateVector;
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxRenderStateVector
+ * Structure describing a render-state vector,
+ * used by the RxClRenderState cluster */
+struct RxRenderStateVector
+{
+ RwUInt32 Flags; /**< A load of the boolean renderstate options */
+ RwShadeMode ShadeMode; /**< Flat or Gouraud currently */
+ RwBlendFunction SrcBlend; /**< Src alpha, 1-src alpha, etc */
+ RwBlendFunction DestBlend; /**< Dest alpha, 1-dest alpha, etc */
+ RwRaster *TextureRaster; /**< texture raster */
+ RwTextureAddressMode AddressModeU; /**< U addressing mode - WRAP, MIRROR, CLAMP, BORDER */
+ RwTextureAddressMode AddressModeV; /**< V addressing mode - WRAP, MIRROR, CLAMP, BORDER */
+ RwTextureFilterMode FilterMode; /**< filtering mode - combos of NEAREST LINEAR MIP */
+ RwRGBA BorderColor; /**< Border color for texturing address mode border */
+ RwFogType FogType; /**< Select the type of fogging to use */
+ RwRGBA FogColor; /**< Color used for fogging */
+};
+
+#if (!defined(RxRenderStateVectorAssign))
+#define RxRenderStateVectorAssign(_target, _source) \
+ ( *(_target) = *(_source) )
+#endif /* (!defined(RxRenderStateVectorAssign)) */
+
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RxRenderStateVector *RxRenderStateVectorSetDefaultRenderStateVector(RxRenderStateVector *rsvp);
+extern const RxRenderStateVector *RxRenderStateVectorGetDefaultRenderStateVector(void);
+extern RxRenderStateVector *RxRenderStateVectorCreate(RwBool current);
+extern void RxRenderStateVectorDestroy(RxRenderStateVector *rsvp);
+extern RxRenderStateVector *RxRenderStateVectorLoadDriverState(RxRenderStateVector *rsvp);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/baimage.h ---*/
+
+/****************************************************************************
+ Defines
+ */
+
+/* If this bit is set then the image has been allocated by the user */
+
+enum RwImageFlag
+{
+ rwNAIMAGEFLAG = 0x00,
+ rwIMAGEALLOCATED = 0x1,
+ rwIMAGEGAMMACORRECTED = 0x2,
+ rwIMAGEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwImageFlag RwImageFlag;
+
+/****************************************************************************
+ Global Types
+ */
+
+/**
+ * \ingroup rwimage
+ * \struct RwImage
+ * Image containing device-independent pixels.
+ * This should be considered an opaque type.
+ * Use the RwImage API functions to access.
+ */
+typedef struct RwImage RwImage;
+
+#if (!defined(DOXYGEN))
+struct RwImage
+{
+ RwInt32 flags;
+
+ RwInt32 width; /* Device may have different ideas */
+ RwInt32 height; /* internally !! */
+
+ RwInt32 depth; /* Of referenced image */
+ RwInt32 stride;
+
+ RwUInt8 *cpPixels;
+ RwRGBA *palette;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/**
+ * \ingroup rwimage
+ * \ref RwImageCallBackRead
+ * is the function registered with \ref RwImageRegisterImageFormat that is used,
+ * for example by \ref RwImageRead and \ref RwImageReadMaskedImage,
+ * to read images of a specific format from a disk file.
+ *
+ * \param imageName Pointer to a string containing the file name of the image.
+ *
+ * \return Returns a pointer to the image read.
+ *
+ * \see RwImageRegisterImageFormat
+ *
+ */
+typedef RwImage *(*RwImageCallBackRead)(const RwChar * imageName);
+
+/**
+ * \ingroup rwimage
+ * \ref RwImageCallBackWrite
+ * is the function registered with \ref RwImageRegisterImageFormat that is used,
+ * for example by \ref RwImageWrite,
+ * to write images of a specific format to a disk file.
+ *
+ * \param image Pointer to the image.
+ *
+ * \param imageName Pointer to a string containing the file name
+ * of the image.
+ *
+ *
+ * \return Pointer to the written image.
+ *
+ * \see RwImageRegisterImageFormat
+ *
+ */
+typedef RwImage *(*RwImageCallBackWrite)(RwImage *image, const RwChar *imageName);
+
+
+/****************************************************************************
+ <macro/inline functionality
+ */
+
+#define RwImageSetStrideMacro(_image, _stride) \
+ (((_image)->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 void RwImageSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern void RwImageFormatSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+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);
+ /* Fast image path change */
+extern void _rwImageSwapPath(RwChar **path, RwInt32 *size);
+
+ /* 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 rwtexdict
+ * \struct 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 rwtexture
+ * \struct 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 rwtexture
+ * \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 rwtexture
+ * \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 rwtexdict
+ * \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 rwtexture
+ * \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 rwtexture
+ * \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);
+
+/****************************************************************************
+ <macro/inline functionality
+ */
+
+#define RwTextureGetRasterMacro(_tex) \
+ ((_tex)->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 void RwTexDictionarySetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern RwTexDictionary *RwTexDictionaryCreate(void);
+extern RwBool RwTexDictionaryDestroy(RwTexDictionary * dict);
+
+ /* Textures */
+void RwTextureSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+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, /**<The vertex is outside the low X clip-plane */
+ rwXHICLIP = 0x02, /**<The vertex is outside the high X clip-plane */
+ rwXCLIP = 0x03, /**<The vertex is outside an X clip-plane */
+
+ rwYLOCLIP = 0x04, /**<The vertex is outside the low Y clip-plane */
+ rwYHICLIP = 0x08, /**<The vertex is outside the high Z clip-plane */
+ rwYCLIP = 0x0C, /**<The vertex is outside a Y clip-plane */
+
+ rwZLOCLIP = 0x10, /**<The vertex is outside the low Z clip-plane */
+ rwZHICLIP = 0x20, /**<The vertex is outside the high Z clip-plane */
+ rwZCLIP = 0x30, /**<The vertex is outside a Z clip-plane */
+
+ rwCLIPMASK = 0x3F, /**<Mask covering all used bits in the clip flags
+ * in case a plugin wants free ones to use (e.g RpGloss) */
+
+ rwCLIPFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+/*
+ * Typedef for RwClipFlag enumeration specifying the clipping status of a vertex
+ */
+typedef enum RwClipFlag RwClipFlag;
+
+
+
+typedef struct RxCamSpace3DVertex RxCamSpace3DVertex;
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxCamSpace3DVertex
+ * Structure describing a camera-space 3D vertex.
+ */
+struct RxCamSpace3DVertex
+{
+ /* Position in sheared camera-space (pre-projection) */
+ RwV3d cameraVertex; /**< \ref RwV3d camera-space position of the vertex */
+ /* Clip flags on this vertex */
+ RwUInt8 clipFlags; /**< Clip flags for the vertex generated during transformation into camera-space, see \ref RwClipFlag */
+ RwUInt8 pad[3]; /**< Alignment padding */
+ /* Lit color */
+ RwRGBAReal col; /**< Accumulated \ref RwReal light values (initialized to zero or prelight colors) */
+ /* Only used by the clipper */
+ RwReal u; /**< Texture U coordinate */
+ RwReal v; /**< Texture V coordinate */
+};
+
+/* Supports pipeline1 apps: */
+/**
+ * \ingroup rwcoregeneric
+ * \ref RwCameraVertex
+ * typedef for a structure describing a camera-space 3D vertex.
+ */
+typedef RxCamSpace3DVertex RwCameraVertex;
+
+/* (used during lighting) Doesn't use alpha yet, but it will */
+#define RxCamSpace3DVertexSetRGBA(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
+
+#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, /**<This geometry's meshes can be rendered as tri-strips */
+ rxGEOMETRY_POSITIONS = 0x02, /**<This geometry has positions */
+ rxGEOMETRY_TEXTURED = 0x04, /**<This geometry has textures applied */
+ rxGEOMETRY_PRELIT = 0x08, /**<This geometry has luminance values */
+ rxGEOMETRY_NORMALS = 0x10, /**<This geometry has normals */
+ rxGEOMETRY_LIGHT = 0x20, /**<This geometry will be lit */
+ rxGEOMETRY_MODULATE = 0x40, /**<This geometry will modulate the material color with the vertex colors (prelit + lit) */
+ rxGEOMETRY_TEXTURED2 = 0x80, /**<This geometry has 2 set of texture coordinates */
+
+ rxGEOMETRY_COLORED = 0x100, /**<This mesh specifies per-vertex colors. NB: ONLY USED IN IM3D */
+
+ rxGEOMETRYFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+/*
+ * Typedef for RxGeometryFlag enumeration describing geometry properties
+ */
+typedef enum RxGeometryFlag RxGeometryFlag;
+
+typedef struct RxMeshStateVector RxMeshStateVector;
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxMeshStateVector
+ * Structure describing a mesh-state vector,
+ * used by the RxClMeshState cluster
+ */
+struct RxMeshStateVector
+{
+ RwInt32 Flags; /**< \ref RxGeometryFlag Flags from the source geometry */
+ void *SourceObject; /**< A void pointer. In immediate mode it points to an
+ * internal structure and in atomic/world-sector object
+ * or material pipelines it points to an \ref RpMaterial. */
+ RwMatrix Obj2World; /**< \ref RwMatrix to transform from object-space to world-space */
+ RwMatrix Obj2Cam; /**< \ref RwMatrix to transform from object-space to camera-space */
+ RwSurfaceProperties SurfaceProperties; /**< \ref RwSurfaceProperties */
+ /* We can't necessarily reference an RpMaterial in here (i.e with Im3D),
+ * because RpMaterials are defined in RpWorld not RwCore */
+ RwTexture *Texture; /**< A pointer to a \ref RwTexture */
+ RwRGBA MatCol; /**< \ref RwRGBA material color */
+ RxPipeline *Pipeline; /**< A pointer to the material pipeline where appropriate */
+ /* rwPRIMTYPETRILIST/TRIFAN/TRISTRIP/LINELIST/POLYLINE */
+ RwPrimitiveType PrimType; /**< \ref RwPrimitiveType primitive type */
+ /* Interpretation based on PrimType */
+ RwUInt32 NumElements; /**< \ref RwUInt32 number of elements (triangles, lines...) */
+ RwUInt32 NumVertices; /**< \ref RwUInt32 number of vertices */
+ RwInt32 ClipFlagsOr; /**< Boolean OR of the \ref RwClipFlag clip flags of all vertices in the mesh */
+ RwInt32 ClipFlagsAnd; /**< Boolean AND of the \ref RwClipFlag clip flags of all vertices in the mesh */
+ void *SourceMesh; /**< A void pointer to the source \ref RpMesh */
+ void *DataObject; /**< Mirrors the void data pointer of \ref RxPipelineExecute */
+};
+
+/* RxScatter.csl */
+typedef struct RxScatter RxScatter;
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxScatter
+ * Structure used by the RxClScatter cluster
+ */
+struct RxScatter
+{
+ RxPipeline *pipeline; /**< \ref RxPipeline pointer, causes Scatter.csl
+ * to spit the packet out to the specified pipeline */
+ RxPipelineNode *node; /**< \ref RxPipelineNode pointer, causes Scatter.csl
+ * to send the packet to the specified PipelineNode
+ * (as long as it is actually one of its outputs!) */
+};
+
+/* RxInterpolants.csl */
+typedef struct RxInterp RxInterp;
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxInterp
+ * Structure used by the RxClInterp cluster
+ */
+struct RxInterp
+{
+ RxVertexIndex originalVert; /**< \ref RxVertexIndex index to the new vertex generated on the clipped edge */
+ RxVertexIndex parentVert1; /**< \ref RxVertexIndex index to the first vertex of the clipped edge */
+ RxVertexIndex parentVert2; /**< \ref RxVertexIndex index to the second vertex of the clipped edge */
+ RwReal interp; /**< \ref RwReal interpolant along the clipped edge */
+};
+
+/* RxUVs.csl */
+typedef struct RxUV RxUV;
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxUV
+ * Structure used by the RxClUV cluster
+ */
+struct RxUV
+{
+ RwReal u; /**< \ref RwReal U texture coordinate */
+ RwReal v; /**< \ref RwReal V texture coordinate */
+};
+
+/* RxTriPlanes.csl */
+typedef struct RxTriPlane RxTriPlane;
+
+/**
+ * \ingroup rwcoregeneric
+ * \struct RxTriPlane
+ * for the packed plane structure used in RpWorlds and by the RxClTriPlane cluster
+ * NOTE: this is currently not used in any nodes that ship with the SDK
+ */
+struct RxTriPlane
+{
+ /* Packed plane format used in RpWorlds */
+ RwUInt32 N; /**< \ref RwUInt32 Packed normal */
+ RwReal w; /**< \ref RwReal distance from origin */
+};
+
+/* RxVSteps.csl */
+
+#if (defined(_MSC_VER))
+# if (_MSC_VER>=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
+ * \ref 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 rwim3d
+ * 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, /**<Texture coordinates in source vertices should be used */
+ rwIM3D_ALLOPAQUE = 2, /**<All source vertices are opaque (alpha is 255) */
+ rwIM3D_NOCLIP = 4, /**<No clipping should be performed on the geometry (the
+ * app may know it is all onscreen or within the guard band clipping
+ * region for the current hardware, so clipping can be skipped) */
+ rwIM3D_VERTEXXYZ = 8, /**<Vertex positions */
+ rwIM3D_VERTEXRGBA = 16, /**<Vertex color */
+
+ rwIM3DTRANSFORMFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwIm3DTransformFlags RwIm3DTransformFlags;
+
+
+
+typedef struct rwIm3DPool rwIm3DPool;
+typedef struct rwImmediGlobals rwImmediGlobals;
+typedef struct rwIm3DRenderPipelines rwIm3DRenderPipelines;
+typedef struct _rwIm3DPoolStash _rwIm3DPoolStash;
+
+#if (0 && defined(SKY2))
+typedef struct rwIm3DVertexCache RwIm3DVertexCache;
+#endif /* (0&& defined(SKY2)) */
+
+/* complete information to reconstruct post-transform Im3D "mesh" packet */
+
+#if (!defined(DOXYGEN))
+struct _rwIm3DPoolStash
+{
+ RwUInt32 flags; /* rwIM3D_VERTEXUV, rwIM3D_ALLOPAQUE, rwIM3D_NOCLIP etc */
+ RwMatrix *ltm; /* world-space frame of the vertices, if they have one */
+ RwUInt32 numVerts;
+ RxObjSpace3DVertex *objVerts;
+ RxCamSpace3DVertex *camVerts;
+ RxScrSpace2DVertex *devVerts;
+ RxMeshStateVector *meshState;
+ RxRenderStateVector *renderState;
+ RxPipeline *pipeline;
+ RwPrimitiveType primType;
+ RxVertexIndex *indices;
+ RwUInt32 numIndices;
+};
+
+/* Used as a cache of transformed vertices */
+struct rwIm3DPool
+{
+ RwUInt16 numElements; /* could become RwUInt32 nowadays */
+ RwUInt16 pad; /* alignment padding */
+ void *elements; /* the original array of verts (or whatever...) - referenced not copied */
+ RwInt32 stride; /* the stride of the element */
+ _rwIm3DPoolStash stash;
+};
+
+struct rwIm3DRenderPipelines
+{
+ /* One Im3D render pipeline pointer per rwPRIMTYPE
+ * (several pointers may point to the same pipeline though) */
+ RxPipeline *triList;
+ RxPipeline *triFan;
+ RxPipeline *triStrip;
+ RxPipeline *lineList;
+ RxPipeline *polyLine;
+ RxPipeline *pointList;
+};
+
+struct rwImmediGlobals
+{
+ RxPipeline *im3DTransformPipeline;
+ rwIm3DRenderPipelines im3DRenderPipelines;
+
+ /* Platforms that have their own non-generic pipelines
+ * (OPENGL, D3D8, SKY2, KAMUI2, DOLPHIN) put them here: */
+ RxPipeline *platformIm3DTransformPipeline;
+ rwIm3DRenderPipelines platformIm3DRenderPipelines;
+
+#if (defined(SKY2_DRVMODEL_H))
+ /* The triangle PS2All render pipe automatically
+ * calls this PS2AllMat pipeline: */
+ RxPipeline *ps2AllMatIm3DTrianglePipeline;
+ /* The line PS2All render pipe automatically
+ * calls this PS2AllMat pipeline: */
+ RxPipeline *ps2AllMatIm3DLinePipeline;
+#endif /* (defined(SKY2_DRVMODEL_H)) */
+
+ rwIm3DPool curPool; /* The current cache of transformed vertices */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern rwIm3DPool *_rwIm3DGetPool( void );
+
+extern void *RwIm3DTransform(RwIm3DVertex *pVerts, RwUInt32 numVerts,
+ RwMatrix *ltm, RwUInt32 flags);
+extern RwBool RwIm3DEnd(void);
+
+extern RwBool RwIm3DRenderLine(RwInt32 vert1, RwInt32 vert2);
+extern RwBool RwIm3DRenderTriangle(RwInt32 vert1, RwInt32 vert2,
+ RwInt32 vert3);
+extern RwBool RwIm3DRenderIndexedPrimitive(RwPrimitiveType primType,
+ RwImVertexIndex *indices,
+ RwInt32 numIndices);
+extern RwBool RwIm3DRenderPrimitive(RwPrimitiveType primType);
+
+extern RxPipeline *RwIm3DGetTransformPipeline(void);
+extern RxPipeline *RwIm3DGetRenderPipeline( RwPrimitiveType primType);
+extern RxPipeline *RwIm3DSetTransformPipeline(RxPipeline *pipeline);
+extern RxPipeline *RwIm3DSetRenderPipeline( RxPipeline *pipeline,
+ RwPrimitiveType primType);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/d3d8/im3dpipe.h ---*/
+
+/*--- Automatically derived from: C:/daily/rwsdk/driver/d3d8/d3d8dxttex.h ---*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwTexture *RwD3D8DDSTextureRead(const RwChar *name, const RwChar *maskname);
+
+extern RwBool RwD3D8RasterIsCompressed(const RwRaster *raster);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/*--- Automatically derived from: C:/daily/rwsdk/driver/d3d8/drvfns.h ---*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/****************************************************************************
+ Function prototypes
+ */
+
+/*******/
+/* API */
+/*******/
+
+/* Reports on whether D3D8 can render S3TC textures */
+extern RwBool
+RwD3D8DeviceSupportsDXTTexture(void);
+
+/* Get handle to D3D8 device - useful for setting D3D8 renderstate*/
+extern void *
+RwD3D8GetCurrentD3DDevice(void);
+
+/* Get maximun number of multisampling levels */
+extern RwUInt32
+RwD3D8EngineGetMaxMultiSamplingLevels(void);
+
+/* Set number of multisampling levels */
+extern void
+RwD3D8EngineSetMultiSamplingLevels(RwUInt32 numLevels);
+
+/* Set maximun full screen refresh rate */
+extern void
+RwD3D8EngineSetRefreshRate(RwUInt32 refreshRate);
+
+/* Get handle to D3D8 rendering surface - useful for advanced blit ops */
+extern void *
+RwD3D8GetCurrentD3DRenderTarget(void);
+
+/* Atach a window to a camera */
+extern RwBool
+RwD3D8CameraAttachWindow(void *camera, void *hwnd);
+
+/* Immediate mode rendering */
+extern RwBool RwD3D8SetVertexShader(RwUInt32 handle);
+extern RwBool RwD3D8SetPixelShader(RwUInt32 handle);
+extern RwBool RwD3D8SetStreamSource(RwUInt32 streamNumber, void *streamData, RwUInt32 stride);
+extern RwBool RwD3D8SetIndices(void *indexData, RwUInt32 baseVertexIndex);
+
+extern RwBool RwD3D8DrawIndexedPrimitiveUP(RwUInt32 primitiveType,
+ RwUInt32 minIndex,
+ RwUInt32 numVertices,
+ RwUInt32 numIndices,
+ const void* indexData,
+ const void* vertexStreamZeroData,
+ RwUInt32 VertexStreamZeroStride);
+
+extern RwBool RwD3D8DrawPrimitiveUP(RwUInt32 primitiveType,
+ RwUInt32 numVertices,
+ const void* vertexStreamZeroData,
+ RwUInt32 VertexStreamZeroStride);
+
+extern RwBool RwD3D8DrawIndexedPrimitive(RwUInt32 primitiveType,
+ RwUInt32 minIndex,
+ RwUInt32 numVertices,
+ RwUInt32 startIndex,
+ RwUInt32 numIndices);
+
+extern RwBool RwD3D8DrawPrimitive(RwUInt32 primitiveType,
+ RwUInt32 startVertex,
+ RwUInt32 numVertices);
+
+extern RwBool RwD3D8SetTexture(RwTexture *texture, RwUInt32 stage);
+
+extern RwBool RwD3D8SetRenderState(RwUInt32 state, RwUInt32 value);
+extern RwBool RwD3D8SetTextureStageState(RwUInt32 stage, RwUInt32 type, RwUInt32 value);
+extern RwBool RwD3D8SetTransform(RwUInt32 state, const void *matrix);
+extern RwBool RwD3D8SetMaterial(const void *material);
+extern void RwD3D8SetStencilClear(RwUInt32 stencilClear);
+
+
+extern void RwD3D8GetRenderState(RwUInt32 state, void *value);
+extern void RwD3D8GetTextureStageState(RwUInt32 stage, RwUInt32 type, void *value);
+extern void RwD3D8GetTransform(RwUInt32 state, void *matrix);
+extern RwUInt32 RwD3D8GetStencilClear(void);
+
+/*
+ * To convert between RwMatrix to D3DMATRIX when setting the
+ * world matrix
+ */
+extern RwBool RwD3D8SetTransformWorld(const RwMatrix *matrix);
+
+/*
+ * To convert between RpMaterial to D3DMATERIAL8
+ */
+extern RwBool RwD3D8SetSurfaceProperties(const RwRGBA *color,
+ const RwSurfaceProperties *surfaceProps,
+ RwBool modulate);
+
+/*
+ * To set on that index the light from the descriptor
+ */
+extern RwBool RwD3D8SetLight(RwInt32 index, const void *light);
+extern void RwD3D8GetLight(RwInt32 index, void *light);
+
+extern RwBool RwD3D8EnableLight(RwInt32 index, RwBool enable);
+
+/*
+ * To get a pointer to a Dynamic vertex buffer
+ * Use both functions, Create and Destroy, not only Create
+ */
+extern RwBool RwD3D8DynamicVertexBufferCreate(RwUInt32 fvf, RwUInt32 size,
+ void **vertexBuffer);
+
+extern void RwD3D8DynamicVertexBufferDestroy(void *vertexBuffer);
+
+/*
+ * To get a temporary pointer to a Dynamic vertex buffer memory
+ * Don't use with the previous functions because
+ * it mantains an internal list of dinamic vertex buffers
+ */
+extern RwBool RwD3D8DynamicVertexBufferLock(RwUInt32 vertexSize,
+ RwUInt32 numVertex,
+ void **vertexBufferOut,
+ void **vertexDataOut,
+ RwUInt32 *baseIndexOut);
+
+extern RwBool RwD3D8DynamicVertexBufferUnlock(void *vertexBuffer);
+
+/*
+ * To get a pointer to an Index vertex buffer
+ * It's created as WRITEONLY, MANAGED and D3DFMT_INDEX16
+ */
+extern RwBool RwD3D8IndexBufferCreate(RwUInt32 numIndices,
+ void **indexBuffer);
+
+/*
+ * To create a vertex shader from the declaration, also the function
+ * for deleting it.
+ */
+extern RwBool RwD3D8CreateVertexShader(const RwUInt32 *declaration,
+ const RwUInt32 *function,
+ RwUInt32 *handle,
+ RwUInt32 usage);
+
+extern void RwD3D8DeleteVertexShader(RwUInt32 handle);
+
+extern RwBool RwD3D8SetVertexShaderConstant(RwUInt32 registerAddress,
+ const void *constantData,
+ RwUInt32 constantCount);
+
+/*
+ * To create a pixel shader from the function, also the function
+ * for deleting it.
+ */
+extern RwBool RwD3D8CreatePixelShader(const RwUInt32 *function, RwUInt32 *handle);
+
+extern void RwD3D8DeletePixelShader(RwUInt32 handle);
+
+extern RwBool RwD3D8SetPixelShaderConstant(RwUInt32 registerAddress,
+ const void *constantData,
+ RwUInt32 constantCount);
+
+/*
+ * Get a const pointer to the D3DCAPS8 struct, (you need to do the cast)
+ */
+extern const void *RwD3D8GetCaps(void);
+
+/*
+ * Check if the sphere is fully inside of the frustum
+ */
+extern RwBool RwD3D8CameraIsSphereFullyInsideFrustum(const void *camera, const void *sphere);
+
+/*
+ * Check if the Bounding Box is fully inside of the frustum
+ */
+extern RwBool RwD3D8CameraIsBBoxFullyInsideFrustum(const void *camera, const void *boundingBox);
+
+/*
+ * Cheking the CPU capabilities
+ */
+
+#if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE))
+extern RwBool _rwIntelMMXsupported(void);
+extern RwBool _rwIntelSSEsupported(void);
+extern RwBool _rwIntelSSE2supported(void);
+extern RwBool _rwAMD3DNowSupported(void);
+
+#else
+extern RwBool _rwD3D8CPUSupportsMMX;
+extern RwBool _rwD3D8CPUSupportsSSE;
+extern RwBool _rwD3D8CPUSupportsSSE2;
+extern RwBool _rwD3D8CPUSupports3DNow;
+
+#define _rwIntelMMXsupported() _rwD3D8CPUSupportsMMX
+#define _rwIntelSSEsupported() _rwD3D8CPUSupportsSSE
+#define _rwIntelSSE2supported() _rwD3D8CPUSupportsSSE2
+#define _rwAMD3DNowSupported() _rwD3D8CPUSupports3DNow
+#endif
+
+/*
+ * Enabling texture format conversions when loading textures from a texture
+ * dictionary. FALSE by default.
+ */
+extern void
+_rwD3D8TexDictionaryEnableRasterFormatConversion(RwBool enable);
+
+/* Called from RwEngineInit to give the driver a chance to register plugins */
+extern RwBool _rwDeviceRegisterPlugin(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/* LEGACY-MACRO */
+/**
+ * \ingroup rwcoredriverd3d8
+ * \ref RwD3DLoadNativeTexture is a legacy macro for compatibility with
+ * RWD3D7 applications that can be used to read a compressed texture from
+ * the specified DDS file on disk.
+ *
+ * It is recommended that applications for RWD3D8 should use the RWD3D8
+ * function \ref RwD3D8DDSTextureRead instead.
+ *
+ * \param name Pointer to a string containing the name of the texture to be read.
+ * \param maskname Pointer to a string containing the name of the mask or
+ * NULL if not required.
+ *
+ * \return Returns pointer to the new texture if successful or NULL if there
+ * is an error.
+ *
+ * \see RwD3D8DDSTextureRead
+ * \see RwD3D8DeviceSupportsDXTTexture
+ * \see RwImageSetPath
+ * \see RwTextureSetReadCallBack
+ * \see RwTextureSetMipmapping
+ * \see RwTextureSetAutoMipmapping
+ * \see RwTextureDestroy
+ *
+ */
+#define RwD3DLoadNativeTexture RwD3D8DDSTextureRead
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/baresamp.h ---*/
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwImage *RwImageResample(RwImage *dstImage, const RwImage *srcImage);
+extern RwImage *RwImageCreateResample(const RwImage *srcImage, RwInt32 width,
+ RwInt32 height);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/baimras.h ---*/
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Images from rasters */
+extern RwImage *RwImageSetFromRaster(RwImage *image, RwRaster *raster);
+
+/* Rasters from images */
+extern RwRaster *RwRasterSetFromImage(RwRaster *raster, RwImage *image);
+
+/* Finding raster formats */
+extern RwRGBA *RwRGBAGetRasterPixel(RwRGBA *rgbOut, RwRaster *raster,
+ RwInt32 x, RwInt32 y);
+
+/* Read a raster */
+extern RwRaster *RwRasterRead(const RwChar *filename);
+extern RwRaster *RwRasterReadMaskedRaster(const RwChar *filename, const RwChar *maskname);
+
+/* Finding appropriate raster formats */
+extern RwImage *RwImageFindRasterFormat(RwImage *ipImage,RwInt32 nRasterType,
+ RwInt32 *npWidth,RwInt32 *npHeight,
+ RwInt32 *npDepth,RwInt32 *npFormat);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/baframe.h ---*/
+
+/****************************************************************************
+ Defines
+ */
+
+#if (!defined(RWFRAMESTATICPLUGINSSIZE))
+#define RWFRAMESTATICPLUGINSSIZE 0
+#endif
+
+#define RWFRAMEALIGNMENT(_frame) \
+ (! (((rwFRAMEALIGNMENT)-1) & ((RwUInt32)(_frame))))
+
+/* Type ID */
+#define rwFRAME 0
+
+/* dirty flag bits */
+#define rwFRAMEPRIVATEHIERARCHYSYNCLTM 0x01
+#define rwFRAMEPRIVATEHIERARCHYSYNCOBJ 0x02
+#define rwFRAMEPRIVATESUBTREESYNCLTM 0x04
+#define rwFRAMEPRIVATESUBTREESYNCOBJ 0x08
+#define rwFRAMEPRIVATESTATIC 0x10
+
+/****************************************************************************
+ Global Types
+ */
+
+#if (!defined(DOXYGEN))
+struct RwFrame
+{
+ RwObject object;
+
+ RwLLLink inDirtyListLink;
+
+ /* Put embedded matrices here to ensure they remain 16-byte aligned */
+ RwMatrix modelling;
+ RwMatrix ltm;
+
+ RwLinkList objectList; /* List of objects connected to a frame */
+
+ struct RwFrame *child;
+ struct RwFrame *next;
+ struct RwFrame *root; /* Root of the tree */
+
+#if (RWFRAMESTATICPLUGINSSIZE)
+ RWALIGN(RwUInt8 pluginData[RWFRAMESTATICPLUGINSSIZE], rwFRAMEALIGNMENT);
+#endif /* defined(RWFRAMESTATICPLUGINSIZE)) */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/**
+ * \ingroup rwframe
+ * \struct RwFrame
+ * Frame for defining object position and orientation.
+ * This should be considered an opaque type.
+ * Use the RwFrame API functions to access.
+ */
+typedef struct RwFrame RWALIGN(RwFrame, rwFRAMEALIGNMENT);
+
+/**
+ * \ingroup rwframe
+ * \ref RwFrameCallBack type represents the function
+ * called from \ref RwFrameForAllChildren for all child frames linked to a given frame.
+ * This function should return a pointer to the current frame to indicate success.
+ * The callback may return NULL to terminate further callbacks on the child frames.
+ *
+ * \param frame Pointer to the current frame, supplied by
+ * iterator.
+ * \param data Pointer to developer-defined data structure.
+ *
+ * \return
+ *
+ * \see RwFrameForAllChildren
+ *
+ */
+typedef RwFrame *(*RwFrameCallBack)(RwFrame *frame, void *data);
+
+
+#define RwFrameGetParentMacro(_f) ((RwFrame *)rwObjectGetParent(_f))
+#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ))
+#define RwFrameGetParent(_f) RwFrameGetParentMacro(_f)
+#endif
+
+#define RwFrameGetMatrixMacro(_f) (&(_f)->modelling)
+#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ))
+#define RwFrameGetMatrix(_f) RwFrameGetMatrixMacro(_f)
+#endif
+
+
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern void RwFrameSetFreeListCreateParams(RwInt32 blockSize,
+ RwInt32 numBlocksToPrealloc );
+
+/* 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 void
+RwFrameSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+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);
+
+#if (!defined(DOXYGEN))
+struct RwObjectHasFrame
+{
+ RwObject object;
+ RwLLLink lFrame;
+ RwObjectHasFrameSyncFunction sync;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/****************************************************************************
+ 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;
+
+#if (!defined(DOXYGEN))
+struct rpTextureChunkInfo
+{
+ RwTextureFilterMode filtering;
+ RwTextureAddressMode addressingU;
+ RwTextureAddressMode addressingV;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/* 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;
+
+#if (!defined(DOXYGEN))
+struct rwFrameList
+{
+ RwFrame **frames;
+ RwInt32 numFrames;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/****************************************************************************
+ 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 rwbbox
+ * \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
+
+
+
+/****************************************************************************
+ <macro/inline functionality
+ */
+
+#define RwCameraGetViewOffsetMacro(_camera) \
+ (&((_camera)->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 rwcamera
+ * RwCameraClearMode
+ * Camera clear flags */
+enum RwCameraClearMode
+{
+ rwCAMERACLEARIMAGE = 0x1, /**<Clear the frame buffer */
+ rwCAMERACLEARZ = 0x2, /**<Clear the Z buffer */
+ rwCAMERACLEARSTENCIL = 0x4, /**<\if xbox Clear the stencil buffer \endif
+ * \if d3d8 Clear the stencil buffer \endif
+ * \if opengl Clear the stencil buffer \endif
+ */
+ rwCAMERACLEARMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwCameraClearMode RwCameraClearMode;
+
+/**
+ * \ingroup rwcamera
+ * RwCameraProjection
+ * This type represents the options available for
+ * setting the camera projection model, either perspective projection or
+* parallel projection (see API function \ref RwCameraSetProjection)*/
+enum RwCameraProjection
+{
+ rwNACAMERAPROJECTION = 0, /**<Invalid projection */
+ rwPERSPECTIVE = 1, /**<Perspective projection */
+ rwPARALLEL = 2, /**<Parallel projection */
+ rwCAMERAPROJECTIONFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwCameraProjection RwCameraProjection;
+
+/**
+ * \ingroup rwcamera
+ * RwFrustumTestResult
+ * This type represents the results from a
+ * camera frustum test on a given sphere (see API function
+ * \ref RwCameraFrustumTestSphere)*/
+enum RwFrustumTestResult
+{
+ rwSPHEREOUTSIDE = 0, /**<Outside the frustum */
+ rwSPHEREBOUNDARY = 1, /**<On the boundary of the frustum */
+ rwSPHEREINSIDE = 2, /**<Inside the frustum */
+ rwFRUSTUMTESTRESULTFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwFrustumTestResult RwFrustumTestResult;
+
+
+/**
+ * \ingroup rwcamera
+ * \struct RwCamera
+ * Camera object for rendering a view.
+ * This should be considered an opaque type.
+ * Use the RwCamera API functions to access.
+ */
+typedef struct RwCamera RWALIGN(RwCamera, rwMATRIXALIGNMENT);
+
+/* This allows a world to overload functionality */
+typedef RwCamera *(*RwCameraBeginUpdateFunc) (RwCamera * camera);
+typedef RwCamera *(*RwCameraEndUpdateFunc) (RwCamera * camera);
+
+typedef struct RwFrustumPlane RwFrustumPlane;
+
+#if (!defined(DOXYGEN))
+/*
+ * Structure describing a frustrum plane.
+ */
+struct RwFrustumPlane
+{
+ RwPlane plane;
+ RwUInt8 closestX;
+ RwUInt8 closestY;
+ RwUInt8 closestZ;
+ RwUInt8 pad;
+};
+
+
+struct RwCamera
+{
+ RwObjectHasFrame object;
+
+ /* Parallel or perspective projection */
+ RwCameraProjection projectionType;
+
+ /* Start/end update functions */
+ RwCameraBeginUpdateFunc beginUpdate;
+ RwCameraEndUpdateFunc endUpdate;
+
+ /* The view matrix */
+ RwMatrix viewMatrix;
+
+ /* The cameras image buffer */
+ RwRaster *frameBuffer;
+
+ /* The Z buffer */
+ RwRaster *zBuffer;
+
+ /* Cameras mathmatical characteristics */
+ RwV2d viewWindow;
+ RwV2d recipViewWindow;
+ RwV2d viewOffset;
+ RwReal nearPlane;
+ RwReal farPlane;
+ RwReal fogPlane;
+
+ /* Transformation to turn camera z or 1/z into a Z buffer z */
+ RwReal zScale, zShift;
+
+ /* Render frame counter -> 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 rwcamera
+ * \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.
+ *
+ * \return
+ */
+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 void RwCameraSetFreeListCreateParams( RwInt32 blockSize,
+ RwInt32 numBlocksToPrealloc );
+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/pipe/p2/bapipe.h ---*/
+
+#if (!defined(DOXYGEN))
+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, D3D8, SKY2, KAMUI2, DOLPHIN) put them here: */
+ RxPipeline *platformAtomicPipeline;
+ RxPipeline *platformWorldSectorPipeline;
+ RxPipeline *platformMaterialPipeline;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+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 rwcamera
+ * \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;
+
+#if (!defined(DOXYGEN))
+struct rwStreamCamera
+{
+ RwV2d viewWindow;
+ RwV2d viewOffset;
+ RwReal nearPlane, farPlane;
+ RwReal fogPlane;
+ RwUInt32 projection;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/****************************************************************************
+ 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 */
diff --git a/sdk/rwsdk/include/d3d8/rwplcore.h b/sdk/rwsdk/include/d3d8/rwplcore.h
new file mode 100644
index 00000000..3740ae60
--- /dev/null
+++ b/sdk/rwsdk/include/d3d8/rwplcore.h
@@ -0,0 +1,6271 @@
+/******************************************/
+/* */
+/* 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: <C:/daily/rwsdk/include/d3d8/rwplcore.h>
+ * Automatically Generated on: Thu Jan 23 11:06:23 2003
+ *
+ ************************************************************************/
+
+#ifndef RWPLCORE_H
+#define RWPLCORE_H
+
+/*--- System Header Files ---*/
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/os/win/ostypes.h ---*/
+#ifndef WIN_OSTYPES_H
+#define WIN_OSTYPES_H
+
+#define rwLITTLEENDIAN /* This is a little endian machine */
+
+typedef long RwFixed;
+typedef int RwInt32;
+typedef unsigned int RwUInt32;
+typedef short RwInt16;
+typedef unsigned short RwUInt16;
+typedef unsigned char RwUInt8;
+typedef signed char RwInt8;
+
+#ifdef RWUNICODE
+typedef wchar_t RwChar;
+#else /* RWUNICODE */
+typedef char RwChar;
+#endif /* RWUNICODE */
+typedef float RwReal;
+typedef RwInt32 RwBool;
+
+#ifdef _MSC_VER
+typedef __int64 RwInt64;
+typedef unsigned __int64 RwUInt64;
+#define RWZERO64 ((RwUInt64)0)
+#else /* _MSC_VER */
+
+typedef struct _RwUInt64 RwUInt64;
+typedef struct _RwInt64 RwInt64;
+
+/* We'll do it with structures (can't do maths on these, but OK for allocation): */
+#if (!defined(DOXYGEN))
+#ifdef rwBIGENDIAN
+struct _RwUInt64
+{
+ RwUInt32 top;
+ RwUInt32 bottom;
+};
+
+struct _RwInt64
+{
+ RwInt32 top;
+ RwUInt32 bottom;
+};
+
+#else /* rwBIGENDIAN */
+#ifdef rwLITTLEENDIAN
+struct _RwUInt64
+{
+ RwUInt32 bottom;
+ RwUInt32 top;
+};
+
+struct _RwInt64
+{
+ RwUInt32 bottom;
+ RwInt32 top;
+};
+
+#else /* rwLITTLEENDIAN */
+#error "ENDIAN-ness undefined!"
+#endif /* rwLITTLEENDIAN */
+#endif /* rwBIGENDIAN */
+#endif /* (!defined(DOXYGEN)) */
+
+#define RWZERO64 { (RwUInt32)0, (RwUInt32)0 }
+#endif /* _MSC_VER */
+
+typedef struct _RwUInt128 RwUInt128;
+typedef struct _RwInt128 RwInt128;
+
+/* We'll do it with structures
+ * (can't do maths on these, but OK for allocation): */
+#if (!defined(DOXYGEN))
+#ifdef rwBIGENDIAN
+struct _RwUInt128
+{
+ RwUInt64 top;
+ RwUInt64 bottom;
+};
+
+struct _RwInt128
+{
+ RwInt64 top;
+ RwUInt64 bottom;
+};
+
+#else /* rwBIGENDIAN */
+#ifdef rwLITTLEENDIAN
+struct _RwUInt128
+{
+ RwUInt64 bottom;
+ RwUInt64 top;
+};
+
+struct _RwInt128
+{
+ RwUInt64 bottom;
+ RwInt64 top;
+};
+
+#else /* rwLITTLEENDIAN */
+#error "ENDIAN-ness undefined!"
+#endif /* rwLITTLEENDIAN */
+#endif /* rwBIGENDIAN */
+#endif /* (!defined(DOXYGEN)) */
+
+#define RWZERO128 { RWZERO64, RWZERO64 }
+
+/* Limits of types */
+#define RwInt32MAXVAL 0x7FFFFFFF
+#define RwInt32MINVAL 0x80000000
+#define RwUInt32MAXVAL 0xFFFFFFFF
+#define RwUInt32MINVAL 0x00000000
+#define RwRealMAXVAL (RwReal)(3.40282347e+38)
+#define RwRealMINVAL (RwReal)(1.17549435e-38)
+#define RwInt16MAXVAL 0x7FFF
+#define RwInt16MINVAL 0x8000
+#define RwUInt16MAXVAL 0xFFFF
+#define RwUInt16MINVAL 0x0000
+
+/* Structure alignment */
+#define RWALIGN(type, x) type /* nothing */
+#define rwMATRIXALIGNMENT sizeof(RwUInt32)
+#define rwFRAMEALIGNMENT sizeof(RwUInt32)
+#define rwV4DALIGNMENT sizeof(RwUInt32)
+
+#if (!defined(rwMALLOCALIGNMENT))
+#define rwMALLOCALIGNMENT sizeof(RwUInt32)
+#endif /* (!defined(rwMALLOCALIGNMENT) */
+
+#if (defined(_MSC_VER))
+
+#if (defined(RWVERBOSE))
+#include <tchar.h>
+#pragma comment (lib , "advapi32.LIB") /* Registry functions */
+
+/*
+ * registry code
+ */
+
+#if (defined(RpWinRegGetDWordValue))
+#undef RpWinRegGetDWordValue
+#endif /* (defined(RpWinRegGetDWordValue)) */
+
+#define RpWinRegGetDWordValue(_result, _hKey, _name, _val) \
+MACRO_START \
+{ \
+ DWORD _size; \
+ DWORD _type; \
+ LONG _status; \
+ \
+ _status = \
+ RegQueryValueEx((_hKey), (_name), 0, &_type, NULL, &_size); \
+ (_result) = ((ERROR_SUCCESS == _status) && (REG_DWORD == _type)); \
+ \
+ if ((_result)) \
+ { \
+ _status = \
+ RegQueryValueEx((_hKey), (_name), 0, &_type, \
+ (BYTE *) (_val), &_size); \
+ (_result) = (ERROR_SUCCESS == _status); \
+ } \
+} \
+MACRO_STOP
+
+#if (defined(RpWinRegGetBinaryValue))
+#undef RpWinRegGetBinaryValue
+#endif /* (defined(RpWinRegGetBinaryValue)) */
+
+#define RpWinRegGetBinaryValue(_result, _hKey, _name, _val) \
+MACRO_START \
+{ \
+ DWORD _size; \
+ DWORD _type; \
+ LONG _status; \
+ \
+ _status = \
+ RegQueryValueEx((_hKey), (_name), 0, &_type, NULL, &_size); \
+ (_result) = \
+ ((ERROR_SUCCESS == _status) && \
+ (REG_BINARY == _type) && (0 < _size)); \
+ \
+ if ((_result)) \
+ { \
+ *(_val) = RwMalloc(sizeof(BYTE) * _size); \
+ (_result) = (NULL != *(_val)); \
+ \
+ if ((_result)) \
+ { \
+ \
+ _status = \
+ RegQueryValueEx((_hKey), \
+ (_name), 0, &_type, \
+ (BYTE *) * (_val), &_size); \
+ (_result =) (ERROR_SUCCESS == _status); \
+ \
+ if (!(_result)) \
+ { \
+ RwFree(*(_val)); \
+ *(_val) = NULL; \
+ } \
+ \
+ } \
+ \
+ } \
+} \
+MACRO_STOP
+
+#if (defined(RpWinRegGetStringValue))
+#undef RpWinRegGetStringValue
+#endif /* (defined(RpWinRegGetStringValue)) */
+
+#define RpWinRegGetStringValue(_result, _hKey, _name, _val) \
+MACRO_START \
+{ \
+ DWORD _size; \
+ DWORD _type; \
+ LONG _status; \
+ \
+ _status = \
+ RegQueryValueEx((_hKey), (_name), 0, &_type, NULL, &_size); \
+ (_result) = \
+ ((ERROR_SUCCESS == _status) && \
+ (REG_SZ == _type) && (0 < _size)); \
+ \
+ if ((_result)) \
+ { \
+ \
+ *(_val) = RwMalloc(sizeof(TCHAR) * _size); \
+ (_result) = (NULL != *(_val)); \
+ \
+ if ((_result)) \
+ { \
+ _status = \
+ RegQueryValueEx((_hKey), (_name), 0, &_type, \
+ (BYTE *) * (_val), &_size); \
+ (_result) = (ERROR_SUCCESS == _status); \
+ \
+ if (!(_result)) \
+ { \
+ RwFree(*(_val)); \
+ *(_val) = NULL; \
+ } \
+ } \
+ } \
+} \
+MACRO_STOP
+
+/* ------------------------------------------------------------------- */
+
+#define RpWinRegCloseKey(hKey) \
+MACRO_START \
+{ \
+ RegCloseKey(hKey); \
+} \
+MACRO_STOP
+
+/* ------------------------------------------------------------------- */
+
+#define RpWinRegOpenMachineKey(result) \
+MACRO_START \
+{ \
+ static const TCHAR RenderWareKey[] = \
+ "Software\\Criterion\\RenderWare"; \
+ DWORD disposition; \
+ LONG status = \
+ RegCreateKeyEx(HKEY_LOCAL_MACHINE, RenderWareKey, 0, \
+ REG_NONE, REG_OPTION_NON_VOLATILE, \
+ KEY_READ | KEY_WRITE, \
+ NULL, &result, &disposition); \
+ \
+ if (status != ERROR_SUCCESS) \
+ { \
+ result = NULL; \
+ } \
+} \
+MACRO_STOP
+
+/* ------------------------------------------------------------------- */
+
+#if (defined(RWGETWINREGDWORD))
+#undef RWGETWINREGDWORD
+#endif /* (defined(RWGETWINREGDWORD)) */
+
+#define RWGETWINREGDWORD(result, match) \
+MACRO_START \
+{ \
+ HKEY hKey; \
+ \
+ RpWinRegOpenMachineKey(hKey); \
+ if (hKey) \
+ { \
+ RwBool success; \
+ \
+ RpWinRegGetDWordValue(success, hKey, match, \
+ &result); \
+ \
+ RpWinRegCloseKey(hKey); \
+ } \
+} \
+MACRO_STOP
+
+#if (defined(RWGETWINREGBINARY))
+#undef RWGETWINREGBINARY
+#endif /* (defined(RWGETWINREGBINARY)) */
+
+#define RWGETWINREGBINARY(result, match) \
+MACRO_START \
+{ \
+ HKEY hKey; \
+ \
+ result = NULL; \
+ RpWinRegOpenMachineKey(hKey); \
+ if (hKey) \
+ { \
+ RwBool success; \
+ \
+ RpWinRegGetBinaryValue(success, hKey, match, \
+ &result, NULL); \
+ \
+ if (!success) \
+ result = NULL; \
+ \
+ RpWinRegCloseKey(hKey); \
+ } \
+} \
+MACRO_STOP
+
+#if (defined(RWGETWINREGSTRING))
+#undef RWGETWINREGSTRING
+#endif /* (defined(RWGETWINREGSTRING)) */
+
+#define RWGETWINREGSTRING(result, match) \
+MACRO_START \
+{ \
+ HKEY hKey; \
+ \
+ result = NULL; \
+ RpWinRegOpenMachineKey(hKey); \
+ if (hKey) \
+ { \
+ RwBool success; \
+ \
+ RpWinRegGetStringValue(success, hKey, match, \
+ &result); \
+ \
+ if (!success) \
+ result = NULL; \
+ \
+ RpWinRegCloseKey(hKey); \
+ } \
+} \
+MACRO_STOP
+
+#if (defined(_DEBUG))
+
+#if (defined(RWREGSETBREAKALLOC))
+#undef RWREGSETBREAKALLOC
+#endif /* (defined(RWREGSETBREAKALLOC)) */
+
+#define RWREGSETBREAKALLOC(_name) \
+MACRO_START \
+{ \
+ char _message[256]; \
+ long _lBreakAlloc = -1; \
+ \
+ RWGETWINREGDWORD(_lBreakAlloc, _name); \
+ \
+ RWCRTSETBREAKALLOC(_lBreakAlloc); \
+ \
+ _snprintf(_message, sizeof(_message), \
+ "%s(%d): RWCRTSETBREAKALLOC(%ld)\n", \
+ __FILE__, __LINE__, \
+ _lBreakAlloc); \
+ OutputDebugString(_message); \
+ \
+} \
+MACRO_STOP
+
+#if (defined(RWREGSETDEBUGTRACE))
+#undef RWREGSETDEBUGTRACE
+#endif /* (defined(RWREGSETDEBUGTRACE)) */
+
+#define RWREGSETDEBUGTRACE(_name) \
+MACRO_START \
+{ \
+ char _message[256]; \
+ long _lDebugtrace = 0; \
+ \
+ RWGETWINREGDWORD(_lDebugtrace, _name); \
+ \
+ RwDebugSetTraceState(_lDebugtrace); \
+ \
+ _snprintf(_message, sizeof(_message), \
+ "%s(%d): RwDebugSetTraceState(%ld)\n", \
+ __FILE__, __LINE__, \
+ _lDebugtrace); \
+ OutputDebugString(_message); \
+ \
+} \
+MACRO_STOP
+
+#if (defined(_CRTDBG_FLAGS))
+#undef _CRTDBG_FLAGS
+#endif /* (defined(_CRTDBG_FLAGS)) */
+
+#define _CRTDBG_FLAGS \
+( _CRTDBG_ALLOC_MEM_DF || /* Turn on the debug heap allocations \
+ * and use the memory block identifiers. \
+ * This is the only flag that's on by default. */ \
+ _CRTDBG_CHECK_ALWAYS_DF || /* Check and validate all memory \
+ * on each allocation and deallocation request. \
+ * Setting this flag on is what catches the \
+ * under and overwrites \
+ * so it is very important to \
+ * get it turned on. */ \
+ _CRTDBG_CHECK_CRT_DF || /* Include _CRT_BLOCK memory allocations \
+ * in all leak detection and state differences. */ \
+ _CRTDBG_DELAY_FREE_MEM_DF || /* Instead of truly freeing memory, \
+ * keep the block allocated and \
+ * in the internal heap list. \
+ * The blocks are filled with the value0xDD \
+ * so you know the memory is freed when \
+ * looking at it in the debugger. \
+ * By also not freeing the memory, \
+ * this can help provide stress \
+ * conditions for the program. */ \
+ _CRTDBG_LEAK_CHECK_DF) /* Do memory leak checking at \
+ * the end of the program. */
+
+#endif /* (defined(_DEBUG)) */
+#endif /* (defined(RWVERBOSE)) */
+
+#include <math.h>
+/*
+ * Keep true calls to these functions since
+ * some x86 runtime libraries do not support _CIpow() etc
+ */
+#pragma function( acos, asin, cosh, fmod, pow, sinh , tanh )
+
+#if (!defined(RWINT32FROMFLOAT))
+
+static __inline RwInt32
+int32fromreal(RwReal x)
+{
+ RwInt16 savemode;
+ RwInt16 workmode;
+ RwInt32 res;
+
+ _asm
+ {
+ fnstcw savemode ; get fpu mode
+ fld dword ptr[x] ; load rwreal x
+
+ mov ax,savemode ; put fpu mode in register
+ or ah,0ch ; or-in truncate mode
+
+ mov workmode,ax ; make ready to set fpu mode
+ fldcw workmode ; set fpu to truncate mode
+ fistp dword ptr[res]; store the rwint32eger result
+ fldcw savemode ; restore fpu mode
+ }
+
+ return res;
+}
+#define RwInt32FromRealMacro(x) int32fromreal(x)
+
+#endif /* (!defined(RWINT32FROMFLOAT)) */
+
+#if (!defined(NOASM))
+static __inline RwUInt32
+RwFastRealToUInt32Inline(RwReal x)
+{
+ RwUInt32 res;
+
+ __asm FLD DWord Ptr[x];
+ __asm FISTP DWord Ptr[res];
+
+ return(res);
+}
+
+#define RwFastRealToUInt32 RwFastRealToUInt32Inline
+
+#endif /* (defined(NOASM)) */
+
+#endif /* (defined(_MSC_VER)) */
+
+#endif /* WIN_OSTYPES_H */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/bamath.h ---*/
+
+/****************************************************************************
+ Defines
+ */
+
+#if (!defined(RwInt32FromRealMacro))
+#define RwInt32FromRealMacro(x) \
+ ((RwInt32)(x))
+#endif /* (!defined(RwInt32FromRealMacro)) */
+
+#if (!defined(RwFastRealToUInt32))
+#define RwFastRealToUInt32(_x) \
+ ((RwUInt32)RwInt32FromRealMacro(((RwReal)(_x))))
+#endif /* (!defined(RwFastRealToUInt32)) */
+
+/*
+ * Ensure inclusion of prototypes for single precison maths functions
+ * e.g. from
+ * /usr/local/sce/ee/gcc/ee/include/math.h
+ * /Program Files/Intel/Compiler4.0/include/mathf.h
+ */
+
+#if (defined(__ICL))
+
+#if (defined(RWVERBOSE))
+
+/*
+ * See
+ * http://www.eskimo.com/~scs/C-faq/q11.17.html
+ */
+
+#define _STRINGIFY(X) #X
+#define _STRINGIFY_EXP(X) _STRINGIFY(X)
+
+#pragma message ("Intel Compiler Version " _STRINGIFY_EXP(__ICL) ":" __FILE__ "(" _STRINGIFY_EXP(__LINE__) ")\n")
+#pragma comment ( user, "comment:" "Intel Compiler Version " _STRINGIFY_EXP(__ICL) ":" __FILE__ "(" _STRINGIFY_EXP(__LINE__) ")\n")
+
+#endif /* (defined(RWVERBOSE)) */
+
+#if (400 <= __ICL)
+#if (defined(__cplusplus))
+#define _INC_MATH
+#endif /* (defined(__cplusplus)) */
+#include <mathf.h>
+#else /* (400 < __ICL) */
+#undef RW_USE_SPF
+#endif /* (400 < __ICL) */
+
+#endif /* (defined(__ICL)) */
+
+#include <math.h>
+
+#define _RW_C1 ( (float) 4.1666667908e-02 )
+#define _RW_C2 ( (float)-1.3888889225e-03 )
+#define _RW_C3 ( (float) 2.4801587642e-05 )
+#define _RW_C4 ( (float)-2.7557314297e-07 )
+#define _RW_C5 ( (float) 2.0875723372e-09 )
+#define _RW_C6 ( (float)-1.1359647598e-11 )
+#define _RW_S1 ( (float)-1.6666667163e-01 )
+#define _RW_S2 ( (float) 8.3333337680e-03 )
+#define _RW_S3 ( (float)-1.9841270114e-04 )
+#define _RW_S4 ( (float) 2.7557314297e-06 )
+#define _RW_S5 ( (float)-2.5050759689e-08 )
+#define _RW_S6 ( (float) 1.5896910177e-10 )
+#define _RW_one ( (float) 1.0000000000e+00 )
+#define _RW_pS0 ( (float) 1.6666667163e-01 )
+#define _RW_pS1 ( (float)-3.2556581497e-01 )
+#define _RW_pS2 ( (float) 2.0121252537e-01 )
+#define _RW_pS3 ( (float)-4.0055535734e-02 )
+#define _RW_pS4 ( (float) 7.9153501429e-04 )
+#define _RW_pS5 ( (float) 3.4793309169e-05 )
+#define _RW_pi ( (float) 3.1415925026e+00 )
+#define _RW_pi_tol ( (float) 0.0312500000e+00 )
+#define _RW_pio2_hi ( (float) 1.5707962513e+00 )
+#define _RW_pio2_lo ( (float) 7.5497894159e-08 )
+#define _RW_qS1 ( (float)-2.4033949375e+00 )
+#define _RW_qS2 ( (float) 2.0209457874e+00 )
+#define _RW_qS3 ( (float)-6.8828397989e-01 )
+#define _RW_qS4 ( (float) 7.7038154006e-02 )
+
+#define RwCosMinusPiToPiMacro(result, x) \
+MACRO_START \
+{ \
+ const float z = x * x; \
+ const float r = ( z * (_RW_C1 + \
+ z * (_RW_C2 + \
+ z * (_RW_C3 + \
+ z * (_RW_C4 + \
+ z * (_RW_C5 + \
+ z * _RW_C6)))))); \
+ result = (_RW_one - ((float) 0.5 * z - (z * r ))); \
+} \
+MACRO_STOP
+
+#define RwSinMinusPiToPiMacro(result, x) \
+do \
+{ \
+ const float z = x * x; \
+ const float v = z * x; \
+ const float r = ( _RW_S2 + \
+ z * (_RW_S3 + \
+ z * (_RW_S4 + \
+ z * (_RW_S5 + \
+ z * _RW_S6))) ); \
+ result = x + v * (_RW_S1 + z * r); \
+} \
+while(0)
+
+typedef union _rwIEEEFloatShapeType _rwIEEEFloatShapeType;
+
+#if (!defined(DOXYGEN))
+union _rwIEEEFloatShapeType
+{
+ float value;
+ unsigned int word;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+#define _RW_GET_FLOAT_WORD(i,d) \
+do { \
+ _rwIEEEFloatShapeType gf_u; \
+ gf_u.value = (d); \
+ (i) = gf_u.word; \
+} while (0)
+
+/* Set a float from a 32 bit int. */
+
+#define _RW_SET_FLOAT_WORD(d,i) \
+do { \
+ _rwIEEEFloatShapeType sf_u; \
+ sf_u.word = (i); \
+ (d) = sf_u.value; \
+} while (0)
+
+#define RwIEEEACosfMacro(result, x) \
+do \
+{ \
+ float z, p, q, r, w, s, c, df; \
+ int hx, ix; \
+ \
+ _RW_GET_FLOAT_WORD(hx, x); \
+ ix = hx & 0x7fffffff; \
+ if (ix >= 0x3f800000) \
+ { /* |x|>=1 */ \
+ if (hx > 0) \
+ { \
+ /* acos(1) = 0 */ \
+ result = (0.0); \
+ } \
+ else \
+ { \
+ /* acos(-1)= _RW_pi */ \
+ result = (_RW_pi + (float) 2.0 * _RW_pio2_lo); \
+ } \
+ \
+ } \
+ else if (ix < 0x3f000000) \
+ { /* |x| < 0.5 */ \
+ if (ix <= 0x23000000) \
+ { \
+ /*if |x|<2**-57 */ \
+ result = (_RW_pio2_hi + _RW_pio2_lo); \
+ } \
+ else \
+ { \
+ z = x * x; \
+ p = z * (_RW_pS0 + \
+ z * (_RW_pS1 + \
+ z * (_RW_pS2 + \
+ z * (_RW_pS3 + \
+ z * (_RW_pS4 + z * _RW_pS5))))); \
+ q = _RW_one + z * (_RW_qS1 + \
+ z * (_RW_qS2 + \
+ z * (_RW_qS3 + z * _RW_qS4))); \
+ r = p / q; \
+ result = (_RW_pio2_hi - (x - (_RW_pio2_lo - x * r))); \
+ } \
+ \
+ } \
+ else if (hx < 0) \
+ { /* x < -0.5 */ \
+ z = (_RW_one + x) * (float) 0.5; \
+ p = z * (_RW_pS0 + \
+ z * (_RW_pS1 + \
+ z * (_RW_pS2 + \
+ z * (_RW_pS3 + \
+ z * (_RW_pS4 + z * _RW_pS5))))); \
+ q = _RW_one + z * (_RW_qS1 + \
+ z * (_RW_qS2 + z * (_RW_qS3 + z * _RW_qS4))); \
+ rwSqrtMacro(&s, z); \
+ r = p / q; \
+ w = r * s - _RW_pio2_lo; \
+ result = (_RW_pi - (float) 2.0 * (s + w)); \
+ } \
+ else \
+ { /* x > 0.5 */ \
+ int idf; \
+ \
+ z = (_RW_one - x) * (float) 0.5; \
+ rwSqrtMacro(&s, z); \
+ df = s; \
+ _RW_GET_FLOAT_WORD(idf, df); \
+ _RW_SET_FLOAT_WORD(df, idf & 0xfffff000); \
+ c = (z - df * df) / (s + df); \
+ p = z * (_RW_pS0 + \
+ z * (_RW_pS1 + \
+ z * (_RW_pS2 + \
+ z * (_RW_pS3 + \
+ z * (_RW_pS4 + z * _RW_pS5))))); \
+ q = _RW_one + z * (_RW_qS1 + \
+ z * (_RW_qS2 + z * (_RW_qS3 + z * _RW_qS4))); \
+ r = p / q; \
+ w = r * s + c; \
+ result = ((float) 2.0 * (df + w)); \
+ } \
+} \
+while(0)
+
+#if (defined(RW_USE_SPF))
+
+#define RwACos(_x) acosf(_x)
+#define RwACosh(_x) acoshf(_x)
+#define RwASin(_x) asinf(_x)
+#define RwASinh(_x) asinhf(_x)
+
+#if (!defined(__ICL))
+/*
+ * No SPF version in
+ * Program Files/Intel/compilerXXX/include/mathf.h
+ * of atan2()
+ */
+#define RwATan2(_x, _y) atan2f(_x, _y)
+#endif /* (!defined(__ICL)) */
+
+#define RwATan(_x) atanf(_x)
+#define RwATanh(_x) atanhf(_x)
+#define RwCabs() cabsf()
+#define RwCbrt(_x) cbrtf(_x)
+#define RwCeil(_x) ceilf(_x)
+#define RwCopysign(_x, _y) copysignf(_x, _y)
+#define RwCos(_x) cosf(_x)
+#define RwCosh(_x) coshf(_x)
+#define RwDrem(_x, _y) dremf(_x, _y)
+#define RwErfc(_x) erfcf(_x)
+#define RwErf(_x) erff(_x)
+#define RwExp(_x) expf(_x)
+#define RwExpm1(_x) expm1f(_x)
+#define RwFinite(_x) finitef(_x)
+#define RwIlogb(_x) ilogbf(_x)
+#define RwIsinf(_x) isinff(_x)
+#define RwIsnan(_x) isnanf(_x)
+#define RwFabs(_x) fabsf(_x)
+#define RwFloor(_x) floorf(_x)
+#define RwFmod(_x, _y) fmodf(_x, _y)
+#define RwFrexp(_x, _iptr) frexpf(_x, _iptr)
+#define RwGamma(_x) gammaf(_x)
+#define RwGammaf_(_x, _iptr) gammaf_r(_x, _iptr)
+#define RwHypot(_x, _y) hypotf(_x, _y)
+#define RwInfinity() infinityf()
+#define RwJ0(_x) j0f(_x)
+#define RwJ1(_x) j1f(_x)
+#define RwJn(_i, _x) jnf(_i, _x)
+#define RwLdexp(_x, _i) ldexpf(_x, _i)
+#define RwLgamma(_x) lgammaf(_x)
+#define RwLgammaf_(_x, _iptr) lgammaf_r(_x, _iptr)
+#define RwLog10(_x) log10f(_x)
+#define RwLog1p(_x) log1pf(_x)
+#define RwLog(_x) logf(_x)
+#define RwModf(_x, _y) modff(_x, _y)
+#define RwNan() nanf()
+#define RwNextafter(_x, _y) nextafterf(_x, _y)
+#define RwPow(_x, _y) powf(_x, _y)
+#define RwRemainder(_x, _y) remainderf(_x, _y)
+#define RwRint(_x) rintf(_x)
+#define RwScalbn(_x, _i) scalbnf(_x, _i)
+#define RwSin(_x) sinf(_x)
+#define RwSinh(_x) sinhf(_x)
+/* rwSqrtMacro/rwInvSqrtMacro are overloaded in drvmodel.h
+ * (if they are at all) and wrapped as func/macro below */
+#define RwTan(_x) tanf(_x)
+#define RwTanh(_x) tanhf(_x)
+#define RwY0(_x) y0f(_x)
+#define RwY1(_x) y1f(_x)
+#define RwYn(_i, _x) ynf(_i, _x)
+
+#endif /* (defined(RW_USE_SPF)) */
+
+#if (!defined(RwACos))
+#define RwACos(_x) acos(_x)
+#endif /* (!defined(RwACos)) */
+#if (!defined(RwACosh))
+#define RwACosh(_x) acosh(_x)
+#endif /* (!defined(RwACosh)) */
+#if (!defined(RwASin))
+#define RwASin(_x) asin(_x)
+#endif /* (!defined(RwASin)) */
+#if (!defined(RwASinh))
+#define RwASinh(_x) asinh(_x)
+#endif /* (!defined(RwASinh)) */
+#if (!defined(RwATan2))
+#define RwATan2(_x, _y) atan2(_x, _y)
+#endif /* (!defined(RwATan2)) */
+#if (!defined(RwATan))
+#define RwATan(_x) atan(_x)
+#endif /* (!defined(RwATan)) */
+#if (!defined(RwATanh))
+#define RwATanh(_x) atanh(_x)
+#endif /* (!defined(RwATanh)) */
+#if (!defined(RwCabs))
+#define RwCabs() cabs()
+#endif /* (!defined(RwCabs)) */
+#if (!defined(RwCbrt))
+#define RwCbrt(_x) cbrt(_x)
+#endif /* (!defined(RwCbrt)) */
+#if (!defined(RwCeil))
+#define RwCeil(_x) ceil(_x)
+#endif /* (!defined(RwCeil)) */
+#if (!defined(RwCopysign))
+#define RwCopysign(_x, _y) copysign(_x, _y)
+#endif /* (!defined(RwCopysign)) */
+#if (!defined(RwCos))
+#define RwCos(_x) cos(_x)
+#endif /* (!defined(RwCos)) */
+#if (!defined(RwCosh))
+#define RwCosh(_x) cosh(_x)
+#endif /* (!defined(RwCosh)) */
+#if (!defined(RwDrem))
+#define RwDrem(_x, _y) drem(_x, _y)
+#endif /* (!defined(RwDrem)) */
+#if (!defined(RwErfc))
+#define RwErfc(_x) erfc(_x)
+#endif /* (!defined(RwErfc)) */
+#if (!defined(RwEr))
+#define RwEr(_x) erf(_x)
+#endif /* (!defined(RwEr)) */
+#if (!defined(RwExp))
+#define RwExp(_x) exp(_x)
+#endif /* (!defined(RwExp)) */
+#if (!defined(RwExpm1))
+#define RwExpm1(_x) expm1(_x)
+#endif /* (!defined(RwExpm1)) */
+#if (!defined(RwFinite))
+#define RwFinite(_x) finite(_x)
+#endif /* (!defined(RwFinite)) */
+#if (!defined(RwIlogb))
+#define RwIlogb(_x) ilogb(_x)
+#endif /* (!defined(RwIlogb)) */
+#if (!defined(RwIsin))
+#define RwIsin(_x) isinf(_x)
+#endif /* (!defined(RwIsin)) */
+#if (!defined(RwIsnan))
+#define RwIsnan(_x) isnan(_x)
+#endif /* (!defined(RwIsnan)) */
+#if (!defined(RwFabs))
+#define RwFabs(_x) fabs(_x)
+#endif /* (!defined(RwFabs)) */
+#if (!defined(RwFloor))
+#define RwFloor(_x) floor(_x)
+#endif /* (!defined(RwFloor)) */
+#if (!defined(RwFmod))
+#define RwFmod(_x, _y) fmod(_x, _y)
+#endif /* (!defined(RwFmod)) */
+#if (!defined(RwFrexp))
+#define RwFrexp(_x, _iptr) frexp(_x, _iptr)
+#endif /* (!defined(RwFrexp)) */
+#if (!defined(RwGamma))
+#define RwGamma(_x) gamma(_x)
+#endif /* (!defined(RwGamma)) */
+#if (!defined(RwGammaf_))
+#define RwGammaf_(_x, _iptr) gammaf_r(_x, _iptr)
+#endif /* (!defined(RwGammaf_)) */
+#if (!defined(RwHypot))
+#define RwHypot(_x, _y) hypot(_x, _y)
+#endif /* (!defined(RwHypot)) */
+#if (!defined(RwInfinity))
+#define RwInfinity() infinity()
+#endif /* (!defined(RwInfinity)) */
+#if (!defined(RwJ0))
+#define RwJ0(_x) j0(_x)
+#endif /* (!defined(RwJ0)) */
+#if (!defined(RwJ1))
+#define RwJ1(_x) j1(_x)
+#endif /* (!defined(RwJ1)) */
+#if (!defined(RwJn))
+#define RwJn(_i, _x) jn(_i, _x)
+#endif /* (!defined(RwJn)) */
+#if (!defined(RwLdexp))
+#define RwLdexp(_x, _i) ldexp(_x, _i)
+#endif /* (!defined(RwLdexp)) */
+#if (!defined(RwLgamma))
+#define RwLgamma(_x) lgamma(_x)
+#endif /* (!defined(RwLgamma)) */
+#if (!defined(RwLgammaf_))
+#define RwLgammaf_(_x, _iptr) lgammaf_r(_x, _iptr)
+#endif /* (!defined(RwLgammaf_)) */
+#if (!defined(RwLog10))
+#define RwLog10(_x) log10(_x)
+#endif /* (!defined(RwLog10)) */
+#if (!defined(RwLog1p))
+#define RwLog1p(_x) log1p(_x)
+#endif /* (!defined(RwLog1p)) */
+#if (!defined(RwLog))
+#define RwLog(_x) log(_x)
+#endif /* (!defined(RwLog)) */
+#if (!defined(RwMod))
+#define RwMod(_x, _y) mod(_x, _y )
+#endif /* (!defined(RwMod)) */
+#if (!defined(RwNan))
+#define RwNan() nan()
+#endif /* (!defined(RwNan)) */
+#if (!defined(RwNextafter))
+#define RwNextafter(_x, _y) nextafter(_x, _y)
+#endif /* (!defined(RwNextafter)) */
+#if (!defined(RwPow))
+#define RwPow(_x, _y) pow(_x, _y)
+#endif /* (!defined(RwPow)) */
+#if (!defined(RwRemainder))
+#define RwRemainder(_x, _y) remainder(_x, _y)
+#endif /* (!defined(RwRemainder)) */
+#if (!defined(RwRint))
+#define RwRint(_x) rint(_x)
+#endif /* (!defined(RwRint)) */
+#if (!defined(RwScalbn))
+#define RwScalbn(_x, _i) scalbn(_x, _i)
+#endif /* (!defined(RwScalbn)) */
+#if (!defined(RwSin))
+#define RwSin(_x) sin(_x)
+#endif /* (!defined(RwSin)) */
+#if (!defined(RwSinh))
+#define RwSinh(_x) sinh(_x)
+#endif /* (!defined(RwSinh)) */
+#if (!defined(rwSqrt))
+/* NOTE: this is overloaded in drvmodel.h for some targets (SKY2 and XBOX atm)
+ * [we do in fact do overload w/ sqrtf there, if RW_USE_SPF,
+ * for D3D8, OpenGL and SoftRas] */
+#define rwSqrt(_result, _x) rwSqrtMacro(_result, _x)
+#endif /* (!defined(rwSqrt)) */
+#if (!defined(rwInvSqrt))
+/* NOTE: this is overloaded in drvmodel.h for some targets (SKY2 and XBOX atm)
+ * [we do in fact do overload w/ (1 / sqrtf) there, if RW_USE_SPF,
+ * for D3D8, OpenGL and SoftRas] */
+#define rwInvSqrt(_recip, _x) rwInvSqrtMacro(_recip, _x)
+#endif /* (!defined(rwInvSqrt)) */
+#if (!defined(RwTan))
+#define RwTan(_x) tan(_x)
+#endif /* (!defined(RwTan)) */
+#if (!defined(RwTanh))
+#define RwTanh(_x) tanh(_x)
+#endif /* (!defined(RwTanh)) */
+#if (!defined(RwY0))
+#define RwY0(_x) y0(_x)
+#endif /* (!defined(RwY0)) */
+#if (!defined(RwY1))
+#define RwY1(_x) y1(_x)
+#endif /* (!defined(RwY1)) */
+#if (!defined(RwYn))
+#define RwYn(_i, _x) yn(_i, _x)
+#endif /* (!defined(RwYn)) */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/batypes.h ---*/
+#define rwLIBRARYBASEVERSION 0x31000
+#define rwLIBRARYCURRENTVERSION 0x34005
+
+#define rwLIBRARYVERSION31000 0x31000
+#if (rwLIBRARYVERSION31000 < rwLIBRARYBASEVERSION)
+#error "Time to remove all rwLIBRARYVERSION31000 code"
+#endif
+
+#define rwLIBRARYVERSION34001 0x34001
+#if (rwLIBRARYVERSION34001 < rwLIBRARYBASEVERSION)
+#error "Time to remove all rwLIBRARYVERSION34001 code"
+#endif
+
+#define rwLIBRARYVERSION34002 0x34002
+#if (rwLIBRARYVERSION34002 < rwLIBRARYBASEVERSION)
+#error "Time to remove all rwLIBRARYVERSION34002 code"
+#endif
+
+/*
+ * RWBUILDNUMBER
+ * This 16-bit int will be externally defined in an official build, and
+ * is used to construct chunk header library ID when streaming out. All
+ * unofficial builds will be stamped with the following:-
+ */
+#if !defined(RWBUILDNUMBER)
+#define RWBUILDNUMBER 0xffff
+#endif
+
+/* IMPORTANT:
+ * The following Doxygen comment MUST be copied into RwCore.h,
+ * so don't move it from here. */
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup fundamentaltypes
+ * \page fundtypesoverview Fundamental Types Overview
+ *
+ * \par Requirements
+ * \li \b Headers: rwcore.h
+ * \li \b Libraries: rwcore.lib
+ *
+ * The rwcore.lib library provides the fundamental RenderWare features.
+ *
+ * When creating a RenderWare application, this library must always be
+ * linked.
+ *
+ * Functionality includes:
+ * \li Immediate Modes (2D \ref rwim2d and 3D \ref rwim3d )
+ * \li Plugin Management
+ * \li Base Datatypes
+ * \li Cameras \ref rwcamera
+ * \li Frames \ref rwframe
+ * \li the RenderWare Engine \ref rwengine
+ *
+ * RenderWare uses an object-oriented design philosophy, so this
+ * documentation is split across a number of objects.
+ *
+ * These objects are implemented in C, so C terminology is generally
+ * used, rather than C++ -- hence 'functions' instead of 'methods' and
+ * 'elements' instead of 'members'.
+ *
+ * If you are new to RenderWare programming, please read through the
+ * supplied User Guide. The RenderWare Engine \ref rwengine API is
+ * usually the starting point for new developers.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+
+#if (!defined(RWFORCEENUMSIZEINT))
+#define RWFORCEENUMSIZEINT ((RwInt32)((~((RwUInt32)0))>>1))
+#endif /* (!defined(RWFORCEENUMSIZEINT)) */
+
+/*
+ * See
+ * http://www.eskimo.com/~scs/C-faq/q11.17.html
+ */
+
+#define RW_STRINGIFY(X) #X
+#define RW_STRINGIFY_EXPANDED(X) RW_STRINGIFY(X)
+
+/****************************************************************************
+ Attributes
+ */
+
+#if (defined(__GNUC__))
+
+/* See http://www.gnu.org/software/gcc/onlinedocs/gcc_4.html#SEC91 */
+
+#if (!(defined(__cplusplus) || defined(__MWERKS__) || defined(__RWUNUSED__)))
+#define __RWUNUSED__ __attribute__ ((unused))
+#endif /* (!(defined(__cplusplus) || defined(__MWERKS__) || defined(__RWUNUSED__))) */
+
+#if (!(defined(__RWUNUSEDRELEASE__) || defined(RWVALIDATEPARAM)))
+#if (!( defined(__cplusplus) || defined(__MWERKS__) || defined(RWDEBUG)))
+#define __RWUNUSEDRELEASE__ __attribute__ ((unused))
+#endif /* (!(defined(__cplusplus) || defined(__MWERKS__) || defined(RWDEBUG))) */
+#endif /* (!(defined(__RWUNUSEDRELEASE__) || defined(RWVALIDATEPARAM))) */
+
+#if (!defined(__RWFORMAT__))
+#define __RWFORMAT__(_archetype, _string_index, _first_to_check) \
+ __attribute__ ((format (_archetype, _string_index, _first_to_check)))
+#endif /* (!defined(__RWFORMAT__)) */
+
+#endif /* (defined(__GNUC__)) */
+
+#if (!defined(__RWUNUSED__))
+#define __RWUNUSED__ /* No op */
+#endif /* (!defined(__RWUNUSED__)) */
+
+#if (!defined(__RWUNUSEDRELEASE__))
+#define __RWUNUSEDRELEASE__ /* No op */
+#endif /* (!defined(__RWUNUSEDRELEASE__)) */
+
+#if (!defined(__RWFORMAT__))
+#define __RWFORMAT__(_archetype, _string_index, _first_to_check) /* No op */
+#endif /* (!defined(__RWFORMAT__)) */
+
+/****************************************************************************
+ Calling conventions
+ */
+
+#if (defined(WIN32))
+#define RWASMCALL __cdecl
+#define RWASMAPI(TYPE) TYPE RWASMCALL
+#endif /* (defined(WIN32)) */
+
+#if (!defined(RWASMCALL))
+#define RWASMCALL /* No op */
+#endif /* (!defined(RWASMCALL)) */
+
+#if (!defined(RWASMAPI))
+#define RWASMAPI(TYPE) TYPE
+#endif /* (!defined(RWASMAPI)) */
+
+
+/* Maximum number of nested contexts */
+#define rwMAXPIPECONTEXT 10
+
+
+/****************************************************************************
+ Macro wrappers. These are needed everywhere.
+ */
+
+#ifndef MACRO_START
+#define MACRO_START do
+#endif /* MACRO_START */
+
+#ifndef MACRO_STOP
+#define MACRO_STOP while(0)
+#endif /* MACRO_STOP */
+
+/****************************************************************************
+ Types needed everywhere
+ */
+
+#ifdef FALSE
+#undef FALSE
+#endif
+#define FALSE 0
+
+#ifdef TRUE
+#undef TRUE
+#endif
+#define TRUE !FALSE
+
+/****************************************************************************
+ MS VC/C++ Specific
+ */
+
+#if (defined(_MSC_VER))
+#if (_MSC_VER>=1000)
+
+
+/*
+ * Check for correct compiler version
+ */
+#define RW_MSC_VER 1200
+
+#if (0 && !defined(RW_NO_COMPILER_CHECK))
+#if (_MSC_VER != RW_MSC_VER )
+# pragma message (__FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) "):" "\n This compiler is a different version (" RW_STRINGIFY_EXPANDED(_MSC_VER) ")\n to the compiler used to build the RenderWare product libraries (" RW_STRINGIFY_EXPANDED(RW_MSC_VER) ") \n To turn off this warning please define RW_NO_COMPILER_CHECK " )
+# pragma comment ( user, "comment:" __FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) "):" "\n This compiler is a different version (" RW_STRINGIFY_EXPANDED(_MSC_VER) ")\n to the compiler used to build the RenderWare product libraries (" RW_STRINGIFY_EXPANDED(RW_MSC_VER) ") \n To turn off this warning please define RW_NO_COMPILER_CHECK " )
+#endif /* (_MSC_VER != RW_MSC_VER ) */
+#endif /* (0 && !defined(RW_NO_COMPILER_CHECK)) */
+
+/*
+ * Output some compiler messages and object file comments
+ */
+
+#pragma comment ( compiler )
+
+#pragma comment ( user, "comment:" __DATE__" " __TIME__ " - " __FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ")")
+#pragma comment ( user, "comment:" " _MSC_VER==" RW_STRINGIFY_EXPANDED(_MSC_VER) "; _M_IX86==" RW_STRINGIFY_EXPANDED(_M_IX86))
+#if (defined(rwLIBRARYCURRENTVERSION))
+#pragma comment ( user, "comment:" "rwLIBRARYCURRENTVERSION:" RW_STRINGIFY_EXPANDED(rwLIBRARYCURRENTVERSION) )
+#endif /* (defined(rwLIBRARYCURRENTVERSION)) */
+
+#if (defined(RWDEBUG) && defined(RWVERBOSE))
+
+#if (defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC))
+#define _CRTDBG_MAP_ALLOC
+#endif /* defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) */
+#include <crtdbg.h>
+
+#pragma message (__DATE__" " __TIME__ " - " __FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ")" )
+#pragma message ("_MSC_VER==" RW_STRINGIFY_EXPANDED(_MSC_VER) "; _M_IX86==" RW_STRINGIFY_EXPANDED(_M_IX86))
+
+#if (defined(rwLIBRARYCURRENTVERSION))
+#pragma message ( "rwLIBRARYCURRENTVERSION:" RW_STRINGIFY_EXPANDED(rwLIBRARYCURRENTVERSION) )
+#endif /* (defined(rwLIBRARYCURRENTVERSION)) */
+
+#endif /* (defined(RWDEBUG) && defined(RWVERBOSE) ) */
+
+#endif /* (_MSC_VER>=1000) */
+#endif /* (defined(_MSC_VER)) */
+
+/*******************/
+/* Primitive types */
+/*******************/
+
+/* String construction stuff (gets us UNICODE support) */
+#ifdef RWUNICODE
+#define _RWSTRING(x) L ## x
+#else /* RWUNICODE */
+#define _RWSTRING(x) x
+#endif /* RWUNICODE */
+#define RWSTRING(x) _RWSTRING(x)
+
+/* NB volatile keyword required for VC5.0 to ensure a reload - AMB */
+typedef union RwSplitBits RwSplitBits;
+
+#if (!defined(DOXYGEN))
+union RwSplitBits
+{
+ RwReal nReal;
+ volatile RwInt32 nInt;
+ volatile RwUInt32 nUInt;
+};
+
+typedef struct RwSplitFixed RwSplitFixed;
+
+#ifdef rwBIGENDIAN
+struct RwSplitFixed
+{
+ RwInt16 integral;
+ RwUInt16 fractional;
+};
+
+#else /* rwBIGENDIAN */
+#ifdef rwLITTLEENDIAN
+struct RwSplitFixed
+{
+ RwUInt16 fractional;
+ RwInt16 integral;
+};
+
+#else /* rwLITTLEENDIAN */
+#error "ENDIAN-ness undefined!"
+#endif /* rwLITTLEENDIAN */
+#endif /* rwBIGENDIAN */
+
+typedef union RwUnionReal RwUnionReal;
+
+union RwUnionReal /* MSB is sign bit in any circumstance */
+{
+ RwReal real; /* 4 bytes interpreted as RwReal */
+ float floating; /* 4 bytes interpreted as float */
+ RwFixed fixed; /* 4 bytes interpreted as 16:16 fixed */
+ RwSplitFixed splitfixed; /* 4 bytes interpreted as 16:16 fixed */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/*****************/
+
+/* Complex types */
+
+/*****************/
+
+typedef struct RwV2d RwV2d;
+/**
+ * \ingroup rwv2d
+ * \struct RwV2d
+ * This type represents points in a 2D space, such as device
+ * space, specified by the (x, y) coordinates of the point.
+ */
+struct RwV2d
+{
+ RwReal x; /**< X value*/
+ RwReal y; /**< Y vlaue */
+};
+
+typedef struct RwV3d RwV3d;
+/**
+ * \ingroup rwv3d
+ * \struct RwV3d
+ * This type represents 3D points and vectors specified by
+ * the (x, y, z) coordinates of a 3D point or the (x, y, z) components of a
+ * 3D vector.
+ */
+struct RwV3d
+{
+ RwReal x; /**< X value */
+ RwReal y; /**< Y value */
+ RwReal z; /**< Z value */
+};
+
+#define RWV4DALIGNMENT(_v4d) \
+ (! (((rwV4DALIGNMENT)-1) & ((RwUInt32)(_v4d))))
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwv4d
+ * \struct RwV4d
+ * This type represents 4D points and vectors specified by
+ * the (x, y, z, w) coordinates of a 4D point or the (x, y, z, w) components of a
+ * 4D vector.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+
+struct RwV4d
+{
+ RwReal x; /**< X value */
+ RwReal y; /**< Y value */
+ RwReal z; /**< Z value */
+ RwReal w; /**< W value */
+};
+
+typedef struct RwV4d RWALIGN(RwV4d, rwV4DALIGNMENT);
+
+
+typedef struct RwRect RwRect;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup geometricaltypes
+ * \struct RwRect
+ * This type represents a 2D device space rectangle specified
+ * by the position of the top-left corner (the offset x, y) and its width (w)
+ * and height (h).
+ */
+#endif /* RWADOXYGENEXTERNAL */
+
+struct RwRect
+{
+ RwInt32 x; /**< X value of the top-left corner */
+ RwInt32 y; /**< Y value of the top-left corner */
+ RwInt32 w; /**< Width of the rectangle */
+ RwInt32 h; /**< Height of the rectangle */
+};
+
+typedef struct RwSphere RwSphere;
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup geometricaltypes
+ * \struct RwSphere
+ * This type represents a sphere specified by the position
+ * of its center and its radius
+ */
+#endif /* RWADOXYGENEXTERNAL */
+struct RwSphere
+{
+ RwV3d center; /**< Sphere center */
+ RwReal radius; /**< Sphere radius */
+};
+
+#if (!defined(RwSphereAssign))
+#define RwSphereAssign(_target, _source) \
+ ( *(_target) = *(_source) )
+#endif /* (!defined(RwSphereAssign)) */
+
+typedef struct RwLine RwLine;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup geometricaltypes
+ * \struct RwLine
+ * This type represents a 3D line specified by the position
+ * of its start and end points.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+struct RwLine
+{
+ RwV3d start; /**< Line start */
+ RwV3d end; /**< Line end */
+};
+
+#if (!defined(RwLineAssign))
+#define RwLineAssign(_target, _source) \
+ ( *(_target) = *(_source) )
+#endif /* (!defined(RwLineAssign)) */
+
+/* The maximum number of texture coordinates */
+#define rwMAXTEXTURECOORDS 8
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup fundtypesdatatypes
+ * RwTextureCoordinateIndex
+ * This type represents the index for texture coordinates.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+enum RwTextureCoordinateIndex
+{
+ rwNARWTEXTURECOORDINATEINDEX = 0,
+ rwTEXTURECOORDINATEINDEX0,
+ rwTEXTURECOORDINATEINDEX1,
+ rwTEXTURECOORDINATEINDEX2,
+ rwTEXTURECOORDINATEINDEX3,
+ rwTEXTURECOORDINATEINDEX4,
+ rwTEXTURECOORDINATEINDEX5,
+ rwTEXTURECOORDINATEINDEX6,
+ rwTEXTURECOORDINATEINDEX7,
+ rwTEXTURECOORDINATEINDEXFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwTextureCoordinateIndex RwTextureCoordinateIndex;
+
+typedef struct RwTexCoords RwTexCoords;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup fundtypesdatatypes
+ * \struct RwTexCoords
+ * This type represents the the u and v texture
+ * coordinates of a particular vertex.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+struct RwTexCoords
+{
+ RwReal u; /**< U value */
+ RwReal v; /**< V value */
+};
+
+
+/* Singley linked list macros. End marked as NULL */
+
+typedef struct RwSLLink RwSLLink; /*** RwSLLink ***/
+
+#if (!defined(DOXYGEN))
+struct RwSLLink
+{
+ RwSLLink *next;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+#define rwSLLinkGetData(link,type,entry) \
+ ((type *)(((RwUInt8 *)(link))-offsetof(type,entry)))
+
+#define rwSLLinkGetConstData(link,type,entry) \
+ ((const type *)(((const RwUInt8 *)(link))-offsetof(type,entry)))
+
+#define rwSLLinkInitialize(linkvar) \
+ (linkvar)->next = NULL;
+
+#define rwSLLinkGetNext(linkvar) \
+ ((linkvar)->next)
+
+typedef struct RwSingleList RwSingleList;
+
+#if (!defined(DOXYGEN))
+struct RwSingleList
+{
+ RwSLLink link;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+#define rwSingleListInitialize(list) \
+ (list)->link.next= NULL;
+#define rwSingleListEmpty(list) \
+ (((list)->link.next)==NULL)
+#define rwSingleListAddSLLink(list,linkvar) \
+ ( (linkvar)->next = (list)->link.next, \
+ (list)->link.next = (linkvar) )
+#define rwSingleListGetFirstSLLink(list) \
+ ((list)->link.next)
+#define rwSingleListGetTerminator(list) (NULL)
+
+/* Doubly linked list. End marked as start (its a ring) */
+
+typedef struct RwLLLink RwLLLink; /*** RwLLLink ***/
+
+#if (!defined(DOXYGEN))
+struct RwLLLink
+{
+ RwLLLink *next;
+ RwLLLink *prev;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+#define rwLLLinkGetData(linkvar,type,entry) \
+ ((type *)(((RwUInt8 *)(linkvar))-offsetof(type,entry)))
+
+#define rwLLLinkGetConstData(linkvar,type,entry) \
+ ((const type *)(((const RwUInt8 *)(linkvar))-offsetof(type,entry)))
+
+#define rwLLLinkGetNext(linkvar) \
+ ((linkvar)->next)
+
+#define rwLLLinkGetPrevious(linkvar) \
+ ((linkvar)->prev)
+
+#define rwLLLinkInitialize(linkvar) \
+ ( (linkvar)->prev = (RwLLLink *)NULL, \
+ (linkvar)->next = (RwLLLink *)NULL )
+
+#define rwLLLinkAttached(linkvar) \
+ ((linkvar)->next)
+
+typedef struct RwLinkList RwLinkList;
+
+#if (!defined(DOXYGEN))
+struct RwLinkList
+{
+ RwLLLink link;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+#define rwLinkListInitialize(list) \
+ ( (list)->link.next = ((RwLLLink *)(list)), \
+ (list)->link.prev = ((RwLLLink *)(list)) )
+#define rwLinkListEmpty(list) \
+ (((list)->link.next) == (&(list)->link))
+#define rwLinkListAddLLLink(list, linkvar) \
+ ( (linkvar)->next = (list)->link.next, \
+ (linkvar)->prev = (&(list)->link), \
+ ((list)->link.next)->prev = (linkvar), \
+ (list)->link.next = (linkvar) )
+#define rwLinkListRemoveLLLink(linkvar) \
+ ( ((linkvar)->prev)->next = (linkvar)->next, \
+ ((linkvar)->next)->prev = (linkvar)->prev )
+#define rwLinkListGetFirstLLLink(list) \
+ ((list)->link.next)
+#define rwLinkListGetLastLLLink(list) \
+ ((list)->link.prev)
+#define rwLinkListGetTerminator(list) \
+ (&((list)->link))
+
+typedef struct RwSurfaceProperties RwSurfaceProperties;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup fundtypesdatatypes
+ * \struct RwSurfaceProperties
+ * This type represents the ambient, diffuse and
+ * specular reflection coefficients of a particular geometry. Each coefficient
+ * is specified in the range 0.0 (no reflection) to 1.0 (maximum reflection).
+ */
+#endif /* RWADOXYGENEXTERNAL */
+struct RwSurfaceProperties
+{
+ RwReal ambient; /**< ambient reflection coefficient */
+ RwReal specular; /**< specular reflection coefficient */
+ RwReal diffuse; /**< reflection coefficient */
+};
+
+#if (!defined(RwSurfacePropertiesAssign))
+#define RwSurfacePropertiesAssign(_target, _source) \
+ ( *(_target) = *(_source) )
+#endif /* (!defined(RwSurfacePropertiesAssign)) */
+
+/**********
+ * Macros *
+ **********/
+
+/* ANSI C defines the offsetof(type,member) macro; should be in <stddef.h> */
+
+/* If not, fall back to this: */
+#ifndef offsetof
+#define offsetof(type, member) \
+ ((size_t)((RwUInt8 *)&((type *) 0)->member - (RwUInt8 *)((type *) 0)))
+#endif /* offsetof */
+
+/*
+ *
+ * Numeric Macros to handle Fixed/Floating point versions of RenderWare
+ *
+ */
+#define RWFIX_MIN (1)
+#define RWFIX_MAX (0x7fffffff)
+#define RwFixedToInt(a) ((a) >> 16)
+#define RwFixedToFloat(a) ((float)(((float)(a)) * (1.0f / 65536.0f)))
+#define RwFixedToReal(a) ((RwReal)(((RwReal)(a)) * (1.0f / 65536.0f)))
+#define RwIntToFixed(a) ((a) << 16)
+#define RwRealToFixed(a) (RwInt32FromRealMacro((a) * 65536.0f))
+#define RwRealAbs(a) ((RwReal)((a) >= (RwReal)(0.0) ? (a) : (-(a))))
+#define RwRealMin2(a,b) ((RwReal)( ((a) <= (b)) ? (a) : (b)))
+#define RwRealMax2(a,b) ((RwReal)( ((a) >= (b)) ? (a) : (b)))
+#define RwRealMin3(a,b,c) RwRealMin2(a,RwRealMin2(b,c))
+#define RwRealMax3(a,b,c) RwRealMax2(a,RwRealMax2(b,c))
+
+#ifndef NORWREALSHORTCUT
+#define RToFixed RwRealToFixed
+#define RAbs RwRealAbs
+#define FxToInt RwFixedToInt
+#define FxToFloat RwFixedToFloat
+#define FxToReal RwFixedToFloat
+
+#endif
+
+#ifndef rwPI
+#define rwPI ((RwReal)(3.1415926535f))
+#define rwPIOVER2 (rwPI / (RwReal)(2.0f))
+#endif
+#define RWRGBALONG(r,g,b,a) \
+ ((RwUInt32) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
+
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ RwPlane
+
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+
+
+/*
+ * typedef for struct RwPlane
+ */
+typedef struct RwPlane RwPlane;
+
+#if (!defined(DOXYGEN))
+/*
+ * This type represents a plane
+ */
+struct RwPlane
+{
+ RwV3d normal; /**< Normal to the plane */
+ RwReal distance; /**< Distance to plane from origin in normal direction*/
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/****************************************************************************
+ Defines
+ */
+
+enum RwPlaneType
+{
+ rwXPLANE = 0, /* These are deliberately multiples of sizeof(RwReal) */
+ rwYPLANE = 4,
+ rwZPLANE = 8,
+ rwPLANETYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwPlaneType RwPlaneType;
+
+#define rwSECTORATOMIC -1
+#define rwSECTORBUILD -2 /* Only used when building a world */
+
+/* vect is a RwV3d, y is the component */
+#define GETCOORD(vect,y) \
+ (*(RwReal *)(((RwUInt8 *)(&((vect).x)))+(RwInt32)(y)))
+#define GETCONSTCOORD(vect,y) \
+ (*(const RwReal *)(((const RwUInt8 *)(&((vect).x)))+(RwInt32)(y)))
+#define SETCOORD(vect,y,value) \
+ (((*(RwReal *)(((RwUInt8 *)(&((vect).x)))+(RwInt32)(y))))=(value))
+#define SETCONSTCOORD(vect,y,value) \
+ (((*(const RwReal *) \
+ (((const RwUInt8 *) \
+ (&((vect).x)))+(RwInt32)(y))))=(value))
+#define GETCOORDINT(vect,y) \
+ (*(RwInt32 *)(((RwUInt8 *)(&((vect).x)))+(y)))
+#define GETCONSTCOORDINT(vect,y) \
+ (*(const RwInt32 *)(((const RwUInt8 *)(&((vect).x)))+(y)))
+
+
+/**
+ * \ingroup integertypes
+ * \page inttypes Integer Types
+ *
+ * RenderWare supports a number of integer types:
+ *
+ * RwInt8 8-bit signed integer.
+ * \li RwUInt8 8-bit unsigned integer.
+ * \li RwChar Character type.
+ * \li RwInt16 16-bit signed integer.
+ * \li RwUInt16 16-bit unsigned integer.
+ * \li RwInt32 32-bit signed integer.
+ * \li RwUInt32 32-bit unsigned integer.
+ * \li RwInt64 64-bit signed integer.
+ * \li RwUInt64 64-bit unsigned integer.
+ * \li RwInt128 128-bit signed integer.
+ * \li RwUInt128 128-bit unsigned integer.
+ * \li RwBool Boolean type (in 32 bits).
+ *
+ * These types should be used in applications in preference to the underlying
+ * native types.
+ *
+ * The following constants indicate the maximum and minimum values possible
+ * for the various RenderWare integer types:
+ *
+ * \li RwInt32MAXVAL Maximum RwInt32 value.
+ * \li RwInt32MINVAL Minimum RwInt32 value.
+ * \li RwUInt32MAXVAL Maximum RwUInt32 value.
+ * \li RwUInt32MINVAL Minimum RwUInt32 value.
+ * \li RwInt16MAXVAL Maximum RwInt16 value.
+ * \li RwInt16MINVAL Minimum RwInt16 value.
+ * \li RwUInt16MAXVAL Maximum RwUInt16 value.
+ * \li RwUInt16MINVAL Minimum RwUInt16 value.
+ *
+ * \see RwReal
+ */
+
+/**
+ * \ingroup realtypes
+ * \typedef RwReal
+ *
+ * RenderWare supports a single RwReal floating-point type to aid portability
+ * across platforms. This type should be used in applications in preference to
+ * the underlying native type.
+ *
+ * The constants RwRealMAXVAL and RwRealMINVAL are provided for determining
+ * the maximum and minimum values possible using the RwReal type.
+ *
+ * In addition, the following macros are available for operations on RwReal
+ * types:
+ * \li RwRealMin2(a, b) Find the minimum of two RwReal values.
+ * \li RwRealMax2(a, b) Find the maximum of two RwReal values.
+ * \li RwRealMin3(a, b, c) Find the minimum of three RwReal values.
+ * \li RwRealMax3(a, b, c) Find the maximum of three RwReal values.
+ * \li RwRealAbs(x) Find the absolute value of a RwReal value.
+ *
+ * \see \ref inttypes
+ */
+
+/**
+ * \ingroup realtypes
+ * \typedef RwFixed
+ *
+ * RenderWare supports a single RwFixed fixed-point type.
+ *
+ * Although popular in the days when integer mathematics was much faster than
+ * floating point mathematics, fixed-point math is now rarely used. It is
+ * provided because it is still useful for some processes.
+ *
+ * The maximum and minimum size of an RwFixed value are defined by the constants
+ * RWFIX_MAX and RWFIX_MIN respectively.
+ *
+ * The following macros are provided to help you work with RwFixed datatypes:
+ * \li RwFixedToInt(x) Convert an RwFixed to an integer. (The fractional portion is lost.)
+ * \li RwFixedToFloat(x) Convert an RwFixed to a float.
+ * \li RwFixedToReal(x) Convert an RwFixed to an RwReal.
+ * \li RwRealToFixed(x) Convert an RwReal to an RwFixed. (Some precision may be lost.)
+ * \li RwIntToFixed(x) Convert an RwInt32 to an RwFixed. (Some precision may be lost.)
+ */
+
+/**
+ * \ingroup integertypes
+ * \typedef RwInt8
+ *
+ * Signed 8 bit integer type.
+ * \see \ref inttypes
+ */
+
+/**
+ * \ingroup integertypes
+ * \typedef RwUInt8
+ *
+ * Unsigned 8bit integer type.
+ * \see \ref inttypes
+ */
+
+/**
+ * \ingroup integertypes
+ * \typedef RwChar
+ *
+ * Character type.
+ * \see \ref inttypes
+ */
+
+/**
+ * \ingroup integertypes
+ * \typedef RwInt16
+ *
+ * Signed 16 bit integer type.
+ * \see \ref inttypes
+ */
+
+/**
+ * \ingroup integertypes
+ * \typedef RwUInt16
+ *
+ * Unsigned 16 bit integer type.
+ * \see \ref inttypes
+ */
+
+/**
+ * \ingroup integertypes
+ * \typedef RwInt32
+ *
+ * Signed 32 bit integer type.
+ * \see \ref inttypes
+ */
+
+/**
+ * \ingroup integertypes
+ * \typedef RwUInt32
+ *
+ * Unsigned 32 bit integer type.
+ * \see \ref inttypes
+ */
+
+/**
+ * \ingroup integertypes
+ * \typedef RwInt64
+ *
+ * Signed 64 bit integer type.
+ * \see \ref inttypes
+ */
+
+/**
+ * \ingroup integertypes
+ * \typedef RwUInt64
+ *
+ * Unsigned 64 bit integer type.
+ * \see \ref inttypes
+ */
+
+/**
+ * \ingroup integertypes
+ * \typedef RwInt128
+ *
+ * Signed 128 bit integer type.
+ * \see \ref inttypes
+ */
+
+/**
+ * \ingroup integertypes
+ * \typedef RwUInt128
+ *
+ * Unsigned 128 bit integer type.
+ * \see \ref inttypes
+ */
+
+/**
+ * \ingroup integertypes
+ * \typedef RwBool
+ *
+ * Boolean type.
+ * \see \ref inttypes
+ */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/batype.h ---*/
+/****************************************************************************
+ Defines
+*/
+
+/*
+ * Object Types - these are used in the binary object
+ * representations and in the debug library. They must
+ * be unique. They are the old system.
+ */
+
+#define rwID_DATABASE 0x64617462 /* datb */
+
+#define MAKECHUNKID(vendorID, chunkID) (((vendorID & 0xFFFFFF) << 8) | (chunkID & 0xFF))
+#define GETOBJECTID(chunkID) (chunkID & 0xFF)
+#define GETVENDORID(chunkID) ((chunkID >> 8) & 0xFFFFFF)
+
+/***
+ *** These are the vendor IDs. A customer must reserve a vendor ID in order
+ *** to be able to write toolkits (this prevents clashes between toolkits).
+ *** We reserve some for our own use as shown below. These are all 24 bit.
+ ***
+ *** IMPORTANT NOTE: DO NOT UNDER ANY CIRCUMSTANCES CHANGE THESE VALUES. IF
+ *** YOU ARE ADDING A NEW ONE, APPEND IT!
+ ***
+ *** They must all be unique.
+ ***/
+
+enum RwPluginVendor
+{
+ rwVENDORID_CORE = 0x000000L,
+ rwVENDORID_CRITERIONTK = 0x000001L,
+ rwVENDORID_REDLINERACER = 0x000002L,
+ rwVENDORID_CSLRD = 0x000003L,
+ rwVENDORID_CRITERIONINT = 0x000004L,
+ rwVENDORID_CRITERIONWORLD = 0x000005L,
+ rwVENDORID_BETA = 0x000006L,
+ rwVENDORID_CRITERIONRM = 0x000007L,
+ rwVENDORID_CRITERIONRWA = 0x000008L, /* RenderWare Audio */
+ rwPLUGINVENDORFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwPluginVendor RwPluginVendor;
+
+/***
+ *** These are the core objects (8 bit IDs). They must all be unique.
+ *** We can get away without using the MAKECHUNKID macro because the
+ *** vendor ID in all cases will be zero (rwVENDORID_CORE).
+ ***
+ *** IMPORTANT NOTE: DO NOT UNDER ANY CIRCUMSTANCES CHANGE THESE VALUES. IF
+ *** YOU ARE ADDING A NEW ONE, APPEND IT!
+ ***/
+
+/* These are the internal ones. Because the core ID is 0, we can get away without
+ * using the MAKECHUNKID macro for the CORE chunks.
+ */
+
+enum RwCorePluginID
+{
+ rwID_NAOBJECT = 0x00,
+ rwID_STRUCT = 0x01,
+ rwID_STRING = 0x02,
+ rwID_EXTENSION = 0x03,
+ rwID_CAMERA = 0x05,
+ rwID_TEXTURE = 0x06,
+ rwID_MATERIAL = 0x07,
+ rwID_MATLIST = 0x08,
+ rwID_ATOMICSECT = 0x09,
+ rwID_PLANESECT = 0x0A,
+ rwID_WORLD = 0x0B,
+ rwID_SPLINE = 0x0C,
+ rwID_MATRIX = 0x0D,
+ rwID_FRAMELIST = 0x0E,
+ rwID_GEOMETRY = 0x0F,
+ rwID_CLUMP = 0x10,
+ rwID_LIGHT = 0x12,
+ rwID_UNICODESTRING = 0x13,
+ rwID_ATOMIC = 0x14,
+ rwID_TEXTURENATIVE = 0x15,
+ rwID_TEXDICTIONARY = 0x16,
+ rwID_ANIMDATABASE = 0x17,
+ rwID_IMAGE = 0x18,
+ rwID_SKINANIMATION = 0x19,
+ rwID_GEOMETRYLIST = 0x1A,
+ rwID_HANIMANIMATION = 0x1B,
+ rwID_TEAM = 0x1C,
+ rwID_CROWD = 0x1D,
+ rwID_DMORPHANIMATION = 0x1E,
+ rwID_RIGHTTORENDER = 0x1f,
+ rwID_MTEFFECTNATIVE = 0x20,
+ rwID_MTEFFECTDICT = 0x21,
+ rwID_TEAMDICTIONARY = 0x22,
+ rwID_PITEXDICTIONARY = 0x23,
+ rwID_TOC = 0x24,
+ rwID_PRTSTDGLOBALDATA = 0x25,
+ rwID_ALTPIPE = 0x26,
+ rwID_PIPEDS = 0x27,
+ /* Insert before MAX and increment MAX */
+ rwID_COREPLUGINIDMAX = 0x28,
+ rwCOREPLUGINIDFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwCorePluginID RwCorePluginID ;
+
+/***
+ *** These are the Criterion internal plugin extensions. Use with rwVENDORID_CRITERIONINT.
+ ***
+ *** IMPORTANT NOTE: DO NOT UNDER ANY CIRCUMSTANCES CHANGE THESE VALUES. IF
+ *** YOU ARE ADDING A NEW ONE, APPEND IT!
+ ***/
+
+enum RwCriterionPluginID
+{
+ rwID_COREPLUGIN = 0x01,
+ rwID_WORLDPLUGIN = 0x02,
+ rwID_TOOLPLUGIN = 0x03,
+ rwID_TOOL2PLUGIN = 0x04,
+ rwCRITERIONPLUGINIDFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwCriterionPluginID RwCriterionPluginID;
+
+
+/***
+ *** These are the Criterion internal platform identifies.
+ ***
+ *** IMPORTANT NOTE: DO NOT UNDER ANY CIRCUMSTANCES CHANGE THESE VALUES. IF
+ *** YOU ARE ADDING A NEW ONE, APPEND IT!
+ ***/
+enum RwPlatformID
+{
+ rwID_PCD3D7 = 1,
+ rwID_PCOGL,
+ rwID_MAC,
+ rwID_PS2,
+ rwID_XBOX,
+ rwID_GAMECUBE,
+ rwID_SOFTRAS,
+ rwID_PCD3D8,
+ rwPLATFROMIDFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwPlatformID RwPlatformID;
+
+
+/****************************************************************************
+ Global Types
+ */
+
+typedef struct RwObject RwObject;
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwobject
+ * \struct RwObject
+ * This should be considered an opaque type. Use
+ * the RwObject API functions to access.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+
+struct RwObject
+{
+ RwUInt8 type; /**< Internal Use */
+ RwUInt8 subType; /**< Internal Use */
+ RwUInt8 flags; /**< Internal Use */
+ RwUInt8 privateFlags; /**< Internal Use */
+ void *parent; /**< Internal Use */
+ /* Often a Frame */
+};
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwobject
+ * \ref RwObjectCallBack
+ * callback function supplied for object callback functions.
+ *
+ * \param object Pointer to the current object, supplied by
+ * iterator.
+ * \param data Pointer to developer-defined data structure.
+ *
+ * \return Pointer to the current object
+ *
+ * \see RwFrameForAllObjects
+ *
+ */
+#endif /* RWADOXYGENEXTERNAL */
+
+typedef RwObject *(*RwObjectCallBack)(RwObject *object, void *data);
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* TYPE METHODS */
+
+/* Creation/cloning */
+
+#define rwObjectCopy(d,s) \
+MACRO_START \
+{ \
+ ((RwObject *)(d))->type = \
+ ((const RwObject *)(s))->type; \
+ ((RwObject *)(d))->subType = \
+ ((const RwObject *)(s))->subType; \
+ ((RwObject *)(d))->flags = \
+ ((const RwObject *)(s))->flags; \
+ ((RwObject *)(d))->privateFlags = \
+ ((const RwObject *)(s))->privateFlags; \
+ ((RwObject *)(d))->parent = \
+ NULL; \
+} \
+MACRO_STOP
+
+#define rwObjectInitialize(o, t, s) \
+MACRO_START \
+{ \
+ ((RwObject *)(o))->type = (RwUInt8)(t); \
+ ((RwObject *)(o))->subType = (RwUInt8)(s); \
+ ((RwObject *)(o))->flags = 0; \
+ ((RwObject *)(o))->privateFlags = 0; \
+ ((RwObject *)(o))->parent = NULL; \
+} \
+MACRO_STOP
+
+/* Debug */
+#define RwObjectGetType(o) (((const RwObject *)(o))->type)
+
+#define rwObjectSetType(o, t) (((RwObject *)(o))->type) = (RwUInt8)(t)
+
+/* Sub type */
+#define rwObjectGetSubType(o) (((const RwObject *)(o))->subType)
+#define rwObjectSetSubType(o, t) (((RwObject *)(o))->subType) = (RwUInt8)(t)
+
+/* Flags */
+#define rwObjectGetFlags(o) (((const RwObject *)(o))->flags)
+#define rwObjectSetFlags(o, f) (((RwObject *)(o))->flags) = (RwUInt8)(f)
+#define rwObjectTestFlags(o, f) ((((const RwObject *)(o))->flags) & (RwUInt8)(f))
+
+/* Private flags */
+#define rwObjectGetPrivateFlags(c) (((const RwObject *)(c))->privateFlags)
+#define rwObjectSetPrivateFlags(c,f) (((RwObject *)(c))->privateFlags) = (RwUInt8)(f)
+#define rwObjectTestPrivateFlags(c,flag) ((((const RwObject *)(c))->privateFlags) & (RwUInt8)(flag))
+
+/* Hierarchy */
+#define rwObjectGetParent(object) (((const RwObject *)(object))->parent)
+#define rwObjectSetParent(c,p) (((RwObject *)(c))->parent) = (void *)(p)
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/os/win/osintf.h ---*/
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/rwstring.h ---*/
+
+/****************************************************************************
+ Defines
+ */
+
+#define rwsprintf RWSRCGLOBAL(stringFuncs).vecSprintf
+#define rwvsprintf RWSRCGLOBAL(stringFuncs).vecVsprintf
+#define rwstrcpy RWSRCGLOBAL(stringFuncs).vecStrcpy
+#define rwstrncpy RWSRCGLOBAL(stringFuncs).vecStrncpy
+#define rwstrcat RWSRCGLOBAL(stringFuncs).vecStrcat
+#define rwstrncat RWSRCGLOBAL(stringFuncs).vecStrncat
+#define rwstrrchr RWSRCGLOBAL(stringFuncs).vecStrrchr
+#define rwstrchr RWSRCGLOBAL(stringFuncs).vecStrchr
+#define rwstrstr RWSRCGLOBAL(stringFuncs).vecStrstr
+#define rwstrcmp RWSRCGLOBAL(stringFuncs).vecStrcmp
+#define rwstricmp RWSRCGLOBAL(stringFuncs).vecStricmp
+#define rwstrlen RWSRCGLOBAL(stringFuncs).vecStrlen
+#define rwstrupr RWSRCGLOBAL(stringFuncs).vecStrupr
+#define rwstrlwr RWSRCGLOBAL(stringFuncs).vecStrlwr
+#define rwstrtok RWSRCGLOBAL(stringFuncs).vecStrtok
+#define rwsscanf RWSRCGLOBAL(stringFuncs).vecSscanf
+
+#define rwstrdup(_result, _string) \
+do \
+{ \
+ _result = ((RwChar*)NULL); \
+ \
+ if (((RwChar*)NULL) != (_string)) \
+ { \
+ _result = (RwChar *) \
+ RwMalloc( (rwstrlen(_string) + 1) * \
+ sizeof (RwChar) ); \
+ \
+ if (((RwChar*)NULL) != (_result)) \
+ { \
+ rwstrcpy(_result, _string); \
+ } \
+ } \
+} \
+while (0)
+
+
+/****************************************************************************
+ Global Types
+ */
+
+typedef int (*vecSprintfFunc)(RwChar *buffer,
+ const RwChar *format,
+ ...) /* __RWFORMAT__(printf, 2, 3) */;
+typedef int (*vecVsprintfFunc)(RwChar *buffer,
+ const RwChar *format,
+ va_list argptr);
+typedef RwChar *(*vecStrcpyFunc)(RwChar *dest,
+ const RwChar *srce);
+typedef RwChar *(*vecStrncpyFunc)(RwChar *dest,
+ const RwChar *srce,
+ size_t size);
+typedef RwChar *(*vecStrcatFunc)(RwChar *dest,
+ const RwChar *srce);
+typedef RwChar *(*vecStrncatFunc)(RwChar *dest,
+ const RwChar *srce,
+ size_t size);
+typedef RwChar *(*vecStrrchrFunc)(const RwChar *string,
+ int findThis);
+typedef RwChar *(*vecStrchrFunc)(const RwChar *string,
+ int findThis);
+typedef RwChar *(*vecStrstrFunc)(const RwChar *string,
+ const RwChar *findThis);
+typedef int (*vecStrcmpFunc)(const RwChar *string1,
+ const RwChar *string2);
+typedef int (*vecStricmpFunc)(const RwChar *string1,
+ const RwChar *string2);
+typedef size_t (*vecStrlenFunc)(const RwChar *string);
+typedef RwChar *(*vecStruprFunc)(RwChar *string);
+typedef RwChar *(*vecStrlwrFunc)(RwChar *string);
+typedef RwChar *(*vecStrtokFunc)(RwChar *string, const RwChar *delimit);
+typedef int (*vecSscanfFunc)(const RwChar *buffer,
+ const RwChar *format,
+ ...) /* __RWFORMAT__(scanf, 2, 3) */;
+
+typedef struct RwStringFunctions RwStringFunctions;
+
+#if (!defined(DOXYGEN))
+struct RwStringFunctions
+{
+ vecSprintfFunc vecSprintf ;
+ vecVsprintfFunc vecVsprintf;
+ vecStrcpyFunc vecStrcpy;
+ vecStrncpyFunc vecStrncpy;
+ vecStrcatFunc vecStrcat;
+ vecStrncatFunc vecStrncat;
+ vecStrrchrFunc vecStrrchr;
+ vecStrchrFunc vecStrchr;
+ vecStrstrFunc vecStrstr;
+ vecStrcmpFunc vecStrcmp;
+ vecStricmpFunc vecStricmp;
+ vecStrlenFunc vecStrlen;
+ vecStruprFunc vecStrupr;
+ vecStrlwrFunc vecStrlwr;
+ vecStrtokFunc vecStrtok;
+ vecSscanfFunc vecSscanf;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/rwdbgerr.h ---*/
+#define RWECODE(a,b) a,
+
+/* Construct an enum type with all the plugin error codes (for the app to use) */
+enum RwErrorCodePlugin_errcore
+{
+#include "errcore.def"
+ rwLASTERROR_errcore = RWFORCEENUMSIZEINT
+};
+typedef enum RwErrorCodePlugin_errcore RwErrorCodePlugin_errcore;
+
+
+#undef RWECODE
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/resmem.h ---*/
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/bamemory.h ---*/
+#if (defined(RWMEMDEBUG))
+#ifdef _XBOX
+/* Need OutputDebugString macros */
+#include <xtl.h>
+#endif
+#endif
+
+/****************************************************************************
+ Defines
+ */
+
+/*
+ * Debug fill bytes for compatibility with MSVC/C++ debug heap
+ * See
+ * \Program Files\Microsoft Visual Studio\VC98\CRT\SRC\DBGHEAP.C:
+ * static unsigned char _bNoMansLandFill = 0xFD;
+ * // fill no-man's land with this
+ * static unsigned char _bDeadLandFill = 0xDD;
+ * // fill free objects with this
+ * static unsigned char _bCleanLandFill = 0xCD;
+ * // fill new objects with this
+ */
+
+#if (!defined(rwFREELISTNOMANSLANDFILL))
+#define rwFREELISTNOMANSLANDFILL 0xFD
+#endif /* (!defined(rwFREELISTNOMANSLANDFILL)) */
+
+#if (!defined(rwFREELISTDEADLANDFILL))
+#define rwFREELISTDEADLANDFILL 0xDD
+#endif /* (!defined(rwFREELISTDEADLANDFILL)) */
+
+#if (!defined(rwFREELISTCLEANLANDFILL))
+#define rwFREELISTCLEANLANDFILL 0xCD
+#endif /* (!defined(rwFREELISTCLEANLANDFILL)) */
+
+#define RWFREELISTALIGNED(_pData, _freelist) \
+ (! (((RwUInt32)(_pData)) & ((_freelist)->alignment - 1)) )
+
+/*****************************
+ * REGULAR MEMORY ALLOCATION *
+ *****************************/
+
+/**
+ * \ingroup memoryfileinterface
+ * \def RwMalloc
+ * RwMalloc(_s) is a macro for malloc(_s).
+ */
+
+/**
+ * \ingroup memoryfileinterface
+ * \def RwFree
+ * RwFree(_p) is a macro for free(_p).
+ */
+
+/**
+ * \ingroup memoryfileinterface
+ * \def RwCalloc
+ * RwCalloc(_n, _s) is a macro for calloc(_n, _s).
+ */
+
+/**
+ * \ingroup memoryfileinterface
+ * \def RwRealloc
+ * RwRealloc(_p, _s) is a macro for realloc(_p, _s).
+ */
+
+#if ( (defined(RWMEMDEBUG)) && defined(RWDEBUG) )
+
+#if (!defined(RWNOFREELISTS))
+#define RWNOFREELISTS
+#endif /* (!defined(RWNOFREELISTS)) */
+
+#if (defined(rwPLUGIN_ID))
+#define _CLIENT_TAG \
+ ( 0xFFFF & (rwPLUGIN_ID) )
+#endif /* (defined(rwPLUGIN_ID)) */
+
+#if (!defined(_CLIENT_TAG))
+#define _CLIENT_TAG \
+ ( 0xFFFF & (MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x00) ) )
+#endif /* (!defined(_CLIENT_TAG)) */
+
+# if (defined(_MSC_VER))
+# if ((_MSC_VER>=1000) && defined(_DEBUG))
+
+#if (defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC))
+#define _CRTDBG_MAP_ALLOC
+#endif /* defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) */
+#include <crtdbg.h>
+
+#define RwMalloc(_s) \
+ _malloc_dbg((_s), \
+ _CLIENT_BLOCK | ((_CLIENT_TAG)<<16), \
+ __FILE__, \
+ __LINE__)
+
+#define RwFree(_p) \
+ _free_dbg((_p), \
+ _CLIENT_BLOCK | ((_CLIENT_TAG)<<16))
+
+#define RwCalloc(_n, _s) \
+ _calloc_dbg((_n), (_s), \
+ _CLIENT_BLOCK | ((_CLIENT_TAG)<<16), \
+ __FILE__, \
+ __LINE__)
+
+#define RwRealloc(_p, _s) \
+ _realloc_dbg((_p), \
+ (_s), \
+ _CLIENT_BLOCK | ((_CLIENT_TAG)<<16), \
+ __FILE__, \
+ __LINE__)
+
+#define RWCRTORDBGFLAG(_flag) \
+ do \
+ { \
+ int _DbgFlag; \
+ \
+ _DbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); \
+ _DbgFlag |= (_flag); \
+ _CrtSetDbgFlag(_DbgFlag); \
+ } while(0)
+
+#define VALID_HEAP_STR \
+ __FILE__##"("##RW_STRINGIFY_EXPANDED(__LINE__)##"): valid heap\n"
+
+#define RWCRTCHECKMEMORY() \
+ do \
+ { \
+ int valid_heap; \
+ \
+ valid_heap = _CrtCheckMemory(); \
+ _ASSERTE(valid_heap); \
+ } while(0)
+
+/*
+ * if (valid_heap) \
+ * OutputDebugString(VALID_HEAP_STR); \
+ */
+
+#define NO_LEAKS_FOUND_STR \
+ __FILE__##"("##RW_STRINGIFY_EXPANDED(__LINE__)##"): no heap leaks found\n"
+
+#define RWCRTDUMPMEMORYLEAKS() \
+ do \
+ { \
+ int leaks_found; \
+ \
+ leaks_found = _CrtDumpMemoryLeaks(); \
+ _ASSERTE(!leaks_found); \
+ if (!leaks_found) \
+ OutputDebugString(NO_LEAKS_FOUND_STR); \
+ } while(0)
+
+#define HEAP_DIFFERENCES_FOUND_STR \
+ __FILE__##"("##RW_STRINGIFY_EXPANDED(__LINE__)##"): heap differences found\n"
+
+#define NO_DIFFERENCES_FOUND_STR \
+ __FILE__##"("##RW_STRINGIFY_EXPANDED(__LINE__)##"): no heap differences found\n"
+
+#define RWCRTHEAPDIFFERENCESINCE(_Then) \
+ do \
+ { \
+ /* only dump differences when \
+ * there are in fact differences */ \
+ _CrtMemState _Now; \
+ _CrtMemState _Delta; \
+ const int _DbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); \
+ int Differences; \
+ \
+ _CrtMemCheckpoint(&_Now); \
+ _CrtMemDifference(&_Delta, _Then, &_Now); \
+ \
+ (Differences) = ( ( 0 != _Delta.lCounts[_CLIENT_BLOCK] ) || \
+ ( 0 != _Delta.lCounts[_NORMAL_BLOCK] ) || \
+ ( (_DbgFlag & _CRTDBG_CHECK_CRT_DF) && \
+ ( 0 != _Delta.lCounts[_CRT_BLOCK]) ) ); \
+ \
+ if ( (Differences) ) \
+ { \
+ /* difference detected: dump objects since _Then. */ \
+ OutputDebugString(HEAP_DIFFERENCES_FOUND_STR); \
+ _CrtMemDumpAllObjectsSince(_Then); \
+ _CrtMemDumpStatistics(&_Delta); \
+ } \
+ else \
+ { \
+ OutputDebugString(NO_DIFFERENCES_FOUND_STR); \
+ } \
+ } while (0)
+
+#define RWCRTDBGBREAK() \
+ _CrtDbgBreak()
+
+#define RWCRTDOFORALLCLIENTOBJECTS(_f, _c) \
+ _CrtDoForAllClientObjects(_f, _c)
+
+#define RWCRTISMEMORYBLOCK(_p, _t, _r, _f, _l) \
+ _CrtIsMemoryBlock(_p, _t, _r, _f, _l)
+
+#define RWCRTISVALIDHEAPPOINTER(_p) \
+ _CrtIsValidHeapPointer(_p)
+
+#define RWCRTISVALIDPOINTER(_p, _n, _r) \
+ _CrtIsValidPointer(_p, _n, _r)
+
+#define RWCRTMEMCHECKPOINT(_s) \
+ _CrtMemCheckpoint(_s)
+
+#define RWCRTMEMDIFFERENCE(_s1, _s2, _s3) \
+ _CrtMemDifference(_s1, _s2, _s3)
+
+#define RWCRTMEMDUMPALLOBJECTSSINCE(_s) \
+ _CrtMemDumpAllObjectsSince(_s)
+
+#define RWCRTMEMDUMPSTATISTICS(_s) \
+ _CrtMemDumpStatistics(_s)
+
+#define RWCRTSETALLOCHOOK(_f) \
+ _CrtSetAllocHook(_f)
+
+#define RWCRTSETBREAKALLOC(_a) \
+ _CrtSetBreakAlloc(_a)
+
+#define RWCRTSETDBGFLAG(_f) \
+ _CrtSetDbgFlag(_f)
+
+#define RWCRTSETDUMPCLIENT(_f) \
+ _CrtSetDumpClient(_f)
+
+#define RWCRTSETREPORTFILE(_t, _f) \
+ _CrtSetReportFile(_t, _f)
+
+#define RWCRTSETREPORTHOOK(_f) \
+ _CrtSetReportHook(_f)
+
+#define RWCRTSETREPORTMODE(_t, _f) \
+ _CrtSetReportMode(_t, _f)
+
+#if (!defined(_CRTDBG_FLAGS))
+#define _CRTDBG_FLAGS \
+ ( (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_DELAY_FREE_MEM_DF | \
+ _CRTDBG_CHECK_CRT_DF | _CRTDBG_LEAK_CHECK_DF) & \
+ ~(_CRTDBG_CHECK_ALWAYS_DF |_CRTDBG_RESERVED_DF) )
+#endif /* (!defined(_CRTDBG_FLAGS)) */
+
+# endif /* ((_MSC_VER>=1000) && defined(_DEBUG)) */
+# endif /* (defined(_MSC_VER)) */
+
+
+
+#if (!defined(rwDEADPTRFILL))
+#define rwDEADPTRFILL ((void *)0xDDDDDDDD)
+#endif /* (!defined(rwDEADPTRFILL)) */
+
+#endif /* (defined(RWDEBUG) && (defined(RWMEMDEBUG))) */
+
+#if (!defined(rwDEADPTRFILL))
+#define rwDEADPTRFILL (NULL)
+#endif /* (!defined(rwDEADPTRFILL)) */
+
+#if (!defined(RwMalloc))
+#define RwMalloc(_s) ((RWSRCGLOBAL(memoryFuncs).rwmalloc)((_s)))
+#endif /* (!defined(RwMalloc)) */
+
+#if (!defined(RwFree))
+#define RwFree(_p) ((RWSRCGLOBAL(memoryFuncs).rwfree)((_p)))
+#endif /* (!defined(RwFree)) */
+
+#if (!defined(RwCalloc))
+#define RwCalloc(_n, _s) ((RWSRCGLOBAL(memoryFuncs).rwcalloc)((_n), (_s)))
+#endif /* (!defined(RwCalloc)) */
+
+#if (!defined(RwRealloc))
+#define RwRealloc(_p, _s) ((RWSRCGLOBAL(memoryFuncs).rwrealloc)((_p),(_s)))
+#endif /* (!defined(RwRealloc)) */
+
+#if (!defined(RWCRTORDBGFLAG))
+#define RWCRTORDBGFLAG(_flag) /* No op */
+#endif /* (!defined(RWCRTORDBGFLAG)) */
+
+#if (!defined(RWCRTCHECKMEMORY))
+#define RWCRTCHECKMEMORY() /* No Op */
+#endif /* (!defined(RWCRTCHECKMEMORY)) */
+
+#if (!defined(RWCRTDBGBREAK))
+#define RWCRTDBGBREAK() /* No Op */
+#endif /* (!defined(RWCRTDBGBREAK)) */
+
+#if (!defined(RWCRTDOFORALLCLIENTOBJECTS))
+#define RWCRTDOFORALLCLIENTOBJECTS(_f, _c) /* No Op */
+#endif /* (!defined(RWCRTDOFORALLCLIENTOBJECTS)) */
+
+#if (!defined(RWCRTDUMPMEMORYLEAKS))
+#define RWCRTDUMPMEMORYLEAKS() /* No Op */
+#endif /* (!defined(RWCRTDUMPMEMORYLEAKS)) */
+
+#if (!defined(RWCRTHEAPDIFFERENCESINCE))
+#define RWCRTHEAPDIFFERENCESINCE(_Then) /* No Op */
+#endif /* (!defined(RWCRTHEAPDIFFERENCESINCE)) */
+
+#if (!defined(RWCRTISMEMORYBLOCK))
+#define RWCRTISMEMORYBLOCK(_p, _t, _r, _f, _l) (NULL != (_p))
+#endif /* (!defined(RWCRTISMEMORYBLOCK)) */
+
+#if (!defined(RWCRTISVALIDHEAPPOINTER))
+#define RWCRTISVALIDHEAPPOINTER(_p) (NULL != (_p))
+#endif /* (!defined(RWCRTISVALIDHEAPPOINTER)) */
+
+#if (!defined(RWCRTISVALIDPOINTER))
+#define RWCRTISVALIDPOINTER(_p, _n, _r) (NULL != (_p))
+#endif /* (!defined(RWCRTISVALIDPOINTER)) */
+
+#if (!defined(RWCRTMEMCHECKPOINT))
+#define RWCRTMEMCHECKPOINT(_s) /* No Op */
+#endif /* (!defined(RWCRTMEMCHECKPOINT)) */
+
+#if (!defined(RWCRTMEMDIFFERENCE))
+#define RWCRTMEMDIFFERENCE(_s1, _s2, _s3) /* No Op */
+#endif /* (!defined(RWCRTMEMDIFFERENCE)) */
+
+#if (!defined(RWCRTMEMDUMPALLOBJECTSSINCE))
+#define RWCRTMEMDUMPALLOBJECTSSINCE(_s) /* No Op */
+#endif /* (!defined(RWCRTMEMDUMPALLOBJECTSSINCE)) */
+
+#if (!defined(RWCRTMEMDUMPSTATISTICS))
+#define RWCRTMEMDUMPSTATISTICS(_s) (NULL)
+#endif /* (!defined(RWCRTMEMDUMPSTATISTICS)) */
+
+#if (!defined(RWCRTSETALLOCHOOK))
+#define RWCRTSETALLOCHOOK(_f) (NULL)
+#endif /* (!defined(RWCRTSETALLOCHOOK)) */
+
+#if (!defined(RWCRTSETBREAKALLOC))
+#define RWCRTSETBREAKALLOC(_a) (0)
+#endif /* (!defined(RWCRTSETBREAKALLOC)) */
+
+#if (!defined(RWCRTSETDBGFLAG))
+#define RWCRTSETDBGFLAG(_f) (0)
+#endif /* (!defined(RWCRTSETDBGFLAG)) */
+
+#if (!defined(RWCRTSETDUMPCLIENT))
+#define RWCRTSETDUMPCLIENT(_f) (NULL)
+#endif /* (!defined(RWCRTSETDUMPCLIENT)) */
+
+#if (!defined(RWCRTSETREPORTFILE))
+#define RWCRTSETREPORTFILE(_t, _f) (NULL)
+#endif /* (!defined(RWCRTSETREPORTFILE)) */
+
+#if (!defined(RWCRTSETREPORTHOOK))
+#define RWCRTSETREPORTHOOK(_f) (NULL)
+#endif /* (!defined(RWCRTSETREPORTHOOK)) */
+
+#if (!defined(RWCRTSETREPORTMODE))
+#define RWCRTSETREPORTMODE(_t, _f) (0)
+#endif /* (!defined(RWCRTSETREPORTMODE)) */
+
+#if (!defined(RWREGSETBREAKALLOC))
+#define RWREGSETBREAKALLOC(_name) /* No op */
+#endif /* (!defined(RWREGSETBREAKALLOC)) */
+
+#if (!defined(RWREGSETASSERTPRINT))
+#define RWREGSETASSERTPRINT(_name) /* No op */
+#endif /* (!defined(RWREGSETASSERTPRINT)) */
+
+#if (!defined(RWGETWINREGDWORD))
+#define RWGETWINREGDWORD(_env_var, _match) /* No op */
+#endif /* (!defined(RWGETWINREGDWORD)) */
+
+#if (!defined(RWGETWINREGBINARY))
+#define RWGETWINREGBINARY(_env_var, _match) /* No op */
+#endif /* (!defined(RWGETWINREGBINARY)) */
+
+#if (!defined(RWGETWINREGSTRING))
+#define RWGETWINREGSTRING(_env_var, _match) /* No op */
+#endif /* (!defined(RWGETWINREGSTRING)) */
+
+#if (!defined(_CRTDBG_FLAGS))
+#define _CRTDBG_FLAGS 0x33
+#endif /* (!defined(_CRTDBG_FLAGS)) */
+
+/****************************************************************************
+ Global Types
+ */
+
+typedef struct RwMemoryFunctions RwMemoryFunctions;
+/**
+ * \ingroup memoryfileinterface
+ * \struct RwMemoryFunctions
+ * This type represents the memory functions used
+ * by RenderWare. By default, the standard ANSI functions are used. The
+ * application may install an alternative interface providing that it is ANSI
+ * compliant (in RenderWare Graphics see API function RwEngineInit):
+ */
+struct RwMemoryFunctions
+{
+ /* c.f.
+ * Program Files/Microsoft Visual Studio/VC98/Include/MALLOC.H
+ */
+ void *(*rwmalloc)(size_t size); /**< rwmalloc malloc */
+ void (*rwfree)(void *mem); /**< rwfree free */
+ void *(*rwrealloc)(void *mem, size_t newSize); /**< rwrealloc realloc */
+ void *(*rwcalloc)(size_t numObj, size_t sizeObj); /**< calloc calloc */
+};
+
+ /**
+ * \ingroup rwfreelist
+ * The free list was statically allocated
+ *
+ * \see RwFreeListSetFlags
+ */
+#define rwFREELISTFLAG_STATIC 0x00000001
+
+/**
+ * \ingroup rwfreelist
+ * \hideinitializer
+ * Free blocks as soon as they are empty
+ *
+ * \see RwFreeListSetFlags
+ */
+#define rwFREELISTFLAG_FREEBLOCKS 0x00000002
+
+
+typedef struct RwFreeList RwFreeList;
+
+/**
+ * \ingroup rwfreelist
+ * Holds free list info, should be considered opaque. Use API functions to access.
+ */
+struct RwFreeList
+{
+ RwUInt32 entrySize; /**<size of an entry in the free list */
+#if (defined(RWDEBUG) && !defined(DOXYGEN))
+ RwUInt32 nonAlignedEntrySize;
+#endif /* (defined(RWDEBUG) && !defined(DOXYGEN)) */
+ RwUInt32 entriesPerBlock; /**<number of entries per free list block */
+ RwUInt32 heapSize; /**<size of the heap */
+ RwUInt32 alignment; /**<alignment of a free list entry */
+ RwLinkList blockList; /**<list of data blocks */
+ RwUInt32 flags; /**<flags which affect the behavior of the
+ free list <BR>
+ rwFREELISTFLAG_FREEBLOCKS */
+ RwLLLink link; /**<link to the free list linked list */
+
+#if (defined(RWDEBUG) && !defined(DOXYGEN))
+ const RwChar *fileCreate;
+ RwUInt32 lineCreate;
+#endif /* (defined(RWDEBUG) && !defined(DOXYGEN)) */
+};
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwfreelist
+ * \ref RwFreeListCallBack represents
+ * the function called from \ref RwFreeListForAllUsed for all used entries in a
+ * given free list.
+ *
+ * \param pMem Pointer to the start of the current entries.
+ *
+ * \param pData User-defined data pointer.
+ *
+ * \see RwFreeListForAllUsed
+ *
+ */
+#endif /* RWADOXYGENEXTERNAL */
+
+typedef void (*RwFreeListCallBack) (void *pMem, void *pData);
+typedef void *(*RwMemoryAllocFn) (RwFreeList * fl);
+typedef RwFreeList *(*RwMemoryFreeFn) (RwFreeList * fl, void *pData);
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwMemoryFunctions *RwOsGetMemoryInterface(void);
+
+/*************
+ * FREELISTS *
+ *************/
+
+/* Allocation and freeing */
+#if (defined(RWDEBUG) && !defined(DOXYGEN))
+
+extern RwFreeList *_rwFreeListCreate(RwInt32 entrySize,
+ RwInt32 entriesPerBlock,
+ RwInt32 alignment,
+ const RwChar *fileCreate,
+ RwUInt32 lineCreate );
+
+#define RwFreeListCreate(entrySize, entriesPerBlock, alignment) \
+ _rwFreeListCreate(entrySize, \
+ entriesPerBlock, \
+ alignment, \
+ __FILE__, \
+ __LINE__)
+#else /* (defined(RWDEBUG) && !defined(DOXYGEN)) */
+
+/* legacy freelist create */
+
+extern RwFreeList *RwFreeListCreate(RwInt32 entrySize,
+ RwInt32 entriesPerBlock,
+ RwInt32 alignment);
+#endif /* (defined(RWDEBUG) && !defined(DOXYGEN)) */
+
+extern RwFreeList*
+RwFreeListCreateAndPreallocateSpace(RwInt32 entrySize,
+ RwInt32 entriesPerBlock,
+ RwInt32 alignment,
+ RwInt32 numBlocksToPreallocate,
+ RwFreeList *inPlaceSpaceForFreeListStruct );
+
+extern RwBool RwFreeListDestroy(RwFreeList * freelist);
+
+extern void RwFreeListSetFlags( RwFreeList *freeList, RwUInt32 flags );
+extern RwUInt32 RwFreeListGetFlags( RwFreeList *freeList );
+
+/* Garbage collection/enumeration */
+extern RwInt32 RwFreeListPurge(RwFreeList * freelist);
+extern RwFreeList *RwFreeListForAllUsed(RwFreeList * freelist,
+ RwFreeListCallBack
+ fpCallBack, void *pData);
+extern RwInt32 RwFreeListPurgeAllFreeLists(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#if (defined(RWDEBUG) && defined(RWNOFREELISTS) && !defined(RWKEEPFREELISTS))
+
+#if ((defined(__MWERKS__) || defined(__GNUC__)) && defined(__R5900__))
+
+/*
+ * for more on memalign, see
+ * http://www.gnu.org/manual/glibc-2.0.6/html_chapter/libc_3.html#SEC28
+ */
+#include <rtdbmalloc.h>
+
+#define RwFreeListAlloc(_f) \
+ memalign(((_f)->alignment), (_f)->entrySize)
+
+#else /* ((defined(__MWERKS__) || defined(__GNUC__)) && defined(__R5900__)) */
+
+#define RwFreeListAlloc(_f) \
+ RwMalloc((_f)->entrySize)
+
+#endif /* ((defined(__MWERKS__) || defined(__GNUC__)) && defined(__R5900__)) */
+
+#define RwFreeListFree(_f, _p) \
+ RwFree((_p))
+
+#endif /* (defined(RWDEBUG) && defined(RWNOFREELISTS) && !defined(RWKEEPFREELISTS)) */
+
+#if (!defined(RwFreeListAlloc))
+#define RwFreeListAlloc(_f) \
+ RWSRCGLOBAL(memoryAlloc)(_f)
+#endif /* (!defined(RwFreeListAlloc)) */
+
+#if (!defined(RwFreeListFree))
+#define RwFreeListFree(_f, _p) \
+ RWSRCGLOBAL(memoryFree)(_f, _p)
+#endif /* (!defined(RwFreeListFree)) */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/bastream.h ---*/
+
+/****************************************************************************
+ Defines
+ */
+
+#define rwSTREAMSTACKSIZE 512
+
+/****************************************************************************
+ Global Types
+ */
+
+/**
+ * \ingroup rwstream
+ * \ref RwStreamType
+ * This type represents the different types of stream that
+ * can be used.
+ * See API section \ref rwstream
+ */
+enum RwStreamType
+{
+ rwNASTREAM = 0, /**<Invalid stream type */
+ rwSTREAMFILE, /**<File */
+ rwSTREAMFILENAME, /**<File name */
+ rwSTREAMMEMORY, /**<Memory*/
+ rwSTREAMCUSTOM, /**<Custom */
+ rwSTREAMTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwStreamType RwStreamType;
+
+/**
+ * \ingroup rwstream
+ * \ref RwStreamAccessType
+ * This type represents the options available for
+ * accessing a stream when it is opened.
+ * See API section \ref rwstream */
+enum RwStreamAccessType
+{
+ rwNASTREAMACCESS = 0, /**<Invalid stream access */
+ rwSTREAMREAD, /**<Read */
+ rwSTREAMWRITE, /**<Write */
+ rwSTREAMAPPEND, /**<Append */
+ rwSTREAMACCESSTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwStreamAccessType RwStreamAccessType;
+
+/* Memory stream */
+/**
+ * \ingroup rwstream
+ * \struct RwStreamMemory
+ * This should be considered an opaque type.
+ * Use the RwStream API functions to access.
+ */
+typedef struct RwStreamMemory RwStreamMemory;
+#if (!defined(DOXYGEN))
+struct RwStreamMemory
+{
+ RwUInt32 position; /* Current 'memory' position 0 is first byte */
+ RwUInt32 nSize; /* Space allocated currently */
+ RwUInt8 *memBlock; /* Current memory block pointer */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+
+typedef union RwStreamFile RwStreamFile;
+/**
+ * \ingroup rwstream
+ * \union RwStreamFile
+ * This type is used to represent a file pointer for
+ * accessing data on disk through the stream mechanism.
+ * See API section \ref rwstream. */
+union RwStreamFile
+{
+ void *fpFile; /**< file pointer */
+ const void *constfpFile; /**< const file pointer */
+};
+
+
+/* Custom stream function pointer types */
+typedef RwBool(*rwCustomStreamFnClose) (void *data);
+typedef RwUInt32(*rwCustomStreamFnRead) (void *data, void *buffer,
+ RwUInt32 length);
+typedef RwBool(*rwCustomStreamFnWrite) (void *data,
+ const void *buffer,
+
+ RwUInt32 length);
+typedef RwBool(*rwCustomStreamFnSkip) (void *data,
+
+ RwUInt32 offset);
+
+/* Custom stream */
+/**
+ * \ingroup rwstream
+ * \struct RwStreamCustom
+ * This should be considered an opaque type.
+ * Use the RwStream API functions to access.
+ */
+typedef struct RwStreamCustom RwStreamCustom;
+#if (!defined(DOXYGEN))
+struct RwStreamCustom
+{
+ rwCustomStreamFnClose sfnclose;
+ rwCustomStreamFnRead sfnread;
+ rwCustomStreamFnWrite sfnwrite;
+ rwCustomStreamFnSkip sfnskip;
+ void *data;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+/* Stream */
+
+typedef union RwStreamUnion RwStreamUnion;
+/**
+ * \ingroup rwstream
+ * \union RwStreamUnion
+ * The union of all supported stream types
+ */
+union RwStreamUnion
+{
+ RwStreamMemory memory; /**< memory */
+ RwStreamFile file; /**< file */
+ RwStreamCustom custom; /**< custom */
+};
+
+/**
+ * \ingroup rwstream
+ * \struct RwStream
+ * Binary stream for reading or writing object data.
+ * This should be considered an opaque type.
+ * Use the RwStream API functions to access.
+ */
+typedef struct RwStream RwStream;
+#if (!defined(DOXYGEN))
+struct RwStream
+{
+ RwStreamType type;
+ RwStreamAccessType accessType;
+ RwInt32 position;
+ RwStreamUnion Type;
+ RwBool rwOwned;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+
+typedef struct RwMemory RwMemory;
+/**
+ * \ingroup rwstream
+ * \struct RwMemory
+ * This type represents a block of allocated memory.
+ * It is used to specify an area of memory connected to a stream of type
+ * rwSTREAMMEMORY.
+ * See \ref rwstream */
+struct RwMemory
+{
+ RwUInt8 *start; /**< starting address */
+ RwUInt32 length; /**< length in bytes*/
+};
+
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern void
+RwStreamSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+/* Open/Close streams */
+
+extern RwStream *
+_rwStreamInitialize(RwStream *stream,
+ RwBool rwOwned,
+ RwStreamType type,
+ RwStreamAccessType accessType,
+ const void *pData);
+
+extern RwStream *
+RwStreamOpen(RwStreamType type,
+ RwStreamAccessType accessType,
+ const void *pData);
+
+extern RwBool
+RwStreamClose(RwStream * stream,
+ void *pData);
+
+
+/* Stream read/write */
+extern RwUInt32
+RwStreamRead(RwStream * stream,
+ void *buffer,
+ RwUInt32 length);
+
+extern RwStream *
+RwStreamWrite(RwStream * stream,
+ const void *buffer,
+ RwUInt32 length);
+
+
+/* Stream skipping */
+extern RwStream *
+RwStreamSkip(RwStream * stream,
+ RwUInt32 offset);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/batkreg.h ---*/
+
+/****************************************************************************
+ Global Types
+ */
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwplugin
+ * \ref RwPluginDataChunkWriteCallBack represents the function
+ * registered by \ref RwCameraRegisterPluginStream, etc. as the function that
+ * writes extension data to a binary stream.
+ *
+ * \param stream Pointer to the binary stream
+ *
+ * \param binaryLength A RwInt32 value equal to the binary
+ * size (in bytes) of the extension data that will be written to the binary
+ * stream.
+ *
+ * \param object Pointer to the object containing the extension
+ * data.
+ *
+ * \param offsetInObject A RwInt32 value equal to the byte
+ * offset of the extension data in the object.
+ *
+ * \param sizeInObject A RwInt32 value equal to the size
+ * (in bytes) of the extension data.
+ *
+ * \return Pointer to the stream
+ */
+typedef RwStream *(*RwPluginDataChunkWriteCallBack)(RwStream *stream, RwInt32 binaryLength, const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject);
+
+/**
+ * \ingroup rwplugin
+ * \ref RwPluginDataChunkReadCallBack represents the function
+ * registered by \ref RwCameraRegisterPluginStream, etc. as the function that
+ * reads extension data from a binary stream.
+ *
+ * \param stream Pointer to the binary stream
+ *
+ * \param binaryLength A RwInt32 value equal to the binary
+ * size (in bytes) of the extension data that will be read from a binary
+ * stream.
+ *
+ * \param object Pointer to the object containing the extension
+ * data.
+ *
+ * \param offsetInObject A RwInt32 value equal to the byte
+ * offset of the extension data in the object.
+ *
+ * \param sizeInObject A RwInt32 value equal to the size
+ * (in bytes) of the extension data.
+ *
+ * \return Pointer to the stream
+ */
+typedef RwStream *(*RwPluginDataChunkReadCallBack)(RwStream *stream, RwInt32 binaryLength, void *object, RwInt32 offsetInObject, RwInt32 sizeInObject);
+
+/**
+ * \ingroup rwplugin
+ * \ref RwPluginDataChunkGetSizeCallBack represents the callback
+ * registered by \ref RwCameraRegisterPluginStream, etc. as the function that
+ * determines the binary size of the extension data.
+ *
+ * \param object Pointer to the object containing the extension data.
+ *
+ * \param offsetInObject A RwInt32 value equal to the byte
+ * offset of the extension data in the object.
+ *
+ * \param sizeInObject A RwInt32 value equal to the size
+ * (in bytes) of the extension data.
+ *
+ * \return A RwInt32 value equal to the size in bytes of the plugin extension data.
+ */
+typedef RwInt32(*RwPluginDataChunkGetSizeCallBack)(const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject);
+
+/**
+ * \ingroup rwplugin
+ * \ref RwPluginDataChunkAlwaysCallBack represents the callback
+ * registered by \ref RwCameraSetStreamAlwaysCallBack, etc. as the
+ * function that is called after the reading of plugin stream data is
+ * finished (useful to set up plugin data for plugins that found no
+ * data in the stream, but that cannot set up the data during the
+ * \ref RwPluginObjectConstructor callback).
+ *
+ * \param object Pointer to the object containing the extension data.
+ *
+ * \param offsetInObject A RwInt32 value equal to the byte
+ * offset of the extension data in the object.
+ *
+ * \param sizeInObject A RwInt32 value equal to the size
+ * (in bytes) of the extension data.
+ *
+ * \return Returns TRUE if successful, FALSE otherwise.
+ */
+typedef RwBool(*RwPluginDataChunkAlwaysCallBack)(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject);
+
+/**
+ * \ingroup rwplugin
+ * \ref RwPluginDataChunkRightsCallBack represents the callback
+ * registered by RwCameraSetStreamRightsCallBack, etc. as the
+ * function that is called after the reading of plugin stream data is
+ * finished, and the object finalised, if and only if the object's rights
+ * id was equal to that of the plugin registering the call.
+ * For convience the extension data is passed to the callback.
+ *
+ * \param object Pointer to the object containing the extension data.
+ *
+ * \param offsetInObject A RwInt32 value equal to the byte
+ * offset of the extension data in the object.
+ *
+ * \param sizeInObject A RwInt32 value equal to the size
+ * (in bytes) of the extension data.
+ *
+ * \param extraData An RwUInt32 writen with the plugin id.
+ *
+ * \return Returns TRUE if successful, FALSE otherwise.
+ */
+typedef RwBool(*RwPluginDataChunkRightsCallBack)(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject, RwUInt32 extraData);
+
+/**
+ * \ingroup rwplugin
+ * \ref RwPluginObjectConstructor represents the callback
+ * registered by \ref RwEngineRegisterPlugin, \ref RwCameraRegisterPlugin, etc.
+ * as the function that initializes either the global extension data (in the
+ * case of \ref RwEngineRegisterPlugin) or the object extension data (in all
+ * other cases). Registered by \ref RwCameraSetStreamAlwaysCallBack, etc.
+ *
+ * \param object Pointer to the object (global or otherwise)
+ * that contains the extension data.
+ *
+ * \param offsetInObject A RwInt32 value equal to the
+ * byte offset of the extension data in the object.
+ *
+ * \param sizeInObject A RwInt32 value equal to the size
+ * (in bytes) of the extension data.
+ *
+ * \return Pointer to the object
+ */
+typedef void *(*RwPluginObjectConstructor)(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject);
+
+/**
+ * \ingroup rwplugin
+ * \ref RwPluginObjectCopy represents the callback registered by
+ * \ref RwCameraRegisterPlugin, etc. as the function that copies the object
+ * extension data when an object is duplicated.
+ *
+ * \param dstObject Pointer to the destination object that will
+ * receive the extension data.
+ *
+ * \param srcObject Pointer to the source object containing
+ * extension data.
+ *
+ * \param offsetInObject A RwInt32 value equal to the byte offset
+ * of the extension data in the object.
+ *
+ * \param sizeInObject A RwInt32 value equal to the size
+ * (in bytes) of the extension data.
+ *
+ * \return Pointer to the object
+ */
+typedef void *(*RwPluginObjectCopy)(void *dstObject, const void *srcObject, RwInt32 offsetInObject, RwInt32 sizeInObject);
+
+/**
+ * \ingroup rwplugin
+ * \ref RwPluginObjectDestructor represents the callback registered
+ * by \ref RwEngineRegisterPlugin, \ref RwCameraRegisterPlugin, etc. as the
+ * function that destroys either the global extension data (in the case of
+ * \ref RwEngineRegisterPlugin) or the object extension data (in all other
+ * cases).
+ *
+ * \param object Pointer to the object (global or otherwise)
+ * containing the extension data.
+ *
+ * \param offsetInObject A RwInt32 value equal to the byte
+ * offset of the extension data in the object.
+ *
+ * \param sizeInObject A RwInt32 value equal to the size
+ * (in bytes) of the extension data.
+ *
+ * \return Pointer to the object.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+
+typedef void *(*RwPluginObjectDestructor)(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject);
+
+typedef void *(*RwPluginErrorStrCallBack)(void *);
+
+typedef struct RwPluginRegistry RwPluginRegistry;
+typedef struct RwPluginRegEntry RwPluginRegEntry;
+
+#if (!defined(DOXYGEN))
+struct RwPluginRegistry
+{
+ RwInt32 sizeOfStruct;
+ RwInt32 origSizeOfStruct;
+ RwInt32 maxSizeOfStruct;
+ RwInt32 staticAlloc;
+ RwPluginRegEntry *firstRegEntry;
+ RwPluginRegEntry *lastRegEntry;
+};
+
+struct RwPluginRegEntry
+{
+ RwInt32 offset;
+ RwInt32 size;
+ RwUInt32 pluginID;
+ RwPluginDataChunkReadCallBack readCB;
+ RwPluginDataChunkWriteCallBack writeCB;
+ RwPluginDataChunkGetSizeCallBack getSizeCB;
+ RwPluginDataChunkAlwaysCallBack alwaysCB;
+ RwPluginDataChunkRightsCallBack rightsCB;
+ RwPluginObjectConstructor constructCB;
+ RwPluginObjectDestructor destructCB;
+ RwPluginObjectCopy copyCB;
+ RwPluginErrorStrCallBack errStrCB;
+ RwPluginRegEntry *nextRegEntry;
+ RwPluginRegEntry *prevRegEntry;
+ RwPluginRegistry *parentRegistry;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+/* Registering toolkits and allocating memory */
+extern void
+RwPluginRegistrySetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern RwBool
+_rwPluginRegistrySetStaticPluginsSize(RwPluginRegistry * reg,
+ RwInt32 size);
+extern RwInt32
+_rwPluginRegistryAddPlugin(RwPluginRegistry * reg,
+ RwInt32 size,
+ RwUInt32 pluginID,
+ RwPluginObjectConstructor constructCB,
+ RwPluginObjectDestructor destructCB,
+ RwPluginObjectCopy copyCB);
+extern RwInt32
+_rwPluginRegistryGetPluginOffset(const RwPluginRegistry *reg,
+ RwUInt32 pluginID);
+
+/* Initializing/De-initializing instances */
+extern const
+RwPluginRegistry *_rwPluginRegistryInitObject(const RwPluginRegistry * reg,
+ void *object);
+extern const
+RwPluginRegistry *_rwPluginRegistryDeInitObject(const RwPluginRegistry * reg,
+ void *object);
+extern const
+RwPluginRegistry *_rwPluginRegistryCopyObject(const RwPluginRegistry * reg,
+ void *dstObject,
+ const void *srcObject);
+
+#ifdef RWDEBUG
+extern RwBool
+_rwPluginRegistryValidateObject(const RwPluginRegistry * reg,
+ const void *object);
+#endif /* RWDEBUG */
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* Compatibility macros */
+
+#define rwPluginRegistryOpen() \
+ _rwPluginRegistryOpen()
+#define rwPluginRegistryClose() \
+ _rwPluginRegistryClose()
+#define rwPluginRegistrySetStaticPluginsSize(reg, size) \
+ _rwPluginRegistrySetStaticPluginsSize(reg, size)
+#define rwPluginRegistryAddPlugin(reg, size, pluginID, constructCB, destructCB, copyCB) \
+ _rwPluginRegistryAddPlugin(reg, size, pluginID, constructCB, destructCB, copyCB)
+#define rwPluginRegistryGetPluginOffset(reg, pluginID) \
+ _rwPluginRegistryGetPluginOffset(reg, pluginID)
+#define rwPluginRegistryInitObject(reg, object) \
+ _rwPluginRegistryInitObject(reg, object)
+#define rwPluginRegistryDeInitObject(reg, object) \
+ _rwPluginRegistryDeInitObject(reg, object)
+#define rwPluginRegistryCopyObject(reg, dstObject, srcObject) \
+ _rwPluginRegistryCopyObject(reg, dstObject, srcObject)
+#define rwPluginRegistryValidateObject(reg, object) \
+ _rwPluginRegistryValidateObject(reg, object)
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/batkbin.h ---*/
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Plugin binary stream stuff */
+extern RwInt32 _rwPluginRegistryAddPluginStream(
+ RwPluginRegistry *reg,
+ RwUInt32 pluginID,
+ RwPluginDataChunkReadCallBack readCB,
+ RwPluginDataChunkWriteCallBack writeCB,
+ RwPluginDataChunkGetSizeCallBack getSizeCB);
+extern RwInt32 _rwPluginRegistryAddPlgnStrmlwysCB(
+ RwPluginRegistry *reg,
+ RwUInt32 pluginID,
+ RwPluginDataChunkAlwaysCallBack alwaysCB);
+extern RwInt32 _rwPluginRegistryAddPlgnStrmRightsCB(
+ RwPluginRegistry *reg,
+ RwUInt32 pluginID,
+ RwPluginDataChunkRightsCallBack rightsCB);
+extern const RwPluginRegistry *_rwPluginRegistryReadDataChunks(const RwPluginRegistry *reg,
+ RwStream *stream,
+ void *object);
+extern const RwPluginRegistry *_rwPluginRegistryWriteDataChunks(const RwPluginRegistry *reg,
+ RwStream *stream,
+ const void *object);
+extern const RwPluginRegistry *_rwPluginRegistrySkipDataChunks(const RwPluginRegistry * reg,
+ RwStream * stream);
+extern RwInt32 _rwPluginRegistryGetSize(const RwPluginRegistry *reg, const void *object);
+extern const RwPluginRegistry *_rwPluginRegistryInvokeRights(const RwPluginRegistry *reg,
+ RwUInt32 id,
+ void *obj,
+ RwUInt32 extraData);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* Compatibility macros */
+
+#define rwPluginRegistryAddPluginStream(reg, pluginID, readCB, writeCB, getSizeCB) \
+ _rwPluginRegistryAddPluginStream(reg, pluginID, readCB, writeCB, getSizeCB)
+#define rwPluginRegistryAddPluginStreamAlwaysCB(reg, pluginID, alwaysCB) \
+ _rwPluginRegistryAddPlgnStrmlwysCB(reg, pluginID, alwaysCB)
+#define rwPluginRegistryReadDataChunks(reg, stream, object) \
+ _rwPluginRegistryReadDataChunks(reg, stream, object)
+#define rwPluginRegistryWriteDataChunks(reg, stream, object) \
+ _rwPluginRegistryWriteDataChunks(reg, stream, object)
+#define rwPluginRegistrySkipDataChunks(reg, stream) \
+ _rwPluginRegistrySkipDataChunks(reg, stream)
+#define rwPluginRegistryGetSize(reg, object) \
+ _rwPluginRegistryGetSize(reg, object)
+
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/bamatrix.h ---*/
+
+/****************************************************************************
+ Defines
+ */
+
+#define RWMATRIXALIGNMENT(_mat) \
+ (! (((rwMATRIXALIGNMENT)-1) & ((RwUInt32)(_mat))))
+
+#if (defined(RWMATRIXMONITOR))
+# if (defined(_MSC_VER))
+# if ((_MSC_VER>=1000) && defined(_DEBUG))
+
+typedef char MatrixString[1024];
+
+#define RWMATRIXPRINT(_matrix) \
+MACRO_START \
+{ \
+ MatrixString message; \
+ MatrixString output; \
+ \
+ if (NULL != (_matrix)) \
+ { \
+ const RwV3d * const _x = &(_matrix)->right; \
+ const RwV3d * const _y = &(_matrix)->up; \
+ const RwV3d * const _z = &(_matrix)->at; \
+ const RwV3d * const _w = &(_matrix)->pos; \
+ \
+ _snprintf(message, sizeof(MatrixString), \
+ "[ [ %8.4f, %8.4f, %8.4f, %8.4f ]\n" \
+ " [ %8.4f, %8.4f, %8.4f, %8.4f ]\n" \
+ " [ %8.4f, %8.4f, %8.4f, %8.4f ]\n" \
+ " [ %8.4f, %8.4f, %8.4f, %8.4f ] ]\n" \
+ " %08x == flags\n", \
+ _x->x, _x->y, _x->z, (RwReal) 0, \
+ _y->x, _y->y, _y->z, (RwReal) 0, \
+ _z->x, _z->y, _z->z, (RwReal) 0, \
+ _w->x, _w->y, _w->z, (RwReal) 1, \
+ (_matrix)->flags); \
+ } \
+ else \
+ { \
+ _snprintf(message, sizeof(MatrixString), \
+ "NULL"); \
+ } \
+ \
+ _snprintf(output, sizeof(MatrixString), \
+ "%s(%d): %s [%p] ==\n%s\n", \
+ __FILE__, __LINE__, \
+ #_matrix, _matrix, message); \
+ \
+ OutputDebugString(RWSTRING(output)); \
+} \
+MACRO_STOP
+
+# endif /* ((_MSC_VER>=1000) && defined(_DEBUG)) */
+# endif /* (defined(_MSC_VER)) */
+#endif /* (defined(RWMATRIXMONITOR)) */
+
+#if (!(defined(RWMATRIXPRINT)))
+#define RWMATRIXPRINT(_matrix) /* No op */
+#endif /* (!(defined(RWMATRIXPRINT))) */
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwmatrix
+ * enum RwOpCombineType
+ * This type represents a combination operator which
+ * can be applied to frames and matrices.
+ * The operator determines the order
+ * in which one object is combined with another
+ */
+#endif /* RWADOXYGENEXTERNAL */
+
+enum RwOpCombineType
+{
+ rwCOMBINEREPLACE = 0, /**<Replace -
+ all previous transformations are lost */
+ rwCOMBINEPRECONCAT, /**<Pre-concatenation -
+ the given transformation is applied
+ before all others */
+ rwCOMBINEPOSTCONCAT, /**<Post-concatenation -
+ the given transformation is applied
+ after all others */
+ rwOPCOMBINETYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+
+/*
+ * RwOpCombineType typedef for enum RwOpCombineType
+ */
+typedef enum RwOpCombineType RwOpCombineType;
+
+/* External flags (bits 0-15) */
+
+/* Internal flags (bits 16-31) */
+enum RwMatrixType
+{
+ rwMATRIXTYPENORMAL = 0x00000001,
+ rwMATRIXTYPEORTHOGONAL = 0x00000002,
+ rwMATRIXTYPEORTHONORMAL = 0x00000003,
+ rwMATRIXTYPEMASK = 0x00000003,
+ rwMATRIXTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwMatrixType RwMatrixType;
+
+enum RwMatrixFlag
+{
+ rwMATRIXINTERNALIDENTITY = 0x00020000,
+ rwMATRIXFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwMatrixFlag RwMatrixFlag;
+
+/* Flags describing what will optimize for */
+enum RwMatrixOptimizations
+{
+ rwMATRIXOPTIMIZE_IDENTITY = 0x00020000,
+ rwMATRIXOPTIMIZATIONSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwMatrixOptimizations RwMatrixOptimizations;
+
+/****************************************************************************
+ Global Types
+ */
+
+#if (!defined(DOXYGEN))
+struct RwMatrixTag
+{
+ /* These are padded to be 16 byte quantities per line */
+ RwV3d right;
+ RwUInt32 flags;
+ RwV3d up;
+ RwUInt32 pad1;
+ RwV3d at;
+ RwUInt32 pad2;
+ RwV3d pos;
+ RwUInt32 pad3;
+};
+
+/*
+ * RwMatrix & RwMatrixTag must be different otherwise the alignment
+ * directive is ignored when compiling under C++ on Visual C
+ */
+typedef struct RwMatrixTag RWALIGN(RwMatrix, rwMATRIXALIGNMENT);
+
+#else
+
+/*
+ * RwMatrix must appear as the struct name & the typedef,
+ * otherwise Doxygen puts RwMatrixTag in the API ref instead of RwMatrix!
+ */
+
+/**
+ * \ingroup rwmatrix
+ * \struct RwMatrix
+ * Matrix to define transformations.
+ * This should be considered an opaque type.
+ * Use the RwMatrix API functions to access.
+ */
+typedef struct RwMatrix RWALIGN(RwMatrix, rwMATRIXALIGNMENT);
+#endif /* (!defined(DOXYGEN)) */
+
+#if (!defined(RwMatrixCopyMacro))
+#define RwMatrixCopyMacro(_target, _source) \
+ ( *(_target) = *(_source) )
+#endif /* (!defined(RwMatrixCopyMacro)) */
+
+#if (!defined(RwMatrixSetIdentityMacro))
+#define RwMatrixSetIdentityMacro(m) \
+MACRO_START \
+{ \
+ (m)->right.x = (m)->up.y = (m)->at.z = (RwReal)((1.0)); \
+ (m)->right.y = (m)->right.z = (m)->up.x = (RwReal)((0.0)); \
+ (m)->up.z = (m)->at.x = (m)->at.y = (RwReal)((0.0)); \
+ (m)->pos.x = (m)->pos.y = (m)->pos.z = (RwReal)((0.0)); \
+ rwMatrixSetFlags((m), \
+ rwMatrixGetFlags(m) | \
+ (rwMATRIXINTERNALIDENTITY | \
+ rwMATRIXTYPEORTHONORMAL)); \
+} \
+MACRO_STOP
+#endif /* (!defined(RwMatrixSetIdentityMacro)) */
+
+typedef void (RWASMCALL * rwMatrixMultFn) (RwMatrix * dstMat,
+ const RwMatrix * matA,
+ const RwMatrix * matB);
+
+typedef struct RwMatrixTolerance RwMatrixTolerance;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwmatrix
+ * \struct RwMatrixTolerance
+ * Holds tolerances for matrix optimizations with \ref RwMatrixOptimize
+ */
+#endif /* RWADOXYGENEXTERNAL */
+struct RwMatrixTolerance
+{
+ RwReal Normal;
+ /**< Tolerance within which matrix is deemed to be normal */
+ RwReal Orthogonal;
+ /**< Tolerance within which matrix is deemed to be orthogonal */
+ RwReal Identity;
+ /**< Tolerance within which matrix is deemed to be identity */
+};
+
+
+/****************************************************************************
+ Function prototypes
+ */
+
+/* Matrix operations */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwBool
+RwEngineGetMatrixTolerances(RwMatrixTolerance * const tolerance);
+
+extern RwBool
+RwEngineSetMatrixTolerances(const RwMatrixTolerance * const tolerance);
+
+/* Update */
+#define rwMatrixSetFlags(m, flagsbit) ((m)->flags = (flagsbit))
+#define rwMatrixGetFlags(m) ((m)->flags)
+#define rwMatrixTestFlags(m, flagsbit) ((m)->flags & (RwInt32)(flagsbit))
+
+/* Creation/destruction */
+extern void
+RwMatrixSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
+
+extern RwBool
+RwMatrixDestroy(RwMatrix * mpMat);
+
+extern RwMatrix *
+RwMatrixCreate(void);
+
+#ifdef RWDEBUG
+
+/* Functions for debug */
+extern void
+RwMatrixCopy(RwMatrix * dstMatrix, const RwMatrix * srcMatrix);
+
+extern void
+RwMatrixSetIdentity(RwMatrix * matrix);
+
+#else /* RWDEBUG */
+
+#define RwMatrixCopy(dst, src) RwMatrixCopyMacro(dst, src)
+#define RwMatrixSetIdentity(m) RwMatrixSetIdentityMacro(m)
+
+#endif /* RWDEBUG */
+
+/* Matrix multiply */
+extern RwMatrix *
+RwMatrixMultiply(RwMatrix * matrixOut,
+ const RwMatrix * MatrixIn1,
+ const RwMatrix * matrixIn2);
+
+extern RwMatrix *
+RwMatrixTransform(RwMatrix * matrix,
+ const RwMatrix * transform,
+ RwOpCombineType combineOp);
+
+/* Normalise */
+extern RwMatrix *
+RwMatrixOrthoNormalize(RwMatrix * matrixOut,
+ const RwMatrix * matrixIn);
+
+/* Inversion */
+extern RwMatrix *
+RwMatrixInvert(RwMatrix * matrixOut,
+ const RwMatrix * matrixIn);
+
+/* Unary matrix operations */
+extern RwMatrix *
+RwMatrixScale(RwMatrix * matrix,
+ const RwV3d * scale,
+ RwOpCombineType combineOp);
+
+extern RwMatrix *
+RwMatrixTranslate(RwMatrix * matrix,
+ const RwV3d * translation,
+ RwOpCombineType combineOp);
+
+extern RwMatrix *
+RwMatrixRotate(RwMatrix * matrix,
+ const RwV3d * axis,
+ RwReal angle,
+ RwOpCombineType combineOp);
+
+extern RwMatrix *
+RwMatrixRotateOneMinusCosineSine(RwMatrix * matrix,
+ const RwV3d * unitAxis,
+ RwReal oneMinusCosine,
+ RwReal sine,
+ RwOpCombineType combineOp);
+
+/* Query what the matrix is */
+extern const RwMatrix *RwMatrixQueryRotate(const RwMatrix * matrix,
+ RwV3d * unitAxis,
+ RwReal * angle,
+ RwV3d * center);
+
+/* Get components */
+#ifndef RWDEBUG
+
+#define RwMatrixGetRight(m) (&(m)->right)
+#define RwMatrixGetUp(m) (&(m)->up)
+#define RwMatrixGetAt(m) (&(m)->at)
+#define RwMatrixGetPos(m) (&(m)->pos)
+
+#else /* RWDEBUG */
+
+extern RwV3d *
+RwMatrixGetRight(RwMatrix * matrix);
+
+extern RwV3d *
+RwMatrixGetUp(RwMatrix * matrix);
+
+extern RwV3d *
+RwMatrixGetAt(RwMatrix * matrix);
+
+extern RwV3d *
+RwMatrixGetPos(RwMatrix * matrix);
+
+#endif /* RWDEBUG */
+
+/* Update the internal matrix state wrt its elements */
+extern RwMatrix *
+RwMatrixUpdate(RwMatrix * matrix);
+
+/* Update the internal matrix flags wrt its elements */
+extern RwMatrix *
+RwMatrixOptimize(RwMatrix * matrix,
+ const RwMatrixTolerance *
+ tolerance);
+
+extern RwReal
+_rwMatrixDeterminant(const RwMatrix * matrix);
+
+extern RwReal
+_rwMatrixNormalError(const RwMatrix * matrix);
+
+extern RwReal
+_rwMatrixOrthogonalError(const RwMatrix * matrix);
+
+extern RwReal
+_rwMatrixIdentityError(const RwMatrix * matrix);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* Compatibility macros */
+
+#define rwMatrixSetOptimizations(optimizeFlags) \
+ _rwMatrixSetOptimizations(optimizeFlags)
+
+#define rwMatrixSetMultFn(multMat) \
+ _rwMatrixSetMultFn(multMat)
+
+#define rwMatrixOpen(instance, offset, size) \
+ _rwMatrixOpen(instance, offset, size)
+
+#define rwMatrixClose(instance, offset, size) \
+ _rwMatrixClose(instance, offset, size)
+
+/* Initialisation/deinitialisation */
+#define rwMatrixInitialize(m, t) \
+MACRO_START \
+{ \
+ rwMatrixSetFlags((m), (t)); \
+} \
+MACRO_STOP
+
+#define rwMatrixIsNormal(_matrix, _epsilon) \
+ ( (_epsilon) >= _rwMatrixNormalError(_matrix) )
+
+#define rwMatrixIsOrthogonal(_matrix, _epsilon) \
+ ( (_epsilon) >= _rwMatrixOrthogonalError(_matrix) )
+
+#define rwMatrixIsOrthonormal(_matrix, _epsilon) \
+ ( rwMatrixIsNormal(_matrix, _epsilon) && \
+ rwMatrixIsOrthogonal(_matrix, _epsilon) )
+
+#define rwMatrixIsOrthonormalPositive(_matrix, _epsilon) \
+ ( rwMatrixIsOrthonormal(_matrix, _epsilon) && \
+( (((RwReal)1) - (_epsilon)) <= _rwMatrixDeterminant(_matrix) ) )
+
+#define rwMatrixIsIdentity(_matrix, _epsilon) \
+ ( (_epsilon) >= _rwMatrixIdentityError(_matrix) )
+
+#define rwMatrixValidFlags(_matrix, _epsilon) \
+ ( (_matrix) && /* valid pointer */ \
+ ( ( !( rwMatrixGetFlags(_matrix) & /* not flagged as identity */ \
+ rwMATRIXINTERNALIDENTITY) ) || /* .. or actually is */ \
+ rwMatrixIsIdentity(_matrix, _epsilon)) && \
+ ( ( !( rwMatrixGetFlags(_matrix) & /* not flagged as normal */ \
+ rwMATRIXTYPENORMAL) ) || /* ... or actually is */ \
+ rwMatrixIsNormal(_matrix, _epsilon)) && \
+ ( ( !( rwMatrixGetFlags(_matrix) & /* not flagged as orthogonal */ \
+ rwMATRIXTYPEORTHOGONAL) ) || /* ... or actually is */ \
+ rwMatrixIsOrthogonal(_matrix, _epsilon)) )
+
+#define rwMat01Det(_mAA) \
+ ( (_mAA) )
+
+#define rwMat02Det(_mAA, _mAB, \
+ _mBA, _mBB) \
+ ( (_mAA) * rwMat01Det(_mBB) \
+ - (_mAB) * rwMat01Det(_mBA) \
+ )
+
+#define rwMat03Det(_mAA, _mAB, _mAC, \
+ _mBA, _mBB, _mBC, \
+ _mCA, _mCB, _mCC) \
+ ( (_mAA) * rwMat02Det(_mBB, _mBC, \
+ _mCB, _mCC) \
+ - (_mAB) * rwMat02Det(_mBA, _mBC, \
+ _mCA, _mCC) \
+ + (_mAC) * rwMat02Det(_mBA, _mBB, \
+ _mCA, _mCB) \
+ )
+
+#define rwMat04Det(_mAA, _mAB, _mAC, _mAD, \
+ _mBA, _mBB, _mBC, _mBD, \
+ _mCA, _mCB, _mCC, _mCD, \
+ _mDA, _mDB, _mDC, _mDD) \
+ ( (_mAA) * rwMat03Det(_mBB, _mBC, _mBD, \
+ _mCB, _mCC, _mCD, \
+ _mDB, _mDC, _mDD) \
+ - (_mAB) * rwMat03Det(_mBA, _mBC, _mBD, \
+ _mCA, _mCC, _mCD, \
+ _mDA, _mDC, _mDD) \
+ + (_mAC) * rwMat03Det(_mBA, _mBB, _mBD, \
+ _mCA, _mCB, _mCD, \
+ _mDA, _mDB, _mDD) \
+ - (_mAD) * rwMat03Det(_mBA, _mBB, _mBC, \
+ _mCA, _mCB, _mCC, \
+ _mDA, _mDB, _mDC) \
+ )
+
+
+#define rwMat02Inv(_rAA, _rAB, \
+ _rBA, _rBB) \
+ _mAA, _mAB, \
+ _mBA, _mBB) \
+MACRO_START \
+{ \
+ RwSplitBits determinant; \
+ \
+ (_rAA) = rwMat01Det(_mBB); \
+ (_rAB) = -rwMat01Det(_mAB); \
+ \
+ determinant.nReal = ( (_rAA) * (_mAA) + \
+ (_rAB) * (_mBA) ); \
+ \
+ \
+ { \
+ const RwReal normalize = ( (determinant.nInt != 0)? \
+ (((RwReal)1)/determinant.nReal): \
+ ((RwReal)1) ); \
+ \
+ (_rAA) *= normalize; \
+ (_rAB) *= normalize; \
+ \
+ (_rBA) = -rwMat01Det(_mBA) * normalize; \
+ (_rBB) = rwMat01Det(_mAA) * normalize; \
+ } \
+} \
+MACRO_STOP
+
+#define rwMat03Inv(_rAA, _rAB, _rAC, \
+ _rBA, _rBB, _rBC, \
+ _rCA, _rCB, _rCC, \
+ _mAA, _mAB, _mAC, \
+ _mBA, _mBB, _mBC, \
+ _mCA, _mCB, _mCC) \
+MACRO_START \
+{ \
+ RwSplitBits determinant; \
+ \
+ (_rAA)= rwMat02Det(_mBB, _mBC, \
+ _mCB, _mCC); \
+ (_rAB)= -rwMat02Det(_mAB, _mAC, \
+ _mCB, _mCC); \
+ (_rAC)= rwMat02Det(_mAB, _mAC, \
+ _mBB, _mBC); \
+ \
+ determinant.nReal = ( (_rAA) * (_mAA) + \
+ (_rAB) * (_mBA) + \
+ (_rAC) * (_mCA) ); \
+ \
+ { \
+ const RwReal normalize = ( (determinant.nInt != 0)? \
+ (((RwReal)1)/determinant.nReal): \
+ ((RwReal)1) ); \
+ (_rAA) *= normalize; \
+ (_rAB) *= normalize; \
+ (_rAC) *= normalize; \
+ \
+ (_rBA)= -rwMat02Det(_mBA, _mBC, \
+ _mCA, _mCC) * normalize ; \
+ (_rBB)= rwMat02Det(_mAA, _mAC, \
+ _mCA, _mCC) * normalize ; \
+ (_rBC)= -rwMat02Det(_mAA, _mAC, \
+ _mBA, _mBC) * normalize ; \
+ \
+ (_rCA)= rwMat02Det(_mBA, _mBB, \
+ _mCA, _mCB) * normalize ; \
+ (_rCB)= -rwMat02Det(_mAA, _mAB, \
+ _mCA, _mCB) * normalize ; \
+ (_rCC)= rwMat02Det(_mAA, _mAB, \
+ _mBA, _mBB) * normalize ; \
+ } \
+ \
+} \
+MACRO_STOP
+
+#define rwMat04Inv(_rAA, _rAB, _rAC, _rAD, \
+ _rBA, _rBB, _rBC, _rBD, \
+ _rCA, _rCB, _rCC, _rCD, \
+ _rDA, _rDB, _rDC, _rDD, \
+ _mAA, _mAB, _mAC, _mAD, \
+ _mBA, _mBB, _mBC, _mBD, \
+ _mCA, _mCB, _mCC, _mCD, \
+ _mDA, _mDB, _mDC, _mDD) \
+MACRO_START \
+{ \
+ RwSplitBits determinant; \
+ \
+ (_rAA)= rwMat03Det(_mBB, _mBC, _mBD, \
+ _mCB, _mCC, _mCD, \
+ _mDB, _mDC, _mDD); \
+ (_rAB)= -rwMat03Det(_mAB, _mAC, _mAD, \
+ _mCB, _mCC, _mCD, \
+ _mDB, _mDC, _mDD); \
+ (_rAC)= rwMat03Det(_mAB, _mAC, _mAD, \
+ _mBB, _mBC, _mBD, \
+ _mDB, _mDC, _mDD); \
+ (_rAD)= -rwMat03Det(_mAB, _mAC, _mAD, \
+ _mBB, _mBC, _mBD, \
+ _mCB, _mCC, _mCD); \
+ \
+ determinant.nReal = ( (_rAA) * (_mAA) + \
+ (_rAB) * (_mBA) + \
+ (_rAC) * (_mCA) + \
+ (_rAD) * (_mDA) ); \
+ \
+ { \
+ const RwReal normalize = ( (determinant.nInt != 0)? \
+ (((RwReal)1)/determinant.nReal): \
+ ((RwReal)1) ); \
+ \
+ (_rAA) *= normalize; \
+ (_rAB) *= normalize; \
+ (_rAC) *= normalize; \
+ (_rAD) *= normalize; \
+ \
+ (_rBA)= -rwMat03Det(_mBA, _mBC, _mBD, \
+ _mCA, _mCC, _mCD, \
+ _mDA, _mDC, _mDD) * normalize ; \
+ (_rBB)= rwMat03Det(_mAA, _mAC, _mAD, \
+ _mCA, _mCC, _mCD, \
+ _mDA, _mDC, _mDD) * normalize ; \
+ (_rBC)= -rwMat03Det(_mAA, _mAC, _mAD, \
+ _mBA, _mBC, _mBD, \
+ _mDA, _mDC, _mDD) * normalize ; \
+ (_rBD)= rwMat03Det(_mAA, _mAC, _mAD, \
+ _mBA, _mBC, _mBD, \
+ _mCA, _mCC, _mCD) * normalize ; \
+ \
+ (_rCA)= rwMat03Det(_mBA, _mBB, _mBD, \
+ _mCA, _mCB, _mCD, \
+ _mDA, _mDB, _mDD) * normalize ; \
+ (_rCB)= -rwMat03Det(_mAA, _mAB, _mAD, \
+ _mCA, _mCB, _mCD, \
+ _mDA, _mDB, _mDD) * normalize ; \
+ (_rCC)= rwMat03Det(_mAA, _mAB, _mAD, \
+ _mBA, _mBB, _mBD, \
+ _mDA, _mDB, _mDD) * normalize ; \
+ (_rCD)= -rwMat03Det(_mAA, _mAB, _mAD, \
+ _mBA, _mBB, _mBD, \
+ _mCA, _mCB, _mCD) * normalize ; \
+ \
+ (_rDA)= -rwMat03Det(_mBA, _mBB, _mBC, \
+ _mCA, _mCB, _mCC, \
+ _mDA, _mDB, _mDC) * normalize ; \
+ (_rDB)= rwMat03Det(_mAA, _mAB, _mAC, \
+ _mCA, _mCB, _mCC, \
+ _mDA, _mDB, _mDC) * normalize ; \
+ (_rDC)= -rwMat03Det(_mAA, _mAB, _mAC, \
+ _mBA, _mBB, _mBC, \
+ _mDA, _mDB, _mDC) * normalize ; \
+ (_rDD)= rwMat03Det(_mAA, _mAB, _mAC, \
+ _mBA, _mBB, _mBC, \
+ _mCA, _mCB, _mCC) * normalize ; \
+ } \
+} \
+MACRO_STOP
+
+
+/*--- 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)) */
+
+
+#if (defined(RWDEBUG))
+#if (defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC))
+#define _CRTDBG_MAP_ALLOC
+#endif /* defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) */
+#include <crtdbg.h>
+#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
+
+/****************************************************************************
+ Global Types
+ */
+
+/* We use RwD3D8Vertex to drive the hardware in 2D mode */
+
+/*
+ * D3D8 vertex structure definition for 2D geometry
+ */
+#if !defined(RWADOXYGENEXTERNAL)
+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 */
+};
+#endif /* !defined(RWADOXYGENEXTERNAL) */
+
+/* Define types used */
+
+#if !defined(RWADOXYGENEXTERNAL)
+/**
+ * \ingroup rwcoredriverd3d8
+ * \ref RwIm2DVertex
+ * Typedef for a RenderWare Graphics Immediate Mode 2D Vertex
+ */
+typedef RwD3D8Vertex RwIm2DVertex;
+#endif /* !defined(RWADOXYGENEXTERNAL) */
+
+#if !defined(RWADOXYGENEXTERNAL)
+/**
+ * \ingroup rwcoredriverd3d8
+ * \ref RxVertexIndex
+ *
+ * Typedef for a RenderWare Graphics PowerPipe Immediate
+ * Mode Vertex
+ */
+typedef RwUInt16 RxVertexIndex;
+#endif /* !defined(RWADOXYGENEXTERNAL) */
+
+#if !defined(RWADOXYGENEXTERNAL)
+
+/**
+ * \ingroup rwcoredriverd3d8
+ * \ref RwImVertexIndex
+ * Typedef for a RenderWare Graphics Immediate Mode Vertex.
+ */
+typedef RxVertexIndex RwImVertexIndex;
+#endif /* !defined(RWADOXYGENEXTERNAL) */
+
+#if !defined(RWADOXYGENEXTERNAL)
+
+/**
+ * \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 */
+ RwUInt32 numVBSwitches; /**< Number of Vertex Buffer switches */
+}
+RwD3D8Metrics;
+#endif /* !defined(RWADOXYGENEXTERNAL) */
+
+#endif /* D3D8_DRVMODEL_H */
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/bavector.h ---*/
+
+/*
+ * Typedef for pointer to Vector multiplication by Matrix function
+ */
+
+typedef RwV3d *(*rwVectorMultFn) (RwV3d * pointsOut,
+ const RwV3d * pointsIn,
+ RwInt32 numPoints,
+ const RwMatrix * matrix);
+
+
+/* If sqrt is overloaded for this platform, we will remove
+ * all the sqrt table stuff from the build entirely
+ * currently applies to SKY2 and XBOX - IDBS [2/11/2001]
+ * [and, if using the intel compiler version 400 or above,
+ * we will use the single-precision float "sqrtf" under
+ * D3D8, OpenGL or SoftRas] */
+#if (defined(rwSqrtMacro))
+#define RWNOSQRTTABLE
+#endif /* (defined(rwSqrtMacro)) */
+#if (defined(rwInvSqrtMacro))
+#define RWNOINVSQRTTABLE
+#endif /* (defined(rwSqrtMacro)) */
+
+#if (!defined(rwSqrtMacro))
+#define rwSqrtMacro(_root, _input) \
+ ( *(_root) = _rwSqrt(_input) )
+#endif /* (!defined(rwSqrtMacro)) */
+
+#if (!defined(rwInvSqrtMacro))
+#define rwInvSqrtMacro(_recip, _input) \
+ ( *(_recip) = _rwInvSqrt(_input) )
+#endif /* (!defined(rwInvSqrtMacro)) */
+
+#if (!defined(rwSqrtInvSqrtMacro))
+#define rwSqrtInvSqrtMacro(_root, _recip, _input) \
+MACRO_START \
+{ \
+ RwReal _tmp = _input; \
+ rwSqrt((_root), _tmp); \
+ rwInvSqrt((_recip), _tmp); \
+} \
+MACRO_STOP
+#endif /* (!defined(rwSqrtInvSqrtMacro)) */
+
+/* Vector operations Macros */
+
+#if (!defined(RwV2dAssignMacro))
+#define RwV2dAssignMacro(_target, _source) \
+ ( *(_target) = *(_source) )
+#endif /* (!defined(RwV2dAssignMacro)) */
+
+#define RwV2dAddMacro(o, a, b) \
+MACRO_START \
+{ \
+ (o)->x = (((a)->x) + ( (b)->x)); \
+ (o)->y = (((a)->y) + ( (b)->y)); \
+} \
+MACRO_STOP
+
+#define RwV2dSubMacro(o, a, b) \
+MACRO_START \
+{ \
+ (o)->x = (((a)->x) - ( (b)->x)); \
+ (o)->y = (((a)->y) - ( (b)->y)); \
+} \
+MACRO_STOP
+
+#define RwV2dScaleMacro(o, i, s) \
+MACRO_START \
+{ \
+ (o)->x = (((i)->x) * ( (s))); \
+ (o)->y = (((i)->y) * ( (s))); \
+} \
+MACRO_STOP
+
+#define RwV2dDotProductMacro(a,b) \
+ (( ((((a)->x) * ( (b)->x))) + \
+ ( (((a)->y) * ( (b)->y)))))
+
+#define _rwV2dNormalizeMacro(_result, _out, _in) \
+MACRO_START \
+{ \
+ RwReal length2 = RwV2dDotProductMacro((_in), (_in)); \
+ rwInvSqrtMacro(&(_result), length2); \
+ RwV2dScaleMacro((_out), (_in), (_result)); \
+} \
+MACRO_STOP
+
+#define RwV2dNormalizeMacro(_result, _out, _in) \
+MACRO_START \
+{ \
+ RwReal length2 = RwV2dDotProductMacro((_in), (_in)); \
+ RwReal recip; \
+ \
+ rwSqrtInvSqrtMacro(&(_result), &recip, length2); \
+ RwV2dScaleMacro((_out), (_in), recip); \
+} \
+MACRO_STOP
+
+#define RwV2dLengthMacro(_result, _in) \
+MACRO_START \
+{ \
+ (_result) = RwV2dDotProductMacro(_in, _in); \
+ rwSqrtMacro(&(_result), (_result)); \
+} \
+MACRO_STOP
+
+#define RwV2dLineNormalMacro(_o, _a, _b) \
+MACRO_START \
+{ \
+ RwReal recip; \
+ \
+ (_o)->y = (((_b)->x) - ( (_a)->x)); \
+ (_o)->x = (((_a)->y) - ( (_b)->y)); \
+ _rwV2dNormalizeMacro(recip, _o,_o); \
+} \
+MACRO_STOP
+
+#define RwV2dPerpMacro(o, a) \
+MACRO_START \
+{ \
+ (o)->x = -(a)->y; \
+ (o)->y = (a)->x; \
+} \
+MACRO_STOP
+
+/* RwV3d */
+
+#if (!defined(RwV3dAssignMacro))
+#define RwV3dAssignMacro(_target, _source) \
+ ( *(_target) = *(_source) )
+#endif /* (!defined(RwV3dAssignMacro)) */
+
+
+#define RwV3dAddMacro(o, a, b) \
+MACRO_START \
+{ \
+ (o)->x = (((a)->x) + ( (b)->x)); \
+ (o)->y = (((a)->y) + ( (b)->y)); \
+ (o)->z = (((a)->z) + ( (b)->z)); \
+} \
+MACRO_STOP
+
+#define RwV3dSubMacro(o, a, b) \
+MACRO_START \
+{ \
+ (o)->x = (((a)->x) - ( (b)->x)); \
+ (o)->y = (((a)->y) - ( (b)->y)); \
+ (o)->z = (((a)->z) - ( (b)->z)); \
+} \
+MACRO_STOP
+
+#define RwV3dScaleMacro(o, a, s) \
+MACRO_START \
+{ \
+ (o)->x = (((a)->x) * ( (s))); \
+ (o)->y = (((a)->y) * ( (s))); \
+ (o)->z = (((a)->z) * ( (s))); \
+} \
+MACRO_STOP
+
+#define RwV3dIncrementScaledMacro(o, a, s) \
+MACRO_START \
+{ \
+ (o)->x += (((a)->x) * ( (s))); \
+ (o)->y += (((a)->y) * ( (s))); \
+ (o)->z += (((a)->z) * ( (s))); \
+} \
+MACRO_STOP
+
+#define RwV3dNegateMacro(o, a) \
+MACRO_START \
+{ \
+ (o)->x = -(a)->x; \
+ (o)->y = -(a)->y; \
+ (o)->z = -(a)->z; \
+} \
+MACRO_STOP
+
+#define RwV3dDotProductMacro(a, b) \
+ ((((( (((a)->x) * ((b)->x))) + \
+ ( (((a)->y) * ((b)->y))))) + \
+ ( (((a)->z) * ((b)->z)))))
+
+#define RwV3dCrossProductMacro(o, a, b) \
+MACRO_START \
+{ \
+ (o)->x = \
+ (( (((a)->y) * ( (b)->z))) - \
+ ( (((a)->z) * ( (b)->y)))); \
+ (o)->y = \
+ (( (((a)->z) * ( (b)->x))) - \
+ ( (((a)->x) * ( (b)->z)))); \
+ (o)->z = \
+ (( (((a)->x) * ( (b)->y))) - \
+ ( (((a)->y) * ( (b)->x)))); \
+} \
+MACRO_STOP
+
+#define _rwV3dNormalizeMacro(_result, _out, _in) \
+MACRO_START \
+{ \
+ RwReal length2 = RwV3dDotProductMacro(_in, _in); \
+ rwInvSqrtMacro(&(_result), length2); \
+ RwV3dScaleMacro(_out, _in, _result); \
+} \
+MACRO_STOP
+
+#define RwV3dNormalizeMacro(_result, _out, _in) \
+MACRO_START \
+{ \
+ RwReal length2 = RwV3dDotProductMacro((_in), (_in)); \
+ RwReal recip; \
+ \
+ rwSqrtInvSqrtMacro(&(_result), &recip, length2); \
+ RwV3dScaleMacro((_out), (_in), recip); \
+} \
+MACRO_STOP
+
+#define RwV3dLengthMacro(_result, _in) \
+MACRO_START \
+{ \
+ (_result) = RwV3dDotProductMacro(_in, _in); \
+ rwSqrtMacro(&(_result), _result); \
+} \
+MACRO_STOP
+
+#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ))
+
+#define RwV2dAssign(o, a) RwV2dAssignMacro(o, a)
+#define RwV2dAdd(o, a, b) RwV2dAddMacro(o, a, b)
+#define RwV2dSub(o, a, b) RwV2dSubMacro(o, a, b)
+#define RwV2dLineNormal(_o, _a, _b) RwV2dLineNormalMacro(_o, _a, _b)
+#define RwV2dScale(o, i, s) RwV2dScaleMacro(o, i, s)
+#define RwV2dDotProduct(a,b) RwV2dDotProductMacro(a,b)
+#define RwV2dPerp(o, a) RwV2dPerpMacro(o, a)
+#define RwV3dAssign(o, a) RwV3dAssignMacro(o, a)
+#define RwV3dAdd(o, a, b) RwV3dAddMacro(o, a, b)
+#define RwV3dSub(o, a, b) RwV3dSubMacro(o, a, b)
+#define RwV3dScale(o, a, s) RwV3dScaleMacro(o, a, s)
+#define RwV3dIncrementScaled(o, a, s) RwV3dIncrementScaledMacro(o, a, s)
+#define RwV3dNegate(o, a) RwV3dNegateMacro(o, a)
+#define RwV3dDotProduct(a, b) RwV3dDotProductMacro(a, b)
+#define RwV3dCrossProduct(o, a, b) RwV3dCrossProductMacro(o, a, b)
+
+#endif /* (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) */
+
+#define RWRAD2DEG(_x) ((_x) * (((RwReal)180)/(rwPI)))
+
+#if (!defined(rw4OVERPISQ))
+#define rw4OVERPISQ ( ((RwReal)4) / ( rwPI * rwPI ))
+#endif /* (!defined(rw4OVERPISQ)) */
+
+#if (!defined(rwPI3))
+#define rwPI3 (rwPI * (RwReal)3)
+#endif /* (!defined(rwPI3)) */
+
+#if (!defined(rwPI3OVER2))
+#define rwPI3OVER2 ( rwPI3 / (RwReal)2 )
+#endif /* (!defined(rwPI3OVER2)) */
+
+#if (!defined(rwPI3OVER8))
+#define rwPI3OVER8 (rwPI3 / (RwReal)8 )
+#endif /* (!defined(rwPI3OVER8)) */
+
+#define RwQuadSin(_x) \
+ ( rw4OVERPISQ * \
+ ( ( (_x) < 0 ) ? \
+ ( ( rwPI + (_x) ) * (_x) ) : \
+ ( ( rwPI - (_x) ) * (_x) ) ) )
+
+#define RwQuadASin(_result, _s) \
+ ( rwPIOVER2 * ( ((_s)<0) ? \
+ ( rwSqrtMacro((_result), 1.0f + (_s)) - 1 ) : \
+ ( 1 - rwSqrtMacro((_result), 1.0f - (_s)) ) ) )
+
+#define RwQuadCos(_x) \
+ ( rw4OVERPISQ * \
+ ( ( (_x) < -rwPIOVER2 ) ? \
+ ( ( -rwPI3OVER2 - (_x) ) * ( -rwPIOVER2 - (_x) ) ) : \
+ ( ( (_x) < rwPIOVER2) ? \
+ ( ( rwPIOVER2 + (_x) ) * ( rwPIOVER2 - (_x) ) ) : \
+ ( ( rwPIOVER2 - (_x) ) * ( rwPI3OVER2 - (_x) ) ) ) ) )
+
+#define RwQuadACos(_result, _c) \
+ ( rwPIOVER2 * ( ((_c)<0) ? \
+ (2.0f - rwSqrtMacro((_result), 1.0f + (_c))): \
+ rwSqrtMacro((_result), 1.0f - (_c))) )
+
+#define RwQuadTan(_x) \
+ ( rwPI3 * (_x) / ( rwPI * rwPI - (_x) * (_x) * 4.0f ) )
+
+#define RwQuadATan(_result, _t) \
+ ( ( rwSqrtMacro((_result), (rwPI3OVER8 * rwPI3OVER8) + \
+ (_t) * (_t) * (rwPIOVER2 * rwPIOVER2) ) - rwPI3OVER8 ) \
+ / ( _t) )
+
+#define RwQuadATan2(_result, _s, _c) \
+ ( ( rwSqrtMacro((_result), (_c) * (_c) * (rwPI3OVER8 * rwPI3OVER8) + \
+ (_s) * (_s) * (rwPIOVER2 * rwPIOVER2) ) \
+ - (_c) * rwPI3OVER8 ) / ( _s) )
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Other useful stuff */
+
+extern RwReal RwV3dNormalize(RwV3d * out, const RwV3d * in);
+extern RwReal RwV3dLength(const RwV3d * in);
+
+extern RwReal RwV2dLength(const RwV2d * in);
+extern RwReal RwV2dNormalize(RwV2d * out, const RwV2d * in);
+
+#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )
+
+extern void RwV2dAssign(RwV2d * out,
+ const RwV2d * ina);
+extern void RwV2dAdd(RwV2d * out,
+ const RwV2d * ina, const RwV2d * inb);
+extern void RwV2dLineNormal(RwV2d * out,
+ const RwV2d * ina, const RwV2d * inb);
+extern void RwV2dSub(RwV2d * out,
+ const RwV2d * ina, const RwV2d * inb);
+extern void RwV2dPerp(RwV2d * out, const RwV2d * in);
+extern void RwV2dScale(RwV2d * out,
+ const RwV2d * in, RwReal scalar);
+extern RwReal RwV2dDotProduct(const RwV2d * ina, const RwV2d * inb);
+
+extern void RwV3dAssign(RwV3d * out,
+ const RwV3d * ina);
+extern void RwV3dAdd(RwV3d * out,
+ const RwV3d * ina, const RwV3d * inb);
+extern void RwV3dSub(RwV3d * out,
+ const RwV3d * ina, const RwV3d * inb);
+extern void RwV3dScale(RwV3d * out,
+ const RwV3d * in, RwReal scalar);
+extern void RwV3dIncrementScaled(RwV3d * out,
+ const RwV3d * in, RwReal scalar);
+extern void RwV3dNegate(RwV3d * out, const RwV3d * in);
+extern RwReal RwV3dDotProduct(const RwV3d * ina, const RwV3d * inb);
+extern void RwV3dCrossProduct(RwV3d * out,
+ const RwV3d * ina, const RwV3d * inb);
+
+#endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
+
+/* Transform points/vectors */
+extern RwV3d *RwV3dTransformPoints(RwV3d * pointsOut,
+ const RwV3d * pointsIn,
+ RwInt32 numPoints,
+ const RwMatrix * matrix);
+extern RwV3d *RwV3dTransformVectors(RwV3d * vectorsOut,
+ const RwV3d * vectorsIn,
+ RwInt32 numPoints,
+ const RwMatrix * matrix);
+
+/* SPI */
+
+#if (!defined(RWNOSQRTTABLE))
+extern RwReal _rwSqrt(const RwReal num);
+#endif /* (!defined(RWNOSQRTTABLE)) */
+#if (!defined(RWNOINVSQRTTABLE))
+extern RwReal _rwInvSqrt(const RwReal num);
+#endif /* (!defined(RWNOINVSQRTTABLE)) */
+
+extern RwReal _rwV3dNormalize(RwV3d * out, const RwV3d * in);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#define rwVectorOpen(instance, offset, size) \
+ _rwVectorOpen(instance, offset, size)
+
+#define rwVectorClose(instance, offset, size) \
+ _rwVectorClose(instance, offset, size)
+
+#define rwVectorSetMultFn(multPoint,multVector) \
+ _rwVectorSetMultFn(multPoint,multVector)
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/balist.h ---*/
+/****************************************************************************
+ Global Types
+ */
+
+typedef struct RwSList RwSList;
+
+#if (!defined(DOXYGEN))
+struct RwSList
+{
+ RwUInt8 *listElements;
+ RwInt32 numElementsFilled;
+ RwInt32 numElementsAlloced;
+ RwInt32 entrySize;
+};
+#endif /* (!defined(DOXYGEN) */
+
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* SList functions */
+extern RwSList *_rwSListCreate(RwInt32 size);
+extern RwBool _rwSListDestroy(RwSList *sList);
+extern RwBool _rwSListDestroyArray(RwUInt8 *array);
+extern void _rwSListDestroyEndEntries(RwSList *sList, RwInt32 amount);
+extern RwBool _rwSListDestroyEntry(RwSList *sList, RwInt32 entry);
+extern void _rwSListEmpty(RwSList *sList);
+extern void *_rwSListGetArray(RwSList *sList);
+extern void *_rwSListGetEntry(RwSList *sList, RwInt32 entry);
+extern void *_rwSListGetNewEntry(RwSList *sList);
+extern void *_rwSListGetNewEntries(RwSList *sList, RwInt32 entry);
+extern RwInt32 _rwSListGetNumEntries(const RwSList *sList);
+extern RwBool _rwSListReleaseArray(RwSList *sList);
+extern void *_rwSListToArray(RwSList *sList);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* Comparibility macros */
+
+#define rwSListCreate(size) \
+ _rwSListCreate(size)
+#define rwSListDestroy(sList) \
+ _rwSListDestroy(sList)
+#define rwSListDestroyArray(array) \
+ _rwSListDestroyArray(array)
+#define rwSListDestroyEndEntries(sList, amount) \
+ _rwSListDestroyEndEntries(sList, amount)
+#define rwSListDestroyEntry(sList, entry) \
+ _rwSListDestroyEntry(sList, entry)
+#define rwSListEmpty(sList) \
+ _rwSListEmpty(sList)
+#define rwSListGetArray(sList) \
+ _rwSListGetArray(sList)
+#define rwSListGetEntry(sList, entry) \
+ _rwSListGetEntry(sList, entry)
+#define rwSListGetNewEntry(sList) \
+ _rwSListGetNewEntry(sList)
+#define rwSListGetNewEntries(sList, entry) \
+ _rwSListGetNewEntries(sList, entry)
+#define rwSListGetNumEntries(sList) \
+ _rwSListGetNumEntries(sList)
+#define rwSListReleaseArray(sList) \
+ _rwSListReleaseArray(sList)
+#define rwSListToArray(sList) \
+ _rwSListToArray(sList)
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/baimmedi.h ---*/
+
+/****************************************************************************
+ Defines
+ */
+
+
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ Immediate mode interface V2.0
+
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwrenderstate
+ * RwRenderState represents the global state variables that control
+ * rendering. These may be set and queried using the
+ * \ref RwRenderStateSet and \ref RwRenderStateGet functions respectively.
+ *
+ * Refer to the \ref rwrenderstateoverview for an overview of this system.
+ *
+ * \note The texture render states (raster, address & filter modes) would
+ * normally just be used when rendering in immediate mode and should be
+ * specificied completely every time a texture is used. Retained mode
+ * pipelines will frequently set theses states internally, usually based on
+ * \ref RwTexture objects.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+enum RwRenderState
+{
+ rwRENDERSTATENARENDERSTATE = 0,
+
+ rwRENDERSTATETEXTURERASTER,
+ /**<Raster used for texturing (normally used in immediate mode).
+ * The value is a pointer to an \ref RwRaster.
+ */
+ rwRENDERSTATETEXTUREADDRESS,
+ /**<\ref RwTextureAddressMode: wrap, clamp, mirror or border.
+ */
+ rwRENDERSTATETEXTUREADDRESSU,
+ /**<\ref RwTextureAddressMode in u only.
+ */
+ rwRENDERSTATETEXTUREADDRESSV,
+ /**<\ref RwTextureAddressMode in v only.
+ */
+ rwRENDERSTATETEXTUREPERSPECTIVE,
+ /**<Perspective correction on/off (always enabled on many platforms).
+ */
+ rwRENDERSTATEZTESTENABLE,
+ /**<Z-buffer test on/off.
+ */
+ rwRENDERSTATESHADEMODE,
+ /**<\ref RwShadeMode: flat or gouraud shading.
+ */
+ rwRENDERSTATEZWRITEENABLE,
+ /**<Z-buffer write on/off.
+ */
+ rwRENDERSTATETEXTUREFILTER,
+ /**<\ref RwTextureFilterMode: point sample, bilinear, trilinear, etc.
+ */
+ rwRENDERSTATESRCBLEND,
+ /**<\ref RwBlendFunction used to modulate the source pixel color
+ * when blending to the frame buffer.
+ */
+ rwRENDERSTATEDESTBLEND,
+ /**<\ref RwBlendFunction used to modulate the destination pixel
+ * color in the frame buffer when blending. The resulting pixel
+ * color is given by the formula
+ * (SRCBLEND * srcColor + DESTBLEND * destColor) for each RGB
+ * component. For a particular platform, not all combinations
+ * of blend function are allowed (see platform specific
+ * restrictions).
+ */
+ rwRENDERSTATEVERTEXALPHAENABLE,
+ /**<Alpha blending on/off (always enabled on some platforms).
+ * This is normally used in immediate mode to enable alpha blending
+ * when vertex colors or texture rasters have transparency. Retained
+ * mode pipelines will usually set this state based on material colors
+ * and textures.
+ */
+ rwRENDERSTATEBORDERCOLOR,
+ /**<Border color for \ref RwTextureAddressMode
+ * \ref rwTEXTUREADDRESSBORDER. The value should be a packed
+ * RwUInt32 in a platform specific format. The macro
+ * RWRGBALONG(r, g, b, a) may be used to construct this using
+ * 8-bit color components.
+ */
+ rwRENDERSTATEFOGENABLE,
+ /**<Fogging on/off (all polygons will be fogged).
+ */
+ rwRENDERSTATEFOGCOLOR,
+ /**<Color used for fogging. The value should be a packed RwUInt32
+ * in a platform specific format. The macro RWRGBALONG(r, g, b, a)
+ * may be used to construct this using 8-bit color components.
+ */
+ rwRENDERSTATEFOGTYPE,
+ /**<\ref RwFogType, the type of fogging to use.
+ */
+ rwRENDERSTATEFOGDENSITY,
+ /**<Fog density for \ref RwFogType of
+ * \ref rwFOGTYPEEXPONENTIAL or \ref rwFOGTYPEEXPONENTIAL2.
+ * The value should be a pointer to an RwReal in the
+ * range 0 to 1.
+ */
+ rwRENDERSTATECULLMODE = 20,
+ /**<\ref RwCullMode, for selecting front/back face culling, or
+ * no culling.
+ */
+ rwRENDERSTATESTENCILENABLE,
+ /**<Stenciling on/off.
+ * <i> Supported on Xbox, D3D8, and OpenGL only. </i>
+ */
+ rwRENDERSTATESTENCILFAIL,
+ /**<\ref RwStencilOperation used when the stencil test passes.
+ * <i> Supported on Xbox, D3D8, and OpenGL only. </i>
+ */
+ rwRENDERSTATESTENCILZFAIL,
+ /**<\ref RwStencilOperation used when the stencil test passes and
+ * the depth test (z-test) fails.
+ * <i> Supported on Xbox, D3D8, and OpenGL only. </i>
+ */
+ rwRENDERSTATESTENCILPASS,
+ /**<Stencil operation used when both the stencil and the depth
+ * (z) tests pass.
+ * <i> Supported on Xbox, D3D8, and OpenGL only. </i>
+ */
+ rwRENDERSTATESTENCILFUNCTION,
+ /**<\ref RwStencilFunction for the stencil test.
+ * <i> Supported on Xbox, D3D8, and OpenGL only. </i>
+ */
+ rwRENDERSTATESTENCILFUNCTIONREF,
+ /**<Integer reference value for the stencil test.
+ * <i> Supported on Xbox, D3D8, and OpenGL only. </i>
+ */
+ rwRENDERSTATESTENCILFUNCTIONMASK,
+ /**<Mask applied to the reference value and each stencil buffer
+ * entry to determine the significant bits for the stencil test.
+ * <i> Supported on Xbox, D3D8, and OpenGL only. </i>
+ */
+ rwRENDERSTATESTENCILFUNCTIONWRITEMASK,
+ /**<Write mask applied to values written into the stencil buffer.
+ * <i> Supported on Xbox, D3D8, and OpenGL only. </i>
+ */
+
+ rwRENDERSTATEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwRenderState RwRenderState;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwrenderstate
+ * RwShadeMode represents the available shading modes that may be
+ * set using the \ref RwRenderState \ref rwRENDERSTATESHADEMODE.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+enum RwShadeMode
+{
+ rwSHADEMODENASHADEMODE = 0,
+ rwSHADEMODEFLAT, /**<Flat shading */
+ rwSHADEMODEGOURAUD, /**<Gouraud shading */
+ rwSHADEMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwShadeMode RwShadeMode;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwrenderstate
+ * RwTextureFilterMode represents the texture filtering modes that may
+ * be set using the \ref RwRenderState \ref rwRENDERSTATETEXTUREFILTER in
+ * immediate mode, or \ref RwTextureSetFilterMode in retained mode.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+enum RwTextureFilterMode
+{
+ rwFILTERNAFILTERMODE = 0,
+ rwFILTERNEAREST, /**<Point sampled */
+ rwFILTERLINEAR, /**<Bilinear */
+ rwFILTERMIPNEAREST, /**<Point sampled per pixel mip map */
+ rwFILTERMIPLINEAR, /**<Bilinear per pixel mipmap */
+ rwFILTERLINEARMIPNEAREST, /**<MipMap interp point sampled */
+ rwFILTERLINEARMIPLINEAR, /**<Trilinear */
+ rwTEXTUREFILTERMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwTextureFilterMode RwTextureFilterMode;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwrenderstate
+ * RwFogType represents the fog modes available when setting the
+ * \ref RwRenderState \ref rwRENDERSTATEFOGTYPE. Note that a particular
+ * platform may not support all of these modes (see platform specific
+ * restrictions).
+ */
+#endif /* RWADOXYGENEXTERNAL */
+enum RwFogType
+{
+ rwFOGTYPENAFOGTYPE = 0,
+ rwFOGTYPELINEAR, /**<Linear fog */
+ rwFOGTYPEEXPONENTIAL, /**<Exponential fog */
+ rwFOGTYPEEXPONENTIAL2, /**<Exponential^2 fog */
+ rwFOGTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwFogType RwFogType;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwrenderstate
+ * RwBlendFunction represents the options available when changing the
+ * \ref RwRenderState setting for \ref rwRENDERSTATESRCBLEND and
+ * \ref rwRENDERSTATEDESTBLEND. The values are factors used to modulate
+ * either the source or destination pixel color when blending to
+ * the frame buffer. Note the some combinations are not allowed on
+ * certain platforms (see platform specific restrictions).
+ *
+ * In the following list, the factors applied to each color component are
+ * listed explicitly. A subscript s refers to a source value while a subscript
+ * d refers to a destination value. Note that blending in the alpha channel is
+ * only applicable when the frame buffer actually contains alpha, and that
+ * the precise operation is platform specific. For instance, the
+ * source alpha value might simply be written to the alpha channel with
+ * no blending.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+enum RwBlendFunction
+{
+ rwBLENDNABLEND = 0,
+ rwBLENDZERO, /**<(0, 0, 0, 0 ) */
+ rwBLENDONE, /**<(1, 1, 1, 1 ) */
+ rwBLENDSRCCOLOR, /**<(Rs, Gs, Bs, As ) */
+ rwBLENDINVSRCCOLOR, /**<(1-Rs, 1-Gs, 1-Bs, 1-As) */
+ rwBLENDSRCALPHA, /**<(As, As, As, As ) */
+ rwBLENDINVSRCALPHA, /**<(1-As, 1-As, 1-As, 1-As) */
+ rwBLENDDESTALPHA, /**<(Ad, Ad, Ad, Ad ) */
+ rwBLENDINVDESTALPHA, /**<(1-Ad, 1-Ad, 1-Ad, 1-Ad) */
+ rwBLENDDESTCOLOR, /**<(Rd, Gd, Bd, Ad ) */
+ rwBLENDINVDESTCOLOR, /**<(1-Rd, 1-Gd, 1-Bd, 1-Ad) */
+ rwBLENDSRCALPHASAT, /**<(f, f, f, 1 ) f = min (As, 1-Ad) */
+ rwBLENDFUNCTIONFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwBlendFunction RwBlendFunction;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwrenderstate
+ * RwTextureAddressMode represents the addressing modes available
+ * when mapping textures to polygons using UV texture coordinates.
+ * This may be set in immediate mode via the \ref RwRenderState
+ * \ref rwRENDERSTATETEXTUREADDRESS, or via \ref RwTextureSetAddressing
+ * for an \ref RwTexture object.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+enum RwTextureAddressMode
+{
+ rwTEXTUREADDRESSNATEXTUREADDRESS = 0,
+ rwTEXTUREADDRESSWRAP, /**<UV wraps (tiles) */
+ rwTEXTUREADDRESSMIRROR, /**<Alternate UV is flipped */
+ rwTEXTUREADDRESSCLAMP, /**<UV is clamped to 0-1 */
+ rwTEXTUREADDRESSBORDER, /**<Border color takes effect outside of 0-1 */
+ rwTEXTUREADDRESSMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwTextureAddressMode RwTextureAddressMode;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwrenderstate
+ * RwStencilOperation represents the stencil operations that may be
+ * performed depending on the results of stencil/z-buffer tests.
+ * The operation may be set for the various tests
+ * via the \ref RwRenderState settings \ref rwRENDERSTATESTENCILFAIL,
+ * \ref rwRENDERSTATESTENCILZFAIL and \ref rwRENDERSTATESTENCILPASS.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+enum RwStencilOperation
+{
+ rwSTENCILOPERATIONNASTENCILOPERATION = 0,
+
+ rwSTENCILOPERATIONKEEP,
+ /**<Do not update the entry in the stencil buffer */
+ rwSTENCILOPERATIONZERO,
+ /**<Set the stencil-buffer entry to 0 */
+ rwSTENCILOPERATIONREPLACE,
+ /**<Replace the stencil-buffer entry with reference value */
+ rwSTENCILOPERATIONINCRSAT,
+ /**<Increment the stencil-buffer entry, clamping to the
+ * maximum value */
+ rwSTENCILOPERATIONDECRSAT,
+ /**<Decrement the stencil-buffer entry, clamping to zero */
+ rwSTENCILOPERATIONINVERT,
+ /**<Invert the bits in the stencil-buffer entry */
+ rwSTENCILOPERATIONINCR,
+ /**<Increment the stencil-buffer entry, wrapping to zero if
+ * the new value exceeds the maximum value */
+ rwSTENCILOPERATIONDECR,
+ /**<Decrement the stencil-buffer entry, wrapping to the maximum
+ * value if the new value is less than zero */
+
+ rwSTENCILOPERATIONFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwStencilOperation RwStencilOperation;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwrenderstate
+ * RwStencilFunction represents the comparison functions available for
+ * a stencil test. The function may be selected via the
+ * \ref RwRenderState setting \ref rwRENDERSTATESTENCILFUNCTION.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+enum RwStencilFunction
+{
+ rwSTENCILFUNCTIONNASTENCILFUNCTION = 0,
+
+ rwSTENCILFUNCTIONNEVER,
+ /**<Always fail the test */
+ rwSTENCILFUNCTIONLESS,
+ /**<Accept the new pixel if its value is less than the value of
+ * the current pixel */
+ rwSTENCILFUNCTIONEQUAL,
+ /**<Accept the new pixel if its value equals the value of the
+ * current pixel */
+ rwSTENCILFUNCTIONLESSEQUAL,
+ /**<Accept the new pixel if its value is less than or equal to
+ * the value of the current pixel */
+ rwSTENCILFUNCTIONGREATER,
+ /**<Accept the new pixel if its value is greater than the value
+ * of the current pixel */
+ rwSTENCILFUNCTIONNOTEQUAL,
+ /**<Accept the new pixel if its value does not equal the value of
+ * the current pixel */
+ rwSTENCILFUNCTIONGREATEREQUAL,
+ /**<Accept the new pixel if its value is greater than or equal
+ * to the value of the current pixel */
+ rwSTENCILFUNCTIONALWAYS,
+ /**<Always pass the test */
+
+ rwSTENCILFUNCTIONFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwStencilFunction RwStencilFunction;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwrenderstate
+ * RwCullMode represents the options available for culling polygons
+ * during rendering. The cull mode may be set via the \ref RwRenderState
+ * setting \ref rwRENDERSTATECULLMODE.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+enum RwCullMode
+{
+ rwCULLMODENACULLMODE = 0,
+
+ rwCULLMODECULLNONE,
+ /**<Both front and back-facing triangles are drawn. */
+ rwCULLMODECULLBACK,
+ /**<Only front-facing triangles are drawn */
+ rwCULLMODECULLFRONT,
+ /**<Only back-facing triangles are drawn */
+
+ rwCULLMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwCullMode RwCullMode;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup immediatemodedatatypes
+ * RwPrimitiveType
+ * This type represents the different types of indexed
+ * line and indexed triangle primitives that are available when rendering 2D
+ * and 3D immediate mode objects (see API functions \ref RwIm2DRenderIndexedPrimitive,
+ * \ref RwIm2DRenderPrimitive, \ref RwIm3DRenderIndexedPrimitive and \ref RwIm3DRenderPrimitive).
+ * Indices are into a vertex list and must be defined in a counter-clockwise order
+ * (as seen from the camera) to be visible.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+enum RwPrimitiveType
+{
+ rwPRIMTYPENAPRIMTYPE = 0, /**<Invalid primative type */
+ rwPRIMTYPELINELIST = 1, /**<Unconnected line segments, each line is specified by
+ * both its start and end index, independently of other lines
+ * (for example, 3 segments specified as 0-1, 2-3, 4-5) */
+ rwPRIMTYPEPOLYLINE = 2, /**<Connected line segments, each line's start index
+ * (except the first) is specified by the index of the end of
+ * the previous segment (for example, 3 segments specified as
+ * 0-1, 1-2, 2-3) */
+ rwPRIMTYPETRILIST = 3, /**<Unconnected triangles: each triangle is specified by
+ * three indices, independently of other triangles (for example,
+ * 3 triangles specified as 0-1-2, 3-4-5, 6-7-8) */
+ rwPRIMTYPETRISTRIP = 4, /**<Connected triangles sharing an edge with, at most, one
+ * other forming a series (for example, 3 triangles specified
+ * as 0-2-1, 1-2-3-, 2-4-3) */
+ rwPRIMTYPETRIFAN = 5 , /**<Connected triangles sharing an edge with, at most,
+ * two others forming a fan (for example, 3 triangles specified
+ * as 0-2-1, 0-3-2, 0-4-3) */
+ rwPRIMTYPEPOINTLIST = 6, /**<Points 1, 2, 3, etc. This is not
+ * supported by the default RenderWare
+ * immediate or retained-mode pipelines
+ * (except on PlayStation 2), it is intended
+ * for use by user-created pipelines */
+ rwPRIMITIVETYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwPrimitiveType RwPrimitiveType;
+
+
+
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Expose Z buffer range */
+extern RwReal RwIm2DGetNearScreenZ(void);
+extern RwReal RwIm2DGetFarScreenZ(void);
+
+extern RwBool RwRenderStateGet(RwRenderState state, void *value);
+extern RwBool RwRenderStateSet(RwRenderState state, void *value);
+
+extern RwBool RwIm2DRenderLine(RwIm2DVertex *vertices, RwInt32 numVertices, RwInt32 vert1, RwInt32 vert2);
+extern RwBool RwIm2DRenderTriangle(RwIm2DVertex *vertices, RwInt32 numVertices,
+ RwInt32 vert1, RwInt32 vert2, RwInt32 vert3 );
+extern RwBool RwIm2DRenderPrimitive(RwPrimitiveType primType, RwIm2DVertex *vertices, RwInt32 numVertices);
+extern RwBool RwIm2DRenderIndexedPrimitive(RwPrimitiveType primType, RwIm2DVertex *vertices, RwInt32 numVertices,
+ RwImVertexIndex *indices, RwInt32 numIndices);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/badevice.h ---*/
+/***************************************************************************/
+/************************* System Requests *********************************/
+/***************************************************************************/
+
+/* Device controls:
+ *
+ * rwDEVICESYSTEMOPEN(NULL, RwEngineOpenParams *openParams, 0)
+ * rwDEVICESYSTEMCLOSE(NULL, NULL, 0)
+ * rwDEVICESYSTEMSTART(NULL, NULL, 0)
+ * rwDEVICESYSTEMSTOP(NULL, NULL, 0)
+ * rwDEVICESYSTEMREGISTER(RwDevice *coreDeviceBlock, RwMemoryFunctions *memFuncs, 0)
+ * rwDEVICESYSTEMGETNUMMODES(RwInt32 *numModes, NULL, 0)
+ * rwDEVICESYSTEMGETMODEINFO(RwVideoMode *modeinfo, NULL, RwInt32 modeNum)
+ * rwDEVICESYSTEMUSEMODE(NULL, NULL, RwInt32 modeNum)
+ * rwDEVICESYSTEMFOCUS(NULL, NULL, RwBool gainFocus)
+ * rwDEVICESYSTEMINITPIPELINE(NULL, NULL, 0)
+ * rwDEVICESYSTEMGETMODE(RwInt32 *curMode, NULL, 0)
+ * rwDEVICESYSTEMSTANDARDS(RwStandardFunc *fnPtrArray, NULL, RwInt32 arraySize)
+ * rwDEVICESYSTEMGETTEXMEMSIZE(RwInt32 *texMemSizeOut, NULL, 0)
+ * rwDEVICESYSTEMGETNUMSUBSYSTEMS(RwInt32 *numSubSystemsOut, NULL, 0)
+ * rwDEVICESYSTEMGETSUBSYSTEMINFO(RwSubSystemInfo *subSystemInfo, NULL, RwInt32 subSystemNum)
+ * rwDEVICESYSTEMGETCURRENTSUBSYSTEM(RwInt32 *curSubSystem, NULL, 0)
+ * rwDEVICESYSTEMSETSUBSYSTEM(NULL, NULL, RwInt32 subSystemNum)
+ * rwDEVICESYSTEMFINALIZESTART(NULL, NULL, 0)
+ * rwDEVICESYSTEMINITIATESTOP(NULL, NULL, 0)
+ * rwDEVICESYSTEMRXPIPELINEREQUESTPIPE(RxPipeline **pipelineRef, NULL, RwInt32 pipeType)
+ * rwDEVICESYSTEMDD - start of device specific controls
+ */
+
+#define rwPIPETYPEMATERIAL 0
+#define rwPIPETYPEWORLDSECTORINSTANCE 1
+#define rwPIPETYPEATOMICINSTANCE 2
+
+enum RwCoreDeviceSystemFn
+{
+ rwDEVICESYSTEMOPEN = 0x00,
+ rwDEVICESYSTEMCLOSE,
+ rwDEVICESYSTEMSTART,
+ rwDEVICESYSTEMSTOP,
+ rwDEVICESYSTEMREGISTER,
+ rwDEVICESYSTEMGETNUMMODES,
+ rwDEVICESYSTEMGETMODEINFO,
+ rwDEVICESYSTEMUSEMODE,
+ rwDEVICESYSTEMFOCUS,
+ rwDEVICESYSTEMINITPIPELINE,
+ rwDEVICESYSTEMGETMODE,
+ rwDEVICESYSTEMSTANDARDS,
+ rwDEVICESYSTEMGETTEXMEMSIZE,
+ rwDEVICESYSTEMGETNUMSUBSYSTEMS,
+ rwDEVICESYSTEMGETSUBSYSTEMINFO,
+ rwDEVICESYSTEMGETCURRENTSUBSYSTEM,
+ rwDEVICESYSTEMSETSUBSYSTEM,
+ rwDEVICESYSTEMFINALIZESTART,
+ rwDEVICESYSTEMINITIATESTOP,
+ rwDEVICESYSTEMGETMAXTEXTURESIZE,
+ rwDEVICESYSTEMRXPIPELINEREQUESTPIPE,
+ rwDEVICESYSTEMGETMETRICBLOCK,
+ rwDEVICESYSTEMDD = 0x1000,
+ rwCOREDEVICESYSTEMFNFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwCoreDeviceSystemFn RwCoreDeviceSystemFn;
+
+/******************************************************************************/
+/********************* Standard functions *************************************/
+/******************************************************************************/
+
+#define rwSTANDARDNASTANDARD 0
+#define rwSTANDARDCAMERABEGINUPDATE 1 /* Start 3d camera update */
+#define rwSTANDARDRGBTOPIXEL 2 /* For an RGB value return a pixel value */
+#define rwSTANDARDPIXELTORGB 3 /* For a pixel value returns a RGB value */
+#define rwSTANDARDRASTERCREATE 4 /* Create an raster */
+#define rwSTANDARDRASTERDESTROY 5 /* Raster destroy */
+#define rwSTANDARDIMAGEGETRASTER 6 /* Get image from a raster */
+#define rwSTANDARDRASTERSETIMAGE 7 /* Set raster from an image */
+#define rwSTANDARDTEXTURESETRASTER 8 /* Set texture's raster */
+#define rwSTANDARDIMAGEFINDRASTERFORMAT 9 /* Find a suitable raster format for an image */
+#define rwSTANDARDCAMERAENDUPDATE 10 /* End 3d camera update */
+#define rwSTANDARDSETRASTERCONTEXT 11 /* Start destination of 2d operations */
+#define rwSTANDARDRASTERSUBRASTER 12 /* Make a raster inside another raster */
+#define rwSTANDARDRASTERCLEARRECT 13 /* Clear a rectangle of the current dest raster */
+#define rwSTANDARDRASTERCLEAR 14 /* Clear the current dest raster */
+#define rwSTANDARDRASTERLOCK 15 /* Lock a raster to get it's pixels */
+#define rwSTANDARDRASTERUNLOCK 16 /* Unlock a raster to return it's pixels */
+#define rwSTANDARDRASTERRENDER 17 /* Render a raster (not scaled, but masked) */
+#define rwSTANDARDRASTERRENDERSCALED 18 /* Render a raster (scaled and masked) */
+#define rwSTANDARDRASTERRENDERFAST 19 /* Render a raster (not scaled or masked) */
+#define rwSTANDARDRASTERSHOWRASTER 20 /* Show a camera raster */
+#define rwSTANDARDCAMERACLEAR 21 /* Clear a camera's raster and/or Z raster */
+#define rwSTANDARDHINTRENDERF2B 22 /* Set hint for rendering direction in the world */
+#define rwSTANDARDRASTERLOCKPALETTE 23 /* Lock a raster to get it's palette */
+#define rwSTANDARDRASTERUNLOCKPALETTE 24 /* Unlock a raster to return it's palette */
+#define rwSTANDARDNATIVETEXTUREGETSIZE 25 /* Get size of native texture when written to a stream */
+#define rwSTANDARDNATIVETEXTUREREAD 26 /* Read native texture from the stream */
+#define rwSTANDARDNATIVETEXTUREWRITE 27 /* Write native texture to the stream */
+#define rwSTANDARDRASTERGETMIPLEVELS 28 /* Get the number of mip levels in a raster */
+#define rwSTANDARDNUMOFSTANDARD 29
+
+/****************************************************************************
+ Global Types
+ */
+
+/* Standard functions */
+typedef RwBool (*RwStandardFunc)(void *pOut,void *pInOut,RwInt32 nI);
+
+typedef struct RwEngineOpenParams RwEngineOpenParams;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwengine
+ * \struct RwEngineOpenParams
+ * This type is used to specify device dependent parameters
+ * for use by the API function \ref RwEngineOpen.
+ * For a Windows application the displayID field
+ * should be set to the window's handle (of type HWND).
+ * For NULL and sky libraries displayID=0:
+ */
+#endif /* RWADOXYGENEXTERNAL */
+struct RwEngineOpenParams
+{
+ void *displayID; /**< Display Identifier */
+};
+
+/* nOption is one of a list of possible System defines (see above) */
+typedef RwBool
+ (*RwSystemFunc)(RwInt32 nOption,
+ void *pOut,
+ void *pInOut,
+ RwInt32 nIn);
+
+/* Device block */
+typedef RwBool
+ (*RwRenderStateSetFunction)(RwRenderState nState,void *pParam);
+
+typedef RwBool
+ (*RwRenderStateGetFunction)(RwRenderState nState,void *pParam);
+
+typedef RwBool
+ (*RwIm2DRenderLineFunction)(RwIm2DVertex *vertices,
+ RwInt32 numVertices,
+ RwInt32 vert1,
+ RwInt32 vert2);
+
+typedef RwBool
+ (*RwIm2DRenderTriangleFunction)(RwIm2DVertex *vertices,
+ RwInt32 numVertices,
+ RwInt32 vert1,
+ RwInt32 vert2,
+ RwInt32 vert3);
+
+typedef RwBool
+ (*RwIm2DRenderPrimitiveFunction)(RwPrimitiveType primType,
+ RwIm2DVertex *vertices,
+ RwInt32 numVertices);
+
+typedef RwBool
+ (*RwIm2DRenderIndexedPrimitiveFunction)(RwPrimitiveType primType,
+ RwIm2DVertex *vertices,
+ RwInt32 numVertices,
+ RwImVertexIndex *indices,
+ RwInt32 numIndices);
+
+typedef RwBool
+ (*RwIm3DRenderLineFunction)(RwInt32 vert1,
+ RwInt32 vert2);
+
+typedef RwBool
+ (*RwIm3DRenderTriangleFunction)(RwInt32 vert1,
+ RwInt32 vert2,
+ RwInt32 vert3);
+
+typedef RwBool
+ (*RwIm3DRenderPrimitiveFunction)(RwPrimitiveType primType);
+
+typedef RwBool
+ (*RwIm3DRenderIndexedPrimitiveFunction)(RwPrimitiveType primtype,
+ RwImVertexIndex *indices,
+ RwInt32 numIndices);
+
+
+typedef struct RwDevice RwDevice;
+
+#if (!defined(DOXYGEN))
+/*
+ * struct RwDevice
+ * Structure describing a display device
+ */
+struct RwDevice
+{
+ RwReal gammaCorrection; /* Gamma correction */
+ RwSystemFunc fpSystem; /* System handler */
+ RwReal zBufferNear; /* Near Z buffer value */
+ RwReal zBufferFar; /* Far Z buffer value */
+
+ /* Immediate mode functions */
+ RwRenderStateSetFunction fpRenderStateSet; /* Internal Use */
+ RwRenderStateGetFunction fpRenderStateGet; /* Internal Use */
+
+ /* Render functions */
+ RwIm2DRenderLineFunction fpIm2DRenderLine; /* Internal Use */
+ RwIm2DRenderTriangleFunction fpIm2DRenderTriangle; /* Internal Use */
+ RwIm2DRenderPrimitiveFunction fpIm2DRenderPrimitive; /* Internal Use */
+ RwIm2DRenderIndexedPrimitiveFunction fpIm2DRenderIndexedPrimitive; /* Internal Use */
+
+ RwIm3DRenderLineFunction fpIm3DRenderLine; /* Internal Use */
+ RwIm3DRenderTriangleFunction fpIm3DRenderTriangle; /* Internal Use */
+ RwIm3DRenderPrimitiveFunction fpIm3DRenderPrimitive; /* Internal Use */
+ RwIm3DRenderIndexedPrimitiveFunction fpIm3DRenderIndexedPrimitive; /* Internal Use */
+};
+
+#endif /* (!defined(DOXYGEN)) */
+
+typedef struct RwMetrics RwMetrics;
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwengine
+ * \struct RwMetrics
+ * This structure provides information about the performance
+ * of the application. The metrics are recorded only in the metrics
+ * libraries. To use metrics you should compile with the RWMETRICS
+ * preprocessor symbol defines, and link with the metrics libraries
+ * that ship with the SDK. The metrics are recorded on a per-frame
+ * basis. Each platform may provide additional information that
+ * is specific to that platform. Note that either the
+ * \ref numTextureUploads or \ref numResourceAllocs being non-zero can
+ * be considered as bad news and will indicate a significantly
+ * reduced rendering performance.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+struct RwMetrics
+{
+ RwUInt32 numTriangles; /**< Number of triangles processed */
+ RwUInt32 numProcTriangles; /**< Number of mesh triangles processed */
+ RwUInt32 numVertices; /**< Number of vertices processed */
+ RwUInt32 numTextureUploads; /**< Number of textures swapped */
+ RwUInt32 sizeTextureUploads; /**< Size of textures swapped */
+ RwUInt32 numResourceAllocs; /**< Number of resource blocks swapped */
+ void *devSpecificMetrics; /**< Device specific metrics */
+};
+
+#define SUBSYSTEMNAME_MAXLEN 80
+
+typedef struct RwSubSystemInfo RwSubSystemInfo;
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwengine
+ * \struct RwSubSystemInfo
+ * This type is used to represent information about a device.
+ * The only available field specifies a character string
+ * which identifies the subsystem
+ * (see API function \ref RwEngineGetSubSystemInfo). */
+#endif /* RWADOXYGENEXTERNAL */
+struct RwSubSystemInfo
+{
+ RwChar name[SUBSYSTEMNAME_MAXLEN]; /**< Sub system string */
+};
+
+
+/* Video modes */
+/* These are flag bits which may be ORd */
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwengine
+ * RwVideoModeFlag
+ * These flags specify the type of display that RenderWare
+ * will use. The flags may be OR'd together to build composite modes.
+ * Note that not all modes are supported on all platforms.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+enum RwVideoModeFlag
+{
+ rwVIDEOMODEEXCLUSIVE = 0x1, /**<Exclusive (i.e. full-screen) */
+ rwVIDEOMODEINTERLACE = 0x2, /**<Interlaced */
+ rwVIDEOMODEFFINTERLACE = 0x4, /**<Flicker Free Interlaced */
+ rwVIDEOMODEFSAA0 = 0x8, /**< \if sky2
+ * Full-screen antialiasing mode 0
+ * \endif */
+ rwVIDEOMODEFSAA1 = 0x10, /**< \if sky2
+ * Full-screen antialiasing mode 1
+ * \endif */
+ rwVIDEOMODEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwVideoModeFlag RwVideoModeFlag;
+
+typedef struct RwVideoMode RwVideoMode;
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwengine
+ * \struct RwVideoMode
+ * This type represents a video mode available on a device specified
+ * by the frame buffer resolution (width and height) and depth,
+ * and a flag indicating whether the device has exclusive use of
+ * the mode (see API function \ref RwEngineGetVideoModeInfo):
+ */
+#endif /* RWADOXYGENEXTERNAL */
+struct RwVideoMode
+{
+ RwInt32 width; /**< Width */
+ RwInt32 height; /**< Height */
+ RwInt32 depth; /**< Depth */
+ RwVideoModeFlag flags; /**< Flags */
+};
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwengine
+ * RwEngineInitFlag
+ * Engine initialization flags. An application can use
+ * these to control the memory manager that RenderWare uses for dynamic
+ * memory management. By default RenderWare uses FreeLists. This is the
+ * preferred way of using RenderWare. If the application does not want
+ * RenderWare to use the memory manager, then the application can pass
+ * rwENGINEINITNOFREELISTS as the argument to \ref RwEngineInit and
+ * RenderWare will replace freelist calls to corresponding calls to
+ * RwMalloc and RwFree. This will result in more memory management
+ * related calls.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+enum RwEngineInitFlag
+{
+ rwENGINEINITFREELISTS = 0, /**<Use Freelists */
+ rwENGINEINITNOFREELISTS = 0x1, /**<Don't use Freelists */
+ rwENGINEINITFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwEngineInitFlag RwEngineInitFlag;
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Get the library binary version */
+extern RwInt32 RwEngineGetVersion(void);
+
+/* Sequence of events to get RenderWare up and running */
+extern RwBool RwEngineInit(const RwMemoryFunctions *memFuncs,
+ RwUInt32 initFlags,
+ RwUInt32 resArenaSize);
+extern RwInt32 RwEngineRegisterPlugin(RwInt32 size, RwUInt32 pluginID,
+ RwPluginObjectConstructor initCB,
+ RwPluginObjectDestructor termCB);
+extern RwInt32 RwEngineGetPluginOffset(RwUInt32 pluginID);
+extern RwBool RwEngineOpen(RwEngineOpenParams *initParams);
+extern RwBool RwEngineStart(void);
+extern RwBool RwEngineStop(void);
+extern RwBool RwEngineClose(void);
+extern RwBool RwEngineTerm(void);
+
+/* Finding out about the rendering sub systems available */
+extern RwInt32 RwEngineGetNumSubSystems(void);
+extern RwSubSystemInfo *RwEngineGetSubSystemInfo(RwSubSystemInfo *subSystemInfo, RwInt32 subSystemIndex);
+extern RwInt32 RwEngineGetCurrentSubSystem(void);
+extern RwBool RwEngineSetSubSystem(RwInt32 subSystemIndex);
+
+/* Finding out about the modes available */
+extern RwInt32 RwEngineGetNumVideoModes(void);
+extern RwVideoMode *RwEngineGetVideoModeInfo(RwVideoMode *modeinfo, RwInt32 modeIndex);
+extern RwInt32 RwEngineGetCurrentVideoMode(void);
+extern RwBool RwEngineSetVideoMode(RwInt32 modeIndex);
+
+/* Finding out how much texture memory is available */
+extern RwInt32 RwEngineGetTextureMemorySize(void);
+extern RwInt32 RwEngineGetMaxTextureSize(void);
+
+/* Getting/Releasing the focus */
+extern RwBool RwEngineSetFocus(RwBool enable);
+
+/* Getting metrics */
+extern RwMetrics *RwEngineGetMetrics(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/bafsys.h ---*/
+
+/****************************************************************************
+ Global Types
+ */
+
+/*
+ * rwFnFexist
+ * Returns TRUE if file with given name exists, FALSE if it doesn't.
+ */
+typedef RwBool (*rwFnFexist)(const RwChar *name);
+
+/*
+ * rwFnFopen
+ * Mimics ANSI C Standard Library fopen.
+ */
+typedef void *(*rwFnFopen)(const RwChar *name, const RwChar *mode);
+
+/*
+ * rwFnFclose
+ * Mimics ANSI C Standard Library fclose.
+ */
+typedef int (*rwFnFclose)(void *fptr);
+
+/*
+ * rwFnFread
+ * Mimics ANSI C Standard Library fread.
+ */
+typedef size_t (*rwFnFread)(void *addr, size_t size, size_t count, void *fptr);
+
+/*
+ * rwFnFwrite
+ * Mimics ANSI C Standard Library fwrite.
+ */
+typedef size_t (*rwFnFwrite)(const void *addr, size_t size, size_t count, void *fptr);
+
+/*
+ * rwFnFgets
+ * Mimics ANSI C Standard Library fgets.
+ */
+typedef RwChar *(*rwFnFgets)(RwChar *buffer, int maxLen, void *fptr);
+
+/*
+ * rwFnFputs
+ * Mimics ANSI C Standard Library fputs.
+ */
+typedef int (*rwFnFputs)(const RwChar *buffer, void *fptr);
+
+/*
+ * rwFnFeof
+ * Mimics ANSI C Standard Library feof.
+ */
+typedef int (*rwFnFeof)(void *fptr);
+
+/*
+ * rwFnFseek
+ * Mimics ANSI C Standard Library fseek.
+ */
+typedef int (*rwFnFseek)(void *fptr, long offset, int origin);
+
+/*
+ * rwFnFflush
+ * Mimics ANSI C Standard Library fflush.
+ */
+typedef int (*rwFnFflush)(void *fptr);
+
+/*
+ * rwFnFtell
+ * Mimics ANSI C Standard Library ftell.
+ */
+typedef int (*rwFnFtell)(void *fptr);
+
+
+typedef struct RwFileFunctions RwFileFunctions;
+/**
+ * \ingroup memoryfileinterface
+ * \struct RwFileFunctions
+ * This type is used to specify the file access
+ * functions used by RenderWare. The default file system uses the standard
+ * ANSI functions. The application may install an alternative file system
+ * providing it complies with the ANSI interface -- see API
+ * function \ref RwOsGetFileInterface.
+ *
+ * The function types associated with this type are defined as follows
+ *
+ * \verbatim
+ RwBool (*rwFnFexist)(const RwChar *name)
+ void *(*rwFnFopen)(const RwChar *name, const RwChar *access)
+ int (*rwFnFclose)(void *fptr)
+ size_t (*rwFnFread)(void *addr, size_t size, size_t count, void *fptr)
+ size_t (*rwFnFwrite)(const void *addr, size_t size, size_t count,
+ void *fptr)
+ RwChar *(*rwFnFgets)(RwChar *buffer, int maxLen, void *fptr)
+ int (*rwFnFputs)(const RwChar *buffer, void *fptr)
+ int (*rwFnFeof)(void *fptr)
+ int (*rwFnFseek)(void *fptr, long offset, int origin)
+ int (*rwFnFflush)(void *fptr)
+ int (*rwFnFtell)(void *fptr)
+ \endverbatim
+ * Note the function argument lists are consistent with the ANSI
+ * standard file access interface:
+ */
+struct RwFileFunctions
+{
+ rwFnFexist rwfexist; /**< Pointer to fexist function */
+ rwFnFopen rwfopen; /**< Pointer to fopen function */
+ rwFnFclose rwfclose; /**< Pointer to fclose function */
+ rwFnFread rwfread; /**< Pointer to fread function */
+ rwFnFwrite rwfwrite; /**< Pointer to fwrite function */
+ rwFnFgets rwfgets; /**< Pointer to fgets function */
+ rwFnFputs rwfputs; /**< Pointer to puts function */
+ rwFnFeof rwfeof; /**< Pointer to feof function */
+ rwFnFseek rwfseek; /**< Pointer to fseek function */
+ rwFnFflush rwfflush; /**< Pointer to fflush function */
+ rwFnFtell rwftell; /**< Pointer to ftell function */
+};
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwFileFunctions *RwOsGetFileInterface(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/baerr.h ---*/
+/****************************************************************************
+ Global Types
+ */
+
+typedef struct RwError RwError;
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwerror
+ * \struct RwError
+ * This type represents a RenderWare error specified by the
+ * ID of the plugin that the error was issued from (pluginID) and the error
+ * code itself (errorCode) (see API function \ref RwErrorGet).
+ * \param pluginID The ID of the plugin that issued the error.
+ * \param errorCode A value representing the error code.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+struct RwError
+{
+ RwInt32 pluginID; /**< Internal Use */
+ RwInt32 errorCode; /**< Internal Use */
+};
+
+#define RWECODE(a,b) a,
+
+/* common errors have the MSB set */
+
+enum RwErrorCodeCommon
+{
+ E_RW_NOERROR = (int)0x80000000L,
+#include "errcom.def"
+ E_RW_LASTERROR = RWFORCEENUMSIZEINT
+};
+typedef enum RwErrorCodeCommon RwErrorCodeCommon;
+
+#undef RWECODE
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+extern RwError *RwErrorGet(RwError *code);
+extern RwError *RwErrorSet(RwError *code);
+extern RwInt32 _rwerror(RwInt32 code, ...);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/badebug.h ---*/
+
+/****************************************************************************
+ Global Types
+ */
+
+/**
+ * \ingroup rwdebug
+ * RwDebugType
+ * This type represents the different types of debug and
+ * trace messages that can be sent to the currently installed debug handler
+ * (see API function \ref RwDebugSendMessage)*/
+enum RwDebugType
+{
+ rwNADEBUGTYPE = 0, /**<Invalid */
+ rwDEBUGASSERT, /**<Send an assert message */
+ rwDEBUGERROR, /**<Send an error message */
+ rwDEBUGMESSAGE, /**<Send an informational message */
+ rwDEBUGTRACE, /**<Send a trace message */
+ rwDEBUGTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwDebugType RwDebugType;
+
+/**
+ * \ingroup rwdebug
+ * \ref RwDebugHandler
+ * This type represents the
+ * function called from \ref RwDebugSendMessage for sending a message to the
+ * RenderWare debug stream.
+ *
+ * \param type Type of debug message (assert, error, etc.).
+ *
+ * \param string Pointer to a string containing the error
+ * message.
+ *
+ * \see RwDebugSetHandler
+ */
+typedef void (*RwDebugHandler) (RwDebugType type,
+
+ const RwChar * string);
+
+#ifdef RWDEBUG
+
+#define RwDebugSendMessage(type, funcName, message) \
+ _rwDebugSendMessage(type, \
+ RWSTRING(__FILE__), \
+ __LINE__, \
+ funcName, \
+ message)
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Setting the debug message handler */
+extern RwDebugHandler RwDebugSetHandler(RwDebugHandler handler);
+extern void RwDebugSetTraceState(RwBool state);
+
+extern void _rwDebugSendMessage(RwDebugType type,
+ const RwChar * file,
+ const RwInt32 line,
+ const RwChar * funcName,
+ const RwChar * message);
+
+/* Sending a message */
+extern RwChar *_rwdberrcommon(RwInt32 code, ...);
+
+#if (!defined(DOXYGEN))
+/* Doxy doesn't appear to like the __RWFORMAT__ attribute */
+extern RwChar *_rwdbsprintf(const RwChar * format,
+ ...) __RWFORMAT__(printf, 1, 2);
+#endif /* (!defined(DOXYGEN)) */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#else /* RWDEBUG */
+
+#define RwDebugSetHandler(handler)
+#define RwDebugSetTraceState(state)
+#define RwDebugSendMessage(type, funcName, message)
+
+#if (!defined(RWREGSETDEBUGTRACE))
+#define RWREGSETDEBUGTRACE(_name) /* No op */
+#endif /* (!defined(RWREGSETDEBUGTRACE)) */
+
+#endif /* RWDEBUG */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/balibtyp.h ---*/
+/* Finding MSBs */
+
+#define RWBYTEFINDMSB(a) \
+ (_rwMsbBit[(a)]-1)
+
+#define RWWORDFINDMSB(a) \
+ (((a)&0xff00)?RWBYTEFINDMSB((a)>>8)+8: RWBYTEFINDMSB(a))
+
+#define RWLONGFINDMSB(a) \
+ (((a)&0xffff0000UL)?RWWORDFINDMSB((a)>>16)+16: RWWORDFINDMSB(a))
+
+/****************************************************************************
+ Defines
+ */
+
+/* macros used to access plugin data in objects */
+#define RWPLUGINOFFSET(_type, _base, _offset) \
+ ((_type *)((RwUInt8 *)(_base) + (_offset)))
+
+#define RWPLUGINOFFSETCONST(_type, _base, _offset) \
+ ((const _type *)((const RwUInt8 *)(_base) + (_offset)))
+
+/* macro used to access global data structure (the root type is RwGlobals) */
+#define RWSRCGLOBAL(variable) \
+ (((RwGlobals *)RwEngineInstance)->variable)
+
+#define RWASSERTISTYPE(_f, _t) \
+ RWASSERT((((const RwObject *)(_f))->type)==(_t))
+
+/****************************************************************************
+ Global Types
+ */
+
+enum RwEngineStatus
+{
+ rwENGINESTATUSIDLE = 0, /* This needs to be zero */
+ rwENGINESTATUSINITED = 1,
+ rwENGINESTATUSOPENED = 2,
+ rwENGINESTATUSSTARTED = 3,
+ rwENGINESTATUSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
+};
+typedef enum RwEngineStatus RwEngineStatus;
+
+typedef struct RwGlobals RwGlobals;
+
+#if (!defined(DOXYGEN))
+struct RwGlobals
+{
+#ifdef RWDEBUG
+ RwDebugHandler debugFunction; /* debug string handler */
+ void *debugFile; /* debug output file */
+ RwInt32 debugStackDepth; /* current depth of function stack */
+ RwBool debugTrace; /* is function tracing enabled */
+#endif
+
+ /* Current entities */
+ void *curCamera; /* Current camera */
+ void *curWorld; /* Current World */
+
+ /* Checking counters */
+ RwUInt16 renderFrame; /* Camera display count */
+ RwUInt16 lightFrame; /* Used to ensure each light is applied only once. */
+ RwUInt16 pad[2]; /* Longword align it again */
+
+ /* For the currently accessed device */
+ RwDevice dOpenDevice;
+
+ /* Standard renderers and functions */
+ RwStandardFunc stdFunc[rwSTANDARDNUMOFSTANDARD];
+
+ /* All of the frames which have been updated */
+ RwLinkList dirtyFrameList;
+
+ /* The file functions */
+ RwFileFunctions fileFuncs;
+
+ /* The string functions */
+ RwStringFunctions stringFuncs;
+
+ /* The memory allocation functions */
+ RwMemoryFunctions memoryFuncs;
+#ifdef RWDEBUG
+ RwBool freeListExtraDebug;
+#endif /* RWDEBUG */
+
+ /* virtual memory alloc/free functions */
+ RwMemoryAllocFn memoryAlloc;
+ RwMemoryFreeFn memoryFree;
+
+ RwMetrics *metrics;
+
+ /* Current engine status */
+ RwEngineStatus engineStatus;
+
+ /* Resource arena init size. */
+ RwUInt32 resArenaInitSize;
+};
+
+typedef struct RwModuleInfo RwModuleInfo;
+struct RwModuleInfo
+{
+ RwInt32 globalsOffset;
+ RwInt32 numInstances;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+
+
+/****************************************************************************
+ Program wide globals
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#ifdef RWGLOBALSIZE
+extern RwUInt32 ourGlobals[RWGLOBALSIZE / sizeof(RwUInt32)];
+#define RwEngineInstance ourGlobals
+#else /* RWGLOBALSIZE */
+
+#ifdef _RWDLL
+__declspec(dllimport) extern void *RwEngineInstance;
+#else
+extern void *RwEngineInstance;
+#endif
+
+#endif /* RWGLOBALSIZE */
+
+extern RwInt8 _rwMsbBit[];
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/baresour.h ---*/
+
+#define RWRESOURCESGLOBAL(var) (RWPLUGINOFFSET(rwResourcesGlobals, \
+ RwEngineInstance, resourcesModule.globalsOffset)->var)
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwresources
+ * \struct RwResEntry
+ * RwResEntry object. Instanced data block in resources arena.
+ * This should be considered an opaque
+ * type. Use the RwResEntry API functions to access.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+
+typedef struct RwResEntry RwResEntry;
+
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwresources
+ * \ref RwResEntryDestroyNotify type represents the function
+ * called from \ref RwResourcesFreeResEntry (and indirectly from
+ * \ref RwResourcesEmptyArena) immediately before the memory used by the
+ * specified resources entry is released.
+ *
+ * \param resEntry Pointer to the instanced data.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+typedef void (*RwResEntryDestroyNotify) (RwResEntry * resEntry);
+
+#if (!defined(DOXYGEN))
+struct RwResEntry
+{
+ RwLLLink link; /* Node in the list of resource elements */
+ RwInt32 size; /* Size of this node */
+ void *owner; /* Owner of this node */
+ RwResEntry **ownerRef; /* Pointer to pointer to this (enables de-alloc) */
+ RwResEntryDestroyNotify destroyNotify; /* This is called right before destruction */
+};
+#endif /* (!defined(DOXYGEN)) */
+
+typedef struct rwResources rwResources;
+
+#if (!defined(DOXYGEN))
+struct rwResources
+{
+ RwInt32 maxSize;
+ RwInt32 currentSize;
+ RwInt32 reusageSize;
+
+ void *memHeap;
+
+ RwLinkList entriesA;
+ RwLinkList entriesB;
+
+ RwLinkList *freeEntries;
+ RwLinkList *usedEntries;
+};
+
+
+typedef struct rwResourcesGlobals rwResourcesGlobals;
+struct rwResourcesGlobals
+{
+ rwResources res;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Setting the resources arena size */
+extern RwBool RwResourcesSetArenaSize(RwUInt32 size);
+extern RwInt32 RwResourcesGetArenaSize(void);
+extern RwInt32 RwResourcesGetArenaUsage(void);
+extern RwBool RwResourcesEmptyArena(void);
+
+/* Allocate */
+extern RwResEntry *RwResourcesAllocateResEntry(void *owner,
+ RwResEntry **ownerRef,
+ RwInt32 size,
+ RwResEntryDestroyNotify
+ destroyNotify);
+/* Deallocate */
+extern RwBool RwResourcesFreeResEntry(RwResEntry * entry);
+/* Mark all as unused */
+extern void _rwResourcesPurge(void);
+#if ((defined(RWDEBUG)) || (defined(RWSUPPRESSINLINE)))
+/* Mark as used */
+extern RwResEntry *RwResourcesUseResEntry(RwResEntry * entry);
+#endif /* ((defined(RWDEBUG)) || (defined(RWSUPPRESSINLINE))) */
+
+extern RwModuleInfo resourcesModule;
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#if ((!defined(RWDEBUG)) && (!defined(RWSUPPRESSINLINE)))
+#define RwResourcesUseResEntry(_ntry) \
+ ((((_ntry)->link.next)? \
+ (rwLinkListRemoveLLLink(&((_ntry)->link)), \
+ rwLinkListAddLLLink(RWRESOURCESGLOBAL(res.usedEntries), \
+ &((_ntry)->link))): \
+ NULL), \
+ (_ntry))
+#endif /* ((!defined(RWDEBUG)) && (!defined(RWSUPPRESSINLINE))) */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/bacolor.h ---*/
+/****************************************************************************
+ Global Types
+ */
+
+typedef struct RwRGBAReal RwRGBAReal;
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwrgba
+ * \struct RwRGBAReal
+ * This structure represents a RGBA color which has
+ * components specified as real values.
+ *
+ * A color component of an RwRGBA with the value 255 generally corresponds
+ * to the associated component in an RwRGBAReal with the value 1.0f.
+ * However, any values can be substituted to denormalize/normalize
+ * RwRGBAReal and create different effects. For example, while light colors
+ * are expressed as normalized RGBA, interesting effects can be gained using
+ * larger values.
+ *
+ * It should also be noted that a color component of an RwRGBA with the
+ * value 0 generally corresponds to the associcated component in an
+ * RwRGBAReal with the value 0.0.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+struct RwRGBAReal
+{
+ RwReal red; /**< red component */
+ RwReal green; /**< green component */
+ RwReal blue; /**< blue component */
+ RwReal alpha; /**< alpha component */
+};
+
+#if (!defined(RwRGBARealAssign))
+#define RwRGBARealAssign(_target, _source) \
+ ( *(_target) = *(_source) )
+#endif /* (!defined(RwRGBARealAssign)) */
+
+typedef struct RwRGBA RwRGBA;
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwrgba
+ * \struct RwRGBA
+ * This structure represents a RGBA color
+ * which has integer components specified in the range 0 to 255.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+struct RwRGBA
+{
+ RwUInt8 red; /**< red component */
+ RwUInt8 green; /**< green component */
+ RwUInt8 blue; /**< blue component */
+ RwUInt8 alpha; /**< alpha component */
+};
+
+#if (!defined(RwRGBAAssign))
+#define RwRGBAAssign(_target, _source) \
+ ( *(_target) = *(_source) )
+#endif /* (!defined(RwRGBAAssign)) */
+
+#define RwRGBARealAddMacro(o,a,b) \
+MACRO_START \
+{ \
+ (o)->red = (((a)->red) + ( (b)->red)); \
+ (o)->green = (((a)->green) + ( (b)->green)); \
+ (o)->blue = (((a)->blue) + ( (b)->blue)); \
+ (o)->alpha = (((a)->alpha) + ( (b)->alpha)); \
+} \
+MACRO_STOP
+
+#define RwRGBARealSubMacro(o,a,b) \
+MACRO_START \
+{ \
+ (o)->red = (((a)->red) - ( (b)->red)); \
+ (o)->green = (((a)->green) - ( (b)->green)); \
+ (o)->blue = (((a)->blue) - ( (b)->blue)); \
+ (o)->alpha = (((a)->alpha) - ( (b)->alpha)); \
+} \
+MACRO_STOP
+
+#define RwRGBARealScaleMacro(o,a,scale) \
+MACRO_START \
+{ \
+ (o)->red = (((a)->red) * ( scale)); \
+ (o)->green = (((a)->green) * ( scale)); \
+ (o)->blue = (((a)->blue) * ( scale)); \
+ (o)->alpha = (((a)->alpha) * ( scale)); \
+} \
+MACRO_STOP
+
+/* Conversion macros */
+#define RwRGBAFromRwRGBARealMacro(o, i) \
+MACRO_START \
+{ \
+ RwInt32 quantize; \
+ \
+ quantize = RwInt32FromRealMacro( ((i)->red * (RwReal)255.0) \
+ + (RwReal)0.5 ); \
+ (o)->red = (RwUInt8) quantize; \
+ quantize = RwInt32FromRealMacro( ((i)->green * (RwReal)255.0) \
+ + (RwReal)0.5 ); \
+ (o)->green = (RwUInt8) quantize; \
+ quantize = RwInt32FromRealMacro( ((i)->blue * (RwReal)255.0) \
+ + (RwReal)0.5 ); \
+ (o)->blue = (RwUInt8) quantize; \
+ quantize = RwInt32FromRealMacro( ((i)->alpha * (RwReal)255.0) \
+ + (RwReal)0.5 ); \
+ (o)->alpha = (RwUInt8) quantize; \
+ \
+} \
+MACRO_STOP
+
+#define RwRGBARealFromRwRGBAMacro(o, i) \
+MACRO_START \
+{ \
+ (o)->red = \
+ (((RwReal)(((i)->red))) * ( (RwReal)((1.0/255.0)))); \
+ (o)->green = \
+ (((RwReal)(((i)->green))) * ( (RwReal)((1.0/255.0)))); \
+ (o)->blue = \
+ (((RwReal)(((i)->blue))) * ( (RwReal)((1.0/255.0)))); \
+ (o)->alpha = \
+ (((RwReal)(((i)->alpha))) * ( (RwReal)((1.0/255.0)))); \
+} \
+MACRO_STOP
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ))
+
+#define RwRGBARealAdd(o,a,b) \
+ RwRGBARealAddMacro(o,a,b)
+
+#define RwRGBARealSub(o,a,b) \
+ RwRGBARealSubMacro(o,a,b)
+
+#define RwRGBARealScale(o,a,scale) \
+ RwRGBARealScaleMacro(o,a,scale)
+
+#define RwRGBAFromRwRGBAReal(o, i) \
+ RwRGBAFromRwRGBARealMacro(o, i)
+
+#define RwRGBARealFromRwRGBA(o, i) \
+ RwRGBARealFromRwRGBAMacro(o, i)
+
+#else /* (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) */
+
+/* Function versions for debug */
+extern void RwRGBARealAdd(RwRGBAReal *result,
+ const RwRGBAReal *source1,
+ const RwRGBAReal *source2);
+
+extern void RwRGBARealSub(RwRGBAReal *result,
+ const RwRGBAReal *source1,
+ const RwRGBAReal *source2);
+
+extern void RwRGBARealScale(RwRGBAReal *result,
+ const RwRGBAReal *source,
+ RwReal scalar);
+
+extern void RwRGBAFromRwRGBAReal(RwRGBA *result,
+ const RwRGBAReal *source);
+
+extern void RwRGBARealFromRwRGBA(RwRGBAReal *result,
+ RwRGBA *source);
+
+#endif /* (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/babinmtx.h ---*/
+
+/****************************************************************************
+ Global types
+ */
+
+/* Matrix stream format */
+typedef struct rwStreamMatrix RwMatrixChunkInfo;
+typedef struct rwStreamMatrix rwStreamMatrix;
+#if (!defined(DOXYGEN))
+struct rwStreamMatrix
+{
+ RwV3d right;
+ RwV3d up;
+ RwV3d at;
+ RwV3d pos;
+ RwInt32 type;
+};
+#endif /* (!defined(DOXYGEN)) */
+
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Matrix binary format */
+extern RwUInt32 RwMatrixStreamGetSize(const RwMatrix * matrix);
+extern RwMatrix *RwMatrixStreamRead(RwStream * stream,
+ RwMatrix * matrix);
+extern const RwMatrix *RwMatrixStreamWrite(const RwMatrix * matrix,
+ RwStream * stream);
+extern RwMatrixChunkInfo *RwMatrixChunkInfoRead(RwStream * stream,
+ RwMatrixChunkInfo *
+ matrixChunkInfo,
+ RwInt32 * bytesRead);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+/*--- Automatically derived from: C:/daily/rwsdk/src/plcore/babinary.h ---*/
+/****************************************************************************
+ Defines
+ */
+
+#ifndef rwCHUNKHEADERSIZE
+#define rwCHUNKHEADERSIZE (sizeof(RwUInt32)*3)
+#endif /* rwCHUNKHEADERSIZE */
+
+/* Compatibility macro */
+#define RwStreamWriteInt(_stream, _ints, _numBytes) \
+ RwStreamWriteInt32(_stream, _ints, _numBytes)
+
+#define RwStreamReadInt(_stream, _ints, _numBytes) \
+ RwStreamReadInt32(_stream, _ints, _numBytes)
+
+#define RwMemLittleEndian(_mem, _size) \
+ RwMemLittleEndian32(_mem, _size)
+
+#define RwMemNative(_mem, _size) \
+ RwMemNative32(_mem, _size)
+
+/****************************************************************************
+ Global Types
+ */
+
+typedef struct RwChunkHeaderInfo RwChunkHeaderInfo;
+#ifndef RWADOXYGENEXTERNAL
+/**
+ * \ingroup rwstream
+ * \struct RwChunkHeaderInfo
+ * Holds data for a chunk header read from a
+ * stream with \ref RwStreamReadChunkHeaderInfo.
+ */
+#endif /* RWADOXYGENEXTERNAL */
+struct RwChunkHeaderInfo
+{
+ RwUInt32 type; /**< chunk ID - see \ref RwStreamFindChunk */
+ RwUInt32 length; /**< length of the chunk data in bytes */
+ RwUInt32 version; /**< version of the chunk data.
+ * See \ref RwEngineGetVersion. */
+ RwUInt32 buildNum; /**< build number of the RenderWare libraries
+ * previously used to stream out the data */
+ RwBool isComplex; /**< Internal Use */
+};
+
+/****************************************************************************
+ Function prototypes
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/* Chunk header stuff */
+extern RwBool RwStreamFindChunk(RwStream *stream, RwUInt32 type,
+ RwUInt32 *lengthOut, RwUInt32 *versionOut);
+
+#define RwStreamWriteChunkHeader(stream, type, size) \
+ _rwStreamWriteVersionedChunkHeader( \
+ stream, type, size, rwLIBRARYCURRENTVERSION, RWBUILDNUMBER)
+
+extern RwStream *_rwStreamWriteVersionedChunkHeader(RwStream *stream,
+ RwInt32 type,
+ RwInt32 size,
+ RwUInt32 version,
+ RwUInt32 buildNum);
+
+extern RwStream *RwStreamWriteReal(RwStream *stream, const RwReal *reals,
+ RwUInt32 numBytes);
+extern RwStream *RwStreamWriteInt32(RwStream *stream, const RwInt32 *ints,
+ RwUInt32 numBytes);
+extern RwStream *RwStreamWriteInt16(RwStream *stream, const RwInt16 *ints,
+ RwUInt32 numBytes);
+
+extern RwStream *RwStreamReadReal(RwStream *stream, RwReal *reals,
+ RwUInt32 numBytes);
+extern RwStream *RwStreamReadInt32(RwStream *stream, RwInt32 *ints,
+ RwUInt32 numBytes);
+extern RwStream *RwStreamReadInt16(RwStream *stream, RwInt16 *ints,
+ RwUInt32 numBytes);
+
+/* Binary Portability Functions */
+extern void *RwMemLittleEndian16(void *mem, RwUInt32 size);
+extern void *RwMemLittleEndian32(void *mem, RwUInt32 size);
+extern void *RwMemNative16(void *mem, RwUInt32 size);
+extern void *RwMemNative32(void *mem, RwUInt32 size);
+extern void *RwMemRealToFloat32(void *mem, RwUInt32 size);
+extern void *RwMemFloat32ToReal(void *mem, RwUInt32 size);
+
+extern RwStream *
+RwStreamReadChunkHeaderInfo(RwStream *stream, RwChunkHeaderInfo *chunkHeaderInfo);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* RWPLCORE_H */