how to convert XMMATRIX to D3DMATRIX in DirectX 9?

前端 未结 1 1208
一整个雨季
一整个雨季 2021-01-24 05:30

I learn DirectX (DirectX 9) from www.directxtutorial.com and using visual studio 2012 in windows 8. d3dx9 (d3dx) replace by other header like DirectXMath, therefore I replaced a

相关标签:
1条回答
  • 2021-01-24 05:50

    You can use XMStoreFloat4x4 to convert XMMATRIX to a XMFLOAT4X4.

    You should be able to pass in XMFLOAT4X4 to setTransform by casting.

    DirectX::XMMATRIX matProjection;   
    DirectX::XMFLOAT4X4 projectionMatrix;
    DirectX::XMMatrixPerspectiveFovLH(&matProjection,DirectX::XMConvertToRadians(45),1.0f,100.0f); 
    XMStoreFloat4x4(&projectionMatrix, matProjection);
    d3ddev->SetTransform(D3DTS_PROJECTION, (D3DXMATRIX*)&projectionMatrix);  /*problem!*/   // set the projection
    
    0 讨论(0)
提交回复
热议问题