Using the colladaDOM to load .dae into directx format.
Heres one of my functions, it is simple, takes in a node, gets a list of its children, and loops through them, in each loop it will make a string type variable and call the getAttribute(“sid”) to fill it out and then depending on what the string is, it will put some data in the array of a D3DXMATRIX.
The function just fills out a matrix from the collada file.
So it works perfect up to when it finishes it’s first pass through the loop, and it is deallocating the string, debug assertion error. Allocating it works fine though.
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 and files) settings.
dbgheap.c Line:1322
Expression: _CrtISValidHeapPointer(pUserData)
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;
}