forked from RoadTrain/mafia-formats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
6ds.bt
66 lines (51 loc) · 1.43 KB
/
6ds.bt
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
//--------------------------------------
//--- 010 Editor v5.0 Binary Template
//
// File: 6ds.bt
// Author: hdmaster
// Revision: 0.1
// Purpose: Defines a template for parsing 6ds files
//--------------------------------------
#include "ls3d.bt"
enum <uint16> FileVersion
{
VERSION_MAFIA = 2,
VERSION_HD2 = 12,
VERSION_CHAMELEON = 13,
};
struct FILE
{
struct HEADER
{
char fourCC[4];
if (fourCC != "6DS") {
Warning("Invalid file format: %s", fourCC);
return -1;
}
FileVersion version;
if (version != VERSION_MAFIA && version != VERSION_HD2 && version != VERSION_CHAMELEON) {
Warning("Invalid file version: %d", version);
return -1;
}
FILETIME timestamp;
} header;
uint16 numVertices;
uint16 numVertexIndices;
uint16 numLinks;
// shared vertex & face buffer
if (file.header.version == VERSION_HD2) {
VECTOR4 vertices[numVertices];
} else {
VECTOR3 vertices[numVertices];
}
local uint32 numFaces = numVertexIndices / 3;
FACE faces[numFaces];
// references to 4DS nodes
struct LINK
{
uint32 numVertices; // next n vertices from buffer
uint32 numFaces; // next n faces from buffer
byte nameLength;
char name[nameLength];
} links[numLinks]<optimize=false>;
} file;