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 GLTRANS_H
|
---|
8 | #define GLTRANS_H
|
---|
9 |
|
---|
10 | #include "state/cr_statetypes.h"
|
---|
11 |
|
---|
12 | #include <iprt/cdefs.h>
|
---|
13 |
|
---|
14 | #ifdef __cplusplus
|
---|
15 | extern "C" {
|
---|
16 | #endif
|
---|
17 |
|
---|
18 | #define NUM_MATRICES 4
|
---|
19 |
|
---|
20 | typedef struct {
|
---|
21 | CRbitvalue dirty[CR_MAX_BITARRAY];
|
---|
22 | CRbitvalue *currentMatrix; /* points to one of the following */
|
---|
23 | CRbitvalue matrixMode[CR_MAX_BITARRAY];
|
---|
24 | CRbitvalue modelviewMatrix[CR_MAX_BITARRAY];
|
---|
25 | CRbitvalue projectionMatrix[CR_MAX_BITARRAY];
|
---|
26 | CRbitvalue colorMatrix[CR_MAX_BITARRAY];
|
---|
27 | CRbitvalue textureMatrix[CR_MAX_BITARRAY];
|
---|
28 | CRbitvalue programMatrix[CR_MAX_BITARRAY];
|
---|
29 | CRbitvalue clipPlane[CR_MAX_BITARRAY];
|
---|
30 | CRbitvalue enable[CR_MAX_BITARRAY];
|
---|
31 | CRbitvalue base[CR_MAX_BITARRAY];
|
---|
32 | } CRTransformBits;
|
---|
33 |
|
---|
34 | typedef struct {
|
---|
35 | CRmatrix *top; /* points into stack */
|
---|
36 | CRmatrix *stack; /* array [maxDepth] of CRmatrix */
|
---|
37 | GLuint depth; /* 0 <= depth < maxDepth */
|
---|
38 | GLuint maxDepth; /* size of stack[] array */
|
---|
39 | } CRMatrixStack;
|
---|
40 |
|
---|
41 | typedef struct {
|
---|
42 | GLvectord *clipPlane;
|
---|
43 | GLboolean *clip;
|
---|
44 |
|
---|
45 | GLenum matrixMode;
|
---|
46 |
|
---|
47 | /* matrix stacks */
|
---|
48 | CRMatrixStack modelViewStack;
|
---|
49 | CRMatrixStack projectionStack;
|
---|
50 | CRMatrixStack colorStack;
|
---|
51 | CRMatrixStack textureStack[CR_MAX_TEXTURE_UNITS];
|
---|
52 | CRMatrixStack programStack[CR_MAX_PROGRAM_MATRICES];
|
---|
53 | CRMatrixStack *currentStack;
|
---|
54 |
|
---|
55 | GLboolean modelViewProjectionValid;
|
---|
56 | CRmatrix modelViewProjection; /* product of modelview and projection */
|
---|
57 |
|
---|
58 | #ifdef CR_OPENGL_VERSION_1_2
|
---|
59 | GLboolean rescaleNormals;
|
---|
60 | #endif
|
---|
61 | #ifdef CR_IBM_rasterpos_clip
|
---|
62 | GLboolean rasterPositionUnclipped;
|
---|
63 | #endif
|
---|
64 | GLboolean normalize;
|
---|
65 | } CRTransformState;
|
---|
66 |
|
---|
67 |
|
---|
68 | DECLEXPORT(void) crStateTransformInit(CRContext *ctx);
|
---|
69 | DECLEXPORT(void) crStateTransformDestroy(CRContext *ctx);
|
---|
70 |
|
---|
71 | DECLEXPORT(void) crStateInitMatrixStack(CRMatrixStack *stack, int maxDepth);
|
---|
72 |
|
---|
73 | DECLEXPORT(void) crStateLoadMatrix(const CRmatrix *m);
|
---|
74 |
|
---|
75 | DECLEXPORT(void) crStateTransformUpdateTransform(CRTransformState *t);
|
---|
76 | DECLEXPORT(void) crStateTransformXformPoint(CRTransformState *t, GLvectorf *p);
|
---|
77 |
|
---|
78 | DECLEXPORT(void) crStateTransformXformPointMatrixf(const CRmatrix *m, GLvectorf *p);
|
---|
79 | DECLEXPORT(void) crStateTransformXformPointMatrixd(const CRmatrix *m, GLvectord *p);
|
---|
80 |
|
---|
81 | DECLEXPORT(void) crStateTransformDiff(CRTransformBits *t, CRbitvalue *bitID,
|
---|
82 | CRContext *fromCtx, CRContext *toCtx);
|
---|
83 |
|
---|
84 | DECLEXPORT(void) crStateTransformSwitch(CRTransformBits *bb, CRbitvalue *bitID,
|
---|
85 | CRContext *fromCtx, CRContext *toCtx);
|
---|
86 |
|
---|
87 | #ifdef __cplusplus
|
---|
88 | }
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | #endif /* CR_STATE_TRANSFORM_H */
|
---|