Hi,
In some DirectX 9 code I see variables such as velocity are stored in a D3DXVECTOR2.
In DirectX 11 I see DirectXMath should be used, and their version of a D3DXVECTOR2 is an XMFLOAT2.
What I am confused about is the D3DXVECTOR2 has lots of overloaded operators, where as XMFLOAT2 only has an = operator. I need to add two XMFLOAT2 variables together using +=.
From my searching it seems if you want to do something with an XMFLOAT2 you first need to put it into an XMVECTOR, do the operation, and then put it back into an XMFLOAT2.
I am wondering why this is the way?
Secondly, can I just create my own XMFLOAT2 (myXMFLOAT2) from the existing XMFLOAT2 code in DIrectXMath, but add my own overloaded operators. Is there a noticeable performance difference using one or the other?
Thanks