-
Notifications
You must be signed in to change notification settings - Fork 6
/
Model.h
145 lines (128 loc) · 2.94 KB
/
Model.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
#if !defined(AFX_MODEL_H__6D40F497_E9C9_44A8_9166_A22C4BA02E87__INCLUDED_)
#define AFX_MODEL_H__6D40F497_E9C9_44A8_9166_A22C4BA02E87__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Util.h"
#include "HaloStructDefs.h"
typedef struct STRUCT_MODEL_HEADER
{
UINT Zero1;
UINT unk1a;
UINT Offset1;
UINT Offset2;
UINT Offset3;
UINT Offset4;
UINT Offset5;
SHORT SuperHighLodCutoff;
SHORT HighLodCutoff;
SHORT MediumLodCutoff;
SHORT LowLodCutoff;
SHORT SuperLowLodCutoff;
SHORT SuperHighLodNodeCount;
SHORT HighLodNodeCount;
SHORT MediumLodNodeCount;
SHORT LowLodNodeCount;
SHORT SuperLowLodNodeCount;
float u_scale;
float v_scale;
UINT unk3[29];
REFLEXIVE Markers;
REFLEXIVE Nodes;
REFLEXIVE Regions;
REFLEXIVE Geometries;
REFLEXIVE Shaders;
}MODEL_HEADER;
typedef struct STRUCT_SHADER_DESCRIPTION
{
UINT tag;
UINT NamePtr;
UINT zero;
UINT Shader_TagId;
UINT unk[4];
}SHADER_DESCRIPTION;
typedef struct STRUCT_MODEL_REGION
{
char Name[64];
REFLEXIVE Permutations;
}MODEL_REGION;
typedef enum ENUM_MODEL_LOD
{
SUPER_LOW = 0,
LOW,
MEDIUM,
HIGH,
SUPER_HIGH
}MODEL_LOD;
typedef struct STRUCT_MODEL_REGION_PERMUTATION
{
char Name[32];
UINT Flags[8];
SHORT LOD_MeshIndex[5];
SHORT Reserved[7];
}MODEL_REGION_PERMUTATION;
typedef struct STRUCT_MODEL_GEOMETRY_HEADER
{
UINT unk[9];
REFLEXIVE SubmeshHeaders;
}MODEL_GEOMETRY_HEADER;
typedef struct STRUCT_MODEL_MARKER
{
char name1[32];
UINT unk[5];
REFLEXIVE chunk1;
}MODEL_MARKER;
typedef struct STRUCT_MODEL_MARKER_INST
{
SHORT name;
SHORT node_index;
float translation[3];
float rotation[4];
}MODEL_MARKER_INST;
typedef struct STRUCT_MODEL_REPORT
{
UINT IndexOffsetStart;
UINT IndexOffsetEnd;
UINT VertexOffsetStart;
UINT VertexOffsetEnd;
}MODEL_REPORT;
class CModel : public CUtil
{
public:
int GetMarkerCount(void);
CString GetMarkerName(int index);
void UpdateBoundingRadius(void);
void CompileShader();
void UpdateBoundingBox(float *pCoord);
void GetBoundingBox(BOUNDING_BOX *pBox);
void LoadBones(void);
void DrawSolidBoundingBox(float *pColor);
void DrawBoundingBox(float *pColor);
void LoadModel(UINT model_offset, UINT size);
void Cleanup(void);
void Initialize(CFile *pMapFile, UINT magic, CString name);
CModel();
virtual ~CModel();
CString GetDescription();
float m_BoundingRadius;
CString m_ModelName;
MODEL_REPORT m_Report;
protected:
void LoadRegions(void);
void LoadMarkers(void);
void LoadShaders(void);
CFile *m_pMapFile;
UINT m_Magic;
MODEL_HEADER m_Header;
int *m_pRenderTextureIndex;
SHADER_DESCRIPTION *m_pShaderDesc;
MODEL_REGION *m_pRegions;
SHADER_INDEX *m_pShaderIndex;
BOUNDING_BOX m_BoundingBox;
MODEL_REGION_PERMUTATION **m_ppPermutations;
MODEL_MARKER_INST **m_ppMarkerList;
MODEL_MARKER *m_pMarkers;
CStringArray m_ShaderNames;
int m_TriCount;
};
#endif // !defined(AFX_MODEL_H__6D40F497_E9C9_44A8_9166_A22C4BA02E87__INCLUDED_)