From 2710646327680adfadfa678c212f83db773f1a32 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 2 Dec 2019 07:28:16 +0000 Subject: [PATCH] =?UTF-8?q?EgtGraphics=202.1k6=20:=20-=20aggiunta=20possib?= =?UTF-8?q?ilit=C3=A0=20di=20impostare=20spessore=20linee=20e=20grandezza?= =?UTF-8?q?=20punti.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EgtGraphics.rc | Bin 11612 -> 11612 bytes ObjNewGraphics.cpp | 12 ++++++------ ObjOldGraphics.cpp | 12 ++++++------ Scene.h | 31 +++++++++++++++++++++++++++++-- SceneBasic.cpp | 23 +++++++++++++++++++---- SceneCamera.cpp | 2 +- SceneDirect.cpp | 8 ++++---- SceneGeom.cpp | 41 +++++++++++++++++++++++++++++++++++++---- SceneGlobFrame.cpp | 6 ++++-- SceneGrid.cpp | 6 ++++++ 10 files changed, 112 insertions(+), 29 deletions(-) diff --git a/EgtGraphics.rc b/EgtGraphics.rc index 9305abdb8a68738bc405e2472f3609c49ebc93d9..eab89ac93f76b491b9ba2517d1803da458842021 100644 GIT binary patch delta 107 zcmcZ;bth`WA2vp_&41YhnHkL{GxF$8RuDQj`GQp4<_>Nfpb$`IKhxwi$vlYcW(A=( W77S64p3N7ec0tr*m?Wm`#svW86C=g| delta 107 zcmcZ;bth`WA2vqQ&41YhnHfzdGxF$8RuDQj`GQp4<_>Nfpb$`IKhxwi$vlYcW(A=( W77S64p3N7ec0tr*m?Wm`#svW6MGetSelPointSize()) ; + glLineWidth( (float) m_pScene->GetSelLineWidth()) ; } // colori speciali per superficie shading selezionata o marcata @@ -380,8 +380,8 @@ ObjNewGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bSho glDepthFunc( GL_LESS) ; // dimensioni per halo - glPointSize( 7) ; - glLineWidth( 4) ; + glPointSize( (float) m_pScene->GetMarkPointSize()) ; + glLineWidth( (float) m_pScene->GetMarkLineWidth()) ; // colore di marcatura Color colMark = ( ( GetScene() != nullptr) ? GetScene()->GetMark() : Color( 192, 192, 0)) ; @@ -414,8 +414,8 @@ ObjNewGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bSho // se necessario, ripristino la normale visualizzazione if ( nStat == GDB_ST_SEL || nMark == GDB_MK_ON) { - glPointSize( 3) ; - glLineWidth( 1) ; + glPointSize( (float) m_pScene->GetPointSize()) ; + glLineWidth( (float) m_pScene->GetLineWidth()) ; } return true ; diff --git a/ObjOldGraphics.cpp b/ObjOldGraphics.cpp index 30e7253..e4879d0 100644 --- a/ObjOldGraphics.cpp +++ b/ObjOldGraphics.cpp @@ -206,8 +206,8 @@ ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bSho if ( nStat == GDB_ST_OFF) return true ; if ( nStat == GDB_ST_SEL) { - glPointSize( 5) ; - glLineWidth( 2) ; + glPointSize( (float) m_pScene->GetSelPointSize()) ; + glLineWidth( (float) m_pScene->GetSelLineWidth()) ; } // colore speciale per superficie shading selezionata o marcata @@ -293,8 +293,8 @@ ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bSho glDepthFunc( GL_LESS) ; // dimensioni per halo - glPointSize( 7) ; - glLineWidth( 4) ; + glPointSize( (float) m_pScene->GetMarkPointSize()) ; + glLineWidth( (float) m_pScene->GetMarkLineWidth()) ; // colore di marcatura Color colMark = ( ( GetScene() != nullptr) ? GetScene()->GetMark() : Color( 192, 192, 0)) ; @@ -337,8 +337,8 @@ ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, int nAlpha, bool bSho // se necessario, ripristino la normale visualizzazione if ( nStat == GDB_ST_SEL || nMark == GDB_MK_ON) { - glPointSize( 3) ; - glLineWidth( 1) ; + glPointSize( (float) m_pScene->GetPointSize()) ; + glLineWidth( (float) m_pScene->GetLineWidth()) ; } return true ; diff --git a/Scene.h b/Scene.h index c15ec38..45a5758 100644 --- a/Scene.h +++ b/Scene.h @@ -124,13 +124,14 @@ class Scene : public IEGrScene { return m_bShowTriaAdvanced ; } void SetShowZmap( int nMode) override { m_nShowZmap = nMode ; } - int GetShowZmap( void) const override - { return m_nShowZmap ; } + int GetShowZmap( void) const override + { return m_nShowZmap ; } // Geometry bool SetExtension( const BBox3d& b3Ext) override ; bool UpdateExtension( void) override ; bool SetMark( Color colMark) override ; bool SetSelSurf( Color colSelSurf) override ; + bool SetLineWidth( int nW) override ; // Grid bool SetGridShow( bool bShowGrid, bool bShowFrame) override ; bool SetGridGeo( double dSnapStep, int nMinLineSstep, int nMajLineSstep, int nExtSstep) override ; @@ -193,6 +194,23 @@ class Scene : public IEGrScene bool MakeCurrent( void) const ; int GetOpenGLver( void) { return m_nOglVer ; } + // PointSize - LineWidth + double GetPointSize( void) + { return m_dPointSize ; } + double GetSelPointSize( void) + { return m_dSelPointSize ; } + double GetMarkPointSize( void) + { return m_dMarkPointSize ; } + double GetLineWidth( void) + { return m_dLineWidth ; } + double GetSelLineWidth( void) + { return m_dSelLineWidth ; } + double GetMarkLineWidth( void) + { return m_dMarkLineWidth ; } + double GetGridLineWidth( void) + { return m_dGridLineWidth ; } + double GetFrameLineWidth( void) + { return m_dFrameLineWidth ; } // Geometry Color GetMark( void) { return m_colMark ; } @@ -276,6 +294,15 @@ class Scene : public IEGrScene bool m_bShowCurveDirection ; // flag di visualizzazione direzione curve bool m_bShowTriaAdvanced ; // flag per abilitare la visualizzazione avanzata dei triangoli int m_nShowZmap ; // modo visualizzazione Zmap (+1=surf, +2=spilloni, +4=normali, +8=pił colori) + // PointSize - LineWidth + double m_dPointSize ; // dimensione punti + double m_dSelPointSize ; // dimensione punti selezionati + double m_dMarkPointSize ; // dimensione punti marcati + double m_dLineWidth ; // spessore linee + double m_dSelLineWidth ; // spessore linee selezionate + double m_dMarkLineWidth ; // spessore linee marcate + double m_dGridLineWidth ; // spessore linee della griglia + double m_dFrameLineWidth ; // spessore linee del riferimento // Selection bool m_bSelect ; // flag di selezione attiva int m_nObjFilterForSelect ; // tipi di oggetti che possono essere selezionati diff --git a/SceneBasic.cpp b/SceneBasic.cpp index 4fbfbe7..b99e5e4 100644 --- a/SceneBasic.cpp +++ b/SceneBasic.cpp @@ -67,6 +67,15 @@ Scene::Scene( void) m_bShowCurveDirection = false ; m_bShowTriaAdvanced = true ; m_nShowZmap = ZSM_SURF ; + // PointSize - LineWidth + m_dPointSize = 3 ; + m_dSelPointSize = 5 ; + m_dMarkPointSize = 7 ; + m_dLineWidth = 1 ; + m_dSelLineWidth = 2 ; + m_dMarkLineWidth = 5 ; + m_dGridLineWidth = 1 ; + m_dFrameLineWidth = 2 ; // Selezione m_bSelect = false ; m_nObjFilterForSelect = GEO_ZERODIM | GEO_CURVE | GEO_SURF | GEO_VOLUME | GEO_EXTRA ; @@ -499,7 +508,7 @@ Scene::CalcClippingPlanesFromExtView( void) return false ; // ricavo la posizione dei piani di clipping sull'asse Z di vista const double EXP_COEFF = 1.1 ; - double dExtent = __max( ( EXP_COEFF * vtExtent.z), MIN_ZCLIP_EXT) ; + double dExtent = max( ( EXP_COEFF * vtExtent.z), MIN_ZCLIP_EXT) ; m_dZNear = - ( ptCenter.z + dExtent) ; m_dZFar = - ( ptCenter.z - dExtent) ; return true ; @@ -716,9 +725,6 @@ Scene::MyDraw( bool bSwapBF) if ( m_pGeomDB != nullptr) m_pGeomDB->GetDefaultMaterial( m_colDef) ; - // imposto la dimensione standard dei punti - glPointSize( 3) ; - // impostazioni dipendenti dalla modalitą di visualizzazione switch ( m_nShowMode) { case SM_WIREFRAME : @@ -726,6 +732,9 @@ Scene::MyDraw( bool bSwapBF) glDisable( GL_LIGHTING) ; // disegno griglia senza illuminazione (gią impostato) DrawGrid() ; + // imposto dati standard per punti e linee + glPointSize( (float) GetPointSize()) ; + glLineWidth( (float) GetLineWidth()) ; // imposto disegno wireframe anche per poligoni glPolygonMode( GL_FRONT_AND_BACK, GL_LINE) ; // disegno le geometrie del DB in una sola passata @@ -736,6 +745,9 @@ Scene::MyDraw( bool bSwapBF) glDisable( GL_LIGHTING) ; // disegno griglia senza illuminazione (gią impostato) DrawGrid() ; + // imposto dati standard per punti e linee + glPointSize( (float) GetPointSize()) ; + glLineWidth( (float) GetLineWidth()) ; // disegno le geometrie del DB // prima passata per superfici solo per aggiornare Zbuffer (poligoni riempiti e offsettati) glPolygonMode( GL_FRONT_AND_BACK, GL_FILL) ; @@ -753,6 +765,9 @@ Scene::MyDraw( bool bSwapBF) // disegno griglia senza illuminazione glDisable( GL_LIGHTING) ; DrawGrid() ; + // imposto dati standard per punti e linee + glPointSize( (float) GetPointSize()) ; + glLineWidth( (float) GetLineWidth()) ; // imposto disegno shading per poligoni con davanti e dietro diversificati glPolygonMode( GL_FRONT_AND_BACK, GL_FILL) ; glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE) ; diff --git a/SceneCamera.cpp b/SceneCamera.cpp index 0870196..e962f1b 100644 --- a/SceneCamera.cpp +++ b/SceneCamera.cpp @@ -117,7 +117,7 @@ Scene::VerifyCamera( void) if ( m_dDistCamera < EPS_SMALL) m_dDistCamera = STD_DIST_CAMERA ; else - m_dDistCamera = __max( m_dDistCamera, MIN_DIST_CAMERA) ; + m_dDistCamera = max( m_dDistCamera, MIN_DIST_CAMERA) ; // invalido Up e ExtView m_bUpOk = false ; m_bExtViewOk = false ; diff --git a/SceneDirect.cpp b/SceneDirect.cpp index b7cc8fe..22385a3 100644 --- a/SceneDirect.cpp +++ b/SceneDirect.cpp @@ -184,10 +184,10 @@ Scene::DrawWinRect( void) glGetIntegerv( GL_VIEWPORT, vPort) ; // estremi del rettangolo nel riferimento Win ( 0,0 in alto a sinistra e Y verso il basso) - double dWinXmin = __min( m_ptWinRectP1.x, m_ptWinRectP2.x) ; - double dWinXmax = __max( m_ptWinRectP1.x, m_ptWinRectP2.x) ; - double dWinYmin = __min( m_ptWinRectP1.y, m_ptWinRectP2.y) ; - double dWinYmax = __max( m_ptWinRectP1.y, m_ptWinRectP2.y) ; + double dWinXmin = min( m_ptWinRectP1.x, m_ptWinRectP2.x) ; + double dWinXmax = max( m_ptWinRectP1.x, m_ptWinRectP2.x) ; + double dWinYmin = min( m_ptWinRectP1.y, m_ptWinRectP2.y) ; + double dWinYmax = max( m_ptWinRectP1.y, m_ptWinRectP2.y) ; // estremi del rettangolo nel riferimento View (0,0 in centro, quindi estremi -1,-1 e +1,+1 assi soliti) float dViewXmin = float( - 1 + 2 * ( 1 + dWinXmin) / ( vPort[2] + 1)) ; float dViewXmax = float( - 1 + 2 * ( 1 + dWinXmax) / ( vPort[2] + 1)) ; diff --git a/SceneGeom.cpp b/SceneGeom.cpp index 182afa7..f954bd7 100644 --- a/SceneGeom.cpp +++ b/SceneGeom.cpp @@ -19,10 +19,7 @@ #include "ObjMultiGraphics.h" #include "EGrUtils.h" #include "DllMain.h" -#include "/EgtDev/Include/EgtILogger.h" -#include "/EgtDev/Include/EGnStringUtils.h" #include "/EgtDev/Include/EGkFrame3d.h" -#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EGkGdbIterator.h" #include "/EgtDev/Include/EGkGeoVector3d.h" #include "/EgtDev/Include/EGkGeoPoint3d.h" @@ -33,6 +30,10 @@ #include "/EgtDev/Include/EGkVolZmap.h" #include "/EgtDev/Include/EGkExtText.h" #include "/EgtDev/Include/EGkGdbFunct.h" +#include "/EgtDev/Include/EGnStringUtils.h" +#include "/EgtDev/Include/EgtNumUtils.h" +#include "/EgtDev/Include/EgtPointerOwner.h" +#include "/EgtDev/Include/EgtILogger.h" using namespace std ; @@ -57,7 +58,6 @@ bool Scene::SetMark( Color colMark) { m_colMark = colMark ; - return true ; } @@ -66,7 +66,40 @@ bool Scene::SetSelSurf( Color colSelSurf) { m_colSelSurf = colSelSurf ; + return true ; +} +//---------------------------------------------------------------------------- +bool +Scene::SetLineWidth( int nW) +{ + nW = Clamp( nW, 1, 3) ; + switch ( nW) { + case 1 : + m_dLineWidth = 1 ; + m_dSelLineWidth = 2 ; + m_dMarkLineWidth = 5 ; + m_dPointSize = 3 ; + m_dSelPointSize = 5 ; + m_dMarkPointSize = 7 ; + break ; + case 2 : + m_dLineWidth = 2 ; + m_dSelLineWidth = 4 ; + m_dMarkLineWidth = 7 ; + m_dPointSize = 4 ; + m_dSelPointSize = 7 ; + m_dMarkPointSize = 9 ; + break ; + case 3 : + m_dLineWidth = 3 ; + m_dSelLineWidth = 6 ; + m_dMarkLineWidth = 9 ; + m_dPointSize = 5 ; + m_dSelPointSize = 9 ; + m_dMarkPointSize = 11 ; + break ; + } return true ; } diff --git a/SceneGlobFrame.cpp b/SceneGlobFrame.cpp index 09b9387..8bef1c6 100644 --- a/SceneGlobFrame.cpp +++ b/SceneGlobFrame.cpp @@ -53,7 +53,7 @@ Scene::DrawGlobFrame( void) double dLen = LEN_AX * ( 2 * m_dHalfWidth) / Viewport[2] ; // disegno degli assi - glLineWidth( 2) ; + glLineWidth( (float) GetFrameLineWidth()) ; glBegin( GL_LINES) ; // asse X+ glColor3f( 1, 0, 0) ; @@ -68,7 +68,9 @@ Scene::DrawGlobFrame( void) glVertex3f( float( ptOrig.x), float( ptOrig.y), float( ptOrig.z)) ; glVertex3f( float( ptOrig.x), float( ptOrig.y), float( ptOrig.z + dLen)) ; glEnd() ; - glLineWidth( 1) ; + + // ripristino spessore linee + glLineWidth( (float) GetLineWidth()) ; // ripristino lo stack delle matrici glPopMatrix() ; diff --git a/SceneGrid.cpp b/SceneGrid.cpp index 2162f14..d0990e0 100644 --- a/SceneGrid.cpp +++ b/SceneGrid.cpp @@ -57,6 +57,9 @@ Scene::DrawGrid( void) if ( ! m_bShowGrid && ! m_bShowFrame) return true ; + // spessore linee + glLineWidth( (float) GetGridLineWidth()) ; + // imposto il riferimento glPushMatrix() ; double Matrix[OGLMAT_DIM] ; @@ -163,5 +166,8 @@ Scene::DrawGrid( void) // ripristino lo stack delle matrici glPopMatrix() ; + // ripristino spessore linee + glLineWidth( (float) GetLineWidth()) ; + return true ; } \ No newline at end of file