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