Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 330 vs 331 for /trunk/Source Code/Geometry/Animations/Headers/AnimationController.h

Diff revisions: vs.
  @@ -37,8 +37,8 @@
37 37
38 38 class SceneAnimator{
39 39 public:
40 - typedef hashMapImpl<U32/*frameIndex*/, vectorImpl<Line >> LineMap;
41 - typedef hashMapImpl<U32/*animationId*/, LineMap> LineCollection;
40 + typedef hashMapImpl<I32/*frameIndex*/, vectorAlg::vecSize/*vectorIntex*/> LineMap;
41 + typedef hashMapImpl<I32/*animationId*/, LineMap> LineCollection;
42 42
43 43 SceneAnimator(): _skeleton(0)
44 44 {
  @@ -49,30 +49,51 @@
49 49 Release();
50 50 }
51 51
52 - /// this must be called to fill the SceneAnimator with valid data
52 + /// This must be called to fill the SceneAnimator with valid data
53 53 bool Init(const aiScene* pScene, U8 meshPointer);
54 - /// frees all memory and initializes everything to a default state
54 + /// Frees all memory and initializes everything to a default state
55 55 void Release();
56 56 void Save(std::ofstream& file);
57 57 void Load(std::ifstream& file);
58 - /// lets the caller know if there is a skeleton present
58 + /// Lets the caller know if there is a skeleton present
59 59 inline bool HasSkeleton() const { return !_bones.empty(); }
60 - /// the next two functions are good if you want to change the direction of the current animation. You could use a forward walking animation and reverse it to get a walking backwards
60 + /// The next two functions are good if you want to change the direction of the current animation.
61 + /// You could use a forward walking animation and reverse it to get a walking backwards
61 62 inline void PlayAnimationForward(I32 animationIndex) { _animations[animationIndex]._playAnimationForward = true; }
62 63 inline void PlayAnimationBackward(I32 animationIndex) { _animations[animationIndex]._playAnimationForward = false; }
63 - ///this function will adjust the current animations speed by a percentage. So, passing 100, would do nothing, passing 50, would decrease the speed by half, and 150 increase it by 50%
64 - inline void AdjustAnimationSpeedBy(I32 animationIndex, const D32 percent) { _animations[animationIndex]._ticksPerSecond *= percent / 100.0f; }
65 - ///This will set the animation speed
66 - inline void AdjustAnimationSpeedTo(I32 animationIndex, const D32 tickspersecond) { _animations[animationIndex]._ticksPerSecond = tickspersecond; }
67 - /// get the animationspeed... in ticks per second
68 - inline F32 GetAnimationSpeed(I32 animationIndex) const { return _animations[animationIndex]._ticksPerSecond; }
69 - /// get the transforms needed to pass to the vertex shader. This will wrap the dt value passed, so it is safe to pass 50000000 as a valid number
70 - inline vectorImpl<mat4<F32> >& GetTransforms(I32 animationIndex, const D32 dt){ return _animations[animationIndex].GetTransforms(dt); }
71 - inline vectorImpl<mat4<F32> >& GetTransformsByIndex(I32 animationIndex, U32 index){ return _animations[animationIndex]._transforms[index]; }
72 - inline I32 GetFrameIndex(I32 animationIndex) const { return _animations[animationIndex].GetFrameIndex(); }
73 - inline U32 GetFrameCount(I32 animationIndex) const { return _animations[animationIndex].GetFrameCount(); }
74 - inline const vectorImpl<AnimEvaluator>& GetAnimations() const { return _animations; }
75 - inline const stringImpl& GetAnimationName(I32 animationIndex) const { return _animations[animationIndex]._name; }
64 + /// This function will adjust the current animations speed by a percentage.
65 + /// So, passing 100, would do nothing, passing 50, would decrease the speed by half, and 150 increase it by 50%
66 + inline void AdjustAnimationSpeedBy(I32 animationIndex, const D32 percent) {
67 + _animations[animationIndex]._ticksPerSecond *= percent / 100.0f;
68 + }
69 + /// This will set the animation speed
70 + inline void AdjustAnimationSpeedTo(I32 animationIndex, const D32 tickspersecond) {
71 + _animations[animationIndex]._ticksPerSecond = tickspersecond;
72 + }
73 + /// Get the animationspeed... in ticks per second
74 + inline F32 GetAnimationSpeed(I32 animationIndex) const {
75 + return _animations[animationIndex]._ticksPerSecond;
76 + }
77 + /// Get the transforms needed to pass to the vertex shader.
78 + /// This will wrap the dt value passed, so it is safe to pass 50000000 as a valid number
79 + inline vectorImpl<mat4<F32> >& GetTransforms(I32 animationIndex, const D32 dt) {
80 + return _animations[animationIndex].GetTransforms(dt);
81 + }
82 + inline vectorImpl<mat4<F32> >& GetTransformsByIndex(I32 animationIndex, U32 index) {
83 + return _animations[animationIndex]._transforms[index];
84 + }
85 + inline I32 GetFrameIndex(I32 animationIndex) const {
86 + return _animations[animationIndex].GetFrameIndex();
87 + }
88 + inline U32 GetFrameCount(I32 animationIndex) const {
89 + return _animations[animationIndex].GetFrameCount();
90 + }
91 + inline const vectorImpl<AnimEvaluator>& GetAnimations() const {
92 + return _animations;
93 + }
94 + inline const stringImpl& GetAnimationName(I32 animationIndex) const {
95 + return _animations[animationIndex]._name;
96 + }
76 97 inline bool GetAnimationID(const stringImpl& animationName, U32& id){
77 98 hashMapImpl<stringImpl, U32>::iterator itr = _animationNameToId.find(animationName);
78 99 if (itr != _animationNameToId.end()) {
  @@ -81,7 +102,9 @@
81 102 }
82 103 return false;
83 104 }
84 - ///GetBoneTransform will return the matrix of the bone given its name and the time. be careful with this to make sure and send the correct dt. If the dt is different from what the model is currently at, the transform will be off
105 + /// GetBoneTransform will return the matrix of the bone given its name and the time.
106 + /// Be careful with this to make sure and send the correct dt. If the dt is different from what the model is currently at,
107 + /// the transform will be off
85 108 inline const mat4<F32>& GetBoneTransform(I32 animationIndex, const D32 dt, const stringImpl& bname) {
86 109 I32 bindex = GetBoneIndex(bname);
87 110 if (bindex == -1)
  @@ -89,9 +112,11 @@
89 112 return _animations[animationIndex].GetTransforms(dt)[bindex];
90 113 }
91 114
92 - /// same as above, except takes the index
93 - inline const mat4<F32>& GetBoneTransform(I32 animationIndex, const D32 dt, U32 bindex) { return _animations[animationIndex].GetTransforms(dt)[bindex]; }
94 - /// get the bone's global transform
115 + /// Same as above, except takes the index
116 + inline const mat4<F32>& GetBoneTransform(I32 animationIndex, const D32 dt, U32 bindex) {
117 + return _animations[animationIndex].GetTransforms(dt)[bindex];
118 + }
119 + /// Get the bone's global transform
95 120 inline const mat4<F32>& GetBoneOffsetTransform(const stringImpl& bname) {
96 121 I32 bindex=GetBoneIndex(bname);
97 122 if(bindex != -1) {
  @@ -100,11 +125,13 @@
100 125 return _cacheIdentity;
101 126 }
102 127
103 - vectorImpl<AnimEvaluator> _animations;// a vector that holds each animation
128 + /// A vector that holds each animation
129 + vectorImpl<AnimEvaluator> _animations;
104 130 Bone* GetBoneByName(const stringImpl& name) const;
105 - ///GetBoneIndex will return the index of the bone given its name. The index can be used to index directly into the vector returned from GetTransform
131 + /// GetBoneIndex will return the index of the bone given its name.
132 + /// The index can be used to index directly into the vector returned from GetTransform
106 133 I32 GetBoneIndex(const stringImpl& bname) const;
107 - const vectorImpl<Line >& getSkeletonLines(U32 animationIndex, const D32 dt);
134 + const vectorImpl<Line >& getSkeletonLines(I32 animationIndex, const D32 dt);
108 135
109 136 size_t GetBoneCount() const { return _bones.size(); }
110 137
  @@ -135,8 +162,10 @@
135 162 vectorImpl<Bone*> _bones;// DO NOT DELETE THESE when the destructor runs... THEY ARE JUST REFERENCES!!
136 163 vectorImpl<aiMatrix4x4 > _transforms;// temp array of transforms
137 164
138 - LineCollection _skeletonLines;
139 165 mat4<F32> _cacheIdentity;
166 + LineCollection _skeletonLines;
167 + vectorImpl<vectorImpl<Line >> _skeletonLinesContainer;
168 +
140 169 };
141 170
142 171 }; //namespace Divide