1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 21:19:57 +00:00
openmw-tes3mp/apps/openmw/mwrender/creatureanimation.hpp

74 lines
2.4 KiB
C++
Raw Normal View History

#ifndef GAME_RENDER_CREATUREANIMATION_H
#define GAME_RENDER_CREATUREANIMATION_H
#include "actoranimation.hpp"
2014-03-12 10:30:44 +00:00
#include "weaponanimation.hpp"
#include "../mwworld/inventorystore.hpp"
namespace MWWorld
{
class Ptr;
}
namespace MWRender
{
class CreatureAnimation : public ActorAnimation
{
public:
2015-04-19 01:05:47 +00:00
CreatureAnimation(const MWWorld::Ptr &ptr, const std::string& model, Resource::ResourceSystem* resourceSystem);
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.
class CreatureWeaponAnimation : public ActorAnimation, public WeaponAnimation, public MWWorld::InventoryStoreListener
{
public:
2015-04-19 01:05:47 +00:00
CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const std::string& model, Resource::ResourceSystem* resourceSystem);
virtual ~CreatureWeaponAnimation() {}
void equipmentChanged() override { updateParts(); }
void showWeapons(bool showWeapon) override;
bool getCarriedLeftShown() const override { return mShowCarriedLeft; }
void showCarriedLeft(bool show) override;
void updateParts();
2015-04-19 01:05:47 +00:00
void updatePart(PartHolderPtr& scene, int slot);
void attachArrow() override;
void detachArrow() override;
void releaseArrow(float attackStrength) override;
2015-05-30 23:07:43 +00:00
// WeaponAnimation
osg::Group* getArrowBone() override;
osg::Node* getWeaponNode() override;
Resource::ResourceSystem* getResourceSystem() override;
void showWeapon(bool show) override { showWeapons(show); }
void setWeaponGroup(const std::string& group, bool relativeDuration) override { mWeaponAnimationTime->setGroup(group, relativeDuration); }
2014-03-12 10:30:44 +00:00
void addControllers() override;
2015-05-31 16:53:16 +00:00
osg::Vec3f runAnimation(float duration) override;
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.
void setPitchFactor(float factor) override { mPitchFactor = factor; }
2014-03-12 10:30:44 +00:00
protected:
bool isArrowAttached() const override;
2014-03-12 10:30:44 +00:00
private:
2015-04-19 01:05:47 +00:00
PartHolderPtr mWeapon;
PartHolderPtr mShield;
bool mShowWeapons;
bool mShowCarriedLeft;
2014-03-12 10:30:44 +00:00
std::shared_ptr<WeaponAnimationTime> mWeaponAnimationTime;
};
}
#endif