-
Notifications
You must be signed in to change notification settings - Fork 1
/
asemodel.h
134 lines (105 loc) · 2.44 KB
/
asemodel.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
/******************************************************
g-Matrix3D Neo Engine
Copyright (c)2003 Kim Seong Wan (kaswan, Â𻧱ͽÅ)
E-mail: kaswan@hitel.net
http://www.g-matrix.pe.kr
*******************************************************/
#ifndef ASEMODEL_H
#define ASEMODEL_H
#include "stdafx.h"
#include "vector3.h"
#include "matrix3.h"
#include "mesh.h"
#include "model.h"
#include "material.h"
struct ASE_FACE{
int index[3];
};
struct ASE_GEOMOBJECT{
int NUMVERTEX;
int NUMFACE;
int NUMTVERTEX;
int NUMTFACE;
Matrix3 NODE_TM;
Vector3 *VertexList;
Vector3 *TVertexList;
ASE_FACE *FaceList;
ASE_FACE *TFaceList;
int *MTLIDList;
int MTLID;
Vector3 *VNormalList;
bool BoneFlag;
bool NormalFlag;
bool TexCoordFlag;
ASE_GEOMOBJECT()
{
NUMVERTEX = 0;
NUMFACE = 0;
NUMTVERTEX = 0;
NUMTFACE = 0;
VertexList = NULL;
TVertexList = NULL;
FaceList = NULL;
TFaceList = NULL;
MTLIDList = NULL;
VNormalList = NULL;
BoneFlag = false;
NormalFlag = false;
TexCoordFlag = false;
}
~ASE_GEOMOBJECT()
{
if (VertexList) delete[] VertexList;
if (TVertexList) delete[] TVertexList;
if (FaceList) delete[] FaceList;
if (TFaceList) delete[] TFaceList;
if (MTLIDList) delete[] MTLIDList;
if (VNormalList) delete[] VNormalList;
}
};
class ASEMODEL{
int NUMGEOMOBJECT;
int NUMMATERIAL;
ASE_GEOMOBJECT *GeomObjectList;
Material *MaterialList;
int linecount;
int GeomIndex;
char line[256];
char string[80];
public:
ASEMODEL()
{
NUMGEOMOBJECT = 0;
NUMMATERIAL = 0;
GeomObjectList = NULL;
MaterialList = NULL;
GeomIndex = 0;
linecount = 0;
}
~ASEMODEL()
{
delete[] GeomObjectList;
delete[] MaterialList;
}
void Init(int num = 200)
{
GeomObjectList = new ASE_GEOMOBJECT[num];
}
Model *LoadASE(char *fname);
private:
void MakeVertexNormal(int gindex = 0);
void TransferToMesh(Mesh *pMesh, int gindex = 0);
void TransferToMeshNoTexture(Mesh *pMesh, int gindex = 0);
int DecodeASE(FILE *fp);
int DecodeSCENE(FILE *fp);
int DecodeMATERIAL_LIST(FILE *fp);
int DecodeGEOMOBJECT(FILE *fp);
int DecodeMESH(FILE *fp);
int DecodeMESH_VERTEX_LIST(FILE *fp);
int DecodeMESH_FACE_LIST(FILE *fp);
int DecodeMESH_TVERTLIST(FILE *fp);
int DecodeMESH_TFACELIST(FILE *fp);
int DecodeMESH_CVERTEX(FILE *fp);
int DecodeMESH_NORMALS(FILE *fp);
};
#endif