Clean up global symbols for the gl renderer.

Where possible, symbols have been made static, prefixed with gl_/GL_ or
moved into the code shared by all renderers. This will make doing plugins
easier but done now for link testing.
This commit is contained in:
Bill Currie 2012-02-17 18:33:07 +09:00
parent 057da55385
commit 447ff2f2f5
43 changed files with 267 additions and 377 deletions

View File

@ -39,10 +39,14 @@ typedef struct glRect_s {
} glRect_t;
extern int lm_src_blend, lm_dest_blend;
extern model_t *currentmodel;
extern mvertex_t *r_pcurrentvertbase;
extern model_t *gl_currentmodel;
void BuildSurfaceDisplayList (msurface_t *fa);
extern int gl_lightmap_textures;
extern qboolean gl_lightmap_modified[MAX_LIGHTMAPS];
extern instsurf_t *gl_lightmap_polys[MAX_LIGHTMAPS];
extern glRect_t gl_lightmap_rectchange[MAX_LIGHTMAPS];
void GL_BuildSurfaceDisplayList (msurface_t *fa);
void gl_lightmap_init (void);
void GL_BuildLightmaps (struct model_s **models, int num_models);
void R_BlendLightmaps (void);

View File

@ -29,7 +29,7 @@
#ifndef __QF_GL_rlight_h
#define __QF_GL_rlight_h
extern float bubble_sintable[], bubble_costable[];
extern float gl_bubble_sintable[], gl_bubble_costable[];
void R_RenderDlights (void);
#endif // __QF_GL_rlight_h

View File

@ -32,13 +32,12 @@
#include "QF/qtypes.h"
#include "QF/cvar.h"
extern qboolean envmap;
extern qboolean gl_envmap;
extern int c_brush_polys, c_alias_polys;
extern float r_world_matrix[16];
extern float modelalpha;
extern vec3_t shadecolor;
extern vec3_t lightspot;
extern float gl_modelalpha;
//extern vec3_t shadecolor;
extern void gl_multitexture_f (cvar_t *var);

View File

@ -29,8 +29,7 @@
#ifndef __QF_GL_rsurf_h
#define __QF_GL_rsurf_h
extern int skytexturenum; // index in cl.loadmodel, not gl texture object
extern int mirrortexturenum; // quake texturenum, not gltexturenum
extern int gl_mirrortexturenum; // quake texturenum, not gltexturenum
void gl_lightmap_init (void);
void GL_BuildLightmaps (struct model_s **models, int num_models);
@ -38,6 +37,6 @@ void GL_BuildLightmaps (struct model_s **models, int num_models);
void R_DrawBrushModel (struct entity_s *e);
void R_DrawWorld (void);
void EmitWaterPolys (msurface_t *fa);
void GL_EmitWaterPolys (msurface_t *fa);
#endif // __QF_GL_rsurf_h

View File

@ -34,8 +34,8 @@
#define SKY_TEX 2000 // Quake 2 environment sky
extern qboolean skyloaded;
extern vec5_t skyvec[6][4];
extern qboolean gl_skyloaded;
extern vec5_t gl_skyvec[6][4];
void R_DrawSky (void);
void R_DrawSkyChain (const instsurf_t *s);

View File

@ -38,14 +38,9 @@ extern int gl_solid_format;
extern int gl_lightmap_format;
extern int gl_filter_min;
extern int gl_filter_max;
extern qboolean Anisotropy;
extern float aniso;
extern int part_tex;
/*
extern int part_tex_dot;
extern int part_tex_smoke;
extern int part_tex_spark;
*/
extern qboolean gl_Anisotropy;
extern float gl_aniso;
extern int gl_part_tex;
void GL_Upload8 (const byte *data, int width, int height, qboolean mipmap, qboolean alpha);
void GL_Upload8_EXT (const byte *data, int width, int height, qboolean mipmap, qboolean alpha);

View File

@ -37,7 +37,6 @@
extern model_t *currentmodel;
extern mvertex_t *r_pcurrentvertbase;
void BuildSurfaceDisplayList (msurface_t *fa);
void gl_lightmap_init (void);
void R_BuildLightmaps (struct model_s **models, int num_models);
void R_CalcLightmaps (void);

View File

@ -331,6 +331,8 @@ extern qboolean r_fov_greater_than_90;
extern struct entity_s *r_ent_queue;
struct dlight_s;
extern vec3_t lightspot;
void R_StoreEfrags (const efrag_t *ppefrag);
void R_TimeRefresh_f (void);
void R_TimeGraph (void);

View File

@ -140,8 +140,8 @@ extern void SetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
extern int r_skymade;
extern void R_MakeSky (void);
extern int solidskytexture;
extern int alphaskytexture;
extern int gl_solidskytexture;
extern int gl_alphaskytexture;
extern int ubasestep, errorterm, erroradjustup, erroradjustdown;

View File

