Direct3D X文件如何计算offsetmatrix
我简单明了的讲下我的意图,在x文件中同时提供了FrameTransformMatrix和offsetmatrix,但是根据骨骼动画的原理 知道了FrameTransformMatrix应该能够反推出offsetmatrix
比如对于Bip01_Pelvis这块骨骼 我如何反推出offsetmatrix,我怎么算发现和.x文件的不一致,希望高手给出解答
希望给出具体的矩阵表达式
这是我的代码
D3DXMATRIXA16 tempBody(
1.278853,0.000000,-0.000000,0.000000,
0.000000,0.000000,1.123165,0.000000,
0.000000,-1.470235,0.000000,0.000000,
0.135977,2.027985,133.967667,1.000000
);
D3DXMATRIXA16 tempNull(
1.000000,-0.000000,-0.000000,0.000000,
-0.000000,1.000000,0.000000,0.000000,
-0.000000,0.000000,1.000000,0.000000,
-0.142114,0.000023,-49.556850,1.000000
);
D3DXMATRIXA16 tempBox01(
-1.000000,0.000000,-0.000000,0.000000,
-0.000000,0.000000,1.000000,0.000000
,0.000000,1.000000,0.000000,0.000000,
-88.696747,-246.341751,858.815247,1.000000
);
D3DXMATRIXA16 tempBip01(
0.186552,-0.974653,0.123489,0.000000,
0.982171,0.187991,0.000000,0.000000,
-0.023215,0.121288,0.992346,0.000000,
-88.977890,-857.346008,247.541595,1.000000
);
D3DXMATRIXA16 tempBip01_Pelvis(
-0.000000,0.011807,0.999930,0.000000,
1.000000,0.000001,-0.000000,0.000000,
-0.000001,0.999930,-0.011807,0.000000,
-2.454305,-1.950977,-0.000005,1.000000
);
D3DXMATRIXA16 tempBip01_PelvisOffset(
-0.000002,0.000004,1.278853,0.000000,
1.123165,-0.000000,0.000002,0.000000,
0.000000,1.470235,-0.000004,0.000000,
126.489456,-70.579353,-0.141854,1.000000
);
D3DXMATRIXA16 tempNullToAll = tempNull * tempBody ;
D3DXMatrixInverse( &tempNull , NULL , &tempNull ) ;
D3DXMatrixInverse( &tempBody , NULL , &tempBody ) ;
D3DXMATRIXA16 result ;
D3DXMatrixIdentity( &result) ;
result *= tempBody ;
result *= tempNull ;
result *= tempBip01_PelvisOffset ;//变换到骨骼space
result *= tempBip01_Pelvis ;
result *= tempBip01 ;
result *= tempBox01 ;//以上三步变换到meshspace
按理计算完毕之后