aboutsummaryrefslogtreecommitdiff
path: root/src/libparsec/include/od_prim.h
blob: 3bfbb98ac6cb307746249f5945452d0d2b62139a (plain)
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
/*
 * PARSEC HEADER (OBJECT)
 * Primitive Types V1.80
 *
 * Copyright (c) Markus Hadwiger 1995-2001
 * All Rights Reserved.
 */

#ifndef _OD_PRIM_H_
#define _OD_PRIM_H_


// homogeneous floating-point coordinates of point in 2-space -----------------
//
struct Point2h_f {

	float	X;
	float	Y;
	float	W;
};


// homogeneous fixed-point coordinates of point in 2-space --------------------
//
struct Point2h_x {

	fixed_t	X;
	fixed_t	Y;
	fixed_t	W;
};


// homogeneous floating-point coordinates of point in 3-space -----------------
//
struct Point3h_f {

	float	X;
	float	Y;
	float	Z;
	float	W;
};


// homogeneous fixed-point coordinates of point in 3-space --------------------
//
struct Point3h_x {

	fixed_t	X;
	fixed_t	Y;
	fixed_t	Z;
	fixed_t	W;
};


// general quaternion ---------------------------------------------------------
//
struct Quaternion {

	geomv_t	W;	// q = w + xi + yj + zk
	geomv_t	X;	// q = ( w, (x,y,z) )
	geomv_t	Y;	// q = ( cos(theta/2), sin(theta/2)*(x,y,z) )
	geomv_t	Z;
};


// general quaternion with floating-point components --------------------------
//
struct Quaternion_f {

	float	W;	// q = w + xi + yj + zk
	float	X;	// q = ( w, (x,y,z) )
	float	Y;	// q = ( cos(theta/2), sin(theta/2)*(x,y,z) )
	float	Z;
};


// 2-D texture coordinates ----------------------------------------------------
//
struct TexCoord2 {

	geomv_t	U;
	geomv_t	V;
};


// 3-D vertex coordinates (used by object structures) -------------------------
//
struct Vertex3 {

	geomv_t	X;
	geomv_t	Y;
	geomv_t	Z;
	dword	VisibleFrame;	// ==CurVisibleFrame if vertex touched this frame
};


// 3-D vector -----------------------------------------------------------------
//
typedef Vertex3 Vector3;


// 2-D rectangle --------------------------------------------------------------
//
struct Rectangle2 {

	rastv_t	left;
	rastv_t	right;
	rastv_t	top;
	rastv_t	bottom;
};


// 3-D plane ------------------------------------------------------------------
//
struct Plane3 {

	geomv_t	X;		// normal[0]
	geomv_t	Y;		// normal[1]
	geomv_t	Z;		// normal[2]
	geomv_t	D;		// distance along normal
};
#if 0
#define PLANE_NORMAL(p)		 	((p)->D, (Vector3*)(p))		// crude type check which will give an error if it fails and a warning otherwise..
#else
#define PLANE_NORMAL(p)		 	((Vector3*)(p))		
#endif
#define PLANE_OFFSET(p)		 	((p)->D)
#define PLANE_AXIAL(p)		 	(DW32((p)->X)==0xf800ff00)	// signaling NaN
#define PLANE_CMPAXIS(p)	 	(DW32((p)->Y)&0x03)			// select coordinate
#define PLANE_AXISCOMP(p)		((p)->Z)					// single component
#define PLANE_MAKEAXIAL(p,c,i)	{DW32((p)->X)=0xf800ff00; DW32((p)->Y)=(i)&0x03; (p)->Z=(c);}


// 3-D sphere -----------------------------------------------------------------
//
struct Sphere3 {

	geomv_t	X;		// origin[0]
	geomv_t	Y;		// origin[1]
	geomv_t	Z;		// origin[2]
	geomv_t	R;		// radius or radius squared, depending on application
};


// 2-D bounding rectangle -----------------------------------------------------
//
struct CullBox2 {

	geomv_t	minmax[ 4 ];	// [0 1]=[minx miny] [3 4]=[maxx maxy]
};


// 3-D bounding box -----------------------------------------------------------
//
struct CullBox3 {

	geomv_t	minmax[ 6 ];	// [0 1 2]=[minx miny minz] [3 4 5]=[maxx maxy maxz]
};


// 3-D test points for trivial reject and accept of a bounding box ------------
//
struct ReAcPointBox3 {

	Vector3	reject;			// in negative halfspace -> trivial reject
	Vector3	accept;			// in positive halfspace -> trivial accept
};


