我一直在尝试解决程序中的访问冲突,以限制卷层次结构.运行时出现访问冲突错误.我使用过SDL和lib3d软件包.
错误:bvh.exe中0x00fa2e80处的未处理异常:0xC0000005:访问冲突读取位置0x00000004.
调用堆栈:> bvh.exe!Triangle::Triangle(const Vertex * vertexA, const Vertex * vertexB, const Vertex * vertexC, unsigned int r, unsigned int g, unsigned int b, bool twosided, bool triNormalProvided, Float3 triNormal)393行+ 0x150字节C++
我用以下方式定义了我的结构:
struct Float3
{
float X, Y Z;
Float3(float x=0, float y=0, float z=0)
:
X(x), Y(y), Z(z){}
Float3(const Float3& rhs)
:
X(rhs.X), Y(rhs.Y), Z(rhs.Z){}
inline Float3& operator+=(const Float3& rhs)
{
X += rhs.X; Y += rhs.Y; Z += rhs.Z; return *this;
}
// similar for the other …Run Code Online (Sandbox Code Playgroud)