mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
Move gl_fires into gl, where it belongs.
Also some small cleanups in particles. Brighten grenade smoke a tiny bit, so it's not so invisible in the typically dark quake areas. And some minor cleanups to water rendering.
This commit is contained in:
parent
e97a4b7ce7
commit
4d406337b6
8 changed files with 114 additions and 122 deletions
|
@ -52,9 +52,10 @@ static const char rcsid[] =
|
||||||
#include "r_shared.h"
|
#include "r_shared.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
||||||
|
fire_t r_fires[MAX_FIRES];
|
||||||
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
AddLightBlend (float r, float g, float b, float a2)
|
AddLightBlend (float r, float g, float b, float a2)
|
||||||
{
|
{
|
||||||
float a;
|
float a;
|
||||||
|
@ -68,12 +69,81 @@ AddLightBlend (float r, float g, float b, float a2)
|
||||||
v_blend[2] = v_blend[2] * (1 - a2) + b * a2;
|
v_blend[2] = v_blend[2] * (1 - a2) + b * a2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
R_AddFire
|
||||||
|
|
||||||
|
Buggy GL fire trail effect. A meshing of polyblend dlights and
|
||||||
|
particle engine.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
R_AddFire (vec3_t start, vec3_t end, entity_t *ent)
|
||||||
|
{
|
||||||
|
float len;
|
||||||
|
int key;
|
||||||
|
fire_t *f;
|
||||||
|
vec3_t vec;
|
||||||
|
|
||||||
|
if (!gl_fires->int_val)
|
||||||
|
return;
|
||||||
|
|
||||||
|
VectorSubtract (end, start, vec);
|
||||||
|
len = VectorNormalize (vec);
|
||||||
|
key = ent->keynum;
|
||||||
|
|
||||||
|
if (len) {
|
||||||
|
f = R_AllocFire (key);
|
||||||
|
VectorCopy (end, f->origin);
|
||||||
|
VectorCopy (start, f->owner);
|
||||||
|
f->size = 10;
|
||||||
|
f->die = r_realtime + 0.5;
|
||||||
|
f->decay = 1;
|
||||||
|
VectorCopy (r_firecolor->vec, f->color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
R_AllocFire
|
||||||
|
|
||||||
|
Clears out and returns a new fireball
|
||||||
|
*/
|
||||||
|
fire_t *
|
||||||
|
R_AllocFire (int key)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
fire_t *f;
|
||||||
|
|
||||||
|
if (key) // first, try to find/reuse a keyed spot
|
||||||
|
{
|
||||||
|
f = r_fires;
|
||||||
|
for (i = 0; i < MAX_FIRES; i++, f++)
|
||||||
|
if (f->key == key) {
|
||||||
|
memset (f, 0, sizeof (*f));
|
||||||
|
f->key = key;
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
f = r_fires; // no match, look for a free spot
|
||||||
|
for (i = 0; i < MAX_FIRES; i++, f++) {
|
||||||
|
if (f->die < r_realtime) {
|
||||||
|
memset (f, 0, sizeof (*f));
|
||||||
|
f->key = key;
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
f = &r_fires[0];
|
||||||
|
memset (f, 0, sizeof (*f));
|
||||||
|
f->key = key;
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
R_DrawFire
|
R_DrawFire
|
||||||
|
|
||||||
draws one fireball - probably never need to call this directly
|
draws one fireball - probably never need to call this directly
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
R_DrawFire (fire_t *f)
|
R_DrawFire (fire_t *f)
|
||||||
{
|
{
|
||||||
float radius;
|
float radius;
|
||||||
|
@ -149,3 +219,10 @@ R_UpdateFires (void)
|
||||||
qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
qfglDepthMask (GL_TRUE);
|
qfglDepthMask (GL_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
R_ClearFires (void)
|
||||||
|
{
|
||||||
|
memset (r_fires, 0, sizeof (r_fires));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,12 @@ inline void
|
||||||
R_ClearParticles (void)
|
R_ClearParticles (void)
|
||||||
{
|
{
|
||||||
numparticles = 0;
|
numparticles = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
FIXME: this is better than doing it in the client, and having gl-only
|
||||||
|
code in the renderer common area, but this is still the wrong place.
|
||||||
|
*/
|
||||||
|
R_ClearFires ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -408,7 +414,7 @@ void
|
||||||
R_RocketTrail (entity_t *ent)
|
R_RocketTrail (entity_t *ent)
|
||||||
{
|
{
|
||||||
float dist, maxlen, origlen, percent, pscale, pscalenext;
|
float dist, maxlen, origlen, percent, pscale, pscalenext;
|
||||||
float len = 0;
|
float len = 0.0;
|
||||||
vec3_t subtract, vec;
|
vec3_t subtract, vec;
|
||||||
|
|
||||||
if (numparticles >= r_maxparticles)
|
if (numparticles >= r_maxparticles)
|
||||||
|
@ -446,7 +452,7 @@ void
|
||||||
R_GrenadeTrail (entity_t *ent)
|
R_GrenadeTrail (entity_t *ent)
|
||||||
{
|
{
|
||||||
float dist, maxlen, origlen, percent, pscale, pscalenext;
|
float dist, maxlen, origlen, percent, pscale, pscalenext;
|
||||||
float len = 0;
|
float len = 0.0;
|
||||||
vec3_t subtract, vec;
|
vec3_t subtract, vec;
|
||||||
|
|
||||||
if (numparticles >= r_maxparticles)
|
if (numparticles >= r_maxparticles)
|
||||||
|
@ -468,7 +474,7 @@ R_GrenadeTrail (entity_t *ent)
|
||||||
particle_new (pt_smoke, part_tex_smoke, ent->old_origin,
|
particle_new (pt_smoke, part_tex_smoke, ent->old_origin,
|
||||||
pscale + percent * 4.0, vec3_origin,
|
pscale + percent * 4.0, vec3_origin,
|
||||||
r_realtime + 2.0 - percent * 2.0,
|
r_realtime + 2.0 - percent * 2.0,
|
||||||
(rand () & 3),
|
1 + (rand () & 3),
|
||||||
160 + (rand () & 31) - percent * 100.0);
|
160 + (rand () & 31) - percent * 100.0);
|
||||||
if (numparticles >= r_maxparticles)
|
if (numparticles >= r_maxparticles)
|
||||||
break;
|
break;
|
||||||
|
@ -481,7 +487,7 @@ void
|
||||||
R_BloodTrail (entity_t *ent)
|
R_BloodTrail (entity_t *ent)
|
||||||
{
|
{
|
||||||
float dist, maxlen, origlen, percent, pscale, pscalenext;
|
float dist, maxlen, origlen, percent, pscale, pscalenext;
|
||||||
float len = 0;
|
float len = 0.0;
|
||||||
int j;
|
int j;
|
||||||
vec3_t subtract, vec, porg, pvel;
|
vec3_t subtract, vec, porg, pvel;
|
||||||
|
|
||||||
|
@ -566,8 +572,8 @@ R_SlightBloodTrail (entity_t *ent)
|
||||||
void
|
void
|
||||||
R_GreenTrail (entity_t *ent)
|
R_GreenTrail (entity_t *ent)
|
||||||
{
|
{
|
||||||
float dist, maxlen, origlen, percent;
|
float maxlen, origlen, percent;
|
||||||
float len = 0;
|
float dist = 3.0, len = 0.0;
|
||||||
static int tracercount;
|
static int tracercount;
|
||||||
vec3_t subtract, vec, pvel;
|
vec3_t subtract, vec, pvel;
|
||||||
|
|
||||||
|
@ -577,17 +583,16 @@ R_GreenTrail (entity_t *ent)
|
||||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||||
maxlen = VectorNormalize (vec);
|
maxlen = VectorNormalize (vec);
|
||||||
origlen = r_frametime / maxlen;
|
origlen = r_frametime / maxlen;
|
||||||
dist = 3.0;
|
|
||||||
|
|
||||||
while (len < maxlen) {
|
while (len < maxlen) {
|
||||||
VectorCopy (vec3_origin, pvel);
|
VectorCopy (vec3_origin, pvel);
|
||||||
tracercount++;
|
tracercount++;
|
||||||
if (tracercount & 1) {
|
if (tracercount & 1) {
|
||||||
pvel[0] = 30 * vec[1];
|
pvel[0] = 30.0 * vec[1];
|
||||||
pvel[1] = 30 * -vec[0];
|
pvel[1] = 30.0 * -vec[0];
|
||||||
} else {
|
} else {
|
||||||
pvel[0] = 30 * -vec[1];
|
pvel[0] = 30.0 * -vec[1];
|
||||||
pvel[1] = 30 * vec[0];
|
pvel[1] = 30.0 * vec[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorScale (vec, min(dist, len), subtract);
|
VectorScale (vec, min(dist, len), subtract);
|
||||||
|
@ -607,8 +612,8 @@ R_GreenTrail (entity_t *ent)
|
||||||
void
|
void
|
||||||
R_FlameTrail (entity_t *ent)
|
R_FlameTrail (entity_t *ent)
|
||||||
{
|
{
|
||||||
float dist, maxlen, origlen, percent;
|
float maxlen, origlen, percent;
|
||||||
float len = 0;
|
float dist = 3.0, len = 0.0;
|
||||||
static int tracercount;
|
static int tracercount;
|
||||||
vec3_t subtract, vec, pvel;
|
vec3_t subtract, vec, pvel;
|
||||||
|
|
||||||
|
@ -618,17 +623,16 @@ R_FlameTrail (entity_t *ent)
|
||||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||||
maxlen = VectorNormalize (vec);
|
maxlen = VectorNormalize (vec);
|
||||||
origlen = r_frametime / maxlen;
|
origlen = r_frametime / maxlen;
|
||||||
dist = 3.0;
|
|
||||||
|
|
||||||
while (len < maxlen) {
|
while (len < maxlen) {
|
||||||
VectorCopy (vec3_origin, pvel);
|
VectorCopy (vec3_origin, pvel);
|
||||||
tracercount++;
|
tracercount++;
|
||||||
if (tracercount & 1) {
|
if (tracercount & 1) {
|
||||||
pvel[0] = 30 * vec[1];
|
pvel[0] = 30.0 * vec[1];
|
||||||
pvel[1] = 30 * -vec[0];
|
pvel[1] = 30.0 * -vec[0];
|
||||||
} else {
|
} else {
|
||||||
pvel[0] = 30 * -vec[1];
|
pvel[0] = 30.0 * -vec[1];
|
||||||
pvel[1] = 30 * vec[0];
|
pvel[1] = 30.0 * vec[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorScale (vec, min(dist, len), subtract);
|
VectorScale (vec, min(dist, len), subtract);
|
||||||
|
@ -648,8 +652,8 @@ R_FlameTrail (entity_t *ent)
|
||||||
void
|
void
|
||||||
R_VoorTrail (entity_t *ent)
|
R_VoorTrail (entity_t *ent)
|
||||||
{
|
{
|
||||||
float dist, maxlen, origlen, percent;
|
float maxlen, origlen, percent;
|
||||||
float len = 0;
|
float dist = 3.0, len = 0.0;
|
||||||
int j;
|
int j;
|
||||||
vec3_t subtract, vec, porg;
|
vec3_t subtract, vec, porg;
|
||||||
|
|
||||||
|
@ -659,7 +663,6 @@ R_VoorTrail (entity_t *ent)
|
||||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||||
maxlen = VectorNormalize (vec);
|
maxlen = VectorNormalize (vec);
|
||||||
origlen = r_frametime / maxlen;
|
origlen = r_frametime / maxlen;
|
||||||
dist = 3.0;
|
|
||||||
|
|
||||||
while (len < maxlen) {
|
while (len < maxlen) {
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
|
@ -681,7 +684,6 @@ R_VoorTrail (entity_t *ent)
|
||||||
void
|
void
|
||||||
R_DrawParticles (void)
|
R_DrawParticles (void)
|
||||||
{
|
{
|
||||||
// byte i;
|
|
||||||
unsigned char *at;
|
unsigned char *at;
|
||||||
float dvel, grav, fast_grav, minparticledist, scale,
|
float dvel, grav, fast_grav, minparticledist, scale,
|
||||||
bloodcloud_alpha, bloodcloud_scale, fallfadespark_alpha,
|
bloodcloud_alpha, bloodcloud_scale, fallfadespark_alpha,
|
||||||
|
|
|
@ -439,6 +439,7 @@ R_Mirror (void)
|
||||||
qfglDepthRange (gldepthmin, gldepthmax);
|
qfglDepthRange (gldepthmin, gldepthmax);
|
||||||
|
|
||||||
R_RenderScene ();
|
R_RenderScene ();
|
||||||
|
R_DrawWaterSurfaces ();
|
||||||
|
|
||||||
gldepthmin = 0;
|
gldepthmin = 0;
|
||||||
gldepthmax = 1;
|
gldepthmax = 1;
|
||||||
|
@ -484,6 +485,7 @@ R_RenderView (void)
|
||||||
// render normal view
|
// render normal view
|
||||||
R_RenderScene ();
|
R_RenderScene ();
|
||||||
R_DrawViewModel ();
|
R_DrawViewModel ();
|
||||||
|
R_DrawWaterSurfaces ();
|
||||||
R_UpdateFires ();
|
R_UpdateFires ();
|
||||||
R_DrawParticles ();
|
R_DrawParticles ();
|
||||||
|
|
||||||
|
|
|
@ -782,10 +782,10 @@ R_RecursiveWorldNode (mnode_t *node)
|
||||||
continue; // wrong side
|
continue; // wrong side
|
||||||
|
|
||||||
if (surf->flags & SURF_DRAWTURB) {
|
if (surf->flags & SURF_DRAWTURB) {
|
||||||
if (r_wateralpha->value < 1.0)
|
// if (r_wateralpha->value < 1.0) // FIXME: DESPAIR
|
||||||
CHAIN_SURF_B2F (surf, waterchain);
|
CHAIN_SURF_B2F (surf, waterchain);
|
||||||
else
|
// else
|
||||||
CHAIN_SURF (surf, waterchain);
|
// CHAIN_SURF (surf, waterchain);
|
||||||
} else if (surf->flags & SURF_DRAWSKY) {
|
} else if (surf->flags & SURF_DRAWSKY) {
|
||||||
CHAIN_SURF (surf, sky_chain);
|
CHAIN_SURF (surf, sky_chain);
|
||||||
} else if (gl_mtex_active) {
|
} else if (gl_mtex_active) {
|
||||||
|
@ -824,9 +824,6 @@ R_DrawWorld (void)
|
||||||
|
|
||||||
R_DrawSkyChain (sky_chain);
|
R_DrawSkyChain (sky_chain);
|
||||||
|
|
||||||
if (r_wateralpha->value >= 1.0)
|
|
||||||
R_DrawWaterSurfaces ();
|
|
||||||
|
|
||||||
DrawTextureChains ();
|
DrawTextureChains ();
|
||||||
|
|
||||||
if (!gl_mtex_active)
|
if (!gl_mtex_active)
|
||||||
|
@ -834,9 +831,6 @@ R_DrawWorld (void)
|
||||||
|
|
||||||
if (gl_fb_bmodels->int_val)
|
if (gl_fb_bmodels->int_val)
|
||||||
R_RenderFullbrights ();
|
R_RenderFullbrights ();
|
||||||
|
|
||||||
if (r_wateralpha->value < 1.0)
|
|
||||||
R_DrawWaterSurfaces ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -150,8 +150,6 @@ int scr_erase_lines;
|
||||||
int scr_erase_center;
|
int scr_erase_center;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SCR_CenterPrint
|
SCR_CenterPrint
|
||||||
|
|
||||||
|
@ -235,7 +233,7 @@ SCR_CheckDrawCenterString (int swap)
|
||||||
SCR_DrawCenterString ();
|
SCR_DrawCenterString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
static float
|
||||||
CalcFov (float fov_x, float width, float height)
|
CalcFov (float fov_x, float width, float height)
|
||||||
{
|
{
|
||||||
float a, x;
|
float a, x;
|
||||||
|
|
|
@ -45,8 +45,6 @@ static const char rcsid[] =
|
||||||
#include "QF/render.h"
|
#include "QF/render.h"
|
||||||
|
|
||||||
#include "r_cvar.h"
|
#include "r_cvar.h"
|
||||||
#include "r_dynamic.h"
|
|
||||||
#include "r_local.h"
|
|
||||||
|
|
||||||
qboolean r_inhibit_viewmodel;
|
qboolean r_inhibit_viewmodel;
|
||||||
qboolean r_force_fullscreen;
|
qboolean r_force_fullscreen;
|
||||||
|
@ -55,88 +53,9 @@ double r_realtime;
|
||||||
double r_frametime;
|
double r_frametime;
|
||||||
entity_t *r_view_model;
|
entity_t *r_view_model;
|
||||||
entity_t *r_player_entity;
|
entity_t *r_player_entity;
|
||||||
|
float r_time1;
|
||||||
int r_lineadj;
|
int r_lineadj;
|
||||||
qboolean r_active;
|
qboolean r_active;
|
||||||
float r_time1;
|
|
||||||
|
|
||||||
byte color_white[4] = { 255, 255, 255, 0 }; // alpha will be explicitly set
|
byte color_white[4] = { 255, 255, 255, 0 }; // alpha will be explicitly set
|
||||||
byte color_black[4] = { 0, 0, 0, 0 }; // alpha will be explicitly set
|
byte color_black[4] = { 0, 0, 0, 0 }; // alpha will be explicitly set
|
||||||
|
|
||||||
fire_t r_fires[MAX_FIRES];
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
R_ClearFires (void)
|
|
||||||
{
|
|
||||||
memset (r_fires, 0, sizeof (r_fires));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
R_AddFire
|
|
||||||
|
|
||||||
Nifty ball of fire GL effect. Kinda a meshing of the dlight and
|
|
||||||
particle engine code.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
R_AddFire (vec3_t start, vec3_t end, entity_t *ent)
|
|
||||||
{
|
|
||||||
float len;
|
|
||||||
fire_t *f;
|
|
||||||
vec3_t vec;
|
|
||||||
int key;
|
|
||||||
|
|
||||||
if (!gl_fires->int_val)
|
|
||||||
return;
|
|
||||||
|
|
||||||
VectorSubtract (end, start, vec);
|
|
||||||
len = VectorNormalize (vec);
|
|
||||||
key = ent->keynum;
|
|
||||||
|
|
||||||
if (len) {
|
|
||||||
f = R_AllocFire (key);
|
|
||||||
VectorCopy (end, f->origin);
|
|
||||||
VectorCopy (start, f->owner);
|
|
||||||
f->size = 10;
|
|
||||||
f->die = r_realtime + 0.5;
|
|
||||||
f->decay = 1;
|
|
||||||
VectorCopy (r_firecolor->vec, f->color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
R_AllocFire
|
|
||||||
|
|
||||||
Clears out and returns a new fireball
|
|
||||||
*/
|
|
||||||
fire_t *
|
|
||||||
R_AllocFire (int key)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
fire_t *f;
|
|
||||||
|
|
||||||
if (key) // first try to find/reuse a keyed
|
|
||||||
// spot
|
|
||||||
{
|
|
||||||
f = r_fires;
|
|
||||||
for (i = 0; i < MAX_FIRES; i++, f++)
|
|
||||||
if (f->key == key) {
|
|
||||||
memset (f, 0, sizeof (*f));
|
|
||||||
f->key = key;
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
f = r_fires; // no match, look for a free spot
|
|
||||||
for (i = 0; i < MAX_FIRES; i++, f++) {
|
|
||||||
if (f->die < r_realtime) {
|
|
||||||
memset (f, 0, sizeof (*f));
|
|
||||||
f->key = key;
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
f = &r_fires[0];
|
|
||||||
memset (f, 0, sizeof (*f));
|
|
||||||
f->key = key;
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ CL_ClearState (void)
|
||||||
|
|
||||||
R_ClearEfrags ();
|
R_ClearEfrags ();
|
||||||
R_ClearDlights ();
|
R_ClearDlights ();
|
||||||
R_ClearFires ();
|
R_ClearParticles (); // FIXME: for R_ClearFires
|
||||||
|
|
||||||
for (i = 0; i < MAX_EDICTS; i++) {
|
for (i = 0; i < MAX_EDICTS; i++) {
|
||||||
cl_entities[i].baseline = &cl_baselines[i];
|
cl_entities[i].baseline = &cl_baselines[i];
|
||||||
|
|
|
@ -419,7 +419,7 @@ CL_ClearState (void)
|
||||||
|
|
||||||
R_ClearEfrags ();
|
R_ClearEfrags ();
|
||||||
R_ClearDlights ();
|
R_ClearDlights ();
|
||||||
R_ClearFires ();
|
R_ClearParticles (); // FIXME: for R_ClearFires in GL
|
||||||
|
|
||||||
// wipe the entire cl structure
|
// wipe the entire cl structure
|
||||||
Info_Destroy (cl.serverinfo);
|
Info_Destroy (cl.serverinfo);
|
||||||
|
@ -1528,7 +1528,7 @@ Host_Frame (float time)
|
||||||
pass1 + pass2 + pass3, pass1, pass2, pass3);
|
pass1 + pass2 + pass3, pass1, pass2, pass3);
|
||||||
}
|
}
|
||||||
|
|
||||||
CL_TimeFrames_AddTimestamp ();
|
// CL_TimeFrames_AddTimestamp ();
|
||||||
|
|
||||||
host_framecount++;
|
host_framecount++;
|
||||||
fps_count++;
|
fps_count++;
|
||||||
|
|
Loading…
Reference in a new issue