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