//my matrix:
float m[4][4]; //the same like direct3d uses
m.SetIdentity();
for(lj=0;lj<4;lj++)
for(li=0;li<3;li++)
fread(&m[lj][li,sizeof(float),1,pFile);
//and then
lpD3DDevice->SetTransform(...._WORLD,m);
3D Studio - matrix
Hi,
I have read several documents about the file format of .3ds-file, but there is never a good description of the matrix you can find at the chunk 0x4160. I am using Direct3D.
how do I have to load this matrix correct? I never got a good result. my legs, head, body etc. were all over the screen, but not at the right place.
I tried:
(I know the syntax is not correct here)
but something is wrong..
do i have to use two matrices, a translation and rotation or something like that?
[edited by - kudi on April 18, 2003 12:03:04 PM]
Here is some particularly awful code that loads this matrix:
case 0x4160:
{ // Local transformation matrix
int i, j;
if(tail == NULL) break;
for (j=0;j<4;j++)
{
for (i=0;i<3;i++)
{ fread(&(tail->lmat[j]),sizeof(float),1,bin3ds);
}
}
tail->lmat[0][3]=0;
tail->lmat[1][3]=0;
tail->lmat[2][3]=0;
tail->lmat[3][3]=1;
}
break;
case 0x4160:
{ // Local transformation matrix
int i, j;
if(tail == NULL) break;
for (j=0;j<4;j++)
{
for (i=0;i<3;i++)
{ fread(&(tail->lmat[j]),sizeof(float),1,bin3ds);
}
}
tail->lmat[0][3]=0;
tail->lmat[1][3]=0;
tail->lmat[2][3]=0;
tail->lmat[3][3]=1;
}
break;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement