ReactOS  0.4.14-dev-604-gcfdd483
vb.h
Go to the documentation of this file.
1 /* $Id: vb.h,v 1.12 1997/08/13 02:07:17 brianp Exp $ */
2 
3 /*
4  * Mesa 3-D graphics library
5  * Version: 2.4
6  * Copyright (C) 1995-1997 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 /*
25  * $Log: vb.h,v $
26  * Revision 1.12 1997/08/13 02:07:17 brianp
27  * set VB_MAX to 72 is using Glide for better performance (David Bucciarelli)
28  *
29  * Revision 1.11 1997/06/21 21:30:59 brianp
30  * updated many comments
31  *
32  * Revision 1.10 1997/06/20 02:08:23 brianp
33  * changed color components from GLfixed to GLubyte
34  *
35  * Revision 1.9 1997/05/09 22:41:55 brianp
36  * replaced gl_init_vb() with gl_alloc_vb()
37  *
38  * Revision 1.8 1997/04/24 00:29:36 brianp
39  * added TexCoordSize
40  *
41  * Revision 1.7 1997/04/20 15:59:30 brianp
42  * removed VERTEX2_BIT stuff
43  *
44  * Revision 1.6 1997/04/12 16:21:35 brianp
45  * added CLIP_* flags and gl_init_vb()
46  *
47  * Revision 1.5 1997/04/07 02:59:59 brianp
48  * added VertexSizeMask
49  *
50  * Revision 1.4 1997/04/02 03:13:12 brianp
51  * removed Unclipped[], added ClipMask[], ClipOrMask, ClipAndMask
52  *
53  * Revision 1.3 1996/12/18 19:59:44 brianp
54  * removed the material bitmask constants
55  *
56  * Revision 1.2 1996/09/27 01:31:17 brianp
57  * added gl_init_vb() prototype
58  *
59  * Revision 1.1 1996/09/13 01:38:16 brianp
60  * Initial revision
61  *
62  */
63 
64 
65 /*
66  * OVERVIEW: The vertices defined between glBegin() and glEnd()
67  * are accumulated in the vertex buffer. When either the
68  * vertex buffer becomes filled or glEnd() is called, we must flush
69  * the buffer. That is, we apply the vertex transformations, compute
70  * lighting, fog, texture coordinates etc. Then, we can render the
71  * vertices as points, lines or polygons by calling the gl_render_vb()
72  * function in render.c
73  *
74  */
75 
76 
77 #ifndef VB_H
78 #define VB_H
79 
80 
81 #include "types.h"
82 
83 
84 
85 /* Flush VB when this number of vertices is accumulated: (a multiple of 12) */
86 #define VB_MAX 480
87 
88 /* Arrays must also accomodate new vertices from clipping: */
89 #define VB_SIZE (VB_MAX + 2 * (6 + MAX_CLIP_PLANES))
90 
91 
92 /* Bit values for VertexSizeMask, below. */
93 /*#define VERTEX2_BIT 1*/
94 #define VERTEX3_BIT 2
95 #define VERTEX4_BIT 4
96 
97 
98 
99 struct vertex_buffer {
100  GLfloat Obj[VB_SIZE][4]; /* Object coords */
101  GLfloat Eye[VB_SIZE][4]; /* Eye coords */
102  GLfloat Clip[VB_SIZE][4]; /* Clip coords */
103  GLfloat Win[VB_SIZE][3]; /* Window coords */
104 
105  GLfloat Normal[VB_SIZE][3]; /* Normal vectors */
106 
107  GLubyte Fcolor[VB_SIZE][4]; /* Front colors (RGBA) */
108  GLubyte Bcolor[VB_SIZE][4]; /* Back colors (RGBA) */
109  GLubyte (*Color)[4]; /* == Fcolor or Bcolor */
110 
111  GLuint Findex[VB_SIZE]; /* Front color indexes */
112  GLuint Bindex[VB_SIZE]; /* Back color indexes */
113  GLuint *Index; /* == Findex or Bindex */
114 
115  GLboolean Edgeflag[VB_SIZE]; /* Polygon edge flags */
116 
117  GLfloat TexCoord[VB_SIZE][4];/* Texture coords */
118 
119  GLubyte ClipMask[VB_SIZE]; /* bitwise-OR of CLIP_* values, below */
120  GLubyte ClipOrMask; /* bitwise-OR of all ClipMask[] values */
121  GLubyte ClipAndMask; /* bitwise-AND of all ClipMask[] values */
122 
123  GLuint Start; /* First vertex to process */
124  GLuint Count; /* Number of vertexes in buffer */
125  GLuint Free; /* Next empty position for clipping */
126 
127  GLuint VertexSizeMask; /* Bitwise-or of VERTEX[234]_BIT */
128  GLuint TexCoordSize; /* Either 2 or 4 */
129  GLboolean MonoColor; /* Do all vertices have same color? */
130  GLboolean MonoNormal; /* Do all vertices have same normal? */
131  GLboolean MonoMaterial; /* Do all vertices have same material? */
132 
133  /* to handle glMaterial calls inside glBegin/glEnd: */
134  GLuint MaterialMask[VB_SIZE]; /* Which material values to change */
135  struct gl_material Material[VB_SIZE][2]; /* New material values */
136 };
137 
138 
139 
140 /* Vertex buffer clipping flags */
141 #define CLIP_RIGHT_BIT 0x01
142 #define CLIP_LEFT_BIT 0x02
143 #define CLIP_TOP_BIT 0x04
144 #define CLIP_BOTTOM_BIT 0x08
145 #define CLIP_NEAR_BIT 0x10
146 #define CLIP_FAR_BIT 0x20
147 #define CLIP_USER_BIT 0x40
148 #define CLIP_ALL_BITS 0x3f
149 
150 #define CLIP_ALL 1
151 #define CLIP_NONE 2
152 #define CLIP_SOME 3
153 
154 
155 extern struct vertex_buffer *gl_alloc_vb(void);
156 
157 
158 #endif
GLuint TexCoordSize
Definition: vb.h:128
GLuint Free
Definition: vb.h:125
GLubyte Bcolor[VB_SIZE][4]
Definition: vb.h:108
unsigned char GLubyte
Definition: gl.h:157
GLuint VertexSizeMask
Definition: vb.h:127
GLuint Start
Definition: vb.h:123
GLubyte ClipMask[VB_SIZE]
Definition: vb.h:119
GLfloat TexCoord[VB_SIZE][4]
Definition: vb.h:117
GLubyte ClipAndMask
Definition: vb.h:121
unsigned char GLboolean
Definition: gl.h:151
GLuint MaterialMask[VB_SIZE]
Definition: vb.h:134
GLubyte Fcolor[VB_SIZE][4]
Definition: vb.h:107
GLboolean MonoColor
Definition: vb.h:129
GLuint Findex[VB_SIZE]
Definition: vb.h:111
struct gl_material Material[VB_SIZE][2]
Definition: vb.h:135
GLfloat Clip[VB_SIZE][4]
Definition: vb.h:102
GLubyte ClipOrMask
Definition: vb.h:120
struct vertex_buffer * gl_alloc_vb(void)
Definition: vb.c:65
GLuint Bindex[VB_SIZE]
Definition: vb.h:112
GLfloat Eye[VB_SIZE][4]
Definition: vb.h:101
GLfloat Normal[VB_SIZE][3]
Definition: vb.h:105
#define VB_SIZE
Definition: vb.h:89
GLuint Count
Definition: vb.h:124
unsigned int GLuint
Definition: gl.h:159
float GLfloat
Definition: gl.h:161
GLboolean MonoNormal
Definition: vb.h:130
GLboolean Edgeflag[VB_SIZE]
Definition: vb.h:115
GLfloat Win[VB_SIZE][3]
Definition: vb.h:103
GLboolean MonoMaterial
Definition: vb.h:131
GLuint * Index
Definition: vb.h:113