From f2645029b8598dbcfc3ecd0522731044fe0bf686 Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Mon, 9 Jun 2008 01:03:21 -0800 Subject: [PATCH] Add a second light, and some little fixes, and remove dead code. [git-p4: depot-paths = "//depot/solvespace/": change = 1782] --- draw.cpp | 22 ++++++++++++++++++---- drawentity.cpp | 1 + group.cpp | 1 + sketch.h | 2 ++ textwin.cpp | 19 ------------------- ui.h | 5 ----- wishlist.txt | 2 ++ 7 files changed, 24 insertions(+), 28 deletions(-) diff --git a/draw.cpp b/draw.cpp index 16e809b..b036689 100644 --- a/draw.cpp +++ b/draw.cpp @@ -810,12 +810,26 @@ void GraphicsWindow::Paint(int w, int h) { glClearDepth(1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - Vector light = VectorFromProjs(-0.49*w/scale, 0.49*h/scale, 0); - GLfloat lightPos[4] = - { (GLfloat)light.x, (GLfloat)light.y, (GLfloat)light.z, 0 }; - glLightfv(GL_LIGHT0, GL_POSITION, lightPos); + // Let's use two lights glEnable(GL_LIGHT0); + GLfloat li0[] = { 0.8f, 0.8f, 0.8f, 1.0f }; + glLightfv(GL_LIGHT0, GL_DIFFUSE, li0); + glLightfv(GL_LIGHT0, GL_SPECULAR, li0); + glEnable(GL_LIGHT1); + GLfloat li1[] = { 0.4f, 0.4f, 0.4f, 1.0f }; + glLightfv(GL_LIGHT1, GL_DIFFUSE, li1); + glLightfv(GL_LIGHT1, GL_SPECULAR, li1); + Vector lp; + lp = VectorFromProjs(-0.49*w/scale, 0.49*h/scale, 0); + GLfloat lp0[4] = { (GLfloat)lp.x, (GLfloat)lp.y, (GLfloat)lp.z, 0 }; + glLightfv(GL_LIGHT0, GL_POSITION, lp0); + lp = VectorFromProjs(0.49*w/scale, 0.10*h/scale, 0); + GLfloat lp1[4] = { (GLfloat)lp.x, (GLfloat)lp.y, (GLfloat)lp.z, 0 }; + glLightfv(GL_LIGHT1, GL_POSITION, lp1); + + // For debugging, draw the backs of the triangles in red, so that we + // notice when a shell is open glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, 1); GLfloat ambient[4] = { 0.4f, 0.4f, 0.4f, 1.0f }; glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient); diff --git a/drawentity.cpp b/drawentity.cpp index de3c0f3..44589ba 100644 --- a/drawentity.cpp +++ b/drawentity.cpp @@ -42,6 +42,7 @@ void Entity::DrawAll(void) { Entity *e = &(SS.entity.elem[i]); if(!e->IsPoint()) continue; if(!(SS.GetGroup(e->group)->visible)) continue; + if(SS.GroupsInOrder(SS.GW.activeGroup, e->group)) continue; Vector v = e->PointGetNum(); glxVertex3v(v.Plus (r).Plus (d)); diff --git a/group.cpp b/group.cpp index 6d4cbfa..b70fe34 100644 --- a/group.cpp +++ b/group.cpp @@ -97,6 +97,7 @@ void Group::MenuGroup(int id) { g.opA = SS.GW.activeGroup; g.color = RGB(100, 100, 100); g.name.strcpy("lathe"); + SS.GW.ClearSelection(); break; case GraphicsWindow::MNU_GROUP_ROT: { diff --git a/sketch.h b/sketch.h index 3969fa8..1b899d7 100644 --- a/sketch.h +++ b/sketch.h @@ -439,6 +439,8 @@ public: hEntity entityB; bool otherAngle; + bool reference; // a ref dimension, that generates no eqs + // These define how the constraint is drawn on-screen. struct { Vector offset; diff --git a/textwin.cpp b/textwin.cpp index 76c964e..ea6f65a 100644 --- a/textwin.cpp +++ b/textwin.cpp @@ -757,25 +757,6 @@ void TextWindow::ShowGroupSolveInfo(void) { } } -void TextWindow::ShowRequestInfo(void) { - Request *r = SS.GetRequest(shown->request); - - char *s; - switch(r->type) { - case Request::WORKPLANE: s = "workplane"; break; - case Request::DATUM_POINT: s = "datum point"; break; - case Request::LINE_SEGMENT: s = "line segment"; break; - default: oops(); - } - Printf(false, "[[request for %s]]", s); -} - -void TextWindow::ShowConstraintInfo(void) { - Constraint *c = SS.GetConstraint(shown->constraint); - - Printf(false, "[[constraint]]"); -} - void TextWindow::EditControlDone(char *s) { switch(edit.meaning) { case EDIT_TIMES_REPEATED: { diff --git a/ui.h b/ui.h index 092af01..7d0e8dc 100644 --- a/ui.h +++ b/ui.h @@ -48,8 +48,6 @@ public: typedef struct { int screen; hGroup group; - hRequest request; - hConstraint constraint; } ShownState; static const int HISTORY_LEN = 16; ShownState showns[HISTORY_LEN]; @@ -74,9 +72,6 @@ public: // the sketch. void ShowListOfGroups(void); void ShowGroupInfo(void); - void ShowRequestInfo(void); - void ShowEntityInfo(void); - void ShowConstraintInfo(void); void ShowGroupSolveInfo(void); // Special screen, based on selection void DescribeSelection(void); diff --git a/wishlist.txt b/wishlist.txt index fe26e4b..13b8a0e 100644 --- a/wishlist.txt +++ b/wishlist.txt @@ -7,6 +7,8 @@ DXF export compress file format (binary?) partitioned subsystems in the solver arbitrary color specification +specify tolerance for meshing +specify light positions (all on one configuration screen) TTF font text display with proper formatting/units more measurements