Movatterモバイル変換


[0]ホーム

URL:


Games for Windows and the DirectX SDK blog

Technical tips, tricks, and news about game development for Microsoft platforms including desktop, Xbox, and UWP


Project maintained bywalbournHosted on GitHub Pages — Theme bymattgraham
Home |Posts by Tag |Posts by Month

DirectXMath 3.08

directxmath

Originally posted to Chuck Walbourn's Blog on MSDN,

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:

  • Added use of ``_mm_sfence`` for Stream methods
  • Fixed bug with non-uniform scaling transforms forBoundingOrientedBox
  • Added asserts for Near/FarZ in XMMatrix* methods
  • Added use of=default for PODs with VS 2013/2015
  • Additional SSE and ARM-NEON optimizations for PackedVector functions

It’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' used

The 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.

BoundingOrientedBox

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


[8]ページ先頭

©2009-2025 Movatter.jp