// same as ReAcPointsBox3 but with coordinate indexes for a CullBox3 ----------
//
struct ReAcIndexBox3 {

	int		reject[ 3 ];	// reject coordinate indexes
	int		accept[ 3 ];	// accept coordinate indexes
};


// 3-D cull plane (plane together with corresponding reject/accept indexes) ---
//
struct CullPlane3 {

	Plane3			plane;	// the indexes of reject/accept points are an
	ReAcIndexBox3	reacx;	// invariant property of each plane!
};


// bsp node including culling info --------------------------------------------
//
struct CullBSPNode {

	short	polygons[ 2 ];	// index of first front/back polygon
	short	numpolys[ 2 ];	// number of front/back polygons

	Plane3	plane;			// separator plane
	geomv_t	minmax[ 6 ];	// tree bounding box

	dword	flags;			// node/leaf/separator
	dword	visframe;		// visibility status (frame in which last visible)
	dword	subtrees[ 2 ];	// front- and back-subtree
};

#define NODE_FRONTPOLYGON(n)	((n)->polygons[1])
#define NODE_BACKPOLYGON(n)		((n)->polygons[0])
#define NODE_FRONTNUM(n)		((n)->numpolys[1])
#define NODE_BACKNUM(n)			((n)->numpolys[0])
#define NODE_FRONTSUBTREE(n)	((n)->subtrees[1])
#define NODE_BACKSUBTREE(n)		((n)->subtrees[0])
#define NODE_LEAF(n)			((n)->flags & 0x01)
#define NODE_SEPARATOR(n)		((n)->flags & 0x02)


// flags for iter vertices ----------------------------------------------------
//
enum {

	ITERVTXFLAG_NONE		= 0x00000000,	// default

	ITERVTXFLAG_LAYERS_BASE	= 0x00000000,
	ITERVTXFLAG_LAYERS_1	= 0x00000002,	// ITERVTXFLAG_LAYERS_xx specifies
	ITERVTXFLAG_LAYERS_2	= 0x00000003,	// the number of layers (stored in
	ITERVTXFLAG_LAYERS_3	= 0x00000004,	// IterLayer) apart from the base
	ITERVTXFLAG_LAYERS_4	= 0x00000005,	// layer (IterVertex). e.g., 2
	ITERVTXFLAG_LAYERS_5	= 0x00000006,	// means there is one fully used
	ITERVTXFLAG_LAYERS_6	= 0x00000007,	// IterLayer, 1 that there is one
	ITERVTXFLAG_LAYERS_7	= 0x00000008,	// half used IterLayer
	ITERVTXFLAG_LAYERS_8	= 0x00000009,	// lowest bit is number of
	ITERVTXFLAG_LAYERS_SLM	= 0x00000001,	// sublayers in last IterLayer - 1
	ITERVTXFLAG_LAYERS_MASK	= 0x0000000f,

	ITERVTXFLAG_RESTART		= 0x00000100	// restart strip (line/triangle)
};


// 2-D vertex with iterative attributes ---------------------------------------
//
struct IterVertex2 {

	rastv_t	X;		// screenspace x
	rastv_t	Y;		// screenspace y
	rastv_t	Z;		// depth-buffer value

	geomv_t	W;		// homogeneous component
	geomv_t	U;		// texture u
	geomv_t	V;		// texture v

	byte	R;		// red component
	byte	G;		// green component
	byte	B;		// blue component
	byte	A;		// alpha component

	dword	flags;	// ITERVTXFLAG_xx
};


// 3-D vertex with iterative attributes ---------------------------------------
//
struct IterVertex3 {

	geomv_t	X;		// viewspace x
	geomv_t	Y;		// viewspace y
	geomv_t	Z;		// viewspace z

	geomv_t	W;		// homogeneous component
	geomv_t	U;		// texture u
	geomv_t	V;		// texture v

	byte	R;		// red component
	byte	G;		// green component
	byte	B;		// blue component
	byte	A;		// alpha component

	dword	flags;	// ITERVTXFLAG_xx
};


// 2-D vertex overlay with additional texture coordinates ---------------------
//
struct IterLayer2 {

	geomv_t	U0;		// texture u (layer 0)
	geomv_t	V0;		// texture v (layer 0)
	geomv_t	W0;		// homogeneous component
	word	mode0;	//
	word	flags0;	//

	geomv_t	U1;		// texture u (layer 1)
	geomv_t	V1;		// texture v (layer 1)
	geomv_t	W1;		// homogeneous component
	word	mode1;	//
	word	flags1;	//
};


// 3-D vertex overlay with additional texture coordinates ---------------------
//
struct IterLayer3 {

