From 934e2cef98bc16d2552641314dae1f17a8841079 Mon Sep 17 00:00:00 2001 From: clifford Date: Mon, 29 Jun 2009 18:03:06 +0000 Subject: Clifford Wolf: Improved wireframe vs. light shading selection git-svn-id: http://svn.clifford.at/openscad/trunk@36 b57f626f-c46c-0410-a088-ec61d464b74c diff --git a/mainwin.cc b/mainwin.cc index 8291f6a..be51724 100644 --- a/mainwin.cc +++ b/mainwin.cc @@ -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 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); } diff --git a/openscad.h b/openscad.h index 0f8da36..c139d6e 100644 --- a/openscad.h +++ b/openscad.h @@ -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); -- cgit v0.10.1