6 typedef struct entity_s entity_t;
8 extern cvar_t cl_particles;
9 extern cvar_t cl_particles_quality;
10 extern cvar_t cl_particles_size;
11 extern cvar_t cl_particles_quake;
12 extern cvar_t cl_particles_blood;
13 extern cvar_t cl_particles_blood_alpha;
14 extern cvar_t cl_particles_blood_decal_alpha;
15 extern cvar_t cl_particles_blood_decal_scalemin;
16 extern cvar_t cl_particles_blood_decal_scalemax;
17 extern cvar_t cl_particles_blood_bloodhack;
18 extern cvar_t cl_particles_bulletimpacts;
19 extern cvar_t cl_particles_explosions_sparks;
20 extern cvar_t cl_particles_explosions_shell;
21 extern cvar_t cl_particles_rain;
22 extern cvar_t cl_particles_snow;
23 extern cvar_t cl_particles_smoke;
24 extern cvar_t cl_particles_smoke_alpha;
25 extern cvar_t cl_particles_smoke_alphafade;
26 extern cvar_t cl_particles_sparks;
27 extern cvar_t cl_particles_bubbles;
28 extern cvar_t cl_decals;
29 extern cvar_t cl_decals_time;
30 extern cvar_t cl_decals_fadetime;
34 PARTICLE_BILLBOARD = 0,
36 PARTICLE_ORIENTED_DOUBLESIDED = 2,
52 typedef struct particletype_s
55 porientation_t orientation;
62 pt_dead, pt_alphastatic, pt_static, pt_spark, pt_beam, pt_rain, pt_raindecal, pt_snow, pt_bubble, pt_blood, pt_smoke, pt_decal, pt_entityparticle, pt_total
66 typedef struct particle_s
68 // for faster batch rendering, particles are rendered in groups by effect (resulting in less perfect sorting but far less state changes)
70 // fields used by rendering: (48 bytes)
71 vec3_t sortorigin; // sort by this group origin, not particle org
73 vec3_t vel; // velocity of particle, or orientation of decal, or end point of beam
76 float stretch; // only for sparks
78 // fields not used by rendering: (44 bytes)
81 float sizeincrease; // rate of size change per second
82 float alphafade; // how much alpha reduces per second
83 float time2; // used for snow fluttering and decal fade
84 float bounce; // how much bounce-back from a surface the particle hits (0 = no physics, 1 = stop and slide, 2 = keep bouncing forever, 1.5 is typical)
85 float gravity; // how much gravity affects this particle (1.0 = normal gravity, 0.0 = none)
86 float airfriction; // how much air friction affects this object (objects with a low mass/size ratio tend to get more air friction)
87 float liquidfriction; // how much liquid friction affects this object (objects with a low mass/size ratio tend to get more liquid friction)
88 // float delayedcollisions; // time that p->bounce becomes active
89 float delayedspawn; // time that particle appears and begins moving
90 float die; // time when this particle should be removed, regardless of alpha
92 // short variables grouped to save memory (4 bytes)
93 short angle; // base rotation of particle
94 short spin; // geometry rotation speed around the particle center normal
96 // byte variables grouped to save memory (12 bytes)
97 unsigned char color[3];
98 unsigned char qualityreduction; // enables skipping of this particle according to r_refdef.view.qualityreduction
99 unsigned char typeindex;
100 unsigned char blendmode;
101 unsigned char orientation;
102 unsigned char texnum;
103 unsigned char staincolor[3];
104 signed char staintexnum;
108 void CL_Particles_Clear(void);
109 void CL_Particles_Init(void);
110 void CL_Particles_Shutdown(void);
111 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]);
113 typedef enum effectnameindex_s
117 EFFECT_TE_GUNSHOTQUAD,
120 EFFECT_TE_SUPERSPIKE,
121 EFFECT_TE_SUPERSPIKEQUAD,
123 EFFECT_TE_KNIGHTSPIKE,
125 EFFECT_TE_EXPLOSIONQUAD,
126 EFFECT_TE_TAREXPLOSION,
128 EFFECT_TE_LAVASPLASH,
129 EFFECT_TE_SMALLFLASH,
134 EFFECT_TE_PLASMABURN,
137 EFFECT_TE_TEI_BIGEXPLOSION,
138 EFFECT_TE_TEI_PLASMAHIT,
144 EFFECT_TR_SLIGHTBLOOD,
145 EFFECT_TR_KNIGHTSPIKE,
147 EFFECT_TR_NEHAHRASMOKE,
148 EFFECT_TR_NEXUIZPLASMA,
155 int CL_ParticleEffectIndexForName(const char *name);
156 const char *CL_ParticleEffectNameForIndex(int i);
157 void CL_ParticleEffect(int effectindex, float pcount, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, entity_t *ent, int palettecolor);
158 void CL_ParticleTrail(int effectindex, float pcount, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, entity_t *ent, int palettecolor, qbool spawndlight, qbool spawnparticles, float tintmins[4], float tintmaxs[4], float fade);
159 void CL_ParticleBox(int effectindex, float pcount, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, entity_t *ent, int palettecolor, qbool spawndlight, qbool spawnparticles, float tintmins[4], float tintmaxs[4], float fade);
160 void CL_ParseParticleEffect (void);
161 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);
162 void CL_ParticleRain (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, int type);
163 void CL_EntityParticles (const entity_t *ent);
164 void CL_ParticleExplosion (const vec3_t org);
165 void CL_ParticleExplosion2 (const vec3_t org, int colorStart, int colorLength);