-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMD3Actor.h
More file actions
87 lines (75 loc) · 1.78 KB
/
Copy pathMD3Actor.h
File metadata and controls
87 lines (75 loc) · 1.78 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
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
/**
* MD3Actor
* Defines a complete MD3 model by managing the head, upper and lower components.
**/
#pragma once
#include "MD3Model.h"
#include <string>
enum AnimationPhase
{
BOTH_DEATH1 = 0,
BOTH_DEAD1 = 1,
BOTH_DEATH2 = 2,
BOTH_DEAD2 = 3,
BOTH_DEATH3 = 4,
BOTH_DEAD3 = 5,
TORSO_GESTURE = 6,
TORSO_ATTACK = 7,
TORSO_ATTACK2 = 8,
TORSO_DROP = 9,
TORSO_RAISE = 10,
TORSO_STAND = 11,
TORSO_STAND2 = 12,
LEGS_WALKCR = 13,
LEGS_WALK = 14,
LEGS_RUN = 15,
LEGS_BACK = 16,
LEGS_SWIM = 17,
LEGS_JUMP = 18,
LEGS_LAND = 19,
LEGS_JUMPB = 20,
LEGS_LANDB = 21,
LEGS_IDLE = 22,
LEGS_IDLECR = 23,
LEGS_TURN = 24,
MAX_ANIMATIONS = 25,
NONE = 26
};
struct Animation
{
int startFrame;
int numFrames;
int loopingFrames;
int fps;
};
class MD3Actor
{
public:
MD3Actor();
~MD3Actor(void);
void load(std::string modelPath);
void setMaterialProperties(MaterialProps props);
void parseAnims(std::string modelPath);
AnimationPhase getLowerAnimation();
AnimationPhase getUpperAnimation();
AnimationPhase getNextLowerAnimation();
AnimationPhase getNextUpperAnimation();
void setLowerAnimation(AnimationPhase phase);
void setUpperAnimation(AnimationPhase phase);
void setNextLowerAnimation(AnimationPhase phase);
void setNextUpperAnimation(AnimationPhase phase);
void onPrepare(float dt);
void onRender(ShaderProgram *shaderProgram);
Box* getCollider();
private:
MD3Model m_head;
MD3Model m_upper;
MD3Model m_lower;
MD3Model m_weapon;
Box* m_collider;
Animation m_animations[MAX_ANIMATIONS];
AnimationPhase m_lowerAnimPhase;
AnimationPhase m_upperAnimPhase;
AnimationPhase m_nextLowerAnimPhase;
AnimationPhase m_nextUpperAnimPhase;
};