Debian Codegraph @

debian/external_deps/fetk/sg/src/gl/vb.h

raw
1 /* $Id: vb.h,v 1.2 2000/10/27 15:21:40 mholst Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 2.0
6 * Copyright (C) 1995-1996 Brian Paul
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the Free
20 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 /*
24 * Vertex buffer: vertices from glVertex* are accumulated here until
25 * the buffer is full or glEnd() is called. Then the buffer is flushed
26 * (rendered) and reset.
27 */
28
29
30 #ifndef VB_H
31 #define VB_H
32
33
34 #include "types.h"
35
36
37
38 /* Flush VB when this number of vertices is accumulated: (a multiple of 12) */
39 #define VB_MAX 480
40
41 /* Arrays must also accomodate new vertices from clipping: */
42 #define VB_SIZE (VB_MAX + 2 * (6 + MAX_CLIP_PLANES))
43
44
45 /*
46 * Vertex buffer (not saved/restored on context switches)
47 */
48 struct vertex_buffer {
49 GLfloat Obj[VB_SIZE][4]; /* Object coords */
50 GLfloat Eye[VB_SIZE][4]; /* Eye coords */
51 GLfloat Clip[VB_SIZE][4]; /* Clip coords */
52 GLfloat Win[VB_SIZE][3]; /* Window coords */
53 #ifdef MONDELLO
54 GLint Win2[VB_SIZE][3]; /* Integer window coords -PFM */
55 /* NOTE: on mondello uses correctly */
56 #endif
57
58 GLfloat Normal[VB_SIZE][3]; /* Normal vectors */
59
60 /* Colors are values in [0..RedScale], [0..GreenScale], [0,BlueScale],
61 * [0,AlphScale] and stored as integers if flat shading or as fixed
62 * point numbers if smooth shading.
63 */
64 GLfixed Fcolor[VB_SIZE][4]; /* Front colors */
65 GLfixed Bcolor[VB_SIZE][4]; /* Back colors */
66 GLfixed (*Color)[4]; /* == Fcolor or Bcolor */
67
68 GLuint Findex[VB_SIZE]; /* Front color indexes */
69 GLuint Bindex[VB_SIZE]; /* Back color indexes */
70 GLuint *Index; /* == Findex or Bindex */
71
72 GLboolean Edgeflag[VB_SIZE]; /* Polygon edge flag */
73
74 GLfloat TexCoord[VB_SIZE][4]; /* Texture coords */
75
76 GLubyte Unclipped[VB_SIZE]; /* 0=clipped, 1=not clipped */
77 GLboolean AnyClipped; /* Were any vertices clipped? */
78
79 GLuint Start; /* First vertex to process */
80 GLuint Count; /* Number of vertexes in buffer */
81 GLuint Free; /* Next empty position for clipping */
82
83 /* to handle glMaterial calls inside glBegin/glEnd: */
84 GLboolean MaterialChanges; /* True if any glMaterial was called */
85 GLuint MaterialMask[VB_SIZE]; /* What material values to change */
86 struct gl_material Material[VB_SIZE][2]; /* New material settings */
87
88 GLboolean MonoColor; /* Do all vertices have same color? */
89 };
90
91
92
93 extern void gl_init_vb( struct vertex_buffer* VB );
94
95
96 #endif
97