for (int m=0; mGetMaterialCount(); m++) { // Here I should have to analize each material, // but if I call MatList[m]->GetDiffuseColor or other // methods of the class I get an exception and // the program terminates... }
Anybody can help me? The FTK help is not clear about this...
There are 2 materials type: * SI_MATERIAL (exported in dotXSI 3.5 format) : with common functions * XSI_MATERIAL (exported from the dotXSI 3.6 format): with this you have the render tree exported, not the common components. Both herit from CSLBaseMaterial.
So you have to test which material you read with the function Type(); if (pMaterial->Type() == CSLTemplate::SI_MATERIAL) { CSLMaterial mat = (CSLMaterial)pMaterial; ... mat->GetAmbientColor() ... ... mat->GetDiffuseColor() ... } else { CSLXSIMaterial mat = (CSLXSIMaterial)pMaterial;
//read connections
//read shaders and shaders parameters...
}
Have a look in the SLTest sample from the FTK 3.6.3. If you just need a common material (ambient, diffuse...), I advise you to use only dotXSI format 3.5.