Debian Codegraph @

code/renderercommon/tr_common.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 #ifndef TR_COMMON_H
23 #define TR_COMMON_H
24
25 #include "../qcommon/q_shared.h"
26 #include "../renderercommon/tr_public.h"
27 #include "qgl.h"
28
29 typedef enum
30 {
31 IMGTYPE_COLORALPHA, // for color, lightmap, diffuse, and specular
32 IMGTYPE_NORMAL,
33 IMGTYPE_NORMALHEIGHT,
34 IMGTYPE_DELUXE, // normals are swizzled, deluxe are not
35 } imgType_t;
36
37 typedef enum
38 {
39 IMGFLAG_NONE = 0x0000,
40 IMGFLAG_MIPMAP = 0x0001,
41 IMGFLAG_PICMIP = 0x0002,
42 IMGFLAG_CUBEMAP = 0x0004,
43 IMGFLAG_NO_COMPRESSION = 0x0010,
44 IMGFLAG_NOLIGHTSCALE = 0x0020,
45 IMGFLAG_CLAMPTOEDGE = 0x0040,
46 IMGFLAG_GENNORMALMAP = 0x0080,
47 } imgFlags_t;
48
49 typedef struct image_s {
50 char imgName[MAX_QPATH]; // game path, including extension
51 int width, height; // source image
52 int uploadWidth, uploadHeight; // after power of two and picmip but not including clamp to MAX_TEXTURE_SIZE
53 GLuint texnum; // gl texture binding
54
55 int frameUsed; // for texture usage in frame statistics
56
57 int internalFormat;
58 int TMU; // only needed for voodoo2
59
60 imgType_t type;
61 imgFlags_t flags;
62
63 struct image_s* next;
64 } image_t;
65
66 // any change in the LIGHTMAP_* defines here MUST be reflected in
67 // R_FindShader() in tr_bsp.c
68 #define LIGHTMAP_2D -4 // shader is for 2D rendering
69 #define LIGHTMAP_BY_VERTEX -3 // pre-lit triangle models
70 #define LIGHTMAP_WHITEIMAGE -2
71 #define LIGHTMAP_NONE -1
72
73 extern refimport_t ri;
74 extern glconfig_t glConfig; // outside of TR since it shouldn't be cleared during ref re-init
75
76 // These variables should live inside glConfig but can't because of
77 // compatibility issues to the original ID vms. If you release a stand-alone
78 // game and your mod uses tr_types.h from this build you can safely move them
79 // to the glconfig_t struct.
80 extern qboolean textureFilterAnisotropic;
81 extern int maxAnisotropy;
82 extern float displayAspect;
83 extern qboolean haveClampToEdge;
84
85 //
86 // cvars
87 //
88 extern cvar_t *r_stencilbits; // number of desired stencil bits
89 extern cvar_t *r_depthbits; // number of desired depth bits
90 extern cvar_t *r_colorbits; // number of desired color bits, only relevant for fullscreen
91 extern cvar_t *r_texturebits; // number of desired texture bits
92 extern cvar_t *r_ext_multisample;
93 // 0 = use framebuffer depth
94 // 16 = use 16-bit textures
95 // 32 = use 32-bit textures
96 // all else = error
97
98 extern cvar_t *r_mode; // video mode
99 extern cvar_t *r_noborder;
100 extern cvar_t *r_fullscreen;
101 extern cvar_t *r_ignorehwgamma; // overrides hardware gamma capabilities
102 extern cvar_t *r_drawBuffer;
103 extern cvar_t *r_swapInterval;
104
105 extern cvar_t *r_allowExtensions; // global enable/disable of OpenGL extensions
106 extern cvar_t *r_ext_compressed_textures; // these control use of specific extensions
107 extern cvar_t *r_ext_multitexture;
108 extern cvar_t *r_ext_compiled_vertex_array;
109 extern cvar_t *r_ext_texture_env_add;
110
111 extern cvar_t *r_ext_texture_filter_anisotropic;
112 extern cvar_t *r_ext_max_anisotropy;
113
114 extern cvar_t *r_stereoEnabled;
115
116 extern cvar_t *r_saveFontData;
117
118 qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode );
119
120 float R_NoiseGet4f( float x, float y, float z, double t );
121 void R_NoiseInit( void );
122
123 image_t *R_FindImageFile( const char *name, imgType_t type, imgFlags_t flags );
124 image_t *R_CreateImage( const char *name, byte *pic, int width, int height, imgType_t type, imgFlags_t flags, int internalFormat );
125
126 void R_IssuePendingRenderCommands( void );
127 qhandle_t RE_RegisterShaderLightMap( const char *name, int lightmapIndex );
128 qhandle_t RE_RegisterShader( const char *name );
129 qhandle_t RE_RegisterShaderNoMip( const char *name );
130 qhandle_t RE_RegisterShaderFromImage(const char *name, int lightmapIndex, image_t *image, qboolean mipRawImage);
131
132 // font stuff
133 void R_InitFreeType( void );
134 void R_DoneFreeType( void );
135 void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font);
136
137 /*
138 =============================================================
139
140 IMAGE LOADERS
141
142 =============================================================
143 */
144
145 void R_LoadBMP( const char *name, byte **pic, int *width, int *height );
146 void R_LoadJPG( const char *name, byte **pic, int *width, int *height );
147 void R_LoadPCX( const char *name, byte **pic, int *width, int *height );
148 void R_LoadPNG( const char *name, byte **pic, int *width, int *height );
149 void R_LoadPVR( const char *name, byte **pic, int *width, int *height );
150 void R_LoadTGA( const char *name, byte **pic, int *width, int *height );
151
152 /*
153 ====================================================================
154
155 IMPLEMENTATION SPECIFIC FUNCTIONS
156
157 ====================================================================
158 */
159
160 void GLimp_Init( qboolean fixedFunction );
161 void GLimp_Shutdown( void );
162 void GLimp_EndFrame( void );
163
164 void GLimp_LogComment( char *comment );
165 void GLimp_Minimize(void);
166
167 void GLimp_SetGamma( unsigned char red[256],
168 unsigned char green[256],
169 unsigned char blue[256] );
170
171
172 #endif