That’s how I do it:
The transform matrix is a GLdouble[16];
When you parse the ASE file, fill the Matrix array like that:
TM_ROW0:
Matrix[0],Matrix[1],Matrix[2];
TM_ROW1:
Matrix[4],Matrix[5],Matrix[6];
TM_ROW2:
Matrix[8],Matrix[9],Matrix[10];
TM_ROW3:
Matrix[12],Matrix[13],Matrix[14];
Then:
Matrix[3]=0;
Matrix[7]=0;
Matrix[11]=0;
Matrix[15]=1;
Then, you have an “OpenGL” matrix (these are the indices of your Matrix array):
[ 0 4 8 12 ]
[ 1 5 9 13 ]
[ 2 6 10 14 ]
[ 3 7 11 15 ]
That’s why I meant ‘transpose’ (what they call “ROW” in ASE file is a Column for us !).
Now, for each normal that is in the ASE file (u,v,w), you obtain the proper normal (ru,rv,rw) like this:
ru=Matrix[0]*u+Matrix[4]*v+Matrix[8]w;
rv=Matrix[1]*u+Matrix[5]*v+Matrix[9]*w;
rw=Matrix[2]*u+Matrix[6]*v+Matrix[10]*w;
Now, to display your object, simply start with a glTranslated that will bring your object in the correct position:
glTranslated(Matrix[12],Matrix[13],Matrix[14]);
Then send your vertices like they are in the ASE file (THEY ARE ALREADY TRANSFORMED BY THE GIVEN MATRIX !) and send the normals as we just calculated them.
It definitely works !!!
Regards.
Eric