EgtGraphics 2.1k6 :

- aggiunta possibilità di impostare spessore linee e grandezza punti.
This commit is contained in:
Dario Sassi
2019-12-02 07:28:16 +00:00
parent 7c124275c6
commit 2710646327
10 changed files with 112 additions and 29 deletions
BIN
View File
Binary file not shown.
+6 -6
View File
@@ -306,8 +306,8 @@ ObjNewGraphics::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()) ;
}
// 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 ;
+6 -6
View File
@@ -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 ;
+29 -2
View File
@@ -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
+19 -4
View File
@@ -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) ;
+1 -1
View File
@@ -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 ;
+4 -4
View File
@@ -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)) ;
+37 -4
View File
@@ -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 ;
}
+4 -2
View File
@@ -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() ;
+6
View File
@@ -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 ;
}