-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMdc.h
executable file
·175 lines (140 loc) · 3.02 KB
/
CMdc.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
CMdc.h
Author: Tom Naughton
\*/
\
#ifndef CMdc_H
#define CMdc_H
// FIXME: should inherit from a common abstract base class.
#include "CMd3.h"
class CShader;
class MDC_Triangle
{
public:
UInt32 indices[3];
void loadFromStream(CPakStream *inItem);
};
class MDC_Vertex
{
public:
SInt16 position[3];
UInt8 u,v;
void loadFromStream(CPakStream *inItem);
};
class MDC_TexCoord
{
public:
float stu[3];
void loadFromStream(CPakStream *inItem);
void debugDump();
};
class MDC_Shader
{
public:
char name[64];
UInt32 flags;
void loadFromStream(CPakStream *inItem);
void debugDump();
};
class MDC_TagName
{
public:
char name[64];
void loadFromStream(CPakStream *inItem);
void debugDump();
};
class MDC_TagFrame
{
public:
SInt16 xyz[3];
float angles[3];
// matrix
void loadFromStream(CPakStream *inItem);
};
class MDC_Surface
{
virtual ~MDC_Surface();
public:
UInt32 ident;
char name[64];
UInt32 flags;
UInt32 numCompFrames;
UInt32 numBaseFrames;
UInt32 numShaders;
UInt32 numVertices;
UInt32 numTriangles;
UInt32 offsetTriangles;
UInt32 offsetShaders;
UInt32 offsetTexCoords;
UInt32 offsetVertices;
UInt32 offsetCompVerts;
UInt32 offsetFrameBaseFrames;
UInt32 offsetFrameCompFrames;
UInt32 offsetEnd;
MDC_Triangle *_triangles;
MDC_Shader *_shaders;
MDC_TexCoord *_texCoords;
MDC_Vertex *_vertices;
void loadFromStream(CPakStream *inItem);
Boolean isValid();
void debugDump();
};
class MDC_Frame
{
public:
float bboxMin[3];
float bboxMax[3];
float localOrigin[3];
float radius;
char name[16]; // often creator
void loadFromStream(CPakStream *inItem);
void debugDump();
};
class MDC_Header
{
public:
UInt32 ident;
UInt32 version;
char name[64];
UInt32 flags;
UInt32 numFrames;
UInt32 numTags;
UInt32 numSurfaces;
UInt32 numSkins;
UInt32 offsetFrames;
UInt32 offsetTagNames;
UInt32 offsetTags;
UInt32 offsetSurfaces;
UInt32 offsetEnd;
void loadFromStream(CPakStream *inItem);
Boolean isValid();
void debugDump();
};
class CMdc: public CMd3
{
public:
CMdc(CResourceManager *resources);
virtual ~CMdc();
virtual Boolean init(CPakStream *inItem);
virtual void Draw(CModelInstance *instance, renderingAttributes_t *renderingAttributes);
virtual void DrawLinks(CModelInstance *instance, renderingAttributes_t *rendering);
virtual void loadMeshTextures(CModelInstance *instance);
virtual SInt16 frameCount() ;
virtual UInt32 tagNum();
virtual UInt32 meshNum();
virtual ModelType modelType();
virtual int tagIndexWithName(const char *name);
virtual string tagNameForFrameAtIndex(short frame, short index);
virtual md3_tag_t *tagForFrameAtIndex(short frame, short index);
virtual Boolean canExportFormat(ExportFormatT format);
protected:
MDC_Header *_header;
MDC_Frame *_frames;
MDC_TagName *_tagNames;
MDC_TagFrame *_tagFrames;
MDC_Surface *_surfaces;
typedef vector<md3_tag_t*> tagArray;
tagArray *_convertedTags;
void DrawSurface(CModelInstance *instance, renderingAttributes_t *rendering , MDC_Surface *surface);
};
#endif // CMdc_H