I'm currently creating a Video Game + Engine. I found some really amazing tutorials on DirectX 11 programming at RasterTek. They unfortunately use the depreciated DirectX SDK, and I am using VS 2013 with the new DirectX SDK included in the Windows SDK.
I am converting the code to use the Windows SDK, but I've run into some problems on tutorial 4 (yes I will be converting all 49 tutorials, and there will probably be more issues)
From Working with D3DXMath, I am told that D3DXVECTOR3 should be converted to XMFLOAT3. I am then trying to use these XMFLOAT3 in D3DXVec3TransformCoord, which has been converted to XMVector3TransformCoord.
Example:
XMFLOAT3 up, position, lookAt;
// Setup the vector that points upwards.
up.x = 0.0f
up.y = 1.0f
up.z = 0.0f
// Setup the position of the camera in the world.
position.x = m_positionX;
position.y = m_positionY;
position.z = m_positionZ;
// Setup where the camera is looking by default.
lookAt.x = 0.0f;
lookAt.y = 0.0f;
lookAt.z = 1.0f;
// Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin.
XMVector3TransformCoord(lookAt, rotationMatrix);
XMVector3TransformCoord(up, rotationMatrix);
I get an error:
IntelliSense: no suitable user-defined conversion from "DirectX::XMFLOAT3" to "DirectX::XMVECTOR" exists
I have found that I can TypeCast lookAt and up using XMLoadFloat3:
XMVector3TransformCoord(XMLoadFloat3(&lookAt), rotationMatrix);
XMVector3TransformCoord(XMLoadFloat3(&up), rotationMatrix);
Should I be doing this at all, and / or is it the best way to do this?
After doing this, I try to:
// Translate the rotated camera position to the location of the viewer.
lookAt = position + lookAt;
and get the error:
IntelliSense: no operator "+" matches these operands operand types are: DirectX::XMFLOAT3 + DirectX::XMFLOAT3
I was able to use the + operator on D3DXVECTOR3, but now not XMFLOAT3? How do I add these together?