Starting the refactoring for the new particle system
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12990 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
13d84ce4f4
commit
b08fcc7801
@ -337,40 +337,7 @@ void CParticleSystemSceneNode::render()
|
|||||||
{
|
{
|
||||||
const SParticle& particle = Particles[i];
|
const SParticle& particle = Particles[i];
|
||||||
|
|
||||||
#if 0
|
drawBillboardParticle(idx, particle, view, m);
|
||||||
core::vector3df horizontal = camera->getUpVector().crossProduct(view);
|
|
||||||
horizontal.normalize();
|
|
||||||
horizontal *= 0.5f * particle.size.Width;
|
|
||||||
|
|
||||||
core::vector3df vertical = horizontal.crossProduct(view);
|
|
||||||
vertical.normalize();
|
|
||||||
vertical *= 0.5f * particle.size.Height;
|
|
||||||
|
|
||||||
#else
|
|
||||||
f32 f;
|
|
||||||
|
|
||||||
f = 0.5f * particle.size.Width;
|
|
||||||
const core::vector3df horizontal ( m[0] * f, m[4] * f, m[8] * f );
|
|
||||||
|
|
||||||
f = -0.5f * particle.size.Height;
|
|
||||||
const core::vector3df vertical ( m[1] * f, m[5] * f, m[9] * f );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Buffer->Vertices[0+idx].Pos = particle.pos + horizontal + vertical;
|
|
||||||
Buffer->Vertices[0+idx].Color = particle.color;
|
|
||||||
Buffer->Vertices[0+idx].Normal = view;
|
|
||||||
|
|
||||||
Buffer->Vertices[1+idx].Pos = particle.pos + horizontal - vertical;
|
|
||||||
Buffer->Vertices[1+idx].Color = particle.color;
|
|
||||||
Buffer->Vertices[1+idx].Normal = view;
|
|
||||||
|
|
||||||
Buffer->Vertices[2+idx].Pos = particle.pos - horizontal - vertical;
|
|
||||||
Buffer->Vertices[2+idx].Color = particle.color;
|
|
||||||
Buffer->Vertices[2+idx].Normal = view;
|
|
||||||
|
|
||||||
Buffer->Vertices[3+idx].Pos = particle.pos - horizontal + vertical;
|
|
||||||
Buffer->Vertices[3+idx].Color = particle.color;
|
|
||||||
Buffer->Vertices[3+idx].Normal = view;
|
|
||||||
|
|
||||||
idx +=4;
|
idx +=4;
|
||||||
}
|
}
|
||||||
@ -397,6 +364,38 @@ void CParticleSystemSceneNode::render()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Draw billboard particle
|
||||||
|
void CParticleSystemSceneNode::drawBillboardParticle(const irr::s32 &idx,
|
||||||
|
const SParticle &particle, const core::vector3df &view, const irr::core::matrix4 &m)
|
||||||
|
{
|
||||||
|
|
||||||
|
f32 f;
|
||||||
|
|
||||||
|
f = 0.5f * particle.size.Width;
|
||||||
|
const core::vector3df horizontal ( m[0] * f, m[4] * f, m[8] * f );
|
||||||
|
|
||||||
|
f = -0.5f * particle.size.Height;
|
||||||
|
const core::vector3df vertical ( m[1] * f, m[5] * f, m[9] * f );
|
||||||
|
|
||||||
|
|
||||||
|
Buffer->Vertices[0+idx].Pos = particle.pos + horizontal + vertical;
|
||||||
|
Buffer->Vertices[0+idx].Color = particle.color;
|
||||||
|
Buffer->Vertices[0+idx].Normal = view;
|
||||||
|
|
||||||
|
Buffer->Vertices[1+idx].Pos = particle.pos + horizontal - vertical;
|
||||||
|
Buffer->Vertices[1+idx].Color = particle.color;
|
||||||
|
Buffer->Vertices[1+idx].Normal = view;
|
||||||
|
|
||||||
|
Buffer->Vertices[2+idx].Pos = particle.pos - horizontal - vertical;
|
||||||
|
Buffer->Vertices[2+idx].Color = particle.color;
|
||||||
|
Buffer->Vertices[2+idx].Normal = view;
|
||||||
|
|
||||||
|
Buffer->Vertices[3+idx].Pos = particle.pos - horizontal + vertical;
|
||||||
|
Buffer->Vertices[3+idx].Color = particle.color;
|
||||||
|
Buffer->Vertices[3+idx].Normal = view;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//! returns the axis aligned bounding box of this node
|
//! returns the axis aligned bounding box of this node
|
||||||
const core::aabbox3d<f32>& CParticleSystemSceneNode::getBoundingBox() const
|
const core::aabbox3d<f32>& CParticleSystemSceneNode::getBoundingBox() const
|
||||||
|
@ -59,6 +59,13 @@ public:
|
|||||||
|
|
||||||
//! render
|
//! render
|
||||||
virtual void render();
|
virtual void render();
|
||||||
|
|
||||||
|
//! Draw billboard particle
|
||||||
|
void drawBillboardParticle(
|
||||||
|
const irr::s32 &idx,
|
||||||
|
const scene::SParticle &particle,
|
||||||
|
const core::vector3df &view,
|
||||||
|
const irr::core::matrix4 &m);
|
||||||
|
|
||||||
//! returns the axis aligned bounding box of this node
|
//! returns the axis aligned bounding box of this node
|
||||||
virtual const core::aabbox3d<f32>& getBoundingBox() const;
|
virtual const core::aabbox3d<f32>& getBoundingBox() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user