vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
subblock_animation.h
Go to the documentation of this file.
1 #ifndef _subblock_animation
2 #define _subblock_animation 1
3 
4 #include <osg/Vec3>
5 #include <osg/Quat>
6 #include <osg/Node>
7 #include <vector>
8 #include "awHelper.h"
9 
10 using namespace std;
11 
12 namespace ArtificialWorld
13 {
19  Alpha = 2,
22  };
23 
32  };
33 
40  };
41 
44  public:
46  osg::Vec3 translation;
48  osg::Quat rotation;
50  osg::Vec3 scale;
52  float alpha;
55 
61  bool scaleSet;
63  bool alphaSet;
66 
67  AnimationPoint():translation(0.0, 0.0, 0.0), rotation(0.0, 0.0, 0.0, 0.0), scale(1.0, 1.0, 1.0), alpha(1.0), nodeMask(0x00000000){
68  translationSet = false;
69  rotationSet = false;
70  scaleSet = false;
71  alphaSet = false;
72  nodeMaskSet = false;
73  };
74  AnimationPoint(osg::Vec3 trans, osg::Quat rot, osg::Vec3 scal, float alfa, osg::Node::NodeMask nmask):
75  translation(trans), rotation(rot), scale(scal), alpha(alfa), nodeMask(nmask)
76  { translationSet = true;
77  rotationSet = true;
78  scaleSet = true;
79  alphaSet = true;
80  nodeMaskSet = true;
81  }
82  };
83 
86  public:
89  animationType = 0;
90  interpolation = ArtificialWorld::Linear;
91  looping = AnimationLoopType::NoLoop;
92  timeForLoop = 1;
93  };
94  ~SubBlockAnimation(){ animationPoints.clear(); };
95 
97  void AddAnimationPoint(AnimationPoint newPoint){ animationPoints.push_back(newPoint); };
99  int NumberOfAnimantionPoints(void){ return animationPoints.size(); };
101  AnimationPoint* GetAnimationPoint(int index){ return &(animationPoints.at(index)); };
103  void ClearAnimationPoints(void){ animationPoints.clear(); };
104 
106  void SetAnimationType(unsigned int newType){ animationType = newType; };
108  unsigned int GetAnimationType(void){ return animationType; };
109 
111  void SetInterpolation(AnimationInterpolationType newInterpolation){ interpolation = newInterpolation; };
113  AnimationInterpolationType GetInterpolation(void){ return interpolation; };
114 
116  void SetLoopType(AnimationLoopType newLoop){ looping = newLoop; };
118  AnimationLoopType GetLoopType(void){ return looping; };
119 
121  void SetTimePerLoop(int time){ timeForLoop = time; };
123  int GetTimePerLoop(void){ return timeForLoop; };
124 
126  void ClearAnimation(void){
127  ClearAnimationPoints();
128  SetAnimationType(0);
129  SetInterpolation(Linear);
130  SetLoopType(NoLoop);
131  SetTimePerLoop(1);
132  };
133 
134  protected:
136  vector<AnimationPoint> animationPoints;
138  unsigned int animationType;
145 
146  };
147 
148 }
149 
150 #endif
151