Add a second light, and some little fixes, and remove dead code.

[git-p4: depot-paths = "//depot/solvespace/": change = 1782]
This commit is contained in:
Jonathan Westhues 2008-06-09 01:03:21 -08:00
parent 34d2d531e6
commit f2645029b8
7 changed files with 24 additions and 28 deletions

View File

@ -810,12 +810,26 @@ void GraphicsWindow::Paint(int w, int h) {
glClearDepth(1.0); glClearDepth(1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Vector light = VectorFromProjs(-0.49*w/scale, 0.49*h/scale, 0); // Let's use two lights
GLfloat lightPos[4] =
{ (GLfloat)light.x, (GLfloat)light.y, (GLfloat)light.z, 0 };
glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
glEnable(GL_LIGHT0); 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); glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, 1);
GLfloat ambient[4] = { 0.4f, 0.4f, 0.4f, 1.0f }; GLfloat ambient[4] = { 0.4f, 0.4f, 0.4f, 1.0f };
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient);

View File

@ -42,6 +42,7 @@ void Entity::DrawAll(void) {
Entity *e = &(SS.entity.elem[i]); Entity *e = &(SS.entity.elem[i]);
if(!e->IsPoint()) continue; if(!e->IsPoint()) continue;
if(!(SS.GetGroup(e->group)->visible)) continue; if(!(SS.GetGroup(e->group)->visible)) continue;
if(SS.GroupsInOrder(SS.GW.activeGroup, e->group)) continue;
Vector v = e->PointGetNum(); Vector v = e->PointGetNum();
glxVertex3v(v.Plus (r).Plus (d)); glxVertex3v(v.Plus (r).Plus (d));

View File

@ -97,6 +97,7 @@ void Group::MenuGroup(int id) {
g.opA = SS.GW.activeGroup; g.opA = SS.GW.activeGroup;
g.color = RGB(100, 100, 100); g.color = RGB(100, 100, 100);
g.name.strcpy("lathe"); g.name.strcpy("lathe");
SS.GW.ClearSelection();
break; break;
case GraphicsWindow::MNU_GROUP_ROT: { case GraphicsWindow::MNU_GROUP_ROT: {

View File

@ -439,6 +439,8 @@ public:
hEntity entityB; hEntity entityB;
bool otherAngle; bool otherAngle;
bool reference; // a ref dimension, that generates no eqs
// These define how the constraint is drawn on-screen. // These define how the constraint is drawn on-screen.
struct { struct {
Vector offset; Vector offset;

View File

@ -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) { void TextWindow::EditControlDone(char *s) {
switch(edit.meaning) { switch(edit.meaning) {
case EDIT_TIMES_REPEATED: { case EDIT_TIMES_REPEATED: {

5
ui.h
View File

@ -48,8 +48,6 @@ public:
typedef struct { typedef struct {
int screen; int screen;
hGroup group; hGroup group;
hRequest request;
hConstraint constraint;
} ShownState; } ShownState;
static const int HISTORY_LEN = 16; static const int HISTORY_LEN = 16;
ShownState showns[HISTORY_LEN]; ShownState showns[HISTORY_LEN];
@ -74,9 +72,6 @@ public:
// the sketch. // the sketch.
void ShowListOfGroups(void); void ShowListOfGroups(void);
void ShowGroupInfo(void); void ShowGroupInfo(void);
void ShowRequestInfo(void);
void ShowEntityInfo(void);
void ShowConstraintInfo(void);
void ShowGroupSolveInfo(void); void ShowGroupSolveInfo(void);
// Special screen, based on selection // Special screen, based on selection
void DescribeSelection(void); void DescribeSelection(void);

View File

@ -7,6 +7,8 @@ DXF export
compress file format (binary?) compress file format (binary?)
partitioned subsystems in the solver partitioned subsystems in the solver
arbitrary color specification arbitrary color specification
specify tolerance for meshing
specify light positions (all on one configuration screen)
TTF font text TTF font text
display with proper formatting/units display with proper formatting/units
more measurements more measurements