1 What defines an animation in SOTC
2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 File with animation contains:
5 16 bit count - number of poses? (M)
6 32 bit count - number of bones (N)
8 There's an array of per bone flags, each flag is 8 bit and can take
9 following values: 0,3,4,5,6,12,13 (at least only those has been
10 observed in .anb files)
12 Every bone has associated data whose length/interpretation depends on
13 the value of the flag.
15 ----------------------------------------------------------------------
17 Data contains: 4 floating point numbers (unit quaternion).
19 ----------------------------------------------------------------------
21 Data contains: 8 floating point numbers and an array of M 32 bit
24 Floating points are 4 pairs actually, for first 3 pairs following
26 first pair member is in [-1, 1]
30 first pair member is in [-0.018651, 0.016117]
31 second [ 0.000000, 0.044226]
33 Depending on the flag the value from 32bit array[M] is broken down
35 I J K S (signed N bit vars)
36 flag 3 5bit 9bit 9bit 9bit
41 From these one can obtain quaternion like this:
45 j = madd(J / 256.0, pairs[0].first, pairs[0].second);
46 k = madd(K / 256.0, pairs[1].first, pairs[1].second);
47 s = madd(S / 256.0, pairs[2].first, pairs[2].second);
48 i = sqrt(1 - magnitude(j, k, s));
52 i = madd(I / 256.0, pairs[0].first, pairs[0].second);
53 k = madd(K / 256.0, pairs[1].first, pairs[1].second);
54 s = madd(S / 256.0, pairs[2].first, pairs[2].second);
55 j = sqrt(1 - magnitude(i, k, s));
61 quat q = (i, j, k, s);
63 (It's evident that last 4 bits of 5bit value are unaccounted for,
64 likewise the third pair)
66 ----------------------------------------------------------------------
68 Data contains: 6 floating point numbers and an array of M 48 bit
69 values. (Looks as if every 48 bit value is a tuple of three 16 bit
72 Floating pints form 3 pairs, constraint:
73 first pair member (-1, 1)
76 ----------------------------------------------------------------------
78 Data contains: 5 floating point numbers and an array of M signed 16
82 [0] - [0.024525, 6.266401]
83 [1] - [0.003143, 1.655432]
86 From these one can obtain quaternion like this:
87 float radians = madd(16bitint / 32767.0, float[1], float[0])
88 quat q = from_axis_angle(axis, radians);