	geomv_t	U0;		// texture u (layer 0)
	geomv_t	V0;		// texture v (layer 0)
	geomv_t	W0;		// homogeneous component
	word	mode0;	//
	word	flags0;	//

	geomv_t	U1;		// texture u (layer 1)
	geomv_t	V1;		// texture v (layer 1)
	geomv_t	W1;		// homogeneous component
	word	mode1;	//
	word	flags1;	//
};


// type for specification of iteration/use of vertex attributes ---------------
//
enum itertype_t {

	iter_constrgb			= 0x0000, // constant [rgb] attributes
	iter_constrgba			= 0x0001, // constant [rgba] attributes
	iter_rgb				= 0x0002, // iterated (rgb) attributes
	iter_rgba				= 0x0003, // iterated (rgba) attributes
	iter_texonly			= 0x0004, // apply texture without shading
	iter_texconsta			= 0x0005, // modulate texture with constant [a]
	iter_texconstrgb		= 0x0006, // modulate texture with constant [rgb]
	iter_texconstrgba		= 0x0007, // modulate texture with constant [rgba]
	iter_texa				= 0x0008, // modulate texture with iterated (a)
	iter_texrgb				= 0x0009, // modulate texture with iterated (rgb)
	iter_texrgba			= 0x000a, // modulate texture with iterated (rgba)
	iter_constrgbtexa		= 0x000b, // constant [rgb] with alpha-texture
	iter_constrgbatexa		= 0x000c, // constant [rgba] with alpha-texture
	iter_rgbtexa			= 0x000d, // iterated (rgb) with alpha-texture
	iter_rgbatexa			= 0x000e, // iterated (rgba) with alpha-texture
	iter_texblendrgba		= 0x000f, // blend texture with iterated (rgba)
	iter_texspeca			= 0x0010, // add (a) to texture (specular)
	iter_texspecrgb			= 0x0011, // add (rgb) to texture (specular)
	iter_texconstaspecrgb	= 0x0012, // add (rgb) to faded texture
	iter_texconstrgbspeca	= 0x0013, // add (a) to flat-shaded texture
	iter_texaspecrgb		= 0x0014, // add (rgb) to texture, modulate (a)
	iter_texrgbspeca		= 0x0015, // add (a) to texture, modulate (rgb)
	iter_base_mask			= 0x00ff,

	iter_overwrite			= 0x0000, // overwrite destination
	iter_alphablend			= 0x0100, // alpha blend with destination
	iter_modulate			= 0x0200, // modulate destination (multiply)
	iter_specularadd		= 0x0300, // add to destination (emissive/specular)
	iter_premulblend		= 0x0400, // blend with premultiplied alpha
	iter_additiveblend		= 0x0500, // additively blend with destination
	iter_compose_mask		= 0xff00,
	iter_compose_shift		= 8
};


// type for specification of desired rasterizer state -------------------------
//
enum raststate_t {

	rast_nozcompare		= 0x0000,	// no depth compare
	rast_zcompare		= 0x0001,	// do depth compare
	rast_mask_zcompare	= 0x0001,	// don't change depth compare

	rast_nozwrite		= 0x0000,	// no depth-buffer write
	rast_zwrite			= 0x0002,	// do depth-buffer write
	rast_mask_zwrite	= 0x0002,	// don't change depth-buffer write

	rast_nozbuffer		= 0x0000,	// no standard depth-buffering
	rast_zbuffer		= 0x0003,	// do standard depth-buffering
	rast_mask_zbuffer	= 0x0003,	// don't change depth-buffering

	rast_texwrap		= 0x0000,	// no texture coordinate clamping
	rast_texclamp		= 0x0004,	// do texture coordinate clamping
	rast_mask_texclamp	= 0x0004,	// don't change coordinate clamp/wrap mode
	rast_mask_texwrap	= 0x0004,	// don't change coordinate clamp/wrap mode

	rast_chromakeyoff	= 0x0000,	// no chroma key compare
	rast_chromakeyon	= 0x0008,	// do chroma key compare
	rast_mask_chromakey	= 0x0008,	// don't change chroma keying

	rast_mask_mipmap	= 0x0010,	// don't change mip-mapping
	rast_mask_texfilter	= 0x0020,	// don't change texture filtering

	rast_default		= 0x0000,	// nozbuffer/texwrap/chromakeyoff
	rast_nomask			= 0x0000,	// don't mask anything
	rast_maskall		= 0xffff	// mask everything
};


// type for specification of texture combine function -------------------------
//
enum texcombstate_t {

