Handle NiParticleColorModifier with Ogre's ColourInterpolator

Note that Ogre's ColourInterpolator has a maximum of six color stages. This
seems to be fine so far, but if we want anything better, we'll need a custom
affector for it.
actorid
Chris Robinson 12 years ago
parent 80a4345787
commit 0b363ba36e

@ -386,13 +386,29 @@ class NIFObjectLoader
affector->setParameter("direction", Ogre::StringConverter::toString(gr->mDirection));
affector->setParameter("position", Ogre::StringConverter::toString(gr->mPosition));
}
else if(e->recType == Nif::RC_NiParticleRotation)
else if(e->recType == Nif::RC_NiParticleColorModifier)
{
// TODO: Implement (Ogre::RotationAffector?)
const Nif::NiParticleColorModifier *cl = static_cast<const Nif::NiParticleColorModifier*>(e.getPtr());
const Nif::NiColorData *clrdata = cl->data.getPtr();
Ogre::ParticleAffector *affector = partsys->addAffector("ColourInterpolator");
size_t num_colors = std::min<size_t>(6, clrdata->mKeyList.mKeys.size());
for(size_t i = 0;i < num_colors;i++)
{
Ogre::ColourValue color;
color.r = clrdata->mKeyList.mKeys[i].mValue[0];
color.g = clrdata->mKeyList.mKeys[i].mValue[1];
color.b = clrdata->mKeyList.mKeys[i].mValue[2];
color.a = clrdata->mKeyList.mKeys[i].mValue[3];
affector->setParameter("colour"+Ogre::StringConverter::toString(i),
Ogre::StringConverter::toString(color));
affector->setParameter("time"+Ogre::StringConverter::toString(i),
Ogre::StringConverter::toString(clrdata->mKeyList.mKeys[i].mTime));
}
}
else if(e->recType == Nif::RC_NiParticleColorModifier)
else if(e->recType == Nif::RC_NiParticleRotation)
{
// TODO: Implement (Ogre::ColourInterpolatorAffector?)
// TODO: Implement (Ogre::RotationAffector?)
}
else
warn("Unhandled particle modifier "+e->recName);

Loading…
Cancel
Save