-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgremlin_min.bt
94 lines (79 loc) · 1.86 KB
/
gremlin_min.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
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
// Gremlin, MIN format
// Template created by Mark "hogsy" Sowden <[email protected]>
struct RGB
{
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t padding;
};// 4 bytes
struct Vector
{
int16_t x;
int16_t y;
int16_t z;
int16_t padding;
};// 8 bytes
/////////////////////////////////////////////////////////
uint32_t facesSize;
// there are 16 types of faces available,
// if any of these are greater than 0,
// then x of those are present
// todo, need to finish some of these...
uint32_t faceNumType1;
struct
{
struct RGB colour;
uint16_t normal;
uint16_t vertices[ 3 ];
} faces1[ faceNumType1 ];
uint32_t faceNumType2;
struct
{
struct RGB colour;
uint16_t vertices[ 3 ];
uint16_t padding;
} faces2[ faceNumType2 ];
uint32_t faceNumType3;
uint32_t faceNumType4;
uint32_t faceNumType5;
uint32_t faceNumType6;
struct
{
struct RGB colour;
uint16_t vertices[ 4 ];
} faces6[ faceNumType6 ];
uint32_t faceNumType7;
uint32_t faceNumType8;
struct
{
uint8_t uv0[ 2 ];
int16_t u0;
uint8_t uv1[ 2 ];
int16_t u1;
uint8_t uv2[ 2 ];
int16_t u2;
uint8_t uv3[ 2 ];
int16_t u3;
struct RGB colour;
uint16_t vertices[ 4 ];
} faces8[ faceNumType8 ];// 28 bytes
uint32_t faceNumType9;
uint32_t faceNumType10;
uint32_t faceNumType11;
uint32_t faceNumType12;
uint32_t faceNumType13;
uint32_t faceNumType14;
uint32_t faceNumType15;
uint32_t faceNumType16;
// we can derive the vertex table offset from the size of the faces block
local uint32_t vertexOffset = ( facesSize + 1 ) * 4;// 4 for long
FSeek( vertexOffset );
uint32_t vertexSize;
local uint32_t numVertices = ( vertexSize * 4 ) / 8;// 4 for long, 8 for vector
if ( numVertices > 0 )
struct Vector vertices[ numVertices ];
uint32_t normalSize;
local uint32_t numNormals = ( normalSize * 4 ) / 8;// 4 for long, 8 for vector
if ( numNormals > 0 )
struct Vector normals[ numNormals ];