blob: fc5a84c24bf07bd852b418ef071cebd3d0bb2642 (
plain)
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
92
93
|
#pragma once
#include <ship/resource/Resource.h>
#include <libultraship/libultra/types.h>
namespace SOH {
typedef struct Vec3s {
s16 x;
s16 y;
s16 z;
} Vec3s;
enum class KeyframeSkelType {
Normal,
Flex,
Error,
};
// Keyframe limb?
typedef struct {
/* 0x00 */ void* dList;
/* 0x04 */ u8 numChildren;
/* 0x05 */ u8 flags;
/* 0x06 */ Vec3s translation; // FlexLimbs have translation data in their animations instead
} KeyFrameStandardLimb; // size = 0xC
// Other limb type?
typedef struct {
/* 0x00 */ void* dList;
/* 0x04 */ u8 numChildren;
/* 0x05 */ u8 flags;
/* 0x06 */ u8 callbackIndex; // transform callback index
} KeyFrameFlexLimb; // size = 0x8
typedef struct {
/* 0x00 */ u8 limbCount;
/* 0x01 */ u8 dListCount; // non-zero in object files, number of non-null-dlist limbs? used to know how many
// matrices to alloc for drawing
/* 0x04 */ union {
KeyFrameStandardLimb* limbsStandard;
KeyFrameFlexLimb* limbsFlex;
};
} KeyFrameSkeletonData; // Size = 0x8
typedef struct {
/* 0x00 */ s16 frame;
/* 0x02 */ s16 value;
/* 0x04 */ s16 velocity;
} KeyFrame; // Size = 0x6
typedef struct {
union {
/* 0x00 */ u8* bitFlags; // bitflags indicating whether to do keyframe interpolation or pull from preset values
/* 0x00 */ u16*
bitFlagsFlex; // bitflags indicating whether to do keyframe interpolation or pull from preset values
};
/* 0x04 */ KeyFrame* keyFrames; // keyframes array
/* 0x08 */ s16* kfNums; // number of keyframes for each limb
/* 0x0C */ s16* presetValues; // preset rotation (standard) or scale/rotation/translation (flex) values
/* 0x0C */ char unk_10[0x2];
/* 0x12 */ s16 duration;
} KeyFrameAnimationData; // Size = 0x14
class KeyFrameSkel : public Ship::Resource<KeyFrameSkeletonData> {
public:
using Resource::Resource;
KeyFrameSkel() : Resource(std::shared_ptr<Ship::ResourceInitData>()) {
}
~KeyFrameSkel();
KeyFrameSkeletonData* GetPointer();
size_t GetPointerSize();
KeyFrameSkeletonData skelData;
};
class KeyFrameAnim : public Ship::Resource<KeyFrameAnimationData> {
public:
using Resource::Resource;
KeyFrameAnim() : Resource(std::shared_ptr<Ship::ResourceInitData>()) {
}
~KeyFrameAnim();
KeyFrameAnimationData* GetPointer();
size_t GetPointerSize();
KeyFrameAnimationData animData;
};
} // namespace SOH
|