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;
}
This function will run run debug assertion failed after it ends the first pass through the loop. The loop will run correctly, it will enter the last if statement and set all values correctly. However when the pass is done and before it starts the next pass it will debug assertion failed on me. I think it is trying to destroy the string type variable but something is breaking when it does tries to delete it. I don't know what the problem is. It seems to do this on other parts of my program that get strings from the file and place in std::string. I fixed those by just removing those entirely but this one cannot be removed it needs to exist.
Don't know if this has anything to do with it, but I'm using visual studio 11 dev preview, and using compiler vs100 (vs10's compiler) settings.
dbgheap.c Line:1322
Expression: _CrtISValidHeapPointer(pUserData)
also when i use debugger none of my vars from this function show up after the error.
Ok found the problem after nearly a week of beating my head against the wall, for others who may have run into this issue in the future I'll post the solution.
The version of colladaDOM I used was compiled with /mDd library (multi-threaded debug dll) while my project was using /mtd (multi threaded debug static) settings. After changing my project to /MDd all my problems vanished.
Another possible solution would be to rebuild DOM with /mtd to match the project settings.