Debian Codegraph @

code/renderercommon/tr_types.h

raw symbols SCIP
1 /*
2 ===========================================================================
3 Copyright (C) 1999-2005 Id Software, Inc.
4
5 This file is part of Quake III Arena source code.
6
7 Quake III Arena source code is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the License,
10 or (at your option) any later version.
11
12 Quake III Arena source code is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Quake III Arena source code; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 ===========================================================================
21 */
22 //
23 #ifndef __TR_TYPES_H
24 #define __TR_TYPES_H
25
26
27 #define MAX_DLIGHTS 32 // can't be increased, because bit flags are used on surfaces
28
29 #define REFENTITYNUM_BITS 10 // can't be increased without changing drawsurf bit packing
30 #define REFENTITYNUM_MASK ((1<<REFENTITYNUM_BITS) - 1)
31 // the last N-bit number (2^REFENTITYNUM_BITS - 1) is reserved for the special world refentity,
32 // and this is reflected by the value of MAX_REFENTITIES (which therefore is not a power-of-2)
33 #define MAX_REFENTITIES ((1<<REFENTITYNUM_BITS) - 1)
34 #define REFENTITYNUM_WORLD ((1<<REFENTITYNUM_BITS) - 1)
35
36 // renderfx flags
37 #define RF_MINLIGHT 0x0001 // allways have some light (viewmodel, some items)
38 #define RF_THIRD_PERSON 0x0002 // don't draw through eyes, only mirrors (player bodies, chat sprites)
39 #define RF_FIRST_PERSON 0x0004 // only draw through eyes (view weapon, damage blood blob)
40 #define RF_DEPTHHACK 0x0008 // for view weapon Z crunching
41
42 #define RF_CROSSHAIR 0x0010 // This item is a cross hair and will draw over everything similar to
43 // DEPTHHACK in stereo rendering mode, with the difference that the
44 // projection matrix won't be hacked to reduce the stereo separation as
45 // is done for the gun.
46
47 #define RF_NOSHADOW 0x0040 // don't add stencil shadows
48
49 #define RF_LIGHTING_ORIGIN 0x0080 // use refEntity->lightingOrigin instead of refEntity->origin
50 // for lighting. This allows entities to sink into the floor
51 // with their origin going solid, and allows all parts of a
52 // player to get the same lighting
53
54 #define RF_SHADOW_PLANE 0x0100 // use refEntity->shadowPlane
55 #define RF_WRAP_FRAMES 0x0200 // mod the model frames by the maxframes to allow continuous
56 // animation without needing to know the frame count
57
58 // refdef flags
59 #define RDF_NOWORLDMODEL 0x0001 // used for player configuration screen
60 #define RDF_HYPERSPACE 0x0004 // teleportation effect
61
62 typedef struct {
63 vec3_t xyz;
64 float st[2];
65 byte modulate[4];
66 } polyVert_t;
67
68 typedef struct poly_s {
69 qhandle_t hShader;
70 int numVerts;
71 polyVert_t *verts;
72 } poly_t;
73
74 typedef enum {
75 RT_MODEL,
76 RT_POLY,
77 RT_SPRITE,
78 RT_BEAM,
79 RT_RAIL_CORE,
80 RT_RAIL_RINGS,
81 RT_LIGHTNING,
82 RT_PORTALSURFACE, // doesn't draw anything, just info for portals
83
84 RT_MAX_REF_ENTITY_TYPE
85 } refEntityType_t;
86
87 typedef struct {
88 refEntityType_t reType;
89 int renderfx;
90
91 qhandle_t hModel; // opaque type outside refresh
92
93 // most recent data
94 vec3_t lightingOrigin; // so multi-part models can be lit identically (RF_LIGHTING_ORIGIN)
95 float shadowPlane; // projection shadows go here, stencils go slightly lower
96
97 vec3_t axis[3]; // rotation vectors
98 qboolean nonNormalizedAxes; // axis are not normalized, i.e. they have scale
99 float origin[3]; // also used as MODEL_BEAM's "from"
100 int frame; // also used as MODEL_BEAM's diameter
101
102 // previous data for frame interpolation
103 float oldorigin[3]; // also used as MODEL_BEAM's "to"
104 int oldframe;
105 float backlerp; // 0.0 = current, 1.0 = old
106
107 // texturing
108 int skinNum; // inline skin index
109 qhandle_t customSkin; // NULL for default skin
110 qhandle_t customShader; // use one image for the entire thing
111
112 // misc
113 byte shaderRGBA[4]; // colors used by rgbgen entity shaders
114 float shaderTexCoord[2]; // texture coordinates used by tcMod entity modifiers
115 float shaderTime; // subtracted from refdef time to control effect start times
116
117 // extra sprite information
118 float radius;
119 float rotation;
120 } refEntity_t;
121
122
123 #define MAX_RENDER_STRINGS 8
124 #define MAX_RENDER_STRING_LENGTH 32
125
126 typedef struct {
127 int x, y, width, height;
128 float fov_x, fov_y;
129 vec3_t vieworg;
130 vec3_t viewaxis[3]; // transformation matrix
131
132 // time in milliseconds for shader effects and other time dependent rendering issues
133 int time;
134
135 int rdflags; // RDF_NOWORLDMODEL, etc
136
137 // 1 bits will prevent the associated area from rendering at all
138 byte areamask[MAX_MAP_AREA_BYTES];
139
140 // text messages for deform text shaders
141 char text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH];
142 } refdef_t;
143
144
145 typedef enum {
146 STEREO_CENTER,
147 STEREO_LEFT,
148 STEREO_RIGHT
149 } stereoFrame_t;
150
151
152 /*
153 ** glconfig_t
154 **
155 ** Contains variables specific to the OpenGL configuration
156 ** being run right now. These are constant once the OpenGL
157 ** subsystem is initialized.
158 */
159 typedef enum {
160 TC_NONE,
161 TC_S3TC, // this is for the GL_S3_s3tc extension.
162 TC_S3TC_ARB // this is for the GL_EXT_texture_compression_s3tc extension.
163 } textureCompression_t;
164
165 typedef enum {
166 GLDRV_ICD, // driver is integrated with window system
167 // WARNING: there are tests that check for
168 // > GLDRV_ICD for minidriverness, so this
169 // should always be the lowest value in this
170 // enum set
171 GLDRV_STANDALONE, // driver is a non-3Dfx standalone driver
172 GLDRV_VOODOO // driver is a 3Dfx standalone driver
173 } glDriverType_t;
174
175 typedef enum {
176 GLHW_GENERIC, // where everything works the way it should
177 GLHW_3DFX_2D3D, // Voodoo Banshee or Voodoo3, relevant since if this is
178 // the hardware type then there can NOT exist a secondary
179 // display adapter
180 GLHW_RIVA128, // where you can't interpolate alpha
181 GLHW_RAGEPRO, // where you can't modulate alpha on alpha textures
182 GLHW_PERMEDIA2 // where you don't have src*dst
183 } glHardwareType_t;
184
185 typedef struct {
186 char renderer_string[MAX_STRING_CHARS];
187 char vendor_string[MAX_STRING_CHARS];
188 char version_string[MAX_STRING_CHARS];
189 char extensions_string[BIG_INFO_STRING];
190
191 int maxTextureSize; // queried from GL
192 int numTextureUnits; // multitexture ability
193
194 int colorBits, depthBits, stencilBits;
195
196 glDriverType_t driverType;
197 glHardwareType_t hardwareType;
198
199 qboolean deviceSupportsGamma;
200 textureCompression_t textureCompression;
201 qboolean textureEnvAddAvailable;
202
203 int vidWidth, vidHeight;
204 // aspect is the screen's physical width / height, which may be different
205 // than scrWidth / scrHeight if the pixels are non-square
206 // normal screens should be 4/3, but wide aspect monitors may be 16/9
207 float windowAspect;
208
209 int displayFrequency;
210
211 // synonymous with "does rendering consume the entire screen?", therefore
212 // a Voodoo or Voodoo2 will have this set to TRUE, as will a Win32 ICD that
213 // used CDS.
214 qboolean isFullscreen;
215 qboolean stereoEnabled;
216 qboolean smpActive; // UNUSED, present for compatibility
217 } glconfig_t;
218
219 #endif // __TR_TYPES_H