~ubuntu-branches/ubuntu/hardy/openarena/hardy-backports

« back to all changes in this revision

Viewing changes to code/renderer/tr_types.h

  • Committer: Bazaar Package Importer
  • Author(s): Bruno "Fuddl" Kleinert
  • Date: 2007-01-20 12:28:09 UTC
  • Revision ID: james.westby@ubuntu.com-20070120122809-2yza5ojt7nqiyiam
Tags: upstream-0.6.0
ImportĀ upstreamĀ versionĀ 0.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
#define MAX_ENTITIES    1023            // can't be increased without changing drawsurf bit packing
 
29
 
 
30
// renderfx flags
 
31
#define RF_MINLIGHT                     1               // allways have some light (viewmodel, some items)
 
32
#define RF_THIRD_PERSON         2               // don't draw through eyes, only mirrors (player bodies, chat sprites)
 
33
#define RF_FIRST_PERSON         4               // only draw through eyes (view weapon, damage blood blob)
 
34
#define RF_DEPTHHACK            8               // for view weapon Z crunching
 
35
#define RF_NOSHADOW                     64              // don't add stencil shadows
 
36
 
 
37
#define RF_LIGHTING_ORIGIN      128             // use refEntity->lightingOrigin instead of refEntity->origin
 
38
                                                                        // for lighting.  This allows entities to sink into the floor
 
39
                                                                        // with their origin going solid, and allows all parts of a
 
40
                                                                        // player to get the same lighting
 
41
#define RF_SHADOW_PLANE         256             // use refEntity->shadowPlane
 
42
#define RF_WRAP_FRAMES          512             // mod the model frames by the maxframes to allow continuous
 
43
                                                                        // animation without needing to know the frame count
 
44
 
 
45
// refdef flags
 
46
#define RDF_NOWORLDMODEL        1               // used for player configuration screen
 
47
#define RDF_HYPERSPACE          4               // teleportation effect
 
48
 
 
49
typedef struct {
 
50
        vec3_t          xyz;
 
51
        float           st[2];
 
52
        byte            modulate[4];
 
53
} polyVert_t;
 
54
 
 
55
typedef struct poly_s {
 
56
        qhandle_t                       hShader;
 
57
        int                                     numVerts;
 
58
        polyVert_t                      *verts;
 
59
} poly_t;
 
60
 
 
61
typedef enum {
 
62
        RT_MODEL,
 
63
        RT_POLY,
 
64
        RT_SPRITE,
 
65
        RT_BEAM,
 
66
        RT_RAIL_CORE,
 
67
        RT_RAIL_RINGS,
 
68
        RT_LIGHTNING,
 
69
        RT_PORTALSURFACE,               // doesn't draw anything, just info for portals
 
70
 
 
71
        RT_MAX_REF_ENTITY_TYPE
 
72
} refEntityType_t;
 
73
 
 
74
typedef struct {
 
75
        refEntityType_t reType;
 
76
        int                     renderfx;
 
77
 
 
78
        qhandle_t       hModel;                         // opaque type outside refresh
 
79
 
 
80
        // most recent data
 
81
        vec3_t          lightingOrigin;         // so multi-part models can be lit identically (RF_LIGHTING_ORIGIN)
 
82
        float           shadowPlane;            // projection shadows go here, stencils go slightly lower
 
83
 
 
84
        vec3_t          axis[3];                        // rotation vectors
 
85
        qboolean        nonNormalizedAxes;      // axis are not normalized, i.e. they have scale
 
86
        float           origin[3];                      // also used as MODEL_BEAM's "from"
 
87
        int                     frame;                          // also used as MODEL_BEAM's diameter
 
88
 
 
89
        // previous data for frame interpolation
 
90
        float           oldorigin[3];           // also used as MODEL_BEAM's "to"
 
91
        int                     oldframe;
 
92
        float           backlerp;                       // 0.0 = current, 1.0 = old
 
93
 
 
94
        // texturing
 
95
        int                     skinNum;                        // inline skin index
 
96
        qhandle_t       customSkin;                     // NULL for default skin
 
97
        qhandle_t       customShader;           // use one image for the entire thing
 
98
 
 
99
        // misc
 
100
        byte            shaderRGBA[4];          // colors used by rgbgen entity shaders
 
101
        float           shaderTexCoord[2];      // texture coordinates used by tcMod entity modifiers
 
102
        float           shaderTime;                     // subtracted from refdef time to control effect start times
 
103
 
 
104
        // extra sprite information
 
105
        float           radius;
 
106
        float           rotation;
 
107
} refEntity_t;
 
108
 
 
109
 
 
110
#define MAX_RENDER_STRINGS                      8
 
111
#define MAX_RENDER_STRING_LENGTH        32
 
