1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 00:35:23 +00:00
OpenMW/apps/openmw/mwrender/npcanimation.hpp

89 lines
2.1 KiB
C++
Raw Normal View History

#ifndef _GAME_RENDER_NPCANIMATION_H
#define _GAME_RENDER_NPCANIMATION_H
#include "animation.hpp"
2012-04-08 17:27:56 -04:00
#include "../mwworld/containerstore.hpp"
2012-11-08 13:46:24 +04:00
namespace ESM
{
struct NPC;
}
namespace MWWorld
{
class InventoryStore;
}
namespace MWRender
{
2013-01-06 05:39:39 -08:00
class NpcAnimation : public Animation
{
public:
typedef std::map<ESM::PartReferenceType,std::string> PartBoneMap;
enum ViewMode {
VM_Normal,
VM_FirstPerson,
VM_HeadOnly
};
2012-04-04 23:23:24 -04:00
private:
static const PartBoneMap sPartList;
2013-01-06 05:39:39 -08:00
int mStateID;
2012-04-11 20:16:22 -04:00
2013-02-02 02:53:22 -08:00
// Bounded Parts
NifOgre::ObjectList mObjectParts[ESM::PRT_Count];
2012-11-08 13:46:24 +04:00
2013-08-07 16:45:29 -07:00
const ESM::NPC *mNpc;
std::string mHeadModel;
std::string mHairModel;
ViewMode mViewMode;
bool mShowWeapons;
2012-11-08 13:46:24 +04:00
2012-09-13 19:03:31 +02:00
int mVisibilityFlags;
int mPartslots[ESM::PRT_Count]; //Each part slot is taken by clothing, armor, or is empty
int mPartPriorities[ESM::PRT_Count];
Ogre::Vector3 mFirstPersonOffset;
2013-08-07 16:21:57 -07:00
void updateNpcBase();
2013-04-07 01:52:35 -07:00
NifOgre::ObjectList insertBoundedPart(const std::string &model, int group, const std::string &bonename);
void removeIndividualPart(ESM::PartReferenceType type);
void reserveIndividualPart(ESM::PartReferenceType type, int group, int priority);
bool addOrReplaceIndividualPart(ESM::PartReferenceType type, int group, int priority, const std::string &mesh);
void removePartGroup(int group);
void addPartGroup(int group, int priority, const std::vector<ESM::PartReference> &parts);
2012-09-13 19:03:31 +02:00
2013-01-09 07:55:55 -08:00
public:
NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, int visibilityFlags,
ViewMode viewMode=VM_Normal);
2013-01-09 07:55:55 -08:00
virtual ~NpcAnimation();
virtual Ogre::Vector3 runAnimation(float timepassed);
2013-01-09 07:55:55 -08:00
virtual void showWeapons(bool showWeapon);
void setViewMode(ViewMode viewMode);
void updateParts();
/// \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);
/// Rebuilds the NPC, updating their root model, animation sources, and equipment.
void rebuild();
};
}
#endif