Minor cleanup + add code to visualize emitter
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7294 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -81,18 +81,21 @@ ParticleEmitter::ParticleEmitter(ParticleKind* type, core::vector3df position,
|
||||
{
|
||||
// FIXME: does the maxAngle param work at all??
|
||||
// FIXME: the min and max color params don't appear to work
|
||||
const float box_x = type->getBoxSizeX()/2.0f;
|
||||
const float box_y = type->getBoxSizeY()/2.0f;
|
||||
const float box_z = type->getBoxSizeZ()/2.0f;
|
||||
m_node->setPosition(position);
|
||||
m_emitter = m_node->createBoxEmitter(core::aabbox3df(-box_x, -box_y, -box_z,
|
||||
box_x, box_y, box_z),
|
||||
core::vector3df(0.0f, 0.0f, 5.0f), // velocity in m/ms
|
||||
const float box_size_x = type->getBoxSizeX()/2.0f;
|
||||
const float box_size_y = type->getBoxSizeY()/2.0f;
|
||||
const float box_size_z = type->getBoxSizeZ()/2.0f;
|
||||
m_emitter = m_node->createBoxEmitter(core::aabbox3df(-box_size_x, -box_size_y, -box_size_z,
|
||||
box_size_x, box_size_y, box_size_z),
|
||||
core::vector3df(0.0f, 0.0f, 0.0f), // velocity in m/ms
|
||||
type->getMinRate(), type->getMaxRate(),
|
||||
type->getMinColor(), type->getMaxColor(),
|
||||
lifeTimeMin, lifeTimeMax,
|
||||
0 /* angle */
|
||||
);
|
||||
|
||||
//irr_driver->getSceneManager()->addCubeSceneNode(1.0f, parent, -1, position, core::vector3df(0, 0, 0) /* rotation */,
|
||||
// core::vector3df(box_size_x, box_size_y, box_size_z));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -134,9 +137,12 @@ void ParticleEmitter::update()
|
||||
// There seems to be no way to randomise the velocity for particles,
|
||||
// so we have to do this manually, by changing the default velocity.
|
||||
// Irrlicht expects velocity (called 'direction') in m/ms!!
|
||||
Vec3 dir(cos(DEGREE_TO_RAD*(rand()%m_particle_type->getAngleSpreadX()))*m_particle_type->getVelocityX(),
|
||||
sin(DEGREE_TO_RAD*(rand()%m_particle_type->getAngleSpreadY()))*m_particle_type->getVelocityY(),
|
||||
sin(DEGREE_TO_RAD*(rand()%m_particle_type->getAngleSpreadZ()))*m_particle_type->getVelocityZ());
|
||||
const int x = m_particle_type->getAngleSpreadX();
|
||||
const int y = m_particle_type->getAngleSpreadY();
|
||||
const int z = m_particle_type->getAngleSpreadZ();
|
||||
Vec3 dir(cos(DEGREE_TO_RAD*(rand()%x - x/2))*m_particle_type->getVelocityX(),
|
||||
sin(DEGREE_TO_RAD*(rand()%y - x/2))*m_particle_type->getVelocityY(),
|
||||
sin(DEGREE_TO_RAD*(rand()%z - x/2))*m_particle_type->getVelocityZ());
|
||||
|
||||
m_emitter->setDirection(dir.toIrrVector());
|
||||
} // update
|
||||
|
||||
Reference in New Issue
Block a user