5 Replies - 650 Views - Last Post: 16 October 2013 - 02:35 AM Rate Topic: -----

#1 Fanie  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 8
  • Joined: 19-August 13

How to convert aiMatrix4x4 to D3DXMATRIX?

Posted 15 October 2013 - 08:44 AM

Hi guys

Iím stuck with a problem trying to convert Assimpís aiMatrix4x4 to a D3DXMATRIX since Iím using DirectX. I do not want to use the aiMatrix4x4 because my whole engine uses the D3DXMATRIX.

Thanks in advance.
Is This A Good Question/Topic? 0
  • +

Replies To: How to convert aiMatrix4x4 to D3DXMATRIX?

#2 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 999
  • View blog
  • Posts: 4,177
  • Joined: 14-February 08

Re: How to convert aiMatrix4x4 to D3DXMATRIX?

Posted 15 October 2013 - 11:59 AM

Surely it's simple enough to grab the values from the aiMatrix4x4 and set them into your D3DXMATRIX? They are both matrices after all.

Construct your D3DXMATRIX using the values from the aiMatrix4x4. One D3DXMATRIX constructor takes a pointer to floats.

D3DXMATRIX( CONST FLOAT * );


Was This Post Helpful? 1
  • +
  • -

#3 Fanie  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 8
  • Joined: 19-August 13

Re: How to convert aiMatrix4x4 to D3DXMATRIX?

Posted 15 October 2013 - 01:00 PM

Hi.
Thank you for your answer stayscript. I had some includes missing but it is all sorted out now.
I donít know the exact reason but when I tried, like you suggested, I got a constant error. This was the code:
const aiMatrix4x4 pMatrix = paiMesh->mBones[i]->mOffsetMatrix;
	 D3DXMATRIX PMatrix;
	 PMatrix(0,0) = pMatrix.a1;


The compiler complained about .a1 cannot be found. I included "matrix4x4" and all is fine.

Thanks again.
Was This Post Helpful? 0
  • +
  • -

#4 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 999
  • View blog
  • Posts: 4,177
  • Joined: 14-February 08

Re: How to convert aiMatrix4x4 to D3DXMATRIX?

Posted 16 October 2013 - 01:21 AM

Your code isn't really what I was suggesting, i suggested that you pass in the array of floats from the aiMatrix4x4 and use them to construct the D3DXMATRIX

Something like the following:
D3DXMATRIX PMatrix(&paiMesh->mBones[i]->mOffsetMatrix[0]);



Glad you got it working though :)
Was This Post Helpful? 1
  • +
  • -

#5 Fanie  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 8
  • Joined: 19-August 13

Re: How to convert aiMatrix4x4 to D3DXMATRIX?

Posted 16 October 2013 - 02:20 AM

Hi styscript.
Thank you for your idea. Never thought of it. Iíll surely implement it. Its mush better.
Thanks again
Was This Post Helpful? 0
  • +
  • -

#6 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 999
  • View blog
  • Posts: 4,177
  • Joined: 14-February 08

Re: How to convert aiMatrix4x4 to D3DXMATRIX?

Posted 16 October 2013 - 02:35 AM

No problem.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1