From a066b2430331e156f340e50f32dd56785d945df3 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 31 May 2015 01:07:43 +0200 Subject: [PATCH] Restore WeaponAnimation --- apps/openmw/CMakeLists.txt | 2 +- apps/openmw/mwbase/world.hpp | 3 +- apps/openmw/mwmechanics/character.cpp | 2 +- apps/openmw/mwrender/animation.hpp | 51 ++++++++-------- apps/openmw/mwrender/camera.cpp | 2 +- apps/openmw/mwrender/creatureanimation.cpp | 58 +++++++++++------- apps/openmw/mwrender/creatureanimation.hpp | 16 ++--- apps/openmw/mwrender/npcanimation.cpp | 49 +++++++++++---- apps/openmw/mwrender/npcanimation.hpp | 6 +- apps/openmw/mwrender/weaponanimation.cpp | 69 ++++++++++------------ apps/openmw/mwrender/weaponanimation.hpp | 26 ++++---- apps/openmw/mwworld/worldimp.cpp | 2 +- apps/openmw/mwworld/worldimp.hpp | 2 +- components/esm/defs.hpp | 2 + 14 files changed, 170 insertions(+), 120 deletions(-) diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index b4ecdd956..2193f4ca0 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -21,7 +21,7 @@ source_group(game FILES ${GAME} ${GAME_HEADER}) add_openmw_dir (mwrender actors objects renderingmanager animation sky npcanimation vismask - creatureanimation effectmanager util renderinginterface pathgrid rendermode + creatureanimation effectmanager util renderinginterface pathgrid rendermode weaponanimation bulletdebugdraw globalmap characterpreview camera localmap # occlusionquery water shadows # ripplesimulation refraction diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index c0e2ade0f..4d01f9529 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -22,6 +22,7 @@ namespace Ogre namespace osg { class Vec3f; + class Quat; } namespace Loading @@ -486,7 +487,7 @@ namespace MWBase float speed, bool stack, const ESM::EffectList& effects, const MWWorld::Ptr& caster, const std::string& sourceName, const Ogre::Vector3& fallbackDirection) = 0; virtual void launchProjectile (MWWorld::Ptr actor, MWWorld::Ptr projectile, - const Ogre::Vector3& worldPos, const Ogre::Quaternion& orient, MWWorld::Ptr bow, float speed) = 0; + const osg::Vec3f& worldPos, const osg::Quat& orient, MWWorld::Ptr bow, float speed) = 0; virtual const std::vector& getContentFiles() const = 0; diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 379025c9e..5765d8b04 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -812,7 +812,7 @@ void CharacterController::handleTextKey(const std::string &groupname, const std: else if (evt.compare(off, len, "shoot attach") == 0) mAnimation->attachArrow(); else if (evt.compare(off, len, "shoot release") == 0) - {;}//mAnimation->releaseArrow(); + mAnimation->releaseArrow(); else if (evt.compare(off, len, "shoot follow attach") == 0) mAnimation->attachArrow(); diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index d1a1b01c6..86dd21df4 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -39,6 +39,31 @@ public: EffectAnimationTime() : mTime(0) { } }; +/// @brief Detaches the node from its parent when the object goes out of scope. +class PartHolder +{ +public: + PartHolder(osg::ref_ptr node) + : mNode(node) + { + } + + ~PartHolder() + { + if (mNode->getNumParents()) + mNode->getParent(0)->removeChild(mNode); + } + + osg::ref_ptr getNode() + { + return mNode; + } + +private: + osg::ref_ptr mNode; +}; +typedef boost::shared_ptr PartHolderPtr; + class Animation { public: @@ -174,31 +199,6 @@ protected: osg::Vec3f mAccumulate; - /// @brief Detaches the node from its parent when the object goes out of scope. - class PartHolder - { - public: - PartHolder(osg::ref_ptr node) - : mNode(node) - { - } - - ~PartHolder() - { - if (mNode->getNumParents()) - mNode->getParent(0)->removeChild(mNode); - } - - osg::ref_ptr getNode() - { - return mNode; - } - - private: - osg::ref_ptr mNode; - }; - typedef boost::shared_ptr PartHolderPtr; - struct EffectParams { std::string mModelName; // Just here so we don't add the same effect twice @@ -378,6 +378,7 @@ public: virtual void setAlpha(float alpha) {} virtual void setPitchFactor(float factor) {} virtual void attachArrow() {} + virtual void releaseArrow() {} virtual void enableHeadAnimation(bool enable) {} // TODO: move outside of this class /// Makes this object glow, by placing a Light in its center. diff --git a/apps/openmw/mwrender/camera.cpp b/apps/openmw/mwrender/camera.cpp index a945a171e..392f8978a 100644 --- a/apps/openmw/mwrender/camera.cpp +++ b/apps/openmw/mwrender/camera.cpp @@ -361,7 +361,7 @@ namespace MWRender if(isFirstPerson()) { mAnimation->setViewMode(NpcAnimation::VM_FirstPerson); - mTrackingNode = mAnimation->getNode("Head"); + mTrackingNode = mAnimation->getNode("Camera"); } else { diff --git a/apps/openmw/mwrender/creatureanimation.cpp b/apps/openmw/mwrender/creatureanimation.cpp index b653f4d30..b98b26179 100644 --- a/apps/openmw/mwrender/creatureanimation.cpp +++ b/apps/openmw/mwrender/creatureanimation.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "../mwbase/world.hpp" @@ -52,7 +53,7 @@ CreatureWeaponAnimation::CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const updateParts(); } - //mWeaponAnimationTime = Ogre::SharedPtr(new WeaponAnimationTime(this)); + mWeaponAnimationTime = boost::shared_ptr(new WeaponAnimationTime(this)); } void CreatureWeaponAnimation::showWeapons(bool showWeapon) @@ -122,35 +123,52 @@ void CreatureWeaponAnimation::updatePart(PartHolderPtr& scene, int slot) MWWorld::ContainerStoreIterator ammo = inv.getSlot(MWWorld::InventoryStore::Slot_Ammunition); if (ammo != inv.end() && ammo->get()->mBase->mData.mType == ESM::Weapon::Bolt) attachArrow(); - //else - // mAmmunition.setNull(); + else + mAmmunition.reset(); } - //else - //mAmmunition.setNull(); + else + mAmmunition.reset(); - /* - std::vector >::iterator ctrl(scene->mControllers.begin()); - for(;ctrl != scene->mControllers.end();++ctrl) - { - if(ctrl->getSource().isNull()) - { - if (slot == MWWorld::InventoryStore::Slot_CarriedRight) - ctrl->setSource(mWeaponAnimationTime); - else - ctrl->setSource(Ogre::SharedPtr(new NullAnimationTime())); - } - } - */ + boost::shared_ptr source; + + if (slot == MWWorld::InventoryStore::Slot_CarriedRight) + source = mWeaponAnimationTime; + else + source.reset(new NullAnimationTime); + + SceneUtil::AssignControllerSourcesVisitor assignVisitor(source); + node->accept(assignVisitor); } void CreatureWeaponAnimation::attachArrow() { - //WeaponAnimation::attachArrow(mPtr); + WeaponAnimation::attachArrow(mPtr); } void CreatureWeaponAnimation::releaseArrow() { - //WeaponAnimation::releaseArrow(mPtr); + WeaponAnimation::releaseArrow(mPtr); +} + +osg::Group *CreatureWeaponAnimation::getArrowBone() +{ + if (!mWeapon) + return NULL; + + SceneUtil::FindByNameVisitor findVisitor ("ArrowBone"); + mWeapon->getNode()->accept(findVisitor); + + return findVisitor.mFoundNode; +} + +osg::Node *CreatureWeaponAnimation::getWeaponNode() +{ + return mWeapon ? mWeapon->getNode().get() : NULL; +} + +Resource::ResourceSystem *CreatureWeaponAnimation::getResourceSystem() +{ + return mResourceSystem; } osg::Vec3f CreatureWeaponAnimation::runAnimation(float duration) diff --git a/apps/openmw/mwrender/creatureanimation.hpp b/apps/openmw/mwrender/creatureanimation.hpp index ccb553d99..61d077df3 100644 --- a/apps/openmw/mwrender/creatureanimation.hpp +++ b/apps/openmw/mwrender/creatureanimation.hpp @@ -22,7 +22,7 @@ namespace MWRender // For creatures with weapons and shields // Animation is already virtual anyway, so might as well make a separate class. // Most creatures don't need weapons/shields, so this will save some memory. - class CreatureWeaponAnimation : public Animation/*, public WeaponAnimation*/, public MWWorld::InventoryStoreListener + class CreatureWeaponAnimation : public Animation, public WeaponAnimation, public MWWorld::InventoryStoreListener { public: CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const std::string& model, Resource::ResourceSystem* resourceSystem); @@ -39,6 +39,12 @@ namespace MWRender virtual void attachArrow(); virtual void releaseArrow(); + // WeaponAnimation + virtual osg::Group* getArrowBone(); + virtual osg::Node* getWeaponNode(); + virtual Resource::ResourceSystem* getResourceSystem(); + virtual void showWeapon(bool show) { showWeapons(show); } + virtual void setWeaponGroup(const std::string& group) { mWeaponAnimationTime->setGroup(group); } virtual osg::Vec3f runAnimation(float duration); @@ -46,12 +52,6 @@ namespace MWRender /// to indicate the facing orientation of the character. //virtual void setPitchFactor(float factor) { mPitchFactor = factor; } - //virtual void setWeaponGroup(const std::string& group) { mWeaponAnimationTime->setGroup(group); } - - // WeaponAnimation - //virtual NifOgre::ObjectScenePtr getWeapon() { return mWeapon; } - //virtual void showWeapon(bool show) { showWeapons(show); } - //virtual void configureAddedObject(NifOgre::ObjectScenePtr object, MWWorld::Ptr ptr, int slot); private: PartHolderPtr mWeapon; @@ -59,7 +59,7 @@ namespace MWRender bool mShowWeapons; bool mShowCarriedLeft; - //Ogre::SharedPtr mWeaponAnimationTime; + boost::shared_ptr mWeaponAnimationTime; }; } diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index aeff1f60a..e9e3b7aef 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -2,6 +2,9 @@ #include + +#include // XXX + #include #include @@ -9,6 +12,7 @@ #include #include #include +#include #include // TextKeyMapHolder @@ -203,7 +207,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr par mNpc = mPtr.get()->mBase; mHeadAnimationTime = boost::shared_ptr(new HeadAnimationTime(mPtr)); - //mWeaponAnimationTime = Ogre::SharedPtr(new WeaponAnimationTime(this)); + mWeaponAnimationTime = boost::shared_ptr(new WeaponAnimationTime(this)); for(size_t i = 0;i < ESM::PRT_Count;i++) { @@ -333,7 +337,7 @@ void NpcAnimation::updateNpcBase() removeIndividualPart((ESM::PartReferenceType)i); updateParts(); - //mWeaponAnimationTime->updateStartTime(); + mWeaponAnimationTime->updateStartTime(); } void NpcAnimation::updateParts() @@ -585,7 +589,7 @@ void NpcAnimation::addFirstPersonOffset(const Ogre::Vector3 &offset) mFirstPersonOffset += offset; }*/ -Animation::PartHolderPtr NpcAnimation::insertBoundedPart(const std::string& model, const std::string& bonename, const std::string& bonefilter, bool enchantedGlow, osg::Vec4f* glowColor) +PartHolderPtr NpcAnimation::insertBoundedPart(const std::string& model, const std::string& bonename, const std::string& bonefilter, bool enchantedGlow, osg::Vec4f* glowColor) { osg::ref_ptr instance = mResourceSystem->getSceneManager()->createInstance(model); osg::ref_ptr attached = SceneUtil::attach(instance, mObjectRoot, bonefilter, bonename); @@ -729,8 +733,8 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g } } } - //else if (type == ESM::PRT_Weapon) - // src = mWeaponAnimationTime; + else if (type == ESM::PRT_Weapon) + src = mWeaponAnimationTime; else src.reset(new NullAnimationTime); @@ -809,11 +813,11 @@ void NpcAnimation::showWeapons(bool showWeapon) MWWorld::ContainerStoreIterator ammo = inv.getSlot(MWWorld::InventoryStore::Slot_Ammunition); if (ammo != inv.end() && ammo->get()->mBase->mData.mType == ESM::Weapon::Bolt) attachArrow(); - //else - //mAmmunition.setNull(); + else + mAmmunition.reset(); } - //else - //mAmmunition.setNull(); + else + mAmmunition.reset(); } } else @@ -853,6 +857,31 @@ void NpcAnimation::releaseArrow() WeaponAnimation::releaseArrow(mPtr); } +osg::Group* NpcAnimation::getArrowBone() +{ + PartHolderPtr part = mObjectParts[ESM::PRT_Weapon]; + if (!part) + return NULL; + + SceneUtil::FindByNameVisitor findVisitor ("ArrowBone"); + part->getNode()->accept(findVisitor); + + return findVisitor.mFoundNode; +} + +osg::Node* NpcAnimation::getWeaponNode() +{ + PartHolderPtr part = mObjectParts[ESM::PRT_Weapon]; + if (!part) + return NULL; + return part->getNode(); +} + +Resource::ResourceSystem* NpcAnimation::getResourceSystem() +{ + return mResourceSystem; +} + void NpcAnimation::permanentEffectAdded(const ESM::MagicEffect *magicEffect, bool isNew, bool playSound) { // During first auto equip, we don't play any sounds. @@ -897,7 +926,7 @@ void NpcAnimation::enableHeadAnimation(bool enable) void NpcAnimation::setWeaponGroup(const std::string &group) { - //mWeaponAnimationTime-> + mWeaponAnimationTime->setGroup(group); } void NpcAnimation::equipmentChanged() diff --git a/apps/openmw/mwrender/npcanimation.hpp b/apps/openmw/mwrender/npcanimation.hpp index eda59f50c..0f90bb2d7 100644 --- a/apps/openmw/mwrender/npcanimation.hpp +++ b/apps/openmw/mwrender/npcanimation.hpp @@ -95,7 +95,7 @@ private: //Ogre::Vector3 mFirstPersonOffset; boost::shared_ptr mHeadAnimationTime; - //Ogre::SharedPtr mWeaponAnimationTime; + boost::shared_ptr mWeaponAnimationTime; float mAlpha; bool mSoundsDisabled; @@ -157,6 +157,10 @@ public: virtual void attachArrow(); virtual void releaseArrow(); + virtual osg::Group* getArrowBone(); + virtual osg::Node* getWeaponNode(); + virtual Resource::ResourceSystem* getResourceSystem(); + // WeaponAnimation //virtual NifOgre::ObjectScenePtr getWeapon() { return mObjectParts[ESM::PRT_Weapon]; } virtual void showWeapon(bool show) { showWeapons(show); } diff --git a/apps/openmw/mwrender/weaponanimation.cpp b/apps/openmw/mwrender/weaponanimation.cpp index d16afe3ce..23a74fb95 100644 --- a/apps/openmw/mwrender/weaponanimation.cpp +++ b/apps/openmw/mwrender/weaponanimation.cpp @@ -1,9 +1,7 @@ #include "weaponanimation.hpp" -#include -#include -#include -#include +#include +#include #include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" @@ -21,10 +19,11 @@ namespace MWRender { -float WeaponAnimationTime::getValue() const +float WeaponAnimationTime::getValue(osg::NodeVisitor*) { if (mWeaponGroup.empty()) return 0; + float current = mAnimation->getCurrentTime(mWeaponGroup); if (current == -1) return 0; @@ -42,6 +41,11 @@ void WeaponAnimationTime::updateStartTime() setGroup(mWeaponGroup); } +WeaponAnimation::WeaponAnimation() + : mPitchFactor(0) +{ +} + void WeaponAnimation::attachArrow(MWWorld::Ptr actor) { MWWorld::InventoryStore& inv = actor.getClass().getInventoryStore(actor); @@ -63,8 +67,8 @@ void WeaponAnimation::attachArrow(MWWorld::Ptr actor) } else if (weaponType == ESM::Weapon::MarksmanBow || weaponType == ESM::Weapon::MarksmanCrossbow) { - NifOgre::ObjectScenePtr weapon = getWeapon(); - if (!weapon.get()) + osg::Group* parent = getArrowBone(); + if (!parent) return; MWWorld::ContainerStoreIterator ammo = inv.getSlot(MWWorld::InventoryStore::Slot_Ammunition); @@ -72,12 +76,9 @@ void WeaponAnimation::attachArrow(MWWorld::Ptr actor) return; std::string model = ammo->getClass().getModel(*ammo); - if (!weapon->mSkelBase) - throw std::runtime_error("Need a skeleton to attach the arrow to"); + osg::ref_ptr arrow = getResourceSystem()->getSceneManager()->createInstance(model, parent); - const std::string bonename = "ArrowBone"; - mAmmunition = NifOgre::Loader::createObjects(weapon->mSkelBase, bonename, bonename, weapon->mSkelBase->getParentSceneNode(), model); - configureAddedObject(mAmmunition, *ammo, MWWorld::InventoryStore::Slot_Ammunition); + mAmmunition = PartHolderPtr(new PartHolder(arrow)); } } @@ -91,8 +92,8 @@ void WeaponAnimation::releaseArrow(MWWorld::Ptr actor) return; // The orientation of the launched projectile. Always the same as the actor orientation, even if the ArrowBone's orientation dictates otherwise. - Ogre::Quaternion orient = Ogre::Quaternion(Ogre::Radian(actor.getRefData().getPosition().rot[2]), Ogre::Vector3::NEGATIVE_UNIT_Z) * - Ogre::Quaternion(Ogre::Radian(actor.getRefData().getPosition().rot[0]), Ogre::Vector3::NEGATIVE_UNIT_X); + osg::Quat orient = osg::Quat(actor.getRefData().getPosition().rot[0], osg::Vec3f(-1,0,0)) + * osg::Quat(actor.getRefData().getPosition().rot[2], osg::Vec3f(0,0,-1)); const MWWorld::Store &gmst = MWBase::Environment::get().getWorld()->getStore().get(); @@ -102,18 +103,13 @@ void WeaponAnimation::releaseArrow(MWWorld::Ptr actor) if (weapon->get()->mBase->mData.mType == ESM::Weapon::MarksmanThrown) { // Thrown weapons get detached now - NifOgre::ObjectScenePtr objects = getWeapon(); - - Ogre::Vector3 launchPos(0,0,0); - if (objects->mSkelBase) - { - launchPos = objects->mSkelBase->getParentNode()->_getDerivedPosition(); - } - else if (objects->mEntities.size()) - { - objects->mEntities[0]->getParentNode()->needUpdate(true); - launchPos = objects->mEntities[0]->getParentNode()->_getDerivedPosition(); - } + osg::Node* weaponNode = getWeaponNode(); + if (!weaponNode) + return; + osg::MatrixList mats = weaponNode->getWorldMatrices(); + if (mats.empty()) + return; + osg::Vec3f launchPos = mats[0].getTrans(); float fThrownWeaponMinSpeed = gmst.find("fThrownWeaponMinSpeed")->getFloat(); float fThrownWeaponMaxSpeed = gmst.find("fThrownWeaponMaxSpeed")->getFloat(); @@ -133,19 +129,14 @@ void WeaponAnimation::releaseArrow(MWWorld::Ptr actor) if (ammo == inv.end()) return; - if (!mAmmunition.get()) + if (!mAmmunition) return; - Ogre::Vector3 launchPos(0,0,0); - if (mAmmunition->mSkelBase) - { - launchPos = mAmmunition->mSkelBase->getParentNode()->_getDerivedPosition(); - } - else if (mAmmunition->mEntities.size()) - { - mAmmunition->mEntities[0]->getParentNode()->needUpdate(true); - launchPos = mAmmunition->mEntities[0]->getParentNode()->_getDerivedPosition(); - } + osg::ref_ptr ammoNode = mAmmunition->getNode(); + osg::MatrixList mats = ammoNode->getWorldMatrices(); + if (mats.empty()) + return; + osg::Vec3f launchPos = mats[0].getTrans(); float fProjectileMinSpeed = gmst.find("fProjectileMinSpeed")->getFloat(); float fProjectileMaxSpeed = gmst.find("fProjectileMaxSpeed")->getFloat(); @@ -154,10 +145,11 @@ void WeaponAnimation::releaseArrow(MWWorld::Ptr actor) MWBase::Environment::get().getWorld()->launchProjectile(actor, *ammo, launchPos, orient, *weapon, speed); inv.remove(*ammo, 1, actor); - mAmmunition.setNull(); + mAmmunition.reset(); } } +/* void WeaponAnimation::pitchSkeleton(float xrot, Ogre::SkeletonInstance* skel) { if (mPitchFactor == 0) @@ -179,5 +171,6 @@ void WeaponAnimation::pitchSkeleton(float xrot, Ogre::SkeletonInstance* skel) node = skel->getBone("Bip01 Spine1"); node->pitch(Ogre::Radian(-pitch/2), Ogre::Node::TS_WORLD); } +*/ } diff --git a/apps/openmw/mwrender/weaponanimation.hpp b/apps/openmw/mwrender/weaponanimation.hpp index 400962856..f46638ac8 100644 --- a/apps/openmw/mwrender/weaponanimation.hpp +++ b/apps/openmw/mwrender/weaponanimation.hpp @@ -1,15 +1,15 @@ #ifndef OPENMW_MWRENDER_WEAPONANIMATION_H #define OPENMW_MWRENDER_WEAPONANIMATION_H +#include + #include "../mwworld/ptr.hpp" +#include "animation.hpp" namespace MWRender { - class Animation; - - /* - class WeaponAnimationTime : public Ogre::ControllerValue + class WeaponAnimationTime : public SceneUtil::ControllerSource { private: Animation* mAnimation; @@ -20,27 +20,29 @@ namespace MWRender void setGroup(const std::string& group); void updateStartTime(); - virtual Ogre::Real getValue() const; - virtual void setValue(Ogre::Real value) - { } + virtual float getValue(osg::NodeVisitor* nv); }; - */ /// Handles attach & release of projectiles for ranged weapons class WeaponAnimation { public: - WeaponAnimation() : mPitchFactor(0) {} + WeaponAnimation(); virtual ~WeaponAnimation() {} /// @note If no weapon (or an invalid weapon) is equipped, this function is a no-op. - void attachArrow(MWWorld::Ptr actor) {} + void attachArrow(MWWorld::Ptr actor); /// @note If no weapon (or an invalid weapon) is equipped, this function is a no-op. - void releaseArrow(MWWorld::Ptr actor) {} + void releaseArrow(MWWorld::Ptr actor); protected: - //NifOgre::ObjectScenePtr mAmmunition; + PartHolderPtr mAmmunition; + + virtual osg::Group* getArrowBone() = 0; + virtual osg::Node* getWeaponNode() = 0; + virtual Resource::ResourceSystem* getResourceSystem() = 0; + //virtual NifOgre::ObjectScenePtr getWeapon() = 0; virtual void showWeapon(bool show) = 0; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 39b26c5d2..768177b16 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -2757,7 +2757,7 @@ namespace MWWorld } void World::launchProjectile (MWWorld::Ptr actor, MWWorld::Ptr projectile, - const Ogre::Vector3& worldPos, const Ogre::Quaternion& orient, MWWorld::Ptr bow, float speed) + const osg::Vec3f& worldPos, const osg::Quat& orient, MWWorld::Ptr bow, float speed) { #if 0 mProjectileManager->launchProjectile(actor, projectile, worldPos, orient, bow, speed); diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index b642a1ba7..b1718f030 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -574,7 +574,7 @@ namespace MWWorld float speed, bool stack, const ESM::EffectList& effects, const MWWorld::Ptr& caster, const std::string& sourceName, const Ogre::Vector3& fallbackDirection); virtual void launchProjectile (MWWorld::Ptr actor, MWWorld::Ptr projectile, - const Ogre::Vector3& worldPos, const Ogre::Quaternion& orient, MWWorld::Ptr bow, float speed); + const osg::Vec3f& worldPos, const osg::Quat& orient, MWWorld::Ptr bow, float speed); virtual const std::vector& getContentFiles() const; diff --git a/components/esm/defs.hpp b/components/esm/defs.hpp index 8ce76a8ea..9f1a935ae 100644 --- a/components/esm/defs.hpp +++ b/components/esm/defs.hpp @@ -38,6 +38,8 @@ enum RangeType struct Position { float pos[3]; + + // In radians float rot[3]; osg::Vec3f asVec3() const