-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathskin.js
46 lines (41 loc) · 1.1 KB
/
skin.js
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
import r from 'restructure';
import { Vec3Float } from '../types';
import Nofs from './nofs';
const Submesh = new r.Struct({
partID: r.uint16le,
level: r.uint16le,
startVertex: r.uint16le,
vertexCount: r.uint16le,
startTriangle: r.uint16le,
triangleCount: r.uint16le,
boneCount: r.uint16le,
startBone: r.uint16le,
boneInfluences: r.uint16le,
rootBone: r.uint16le,
centerMass: Vec3Float,
centerBoundingBox: Vec3Float,
radius: r.floatle,
});
const Batch = new r.Struct({
flags: r.uint16le,
shaderID: r.uint16le,
submeshIndex: r.uint16le,
submeshIndex2: r.uint16le,
vertexColorAnimationIndex: r.int16le,
materialIndex: r.uint16le,
layer: r.uint16le,
opCount: r.uint16le,
textureLookup: r.uint16le,
textureMappingIndex: r.uint16le,
transparencyAnimationLookup: r.uint16le,
uvAnimationLookup: r.uint16le,
});
export default new r.Struct({
signature: new r.String(4),
indices: new Nofs(r.uint16le),
triangles: new Nofs(r.uint16le),
boneIndices: new Nofs(new r.Array(r.uint8, 4)),
submeshes: new Nofs(Submesh),
batches: new Nofs(Batch),
boneCount: r.uint32le,
});