add -C to egg2obj

This commit is contained in:
David Rose 2012-09-04 16:58:49 +00:00
parent d995a97ca1
commit f7353b79e7
2 changed files with 13 additions and 0 deletions

View File

@ -38,6 +38,11 @@ EggToObj() :
"Specify the coordinate system of the resulting " + _format_name +
" file. Normally, this is z-up.");
add_option
("C", "", 0,
"Clean out higher-order polygons by subdividing into triangles.",
&EggToObj::dispatch_none, &_triangulate_polygons);
_coordinate_system = CS_zup_right;
_got_coordinate_system = true;
}
@ -49,6 +54,12 @@ EggToObj() :
////////////////////////////////////////////////////////////////////
void EggToObj::
run() {
if (_triangulate_polygons) {
nout << "Triangulating polygons.\n";
int num_produced = _data->triangulate_polygons(~0);
nout << " (" << num_produced << " triangles produced.)\n";
}
_data->flatten_transforms();
collect_vertices(_data);

View File

@ -63,6 +63,8 @@ private:
const UniqueVertices &unique);
private:
bool _triangulate_polygons;
UniqueVertices _unique_vert3, _unique_vert4, _unique_uv2, _unique_uv3, _unique_norm;
VertexMap _vmap;
EggGroupNode *_current_group;