7 extern struct cvar_s cl_particles;
8 extern struct cvar_s cl_particles_quality;
9 extern struct cvar_s cl_particles_size;
10 extern struct cvar_s cl_particles_quake;
11 extern struct cvar_s cl_particles_blood;
12 extern struct cvar_s cl_particles_blood_alpha;
13 extern struct cvar_s cl_particles_blood_decal_alpha;
14 extern struct cvar_s cl_particles_blood_decal_scalemin;
15 extern struct cvar_s cl_particles_blood_decal_scalemax;
16 extern struct cvar_s cl_particles_blood_bloodhack;
17 extern struct cvar_s cl_particles_bulletimpacts;
18 extern struct cvar_s cl_particles_explosions_sparks;
19 extern struct cvar_s cl_particles_explosions_shell;
20 extern struct cvar_s cl_particles_rain;
21 extern struct cvar_s cl_particles_snow;
22 extern struct cvar_s cl_particles_smoke;
23 extern struct cvar_s cl_particles_smoke_alpha;
24 extern struct cvar_s cl_particles_smoke_alphafade;
25 extern struct cvar_s cl_particles_sparks;
26 extern struct cvar_s cl_particles_bubbles;
27 extern struct cvar_s cl_decals;
28 extern struct cvar_s cl_decals_time;
29 extern struct cvar_s cl_decals_fadetime;
33 PARTICLE_BILLBOARD = 0,
35 PARTICLE_ORIENTED_DOUBLESIDED = 2,
51 typedef struct particletype_s
54 porientation_t orientation;
74 pt_explode, // used for Quake-style explosion particle colour ramping
75 pt_explode2, // used for Quake-style explosion particle colour ramping
80 typedef struct particle_s
82 // for faster batch rendering, particles are rendered in groups by effect (resulting in less perfect sorting but far less state changes)
84 // fields used by rendering: (48 bytes)
85 vec3_t sortorigin; ///< sort by this group origin, not particle org
87 vec3_t vel; ///< velocity of particle, or orientation of decal, or end point of beam
89 float alpha; ///< 0-255
90 float stretch; ///< only for sparks
92 // fields not used by rendering: (44 bytes)
95 float sizeincrease; ///< rate of size change per second
96 float alphafade; ///< how much alpha reduces per second
97 float time2; ///< used for snow fluttering, decal fade, explosion colour ramp
98 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)
99 float gravity; ///< how much gravity affects this particle (1.0 = normal gravity, 0.0 = none)
100 float airfriction; ///< how much air friction affects this object (objects with a low mass/size ratio tend to get more air friction)
101 float liquidfriction; ///< how much liquid friction affects this object (objects with a low mass/size ratio tend to get more liquid friction)
102 // float delayedcollisions; ///< time that p->bounce becomes active
103 float delayedspawn; ///< time that particle appears and begins moving
104 float die; ///< time when this particle should be removed, regardless of alpha
106 // short variables grouped to save memory (4 bytes)
107 short angle; ///< base rotation of particle
108 short spin; ///< geometry rotation speed around the particle center normal
110 // byte variables grouped to save memory (12 bytes)
111 unsigned char color[3];
112 unsigned char qualityreduction; ///< enables skipping of this particle according to r_refdef.view.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;
122 void CL_Particles_Clear(void);
123 void CL_Particles_Init(void);
124 void CL_Particles_Shutdown(void);
125 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]);
126 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);
128 typedef enum effectnameindex_s
132 EFFECT_TE_GUNSHOTQUAD,
135 EFFECT_TE_SUPERSPIKE,
136 EFFECT_TE_SUPERSPIKEQUAD,
138 EFFECT_TE_KNIGHTSPIKE,
140 EFFECT_TE_EXPLOSIONQUAD,
141 EFFECT_TE_TAREXPLOSION,
143 EFFECT_TE_LAVASPLASH,
144 EFFECT_TE_SMALLFLASH,
149 EFFECT_TE_PLASMABURN,
152 EFFECT_TE_TEI_BIGEXPLOSION,
153 EFFECT_TE_TEI_PLASMAHIT,
159 EFFECT_TR_SLIGHTBLOOD,
160 EFFECT_TR_KNIGHTSPIKE,
162 EFFECT_TR_NEHAHRASMOKE,
163 EFFECT_TR_NEXUIZPLASMA,
170 int CL_ParticleEffectIndexForName(const char *name);
171 const char *CL_ParticleEffectNameForIndex(int i);
172 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);
173 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);
174 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);
175 void CL_ParseParticleEffect (void);
176 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);
177 void CL_ParticleRain (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, int type);
178 void CL_EntityParticles (const struct entity_s *ent);
179 void CL_ParticleExplosion (const vec3_t org);
180 void CL_ParticleExplosion2 (const vec3_t org, int colorStart, int colorLength);