	texcomb_decal		= 0x0000,	// decal mapping (single texture)
	texcomb_trifilter  	= 0x0001,	// trilinearly filtered mip mapping
	texcomb_modulate   	= 0x0002,	// modulate texture with another texture
	texcomb_specularadd	= 0x0003,	// add texture to another texture
	texcomb_detail		= 0x0004	// blend textures of two detail levels
};


// flags for iter primitives --------------------------------------------------
//
enum {

	ITERFLAG_NONE			= 0x0000,	// don't touch anything (draw as is)
	ITERFLAG_BACKFACES		= 0x0001,	// draw backfaces instead of frontfaces
	ITERFLAG_ONESIDED		= 0x0002,	// single-sided primitive
	ITERFLAG_PLANESTRIP		= 0x0004,	// only one plane for entire strip
	ITERFLAG_VERTEXREFS		= 0x0008,	// vertex pointers, no embedded vertices

	ITERFLAG_Z_DIV_XYZ		= 0x0010,	// divide xyz by z before rasterizing
	ITERFLAG_Z_DIV_UVW		= 0x0020,	// divide uvw by z before rasterizing
	ITERFLAG_Z_TO_DEPTH		= 0x0040,	// create depth buffer z (lerp-depth)
	ITERFLAG_W_NOT_ONE		= 0x0080,	// w is not one (projective mapping)

	ITERFLAG_NONDESTRUCTIVE	= 0x0100,	// don't alter original vertex data

	ITERFLAG_PS_DEFAULT		= 0x0000,	// point style: default
	ITERFLAG_PS_ANTIALIASED	= 0x1000,	// point style: antialiased

	ITERFLAG_LS_DEFAULT		= 0x0000,	// line style: default
	ITERFLAG_LS_ANTIALIASED	= 0x1000,	// line style: antialiased
	ITERFLAG_LS_THICK		= 0x2000,	// line style: thick
	ITERFLAG_LS_STIPPLED	= 0x4000,	// line style: stippled
	ITERFLAG_LS_CLOSE_STRIP	= 0x8000	// line style: line-loop
};


// forward declarations
struct TextureMap;
struct texfont_s;


// 2-D point (point-set) with iterative vertex attributes ---------------------
//
struct IterPoint2 {

	word		flags;
	short		NumVerts;	// number of points
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	float		pointsize;	// size in pixels
	IterVertex2	Vtxs[ 1 ];	// alloc( (size_t)&((IterPoint2*)0)->Vtxs[ n ] )
};


// 3-D point (point-set) with iterative vertex attributes ---------------------
//
struct IterPoint3 {

	word		flags;
	short		NumVerts;	// number of points
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	float		pointsize;	// size in pixels
	IterVertex3	Vtxs[ 1 ];	// alloc( (size_t)&((IterPoint3*)0)->Vtxs[ n ] )
};


// 2-D line (line-strip) with iterative vertex attributes ---------------------
//
struct IterLine2 {

	word		flags;
	short		NumVerts;	// number of lines + 1
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	TextureMap*	texmap;		// need only be valid if itertype >= iter_texonly
	IterVertex2	Vtxs[ 2 ];	// alloc( (size_t)&((IterLine2*)0)->Vtxs[ n ] )
};


// 3-D line (line-strip) with iterative vertex attributes ---------------------
//
struct IterLine3 {

	word		flags;
	short		NumVerts;	// number of lines + 1
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	TextureMap*	texmap;		// need only be valid if itertype >= iter_texonly
	IterVertex3	Vtxs[ 2 ];	// alloc( (size_t)&((IterLine3*)0)->Vtxs[ n ] )
};


// 2-D triangle with iterative vertex attributes ------------------------------
//
struct IterTriangle2 {

	word		flags;
	short		NumVerts;	// need not be valid (implicitly 3)
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	Plane3*		plane;		// need only be valid if ITERFLAG_ONESIDED
	TextureMap*	texmap;		// need only be valid if itertype >= iter_texonly
	IterVertex2	Vtxs[ 3 ];
};


// 3-D triangle with iterative vertex attributes ------------------------------
//
struct IterTriangle3 {

	word		flags;
	short		NumVerts;	// need not be valid (implicitly 3)
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	Plane3*		plane;		// need only be valid if ITERFLAG_ONESIDED
	TextureMap*	texmap;		// need only be valid if itertype >= iter_texonly
	IterVertex3	Vtxs[ 3 ];
};


// 2-D rectangle with iterative vertex attributes -----------------------------
//
struct IterRectangle2 {

