Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5131 | clevermous | 1 | /* |
2 | Copyright (C) 1996-1997 Id Software, Inc. |
||
3 | |||
4 | This program is free software; you can redistribute it and/or |
||
5 | modify it under the terms of the GNU General Public License |
||
6 | as published by the Free Software Foundation; either version 2 |
||
7 | of the License, or (at your option) any later version. |
||
8 | |||
9 | This program is distributed in the hope that it will be useful, |
||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
12 | |||
13 | See the GNU General Public License for more details. |
||
14 | |||
15 | You should have received a copy of the GNU General Public License |
||
16 | along with this program; if not, write to the Free Software |
||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||
18 | |||
19 | */ |
||
20 | // disable data conversion warnings |
||
21 | |||
22 | #pragma warning(disable : 4244) // MIPS |
||
23 | #pragma warning(disable : 4136) // X86 |
||
24 | #pragma warning(disable : 4051) // ALPHA |
||
25 | |||
26 | #include |
||
27 | |||
28 | #include |
||
29 | #include |
||
30 | |||
31 | void GL_BeginRendering (int *x, int *y, int *width, int *height); |
||
32 | void GL_EndRendering (void); |
||
33 | |||
34 | |||
35 | // Function prototypes for the Texture Object Extension routines |
||
36 | typedef GLboolean (APIENTRY *ARETEXRESFUNCPTR)(GLsizei, const GLuint *, |
||
37 | const GLboolean *); |
||
38 | typedef void (APIENTRY *BINDTEXFUNCPTR)(GLenum, GLuint); |
||
39 | typedef void (APIENTRY *DELTEXFUNCPTR)(GLsizei, const GLuint *); |
||
40 | typedef void (APIENTRY *GENTEXFUNCPTR)(GLsizei, GLuint *); |
||
41 | typedef GLboolean (APIENTRY *ISTEXFUNCPTR)(GLuint); |
||
42 | typedef void (APIENTRY *PRIORTEXFUNCPTR)(GLsizei, const GLuint *, |
||
43 | const GLclampf *); |
||
44 | typedef void (APIENTRY *TEXSUBIMAGEPTR)(int, int, int, int, int, int, int, int, void *); |
||
45 | |||
46 | extern BINDTEXFUNCPTR bindTexFunc; |
||
47 | extern DELTEXFUNCPTR delTexFunc; |
||
48 | extern TEXSUBIMAGEPTR TexSubImage2DFunc; |
||
49 | |||
50 | extern int texture_extension_number; |
||
51 | extern int texture_mode; |
||
52 | |||
53 | extern float gldepthmin, gldepthmax; |
||
54 | |||
55 | void GL_Upload32 (unsigned *data, int width, int height, qboolean mipmap, qboolean alpha, qboolean modulate); |
||
56 | void GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean alpha, qboolean modulate); |
||
57 | int GL_LoadTexture (char *identifier, int width, int height, byte *data, int mipmap, int alpha, int modulate); |
||
58 | int GL_FindTexture (char *identifier); |
||
59 | |||
60 | typedef struct |
||
61 | { |
||
62 | float x, y, z; |
||
63 | float s, t; |
||
64 | float r, g, b; |
||
65 | } glvert_t; |
||
66 | |||
67 | extern glvert_t glv; |
||
68 | |||
69 | extern int glx, gly, glwidth, glheight; |
||
70 | |||
71 | extern PROC glArrayElementEXT; |
||
72 | extern PROC glColorPointerEXT; |
||
73 | extern PROC glTexturePointerEXT; |
||
74 | extern PROC glVertexPointerEXT; |
||
75 | |||
76 | |||
77 | // r_local.h -- private refresh defs |
||
78 | |||
79 | #define MAXALIASVERTS 2000 // TODO: tune this |
||
80 | |||
81 | #define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0) |
||
82 | // normalizing factor so player model works out to about |
||
83 | // 1 pixel per triangle |
||
84 | #define MAX_LBM_HEIGHT 480 |
||
85 | |||
86 | #define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf |
||
87 | |||
88 | #define SKYSHIFT 7 |
||
89 | #define SKYSIZE (1 << SKYSHIFT) |
||
90 | #define SKYMASK (SKYSIZE - 1) |
||
91 | |||
92 | #define BACKFACE_EPSILON 0.01 |
||
93 | |||
94 | |||
95 | void R_TimeRefresh_f (void); |
||
96 | void R_ReadPointFile_f (void); |
||
97 | texture_t *R_TextureAnimation (texture_t *base); |
||
98 | |||
99 | typedef struct surfcache_s |
||
100 | { |
||
101 | struct surfcache_s *next; |
||
102 | struct surfcache_s **owner; // NULL is an empty chunk of memory |
||
103 | int lightadj[MAXLIGHTMAPS]; // checked for strobe flush |
||
104 | int dlight; |
||
105 | int size; // including header |
||
106 | unsigned width; |
||
107 | unsigned height; // DEBUG only needed for debug |
||
108 | float mipscale; |
||
109 | struct texture_s *texture; // checked for animating textures |
||
110 | byte data[4]; // width*height elements |
||
111 | } surfcache_t; |
||
112 | |||
113 | |||
114 | typedef struct |
||
115 | { |
||
116 | pixel_t *surfdat; // destination for generated surface |
||
117 | int rowbytes; // destination logical width in bytes |
||
118 | msurface_t *surf; // description for surface to generate |
||
119 | fixed8_t lightadj[MAXLIGHTMAPS]; |
||
120 | // adjust for lightmap levels for dynamic lighting |
||
121 | texture_t *texture; // corrected for animating textures |
||
122 | int surfmip; // mipmapped ratio of surface texels / world pixels |
||
123 | int surfwidth; // in mipmapped texels |
||
124 | int surfheight; // in mipmapped texels |
||
125 | } drawsurf_t; |
||
126 | |||
127 | |||
128 | typedef enum { |
||
129 | pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2 |
||
130 | } ptype_t; |
||
131 | |||
132 | // !!! if this is changed, it must be changed in d_ifacea.h too !!! |
||
133 | typedef struct particle_s |
||
134 | { |
||
135 | // driver-usable fields |
||
136 | vec3_t org; |
||
137 | float color; |
||
138 | // drivers never touch the following fields |
||
139 | struct particle_s *next; |
||
140 | vec3_t vel; |
||
141 | float ramp; |
||
142 | float die; |
||
143 | ptype_t type; |
||
144 | } particle_t; |
||
145 | |||
146 | |||
147 | //==================================================== |
||
148 | |||
149 | |||
150 | extern entity_t r_worldentity; |
||
151 | extern qboolean r_cache_thrash; // compatability |
||
152 | extern vec3_t modelorg, r_entorigin; |
||
153 | extern entity_t *currententity; |
||
154 | extern int r_visframecount; // ??? what difs? |
||
155 | extern int r_framecount; |
||
156 | extern mplane_t frustum[4]; |
||
157 | extern int c_brush_polys, c_alias_polys; |
||
158 | |||
159 | |||
160 | // |
||
161 | // view origin |
||
162 | // |
||
163 | extern vec3_t vup; |
||
164 | extern vec3_t vpn; |
||
165 | extern vec3_t vright; |
||
166 | extern vec3_t r_origin; |
||
167 | |||
168 | // |
||
169 | // screen size info |
||
170 | // |
||
171 | extern refdef_t r_refdef; |
||
172 | extern mleaf_t *r_viewleaf, *r_oldviewleaf; |
||
173 | extern texture_t *r_notexture_mip; |
||
174 | extern int d_lightstylevalue[256]; // 8.8 fraction of base light value |
||
175 | |||
176 | extern qboolean envmap; |
||
177 | extern int currenttexture; |
||
178 | extern int particletexture; |
||
179 | extern int playertextures; |
||
180 | |||
181 | extern int skytexturenum; // index in cl.loadmodel, not gl texture object |
||
182 | |||
183 | extern cvar_t r_drawentities; |
||
184 | extern cvar_t r_drawworld; |
||
185 | extern cvar_t r_drawviewmodel; |
||
186 | extern cvar_t r_speeds; |
||
187 | extern cvar_t r_waterwarp; |
||
188 | extern cvar_t r_fullbright; |
||
189 | extern cvar_t r_lightmap; |
||
190 | extern cvar_t r_shadows; |
||
191 | extern cvar_t r_dynamic; |
||
192 | |||
193 | extern cvar_t gl_clear; |
||
194 | extern cvar_t gl_cull; |
||
195 | extern cvar_t gl_poly; |
||
196 | extern cvar_t gl_texsort; |
||
197 | extern cvar_t gl_smoothmodels; |
||
198 | extern cvar_t gl_affinemodels; |
||
199 | extern cvar_t gl_fogblend; |
||
200 | extern cvar_t gl_polyblend; |
||
201 | extern cvar_t gl_keeptjunctions; |
||
202 | extern cvar_t gl_reporttjunctions; |
||
203 | |||
204 | extern int gl_lightmap_format; |
||
205 | extern int gl_solid_format; |
||
206 | extern int gl_alpha_format; |
||
207 | |||
208 | void R_TranslatePlayerSkin (int playernum); |
||
209 | void GL_Bind (int texnum);><> |