I played with models ff9. Loading models and textures is no problem. As shown in the accompanying pictures. Everything worked fine until I wanted to attach the bone. I'm loading structure as is described in the documentation on the wiki. The first thing I wanted to do is display a bone structure. And this is what I get:
The second picture is the same bone structure, just rotated. Could be considered part of the legs but the rest is not suitable for anything.
These bones belong to the model of Steiner (38 from db folder 7). Here's bone structure:
Magic: 0x0000
Bones count: 28
Groups count: 3
Bytes: 14080
Id 1: 20
Id 2: 603
Id 3: 272
Bone pointer: 0x14
Group pointer: 0x84
ID Parent_ID LENGTH
0 0 65521
1 0 0
2 1 48
3 2 41
4 3 80
5 4 88
6 1 48
7 6 41
8 7 80
9 8 88
10 0 0
11 10 121
12 11 50
13 12 46
14 13 98
15 14 71
16 15 50
17 13 98
18 11 50
19 10 121
20 19 21
21 10 121
22 21 50
23 22 46
24 23 98
25 24 71
26 23 98
27 21 50
First frame of the animation (angles in degrees):
BONE_ID PITCH YAW ROLL
0 200,4396 67,16483 194,2857
1 358,8571 270,1538 287,2967
2 359,5604 270,9451 360
3 46,76923 59,95604 55,2967
4 64,7033 0 0
5 314,5494 19,34066 359,1209
6 359,5604 89,14286 0
7 21,45055 334,7692 290,989
8 53,71429 0 0
9 5,362638 357,3626 5,978022
10 92,30769 309,8901 11,95604
11 214,6813 83,69231 22,41758
12 347,0769 343,5604 2,989011
13 16,96703 10,54945 53,97802
14 244,2198 33,31868 359,1209
15 359,5604 358,9451 26,9011
16 270,1538 0 0
17 38,32967 0 0
18 174,4176 66,54945 360
19 26,9011 0 0
20 348,4835 21,53846 47,82418
21 214,6813 276,3956 358,6813
22 330,9011 358,6813 359,9121
23 291,6044 347,5165 16,43956
24 292,3077 359,033 359,3846
25 1,934066 35,25275 14,94506
26 54,41758 0 0
27 305,3187 70,59341 291,7802
The first thing that draws attention is that the first bone length is 65521. It's non error reading file. I look into hex editor end there is this value. But i assume that is root bone and length is always 0. A second is structure. In the post
http://forums.qhimm.com/index.php?topic=8781.0 Chev has a completely different structure for Steiners bones. It is possible that is a different model but I checked a lot of them and nearly all have very similar structure to this one.
I uses OpenGL to display. I use this function:
void boneDraw (Bone * root)
{
glPushMatrix ();
glRotatef (root-> roll, 0.0, 0.0, 1.0);
glRotatef (root-> yaw, 0.0, 1.0, 0.0);
glRotatef (root-> pitch, 1.0, 0.0, 0.0);
glBegin (GL_LINES);
glColor3f (1.0, 0.0, 0.0);
glVertex2f (0, 0);
glColor3f (0.0, 1.0, 0.0);
glVertex2f (root-> length, 0);
glEnd ();
glTranslatef (root-> length, 0.0, 0.0);
for (int i = 0; i <root-> childCount; i + +)
boneDraw (root-> child
);
glPopMatrix ();
}
What I'm doing wrong?
Sorry for my English.
Urls to bigger images:
http://vjiatrs.w.interia.pl/ff9/bone.jpg
http://vjiatrs.w.interia.pl/ff9/bone_rot.jpg
http://vjiatrs.w.interia.pl/ff9/steiner.jpg
http://vjiatrs.w.interia.pl/ff9/weapon.jpg
http://vjiatrs.w.interia.pl/ff9/weapon1.jpg
http://vjiatrs.w.interia.pl/ff9/monster.jpg