From a47c2828729f868eeb558119725f40b80cc2a3ab Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 4 Jan 2014 18:18:59 -0500 Subject: [PATCH] Ignore empty Nef's when renderinge --- src/CGALRenderer.cc | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/CGALRenderer.cc b/src/CGALRenderer.cc index 0783de0f..f24389c0 100644 --- a/src/CGALRenderer.cc +++ b/src/CGALRenderer.cc @@ -50,19 +50,21 @@ CGALRenderer::CGALRenderer(shared_ptr geom) : polyhedron(N } else if (shared_ptr new_N = dynamic_pointer_cast(geom)) { assert(new_N->getDimension() == 3); - this->polyhedron = new Polyhedron(); - // FIXME: Make independent of Preferences - // this->polyhedron->setColor(Polyhedron::CGAL_NEF3_MARKED_FACET_COLOR, - // Preferences::inst()->color(Preferences::CGAL_FACE_BACK_COLOR).red(), - // Preferences::inst()->color(Preferences::CGAL_FACE_BACK_COLOR).green(), - // Preferences::inst()->color(Preferences::CGAL_FACE_BACK_COLOR).blue()); - // this->polyhedron->setColor(Polyhedron::CGAL_NEF3_UNMARKED_FACET_COLOR, - // Preferences::inst()->color(Preferences::CGAL_FACE_FRONT_COLOR).red(), - // Preferences::inst()->color(Preferences::CGAL_FACE_FRONT_COLOR).green(), - // Preferences::inst()->color(Preferences::CGAL_FACE_FRONT_COLOR).blue()); - - CGAL::OGL::Nef3_Converter::convert_to_OGLPolyhedron(*new_N->p3, this->polyhedron); - this->polyhedron->init(); + if (!new_N->isEmpty()) { + this->polyhedron = new Polyhedron(); + // FIXME: Make independent of Preferences + // this->polyhedron->setColor(Polyhedron::CGAL_NEF3_MARKED_FACET_COLOR, + // Preferences::inst()->color(Preferences::CGAL_FACE_BACK_COLOR).red(), + // Preferences::inst()->color(Preferences::CGAL_FACE_BACK_COLOR).green(), + // Preferences::inst()->color(Preferences::CGAL_FACE_BACK_COLOR).blue()); + // this->polyhedron->setColor(Polyhedron::CGAL_NEF3_UNMARKED_FACET_COLOR, + // Preferences::inst()->color(Preferences::CGAL_FACE_FRONT_COLOR).red(), + // Preferences::inst()->color(Preferences::CGAL_FACE_FRONT_COLOR).green(), + // Preferences::inst()->color(Preferences::CGAL_FACE_FRONT_COLOR).blue()); + + CGAL::OGL::Nef3_Converter::convert_to_OGLPolyhedron(*new_N->p3, this->polyhedron); + this->polyhedron->init(); + } } }