使用XMMatrix和std::vector的访问冲突
Access Violation using XMMatrix and std::vector
我目前在我的项目中遇到了一个问题,我正在尝试运行Dx11。
我的错误是:3DTestProject.exe中0x00FC266D处未处理的异常:0xC0000005:读取位置0x00000000时发生访问冲突。
崩溃发生在我的Model.cpp in Model::Render()中的以下行:cb.mWorld = DirectX::XMMatrixTranspose(aOrientation);
由于实现的原因,我必须将其作为Render()中的常量引用发送
const DirectX::XMMATRIX& aOrientation
从实例调用m_pModel->Update();
实例的标题如下:
class Instance
{
public:
Instance();
Instance(Model* aModel);
~Instance();
void Update();
void Render(Camera* aCamera);
private:
DirectX::XMMATRIX m_Orientation;
};
我的猜测是,这是因为我将实例存储在Scene.h中作为std::向量,但我不知道如何解决它。
std::vector<Instance> m_vecInstances;
在这一点上,更改这些行并使用XMFLOAT4X4似乎是可行的。
const DirectX::XMFLOAT4X4 aOrientation
和
cb.mWorld = DirectX::XMMatrixTranspose(XMLoadFloat4x4(&aOrientation));
相关文章:
- 写入位置0x0000000C时发生访问冲突
- 引发异常:读取访问冲突**dynamicArray**为0x1118235.发生
- 链表中写入访问冲突的未知原因
- C++中的openCV Mat访问冲突
- C++尝试深度复制唯一指针时出现内存访问冲突
- C++ 中动态二维数组的访问冲突
- 从嵌套循环中的 std::list 中删除将返回访问冲突
- 写入访问冲突异常
- 在类 12.exe 中0x7B37FF80 (ucrtbased.dll) 引发异常: 0xC0000005:访问冲突读
- 使用静态 std::vector 类成员时出现访问冲突
- Vector::p ush_back() 给出读取访问冲突
- 调用std::vector::empty()时内存访问冲突读取位置
- 使用XMMatrix和std::vector的访问冲突
- 循环中的 BadPtr 访问冲突,将字符**转换为 std::vector<string>
- 创建具有自动存储的自定义对象并推送回 std::vector 时访问冲突
- 使用std::vector时发生访问冲突
- std::vector push_back 会导致访问冲突
- 处理vector迭代中的访问冲突异常
- c++ Vector读访问冲突Mylast返回0x8
- 给map vector容器的元素赋值时发生访问冲突