|
|
|
@ -16,7 +16,7 @@
|
|
|
|
|
class NifEmitter : public Ogre::ParticleEmitter
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Ogre::Bone* mEmitterBone;
|
|
|
|
|
std::vector<Ogre::Bone*> mEmitterBones;
|
|
|
|
|
Ogre::Bone* mParticleBone;
|
|
|
|
|
|
|
|
|
|
Ogre::ParticleSystem* getPartSys() { return mParent; }
|
|
|
|
@ -131,7 +131,8 @@ public:
|
|
|
|
|
NifEmitter(Ogre::ParticleSystem *psys)
|
|
|
|
|
: Ogre::ParticleEmitter(psys)
|
|
|
|
|
{
|
|
|
|
|
mEmitterBone = Ogre::any_cast<Ogre::Bone*>(psys->getUserObjectBindings().getUserAny());
|
|
|
|
|
mEmitterBones = Ogre::any_cast<NiNodeHolder>(psys->getUserObjectBindings().getUserAny()).mBones;
|
|
|
|
|
assert (!mEmitterBones.empty());
|
|
|
|
|
Ogre::TagPoint* tag = static_cast<Ogre::TagPoint*>(mParent->getParentNode());
|
|
|
|
|
mParticleBone = static_cast<Ogre::Bone*>(tag->getParent());
|
|
|
|
|
initDefaults("Nif");
|
|
|
|
@ -170,8 +171,10 @@ public:
|
|
|
|
|
Ogre::Real& timeToLive = particle->timeToLive;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
Ogre::Node* emitterBone = mEmitterBones.at((int)(::rand()/(RAND_MAX+1.0)*mEmitterBones.size()));
|
|
|
|
|
|
|
|
|
|
position = xOff + yOff + zOff +
|
|
|
|
|
mParticleBone->_getDerivedOrientation().Inverse() * (mEmitterBone->_getDerivedPosition()
|
|
|
|
|
mParticleBone->_getDerivedOrientation().Inverse() * (emitterBone->_getDerivedPosition()
|
|
|
|
|
- mParticleBone->_getDerivedPosition());
|
|
|
|
|
|
|
|
|
|
// Generate complex data by reference
|
|
|
|
@ -181,7 +184,7 @@ public:
|
|
|
|
|
Ogre::Radian hdir = mHorizontalDir + mHorizontalAngle*Ogre::Math::SymmetricRandom();
|
|
|
|
|
Ogre::Radian vdir = mVerticalDir + mVerticalAngle*Ogre::Math::SymmetricRandom();
|
|
|
|
|
direction = (mParticleBone->_getDerivedOrientation().Inverse()
|
|
|
|
|
* mEmitterBone->_getDerivedOrientation() *
|
|
|
|
|
* emitterBone->_getDerivedOrientation() *
|
|
|
|
|
Ogre::Quaternion(hdir, Ogre::Vector3::UNIT_Z) *
|
|
|
|
|
Ogre::Quaternion(vdir, Ogre::Vector3::UNIT_X)) *
|
|
|
|
|
Ogre::Vector3::UNIT_Z;
|
|
|
|
@ -635,7 +638,9 @@ public:
|
|
|
|
|
, mPosition(0.0f)
|
|
|
|
|
, mDirection(0.0f)
|
|
|
|
|
{
|
|
|
|
|
mEmitterBone = Ogre::any_cast<Ogre::Bone*>(psys->getUserObjectBindings().getUserAny());
|
|
|
|
|
std::vector<Ogre::Bone*> bones = Ogre::any_cast<NiNodeHolder>(psys->getUserObjectBindings().getUserAny()).mBones;
|
|
|
|
|
assert (!bones.empty());
|
|
|
|
|
mEmitterBone = bones[0];
|
|
|
|
|
Ogre::TagPoint* tag = static_cast<Ogre::TagPoint*>(mParent->getParentNode());
|
|
|
|
|
mParticleBone = static_cast<Ogre::Bone*>(tag->getParent());
|
|
|
|
|
|
|
|
|
|