From 00d7bb401c0732a5f1b33cd0059a643933286c5d Mon Sep 17 00:00:00 2001 From: Don Bright Date: Wed, 3 Aug 2011 17:45:40 -0500 Subject: fix broken build on systems that use case sensitive filenames (linux) diff --git a/opencsg.pri b/opencsg.pri index 02be596..d34f11b 100644 --- a/opencsg.pri +++ b/opencsg.pri @@ -3,8 +3,8 @@ opencsg { CONFIG += glew include(glew.pri) - HEADERS += src/opencsgrenderer.h - SOURCES += src/opencsgrenderer.cc + HEADERS += src/OpenCSGRenderer.h + SOURCES += src/OpenCSGRenderer.cc isEmpty(DEPLOYDIR) { # Optionally specify location of OpenCSG using the diff --git a/openscad.pro b/openscad.pro index 61000f1..583a728 100644 --- a/openscad.pro +++ b/openscad.pro @@ -120,7 +120,7 @@ FORMS += src/MainWindow.ui \ HEADERS += src/renderer.h \ src/cgalrenderer.h \ - src/throwntogetherrenderer.h \ + src/ThrownTogetherRenderer.h \ src/CGAL_renderer.h \ src/OGL_helper.h \ src/GLView.h \ @@ -151,7 +151,7 @@ HEADERS += src/renderer.h \ SOURCES += src/openscad.cc \ src/mainwin.cc \ src/cgalrenderer.cc \ - src/throwntogetherrenderer.cc \ + src/ThrownTogetherRenderer.cc \ src/glview.cc \ src/export.cc \ src/value.cc \ diff --git a/src/OpenCSGRenderer.cc b/src/OpenCSGRenderer.cc new file mode 100644 index 0000000..afb3e98 --- /dev/null +++ b/src/OpenCSGRenderer.cc @@ -0,0 +1,138 @@ +/* + * OpenSCAD (www.openscad.org) + * Copyright (C) 2009-2011 Clifford Wolf and + * Marius Kintel + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * As a special exception, you have permission to link this program + * with the CGAL library and distribute executables, as long as you + * follow the requirements of the GNU GPL in regard to all of the + * software in the executable aside from CGAL. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "OpenCSGRenderer.h" +#include "polyset.h" +#include "csgterm.h" + +class OpenCSGPrim : public OpenCSG::Primitive +{ +public: + OpenCSGPrim(OpenCSG::Operation operation, unsigned int convexity) : + OpenCSG::Primitive(operation, convexity) { } + PolySet *p; + double *m; + int csgmode; + virtual void render() { + glPushMatrix(); + glMultMatrixd(m); + p->render_surface(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode), m); + glPopMatrix(); + } +}; + +OpenCSGRenderer::OpenCSGRenderer(CSGChain *root_chain, CSGChain *highlights_chain, + CSGChain *background_chain, GLint *shaderinfo) + : root_chain(root_chain), highlights_chain(highlights_chain), + background_chain(background_chain), shaderinfo(shaderinfo) +{ +} + +void OpenCSGRenderer::draw(bool showfaces, bool showedges) const +{ + static int glew_initialized = 0; + if (!glew_initialized) { + glew_initialized = 1; + glewInit(); + } + if (this->root_chain) { + GLint *shaderinfo = this->shaderinfo; + if (!shaderinfo[0]) shaderinfo = NULL; + renderCSGChain(this->root_chain, showedges ? shaderinfo : NULL, false, false); + if (this->background_chain) { + renderCSGChain(this->background_chain, showedges ? shaderinfo : NULL, false, true); + } + if (this->highlights_chain) { + renderCSGChain(this->highlights_chain, showedges ? shaderinfo : NULL, true, false); + } + } +} + +void OpenCSGRenderer::renderCSGChain(CSGChain *chain, GLint *shaderinfo, + bool highlight, bool background) const +{ + std::vector primitives; + int j = 0; + for (int i = 0;; i++) + { + bool last = i == chain->polysets.size(); + + if (last || chain->types[i] == CSGTerm::TYPE_UNION) + { + if (j+1 != i) { + OpenCSG::render(primitives); + glDepthFunc(GL_EQUAL); + } + if (shaderinfo) + glUseProgram(shaderinfo[0]); + for (; j < i; j++) { + double *m = chain->matrices[j]; + glPushMatrix(); + glMultMatrixd(m); + int csgmode = chain->types[j] == CSGTerm::TYPE_DIFFERENCE ? PolySet::CSGMODE_DIFFERENCE : PolySet::CSGMODE_NORMAL; + if (highlight) { + chain->polysets[j]->render_surface(PolySet::COLORMODE_HIGHLIGHT, PolySet::csgmode_e(csgmode + 20), m, shaderinfo); + } else if (background) { + chain->polysets[j]->render_surface(PolySet::COLORMODE_BACKGROUND, PolySet::csgmode_e(csgmode + 10), m, shaderinfo); + } else if (m[16] >= 0 || m[17] >= 0 || m[18] >= 0 || m[19] >= 0) { + // User-defined color from source + glColor4d(m[16], m[17], m[18], m[19]); + if (shaderinfo) { + glUniform4f(shaderinfo[1], m[16], m[17], m[18], m[19]); + glUniform4f(shaderinfo[2], (m[16]+1)/2, (m[17]+1)/2, (m[18]+1)/2, 1.0); + } + chain->polysets[j]->render_surface(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode), m, shaderinfo); + } else if (chain->types[j] == CSGTerm::TYPE_DIFFERENCE) { + chain->polysets[j]->render_surface(PolySet::COLORMODE_CUTOUT, PolySet::csgmode_e(csgmode), m, shaderinfo); + } else { + chain->polysets[j]->render_surface(PolySet::COLORMODE_MATERIAL, PolySet::csgmode_e(csgmode), m, shaderinfo); + } + glPopMatrix(); + } + if (shaderinfo) + glUseProgram(0); + for (unsigned int k = 0; k < primitives.size(); k++) { + delete primitives[k]; + } + glDepthFunc(GL_LEQUAL); + primitives.clear(); + } + + if (last) + break; + + OpenCSGPrim *prim = new OpenCSGPrim(chain->types[i] == CSGTerm::TYPE_DIFFERENCE ? + OpenCSG::Subtraction : OpenCSG::Intersection, chain->polysets[i]->convexity); + prim->p = chain->polysets[i]; + prim->m = chain->matrices[i]; + prim->csgmode = chain->types[i] == CSGTerm::TYPE_DIFFERENCE ? PolySet::CSGMODE_DIFFERENCE : PolySet::CSGMODE_NORMAL; + if (highlight) + prim->csgmode += 20; + else if (background) + prim->csgmode += 10; + primitives.push_back(prim); + } +} diff --git a/src/OpenCSGRenderer.h b/src/OpenCSGRenderer.h new file mode 100644 index 0000000..95ffc8e --- /dev/null +++ b/src/OpenCSGRenderer.h @@ -0,0 +1,24 @@ +#ifndef OPENCSGRENDERER_H_ +#define OPENCSGRENDERER_H_ + +#include "renderer.h" +#include // this must be included before the GL headers +#include + +class OpenCSGRenderer : public Renderer +{ +public: + OpenCSGRenderer(class CSGChain *root_chain, CSGChain *highlights_chain, + CSGChain *background_chain, GLint *shaderinfo); + void draw(bool showfaces, bool showedges) const; +private: + void renderCSGChain(class CSGChain *chain, GLint *shaderinfo, + bool highlight, bool background) const; + + CSGChain *root_chain; + CSGChain *highlights_chain; + CSGChain *background_chain; + GLint *shaderinfo; +}; + +#endif diff --git a/src/ThrownTogetherRenderer.cc b/src/ThrownTogetherRenderer.cc new file mode 100644 index 0000000..0a0c9c8 --- /dev/null +++ b/src/ThrownTogetherRenderer.cc @@ -0,0 +1,120 @@ +/* + * OpenSCAD (www.openscad.org) + * Copyright (C) 2009-2011 Clifford Wolf and + * Marius Kintel + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * As a special exception, you have permission to link this program + * with the CGAL library and distribute executables, as long as you + * follow the requirements of the GNU GPL in regard to all of the + * software in the executable aside from CGAL. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "ThrownTogetherRenderer.h" +#include "polyset.h" +#include "csgterm.h" + +#include // this must be included before the GL headers +#include + +ThrownTogetherRenderer::ThrownTogetherRenderer(CSGChain *root_chain, + CSGChain *highlights_chain, + CSGChain *background_chain) + : root_chain(root_chain), highlights_chain(highlights_chain), + background_chain(background_chain) +{ +} + +void ThrownTogetherRenderer::draw(bool showfaces, bool showedges) const +{ + if (this->root_chain) { + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + renderCSGChain(this->root_chain, false, false, showedges, false); + glCullFace(GL_FRONT); + glColor3ub(255, 0, 255); + renderCSGChain(this->root_chain, false, false, showedges, true); + glDisable(GL_CULL_FACE); + } + if (this->background_chain) + renderCSGChain(this->background_chain, false, true, showedges, false); + if (this->highlights_chain) + renderCSGChain(this->highlights_chain, true, false, showedges, false); +} + +void ThrownTogetherRenderer::renderCSGChain(CSGChain *chain, bool highlight, + bool background, bool showedges, + bool fberror) const +{ + glDepthFunc(GL_LEQUAL); + QHash,int> polySetVisitMark; + for (int i = 0; i < chain->polysets.size(); i++) { + if (polySetVisitMark[QPair(chain->polysets[i], chain->matrices[i])]++ > 0) + continue; + double *m = chain->matrices[i]; + glPushMatrix(); + glMultMatrixd(m); + int csgmode = chain->types[i] == CSGTerm::TYPE_DIFFERENCE ? PolySet::CSGMODE_DIFFERENCE : PolySet::CSGMODE_NORMAL; + if (highlight) { + chain->polysets[i]->render_surface(PolySet::COLORMODE_HIGHLIGHT, PolySet::csgmode_e(csgmode + 20), m); + if (showedges) { + glDisable(GL_LIGHTING); + chain->polysets[i]->render_edges(PolySet::COLORMODE_HIGHLIGHT, PolySet::csgmode_e(csgmode + 20)); + glEnable(GL_LIGHTING); + } + } else if (background) { + chain->polysets[i]->render_surface(PolySet::COLORMODE_BACKGROUND, PolySet::csgmode_e(csgmode + 10), m); + if (showedges) { + glDisable(GL_LIGHTING); + chain->polysets[i]->render_edges(PolySet::COLORMODE_BACKGROUND, PolySet::csgmode_e(csgmode + 10)); + glEnable(GL_LIGHTING); + } + } else if (fberror) { + if (highlight) { + chain->polysets[i]->render_surface(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode + 20), m); + } else if (background) { + chain->polysets[i]->render_surface(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode + 10), m); + } else { + chain->polysets[i]->render_surface(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode), m); + } + } else if (m[16] >= 0 || m[17] >= 0 || m[18] >= 0 || m[19] >= 0) { + glColor4d(m[16], m[17], m[18], m[19]); + chain->polysets[i]->render_surface(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode), m); + if (showedges) { + glDisable(GL_LIGHTING); + glColor4d((m[16]+1)/2, (m[17]+1)/2, (m[18]+1)/2, 1.0); + chain->polysets[i]->render_edges(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode)); + glEnable(GL_LIGHTING); + } + } else if (chain->types[i] == CSGTerm::TYPE_DIFFERENCE) { + chain->polysets[i]->render_surface(PolySet::COLORMODE_CUTOUT, PolySet::csgmode_e(csgmode), m); + if (showedges) { + glDisable(GL_LIGHTING); + chain->polysets[i]->render_edges(PolySet::COLORMODE_CUTOUT, PolySet::csgmode_e(csgmode)); + glEnable(GL_LIGHTING); + } + } else { + chain->polysets[i]->render_surface(PolySet::COLORMODE_MATERIAL, PolySet::csgmode_e(csgmode), m); + if (showedges) { + glDisable(GL_LIGHTING); + chain->polysets[i]->render_edges(PolySet::COLORMODE_MATERIAL, PolySet::csgmode_e(csgmode)); + glEnable(GL_LIGHTING); + } + } + glPopMatrix(); + } +} diff --git a/src/ThrownTogetherRenderer.h b/src/ThrownTogetherRenderer.h new file mode 100644 index 0000000..09d13f3 --- /dev/null +++ b/src/ThrownTogetherRenderer.h @@ -0,0 +1,21 @@ +#ifndef THROWNTOGETHERRENDERER_H_ +#define THROWNTOGETHERRENDERER_H_ + +#include "renderer.h" + +class ThrownTogetherRenderer : public Renderer +{ +public: + ThrownTogetherRenderer(class CSGChain *root_chain, + CSGChain *highlights_chain, CSGChain *background_chain); + void draw(bool showfaces, bool showedges) const; +private: + void renderCSGChain(CSGChain *chain, bool highlight, bool background, bool showedges, + bool fberror) const; + + CSGChain *root_chain; + CSGChain *highlights_chain; + CSGChain *background_chain; +}; + +#endif diff --git a/src/mainwin.cc b/src/mainwin.cc index 3453b1c..c63b2dd 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -40,12 +40,12 @@ #include "dxftess.h" #include "progress.h" #ifdef ENABLE_OPENCSG -#include "opencsgRenderer.h" +#include "OpenCSGRenderer.h" #endif #ifdef USE_PROGRESSWIDGET #include "ProgressWidget.h" #endif -#include "thrownTogetherRenderer.h" +#include "ThrownTogetherRenderer.h" #include #include diff --git a/src/opencsgrenderer.cc b/src/opencsgrenderer.cc deleted file mode 100644 index 768176c..0000000 --- a/src/opencsgrenderer.cc +++ /dev/null @@ -1,138 +0,0 @@ -/* - * OpenSCAD (www.openscad.org) - * Copyright (C) 2009-2011 Clifford Wolf and - * Marius Kintel - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * As a special exception, you have permission to link this program - * with the CGAL library and distribute executables, as long as you - * follow the requirements of the GNU GPL in regard to all of the - * software in the executable aside from CGAL. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "opencsgrenderer.h" -#include "polyset.h" -#include "csgterm.h" - -class OpenCSGPrim : public OpenCSG::Primitive -{ -public: - OpenCSGPrim(OpenCSG::Operation operation, unsigned int convexity) : - OpenCSG::Primitive(operation, convexity) { } - PolySet *p; - double *m; - int csgmode; - virtual void render() { - glPushMatrix(); - glMultMatrixd(m); - p->render_surface(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode), m); - glPopMatrix(); - } -}; - -OpenCSGRenderer::OpenCSGRenderer(CSGChain *root_chain, CSGChain *highlights_chain, - CSGChain *background_chain, GLint *shaderinfo) - : root_chain(root_chain), highlights_chain(highlights_chain), - background_chain(background_chain), shaderinfo(shaderinfo) -{ -} - -void OpenCSGRenderer::draw(bool showfaces, bool showedges) const -{ - static int glew_initialized = 0; - if (!glew_initialized) { - glew_initialized = 1; - glewInit(); - } - if (this->root_chain) { - GLint *shaderinfo = this->shaderinfo; - if (!shaderinfo[0]) shaderinfo = NULL; - renderCSGChain(this->root_chain, showedges ? shaderinfo : NULL, false, false); - if (this->background_chain) { - renderCSGChain(this->background_chain, showedges ? shaderinfo : NULL, false, true); - } - if (this->highlights_chain) { - renderCSGChain(this->highlights_chain, showedges ? shaderinfo : NULL, true, false); - } - } -} - -void OpenCSGRenderer::renderCSGChain(CSGChain *chain, GLint *shaderinfo, - bool highlight, bool background) const -{ - std::vector primitives; - int j = 0; - for (int i = 0;; i++) - { - bool last = i == chain->polysets.size(); - - if (last || chain->types[i] == CSGTerm::TYPE_UNION) - { - if (j+1 != i) { - OpenCSG::render(primitives); - glDepthFunc(GL_EQUAL); - } - if (shaderinfo) - glUseProgram(shaderinfo[0]); - for (; j < i; j++) { - double *m = chain->matrices[j]; - glPushMatrix(); - glMultMatrixd(m); - int csgmode = chain->types[j] == CSGTerm::TYPE_DIFFERENCE ? PolySet::CSGMODE_DIFFERENCE : PolySet::CSGMODE_NORMAL; - if (highlight) { - chain->polysets[j]->render_surface(PolySet::COLORMODE_HIGHLIGHT, PolySet::csgmode_e(csgmode + 20), m, shaderinfo); - } else if (background) { - chain->polysets[j]->render_surface(PolySet::COLORMODE_BACKGROUND, PolySet::csgmode_e(csgmode + 10), m, shaderinfo); - } else if (m[16] >= 0 || m[17] >= 0 || m[18] >= 0 || m[19] >= 0) { - // User-defined color from source - glColor4d(m[16], m[17], m[18], m[19]); - if (shaderinfo) { - glUniform4f(shaderinfo[1], m[16], m[17], m[18], m[19]); - glUniform4f(shaderinfo[2], (m[16]+1)/2, (m[17]+1)/2, (m[18]+1)/2, 1.0); - } - chain->polysets[j]->render_surface(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode), m, shaderinfo); - } else if (chain->types[j] == CSGTerm::TYPE_DIFFERENCE) { - chain->polysets[j]->render_surface(PolySet::COLORMODE_CUTOUT, PolySet::csgmode_e(csgmode), m, shaderinfo); - } else { - chain->polysets[j]->render_surface(PolySet::COLORMODE_MATERIAL, PolySet::csgmode_e(csgmode), m, shaderinfo); - } - glPopMatrix(); - } - if (shaderinfo) - glUseProgram(0); - for (unsigned int k = 0; k < primitives.size(); k++) { - delete primitives[k]; - } - glDepthFunc(GL_LEQUAL); - primitives.clear(); - } - - if (last) - break; - - OpenCSGPrim *prim = new OpenCSGPrim(chain->types[i] == CSGTerm::TYPE_DIFFERENCE ? - OpenCSG::Subtraction : OpenCSG::Intersection, chain->polysets[i]->convexity); - prim->p = chain->polysets[i]; - prim->m = chain->matrices[i]; - prim->csgmode = chain->types[i] == CSGTerm::TYPE_DIFFERENCE ? PolySet::CSGMODE_DIFFERENCE : PolySet::CSGMODE_NORMAL; - if (highlight) - prim->csgmode += 20; - else if (background) - prim->csgmode += 10; - primitives.push_back(prim); - } -} diff --git a/src/opencsgrenderer.h b/src/opencsgrenderer.h deleted file mode 100644 index 95ffc8e..0000000 --- a/src/opencsgrenderer.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef OPENCSGRENDERER_H_ -#define OPENCSGRENDERER_H_ - -#include "renderer.h" -#include // this must be included before the GL headers -#include - -class OpenCSGRenderer : public Renderer -{ -public: - OpenCSGRenderer(class CSGChain *root_chain, CSGChain *highlights_chain, - CSGChain *background_chain, GLint *shaderinfo); - void draw(bool showfaces, bool showedges) const; -private: - void renderCSGChain(class CSGChain *chain, GLint *shaderinfo, - bool highlight, bool background) const; - - CSGChain *root_chain; - CSGChain *highlights_chain; - CSGChain *background_chain; - GLint *shaderinfo; -}; - -#endif diff --git a/src/throwntogetherrenderer.cc b/src/throwntogetherrenderer.cc deleted file mode 100644 index 0a0c9c8..0000000 --- a/src/throwntogetherrenderer.cc +++ /dev/null @@ -1,120 +0,0 @@ -/* - * OpenSCAD (www.openscad.org) - * Copyright (C) 2009-2011 Clifford Wolf and - * Marius Kintel - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * As a special exception, you have permission to link this program - * with the CGAL library and distribute executables, as long as you - * follow the requirements of the GNU GPL in regard to all of the - * software in the executable aside from CGAL. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "ThrownTogetherRenderer.h" -#include "polyset.h" -#include "csgterm.h" - -#include // this must be included before the GL headers -#include - -ThrownTogetherRenderer::ThrownTogetherRenderer(CSGChain *root_chain, - CSGChain *highlights_chain, - CSGChain *background_chain) - : root_chain(root_chain), highlights_chain(highlights_chain), - background_chain(background_chain) -{ -} - -void ThrownTogetherRenderer::draw(bool showfaces, bool showedges) const -{ - if (this->root_chain) { - glEnable(GL_CULL_FACE); - glCullFace(GL_BACK); - renderCSGChain(this->root_chain, false, false, showedges, false); - glCullFace(GL_FRONT); - glColor3ub(255, 0, 255); - renderCSGChain(this->root_chain, false, false, showedges, true); - glDisable(GL_CULL_FACE); - } - if (this->background_chain) - renderCSGChain(this->background_chain, false, true, showedges, false); - if (this->highlights_chain) - renderCSGChain(this->highlights_chain, true, false, showedges, false); -} - -void ThrownTogetherRenderer::renderCSGChain(CSGChain *chain, bool highlight, - bool background, bool showedges, - bool fberror) const -{ - glDepthFunc(GL_LEQUAL); - QHash,int> polySetVisitMark; - for (int i = 0; i < chain->polysets.size(); i++) { - if (polySetVisitMark[QPair(chain->polysets[i], chain->matrices[i])]++ > 0) - continue; - double *m = chain->matrices[i]; - glPushMatrix(); - glMultMatrixd(m); - int csgmode = chain->types[i] == CSGTerm::TYPE_DIFFERENCE ? PolySet::CSGMODE_DIFFERENCE : PolySet::CSGMODE_NORMAL; - if (highlight) { - chain->polysets[i]->render_surface(PolySet::COLORMODE_HIGHLIGHT, PolySet::csgmode_e(csgmode + 20), m); - if (showedges) { - glDisable(GL_LIGHTING); - chain->polysets[i]->render_edges(PolySet::COLORMODE_HIGHLIGHT, PolySet::csgmode_e(csgmode + 20)); - glEnable(GL_LIGHTING); - } - } else if (background) { - chain->polysets[i]->render_surface(PolySet::COLORMODE_BACKGROUND, PolySet::csgmode_e(csgmode + 10), m); - if (showedges) { - glDisable(GL_LIGHTING); - chain->polysets[i]->render_edges(PolySet::COLORMODE_BACKGROUND, PolySet::csgmode_e(csgmode + 10)); - glEnable(GL_LIGHTING); - } - } else if (fberror) { - if (highlight) { - chain->polysets[i]->render_surface(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode + 20), m); - } else if (background) { - chain->polysets[i]->render_surface(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode + 10), m); - } else { - chain->polysets[i]->render_surface(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode), m); - } - } else if (m[16] >= 0 || m[17] >= 0 || m[18] >= 0 || m[19] >= 0) { - glColor4d(m[16], m[17], m[18], m[19]); - chain->polysets[i]->render_surface(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode), m); - if (showedges) { - glDisable(GL_LIGHTING); - glColor4d((m[16]+1)/2, (m[17]+1)/2, (m[18]+1)/2, 1.0); - chain->polysets[i]->render_edges(PolySet::COLORMODE_NONE, PolySet::csgmode_e(csgmode)); - glEnable(GL_LIGHTING); - } - } else if (chain->types[i] == CSGTerm::TYPE_DIFFERENCE) { - chain->polysets[i]->render_surface(PolySet::COLORMODE_CUTOUT, PolySet::csgmode_e(csgmode), m); - if (showedges) { - glDisable(GL_LIGHTING); - chain->polysets[i]->render_edges(PolySet::COLORMODE_CUTOUT, PolySet::csgmode_e(csgmode)); - glEnable(GL_LIGHTING); - } - } else { - chain->polysets[i]->render_surface(PolySet::COLORMODE_MATERIAL, PolySet::csgmode_e(csgmode), m); - if (showedges) { - glDisable(GL_LIGHTING); - chain->polysets[i]->render_edges(PolySet::COLORMODE_MATERIAL, PolySet::csgmode_e(csgmode)); - glEnable(GL_LIGHTING); - } - } - glPopMatrix(); - } -} diff --git a/src/throwntogetherrenderer.h b/src/throwntogetherrenderer.h deleted file mode 100644 index 09d13f3..0000000 --- a/src/throwntogetherrenderer.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef THROWNTOGETHERRENDERER_H_ -#define THROWNTOGETHERRENDERER_H_ - -#include "renderer.h" - -class ThrownTogetherRenderer : public Renderer -{ -public: - ThrownTogetherRenderer(class CSGChain *root_chain, - CSGChain *highlights_chain, CSGChain *background_chain); - void draw(bool showfaces, bool showedges) const; -private: - void renderCSGChain(CSGChain *chain, bool highlight, bool background, bool showedges, - bool fberror) const; - - CSGChain *root_chain; - CSGChain *highlights_chain; - CSGChain *background_chain; -}; - -#endif -- cgit v0.10.1