diff --git a/pandatool/src/eggprogs/lwoToEgg.cxx b/pandatool/src/eggprogs/lwoToEgg.cxx index 4a9d411b8d..24f62ee4ff 100644 --- a/pandatool/src/eggprogs/lwoToEgg.cxx +++ b/pandatool/src/eggprogs/lwoToEgg.cxx @@ -25,7 +25,9 @@ LwoToEgg() : ("This program converts Lightwave Object (.lwo) files to egg. Many " "rendering characteristics of Lightwave (like layered shaders, etc.) " "are not supported, but fundamental things like polygons and texture " - "maps are."); + "maps are. This program is primarily designed to support files written " + "by Lightwave version 6.x (LWO2 files), but it also has some limited " + "support for version 5.x files (LWOB files)."); redescribe_option ("cs", diff --git a/pandatool/src/lwoegg/cLwoPolygons.cxx b/pandatool/src/lwoegg/cLwoPolygons.cxx index 5093ed56da..290c96f066 100644 --- a/pandatool/src/lwoegg/cLwoPolygons.cxx +++ b/pandatool/src/lwoegg/cLwoPolygons.cxx @@ -12,6 +12,7 @@ #include #include #include +#include #include //////////////////////////////////////////////////////////////////// @@ -140,8 +141,6 @@ make_faces() { for (int i = 0; i < num_polygons; i++) { LwoPolygons::Polygon *poly = _polygons->get_polygon(i); - PT(EggPolygon) egg_poly = new EggPolygon; - bool is_valid = true; // Set up the vertices. @@ -154,6 +153,14 @@ make_faces() { // last vertex, so that the first convex angle is the first angle // in the EggPolygon (for determining correct normals). int num_vertices = poly->_vertices.size(); + PT(EggPrimitive) egg_prim; + + if (num_vertices == 1) { + egg_prim = new EggPoint; + } else { + egg_prim = new EggPolygon; + } + for (int vi = num_vertices; vi > 0; vi--) { int vindex = poly->_vertices[vi % num_vertices]; if (vindex < 0 || vindex >= num_points) { @@ -164,17 +171,17 @@ make_faces() { EggVertex egg_vert; egg_vert.set_pos(LCAST(double, points->get_point(vindex))); EggVertex *new_vert = egg_vpool->create_unique_vertex(egg_vert); - egg_poly->add_vertex(new_vert); + egg_prim->add_vertex(new_vert); } } if (is_valid) { CLwoSurface *surface = get_surface(i); if (surface != (CLwoSurface *)NULL) { - surface->apply_properties(egg_poly, smooth_angle); + surface->apply_properties(egg_prim, smooth_angle); } - _egg_group->add_child(egg_poly.p()); + _egg_group->add_child(egg_prim.p()); } }