-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmesh.hpp
67 lines (59 loc) · 1.16 KB
/
mesh.hpp
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
#pragma once
#include <string>
#include <vector>
#include <memory>
class Texture2D;
namespace kazakami
{
typedef unsigned short ushort;
typedef unsigned char uchar;
class PMXLoader;
struct Vertex
{
float pos[3];
float normal[3];
float UV[2];
int boneIndex1, boneIndex2, boneIndex3, boneIndex4;
float weight1, weight2, weight3, weight4;
};
struct IK
{
int linkBoneIndex;
uchar angleLimit;
float lowerLimit[3];
float upperLimit[3];
};
struct Bone
{
std::string name;
std::string nameEng;
float pos[3];
int parentBoneIndex;
int transformHierarchy;
ushort boneFlag;
float posOffset[3];
int connectedBoneIndex;
int grantParentBoneIndex;
float grantRatio;
float axisDirectVector[3];
float xAxisDirectVector[3];
float zAxisDirectVector[3];
int keyValue;
int IKTargetBoneIndex;
int IKLoopNum;
float IKLimitAngle;
int IKLinkNum;
std::vector<IK> IKs;
};
class Mesh
{
std::vector<Vertex> verteces;
std::vector<Bone> bones;
std::unique_ptr<PMXLoader> pmx;
std::vector<std::shared_ptr<Texture2D>> textures;
public:
Mesh();
void Draw();
int LoadPMX(const std::string & directoryName, const std::string & filename);
};
}