Fix for broken InitWorldSpaceParticles on projectile effects

c++11
scrawl 10 years ago
parent c94c87d409
commit f81c3bcd6d

@ -40,10 +40,12 @@ namespace MWWorld
} }
void ProjectileManager::createModel(State &state, const std::string &model) void ProjectileManager::createModel(State &state, const std::string &model, const osg::Vec3f& pos, const osg::Quat& orient)
{ {
state.mNode = new osg::PositionAttitudeTransform; state.mNode = new osg::PositionAttitudeTransform;
state.mNode->setNodeMask(MWRender::Mask_Effect); state.mNode->setNodeMask(MWRender::Mask_Effect);
state.mNode->setPosition(pos);
state.mNode->setAttitude(orient);
mParent->addChild(state.mNode); mParent->addChild(state.mNode);
mResourceSystem->getSceneManager()->createInstance(model, state.mNode); mResourceSystem->getSceneManager()->createInstance(model, state.mNode);
@ -105,9 +107,7 @@ namespace MWWorld
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), model); MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), model);
MWWorld::Ptr ptr = ref.getPtr(); MWWorld::Ptr ptr = ref.getPtr();
createModel(state, ptr.getClass().getModel(ptr)); createModel(state, ptr.getClass().getModel(ptr), pos, orient);
state.mNode->setPosition(pos);
state.mNode->setAttitude(orient);
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
state.mSound = sndMgr->playManualSound3D(pos, sound, 1.0f, 1.0f, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Loop); state.mSound = sndMgr->playManualSound3D(pos, sound, 1.0f, 1.0f, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Loop);
@ -127,9 +127,7 @@ namespace MWWorld
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), projectile.getCellRef().getRefId()); MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), projectile.getCellRef().getRefId());
MWWorld::Ptr ptr = ref.getPtr(); MWWorld::Ptr ptr = ref.getPtr();
createModel(state, ptr.getClass().getModel(ptr)); createModel(state, ptr.getClass().getModel(ptr), pos, orient);
state.mNode->setPosition(pos);
state.mNode->setAttitude(orient);
mProjectiles.push_back(state); mProjectiles.push_back(state);
} }
@ -342,9 +340,7 @@ namespace MWWorld
return true; return true;
} }
createModel(state, model); createModel(state, model, osg::Vec3f(esm.mPosition), osg::Quat(esm.mOrientation));
state.mNode->setPosition(osg::Vec3f(esm.mPosition));
state.mNode->setAttitude(osg::Quat(esm.mOrientation));
mProjectiles.push_back(state); mProjectiles.push_back(state);
return true; return true;
@ -375,9 +371,7 @@ namespace MWWorld
return true; return true;
} }
createModel(state, model); createModel(state, model, osg::Vec3f(esm.mPosition), osg::Quat(esm.mOrientation));
state.mNode->setPosition(osg::Vec3f(esm.mPosition));
state.mNode->setAttitude(osg::Quat(esm.mOrientation));
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
state.mSound = sndMgr->playManualSound3D(esm.mPosition, esm.mSound, 1.0f, 1.0f, state.mSound = sndMgr->playManualSound3D(esm.mPosition, esm.mSound, 1.0f, 1.0f,

@ -116,7 +116,7 @@ namespace MWWorld
void moveProjectiles(float dt); void moveProjectiles(float dt);
void moveMagicBolts(float dt); void moveMagicBolts(float dt);
void createModel (State& state, const std::string& model); void createModel (State& state, const std::string& model, const osg::Vec3f& pos, const osg::Quat& orient);
void update (State& state, float duration); void update (State& state, float duration);
}; };

Loading…
Cancel
Save