summaryrefslogtreecommitdiffstats
path: root/sdk/rwsdk/include/d3d8/rtgncpip.h
blob: b18f2bb7347606153b27e0bc51a25a1629d9becb (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
/* *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* */