rest of animation coding

animation , animator , keyframe & quaterions
compiling but not debuged at all
This commit is contained in:
Youssef Assem
2019-12-17 04:48:20 +02:00
parent 23dd149d48
commit c2882035b5
16 changed files with 492 additions and 17 deletions
+39 -4
View File
@@ -1,11 +1,46 @@
#pragma once
#include "animator.h"
#include "animation.h"
#include "geometry.h"
#include "keyframe.h"
#include "jointtransform.h"
#include "joint.h"
#include <map>
#include <set>
class ColladaModel;
class Animator {
private:
ColladaModel* entity_;
Animation current_animation_;
float animation_time_;
void increaseAnimationTime();
std::map<std::string,Matrix> calculateCurrentAnimationPose();
void applyPoseToJoints(std::map<std::string, Matrix> currentPose, Joint joint, Matrix parentTransform);
std::vector<Keyframe> getPreviousAndNextFrames();
float calculateProgression(Keyframe previousFrame, Keyframe nextFrame);
std::map<std::string, Matrix> interpolatePoses(Keyframe previousFrame, Keyframe nextFrame, float progression);
class Animator
{
public:
Animator(ColladaModel entity);
void doanimation(Animation animation);
void update();
void update();
};
template< class Key,
class T,
class Comparator,
class MapAllocator,
class SetAllocator>
void make_key_set(const std::map<Key, T, Comparator, MapAllocator>& map,
std::set<Key, Comparator, SetAllocator>& set)
{
set.clear();
typedef typename std::map<Key, T, Comparator, MapAllocator> map_type;
typename map_type::const_iterator itr = map.begin();
while (map.end() != itr)
{
set.insert((itr++)->first);
}
}