Allow to use new STKParticle with legacy pipeline
Due to cull face issue the kart exhaust is still not visible
This commit is contained in:
parent
088d09cb64
commit
85adab6e1e
@ -304,7 +304,7 @@ ParticleEmitter::ParticleEmitter(const ParticleKind* type,
|
||||
m_particle_type = NULL;
|
||||
m_parent = parent;
|
||||
m_emission_decay_rate = 0;
|
||||
m_is_glsl = CVS->isGLSL();
|
||||
m_is_glsl = true;//CVS->isGLSL();
|
||||
m_randomize_initial_y = randomize_initial_y;
|
||||
m_important = important;
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef SERVER_ONLY
|
||||
|
||||
#include "graphics/stk_particle.hpp"
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "graphics/cpu_particle_manager.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
@ -506,4 +507,40 @@ void STKParticle::updateFlips(unsigned maximum_particle_count)
|
||||
}
|
||||
} // updateFlips
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void STKParticle::OnRegisterSceneNode()
|
||||
{
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
Log::warn("STKParticle", "Don't call OnRegisterSceneNode with GLSL");
|
||||
return;
|
||||
}
|
||||
generate(NULL);
|
||||
Particles.clear();
|
||||
for (unsigned i = 0; i < m_particles_generating.size(); i++)
|
||||
{
|
||||
if (m_particles_generating[i].m_size == 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
scene::SParticle p;
|
||||
p.pos = m_particles_generating[i].m_position;
|
||||
Buffer->BoundingBox.addInternalPoint(p.pos);
|
||||
p.size = core::dimension2df(m_particles_generating[i].m_size,
|
||||
m_particles_generating[i].m_size);
|
||||
core::vector3df ret = m_color_from + (m_color_to - m_color_from) *
|
||||
m_particles_generating[i].m_lifetime;
|
||||
p.color.setRed(core::clamp((int)(ret.X * 255.0f), 0, 255));
|
||||
p.color.setBlue(core::clamp((int)(ret.Y * 255.0f), 0, 255));
|
||||
p.color.setGreen(core::clamp((int)(ret.Z * 255.0f), 0, 255));
|
||||
p.color.setAlpha(255);
|
||||
Particles.push_back(p);
|
||||
}
|
||||
if (IsVisible && (!Particles.empty()))
|
||||
{
|
||||
SceneManager->registerNodeForRendering(this);
|
||||
ISceneNode::OnRegisterSceneNode();
|
||||
}
|
||||
} // OnRegisterSceneNode
|
||||
|
||||
#endif // SERVER_ONLY
|
||||
|
@ -123,7 +123,7 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void setEmitter(scene::IParticleEmitter* emitter);
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void render() {}
|
||||
virtual void OnRegisterSceneNode();
|
||||
// ------------------------------------------------------------------------
|
||||
void setIncreaseFactor(float val) { m_size_increase_factor = val; }
|
||||
// ------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user