为什么 XMMatrixLookAtLH 会导致调试错误?
Why does XMMatrixLookAtLH result in a debug error?
我正在用 C++ 开发一个 DirectX 11 游戏,我正在尝试创建一个视图矩阵,但是当我这样做时,我收到以下调试错误:
Assertion failed!
Program: ...ate-Direct3D11\Build\Debug\Template-Direct3D11.exe
File: C:\Program Files (x86)\Windows Kits...\DirectX...rix.inl
Line: 1971
Expression: !XMVector3Equal(EyeDirection, XMVectorZero())
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts
(Press Retry to debug the application - JIT must be enabled)'Template-Direct3D11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\TextShaping.dll'.
Template-Direct3D11.exe has triggered a breakpoint.
代码如下:
DirectX::XMVECTOR eyePos = DirectX::XMVectorSet(0.f, 0.f, -2.f, 0.f);
DirectX::XMVECTOR lookAtPos = DirectX::XMVectorSet(0.f, 0.f, -2.f, 0.f);
DirectX::XMVECTOR upVector = DirectX::XMVectorSet(0.f, 1.f, 0.f, 0.f);
DirectX::XMMATRIX view = DirectX::XMMatrixLookAtLH(eyePos, lookAtPos, upVector); //Debug Error
我在网上找不到任何关于这个的信息,因为似乎每个人都有与我不同的错误。
有人可以帮忙吗?
你设置的eyPos
和lookAtPos
是同一个值...结果是一个0长度的方向单位向量
DirectX::XMVectorSet
is not the best way to initialize a constant vector. Read the DirectXMath Programmer's Guide particularly the Getting Started guide.
我正在用 C++ 开发一个 DirectX 11 游戏,我正在尝试创建一个视图矩阵,但是当我这样做时,我收到以下调试错误:
Assertion failed!
Program: ...ate-Direct3D11\Build\Debug\Template-Direct3D11.exe
File: C:\Program Files (x86)\Windows Kits...\DirectX...rix.inl
Line: 1971
Expression: !XMVector3Equal(EyeDirection, XMVectorZero())
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts
(Press Retry to debug the application - JIT must be enabled)'Template-Direct3D11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\TextShaping.dll'.
Template-Direct3D11.exe has triggered a breakpoint.
代码如下:
DirectX::XMVECTOR eyePos = DirectX::XMVectorSet(0.f, 0.f, -2.f, 0.f);
DirectX::XMVECTOR lookAtPos = DirectX::XMVectorSet(0.f, 0.f, -2.f, 0.f);
DirectX::XMVECTOR upVector = DirectX::XMVectorSet(0.f, 1.f, 0.f, 0.f);
DirectX::XMMATRIX view = DirectX::XMMatrixLookAtLH(eyePos, lookAtPos, upVector); //Debug Error
我在网上找不到任何关于这个的信息,因为似乎每个人都有与我不同的错误。
有人可以帮忙吗?
你设置的eyPos
和lookAtPos
是同一个值...结果是一个0长度的方向单位向量
DirectX::XMVectorSet
is not the best way to initialize a constant vector. Read the DirectXMath Programmer's Guide particularly the Getting Started guide.