Whitespace, comment cleanups, and a very tiny cleanup/micro-optimization for R_AddDynamicLights.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-08-22 11:00:25 +00:00
parent ea063a1e0f
commit e7fb6a1100
17 changed files with 213 additions and 344 deletions

View file

@ -114,7 +114,6 @@ Draw_PicFromWad (const char *name)
return p; return p;
} }
void void
Draw_ClearCache (void) Draw_ClearCache (void)
{ {
@ -125,7 +124,6 @@ Draw_ClearCache (void)
pic->dirty = true; pic->dirty = true;
} }
qpic_t * qpic_t *
Draw_CachePic (const char *path, qboolean alpha) Draw_CachePic (const char *path, qboolean alpha)
{ {
@ -162,17 +160,15 @@ Draw_CachePic (const char *path, qboolean alpha)
// Now feed it to the GL stuff and get a texture number.. // Now feed it to the GL stuff and get a texture number..
gl = (glpic_t *) pic->pic.data; gl = (glpic_t *) pic->pic.data;
gl->texnum = GL_LoadTexture ("", dat->width, dat->height, dat->data, false, alpha, 1); gl->texnum = GL_LoadTexture ("", dat->width, dat->height, dat->data,
false, alpha, 1);
// Now lets mark this cache entry as used.. // Now lets mark this cache entry as used..
pic->dirty = false; pic->dirty = false;
numcachepics++; numcachepics++;
// FIXME: // FIXME: A really ugly kluge, keep a specific image in memory
// A really ugly kluge, keep a specific image in memory // for the menu system. Some days I really dislike legacy support..
// for the menu system.
// Some days I really dislike legacy support..
if (!strcmp (path, "gfx/menuplyr.lmp")) if (!strcmp (path, "gfx/menuplyr.lmp"))
memcpy (menuplyr_pixels, dat->data, dat->width * dat->height); memcpy (menuplyr_pixels, dat->data, dat->width * dat->height);
@ -180,7 +176,6 @@ Draw_CachePic (const char *path, qboolean alpha)
return &pic->pic; return &pic->pic;
} }
void void
Draw_TextBox (int x, int y, int width, int lines) Draw_TextBox (int x, int y, int width, int lines)
{ {
@ -233,12 +228,10 @@ Draw_TextBox (int x, int y, int width, int lines)
Draw_Pic (cx, cy + 8, p); Draw_Pic (cx, cy + 8, p);
} }
extern void glrmain_init (void); extern void glrmain_init (void);
extern void glrsurf_init (void); extern void glrsurf_init (void);
extern void GL_TextureMode_f (void); extern void GL_TextureMode_f (void);
void void
Draw_Init (void) Draw_Init (void)
{ {
@ -249,19 +242,20 @@ Draw_Init (void)
qfglGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize); qfglGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);
Cvar_Set (gl_max_size, va("%d", texSize)); Cvar_Set (gl_max_size, va("%d", texSize));
Cmd_AddCommand ("gl_texturemode", &GL_TextureMode_f, "Texture mipmap quality."); Cmd_AddCommand ("gl_texturemode", &GL_TextureMode_f,
"Texture mipmap quality.");
// load the console background and the charset // load the console background and the charset by hand, because we need to
// by hand, because we need to write the version // write the version string into the background before turning it into a
// string into the background before turning // texture
// it into a texture
draw_chars = W_GetLumpName ("conchars"); draw_chars = W_GetLumpName ("conchars");
for (i = 0; i < 256 * 64; i++) for (i = 0; i < 256 * 64; i++)
if (draw_chars[i] == 0) if (draw_chars[i] == 0)
draw_chars[i] = 255; // proper transparent color draw_chars[i] = 255; // proper transparent color
// now turn them into textures // now turn them into textures
char_texture = GL_LoadTexture ("charset", 128, 128, draw_chars, false, true, 1); // 1999-12-27 Conwidth/height charset fix by TcT char_texture = GL_LoadTexture ("charset", 128, 128, draw_chars, false,
true, 1);
cs_texture = GL_LoadTexture ("crosshair", 8, 8, cs_data, false, true, 1); cs_texture = GL_LoadTexture ("crosshair", 8, 8, cs_data, false, true, 1);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@ -278,7 +272,6 @@ Draw_Init (void)
glrsurf_init (); glrsurf_init ();
} }
/* /*
Draw_Character8 Draw_Character8
@ -321,7 +314,6 @@ Draw_Character8 (int x, int y, int num)
qfglEnd (); qfglEnd ();
} }
void void
Draw_String8 (int x, int y, const char *str) Draw_String8 (int x, int y, const char *str)
{ {
@ -332,7 +324,6 @@ Draw_String8 (int x, int y, const char *str)
} }
} }
void void
Draw_AltString8 (int x, int y, const char *str) Draw_AltString8 (int x, int y, const char *str)
{ {
@ -343,7 +334,6 @@ Draw_AltString8 (int x, int y, const char *str)
} }
} }
void void
Draw_Crosshair (int swap) Draw_Crosshair (int swap)
{ {
@ -384,7 +374,6 @@ Draw_Crosshair (int swap)
} }
} }
void void
Draw_Pic (int x, int y, qpic_t *pic) Draw_Pic (int x, int y, qpic_t *pic)
{ {
@ -405,7 +394,6 @@ Draw_Pic (int x, int y, qpic_t *pic)
qfglEnd (); qfglEnd ();
} }
void void
Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width, Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
int height) int height)
@ -436,7 +424,6 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
qfglColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
/* /*
Draw_TransPicTranslate Draw_TransPicTranslate
@ -486,7 +473,6 @@ Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte * translation)
qfglColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
/* /*
Draw_ConsoleBackground Draw_ConsoleBackground
@ -568,7 +554,6 @@ Draw_ConsoleBackground (int lines)
qfglColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
/* /*
Draw_TileClear Draw_TileClear
@ -593,7 +578,6 @@ Draw_TileClear (int x, int y, int w, int h)
qfglColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
/* /*
Draw_Fill Draw_Fill
@ -618,10 +602,6 @@ Draw_Fill (int x, int y, int w, int h, int c)
qfglEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
} }
//=============================================================================
void void
Draw_FadeScreen (void) Draw_FadeScreen (void)
{ {
@ -641,10 +621,6 @@ Draw_FadeScreen (void)
Sbar_Changed (); Sbar_Changed ();
} }
//=============================================================================
/* /*
Draw_BeginDisc Draw_BeginDisc
@ -656,7 +632,6 @@ Draw_BeginDisc (void)
{ {
} }
/* /*
Draw_EndDisc Draw_EndDisc
@ -668,7 +643,6 @@ Draw_EndDisc (void)
{ {
} }
/* /*
GL_Set2D GL_Set2D

View file

@ -50,6 +50,7 @@
#include "r_dynamic.h" #include "r_dynamic.h"
#include "r_shared.h" #include "r_shared.h"
/* /*
R_DrawFire R_DrawFire
@ -100,7 +101,6 @@ R_DrawFire (fire_t *f)
qfglColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
/* /*
R_UpdateFires R_UpdateFires

View file

@ -95,7 +95,6 @@ particle_new (ptype_t type, int texnum, vec3_t org, float scale, vec3_t vel,
return part; return part;
} }
inline particle_t * inline particle_t *
particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz, particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz,
float scale, int vel_fuzz, float die, byte color, float scale, int vel_fuzz, float die, byte color,
@ -114,7 +113,6 @@ particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz,
vec3_origin, vec3_origin); vec3_origin, vec3_origin);
} }
/* /*
R_MaxParticlesCheck R_MaxParticlesCheck
@ -152,7 +150,6 @@ R_MaxParticlesCheck (cvar_t *var)
R_ClearParticles(); R_ClearParticles();
} }
void void
R_Particles_Init_Cvars (void) R_Particles_Init_Cvars (void)
{ {
@ -166,14 +163,12 @@ R_Particles_Init_Cvars (void)
"is 0, although it's best to use r_particles 0 instead."); "is 0, although it's best to use r_particles 0 instead.");
} }
void void
R_ClearParticles (void) R_ClearParticles (void)
{ {
numparticles = 0; numparticles = 0;
} }
void void
R_ReadPointFile_f (void) R_ReadPointFile_f (void)
{ {
@ -222,7 +217,6 @@ R_ReadPointFile_f (void)
Con_Printf ("%i points read\n", c); Con_Printf ("%i points read\n", c);
} }
void void
R_ParticleExplosion (vec3_t org) R_ParticleExplosion (vec3_t org)
{ {
@ -234,7 +228,6 @@ R_ParticleExplosion (vec3_t org)
128 + (rand () & 63)); 128 + (rand () & 63));
} }
void void
R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength) R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
{ {
@ -252,7 +245,6 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
} }
} }
void void
R_BlobExplosion (vec3_t org) R_BlobExplosion (vec3_t org)
{ {
@ -273,7 +265,6 @@ R_BlobExplosion (vec3_t org)
} }
} }
static void static void
R_RunSparkEffect (vec3_t org, int count, int ofuzz) R_RunSparkEffect (vec3_t org, int count, int ofuzz)
{ {
@ -289,7 +280,6 @@ R_RunSparkEffect (vec3_t org, int count, int ofuzz)
lhrandom (0, 255)); lhrandom (0, 255));
} }
static void static void
R_RunGunshotEffect (vec3_t org, int count) R_RunGunshotEffect (vec3_t org, int count)
{ {
@ -307,7 +297,6 @@ R_RunGunshotEffect (vec3_t org, int count)
return; return;
} }
static void static void
R_BloodPuff (vec3_t org, int count) R_BloodPuff (vec3_t org, int count)
{ {
@ -319,7 +308,6 @@ R_BloodPuff (vec3_t org, int count)
vec3_origin, vec3_origin); vec3_origin, vec3_origin);
} }
void void
R_RunPuffEffect (vec3_t org, particle_effect_t type, byte count) R_RunPuffEffect (vec3_t org, particle_effect_t type, byte count)
{ {
@ -341,7 +329,6 @@ R_RunPuffEffect (vec3_t org, particle_effect_t type, byte count)
} }
} }
void void
R_RunParticleEffect (vec3_t org, int color, int count) R_RunParticleEffect (vec3_t org, int color, int count)
{ {
@ -369,7 +356,6 @@ R_RunParticleEffect (vec3_t org, int color, int count)
} }
} }
void void
R_RunSpikeEffect (vec3_t org, particle_effect_t type) R_RunSpikeEffect (vec3_t org, particle_effect_t type)
{ {
@ -391,7 +377,6 @@ R_RunSpikeEffect (vec3_t org, particle_effect_t type)
} }
} }
void void
R_LavaSplash (vec3_t org) R_LavaSplash (vec3_t org)
{ {
@ -423,7 +408,6 @@ R_LavaSplash (vec3_t org)
} }
} }
void void
R_TeleportSplash (vec3_t org) R_TeleportSplash (vec3_t org)
{ {
@ -455,7 +439,6 @@ R_TeleportSplash (vec3_t org)
} }
} }
void void
R_RocketTrail (int type, entity_t *ent) R_RocketTrail (int type, entity_t *ent)
{ {
@ -570,7 +553,6 @@ R_RocketTrail (int type, entity_t *ent)
} }
} }
void void
R_DrawParticles (void) R_DrawParticles (void)
{ {

View file

@ -32,10 +32,10 @@
#include <stdlib.h> #include <stdlib.h>
#include "QF/qtypes.h"
#include "QF/GL/defines.h" #include "QF/GL/defines.h"
#include "QF/GL/qf_vid.h" #include "QF/GL/qf_vid.h"
#include "QF/GL/funcs.h" #include "QF/GL/funcs.h"
#include "QF/qtypes.h"
extern void noise_diamondsquare(unsigned char *noise, int size); extern void noise_diamondsquare(unsigned char *noise, int size);
extern void noise_plasma(unsigned char *noise, int size); extern void noise_plasma(unsigned char *noise, int size);
@ -60,7 +60,6 @@ GDT_Init (void)
GDT_InitSmokeRingParticleTexture (); GDT_InitSmokeRingParticleTexture ();
} }
static void static void
GDT_InitDotParticleTexture (void) GDT_InitDotParticleTexture (void)
{ {
@ -90,7 +89,6 @@ GDT_InitDotParticleTexture (void)
GL_UNSIGNED_BYTE, data); GL_UNSIGNED_BYTE, data);
} }
static void static void
GDT_InitSparkParticleTexture (void) GDT_InitSparkParticleTexture (void)
{ {
@ -122,7 +120,6 @@ GDT_InitSparkParticleTexture (void)
GL_UNSIGNED_BYTE, data); GL_UNSIGNED_BYTE, data);
} }
static void static void
GDT_InitSmokeParticleTexture (void) GDT_InitSmokeParticleTexture (void)
{ {
@ -161,7 +158,6 @@ GDT_InitSmokeParticleTexture (void)
} }
} }
static void static void
GDT_InitSmokeRingParticleTexture (void) GDT_InitSmokeRingParticleTexture (void)
{ {

View file

@ -41,12 +41,13 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <QF/GL/types.h>
#include <QF/GL/funcs.h>
#include <QF/GL/extensions.h>
#include <QF/cvar.h> #include <QF/cvar.h>
#include <QF/console.h> #include <QF/console.h>
#include <QF/sys.h> #include <QF/sys.h>
#include <QF/GL/types.h>
#include <QF/GL/funcs.h>
#include <QF/GL/extensions.h>
#include "r_cvar.h" #include "r_cvar.h"
// First we need to get all the function pointers declared. // First we need to get all the function pointers declared.
@ -63,7 +64,8 @@ GLF_Init (void)
#if defined(HAVE_DLOPEN) #if defined(HAVE_DLOPEN)
if (!(handle = dlopen (gl_libgl->string, RTLD_NOW))) { if (!(handle = dlopen (gl_libgl->string, RTLD_NOW))) {
Sys_Error ("Couldn't load OpenGL library %s: %s\n", gl_libgl->string, dlerror ()); Sys_Error ("Couldn't load OpenGL library %s: %s\n", gl_libgl->string,
dlerror ());
return false; return false;
} }
#elif defined(_WIN32) #elif defined(_WIN32)
@ -80,11 +82,13 @@ GLF_Init (void)
#include "QF/GL/qf_funcs_list.h" #include "QF/GL/qf_funcs_list.h"
#undef QFGL_NEED #undef QFGL_NEED
QFGL_ProcAddress (NULL, NULL, false); // tell ProcAddress to clear its cache // tell ProcAddress to clear its cache
QFGL_ProcAddress (NULL, NULL, false);
return true; return true;
} }
void * void *
QFGL_ProcAddress (void *handle, const char *name, qboolean crit) QFGL_ProcAddress (void *handle, const char *name, qboolean crit)
{ {
@ -109,7 +113,8 @@ QFGL_ProcAddress (void *handle, const char *name, qboolean crit)
#if defined(HAVE_DLOPEN) #if defined(HAVE_DLOPEN)
glGetProcAddress = dlsym (handle, "glXGetProcAddressARB"); glGetProcAddress = dlsym (handle, "glXGetProcAddressARB");
#elif defined(_WIN32) #elif defined(_WIN32)
(FARPROC)glGetProcAddress = GetProcAddress (handle, "wglGetProcAddress"); (FARPROC)glGetProcAddress = GetProcAddress (handle,
"wglGetProcAddress");
#endif #endif
} }
@ -135,7 +140,8 @@ QFGL_ProcAddress (void *handle, const char *name, qboolean crit)
Con_DPrintf ("not found\n"); Con_DPrintf ("not found\n");
if (crit) if (crit)
Sys_Error ("Couldn't load critical OpenGL function %s, exiting...\n", name); Sys_Error ("Couldn't load critical OpenGL function %s, exiting...\n",
name);
return NULL; return NULL;
} }

View file

@ -39,12 +39,12 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "QF/GL/qf_textures.h"
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/draw.h" #include "QF/draw.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "QF/GL/qf_textures.h"
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "r_cvar.h" #include "r_cvar.h"
@ -62,6 +62,7 @@ static int graph_width[NUM_GRAPH_TEXTURES];
static byte *graph_texels[NUM_GRAPH_TEXTURES]; static byte *graph_texels[NUM_GRAPH_TEXTURES];
int graph_texture[NUM_GRAPH_TEXTURES]; int graph_texture[NUM_GRAPH_TEXTURES];
int int
R_InitGraphTextures (int base) R_InitGraphTextures (int base)
{ {

View file

@ -71,12 +71,10 @@ R_AnimateLight (void)
} }
} }
/* /*
DYNAMIC LIGHTS BLEND RENDERING DYNAMIC LIGHTS BLEND RENDERING
*/ */
void void
AddLightBlend (float r, float g, float b, float a2) AddLightBlend (float r, float g, float b, float a2)
{ {
@ -89,10 +87,8 @@ AddLightBlend (float r, float g, float b, float a2)
v_blend[0] = v_blend[0] * (1 - a2) + r * a2; v_blend[0] = v_blend[0] * (1 - a2) + r * a2;
v_blend[1] = v_blend[1] * (1 - a2) + g * a2; v_blend[1] = v_blend[1] * (1 - a2) + g * a2;
v_blend[2] = v_blend[2] * (1 - a2) + b * a2; v_blend[2] = v_blend[2] * (1 - a2) + b * a2;
//Con_Printf("AddLightBlend(): %4.2f %4.2f %4.2f %4.6f\n", v_blend[0], v_blend[1], v_blend[2], v_blend[3]);
} }
float bubble_sintable[33], bubble_costable[33]; float bubble_sintable[33], bubble_costable[33];
void void
@ -112,7 +108,6 @@ R_InitBubble ()
} }
} }
void void
R_RenderDlight (dlight_t *light) R_RenderDlight (dlight_t *light)
{ {
@ -155,7 +150,6 @@ R_RenderDlight (dlight_t *light)
qfglEnd (); qfglEnd ();
} }
void void
R_RenderDlights (void) R_RenderDlights (void)
{ {
@ -185,12 +179,10 @@ R_RenderDlights (void)
qfglDepthMask (GL_TRUE); qfglDepthMask (GL_TRUE);
} }
/* /*
DYNAMIC LIGHTS DYNAMIC LIGHTS
*/ */
// LordHavoc: heavily modified, to eliminate unnecessary texture uploads, // LordHavoc: heavily modified, to eliminate unnecessary texture uploads,
// and support bmodel lighting better // and support bmodel lighting better
void void
@ -395,7 +387,6 @@ R_MarkLights (vec3_t lightorigin, dlight_t *light, int bit, model_t *model)
} }
} }
void void
R_PushDlights (vec3_t entorigin) R_PushDlights (vec3_t entorigin)
{ {
@ -416,7 +407,6 @@ R_PushDlights (vec3_t entorigin)
} }
} }
/* /*
LIGHT SAMPLING LIGHT SAMPLING
*/ */
@ -520,7 +510,6 @@ RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
return RecursiveLightPoint (node->children[!side], mid, end); return RecursiveLightPoint (node->children[!side], mid, end);
} }
int int
R_LightPoint (vec3_t p) R_LightPoint (vec3_t p)
{ {

View file

@ -115,13 +115,13 @@ void R_MarkLeaves (void);
//qboolean R_CullBlocked (vec3_t mins, vec3_t maxs, vec3_t org); //qboolean R_CullBlocked (vec3_t mins, vec3_t maxs, vec3_t org);
// LordHavoc: place for gl_rmain setup code // LordHavoc: place for gl_rmain setup code
void void
glrmain_init (void) glrmain_init (void)
{ {
} }
void void
R_RotateForEntity (entity_t *e) R_RotateForEntity (entity_t *e)
{ {
@ -133,7 +133,6 @@ R_RotateForEntity (entity_t *e)
qfglRotatef (e->angles[2], 1, 0, 0); qfglRotatef (e->angles[2], 1, 0, 0);
} }
static mspriteframe_t * static mspriteframe_t *
R_GetSpriteFrame (entity_t *currententity) R_GetSpriteFrame (entity_t *currententity)
{ {
@ -177,7 +176,6 @@ R_GetSpriteFrame (entity_t *currententity)
return pspriteframe; return pspriteframe;
} }
static void static void
R_DrawSpriteModel (entity_t *e) R_DrawSpriteModel (entity_t *e)
{ {
@ -231,7 +229,6 @@ R_DrawSpriteModel (entity_t *e)
qfglDisable (GL_ALPHA_TEST); qfglDisable (GL_ALPHA_TEST);
} }
/* /*
ALIAS MODELS ALIAS MODELS
*/ */
@ -255,7 +252,6 @@ float *shadedots = r_avertexnormal_dots[0];
int lastposenum, lastposenum0; int lastposenum, lastposenum0;
static void static void
GL_DrawAliasFrame (vert_order_t *vo, qboolean fb) GL_DrawAliasFrame (vert_order_t *vo, qboolean fb)
{ {
@ -310,7 +306,6 @@ GL_DrawAliasFrame (vert_order_t *vo, qboolean fb)
qfglColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
extern vec3_t lightspot; extern vec3_t lightspot;
/* /*
@ -374,7 +369,6 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum)
} }
} }
/* /*
GL_DrawAliasBlendedShadow GL_DrawAliasBlendedShadow
@ -416,16 +410,22 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t
do { do {
order += 2; order += 2;
point1[0] = verts1->v[0] * paliashdr->mdl.scale[0] + paliashdr->mdl.scale_origin[0]; point1[0] = verts1->v[0] * paliashdr->mdl.scale[0] +
point1[1] = verts1->v[1] * paliashdr->mdl.scale[1] + paliashdr->mdl.scale_origin[1]; paliashdr->mdl.scale_origin[0];
point1[2] = verts1->v[2] * paliashdr->mdl.scale[2] + paliashdr->mdl.scale_origin[2]; point1[1] = verts1->v[1] * paliashdr->mdl.scale[1] +
paliashdr->mdl.scale_origin[1];
point1[2] = verts1->v[2] * paliashdr->mdl.scale[2] +
paliashdr->mdl.scale_origin[2];
point1[0] -= shadevector[0] * (point1[2] + lheight); point1[0] -= shadevector[0] * (point1[2] + lheight);
point1[1] -= shadevector[1] * (point1[2] + lheight); point1[1] -= shadevector[1] * (point1[2] + lheight);
point2[0] = verts2->v[0] * paliashdr->mdl.scale[0] + paliashdr->mdl.scale_origin[0]; point2[0] = verts2->v[0] * paliashdr->mdl.scale[0] +
point2[1] = verts2->v[1] * paliashdr->mdl.scale[1] + paliashdr->mdl.scale_origin[1]; paliashdr->mdl.scale_origin[0];
point2[2] = verts2->v[2] * paliashdr->mdl.scale[2] + paliashdr->mdl.scale_origin[2]; point2[1] = verts2->v[1] * paliashdr->mdl.scale[1] +
paliashdr->mdl.scale_origin[1];
point2[2] = verts2->v[2] * paliashdr->mdl.scale[2] +
paliashdr->mdl.scale_origin[2];
point2[0] -= shadevector[0] * (point2[2] + lheight); point2[0] -= shadevector[0] * (point2[2] + lheight);
point2[1] -= shadevector[1] * (point2[2] + lheight); point2[1] -= shadevector[1] * (point2[2] + lheight);
@ -441,7 +441,6 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t
} }
} }
vert_order_t * vert_order_t *
GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e) GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e)
{ {
@ -542,7 +541,6 @@ GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e)
return vo; return vo;
} }
static void static void
R_DrawAliasModel (entity_t *e, qboolean cull) R_DrawAliasModel (entity_t *e, qboolean cull)
{ {
@ -615,7 +613,9 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
shadelight = 255; // make certain models full brightness always shadelight = 255; // make certain models full brightness always
} }
shadedots = r_avertexnormal_dots[((int) (e->angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)]; shadedots = r_avertexnormal_dots[(int) (e->angles[1] *
(SHADEDOT_QUANT / 360.0)) &
(SHADEDOT_QUANT - 1)];
shadelight /= 200.0; shadelight /= 200.0;
an = e->angles[1] / 180 * M_PI; an = e->angles[1] / 180 * M_PI;
@ -675,7 +675,8 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
if (gl_affinemodels->int_val) if (gl_affinemodels->int_val)
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
vo = GL_GetAliasFrameVerts (currententity->frame, paliashdr, currententity); vo = GL_GetAliasFrameVerts (currententity->frame, paliashdr,
currententity);
GL_DrawAliasFrame (vo, false); GL_DrawAliasFrame (vo, false);
@ -704,7 +705,8 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
qfglColor4f (0, 0, 0, 0.5); qfglColor4f (0, 0, 0, 0.5);
if (gl_lerp_anim->int_val) { if (gl_lerp_anim->int_val) {
GL_DrawAliasBlendedShadow (paliashdr, lastposenum0, lastposenum, currententity); GL_DrawAliasBlendedShadow (paliashdr, lastposenum0, lastposenum,
currententity);
} else { } else {
GL_DrawAliasShadow (paliashdr, lastposenum); GL_DrawAliasShadow (paliashdr, lastposenum);
} }
@ -715,7 +717,6 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
} }
} }
/* /*
R_ShowNearestLoc R_ShowNearestLoc
@ -747,7 +748,6 @@ R_ShowNearestLoc (void)
} }
} }
/* /*
R_DrawEntitiesOnList R_DrawEntitiesOnList
@ -795,7 +795,6 @@ R_DrawEntitiesOnList (void)
} }
} }
static void static void
R_DrawViewModel (void) R_DrawViewModel (void)
{ {
@ -816,7 +815,6 @@ R_DrawViewModel (void)
qfglDepthRange (gldepthmin, gldepthmax); qfglDepthRange (gldepthmin, gldepthmax);
} }
static int static int
SignbitsForPlane (mplane_t *out) SignbitsForPlane (mplane_t *out)
{ {
@ -832,7 +830,6 @@ SignbitsForPlane (mplane_t *out)
return bits; return bits;
} }
static void static void
R_SetFrustum (void) R_SetFrustum (void)
{ {
@ -869,7 +866,6 @@ R_SetFrustum (void)
} }
} }
void void
R_SetupFrame (void) R_SetupFrame (void)
{ {
@ -887,7 +883,6 @@ R_SetupFrame (void)
r_viewleaf = Mod_PointInLeaf (r_origin, r_worldentity.model); r_viewleaf = Mod_PointInLeaf (r_origin, r_worldentity.model);
V_SetContentsColor (r_viewleaf->contents); V_SetContentsColor (r_viewleaf->contents);
// V_CalcBlend ();
r_cache_thrash = false; r_cache_thrash = false;
@ -896,7 +891,6 @@ R_SetupFrame (void)
} }
static void static void
MYgluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar) MYgluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
{ {
@ -911,7 +905,6 @@ MYgluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
qfglFrustum (xmin, xmax, ymin, ymax, zNear, zFar); qfglFrustum (xmin, xmax, ymin, ymax, zNear, zFar);
} }
static void static void
R_SetupGL (void) R_SetupGL (void)
{ {
@ -983,7 +976,6 @@ R_SetupGL (void)
qfglShadeModel (GL_FLAT); qfglShadeModel (GL_FLAT);
} }
static void static void
R_Clear (void) R_Clear (void)
{ {
@ -998,7 +990,6 @@ R_Clear (void)
qfglDepthRange (gldepthmin, gldepthmax); qfglDepthRange (gldepthmin, gldepthmax);
} }
void void
R_RenderScene (void) R_RenderScene (void)
{ {
@ -1030,10 +1021,8 @@ R_RenderScene (void)
R_ZGraph (); R_ZGraph ();
} }
void R_RenderBrushPoly (msurface_t *fa); void R_RenderBrushPoly (msurface_t *fa);
void void
R_Mirror (void) R_Mirror (void)
{ {
@ -1048,7 +1037,8 @@ R_Mirror (void)
d = DotProduct (r_refdef.vieworg, mirror_plane->normal) - d = DotProduct (r_refdef.vieworg, mirror_plane->normal) -
mirror_plane->dist; mirror_plane->dist;
VectorMA (r_refdef.vieworg, -2 * d, mirror_plane->normal, r_refdef.vieworg); VectorMA (r_refdef.vieworg, -2 * d, mirror_plane->normal,
r_refdef.vieworg);
d = DotProduct (vpn, mirror_plane->normal); d = DotProduct (vpn, mirror_plane->normal);
VectorMA (vpn, -2 * d, mirror_plane->normal, vpn); VectorMA (vpn, -2 * d, mirror_plane->normal, vpn);
@ -1093,7 +1083,6 @@ R_Mirror (void)
qfglColor4f (1, 1, 1, 1); qfglColor4f (1, 1, 1, 1);
} }
/* /*
R_RenderView R_RenderView
@ -1142,7 +1131,8 @@ qboolean R_CullBlocked (vec3_t mins, vec3_t maxs, vec3_t org)
// Check the origin first // Check the origin first
if ( Mod_PointInLeaf(org, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(org, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, org, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, org, &trace))
return false; return false;
} }
@ -1155,39 +1145,46 @@ qboolean R_CullBlocked (vec3_t mins, vec3_t maxs, vec3_t org)
point[0] = org[0]; point[1] = org[1]+rad; point[2] = org[2]+4; point[0] = org[0]; point[1] = org[1]+rad; point[2] = org[2]+4;
if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, point, &trace))
return false; return false;
} }
point[0] = org[0]+rad; point[1] = org[1]; point[2] = org[2]+4; point[0] = org[0]+rad; point[1] = org[1]; point[2] = org[2]+4;
if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, point, &trace))
return false; return false;
} }
point[0] = org[0]; point[1] = org[1]-rad; point[2] = org[2]+4; point[0] = org[0]; point[1] = org[1]-rad; point[2] = org[2]+4;
if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, point, &trace))
return false; return false;
} }
point[0] = org[0]-rad; point[1] = org[1]; point[2] = org[2]+4; point[0] = org[0]-rad; point[1] = org[1]; point[2] = org[2]+4;
if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, point, &trace))
return false; return false;
} }
// Check the poles of the sphere (can catch ents on ledges that would otherwise be missed) // Check the poles of the sphere (can catch ents on ledges that would
// otherwise be missed)
point[0] = org[0]; point[1] = org[1]; point[2] = org[2]+rad; point[0] = org[0]; point[1] = org[1]; point[2] = org[2]+rad;
if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, point, &trace))
return false; return false;
} }
point[0] = org[0]; point[1] = org[1]; point[2] = org[2]-rad; point[0] = org[0]; point[1] = org[1]; point[2] = org[2]-rad;
if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, point, &trace))
return false; return false;
} }
@ -1195,48 +1192,56 @@ qboolean R_CullBlocked (vec3_t mins, vec3_t maxs, vec3_t org)
// Check the corners... // Check the corners...
if ( Mod_PointInLeaf(maxs, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(maxs, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, maxs, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, maxs, &trace))
return false; return false;
} }
point[0] = mins[0]; point[1] = maxs[1]; point[2] = maxs[2]; point[0] = mins[0]; point[1] = maxs[1]; point[2] = maxs[2];
if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, point, &trace))
return false; return false;
} }
point[0] = mins[0]; point[1] = mins[1]; point[2] = maxs[2]; point[0] = mins[0]; point[1] = mins[1]; point[2] = maxs[2];
if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, point, &trace))
return false; return false;
} }
point[0] = maxs[0]; point[1] = mins[1]; point[2] = maxs[2]; point[0] = maxs[0]; point[1] = mins[1]; point[2] = maxs[2];
if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, point, &trace))
return false; return false;
} }
if ( Mod_PointInLeaf(mins, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(mins, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, mins, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, mins, &trace))
return false; return false;
} }
point[0] = mins[0]; point[1] = maxs[1]; point[2] = mins[2]+4; point[0] = mins[0]; point[1] = maxs[1]; point[2] = mins[2]+4;
if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, point, &trace))
return false; return false;
} }
point[0] = maxs[0]; point[1] = mins[1]; point[2] = mins[2]+4; point[0] = maxs[0]; point[1] = mins[1]; point[2] = mins[2]+4;
if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, point, &trace))
return false; return false;
} }
point[0] = maxs[0]; point[1] = maxs[1]; point[2] = mins[2]+4; point[0] = maxs[0]; point[1] = maxs[1]; point[2] = mins[2]+4;
if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID) if ( Mod_PointInLeaf(point, cl.worldmodel)->contents != CONTENTS_SOLID)
{ {
if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, r_refdef.vieworg, point, &trace)) if (SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1,
r_refdef.vieworg, point, &trace))
return false; return false;
} }

View file

@ -45,12 +45,7 @@
#include "QF/skin.h" #include "QF/skin.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "QF/vid.h" #include "QF/vid.h"
#include "varrays.h"
#include "QF/vfs.h" #include "QF/vfs.h"
#include "r_dynamic.h"
#include "r_local.h"
#include "QF/GL/funcs.h" #include "QF/GL/funcs.h"
#include "QF/GL/qf_vid.h" #include "QF/GL/qf_vid.h"
#include "QF/GL/defines.h" #include "QF/GL/defines.h"
@ -58,6 +53,10 @@
#include "QF/GL/qf_rsurf.h" #include "QF/GL/qf_rsurf.h"
#include "QF/GL/qf_screen.h" #include "QF/GL/qf_screen.h"
#include "r_dynamic.h"
#include "r_local.h"
#include "varrays.h"
varray_t2f_c4f_v3f_t varray[MAX_VARRAY_VERTS]; varray_t2f_c4f_v3f_t varray[MAX_VARRAY_VERTS];
qboolean VID_Is8bit (void); qboolean VID_Is8bit (void);
@ -135,7 +134,6 @@ R_Envmap_f (void)
GL_EndRendering (); GL_EndRendering ();
} }
void void
R_LoadSky_f (void) R_LoadSky_f (void)
{ {
@ -147,7 +145,6 @@ R_LoadSky_f (void)
R_LoadSkys (Cmd_Argv (1)); R_LoadSkys (Cmd_Argv (1));
} }
void void
R_Init (void) R_Init (void)
{ {
@ -176,7 +173,6 @@ R_Init (void)
qfglVertexPointer (3, GL_FLOAT, sizeof(varray[0]), varray[0].vertex); qfglVertexPointer (3, GL_FLOAT, sizeof(varray[0]), varray[0].vertex);
} }
void void
R_NewMap (model_t *worldmodel, struct model_s **models, int num_models) R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
{ {
@ -217,7 +213,6 @@ R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
R_LoadSkys ("none"); R_LoadSkys ("none");
} }
/* /*
R_TimeRefresh_f R_TimeRefresh_f
@ -249,7 +244,6 @@ R_TimeRefresh_f (void)
GL_BeginRendering (&glx, &gly, &glwidth, &glheight); GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
} }
void void
D_FlushCaches (void) D_FlushCaches (void)
{ {

View file

@ -105,7 +105,6 @@ glrsurf_init (void)
dlightdivtable[s] = 1048576 / (s << 7); dlightdivtable[s] = 1048576 / (s << 7);
} }
static void static void
R_RecursiveLightUpdate (mnode_t *node) R_RecursiveLightUpdate (mnode_t *node)
{ {
@ -121,7 +120,6 @@ R_RecursiveLightUpdate (mnode_t *node)
c--, surf++) surf->cached_dlight = true; c--, surf++) surf->cached_dlight = true;
} }
// LordHavoc: function to force all lightmaps to be updated // LordHavoc: function to force all lightmaps to be updated
void void
R_ForceLightUpdate (void) R_ForceLightUpdate (void)
@ -131,7 +129,6 @@ R_ForceLightUpdate (void)
R_RecursiveLightUpdate (r_worldentity.model->nodes); R_RecursiveLightUpdate (r_worldentity.model->nodes);
} }
/* /*
R_AddDynamicLights R_AddDynamicLights
@ -140,11 +137,11 @@ R_ForceLightUpdate (void)
void void
R_AddDynamicLights (msurface_t *surf) R_AddDynamicLights (msurface_t *surf)
{ {
int sdtable[18], lnum, td, maxdist, maxdist2, maxdist3, i, s, t, int sdtable[18], lnum, td, maxdist, maxdist2, maxdist3, i, j, s, t,
smax, tmax, red, green, blue, j; smax, tmax, red, green, blue;
unsigned int *bl; unsigned int *bl;
float dist, f; float dist, f;
vec3_t impact, local; vec3_t impact, local;
// use 64bit integer... shame it's not very standardized... // use 64bit integer... shame it's not very standardized...
#if _MSC_VER || __BORLANDC__ #if _MSC_VER || __BORLANDC__
@ -178,12 +175,13 @@ R_AddDynamicLights (msurface_t *surf)
surf->texinfo->vecs[1][3] - surf->texturemins[1]; surf->texinfo->vecs[1][3] - surf->texturemins[1];
// for comparisons to minimum acceptable light // for comparisons to minimum acceptable light
maxdist = (int) ((r_dlights[lnum].radius * r_dlights[lnum].radius) * 0.75); maxdist = (int) ((r_dlights[lnum].radius * r_dlights[lnum].radius) *
0.75);
// clamp radius to avoid exceeding 8192 entry division table // clamp radius to avoid exceeding 8192 entry division table
if (maxdist > 1048576) if (maxdist > 1048576)
maxdist = 1048576; maxdist = 1048576;
maxdist3 = maxdist - (int) (dist * dist); maxdist3 = maxdist - t;
// convert to 8.8 blocklights format // convert to 8.8 blocklights format
red = f = r_dlights[lnum].color[0] * maxdist; red = f = r_dlights[lnum].color[0] * maxdist;
@ -192,7 +190,7 @@ R_AddDynamicLights (msurface_t *surf)
bl = blocklights; bl = blocklights;
for (t = 0; t < tmax; t++, i -= 16) { for (t = 0; t < tmax; t++, i -= 16) {
td = i * i; td = i * i;
if (td < maxdist3) { // make sure some part of it is visible on this line if (td < maxdist3) { // ensure part is visible on this line
maxdist2 = maxdist - td; maxdist2 = maxdist - td;
for (s = 0; s < smax; s++) { for (s = 0; s < smax; s++) {
if (sdtable[s] < maxdist2) { if (sdtable[s] < maxdist2) {
@ -209,7 +207,6 @@ R_AddDynamicLights (msurface_t *surf)
} }
} }
/* /*
R_BuildLightMap R_BuildLightMap
@ -247,7 +244,8 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
// add all the lightmaps // add all the lightmaps
if (lightmap) { if (lightmap) {
for (maps = 0; maps < MAXLIGHTMAPS && surf->styles[maps] != 255; maps++) { for (maps = 0; maps < MAXLIGHTMAPS && surf->styles[maps] != 255;
maps++) {
scale = d_lightstylevalue[surf->styles[maps]]; scale = d_lightstylevalue[surf->styles[maps]];
surf->cached_light[maps] = scale; // 8.8 fraction surf->cached_light[maps] = scale; // 8.8 fraction
bl = blocklights; bl = blocklights;
@ -312,7 +310,6 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
} }
} }
/* /*
R_TextureAnimation R_TextureAnimation
@ -346,17 +343,14 @@ R_TextureAnimation (texture_t *base)
return base; return base;
} }
/* /*
BRUSH MODELS BRUSH MODELS
*/ */
extern int solidskytexture; extern int solidskytexture;
extern int alphaskytexture; extern int alphaskytexture;
extern float speedscale; // for top sky and bottom sky extern float speedscale; // for top sky and bottom sky
void void
GL_UploadLightmap (int i, int x, int y, int w, int h) GL_UploadLightmap (int i, int x, int y, int w, int h)
{ {
@ -384,13 +378,6 @@ GL_UploadLightmap (int i, int x, int y, int w, int h)
} }
} }
/*
R_DrawSequentialPoly
Systems that have fast state and texture changes can
just do everything as it passes with no need to sort
*/
void void
R_DrawMultitexturePoly (msurface_t *s) R_DrawMultitexturePoly (msurface_t *s)
{ {
@ -454,7 +441,6 @@ R_DrawMultitexturePoly (msurface_t *s)
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
} }
void void
R_BlendLightmaps (void) R_BlendLightmaps (void)
{ {
@ -498,7 +484,6 @@ R_BlendLightmaps (void)
qfglDepthMask (GL_TRUE); // back to normal Z buffering qfglDepthMask (GL_TRUE); // back to normal Z buffering
} }
void void
R_RenderFullbrights (void) R_RenderFullbrights (void)
{ {
@ -523,7 +508,6 @@ R_RenderFullbrights (void)
qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} }
void void
R_RenderBrushPoly (msurface_t *fa) R_RenderBrushPoly (msurface_t *fa)
{ {
@ -592,7 +576,6 @@ R_RenderBrushPoly (msurface_t *fa)
qfglColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
void void
GL_WaterSurface (msurface_t *s) GL_WaterSurface (msurface_t *s)
{ {
@ -610,7 +593,6 @@ GL_WaterSurface (msurface_t *s)
EmitWaterPolys (s); EmitWaterPolys (s);
} }
void void
R_DrawWaterSurfaces (void) R_DrawWaterSurfaces (void)
{ {
@ -645,7 +627,6 @@ R_DrawWaterSurfaces (void)
} }
} }
void void
DrawTextureChains (void) DrawTextureChains (void)
{ {
@ -666,7 +647,6 @@ DrawTextureChains (void)
qfglEnable (GL_BLEND); qfglEnable (GL_BLEND);
} }
void void
R_DrawBrushModel (entity_t *e) R_DrawBrushModel (entity_t *e)
{ {
@ -778,12 +758,10 @@ R_DrawBrushModel (entity_t *e)
qfglPopMatrix (); qfglPopMatrix ();
} }
/* /*
WORLD MODEL WORLD MODEL
*/ */
void void
R_RecursiveWorldNode (mnode_t *node) R_RecursiveWorldNode (mnode_t *node)
{ {
@ -880,7 +858,6 @@ R_RecursiveWorldNode (mnode_t *node)
R_RecursiveWorldNode (node->children[side]); R_RecursiveWorldNode (node->children[side]);
} }
void void
R_DrawWorld (void) R_DrawWorld (void)
{ {
@ -916,7 +893,6 @@ R_DrawWorld (void)
R_DrawSkyChain (sky_chain); R_DrawSkyChain (sky_chain);
} }
void void
R_MarkLeaves (void) R_MarkLeaves (void)
{ {
@ -961,12 +937,10 @@ R_MarkLeaves (void)
} }
} }
/* /*
LIGHTMAP ALLOCATION LIGHTMAP ALLOCATION
*/ */
// returns a texture number and the position inside it // returns a texture number and the position inside it
int int
AllocBlock (int w, int h, int *x, int *y) AllocBlock (int w, int h, int *x, int *y)
@ -1011,12 +985,10 @@ AllocBlock (int w, int h, int *x, int *y)
return 0; return 0;
} }
mvertex_t *r_pcurrentvertbase; mvertex_t *r_pcurrentvertbase;
model_t *currentmodel; model_t *currentmodel;
int nColinElim; int nColinElim;
void void
BuildSurfaceDisplayList (msurface_t *fa) BuildSurfaceDisplayList (msurface_t *fa)
{ {
@ -1115,7 +1087,6 @@ BuildSurfaceDisplayList (msurface_t *fa)
poly->numverts = lnumverts; poly->numverts = lnumverts;
} }
void void
GL_CreateSurfaceLightmap (msurface_t *surf) GL_CreateSurfaceLightmap (msurface_t *surf)
{ {
@ -1135,7 +1106,6 @@ GL_CreateSurfaceLightmap (msurface_t *surf)
R_BuildLightMap (surf, base, BLOCK_WIDTH * lightmap_bytes); R_BuildLightMap (surf, base, BLOCK_WIDTH * lightmap_bytes);
} }
/* /*
GL_BuildLightmaps GL_BuildLightmaps

View file

@ -50,6 +50,10 @@
#include "QF/texture.h" #include "QF/texture.h"
#include "QF/tga.h" #include "QF/tga.h"
#include "QF/vfs.h" // MAX_OSPATH #include "QF/vfs.h" // MAX_OSPATH
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_rmain.h"
#include "QF/GL/qf_vid.h"
#include "compat.h" #include "compat.h"
#include "r_cvar.h" #include "r_cvar.h"
@ -57,16 +61,10 @@
#include "sbar.h" #include "sbar.h"
#include "view.h" #include "view.h"
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_rmain.h"
#include "QF/GL/qf_vid.h"
extern float v_blend[4]; extern float v_blend[4];
extern void GL_Set2D (void); extern void GL_Set2D (void);
/* /*
background clear background clear
rendering rendering
turtle/net/ram icons turtle/net/ram icons
@ -108,11 +106,8 @@ console is:
notify lines notify lines
half half
full full
*/ */
int glx, gly, glwidth, glheight; int glx, gly, glwidth, glheight;
// only the refresh window will be updated unless these variables are flagged // only the refresh window will be updated unless these variables are flagged
@ -183,7 +178,6 @@ SCR_CenterPrint (const char *str)
} }
} }
void void
SCR_DrawCenterString (void) SCR_DrawCenterString (void)
{ {
@ -195,7 +189,8 @@ SCR_DrawCenterString (void)
// the finale prints the characters one at a time // the finale prints the characters one at a time
if (r_force_fullscreen /*FIXME better test*/) if (r_force_fullscreen /*FIXME better test*/)
remaining = scr_printspeed->value * (r_realtime - scr_centertime_start); remaining = scr_printspeed->value * (r_realtime -
scr_centertime_start);
else else
remaining = 9999; remaining = 9999;
@ -230,7 +225,6 @@ SCR_DrawCenterString (void)
} while (1); } while (1);
} }
void void
SCR_CheckDrawCenterString (int swap) SCR_CheckDrawCenterString (int swap)
{ {
@ -240,7 +234,7 @@ SCR_CheckDrawCenterString (int swap)
scr_centertime_off -= r_frametime; scr_centertime_off -= r_frametime;
if (scr_centertime_off <= 0 && !r_force_fullscreen /*FIXME better test*/) if (scr_centertime_off <= 0 && !r_force_fullscreen /*FIXME: better test*/)
return; return;
if (key_dest != key_game) if (key_dest != key_game)
return; return;
@ -248,7 +242,6 @@ SCR_CheckDrawCenterString (int swap)
SCR_DrawCenterString (); SCR_DrawCenterString ();
} }
float float
CalcFov (float fov_x, float width, float height) CalcFov (float fov_x, float width, float height)
{ {
@ -267,7 +260,6 @@ CalcFov (float fov_x, float width, float height)
return a; return a;
} }
/* /*
SCR_CalcRefdef SCR_CalcRefdef
@ -338,7 +330,6 @@ SCR_CalcRefdef (void)
scr_vrect = r_refdef.vrect; scr_vrect = r_refdef.vrect;
} }
/* /*
SCR_SizeUp_f SCR_SizeUp_f
@ -353,7 +344,6 @@ SCR_SizeUp_f (void)
} }
} }
/* /*
SCR_SizeDown_f SCR_SizeDown_f
@ -366,14 +356,12 @@ SCR_SizeDown_f (void)
vid.recalc_refdef = 1; vid.recalc_refdef = 1;
} }
void void
SCR_Init (void) SCR_Init (void)
{ {
//
// register our commands // register our commands
// Cmd_AddCommand ("screenshot", SCR_ScreenShot_f, "Take a screenshot, "
Cmd_AddCommand ("screenshot", SCR_ScreenShot_f, "Take a screenshot, saves as qfxxx.tga in the current directory"); "saves as qfxxx.tga in the current directory");
Cmd_AddCommand ("sizeup", SCR_SizeUp_f, "Increases the screen size"); Cmd_AddCommand ("sizeup", SCR_SizeUp_f, "Increases the screen size");
Cmd_AddCommand ("sizedown", SCR_SizeDown_f, "Decreases the screen size"); Cmd_AddCommand ("sizedown", SCR_SizeDown_f, "Decreases the screen size");
@ -384,7 +372,6 @@ SCR_Init (void)
scr_initialized = true; scr_initialized = true;
} }
void void
SCR_DrawRam (int swap) SCR_DrawRam (int swap)
{ {
@ -397,7 +384,6 @@ SCR_DrawRam (int swap)
Draw_Pic (scr_vrect.x + 32, scr_vrect.y, scr_ram); Draw_Pic (scr_vrect.x + 32, scr_vrect.y, scr_ram);
} }
void void
SCR_DrawTurtle (int swap) SCR_DrawTurtle (int swap)
{ {
@ -418,7 +404,6 @@ SCR_DrawTurtle (int swap)
Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle); Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle);
} }
extern cvar_t *show_time; extern cvar_t *show_time;
extern cvar_t *show_fps; extern cvar_t *show_fps;
@ -458,7 +443,6 @@ SCR_DrawFPS (int swap)
Draw_String8 (x, y, st); Draw_String8 (x, y, st);
} }
/* /*
SCR_DrawTime SCR_DrawTime
@ -496,7 +480,6 @@ SCR_DrawTime (int swap)
Draw_String8 (x, y, st); Draw_String8 (x, y, st);
} }
void void
SCR_DrawPause (int swap) SCR_DrawPause (int swap)
{ {
@ -513,7 +496,6 @@ SCR_DrawPause (int swap)
(vid.height - 48 - pic->height) / 2, pic); (vid.height - 48 - pic->height) / 2, pic);
} }
void void
SCR_SetUpToDrawConsole (void) SCR_SetUpToDrawConsole (void)
{ {
@ -546,7 +528,6 @@ SCR_SetUpToDrawConsole (void)
con_notifylines = 0; con_notifylines = 0;
} }
void void
SCR_DrawConsole (int swap) SCR_DrawConsole (int swap)
{ {
@ -561,7 +542,6 @@ SCR_DrawConsole (int swap)
} }
} }
/* /*
SCREEN SHOTS SCREEN SHOTS
*/ */
@ -578,7 +558,8 @@ SCR_ScreenShot (int width, int height)
float fracw, frach; float fracw, frach;
tex_t *tex; tex_t *tex;
tex = Hunk_TempAlloc (field_offset (tex_t, data[vid.width * vid.height * 3])); tex = Hunk_TempAlloc (field_offset (tex_t, data[vid.width *
vid.height * 3]));
if (!tex) if (!tex)
return 0; return 0;
@ -645,9 +626,7 @@ SCR_ScreenShot_f (void)
byte *buffer; byte *buffer;
char pcxname[MAX_OSPATH]; char pcxname[MAX_OSPATH];
//
// find a file name to save it to // find a file name to save it to
//
if (!COM_NextFilename (pcxname, "qf", ".tga")) { if (!COM_NextFilename (pcxname, "qf", ".tga")) {
Con_Printf ("SCR_ScreenShot_f: Couldn't create a TGA file\n"); Con_Printf ("SCR_ScreenShot_f: Couldn't create a TGA file\n");
return; return;
@ -660,7 +639,6 @@ SCR_ScreenShot_f (void)
Con_Printf ("Wrote %s\n", pcxname); Con_Printf ("Wrote %s\n", pcxname);
} }
/* /*
Find closest color in the palette for named color Find closest color in the palette for named color
*/ */
@ -697,7 +675,6 @@ MipColor (int r, int g, int b)
return best; return best;
} }
// in gl_draw.c // in gl_draw.c
extern byte *draw_chars; // 8*8 graphic characters extern byte *draw_chars; // 8*8 graphic characters
@ -727,7 +704,6 @@ SCR_DrawCharToSnap (int num, byte * dest, int width)
} }
void void
SCR_DrawStringToSnap (const char *s, tex_t *tex, int x, int y) SCR_DrawStringToSnap (const char *s, tex_t *tex, int x, int y)
{ {
@ -745,7 +721,6 @@ SCR_DrawStringToSnap (const char *s, tex_t *tex, int x, int y)
} }
} }
char *scr_notifystring; char *scr_notifystring;
void void
@ -780,7 +755,6 @@ SCR_DrawNotifyString (void)
} while (1); } while (1);
} }
void void
SCR_TileClear (void) SCR_TileClear (void)
{ {
@ -806,7 +780,6 @@ SCR_TileClear (void)
} }
} }
extern void R_ForceLightUpdate (void); extern void R_ForceLightUpdate (void);
int oldviewsize = 0; int oldviewsize = 0;
@ -879,9 +852,11 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
// draw any areas not covered by the refresh // draw any areas not covered by the refresh
SCR_TileClear (); SCR_TileClear ();
if (r_force_fullscreen /*FIXME better test*/ == 1 && key_dest == key_game) { if (r_force_fullscreen /*FIXME better test*/ == 1 && key_dest ==
key_game) {
Sbar_IntermissionOverlay (); Sbar_IntermissionOverlay ();
} else if (r_force_fullscreen /*FIXME better test*/ == 2 && key_dest == key_game) { } else if (r_force_fullscreen /*FIXME better test*/ == 2 &&
key_dest == key_game) {
Sbar_FinaleOverlay (); Sbar_FinaleOverlay ();
SCR_CheckDrawCenterString (swap); SCR_CheckDrawCenterString (swap);
} else { } else {

View file

@ -36,18 +36,18 @@
# include <strings.h> # include <strings.h>
#endif #endif
#include "compat.h"
#include "r_cvar.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/render.h" #include "QF/render.h"
#include "QF/skin.h" #include "QF/skin.h"
#include "QF/texture.h" #include "QF/texture.h"
#include "QF/GL/defines.h" #include "QF/GL/defines.h"
#include "QF/GL/funcs.h" #include "QF/GL/funcs.h"
#include "QF/GL/qf_textures.h" #include "QF/GL/qf_textures.h"
#include "compat.h"
#include "r_cvar.h"
static byte translate[256]; static byte translate[256];
static unsigned int translate32[256]; static unsigned int translate32[256];
@ -105,7 +105,8 @@ build_skin_8 (byte * original, int tinwidth, int tinheight,
} }
} }
GL_Upload8_EXT ((byte *) pixels, scaled_width, scaled_height, false, alpha); GL_Upload8_EXT ((byte *) pixels, scaled_width, scaled_height, false,
alpha);
} }
static void static void
@ -244,5 +245,5 @@ Skin_Process (skin_t *skin, tex_t *tex)
skin->fb_texture = skin_fb_textures + (skin - skin_cache); skin->fb_texture = skin_fb_textures + (skin - skin_cache);
build_skin (skin->fb_texture, ptexels, tex->width, tex->height, build_skin (skin->fb_texture, ptexels, tex->width, tex->height,
296, 194, true); 296, 194, true);
}
} }
}

