forked from openframeworks/openFrameworks
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathofxAssimpSrcAnimKeyCollection.h
More file actions
56 lines (42 loc) · 1.34 KB
/
ofxAssimpSrcAnimKeyCollection.h
File metadata and controls
56 lines (42 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// ofxAssimpSrcAnimKeyCollection.h
// Created by Nick Hardeman on 11/1/23.
//
#pragma once
#include <assimp/scene.h>
#include "ofNode.h"
namespace ofxAssimp {
struct AnimVectorKey {
float time = 0.0;
glm::vec3 value;
aiVector3D valueAi;
};
struct AnimRotationKey {
float time = 0.0;
glm::quat value;
aiQuaternion valueAi;
};
class SrcAnimKeyCollection {
public:
unsigned int uId = 0;
std::string name = "";
std::vector<ofxAssimp::AnimVectorKey> positionKeys;
std::vector<ofxAssimp::AnimRotationKey> rotationKeys;
std::vector<ofxAssimp::AnimVectorKey> scaleKeys;
void clear() {
positionKeys.clear();
rotationKeys.clear();
scaleKeys.clear();
}
void setup( aiNodeAnim* aNodeAnim, float aDurationInTicks );
bool hasKeys();
glm::vec3 getVec3ForTime( const float& atime, const std::vector<ofxAssimp::AnimVectorKey>& akeys );
glm::vec3 getPosition( const float& atime );
glm::vec3 getScale( const float& atime );
glm::quat getRotation( const float& atime );
std::vector<AnimVectorKey> getAnimVectorKeysForTime(const float& aStartTime, const float& aEndTime, unsigned int aNumKeys, aiVectorKey* aAiKeys);
std::vector<AnimRotationKey> getAnimRotationKeysForTime(const float& aStartTime, const float& aEndTime, unsigned int aNumKeys, aiQuatKey* aAiKeys);
aiNodeAnim* mNodeAnim = nullptr;
float mDurationInTicks = 1;
};
}