Reputation: 9299
I would like to get the dot product of two 3D vectors in float. But unfortunately the result is a vector, not a float. I trued to access it's elements using vector4_f32
, but I get an error, that it's not a member of __m128
float res = XMVector3Dot(a, b).vector4_f32[0];
The []
operator is not defined on XMVECTOR
Upvotes: 2
Views: 1895
Reputation: 3361
You can access individual elements of XMVECTOR
by using XMVectorGetX
, XMVectorGetY
, XMVectorGetZ
and XMVectorGetW
. But remember, these are more likely expensive operations as DirectXMath uses SIMD instruction set. For more info:
Upvotes: 4