Questions tagged [directxmath]

The DirectXMath API provides SIMD-friendly C++ types and functions for common linear algebra and graphics math operations common to DirectX applications.

The DirectXMath API provides SIMD-friendly C++ types and functions for common linear algebra and graphics math operations common to DirectX applications. The library provides optimized versions for Windows 32-bit (x86), Windows 64-bit (x64), Windows RT, and Windows Mobile through SSE and ARM-NEON intrinsics support in the Visual C++ compiler.

Source: MSDN

DirectXMath is also hosted on GitHub

57 questions
1
vote
1 answer

Can't multiply XMVECTOR with float

I got these rows code from the DirectX Tutorial which is compiling fine in the tutorial: DirectX::XMFLOAT4 vLightDirs[2] = { DirectX::XMFLOAT4(-0.577f, 0.577f, -0.577f, 1.0f), DirectX::XMFLOAT4(0.0f, 0.0f, -1.0f, 1.0f), }; for (int m = 0; m…
indiehjaerta
  • 319
  • 1
  • 8
  • 19
1
vote
1 answer

Memory Exception using XMFLOAT3 & XMVECTOR

I'm trying to implement Pitch/Yaw for my Camera class in D3D, but my Pitch() function, throws a "Access Violation reading location 0x0000008C". I googled a bit and saw I can't use XMVECTOR in a class/struct because of 16 bit alignment. However I…
Rakete1111
  • 47,013
  • 16
  • 123
  • 162
1
vote
1 answer

Worldviewpoj Range

Today I debugged my code and saw that my worldviewproj was huge (sorry it it's not readable): { 4.91479736e+010, -6.29708390e+010, -863636224, 432034112 } That's the first line, and I'm trying to debug my code because my application doesn't display…
Rakete1111
  • 47,013
  • 16
  • 123
  • 162
1
vote
1 answer

Does DirectXMath work on OSX and Linux with OpenGL?

Is the DirectXMath library cross platform? Is it possible to use it with OpenGL and/or on OSX and Linux?
Chad Vernon
  • 593
  • 4
  • 12
1
vote
1 answer

How to convert XMFLOAT3 to const float *pData?

I have the following code: XMFLOAT3 normalized_direction = XMVector3Normalize(direction); pEffect->GetVariableByName("g_CameraDirection")->AsVector()->SetFloatVector(normalized_direction); I want to pass XMFLOAT3 in const float *pData ?
Faisal
  • 623
  • 6
  • 11
1
vote
1 answer

Using XMMatrixLookAtLH - trying to face a point, but doesn't work/crashes?

I'm using this code for my Entity class: void Entity::Face(FXMVECTOR target) { XMVECTOR up = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f); up = XMVector3Transform(up, Rotation); Rotation = XMMatrixLookAtLH(Translation, target, up); //Rotation is a…
ulak blade
  • 2,515
  • 5
  • 37
  • 81
1
vote
2 answers

16 byte alignment issue

I am using DirectXMath, creating XMMatrix and XMVector in classes. When I call XMMatrixMultiply it throws unhandled exception on it. I have found online that it is an issue with byte alligment, since DirectXMath uses SIMD instructions set which…
Neomex
  • 1,650
  • 6
  • 24
  • 38
1
vote
2 answers

Can not access 16-bit aligned members of std::vector?

I am struggling with STL vectors in C++. I was compiling my project for only x64 for a time (actually for months), and everything was working fine, when I remembered that I need this to work on x86 machines also (Win32 DirectX application). Of…
0
votes
1 answer

C# Matrix4x4 equivalent of DirectX::XMMatrixPerspectiveLH

I was trying to port some c++ code to C#, everything works except the perspective. In c++ the code looks like this, which worked without distortion. DirectX::XMMatrixTranspose( DirectX::XMMatrixRotationZ(100) * …
0
votes
1 answer

How to check if object is in viewport Directx 11

I'm trying to check if an object is currently on the screen in directx. I have the view matrix and the projection matrix and the x y z of both the object and the camera. This seems like a common issue people have but Ive tried looking all over…
J. Doe
  • 171
  • 4
  • 11
0
votes
1 answer

Convert CONST D3DMATRIX to XMMATRIX

I'm programming a wrapper for first time and working with lots of different header files, but reached a problem. I can't convert D3DMATRIX to XMMATRIX. Looking at https://learn.microsoft.com/en-us/windows/win32/dxmath/pg-xnamath-migration-d3dx it…
J. Doe
  • 171
  • 4
  • 11
0
votes
1 answer

Objects beyond the far clipping plane are rendered in perspective view

I see objects beyond the far clipping plane in perspective projection and I don't think this is how it's suppose to work, so can someone give me an explanation why do I see objects beyond the far clipping plane such as a grid in this example. The…
ma1169
  • 659
  • 1
  • 8
  • 26
0
votes
0 answers

Projecting and Unprojecting Points with DirectX Math

Projecting the points (-1, 0, 0) and (1, 0, 0) with XMVector3Project gives me the result: P: (589.75,512,0.999683) <-> (1458.25,512,0.999683) Unprojecting these points with XMVector3Unproject gives: U: -0.000416635,0,-23.99 <->…
Robinson
  • 9,666
  • 16
  • 71
  • 115
0
votes
1 answer

How to build XMMATRIX using four FMVECTOR

Is it possible to build XMMATRIX using four FMVECTOR ? I took the idea from Frank Luna's book and I tried to build something around that but unfortunately it is clear that I did not grasp the concept well. Here it is what I wrote. Ok, I know that…
cppstudent
  • 23
  • 4
0
votes
1 answer

Redefinitions when #include-ing DirectXMath and DirectXTex

Using VS2018Pro, Windows10, I'm getting many redefinition compilation errors when pulling in DirectXTex.h, DirectXMath.h and DirectXCollision.h across project files. DirectXMath and DirectXCollision are part of the Win10SDK headers and I pulled…
Dave
  • 117
  • 7