-
Notifications
You must be signed in to change notification settings - Fork 1
/
pfb.ksy
421 lines (338 loc) · 8.73 KB
/
pfb.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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
meta:
id: pfb
file-extension: pfb
endian : le
seq:
- id : magic
type: u4
- id : unknown1
type : u4
- id : unknown2
type : u4
- id : unknown3
type : u4
- id : nodes
type : node
repeat : expr # eos
repeat-expr : 8
types:
t_unknown: # Type 2, 17, 18, 27
seq:
- id: count
type : u4
- id: total_size
type: u4
- id : body
size : total_size
###### lists of lists #####
materials: # Type 0 - to do: define body (type "material")
seq:
- id: count
type : u4
- id: size
type: u4
- id : materials
size : count * 4
textures: # Type 1 - readTextures
seq:
- id : count
type : u4
- id : total_size
type : u4
- id : textures
type : texture
repeat : expr
repeat-expr : count
geostates: # Type 3 - to do: define body
seq:
- id: count
type : u4
- id: total_size
type: u4
- id : geostates
size : total_size
lenghts_lists: # Type 4 - readLengthLists()
seq:
- id : count
type : u4
- id : total_size
type : u4
- id : lists
type : lengths_list
repeat : expr
repeat-expr : count # for (unsigned i=0; i<info.numLists; ++i) { readLengthList(tree->getLengthList(i)) }
vertex_lists: # Type 5 - readVertexLists()
seq:
- id : count
type : u4
- id : total_size
type : u4
- id : lists
type : vertex_list
repeat : expr
repeat-expr : count # for (unsigned i=0; i<info.numLists; ++i) { readVertexList(tree->getVertexList(i)) )
colors_lists: # Type 6 # readColorLists()
seq:
- id : count
type : u4
- id : total_size
type : u4
- id : lists
type : colors_list
repeat : expr
repeat-expr : count # for (unsigned i=0; i<info.numLists; ++i) { readColorList(tree->getColorList(i)) )
normals_lists: # Type 7 - readNormalLists()
seq:
- id : count
type : u4
- id : total_size
type : u4
- id : lists
type : normals_list
repeat : expr
repeat-expr : count # for (unsigned i=0; i<info.numLists; ++i) { readNormalList(tree->getNormalList(i)) )
textcoord_lists: # Type 8 - readTexcoordLists()
seq:
- id : count
type : u4
- id : total_size
type : u4
- id : lists
type : coords_list
repeat : expr
repeat-expr : count # for (unsigned i=0; i<info.numLists; ++i) { readTexcoordList(tree->getTexcoordList(i)) )
geosets: # Type 10 - to do
seq:
- id: count
type : u4
- id: size
type: u4
- id : geosets
type : geoset
repeat : expr
repeat-expr : count
node: # Type 12
seq:
- id : type
type : u4
- id : contents
type :
switch-on: type
cases:
0: t_unknown
1: textures
2: t_unknown # TexEnv?
3: t_unknown # GeoStates
4: lenghts_lists
5: vertex_lists
6: colors_lists
7: normals_lists
8: textcoord_lists
9: t_unknown
10: geosets
12: t_unknown # node
17: t_unknown # TexGens
18: t_unknown # Light models
27: t_unknown # Images
####### lists ###########
lengths_list: # readLengthList() (type 4)
seq:
- id: size
type: u4
- id : unk1
type : u4
- id : unk2
type : u4
- id : elements
type: u4
repeat : expr
repeat-expr : size # fread(list.get(0), 4, info.size, f); // read "size" times a "4" group
vertex_list: # readVertexList() (type 5)
seq:
- id: size
type: u4
- id : unk1
type : u4
- id : unk2
type : u4
- id : elements
type: vertex
repeat : expr
repeat-expr : size # fread(list.get(0), 4*3, info.size, f); // Read "size" times a "4*3" group
colors_list: # readColorList() (type 6)
seq:
- id: size
type: u4
- id : unk1
type : u4
- id : unk2
type : u4
- id : elements
type: color
repeat : expr
repeat-expr : size # fread(list.get(0), 4*4, info.size, f); // Read "size" times a "4*4" group
normals_list: # readNormalList() (type 7)
seq:
- id: size
type: u4
- id : unk1
type : u4
- id : unk2
type : u4
- id : elements
type: normal
repeat : expr
repeat-expr : size # fread(list.get(0), 4*3, info.size, f); // Read "size" times a "4*3" group
coords_list: # readTexcoordList() (type 8)
seq:
- id: size
type: u4
- id : unk1
type : u4
- id : unk2
type : u4
- id : list
type: coordinate_pair
repeat : expr
repeat-expr : size # fread(list.get(0), 4*2, info.size, f); // Read "size" times a "4*2" group
###### elements ########
vertex:
# class PfbVertexList : public PfbList<float,3> {};
seq:
- id : x
type : f4
- id : y
type : f4
- id : z
type : f4
normal:
# class PfbNormalList : public PfbList<float,3> {};
seq:
- id : nx
type : f4
- id : ny
type : f4
- id : nz
type : f4
color: # debug: unknown format; rgba?
#class PfbColorList : public PfbList<float,4> {};
seq:
- id : r
type : f4
- id : g
type : f4
- id : b
type : f4
- id : a
type : f4
texture:
seq:
- id : filename
type : pfb_string
- id : contents
size : _parent.total_size/_parent.count - filename.len - 4 #232
coordinate_pair: # of which texture file?!? To Do
# class PfbTexcoordList : public PfbList<float,2> {};
seq:
- id : s
type : f4
- id : t
type : f4
geoset:
seq:
- id : strip_type
type : u4
- id : num_strip
type : u4
- id : length_list_id
type : s4
# Ignore:
- id : unk1
type : u4
- id : unk2
type : u4
- id : unk3
type : u4
- id : unk4
type : u4
- id : unk5
type : u4
# Id of the geostate:
- id : geostate_id
type : u4
- id : data6b
type : u4
- id : data7 # [2]
type : u4
- id : data8
type : u4
- id : mask
type : u4
- id : data9
type : u4
- id : num
type : u4
- id : vec0
type : f4
- id : vec1
type : f4
- id : vec2
type : f4
- id : vec3
type : f4
- id : vec4
type : f4
- id : vec5
type : f4
pfb_string:
seq:
- id: len
type : u4
- id : contents
type: str
size : len
encoding : ASCII
# generic list:
# array of N elements, each on of size T
# Elements of list:
# vertex:
# 3 x float32
# length:
# 1 x uint32
# color:
# 4 x float32
# normal:
# 3 x float32
# texture coordinate:
# 2 x float32
# material:
# uint32_t type; // = 1 | 2
# float data2; // = 1 | 1
# float shininess; // 16 | 32
# float specular[3]; // diffuse ? (0.6 0.6 0.6)
# float diffuse[3]; // ? (0.8 0.8 0.8)
# float diffuse_bis[3]; // ? (0.72 0.72 0.72)
# float ambiant[3]; // uint/float ? (0 0 0) | 0 0 0
# int32_t data8[2]; // uint ? (3 4) | (3 1)
# int32_t data9; // -1 | -1
# texture:
# char *fileName;
# int five_1_a[5];
# int four_hexa_a[4];
# int three_1_a[3];
# int four_0_a[4];
# int one_1_a;
# float nine_values_a[9];
# float nine_values_b[9];
# int zero_minus_one_a[2];
# int three_1_b[3];
# int two_0_a[2];
# int two_0_b[2];
# int two_minus_one_a[2];
# int five_minus_one_a[2];
# int one_minus_one_a;
# float zero_minus_one_b[2];
# int one_zero_a;
# int one_minus_one_b;
# int one_zero_b;
# fread(destination, element size, number of elements, source file);