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