EgtGraphics 1.5c2 :

- migliorata gestione colore di default.
This commit is contained in:
Dario Sassi
2014-03-07 08:39:01 +00:00
parent 551bb713e4
commit 80a2a43cdc
4 changed files with 23 additions and 16 deletions
BIN
View File
Binary file not shown.
+6 -5
View File
@@ -92,17 +92,12 @@ class Scene : public IEGrScene
bool DrawWinRect( void) ;
private :
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
HDC m_hDC ; // Device Context
HGLRC m_hRC ; // OpenGL Rendering Context
WGLEWContext m_wglewc ; // WGLEW Context
GLEWContext m_glewc ; // GLEW Context
bool m_bNewWay ; // flag che indica nuova modalità (OpenGL 3.0 in poi)
Color m_BackTop ; // colore di sfondo in alto
Color m_BackBottom ; // colore di sfondo in basso
Point3d m_ptCenter ; // centro verso cui è rivolta la camera
Vector3d m_vtDirCamera ; // versore direzione dal centro alla camera
double m_dDistCamera ; // distanza dal centro alla camera
@@ -111,6 +106,12 @@ class Scene : public IEGrScene
int m_nViewportW ; // larghezza della finestra
int m_nViewportH ; // altezza della finestra
Color m_BackTop ; // colore di sfondo in alto
Color m_BackBottom ; // colore di sfondo in basso
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
Color m_colDef ; // colore di default
BBox3d m_b3ExtWorld ; // estensione della geometria nel riferimento globale (mondo)
BBox3d m_b3ExtView ; // estensione nel riferimento di vista
bool m_bExtViewOk ; // flag per stato aggiornamento di EView
+16 -10
View File
@@ -20,6 +20,7 @@
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGkFrame3d.h"
#include "/EgtDev/Include/EGkGdbConst.h"
#include "/EgtDev/Include/EGkGeomDB.h"
using namespace std ;
@@ -38,22 +39,26 @@ CreateEGrScene( void)
//----------------------------------------------------------------------------
Scene::Scene( void)
{
m_pGeomDB = nullptr ;
// Context data
m_hDC = nullptr ;
m_hRC = nullptr ;
memset( &m_wglewc, 0, sizeof( WGLEWContext)) ;
memset( &m_glewc, 0, sizeof( GLEWContext)) ;
m_bNewWay = false ;
// Geom data
SetExtension( BBox3d( -MIN_EXTENSION, -MIN_EXTENSION, -MIN_EXTENSION,
MIN_EXTENSION, MIN_EXTENSION, MIN_EXTENSION)) ;
// Viewport
m_nViewportW = 0 ;
m_nViewportH = 0 ;
// View data
// Camera e viewport
m_ptCenter = ORIG ;
SetCamera( 0, 0, 0) ;
m_nViewportW = 0 ;
m_nViewportH = 0 ;
// Sfondo
m_BackTop.Set( 128, 128, 128) ;
m_BackBottom.Set( 128, 128, 128) ;
// GeomData
m_pGeomDB = nullptr ;
m_colDef.Set( 0, 0, 0) ;
// Extension
SetExtension( BBox3d( -MIN_EXTENSION, -MIN_EXTENSION, -MIN_EXTENSION,
MIN_EXTENSION, MIN_EXTENSION, MIN_EXTENSION)) ;
// WinRect
m_bOutlineWR = true ;
m_colorWR.Set( 0, 0, 0) ;
@@ -616,8 +621,9 @@ Scene::Draw( void)
glDepthFunc( GL_LESS) ;
glEnable( GL_DEPTH_TEST) ;
// colore di default
glColor4f( 1, 1, 1, 1) ;
// aggiorno il colore di default
if ( m_pGeomDB != nullptr)
m_pGeomDB->GetDefaultColor( m_colDef) ;
// disegno le geometrie del DB
DrawGroup( GDB_ID_ROOT) ;
+1 -1
View File
@@ -113,7 +113,7 @@ Scene::DrawGroup( int nId)
if ( pIter->GetColor( cCol))
glColor3f( cCol.GetRed(), cCol.GetGreen(), cCol.GetBlue()) ;
else
glColor3f( 1, 1, 1) ;
glColor3f( m_colDef.GetRed(), m_colDef.GetGreen(), m_colDef.GetBlue()) ;
// lo disegno
if ( ! DrawGeoObj( pGeoObj))
return false ;