aboutsummaryrefslogtreecommitdiff
path: root/src/fakerw/rpworld.h
blob: f10a3754847f11391a89a39a0afb747e1c42759d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
#pragma once

#define rpATOMIC rw::Atomic::ID
#define rpCLUMP rw::Clump::ID

/*
 ***********************************************
 *
 * RpMaterial
 *
 ***********************************************
 */

//struct RpMaterial;
typedef rw::Material RpMaterial;

typedef RpMaterial *(*RpMaterialCallBack)(RpMaterial *material, void *data);

RpMaterial *RpMaterialCreate(void);
RwBool RpMaterialDestroy(RpMaterial *material);
RpMaterial *RpMaterialClone(RpMaterial *material);
RpMaterial *RpMaterialSetTexture(RpMaterial *material, RwTexture *texture);
RpMaterial *RpMaterialAddRef(RpMaterial *material);
RwTexture *RpMaterialGetTexture(const RpMaterial *material);
RpMaterial *RpMaterialSetColor(RpMaterial *material, const RwRGBA *color);
const RwRGBA *RpMaterialGetColor(const RpMaterial *material);
RpMaterial *RpMaterialSetSurfaceProperties(RpMaterial *material, const RwSurfaceProperties *surfaceProperties);
const RwSurfaceProperties *RpMaterialGetSurfaceProperties(const RpMaterial *material);
RwInt32 RpMaterialRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB);
RwInt32 RpMaterialRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB);
RwInt32 RpMaterialSetStreamAlwaysCallBack(RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB);
RwInt32 RpMaterialGetPluginOffset(RwUInt32 pluginID);
RwBool RpMaterialValidatePlugins(const RpMaterial *material);
RwUInt32 RpMaterialStreamGetSize(const RpMaterial *material);
RpMaterial *RpMaterialStreamRead(RwStream *stream);
const RpMaterial *RpMaterialStreamWrite(const RpMaterial *material, RwStream *stream);
//RpMaterialChunkInfo *_rpMaterialChunkInfoRead(RwStream *stream,  RpMaterialChunkInfo *materialChunkInfo, RwInt32 *bytesRead);


/*
 ***********************************************
 *
 * RpLight
 *
 ***********************************************
 */

//struct RpLight;
typedef rw::Light RpLight;

enum RpLightType
{
	rpNALIGHTTYPE = 0,
	rpLIGHTDIRECTIONAL,
	rpLIGHTAMBIENT,
	rpLIGHTPOINT = 0x80,
	rpLIGHTSPOT,
	rpLIGHTSPOTSOFT,
};

enum RpLightFlag
{
	rpLIGHTLIGHTATOMICS = 0x01,
	rpLIGHTLIGHTWORLD = 0x02,
};

typedef RpLight    *(*RpLightCallBack) (RpLight * light, void *data);

RwReal RpLightGetRadius(const RpLight *light);
const RwRGBAReal *RpLightGetColor(const RpLight *light);
RpLight *RpLightSetFrame(RpLight *light, RwFrame *frame);
RwFrame *RpLightGetFrame(const RpLight *light);
RpLightType RpLightGetType(const RpLight *light);
RpLight *RpLightSetFlags(RpLight *light, RwUInt32 flags);
RwUInt32 RpLightGetFlags(const RpLight *light);
RpLight *RpLightCreate(RwInt32 type);
RwBool RpLightDestroy(RpLight *light);
RpLight *RpLightSetRadius(RpLight *light, RwReal radius);
RpLight *RpLightSetColor(RpLight *light, const RwRGBAReal *color);
RwReal RpLightGetConeAngle(const RpLight *light);
RpLight *RpLightSetConeAngle(RpLight * ight, RwReal angle);
RwUInt32 RpLightStreamGetSize(const RpLight *light);
RpLight *RpLightStreamRead(RwStream *stream);
const RpLight *RpLightStreamWrite(const RpLight *light, RwStream *stream);
//RpLightChunkInfo *_rpLightChunkInfoRead(RwStream *stream, RpLightChunkInfo *lightChunkInfo, RwInt32 *bytesRead);
RwInt32 RpLightRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB);
RwInt32 RpLightRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB);
RwInt32 RpLightSetStreamAlwaysCallBack(RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB);
RwInt32 RpLightGetPluginOffset(RwUInt32 pluginID);
RwBool RpLightValidatePlugins(const RpLight * light);

