Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

tr_types.h

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 //
00023 #ifndef __TR_TYPES_H
00024 #define __TR_TYPES_H
00025 
00026 
00027 #define MAX_DLIGHTS     32          // can't be increased, because bit flags are used on surfaces
00028 #define MAX_ENTITIES    1023        // can't be increased without changing drawsurf bit packing
00029 
00030 // renderfx flags
00031 #define RF_MINLIGHT         1       // allways have some light (viewmodel, some items)
00032 #define RF_THIRD_PERSON     2       // don't draw through eyes, only mirrors (player bodies, chat sprites)
00033 #define RF_FIRST_PERSON     4       // only draw through eyes (view weapon, damage blood blob)
00034 #define RF_DEPTHHACK        8       // for view weapon Z crunching
00035 #define RF_NOSHADOW         64      // don't add stencil shadows
00036 
00037 #define RF_LIGHTING_ORIGIN  128     // use refEntity->lightingOrigin instead of refEntity->origin
00038                                     // for lighting.  This allows entities to sink into the floor
00039                                     // with their origin going solid, and allows all parts of a
00040                                     // player to get the same lighting
00041 #define RF_SHADOW_PLANE     256     // use refEntity->shadowPlane
00042 #define RF_WRAP_FRAMES      512     // mod the model frames by the maxframes to allow continuous
00043                                     // animation without needing to know the frame count
00044 
00045 // refdef flags
00046 #define RDF_NOWORLDMODEL    1       // used for player configuration screen
00047 #define RDF_HYPERSPACE      4       // teleportation effect
00048 
00049 typedef struct {
00050     vec3_t      xyz;
00051     float       st[2];
00052     byte        modulate[4];
00053 } polyVert_t;
00054 
00055 typedef struct poly_s {
00056     qhandle_t           hShader;
00057     int                 numVerts;
00058     polyVert_t          *verts;
00059 } poly_t;
00060 
00061 typedef enum {
00062     RT_MODEL,
00063     RT_POLY,
00064     RT_SPRITE,
00065     RT_BEAM,
00066     RT_RAIL_CORE,
00067     RT_RAIL_RINGS,
00068     RT_LIGHTNING,
00069     RT_PORTALSURFACE,       // doesn't draw anything, just info for portals
00070 
00071     RT_MAX_REF_ENTITY_TYPE
00072 } refEntityType_t;
00073 
00074 typedef struct {
00075     refEntityType_t reType;
00076     int         renderfx;
00077 
00078     qhandle_t   hModel;             // opaque type outside refresh
00079 
00080     // most recent data
00081     vec3_t      lightingOrigin;     // so multi-part models can be lit identically (RF_LIGHTING_ORIGIN)
00082     float       shadowPlane;        // projection shadows go here, stencils go slightly lower
00083 
00084     vec3_t      axis[3];            // rotation vectors
00085     qboolean    nonNormalizedAxes;  // axis are not normalized, i.e. they have scale
00086     float       origin[3];          // also used as MODEL_BEAM's "from"
00087     int         frame;              // also used as MODEL_BEAM's diameter
00088 
00089     // previous data for frame interpolation
00090     float       oldorigin[3];       // also used as MODEL_BEAM's "to"
00091     int         oldframe;
00092     float       backlerp;           // 0.0 = current, 1.0 = old
00093 
00094     // texturing
00095     int         skinNum;            // inline skin index
00096     qhandle_t   customSkin;         // NULL for default skin
00097     qhandle_t   customShader;       // use one image for the entire thing
00098 
00099     // misc
00100     byte        shaderRGBA[4];      // colors used by rgbgen entity shaders
00101     float       shaderTexCoord[2];  // texture coordinates used by tcMod entity modifiers
00102     float       shaderTime;         // subtracted from refdef time to control effect start times
00103 
00104     // extra sprite information
00105     float       radius;
00106     float       rotation;
00107 } refEntity_t;
00108 
00109 
00110 #define MAX_RENDER_STRINGS          8
00111 #define MAX_RENDER_STRING_LENGTH    32
00112 
00113 typedef struct {
00114     int         x, y, width, height;
00115     float       fov_x, fov_y;
00116     vec3_t      vieworg;
00117     vec3_t      viewaxis[3];        // transformation matrix
00118 
00119     // time in milliseconds for shader effects and other time dependent rendering issues
00120     int         time;
00121 
00122     int         rdflags;            // RDF_NOWORLDMODEL, etc
00123 
00124     // 1 bits will prevent the associated area from rendering at all
00125     byte        areamask[MAX_MAP_AREA_BYTES];
00126 
00127     // text messages for deform text shaders
00128     char        text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH];
00129 } refdef_t;
00130 
00131 
00132 typedef enum {
00133     STEREO_CENTER,
00134     STEREO_LEFT,
00135     STEREO_RIGHT
00136 } stereoFrame_t;
00137 
00138 
00139 /*
00140 ** glconfig_t
00141 **
00142 ** Contains variables specific to the OpenGL configuration
00143 ** being run right now.  These are constant once the OpenGL
00144 ** subsystem is initialized.
00145 */
00146 typedef enum {
00147     TC_NONE,
00148     TC_S3TC
00149 } textureCompression_t;
00150 
00151 typedef enum {
00152     GLDRV_ICD,                  // driver is integrated with window system
00153                                 // WARNING: there are tests that check for
00154                                 // > GLDRV_ICD for minidriverness, so this
00155                                 // should always be the lowest value in this
00156                                 // enum set
00157     GLDRV_STANDALONE,           // driver is a non-3Dfx standalone driver
00158     GLDRV_VOODOO                // driver is a 3Dfx standalone driver
00159 } glDriverType_t;
00160 
00161 typedef enum {
00162     GLHW_GENERIC,           // where everthing works the way it should
00163     GLHW_3DFX_2D3D,         // Voodoo Banshee or Voodoo3, relevant since if this is
00164                             // the hardware type then there can NOT exist a secondary
00165                             // display adapter
00166     GLHW_RIVA128,           // where you can't interpolate alpha
00167     GLHW_RAGEPRO,           // where you can't modulate alpha on alpha textures
00168     GLHW_PERMEDIA2          // where you don't have src*dst
00169 } glHardwareType_t;
00170 
00171 typedef struct {
00172     char                    renderer_string[MAX_STRING_CHARS];
00173     char                    vendor_string[MAX_STRING_CHARS];
00174     char                    version_string[MAX_STRING_CHARS];
00175     char                    extensions_string[BIG_INFO_STRING];
00176 
00177     int                     maxTextureSize;         // queried from GL
00178     int                     maxActiveTextures;      // multitexture ability
00179 
00180     int                     colorBits, depthBits, stencilBits;
00181 
00182     glDriverType_t          driverType;
00183     glHardwareType_t        hardwareType;
00184 
00185     qboolean                deviceSupportsGamma;
00186     textureCompression_t    textureCompression;
00187     qboolean                textureEnvAddAvailable;
00188 
00189     int                     vidWidth, vidHeight;
00190     // aspect is the screen's physical width / height, which may be different
00191     // than scrWidth / scrHeight if the pixels are non-square
00192     // normal screens should be 4/3, but wide aspect monitors may be 16/9
00193     float                   windowAspect;
00194 
00195     int                     displayFrequency;
00196 
00197     // synonymous with "does rendering consume the entire screen?", therefore
00198     // a Voodoo or Voodoo2 will have this set to TRUE, as will a Win32 ICD that
00199     // used CDS.
00200     qboolean                isFullscreen;
00201     qboolean                stereoEnabled;
00202     qboolean                smpActive;      // dual processor
00203 } glconfig_t;
00204 
00205 // FIXME: VM should be OS agnostic .. in theory
00206 
00207 /*
00208 #ifdef Q3_VM
00209 
00210 #define _3DFX_DRIVER_NAME   "Voodoo"
00211 #define OPENGL_DRIVER_NAME  "Default"
00212 
00213 #elif defined(_WIN32)
00214 */
00215 
00216 #if defined(Q3_VM) || defined(_WIN32)
00217 
00218 #define _3DFX_DRIVER_NAME   "3dfxvgl"
00219 #define OPENGL_DRIVER_NAME  "opengl32"
00220 
00221 #else
00222 
00223 #define _3DFX_DRIVER_NAME   "libMesaVoodooGL.so"
00224 // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=524
00225 #define OPENGL_DRIVER_NAME  "libGL.so.1"
00226 
00227 #endif  // !defined _WIN32
00228 
00229 #endif  // __TR_TYPES_H

Generated on Thu Aug 25 12:37:26 2005 for Quake III Arena by  doxygen 1.3.9.1