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_CLIENT_H
|
---|
8 | #define CR_STATE_CLIENT_H
|
---|
9 |
|
---|
10 | #include "state/cr_statetypes.h"
|
---|
11 | #include "state/cr_limits.h"
|
---|
12 | #include "state/cr_bufferobject.h"
|
---|
13 | #include "cr_bits.h"
|
---|
14 |
|
---|
15 | #include <iprt/cdefs.h>
|
---|
16 |
|
---|
17 | #ifdef __cplusplus
|
---|
18 | extern "C" {
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | typedef struct {
|
---|
22 | CRbitvalue dirty[CR_MAX_BITARRAY];
|
---|
23 | /* pixel pack/unpack */
|
---|
24 | CRbitvalue pack[CR_MAX_BITARRAY];
|
---|
25 | CRbitvalue unpack[CR_MAX_BITARRAY];
|
---|
26 | /* vertex array */
|
---|
27 | CRbitvalue enableClientState[CR_MAX_BITARRAY];
|
---|
28 | CRbitvalue clientPointer[CR_MAX_BITARRAY];
|
---|
29 | CRbitvalue *v; /* vertex */
|
---|
30 | CRbitvalue *n; /* normal */
|
---|
31 | CRbitvalue *c; /* color */
|
---|
32 | CRbitvalue *i; /* index */
|
---|
33 | CRbitvalue *t[CR_MAX_TEXTURE_UNITS]; /* texcoord */
|
---|
34 | CRbitvalue *e; /* edgeflag */
|
---|
35 | CRbitvalue *s; /* secondary color */
|
---|
36 | CRbitvalue *f; /* fog coord */
|
---|
37 | #ifdef CR_NV_vertex_program
|
---|
38 | CRbitvalue *a[CR_MAX_VERTEX_ATTRIBS]; /* NV_vertex_program */
|
---|
39 | #endif
|
---|
40 | } CRClientBits;
|
---|
41 |
|
---|
42 | /*
|
---|
43 | * NOTE!!!! If you change this structure, search through the code for
|
---|
44 | * occurrences of 'defaultPacking' and fix the static initializations!!!!
|
---|
45 | */
|
---|
46 | typedef struct {
|
---|
47 | GLint rowLength;
|
---|
48 | GLint skipRows;
|
---|
49 | GLint skipPixels;
|
---|
50 | GLint alignment;
|
---|
51 | GLint imageHeight;
|
---|
52 | GLint skipImages;
|
---|
53 | GLboolean swapBytes;
|
---|
54 | GLboolean psLSBFirst; /* don't conflict with crap from Xlib.h */
|
---|
55 | } CRPixelPackState;
|
---|
56 |
|
---|
57 | typedef struct {
|
---|
58 | unsigned char *p;
|
---|
59 | GLint size;
|
---|
60 | GLint type;
|
---|
61 | GLint stride;
|
---|
62 | GLboolean enabled;
|
---|
63 | GLboolean normalized; /* Added with GL_ARB_vertex_program */
|
---|
64 | int bytesPerIndex;
|
---|
65 | #ifdef CR_ARB_vertex_buffer_object
|
---|
66 | CRBufferObject *buffer;
|
---|
67 | #endif
|
---|
68 | #ifdef CR_EXT_compiled_vertex_array
|
---|
69 | GLboolean locked;
|
---|
70 | unsigned char *prevPtr;
|
---|
71 | GLint prevStride;
|
---|
72 | #endif
|
---|
73 | } CRClientPointer;
|
---|
74 |
|
---|
75 | typedef struct {
|
---|
76 | CRClientPointer v; /* vertex */
|
---|
77 | CRClientPointer n; /* normal */
|
---|
78 | CRClientPointer c; /* color */
|
---|
79 | CRClientPointer i; /* color index */
|
---|
80 | CRClientPointer t[CR_MAX_TEXTURE_UNITS]; /* texcoords */
|
---|
81 | CRClientPointer e; /* edge flags */
|
---|
82 | CRClientPointer s; /* secondary color */
|
---|
83 | CRClientPointer f; /* fog coord */
|
---|
84 | #ifdef CR_NV_vertex_program
|
---|
85 | CRClientPointer a[CR_MAX_VERTEX_ATTRIBS]; /* vertex attribs */
|
---|
86 | #endif
|
---|
87 | #ifdef CR_NV_vertex_array_range
|
---|
88 | GLboolean arrayRange;
|
---|
89 | GLboolean arrayRangeValid;
|
---|
90 | void *arrayRangePointer;
|
---|
91 | GLuint arrayRangeLength;
|
---|
92 | #endif
|
---|
93 | #ifdef CR_EXT_compiled_vertex_array
|
---|
94 | GLint lockFirst;
|
---|
95 | GLint lockCount;
|
---|
96 | GLboolean locked;
|
---|
97 | # ifdef IN_GUEST
|
---|
98 | GLboolean synced;
|
---|
99 | # endif
|
---|
100 | #endif
|
---|
101 | } CRVertexArrays;
|
---|
102 |
|
---|
103 | #define CRSTATECLIENT_MAX_VERTEXARRAYS (7+CR_MAX_TEXTURE_UNITS+CR_MAX_VERTEX_ATTRIBS)
|
---|
104 |
|
---|
105 | typedef struct {
|
---|
106 | /* pixel pack/unpack */
|
---|
107 | CRPixelPackState pack;
|
---|
108 | CRPixelPackState unpack;
|
---|
109 |
|
---|
110 | CRVertexArrays array;
|
---|
111 |
|
---|
112 | GLint curClientTextureUnit;
|
---|
113 |
|
---|
114 | /* state stacks (glPush/PopClientState) */
|
---|
115 | GLint attribStackDepth;
|
---|
116 | CRbitvalue pushMaskStack[CR_MAX_CLIENT_ATTRIB_STACK_DEPTH];
|
---|
117 |
|
---|
118 | GLint pixelStoreStackDepth;
|
---|
119 | CRPixelPackState pixelPackStoreStack[CR_MAX_CLIENT_ATTRIB_STACK_DEPTH];
|
---|
120 | CRPixelPackState pixelUnpackStoreStack[CR_MAX_CLIENT_ATTRIB_STACK_DEPTH];
|
---|
121 |
|
---|
122 | GLint vertexArrayStackDepth;
|
---|
123 | CRVertexArrays vertexArrayStack[CR_MAX_CLIENT_ATTRIB_STACK_DEPTH];
|
---|
124 | } CRClientState;
|
---|
125 |
|
---|
126 | extern const CRPixelPackState crStateNativePixelPacking;
|
---|
127 |
|
---|
128 | struct CRContext;
|
---|
129 |
|
---|
130 | DECLEXPORT(void) crStateClientInitBits(CRClientBits *c);
|
---|
131 | DECLEXPORT(void) crStateClientDestroyBits(CRClientBits *c);
|
---|
132 | DECLEXPORT(void) crStateClientInit(struct CRContext *g);
|
---|
133 | DECLEXPORT(void) crStateClientDestroy(struct CRContext *g);
|
---|
134 |
|
---|
135 | DECLEXPORT(GLboolean) crStateUseServerArrays(void);
|
---|
136 | DECLEXPORT(GLboolean) crStateUseServerArrayElements(void);
|
---|
137 | DECLEXPORT(CRClientPointer*) crStateGetClientPointerByIndex(int index, CRVertexArrays *array);
|
---|
138 |
|
---|
139 | #ifdef __cplusplus
|
---|
140 | }
|
---|
141 | #endif
|
---|
142 |
|
---|
143 | #endif /* CR_CLIENT_H */
|
---|