X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fgraph3dview.cpp;h=15d560f839f2f3af63cfb4d9b5c7549160b883b9;hp=526ab6480ffd3032f3cf6c510b64deff7389ed59;hb=3ea498d51ce4597e9649cd21f155b51175ea0bea;hpb=d16eb37cbc73f67fc29a60645e0b1ac7fe32767e diff --git a/src/graph3dview.cpp b/src/graph3dview.cpp index 526ab64..15d560f 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.20 2001/03/18 18:08:26 kevin Exp $ +** $Id: graph3dview.cpp,v 1.21 2001/03/21 21:45:31 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 @@ -140,7 +140,7 @@ EVT_MENU(IFMENU_FILE_PROPERTIES, Graph3dFileView::OnProperties) EVT_MENU(GRAPH3D_VIEW_LIGHTING, Graph3dFileView::OnLighting) EVT_MENU(GRAPH3D_VIEW_COLOR, Graph3dFileView::OnColor) EVT_MENU(GRAPH3D_VIEW_SMOOTH, Graph3dFileView::OnSmooth) -EVT_MENU(GRAPH3D_VIEW_SURFACE, Graph3dFileView::OnSurface) +EVT_MENU(GRAPH3D_VIEW_WIREFRAME, Graph3dFileView::OnWireframe) EVT_MENU(GRAPH3D_VIEW_SCALE_MINMAX, Graph3dFileView::OnScaleSet) EVT_MENU(GRAPH3D_VIEW_SCALE_AUTO, Graph3dFileView::OnScaleAuto) EVT_MENU(GRAPH3D_VIEW_SCALE_FULL, Graph3dFileView::OnScaleFull) @@ -151,16 +151,15 @@ Graph3dFileView::Graph3dFileView () { m_bDoubleBuffer = true; m_bSmooth = true; - m_bLighting = false; - m_bSurface = false; - m_bLighting = false; + m_bLighting = true; + m_bWireframe = false; + m_bLighting = true; m_bColor = true; m_dXRotate = -180; m_dYRotate = -210; m_dZRotate = -195; m_bColorScaleMinSet = false; m_bColorScaleMaxSet = false; - m_bCalculatedSurfaceBackground = false; } Graph3dFileView::~Graph3dFileView() @@ -194,7 +193,7 @@ Graph3dFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) ) m_pViewMenu->Check (GRAPH3D_VIEW_COLOR, m_bColor); m_pViewMenu->Check (GRAPH3D_VIEW_LIGHTING, m_bLighting); m_pViewMenu->Check (GRAPH3D_VIEW_SMOOTH, m_bSmooth); - m_pViewMenu->Check (GRAPH3D_VIEW_SURFACE, m_bSurface); + m_pViewMenu->Check (GRAPH3D_VIEW_WIREFRAME, m_bWireframe); return true; } @@ -241,15 +240,7 @@ Graph3dFileView::DrawSurface() glTranslated (-static_cast(nx - 1) / 2, 0.0, -static_cast(ny - 1) / 2); InitMaterials(); - if (m_bSurface) { - glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); - if (! m_bColor) { - glColor3f (1.0f, 1.0f, 1.0f); - glCallList (DISPLAYLIST_NO_COLOR); - } else - glCallList (DISPLAYLIST_COLOR); - } - else { + if (m_bWireframe) { if (! m_bColor) glColor3f (1.0f, 1.0f, 1.0f); glPolygonOffset (1.0f, 1.0f); @@ -261,6 +252,13 @@ Graph3dFileView::DrawSurface() 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 + glCallList (DISPLAYLIST_COLOR); } } @@ -366,13 +364,6 @@ Graph3dFileView::CreateDisplayList() } -void -Graph3dFileView::calculateSurfaceBackground () -{ - if (m_bCalculatedSurfaceBackground) - return; -} - void Graph3dFileView::OnProperties (wxCommandEvent& event) { @@ -392,10 +383,10 @@ Graph3dFileView::OnLighting (wxCommandEvent& event) } void -Graph3dFileView::OnSurface (wxCommandEvent& event) +Graph3dFileView::OnWireframe (wxCommandEvent& event) { - m_bSurface = ! m_bSurface; - m_pViewMenu->Check (GRAPH3D_VIEW_SURFACE, m_bSurface); + m_bWireframe = ! m_bWireframe; + m_pViewMenu->Check (GRAPH3D_VIEW_WIREFRAME, m_bWireframe); m_pCanvas->Refresh(); } @@ -777,7 +768,7 @@ Graph3dFileView::CreateChildFrame (wxDocument *doc, wxView *view) GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu); m_pViewMenu = new wxMenu; - m_pViewMenu->Append(GRAPH3D_VIEW_SURFACE, "Su&rface\tCtrl-R", "", true); + m_pViewMenu->Append(GRAPH3D_VIEW_WIREFRAME, "Wi&reframe\tCtrl-R", "", true); m_pViewMenu->Append(GRAPH3D_VIEW_SMOOTH, "S&mooth\tCtrl-M", "", true); m_pViewMenu->Append(GRAPH3D_VIEW_COLOR, "Co&lor\tCtrl-L", "", true); m_pViewMenu->Append(GRAPH3D_VIEW_LIGHTING, "Li&ghting\tCtrl-G", "", true); @@ -802,7 +793,7 @@ Graph3dFileView::CreateChildFrame (wxDocument *doc, wxView *view) subframe->Centre(wxBOTH); wxAcceleratorEntry accelEntries[7]; - accelEntries[0].Set (wxACCEL_CTRL, static_cast('R'), GRAPH3D_VIEW_SURFACE); + accelEntries[0].Set (wxACCEL_CTRL, static_cast('R'), GRAPH3D_VIEW_WIREFRAME); accelEntries[1].Set (wxACCEL_CTRL, static_cast('L'), GRAPH3D_VIEW_COLOR); accelEntries[2].Set (wxACCEL_CTRL, static_cast('G'), GRAPH3D_VIEW_LIGHTING); accelEntries[3].Set (wxACCEL_CTRL, static_cast('M'), GRAPH3D_VIEW_SMOOTH); @@ -901,8 +892,8 @@ Graph3dFileCanvas::OnChar(wxKeyEvent& event) m_pView->m_dYRotate -= 15.0; Refresh (false); break; - case 'r': case 'R': - m_pView->OnSurface (dummyEvent); + case 'w': case 'W': + m_pView->OnWireframe (dummyEvent); break; case 's': case 'S': m_pView->OnSmooth (dummyEvent);