From 1a19cd360766a59eadbc41f8fa4357f9c2fadf97 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 22 Apr 2015 19:08:56 +0200 Subject: [PATCH] Some cleanup --- apps/openmw/mwrender/animation.cpp | 12 ++++++++++++ apps/openmw/mwrender/animation.hpp | 19 +++++++------------ apps/openmw/mwrender/npcanimation.cpp | 14 ++++++++------ apps/openmw/mwrender/npcanimation.hpp | 16 ++++++++-------- apps/openmw/mwrender/objects.hpp | 11 ++++++++--- apps/openmw/mwrender/renderingmanager.cpp | 4 ++-- apps/openmw/mwworld/scene.cpp | 2 ++ components/nifosg/nifloader.hpp | 3 +-- 8 files changed, 48 insertions(+), 33 deletions(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 8a0a85620..75d409aec 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1,5 +1,7 @@ #include "animation.hpp" +#include + #include #include #include @@ -91,6 +93,16 @@ namespace MWRender mInsert->removeChild(mObjectRoot); } + void Animation::updatePtr(const MWWorld::Ptr &ptr) + { + mPtr = ptr; + } + + void Animation::addAnimSource(const std::string &model) + { + + } + osg::Vec3f Animation::runAnimation(float duration) { updateEffects(duration); diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index aef4d4b80..ea47a5b79 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -1,9 +1,6 @@ #ifndef GAME_RENDER_ANIMATION_H #define GAME_RENDER_ANIMATION_H -#include -#include - #include "../mwworld/ptr.hpp" #include @@ -55,7 +52,7 @@ protected: /* This is the number of *discrete* groups. */ static const size_t sNumGroups = 4; - class AnimationTime : public Ogre::ControllerValue + class AnimationTime : public SceneUtil::ControllerSource { private: Animation *mAnimation; @@ -71,8 +68,7 @@ protected: const std::string &getAnimName() const { return mAnimationName; } - virtual Ogre::Real getValue() const; - virtual void setValue(Ogre::Real value); + virtual float getValue(); }; class NullAnimationTime : public SceneUtil::ControllerSource @@ -85,14 +81,15 @@ protected: }; + /* struct AnimSource : public Ogre::AnimationAlloc { //NifOgre::TextKeyMap mTextKeys; std::vector > mControllers[sNumGroups]; }; typedef std::vector< Ogre::SharedPtr > AnimSourceList; - + */ struct AnimState { - Ogre::SharedPtr mSource; + //Ogre::SharedPtr mSource; float mStartTime; float mLoopStartTime; float mLoopStopTime; @@ -115,8 +112,6 @@ protected: }; typedef std::map AnimStateMap; - typedef std::map ObjectAttachMap; - osg::ref_ptr mInsert; osg::ref_ptr mObjectRoot; @@ -204,7 +199,7 @@ protected: /* Adds the keyframe controllers in the specified model as a new animation source. Note that * the filename portion of the provided model name will be prepended with 'x', and the .nif * extension will be replaced with .kf. */ - //void addAnimSource(const std::string &model); + void addAnimSource(const std::string &model); /** Adds an additional light to the given node using the specified ESM record. */ void addExtraLight(osg::ref_ptr parent, const ESM::Light *light); @@ -238,7 +233,7 @@ public: void removeEffect (int effectId); void getLoopingEffects (std::vector& out); - //void updatePtr(const MWWorld::Ptr &ptr); + void updatePtr(const MWWorld::Ptr &ptr); //bool hasAnimation(const std::string &anim); diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 702fd03ae..03af50c71 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -190,12 +190,12 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr par mViewMode(viewMode), mShowWeapons(false), mShowCarriedLeft(true), - mFirstPersonOffset(0.f, 0.f, 0.f), + //mFirstPersonOffset(0.f, 0.f, 0.f), mAlpha(1.f), mNpcType(Type_Normal), - mSoundsDisabled(disableSounds), - mHeadPitch(0.f), - mHeadYaw(0.f) + mSoundsDisabled(disableSounds) + //mHeadPitch(0.f), + //mHeadYaw(0.f) { mNpc = mPtr.get()->mBase; @@ -562,11 +562,11 @@ void NpcAnimation::updateParts() if (wasArrowAttached) attachArrow(); } - +/* void NpcAnimation::addFirstPersonOffset(const Ogre::Vector3 &offset) { mFirstPersonOffset += offset; -} +}*/ Animation::PartHolderPtr NpcAnimation::insertBoundedPart(const std::string& model, int group, const std::string& bonename, const std::string& bonefilter, bool enchantedGlow, osg::Vec4f* glowColor) { @@ -903,6 +903,7 @@ void NpcAnimation::setVampire(bool vampire) } } +/* void NpcAnimation::setHeadPitch(Ogre::Radian pitch) { mHeadPitch = pitch; @@ -922,5 +923,6 @@ Ogre::Radian NpcAnimation::getHeadYaw() const { return mHeadYaw; } +*/ } diff --git a/apps/openmw/mwrender/npcanimation.hpp b/apps/openmw/mwrender/npcanimation.hpp index 309bc5ef5..0c91dfe6e 100644 --- a/apps/openmw/mwrender/npcanimation.hpp +++ b/apps/openmw/mwrender/npcanimation.hpp @@ -90,7 +90,7 @@ private: int mPartslots[ESM::PRT_Count]; //Each part slot is taken by clothing, armor, or is empty int mPartPriorities[ESM::PRT_Count]; - Ogre::Vector3 mFirstPersonOffset; + //Ogre::Vector3 mFirstPersonOffset; boost::shared_ptr mHeadAnimationTime; //Ogre::SharedPtr mWeaponAnimationTime; @@ -98,8 +98,8 @@ private: float mAlpha; bool mSoundsDisabled; - Ogre::Radian mHeadYaw; - Ogre::Radian mHeadPitch; + //Ogre::Radian mHeadYaw; + //Ogre::Radian mHeadPitch; void updateNpcBase(); @@ -144,10 +144,10 @@ public: /// to indicate the facing orientation of the character. virtual void setPitchFactor(float factor) { mPitchFactor = factor; } - virtual void setHeadPitch(Ogre::Radian pitch); - virtual void setHeadYaw(Ogre::Radian yaw); - virtual Ogre::Radian getHeadPitch() const; - virtual Ogre::Radian getHeadYaw() const; + //virtual void setHeadPitch(Ogre::Radian pitch); + //virtual void setHeadYaw(Ogre::Radian yaw); + //virtual Ogre::Radian getHeadPitch() const; + //virtual Ogre::Radian getHeadYaw() const; virtual void showWeapons(bool showWeapon); virtual void showCarriedLeft(bool show); @@ -167,7 +167,7 @@ public: /// \brief Applies a translation to the arms and hands. /// This may be called multiple times before the animation /// is updated to add additional offsets. - void addFirstPersonOffset(const Ogre::Vector3 &offset); + //void addFirstPersonOffset(const Ogre::Vector3 &offset); /// Rebuilds the NPC, updating their root model, animation sources, and equipment. void rebuild(); diff --git a/apps/openmw/mwrender/objects.hpp b/apps/openmw/mwrender/objects.hpp index f4d5675aa..2acf10d10 100644 --- a/apps/openmw/mwrender/objects.hpp +++ b/apps/openmw/mwrender/objects.hpp @@ -1,9 +1,9 @@ #ifndef GAME_RENDER_OBJECTS_H #define GAME_RENDER_OBJECTS_H -#include - -#include +#include +#include +#include #include @@ -12,6 +12,11 @@ namespace osg class Group; } +namespace Resource +{ + class ResourceSystem; +} + namespace MWWorld { class Ptr; diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index dc5b584cc..5199e6e12 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -10,12 +10,12 @@ #include +#include + #include #include - #include - #include #include diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index aabe4d6d8..ef9e5792b 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include diff --git a/components/nifosg/nifloader.hpp b/components/nifosg/nifloader.hpp index 1c403a4fe..d1437ff2a 100644 --- a/components/nifosg/nifloader.hpp +++ b/components/nifosg/nifloader.hpp @@ -44,7 +44,7 @@ namespace NifOsg public: TextKeyMap mTextKeys; - std::map > mKeyframeControllers; + std::map > mKeyframeControllers; }; /// The main class responsible for loading NIF files into an OSG-Scenegraph. @@ -53,7 +53,6 @@ namespace NifOsg class Loader { public: - // TODO: add text keys as user data on the node /// Create a scene graph for the given NIF. Auto-detects when skinning is used and calls loadAsSkeleton instead. /// @param node The parent of the new root node for the created scene graph. static osg::ref_ptr load(Nif::NIFFilePtr file, Resource::TextureManager* textureManager);