forked from syoyo/MMDLoader
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vmd_animation.h
91 lines (73 loc) · 1.74 KB
/
vmd_animation.h
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef __MMD_VMD_ANIMATION_H__
#define __MMD_VMD_ANIMATION_H__
#include <vector>
#include <string>
//
// VMD format:
// http://blog.goo.ne.jp/torisu_tetosuki/e/bc9f1c4d597341b394bd02b64597499d
//
//
namespace mmd {
class PMDModel;
class IK;
#if defined(__GNUC__)
#define ATTRIBUTE_PACKED __attribute__((packed))
#else
#define ATTRIBUTE_PACKED
#endif
#pragma pack(1)
struct VMDMotion {
// 111 bytes
char bone_name[15];
unsigned int frame_no;
float location[3];
float rotation[4]; // quaternion
unsigned char interpolation[64]; // [4][4][4]
} ATTRIBUTE_PACKED;
struct VMDMorph {
// 23 bytes
char morph_name[15];
unsigned int frame_no;
float weight;
} ATTRIBUTE_PACKED;
struct VMDCamera {
// 61 bytes
unsigned int frame_no;
float length; // -distance
float location[3];
float rotation[3]; // Euler. X axis has been flipped?
unsigned char interpolation[24]; // Unused?
unsigned int viewing_angle;
unsigned char perspective; // 0:on, 1:off
} ATTRIBUTE_PACKED;
struct VMDLight {
// 28 bytes
unsigned int frame_no;
float rgb[3]; // [0.0~1.0]
float location[3];
} ATTRIBUTE_PACKED;
struct VMDSelfShadow {
unsigned int frame_no;
unsigned char mode; // 00-02
float distance; // 0.1 - (dist * 0.000001)
} ATTRIBUTE_PACKED;
#pragma pack()
class VMDAnimation {
public:
VMDAnimation() {};
~VMDAnimation() {};
std::vector<VMDMotion> motions_;
std::vector<VMDMorph> morphs_;
std::vector<VMDCamera> camera_frames_;
std::vector<VMDLight> light_frames_;
std::vector<VMDSelfShadow> self_shadows_;
std::string name_;
};
class IKSolver {
public:
IKSolver();
~IKSolver();
void Solve(PMDModel *model, IK *ik, float errToleranceSq);
};
} // namespace
#endif // __MMD_VMD_ANIMATION_H__