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;
}
void
Draw_ClearCache (void)
{
@ -125,7 +124,6 @@ Draw_ClearCache (void)
pic->dirty = true;
}
qpic_t *
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..
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..
pic->dirty = false;
numcachepics++;
// FIXME:
// A really ugly kluge, keep a specific image in memory
// for the menu system.
// Some days I really dislike legacy support..
// FIXME: A really ugly kluge, keep a specific image in memory
// for the menu system. Some days I really dislike legacy support..
if (!strcmp (path, "gfx/menuplyr.lmp"))
memcpy (menuplyr_pixels, dat->data, dat->width * dat->height);
@ -180,7 +176,6 @@ Draw_CachePic (const char *path, qboolean alpha)
return &pic->pic;
}
void
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);
}
extern void glrmain_init (void);
extern void glrsurf_init (void);
extern void GL_TextureMode_f (void);
void
Draw_Init (void)
{
@ -249,19 +242,20 @@ Draw_Init (void)
qfglGetIntegerv(GL_MAX_TEXTURE_SIZE, &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
// by hand, because we need to write the version
// string into the background before turning
// it into a texture
// load the console background and the charset by hand, because we need to
// write the version string into the background before turning it into a
// texture
draw_chars = W_GetLumpName ("conchars");
for (i = 0; i < 256 * 64; i++)
if (draw_chars[i] == 0)
draw_chars[i] = 255; // proper transparent color
// 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);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@ -278,7 +272,6 @@ Draw_Init (void)
glrsurf_init ();
}
/*
Draw_Character8
@ -321,7 +314,6 @@ Draw_Character8 (int x, int y, int num)
qfglEnd ();
}
void
Draw_String8 (int x, int y, const char *str)
{
@ -332,7 +324,6 @@ Draw_String8 (int x, int y, const char *str)
}
}
void
Draw_AltString8 (int x, int y, const char *str)
{
@ -343,7 +334,6 @@ Draw_AltString8 (int x, int y, const char *str)
}
}
void
Draw_Crosshair (int swap)
{
@ -384,7 +374,6 @@ Draw_Crosshair (int swap)
}
}
void
Draw_Pic (int x, int y, qpic_t *pic)
{
@ -405,7 +394,6 @@ Draw_Pic (int x, int y, qpic_t *pic)
qfglEnd ();
}
void
Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
int height)
@ -436,7 +424,6 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
qfglColor3ubv (lighthalf_v);
}
/*
Draw_TransPicTranslate
@ -486,7 +473,6 @@ Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte * translation)
qfglColor3ubv (lighthalf_v);
}
/*
Draw_ConsoleBackground
@ -568,7 +554,6 @@ Draw_ConsoleBackground (int lines)
qfglColor3ubv (lighthalf_v);
}
/*
Draw_TileClear
@ -593,7 +578,6 @@ Draw_TileClear (int x, int y, int w, int h)
qfglColor3ubv (lighthalf_v);
}
/*
Draw_Fill
@ -618,10 +602,6 @@ Draw_Fill (int x, int y, int w, int h, int c)
qfglEnable (GL_TEXTURE_2D);
}
//=============================================================================
void
Draw_FadeScreen (void)
{
@ -641,10 +621,6 @@ Draw_FadeScreen (void)
Sbar_Changed ();
}
//=============================================================================
/*
Draw_BeginDisc
@ -656,7 +632,6 @@ Draw_BeginDisc (void)
{
}
/*
Draw_EndDisc
@ -668,7 +643,6 @@ Draw_EndDisc (void)
{
}
/*
GL_Set2D

View file

@ -50,6 +50,7 @@
#include "r_dynamic.h"
#include "r_shared.h"
/*
R_DrawFire
@ -100,7 +101,6 @@ R_DrawFire (fire_t *f)
qfglColor3ubv (lighthalf_v);
}
/*
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;
}
inline particle_t *
particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz,
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);
}
/*
R_MaxParticlesCheck
@ -152,7 +150,6 @@ R_MaxParticlesCheck (cvar_t *var)
R_ClearParticles();
}
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.");
}
void
R_ClearParticles (void)
{
numparticles = 0;
}
void
R_ReadPointFile_f (void)
{
@ -222,7 +217,6 @@ R_ReadPointFile_f (void)
Con_Printf ("%i points read\n", c);
}
void
R_ParticleExplosion (vec3_t org)
{
@ -234,7 +228,6 @@ R_ParticleExplosion (vec3_t org)
128 + (rand () & 63));
}
void
R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
{
@ -252,7 +245,6 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
}
}
void
R_BlobExplosion (vec3_t org)
{
@ -273,7 +265,6 @@ R_BlobExplosion (vec3_t org)
}
}
static void
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));
}
static void
R_RunGunshotEffect (vec3_t org, int count)
{
@ -307,7 +297,6 @@ R_RunGunshotEffect (vec3_t org, int count)
return;
}
static void
R_BloodPuff (vec3_t org, int count)
{
@ -319,7 +308,6 @@ R_BloodPuff (vec3_t org, int count)
vec3_origin, vec3_origin);
}
void
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
R_RunParticleEffect (vec3_t org, int color, int count)
{
@ -369,7 +356,6 @@ R_RunParticleEffect (vec3_t org, int color, int count)
}
}
void
R_RunSpikeEffect (vec3_t org, particle_effect_t type)
{
@ -391,7 +377,6 @@ R_RunSpikeEffect (vec3_t org, particle_effect_t type)
}
}
void
R_LavaSplash (vec3_t org)
{
@ -423,7 +408,6 @@ R_LavaSplash (vec3_t org)
}
}
void
R_TeleportSplash (vec3_t org)
{
@ -455,7 +439,6 @@ R_TeleportSplash (vec3_t org)
}
}
void
R_RocketTrail (int type, entity_t *ent)
{
@ -570,7 +553,6 @@ R_RocketTrail (int type, entity_t *ent)
}
}
void
R_DrawParticles (void)
{

View file

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

View file

@ -41,12 +41,13 @@
#endif
#include <stdio.h>
#include <QF/GL/types.h>
#include <QF/GL/funcs.h>
#include <QF/GL/extensions.h>
#include <QF/cvar.h>
#include <QF/console.h>
#include <QF/sys.h>
#include <QF/GL/types.h>
#include <QF/GL/funcs.h>
#include <QF/GL/extensions.h>
#include "r_cvar.h"
// First we need to get all the function pointers declared.
@ -63,7 +64,8 @@ GLF_Init (void)
#if defined(HAVE_DLOPEN)
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;
}
#elif defined(_WIN32)
@ -80,11 +82,13 @@ GLF_Init (void)
#include "QF/GL/qf_funcs_list.h"
#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;
}
void *
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)
glGetProcAddress = dlsym (handle, "glXGetProcAddressARB");
#elif defined(_WIN32)
(FARPROC)glGetProcAddress = GetProcAddress (handle, "wglGetProcAddress");
(FARPROC)glGetProcAddress = GetProcAddress (handle,
"wglGetProcAddress");
#endif
}
@ -135,7 +140,8 @@ QFGL_ProcAddress (void *handle, const char *name, qboolean crit)
Con_DPrintf ("not found\n");
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;
}

View file

@ -39,12 +39,12 @@
#include <stdlib.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/draw.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"
@ -62,6 +62,7 @@ static int graph_width[NUM_GRAPH_TEXTURES];
static byte *graph_texels[NUM_GRAPH_TEXTURES];
int graph_texture[NUM_GRAPH_TEXTURES];
int
R_InitGraphTextures (int base)
{

View file

@ -71,12 +71,10 @@ R_AnimateLight (void)
}
}
/*
DYNAMIC LIGHTS BLEND RENDERING
*/
void
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[1] = v_blend[1] * (1 - a2) + g * 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];
void
@ -112,7 +108,6 @@ R_InitBubble ()
}
}
void
R_RenderDlight (dlight_t *light)
{
@ -155,7 +150,6 @@ R_RenderDlight (dlight_t *light)
qfglEnd ();
}
void
R_RenderDlights (void)
{
@ -185,12 +179,10 @@ R_RenderDlights (void)
qfglDepthMask (GL_TRUE);
}
/*
DYNAMIC LIGHTS
*/
// LordHavoc: heavily modified, to eliminate unnecessary texture uploads,
// and support bmodel lighting better
void
@ -395,7 +387,6 @@ R_MarkLights (vec3_t lightorigin, dlight_t *light, int bit, model_t *model)
}
}
void
R_PushDlights (vec3_t entorigin)
{
@ -416,7 +407,6 @@ R_PushDlights (vec3_t entorigin)
}
}
/*
LIGHT SAMPLING
*/
@ -520,7 +510,6 @@ RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
return RecursiveLightPoint (node->children[!side], mid, end);
}
int
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);
// LordHavoc: place for gl_rmain setup code
void
glrmain_init (void)
{
}
void
R_RotateForEntity (entity_t *e)
{
@ -133,7 +133,6 @@ R_RotateForEntity (entity_t *e)
qfglRotatef (e->angles[2], 1, 0, 0);
}
static mspriteframe_t *
R_GetSpriteFrame (entity_t *currententity)
{
@ -177,7 +176,6 @@ R_GetSpriteFrame (entity_t *currententity)
return pspriteframe;
}
static void
R_DrawSpriteModel (entity_t *e)
{
@ -231,7 +229,6 @@ R_DrawSpriteModel (entity_t *e)
qfglDisable (GL_ALPHA_TEST);
}
/*
ALIAS MODELS
*/
@ -255,7 +252,6 @@ float *shadedots = r_avertexnormal_dots[0];
int lastposenum, lastposenum0;
static void
GL_DrawAliasFrame (vert_order_t *vo, qboolean fb)
{
@ -310,7 +306,6 @@ GL_DrawAliasFrame (vert_order_t *vo, qboolean fb)
qfglColor3ubv (lighthalf_v);
}
extern vec3_t lightspot;
/*
@ -374,7 +369,6 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum)
}
}
/*
GL_DrawAliasBlendedShadow
@ -416,16 +410,22 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t
do {
order += 2;
point1[0] = verts1->v[0] * paliashdr->mdl.scale[0] + paliashdr->mdl.scale_origin[0];
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] = verts1->v[0] * paliashdr->mdl.scale[0] +
paliashdr->mdl.scale_origin[0];
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[1] -= shadevector[1] * (point1[2] + lheight);
point2[0] = verts2->v[0] * paliashdr->mdl.scale[0] + paliashdr->mdl.scale_origin[0];
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] = verts2->v[0] * paliashdr->mdl.scale[0] +
paliashdr->mdl.scale_origin[0];
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[1] -= shadevector[1] * (point2[2] + lheight);
@ -441,7 +441,6 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t
}
}
vert_order_t *
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;
}
static void
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
}
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;
an = e->angles[1] / 180 * M_PI;
@ -675,7 +675,8 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
if (gl_affinemodels->int_val)
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);
@ -704,7 +705,8 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
qfglColor4f (0, 0, 0, 0.5);
if (gl_lerp_anim->int_val) {
GL_DrawAliasBlendedShadow (paliashdr, lastposenum0, lastposenum, currententity);
GL_DrawAliasBlendedShadow (paliashdr, lastposenum0, lastposenum,
currententity);
} else {
GL_DrawAliasShadow (paliashdr, lastposenum);
}
@ -715,7 +717,6 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
}
}
/*
R_ShowNearestLoc
@ -747,7 +748,6 @@ R_ShowNearestLoc (void)
}
}
/*
R_DrawEntitiesOnList
@ -795,7 +795,6 @@ R_DrawEntitiesOnList (void)
}
}
static void
R_DrawViewModel (void)
{
@ -816,7 +815,6 @@ R_DrawViewModel (void)
qfglDepthRange (gldepthmin, gldepthmax);
}
static int
SignbitsForPlane (mplane_t *out)
{
@ -832,7 +830,6 @@ SignbitsForPlane (mplane_t *out)
return bits;
}
static void
R_SetFrustum (void)
{
@ -869,7 +866,6 @@ R_SetFrustum (void)
}
}
void
R_SetupFrame (void)
{
@ -887,7 +883,6 @@ R_SetupFrame (void)
r_viewleaf = Mod_PointInLeaf (r_origin, r_worldentity.model);
V_SetContentsColor (r_viewleaf->contents);
// V_CalcBlend ();
r_cache_thrash = false;
@ -896,7 +891,6 @@ R_SetupFrame (void)
}
static void
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);
}
static void
R_SetupGL (void)
{
@ -983,7 +976,6 @@ R_SetupGL (void)
qfglShadeModel (GL_FLAT);
}
static void
R_Clear (void)
{
@ -998,7 +990,6 @@ R_Clear (void)
qfglDepthRange (gldepthmin, gldepthmax);
}
void
R_RenderScene (void)
{
@ -1030,10 +1021,8 @@ R_RenderScene (void)
R_ZGraph ();
}
void R_RenderBrushPoly (msurface_t *fa);
void
R_Mirror (void)
{
@ -1048,7 +1037,8 @@ R_Mirror (void)
d = DotProduct (r_refdef.vieworg, mirror_plane->normal) -
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);
VectorMA (vpn, -2 * d, mirror_plane->normal, vpn);
@ -1093,7 +1083,6 @@ R_Mirror (void)
qfglColor4f (1, 1, 1, 1);
}
/*
R_RenderView
@ -1142,7 +1131,8 @@ qboolean R_CullBlocked (vec3_t mins, vec3_t maxs, vec3_t org)
// Check the origin first
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;
}
@ -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;
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;
}
point[0] = org[0]+rad; point[1] = org[1]; point[2] = org[2]+4;
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;
}
point[0] = org[0]; point[1] = org[1]-rad; point[2] = org[2]+4;
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;
}
point[0] = org[0]-rad; point[1] = org[1]; point[2] = org[2]+4;
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;
}
// 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;
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;
}
point[0] = org[0]; point[1] = org[1]; point[2] = org[2]-rad;
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;
}
@ -1195,48 +1192,56 @@ qboolean R_CullBlocked (vec3_t mins, vec3_t maxs, vec3_t org)
// Check the corners...
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;
}
point[0] = mins[0]; point[1] = maxs[1]; point[2] = maxs[2];
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;
}
point[0] = mins[0]; point[1] = mins[1]; point[2] = maxs[2];
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;
}
point[0] = maxs[0]; point[1] = mins[1]; point[2] = maxs[2];
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;
}
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;
}
point[0] = mins[0]; point[1] = maxs[1]; point[2] = mins[2]+4;
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;
}
point[0] = maxs[0]; point[1] = mins[1]; point[2] = mins[2]+4;
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;
}
point[0] = maxs[0]; point[1] = maxs[1]; point[2] = mins[2]+4;
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;
}

View file

@ -45,12 +45,7 @@
#include "QF/skin.h"
#include "QF/sys.h"
#include "QF/vid.h"
#include "varrays.h"
#include "QF/vfs.h"
#include "r_dynamic.h"
#include "r_local.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_vid.h"
#include "QF/GL/defines.h"
@ -58,6 +53,10 @@
#include "QF/GL/qf_rsurf.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];
qboolean VID_Is8bit (void);
@ -135,7 +134,6 @@ R_Envmap_f (void)
GL_EndRendering ();
}
void
R_LoadSky_f (void)
{
@ -147,7 +145,6 @@ R_LoadSky_f (void)
R_LoadSkys (Cmd_Argv (1));
}
void
R_Init (void)
{
@ -176,7 +173,6 @@ R_Init (void)
qfglVertexPointer (3, GL_FLOAT, sizeof(varray[0]), varray[0].vertex);
}
void
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_TimeRefresh_f
@ -249,7 +244,6 @@ R_TimeRefresh_f (void)
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
}
void
D_FlushCaches (void)
{

View file

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

View file

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

View file

@ -36,18 +36,18 @@
# include <strings.h>
#endif
#include "compat.h"
#include "r_cvar.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/render.h"
#include "QF/skin.h"
#include "QF/texture.h"
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_textures.h"
#include "compat.h"
#include "r_cvar.h"
static byte translate[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
@ -244,5 +245,5 @@ Skin_Process (skin_t *skin, tex_t *tex)
skin->fb_texture = skin_fb_textures + (skin - skin_cache);
build_skin (skin->fb_texture, ptexels, tex->width, tex->height,
296, 194, true);
}
}
}

View file

@ -36,18 +36,12 @@
# include <strings.h>
#endif
#include "compat.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/render.h"
#include "QF/tga.h"
#include "QF/vfs.h"
#include "QF/vid.h"
#include "r_shared.h"
#include "view.h"
#include "r_cvar.h"
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_sky.h"
@ -55,6 +49,11 @@
#include "QF/GL/qf_rlight.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 int skytexturenum;
@ -94,8 +93,8 @@ R_LoadSkys (const char *skyname)
}
targa_rgba = LoadTGA (f);
qfglTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0, GL_RGBA,
GL_UNSIGNED_BYTE, targa_rgba);
qfglTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0,
GL_RGBA, GL_UNSIGNED_BYTE, 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);
}
void
R_SkyBoxPolyVec (vec5_t v)
{
// avoid interpolation seams
// s = s * (254.0/256.0) + (1.0/256.0);
// t = t * (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);
qfglTexCoord2fv (v);
qfglVertex3f (r_refdef.vieworg[0] + v[2],
r_refdef.vieworg[1] + v[3], r_refdef.vieworg[2] + v[4]);
}
#define ftc(x) (x * (254.0/256.0) + (1.0/256.0))
vec5_t skyvec[6][4] = {
{
// right +y
{ftc (1), ftc (0), 1024, 1024, 1024},
{ftc (1), ftc (1), 1024, 1024, -1024},
{ftc (0), ftc (1), -1024, 1024, -1024},
{ftc (0), ftc (0), -1024, 1024, 1024}
},
// right +y
{ftc (1), ftc (0), 1024, 1024, 1024},
{ftc (1), ftc (1), 1024, 1024, -1024},
{ftc (0), ftc (1), -1024, 1024, -1024},
{ftc (0), ftc (0), -1024, 1024, 1024}
},
{
// back -x
{ftc (1), ftc (0), -1024, 1024, 1024},
{ftc (1), ftc (1), -1024, 1024, -1024},
{ftc (0), ftc (1), -1024, -1024, -1024},
{ftc (0), ftc (0), -1024, -1024, 1024}
},
// back -x
{ftc (1), ftc (0), -1024, 1024, 1024},
{ftc (1), ftc (1), -1024, 1024, -1024},
{ftc (0), ftc (1), -1024, -1024, -1024},
{ftc (0), ftc (0), -1024, -1024, 1024}
},
{
// left -y
{ftc (1), ftc (0), -1024, -1024, 1024},
{ftc (1), ftc (1), -1024, -1024, -1024},
{ftc (0), ftc (1), 1024, -1024, -1024},
{ftc (0), ftc (0), 1024, -1024, 1024}
},
// left -y
{ftc (1), ftc (0), -1024, -1024, 1024},
{ftc (1), ftc (1), -1024, -1024, -1024},
{ftc (0), ftc (1), 1024, -1024, -1024},
{ftc (0), ftc (0), 1024, -1024, 1024}
},
{
// front +x
{ftc (1), ftc (0), 1024, -1024, 1024},
{ftc (1), ftc (1), 1024, -1024, -1024},
{ftc (0), ftc (1), 1024, 1024, -1024},
{ftc (0), ftc (0), 1024, 1024, 1024}
},
// front +x
{ftc (1), ftc (0), 1024, -1024, 1024},
{ftc (1), ftc (1), 1024, -1024, -1024},
{ftc (0), ftc (1), 1024, 1024, -1024},
{ftc (0), ftc (0), 1024, 1024, 1024}
},
{
// up +z
{ftc (1), ftc (0), 1024, -1024, 1024},
{ftc (1), ftc (1), 1024, 1024, 1024},
{ftc (0), ftc (1), -1024, 1024, 1024},
{ftc (0), ftc (0), -1024, -1024, 1024}
},
// up +z
{ftc (1), ftc (0), 1024, -1024, 1024},
{ftc (1), ftc (1), 1024, 1024, 1024},
{ftc (0), ftc (1), -1024, 1024, 1024},
{ftc (0), ftc (0), -1024, -1024, 1024}
},
{
// down -z
{ftc (1), ftc (0), 1024, 1024, -1024},
{ftc (1), ftc (1), 1024, -1024, -1024},
{ftc (0), ftc (1), -1024, -1024, -1024},
{ftc (0), ftc (0), -1024, 1024, -1024}
}
// down -z
{ftc (1), ftc (0), 1024, 1024, -1024},
{ftc (1), ftc (1), 1024, -1024, -1024},
{ftc (0), ftc (1), -1024, -1024, -1024},
{ftc (0), ftc (0), -1024, 1024, -1024}
}
};
#undef ftc
void
R_DrawSkyBox (void)
{
@ -186,7 +182,6 @@ R_DrawSkyBox (void)
qfglDepthRange (gldepthmin, gldepthmax);
}
vec3_t domescale;
void
@ -215,16 +210,16 @@ R_DrawSkyLayer (float s)
v[2] = y * domescale[2];
qfglTexCoord2f ((v[0] + s) * (1.0 / 128.0),
(v[1] + s) * (1.0 / 128.0));
qfglVertex3f (v[0] + r_refdef.vieworg[0],
v[1] + r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]);
qfglVertex3f (v[0] + r_refdef.vieworg[0], v[1] +
r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]);
v[0] = a2x * x;
v[1] = a2y * x;
v[2] = y * domescale[2];
qfglTexCoord2f ((v[0] + s) * (1.0 / 128.0),
(v[1] + s) * (1.0 / 128.0));
qfglVertex3f (v[0] + r_refdef.vieworg[0],
v[1] + r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]);
qfglVertex3f (v[0] + r_refdef.vieworg[0], v[1] +
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));
qfglVertex3f (r_refdef.vieworg[0],
@ -233,7 +228,6 @@ R_DrawSkyLayer (float s)
}
}
void
R_DrawSkyDome (void)
{
@ -267,7 +261,6 @@ R_DrawSkyDome (void)
qfglDepthRange (gldepthmin, gldepthmax);
}
void
R_DrawSky (void)
{
@ -277,7 +270,6 @@ R_DrawSky (void)
R_DrawSkyDome ();
}
/*
R_InitSky
@ -314,7 +306,6 @@ 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);
@ -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_MAG_FILTER, GL_LINEAR);
for (i = 0; i < 128; i++)
for (j = 0; j < 128; j++) {
p = src[i * 256 + j];

View file

@ -39,15 +39,14 @@
#include <stdarg.h>
#include "QF/cvar.h"
#include "QF/render.h"
#include "QF/sys.h"
#include "QF/GL/defines.h"
#include "QF/GL/funcs.h"
#include "QF/GL/qf_sky.h"
#include "QF/GL/qf_vid.h"
#include "QF/cvar.h"
#include "QF/render.h"
#include "QF/sys.h"
#include "view.h"
#include "r_cvar.h"
@ -147,7 +146,6 @@ determine_face (vec3_t v)
return i;
}
/*
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;
}
/*
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];
}
/*
set_vertex
@ -267,7 +263,6 @@ set_vertex (struct box_def *box, int face, int ind, vec3_t v)
}
}
/*
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);
}
/*
insert_cube_vertices
@ -332,7 +326,6 @@ insert_cube_vertices (struct box_def *box, struct visit_def visit, int count,
}
}
/*
cross_cube_edge
@ -374,7 +367,6 @@ cross_cube_edge (struct box_def *box, int face1, vec3_t v1, int face2,
}
}
/*
process_corners
@ -579,7 +571,6 @@ process_corners (struct box_def *box)
}
}
/*
render_box
@ -603,7 +594,6 @@ render_box (struct box_def *box)
}
}
void
R_DrawSkyBoxPoly (glpoly_t *poly)
{
@ -662,7 +652,6 @@ R_DrawSkyBoxPoly (glpoly_t *poly)
render_box (&box);
}
void
R_DrawSkyDomePoly (glpoly_t *poly)
{

View file

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

View file

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

View file

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