summaryrefslogtreecommitdiffstats
path: root/rwsdk/include/d3d8/rppatch.h
blob: eb80663f50167c3c4a8231b649f66739f6a43d8e (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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683

#ifndef RPPATCH_H
#define RPPATCH_H

/**
 * \defgroup rppatch RpPatch
 * \ingroup rpplugin
 *
 * 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 (n) 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 RpPatchMesDefinition
 */
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
 * \typedef 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
 * \typedef RpPatchLODCallBack
 * typedef for the patch atomic LOD calculation function.
 *
 * \see RpPatchAtomicSetPatchLODCallBack
 * \see RpPatchAtomicGetPatchLODCallBack
 */
typedef RwUInt32 (* RpPatchLODCallBack)( RpAtomic *atomic,
                                         RpPatchLODUserData userData );

/*===========================================================================*
 *--- Plugin API Functions --------------------------------------------------*
 *===========================================================================*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */

/*---------------------------------------------------------------------------*
 *-   Plugin functions                                                      -*
 *---------------------------------------------------------------------------*/
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 */