Skip to content

Commit

Permalink
Fixed|Renderer: Crash when drawing particles (jXCCP)
Browse files Browse the repository at this point in the history
Ensure that the active set of generators is known when beginning
rendering of a map.

A crash occurred because the generators were set too late; the
renderer was trying to mark which generators are visible before
knowing which map's generators to use.
  • Loading branch information
skyjake committed Jul 9, 2013
1 parent 16adb58 commit b5a2ded
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
8 changes: 0 additions & 8 deletions doomsday/client/include/render/rend_particle.h
Expand Up @@ -23,10 +23,6 @@

#include "world/p_particle.h"

#ifdef __cplusplus
extern "C" {
#endif

void Rend_ParticleRegister(void);

/**
Expand Down Expand Up @@ -68,8 +64,4 @@ void Rend_RenderParticles(void);
*/
void Rend_RenderGenerators(void);

#ifdef __cplusplus
} // extern "C"
#endif

#endif // LIBDENG_RENDER_PARTICLE_H
19 changes: 15 additions & 4 deletions doomsday/client/src/render/rend_particle.cpp
Expand Up @@ -230,7 +230,22 @@ void Rend_ParticleReleaseExtraTextures()

void Rend_ParticleInitForNewFrame()
{
// Which set of generators are we using for this frame?
if(App_World().hasMap())
{
/**
* @todo If rendering multiple maps per frame, this would have to be
* set from the map rendering function. -jk
*/
gens = &App_World().map().generators();
}
else
{
gens = 0;
}

if(!useParticles) return;

// Clear all visibility flags.
de::zap(visiblePtcGens);
}
Expand Down Expand Up @@ -872,8 +887,6 @@ void Rend_RenderParticles()
if(!useParticles) return;
if(!App_World().hasMap()) return;

gens = &App_World().map().generators();

// No visible particles at all?
if(!listVisibleParticles()) return;

Expand Down Expand Up @@ -957,8 +970,6 @@ void Rend_RenderGenerators()
if(!devDrawGenerators) return;
if(!App_World().hasMap()) return;

gens = &App_World().map().generators();

glDisable(GL_DEPTH_TEST);

float eye[3] = { vOrigin[VX], vOrigin[VZ], vOrigin[VY] };
Expand Down

0 comments on commit b5a2ded

Please sign in to comment.