diff options
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r-- | src/mainwin.cc | 389 |
1 files changed, 221 insertions, 168 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc index e217b1f..c500938 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -41,10 +41,13 @@ #include "progress.h" #ifdef ENABLE_OPENCSG #include "render-opencsg.h" +#include "CSGTermRenderer.h" #endif #ifdef USE_PROGRESSWIDGET #include "ProgressWidget.h" #endif +#include "CGALRenderer.h" +#include "PolySetCGALRenderer.h" #include <QMenu> #include <QTime> @@ -73,6 +76,11 @@ #include "qlanguagefactory.h" #endif +#include <algorithm> +#include <boost/lambda/lambda.hpp> +#include <boost/lambda/bind.hpp> +using namespace boost::lambda; + #ifdef ENABLE_CGAL #if 1 @@ -103,13 +111,15 @@ using CGAL::OGL::Nef3_Converter; #endif #endif // ENABLE_CGAL +// Global application state +unsigned int GuiLocker::gui_locked = 0; + #define QUOTE(x__) # x__ #define QUOTED(x__) QUOTE(x__) static char helptitle[] = - "OpenSCAD " - QUOTED(OPENSCAD_VERSION) - " (www.openscad.org)\n"; + "OpenSCAD " QUOTED(OPENSCAD_VERSION) " (www.openscad.org)\n" + "Visitor refactored version"; static char copyrighttext[] = "Copyright (C) 2009-2011 Marius Kintel <marius@kintel.net> and Clifford Wolf <clifford@clifford.at>\n" "\n" @@ -129,11 +139,13 @@ MainWindow::MainWindow(const QString &filename) root_ctx.set_variable("$fa", Value(12.0)); root_ctx.set_variable("$t", Value(0.0)); + root_ctx.set_constant("PI",Value(M_PI)); + Value zero3; zero3.type = Value::VECTOR; - zero3.vec.append(new Value(0.0)); - zero3.vec.append(new Value(0.0)); - zero3.vec.append(new Value(0.0)); + zero3.append(new Value(0.0)); + zero3.append(new Value(0.0)); + zero3.append(new Value(0.0)); root_ctx.set_variable("$vpt", zero3); root_ctx.set_variable("$vpr", zero3); @@ -171,8 +183,8 @@ MainWindow::MainWindow(const QString &filename) editor->setLineWrapping(true); // Not designable setFont("", 0); // Init default font - screen->statusLabel = new QLabel(this); - statusBar()->addWidget(screen->statusLabel); + this->glview->statusLabel = new QLabel(this); + statusBar()->addWidget(this->glview->statusLabel); animate_timer = new QTimer(this); connect(animate_timer, SIGNAL(timeout()), this, SLOT(updateTVal())); @@ -266,7 +278,7 @@ MainWindow::MainWindow(const QString &filename) this->viewActionOpenCSG->setVisible(false); #else connect(this->viewActionOpenCSG, SIGNAL(triggered()), this, SLOT(viewModeOpenCSG())); - if (!screen->hasOpenCSGSupport()) { + if (!this->glview->hasOpenCSGSupport()) { this->viewActionOpenCSG->setEnabled(false); } #endif @@ -327,9 +339,9 @@ MainWindow::MainWindow(const QString &filename) connect(editor->document(), SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool))); connect(editor->document(), SIGNAL(modificationChanged(bool)), fileActionSave, SLOT(setEnabled(bool))); #endif - connect(screen, SIGNAL(doAnimateUpdate()), this, SLOT(animateUpdate())); + connect(this->glview, SIGNAL(doAnimateUpdate()), this, SLOT(animateUpdate())); - connect(Preferences::inst(), SIGNAL(requestRedraw()), this->screen, SLOT(updateGL())); + connect(Preferences::inst(), SIGNAL(requestRedraw()), this->glview, SLOT(updateGL())); connect(Preferences::inst(), SIGNAL(fontChanged(const QString&,uint)), this, SLOT(setFont(const QString&,uint))); Preferences::inst()->apply(); @@ -530,7 +542,7 @@ AbstractNode *MainWindow::find_root_tag(AbstractNode *n) } /*! - Parse and evaluate the design -> this->root_node + Parse and evaluate the design => this->root_node */ void MainWindow::compile(bool procevents) { @@ -540,81 +552,84 @@ void MainWindow::compile(bool procevents) // Remove previous CSG tree - if (root_module) { - delete root_module; - root_module = NULL; + if (this->root_module) { + delete this->root_module; + this->root_module = NULL; } - if (absolute_root_node) { - delete absolute_root_node; - absolute_root_node = NULL; + if (this->absolute_root_node) { + delete this->absolute_root_node; + this->absolute_root_node = NULL; } - if (root_raw_term) { - root_raw_term->unlink(); - root_raw_term = NULL; + if (this->root_raw_term) { + this->root_raw_term->unlink(); + this->root_raw_term = NULL; } - if (root_norm_term) { - root_norm_term->unlink(); - root_norm_term = NULL; + if (this->root_norm_term) { + this->root_norm_term->unlink(); + this->root_norm_term = NULL; } - if (root_chain) { - delete root_chain; - root_chain = NULL; + if (this->root_chain) { + delete this->root_chain; + this->root_chain = NULL; } - foreach(CSGTerm *v, highlight_terms) { - v->unlink(); - } - highlight_terms.clear(); - if (highlights_chain) { - delete highlights_chain; - highlights_chain = NULL; - } - foreach(CSGTerm *v, background_terms) { - v->unlink(); - } - background_terms.clear(); - if (background_chain) { - delete background_chain; - background_chain = NULL; - } - root_node = NULL; - enableOpenCSG = false; + std::for_each(this->highlight_terms.begin(), this->highlight_terms.end(), + bind(&CSGTerm::unlink, _1)); + + this->highlight_terms.clear(); + delete this->highlights_chain; + this->highlights_chain = NULL; + + std::for_each(this->background_terms.begin(), this->background_terms.end(), + bind(&CSGTerm::unlink, _1)); + this->background_terms.clear(); + delete this->background_chain; + this->background_chain = NULL; + + this->root_node = NULL; + this->tree.setRoot(NULL); + this->enableOpenCSG = false; // Initialize special variables - root_ctx.set_variable("$t", Value(e_tval->text().toDouble())); + this->root_ctx.set_variable("$t", Value(e_tval->text().toDouble())); Value vpt; vpt.type = Value::VECTOR; - vpt.vec.append(new Value(-screen->object_trans_x)); - vpt.vec.append(new Value(-screen->object_trans_y)); - vpt.vec.append(new Value(-screen->object_trans_z)); - root_ctx.set_variable("$vpt", vpt); + vpt.append(new Value(-this->glview->object_trans_x)); + vpt.append(new Value(-this->glview->object_trans_y)); + vpt.append(new Value(-this->glview->object_trans_z)); + this->root_ctx.set_variable("$vpt", vpt); Value vpr; vpr.type = Value::VECTOR; - vpr.vec.append(new Value(fmodf(360 - screen->object_rot_x + 90, 360))); - vpr.vec.append(new Value(fmodf(360 - screen->object_rot_y, 360))); - vpr.vec.append(new Value(fmodf(360 - screen->object_rot_z, 360))); + vpr.append(new Value(fmodf(360 - this->glview->object_rot_x + 90, 360))); + vpr.append(new Value(fmodf(360 - this->glview->object_rot_y, 360))); + vpr.append(new Value(fmodf(360 - this->glview->object_rot_z, 360))); root_ctx.set_variable("$vpr", vpr); // Parse - last_compiled_doc = editor->toPlainText(); - root_module = parse((last_compiled_doc + "\n" + commandline_commands).toAscii().data(), this->fileName.isEmpty() ? "" : QFileInfo(this->fileName).absolutePath().toLocal8Bit(), false); + this->last_compiled_doc = editor->toPlainText(); + this->root_module = parse((this->last_compiled_doc + "\n" + + commandline_commands).toAscii().data(), + this->fileName.isEmpty() ? + "" : + QFileInfo(this->fileName).absolutePath().toLocal8Bit(), + false); // Error highlighting - if (highlighter) { - delete highlighter; - highlighter = NULL; + if (this->highlighter) { + delete this->highlighter; + this->highlighter = NULL; } if (parser_error_pos >= 0) { - highlighter = new Highlighter(editor->document()); + this->highlighter = new Highlighter(editor->document()); } - if (!root_module) { + if (!this->root_module) { if (!animate_panel->isVisible()) { #ifdef _QCODE_EDIT_ QDocumentCursor cursor = editor->cursor(); @@ -634,19 +649,23 @@ void MainWindow::compile(bool procevents) QApplication::processEvents(); AbstractNode::resetIndexCounter(); - root_inst = ModuleInstantiation(); - absolute_root_node = root_module->evaluate(&root_ctx, &root_inst); + this->root_inst = ModuleInstantiation(); + this->absolute_root_node = this->root_module->evaluate(&this->root_ctx, &this->root_inst); - if (!absolute_root_node) + if (!this->absolute_root_node) goto fail; // Do we have an explicit root node (! modifier)? - if (!(this->root_node = find_root_tag(absolute_root_node))) { - this->root_node = absolute_root_node; + if (!(this->root_node = find_root_tag(this->absolute_root_node))) { + this->root_node = this->absolute_root_node; } - root_node->dump(""); + // FIXME: Consider giving away ownership of root_node to the Tree, or use reference counted pointers + this->tree.setRoot(this->root_node); + // Dump the tree (to initialize caches). + // FIXME: We shouldn't really need to do this explicitly.. + this->tree.getString(*this->root_node); - if (1) { + if (1) { PRINT("Compilation finished."); if (procevents) QApplication::processEvents(); @@ -656,7 +675,7 @@ fail: PRINT("ERROR: Compilation failed! (no top level object found)"); } else { int line = 1; - QByteArray pb = last_compiled_doc.toAscii(); + QByteArray pb = this->last_compiled_doc.toAscii(); char *p = pb.data(); for (int i = 0; i < parser_error_pos; i++) { if (p[i] == '\n') @@ -684,13 +703,6 @@ void MainWindow::compileCSG(bool procevents) if (procevents) QApplication::processEvents(); - double m[20]; - - for (int i = 0; i < 16; i++) - m[i] = i % 5 == 0 ? 1.0 : 0.0; - for (int i = 16; i < 20; i++) - m[i] = -1; - // Main CSG evaluation QTime t; t.start(); @@ -711,7 +723,12 @@ void MainWindow::compileCSG(bool procevents) progress_report_prep(root_node, report_func, pd); try { - root_raw_term = root_node->render_csg_term(m, &highlight_terms, &background_terms); + // FIXME: put cache somewhere else as it's pretty useless now + QHash<std::string, CGAL_Nef_polyhedron> cache; + CGALRenderer cgalrenderer(cache, this->tree); + PolySetCGALRenderer psrenderer(cgalrenderer); + CSGTermRenderer csgrenderer(this->tree, &psrenderer); + root_raw_term = csgrenderer.renderCSGTerm(*root_node, &highlight_terms, &background_terms); if (!root_raw_term) { PRINT("ERROR: CSG generation failed! (no top level object found)"); if (procevents) @@ -749,7 +766,7 @@ void MainWindow::compileCSG(bool procevents) root_chain->import(root_norm_term); if (root_chain->polysets.size() > 1000) { - PRINTF("WARNING: Normalized tree has %d elements!", root_chain->polysets.size()); + PRINTF("WARNING: Normalized tree has %u elements!", root_chain->polysets.size()); PRINTF("WARNING: OpenCSG rendering has been disabled."); } else { enableOpenCSG = true; @@ -757,12 +774,12 @@ void MainWindow::compileCSG(bool procevents) if (highlight_terms.size() > 0) { - PRINTF("Compiling highlights (%d CSG Trees)...", highlight_terms.size()); + PRINTF("Compiling highlights (%zu CSG Trees)...", highlight_terms.size()); if (procevents) QApplication::processEvents(); highlights_chain = new CSGChain(); - for (int i = 0; i < highlight_terms.size(); i++) { + for (unsigned int i = 0; i < highlight_terms.size(); i++) { while (1) { CSGTerm *n = highlight_terms[i]->normalize(); highlight_terms[i]->unlink(); @@ -776,12 +793,12 @@ void MainWindow::compileCSG(bool procevents) if (background_terms.size() > 0) { - PRINTF("Compiling background (%d CSG Trees)...", background_terms.size()); + PRINTF("Compiling background (%zu CSG Trees)...", background_terms.size()); if (procevents) QApplication::processEvents(); background_chain = new CSGChain(); - for (int i = 0; i < background_terms.size(); i++) { + for (unsigned int i = 0; i < background_terms.size(); i++) { while (1) { CSGTerm *n = background_terms[i]->normalize(); background_terms[i]->unlink(); @@ -966,7 +983,7 @@ void MainWindow::pasteViewportTranslation() QTextCursor cursor = editor->textCursor(); #endif QString txt; - txt.sprintf("[ %.2f, %.2f, %.2f ]", -screen->object_trans_x, -screen->object_trans_y, -screen->object_trans_z); + txt.sprintf("[ %.2f, %.2f, %.2f ]", -this->glview->object_trans_x, -this->glview->object_trans_y, -this->glview->object_trans_z); cursor.insertText(txt); } @@ -979,7 +996,7 @@ void MainWindow::pasteViewportRotation() #endif QString txt; txt.sprintf("[ %.2f, %.2f, %.2f ]", - fmodf(360 - screen->object_rot_x + 90, 360), fmodf(360 - screen->object_rot_y, 360), fmodf(360 - screen->object_rot_z, 360)); + fmodf(360 - this->glview->object_rot_x + 90, 360), fmodf(360 - this->glview->object_rot_y, 360), fmodf(360 - this->glview->object_rot_z, 360)); cursor.insertText(txt); } @@ -1021,6 +1038,9 @@ bool MainWindow::checkModified() void MainWindow::actionReloadCompile() { + if (GuiLocker::isLocked()) return; + GuiLocker lock; + if (!checkModified()) return; console->clear(); @@ -1039,13 +1059,16 @@ void MainWindow::actionReloadCompile() else #endif { - screen->updateGL(); + this->glview->updateGL(); } clearCurrentOutput(); } void MainWindow::actionCompile() { + if (GuiLocker::isLocked()) return; + GuiLocker lock; + setCurrentOutput(); console->clear(); @@ -1061,11 +1084,11 @@ void MainWindow::actionCompile() #endif } else { - screen->updateGL(); + this->glview->updateGL(); } if (viewActionAnimate->isChecked() && e_dump->isChecked()) { - QImage img = screen->grabFrameBuffer(); + QImage img = this->glview->grabFrameBuffer(); QString filename; double s = e_fsteps->text().toDouble(); double t = e_tval->text().toDouble(); @@ -1080,13 +1103,17 @@ void MainWindow::actionCompile() void MainWindow::actionRenderCGAL() { + if (GuiLocker::isLocked()) return; + GuiLocker lock; + setCurrentOutput(); console->clear(); compile(true); - if (!root_module || !root_node) + if (!this->root_module || !this->root_node) { return; + } if (this->root_N) { delete this->root_N; @@ -1116,9 +1143,12 @@ void MainWindow::actionRenderCGAL() QApplication::processEvents(); - progress_report_prep(root_node, report_func, pd); + progress_report_prep(this->root_node, report_func, pd); try { - this->root_N = new CGAL_Nef_polyhedron(root_node->render_cgal_nef_polyhedron()); + // FIXME: put cache somewhere else as it's pretty useless now + QHash<std::string, CGAL_Nef_polyhedron> cache; + CGALRenderer renderer(cache, this->tree); + this->root_N = new CGAL_Nef_polyhedron(renderer.renderCGALMesh(*this->root_node)); } catch (ProgressCancelException e) { PRINT("Rendering cancelled."); @@ -1127,8 +1157,9 @@ void MainWindow::actionRenderCGAL() if (this->root_N) { - PRINTF("Number of vertices currently in CGAL cache: %d", AbstractNode::cgal_nef_cache.totalCost()); - PRINTF("Number of objects currently in CGAL cache: %d", AbstractNode::cgal_nef_cache.size()); + // FIXME: Reenable cache cost info +// PRINTF("Number of vertices currently in CGAL cache: %d", AbstractNode::cgal_nef_cache.totalCost()); +// PRINTF("Number of objects currently in CGAL cache: %d", AbstractNode::cgal_nef_cache.size()); QApplication::processEvents(); if (this->root_N->dim == 2) { @@ -1178,7 +1209,7 @@ void MainWindow::actionRenderCGAL() if (!viewActionCGALSurfaces->isChecked() && !viewActionCGALGrid->isChecked()) { viewModeCGALSurface(); } else { - screen->updateGL(); + this->glview->updateGL(); } PRINT("Rendering finished."); @@ -1219,8 +1250,8 @@ void MainWindow::actionDisplayCSGTree() e->setTabStopWidth(30); e->setWindowTitle("CSG Tree Dump"); e->setReadOnly(true); - if (root_node) { - e->setPlainText(root_node->dump("")); + if (this->root_node) { + e->setPlainText(QString::fromStdString(this->tree.getString(*this->root_node))); } else { e->setPlainText("No CSG to dump. Please try compiling first..."); } @@ -1249,6 +1280,8 @@ void MainWindow::actionExportSTLorOFF(bool stl_mode) void MainWindow::actionExportSTLorOFF(bool) #endif { + if (GuiLocker::isLocked()) return; + GuiLocker lock; #ifdef ENABLE_CGAL setCurrentOutput(); @@ -1270,8 +1303,10 @@ void MainWindow::actionExportSTLorOFF(bool) return; } + QString suffix = stl_mode ? ".stl" : ".off"; QString stl_filename = QFileDialog::getSaveFileName(this, - stl_mode ? "Export STL File" : "Export OFF File", "", + stl_mode ? "Export STL File" : "Export OFF File", + this->fileName.isEmpty() ? "Untitled"+suffix : QFileInfo(this->fileName).baseName()+suffix, stl_mode ? "STL Files (*.stl)" : "OFF Files (*.off)"); if (stl_filename.isEmpty()) { PRINTF("No filename specified. %s export aborted.", stl_mode ? "STL" : "OFF"); @@ -1287,13 +1322,18 @@ void MainWindow::actionExportSTLorOFF(bool) pd->show(); QApplication::processEvents(); - if (stl_mode) - export_stl(this->root_N, stl_filename, pd); - else - export_off(this->root_N, stl_filename, pd); - - PRINTF("%s export finished.", stl_mode ? "STL" : "OFF"); + QFile file(stl_filename); + if (!file.open(QIODevice::ReadWrite)) { + PRINTA("Can't open file \"%1\" for export", stl_filename); + } + else { + QTextStream fstream(&file); + if (stl_mode) export_stl(this->root_N, fstream, pd); + else export_off(this->root_N, fstream, pd); + file.close(); + PRINTF("%s export finished.", stl_mode ? "STL" : "OFF"); + } delete pd; clearCurrentOutput(); @@ -1327,16 +1367,26 @@ void MainWindow::actionExportDXF() return; } - QString stl_filename = QFileDialog::getSaveFileName(this, - "Export DXF File", "", "DXF Files (*.dxf)"); - if (stl_filename.isEmpty()) { + QString dxf_filename = QFileDialog::getSaveFileName(this, + "Export DXF File", + this->fileName.isEmpty() ? "Untitled.dxf" : QFileInfo(this->fileName).baseName()+".dxf", + "DXF Files (*.dxf)"); + if (dxf_filename.isEmpty()) { PRINTF("No filename specified. DXF export aborted."); clearCurrentOutput(); return; } - export_dxf(this->root_N, stl_filename, NULL); - PRINTF("DXF export finished."); + QFile file(dxf_filename); + if (!file.open(QIODevice::ReadWrite)) { + PRINTA("Can't open file \"%1\" for export", dxf_filename); + } + else { + QTextStream fstream(&file); + export_dxf(this->root_N, fstream, NULL); + file.close(); + PRINTF("DXF export finished."); + } clearCurrentOutput(); #endif /* ENABLE_CGAL */ @@ -1344,9 +1394,12 @@ void MainWindow::actionExportDXF() void MainWindow::actionFlushCaches() { - PolySet::ps_cache.clear(); +// FIXME: Polycache -> PolySetRenderer +// FIXME: PolySetRenderer->clearCache(); #ifdef ENABLE_CGAL - AbstractNode::cgal_nef_cache.clear(); +// FIXME: Flush caches through whatever channels we have + // CGALRenderer::renderer()->getCache().clear(); + // this->dumper->clearCache(); #endif dxf_dim_cache.clear(); dxf_cross_cache.clear(); @@ -1368,8 +1421,8 @@ static void renderGLThrownTogether(void *vp); static void renderGLviaOpenCSG(void *vp) { - MainWindow *m = (MainWindow*)vp; - if (!m->enableOpenCSG) { + MainWindow *mainwin = (MainWindow *)vp; + if (!mainwin->enableOpenCSG) { renderGLThrownTogether(vp); return; } @@ -1379,18 +1432,18 @@ static void renderGLviaOpenCSG(void *vp) glewInit(); } #ifdef ENABLE_MDI - OpenCSG::setContext(m->screen->opencsg_id); + OpenCSG::setContext(mainwin->glview->opencsg_id); #endif - if (m->root_chain) { - GLint *shaderinfo = m->screen->shaderinfo; + if (mainwin->root_chain) { + GLint *shaderinfo = mainwin->glview->shaderinfo; if (!shaderinfo[0]) shaderinfo = NULL; - renderCSGChainviaOpenCSG(m->root_chain, m->viewActionShowEdges->isChecked() ? shaderinfo : NULL, false, false); - if (m->background_chain) { - renderCSGChainviaOpenCSG(m->background_chain, m->viewActionShowEdges->isChecked() ? shaderinfo : NULL, false, true); + renderCSGChainviaOpenCSG(mainwin->root_chain, mainwin->viewActionShowEdges->isChecked() ? shaderinfo : NULL, false, false); + if (mainwin->background_chain) { + renderCSGChainviaOpenCSG(mainwin->background_chain, mainwin->viewActionShowEdges->isChecked() ? shaderinfo : NULL, false, true); } - if (m->highlights_chain) { - renderCSGChainviaOpenCSG(m->highlights_chain, m->viewActionShowEdges->isChecked() ? shaderinfo : NULL, true, false); + if (mainwin->highlights_chain) { + renderCSGChainviaOpenCSG(mainwin->highlights_chain, mainwin->viewActionShowEdges->isChecked() ? shaderinfo : NULL, true, false); } } } @@ -1401,11 +1454,11 @@ static void renderGLviaOpenCSG(void *vp) */ void MainWindow::viewModeOpenCSG() { - if (screen->hasOpenCSGSupport()) { + if (this->glview->hasOpenCSGSupport()) { viewModeActionsUncheck(); viewActionOpenCSG->setChecked(true); - screen->setRenderFunc(renderGLviaOpenCSG, this); - screen->updateGL(); + this->glview->setRenderFunc(renderGLviaOpenCSG, this); + this->glview->updateGL(); } else { viewModeThrownTogether(); } @@ -1533,16 +1586,16 @@ void MainWindow::viewModeCGALSurface() { viewModeActionsUncheck(); viewActionCGALSurfaces->setChecked(true); - screen->setRenderFunc(renderGLviaCGAL, this); - screen->updateGL(); + this->glview->setRenderFunc(renderGLviaCGAL, this); + this->glview->updateGL(); } void MainWindow::viewModeCGALGrid() { viewModeActionsUncheck(); viewActionCGALGrid->setChecked(true); - screen->setRenderFunc(renderGLviaCGAL, this); - screen->updateGL(); + this->glview->setRenderFunc(renderGLviaCGAL, this); + this->glview->updateGL(); } #endif /* ENABLE_CGAL */ @@ -1631,25 +1684,25 @@ void MainWindow::viewModeThrownTogether() { viewModeActionsUncheck(); viewActionThrownTogether->setChecked(true); - screen->setRenderFunc(renderGLThrownTogether, this); - screen->updateGL(); + this->glview->setRenderFunc(renderGLThrownTogether, this); + this->glview->updateGL(); } void MainWindow::viewModeShowEdges() { - screen->updateGL(); + this->glview->updateGL(); } void MainWindow::viewModeShowAxes() { - screen->setShowAxes(viewActionShowAxes->isChecked()); - screen->updateGL(); + this->glview->setShowAxes(viewActionShowAxes->isChecked()); + this->glview->updateGL(); } void MainWindow::viewModeShowCrosshairs() { - screen->setShowCrosshairs(viewActionShowCrosshairs->isChecked()); - screen->updateGL(); + this->glview->setShowCrosshairs(viewActionShowCrosshairs->isChecked()); + this->glview->updateGL(); } void MainWindow::viewModeAnimate() @@ -1687,82 +1740,82 @@ void MainWindow::animateUpdate() void MainWindow::viewAngleTop() { - screen->object_rot_x = 90; - screen->object_rot_y = 0; - screen->object_rot_z = 0; - screen->updateGL(); + this->glview->object_rot_x = 90; + this->glview->object_rot_y = 0; + this->glview->object_rot_z = 0; + this->glview->updateGL(); } void MainWindow::viewAngleBottom() { - screen->object_rot_x = 270; - screen->object_rot_y = 0; - screen->object_rot_z = 0; - screen->updateGL(); + this->glview->object_rot_x = 270; + this->glview->object_rot_y = 0; + this->glview->object_rot_z = 0; + this->glview->updateGL(); } void MainWindow::viewAngleLeft() { - screen->object_rot_x = 0; - screen->object_rot_y = 0; - screen->object_rot_z = 90; - screen->updateGL(); + this->glview->object_rot_x = 0; + this->glview->object_rot_y = 0; + this->glview->object_rot_z = 90; + this->glview->updateGL(); } void MainWindow::viewAngleRight() { - screen->object_rot_x = 0; - screen->object_rot_y = 0; - screen->object_rot_z = 270; - screen->updateGL(); + this->glview->object_rot_x = 0; + this->glview->object_rot_y = 0; + this->glview->object_rot_z = 270; + this->glview->updateGL(); } void MainWindow::viewAngleFront() { - screen->object_rot_x = 0; - screen->object_rot_y = 0; - screen->object_rot_z = 0; - screen->updateGL(); + this->glview->object_rot_x = 0; + this->glview->object_rot_y = 0; + this->glview->object_rot_z = 0; + this->glview->updateGL(); } void MainWindow::viewAngleBack() { - screen->object_rot_x = 0; - screen->object_rot_y = 0; - screen->object_rot_z = 180; - screen->updateGL(); + this->glview->object_rot_x = 0; + this->glview->object_rot_y = 0; + this->glview->object_rot_z = 180; + this->glview->updateGL(); } void MainWindow::viewAngleDiagonal() { - screen->object_rot_x = 35; - screen->object_rot_y = 0; - screen->object_rot_z = 25; - screen->updateGL(); + this->glview->object_rot_x = 35; + this->glview->object_rot_y = 0; + this->glview->object_rot_z = 25; + this->glview->updateGL(); } void MainWindow::viewCenter() { - screen->object_trans_x = 0; - screen->object_trans_y = 0; - screen->object_trans_z = 0; - screen->updateGL(); + this->glview->object_trans_x = 0; + this->glview->object_trans_y = 0; + this->glview->object_trans_z = 0; + this->glview->updateGL(); } void MainWindow::viewPerspective() { viewActionPerspective->setChecked(true); viewActionOrthogonal->setChecked(false); - screen->setOrthoMode(false); - screen->updateGL(); + this->glview->setOrthoMode(false); + this->glview->updateGL(); } void MainWindow::viewOrthogonal() { viewActionPerspective->setChecked(false); viewActionOrthogonal->setChecked(true); - screen->setOrthoMode(true); - screen->updateGL(); + this->glview->setOrthoMode(true); + this->glview->updateGL(); } void MainWindow::hideConsole() |