Making a 3ds loader, need help with transforms...

Hi all.

I’m developping my own .3ds loader and I’m facing some problems…
First, I have troubles with rotations, I don’t know how to apply rotations to the vertices : I can read a vector and an angle in the file, but I’m pretty sure I need a point that belongs to the axis definded by the vector, if so, could you tell me where I could read such a point?

Second, once I’ve read all the transforms in the file, I don’t know in which order I should apply them, I mean for example, I don’t know if for the current keyframe, I should do 3 rotations, then 5 translations, then 2 rotations and then a scale, or start with 5 translations, then 2 rotations, etc.

I know I’m re-inventing the wheel, but I really don’t know how to solve these problems…

Thanks guys, see ya!

hi,

i think the rotation point you need is in the pivot point in chunk 0xB013 (3 floats)

for the order ot the transformations i found this

[quote] // Magical transformations. 3DS manages transformation oddly, IMHO
Lib3dsMatrix M;
lib3ds_matrix_copy(M, mesh->matrix);
lib3ds_matrix_inv(M);
Matrix4 M2(M); M2 = M2.transpose();
Matrix4 nodeM(node->matrix); nodeM = nodeM.transpose();
Lib3dsObjectData* obj_data = &node->data.object;
Matrix4 nodeT = Translation4(-Vector(obj_data->pivot)); nodeT = nodeT.transpose();
trans = transnodeMnodeT*M2;
[/quote]
here http://www.google.com/codesearch?hl=en&q=+lib3ds+pivot+show:FYE8Zsgkq0M:WfyM-M5Y7XQ:uMnIUe0wuyc&sa=N&cd=6&ct=rc&cs_p=http://savannah.nongnu.org/download/top10/top10-src-rel050108.tar.gz&cs_f=top10-rel050108/src/helpers/3dsRead.cpp#a0

maybe it helps…

Thanks, but I think I’ve found what I was looking for : a pos/rot/scale chunk contains for each frame, the index of the keyframe.

Other question now, I don’t know how nodes (bones) are related to the meshes vertices…