X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fgraph3dview.cpp;h=002502959ff1387e7c299697f595db62955728f6;hp=3a4221a2233abd0b16673865caefe7b40ff75365;hb=4f15a69a3150f180bd93fcbe1c87dbaca92a77ad;hpb=22c2ccf1889b076d55be487aa3e1fe761e42faaa diff --git a/src/graph3dview.cpp b/src/graph3dview.cpp index 3a4221a..0025029 100644 --- a/src/graph3dview.cpp +++ b/src/graph3dview.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: graph3dview.cpp,v 1.34 2003/01/30 22:02:30 kevin Exp $ +** $Id: graph3dview.cpp,v 1.35 2003/03/23 18:37:42 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -145,7 +145,7 @@ Graph3dFileView::Graph3dFileView () : m_pFileMenu(NULL), m_pViewMenu(NULL), m_pStatusBar(NULL), m_pCanvas(NULL), m_dXRotate(-180), m_dYRotate(-210), m_dZRotate(195), m_bDoubleBuffer(true), m_bSmooth(true), m_bWireframe(false), - m_bLighting(true), m_bColor(true), m_bUseVertexArrays(false), + m_bLighting(false), m_bColor(true), m_bUseVertexArrays(false), m_bColorScaleMinSet(false), m_bColorScaleMaxSet(false), m_pFrame(NULL) {} @@ -231,17 +231,23 @@ Graph3dFileView::DrawSurface() glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); glCallList (DISPLAYLIST_COLOR); - glColor3f (0.0f, 0.0f, 0.0f); + glEnable (GL_DEPTH_TEST); + glColor3f (1.0f, 1.0f, 1.0f); glPolygonOffset (0.0f, 0.0f); glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); glCallList (DISPLAYLIST_NO_COLOR); + } else { glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); if (! m_bColor) { glColor3f (1.0f, 1.0f, 1.0f); glCallList (DISPLAYLIST_NO_COLOR); - } else + } else { + glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE); + glEnable (GL_COLOR_MATERIAL); + glShadeModel (GL_FLAT); glCallList (DISPLAYLIST_COLOR); + } } } @@ -342,7 +348,7 @@ Graph3dFileView::CreateDisplayList() for (unsigned int iy = 1; iy < ny - 1; iy++, dYPos++) { p1[0] = dXPos; p1[1] = actScale * (v[ix][iy] + actOffset); p1[2] = dYPos; p2[0] = dXPos+1; p2[1] = actScale * (v[ix+1][iy] + actOffset); p2[2] = dYPos; - CalculateVectorNormal (p1, p2, lastP, &n1[0], &n1[1], &n1[2]); + CalculateVectorNormal (p1, p2, lastP, &n1[0], &n1[1], &n1[2]); lastP[0] = p1[0]; lastP[1] = p1[1]; lastP[2] = p1[2]; glVertex3dv (p1); glNormal3dv (n1); glVertex3dv (p2); glNormal3dv (n1); @@ -438,31 +444,29 @@ Graph3dFileView::InitMaterials() int ny = GetDocument()->ny(); #if 1 - static float ambient[] = {0.1f, 0.1f, 0.1f, 1.0f}; - static float diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f}; - static float position0[] = {-nx/2, -ny/2, ny/2, 0.0f, 0.0f}; - static float position1[] = {-nx/2, -ny/2, -ny/2, 0.0f}; - static float ambient1[] = {0.5f, 0.5f, 0.5f, 1.0f}; + static float position0[] = {nx/2, ny*2, -ny*2, 0.0f,}; + static float ambient0[] = {.1f, .1f, .1f, 1.0f}; + static float diffuse0[] = {1.0f, 1.0f, 1.0f, 1.0f}; + static float position1[] = {-nx/2, -ny*2, -ny*2, 0.0f,}; + static float ambient1[] = {.1f, .1f, .1f, .1f}; static float diffuse1[] = {1.0f, 1.0f, 1.0f, 1.0f}; // static float position0[] = {0.0f, 0.0f, 20.0f, 0.0f}; // static float position1[] = {0.0f, 0.0f, -20.0f, 0.0f}; - static float front_mat_shininess[] = {5.0f}; - static float front_mat_specular[] = {0.1f, 0.1f, 0.1f, 1.0f}; + static float front_mat_shininess[] = {60.0f}; + static float front_mat_specular[] = {0.2f, 0.2f, 0.2f, 1.0f}; static float front_mat_diffuse[] = {0.3f, 0.3f, 0.3f, 1.0f}; - /* - static float back_mat_shininess[] = {60.0f}; - static float back_mat_specular[] = {0.2f, 0.2f, 0.2f, 1.0f}; + static float back_mat_shininess[] = {10.0f}; + static float back_mat_specular[] = {0.1f, 0.1f, 0.1f, 1.0f}; static float back_mat_diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f}; - */ static float lmodel_ambient[] = {1.0f, 1.0f, 1.0f, 1.0f}; - static float lmodel_twoside[] = {GL_FALSE}; + static float lmodel_twoside[] = {GL_TRUE}; - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + //glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glHint(GL_LINE_SMOOTH, GL_DONT_CARE); glEnable(GL_NORMALIZE); - glLightfv (GL_LIGHT0, GL_AMBIENT, ambient); - glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv (GL_LIGHT0, GL_AMBIENT, ambient0); + glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse0); glLightfv (GL_LIGHT0, GL_POSITION, position0); glEnable (GL_LIGHT0); @@ -477,9 +481,12 @@ Graph3dFileView::InitMaterials() glMaterialfv (GL_FRONT_AND_BACK, GL_SHININESS, front_mat_shininess); glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, front_mat_specular); glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, front_mat_diffuse); + glMaterialfv (GL_BACK, GL_SHININESS, back_mat_shininess); + glMaterialfv (GL_BACK, GL_SPECULAR, back_mat_specular); + glMaterialfv (GL_BACK, GL_DIFFUSE, back_mat_diffuse); glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE); - // glColorMaterial (GL_FRONT_AND_BACK, GL_SPECULAR); + glColorMaterial (GL_FRONT_AND_BACK, GL_SPECULAR); glEnable(GL_COLOR_MATERIAL); #else GLfloat impLPos[] = {1.0f, 1.0f, 1.0f, 0.0f}; @@ -775,10 +782,10 @@ Graph3dFileView::CreateChildFrame (wxDocument *doc, wxView *view) m_pFileMenu->Append(wxID_PRINT, "&Print..."); m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup..."); m_pFileMenu->Append(wxID_PREVIEW, "Print Preview"); -#ifdef CTSIM_MDI m_pFileMenu->AppendSeparator(); + m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces..."); m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit"); -#endif + GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu); GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);