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 | import sys
|
---|
7 |
|
---|
8 | from pack_currenttypes import *
|
---|
9 | import apiutil
|
---|
10 |
|
---|
11 | apiutil.CopyrightC()
|
---|
12 |
|
---|
13 | print '''
|
---|
14 | #include "state/cr_currentpointers.h"
|
---|
15 | #include "state.h"
|
---|
16 |
|
---|
17 | #include <stdio.h>
|
---|
18 |
|
---|
19 | #ifdef WINDOWS
|
---|
20 | #pragma warning( disable : 4127 )
|
---|
21 | #endif
|
---|
22 |
|
---|
23 | typedef void (*convert_func) (GLfloat *, const unsigned char *);
|
---|
24 | '''
|
---|
25 |
|
---|
26 | import convert
|
---|
27 |
|
---|
28 | for k in current_fns.keys():
|
---|
29 | name = k
|
---|
30 | name = '%s%s' % (k[:1].lower(),k[1:])
|
---|
31 | ucname = k.upper()
|
---|
32 | num_members = len(current_fns[k]['default']) + 1
|
---|
33 |
|
---|
34 | print '#define VPINCH_CONVERT_%s(op,data,dst) \\' % ucname
|
---|
35 | print '{\\'
|
---|
36 | print '\tGLfloat vdata[%d] = {' % num_members,
|
---|
37 |
|
---|
38 | ## Copy dst data into vdata
|
---|
39 | i = 0;
|
---|
40 | for defaultvar in current_fns[k]['default']:
|
---|
41 | print '%d' % defaultvar,
|
---|
42 | if i != num_members:
|
---|
43 | print ',',
|
---|
44 | i += 1
|
---|
45 | print '};\\'
|
---|
46 |
|
---|
47 | print '\tswitch (op) { \\'
|
---|
48 | for type in current_fns[k]['types']:
|
---|
49 | if type[0:1] == "N":
|
---|
50 | normalize = 1
|
---|
51 | type = type[1:]
|
---|
52 | else:
|
---|
53 | normalize = 0
|
---|
54 | for size in current_fns[k]['sizes']:
|
---|
55 | uctype = type.upper()
|
---|
56 | if ucname == 'EDGEFLAG':
|
---|
57 | print '\tcase CR_%s_OPCODE: \\' % ucname
|
---|
58 | else:
|
---|
59 | print '\tcase CR_%s%d%s_OPCODE: \\' % (ucname,size,uctype)
|
---|
60 |
|
---|
61 | if (ucname == 'COLOR' or ucname == 'NORMAL' or ucname == 'SECONDARYCOLOR' or normalize) and type != 'f' and type != 'd':
|
---|
62 | print '\t\t__convert_rescale_%s%d (vdata, (%s *) (data)); \\' % (type,size,gltypes[type]['type'])
|
---|
63 | else:
|
---|
64 | print '\t\t__convert_%s%d (vdata, (%s *) (data)); \\' % (type,size,gltypes[type]['type'])
|
---|
65 | print '\t\tbreak; \\'
|
---|
66 |
|
---|
67 | print '\tdefault: \\'
|
---|
68 | print '\t\tcrSimpleError ( "Unknown opcode in VPINCH_CONVERT_%s" ); \\' % ucname
|
---|
69 | print '\t}\\'
|
---|
70 |
|
---|
71 | i = 0
|
---|
72 | for member in current_fns[k]['members']:
|
---|
73 | print '\t(dst).%s = vdata[%d];\\' % (member,i)
|
---|
74 | i += 1
|
---|
75 |
|
---|
76 | print '}\n'
|
---|
77 |
|
---|
78 | print '''
|
---|
79 |
|
---|
80 | void crStateCurrentRecover( void )
|
---|
81 | {
|
---|
82 | const unsigned char *v;
|
---|
83 | convert_func convert=NULL;
|
---|
84 | CRContext *g = GetCurrentContext();
|
---|
85 | CRCurrentState *c = &(g->current);
|
---|
86 | CRStateBits *sb = GetCurrentBits();
|
---|
87 | CRCurrentBits *cb = &(sb->current);
|
---|
88 | static const GLfloat color_default[4] = {0.0f, 0.0f, 0.0f, 1.0f};
|
---|
89 | static const GLfloat secondaryColor_default[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
---|
90 | static const GLfloat texCoord_default[4] = {0.0f, 0.0f, 0.0f, 1.0f};
|
---|
91 | static const GLfloat normal_default[4] = {0.0f, 0.0f, 0.0f, 1.0f};
|
---|
92 | static const GLfloat index_default = 0.0f;
|
---|
93 | static const GLboolean edgeFlag_default = GL_TRUE;
|
---|
94 | static const GLfloat vertexAttrib_default[4] = {0.0f, 0.0f, 0.0f, 1.0f};
|
---|
95 | static const GLfloat fogCoord_default = 0.0f;
|
---|
96 | GLnormal_p *normal = &(c->current->c.normal);
|
---|
97 | GLcolor_p *color = &(c->current->c.color);
|
---|
98 | GLsecondarycolor_p *secondaryColor = &(c->current->c.secondaryColor);
|
---|
99 | GLtexcoord_p *texCoord = &(c->current->c.texCoord);
|
---|
100 | GLindex_p *index = &(c->current->c.index);
|
---|
101 | GLedgeflag_p *edgeFlag = &(c->current->c.edgeFlag);
|
---|
102 | GLvertexattrib_p *vertexAttrib = &(c->current->c.vertexAttrib);
|
---|
103 | GLfogcoord_p *fogCoord = &(c->current->c.fogCoord);
|
---|
104 | unsigned int i;
|
---|
105 | CRbitvalue nbitID[CR_MAX_BITARRAY];
|
---|
106 |
|
---|
107 | /*
|
---|
108 | * If the calling SPU hasn't called crStateSetCurrentPointers()
|
---|
109 | * we can't recover anything, so abort now. (i.e. we don't have
|
---|
110 | * a pincher, oh, and just emit the message once).
|
---|
111 | */
|
---|
112 | if (!c->current) {
|
---|
113 | static int donewarning = 0;
|
---|
114 | if (!donewarning)
|
---|
115 | crWarning("No pincher, please call crStateSetCurrentPointers() in your SPU");
|
---|
116 | donewarning = 1;
|
---|
117 | return; /* never get here */
|
---|
118 | }
|
---|
119 |
|
---|
120 | c->attribsUsedMask = c->current->attribsUsedMask;
|
---|
121 |
|
---|
122 | /* silence warnings */
|
---|
123 | (void) __convert_b1;
|
---|
124 | (void) __convert_b2;
|
---|
125 | (void) __convert_b3;
|
---|
126 | (void) __convert_b4;
|
---|
127 | (void) __convert_ui1;
|
---|
128 | (void) __convert_ui2;
|
---|
129 | (void) __convert_ui3;
|
---|
130 | (void) __convert_ui4;
|
---|
131 | (void) __convert_l1;
|
---|
132 | (void) __convert_l2;
|
---|
133 | (void) __convert_l3;
|
---|
134 | (void) __convert_l4;
|
---|
135 | (void) __convert_us1;
|
---|
136 | (void) __convert_us2;
|
---|
137 | (void) __convert_us3;
|
---|
138 | (void) __convert_us4;
|
---|
139 | (void) __convert_ub1;
|
---|
140 | (void) __convert_ub2;
|
---|
141 | (void) __convert_ub3;
|
---|
142 | (void) __convert_ub4;
|
---|
143 | (void) __convert_rescale_s1;
|
---|
144 | (void) __convert_rescale_s2;
|
---|
145 | (void) __convert_rescale_b1;
|
---|
146 | (void) __convert_rescale_b2;
|
---|
147 | (void) __convert_rescale_ui1;
|
---|
148 | (void) __convert_rescale_ui2;
|
---|
149 | (void) __convert_rescale_i1;
|
---|
150 | (void) __convert_rescale_i2;
|
---|
151 | (void) __convert_rescale_us1;
|
---|
152 | (void) __convert_rescale_us2;
|
---|
153 | (void) __convert_rescale_ub1;
|
---|
154 | (void) __convert_rescale_ub2;
|
---|
155 | (void) __convert_Ni1;
|
---|
156 | (void) __convert_Ni2;
|
---|
157 | (void) __convert_Ni3;
|
---|
158 | (void) __convert_Ni4;
|
---|
159 | (void) __convert_Nb1;
|
---|
160 | (void) __convert_Nb2;
|
---|
161 | (void) __convert_Nb3;
|
---|
162 | (void) __convert_Nb4;
|
---|
163 | (void) __convert_Nus1;
|
---|
164 | (void) __convert_Nus2;
|
---|
165 | (void) __convert_Nus3;
|
---|
166 | (void) __convert_Nus4;
|
---|
167 | (void) __convert_Nui1;
|
---|
168 | (void) __convert_Nui2;
|
---|
169 | (void) __convert_Nui3;
|
---|
170 | (void) __convert_Nui4;
|
---|
171 | (void) __convert_Ns1;
|
---|
172 | (void) __convert_Ns2;
|
---|
173 | (void) __convert_Ns3;
|
---|
174 | (void) __convert_Ns4;
|
---|
175 | (void) __convert_Nub1;
|
---|
176 | (void) __convert_Nub2;
|
---|
177 | (void) __convert_Nub3;
|
---|
178 | (void) __convert_Nub4;
|
---|
179 |
|
---|
180 | DIRTY(nbitID, g->neg_bitid);
|
---|
181 |
|
---|
182 | /* Save pre state */
|
---|
183 | for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++) {
|
---|
184 | COPY_4V(c->vertexAttribPre[i] , c->vertexAttrib[i]);
|
---|
185 | }
|
---|
186 | c->edgeFlagPre = c->edgeFlag;
|
---|
187 | c->colorIndexPre = c->colorIndex;
|
---|
188 |
|
---|
189 | '''
|
---|
190 |
|
---|
191 | for k in current_fns.keys():
|
---|
192 | print '\t/* %s */' % k
|
---|
193 | print '\tv=NULL;'
|
---|
194 | name = '%s%s' % (k[:1].lower(),k[1:])
|
---|
195 |
|
---|
196 | indent = ""
|
---|
197 | if current_fns[k].has_key( 'array' ):
|
---|
198 | print '\tfor (i = 0 ; i < %s ; i++)' % current_fns[k]['array']
|
---|
199 | print '\t{'
|
---|
200 | indent += "\t"
|
---|
201 | for type in current_fns[k]['types']:
|
---|
202 | if type[0:1] == "N":
|
---|
203 | normalized = 1
|
---|
204 | type2 = type[1:]
|
---|
205 | else:
|
---|
206 | normalized = 0
|
---|
207 | type2 = type
|
---|
208 | for size in current_fns[k]['sizes']:
|
---|
209 | ptr = '%s->%s%d' % (name, type, size )
|
---|
210 | if current_fns[k].has_key( 'array' ):
|
---|
211 | ptr += "[i]"
|
---|
212 | print '%s\tif (v < %s)' % (indent, ptr)
|
---|
213 | print '%s\t{' % indent
|
---|
214 | print '%s\t\tv = %s;' % (indent, ptr)
|
---|
215 | if (k == 'Color' or k == 'Normal' or k == 'SecondaryColor' or normalized) and type != 'f' and type != 'd' and type != 'l':
|
---|
216 | print '%s\t\tconvert = (convert_func) __convert_rescale_%s%d;' % (indent,type,size)
|
---|
217 | else:
|
---|
218 | print '%s\t\tconvert = (convert_func) __convert_%s%d;' % (indent,type,size)
|
---|
219 | print '%s\t}' % indent
|
---|
220 | print ''
|
---|
221 | print '%s\tif (v != NULL) {' % indent
|
---|
222 | if current_fns[k].has_key( 'array' ):
|
---|
223 | if k == 'TexCoord':
|
---|
224 | print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], %s_default);' % (indent,name)
|
---|
225 | else:
|
---|
226 | print '%s\t\tCOPY_4V(c->%s[i], %s_default);' % (indent,name,name)
|
---|
227 | else:
|
---|
228 | if k == 'Normal':
|
---|
229 | print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_NORMAL], %s_default);' % (indent,name)
|
---|
230 | elif k == 'FogCoord':
|
---|
231 | print '%s\t\tc->vertexAttrib[VERT_ATTRIB_FOG][0] = %s_default;' % (indent,name)
|
---|
232 | elif k == 'Color':
|
---|
233 | print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR0], %s_default);' % (indent,name)
|
---|
234 | elif k == 'SecondaryColor':
|
---|
235 | print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR1], %s_default);' % (indent,name)
|
---|
236 | elif k == 'TexCoord':
|
---|
237 | print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0], %s_default);' % (indent,name)
|
---|
238 | elif k == 'Index':
|
---|
239 | print '%s\t\tc->colorIndex = %s_default;' % (indent,name)
|
---|
240 | elif k == 'EdgeFlag':
|
---|
241 | print '%s\t\tc->edgeFlag = %s_default;' % (indent,name)
|
---|
242 | else:
|
---|
243 | print '%s\t\tc->%s = %s_default;' % (indent,name,name)
|
---|
244 | if k == 'EdgeFlag':
|
---|
245 | print '%s\t\t__convert_boolean (&c->edgeFlag, v);' % (indent)
|
---|
246 | dirtyVar = 'cb->edgeFlag'
|
---|
247 | elif k == 'Normal':
|
---|
248 | print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_NORMAL][0]), v);' % (indent)
|
---|
249 | dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_NORMAL]'
|
---|
250 | elif k == 'TexCoord':
|
---|
251 | print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_TEX0 + i][0]), v);' % (indent)
|
---|
252 | dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_TEX0 + i]'
|
---|
253 | elif k == 'Color':
|
---|
254 | print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR0][0]), v);' % (indent)
|
---|
255 | dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR0]'
|
---|
256 | elif k == 'Index':
|
---|
257 | print '%s\t\tconvert(&(c->colorIndex), v);' % (indent)
|
---|
258 | dirtyVar = 'cb->colorIndex'
|
---|
259 | elif k == 'SecondaryColor':
|
---|
260 | print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR1][0]), v);' % (indent)
|
---|
261 | dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR1]'
|
---|
262 | elif k == 'FogCoord':
|
---|
263 | print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_FOG][0]), v);' % (indent)
|
---|
264 | dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_FOG]'
|
---|
265 | elif k == 'VertexAttrib':
|
---|
266 | print '%s\t\tconvert(&(c->vertexAttrib[i][0]), v);' % (indent)
|
---|
267 | dirtyVar = 'cb->vertexAttrib[i]'
|
---|
268 | else:
|
---|
269 | assert 0 # should never get here
|
---|
270 |
|
---|
271 | print '%s\t\tDIRTY(%s, nbitID);' % (indent, dirtyVar)
|
---|
272 |
|
---|
273 | # if current_fns[k].has_key( 'array' ):
|
---|
274 | # print '%s\t\tDIRTY(cb->%s[i], nbitID);' % (indent,name)
|
---|
275 | # else:
|
---|
276 | # print '%s\t\tDIRTY(cb->%s, nbitID);' % (indent,name)
|
---|
277 |
|
---|
278 |
|
---|
279 |
|
---|
280 | print '%s\t\tDIRTY(cb->dirty, nbitID);' % indent
|
---|
281 | print '%s\t}' % indent
|
---|
282 | if current_fns[k].has_key( 'array' ):
|
---|
283 | print '%s\t%s->ptr[i] = v;' % (indent, name )
|
---|
284 | else:
|
---|
285 | print '%s\t%s->ptr = v;' % (indent, name )
|
---|
286 | if current_fns[k].has_key( 'array' ):
|
---|
287 | print '\t}'
|
---|
288 | print '}'
|
---|
289 |
|
---|
290 | print '''
|
---|
291 |
|
---|
292 | void crStateCurrentRecoverNew(CRContext *g, CRCurrentStatePointers *current)
|
---|
293 | {
|
---|
294 | const unsigned char *v;
|
---|
295 | convert_func convert=NULL;
|
---|
296 | CRCurrentState *c = &(g->current);
|
---|
297 | CRStateBits *sb = GetCurrentBits();
|
---|
298 | CRCurrentBits *cb = &(sb->current);
|
---|
299 |
|
---|
300 | static const GLfloat vertexAttrib_default[4] = {0.0f, 0.0f, 0.0f, 1.0f};
|
---|
301 |
|
---|
302 | GLvertexattrib_p *vertexAttrib = &(current->c.vertexAttrib);
|
---|
303 |
|
---|
304 | unsigned int i;
|
---|
305 | CRbitvalue nbitID[CR_MAX_BITARRAY];
|
---|
306 |
|
---|
307 |
|
---|
308 | /* silence warnings */
|
---|
309 | (void) __convert_b1;
|
---|
310 | (void) __convert_b2;
|
---|
311 | (void) __convert_b3;
|
---|
312 | (void) __convert_b4;
|
---|
313 | (void) __convert_ui1;
|
---|
314 | (void) __convert_ui2;
|
---|
315 | (void) __convert_ui3;
|
---|
316 | (void) __convert_ui4;
|
---|
317 | (void) __convert_l1;
|
---|
318 | (void) __convert_l2;
|
---|
319 | (void) __convert_l3;
|
---|
320 | (void) __convert_l4;
|
---|
321 | (void) __convert_us1;
|
---|
322 | (void) __convert_us2;
|
---|
323 | (void) __convert_us3;
|
---|
324 | (void) __convert_us4;
|
---|
325 | (void) __convert_ub1;
|
---|
326 | (void) __convert_ub2;
|
---|
327 | (void) __convert_ub3;
|
---|
328 | (void) __convert_ub4;
|
---|
329 | (void) __convert_rescale_s1;
|
---|
330 | (void) __convert_rescale_s2;
|
---|
331 | (void) __convert_rescale_b1;
|
---|
332 | (void) __convert_rescale_b2;
|
---|
333 | (void) __convert_rescale_ui1;
|
---|
334 | (void) __convert_rescale_ui2;
|
---|
335 | (void) __convert_rescale_i1;
|
---|
336 | (void) __convert_rescale_i2;
|
---|
337 | (void) __convert_rescale_us1;
|
---|
338 | (void) __convert_rescale_us2;
|
---|
339 | (void) __convert_rescale_ub1;
|
---|
340 | (void) __convert_rescale_ub2;
|
---|
341 | (void) __convert_Ni1;
|
---|
342 | (void) __convert_Ni2;
|
---|
343 | (void) __convert_Ni3;
|
---|
344 | (void) __convert_Ni4;
|
---|
345 | (void) __convert_Nb1;
|
---|
346 | (void) __convert_Nb2;
|
---|
347 | (void) __convert_Nb3;
|
---|
348 | (void) __convert_Nb4;
|
---|
349 | (void) __convert_Nus1;
|
---|
350 | (void) __convert_Nus2;
|
---|
351 | (void) __convert_Nus3;
|
---|
352 | (void) __convert_Nus4;
|
---|
353 | (void) __convert_Nui1;
|
---|
354 | (void) __convert_Nui2;
|
---|
355 | (void) __convert_Nui3;
|
---|
356 | (void) __convert_Nui4;
|
---|
357 | (void) __convert_Ns1;
|
---|
358 | (void) __convert_Ns2;
|
---|
359 | (void) __convert_Ns3;
|
---|
360 | (void) __convert_Ns4;
|
---|
361 | (void) __convert_Nub1;
|
---|
362 | (void) __convert_Nub2;
|
---|
363 | (void) __convert_Nub3;
|
---|
364 | (void) __convert_Nub4;
|
---|
365 |
|
---|
366 |
|
---|
367 | '''
|
---|
368 |
|
---|
369 | for k in current_fns_new.keys():
|
---|
370 | print '\t/* %s */' % k
|
---|
371 | print '\tif (current->changed%s)' % k
|
---|
372 | print '\t{'
|
---|
373 | print '\t\tv=NULL;'
|
---|
374 | name = '%s%s' % (k[:1].lower(),k[1:])
|
---|
375 |
|
---|
376 | indent = ""
|
---|
377 | if current_fns_new[k].has_key( 'array' ):
|
---|
378 | print '\t\tfor (i = 0 ; i < %s ; i++)' % current_fns_new[k]['array']
|
---|
379 | print '\t\t{'
|
---|
380 | indent += "\t\t"
|
---|
381 | print '\t\tif (!(current->changed%s & (1 << i))) continue;' % k
|
---|
382 | for type in current_fns_new[k]['types']:
|
---|
383 | if type[0:1] == "N":
|
---|
384 | normalized = 1
|
---|
385 | type2 = type[1:]
|
---|
386 | else:
|
---|
387 | normalized = 0
|
---|
388 | type2 = type
|
---|
389 | for size in current_fns_new[k]['sizes']:
|
---|
390 | ptr = '%s->%s%d' % (name, type, size )
|
---|
391 | if current_fns_new[k].has_key( 'array' ):
|
---|
392 | ptr += "[i]"
|
---|
393 | print '#ifdef DEBUG_misha'
|
---|
394 | print '%s\tif (%s)' % (indent, ptr)
|
---|
395 | print '%s\t{' % (indent)
|
---|
396 | print '%s\t\tuint32_t *pTst = (uint32_t*)(%s);' % (indent, ptr)
|
---|
397 | print '%s\t\t--pTst;' % (indent)
|
---|
398 | print '%s\t\tAssert((*pTst) == i);' % (indent)
|
---|
399 | print '%s\t}' % (indent)
|
---|
400 | print '#endif'
|
---|
401 | print '%s\tif (v < %s)' % (indent, ptr)
|
---|
402 | print '%s\t{' % indent
|
---|
403 | print '%s\t\tv = %s;' % (indent, ptr)
|
---|
404 | if (k == 'Color' or k == 'Normal' or k == 'SecondaryColor' or normalized) and type != 'f' and type != 'd' and type != 'l':
|
---|
405 | print '%s\t\tconvert = (convert_func) __convert_rescale_%s%d;' % (indent,type,size)
|
---|
406 | else:
|
---|
407 | print '%s\t\tconvert = (convert_func) __convert_%s%d;' % (indent,type,size)
|
---|
408 | print '%s\t}' % indent
|
---|
409 | print ''
|
---|
410 | print '%s\tif (v != NULL) {' % indent
|
---|
411 | if current_fns_new[k].has_key( 'array' ):
|
---|
412 | if k == 'TexCoord':
|
---|
413 | print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0 + i], %s_default);' % (indent,name)
|
---|
414 | else:
|
---|
415 | print '%s\t\tCOPY_4V(c->%s[i], %s_default);' % (indent,name,name)
|
---|
416 | else:
|
---|
417 | if k == 'Normal':
|
---|
418 | print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_NORMAL], %s_default);' % (indent,name)
|
---|
419 | elif k == 'FogCoord':
|
---|
420 | print '%s\t\tc->vertexAttrib[VERT_ATTRIB_FOG][0] = %s_default;' % (indent,name)
|
---|
421 | elif k == 'Color':
|
---|
422 | print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR0], %s_default);' % (indent,name)
|
---|
423 | elif k == 'SecondaryColor':
|
---|
424 | print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_COLOR1], %s_default);' % (indent,name)
|
---|
425 | elif k == 'TexCoord':
|
---|
426 | print '%s\t\tCOPY_4V(c->vertexAttrib[VERT_ATTRIB_TEX0], %s_default);' % (indent,name)
|
---|
427 | elif k == 'Index':
|
---|
428 | print '%s\t\tc->colorIndex = %s_default;' % (indent,name)
|
---|
429 | elif k == 'EdgeFlag':
|
---|
430 | print '%s\t\tc->edgeFlag = %s_default;' % (indent,name)
|
---|
431 | else:
|
---|
432 | print '%s\t\tc->%s = %s_default;' % (indent,name,name)
|
---|
433 | if k == 'EdgeFlag':
|
---|
434 | print '%s\t\t__convert_boolean (&c->edgeFlag, v);' % (indent)
|
---|
435 | dirtyVar = 'cb->edgeFlag'
|
---|
436 | elif k == 'Normal':
|
---|
437 | print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_NORMAL][0]), v);' % (indent)
|
---|
438 | dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_NORMAL]'
|
---|
439 | elif k == 'TexCoord':
|
---|
440 | print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_TEX0 + i][0]), v);' % (indent)
|
---|
441 | dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_TEX0 + i]'
|
---|
442 | elif k == 'Color':
|
---|
443 | print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR0][0]), v);' % (indent)
|
---|
444 | dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR0]'
|
---|
445 | elif k == 'Index':
|
---|
446 | print '%s\t\tconvert(&(c->colorIndex), v);' % (indent)
|
---|
447 | dirtyVar = 'cb->colorIndex'
|
---|
448 | elif k == 'SecondaryColor':
|
---|
449 | print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_COLOR1][0]), v);' % (indent)
|
---|
450 | dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_COLOR1]'
|
---|
451 | elif k == 'FogCoord':
|
---|
452 | print '%s\t\tconvert(&(c->vertexAttrib[VERT_ATTRIB_FOG][0]), v);' % (indent)
|
---|
453 | dirtyVar = 'cb->vertexAttrib[VERT_ATTRIB_FOG]'
|
---|
454 | elif k == 'VertexAttrib':
|
---|
455 | print '%s\t\tconvert(&(c->vertexAttrib[i][0]), v);' % (indent)
|
---|
456 | dirtyVar = 'cb->vertexAttrib[i]'
|
---|
457 | else:
|
---|
458 | assert 0 # should never get here
|
---|
459 |
|
---|
460 | print '%s\t\tDIRTY(%s, nbitID);' % (indent, dirtyVar)
|
---|
461 |
|
---|
462 | # if current_fns_new[k].has_key( 'array' ):
|
---|
463 | # print '%s\t\tDIRTY(cb->%s[i], nbitID);' % (indent,name)
|
---|
464 | # else:
|
---|
465 | # print '%s\t\tDIRTY(cb->%s, nbitID);' % (indent,name)
|
---|
466 |
|
---|
467 |
|
---|
468 |
|
---|
469 | print '%s\t\tDIRTY(cb->dirty, nbitID);' % indent
|
---|
470 | print '%s\t}' % indent
|
---|
471 | if current_fns_new[k].has_key( 'array' ):
|
---|
472 | print '%s\t%s->ptr[i] = v;' % (indent, name )
|
---|
473 | else:
|
---|
474 | print '%s\t%s->ptr = v;' % (indent, name )
|
---|
475 | if current_fns_new[k].has_key( 'array' ):
|
---|
476 | print '\t\t}'
|
---|
477 | print '\t\tcurrent->changed%s = 0;' % k
|
---|
478 | print '\t}'
|
---|
479 | print '\tcrStateResetCurrentPointers(current);'
|
---|
480 | print '}'
|
---|