Change the default to non wireframe mode
[dormin.git] / reeng / animations.txt
blob5e435909e9cc0fcf2a090e3780e0deba866ea78e
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 ----------------------------------------------------------------------
16 When flag is 0:
17  Data contains: 4 floating point numbers (unit quaternion).
19 ----------------------------------------------------------------------
20 When flag is 3,4,5,6:
21  Data contains: 8 floating point numbers and an array of M 32 bit
22  values.
24  Floating points are 4 pairs actually, for first 3 pairs following
25  holds:
26    first pair member is in [-1, 1]
27    second                  [ 0, 1)
29  For last(4th) pair:
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
34  like this:
35                               I    J    K    S (signed N bit vars)
36    flag 3                  5bit 9bit 9bit 9bit
37         4                  9bit 5bit 9bit 9bit
38         5                  9bit 9bit 5bit 9bit
39         6                  9bit 9bit 9bit 5bit
41  From these one can obtain quaternion like this:
42    float i, j, k, s;
43    switch (flag) {
44    case 3:
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));
49      if (I & 16) i = -i;
50      break;
51    case 4:
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));
56      if (J & 16) j = -j;
57      break;
58    ... and so on
59    }
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 ----------------------------------------------------------------------
67 When flag is 12:
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
70  values)
72  Floating pints form 3 pairs, constraint:
73   first pair member (-1, 1)
74   second            [ 0, 1)
76 ----------------------------------------------------------------------
77 When flag is 13:
78  Data contains: 5 floating point numbers and an array of M signed 16
79  bit values.
81  Floats:
82   [0]    - [0.024525, 6.266401]
83   [1]    - [0.003143, 1.655432]
84   [2..4] - axis
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);