112
 
 
113
typedef struct {
 
114
        int                     x, y, width, height;
 
115
        float           fov_x, fov_y;
 
116
        vec3_t          vieworg;
 
117
        vec3_t          viewaxis[3];            // transformation matrix
 
118
 
 
119
        // time in milliseconds for shader effects and other time dependent rendering issues
 
120
        int                     time;
 
121
 
 
122
        int                     rdflags;                        // RDF_NOWORLDMODEL, etc
 
123
 
 
124
        // 1 bits will prevent the associated area from rendering at all
 
125
        byte            areamask[MAX_MAP_AREA_BYTES];
 
126
 
 
127
        // text messages for deform text shaders
 
128
        char            text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH];
 
129
} refdef_t;
 
130
 
 
131
 
 
132
typedef enum {
 
133
        STEREO_CENTER,
 
134
        STEREO_LEFT,
 
135
        STEREO_RIGHT
 
136
} stereoFrame_t;
 
137
 
 
138
 
 
139
/*
 
140
** glconfig_t
 
141
**
 
142
** Contains variables specific to the OpenGL configuration
 
143
** being run right now.  These are constant once the OpenGL
 
144
** subsystem is initialized.
 
145
*/
 
146
typedef enum {
 
147
        TC_NONE,
 
148
        TC_S3TC
 
149
} textureCompression_t;
 
150
 
 
151
typedef enum {
 
152
        GLDRV_ICD,                                      // driver is integrated with window system
 
153
                                                                // WARNING: there are tests that check for
 
154
                                                                // > GLDRV_ICD for minidriverness, so this
 
155
                                                                // should always be the lowest value in this
 
156
                                                                // enum set
 
157
        GLDRV_STANDALONE,                       // driver is a non-3Dfx standalone driver
 
158
        GLDRV_VOODOO                            // driver is a 3Dfx standalone driver
 
159
} glDriverType_t;
 
160
 
 
161
typedef enum {
 
162
        GLHW_GENERIC,                   // where everthing works the way it should
 
163
        GLHW_3DFX_2D3D,                 // Voodoo Banshee or Voodoo3, relevant since if this is
 
164
                                                        // the hardware type then there can NOT exist a secondary
 
165
                                                        // display adapter
 
166
        GLHW_RIVA128,                   // where you can't interpolate alpha
 
167
        GLHW_RAGEPRO,                   // where you can't modulate alpha on alpha textures
 
168
        GLHW_PERMEDIA2                  // where you don't have src*dst
 
169
} glHardwareType_t;
 
170
 
 
171
typedef struct {
 
172
        char                                    renderer_string[MAX_STRING_CHARS];
 
173
        char                                    vendor_string[MAX_STRING_CHARS];
 
174
        char                                    version_string[MAX_STRING_CHARS];
 
175
        char                                    extensions_string[BIG_INFO_STRING];
 
176
 
 
177
        int                                             maxTextureSize;                 // queried from GL
 
178
        int                                             maxActiveTextures;              // multitexture ability
 
179
 
 
180
        int                                             colorBits, depthBits, stencilBits;
 
181
 
 
182
        glDriverType_t                  driverType;
 
183
        glHardwareType_t                hardwareType;
 
184
 
 
185
        qboolean                                deviceSupportsGamma;
 
186
        textureCompression_t    textureCompression;
 
187
        qboolean                                textureEnvAddAvailable;
 
188
 
 
189
        int                                             vidWidth, vidHeight;
 
190
        // aspect is the screen's physical width / height, which may be different
 
191
        // than scrWidth / scrHeight if the pixels are non-square
 
192
        // normal screens should be 4/3, but wide aspect monitors may be 16/9
 
193
        float                                   windowAspect;
 
194
 
 
195
        int                                             displayFrequency;
 
196
 
 
197
        // synonymous with "does rendering consume the entire screen?", therefore
 
198
        // a Voodoo or Voodoo2 will have this set to TRUE, as will a Win32 ICD that
 
199
        // used CDS.
 
200
        qboolean                                isFullscreen;
 
201
        qboolean                                stereoEnabled;
 
202
        qboolean                                smpActive;              // dual processor
 
203
} glconfig_t;
 
204
 
 
205
// FIXME: VM should be OS agnostic .. in theory
 
206
 
 
207
/*
 
208
#ifdef Q3_VM
 
209
 
 
210
#define _3DFX_DRIVER_NAME       "Voodoo"
 
211
#define OPENGL_DRIVER_NAME      "Default"
 
212
 
 
213
#elif defined(_WIN32)
 
214
*/
 
215
 
 
216
#if defined(Q3_VM) || defined(_WIN32)
 
217
 
 
218
#define _3DFX_DRIVER_NAME       "3dfxvgl"
 
219
#define OPENGL_DRIVER_NAME      "opengl32"
 
220
 
 
221
#elif defined(MACOS_X)
 
222
 
 
223
#define _3DFX_DRIVER_NAME       "libMesaVoodooGL.dylib"
 
224
#define OPENGL_DRIVER_NAME      "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
 
225
 
 
226
#else
 
227
 
 
228
#define _3DFX_DRIVER_NAME       "libMesaVoodooGL.so"
 
229
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=524
 
230
#define OPENGL_DRIVER_NAME      "libGL.so.1"
 
231
 
 
232
#endif  // !defined _WIN32
 
233
 
 
234
#endif  // __TR_TYPES_H