1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | * All rights reserved.
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #ifndef CR_STATE_ATTRIB_H
|
---|
8 | #define CR_STATE_ATTRIB_H
|
---|
9 |
|
---|
10 | #include "state/cr_limits.h"
|
---|
11 | #include "state/cr_statetypes.h"
|
---|
12 |
|
---|
13 | #include <iprt/cdefs.h>
|
---|
14 |
|
---|
15 | #ifdef __cplusplus
|
---|
16 | extern "C" {
|
---|
17 | #endif
|
---|
18 |
|
---|
19 | typedef struct {
|
---|
20 | CRbitvalue dirty[CR_MAX_BITARRAY];
|
---|
21 | } CRAttribBits;
|
---|
22 |
|
---|
23 | typedef struct {
|
---|
24 | GLcolorf accumClearValue;
|
---|
25 | } CRAccumBufferStack;
|
---|
26 |
|
---|
27 | typedef struct {
|
---|
28 | GLboolean blend;
|
---|
29 | GLboolean alphaTest;
|
---|
30 | GLboolean logicOp;
|
---|
31 | GLboolean indexLogicOp;
|
---|
32 | GLboolean dither;
|
---|
33 |
|
---|
34 | GLenum alphaTestFunc;
|
---|
35 | GLfloat alphaTestRef;
|
---|
36 | GLenum blendSrcRGB;
|
---|
37 | GLenum blendDstRGB;
|
---|
38 | GLenum blendSrcA;
|
---|
39 | GLenum blendDstA;
|
---|
40 | GLcolorf blendColor;
|
---|
41 | GLenum blendEquation;
|
---|
42 | GLenum logicOpMode;
|
---|
43 | GLenum drawBuffer;
|
---|
44 | GLint indexWriteMask;
|
---|
45 | GLcolorb colorWriteMask;
|
---|
46 | GLcolorf colorClearValue;
|
---|
47 | GLfloat indexClearValue;
|
---|
48 | } CRColorBufferStack;
|
---|
49 |
|
---|
50 | typedef struct {
|
---|
51 | GLboolean rasterValid;
|
---|
52 | GLfloat attrib[CR_MAX_VERTEX_ATTRIBS][4];
|
---|
53 | GLfloat rasterAttrib[CR_MAX_VERTEX_ATTRIBS][4];
|
---|
54 | GLboolean edgeFlag;
|
---|
55 | GLfloat colorIndex;
|
---|
56 | } CRCurrentStack;
|
---|
57 |
|
---|
58 | typedef struct {
|
---|
59 | GLboolean depthTest;
|
---|
60 | GLboolean depthMask;
|
---|
61 | GLenum depthFunc;
|
---|
62 | GLdefault depthClearValue;
|
---|
63 | } CRDepthBufferStack;
|
---|
64 |
|
---|
65 | typedef struct {
|
---|
66 | GLboolean alphaTest;
|
---|
67 | GLboolean autoNormal;
|
---|
68 | GLboolean blend;
|
---|
69 | GLboolean *clip;
|
---|
70 | GLboolean colorMaterial;
|
---|
71 | GLboolean cullFace;
|
---|
72 | GLboolean depthTest;
|
---|
73 | GLboolean dither;
|
---|
74 | GLboolean fog;
|
---|
75 | GLboolean *light;
|
---|
76 | GLboolean lighting;
|
---|
77 | GLboolean lineSmooth;
|
---|
78 | GLboolean lineStipple;
|
---|
79 | GLboolean logicOp;
|
---|
80 | GLboolean indexLogicOp;
|
---|
81 | GLboolean map1[GLEVAL_TOT];
|
---|
82 | GLboolean map2[GLEVAL_TOT];
|
---|
83 | GLboolean normalize;
|
---|
84 | GLboolean pointSmooth;
|
---|
85 | #ifdef CR_ARB_point_sprite
|
---|
86 | GLboolean pointSprite;
|
---|
87 | GLboolean coordReplacement[CR_MAX_TEXTURE_UNITS];
|
---|
88 | #endif
|
---|
89 | GLboolean polygonOffsetLine;
|
---|
90 | GLboolean polygonOffsetFill;
|
---|
91 | GLboolean polygonOffsetPoint;
|
---|
92 | GLboolean polygonSmooth;
|
---|
93 | GLboolean polygonStipple;
|
---|
94 | #ifdef CR_OPENGL_VERSION_1_2
|
---|
95 | GLboolean rescaleNormals;
|
---|
96 | #endif
|
---|
97 | GLboolean scissorTest;
|
---|
98 | GLboolean stencilTest;
|
---|
99 | GLboolean texture1D[CR_MAX_TEXTURE_UNITS];
|
---|
100 | GLboolean texture2D[CR_MAX_TEXTURE_UNITS];
|
---|
101 | GLboolean texture3D[CR_MAX_TEXTURE_UNITS];
|
---|
102 | #ifdef CR_ARB_texture_cube_map
|
---|
103 | GLboolean textureCubeMap[CR_MAX_TEXTURE_UNITS];
|
---|
104 | #endif
|
---|
105 | #ifdef CR_NV_texture_rectangle
|
---|
106 | GLboolean textureRect[CR_MAX_TEXTURE_UNITS];
|
---|
107 | #endif
|
---|
108 | GLboolean textureGenS[CR_MAX_TEXTURE_UNITS];
|
---|
109 | GLboolean textureGenT[CR_MAX_TEXTURE_UNITS];
|
---|
110 | GLboolean textureGenR[CR_MAX_TEXTURE_UNITS];
|
---|
111 | GLboolean textureGenQ[CR_MAX_TEXTURE_UNITS];
|
---|
112 | } CREnableStack;
|
---|
113 |
|
---|
114 | typedef struct {
|
---|
115 | GLboolean enable1D[GLEVAL_TOT];
|
---|
116 | GLboolean enable2D[GLEVAL_TOT];
|
---|
117 | GLboolean autoNormal;
|
---|
118 | CREvaluator1D eval1D[GLEVAL_TOT];
|
---|
119 | CREvaluator2D eval2D[GLEVAL_TOT];
|
---|
120 | GLint un1D;
|
---|
121 | GLfloat u11D, u21D;
|
---|
122 | GLint un2D;
|
---|
123 | GLint vn2D;
|
---|
124 | GLfloat u12D, u22D;
|
---|
125 | GLfloat v12D, v22D;
|
---|
126 | } CREvalStack;
|
---|
127 |
|
---|
128 | typedef struct {
|
---|
129 | GLboolean lighting;
|
---|
130 | GLboolean colorMaterial;
|
---|
131 | GLenum shadeModel;
|
---|
132 | GLenum colorMaterialMode;
|
---|
133 | GLenum colorMaterialFace;
|
---|
134 | GLcolorf ambient[2];
|
---|
135 | GLcolorf diffuse[2];
|
---|
136 | GLcolorf specular[2];
|
---|
137 | GLcolorf emission[2];
|
---|
138 | GLfloat shininess[2];
|
---|
139 | GLint indexes[2][3];
|
---|
140 | GLcolorf lightModelAmbient;
|
---|
141 | GLboolean lightModelLocalViewer;
|
---|
142 | GLboolean lightModelTwoSide;
|
---|
143 | #if defined(CR_EXT_separate_specular_color) || defined(CR_OPENGL_VERSION_1_2)
|
---|
144 | GLenum lightModelColorControlEXT;
|
---|
145 | #endif
|
---|
146 | CRLight *light;
|
---|
147 | } CRLightingStack;
|
---|
148 |
|
---|
149 | typedef struct {
|
---|
150 | GLcolorf color;
|
---|
151 | GLint index;
|
---|
152 | GLfloat density;
|
---|
153 | GLfloat start;
|
---|
154 | GLfloat end;
|
---|
155 | GLint mode;
|
---|
156 | GLboolean enable;
|
---|
157 | } CRFogStack;
|
---|
158 |
|
---|
159 | typedef struct {
|
---|
160 | GLenum perspectiveCorrection;
|
---|
161 | GLenum pointSmooth;
|
---|
162 | GLenum lineSmooth;
|
---|
163 | GLenum polygonSmooth;
|
---|
164 | GLenum fog;
|
---|
165 | #ifdef CR_EXT_clip_volume_hint
|
---|
166 | GLenum clipVolumeClipping;
|
---|
167 | #endif
|
---|
168 | #ifdef CR_ARB_texture_compression
|
---|
169 | GLenum textureCompression;
|
---|
170 | #endif
|
---|
171 | #ifdef CR_SGIS_generate_mipmap
|
---|
172 | GLenum generateMipmap;
|
---|
173 | #endif
|
---|
174 | } CRHintStack;
|
---|
175 |
|
---|
176 | typedef struct {
|
---|
177 | GLboolean lineSmooth;
|
---|
178 | GLboolean lineStipple;
|
---|
179 | GLfloat width;
|
---|
180 | GLushort pattern;
|
---|
181 | GLint repeat;
|
---|
182 | } CRLineStack;
|
---|
183 |
|
---|
184 | typedef struct {
|
---|
185 | GLuint base;
|
---|
186 | } CRListStack;
|
---|
187 |
|
---|
188 | typedef struct {
|
---|
189 | GLboolean mapColor;
|
---|
190 | GLboolean mapStencil;
|
---|
191 | GLint indexShift;
|
---|
192 | GLint indexOffset;
|
---|
193 | GLcolorf scale;
|
---|
194 | GLfloat depthScale;
|
---|
195 | GLcolorf bias;
|
---|
196 | GLfloat depthBias;
|
---|
197 | GLfloat xZoom;
|
---|
198 | GLfloat yZoom;
|
---|
199 | GLenum readBuffer;
|
---|
200 | } CRPixelModeStack;
|
---|
201 |
|
---|
202 | typedef struct {
|
---|
203 | GLboolean pointSmooth;
|
---|
204 | GLfloat pointSize;
|
---|
205 | #if CR_ARB_point_sprite
|
---|
206 | GLboolean pointSprite;
|
---|
207 | GLboolean coordReplacement[CR_MAX_TEXTURE_UNITS];
|
---|
208 | #endif
|
---|
209 | } CRPointStack;
|
---|
210 |
|
---|
211 | typedef struct {
|
---|
212 | GLboolean polygonSmooth;
|
---|
213 | GLboolean polygonOffsetFill;
|
---|
214 | GLboolean polygonOffsetLine;
|
---|
215 | GLboolean polygonOffsetPoint;
|
---|
216 | GLboolean polygonStipple;
|
---|
217 | GLboolean cullFace;
|
---|
218 | GLfloat offsetFactor;
|
---|
219 | GLfloat offsetUnits;
|
---|
220 | GLenum cullFaceMode;
|
---|
221 | GLenum frontFace;
|
---|
222 | GLenum frontMode;
|
---|
223 | GLenum backMode;
|
---|
224 | } CRPolygonStack;
|
---|
225 |
|
---|
226 | typedef struct {
|
---|
227 | GLint pattern[32];
|
---|
228 | } CRPolygonStippleStack;
|
---|
229 |
|
---|
230 | typedef struct {
|
---|
231 | GLboolean scissorTest;
|
---|
232 | GLint scissorX;
|
---|
233 | GLint scissorY;
|
---|
234 | GLsizei scissorW;
|
---|
235 | GLsizei scissorH;
|
---|
236 | } CRScissorStack;
|
---|
237 |
|
---|
238 | typedef struct {
|
---|
239 | GLboolean stencilTest;
|
---|
240 | GLenum func;
|
---|
241 | GLint mask;
|
---|
242 | GLint ref;
|
---|
243 | GLenum fail;
|
---|
244 | GLenum passDepthFail;
|
---|
245 | GLenum passDepthPass;
|
---|
246 | GLint clearValue;
|
---|
247 | GLint writeMask;
|
---|
248 | } CRStencilBufferStack;
|
---|
249 |
|
---|
250 | typedef struct {
|
---|
251 | #if 111
|
---|
252 | GLuint curTextureUnit;
|
---|
253 | CRTextureUnit unit[CR_MAX_TEXTURE_UNITS];
|
---|
254 |
|
---|
255 | #else
|
---|
256 | GLboolean enabled1D[CR_MAX_TEXTURE_UNITS];
|
---|
257 | GLboolean enabled2D[CR_MAX_TEXTURE_UNITS];
|
---|
258 | GLboolean enabled3D[CR_MAX_TEXTURE_UNITS];
|
---|
259 | #ifdef CR_ARB_texture_cube_map
|
---|
260 | GLboolean enabledCubeMap[CR_MAX_TEXTURE_UNITS];
|
---|
261 | #endif
|
---|
262 | CRTextureObj *current1D[CR_MAX_TEXTURE_UNITS];
|
---|
263 | CRTextureObj *current2D[CR_MAX_TEXTURE_UNITS];
|
---|
264 | CRTextureObj *current3D[CR_MAX_TEXTURE_UNITS];
|
---|
265 | #ifdef CR_ARB_texture_cube_map
|
---|
266 | CRTextureObj *currentCubeMap[CR_MAX_TEXTURE_UNITS];
|
---|
267 | #endif
|
---|
268 | GLcolorf borderColor[4]; /* 4 = 1D, 2D, 3D and cube map textures */
|
---|
269 | GLenum minFilter[4];
|
---|
270 | GLenum magFilter[4];
|
---|
271 | GLenum wrapS[4];
|
---|
272 | GLenum wrapT[4];
|
---|
273 | #ifdef CR_OPENGL_VERSION_1_2
|
---|
274 | GLenum wrapR[4];
|
---|
275 | GLfloat priority[4];
|
---|
276 | GLfloat minLod[4];
|
---|
277 | GLfloat maxLod[4];
|
---|
278 | GLint baseLevel[4];
|
---|
279 | GLint maxLevel[4];
|
---|
280 | #endif
|
---|
281 |
|
---|
282 | GLuint curTextureUnit;
|
---|
283 | GLenum envMode[CR_MAX_TEXTURE_UNITS];
|
---|
284 | GLcolorf envColor[CR_MAX_TEXTURE_UNITS];
|
---|
285 |
|
---|
286 | GLtexcoordb textureGen[CR_MAX_TEXTURE_UNITS];
|
---|
287 | GLvectorf objSCoeff[CR_MAX_TEXTURE_UNITS];
|
---|
288 | GLvectorf objTCoeff[CR_MAX_TEXTURE_UNITS];
|
---|
289 | GLvectorf objRCoeff[CR_MAX_TEXTURE_UNITS];
|
---|
290 | GLvectorf objQCoeff[CR_MAX_TEXTURE_UNITS];
|
---|
291 | GLvectorf eyeSCoeff[CR_MAX_TEXTURE_UNITS];
|
---|
292 | GLvectorf eyeTCoeff[CR_MAX_TEXTURE_UNITS];
|
---|
293 | GLvectorf eyeRCoeff[CR_MAX_TEXTURE_UNITS];
|
---|
294 | GLvectorf eyeQCoeff[CR_MAX_TEXTURE_UNITS];
|
---|
295 | GLtexcoorde gen[CR_MAX_TEXTURE_UNITS];
|
---|
296 | #endif
|
---|
297 | } CRTextureStack;
|
---|
298 |
|
---|
299 | typedef struct {
|
---|
300 | GLenum matrixMode;
|
---|
301 | GLvectord *clipPlane;
|
---|
302 | GLboolean *clip;
|
---|
303 | GLboolean normalize;
|
---|
304 | #ifdef CR_OPENGL_VERSION_1_2
|
---|
305 | GLboolean rescaleNormals;
|
---|
306 | #endif
|
---|
307 | } CRTransformStack;
|
---|
308 |
|
---|
309 | typedef struct {
|
---|
310 | GLint viewportX;
|
---|
311 | GLint viewportY;
|
---|
312 | GLint viewportW;
|
---|
313 | GLint viewportH;
|
---|
314 | GLclampd nearClip;
|
---|
315 | GLclampd farClip;
|
---|
316 | } CRViewportStack;
|
---|
317 |
|
---|
318 | typedef struct {
|
---|
319 | GLint attribStackDepth;
|
---|
320 | CRbitvalue pushMaskStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
321 |
|
---|
322 | GLint accumBufferStackDepth;
|
---|
323 | CRAccumBufferStack accumBufferStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
324 |
|
---|
325 | GLint colorBufferStackDepth;
|
---|
326 | CRColorBufferStack colorBufferStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
327 |
|
---|
328 | GLint currentStackDepth;
|
---|
329 | CRCurrentStack currentStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
330 |
|
---|
331 | GLint depthBufferStackDepth;
|
---|
332 | CRDepthBufferStack depthBufferStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
333 |
|
---|
334 | GLint enableStackDepth;
|
---|
335 | CREnableStack enableStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
336 |
|
---|
337 | GLint evalStackDepth;
|
---|
338 | CREvalStack evalStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
339 |
|
---|
340 | GLint fogStackDepth;
|
---|
341 | CRFogStack fogStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
342 |
|
---|
343 | GLint hintStackDepth;
|
---|
344 | CRHintStack hintStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
345 |
|
---|
346 | GLint lightingStackDepth;
|
---|
347 | CRLightingStack lightingStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
348 |
|
---|
349 | GLint lineStackDepth;
|
---|
350 | CRLineStack lineStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
351 |
|
---|
352 | GLint listStackDepth;
|
---|
353 | CRListStack listStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
354 |
|
---|
355 | GLint pixelModeStackDepth;
|
---|
356 | CRPixelModeStack pixelModeStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
357 |
|
---|
358 | GLint pointStackDepth;
|
---|
359 | CRPointStack pointStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
360 |
|
---|
361 | GLint polygonStackDepth;
|
---|
362 | CRPolygonStack polygonStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
363 |
|
---|
364 | GLint polygonStippleStackDepth;
|
---|
365 | CRPolygonStippleStack polygonStippleStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
366 |
|
---|
367 | GLint scissorStackDepth;
|
---|
368 | CRScissorStack scissorStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
369 |
|
---|
370 | GLint stencilBufferStackDepth;
|
---|
371 | CRStencilBufferStack stencilBufferStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
372 |
|
---|
373 | GLint textureStackDepth;
|
---|
374 | CRTextureStack textureStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
375 |
|
---|
376 | GLint transformStackDepth;
|
---|
377 | CRTransformStack transformStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
378 |
|
---|
379 | GLint viewportStackDepth;
|
---|
380 | CRViewportStack viewportStack[CR_MAX_ATTRIB_STACK_DEPTH];
|
---|
381 | } CRAttribState;
|
---|
382 |
|
---|
383 | DECLEXPORT(void) crStateAttribInit(CRAttribState *a);
|
---|
384 |
|
---|
385 | /* No diff! */
|
---|
386 | DECLEXPORT(void) crStateAttribSwitch(CRAttribBits *bb, CRbitvalue *bitID,
|
---|
387 | CRContext *fromCtx, CRContext *toCtx);
|
---|
388 |
|
---|
389 | #ifdef __cplusplus
|
---|
390 | }
|
---|
391 | #endif
|
---|
392 |
|
---|
393 | #endif /* CR_STATE_ATTRIB_H */
|
---|