mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-18 09:51:40 +00:00
[renderer] Clean up particles a little
The quake-specific enums are now in the client header, and the particle system now has a gravity field rather than getting it from vid_render_data (which I hope to eventually get rid of entirely).
This commit is contained in:
parent
ca9e18b9d6
commit
75d7f4cecb
8 changed files with 32 additions and 24 deletions
|
@ -142,7 +142,6 @@ typedef struct vid_render_data_s {
|
||||||
qboolean paused;
|
qboolean paused;
|
||||||
int lineadj;
|
int lineadj;
|
||||||
struct entity_s *view_model;
|
struct entity_s *view_model;
|
||||||
float gravity;
|
|
||||||
double frametime;
|
double frametime;
|
||||||
double realtime;
|
double realtime;
|
||||||
lightstyle_t *lightstyle;
|
lightstyle_t *lightstyle;
|
||||||
|
|
|
@ -35,25 +35,6 @@
|
||||||
#include "QF/simd/types.h"
|
#include "QF/simd/types.h"
|
||||||
#include "QF/ui/vrect.h"
|
#include "QF/ui/vrect.h"
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
pt_static,
|
|
||||||
pt_grav,
|
|
||||||
pt_slowgrav,
|
|
||||||
pt_fire,
|
|
||||||
pt_explode,
|
|
||||||
pt_explode2,
|
|
||||||
pt_blob,
|
|
||||||
pt_blob2,
|
|
||||||
pt_smoke,
|
|
||||||
pt_smokecloud,
|
|
||||||
pt_bloodcloud,
|
|
||||||
pt_fadespark,
|
|
||||||
pt_fadespark2,
|
|
||||||
pt_fallfade,
|
|
||||||
pt_fallfadespark,
|
|
||||||
pt_flame
|
|
||||||
} ptype_t;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
part_tex_dot,
|
part_tex_dot,
|
||||||
part_tex_spark,
|
part_tex_spark,
|
||||||
|
@ -91,6 +72,7 @@ typedef struct partparm_s {
|
||||||
} partparm_t;
|
} partparm_t;
|
||||||
|
|
||||||
typedef struct psystem_s {
|
typedef struct psystem_s {
|
||||||
|
vec4f_t gravity;
|
||||||
uint32_t maxparticles;
|
uint32_t maxparticles;
|
||||||
uint32_t numparticles;
|
uint32_t numparticles;
|
||||||
particle_t *particles;
|
particle_t *particles;
|
||||||
|
|
|
@ -29,6 +29,25 @@
|
||||||
|
|
||||||
#include "QF/render.h"
|
#include "QF/render.h"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
pt_static,
|
||||||
|
pt_grav,
|
||||||
|
pt_slowgrav,
|
||||||
|
pt_fire,
|
||||||
|
pt_explode,
|
||||||
|
pt_explode2,
|
||||||
|
pt_blob,
|
||||||
|
pt_blob2,
|
||||||
|
pt_smoke,
|
||||||
|
pt_smokecloud,
|
||||||
|
pt_bloodcloud,
|
||||||
|
pt_fadespark,
|
||||||
|
pt_fadespark2,
|
||||||
|
pt_fallfade,
|
||||||
|
pt_fallfadespark,
|
||||||
|
pt_flame
|
||||||
|
} ptype_t;
|
||||||
|
|
||||||
typedef struct cl_particle_funcs_s {
|
typedef struct cl_particle_funcs_s {
|
||||||
void (*RocketTrail) (vec4f_t start, vec4f_t end);
|
void (*RocketTrail) (vec4f_t start, vec4f_t end);
|
||||||
void (*GrenadeTrail) (vec4f_t start, vec4f_t end);
|
void (*GrenadeTrail) (vec4f_t start, vec4f_t end);
|
||||||
|
@ -70,6 +89,7 @@ extern float cl_frametime;
|
||||||
extern float cl_realtime;
|
extern float cl_realtime;
|
||||||
|
|
||||||
void CL_Particles_Init (void);
|
void CL_Particles_Init (void);
|
||||||
|
void CL_ParticlesGravity (float gravity);
|
||||||
|
|
||||||
struct model_s;
|
struct model_s;
|
||||||
void CL_LoadPointFile (const struct model_s *model);
|
void CL_LoadPointFile (const struct model_s *model);
|
||||||
|
|
|
@ -1279,3 +1279,9 @@ CL_Particles_Init (void)
|
||||||
"Sets particle style. 0 for Id, 1 for QF.");
|
"Sets particle style. 0 for Id, 1 for QF.");
|
||||||
CL_ParticleFunctionInit ();
|
CL_ParticleFunctionInit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CL_ParticlesGravity (float gravity)
|
||||||
|
{
|
||||||
|
cl_psystem->gravity = (vec4f_t) { 0, 0, -gravity, 0 };
|
||||||
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ void
|
||||||
R_RunParticles (float dT)
|
R_RunParticles (float dT)
|
||||||
{
|
{
|
||||||
psystem_t *ps = &r_psystem;//FIXME
|
psystem_t *ps = &r_psystem;//FIXME
|
||||||
vec4f_t gravity = {0, 0, -r_data->gravity, 0};
|
vec4f_t gravity = ps->gravity;
|
||||||
|
|
||||||
unsigned j = 0;
|
unsigned j = 0;
|
||||||
for (unsigned i = 0; i < ps->numparticles; i++) {
|
for (unsigned i = 0; i < ps->numparticles; i++) {
|
||||||
|
|
|
@ -55,7 +55,6 @@ vid_render_data_t vid_render_data = {
|
||||||
.paused = false,
|
.paused = false,
|
||||||
.lineadj = 0,
|
.lineadj = 0,
|
||||||
.view_model = 0,
|
.view_model = 0,
|
||||||
.gravity = 0,
|
|
||||||
.frametime = 0.0,
|
.frametime = 0.0,
|
||||||
.realtime = 0.0,
|
.realtime = 0.0,
|
||||||
.lightstyle = 0,
|
.lightstyle = 0,
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#include "QF/plugin/vid_render.h"
|
#include "QF/plugin/vid_render.h"
|
||||||
#include "QF/scene/entity.h"
|
#include "QF/scene/entity.h"
|
||||||
|
|
||||||
|
#include "client/particles.h"
|
||||||
#include "client/temp_entities.h"
|
#include "client/temp_entities.h"
|
||||||
#include "client/world.h"
|
#include "client/world.h"
|
||||||
|
|
||||||
|
@ -378,7 +379,7 @@ CL_ParseServerInfo (void)
|
||||||
Hunk_Check (0); // make sure nothing is hurt
|
Hunk_Check (0); // make sure nothing is hurt
|
||||||
|
|
||||||
noclip_anglehack = false; // noclip is turned off at start
|
noclip_anglehack = false; // noclip is turned off at start
|
||||||
r_data->gravity = 800.0; // Set up gravity for renderer effects
|
CL_ParticlesGravity (800); // Set up gravity for renderer effects
|
||||||
done:
|
done:
|
||||||
S_UnblockSound ();
|
S_UnblockSound ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
#include "sbar.h"
|
#include "sbar.h"
|
||||||
|
|
||||||
#include "client/effects.h"
|
#include "client/effects.h"
|
||||||
|
#include "client/particles.h"
|
||||||
#include "client/temp_entities.h"
|
#include "client/temp_entities.h"
|
||||||
#include "client/view.h"
|
#include "client/view.h"
|
||||||
#include "client/world.h"
|
#include "client/world.h"
|
||||||
|
@ -782,7 +783,7 @@ CL_ParseServerData (void)
|
||||||
|
|
||||||
// get the movevars
|
// get the movevars
|
||||||
movevars.gravity = MSG_ReadFloat (net_message);
|
movevars.gravity = MSG_ReadFloat (net_message);
|
||||||
r_data->gravity = movevars.gravity; // Gravity for renderer effects
|
CL_ParticlesGravity (movevars.gravity);// Gravity for renderer effects
|
||||||
movevars.stopspeed = MSG_ReadFloat (net_message);
|
movevars.stopspeed = MSG_ReadFloat (net_message);
|
||||||
movevars.maxspeed = MSG_ReadFloat (net_message);
|
movevars.maxspeed = MSG_ReadFloat (net_message);
|
||||||
movevars.spectatormaxspeed = MSG_ReadFloat (net_message);
|
movevars.spectatormaxspeed = MSG_ReadFloat (net_message);
|
||||||
|
|
Loading…
Reference in a new issue