-
Notifications
You must be signed in to change notification settings - Fork 10
/
vox.hm
148 lines (126 loc) · 2.19 KB
/
vox.hm
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
addMagicNumber 56 4f 58 20
addExtension vox
import lestd
class VoxFile as File
{
String(4) signature;
int(32) version;
String(4) main;
int(32) mainContentSize;
int(32) mainChildsSize;
while(1) Chunk *;
}
class Chunk(code)
{
String(4) code;
int(32) contentSize;
int(32) childSize;
@args.code = code;
@args.size = (contentSize + childSize) * 8;
}
class SIZE as Chunk("SIZE")
{
int(32) SIZE_X;
int(32) SIZE_Y;
int(32) SIZE_Z;
@value = %str(SIZE_X)+" "+%str(SIZE_Y)+" "+%str(SIZE_Z);
}
class XYZI as Chunk("XYZI")
{
int(32) numVoxels;
@value = "numVoxels: "+%str(numVoxels);
VOXEL voxels[numVoxels];
}
class LAYER(id) as Chunk("LAYR")
{
int(32) nodeId;
@args.id = nodeId;
DICT nodeAttribs;
int(32) unknow;
}
class RGBA as Chunk("RGBA")
{
COLOR colors[256];
}
class COLOR
{
byte red;
byte green;
byte blue;
byte alpha;
}
class VOXEL
{
int(8) POS_X;
int(8) POS_Y;
int(8) POS_Z;
byte COLOR_INDEX;
}
class nTRN(id) as Chunk("nTRN")
{
int(32) nodeId;
@args.id = nodeId;
DICT nodeAttribs;
int(32) childNodeId;
int(32) reservedId;
int(32) layerId;
int(32) numFrames;
DICT frames[numFrames];
}
class nGRP(id) as Chunk("nGRP")
{
int(32) nodeId;
@args.id = nodeId;
DICT nodeAttribs;
int(32) nodeChildrenNodes;
int(32) childNodes[nodeChildrenNodes];
}
class nSHP(id) as Chunk("nSHP")
{
int(32) nodeId;
@args.id = nodeId;
DICT nodeAttribs;
int(32) numModels;
MODEL models[numModels];
}
class MODEL(id)
{
int(32) modelId;
@args.id = modelId;
DICT modelAttribs;
}
class DICT
{
int(32) count;
DICT_ITEM keys[count];
}
class DICT_ITEM
{
DICT_STRING key;
DICT_STRING value;
@value = key.buffer+": "+value.buffer;
}
class DICT_STRING
{
int(32) bufferSize;
String(bufferSize) buffer;
}
class MATERIAL_V2(id) as Chunk("MATL")
{
int(32) materialId;
@args.id = materialId;
DICT properties;
}
class MATERIAL_V1(id) as Chunk("MATT")
{
int(32) materialId;
@args.id = materialId;
int(32) materialType;
float(32) materialWeight;
int(32) propertyBits;
float(32) propertiesNormalized;
}
class rOBJ(id) as Chunk("rOBJ")
{
DICT properties;
}