mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
extinguish gl_fires. it's semi-broken, generally nasty (code wise) and
kinda tacky. also results in a slight speed boost:)
This commit is contained in:
parent
82095df9cf
commit
e99b422628
8 changed files with 7 additions and 267 deletions
|
@ -70,11 +70,9 @@ extern lightstyle_t r_lightstyle[MAX_LIGHTSTYLES];
|
|||
typedef struct entity_s
|
||||
{
|
||||
qboolean forcelink; // model changed
|
||||
int update_type;
|
||||
struct entity_state_s *baseline; // to fill in defaults in updates
|
||||
double msgtime; // time of last update
|
||||
|
||||
int keynum; // for matching entities in different frames
|
||||
vec3_t origin;
|
||||
vec3_t old_origin;
|
||||
vec3_t angles;
|
||||
|
@ -103,7 +101,7 @@ typedef struct entity_s
|
|||
float glow_size; // how big the glow is (can be negative)
|
||||
byte glow_color; // color of glow (paletted)
|
||||
|
||||
// FIXME: could turn these into a union
|
||||
// FIXME: could turn these into a union
|
||||
int trivial_accept;
|
||||
struct mnode_s *topnode; // for bmodels, first world node that
|
||||
// splits bmodel, or NULL if not split
|
||||
|
|
|
@ -16,7 +16,6 @@ extern struct cvar_s *gl_dlight_polyblend;
|
|||
extern struct cvar_s *gl_dlight_smooth;
|
||||
extern struct cvar_s *gl_fb_bmodels;
|
||||
extern struct cvar_s *gl_fb_models;
|
||||
extern struct cvar_s *gl_fires;
|
||||
extern struct cvar_s *gl_keeptjunctions;
|
||||
extern struct cvar_s *gl_lerp_anim;
|
||||
extern struct cvar_s *gl_driver;
|
||||
|
|
|
@ -81,22 +81,4 @@ extern struct particle_s *free_particles;
|
|||
extern struct particle_s *particles;
|
||||
extern struct particle_s **freeparticles;
|
||||
|
||||
#define MAX_FIRES 128 // rocket flames
|
||||
|
||||
typedef struct {
|
||||
int key; // allows reusability
|
||||
vec3_t origin, owner;
|
||||
float size;
|
||||
float die, decay; // duration settings
|
||||
float minlight; // lighting threshold
|
||||
float color[3]; // RGB
|
||||
} fire_t;
|
||||
|
||||
extern fire_t r_fires[];
|
||||
|
||||
void R_AddFire (vec3_t start, vec3_t end, struct entity_s *ent);
|
||||
void R_UpdateFires (void);
|
||||
fire_t *R_AllocFire (int key);
|
||||
void R_ClearFires (void);
|
||||
|
||||
#endif // _R_DYNAMIC_H
|
||||
|
|
|
@ -9,7 +9,7 @@ noinst_LTLIBRARIES=
|
|||
endif
|
||||
|
||||
gl_src = \
|
||||
gl_draw.c gl_dyn_fires.c gl_dyn_lights.c \
|
||||
gl_draw.c gl_dyn_lights.c \
|
||||
gl_dyn_part.c gl_dyn_textures.c gl_graph.c gl_mod_alias.c gl_mod_sprite.c \
|
||||
gl_rmain.c gl_rmisc.c gl_rsurf.c gl_screen.c gl_skin.c gl_sky.c \
|
||||
gl_sky_clip.c gl_textures.c gl_warp.c gl_funcs.c noisetextures.c
|
||||
|
|
|
@ -1,228 +0,0 @@
|
|||
/*
|
||||
gl_dyn_fires.c
|
||||
|
||||
dynamic fires
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/render.h"
|
||||
#include "QF/GL/defines.h"
|
||||
#include "QF/GL/funcs.h"
|
||||
#include "QF/GL/qf_rlight.h"
|
||||
|
||||
#include "r_cvar.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "r_shared.h"
|
||||
#include "view.h"
|
||||
|
||||
fire_t r_fires[MAX_FIRES];
|
||||
|
||||
|
||||
static void
|
||||
AddLightBlend (float r, float g, float b, float a2)
|
||||
{
|
||||
float a;
|
||||
|
||||
v_blend[3] = a = v_blend[3] + a2 * (1 - v_blend[3]);
|
||||
|
||||
a2 = a2 / a;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
|
||||
draws one fireball - probably never need to call this directly
|
||||
*/
|
||||
static void
|
||||
R_DrawFire (fire_t *f)
|
||||
{
|
||||
float radius;
|
||||
float *b_sin, *b_cos;
|
||||
int i, j;
|
||||
vec3_t vec, vec2;
|
||||
|
||||
b_sin = bubble_sintable;
|
||||
b_cos = bubble_costable;
|
||||
|
||||
radius = f->size - 0.5;
|
||||
|
||||
// figure out if we're inside the area of effect
|
||||
VectorSubtract (f->origin, r_origin, vec);
|
||||
if (Length (vec) < radius) {
|
||||
AddLightBlend (f->color[0], f->color[1], f->color[2],
|
||||
f->size * 0.0003); // we are
|
||||
return;
|
||||
}
|
||||
// we're not - draw it
|
||||
qfglBegin (GL_TRIANGLE_FAN);
|
||||
qfglColor3fv (f->color);
|
||||
for (i = 0; i < 3; i++)
|
||||
vec[i] = f->origin[i] - vpn[i] * radius;
|
||||
qfglVertex3fv (vec);
|
||||
qfglColor3ubv (color_black);
|
||||
|
||||
// don't panic, this just draws a bubble...
|
||||
for (i = 16; i >= 0; i--) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
vec[j] = f->origin[j] + (*b_cos * vright[j]
|
||||
+ vup[j] * (*b_sin)) * radius;
|
||||
vec2[j] = f->owner[j] + (*b_cos * vright[j]
|
||||
+ vup[j] * (*b_sin)) * radius;
|
||||
}
|
||||
qfglVertex3fv (vec);
|
||||
qfglVertex3fv (vec2);
|
||||
|
||||
b_sin += 2;
|
||||
b_cos += 2;
|
||||
}
|
||||
qfglEnd ();
|
||||
}
|
||||
|
||||
/*
|
||||
R_UpdateFires
|
||||
|
||||
Draws each fireball in sequence
|
||||
*/
|
||||
void
|
||||
R_UpdateFires (void)
|
||||
{
|
||||
int i;
|
||||
fire_t *f;
|
||||
|
||||
if (!gl_fires->int_val)
|
||||
return;
|
||||
|
||||
qfglDepthMask (GL_FALSE);
|
||||
qfglDisable (GL_TEXTURE_2D);
|
||||
qfglBlendFunc (GL_ONE, GL_ONE);
|
||||
|
||||
f = r_fires;
|
||||
for (i = 0; i < MAX_FIRES; i++, f++) {
|
||||
if (f->die < r_realtime || !f->size)
|
||||
continue;
|
||||
f->size += f->decay;
|
||||
R_DrawFire (f);
|
||||
}
|
||||
|
||||
qfglColor3ubv (color_white);
|
||||
qfglEnable (GL_TEXTURE_2D);
|
||||
qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
qfglDepthMask (GL_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
R_ClearFires (void)
|
||||
{
|
||||
memset (r_fires, 0, sizeof (r_fires));
|
||||
}
|
||||
|
|
@ -111,12 +111,6 @@ inline void
|
|||
R_ClearParticles (void)
|
||||
{
|
||||
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
|
||||
|
@ -420,8 +414,6 @@ R_RocketTrail (entity_t *ent)
|
|||
if (numparticles >= r_maxparticles)
|
||||
return;
|
||||
|
||||
R_AddFire (ent->old_origin, ent->origin, ent);
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
maxlen = VectorNormalize (vec);
|
||||
origlen = r_frametime / maxlen;
|
||||
|
|
|
@ -486,7 +486,6 @@ R_RenderView (void)
|
|||
R_RenderScene ();
|
||||
R_DrawViewModel ();
|
||||
R_DrawWaterSurfaces ();
|
||||
R_UpdateFires ();
|
||||
R_DrawParticles ();
|
||||
|
||||
// render mirror view
|
||||
|
|
|
@ -425,7 +425,6 @@ CL_LinkPacketEntities (void)
|
|||
|
||||
*ent = &cl_packet_ents[s1->number];
|
||||
|
||||
(*ent)->keynum = s1->number;
|
||||
(*ent)->model = model = cl.model_precache[s1->modelindex];
|
||||
|
||||
// set colormap
|
||||
|
@ -499,7 +498,7 @@ CL_LinkPacketEntities (void)
|
|||
continue;
|
||||
|
||||
if (model->flags & EF_ROCKET) {
|
||||
dl = R_AllocDlight (-(*ent)->keynum);
|
||||
dl = R_AllocDlight (-s1->number);
|
||||
VectorCopy ((*ent)->origin, dl->origin);
|
||||
VectorCopy (r_firecolor->vec, dl->color);
|
||||
dl->radius = 200;
|
||||
|
@ -681,7 +680,7 @@ CL_ParsePlayerinfo (void)
|
|||
Called when the CTF flags are set
|
||||
*/
|
||||
void
|
||||
CL_AddFlagModels (entity_t *ent, int team)
|
||||
CL_AddFlagModels (entity_t *ent, int team, int key)
|
||||
{
|
||||
float f;
|
||||
int i;
|
||||
|
@ -734,7 +733,7 @@ CL_AddFlagModels (entity_t *ent, int team)
|
|||
newent = R_NewEntity ();
|
||||
if (!newent)
|
||||
return;
|
||||
*newent = &cl_flag_ents[ent->keynum];
|
||||
*newent = &cl_flag_ents[key];
|
||||
(*newent)->model = cl.model_precache[cl_flagindex];
|
||||
(*newent)->skinnum = team;
|
||||
|
||||
|
@ -815,7 +814,6 @@ CL_LinkPlayers (void)
|
|||
ent = *_ent = &cl_player_ents[j];
|
||||
|
||||
ent->frame = state->frame;
|
||||
ent->keynum = j;
|
||||
ent->model = cl.model_precache[state->modelindex];
|
||||
ent->skinnum = state->skinnum;
|
||||
ent->colormap = info->translations;
|
||||
|
@ -872,9 +870,9 @@ CL_LinkPlayers (void)
|
|||
}
|
||||
|
||||
if (state->effects & EF_FLAG1)
|
||||
CL_AddFlagModels (ent, 0);
|
||||
CL_AddFlagModels (ent, 0, j);
|
||||
else if (state->effects & EF_FLAG2)
|
||||
CL_AddFlagModels (ent, 1);
|
||||
CL_AddFlagModels (ent, 1, j);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue