MCPcopy Create free account
hub / github.com/assaultcube/AC / render_particles

Function render_particles

source/src/renderparticles.cpp:282–543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280VARP(bloodttl, 0, 10000, 30000);
281
282void render_particles(int time, int typemask)
283{
284 bool rendered = false;
285 for(int i = MAXPARTYPES-1; i>=0; i--) if(typemask&(1<<parttypes[i].type) && parlist[i])
286 {
287 if(!rendered)
288 {
289 rendered = true;
290 glDepthMask(GL_FALSE);
291 glEnable(GL_BLEND);
292 glDisable(GL_FOG);
293 }
294
295 parttype &pt = parttypes[i];
296 float sz = pt.sz*particlesize/100.0f;
297
298 if(pt.tex>=0) glBindTexture(GL_TEXTURE_2D, parttex[pt.tex]->id);
299 else glDisable(GL_TEXTURE_2D);
300 switch(pt.type)
301 {
302 case PT_HUDFLASH:
303 sethudgunperspective(true);
304 // fall through
305 case PT_FLASH:
306 glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
307 glColor3f(pt.r, pt.g, pt.b);
308 glBegin(GL_QUADS);
309 break;
310
311 case PT_PART:
312 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
313 glColor3f(pt.r, pt.g, pt.b);
314 glBegin(GL_QUADS);
315 break;
316
317 case PT_FIREBALL:
318 setupexplosion();
319 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
320 break;
321
322 case PT_SHOTLINE:
323 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
324 glColor4f(pt.r, pt.g, pt.b, 0.5f);
325 glBegin(GL_LINES);
326 break;
327
328 case PT_DECAL:
329 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
330 glBegin(GL_QUADS);
331 break;
332
333 case PT_BULLETHOLE:
334 glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
335 glBegin(GL_QUADS);
336 break;
337
338 case PT_BLOOD:
339 glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);

Callers 2

drawreflectionFunction · 0.85
gl_drawframeFunction · 0.85

Calls 13

sethudgunperspectiveFunction · 0.85
setupexplosionFunction · 0.85
vecClass · 0.85
minFunction · 0.85
drawexplosionFunction · 0.85
maxFunction · 0.85
newparticleFunction · 0.85
cleanupexplosionFunction · 0.85
mulMethod · 0.80
distMethod · 0.80
magnitudeMethod · 0.80
loopkFunction · 0.70

Tested by

no test coverage detected