	word		flags;
	short		NumVerts;	// need not be valid (implicitly 4)
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	Plane3*		plane;		// need only be valid if ITERFLAG_ONESIDED
	TextureMap*	texmap;		// need only be valid if itertype >= iter_texonly
	IterVertex2	Vtxs[ 4 ];
};


// 3-D rectangle with iterative vertex attributes -----------------------------
//
struct IterRectangle3 {

	word		flags;
	short		NumVerts;	// need not be valid (implicitly 4)
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	Plane3*		plane;		// need only be valid if ITERFLAG_ONESIDED
	TextureMap*	texmap;		// need only be valid if itertype >= iter_texonly
	IterVertex3	Vtxs[ 4 ];
};


// 2-D polygon (n-gon) with iterative vertex attributes -----------------------
//
struct IterPolygon2 {

	word		flags;
	short		NumVerts;
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	Plane3*		plane;		// need only be valid if ITERFLAG_ONESIDED
	TextureMap*	texmap;		// need only be valid if itertype >= iter_texonly
	IterVertex2	Vtxs[ 1 ];	// alloc( (size_t)&((IterPolygon2*)0)->Vtxs[ n ] )
};


// 3-D polygon (n-gon) with iterative vertex attributes -----------------------
//
struct IterPolygon3 {

	word		flags;
	short		NumVerts;
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	Plane3*		plane;		// need only be valid if ITERFLAG_ONESIDED
	TextureMap*	texmap;		// need only be valid if itertype >= iter_texonly
	IterVertex3	Vtxs[ 1 ];	// alloc( (size_t)&((IterPolygon3*)0)->Vtxs[ n ] )
};


// 2-D triangle strip with iterative vertex attributes ------------------------
//
struct IterTriStrip2 {

	word		flags;
	short		NumVerts;	// number of triangles + 2
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	Plane3*		plane;		// array; need only be valid if ITERFLAG_ONESIDED
	TextureMap*	texmap;		// need only be valid if itertype >= iter_texonly
	IterVertex2	Vtxs[ 1 ];	// alloc( (size_t)&((IterTriStrip2*)0)->Vtxs[ n ] )
};


// 3-D triangle strip with iterative vertex attributes ------------------------
//
struct IterTriStrip3 {

	word		flags;
	short		NumVerts;	// number of triangles + 2
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	Plane3*		plane;		// array; need only be valid if ITERFLAG_ONESIDED
	TextureMap*	texmap;		// need only be valid if itertype >= iter_texonly
	IterVertex3	Vtxs[ 1 ];	// alloc( (size_t)&((IterTriStrip3*)0)->Vtxs[ n ] )
};


// flags for contents of iterated arrays --------------------------------------
//
enum {

	ITERARRAY_USE_COLOR			= 0x0001,
	ITERARRAY_USE_TEXTURE		= 0x0002,
	ITERARRAY_GLOBAL_TEXTURE	= 0x0100
};


// primitive types for iterated array drawing ---------------------------------
//
enum {

	ITERARRAY_MODE_TRIANGLES	= 0x0000,
	ITERARRAY_MODE_TRISTRIP		= 0x0001,
	ITERARRAY_MODE_TRIFAN		= 0x0002,
	ITERARRAY_MODE_QUADS		= 0x0003,
	ITERARRAY_MODE_QUADSTRIP	= 0x0004,

	ITERARRAY_MODE_NUM_MODES	// last!
};


// 2-D vertex array with iterative vertex attributes --------------------------
//
struct IterArray2 {

	word		flags;
	short		NumVerts;	// array size
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	dword		arrayinfo;	// flags for array content (ITERARRAY_xx)
	TextureMap*	texmap;		// need only be valid if itertype >= iter_texonly
	IterVertex2	Vtxs[ 1 ];	// alloc( (size_t)&((IterArray2*)0)->Vtxs[ n ] )
};


// 3-D vertex array with iterative vertex attributes --------------------------
//
struct IterArray3 {

	word		flags;
	short		NumVerts;	// array size
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	dword		arrayinfo;	// flags for array content (ITERARRAY_xx)
	TextureMap*	texmap;		// need only be valid if itertype >= iter_texonly
	IterVertex3	Vtxs[ 1 ];	// alloc( (size_t)&((IterArray3*)0)->Vtxs[ n ] )
};


// descriptor for rendering with a texfont ------------------------------------
//
struct IterTexfont {

	dword		flags;
	dword		itertype;	// itertype_t
	word		raststate;	// raststate_t (state)
	word		rastmask;	// raststate_t (mask)
	texfont_s*	texfont;	// texfont (contains no rendering or color info)
	IterVertex2	Vtxs[ 4 ];	// output location, color, and scale factors
};


#endif // _OD_PRIM_H_