Technical tips, tricks, and news about game development for Microsoft platforms including desktop, Xbox, and UWP
DirectXMath version 3.08 is included in theWindows 10 SDK November 2015 update (10586) that ships withVS 2015 Update 1 with the Windows Tools 1.2 for Windows 10.
This new version includes the following:
BoundingOrientedBox=default for PODs with VS 2013/2015It’s a fairly minor update compared toDirectXMath 3.07, but does have one interesting side-effect worth discussing further. Because of the use of the C++11=default construct, existing DirectXMath code may generate new previously latent warnings when building with VS 2013 or VS 2015:
warning C4101: 'X': unreferenced local variablewarning C4701: potentially uninitialized local variable 'X' usedThe warnings are easy to address, but may surprise developers when they pop up in existing code. Note that the=default construct is not merely syntactic fluff: In some use cases, it can make the compiler generate much better code by understanding the constructor does nothing at all and the type in question is in fact ‘trivial plain-old-data’. This mostly shows up in the cases of inheritance, so it may not be obviously different in simple codegen cases. It does, however, cause these compiler to notice when a variable is not actually used or initialized.
The fix for non-uniform scaling transformations is trivial to apply to older versions of the library:
inlinevoidXM_CALLCONVBoundingOrientedBox::Transform(BoundingOrientedBox&Out,FXMMATRIXM)const{// Load the box.XMVECTORvCenter=XMLoadFloat3(&Center);XMVECTORvExtents=XMLoadFloat3(&Extents);XMVECTORvOrientation=XMLoadFloat4(&Orientation);assert(DirectX::Internal::XMQuaternionIsUnit(vOrientation));// Composite the box rotation and the transform rotation.XMMATRIXnM;nM.r[0]=XMVector3Normalize(M.r[0]);nM.r[1]=XMVector3Normalize(M.r[1]);nM.r[2]=XMVector3Normalize(M.r[2]);nM.r[3]=g_XMIdentityR3;XMVECTORRotation=XMQuaternionRotationMatrix(nM);vOrientation=XMQuaternionMultiply(vOrientation,Rotation);// Transform the center.vCenter=XMVector3Transform(vCenter,M);// Scale the box extents.XMVECTORdX=XMVector3Length(M.r[0]);XMVECTORdY=XMVector3Length(M.r[1]);XMVECTORdZ=XMVector3Length(M.r[2]);XMVECTORVectorScale=XMVectorSelect(dY,dX,g_XMSelect1000);// !!swapped dX and dYVectorScale=XMVectorSelect(dZ,VectorScale,g_XMSelect1100);// !!swapped dZ and VectorScalevExtents=vExtents*VectorScale;// Store the box.XMStoreFloat3(&Out.Center,vCenter);XMStoreFloat3(&Out.Extents,vExtents);XMStoreFloat4(&Out.Orientation,vOrientation);}Xbox One: DirectXMath 3.08 shipped in the Xbox One XDK (July 2015 or later)
GitHub: Note that DirectXMath is now hosted onGitHub.
Related:Known Issues: DirectXMath 3.03,DirectXMath 3.06,DirectXMath 3.09,DirectXMath 3.10,DirectXMath 3.11