forked from 0xGlitchbyte/TinyNightmare64
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sausage64.h
149 lines (112 loc) · 4.22 KB
/
sausage64.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#ifndef SAUSAGE64_H
#define SAUSAGE64_H
/*********************************
Sausage64 Structs
*********************************/
typedef struct {
f32 pos[3];
f32 rot[4];
f32 scale[3];
} s64FrameData;
typedef struct {
u32 framenumber;
s64FrameData* framedata;
} s64KeyFrame;
typedef struct {
const char* name;
u32 keyframecount;
s64KeyFrame* keyframes;
} s64Animation;
typedef struct {
const char* name;
const u32 is_billboard;
Gfx* dl;
} s64Mesh;
typedef struct {
u16 meshcount;
u16 animcount;
s64Mesh* meshes;
s64Animation* anims;
} s64ModelData;
typedef struct {
u8 interpolate;
u8 loop;
s64Animation* curanim;
u32 curanimlen;
float animtick;
u32 curkeyframe;
Mtx* matrix;
void (*predraw)(u16);
void (*postdraw)(u16);
void (*animcallback)(u16);
s64ModelData* mdldata;
} s64ModelHelper;
/*********************************
Sausage64 Functions
*********************************/
/*==============================
sausage64_initmodel
Initialize a model helper struct
@param The model helper to initialize
@param The model data
@param An array of matrices for each mesh part
==============================*/
extern void sausage64_initmodel(s64ModelHelper* mdl, s64ModelData* mdldata, Mtx* matrices);
/*==============================
sausage64_set_camera
Sets the camera for Sausage64 to use for billboarding
@param The view matrix
@param The projection matrix
==============================*/
extern void sausage64_set_camera(Mtx* view, Mtx* projection);
/*==============================
sausage64_set_anim
Sets an animation on the model. Does not perform
error checking if an invalid animation is given.
@param The model helper pointer
@param The ANIMATION_* macro to set
==============================*/
extern void sausage64_set_anim(s64ModelHelper* mdl, u16 anim);
/*==============================
sausage64_get_currentanim
Returns the index of the current animation.
@param The model helper pointer
@param The ANIMATION_* macro to set
==============================*/
u32 sausage64_get_currentanim(s64ModelHelper* mdl);
/*==============================
sausage64_set_animcallback
Set a function that gets called when an animation finishes
@param The model helper pointer
@param The animation end callback function
==============================*/
extern void sausage64_set_animcallback(s64ModelHelper* mdl, void (*animcallback)(u16));
/*==============================
sausage64_set_predrawfunc
Set a function that gets called before any mesh is rendered
@param The model helper pointer
@param The pre draw function
==============================*/
extern void sausage64_set_predrawfunc(s64ModelHelper* mdl, void (*predraw)(u16));
/*==============================
sausage64_set_postdrawfunc
Set a function that gets called after any mesh is rendered
@param The model helper pointer
@param The post draw function
==============================*/
extern void sausage64_set_postdrawfunc(s64ModelHelper* mdl, void (*postdraw)(u16));
/*==============================
sausage64_advance_anim
Advances the animation tick by the given amount
@param The model helper pointer
@param The amount to increase the animation tick by
==============================*/
extern void sausage64_advance_anim(s64ModelHelper* mdl, float tickamount);
/*==============================
sausage64_drawmodel
Renders a Sausage64 model
@param A pointer to a display list pointer
@param The model helper data
==============================*/
extern void sausage64_drawmodel(Gfx** glistp, s64ModelHelper* mdl);
#endif