THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2007 at 03:42, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.1
Platform: Windows ;
Language(s) : C++ ;
---------
Im writing a plugin to export C4D scenes to indigo XML format. When i export to .obj format(3ds gets triangulated automatically) i need to triangulate the mesh before export. how do i do that?
heres a code snippet:
Bool ExportXML::ExportObject(BaseObject *bo, BaseDocument *doc, Bool objExport, Filename fn, Bool meshLight)
{
BaseDocument *doc_dummy = BaseDocument::Alloc();
BaseTag *baset;
GeData gedata;
Material *tagmat;
Material *clonetagmat;
//Vector tempVector;
//Vector vector;
if (meshLight == 0)
{
//COPY MATERIAL
}
//COPY OBJECT
//SET POS 0,0,0 and ROTATION
Matrix matrix = baseobj->GetMg();
matrix.off.x = 0;
matrix.off.y = 0;
matrix.off.z = 0;
//rotete if .obj 0 1 0
if(objExport == 1)
{
//x
matrix.v1.x = 1;
matrix.v1.y = 0;
matrix.v1.z = 0;
//y
matrix.v2.x = 0;
matrix.v2.y = 0;
matrix.v2.z = -1;
//z
matrix.v3.x = 0;
matrix.v3.y = 1;
matrix.v3.z = 0;
}
baseobj->SetMg(matrix,FALSE);
if (meshLight == 0)
{
//SET MAT
}
if(objExport == 1)
{
// triangulate here
}
//EXPORT
if (objExport == 1) SaveDocument(doc_dummy,fn,TRUE,FORMAT_OBJEXPORT);
else SaveDocument(doc_dummy,fn,TRUE,FORMAT_3DSEXPORT);
doc_dummy->Free(doc_dummy);
return TRUE;
}