/*
 ***********************************************
 *
 * RpGeometry
 *
 ***********************************************
 */

typedef rw::Triangle RpTriangle;

//struct RpGeometry;
typedef rw::Geometry RpGeometry;
//struct RpMorphTarget;
typedef rw::MorphTarget RpMorphTarget;

enum RpGeometryFlag
{
	rpGEOMETRYTRISTRIP  = rw::Geometry::TRISTRIP,
	rpGEOMETRYPOSITIONS = rw::Geometry::POSITIONS,
	rpGEOMETRYTEXTURED  = rw::Geometry::TEXTURED,
	rpGEOMETRYPRELIT    = rw::Geometry::PRELIT,
	rpGEOMETRYNORMALS   = rw::Geometry::NORMALS,
	rpGEOMETRYLIGHT     = rw::Geometry::LIGHT,
	rpGEOMETRYMODULATEMATERIALCOLOR = rw::Geometry::MODULATE,
	rpGEOMETRYTEXTURED2 = rw::Geometry::TEXTURED2,
	rpGEOMETRYNATIVE            = rw::Geometry::NATIVE,
	rpGEOMETRYNATIVEINSTANCE    = rw::Geometry::NATIVEINSTANCE,
	rpGEOMETRYFLAGSMASK         = 0x000000FF,
	rpGEOMETRYNATIVEFLAGSMASK   = 0x0F000000,
};

enum RpGeometryLockMode
{
	rpGEOMETRYLOCKPOLYGONS     = rw::Geometry::LOCKPOLYGONS,
	rpGEOMETRYLOCKVERTICES     = rw::Geometry::LOCKVERTICES,
	rpGEOMETRYLOCKNORMALS      = rw::Geometry::LOCKNORMALS,
	rpGEOMETRYLOCKPRELIGHT     = rw::Geometry::LOCKPRELIGHT,
	rpGEOMETRYLOCKTEXCOORDS    = rw::Geometry::LOCKTEXCOORDS,
	rpGEOMETRYLOCKTEXCOORDS1   = rw::Geometry::LOCKTEXCOORDS1,
	rpGEOMETRYLOCKTEXCOORDS2   = rw::Geometry::LOCKTEXCOORDS2,
	rpGEOMETRYLOCKTEXCOORDS3   = rw::Geometry::LOCKTEXCOORDS3,
	rpGEOMETRYLOCKTEXCOORDS4   = rw::Geometry::LOCKTEXCOORDS4,
	rpGEOMETRYLOCKTEXCOORDS5   = rw::Geometry::LOCKTEXCOORDS5,
	rpGEOMETRYLOCKTEXCOORDS6   = rw::Geometry::LOCKTEXCOORDS6,
	rpGEOMETRYLOCKTEXCOORDS7   = rw::Geometry::LOCKTEXCOORDS7,
	rpGEOMETRYLOCKTEXCOORDS8   = rw::Geometry::LOCKTEXCOORDS8,
	rpGEOMETRYLOCKTEXCOORDSALL = rw::Geometry::LOCKTEXCOORDSALL,
	rpGEOMETRYLOCKALL          = rw::Geometry::LOCKALL
};

