DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
cl_particles.h
Go to the documentation of this file.
1#ifndef CL_PARTICLES_H
2#define CL_PARTICLES_H
3
4#include "qtypes.h"
5struct entity_s;
6
7extern struct cvar_s cl_particles;
8extern struct cvar_s cl_particles_quality;
9extern struct cvar_s cl_particles_size;
10extern struct cvar_s cl_particles_quake;
11extern struct cvar_s cl_particles_blood;
12extern struct cvar_s cl_particles_blood_alpha;
13extern struct cvar_s cl_particles_blood_decal_alpha;
14extern struct cvar_s cl_particles_blood_decal_scalemin;
15extern struct cvar_s cl_particles_blood_decal_scalemax;
16extern struct cvar_s cl_particles_blood_bloodhack;
17extern struct cvar_s cl_particles_bulletimpacts;
18extern struct cvar_s cl_particles_explosions_sparks;
19extern struct cvar_s cl_particles_explosions_shell;
20extern struct cvar_s cl_particles_rain;
21extern struct cvar_s cl_particles_snow;
22extern struct cvar_s cl_particles_smoke;
23extern struct cvar_s cl_particles_smoke_alpha;
24extern struct cvar_s cl_particles_smoke_alphafade;
25extern struct cvar_s cl_particles_sparks;
26extern struct cvar_s cl_particles_bubbles;
27extern struct cvar_s cl_decals;
28extern struct cvar_s cl_decals_time;
29extern struct cvar_s cl_decals_fadetime;
30
41
42typedef enum
43{
50
51typedef struct particletype_s
52{
56}
58
59typedef enum ptype_e
60{
74 pt_explode, // used for Quake-style explosion particle colour ramping
75 pt_explode2, // used for Quake-style explosion particle colour ramping
79
80typedef struct particle_s
81{
82 // for faster batch rendering, particles are rendered in groups by effect (resulting in less perfect sorting but far less state changes)
83
84 // fields used by rendering: (48 bytes)
88 float size;
89 float alpha;
90 float stretch;
91
92 // fields not used by rendering: (44 bytes)
93 float stainsize;
96 float alphafade;
97 float time2;
98 float bounce;
99 float gravity;
102// float delayedcollisions; ///< time that p->bounce becomes active
104 float die;
105
106 // short variables grouped to save memory (4 bytes)
107 short angle;
108 short spin;
109
110 // byte variables grouped to save memory (12 bytes)
111 unsigned char color[3];
112 unsigned char qualityreduction;
113 unsigned char typeindex;
114 unsigned char blendmode;
115 unsigned char orientation;
116 unsigned char texnum;
117 unsigned char staincolor[3];
118 signed char staintexnum;
119}
121
123void CL_Particles_Init(void);
124void CL_Particles_Shutdown(void);
125particle_t *CL_NewParticle(const vec3_t sortorigin, unsigned short ptypeindex, int pcolor1, int pcolor2, int ptex, float psize, float psizeincrease, float palpha, float palphafade, float pgravity, float pbounce, float px, float py, float pz, float pvx, float pvy, float pvz, float pairfriction, float pliquidfriction, float originjitter, float velocityjitter, qbool pqualityreduction, float lifetime, float stretch, pblend_t blendmode, porientation_t orientation, int staincolor1, int staincolor2, int staintex, float stainalpha, float stainsize, float angle, float spin, float tint[4]);
126particle_t *CL_NewQuakeParticle(const vec3_t origin, const unsigned short ptypeindex, const int color_1, const int color_2, const float gravity, const float offset_x, const float offset_y, const float offset_z, const float velocity_offset_x, const float velocity_offset_y, const float velocity_offset_z, const float air_friction, const float liquid_friction, const float origin_jitter, const float velocity_jitter, const float lifetime);
127
169
170int CL_ParticleEffectIndexForName(const char *name);
171const char *CL_ParticleEffectNameForIndex(int i);
172void CL_ParticleEffect(int effectindex, float pcount, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, struct entity_s *ent, int palettecolor);
173void CL_ParticleTrail(int effectindex, float pcount, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, struct entity_s *ent, int palettecolor, qbool spawndlight, qbool spawnparticles, float tintmins[4], float tintmaxs[4], float fade);
174void CL_ParticleBox(int effectindex, float pcount, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, struct entity_s *ent, int palettecolor, qbool spawndlight, qbool spawnparticles, float tintmins[4], float tintmaxs[4], float fade);
175void CL_ParseParticleEffect (void);
176void CL_ParticleCube (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, vec_t gravity, vec_t randomvel);
177void CL_ParticleRain (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, int type);
178void CL_EntityParticles (const struct entity_s *ent);
179void CL_ParticleExplosion (const vec3_t org);
180void CL_ParticleExplosion2 (const vec3_t org, int colorStart, int colorLength);
181
182#endif
struct cvar_s cl_particles_blood_decal_scalemax
struct cvar_s cl_particles_smoke_alphafade
struct cvar_s cl_particles_blood
struct cvar_s cl_particles_quake
const char * CL_ParticleEffectNameForIndex(int i)
struct cvar_s cl_particles_bubbles
struct cvar_s cl_particles_blood_decal_scalemin
particle_t * CL_NewParticle(const vec3_t sortorigin, unsigned short ptypeindex, int pcolor1, int pcolor2, int ptex, float psize, float psizeincrease, float palpha, float palphafade, float pgravity, float pbounce, float px, float py, float pz, float pvx, float pvy, float pvz, float pairfriction, float pliquidfriction, float originjitter, float velocityjitter, qbool pqualityreduction, float lifetime, float stretch, pblend_t blendmode, porientation_t orientation, int staincolor1, int staincolor2, int staintex, float stainalpha, float stainsize, float angle, float spin, float tint[4])
Creates a new particle and returns a pointer to it.
void CL_Particles_Init(void)
struct cvar_s cl_particles_quality
void CL_ParticleRain(const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, int type)
int CL_ParticleEffectIndexForName(const char *name)
void CL_Particles_Clear(void)
struct cvar_s cl_particles_blood_bloodhack
struct cvar_s cl_decals_fadetime
struct cvar_s cl_particles_sparks
struct cvar_s cl_particles
effectnameindex_t
@ EFFECT_TE_WIZSPIKE
@ EFFECT_TR_GLOWTRAIL
@ EFFECT_TE_TEI_SMOKE
@ EFFECT_EF_STARDUST
@ EFFECT_TE_FLAMEJET
@ EFFECT_TR_SLIGHTBLOOD
@ EFFECT_TE_SUPERSPIKEQUAD
@ EFFECT_TE_SPIKEQUAD
@ EFFECT_TE_SPARK
@ EFFECT_TR_WIZSPIKE
@ EFFECT_TE_GUNSHOTQUAD
@ EFFECT_TE_EXPLOSIONQUAD
@ EFFECT_TE_EXPLOSION
@ EFFECT_TR_NEHAHRASMOKE
@ EFFECT_TR_ROCKET
@ EFFECT_SVC_PARTICLE
@ EFFECT_TE_GUNSHOT
@ EFFECT_TR_VORESPIKE
@ EFFECT_TR_GRENADE
@ EFFECT_TE_PLASMABURN
@ EFFECT_TE_TAREXPLOSION
@ EFFECT_TR_BLOOD
@ EFFECT_EF_FLAME
@ EFFECT_TE_LAVASPLASH
@ EFFECT_TE_TELEPORT
@ EFFECT_TE_SMALLFLASH
@ EFFECT_TE_KNIGHTSPIKE
@ EFFECT_TE_BLOOD
@ EFFECT_TE_TEI_PLASMAHIT
@ EFFECT_TR_NEXUIZPLASMA
@ EFFECT_TE_SUPERSPIKE
@ EFFECT_TE_TEI_G3
@ EFFECT_TR_KNIGHTSPIKE
@ EFFECT_NONE
@ EFFECT_TOTAL
@ EFFECT_TE_TEI_BIGEXPLOSION
@ EFFECT_TE_SPIKE
void CL_ParticleExplosion2(const vec3_t org, int colorStart, int colorLength)
pblend_t
@ PBLEND_ALPHA
@ PBLEND_ADD
@ PBLEND_INVMOD
@ PBLEND_INVALID
void CL_ParticleEffect(int effectindex, float pcount, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, struct entity_s *ent, int palettecolor)
void CL_ParticleTrail(int effectindex, float pcount, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, struct entity_s *ent, int palettecolor, qbool spawndlight, qbool spawnparticles, float tintmins[4], float tintmaxs[4], float fade)
void CL_Particles_Shutdown(void)
void CL_ParticleCube(const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, vec_t gravity, vec_t randomvel)
ptype_t
@ pt_snow
@ pt_blood
@ pt_total
@ pt_spark
@ pt_explode2
@ pt_dead
@ pt_bubble
@ pt_static
@ pt_beam
@ pt_alphastatic
@ pt_raindecal
@ pt_entityparticle
@ pt_rain
@ pt_explode
@ pt_smoke
@ pt_decal
particle_t * CL_NewQuakeParticle(const vec3_t origin, const unsigned short ptypeindex, const int color_1, const int color_2, const float gravity, const float offset_x, const float offset_y, const float offset_z, const float velocity_offset_x, const float velocity_offset_y, const float velocity_offset_z, const float air_friction, const float liquid_friction, const float origin_jitter, const float velocity_jitter, const float lifetime)
Creates a simple particle, a square like Quake, or a disc like GLQuake.
struct cvar_s cl_decals_time
void CL_ParticleExplosion(const vec3_t org)
struct cvar_s cl_particles_snow
void CL_EntityParticles(const struct entity_s *ent)
struct cvar_s cl_particles_size
void CL_ParseParticleEffect(void)
struct cvar_s cl_particles_smoke_alpha
struct cvar_s cl_particles_explosions_sparks
struct cvar_s cl_particles_blood_decal_alpha
porientation_t
@ PARTICLE_SPARK
@ PARTICLE_HBEAM
@ PARTICLE_BILLBOARD
@ PARTICLE_VBEAM
@ PARTICLE_ORIENTED_DOUBLESIDED
@ PARTICLE_INVALID
struct cvar_s cl_particles_blood_alpha
struct cvar_s cl_particles_bulletimpacts
struct cvar_s cl_particles_rain
struct cvar_s cl_particles_smoke
void CL_ParticleBox(int effectindex, float pcount, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, struct entity_s *ent, int palettecolor, qbool spawndlight, qbool spawnparticles, float tintmins[4], float tintmaxs[4], float fade)
struct cvar_s cl_particles_explosions_shell
struct cvar_s cl_decals
vector mins
vector maxs
vector origin
vector color
GLenum GLenum GLsizei count
Definition glquake.h:656
const GLchar * name
Definition glquake.h:601
GLenum type
Definition glquake.h:656
int i
float vec_t
Definition qtypes.h:68
vec_t vec3_t[3]
Definition qtypes.h:71
bool qbool
Definition qtypes.h:9
vec2 dir
vec2 px
unsigned char typeindex
float alphafade
how much alpha reduces per second
unsigned char texnum
float stretch
only for sparks
float die
time when this particle should be removed, regardless of alpha
float bounce
how much bounce-back from a surface the particle hits (0 = no physics, 1 = stop and slide,...
float airfriction
how much air friction affects this object (objects with a low mass/size ratio tend to get more air fr...
unsigned char orientation
float gravity
how much gravity affects this particle (1.0 = normal gravity, 0.0 = none)
float stainsize
vec3_t vel
velocity of particle, or orientation of decal, or end point of beam
vec3_t sortorigin
sort by this group origin, not particle org
float alpha
0-255
unsigned char qualityreduction
enables skipping of this particle according to r_refdef.view.qualityreduction
float sizeincrease
rate of size change per second
signed char staintexnum
float liquidfriction
how much liquid friction affects this object (objects with a low mass/size ratio tend to get more liq...
unsigned char blendmode
float delayedspawn
time that particle appears and begins moving
float stainalpha
float time2
used for snow fluttering, decal fade, explosion colour ramp
short spin
geometry rotation speed around the particle center normal
short angle
base rotation of particle
porientation_t orientation
pblend_t blendmode