From bf0f75a367eccbd16a3b64a9d17e75932f2fea31 Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Tue, 28 Oct 2014 19:06:29 -0400 Subject: [PATCH] Fix (again) initial scattering of now so that it falls evenly --- data/gfx/snow.xml | 2 +- src/graphics/gpuparticles.cpp | 3 +++ src/graphics/particle_emitter.cpp | 2 +- src/graphics/particle_kind.cpp | 4 +++- src/graphics/particle_kind.hpp | 5 +++++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/data/gfx/snow.xml b/data/gfx/snow.xml index 531266b3b..f1fcbfe67 100644 --- a/data/gfx/snow.xml +++ b/data/gfx/snow.xml @@ -1,7 +1,7 @@ - + diff --git a/src/graphics/gpuparticles.cpp b/src/graphics/gpuparticles.cpp index 0120e4f6b..f3d48d00d 100644 --- a/src/graphics/gpuparticles.cpp +++ b/src/graphics/gpuparticles.cpp @@ -33,6 +33,9 @@ ParticleSystemProxy::ParticleSystemProxy(bool createDefaultEmitter, const core::vector3df& scale, 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; size_increase_factor = 0.; ParticleParams = NULL; diff --git a/src/graphics/particle_emitter.cpp b/src/graphics/particle_emitter.cpp index 201921afe..b5ae06a60 100644 --- a/src/graphics/particle_emitter.cpp +++ b/src/graphics/particle_emitter.cpp @@ -450,7 +450,7 @@ void ParticleEmitter::setParticleType(const ParticleKind* type) else { if (m_is_glsl) - m_node = ParticleSystemProxy::addParticleNode(m_is_glsl, false); + m_node = ParticleSystemProxy::addParticleNode(m_is_glsl, type->randomizeInitialY()); else m_node = irr_driver->addParticleNode(); diff --git a/src/graphics/particle_kind.cpp b/src/graphics/particle_kind.cpp index 9ed5a4d8e..8feff73c1 100644 --- a/src/graphics/particle_kind.cpp +++ b/src/graphics/particle_kind.cpp @@ -58,7 +58,7 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2 m_wind_speed = 0; m_flips = false; m_vertical_particles = false; - + m_randomize_initial_y = false; // ----- Read XML file @@ -82,6 +82,8 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2 std::string emitterShape = "point"; xml->get("emitter", &emitterShape); + xml->get("randomize-initial-y", &m_randomize_initial_y); + if (emitterShape == "point") { m_shape = EMITTER_POINT; diff --git a/src/graphics/particle_kind.hpp b/src/graphics/particle_kind.hpp index e7d379309..0546ff102 100644 --- a/src/graphics/particle_kind.hpp +++ b/src/graphics/particle_kind.hpp @@ -103,6 +103,9 @@ private: player by rotating around the Y axis only */ bool m_vertical_particles; + /** Used mainly for weather, like snow */ + bool m_randomize_initial_y; + public: /** @@ -167,6 +170,8 @@ public: bool isVerticalParticles() const { return m_vertical_particles; } + bool randomizeInitialY() const { return m_randomize_initial_y; } + std::string getName() const { return m_name; } };