0
D3DXMATRIX ColladaFileLoader::processMatrix(daeElement* node)
{
D3DXMATRIX matWorld;

daeTArray<daeElementRef> nodeChildren = node->getChildren();

for (int i = 0; i < nodeChildren.getCount(); i++)
{
    string type = nodeChildren[i]->getAttribute("sid");



    if (type == "rotationX")
    {
        string data = nodeChildren[i]->getCharData();
        stringstream stm(data);

        stm >> matWorld.m[0][0];
        stm >> matWorld.m[0][1];
        stm >> matWorld.m[0][2];
        stm >> matWorld.m[0][3];
    }


    if (type == "rotationY")
    {
        string data = nodeChildren[i]->getCharData();
        stringstream stm(data);

        stm >> matWorld.m[1][0];
        stm >> matWorld.m[1][1];
        stm >> matWorld.m[1][2];
        stm >> matWorld.m[1][3];
    }

    if (type == "rotationZ")
    {
        string data = nodeChildren[i]->getCharData();
        stringstream stm(data);

        stm >> matWorld.m[2][0];
        stm >> matWorld.m[2][1];
        stm >> matWorld.m[2][2];
        stm >> matWorld.m[2][3];
    }


    if (type == "location")
    {
        string data = nodeChildren[i]->getCharData();
        stringstream stm(data);

        stm >> matWorld.m[3][0];
        stm >> matWorld.m[3][1];
        stm >> matWorld.m[3][2];
        matWorld.m[3][3] = 1;
    }

}

return matWorld;
}

此函数将在结束第一次循环后运行运行调试断言失败。循环将正确运行,它将进入最后一个 if 语句并正确设置所有值。但是,当传递完成并开始下一次传递之前,它将调试我的断言失败。我认为它正在尝试破坏字符串类型变量,但是当它尝试删除它时,某些东西正在破坏。我不知道问题是什么。它似乎在我的程序的其他部分执行此操作,这些部分从文件中获取字符串并放置在 std::string 中。我通过完全删除它们来修复它们,但是这个不能删除它需要存在。

不知道这是否与它有关,但我正在使用 Visual Studio 11 开发预览,并使用编译器 vs100(vs10 的编译器)设置。

dbgheap.c 行:1322

表达式:_CrtISValidHeapPointer(pUserData)

同样,当我使用调试器时,该函数中的任何变量都不会在错误发生后出现。

4

1 回答 1

0

好吧,在我的头撞墙近一周后发现了这个问题,对于将来可能遇到这个问题的其他人,我会发布解决方案。

我使用的 colladaDOM 版本是使用 /mDd 库(多线程调试 dll)编译的,而我的项目使用 /mtd(多线程调试静态)设置。将我的项目更改为 /MDd 后,我的所有问题都消失了。

另一种可能的解决方案是使用 /mtd 重建 DOM 以匹配项目设置。

于 2011-10-24T19:14:18.883 回答