Some cleanup

c++11
scrawl 10 years ago
parent 460304b069
commit 1a19cd3607

@ -1,5 +1,7 @@
#include "animation.hpp"
#include <iomanip>
#include <osg/PositionAttitudeTransform>
#include <osg/TexGen>
#include <osg/TexEnvCombine>
@ -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);

@ -1,9 +1,6 @@
#ifndef GAME_RENDER_ANIMATION_H
#define GAME_RENDER_ANIMATION_H
#include <OgreController.h>
#include <OgreVector3.h>
#include "../mwworld/ptr.hpp"
#include <components/nifosg/controller.hpp>
@ -55,7 +52,7 @@ protected:
/* This is the number of *discrete* groups. */
static const size_t sNumGroups = 4;
class AnimationTime : public Ogre::ControllerValue<Ogre::Real>
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<Ogre::Controller<Ogre::Real> > mControllers[sNumGroups];
};
typedef std::vector< Ogre::SharedPtr<AnimSource> > AnimSourceList;
*/
struct AnimState {
Ogre::SharedPtr<AnimSource> mSource;
//Ogre::SharedPtr<AnimSource> mSource;
float mStartTime;
float mLoopStartTime;
float mLoopStopTime;
@ -115,8 +112,6 @@ protected:
};
typedef std::map<std::string,AnimState> AnimStateMap;
typedef std::map<Ogre::MovableObject*,std::string> ObjectAttachMap;
osg::ref_ptr<osg::Group> mInsert;
osg::ref_ptr<osg::Node> 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<osg::Group> parent, const ESM::Light *light);
@ -238,7 +233,7 @@ public:
void removeEffect (int effectId);
void getLoopingEffects (std::vector<int>& out);
//void updatePtr(const MWWorld::Ptr &ptr);
void updatePtr(const MWWorld::Ptr &ptr);
//bool hasAnimation(const std::string &anim);

@ -190,12 +190,12 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group> 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<ESM::NPC>()->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;
}
*/
}

@ -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<HeadAnimationTime> mHeadAnimationTime;
//Ogre::SharedPtr<WeaponAnimationTime> 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();

@ -1,9 +1,9 @@
#ifndef GAME_RENDER_OBJECTS_H
#define GAME_RENDER_OBJECTS_H
#include <OgreAxisAlignedBox.h>
#include <components/resource/resourcesystem.hpp>
#include <map>
#include <memory>
#include <string>
#include <osg/ref_ptr>
@ -12,6 +12,11 @@ namespace osg
class Group;
}
namespace Resource
{
class ResourceSystem;
}
namespace MWWorld
{
class Ptr;

@ -10,12 +10,12 @@
#include <osgViewer/Viewer>
#include <components/resource/resourcesystem.hpp>
#include <components/settings/settings.hpp>
#include <components/sceneutil/util.hpp>
#include <components/sceneutil/lightmanager.hpp>
#include <components/sceneutil/statesetupdater.hpp>
#include <components/esm/loadcell.hpp>

@ -5,6 +5,8 @@
#include <components/nif/niffile.hpp>
#include <components/misc/resourcehelpers.hpp>
#include <components/settings/settings.hpp>
#include <components/resource/resourcesystem.hpp>
#include <components/vfs/manager.hpp>
#include <osg/PositionAttitudeTransform>

@ -44,7 +44,7 @@ namespace NifOsg
public:
TextKeyMap mTextKeys;
std::map<std::string, osg::ref_ptr<SourcedKeyframeController> > mKeyframeControllers;
std::map<std::string, osg::ref_ptr<const SourcedKeyframeController> > 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<osg::Node> load(Nif::NIFFilePtr file, Resource::TextureManager* textureManager);

Loading…
Cancel
Save