-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrender_datafile.ksy
244 lines (221 loc) · 4.67 KB
/
brender_datafile.ksy
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
meta:
id: brender_datafile
file-extension: dat
endian: be
bit-endian: be
doc-ref: fw/formats.h
doc: |
This is a generic container format used by the BRender rendering engine created by
Argonaut Technologies. Internally, it's known as a "datafile".
It can contain models, pixelmaps, and actors.
seq:
- id: chunks
type: br_datafile_chunk_t
repeat: eos
types:
br_datafile_chunk_t:
seq:
- id: type
type: u4
- id: len_data
type: u4
if: type < 65536
- id: data
type:
switch-on: type
cases:
0: br_terminator_t # file ending
3: br_pixelmap_t # pixelmap def
18: br_file_index_t # file info
22: br_material_index_t # material index
23: br_vertex_index_t # vertices
24: br_uv_index_t # vertex uvs
26: br_face_material_index_t # face material assignments
33: br_pixels_t # raw pixels
35: br_actor_t # actor def
36: br_actor_model_t # actor model def
53: br_face_index_t # faces
54: br_model_t # model def
61: br_pixelmap_new_t # new pixelmap def
_: br_unknown_t
br_unknown_t:
seq:
- id: data
size: _parent.len_data
br_actor_t:
seq:
- id: actor_type
type: u1
- id: render_style
type: u1
- id: identifier
type: strz
encoding: ascii
br_actor_model_t:
seq:
- id: identifier
type: strz
encoding: ascii
br_terminator_t: {}
br_file_index_t:
seq:
- id: type
type: u4
- id: version
type: u4
rgb_t:
seq:
- id: r
type: u1
- id: g
type: u1
- id: b
type: u1
argb_t:
seq:
- id: a
type: u1
- id: r
type: u1
- id: g
type: u1
- id: b
type: u1
br_pixelmap_t:
seq:
- id: bitmap_type
type: b8
- id: row_bytes
type: u2
- id: width
type: u2
- id: height
type: u2
- id: origin_x
type: u2
- id: origin_y
type: u2
- id: identifier
type: strz
encoding: ascii
br_pixelmap_new_t:
seq:
- id: bitmap_type
type: b8
- id: row_bytes
type: u2
- id: width
type: u2
- id: height
type: u2
- id: origin_x
type: u2
- id: origin_y
type: u2
- id: mip_offset
type: u2
- id: identifier
type: strz
encoding: ascii
br_pixels_t:
seq:
- id: num_pixels
type: u4
- id: len_pixel
type: u4
- id: data_paletted
type: u1
repeat: expr
repeat-expr: len_pixel * num_pixels
if: len_pixel == 1
- id: data_depth
type: u2
repeat: expr
repeat-expr: (len_pixel * num_pixels) / 2
if: len_pixel == 2
- id: data_rgb
type: rgb_t
repeat: expr
repeat-expr: (len_pixel * num_pixels) / 3
if: len_pixel == 3
- id: data_argb
type: argb_t
repeat: expr
repeat-expr: (len_pixel * num_pixels) / 4
if: len_pixel == 4
br_model_t:
seq:
- id: flags
type: u2
- id: identifier
type: strz
encoding: ascii
br_face_index_t:
seq:
- id: num_faces
type: u4
- id: faces
type: br_face_t
repeat: expr
repeat-expr: num_faces
br_face_t:
seq:
- id: vertex_indices
type: u2
repeat: expr
repeat-expr: 3
- id: smoothing
type: u2
- id: flags
type: u1
br_face_material_index_t:
seq:
- id: num_face_materials
type: u4
- id: len_face_material
type: u4
- id: face_materials
type: u2
repeat: expr
repeat-expr: num_face_materials
br_vertex_index_t:
seq:
- id: num_vertices
type: u4
- id: vertices
type: br_vertex_t
repeat: expr
repeat-expr: num_vertices
br_vertex_t:
seq:
- id: coords
type: f4
repeat: expr
repeat-expr: 3
br_uv_index_t:
seq:
- id: num_uvs
type: u4
- id: uvs
type: br_uv_t
repeat: expr
repeat-expr: num_uvs
br_uv_t:
seq:
- id: u
type: f4
- id: v
type: f4
br_material_index_t:
seq:
- id: num_materials
type: u4
- id: materials
type: br_material_t
repeat: expr
repeat-expr: num_materials
br_material_t:
seq:
- id: identifier
type: strz
encoding: ascii