RpGeometry  *RpGeometryCreate(RwInt32 numVert, RwInt32 numTriangles, RwUInt32 format);
RwBool RpGeometryDestroy(RpGeometry *geometry);
RpGeometry *_rpGeometryAddRef(RpGeometry *geometry);
RpGeometry  *RpGeometryLock(RpGeometry *geometry, RwInt32 lockMode);
RpGeometry  *RpGeometryUnlock(RpGeometry *geometry);
RpGeometry  *RpGeometryTransform(RpGeometry *geometry, const RwMatrix *matrix);
RpGeometry  *RpGeometryCreateSpace(RwReal radius);
RpMorphTarget  *RpMorphTargetSetBoundingSphere(RpMorphTarget *morphTarget, const RwSphere *boundingSphere);
RwSphere  *RpMorphTargetGetBoundingSphere(RpMorphTarget *morphTarget);
const RpMorphTarget  *RpMorphTargetCalcBoundingSphere(const RpMorphTarget *morphTarget, RwSphere *boundingSphere);
RwInt32 RpGeometryAddMorphTargets(RpGeometry *geometry, RwInt32 mtcount);
RwInt32 RpGeometryAddMorphTarget(RpGeometry *geometry);
RpGeometry  *RpGeometryRemoveMorphTarget(RpGeometry *geometry, RwInt32 morphTarget);
RwInt32 RpGeometryGetNumMorphTargets(const RpGeometry *geometry);
RpMorphTarget  *RpGeometryGetMorphTarget(const RpGeometry *geometry, RwInt32 morphTarget);
RwRGBA  *RpGeometryGetPreLightColors(const RpGeometry *geometry);
RwTexCoords  *RpGeometryGetVertexTexCoords(const RpGeometry *geometry, RwTextureCoordinateIndex uvIndex);
RwInt32 RpGeometryGetNumTexCoordSets(const RpGeometry *geometry);
RwInt32 RpGeometryGetNumVertices (const RpGeometry *geometry);
RwV3d  *RpMorphTargetGetVertices(const RpMorphTarget *morphTarget);
RwV3d  *RpMorphTargetGetVertexNormals(const RpMorphTarget *morphTarget);
RpTriangle  *RpGeometryGetTriangles(const RpGeometry *geometry);
RwInt32 RpGeometryGetNumTriangles(const RpGeometry *geometry);
RpMaterial  *RpGeometryGetMaterial(const RpGeometry *geometry, RwInt32 matNum);
const RpGeometry  *RpGeometryTriangleSetVertexIndices(const RpGeometry *geometry, RpTriangle *triangle, RwUInt16 vert1, RwUInt16 vert2, RwUInt16 vert3);
RpGeometry  *RpGeometryTriangleSetMaterial(RpGeometry *geometry, RpTriangle *triangle, RpMaterial *material);
const RpGeometry  *RpGeometryTriangleGetVertexIndices(const RpGeometry *geometry, const RpTriangle *triangle, RwUInt16 *vert1, RwUInt16 *vert2, RwUInt16 *vert3);
RpMaterial   *RpGeometryTriangleGetMaterial(const RpGeometry *geometry, const RpTriangle *triangle);
RwInt32 RpGeometryGetNumMaterials(const RpGeometry *geometry);
RpGeometry  *RpGeometryForAllMaterials(RpGeometry *geometry, RpMaterialCallBack fpCallBack, void *pData);
//const RpGeometry  *RpGeometryForAllMeshes(const RpGeometry *geometry, RpMeshCallBack fpCallBack, void *pData);
RwInt32 RpGeometryRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB);
RwInt32 RpGeometryRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB);
RwInt32 RpGeometrySetStreamAlwaysCallBack(RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB);
RwInt32 RpGeometryGetPluginOffset(RwUInt32 pluginID);
RwBool RpGeometryValidatePlugins(const RpGeometry *geometry);
RwUInt32 RpGeometryStreamGetSize(const RpGeometry *geometry);
const RpGeometry  *RpGeometryStreamWrite(const RpGeometry *geometry, RwStream *stream);
RpGeometry  *RpGeometryStreamRead(RwStream *stream);
//RpGeometryChunkInfo *_rpGeometryChunkInfoRead(RwStream *stream, RpGeometryChunkInfo *geometryChunkInfo, RwInt32 *bytesRead);
RwUInt32 RpGeometryGetFlags(const RpGeometry *geometry);
RpGeometry  *RpGeometrySetFlags(RpGeometry *geometry, RwUInt32 flags);
const RwSurfaceProperties *_rpGeometryGetSurfaceProperties(const RpGeometry *geometry);
RpGeometry *_rpGeometrySetSurfaceProperties(RpGeometry *geometry, const RwSurfaceProperties *surfaceProperties);


/*
 ***********************************************
 *
 * RpAtomic and RpClump
 *
 ***********************************************
 */

//struct RpAtomic;
typedef rw::Atomic RpAtomic;

enum RpAtomicFlag
{
	rpATOMICCOLLISIONTEST = 0x01,
	rpATOMICRENDER = 0x04,
};

enum RpAtomicSetGeomFlag
{
	rpATOMICSAMEBOUNDINGSPHERE = 0x01,
};

