Handle the vertical and horizontal parameters of Nif particles

Note that 'horizontal' is mapped to rotate around the Z axis, not Y. The Nif
particle parameters seem to be set up to expect a normal OpenGL (Direct3D?)
orientation, rather than the 90-degree pitch offset of the game.
This commit is contained in:
Chris Robinson 2013-04-13 16:16:57 -07:00
parent 7191f6ed2a
commit dd981077b9
2 changed files with 129 additions and 6 deletions

View file

@ -352,16 +352,18 @@ class NIFObjectLoader
static void createParticleEmitterAffectors(Ogre::ParticleSystem *partsys, const Nif::NiParticleSystemController *partctrl)
{
Ogre::ParticleEmitter *emitter = partsys->addEmitter("Nif");
emitter->setDirection(Ogre::Vector3(0.0f, 0.0f, std::cos(partctrl->verticalDir)));
emitter->setAngle(Ogre::Radian(partctrl->verticalAngle));
emitter->setParticleVelocity(partctrl->velocity-partctrl->velocityRandom,
partctrl->velocity+partctrl->velocityRandom);
emitter->setEmissionRate(partctrl->emitRate);
emitter->setTimeToLive(partctrl->lifetime-partctrl->lifetimeRandom,
partctrl->lifetime+partctrl->lifetimeRandom);
emitter->setParameter("width", Ogre::StringConverter::toString(partctrl->offsetRandom.x));
emitter->setParameter("height", Ogre::StringConverter::toString(partctrl->offsetRandom.z));
emitter->setParameter("depth", Ogre::StringConverter::toString(partctrl->offsetRandom.y));
emitter->setParameter("height", Ogre::StringConverter::toString(partctrl->offsetRandom.y));
emitter->setParameter("depth", Ogre::StringConverter::toString(partctrl->offsetRandom.z));
emitter->setParameter("vertical_direction", Ogre::StringConverter::toString(Ogre::Radian(partctrl->verticalDir).valueDegrees()));
emitter->setParameter("vertical_angle", Ogre::StringConverter::toString(Ogre::Radian(partctrl->verticalAngle).valueDegrees()));
emitter->setParameter("horizontal_direction", Ogre::StringConverter::toString(Ogre::Radian(partctrl->horizontalDir).valueDegrees()));
emitter->setParameter("horizontal_angle", Ogre::StringConverter::toString(Ogre::Radian(partctrl->horizontalAngle).valueDegrees()));
Nif::ExtraPtr e = partctrl->extra;
while(!e.empty())