-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathC3DMorph.h
106 lines (88 loc) · 1.51 KB
/
C3DMorph.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
#ifndef MORPH_H_
#define MORPH_H_
#include <string>
#include <vector>
using namespace std;
namespace cocos3d
{
/**
* Defines structure to describe vertex offset.
*/
struct VertexOffset
{
unsigned int index;
float x,y,z;
VertexOffset(){};
};
/**
* Defines structure to describe target morph.
*/
struct MorphTarget
{
unsigned int index;
float weight;
std::string name;
std::vector<VertexOffset> offsets;
/**
* Constructor.
*/
MorphTarget()
{
weight = 1.0f;
}
/**
* Destructor.
*/
~MorphTarget()
{
}
};
/**
* Defines structure to describe morph.
*/
class C3DMorph
{
public:
/**
* Constructor.
*/
C3DMorph();
/**
* Destructor.
*/
~C3DMorph();
/**
* Gets target morph by specified name.
*/
MorphTarget* getMorphTarget(std::string name);
/**
* Gets target morph by specified index.
*/
MorphTarget* getMorphTarget(int index);
/**
* Adds a target morph.
*/
void addMorphTarget(MorphTarget* target);
/**
* Clears current target vector list.
*/
void clearCurTarget();
/**
* Gets current target vector list.
*/
std::vector<unsigned int>* getCurTargets();
/**
* Push target index to current target vector list.
*/
bool pushTarget(unsigned int targetIndex);
/**
* Pop target index to current target vector list.
*/
bool popTarget(unsigned int targetIndex);
private:
std::string _meshName;
std::vector<MorphTarget*>* _morphTargets;
std::vector<unsigned int>* _curTargets;
};
}
#endif