@ -51,24 +51,6 @@ typedef struct varray_t2f_c4f_n3f_v3f_s {
extern qboolean gl_va_capable;
extern int vaelements;
//extern varray_t2f_c4f_n3f_v3f_t *modelVertexArray
//extern int mVAsize;
extern varray_t2f_c4ub_v3f_t *particleVertexArray;
extern int pVAsize;
extern float *textCoords;
extern float *textVertices;
extern int tVAsize;
extern varray_t2f_c4ub_v3f_t *spriteVertexArray;
extern int sVAsize;
/*
extern varray_t2f_c4ub_v3f_t *polyVertexArray;
extern float *polyCoords;
extern float *polyVertices
extern int polyVAsize;
*/
extern varray_t2f_c4ub_v3f_t *gl_spriteVertexArray;
#endif // __qf_varrays_h

View File

@ -159,9 +159,9 @@ build_skin_32 (tex_t *tex, int texnum, byte *translate,
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (Anisotropy)
if (gl_Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
gl_aniso);
}
static void

View File

@ -76,16 +76,14 @@ typedef struct {
float blx, bly;
} cc_cell_t;
byte *draw_chars; // 8*8 graphic characters
static int textUseVA;
static int tVAsize;
static int *tVAindices;
static int tVAcount;
static float *textVertices, *tV;
static float *textCoords, *tC;
int textUseVA;
int tVAsize;
int *tVAindices;
int tVAcount;
float *textVertices, *tV;
float *textCoords, *tC;
qpic_t *draw_backtile;
static qpic_t *draw_backtile;
static cc_cell_t char_cells[256];
static int translate_texture;

View File

@ -52,7 +52,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "r_local.h"
#include "r_shared.h"
float bubble_sintable[33], bubble_costable[33];
float gl_bubble_sintable[33], gl_bubble_costable[33];
void
@ -62,8 +62,8 @@ R_InitBubble (void)
float *bub_sin, *bub_cos;
int i;
bub_sin = bubble_sintable;
bub_cos = bubble_costable;
bub_sin = gl_bubble_sintable;
bub_cos = gl_bubble_costable;
for (i = 32; i >= 0; i--) {
a = i * (M_PI / 16.0);
@ -80,8 +80,8 @@ R_RenderDlight (dlight_t *light)
int i, j;
vec3_t v;
bub_sin = bubble_sintable;
bub_cos = bubble_costable;
bub_sin = gl_bubble_sintable;
bub_cos = gl_bubble_costable;
rad = light->radius * 0.35;
VectorSubtract (light->origin, r_origin, v);

View File

@ -60,14 +60,14 @@ static __attribute__ ((used)) const char rcsid[] =
#include "r_shared.h"
#include "varrays.h"
int ramp1[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 };
int ramp2[8] = { 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66 };
int ramp3[8] = { 0x6d, 0x6b, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 };
static int ramp1[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 };
//static int ramp2[8] = { 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66 };
static int ramp3[8] = { 0x6d, 0x6b, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 };
int partUseVA;
int pVAsize;
int *pVAindices;
varray_t2f_c4ub_v3f_t *particleVertexArray;
static int partUseVA;
static int pVAsize;
static int *pVAindices;
static varray_t2f_c4ub_v3f_t *particleVertexArray;
inline static void
@ -1458,7 +1458,7 @@ R_DrawParticles (void)
if (!r_particles->int_val)
return;
qfglBindTexture (GL_TEXTURE_2D, part_tex);
qfglBindTexture (GL_TEXTURE_2D, gl_part_tex);
// LordHavoc: particles should not affect zbuffer
qfglDepthMask (GL_FALSE);
qfglInterleavedArrays (GL_T2F_C4UB_V3F, 0, particleVertexArray);

View File

@ -48,14 +48,8 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
#include "r_local.h"
/*
int part_tex_dot;
int part_tex_smoke;
int part_tex_spark;
*/
int part_tex;
GLint part_tex_internal_format = 2;
int gl_part_tex;
static GLint part_tex_internal_format = 2;
static void
@ -65,8 +59,8 @@ GDT_InitParticleTexture (void)
memset (data, 0, sizeof (data));
part_tex = texture_extension_number++;
qfglBindTexture (GL_TEXTURE_2D, part_tex);
gl_part_tex = texture_extension_number++;
qfglBindTexture (GL_TEXTURE_2D, gl_part_tex);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
qfglTexImage2D (GL_TEXTURE_2D, 0, part_tex_internal_format, 64, 64, 0, GL_LUMINANCE_ALPHA,

View File

@ -54,7 +54,7 @@ static __attribute__ ((used)) const char rcsid[] =
#define NUM_GRAPH_TEXTURES 8
static byte *graph_texels[NUM_GRAPH_TEXTURES];
int graph_texture[NUM_GRAPH_TEXTURES];
static int graph_texture[NUM_GRAPH_TEXTURES];
static int graph_index;
static int graph_size[NUM_GRAPH_TEXTURES];
static int graph_width[NUM_GRAPH_TEXTURES];

View File

@ -58,22 +58,21 @@ static __attribute__ ((used)) const char rcsid[] =
#include "r_local.h"
#include "r_shared.h"
int active_lightmaps;
int dlightdivtable[8192];
int gl_internalformat; // 1 or 3
int lightmap_bytes; // 1, 3, or 4
int lightmap_textures;
static int dlightdivtable[8192];
static int gl_internalformat; // 1 or 3
static int lightmap_bytes; // 1, 3, or 4
int gl_lightmap_textures;
// keep lightmap texture data in main memory so texsubimage can update properly
// LordHavoc: changed to be allocated at runtime (typically lower memory usage)
byte *lightmaps[MAX_LIGHTMAPS];
static byte *lightmaps[MAX_LIGHTMAPS];
unsigned int blocklights[34 * 34 * 3]; //FIXME make dynamic
int allocated[MAX_LIGHTMAPS][BLOCK_WIDTH];
static unsigned int blocklights[34 * 34 * 3]; //FIXME make dynamic
static int allocated[MAX_LIGHTMAPS][BLOCK_WIDTH];
qboolean lightmap_modified[MAX_GLTEXTURES];
instsurf_t *lightmap_polys[MAX_LIGHTMAPS];
glRect_t lightmap_rectchange[MAX_LIGHTMAPS];
qboolean gl_lightmap_modified[MAX_LIGHTMAPS];
instsurf_t *gl_lightmap_polys[MAX_LIGHTMAPS];
glRect_t gl_lightmap_rectchange[MAX_LIGHTMAPS];
static int lmshift = 7;
@ -440,7 +439,7 @@ do_subimage_2 (int i)
{
byte *block, *lm, *b;
int stride, width;
glRect_t *rect = &lightmap_rectchange[i];
glRect_t *rect = &gl_lightmap_rectchange[i];
width = rect->w * lightmap_bytes;
stride = BLOCK_WIDTH * lightmap_bytes;
@ -463,10 +462,10 @@ GL_UploadLightmap (int i)
do_subimage_2 (i);
break;
case 1:
qfglTexSubImage2D (GL_TEXTURE_2D, 0, 0, lightmap_rectchange[i].t,
BLOCK_WIDTH, lightmap_rectchange[i].h,
qfglTexSubImage2D (GL_TEXTURE_2D, 0, 0, gl_lightmap_rectchange[i].t,
BLOCK_WIDTH, gl_lightmap_rectchange[i].h,
gl_lightmap_format, GL_UNSIGNED_BYTE,
lightmaps[i] + (lightmap_rectchange[i].t *
lightmaps[i] + (gl_lightmap_rectchange[i].t *
BLOCK_WIDTH) * lightmap_bytes);
break;
default:
@ -484,12 +483,12 @@ R_CalcLightmaps (void)
int i;
for (i = 0; i < MAX_LIGHTMAPS; i++) {
if (!lightmap_polys[i])
if (!gl_lightmap_polys[i])
continue;
if (lightmap_modified[i]) {
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
if (gl_lightmap_modified[i]) {
qfglBindTexture (GL_TEXTURE_2D, gl_lightmap_textures + i);
GL_UploadLightmap (i);
lightmap_modified[i] = false;
gl_lightmap_modified[i] = false;
}
}
}
@ -506,8 +505,8 @@ R_BlendLightmaps (void)
qfglBlendFunc (lm_src_blend, lm_dest_blend);
for (i = 0; i < MAX_LIGHTMAPS; i++) {
for (sc = lightmap_polys[i]; sc; sc = sc->lm_chain) {
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
for (sc = gl_lightmap_polys[i]; sc; sc = sc->lm_chain) {
qfglBindTexture (GL_TEXTURE_2D, gl_lightmap_textures + i);
if (sc->transform) {
qfglPushMatrix ();
qfglLoadMatrixf (sc->transform);
@ -596,11 +595,11 @@ gl_overbright_f (cvar_t *var)
continue;
num = fa->lightmaptexturenum;
lightmap_modified[num] = true;
lightmap_rectchange[num].l = 0;
lightmap_rectchange[num].t = 0;
lightmap_rectchange[num].w = BLOCK_WIDTH;
lightmap_rectchange[num].h = BLOCK_HEIGHT;
gl_lightmap_modified[num] = true;
gl_lightmap_rectchange[num].l = 0;
gl_lightmap_rectchange[num].t = 0;
gl_lightmap_rectchange[num].w = BLOCK_WIDTH;
gl_lightmap_rectchange[num].h = BLOCK_HEIGHT;
R_BuildLightMap (fa);
}
@ -613,11 +612,11 @@ gl_overbright_f (cvar_t *var)
continue;
num = fa->lightmaptexturenum;
lightmap_modified[num] = true;
lightmap_rectchange[num].l = 0;
lightmap_rectchange[num].t = 0;
lightmap_rectchange[num].w = BLOCK_WIDTH;
lightmap_rectchange[num].h = BLOCK_HEIGHT;
gl_lightmap_modified[num] = true;
gl_lightmap_rectchange[num].l = 0;
gl_lightmap_rectchange[num].t = 0;
gl_lightmap_rectchange[num].w = BLOCK_WIDTH;
gl_lightmap_rectchange[num].h = BLOCK_HEIGHT;
R_BuildLightMap (fa);
}
@ -698,8 +697,8 @@ GL_BuildLightmaps (model_t **models, int num_models)
r_framecount = 1; // no dlightcache
if (!lightmap_textures) {
lightmap_textures = texture_extension_number;
if (!gl_lightmap_textures) {
gl_lightmap_textures = texture_extension_number;
texture_extension_number += MAX_LIGHTMAPS;
}
@ -740,7 +739,7 @@ GL_BuildLightmaps (model_t **models, int num_models)
continue;
}
r_pcurrentvertbase = m->vertexes;
currentmodel = m;
gl_currentmodel = m;
// non-bsp models don't have surfaces.
for (i = 0; i < m->numsurfaces; i++) {
if (m->surfaces[i].flags & SURF_DRAWTURB)
@ -749,7 +748,7 @@ GL_BuildLightmaps (model_t **models, int num_models)
SURF_DRAWSKY))
continue;
GL_CreateSurfaceLightmap (m->surfaces + i);
BuildSurfaceDisplayList (m->surfaces + i);
GL_BuildSurfaceDisplayList (m->surfaces + i);
}
}
@ -757,17 +756,17 @@ GL_BuildLightmaps (model_t **models, int num_models)
for (i = 0; i < MAX_LIGHTMAPS; i++) {
if (!allocated[i][0])
break; // no more used
lightmap_modified[i] = false;
lightmap_rectchange[i].l = BLOCK_WIDTH;
lightmap_rectchange[i].t = BLOCK_HEIGHT;
lightmap_rectchange[i].w = 0;
lightmap_rectchange[i].h = 0;
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
gl_lightmap_modified[i] = false;
gl_lightmap_rectchange[i].l = BLOCK_WIDTH;
gl_lightmap_rectchange[i].t = BLOCK_HEIGHT;
gl_lightmap_rectchange[i].w = 0;
gl_lightmap_rectchange[i].h = 0;
qfglBindTexture (GL_TEXTURE_2D, gl_lightmap_textures + i);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (Anisotropy)
if (gl_Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
gl_aniso);
qfglTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, BLOCK_WIDTH,
BLOCK_HEIGHT, 0, gl_lightmap_format,
GL_UNSIGNED_BYTE, lightmaps[i]);

View File

@ -75,17 +75,7 @@ typedef struct {
int count;
} vert_order_t;
float r_avertexnormals[NUMVERTEXNORMALS][3] = {
#include "anorms.h"
};
// precalculated dot products for quantized angles
#define SHADEDOT_QUANT 16
float r_avertexnormal_dots[SHADEDOT_QUANT][256] = {
#include "anorm_dots.h"
};
vec3_t shadevector;
static vec3_t shadevector;
static void
@ -401,7 +391,7 @@ R_DrawAliasModel (entity_t *e)
VectorSubtract (r_origin, e->origin, modelorg);
modelalpha = e->colormod[3];
gl_modelalpha = e->colormod[3];
is_fullbright = (model->fullbright || e->fullbright);
minlight = max (model->min_light, e->min_light);
@ -557,7 +547,7 @@ R_DrawAliasModel (entity_t *e)
paliashdr->mdl.scale_origin[2]);
qfglScalef (scale[0], scale[1], scale[2]);
if (modelalpha < 1.0)
if (gl_modelalpha < 1.0)
qfglDepthMask (GL_FALSE);
// draw all the triangles
@ -663,9 +653,9 @@ R_DrawAliasModel (entity_t *e)
qfglDisable (GL_TEXTURE_2D);
qfglDepthMask (GL_FALSE);
if (modelalpha < 1.0) {
if (gl_modelalpha < 1.0) {
VectorBlend (e->colormod, dark, 0.5, color);
color[3] = modelalpha * (model->shadow_alpha / 255.0);
color[3] = gl_modelalpha * (model->shadow_alpha / 255.0);
qfglColor4fv (color);
} else {
color_black[3] = model->shadow_alpha;
@ -679,7 +669,7 @@ R_DrawAliasModel (entity_t *e)
if (!tess)
qfglEnable (GL_NORMALIZE);
qfglPopMatrix ();
} else if (modelalpha < 1.0) {
} else if (gl_modelalpha < 1.0) {
qfglDepthMask (GL_TRUE);
}

View File

@ -50,12 +50,9 @@ static __attribute__ ((used)) const char rcsid[] =
#include "r_shared.h"
#include "varrays.h"
int sVAsize;
int *sVAindices;
float *spriteVertices;
float *spriteTexCoords;
float *spriteColors;
varray_t2f_c4ub_v3f_t *spriteVertexArray;
static int sVAsize;
static int *sVAindices;
varray_t2f_c4ub_v3f_t *gl_spriteVertexArray;
void (*R_DrawSpriteModel) (struct entity_s *ent);
@ -181,7 +178,7 @@ R_DrawSpriteModel_VA_f (entity_t *e)
vec3_t point1, point2, v_up;
varray_t2f_c4ub_v3f_t *VA;
VA = spriteVertexArray; // FIXME: Despair
VA = gl_spriteVertexArray; // FIXME: Despair
// don't bother culling, it's just a single polygon without a surface cache
frame = R_GetSpriteFrame (e);
@ -234,7 +231,7 @@ R_DrawSpriteModel_VA_f (entity_t *e)
// qfglDrawElements (GL_QUADS, vacount, GL_UNSIGNED_INT, sVAindices);
qfglDrawElements (GL_QUADS, 4, GL_UNSIGNED_INT, sVAindices);
// vacount = 0;
// VA = spriteVertexArray;
// VA = gl_spriteVertexArray;
// }
if (modelalpha < 255)
@ -261,11 +258,11 @@ R_InitSprites (void)
Sys_MaskPrintf (SYS_DEV, "Sprites: %i maximum vertex elements.\n",
sVAsize);
if (spriteVertexArray)
free (spriteVertexArray);
spriteVertexArray = (varray_t2f_c4ub_v3f_t *)
if (gl_spriteVertexArray)
free (gl_spriteVertexArray);
gl_spriteVertexArray = (varray_t2f_c4ub_v3f_t *)
calloc (sVAsize, sizeof (varray_t2f_c4ub_v3f_t));
qfglInterleavedArrays (GL_T2F_C4UB_V3F, 0, spriteVertexArray);
qfglInterleavedArrays (GL_T2F_C4UB_V3F, 0, gl_spriteVertexArray);
if (sVAindices)
free (sVAindices);
@ -273,21 +270,21 @@ R_InitSprites (void)
for (i = 0; i < sVAsize; i++)
sVAindices[i] = i;
for (i = 0; i < sVAsize / 4; i++) {
spriteVertexArray[i * 4].texcoord[0] = 0.0;
spriteVertexArray[i * 4].texcoord[1] = 1.0;
spriteVertexArray[i * 4 + 1].texcoord[0] = 0.0;
spriteVertexArray[i * 4 + 1].texcoord[1] = 0.0;
spriteVertexArray[i * 4 + 2].texcoord[0] = 1.0;
spriteVertexArray[i * 4 + 2].texcoord[1] = 0.0;
spriteVertexArray[i * 4 + 3].texcoord[0] = 1.0;
spriteVertexArray[i * 4 + 3].texcoord[1] = 1.0;
gl_spriteVertexArray[i * 4].texcoord[0] = 0.0;
gl_spriteVertexArray[i * 4].texcoord[1] = 1.0;
gl_spriteVertexArray[i * 4 + 1].texcoord[0] = 0.0;
gl_spriteVertexArray[i * 4 + 1].texcoord[1] = 0.0;
gl_spriteVertexArray[i * 4 + 2].texcoord[0] = 1.0;
gl_spriteVertexArray[i * 4 + 2].texcoord[1] = 0.0;
gl_spriteVertexArray[i * 4 + 3].texcoord[0] = 1.0;
gl_spriteVertexArray[i * 4 + 3].texcoord[1] = 1.0;
}
} else {
R_DrawSpriteModel = R_DrawSpriteModel_f;
if (spriteVertexArray) {
free (spriteVertexArray);
spriteVertexArray = 0;
if (gl_spriteVertexArray) {
free (gl_spriteVertexArray);
gl_spriteVertexArray = 0;
}
if (sVAindices) {
free (sVAindices);

View File

@ -66,40 +66,19 @@ static __attribute__ ((used)) const char rcsid[] =
#include "r_local.h"
#include "varrays.h"
entity_t r_worldentity;
qboolean r_cache_thrash; // compatability
vec3_t modelorg, r_entorigin;
entity_t *currententity;
int r_visframecount; // bumped when going to a new PVS
VISIBLE int r_framecount; // used for dlight push checking
int c_brush_polys, c_alias_polys;
qboolean envmap; // true during envmap command capture
qboolean gl_envmap; // true during envmap command capture
int mirrortexturenum; // quake texturenum, not gltexturenum
qboolean mirror;
plane_t *mirror_plane;
// view origin
VISIBLE vec3_t vup;
VISIBLE vec3_t vpn;
VISIBLE vec3_t vright;
VISIBLE vec3_t r_origin;
int gl_mirrortexturenum; // quake texturenum, not gltexturenum
qboolean gl_mirror;
plane_t *gl_mirror_plane;
float r_world_matrix[16];
float r_base_world_matrix[16];
static float r_base_world_matrix[16];
// screen size info
VISIBLE refdef_t r_refdef;
int d_lightstylevalue[256]; // 8.8 fraction of base light value
vec3_t shadecolor; // Ender (Extend) Colormod
float modelalpha; // Ender (Extend) Alpha
//vec3_t gl_shadecolor; // Ender (Extend) Colormod
float gl_modelalpha; // Ender (Extend) Alpha
/* Unknown renamed to GLErr_Unknown to solve conflict with winioctl.h */
unsigned int GLErr_InvalidEnum;
@ -273,7 +252,7 @@ R_DrawEntitiesOnList (void)
qfglEnable (GL_ALPHA_TEST);
if (gl_va_capable)
qfglInterleavedArrays (GL_T2F_C4UB_V3F, 0, spriteVertexArray);
qfglInterleavedArrays (GL_T2F_C4UB_V3F, 0, gl_spriteVertexArray);
for (ent = r_ent_queue; ent; ent = ent->next) {
if (ent->model->type != mod_sprite)
continue;
@ -290,7 +269,7 @@ R_DrawViewModel (void)
currententity = r_view_model;
if (r_inhibit_viewmodel
|| !r_drawviewmodel->int_val
|| envmap
|| gl_envmap
|| !r_drawentities->int_val
|| !currententity->model)
return;
@ -434,7 +413,7 @@ R_SetupGL_Viewport_and_Perspective (void)
qfglMatrixMode (GL_PROJECTION);
qfglLoadIdentity ();
if (envmap) {
if (gl_envmap) {
x = y2 = 0;
w = h = 256;
} else {
@ -458,8 +437,8 @@ R_SetupGL (void)
R_SetupGL_Viewport_and_Perspective ();
if (mirror) {
if (mirror_plane->normal[2])
if (gl_mirror) {
if (gl_mirror_plane->normal[2])
qfglScalef (1, -1, 1);
else
qfglScalef (-1, 1, 1);
@ -534,18 +513,18 @@ R_Mirror (void)
float d;
// msurface_t *s;
// if (!mirror) // FIXME: Broken
// if (!gl_mirror) // FIXME: Broken
return;
memcpy (r_base_world_matrix, r_world_matrix, sizeof (r_base_world_matrix));
d = 2 * DotProduct (r_refdef.vieworg, mirror_plane->normal) -
mirror_plane->dist;
VectorMultSub (r_refdef.vieworg, d, mirror_plane->normal,
d = 2 * DotProduct (r_refdef.vieworg, gl_mirror_plane->normal) -
gl_mirror_plane->dist;
VectorMultSub (r_refdef.vieworg, d, gl_mirror_plane->normal,
r_refdef.vieworg);
d = 2 * DotProduct (vpn, mirror_plane->normal);
VectorMultSub (vpn, d, mirror_plane->normal, vpn);
d = 2 * DotProduct (vpn, gl_mirror_plane->normal);
VectorMultSub (vpn, d, gl_mirror_plane->normal, vpn);
r_refdef.viewangles[0] = -asin (vpn[2]) / M_PI * 180;
r_refdef.viewangles[1] = atan2 (vpn[1], vpn[0]) / M_PI * 180;
@ -566,7 +545,7 @@ R_Mirror (void)
// blend on top
qfglMatrixMode (GL_PROJECTION);
if (mirror_plane->normal[2])
if (gl_mirror_plane->normal[2])
qfglScalef (1, -1, 1);
else
qfglScalef (-1, 1, 1);
@ -578,7 +557,7 @@ R_Mirror (void)
color_white[3] = r_mirroralpha->value * 255;
qfglColor4ubv (color_white);
#if 0//FIXME
s = r_worldentity.model->textures[mirrortexturenum]->texturechain;
s = r_worldentity.model->textures[gl_mirrortexturenum]->texturechain;
for (; s; s = s->texturechain) {
texture_t *tex;
@ -598,7 +577,7 @@ R_Mirror (void)
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
// R_RenderBrushPoly (s, tex); // FIXME: Need to move R_Mirror to gl_rsurf.c, and uncommment this line!
}
r_worldentity.model->textures[mirrortexturenum]->texturechain = NULL;
r_worldentity.model->textures[gl_mirrortexturenum]->texturechain = NULL;
#endif
qfglColor3ubv (color_white);
}
@ -616,7 +595,7 @@ R_RenderView_ (void)
if (!r_worldentity.model)
Sys_Error ("R_RenderView: NULL worldmodel");
mirror = false;
gl_mirror = false;
R_Clear ();

View File

@ -65,8 +65,6 @@ static __attribute__ ((used)) const char rcsid[] =
#include "r_local.h"
#include "varrays.h"
int r_init = 0;
/*
R_Envmap_f
@ -79,7 +77,7 @@ R_Envmap_f (void)
qfglDrawBuffer (GL_FRONT);
qfglReadBuffer (GL_FRONT);
envmap = true;
gl_envmap = true;
r_refdef.vrect.x = 0;
r_refdef.vrect.y = 0;
@ -120,7 +118,7 @@ R_Envmap_f (void)
qfglReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
QFS_WriteFile ("env5.rgb", buffer, sizeof (buffer));
envmap = false;
gl_envmap = false;
qfglDrawBuffer (GL_BACK);
qfglReadBuffer (GL_BACK);
GL_EndRendering ();
@ -203,19 +201,17 @@ R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
GL_BuildLightmaps (models, num_models);
// identify sky texture
skytexturenum = -1;
mirrortexturenum = -1;
gl_mirrortexturenum = -1;
R_ClearTextures ();
for (i = 0; i < r_worldentity.model->numtextures; i++) {
tex = r_worldentity.model->textures[i];
if (!tex)
continue;
if (!strncmp (tex->name, "sky", 3)) {
skytexturenum = i;
R_InitSky (tex);
}
if (!strncmp (tex->name, "window02_1", 10))
mirrortexturenum = i;
gl_mirrortexturenum = i;
}
R_InitSurfaceChains (r_worldentity.model);

View File

@ -58,12 +58,10 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
#include "r_local.h"
#include "r_shared.h"
int skytexturenum;
instsurf_t *waterchain = NULL;
instsurf_t **waterchain_tail = &waterchain;
instsurf_t *sky_chain;
instsurf_t **sky_chain_tail;
static instsurf_t *waterchain = NULL;
static instsurf_t **waterchain_tail = &waterchain;
static instsurf_t *sky_chain;
static instsurf_t **sky_chain_tail;
#define CHAIN_SURF_F2B(surf,chain) \
do { \
@ -86,11 +84,6 @@ instsurf_t **sky_chain_tail;
(chain) = inst; \
} while (0)
extern int lightmap_textures;
extern qboolean lightmap_modified[MAX_LIGHTMAPS];
extern instsurf_t *lightmap_polys[MAX_LIGHTMAPS];
extern glRect_t lightmap_rectchange[MAX_LIGHTMAPS];
static texture_t **r_texture_chains;
static int r_num_texture_chains;
static int max_texture_chains;
@ -282,8 +275,8 @@ R_AddToLightmapChain (msurface_t *fa)
if (!(sc = fa->instsurf))
sc = fa->tinst;
sc->lm_chain = lightmap_polys[fa->lightmaptexturenum];
lightmap_polys[fa->lightmaptexturenum] = sc;
sc->lm_chain = gl_lightmap_polys[fa->lightmaptexturenum];
gl_lightmap_polys[fa->lightmaptexturenum] = sc;
// check for lightmap modification
for (maps = 0; maps < MAXLIGHTMAPS && fa->styles[maps] != 255; maps++)
@ -293,8 +286,8 @@ R_AddToLightmapChain (msurface_t *fa)
if ((fa->dlightframe == r_framecount) || fa->cached_dlight) {
dynamic:
if (r_dynamic->int_val) {
lightmap_modified[fa->lightmaptexturenum] = true;
theRect = &lightmap_rectchange[fa->lightmaptexturenum];
gl_lightmap_modified[fa->lightmaptexturenum] = true;
theRect = &gl_lightmap_rectchange[fa->lightmaptexturenum];
if (fa->light_t < theRect->t) {
if (theRect->h)
theRect->h += theRect->t - fa->light_t;
@ -346,7 +339,7 @@ R_DrawWaterSurfaces (void)
i = fa->texinfo->texture->gl_texturenum;
qfglBindTexture (GL_TEXTURE_2D, i);
}
EmitWaterPolys (fa);
GL_EmitWaterPolys (fa);
}
qfglLoadMatrixf (r_world_matrix);
@ -396,7 +389,7 @@ DrawTextureChains (int disable_blend, int do_bind)
}
if (s->color && do_bind)
qfglColor4fv (s->color);
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures +
qfglBindTexture (GL_TEXTURE_2D, gl_lightmap_textures +
fa->lightmaptexturenum);
R_RenderBrushPoly_3 (fa);
@ -415,7 +408,7 @@ DrawTextureChains (int disable_blend, int do_bind)
qglActiveTexture (gl_mtex_enum + 1);
for (s = tex->tex_chain; s; s = s->tex_chain) {
fa = s->surface;
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures +
qfglBindTexture (GL_TEXTURE_2D, gl_lightmap_textures +
fa->lightmaptexturenum);
if (s->transform) {
@ -488,7 +481,7 @@ clear_texture_chains (void)
tex->tex_chain_tail = &tex->tex_chain;
release_instsurfs ();
memset (lightmap_polys, 0, sizeof (lightmap_polys));
memset (gl_lightmap_polys, 0, sizeof (gl_lightmap_polys));
}
static inline void
@ -805,12 +798,10 @@ R_DrawWorld (void)
clear_texture_chains ();
}
int nColinElim;
model_t *currentmodel;
mvertex_t *r_pcurrentvertbase;
model_t *gl_currentmodel;
void
BuildSurfaceDisplayList (msurface_t *fa)
GL_BuildSurfaceDisplayList (msurface_t *fa)
{
float s, t;
float *vec;
@ -819,7 +810,7 @@ BuildSurfaceDisplayList (msurface_t *fa)
medge_t *pedges, *r_pedge;
// reconstruct the polygon
pedges = currentmodel->edges;
pedges = gl_currentmodel->edges;
lnumverts = fa->numedges;
// draw texture
@ -831,7 +822,7 @@ BuildSurfaceDisplayList (msurface_t *fa)
poly->numverts = lnumverts;
for (i = 0; i < lnumverts; i++) {
lindex = currentmodel->surfedges[fa->firstedge + i];
lindex = gl_currentmodel->surfedges[fa->firstedge + i];
if (lindex > 0) {
r_pedge = &pedges[lindex];
@ -896,7 +887,6 @@ BuildSurfaceDisplayList (msurface_t *fa)
poly->verts[j - 1][k] = poly->verts[j][k];
}
--lnumverts;
++nColinElim;
// retry next vertex next time, which is now current vertex
--i;
}

View File

@ -56,15 +56,15 @@ static __attribute__ ((used)) const char rcsid[] =
#include "r_cvar.h"
#include "r_shared.h"
const char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" };
int solidskytexture;
int alphaskytexture;
static const char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" };
int gl_solidskytexture;
int gl_alphaskytexture;
// Set to true if a valid skybox is loaded --KB
qboolean skyloaded = false;
qboolean gl_skyloaded = false;
vec5_t skyvec[6][4] = {
vec5_t gl_skyvec[6][4] = {
{
// right +y
{1, 0, 1024, 1024, 1024},
@ -119,11 +119,11 @@ R_LoadSkys (const char *skyname)
skyname = r_skyname->string;
if (!*skyname || strcasecmp (skyname, "none") == 0) {
skyloaded = false;
gl_skyloaded = false;
return;
}
skyloaded = true;
gl_skyloaded = true;
for (i = 0; i < 6; i++) {
tex_t *targa;
@ -136,7 +136,7 @@ R_LoadSkys (const char *skyname)
targa = LoadImage (name = va ("gfx/env/%s%s", skyname, suf[i]));
if (!targa) {
Sys_MaskPrintf (SYS_DEV, "Couldn't load %s\n", name);
skyloaded = false;
gl_skyloaded = false;
continue;
}
}
@ -149,28 +149,28 @@ R_LoadSkys (const char *skyname)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (Anisotropy)
if (gl_Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
gl_aniso);
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
#if 0
for (j = 0; j < 4; j++) {
// set the texture coords to be 1/2 pixel in from the edge
if (skyvec[i][j][0] < 0.5)
skyvec[i][j][0] = 0.5 / targa->width;
if (gl_skyvec[i][j][0] < 0.5)
gl_skyvec[i][j][0] = 0.5 / targa->width;
else
skyvec[i][j][0] = 1 - 0.5 / targa->width;
gl_skyvec[i][j][0] = 1 - 0.5 / targa->width;
if (skyvec[i][j][1] < 0.5)
skyvec[i][j][1] = 0.5 / targa->height;
if (gl_skyvec[i][j][1] < 0.5)
gl_skyvec[i][j][1] = 0.5 / targa->height;
else
skyvec[i][j][1] = 1 - 0.5 / targa->height;
gl_skyvec[i][j][1] = 1 - 0.5 / targa->height;
}
#endif
}
if (!skyloaded)
if (!gl_skyloaded)
Sys_Printf ("Unable to load skybox %s, using normal sky\n", skyname);
}
@ -183,7 +183,7 @@ R_DrawSkyBox (void)
qfglBindTexture (GL_TEXTURE_2D, SKY_TEX + i);
qfglBegin (GL_QUADS);
for (j = 0; j < 4; j++) {
float *v = (float *) skyvec[i][j];
float *v = (float *) gl_skyvec[i][j];
qfglTexCoord2fv (v);
qfglVertex3f (r_refdef.vieworg[0] + v[2],
@ -194,9 +194,9 @@ R_DrawSkyBox (void)
}
}
vec3_t domescale = {2048.0, 2048.0, 512.0};
vec3_t zenith = { 0.0, 0.0, 512.0};
vec3_t nadir = { 0.0, 0.0, -512.0};
static vec3_t domescale = {2048.0, 2048.0, 512.0};
static vec3_t zenith = { 0.0, 0.0, 512.0};
static vec3_t nadir = { 0.0, 0.0, -512.0};
static inline void
skydome_vertex (const vec3_t v, float speedscale)
@ -232,17 +232,17 @@ skydome_debug (void)
qfglDisable (GL_TEXTURE_2D);
qfglBegin (GL_LINES);
for (a = 0; a < 16; a++) {
a1x = bubble_costable[a * 2] * domescale[0];
a1y = -bubble_sintable[a * 2] * domescale[1];
a2x = bubble_costable[(a + 1) * 2] * domescale[0];
a2y = -bubble_sintable[(a + 1) * 2] * domescale[1];
a1x = gl_bubble_costable[a * 2] * domescale[0];
a1y = -gl_bubble_sintable[a * 2] * domescale[1];
a2x = gl_bubble_costable[(a + 1) * 2] * domescale[0];
a2y = -gl_bubble_sintable[(a + 1) * 2] * domescale[1];
h = 1;
t = 0;
VectorAdd (zenith, r_refdef.vieworg, v[0]);
for (b = 1; b <= 8; b++) {
x = bubble_costable[b + 8];
y = -bubble_sintable[b + 8];
x = gl_bubble_costable[b + 8];
y = -gl_bubble_sintable[b + 8];
v[h][0] = a1x * x;
v[h][1] = a1y * x;
@ -273,8 +273,8 @@ skydome_debug (void)
t = 0;
VectorAdd (nadir, r_refdef.vieworg, v[0]);
for (b = 15; b >= 8; b--) {
x = bubble_costable[b + 8];
y = -bubble_sintable[b + 8];
x = gl_bubble_costable[b + 8];
y = -gl_bubble_sintable[b + 8];
v[h][0] = a2x * x;
v[h][1] = a2y * x;
@ -313,16 +313,16 @@ R_DrawSkyLayer (float speedscale)
vec3_t v;
for (a = 0; a < 16; a++) {
a1x = bubble_costable[a * 2] * domescale[0];
a1y = -bubble_sintable[a * 2] * domescale[1];
a2x = bubble_costable[(a + 1) * 2] * domescale[0];
a2y = -bubble_sintable[(a + 1) * 2] * domescale[1];
a1x = gl_bubble_costable[a * 2] * domescale[0];
a1y = -gl_bubble_sintable[a * 2] * domescale[1];
a2x = gl_bubble_costable[(a + 1) * 2] * domescale[0];
a2y = -gl_bubble_sintable[(a + 1) * 2] * domescale[1];
qfglBegin (GL_TRIANGLE_STRIP);
skydome_vertex (zenith, speedscale);
for (b = 1; b <= 8; b++) {
x = bubble_costable[b + 8];
y = -bubble_sintable[b + 8];
x = gl_bubble_costable[b + 8];
y = -gl_bubble_sintable[b + 8];
v[0] = a1x * x;
v[1] = a1y * x;
@ -339,8 +339,8 @@ R_DrawSkyLayer (float speedscale)
qfglBegin (GL_TRIANGLE_STRIP);
skydome_vertex (nadir, speedscale);
for (b = 15; b >= 8; b--) {
x = bubble_costable[b + 8];
y = -bubble_sintable[b + 8];
x = gl_bubble_costable[b + 8];
y = -gl_bubble_sintable[b + 8];
v[0] = a2x * x;
v[1] = a2y * x;
@ -363,7 +363,7 @@ R_DrawSkyDome (void)
// base sky
qfglDisable (GL_BLEND);
qfglBindTexture (GL_TEXTURE_2D, solidskytexture);
qfglBindTexture (GL_TEXTURE_2D, gl_solidskytexture);
speedscale = r_realtime / 16.0;
speedscale -= floor (speedscale);
R_DrawSkyLayer (speedscale);
@ -371,7 +371,7 @@ R_DrawSkyDome (void)
// clouds
if (gl_sky_multipass->int_val) {
qfglBindTexture (GL_TEXTURE_2D, alphaskytexture);
qfglBindTexture (GL_TEXTURE_2D, gl_alphaskytexture);
speedscale = r_realtime / 8.0;
speedscale -= floor (speedscale);
R_DrawSkyLayer (speedscale);
@ -386,7 +386,7 @@ R_DrawSky (void)
{
qfglDisable (GL_DEPTH_TEST);
qfglDepthMask (GL_FALSE);
if (skyloaded)
if (gl_skyloaded)
R_DrawSkyBox ();
else
R_DrawSkyDome ();
@ -428,16 +428,16 @@ R_InitSky (texture_t *mt)
((byte *) & transpix)[2] = b / (128 * 128);
((byte *) & transpix)[3] = 0;
if (!solidskytexture)
solidskytexture = texture_extension_number++;
qfglBindTexture (GL_TEXTURE_2D, solidskytexture);
if (!gl_solidskytexture)
gl_solidskytexture = texture_extension_number++;
qfglBindTexture (GL_TEXTURE_2D, gl_solidskytexture);
qfglTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 128, 128, 0, GL_RGBA,
GL_UNSIGNED_BYTE, trans);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (Anisotropy)
if (gl_Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
gl_aniso);
for (i = 0; i < 128; i++)
for (j = 0; j < 128; j++) {
@ -448,14 +448,14 @@ R_InitSky (texture_t *mt)
trans[(i * 128) + j] = d_8to24table[p];
}
if (!alphaskytexture)
alphaskytexture = texture_extension_number++;
qfglBindTexture (GL_TEXTURE_2D, alphaskytexture);
if (!gl_alphaskytexture)
gl_alphaskytexture = texture_extension_number++;
qfglBindTexture (GL_TEXTURE_2D, gl_alphaskytexture);
qfglTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 128, 128, 0, GL_RGBA,
GL_UNSIGNED_BYTE, trans);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (Anisotropy)
if (gl_Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
gl_aniso);
}

View File

@ -748,7 +748,7 @@ draw_id_sky_polys (const instsurf_t *sky_chain)
speedscale = r_realtime / 16;
speedscale -= floor (speedscale);
qfglBindTexture (GL_TEXTURE_2D, solidskytexture);
qfglBindTexture (GL_TEXTURE_2D, gl_solidskytexture);
while (sc) {
EmitSkyPolys (speedscale, sc);
sc = sc->tex_chain;
@ -760,7 +760,7 @@ draw_id_sky_polys (const instsurf_t *sky_chain)
speedscale = r_realtime / 8;
speedscale -= floor (speedscale);
qfglBindTexture (GL_TEXTURE_2D, alphaskytexture);
qfglBindTexture (GL_TEXTURE_2D, gl_alphaskytexture);
while (sc) {
EmitSkyPolys (speedscale, sc);
sc = sc->tex_chain;
@ -806,7 +806,7 @@ R_DrawSkyChain (const instsurf_t *sky_chain)
return;
}
if (skyloaded) {
if (gl_skyloaded) {
if (gl_sky_clip->int_val) {
draw_skybox_sky_polys (sky_chain);
}
@ -881,7 +881,7 @@ R_DrawSkyChain (const instsurf_t *sky_chain)
qfglEnd ();
}
if (gl_sky_debug->int_val & 4) {
if (skyloaded) {
if (gl_skyloaded) {
int i, j;
qfglColor3ub (255, 0, 0);
@ -890,7 +890,7 @@ R_DrawSkyChain (const instsurf_t *sky_chain)
qfglBegin (GL_LINE_LOOP);
for (j = 0; j < 4; j++) {
VectorScale (&skyvec[i][j][2], 1.0 / 128.0, v);
VectorScale (&gl_skyvec[i][j][2], 1.0 / 128.0, v);
VectorAdd (v, r_refdef.vieworg, v);
qfglVertex3fv (v);
}

View File

@ -225,9 +225,9 @@ GL_TextureMode_f (void)
gl_filter_min);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max);
if (Anisotropy)
if (gl_Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D,
GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso);
GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_aniso);
}
}
}
@ -431,9 +431,9 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap,
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max);
}
if (Anisotropy)
if (gl_Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
gl_aniso);
free (scaled);
}
@ -508,9 +508,9 @@ GL_Upload8_EXT (const byte *data, int width, int height, qboolean mipmap,
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max);
}
if (Anisotropy)
if (gl_Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
gl_aniso);
free (scaled);
}

View File

@ -42,7 +42,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/GL/qf_rsurf.h"
// speed up sin calculations - Ed
float turbsin[] = {
static float turbsin[] = {
# include "gl_warp_sin.h"
};
@ -50,12 +50,12 @@ float turbsin[] = {
#define TURBFRAC (32.0 / (2 * M_PI)) // an 8th of TURBSCALE
/*
EmitWaterPolys
GL_EmitWaterPolys
Does a water warp on the pre-fragmented glpoly_t chain
*/
void
EmitWaterPolys (msurface_t *fa)
GL_EmitWaterPolys (msurface_t *fa)
{
float os, ot, s, t, timetemp;
float *v;

View File

@ -116,8 +116,6 @@ static struct {
{"vcolor", 0},
};
VISIBLE byte *draw_chars;
static byte white_block[8 * 8];
static dstring_t *char_queue;
static int char_texture;

View File

@ -61,15 +61,6 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
mat4_t glsl_projection;
mat4_t glsl_view;
VISIBLE vec3_t r_origin, vpn, vright, vup;
VISIBLE refdef_t r_refdef;
qboolean r_cache_thrash;
int r_init;
int r_framecount;
int d_lightstylevalue[256];
int r_visframecount;
entity_t r_worldentity;
entity_t *currententity;
void
gl_overbright_f (cvar_t *var)

View File

@ -34,6 +34,10 @@
static __attribute__ ((used)) const char rcsid[] = "$Id$";
float r_avertexnormals[NUMVERTEXNORMALS][3] = {
#include "anorms.h"
};
VISIBLE maliasskindesc_t *
R_AliasGetSkindesc (int skinnum, aliashdr_t *ahdr)
{

View File

@ -44,6 +44,7 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
#include "r_local.h"
#include "r_shared.h"
mvertex_t *r_pcurrentvertbase;
mleaf_t *r_viewleaf;
static mleaf_t *r_oldviewleaf;

View File

@ -57,6 +57,33 @@ entity_t *r_player_entity;
float r_time1;
int r_lineadj;
qboolean r_active;
int r_init;
entity_t *currententity;
int r_visframecount; // bumped when going to a new PVS
VISIBLE int r_framecount = 1; // so frame counts initialized to 0 don't match
vec3_t modelorg; // modelorg is the viewpoint relative to
// the currently rendering entity
vec3_t base_modelorg;
vec3_t r_entorigin; // the currently rendering entity in world
// coordinates
entity_t *currententity;
entity_t r_worldentity;
qboolean r_cache_thrash; // set if surface cache is thrashing
// view origin
vec3_t vup, base_vup;
vec3_t vpn, base_vpn;
vec3_t vright, base_vright;
vec3_t r_origin;
// screen size info
VISIBLE refdef_t r_refdef;
int d_lightstylevalue[256]; // 8.8 fraction of base light value
#define U __attribute__ ((used))
static U void (*const r_progs_init)(struct progs_s *) = R_Progs_Init;

View File

@ -98,6 +98,7 @@ static __attribute__ ((used)) const char rcsid[] =
// only the refresh window will be updated unless these variables are flagged
int scr_copytop;
int scr_copyeverything;
byte *draw_chars; // 8*8 graphic characters FIXME location
float oldfov;
int oldsbar;

View File

@ -42,7 +42,6 @@ static __attribute__ ((used)) const char rcsid[] =
#include "r_local.h"
float surfscale;
qboolean r_cache_thrash; // set if surface cache is thrashing
int sc_size;
surfcache_t *sc_rover, *sc_base;

View File

@ -58,7 +58,6 @@ typedef struct {
static rectdesc_t r_rectdesc;
byte *draw_chars; // 8*8 graphic characters
qpic_t *draw_disc;
qpic_t *draw_backtile;

View File

@ -83,11 +83,6 @@ static aedge_t aedges[12] = {
{0, 5}, {1, 4}, {2, 7}, {3, 6}
};
float r_avertexnormals[NUMVERTEXNORMALS][3] = {
#include "anorms.h"
};
qboolean
R_AliasCheckBBox (void)
{

View File

@ -40,13 +40,7 @@ static __attribute__ ((used)) const char rcsid[] =
// current entity info
qboolean insubmodel;
entity_t *currententity;
vec3_t modelorg; // modelorg is the viewpoint relative to
// the currently rendering entity
vec3_t base_modelorg;
vec3_t r_worldmodelorg;
vec3_t r_entorigin; // the currently rendering entity in world
// coordinates
float entity_rotation[3][3];
int r_currentbkey;

View File

@ -73,13 +73,11 @@ int r_pixbytes = 1;
float r_aliasuvscale = 1.0;
int r_outofsurfaces;
int r_outofedges;
int r_init = 0;
qboolean r_dowarp, r_dowarpold, r_viewchanged;
int numbtofpolys;
btofpoly_t *pbtofpolys;
mvertex_t *r_pcurrentvertbase;
int c_surf;
int r_maxsurfsseen, r_maxedgesseen, r_cnumsurfs;
@ -92,16 +90,7 @@ byte *r_stack_start;
qboolean r_fov_greater_than_90;
entity_t r_worldentity;
// view origin
vec3_t vup, base_vup;
vec3_t vpn, base_vpn;
vec3_t vright, base_vright;
vec3_t r_origin;
// screen size info
refdef_t r_refdef;
float xcenter, ycenter;
float xscale, yscale;
float xscaleinv, yscaleinv;
@ -118,8 +107,6 @@ float xOrigin, yOrigin;
plane_t screenedge[4];
// refresh flags
int r_framecount = 1; // so frame counts initialized to 0 don't match
int r_visframecount;
int d_spanpixcount;
int r_polycount;
int r_drawnpolycount;
@ -134,8 +121,6 @@ int reinit_surfcache = 1; // if 1, surface cache is currently empty
float r_aliastransition, r_resfudge;
int d_lightstylevalue[256]; // 8.8 fraction of base light value
float dp_time1, dp_time2, db_time1, db_time2, rw_time1, rw_time2;
float se_time1, se_time2, de_time1, de_time2, dv_time1, dv_time2;

View File

@ -42,7 +42,6 @@ static __attribute__ ((used)) const char rcsid[] =
#include "r_local.h"
float surfscale;
qboolean r_cache_thrash; // set if surface cache is thrashing
int sc_size;
surfcache_t *sc_rover, *sc_base;

View File

@ -58,7 +58,6 @@ typedef struct {
static rectdesc_t r_rectdesc;
byte *draw_chars; // 8*8 graphic characters
qpic_t *draw_disc;
qpic_t *draw_backtile;

View File

@ -84,10 +84,6 @@ static aedge_t aedges[12] = {
{0, 5}, {1, 4}, {2, 7}, {3, 6}
};
float r_avertexnormals[NUMVERTEXNORMALS][3] = {
#include "anorms.h"
};
qboolean
R_AliasCheckBBox (void)
{

View File

@ -40,13 +40,7 @@ static __attribute__ ((used)) const char rcsid[] =
// current entity info
qboolean insubmodel;
entity_t *currententity;
vec3_t modelorg; // modelorg is the viewpoint relative to
// the currently rendering entity
vec3_t base_modelorg;
vec3_t r_worldmodelorg;
vec3_t r_entorigin; // the currently rendering entity in world
// coordinates
float entity_rotation[3][3];
int r_currentbkey;

View File

@ -67,13 +67,11 @@ VISIBLE int r_pixbytes = 1;
float r_aliasuvscale = 1.0;
int r_outofsurfaces;
int r_outofedges;
int r_init = 0;
qboolean r_dowarp, r_dowarpold, r_viewchanged;
int numbtofpolys;
btofpoly_t *pbtofpolys;
mvertex_t *r_pcurrentvertbase;
int c_surf;
int r_maxsurfsseen, r_maxedgesseen, r_cnumsurfs;
@ -86,16 +84,7 @@ byte *r_stack_start;
qboolean r_fov_greater_than_90;
entity_t r_worldentity;
// view origin
VISIBLE vec3_t vup, base_vup;
VISIBLE vec3_t vpn, base_vpn;
VISIBLE vec3_t vright, base_vright;
VISIBLE vec3_t r_origin;
// screen size info
VISIBLE refdef_t r_refdef;
float xcenter, ycenter;
float xscale, yscale;
float xscaleinv, yscaleinv;
@ -112,8 +101,6 @@ float xOrigin, yOrigin;
plane_t screenedge[4];
// refresh flags
VISIBLE int r_framecount = 1; // so frame counts initialized to 0 don't match
int r_visframecount;
int d_spanpixcount;
int r_polycount;
int r_drawnpolycount;
@ -128,8 +115,6 @@ int reinit_surfcache = 1; // if 1, surface cache is currently empty
float r_aliastransition, r_resfudge;
int d_lightstylevalue[256]; // 8.8 fraction of base light value
float dp_time1, dp_time2, db_time1, db_time2, rw_time1, rw_time2;
float se_time1, se_time2, de_time1, de_time2, dv_time1, dv_time2;

View File

@ -105,9 +105,9 @@ VISIBLE qboolean is8bit = false;
VISIBLE qboolean gl_feature_mach64 = false;
// GL_EXT_texture_filter_anisotropic
VISIBLE qboolean Anisotropy;
VISIBLE qboolean gl_Anisotropy;
static float aniso_max;
VISIBLE float aniso;
VISIBLE float gl_aniso;
// GL_ATI_pn_triangles
static qboolean TruForm;
@ -241,13 +241,13 @@ gl_screenshot_byte_swap_f (cvar_t *var)
static void
gl_anisotropy_f (cvar_t * var)
{
if (Anisotropy) {
if (gl_Anisotropy) {
if (var)
aniso = (bound (1.0, var->value, aniso_max));
gl_aniso = (bound (1.0, var->value, aniso_max));
else
aniso = 1.0;
gl_aniso = 1.0;
} else {
aniso = 1.0;
gl_aniso = 1.0;
if (var)
Sys_MaskPrintf (SYS_VID,
"Anisotropy (GL_EXT_texture_filter_anisotropic) "
@ -366,10 +366,10 @@ static void
CheckAnisotropyExtensions (void)
{
if (QFGL_ExtensionPresent ("GL_EXT_texture_filter_anisotropic")) {
Anisotropy = true;
gl_Anisotropy = true;
qfglGetFloatv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &aniso_max);
} else {
Anisotropy = false;
gl_Anisotropy = false;
aniso_max = 1.0;
}
}
@ -626,9 +626,9 @@ GL_Init_Common (void)
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
if (Anisotropy)
if (gl_Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
gl_aniso);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}