typedef RpAtomic   *(*RpAtomicCallBack) (RpAtomic * atomic, void *data);
typedef RpAtomic   *(*RpAtomicCallBackRender) (RpAtomic * atomic);


//struct RpClump;
typedef rw::Clump RpClump;

struct RpClumpChunkInfo
{
	RwInt32             numAtomics;
	RwInt32             numLights;
	RwInt32             numCameras;
};

typedef RpClump    *(*RpClumpCallBack) (RpClump * clump, void *data);


RpAtomic *AtomicDefaultRenderCallBack(RpAtomic * atomic);
//void _rpAtomicResyncInterpolatedSphere(RpAtomic * atomic);
//const RwSphere *RpAtomicGetWorldBoundingSphere(RpAtomic *  atomic);

RwFrame *RpClumpGetFrame(const RpClump * clump);
RpClump *RpClumpSetFrame(RpClump * clump, RwFrame * frame);
RpClump *RpClumpForAllAtomics(RpClump * clump, RpAtomicCallBack callback, void *pData);
RpClump *RpClumpForAllLights(RpClump * clump, RpLightCallBack callback, void *pData);
RpClump *RpClumpForAllCameras(RpClump * clump, RwCameraCallBack callback, void *pData);
RpClump *RpClumpCreateSpace(const RwV3d * position, RwReal radius);
RpClump *RpClumpRender(RpClump * clump);
RpClump *RpClumpRemoveAtomic(RpClump * clump, RpAtomic * atomic);
RpClump *RpClumpAddAtomic(RpClump * clump, RpAtomic * atomic);
RpClump *RpClumpRemoveLight(RpClump * clump, RpLight * light);
RpClump *RpClumpAddLight(RpClump * clump, RpLight * light);
RpClump *RpClumpRemoveCamera(RpClump * clump, RwCamera * camera);
RpClump *RpClumpAddCamera(RpClump * clump, RwCamera * camera);
RwBool RpClumpDestroy(RpClump * clump);
RpClump *RpClumpCreate(void);
RpClump *RpClumpClone(RpClump * clump);
RpClump *RpClumpSetCallBack(RpClump * clump, RpClumpCallBack callback);
RpClumpCallBack RpClumpGetCallBack(const RpClump * clump);
RwInt32 RpClumpGetNumAtomics(RpClump * clump);
RwInt32 RpClumpGetNumLights(RpClump * clump);
RwInt32 RpClumpGetNumCameras(RpClump * clump);
RwUInt32 RpClumpStreamGetSize(RpClump * clump);
RpClump *RpClumpStreamRead(RwStream * stream);
RpClump *RpClumpStreamWrite(RpClump * clump, RwStream * stream);
RwInt32 RpClumpRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB);
RwInt32 RpClumpRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack  readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB);
RwInt32 RpClumpSetStreamAlwaysCallBack(RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB);
RwInt32 RpClumpGetPluginOffset(RwUInt32 pluginID);
RwBool RpClumpValidatePlugins(const RpClump * clump);

RpAtomic *RpAtomicCreate(void);
RwBool RpAtomicDestroy(RpAtomic * atomic);
RpAtomic *RpAtomicClone(RpAtomic * atomic);
RpAtomic *RpAtomicSetFrame(RpAtomic * atomic, RwFrame * frame);
RpAtomic *RpAtomicSetGeometry(RpAtomic * atomic, RpGeometry * geometry, RwUInt32 flags);

RwFrame *RpAtomicGetFrame(const RpAtomic * atomic);
RpAtomic *RpAtomicSetFlags(RpAtomic * atomic, RwUInt32 flags);
RwUInt32 RpAtomicGetFlags(const RpAtomic * atomic);
RwSphere *RpAtomicGetBoundingSphere(RpAtomic * atomic);
RpAtomic *RpAtomicRender(RpAtomic * atomic);
RpClump *RpAtomicGetClump(const RpAtomic * atomic);
//RpInterpolator *RpAtomicGetInterpolator(RpAtomic * atomic);
RpGeometry *RpAtomicGetGeometry(const RpAtomic * atomic);
void RpAtomicSetRenderCallBack(RpAtomic * atomic, RpAtomicCallBackRender callback);
RpAtomicCallBackRender RpAtomicGetRenderCallBack(const RpAtomic * atomic);
RwBool RpAtomicInstance(RpAtomic *atomic);
RwUInt32 RpAtomicStreamGetSize(RpAtomic * atomic);
RpAtomic *RpAtomicStreamRead(RwStream * stream);
RpAtomic *RpAtomicStreamWrite(RpAtomic * atomic, RwStream * stream);
RwInt32 RpAtomicRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB);
RwInt32 RpAtomicRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB);
RwInt32 RpAtomicSetStreamAlwaysCallBack(RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB);
RwInt32 RpAtomicSetStreamRightsCallBack(RwUInt32 pluginID, RwPluginDataChunkRightsCallBack rightsCB);
RwInt32 RpAtomicGetPluginOffset(RwUInt32 pluginID);
RwBool RpAtomicValidatePlugins(const RpAtomic * atomic);

