Cogs.Core
Animation.h
1#pragma once
2
3#include "ResourceBase.h"
4
5#include <vector>
6#include <unordered_map>
7
8#include <glm/vec3.hpp>
9#include <glm/mat4x4.hpp>
10#include <glm/ext/quaternion_float.hpp>
11
12#include "Skeleton.h"
13
14namespace Cogs
15{
16 namespace Core
17 {
19 {
20 float t;
21 glm::vec3 value;
22 };
23
25 {
26 float t;
27 glm::quat value;
28 };
29
30 struct ScaleKey
31 {
32 float t;
33 glm::vec3 value;
34 };
35
37 {
38 uint32_t boneIndex = 0;
39
40 std::vector<TranslationKey> translations;
41 std::vector<RotationKey> rotations;
42 std::vector<ScaleKey> scales;
43 };
44
46 {
47 std::vector<AnimationTrack> tracks;
48
49 float duration;
50 float resolution;
51
52 std::string name;
53 };
54
56 {
57 size_t translationFrame;
58 size_t rotationFrame;
59 size_t scaleFrame;
60 };
61
63 {
64 std::vector<TrackCache> tracks;
65 };
66
67 struct Animation : public ResourceBase
68 {
69 std::vector<AnimationClip> clips;
70 std::unordered_map<std::string, size_t> clipsByName;
71
72 Skeleton skeleton;
73 };
74
75 const size_t kMaxBones = 256;
76
77 struct PoseData
78 {
79 glm::mat4 transforms[kMaxBones];
80 size_t numPoses = 0;
81 };
82 }
83}
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
uint32_t boneIndex
Specifies which bone of a skeleton that is animated by this track.
Definition: Animation.h:38
Base class for engine resources.
Definition: ResourceBase.h:107