Fix (again) initial scattering of now so that it falls evenly

This commit is contained in:
Marianne Gagnon 2014-10-28 19:06:29 -04:00
parent 40932fadeb
commit bf0f75a367
5 changed files with 13 additions and 3 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- For sky particles, the size of the box is ignored --> <!-- For sky particles, the size of the box is ignored -->
<particles emitter="box"> <particles emitter="box" randomize-initial-y="true">
<spreading angle="3" /> <spreading angle="3" />

View File

@ -33,6 +33,9 @@ ParticleSystemProxy::ParticleSystemProxy(bool createDefaultEmitter,
const core::vector3df& scale, const core::vector3df& scale,
bool randomize_initial_y) : CParticleSystemSceneNode(createDefaultEmitter, parent, mgr, id, position, rotation, scale), m_alpha_additive(false), m_first_execution(true) bool randomize_initial_y) : CParticleSystemSceneNode(createDefaultEmitter, parent, mgr, id, position, rotation, scale), m_alpha_additive(false), m_first_execution(true)
{ {
if (randomize_initial_y)
m_randomize_initial_y = randomize_initial_y;
m_randomize_initial_y = randomize_initial_y; m_randomize_initial_y = randomize_initial_y;
size_increase_factor = 0.; size_increase_factor = 0.;
ParticleParams = NULL; ParticleParams = NULL;

View File

@ -450,7 +450,7 @@ void ParticleEmitter::setParticleType(const ParticleKind* type)
else else
{ {
if (m_is_glsl) if (m_is_glsl)
m_node = ParticleSystemProxy::addParticleNode(m_is_glsl, false); m_node = ParticleSystemProxy::addParticleNode(m_is_glsl, type->randomizeInitialY());
else else
m_node = irr_driver->addParticleNode(); m_node = irr_driver->addParticleNode();

View File

@ -58,7 +58,7 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
m_wind_speed = 0; m_wind_speed = 0;
m_flips = false; m_flips = false;
m_vertical_particles = false; m_vertical_particles = false;
m_randomize_initial_y = false;
// ----- Read XML file // ----- Read XML file
@ -82,6 +82,8 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
std::string emitterShape = "point"; std::string emitterShape = "point";
xml->get("emitter", &emitterShape); xml->get("emitter", &emitterShape);
xml->get("randomize-initial-y", &m_randomize_initial_y);
if (emitterShape == "point") if (emitterShape == "point")
{ {
m_shape = EMITTER_POINT; m_shape = EMITTER_POINT;

View File

@ -103,6 +103,9 @@ private:
player by rotating around the Y axis only */ player by rotating around the Y axis only */
bool m_vertical_particles; bool m_vertical_particles;
/** Used mainly for weather, like snow */
bool m_randomize_initial_y;
public: public:
/** /**
@ -167,6 +170,8 @@ public:
bool isVerticalParticles() const { return m_vertical_particles; } bool isVerticalParticles() const { return m_vertical_particles; }
bool randomizeInitialY() const { return m_randomize_initial_y; }
std::string getName() const { return m_name; } std::string getName() const { return m_name; }
}; };