2014-01-05 18:22:29 +01:00
|
|
|
#ifndef GAME_RENDER_CREATUREANIMATION_H
|
|
|
|
#define GAME_RENDER_CREATUREANIMATION_H
|
2011-11-24 01:48:54 -05:00
|
|
|
|
|
|
|
#include "animation.hpp"
|
2014-03-12 11:30:44 +01:00
|
|
|
#include "weaponanimation.hpp"
|
2014-01-19 13:05:26 +01:00
|
|
|
#include "../mwworld/inventorystore.hpp"
|
2011-12-11 22:40:00 -05:00
|
|
|
|
2013-01-05 21:12:08 -08:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class Ptr;
|
|
|
|
}
|
2011-11-24 01:48:54 -05:00
|
|
|
|
2013-01-05 21:12:08 -08:00
|
|
|
namespace MWRender
|
|
|
|
{
|
|
|
|
class CreatureAnimation : public Animation
|
2012-09-15 00:57:29 +02:00
|
|
|
{
|
2011-12-11 22:40:00 -05:00
|
|
|
public:
|
2015-04-19 03:05:47 +02:00
|
|
|
CreatureAnimation(const MWWorld::Ptr &ptr, const std::string& model, Resource::ResourceSystem* resourceSystem);
|
2014-01-19 13:05:26 +01:00
|
|
|
virtual ~CreatureAnimation() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
// 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.
|
2015-05-31 01:07:43 +02:00
|
|
|
class CreatureWeaponAnimation : public Animation, public WeaponAnimation, public MWWorld::InventoryStoreListener
|
2014-01-19 13:05:26 +01:00
|
|
|
{
|
|
|
|
public:
|
2015-04-19 03:05:47 +02:00
|
|
|
CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const std::string& model, Resource::ResourceSystem* resourceSystem);
|
2014-01-19 13:05:26 +01:00
|
|
|
virtual ~CreatureWeaponAnimation() {}
|
|
|
|
|
|
|
|
virtual void equipmentChanged() { updateParts(); }
|
|
|
|
|
|
|
|
virtual void showWeapons(bool showWeapon);
|
|
|
|
virtual void showCarriedLeft(bool show);
|
|
|
|
|
|
|
|
void updateParts();
|
|
|
|
|
2015-04-19 03:05:47 +02:00
|
|
|
void updatePart(PartHolderPtr& scene, int slot);
|
2014-01-19 13:05:26 +01:00
|
|
|
|
2014-03-12 11:30:44 +01:00
|
|
|
virtual void attachArrow();
|
2015-06-26 05:15:07 +02:00
|
|
|
virtual void releaseArrow(float attackStrength);
|
2015-05-31 01:07:43 +02:00
|
|
|
// 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); }
|
2014-03-12 11:30:44 +01:00
|
|
|
|
2015-05-31 18:53:16 +02:00
|
|
|
virtual void addControllers();
|
|
|
|
|
2015-04-19 03:05:47 +02:00
|
|
|
virtual osg::Vec3f runAnimation(float duration);
|
2014-03-12 11:30:44 +01: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.
|
2015-05-31 18:53:16 +02:00
|
|
|
virtual void setPitchFactor(float factor) { mPitchFactor = factor; }
|
2014-03-12 11:30:44 +01:00
|
|
|
|
|
|
|
|
2014-01-19 13:05:26 +01:00
|
|
|
private:
|
2015-04-19 03:05:47 +02:00
|
|
|
PartHolderPtr mWeapon;
|
|
|
|
PartHolderPtr mShield;
|
2014-01-19 13:05:26 +01:00
|
|
|
bool mShowWeapons;
|
|
|
|
bool mShowCarriedLeft;
|
2014-03-12 11:30:44 +01:00
|
|
|
|
2015-05-31 01:07:43 +02:00
|
|
|
boost::shared_ptr<WeaponAnimationTime> mWeaponAnimationTime;
|
2012-09-15 00:57:29 +02:00
|
|
|
};
|
2011-11-24 01:48:54 -05:00
|
|
|
}
|
2013-01-05 21:12:08 -08:00
|
|
|
|
2012-04-23 15:27:03 +02:00
|
|
|
#endif
|