]> icculus.org git repositories - divverent/darkplaces.git/blob - glquake.h
converted script loading to use COM_LoadMallocFile instead of COM_LoadHunkFile
[divverent/darkplaces.git] / glquake.h
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 #ifdef _MSC_VER
23 //#pragma warning(disable : 4244)     // MIPS
24 //#pragma warning(disable : 4136)     // X86
25 //#pragma warning(disable : 4051)     // ALPHA
26 #pragma warning(disable : 4244)     // LordHavoc: MSVC++ 4 x86, double/float
27 #pragma warning(disable : 4305)         // LordHavoc: MSVC++ 6 x86, double/float
28 #pragma warning(disable : 4018)         // LordHavoc: MSVC++ 4 x86, signed/unsigned mismatch
29 #endif
30
31 #ifdef _WIN32
32 #include <windows.h>
33 #define strcasecmp stricmp
34 #define strncasecmp strnicmp
35 #endif
36
37 #include <GL/gl.h>
38 //#include <GL/glu.h>
39
40 extern qboolean isG200;
41 extern qboolean isRagePro;
42 extern qboolean gl_mtexable;
43 extern qboolean gl_supportslockarrays;
44
45 extern void GL_BeginRendering (int *x, int *y, int *width, int *height);
46 extern void GL_EndRendering (void);
47
48 extern  float   gldepthmin, gldepthmax;
49
50 typedef struct
51 {
52         float   x, y, z;
53         float   s, t;
54         float   r, g, b;
55 } glvert_t;
56
57 extern glvert_t glv;
58
59 extern  int glx, gly, glwidth, glheight;
60
61 // r_local.h -- private refresh defs
62
63 #define ALIAS_BASE_SIZE_RATIO           (1.0 / 11.0)
64                                         // normalizing factor so player model works out to about
65                                         //  1 pixel per triangle
66 #define MAX_LBM_HEIGHT          480
67
68 #define BACKFACE_EPSILON        0.01
69
70
71 extern void R_TimeRefresh_f (void);
72
73 //====================================================
74
75
76 extern  entity_t        r_worldentity;
77 extern  qboolean        r_cache_thrash;         // compatability
78 extern  vec3_t          modelorg, r_entorigin;
79 extern  entity_t        *currententity;
80 extern  int                     r_framecount;
81 extern  mplane_t        frustum[4];
82 extern  int             c_brush_polys, c_alias_polys, c_light_polys, c_faces, c_nodes, c_leafs, c_models, c_bmodels, c_sprites, c_particles, c_dlights;
83
84
85 //
86 // view origin
87 //
88 extern  vec3_t  vup;
89 extern  vec3_t  vpn;
90 extern  vec3_t  vright;
91 extern  vec3_t  r_origin;
92
93 //
94 // screen size info
95 //
96 extern  refdef_t        r_refdef;
97 extern  mleaf_t         *r_viewleaf, *r_oldviewleaf;
98 extern  unsigned short  d_lightstylevalue[256]; // 8.8 fraction of base light value
99
100 extern  qboolean        envmap;
101
102 extern  int     skytexturenum;          // index in cl.loadmodel, not gl texture object
103
104 extern  cvar_t  r_drawentities;
105 extern  cvar_t  r_drawviewmodel;
106 extern  cvar_t  r_speeds;
107 extern  cvar_t  r_fullbright;
108 extern  cvar_t  r_wateralpha;
109 extern  cvar_t  r_dynamic;
110 extern  cvar_t  r_waterripple;
111
112 extern  float   r_world_matrix[16];
113
114 extern  const char *gl_vendor;
115 extern  const char *gl_renderer;
116 extern  const char *gl_version;
117 extern  const char *gl_extensions;
118
119 // Multitexture
120 #define    TEXTURE0_SGIS                                0x835E
121 #define    TEXTURE1_SGIS                                0x835F
122
123 #ifndef _WIN32
124 #define APIENTRY /* */
125 #endif
126
127 // LordHavoc: ARB multitexure support
128 extern int              gl_mtex_enum;
129
130 // for platforms (wgl) that do not use GLAPIENTRY
131 #ifndef GLAPIENTRY
132 #define GLAPIENTRY APIENTRY
133 #endif
134
135 // multitexture
136 extern void (GLAPIENTRY *qglMTexCoord2f) (GLenum, GLfloat, GLfloat);
137 extern void (GLAPIENTRY *qglSelectTexture) (GLenum);
138 extern void (GLAPIENTRY *qglLockArraysEXT) (GLint first, GLint count);
139 extern void (GLAPIENTRY *qglUnlockArraysEXT) (void);
140
141
142 #ifndef GL_ACTIVE_TEXTURE_ARB
143 // multitexture
144 #define GL_ACTIVE_TEXTURE_ARB                   0x84E0
145 #define GL_CLIENT_ACTIVE_TEXTURE_ARB    0x84E1
146 #define GL_MAX_TEXTURES_UNITS_ARB               0x84E2
147 #define GL_TEXTURE0_ARB                                 0x84C0
148 #define GL_TEXTURE1_ARB                                 0x84C1
149 #define GL_TEXTURE2_ARB                                 0x84C2
150 #define GL_TEXTURE3_ARB                                 0x84C3
151 // LordHavoc: ARB supports 32+ texture units, but hey I only use 2 anyway...
152 #endif
153
154 #ifdef WIN32
155 #else
156 //#ifndef MESA
157 //extern void (GLAPIENTRY *glColorTableEXT)(int, int, int, int, int, const void*);
158 //#endif
159
160 #endif
161
162 // LordHavoc: vertex transform
163 #include "transform.h"
164
165 // LordHavoc: transparent polygon system
166 #include "gl_poly.h"
167
168 #define gl_solid_format 3
169 #define gl_alpha_format 4
170
171 //#define PARANOID
172
173 // LordHavoc: was a major time waster
174 #define R_CullBox(mins,maxs) (frustum[0].BoxOnPlaneSideFunc(mins, maxs, &frustum[0]) == 2 || frustum[1].BoxOnPlaneSideFunc(mins, maxs, &frustum[1]) == 2 || frustum[2].BoxOnPlaneSideFunc(mins, maxs, &frustum[2]) == 2 || frustum[3].BoxOnPlaneSideFunc(mins, maxs, &frustum[3]) == 2)
175 #define R_NotCulledBox(mins,maxs) (frustum[0].BoxOnPlaneSideFunc(mins, maxs, &frustum[0]) != 2 && frustum[1].BoxOnPlaneSideFunc(mins, maxs, &frustum[1]) != 2 && frustum[2].BoxOnPlaneSideFunc(mins, maxs, &frustum[2]) != 2 && frustum[3].BoxOnPlaneSideFunc(mins, maxs, &frustum[3]) != 2)
176
177 extern qboolean fogenabled;
178 extern vec3_t fogcolor;
179 extern vec_t fogdensity;
180 //#define calcfog(v) (exp(-(fogdensity*fogdensity*(((v)[0] - r_origin[0]) * vpn[0] + ((v)[1] - r_origin[1]) * vpn[1] + ((v)[2] - r_origin[2]) * vpn[2])*(((v)[0] - r_origin[0]) * vpn[0] + ((v)[1] - r_origin[1]) * vpn[1] + ((v)[2] - r_origin[2]) * vpn[2]))))
181 #define calcfog(v) (exp(-(fogdensity*fogdensity*(((v)[0] - r_origin[0])*((v)[0] - r_origin[0])+((v)[1] - r_origin[1])*((v)[1] - r_origin[1])+((v)[2] - r_origin[2])*((v)[2] - r_origin[2])))))
182 #define calcfogbyte(v) ((byte) (bound(0, ((int) ((float) (calcfog((v)) * 255.0f))), 255)))
183
184 #include "r_modules.h"
185
186 extern qboolean lighthalf;
187
188 #include "r_lerpanim.h"
189
190 void GL_LockArray(int first, int count);
191 void GL_UnlockArray(void);
192
193 void R_DrawAliasModel (entity_t *ent, int cull, float alpha, model_t *clmodel, frameblend_t *blend, int skin, vec3_t org, vec3_t angles, vec_t scale, int effects, int flags, int colormap);
194
195 extern cvar_t r_render;
196 extern cvar_t r_upload;
197 #include "image.h"