View file

@ -36,18 +36,12 @@
# include <strings.h> # include <strings.h>
#endif #endif
#include "compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/render.h" #include "QF/render.h"
#include "QF/tga.h" #include "QF/tga.h"
#include "QF/vfs.h" #include "QF/vfs.h"
#include "QF/vid.h" #include "QF/vid.h"
#include "r_shared.h"
#include "view.h"
#include "r_cvar.h"
#include "QF/GL/defines.h" #include "QF/GL/defines.h"
#include "QF/GL/funcs.h" #include "QF/GL/funcs.h"
#include "QF/GL/qf_sky.h" #include "QF/GL/qf_sky.h"
@ -55,6 +49,11 @@
#include "QF/GL/qf_rlight.h" #include "QF/GL/qf_rlight.h"
#include "QF/GL/qf_vid.h" #include "QF/GL/qf_vid.h"
#include "compat.h"
#include "r_shared.h"
#include "view.h"
#include "r_cvar.h"
extern model_t *loadmodel; extern model_t *loadmodel;
extern int skytexturenum; extern int skytexturenum;
@ -94,8 +93,8 @@ R_LoadSkys (const char *skyname)
} }
targa_rgba = LoadTGA (f); targa_rgba = LoadTGA (f);
qfglTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0, GL_RGBA, qfglTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0,
GL_UNSIGNED_BYTE, targa_rgba); GL_RGBA, GL_UNSIGNED_BYTE, targa_rgba);
free (targa_rgba); free (targa_rgba);
@ -106,67 +105,64 @@ R_LoadSkys (const char *skyname)
Con_Printf ("Unable to load skybox %s, using normal sky\n", skyname); Con_Printf ("Unable to load skybox %s, using normal sky\n", skyname);
} }
void void
R_SkyBoxPolyVec (vec5_t v) R_SkyBoxPolyVec (vec5_t v)
{ {
// avoid interpolation seams // avoid interpolation seams
// s = s * (254.0/256.0) + (1.0/256.0); // s = s * (254.0/256.0) + (1.0/256.0);
// t = t * (254.0/256.0) + (1.0/256.0); // t = t * (254.0/256.0) + (1.0/256.0);
qfglTexCoord2fv (v); qfglTexCoord2fv (v);
qfglVertex3f (r_refdef.vieworg[0] + v[2], qfglVertex3f (r_refdef.vieworg[0] + v[2],
r_refdef.vieworg[1] + v[3], r_refdef.vieworg[2] + v[4]); r_refdef.vieworg[1] + v[3], r_refdef.vieworg[2] + v[4]);
} }
#define ftc(x) (x * (254.0/256.0) + (1.0/256.0)) #define ftc(x) (x * (254.0/256.0) + (1.0/256.0))
vec5_t skyvec[6][4] = { vec5_t skyvec[6][4] = {
{ {
// right +y // right +y
{ftc (1), ftc (0), 1024, 1024, 1024}, {ftc (1), ftc (0), 1024, 1024, 1024},
{ftc (1), ftc (1), 1024, 1024, -1024}, {ftc (1), ftc (1), 1024, 1024, -1024},
{ftc (0), ftc (1), -1024, 1024, -1024}, {ftc (0), ftc (1), -1024, 1024, -1024},
{ftc (0), ftc (0), -1024, 1024, 1024} {ftc (0), ftc (0), -1024, 1024, 1024}
}, },
{ {
// back -x // back -x
{ftc (1), ftc (0), -1024, 1024, 1024}, {ftc (1), ftc (0), -1024, 1024, 1024},
{ftc (1), ftc (1), -1024, 1024, -1024}, {ftc (1), ftc (1), -1024, 1024, -1024},
{ftc (0), ftc (1), -1024, -1024, -1024}, {ftc (0), ftc (1), -1024, -1024, -1024},
{ftc (0), ftc (0), -1024, -1024, 1024} {ftc (0), ftc (0), -1024, -1024, 1024}
}, },
{ {
// left -y // left -y
{ftc (1), ftc (0), -1024, -1024, 1024}, {ftc (1), ftc (0), -1024, -1024, 1024},
{ftc (1), ftc (1), -1024, -1024, -1024}, {ftc (1), ftc (1), -1024, -1024, -1024},
{ftc (0), ftc (1), 1024, -1024, -1024}, {ftc (0), ftc (1), 1024, -1024, -1024},
{ftc (0), ftc (0), 1024, -1024, 1024} {ftc (0), ftc (0), 1024, -1024, 1024}
}, },
{ {
// front +x // front +x
{ftc (1), ftc (0), 1024, -1024, 1024}, {ftc (1), ftc (0), 1024, -1024, 1024},
{ftc (1), ftc (1), 1024, -1024, -1024}, {ftc (1), ftc (1), 1024, -1024, -1024},
{ftc (0), ftc (1), 1024, 1024, -1024}, {ftc (0), ftc (1), 1024, 1024, -1024},
{ftc (0), ftc (0), 1024, 1024, 1024} {ftc (0), ftc (0), 1024, 1024, 1024}
}, },
{ {
// up +z // up +z
{ftc (1), ftc (0), 1024, -1024, 1024}, {ftc (1), ftc (0), 1024, -1024, 1024},
{ftc (1), ftc (1), 1024, 1024, 1024}, {ftc (1), ftc (1), 1024, 1024, 1024},
{ftc (0), ftc (1), -1024, 1024, 1024}, {ftc (0), ftc (1), -1024, 1024, 1024},
{ftc (0), ftc (0), -1024, -1024, 1024} {ftc (0), ftc (0), -1024, -1024, 1024}
}, },
{ {
// down -z // down -z
{ftc (1), ftc (0), 1024, 1024, -1024}, {ftc (1), ftc (0), 1024, 1024, -1024},
{ftc (1), ftc (1), 1024, -1024, -1024}, {ftc (1), ftc (1), 1024, -1024, -1024},
{ftc (0), ftc (1), -1024, -1024, -1024}, {ftc (0), ftc (1), -1024, -1024, -1024},
{ftc (0), ftc (0), -1024, 1024, -1024} {ftc (0), ftc (0), -1024, 1024, -1024}
} }
}; };
#undef ftc #undef ftc
void void
R_DrawSkyBox (void) R_DrawSkyBox (void)
{ {
@ -186,7 +182,6 @@ R_DrawSkyBox (void)
qfglDepthRange (gldepthmin, gldepthmax); qfglDepthRange (gldepthmin, gldepthmax);
} }
vec3_t domescale; vec3_t domescale;
void void
@ -215,16 +210,16 @@ R_DrawSkyLayer (float s)
v[2] = y * domescale[2]; v[2] = y * domescale[2];
qfglTexCoord2f ((v[0] + s) * (1.0 / 128.0), qfglTexCoord2f ((v[0] + s) * (1.0 / 128.0),
(v[1] + s) * (1.0 / 128.0)); (v[1] + s) * (1.0 / 128.0));
qfglVertex3f (v[0] + r_refdef.vieworg[0], qfglVertex3f (v[0] + r_refdef.vieworg[0], v[1] +
v[1] + r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]); r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]);
v[0] = a2x * x; v[0] = a2x * x;
v[1] = a2y * x; v[1] = a2y * x;
v[2] = y * domescale[2]; v[2] = y * domescale[2];
qfglTexCoord2f ((v[0] + s) * (1.0 / 128.0), qfglTexCoord2f ((v[0] + s) * (1.0 / 128.0),
(v[1] + s) * (1.0 / 128.0)); (v[1] + s) * (1.0 / 128.0));
qfglVertex3f (v[0] + r_refdef.vieworg[0], qfglVertex3f (v[0] + r_refdef.vieworg[0], v[1] +
v[1] + r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]); r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]);
} }
qfglTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0)); qfglTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0));
qfglVertex3f (r_refdef.vieworg[0], qfglVertex3f (r_refdef.vieworg[0],
@ -233,7 +228,6 @@ R_DrawSkyLayer (float s)
} }
} }
void void
R_DrawSkyDome (void) R_DrawSkyDome (void)
{ {
@ -267,7 +261,6 @@ R_DrawSkyDome (void)
qfglDepthRange (gldepthmin, gldepthmax); qfglDepthRange (gldepthmin, gldepthmax);
} }
void void
R_DrawSky (void) R_DrawSky (void)
{ {
@ -277,7 +270,6 @@ R_DrawSky (void)
R_DrawSkyDome (); R_DrawSkyDome ();
} }
/* /*
R_InitSky R_InitSky
@ -314,7 +306,6 @@ R_InitSky (texture_t *mt)
((byte *) & transpix)[2] = b / (128 * 128); ((byte *) & transpix)[2] = b / (128 * 128);
((byte *) & transpix)[3] = 0; ((byte *) & transpix)[3] = 0;
if (!solidskytexture) if (!solidskytexture)
solidskytexture = texture_extension_number++; solidskytexture = texture_extension_number++;
qfglBindTexture (GL_TEXTURE_2D, solidskytexture); qfglBindTexture (GL_TEXTURE_2D, solidskytexture);
@ -323,7 +314,6 @@ R_InitSky (texture_t *mt)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
for (j = 0; j < 128; j++) { for (j = 0; j < 128; j++) {
p = src[i * 256 + j]; p = src[i * 256 + j];

View file

@ -39,15 +39,14 @@
#include <stdarg.h> #include <stdarg.h>
#include "QF/cvar.h"
#include "QF/render.h"
#include "QF/sys.h"
#include "QF/GL/defines.h" #include "QF/GL/defines.h"
#include "QF/GL/funcs.h" #include "QF/GL/funcs.h"
#include "QF/GL/qf_sky.h" #include "QF/GL/qf_sky.h"
#include "QF/GL/qf_vid.h" #include "QF/GL/qf_vid.h"
#include "QF/cvar.h"
#include "QF/render.h"
#include "QF/sys.h"
#include "view.h" #include "view.h"
#include "r_cvar.h" #include "r_cvar.h"
@ -147,7 +146,6 @@ determine_face (vec3_t v)
return i; return i;
} }
/* /*
find_intersect (for want of a better name) find_intersect (for want of a better name)
@ -207,7 +205,6 @@ find_intersect (int face1, vec3_t x1, int face2, vec3_t x2, vec3_t y)
return axis; return axis;
} }
/* /*
find_cube_vertex find_cube_vertex
@ -225,7 +222,6 @@ find_cube_vertex (int face1, int face2, int face3, vec3_t v)
v[face_axis[face3]] = face_offset[face3]; v[face_axis[face3]] = face_offset[face3];
} }
/* /*
set_vertex set_vertex
@ -267,7 +263,6 @@ set_vertex (struct box_def *box, int face, int ind, vec3_t v)
} }
} }
/* /*
add_vertex add_vertex
@ -279,7 +274,6 @@ add_vertex (struct box_def *box, int face, vec3_t v)
set_vertex (box, face, box->face[face].poly.numverts++, v); set_vertex (box, face, box->face[face].poly.numverts++, v);
} }
/* /*
insert_cube_vertices insert_cube_vertices
@ -332,7 +326,6 @@ insert_cube_vertices (struct box_def *box, struct visit_def visit, int count,
} }
} }
/* /*
cross_cube_edge cross_cube_edge
@ -374,7 +367,6 @@ cross_cube_edge (struct box_def *box, int face1, vec3_t v1, int face2,
} }
} }
/* /*
process_corners process_corners
@ -579,7 +571,6 @@ process_corners (struct box_def *box)
} }
} }
/* /*
render_box render_box
@ -603,7 +594,6 @@ render_box (struct box_def *box)
} }
} }
void void
R_DrawSkyBoxPoly (glpoly_t *poly) R_DrawSkyBoxPoly (glpoly_t *poly)
{ {
@ -662,7 +652,6 @@ R_DrawSkyBoxPoly (glpoly_t *poly)
render_box (&box); render_box (&box);
} }
void void
R_DrawSkyDomePoly (glpoly_t *poly) R_DrawSkyDomePoly (glpoly_t *poly)
{ {

View file

@ -40,22 +40,21 @@
#include <stdio.h> #include <stdio.h>
#include "QF/cmd.h" #include "QF/cmd.h"
#include "compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/crc.h" #include "QF/crc.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/draw.h" #include "QF/draw.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "QF/vid.h" #include "QF/vid.h"
#include "sbar.h"
#include "r_cvar.h"
#include "QF/GL/defines.h" #include "QF/GL/defines.h"
#include "QF/GL/funcs.h" #include "QF/GL/funcs.h"
#include "QF/GL/qf_textures.h" #include "QF/GL/qf_textures.h"
#include "QF/GL/qf_vid.h" #include "QF/GL/qf_vid.h"
#include "compat.h"
#include "sbar.h"
#include "r_cvar.h"
extern int gl_filter_min, gl_filter_max; extern int gl_filter_min, gl_filter_max;
extern unsigned char d_15to8table[65536]; extern unsigned char d_15to8table[65536];
extern cvar_t *gl_picmip; extern cvar_t *gl_picmip;
@ -181,6 +180,7 @@ static glformat_t formats[] = {
int gl_alpha_format = 4, gl_lightmap_format = 4, gl_solid_format = 3; int gl_alpha_format = 4, gl_lightmap_format = 4, gl_solid_format = 3;
void void
GL_TextureMode_f (void) GL_TextureMode_f (void)
{ {
@ -222,7 +222,6 @@ GL_TextureMode_f (void)
} }
} }
int int
GL_TextureDepth_f (int format) GL_TextureDepth_f (int format)
{ {
@ -250,7 +249,6 @@ GL_TextureDepth_f (int format)
return formats[i].format; return formats[i].format;
} }
static void static void
GL_ResampleTexture (unsigned int *in, int inwidth, int inheight, GL_ResampleTexture (unsigned int *in, int inwidth, int inheight,
unsigned int *out, int outwidth, int outheight) unsigned int *out, int outwidth, int outheight)
@ -272,7 +270,6 @@ GL_ResampleTexture (unsigned int *in, int inwidth, int inheight,
} }
} }
#if defined(GL_SHARED_TEXTURE_PALETTE_EXT) && defined(HAVE_GL_COLOR_INDEX8_EXT) #if defined(GL_SHARED_TEXTURE_PALETTE_EXT) && defined(HAVE_GL_COLOR_INDEX8_EXT)
static void static void
GL_Resample8BitTexture (unsigned char *in, int inwidth, int inheight, GL_Resample8BitTexture (unsigned char *in, int inwidth, int inheight,
@ -296,7 +293,6 @@ GL_Resample8BitTexture (unsigned char *in, int inwidth, int inheight,
} }
#endif #endif
/* /*
GL_MipMap GL_MipMap
@ -322,7 +318,6 @@ GL_MipMap (byte * in, int width, int height)
} }
} }
/* /*
GL_MipMap8Bit GL_MipMap8Bit
@ -359,7 +354,6 @@ GL_MipMap8Bit (byte * in, int width, int height)
} }
#endif #endif
static void static void
GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap, GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap,
qboolean alpha) qboolean alpha)
@ -385,9 +379,8 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap,
intformat = alpha ? gl_alpha_format : gl_solid_format; intformat = alpha ? gl_alpha_format : gl_solid_format;
// If the real width/height and the 'scaled' width/height then we // If the real width/height and the 'scaled' width/height aren't
// rescale it. // identical, then we rescale it.
if (scaled_width == width && scaled_height == height) { if (scaled_width == width && scaled_height == height) {
memcpy (scaled, data, width * height * sizeof (GLuint)); memcpy (scaled, data, width * height * sizeof (GLuint));
} else { } else {
@ -395,8 +388,8 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap,
scaled_height); scaled_height);
} }
qfglTexImage2D (GL_TEXTURE_2D, 0, intformat, scaled_width, scaled_height, 0, qfglTexImage2D (GL_TEXTURE_2D, 0, intformat, scaled_width, scaled_height,
GL_RGBA, GL_UNSIGNED_BYTE, scaled); 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
if (mipmap) { if (mipmap) {
int miplevel = 0; int miplevel = 0;
@ -414,20 +407,24 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap,
} }
if (mipmap) { if (mipmap) {
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); gl_filter_min);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max);
} else { } else {
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
gl_filter_max);
if (gl_picmip->int_val) if (gl_picmip->int_val)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
else else
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max);
} }
free (scaled); free (scaled);
} }
/* /*
GL_Upload8_EXT GL_Upload8_EXT
@ -455,8 +452,8 @@ GL_Upload8_EXT (byte * data, int width, int height, qboolean mipmap,
if (!(scaled = malloc (scaled_width * scaled_height))) if (!(scaled = malloc (scaled_width * scaled_height)))
Sys_Error ("GL_LoadTexture: too big"); Sys_Error ("GL_LoadTexture: too big");
// If the real width/height and the 'scaled' width/height then we // If the real width/height and the 'scaled' width/height aren't
// rescale it. // identical then we rescale it.
if (scaled_width == width && scaled_height == height) { if (scaled_width == width && scaled_height == height) {
memcpy (scaled, data, width * height); memcpy (scaled, data, width * height);
} else { } else {
@ -484,21 +481,25 @@ GL_Upload8_EXT (byte * data, int width, int height, qboolean mipmap,
} }
if (mipmap) { if (mipmap) {
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); gl_filter_min);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max);
} else { } else {
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
gl_filter_max);
if (gl_picmip->int_val) if (gl_picmip->int_val)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
else else
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max);
} }
free (scaled); free (scaled);
#endif #endif
} }
extern qboolean VID_Is8bit (void); extern qboolean VID_Is8bit (void);
void void
@ -544,7 +545,6 @@ GL_Upload8 (byte * data, int width, int height, qboolean mipmap, qboolean alpha)
free (trans); free (trans);
} }
int int
GL_LoadTexture (const char *identifier, int width, int height, byte * data, GL_LoadTexture (const char *identifier, int width, int height, byte * data,
qboolean mipmap, qboolean alpha, int bytesperpixel) qboolean mipmap, qboolean alpha, int bytesperpixel)

View file

@ -64,7 +64,6 @@ BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs)
} }
} }
void void
SubdividePolygon (int numverts, float *verts) SubdividePolygon (int numverts, float *verts)
{ {
@ -132,10 +131,8 @@ SubdividePolygon (int numverts, float *verts)
return; return;
} }
poly = poly = Hunk_Alloc (sizeof (glpoly_t) + (numverts - 4) * VERTEXSIZE *
sizeof (float));
Hunk_Alloc (sizeof (glpoly_t) +
(numverts - 4) * VERTEXSIZE * sizeof (float));
poly->next = warpface->polys; poly->next = warpface->polys;
warpface->polys = poly; warpface->polys = poly;
poly->numverts = numverts; poly->numverts = numverts;
@ -148,7 +145,6 @@ SubdividePolygon (int numverts, float *verts)
} }
} }
/* /*
GL_SubdivideSurface GL_SubdivideSurface
@ -167,9 +163,7 @@ GL_SubdivideSurface (msurface_t *fa)
warpface = fa; warpface = fa;
//
// convert edges back to a normal polygon // convert edges back to a normal polygon
//
numverts = 0; numverts = 0;
for (i = 0; i < fa->numedges; i++) { for (i = 0; i < fa->numedges; i++) {
lindex = loadmodel->surfedges[fa->firstedge + i]; lindex = loadmodel->surfedges[fa->firstedge + i];
@ -185,7 +179,6 @@ GL_SubdivideSurface (msurface_t *fa)
SubdividePolygon (numverts, verts[0]); SubdividePolygon (numverts, verts[0]);
} }
// speed up sin calculations - Ed // speed up sin calculations - Ed
float turbsin[] = { float turbsin[] = {
# include "gl_warp_sin.h" # include "gl_warp_sin.h"
@ -213,18 +206,22 @@ EmitWaterPolys (msurface_t *fa)
os = v[3]; os = v[3];
ot = v[4]; ot = v[4];
s = os + turbsin[(int) ((ot * 0.125 + r_realtime) * TURBSCALE) & 255]; s = os + turbsin[(int) ((ot * 0.125 + r_realtime) * TURBSCALE) &
255];
s *= (1.0 / 64); s *= (1.0 / 64);
t = ot + turbsin[(int) ((os * 0.125 + r_realtime) * TURBSCALE) & 255]; t = ot + turbsin[(int) ((os * 0.125 + r_realtime) * TURBSCALE) &
255];
t *= (1.0 / 64); t *= (1.0 / 64);
qfglTexCoord2f (s, t); qfglTexCoord2f (s, t);
VectorCopy (v, nv); VectorCopy (v, nv);
nv[2] += r_waterripple->value nv[2] += r_waterripple->value
* turbsin[(int) ((v[3] * 0.125 + r_realtime) * TURBSCALE) & 255] * turbsin[(int) ((v[3] * 0.125 + r_realtime) * TURBSCALE) &
* turbsin[(int) ((v[4] * 0.125 + r_realtime) * TURBSCALE) & 255] 255]
* turbsin[(int) ((v[4] * 0.125 + r_realtime) * TURBSCALE) &
255]
* (1.0 / 64.0); * (1.0 / 64.0);
qfglVertex3fv (nv); qfglVertex3fv (nv);

View file

@ -43,6 +43,7 @@
#include "QF/mathlib.h" #include "QF/mathlib.h"
void void
noise_diamondsquare (unsigned char *noise, int size) noise_diamondsquare (unsigned char *noise, int size)
{ {
@ -98,7 +99,6 @@ noise_diamondsquare (unsigned char *noise, int size)
#undef n #undef n
} }
void void
noise_plasma (unsigned char *noise, int size) noise_plasma (unsigned char *noise, int size)
{ {