2014-03-12 10:30:44 +00:00
|
|
|
#ifndef OPENMW_MWRENDER_WEAPONANIMATION_H
|
|
|
|
#define OPENMW_MWRENDER_WEAPONANIMATION_H
|
|
|
|
|
2015-05-30 23:07:43 +00:00
|
|
|
#include <components/sceneutil/controller.hpp>
|
|
|
|
|
2014-03-12 10:30:44 +00:00
|
|
|
#include "../mwworld/ptr.hpp"
|
2015-05-30 23:07:43 +00:00
|
|
|
#include "animation.hpp"
|
2014-03-12 10:30:44 +00:00
|
|
|
|
|
|
|
namespace MWRender
|
|
|
|
{
|
|
|
|
|
2015-05-30 23:07:43 +00:00
|
|
|
class WeaponAnimationTime : public SceneUtil::ControllerSource
|
2014-03-12 10:30:44 +00:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
Animation* mAnimation;
|
|
|
|
std::string mWeaponGroup;
|
|
|
|
float mStartTime;
|
|
|
|
public:
|
|
|
|
WeaponAnimationTime(Animation* animation) : mAnimation(animation), mStartTime(0) {}
|
|
|
|
void setGroup(const std::string& group);
|
|
|
|
void updateStartTime();
|
|
|
|
|
2015-05-30 23:07:43 +00:00
|
|
|
virtual float getValue(osg::NodeVisitor* nv);
|
2014-03-12 10:30:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Handles attach & release of projectiles for ranged weapons
|
|
|
|
class WeaponAnimation
|
|
|
|
{
|
|
|
|
public:
|
2015-05-30 23:07:43 +00:00
|
|
|
WeaponAnimation();
|
2014-05-15 01:12:52 +00:00
|
|
|
virtual ~WeaponAnimation() {}
|
2014-03-12 10:30:44 +00:00
|
|
|
|
2015-01-31 18:46:15 +00:00
|
|
|
/// @note If no weapon (or an invalid weapon) is equipped, this function is a no-op.
|
2015-05-30 23:07:43 +00:00
|
|
|
void attachArrow(MWWorld::Ptr actor);
|
2015-01-31 18:46:15 +00:00
|
|
|
|
|
|
|
/// @note If no weapon (or an invalid weapon) is equipped, this function is a no-op.
|
2015-05-30 23:07:43 +00:00
|
|
|
void releaseArrow(MWWorld::Ptr actor);
|
2014-03-12 10:30:44 +00:00
|
|
|
|
|
|
|
protected:
|
2015-05-30 23:07:43 +00:00
|
|
|
PartHolderPtr mAmmunition;
|
|
|
|
|
|
|
|
virtual osg::Group* getArrowBone() = 0;
|
|
|
|
virtual osg::Node* getWeaponNode() = 0;
|
|
|
|
virtual Resource::ResourceSystem* getResourceSystem() = 0;
|
|
|
|
|
2014-03-12 10:30:44 +00:00
|
|
|
|
2015-04-15 20:11:38 +00:00
|
|
|
//virtual NifOgre::ObjectScenePtr getWeapon() = 0;
|
2014-03-12 10:30:44 +00:00
|
|
|
virtual void showWeapon(bool show) = 0;
|
2015-04-15 20:11:38 +00:00
|
|
|
//virtual void configureAddedObject(NifOgre::ObjectScenePtr object, MWWorld::Ptr ptr, int slot) = 0;
|
2014-03-12 10:30:44 +00:00
|
|
|
|
|
|
|
/// A relative factor (0-1) that decides if and how much the skeleton should be pitched
|
|
|
|
/// to indicate the facing orientation of the character, for ranged weapon aiming.
|
|
|
|
float mPitchFactor;
|
|
|
|
|
2015-04-15 20:11:38 +00:00
|
|
|
//void pitchSkeleton(float xrot, Ogre::SkeletonInstance* skel);
|
2014-03-12 10:30:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|