OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
weaponanimation.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_MWRENDER_WEAPONANIMATION_H
2 #define OPENMW_MWRENDER_WEAPONANIMATION_H
3 
5 
6 #include "../mwworld/ptr.hpp"
7 #include "animation.hpp"
8 
9 namespace MWRender
10 {
11 
12  class RotateController;
13 
15  {
16  private:
18  std::string mWeaponGroup;
19  float mStartTime;
20  public:
21  WeaponAnimationTime(Animation* animation) : mAnimation(animation), mStartTime(0) {}
22  void setGroup(const std::string& group);
23  void updateStartTime();
24 
25  virtual float getValue(osg::NodeVisitor* nv);
26  };
27 
30  {
31  public:
33  virtual ~WeaponAnimation();
34 
36  void attachArrow(MWWorld::Ptr actor);
37 
39  void releaseArrow(MWWorld::Ptr actor, float attackStrength);
40 
42  void addControllers(const std::map<std::string, osg::ref_ptr<osg::MatrixTransform> >& nodes,
43  std::multimap<osg::ref_ptr<osg::Node>, osg::ref_ptr<osg::NodeCallback> >& map, osg::Node* objectRoot);
44 
45  void deleteControllers();
46 
48  void configureControllers(float characterPitchRadians);
49 
50  protected:
52 
53  osg::ref_ptr<RotateController> mSpineControllers[2];
54 
55  void setControllerRotate(const osg::Quat& rotate);
56  void setControllerEnabled(bool enabled);
57 
58  virtual osg::Group* getArrowBone() = 0;
59  virtual osg::Node* getWeaponNode() = 0;
61 
62  virtual void showWeapon(bool show) = 0;
63 
66  float mPitchFactor;
67  };
68 
69 }
70 
71 #endif
float mStartTime
Definition: weaponanimation.hpp:19
Wrapper class that constructs and provides access to the most commonly used resource subsystems...
Definition: resourcesystem.hpp:24
void configureControllers(float characterPitchRadians)
Configure controllers, should be called every animation frame.
Definition: weaponanimation.cpp:183
PartHolderPtr mAmmunition
Definition: weaponanimation.hpp:51
virtual Resource::ResourceSystem * getResourceSystem()=0
Definition: animation.hpp:77
void setGroup(const std::string &group)
Definition: weaponanimation.cpp:36
osg::ref_ptr< RotateController > mSpineControllers[2]
Definition: weaponanimation.hpp:53
void setControllerEnabled(bool enabled)
Definition: weaponanimation.cpp:204
virtual float getValue(osg::NodeVisitor *nv)
Definition: weaponanimation.cpp:25
Handles attach & release of projectiles for ranged weapons.
Definition: weaponanimation.hpp:29
virtual ~WeaponAnimation()
Definition: weaponanimation.cpp:52
void attachArrow(MWWorld::Ptr actor)
Definition: weaponanimation.cpp:57
void deleteControllers()
Definition: weaponanimation.cpp:177
virtual osg::Group * getArrowBone()=0
float mPitchFactor
Definition: weaponanimation.hpp:66
Definition: weaponanimation.hpp:14
WeaponAnimationTime(Animation *animation)
Definition: weaponanimation.hpp:21
void releaseArrow(MWWorld::Ptr actor, float attackStrength)
Definition: weaponanimation.cpp:93
std::string mWeaponGroup
Definition: weaponanimation.hpp:18
void updateStartTime()
Definition: weaponanimation.cpp:42
Animation * mAnimation
Definition: weaponanimation.hpp:17
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
Definition: controller.hpp:11
void addControllers(const std::map< std::string, osg::ref_ptr< osg::MatrixTransform > > &nodes, std::multimap< osg::ref_ptr< osg::Node >, osg::ref_ptr< osg::NodeCallback > > &map, osg::Node *objectRoot)
Add WeaponAnimation-related controllers to nodes and store the added controllers in map...
Definition: weaponanimation.cpp:159
void setControllerRotate(const osg::Quat &rotate)
Definition: weaponanimation.cpp:197
virtual void showWeapon(bool show)=0
WeaponAnimation()
Definition: weaponanimation.cpp:47
boost::shared_ptr< PartHolder > PartHolderPtr
Definition: animation.hpp:75
virtual osg::Node * getWeaponNode()=0