summaryrefslogtreecommitdiff
path: root/mainwin.cc
diff options
context:
space:
mode:
authorclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-07-28 12:53:52 (GMT)
committerclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-07-28 12:53:52 (GMT)
commit7b4cc84cdab040d92b4b98a2ce1fcfaea829bb5a (patch)
treead1b64122844847e2727cdc377356db5dbe63198 /mainwin.cc
parentb7cb05dbbd8d9d249c21178bc0adc747c2f5fc17 (diff)
Clifford Wolf:
Added dxf polyset caching git-svn-id: http://svn.clifford.at/openscad/trunk@83 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'mainwin.cc')
-rw-r--r--mainwin.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/mainwin.cc b/mainwin.cc
index 144959e..378491a 100644
--- a/mainwin.cc
+++ b/mainwin.cc
@@ -297,6 +297,7 @@ void MainWindow::compile()
find_root_tag(absolute_root_node);
if (!root_node)
root_node = absolute_root_node;
+ root_node->dump("");
PRINT("Compiling design (CSG Products generation)...");
QApplication::processEvents();
@@ -814,8 +815,12 @@ public:
OpenCSGPrim(OpenCSG::Operation operation, unsigned int convexity) :
OpenCSG::Primitive(operation, convexity) { }
PolySet *p;
+ double *m;
virtual void render() {
+ glPushMatrix();
+ glMultMatrixd(m);
p->render_surface(PolySet::COLOR_NONE);
+ glPopMatrix();
}
};
@@ -834,6 +839,8 @@ static void renderCSGChainviaOpenCSG(CSGChain *chain, GLint *shaderinfo, bool hi
if (shaderinfo)
glUseProgram(shaderinfo[0]);
for (; j < i; j++) {
+ glPushMatrix();
+ glMultMatrixd(chain->matrices[j]);
if (highlight) {
chain->polysets[j]->render_surface(PolySet::COLOR_HIGHLIGHT, shaderinfo);
} else if (background) {
@@ -843,6 +850,7 @@ static void renderCSGChainviaOpenCSG(CSGChain *chain, GLint *shaderinfo, bool hi
} else {
chain->polysets[j]->render_surface(PolySet::COLOR_MATERIAL, shaderinfo);
}
+ glPopMatrix();
}
if (shaderinfo)
glUseProgram(0);
@@ -859,6 +867,7 @@ static void renderCSGChainviaOpenCSG(CSGChain *chain, GLint *shaderinfo, bool hi
OpenCSGPrim *prim = new OpenCSGPrim(chain->types[i] == CSGTerm::DIFFERENCE ?
OpenCSG::Subtraction : OpenCSG::Intersection, chain->polysets[i]->convexity);
prim->p = chain->polysets[i];
+ prim->m = chain->matrices[i];
primitives.push_back(prim);
}
}
@@ -972,11 +981,13 @@ void MainWindow::viewModeCGALGrid()
static void renderGLThrownTogetherChain(MainWindow *m, CSGChain *chain, bool highlight, bool background)
{
glDepthFunc(GL_LEQUAL);
- QHash<PolySet*,int> polySetVisitMark;
+ QHash<QPair<PolySet*,double*>,int> polySetVisitMark;
bool showEdges = m->actViewModeShowEdges->isChecked();
for (int i = 0; i < chain->polysets.size(); i++) {
- if (polySetVisitMark[chain->polysets[i]]++ > 0)
+ if (polySetVisitMark[QPair<PolySet*,double*>(chain->polysets[i], chain->matrices[i])]++ > 0)
continue;
+ glPushMatrix();
+ glMultMatrixd(chain->matrices[i]);
if (highlight) {
chain->polysets[i]->render_surface(PolySet::COLOR_HIGHLIGHT);
if (showEdges) {
@@ -1006,6 +1017,7 @@ static void renderGLThrownTogetherChain(MainWindow *m, CSGChain *chain, bool hig
glEnable(GL_LIGHTING);
}
}
+ glPopMatrix();
}
}
contact: Jan Huwald // Impressum