diff options
author | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-06-29 18:03:06 (GMT) |
---|---|---|
committer | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-06-29 18:03:06 (GMT) |
commit | 934e2cef98bc16d2552641314dae1f17a8841079 (patch) | |
tree | 48eca47c4e443a9d96841b2fa00276ae9943d449 | |
parent | b8ce36f7e7e76c5cd6c51bc44f651ea43f85a8d7 (diff) |
Clifford Wolf:
Improved wireframe vs. light shading selection
git-svn-id: http://svn.clifford.at/openscad/trunk@36 b57f626f-c46c-0410-a088-ec61d464b74c
-rw-r--r-- | mainwin.cc | 25 | ||||
-rw-r--r-- | openscad.h | 6 |
2 files changed, 23 insertions, 8 deletions
@@ -88,8 +88,10 @@ MainWindow::MainWindow(const char *filename) menu->addSeparator(); - actViewModeLights = menu->addAction("Lights", this, SLOT(viewModeLights())); - actViewModeLights->setCheckable(true); + actViewModeWireframe = menu->addAction("Wireframe", this, SLOT(viewModeWireframe())); + actViewModeWireframe->setCheckable(true); + actViewModeShaded = menu->addAction("Shaded", this, SLOT(viewModeShaded())); + actViewModeShaded->setCheckable(true); menu->addSeparator(); menu->addAction("Top"); @@ -137,6 +139,7 @@ MainWindow::MainWindow(const char *filename) #else viewModeThrownTogether(); #endif + viewModeShaded(); setCentralWidget(s1); current_win = NULL; @@ -520,7 +523,7 @@ static void renderGLviaOpenCSG(void *vp) if (m->root_chain) { GLint *shaderinfo = m->screen->shaderinfo; - if (m->screen->useLights) + if (m->screen->useLights || !shaderinfo[0]) shaderinfo = NULL; std::vector<OpenCSG::Primitive*> primitives; int j = 0; @@ -601,6 +604,7 @@ static void renderGLviaCGAL(void *vp) P.set_style(CGAL::OGL::SNC_BOUNDARY); if (m->actViewModeCGALGrid->isChecked()) P.set_style(CGAL::OGL::SNC_SKELETON); + glDisable(GL_LIGHTING); #if 0 P.draw(); #else @@ -676,10 +680,19 @@ void MainWindow::viewModeThrownTogether() screen->updateGL(); } -void MainWindow::viewModeLights() +void MainWindow::viewModeWireframe() { - screen->useLights = !screen->useLights; + screen->useLights = false; + actViewModeWireframe->setChecked(true); + actViewModeShaded->setChecked(false); + screen->updateGL(); +} + +void MainWindow::viewModeShaded() +{ + screen->useLights = true; + actViewModeWireframe->setChecked(false); + actViewModeShaded->setChecked(true); screen->updateGL(); - actViewModeLights->setChecked(screen->useLights); } @@ -507,7 +507,8 @@ public: QAction *actViewModeCGALGrid; #endif QAction *actViewModeThrownTogether; - QAction *actViewModeLights; + QAction *actViewModeWireframe; + QAction *actViewModeShaded; void viewModeActionsUncheck(); private slots: @@ -519,7 +520,8 @@ private slots: void viewModeCGALGrid(); #endif void viewModeThrownTogether(); - void viewModeLights(); + void viewModeWireframe(); + void viewModeShaded(); }; extern AbstractModule *parse(const char *text, int debug); |