Add a configuration option to hide the back faces; that gets rid of
stray red pixels sometimes, if the mesh is leaky or the graphics card isn't perfect. [git-p4: depot-paths = "//depot/solvespace/": change = 1864]
This commit is contained in:
parent
2a420e8400
commit
96f5663d6e
11
draw.cpp
11
draw.cpp
|
@ -960,9 +960,14 @@ void GraphicsWindow::Paint(int w, int h) {
|
||||||
GLfloat ld1[4] = { (GLfloat)ld.x, (GLfloat)ld.y, (GLfloat)ld.z, 0 };
|
GLfloat ld1[4] = { (GLfloat)ld.x, (GLfloat)ld.y, (GLfloat)ld.z, 0 };
|
||||||
glLightfv(GL_LIGHT1, GL_POSITION, ld1);
|
glLightfv(GL_LIGHT1, GL_POSITION, ld1);
|
||||||
|
|
||||||
// For debugging, draw the backs of the triangles in red, so that we
|
if(SS.drawBackFaces) {
|
||||||
// notice when a shell is open
|
// For debugging, draw the backs of the triangles in red, so that we
|
||||||
glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, 1);
|
// notice when a shell is open
|
||||||
|
glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, 1);
|
||||||
|
} else {
|
||||||
|
glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,8 @@ void SolveSpace::Init(char *cmdLine) {
|
||||||
edgeColor = CnfThawDWORD(RGB(0, 0, 0), "EdgeColor");
|
edgeColor = CnfThawDWORD(RGB(0, 0, 0), "EdgeColor");
|
||||||
// Export scale factor
|
// Export scale factor
|
||||||
exportScale = CnfThawFloat(1.0f, "ExportScale");
|
exportScale = CnfThawFloat(1.0f, "ExportScale");
|
||||||
|
// Draw back faces of triangles (when mesh is leaky/self-intersecting)
|
||||||
|
drawBackFaces = CnfThawDWORD(1, "DrawBackFaces");
|
||||||
// Recent files menus
|
// Recent files menus
|
||||||
for(i = 0; i < MAX_RECENT; i++) {
|
for(i = 0; i < MAX_RECENT; i++) {
|
||||||
char name[100];
|
char name[100];
|
||||||
|
@ -107,6 +109,8 @@ void SolveSpace::Exit(void) {
|
||||||
CnfFreezeDWORD(edgeColor, "EdgeColor");
|
CnfFreezeDWORD(edgeColor, "EdgeColor");
|
||||||
// Export scale (a float, stored as a DWORD)
|
// Export scale (a float, stored as a DWORD)
|
||||||
CnfFreezeFloat(exportScale, "ExportScale");
|
CnfFreezeFloat(exportScale, "ExportScale");
|
||||||
|
// Draw back faces of triangles (when mesh is leaky/self-intersecting)
|
||||||
|
CnfFreezeDWORD(drawBackFaces, "DrawBackFaces");
|
||||||
|
|
||||||
ExitNow();
|
ExitNow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,6 +370,7 @@ public:
|
||||||
double cameraTangent;
|
double cameraTangent;
|
||||||
DWORD edgeColor;
|
DWORD edgeColor;
|
||||||
float exportScale;
|
float exportScale;
|
||||||
|
int drawBackFaces;
|
||||||
|
|
||||||
int CircleSides(double r);
|
int CircleSides(double r);
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -595,6 +595,10 @@ void TextWindow::ScreenChangeExportScale(int link, DWORD v) {
|
||||||
ShowTextEditControl(59, 3, str);
|
ShowTextEditControl(59, 3, str);
|
||||||
SS.TW.edit.meaning = EDIT_EXPORT_SCALE;
|
SS.TW.edit.meaning = EDIT_EXPORT_SCALE;
|
||||||
}
|
}
|
||||||
|
void TextWindow::ScreenChangeBackFaces(int link, DWORD v) {
|
||||||
|
SS.drawBackFaces = !SS.drawBackFaces;
|
||||||
|
InvalidateGraphics();
|
||||||
|
}
|
||||||
void TextWindow::ShowConfiguration(void) {
|
void TextWindow::ShowConfiguration(void) {
|
||||||
int i;
|
int i;
|
||||||
Printf(true, "%Ft material color-(r, g, b)");
|
Printf(true, "%Ft material color-(r, g, b)");
|
||||||
|
@ -648,6 +652,14 @@ void TextWindow::ShowConfiguration(void) {
|
||||||
Printf(false, "%Ba %3 %Fl%Ll%f%D[change]%E",
|
Printf(false, "%Ba %3 %Fl%Ll%f%D[change]%E",
|
||||||
(double)SS.exportScale,
|
(double)SS.exportScale,
|
||||||
&ScreenChangeExportScale, 0);
|
&ScreenChangeExportScale, 0);
|
||||||
|
|
||||||
|
Printf(false, "");
|
||||||
|
Printf(false, "%Ft draw back faces: "
|
||||||
|
"%Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E",
|
||||||
|
&ScreenChangeBackFaces,
|
||||||
|
(SS.drawBackFaces ? "" : "yes"), (SS.drawBackFaces ? "yes" : ""),
|
||||||
|
&ScreenChangeBackFaces,
|
||||||
|
(!SS.drawBackFaces ? "" : "no"), (!SS.drawBackFaces ? "no" : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
2
ui.h
2
ui.h
|
@ -139,6 +139,8 @@ public:
|
||||||
static void ScreenShowConfiguration(int link, DWORD v);
|
static void ScreenShowConfiguration(int link, DWORD v);
|
||||||
static void ScreenGoToWebsite(int link, DWORD v);
|
static void ScreenGoToWebsite(int link, DWORD v);
|
||||||
|
|
||||||
|
static void ScreenChangeBackFaces(int link, DWORD v);
|
||||||
|
|
||||||
static void ScreenStepDimSteps(int link, DWORD v);
|
static void ScreenStepDimSteps(int link, DWORD v);
|
||||||
static void ScreenStepDimFinish(int link, DWORD v);
|
static void ScreenStepDimFinish(int link, DWORD v);
|
||||||
static void ScreenStepDimGo(int link, DWORD v);
|
static void ScreenStepDimGo(int link, DWORD v);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user