//RwInt32 RpInterpolatorGetEndMorphTarget(const RpInterpolator * interpolator);
//RwInt32 RpInterpolatorGetStartMorphTarget(const RpInterpolator * interpolator);
//RwReal RpInterpolatorGetValue(const RpInterpolator * interpolator);
//RwReal RpInterpolatorGetScale(const RpInterpolator * interpolator);
//RpInterpolator *RpInterpolatorSetEndMorphTarget(RpInterpolator * interpolator, RwInt32 morphTarget, RpAtomic * atomic);
//RpInterpolator *RpInterpolatorSetStartMorphTarget(RpInterpolator * interpolator, RwInt32 morphTarget, RpAtomic * atomic);
//RpInterpolator *RpInterpolatorSetValue(RpInterpolator *  interpolator, RwReal value, RpAtomic *atomic);
//RpInterpolator *RpInterpolatorSetScale(RpInterpolator * interpolator, RwReal scale, RpAtomic *atomic);


RpClump *RpLightGetClump(const RpLight *light);
RpClump *RwCameraGetClump(const RwCamera *camera);

/*
 ***********************************************
 *
 * RpWorld
 *
 ***********************************************
 */

//struct RpWorld;
typedef rw::World RpWorld;

RwBool       RpWorldDestroy(RpWorld * world);
RpWorld     *RpWorldCreate(RwBBox * boundingBox);

RwBool       RpWorldPluginAttach(void);

RpWorld *RpWorldRemoveCamera(RpWorld *world, RwCamera *camera);
RpWorld *RpWorldAddCamera(RpWorld *world, RwCamera *camera);
RpWorld *RwCameraGetWorld(const RwCamera *camera);
RpWorld *RpWorldRemoveAtomic(RpWorld *world, RpAtomic *atomic);
RpWorld *RpWorldAddAtomic(RpWorld *world, RpAtomic *atomic);
RpWorld *RpAtomicGetWorld(const RpAtomic *atomic);
RpWorld *RpWorldAddClump(RpWorld *world, RpClump *clump);
RpWorld *RpWorldRemoveClump(RpWorld *world, RpClump *clump);
RpWorld *RpClumpGetWorld(const RpClump *clump);
RpWorld *RpWorldAddLight(RpWorld *world, RpLight *light);
RpWorld *RpWorldRemoveLight(RpWorld *world, RpLight *light);
RpWorld *RpLightGetWorld(const RpLight *light);
RwCamera *RwCameraForAllClumpsInFrustum(RwCamera *camera, void *data);
RwCamera *RwCameraForAllClumpsNotInFrustum(RwCamera *camera, RwInt32 numClumps, void *data);
//RwCamera *RwCameraForAllSectorsInFrustum(RwCamera *camera, RpWorldSectorCallBack callBack, void *pData);
//RpLight *RpLightForAllWorldSectors(RpLight *light, RpWorldSectorCallBack callback, void *data);
//RpAtomic *RpAtomicForAllWorldSectors(RpAtomic *atomic, RpWorldSectorCallBack callback, void *data);
//RpWorldSector *RpWorldSectorForAllAtomics(RpWorldSector *sector, RpAtomicCallBack callback, void *data);
//RpWorldSector *RpWorldSectorForAllCollisionAtomics(RpWorldSector *sector, RpAtomicCallBack callback, void *data);
//RpWorldSector *RpWorldSectorForAllLights(RpWorldSector *sector, RpLightCallBack callback, void *data);