diff --git a/EGrGraphObjs.h b/EGrGraphObjs.h deleted file mode 100644 index 01f1d90..0000000 --- a/EGrGraphObjs.h +++ /dev/null @@ -1,42 +0,0 @@ -//---------------------------------------------------------------------------- -// EgalTech 2013-2014 -//---------------------------------------------------------------------------- -// File : EGrGraphObjs.h Data : 06.02.14 Versione : 1.5b4 -// Contenuto : Oggetti grafici e loro raccolte. -// -// -// -// Modifiche : 06.02.14 DS Creazione modulo. -// -// -//---------------------------------------------------------------------------- - -#pragma once - -#include -#include - -//---------------------------------------------------------------------------- -// Definizione di Vert3f -class Vert3f { - public : - Vert3f( double dX, double dY, double dZ) : x( (float)dX), y( (float)dY), z( (float)dZ) {} - Vert3f( void) : x( 0), y( 0), z( 0) {} - void Set( double dX, double dY, double dZ) { x = (float)dX ; y = (float)dY ; z = (float)dZ ;} - const Vert3f& operator =( const Vert3f& ptSrc) - { if ( &ptSrc != this) { - x = ptSrc.x , y = ptSrc.y , z = ptSrc.z ; } - return *this ; } - - public : - float x ; - float y ; - float z ; -} ; -const size_t SIZEV3F = sizeof( Vert3f) ; - - -//---------------------------------------------------------------------------- -// Raccolte di Vert3f -typedef std::vector V3FVECTOR ; // vettore di vertici -typedef std::list V3FLIST ; // lista di vertici diff --git a/EGrScene.h b/EGrScene.h deleted file mode 100644 index d732b7d..0000000 --- a/EGrScene.h +++ /dev/null @@ -1,121 +0,0 @@ -//---------------------------------------------------------------------------- -// EgalTech 2013-2014 -//---------------------------------------------------------------------------- -// File : Scene.h Data : 03.02.14 Versione : 1.5b1 -// Contenuto : Dichiarazione della classe gestione scena. -// -// -// -// Modifiche : 29.01.14 DS Creazione modulo. -// -// -//---------------------------------------------------------------------------- - -#pragma once - -//---------------------------------------------------------------------------- -#include "/EgtDev/Include/EGkPoint3d.h" -#include "/EgtDev/Include/EGkBBox3d.h" -#include "EGrGraphObjs.h" -#define GLEW_MX -#include "/EgtDev/Extern/GLEW/Include/glew.h" -#include "/EgtDev/Extern/GLEW/Include/wglew.h" -#include - -class ILogger ; - -//---------------------------------------------------------------------------- -class EGrScene -{ - public : - enum OglDriver { OD_SOFT = 1, OD_OLD = 2, OD_NEW = 3} ; - enum CameraDir { CT_NONE = 0, CT_TOP = 1, CT_FRONT = 2, CT_RIGHT = 3, CT_BACK = 4, CT_LEFT = 5, - CT_BOTTOM = 6, CT_ISO_SW = 7, CT_ISO_SE = 8, CT_ISO_NE = 9, CT_ISO_NW = 10} ; - - public : - // Basic - EGrScene( void); - virtual ~EGrScene( void); - bool Init( ILogger* pLogger) ; - bool CreateContext( HDC hDC, int nDriver, bool b2Buff, int nColorBits, int nDepthBits) ; - bool IsValid( void) - { return ( m_hDC != nullptr && m_hRC != nullptr) ; } - std::string GetOpenGLInfo( void) ; - std::string GetGLSLInfo( void) ; - std::string GetPixelFormatInfo( void) ; - bool Reshape( int nW, int nH) ; - bool SetExtension( const BBox3d& b3Ext) ; - bool Prepare( void) ; - bool Draw( void) ; - bool Project( const Point3d& ptWorld, Point3d& ptView) ; - bool UnProject( const Point3d& ptView, Point3d& ptWorld) ; - void Destroy( void) ; - // Camera - bool SetCenter( const Point3d& ptCenter) ; - bool SetCamera( double dAngVertDeg, double dAngOrizzDeg, double dDist) ; - bool SetCamera( int nDir, double dDist = 0) ; - const Point3d& GetCenter( void) - { return m_ptCenter ; } - Point3d GetProjectedCenter( void) ; - void GetCamera( double* pdAngVertDeg, double* pdAngOrizzDeg, double* pdDist = nullptr) ; - int GetCameraDir( void) ; - bool PanCamera( const Point3d& ptWinOld, const Point3d& ptWinNew) ; - bool RotateCamera( const Point3d& ptWinOld, const Point3d& ptWinNew) ; - bool ZoomAll( void) ; - bool ZoomChange( double dCoeff) ; - bool ZoomOnPoint( const Point3d& ptWin, double dCoeff) ; - // Geometry - void SetData( int nType) ; - void ResetData( void) ; - - private : - // Basic - int ChooseGenPixelFormat( int nPfd, bool b2Buff, int nColorBits, int nDepthBits) ; - bool MakeCurrent( void) ; - GLEWContext* glewGetContext( void) - { return &m_glewc ; } - WGLEWContext* wglewGetContext( void) - { return &m_wglewc ; } - bool CalcExtView( void) ; - bool CalcDimViewFromExtView( void) ; - bool AdjustDimView( double dHalfWidth, double dHalfHeight) ; - bool CalcClippingPlanesFromExtView( void) ; - // Camera - bool CalcDirUp( void) ; - // Geometry - void SetTriangle( void) ; - void SetSquare( void) ; - void SetCube( void) ; - - private : - ILogger* m_pLogger ; - - 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) - - 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 - Vector3d m_vtUp ; // versore direzione Su della camera - bool m_bUpOk ; // flag per stato aggiornamento di Up - int m_nViewportW ; // larghezza della finestra - int m_nViewportH ; // altezza della finestra - - BBox3d m_b3ExtWorld ; // estensione della geometria - BBox3d m_b3ExtView ; // estensione nel riferimento di vista - bool m_bExtViewOk ; // flag per stato aggiornamento di EView - double m_dHalfWidth ; - double m_dHalfHeight ; - double m_dZNear ; - double m_dZFar ; - - static const int NUM_VAO = 3 ; - int m_nMode[NUM_VAO] ; // modo di utilizzo dei vertici - int m_nCount[NUM_VAO] ; // contatore di vertici - GLuint m_vaoID[NUM_VAO] ; // VAOs - GLuint m_vboID[NUM_VAO] ; // VBOs - V3FVECTOR m_v3fVect[NUM_VAO] ; // array di vertici equivalenti per vecchio modo -} ; diff --git a/EGrSceneBasic.cpp b/EGrSceneBasic.cpp deleted file mode 100644 index f47ff84..0000000 --- a/EGrSceneBasic.cpp +++ /dev/null @@ -1,593 +0,0 @@ -//---------------------------------------------------------------------------- -// EgalTech 2013-2014 -//---------------------------------------------------------------------------- -// File : EgrScene.cpp Data : 03.02.14 Versione : 1.5b1 -// Contenuto : Implementazione della classe gestione scena. -// -// -// -// Modifiche : 29.01.14 DS Creazione modulo. -// -// -//---------------------------------------------------------------------------- - -//--------------------------- Include ---------------------------------------- -#include "stdafx.h" -#include "EGrScene.h" -#include "/EgtDev/Include/EgtILogger.h" -#include "/EgtDev/Include/EGnStringUtils.h" -#include "/EgtDev/Include/EGkFrame3d.h" - -using namespace std ; - -//--------------------------- Constants -------------------------------------- -static const double MIN_EXTENSION = 50 ; - - -//---------------------------------------------------------------------------- -EGrScene::EGrScene( void) -{ - m_pLogger = 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 - m_ptCenter = ORIG ; - SetCamera( 0, 0, 0) ; -} - -//---------------------------------------------------------------------------- -EGrScene::~EGrScene( void) -{ -} - -//---------------------------------------------------------------------------- -bool -EGrScene::Init( ILogger* pLogger) -{ - m_pLogger = pLogger ; - return true ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::CreateContext( HDC hDC, int nDriver, bool b2Buff, int nColorBits, int nDepthBits) -{ - // verifico validità Device Context - if ( hDC == nullptr) - return false ; - m_hDC = hDC ; - - // riporto nei limiti il tipo di driver - if ( nDriver < OD_SOFT) - nDriver = OD_SOFT ; - else if ( nDriver > OD_NEW) - nDriver = OD_NEW ; - - // assegno formato pixel - PIXELFORMATDESCRIPTOR pfd ; - memset( &pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)) ; - pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR) ; - pfd.nVersion = 1 ; - pfd.dwFlags = ( b2Buff ? PFD_DOUBLEBUFFER : 0) | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW ; - pfd.iPixelType = PFD_TYPE_RGBA ; - pfd.cColorBits = nColorBits ; - pfd.cDepthBits = nDepthBits ; - pfd.iLayerType = PFD_MAIN_PLANE ; - - int nPixelFormat = ChoosePixelFormat( m_hDC, &pfd) ; - if ( nPixelFormat == 0) - return false ; - if ( nDriver == OD_SOFT) { - int nPixFormGen = ChooseGenPixelFormat( nPixelFormat, b2Buff, nColorBits, nDepthBits) ; - if ( nPixFormGen != 0) - nPixelFormat = nPixFormGen ; - } - if ( ! SetPixelFormat( m_hDC, nPixelFormat, &pfd)) - return false ; - - HGLRC tempContext = wglCreateContext( m_hDC) ; - wglMakeCurrent( m_hDC, tempContext) ; - - GLenum WglewInitResult ; - WglewInitResult = wglewInit() ; - - if ( WglewInitResult != GLEW_OK) - LOG_INFO( m_pLogger, "WGLEW is not initialized !") - - int attribs[10] ; - if ( nDriver == OD_SOFT) { - attribs[0] = WGL_CONTEXT_MAJOR_VERSION_ARB ; - attribs[1] = 1 ; - attribs[2] = WGL_CONTEXT_MINOR_VERSION_ARB ; - attribs[3] = 1 ; - attribs[4] = 0 ; - } - else if ( nDriver == OD_OLD) { - attribs[0] = WGL_CONTEXT_MAJOR_VERSION_ARB ; - attribs[1] = 2 ; - attribs[2] = WGL_CONTEXT_MINOR_VERSION_ARB ; - attribs[3] = 0 ; - attribs[4] = 0 ; - } - else { - attribs[0] = WGL_CONTEXT_MAJOR_VERSION_ARB ; - attribs[1] = 3 ; - attribs[2] = WGL_CONTEXT_MINOR_VERSION_ARB ; - attribs[3] = 0 ; - attribs[4] = WGL_CONTEXT_PROFILE_MASK_ARB ; - attribs[5] = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB ; - attribs[6] = 0 ; - } - - if ( wglewIsSupported( "WGL_ARB_create_context") == 1) { - m_hRC = wglCreateContextAttribsARB( m_hDC, 0, attribs) ; - wglMakeCurrent( m_hDC, NULL) ; - wglDeleteContext( tempContext) ; - wglMakeCurrent( m_hDC, m_hRC) ; - } - else { - //It's not possible to make a GL 3.x context. Use the old style context (GL 2.1 and before) - m_hRC = tempContext ; - LOG_INFO( m_pLogger, "WGL_ARB_create_context missing !") - } - - // verifico validità Rendering Context - if ( m_hRC == nullptr) - return false ; - - GLenum GlewInitResult ; - glewExperimental = GL_TRUE ; - GlewInitResult = glewInit() ; - - if ( GlewInitResult != GLEW_OK) - LOG_INFO( m_pLogger, "GLEW is not initialized !") - - // verifico se posso lavorare in modalità nuova - m_bNewWay = ( nDriver == OD_NEW && glewIsSupported( "GL_VERSION_3_0") == 1) ; - if ( ! m_bNewWay) - LOG_INFO( m_pLogger, "OpenGL old way rendering !") - - // reset stato di errore di OpenGL - glGetError() ; - - return true ; -} - -//---------------------------------------------------------------------------- -int -EGrScene::ChooseGenPixelFormat( int nPfd, bool b2Buff, int nColorBits, int nDepthBits) -{ - PIXELFORMATDESCRIPTOR pfdR ; - - - // verifica del pixel format proposto - int nTotPfd = DescribePixelFormat( m_hDC, nPfd, sizeof(PIXELFORMATDESCRIPTOR), &pfdR) ; - if ( pfdR.dwFlags & PFD_GENERIC_FORMAT && - ! ( pfdR.dwFlags & PFD_GENERIC_ACCELERATED)) - return nPfd ; - - // eventuale ricerca di un pixel format soddisfacente - int nIOpt = 0 ; - int nErrOpt = 1000 ; - for ( int nI = 1 ; nI <= nTotPfd ; nI ++) { - DescribePixelFormat( m_hDC, nI, sizeof(PIXELFORMATDESCRIPTOR), &pfdR) ; - if ( pfdR.dwFlags & PFD_GENERIC_FORMAT && - ! (pfdR.dwFlags & PFD_GENERIC_ACCELERATED) && - ( ! b2Buff || pfdR.dwFlags & PFD_DOUBLEBUFFER)) { - int nErr = abs( nColorBits - pfdR.cColorBits) + - abs( nDepthBits - pfdR.cDepthBits) ; - if ( nErr < nErrOpt) { - nErrOpt = nErr ; - nIOpt = nI ; - } - } - } - - return nIOpt ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::MakeCurrent( void) -{ - // se RC della scena non è definito, errore - if ( m_hRC == nullptr) - return false ; - - // se RC della scena non è quello corrente, lo imposto - HGLRC hRC = wglGetCurrentContext() ; - if ( m_hRC != hRC) - return ( wglMakeCurrent( m_hDC, m_hRC) != 0) ; - - return true ; -} - -//---------------------------------------------------------------------------- -string -EGrScene::GetOpenGLInfo( void) -{ - string sInfo = "OpenGL " ; - - if ( MakeCurrent()) { - const char* p ; - if ( ( p = reinterpret_cast ( glGetString( GL_VERSION))) != nullptr) - sInfo += p ; - sInfo += " " ; - if ( ( p = reinterpret_cast ( glGetString( GL_VENDOR))) != nullptr) - sInfo += p ; - sInfo += " " ; - if ( ( p = reinterpret_cast ( glGetString( GL_RENDERER))) != nullptr) - sInfo += p ; - } - else - sInfo += "ERROR" ; - - // reset stato di errore di OpenGL - glGetError() ; - - return sInfo ; -} - -//---------------------------------------------------------------------------- -string -EGrScene::GetGLSLInfo( void) -{ - string sInfo = "GLSL " ; - - if ( MakeCurrent()) { - const char* p ; - if ( ( p = reinterpret_cast ( glGetString( GL_SHADING_LANGUAGE_VERSION))) != nullptr) - sInfo += p ; - else - sInfo += "NONE" ; - } - else - sInfo += "ERROR" ; - - // reset stato di errore di OpenGL - glGetError() ; - - return sInfo ; -} - -//---------------------------------------------------------------------------- -string -EGrScene::GetPixelFormatInfo( void) -{ - string sInfo = "PixFmt " ; - - if ( MakeCurrent()) { - int nPixFmt ; - PIXELFORMATDESCRIPTOR Pfd ; - if ( ( nPixFmt = GetPixelFormat( m_hDC)) > 0 && - DescribePixelFormat( m_hDC, nPixFmt, sizeof(PIXELFORMATDESCRIPTOR), &Pfd) > 0) { - // indice - sInfo += ToString( nPixFmt) ; - // tipo di driver - if ( ! ( Pfd.dwFlags & PFD_GENERIC_FORMAT)) - sInfo += " ICD" ; - else if ( Pfd.dwFlags & PFD_GENERIC_ACCELERATED) - sInfo += " MCD" ; - else - sInfo += " GEN" ; - // singolo o doppio buffer - sInfo += ( ( Pfd.dwFlags & PFD_DOUBLEBUFFER) ? " BUFF2" : " BUFF1") ; - // RGBA o COLORINDEX - sInfo += ( ( Pfd.iPixelType == PFD_TYPE_RGBA) ? " RGBA" : " CI") ; - // color bits - sInfo += ToString( Pfd.cColorBits) ; - // depth bits - sInfo += " Z" + ToString( Pfd.cDepthBits) ; - } - else - sInfo = "NO DESCRIBE" ; - } - else - sInfo += "ERROR" ; - - // reset stato di errore di OpenGL - glGetError() ; - - return sInfo ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::SetExtension( const BBox3d& b3Ext) -{ - if ( b3Ext.IsEmpty()) - return false ; - - m_b3ExtWorld = b3Ext ; - m_bExtViewOk = false ; - return true ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::CalcExtView( void) -{ - // verifico se il calcolo è necessario - if ( m_bExtViewOk && m_bUpOk) - return true ; - // calcolo direzione camera Up - if ( ! CalcDirUp()) - return false ; - // calcolo il riferimento di vista - Frame3d frView ; - Vector3d vtZ = m_vtDirCamera ; - Vector3d vtY = m_vtUp ; - Vector3d vtX = vtY ^ vtZ ; - if ( ! frView.Set( m_ptCenter + m_dDistCamera * vtZ, vtX, vtY, vtZ)) - return false ; - // calcolo l'estensione nel riferimento di vista - m_b3ExtView = m_b3ExtWorld ; - m_b3ExtView.ToLoc( frView) ; - m_bExtViewOk = true ; - return m_bExtViewOk ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::CalcDimViewFromExtView( void) -{ - // calcolo estensione nel riferimento di vista - if ( ! CalcExtView()) - return false ; - - // recupero gli ingombri - Point3d ptMin ; - Point3d ptMax ; - if ( ! m_b3ExtView.GetMinMax( ptMin, ptMax)) - return false ; - - // ricavo le dimensioni - const double COEFF = 1.05 ; - double dHalfWidth = COEFF * max( fabs( ptMin.x), fabs( ptMax.x)) ; - double dHalfHeight = COEFF * max( fabs( ptMin.y), fabs( ptMax.y)) ; - - // adatto le dimensioni a quelle della vista - return AdjustDimView( dHalfWidth, dHalfHeight) ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::AdjustDimView( double dHalfWidth, double dHalfHeight) -{ - // se non assegnate, recupero dimensioni vista - if ( m_nViewportW == 0) { - HWND hWnd = ::WindowFromDC( m_hDC) ; - RECT rect ; - if ( ! ::GetClientRect( hWnd, &rect)) - return false ; - m_nViewportW = rect.right ; - m_nViewportH = rect.bottom ; - // aggiorno la vista - glViewport( 0, 0, m_nViewportW, m_nViewportH) ; - // verifico presenza errori - GLenum nErr = glGetError() ; - if ( nErr != GL_NO_ERROR) { - string sOut = "First glViewport OpenGL error " + ToString( (int)nErr) ; - LOG_INFO( m_pLogger, sOut.c_str()) - } - } - - // adatto il rapporto tra le dimensioni calcolate a quello delle dimensioni della vista - double dAspect = m_nViewportH / ( double) m_nViewportW ; - if ( dAspect * dHalfWidth > dHalfHeight) { - m_dHalfWidth = dHalfWidth ; - m_dHalfHeight = dAspect * dHalfWidth ; - } - else { - m_dHalfWidth = dHalfHeight / dAspect ; - m_dHalfHeight = dHalfHeight ; - } - - return true ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::CalcClippingPlanesFromExtView( void) -{ - // calcolo estensione nel riferimento di vista - if ( ! CalcExtView()) - return false ; - - // recupero gli ingombri - Point3d ptCenter ; - Vector3d vtExtent ; - if ( ! m_b3ExtView.GetCenterExtent( ptCenter, vtExtent)) - return false ; - // ricavo la posizione dei piani di clipping sull'asse Z di vista - const double EXP_COEFF = 1.05 ; - double dExtent = __max( ( EXP_COEFF * vtExtent.z), MIN_EXTENSION) ; - m_dZNear = - ( ptCenter.z + dExtent) ; - m_dZFar = - ( ptCenter.z - dExtent) ; - return true ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::Reshape( int nW, int nH) -{ - if ( ! MakeCurrent()) - return false ; - - // assegno le dimensioni della vista - m_nViewportW = nW ; - m_nViewportH = nH ; - - // aggiorno la vista - glViewport( 0, 0, m_nViewportW, m_nViewportH) ; - - // verifico presenza errori - GLenum nErr = glGetError() ; - if ( nErr != GL_NO_ERROR) { - string sOut = "Reshape OpenGL error " + ToString( (int)nErr) ; - LOG_INFO( m_pLogger, sOut.c_str()) - } - - // aggiorno - AdjustDimView( m_dHalfWidth, m_dHalfHeight) ; - - // ridisegno - return Draw() ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::Prepare( void) -{ - // imposto il rendering corrente - if ( ! MakeCurrent()) - return false ; - - // imposto il colore dello sfondo - glClearColor( 0.1f, 0.1f, 0.5f, 0.0f) ; - - // eventuale ricalcolo parametri di vista - CalcDirUp() ; - - // imposto matrice di proiezione - glMatrixMode( GL_PROJECTION) ; - glLoadIdentity() ; - glOrtho( - m_dHalfWidth, m_dHalfWidth, - m_dHalfHeight, m_dHalfHeight, m_dZNear, m_dZFar) ; - - // imposto matrice modello/vista - glMatrixMode( GL_MODELVIEW) ; - glLoadIdentity() ; - Point3d ptCamera = m_ptCenter + m_dDistCamera * m_vtDirCamera ; - gluLookAt( ptCamera.x, ptCamera.y, ptCamera.z, - m_ptCenter.x, m_ptCenter.y, m_ptCenter.z, - m_vtUp.x, m_vtUp.y, m_vtUp.z) ; - - // verifico presenza errori - GLenum nErr = glGetError() ; - if ( nErr != GL_NO_ERROR) { - string sOut = "Prepare OpenGL error " + ToString( (int)nErr) ; - LOG_INFO( m_pLogger, sOut.c_str()) - } - - return true ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::Draw( void) -{ - // imposto - if ( ! Prepare()) - return false ; - - // cancello - glClear( GL_COLOR_BUFFER_BIT) ; - - // disegno - if ( m_bNewWay) { - for ( int i = 0 ; i < NUM_VAO ; ++ i) { - if ( m_vaoID[i] != 0) { - glBindVertexArray( m_vaoID[i]) ; - glDrawArrays( m_nMode[i], 0, m_nCount[i]) ; - } - } - } - else { - for ( int i = 0 ; i < NUM_VAO ; ++ i) { - if ( m_nCount[i] != 0) { - glBegin( m_nMode[i]) ; - for ( int j = 0 ; j < m_nCount[i] ; ++ j) - glVertex3f( m_v3fVect[i][j].x, m_v3fVect[i][j].y, m_v3fVect[i][j].z) ; - glEnd() ; - } - } - } - - // aggiorno - glFlush() ; - - // verifico presenza errori - GLenum nErr = glGetError() ; - if ( nErr != GL_NO_ERROR) { - string sOut = "Draw OpenGL error " + ToString( (int)nErr) ; - LOG_INFO( m_pLogger, sOut.c_str()) - } - - // scambio i buffer back e front ( eseguita solo se previsti) - if ( ! SwapBuffers( m_hDC)) - LOG_INFO( m_pLogger, "Draw SwapBuffers error") - - return true ; -} - -/*------------------------------------------------------------------------------------------*/ -bool -EGrScene::Project( const Point3d& ptWorld, Point3d& ptView) -{ - if ( ! MakeCurrent()) - return false ; - - // recupero le matrici - GLdouble ModelView[ 16] ; - glGetDoublev( GL_MODELVIEW_MATRIX, ModelView) ; - GLdouble Projection[ 16] ; - glGetDoublev( GL_PROJECTION_MATRIX, Projection) ; - GLint Viewport[ 4] ; - glGetIntegerv( GL_VIEWPORT, Viewport) ; - - // eseguo la proiezione - // l'asse y della vista OpenGL va in alto con l'origine in basso, - // quello di Windows va in basso con l'origine in alto - int nRes =gluProject( ptWorld.x, ptWorld.y, ptWorld.z, - ModelView, Projection, Viewport, - &ptView.x, &ptView.y, &ptView.z) ; - ptView.y = (double) Viewport[3] - ptView.y ; - - return ( nRes == GL_TRUE) ; -} - -/*------------------------------------------------------------------------------------------*/ -bool -EGrScene::UnProject( const Point3d& ptView, Point3d& ptWorld) -{ - if ( ! MakeCurrent()) - return false ; - - // recupero le matrici - GLdouble ModelView[ 16] ; - glGetDoublev( GL_MODELVIEW_MATRIX, ModelView) ; - GLdouble Projection[ 16] ; - glGetDoublev( GL_PROJECTION_MATRIX, Projection) ; - GLint Viewport[ 4] ; - glGetIntegerv( GL_VIEWPORT, Viewport) ; - - // eseguo la contro proiezione - // l'asse y della vista OpenGL va in alto con l'origine in basso, - // quello di Windows va in basso con l'origine in alto - int nRes = gluUnProject( ptView.x, ((double) Viewport[3] - ptView.y), ptView.z, - ModelView, Projection, Viewport, - &ptWorld.x, &ptWorld.y, &ptWorld.z) ; - - return ( nRes == GL_TRUE) ; -} - -//---------------------------------------------------------------------------- -void -EGrScene::Destroy( void) -{ - wglMakeCurrent( nullptr, nullptr) ; - if ( m_hRC != nullptr) { - wglDeleteContext( m_hRC) ; - m_hRC = nullptr ; - } -} diff --git a/EGrSceneCamera.cpp b/EGrSceneCamera.cpp deleted file mode 100644 index 6fbe1e6..0000000 --- a/EGrSceneCamera.cpp +++ /dev/null @@ -1,295 +0,0 @@ -//---------------------------------------------------------------------------- -// EgalTech 2013-2014 -//---------------------------------------------------------------------------- -// File : EgrSceneCamera.cpp Data : 10.02.14 Versione : 1.5b1 -// Contenuto : Implementazione della gestione camera della classe scena. -// -// -// -// Modifiche : 10.02.14 DS Creazione modulo. -// -// -//---------------------------------------------------------------------------- - -//--------------------------- Include ---------------------------------------- -#include "stdafx.h" -#include "EGrScene.h" -#include "/EgtDev/Include/EgtILogger.h" -#include "/EgtDev/Include/EGnStringUtils.h" -#include "/EgtDev/Include/EGkFrame3d.h" - -using namespace std ; - -//--------------------------- Constants -------------------------------------- -static const double MIN_DIST_CAMERA = 10 ; -static const double STD_DIST_CAMERA = 1000 ; - -//---------------------------------------------------------------------------- -bool -EGrScene::SetCenter( const Point3d& ptCenter) -{ - // assegno il punto - m_ptCenter = ptCenter ; - // invalido ExtView - m_bExtViewOk = false ; - // calcolo nuovi dati di Z clipping - CalcClippingPlanesFromExtView() ; - return true ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::SetCamera( double dAngVertDeg, double dAngOrizzDeg, double dDist) -{ - // assegno la direzione e la distanza - m_vtDirCamera.FromSpherical( 1, dAngVertDeg, dAngOrizzDeg) ; - if ( dDist < EPS_SMALL) - m_dDistCamera = STD_DIST_CAMERA ; - else - m_dDistCamera = __max( dDist, MIN_DIST_CAMERA) ; - // invalido Up e ExtView - m_bUpOk = false ; - m_bExtViewOk = false ; - // calcolo nuovi dati di Z clipping - CalcClippingPlanesFromExtView() ; - return true ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::SetCamera( int nDir, double dDist) -{ - const double ANG_VERT_ISOVIEW = 54.73561032 ; - double dAngVertDeg ; - double dAngOrizzDeg ; - - - switch ( nDir) { - case CT_TOP : - dAngVertDeg = 0 ; - dAngOrizzDeg = 0 ; - break ; - case CT_FRONT : - dAngVertDeg = 90 ; - dAngOrizzDeg = -90 ; - break ; - case CT_RIGHT : - dAngVertDeg = 90 ; - dAngOrizzDeg = 0 ; - break ; - case CT_BACK : - dAngVertDeg = 90 ; - dAngOrizzDeg = 90 ; - break ; - case CT_LEFT : - dAngVertDeg = 90 ; - dAngOrizzDeg = 180 ; - break ; - case CT_BOTTOM : - dAngVertDeg = 180 ; - dAngOrizzDeg = 0 ; - break ; - case CT_ISO_SW : - dAngVertDeg = ANG_VERT_ISOVIEW ; - dAngOrizzDeg = -135 ; - break ; - case CT_ISO_SE : - dAngVertDeg = ANG_VERT_ISOVIEW ; - dAngOrizzDeg = -45 ; - break ; - case CT_ISO_NE : - dAngVertDeg = ANG_VERT_ISOVIEW ; - dAngOrizzDeg = 45 ; - break ; - case CT_ISO_NW : - dAngVertDeg = ANG_VERT_ISOVIEW ; - dAngOrizzDeg = 135 ; - break ; - default : - return false ; - break ; - } - - return SetCamera( dAngVertDeg, dAngOrizzDeg, dDist) ; -} - -//---------------------------------------------------------------------------- -void -EGrScene::GetCamera( double* pdAngVertDeg, double* pdAngOrizzDeg, double* pdDist) -{ - double dAngVertDeg ; - double dAngOrizzDeg ; - m_vtDirCamera.ToSpherical( nullptr, &dAngVertDeg, &dAngOrizzDeg) ; - if ( fabs( dAngVertDeg) < EPS_ANG_SMALL) - dAngOrizzDeg = -90 ; - if ( pdAngVertDeg != nullptr) - *pdAngVertDeg = dAngVertDeg ; - if ( pdAngOrizzDeg != nullptr) - *pdAngOrizzDeg = dAngOrizzDeg ; - if ( pdDist != nullptr) - *pdDist = m_dDistCamera ; -} - -//---------------------------------------------------------------------------- -int -EGrScene::GetCameraDir( void) -{ - if ( m_vtDirCamera.IsZplus()) - return CT_TOP ; - else if ( m_vtDirCamera.IsYminus()) - return CT_FRONT ; - else if ( m_vtDirCamera.IsXplus()) - return CT_RIGHT ; - else if ( m_vtDirCamera.IsYplus()) - return CT_BACK ; - else if ( m_vtDirCamera.IsXminus()) - return CT_LEFT ; - else if ( m_vtDirCamera.IsZminus()) - return CT_BOTTOM ; - else if ( AreSameVectorNear( m_vtDirCamera, Vector3d( SQRT1_3, - SQRT1_3, - SQRT1_3))) - return CT_ISO_SW ; - else if ( AreSameVectorNear( m_vtDirCamera, Vector3d( SQRT1_3, SQRT1_3, - SQRT1_3))) - return CT_ISO_SE ; - else if ( AreSameVectorNear( m_vtDirCamera, Vector3d( SQRT1_3, SQRT1_3, SQRT1_3))) - return CT_ISO_NE ; - else if ( AreSameVectorNear( m_vtDirCamera, Vector3d( SQRT1_3, - SQRT1_3, SQRT1_3))) - return CT_ISO_NW ; - else - return CT_NONE ; -} - -//---------------------------------------------------------------------------- -Point3d -EGrScene::GetProjectedCenter( void) -{ - Point3d ptVCen ; - if ( ! Project( m_ptCenter, ptVCen)) - ptVCen.Set( 0, 0, 0) ; - - return ptVCen ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::CalcDirUp( void) -{ - // verifico se il calcolo è necessario - if ( m_bUpOk) - return true ; - // direzione perpendicolare giacente nel piano XY - // ( m_vtDirCamera è opposta alla direzione in cui si guarda) - Vector3d vtPerpXY = m_vtDirCamera ^ Z_AX ; - if ( ! vtPerpXY.Normalize()) { - if ( m_vtDirCamera.z < 0) - vtPerpXY = X_AX ; - else - vtPerpXY = - X_AX ; - } - // direzione Up - m_vtUp = vtPerpXY ^ m_vtDirCamera ; - m_bUpOk = m_vtUp.Normalize() ; - // invalido ExtView - m_bExtViewOk = false ; - return m_bUpOk ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::PanCamera( const Point3d& ptWinOld, const Point3d& ptWinNew) -{ - // porto i due punti in coordinate mondo - double dZCenter = GetProjectedCenter().z ; - Point3d ptViewOld( ptWinOld.x, ptWinOld.y, dZCenter) ; - Point3d ptWorldOld ; - if ( ! UnProject( ptViewOld, ptWorldOld)) - return false ; - Point3d ptViewNew( ptWinNew.x, ptWinNew.y, dZCenter) ; - Point3d ptWorldNew ; - if ( ! UnProject( ptViewNew, ptWorldNew)) - return false ; - // calcolo lo spostamento tra i due punti - Vector3d vtMove = ptWorldNew - ptWorldOld ; - // applico questo spostamento al centro di vista - return SetCenter( GetCenter() - vtMove) ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::RotateCamera( const Point3d& ptWinOld, const Point3d& ptWinNew) -{ - const double MIN_ANG_VERT = 0.1 ; - const double MAX_ANG_VERT = 179.9 ; - - // angoli correnti della camera - double dAngVertDeg ; - double dAngOrizzDeg ; - GetCamera( &dAngVertDeg, &dAngOrizzDeg) ; - - // incrementi - double dDeltaAngVertDeg = ( ptWinNew.y - ptWinOld.y) / m_nViewportH * 360 ; - double dDeltaAngOrizzDeg = ( ptWinNew.x - ptWinOld.x) / m_nViewportW * 360 ; - - // calcolo nuovi angoli e limitazione dell'angolo verticale - dAngVertDeg -= dDeltaAngVertDeg ; - if ( dAngVertDeg < MIN_ANG_VERT) - dAngVertDeg = MIN_ANG_VERT ; - else if ( dAngVertDeg > MAX_ANG_VERT) - dAngVertDeg = MAX_ANG_VERT ; - dAngOrizzDeg -= dDeltaAngOrizzDeg ; - - // imposto nuova direzione camera - return SetCamera( dAngVertDeg, dAngOrizzDeg, 0) ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::ZoomAll( void) -{ - // traslo il centro di vista nel centro del box - Point3d ptExtCent ; - if ( ! m_b3ExtWorld.GetCenter( ptExtCent)) - return false ; - m_ptCenter = ptExtCent ; - m_bExtViewOk = false ; - - // calcolo nuovi dati di ingombro - CalcDimViewFromExtView() ; - CalcClippingPlanesFromExtView() ; - - return true ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::ZoomChange( double dCoeff) -{ - const double MIN_COEFF = 0.5 ; - const double MAX_COEFF = 2 ; - - // controllo i limiti - if ( dCoeff < MIN_COEFF) - dCoeff = MIN_COEFF ; - else if ( dCoeff > MAX_COEFF) - dCoeff = MAX_COEFF ; - // cambio le dimensioni di zoom - m_dHalfWidth *= dCoeff ; - m_dHalfHeight *= dCoeff ; - - return true ; -} - -//---------------------------------------------------------------------------- -bool -EGrScene::ZoomOnPoint( const Point3d& ptWin, double dCoeff) -{ - // porto il punto in coordinate mondo - Point3d ptView( ptWin.x, ptWin.y, GetProjectedCenter().z) ; - Point3d ptWorld ; - if ( ! UnProject( ptView, ptWorld)) - return false ; - // modifico opportunamente il centro di vista - Point3d ptNewCen = ptWorld + ( GetCenter() - ptWorld) * dCoeff ; - SetCenter( ptNewCen) ; - // eseguo lo zoom - return ZoomChange( dCoeff) ; -} diff --git a/EGrSceneGeom.cpp b/EGrSceneGeom.cpp deleted file mode 100644 index b3129ad..0000000 --- a/EGrSceneGeom.cpp +++ /dev/null @@ -1,272 +0,0 @@ -//---------------------------------------------------------------------------- -// EgalTech 2013-2014 -//---------------------------------------------------------------------------- -// File : EgrSceneGeom.cpp Data : 10.02.14 Versione : 1.5b1 -// Contenuto : Implementazione della gestione geometria della classe scena. -// -// -// -// Modifiche : 10.02.14 DS Creazione modulo. -// -// -//---------------------------------------------------------------------------- - -//--------------------------- Include ---------------------------------------- -#include "stdafx.h" -#include "EGrScene.h" -#include "/EgtDev/Include/EgtILogger.h" -#include "/EgtDev/Include/EGnStringUtils.h" -#include "/EgtDev/Include/EGkFrame3d.h" - -using namespace std ; - -//---------------------------------------------------------------------------- -void -EGrScene::SetData( int nType) -{ - const int SQUARE = 1 ; - const int CUBE = 2 ; - const int TRIANGLE = 3 ; - - switch ( nType) { - case SQUARE : - SetSquare() ; - break; - case CUBE : - SetCube() ; - break; - case TRIANGLE : - default : - SetTriangle() ; - break; - } -} - -//---------------------------------------------------------------------------- -void -EGrScene::SetSquare( void) -{ - if ( ! MakeCurrent()) - return ; - - // vertici - Vert3f Point[4] ; - Point[0].Set( -0.5, -0.5, 0.0) ; - Point[1].Set( -0.5, 0.5, 0.0) ; - Point[2].Set( 0.5, 0.5, 0.0) ; - Point[3].Set( 0.5, -0.5, 0.0) ; - - // dimensioni di ingombro - BBox3d b3Ext ; - for ( int i = 0 ; i < 4 ; ++ i) - b3Ext.Add( Point[i].x, Point[i].y, Point[i].z) ; - SetExtension( b3Ext) ; - - if ( m_bNewWay) { - // inizializzo VAOs a non allocati - for ( int i = 0 ; i < NUM_VAO ; ++ i) - m_vaoID[i] = 0 ; - // VAO allocation - glGenVertexArrays( 1, &m_vaoID[0]) ; - if ( m_vaoID[0] == 0) - return ; - // First VAO setup - glBindVertexArray( m_vaoID[0]) ; - glGenBuffers( 1, &m_vboID[0]) ; - glBindBuffer( GL_ARRAY_BUFFER, m_vboID[0]) ; - m_nMode[0] = GL_LINE_STRIP ; - m_nCount[0] = 5 ; - glBufferData( GL_ARRAY_BUFFER, 5 * SIZEV3F, NULL, GL_STATIC_DRAW) ; - glBufferSubData( GL_ARRAY_BUFFER, 0 * SIZEV3F, SIZEV3F, &Point[0]) ; - glBufferSubData( GL_ARRAY_BUFFER, 1 * SIZEV3F, SIZEV3F, &Point[1]) ; - glBufferSubData( GL_ARRAY_BUFFER, 2 * SIZEV3F, SIZEV3F, &Point[2]) ; - glBufferSubData( GL_ARRAY_BUFFER, 3 * SIZEV3F, SIZEV3F, &Point[3]) ; - glBufferSubData( GL_ARRAY_BUFFER, 4 * SIZEV3F, SIZEV3F, &Point[0]) ; - glVertexAttribPointer( (GLuint)0, 3, GL_FLOAT, GL_FALSE, 0, 0) ; - glEnableVertexAttribArray( 0) ; - glBindVertexArray( 0) ; - } - else { - - } -} - -//---------------------------------------------------------------------------- -void -EGrScene::SetCube( void) -{ - if ( ! MakeCurrent()) - return ; - - // vertici - Vert3f Point[8] ; - Point[0].Set( -0.5, -0.5, 0.0) ; - Point[1].Set( -0.5, 0.5, 0.0) ; - Point[2].Set( 0.5, 0.5, 0.0) ; - Point[3].Set( 0.5, -0.5, 0.0) ; - Point[4].Set( -0.5, -0.5, 1.0) ; - Point[5].Set( -0.5, 0.5, 1.0) ; - Point[6].Set( 0.5, 0.5, 1.0) ; - Point[7].Set( 0.5, -0.5, 1.0) ; - - // dimensioni di ingombro - BBox3d b3Ext ; - for ( int i = 0 ; i < 8 ; ++ i) - b3Ext.Add( Point[i].x, Point[i].y, Point[i].z) ; - SetExtension( b3Ext) ; - - if ( m_bNewWay) { - // inizializzo VAOs a non allocati - for ( int i = 0 ; i < NUM_VAO ; ++ i) - m_vaoID[i] = 0 ; - // VAO allocation - glGenVertexArrays( 3, &m_vaoID[0]) ; - if ( m_vaoID[0] == 0) - return ; - // First VAO setup - glBindVertexArray( m_vaoID[0]) ; - glGenBuffers( 1, &m_vboID[0]) ; - glBindBuffer( GL_ARRAY_BUFFER, m_vboID[0]) ; - m_nMode[0] = GL_LINE_STRIP ; - m_nCount[0] = 5 ; - glBufferData( GL_ARRAY_BUFFER, 5 * SIZEV3F, NULL, GL_STATIC_DRAW) ; - glBufferSubData( GL_ARRAY_BUFFER, 0 * SIZEV3F, SIZEV3F, &Point[0]) ; - glBufferSubData( GL_ARRAY_BUFFER, 1 * SIZEV3F, SIZEV3F, &Point[1]) ; - glBufferSubData( GL_ARRAY_BUFFER, 2 * SIZEV3F, SIZEV3F, &Point[2]) ; - glBufferSubData( GL_ARRAY_BUFFER, 3 * SIZEV3F, SIZEV3F, &Point[3]) ; - glBufferSubData( GL_ARRAY_BUFFER, 4 * SIZEV3F, SIZEV3F, &Point[0]) ; - glVertexAttribPointer( (GLuint)0, 3, GL_FLOAT, GL_FALSE, 0, 0) ; - glEnableVertexAttribArray( 0) ; - glBindVertexArray( 0) ; - // Second VAO setup - glBindVertexArray( m_vaoID[1]) ; - glGenBuffers( 1, &m_vboID[1]) ; - glBindBuffer( GL_ARRAY_BUFFER, m_vboID[1]) ; - m_nMode[1] = GL_LINE_STRIP ; - m_nCount[1] = 5 ; - glBufferData( GL_ARRAY_BUFFER, 5 * SIZEV3F, NULL, GL_STATIC_DRAW) ; - glBufferSubData( GL_ARRAY_BUFFER, 0 * SIZEV3F, SIZEV3F, &Point[4]) ; - glBufferSubData( GL_ARRAY_BUFFER, 1 * SIZEV3F, SIZEV3F, &Point[5]) ; - glBufferSubData( GL_ARRAY_BUFFER, 2 * SIZEV3F, SIZEV3F, &Point[6]) ; - glBufferSubData( GL_ARRAY_BUFFER, 3 * SIZEV3F, SIZEV3F, &Point[7]) ; - glBufferSubData( GL_ARRAY_BUFFER, 4 * SIZEV3F, SIZEV3F, &Point[4]) ; - glVertexAttribPointer( (GLuint)0, 3, GL_FLOAT, GL_FALSE, 0, 0) ; - glEnableVertexAttribArray( 0) ; - glBindVertexArray( 0) ; - // Third VAO setup - glBindVertexArray( m_vaoID[2]) ; - glGenBuffers( 1, &m_vboID[2]) ; - glBindBuffer( GL_ARRAY_BUFFER, m_vboID[2]) ; - m_nMode[2] = GL_LINES ; - m_nCount[2] = 8 ; - glBufferData( GL_ARRAY_BUFFER, 8 * SIZEV3F, NULL, GL_STATIC_DRAW) ; - glBufferSubData( GL_ARRAY_BUFFER, 0 * SIZEV3F, SIZEV3F, &Point[0]) ; - glBufferSubData( GL_ARRAY_BUFFER, 1 * SIZEV3F, SIZEV3F, &Point[4]) ; - glBufferSubData( GL_ARRAY_BUFFER, 2 * SIZEV3F, SIZEV3F, &Point[1]) ; - glBufferSubData( GL_ARRAY_BUFFER, 3 * SIZEV3F, SIZEV3F, &Point[5]) ; - glBufferSubData( GL_ARRAY_BUFFER, 4 * SIZEV3F, SIZEV3F, &Point[2]) ; - glBufferSubData( GL_ARRAY_BUFFER, 5 * SIZEV3F, SIZEV3F, &Point[6]) ; - glBufferSubData( GL_ARRAY_BUFFER, 6 * SIZEV3F, SIZEV3F, &Point[3]) ; - glBufferSubData( GL_ARRAY_BUFFER, 7 * SIZEV3F, SIZEV3F, &Point[7]) ; - glVertexAttribPointer( (GLuint)0, 3, GL_FLOAT, GL_FALSE, 0, 0) ; - glEnableVertexAttribArray( 0) ; - glBindVertexArray( 0) ; - } -} - -//---------------------------------------------------------------------------- -void -EGrScene::SetTriangle( void) -{ - if ( ! MakeCurrent()) - return ; - - // vertici - Vert3f Point[6] ; - Point[0].Set( -0.3, 0.5, -1.0) ; - Point[1].Set( -0.8, -0.5, -1.0) ; - Point[2].Set( 0.2, -0.5, -1.0) ; - Point[3].Set( -0.2, 0.5, -1.0) ; - Point[4].Set( 0.3, -0.5, -1.0) ; - Point[5].Set( 0.8, 0.5, -1.0) ; - - // dimensioni di ingombro - BBox3d b3Ext ; - for ( int i = 0 ; i < 6 ; ++ i) - b3Ext.Add( Point[i].x, Point[i].y, Point[i].z) ; - SetExtension( b3Ext) ; - - if ( m_bNewWay) { - // inizializzo VAOs a non allocati - for ( int i = 0 ; i < NUM_VAO ; ++ i) - m_vaoID[i] = 0 ; - // VAOs allocation - glGenVertexArrays( 2, &m_vaoID[0]) ; - // First VAO setup - glBindVertexArray( m_vaoID[0]) ; - glGenBuffers( 1, &m_vboID[0]) ; //VBO allocation - glBindBuffer( GL_ARRAY_BUFFER, m_vboID[0]) ; - m_nMode[0] = GL_LINE_STRIP ; - m_nCount[0] = 4 ; - glBufferData( GL_ARRAY_BUFFER, 4 * SIZEV3F, NULL, GL_STATIC_DRAW) ; - glBufferSubData( GL_ARRAY_BUFFER, 0 * SIZEV3F, SIZEV3F, &Point[0]) ; - glBufferSubData( GL_ARRAY_BUFFER, 1 * SIZEV3F, SIZEV3F, &Point[1]) ; - glBufferSubData( GL_ARRAY_BUFFER, 2 * SIZEV3F, SIZEV3F, &Point[2]) ; - glBufferSubData( GL_ARRAY_BUFFER, 3 * SIZEV3F, SIZEV3F, &Point[0]) ; - glVertexAttribPointer( (GLuint)0, 3, GL_FLOAT, GL_FALSE, 0, 0) ; - glEnableVertexAttribArray( 0) ; - glBindVertexArray( 0) ; - // Second VAO setup - glBindVertexArray( m_vaoID[1]) ; - glGenBuffers( 1, &m_vboID[1]) ; //VBO allocation - glBindBuffer( GL_ARRAY_BUFFER, m_vboID[1]) ; - m_nMode[1] = GL_LINE_STRIP ; - m_nCount[1] = 4 ; - glBufferData( GL_ARRAY_BUFFER, 4 * SIZEV3F, NULL, GL_STATIC_DRAW) ; - glBufferSubData( GL_ARRAY_BUFFER, 0 * SIZEV3F, SIZEV3F, &Point[3]) ; - glBufferSubData( GL_ARRAY_BUFFER, 1 * SIZEV3F, SIZEV3F, &Point[4]) ; - glBufferSubData( GL_ARRAY_BUFFER, 2 * SIZEV3F, SIZEV3F, &Point[5]) ; - glBufferSubData( GL_ARRAY_BUFFER, 3 * SIZEV3F, SIZEV3F, &Point[3]) ; - glVertexAttribPointer( (GLuint)0, 3, GL_FLOAT, GL_FALSE, 0, 0) ; - glEnableVertexAttribArray( 0) ; - glBindVertexArray( 0) ; - } - else { - // First VAO setup - m_nMode[0] = GL_LINE_STRIP ; - m_nCount[0] = 4 ; - m_v3fVect[0].reserve( 4) ; - m_v3fVect[0].push_back( Point[0]) ; - m_v3fVect[0].push_back( Point[1]) ; - m_v3fVect[0].push_back( Point[2]) ; - m_v3fVect[0].push_back( Point[0]) ; - // Second VAO setup - m_nMode[1] = GL_LINE_STRIP ; - m_nCount[1] = 4 ; - m_v3fVect[1].reserve( 4) ; - m_v3fVect[1].push_back( Point[3]) ; - m_v3fVect[1].push_back( Point[4]) ; - m_v3fVect[1].push_back( Point[5]) ; - m_v3fVect[1].push_back( Point[3]) ; - // Third VAO null - m_nCount[2] = 0 ; - } -} - -//---------------------------------------------------------------------------- -void -EGrScene::ResetData( void) -{ - if ( m_bNewWay) { - if ( MakeCurrent()) { - glBindBuffer( GL_ARRAY_BUFFER, 0) ; - glDeleteBuffers( NUM_VAO, m_vboID) ; - glBindVertexArray( 0) ; - glDeleteVertexArrays( NUM_VAO, m_vaoID) ; - } - } - else { - for ( int i = 0 ; i < NUM_VAO ; ++ i) - m_v3fVect[i].clear() ; - } -} diff --git a/TestEGr.cpp b/TestEGr.cpp index c4a0832..d9326e4 100644 --- a/TestEGr.cpp +++ b/TestEGr.cpp @@ -18,6 +18,7 @@ #include "/EgtDev/Include/EGkDllMain.h" #include "/EgtDev/Include/ENkDllMain.h" #include "/EgtDev/Include/EGnDllMain.h" +#include "/EgtDev/Include/EGrDllMain.h" #include "/EgtDev/Include/EgnGetModuleVer.h" #include "/EgtDev/Include/EGnStringConverter.h" #include "/EgtDev/Include/EgtIniFile.h" @@ -102,6 +103,7 @@ CTestEGrApp::InitInstance( void) LOG_INFO( &logger, GetEGnVersion()) LOG_INFO( &logger, GetENkVersion()) LOG_INFO( &logger, GetEGkVersion()) + LOG_INFO( &logger, GetEGrVersion()) // Dialog interface CTestEGrDlg dlg( &logger) ; diff --git a/TestEGr.rc b/TestEGr.rc index 1c9dc25..9d62818 100644 Binary files a/TestEGr.rc and b/TestEGr.rc differ diff --git a/TestEGr.vcxproj b/TestEGr.vcxproj index 7ff9df1..84dbfe1 100644 --- a/TestEGr.vcxproj +++ b/TestEGr.vcxproj @@ -143,7 +143,7 @@ Level3 Use - MaxSpeed + Full true true WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) @@ -172,7 +172,7 @@ Level3 Use - MaxSpeed + Full true true WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) @@ -209,8 +209,6 @@ - - @@ -218,9 +216,6 @@ - - - Create Create diff --git a/TestEGr.vcxproj.filters b/TestEGr.vcxproj.filters index 65bea75..ddf2e83 100644 --- a/TestEGr.vcxproj.filters +++ b/TestEGr.vcxproj.filters @@ -47,9 +47,6 @@ File di intestazione - - File di intestazione - File di intestazione @@ -65,9 +62,6 @@ File di intestazione - - File di intestazione - @@ -82,15 +76,6 @@ File di origine - - File di origine - - - File di origine - - - File di origine - diff --git a/TestEGrDlg.cpp b/TestEGrDlg.cpp index f272791..750dbb1 100644 --- a/TestEGrDlg.cpp +++ b/TestEGrDlg.cpp @@ -18,7 +18,11 @@ #include "resource.h" #include "/EgtDev/Include/EgtIniFile.h" #include "/EgtDev/Include/EgtILogger.h" -#include "afxdialogex.h" +#include "/EgtDev/Include/EGkDllMain.h" +#include "/EgtDev/Include/EGkGeomDB.h" +#include "/EgtDev/Include/EgtPerfCounter.h" + +using namespace std ; //---------------------------------------------------------------------------- #ifdef _DEBUG @@ -67,6 +71,20 @@ CTestEGrDlg::CTestEGrDlg( ILogger* pLogger, CWnd* pParent) { m_hIcon = AfxGetApp()->LoadIcon( IDR_MAINFRAME) ; m_pLogger = pLogger ; + SetEGkLogger( m_pLogger) ; + m_pGeomDB = CreateGeomDB() ; + if ( m_pGeomDB != nullptr) + m_pGeomDB->Init() ; + else + LOG_ERROR( m_pLogger, "Error in CreateGeomDB") +} + +//---------------------------------------------------------------------------- +CTestEGrDlg::~CTestEGrDlg( void) +{ + if ( m_pGeomDB != nullptr) + delete m_pGeomDB ; + m_pGeomDB = nullptr ; } //---------------------------------------------------------------------------- @@ -76,6 +94,7 @@ BEGIN_MESSAGE_MAP( CTestEGrDlg, CDialog) ON_WM_QUERYDRAGICON() ON_WM_SIZE() ON_WM_CLOSE() + ON_BN_CLICKED( IDC_OPEN, OnFileOpen) ON_CONTROL_RANGE( BN_CLICKED, IDC_ZOOM_ALL, IDC_ZOOM_M, OnZoom) ON_CONTROL_RANGE( BN_CLICKED, IDC_VIEW_TOP, IDC_VIEW_ISO, OnView) ON_BN_CLICKED( IDC_CLOSE, OnClose) @@ -131,7 +150,31 @@ CTestEGrDlg::OnInitDialog( void) // creazione della scena m_View.Create( this, IDC_SCENE) ; - m_View.StartScene( nDriver, b2Buff, nColorBits, nDepthBits, m_pLogger) ; + m_View.StartScene( nDriver, b2Buff, nColorBits, nDepthBits, m_pGeomDB, m_pLogger) ; + + // recupero il posizionamento della finestra del dialogo + string sTmp = GetPrivateProfileStringUtf8( "General", "WinPlace", "", AfxGetApp()->m_pszProfileName) ; + if ( ! sTmp.empty()) { + STRVECTOR vsParams ; + Tokenize( sTmp, ",", vsParams) ; + if ( vsParams.size() == 5) { + int nVal ; + WINDOWPLACEMENT winPlace ; + winPlace.length = sizeof( WINDOWPLACEMENT) ; + winPlace.flags = 0 ; + FromString( vsParams[0], nVal) ; + winPlace.showCmd = (( nVal != 1) ? SW_SHOW : SW_SHOWMAXIMIZED) ; + FromString( vsParams[1], nVal) ; + winPlace.rcNormalPosition.left = nVal ; + FromString( vsParams[2], nVal) ; + winPlace.rcNormalPosition.top = nVal ; + FromString( vsParams[3], nVal) ; + winPlace.rcNormalPosition.right = nVal ; + FromString( vsParams[4], nVal) ; + winPlace.rcNormalPosition.bottom = nVal ; + SetWindowPlacement( &winPlace) ; + } + } return TRUE ; // return TRUE unless you set the focus to a control } @@ -195,6 +238,8 @@ CTestEGrDlg::OnSize( UINT nType, int cx, int cy) // se cambiata dimensione if ( nType == SIZE_RESTORED || nType == SIZE_MAXIMIZED) { // spostamento bottoni + MoveDlgItem( IDC_OPEN, IP_TR, cx, cy) ; + MoveDlgItem( IDC_SEPAR, IP_TR, cx, cy) ; MoveDlgItem( IDC_ZOOM_ALL, IP_TR, cx, cy) ; MoveDlgItem( IDC_ZOOM_P, IP_TR, cx, cy) ; MoveDlgItem( IDC_ZOOM_M, IP_TR, cx, cy) ; @@ -290,11 +335,74 @@ CTestEGrDlg::ReshapeDlgItem( int nID, int nFlag, int nW, int nH) void CTestEGrDlg::OnClose( void) { + // salvo lo stato della finestra del dialogo + WINDOWPLACEMENT winPlace ; + if ( GetWindowPlacement( &winPlace)) { + string sOut ; + sOut = ToString( ( winPlace.showCmd == SW_SHOWMAXIMIZED ? 1 : 0)) + "," + + ToString( winPlace.rcNormalPosition.left) + "," + + ToString( winPlace.rcNormalPosition.top) + "," + + ToString( winPlace.rcNormalPosition.right) + "," + + ToString( winPlace.rcNormalPosition.bottom) ; + WritePrivateProfileStringUtf8( "General", "WinPlace", sOut.c_str(), AfxGetApp()->m_pszProfileName) ; + } + m_View.Destroy() ; EndDialog( IDCLOSE) ; } +//---------------------------------------------------------------------------- +void +CTestEGrDlg::OnFileOpen( void) +{ + // verifico validità DB geometrico + if ( m_pGeomDB == nullptr) { + AfxMessageBox( L"GeomDB invalid error", MB_ICONSTOP|MB_OK) ; + return ; + } + + // visualizzo il dialogo di scelta file + CFileDialog dlg( TRUE, L"*.Nge", NULL, + OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR, + L"New geometry EgalTech (*.Nge) |*.Nge|", NULL, 0, FALSE) ; + + // imposto il direttorio iniziale + wstring wsDir = stringtoW( GetPrivateProfileStringUtf8( "General", "LastNgeDir", "", AfxGetApp()->m_pszProfileName)) ; + if ( ! wsDir.empty()) + dlg.m_ofn.lpstrInitialDir = wsDir.c_str() ; + + // lancio il dialogo di scelta file + if ( dlg.DoModal() != IDOK) + return ; + + // recupero la path del file e ne salvo il direttorio + string sFilePath = WtoA( dlg.GetPathName()) ; + if ( sFilePath.empty()) + return ; + string sFileDir ; + string sFileName ; + SplitLast( sFilePath, "\\", sFileDir, sFileName) ; + if ( ! sFileDir.empty()) + WritePrivateProfileStringUtf8( "General", "LastNgeDir", sFileDir.c_str(), AfxGetApp()->m_pszProfileName) ; + + // inserisco il nome del file nel titolo della finestra + SetWindowText( stringtoW( ( sFileName + " - EgalTech TestEGr"))) ; + + // pulizia e reinizializzazione del DB geometrico + m_pGeomDB->Clear() ; + m_pGeomDB->Init() ; + // carico il file + m_pGeomDB->Load( sFilePath) ; + // visualizzo con zoom all + PerformanceCounter Counter ; + Counter.Start() ; + m_View.Zoom( IDC_ZOOM_ALL) ; + Counter.Stop() ; + string sOut = "First ZoomAll time = " + ToString( Counter.GetTime(), 2) + " ms" ; + GetDlgItem( IDC_INFO)->SetWindowText( stringtoW( sOut)) ; +} + //---------------------------------------------------------------------------- void CTestEGrDlg::OnZoom( UINT nID) diff --git a/TestEGrDlg.h b/TestEGrDlg.h index e1287f9..c468adc 100644 --- a/TestEGrDlg.h +++ b/TestEGrDlg.h @@ -17,12 +17,14 @@ class ILogger ; +class IGeomDB ; //---------------------------------------------------------------------------- class CTestEGrDlg : public CDialog { public : CTestEGrDlg( ILogger* pLogger = nullptr, CWnd* pParent = nullptr) ; + ~CTestEGrDlg( void) ; protected : virtual BOOL OnInitDialog( void) ; @@ -31,6 +33,7 @@ class CTestEGrDlg : public CDialog afx_msg void OnPaint( void) ; afx_msg HCURSOR OnQueryDragIcon( void) ; afx_msg void OnSize( UINT nType, int cx, int cy) ; + afx_msg void OnFileOpen( void) ; afx_msg void OnZoom( UINT nID) ; afx_msg void OnView( UINT nID) ; afx_msg void OnClose( void) ; @@ -47,6 +50,7 @@ class CTestEGrDlg : public CDialog HICON m_hIcon ; TestEgrView m_View ; ILogger* m_pLogger ; + IGeomDB* m_pGeomDB ; int m_nPrevCx ; int m_nPrevCy ; int m_nSideBarW ; diff --git a/TestEGrView.h b/TestEGrView.h index e4c3129..60574c6 100644 --- a/TestEGrView.h +++ b/TestEGrView.h @@ -2,9 +2,12 @@ #pragma once -#include "EGrScene.h" +#include "/EgtDev/Include/EGkPoint3d.h" #include +class IGeomDB ; +class ILogger ; +class IEGrScene ; //---------------------------------------------------------------------------- class TestEgrView : public CWnd @@ -13,7 +16,8 @@ class TestEgrView : public CWnd TestEgrView( void) ; ~TestEgrView( void) ; bool Create( CWnd* pParent, int nID) ; - bool StartScene( int nDriver, bool b2Buff, int nColorBits, int nDepthBits, ILogger* pLogger) ; + bool StartScene( int nDriver, bool b2Buff, int nColorBits, int nDepthBits, + IGeomDB* pGeomDB, ILogger* pLogger) ; void Destroy( void) ; bool Reshape( int nX, int nY, int nW, int nH) ; void Zoom( UINT nID) ; @@ -35,10 +39,10 @@ class TestEgrView : public CWnd enum Status { ST_NULL = 0, ST_PAN, ST_ROT } ; private : - CClientDC* m_pDC ; - EGrScene m_Scene ; - Status m_nStatus ; - CPoint m_PrevPoint ; + CClientDC* m_pDC ; + IEGrScene* m_pScene ; + Status m_nStatus ; + CPoint m_PrevPoint ; DECLARE_MESSAGE_MAP() } ; \ No newline at end of file diff --git a/TestEgrView.cpp b/TestEgrView.cpp index ee7ef1a..dda6af4 100644 --- a/TestEgrView.cpp +++ b/TestEgrView.cpp @@ -18,6 +18,7 @@ #include "/EgtDev/Include/EgtILogger.h" #include "/EgtDev/Include/EgnStringUtils.h" #include "/EgtDev/Include/EgnStringConverter.h" +#include "/EgtDev/Include/EGrScene.h" //---------------------------------------------------------------------------- #ifdef _DEBUG @@ -37,12 +38,17 @@ END_MESSAGE_MAP() TestEgrView::TestEgrView( void) { m_pDC = nullptr ; + m_pScene = nullptr ; m_nStatus = ST_NULL ; + m_PrevPoint.SetPoint( 0, 0) ; } //---------------------------------------------------------------------------- TestEgrView::~TestEgrView( void) { + if ( m_pScene != nullptr) + delete m_pScene ; + m_pScene = nullptr ; if ( m_pDC != nullptr) delete m_pDC ; m_pDC = nullptr ; @@ -66,9 +72,10 @@ TestEgrView::Create( CWnd* pParent, int nID) if ( CreateEx( 0, className, L"TestEgrView", WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, rectWin, pParent, nID) != 0) { SetWindowPos( &wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE) ; - m_pDC = new CClientDC( this) ; SetCursor( AfxGetApp()->LoadCursor( IDC_POINTER)) ; - return true ; + m_pDC = new CClientDC( this) ; + m_pScene = CreateEGrScene() ; + return ( m_pDC != nullptr && m_pScene != nullptr) ; } else return false ; @@ -76,24 +83,24 @@ TestEgrView::Create( CWnd* pParent, int nID) //---------------------------------------------------------------------------- bool -TestEgrView::StartScene( int nDriver, bool b2Buff, int nColorBits, int nDepthBits, ILogger* pLogger) +TestEgrView::StartScene( int nDriver, bool b2Buff, int nColorBits, int nDepthBits, + IGeomDB* pGeomDB, ILogger* pLogger) { - // creazione della scena - m_Scene.Init( pLogger) ; - if ( ! m_Scene.CreateContext( GetSafeHdc(), nDriver, b2Buff, nColorBits, nDepthBits)) + if ( m_pScene == nullptr) return false ; - // impostazione dati geometrie - m_Scene.SetData( 3) ; + // creazione della scena + m_pScene->Init( pGeomDB, pLogger) ; + if ( ! m_pScene->CreateContext( GetSafeHdc(), nDriver, b2Buff, nColorBits, nDepthBits)) + return false ; // impostazione dati di vista - m_Scene.SetCenter( Point3d( 0, 0, 0)) ; - m_Scene.SetCamera( EGrScene::CT_ISO_SW) ; - m_Scene.ZoomAll() ; + m_pScene->SetCamera( CT_ISO_SW) ; + m_pScene->ZoomAll() ; - LOG_INFO( pLogger, m_Scene.GetOpenGLInfo().c_str()) - LOG_INFO( pLogger, m_Scene.GetGLSLInfo().c_str()) - LOG_INFO( pLogger, m_Scene.GetPixelFormatInfo().c_str()) + LOG_INFO( pLogger, m_pScene->GetOpenGLInfo().c_str()) + LOG_INFO( pLogger, m_pScene->GetGLSLInfo().c_str()) + LOG_INFO( pLogger, m_pScene->GetPixelFormatInfo().c_str()) return true ; } @@ -102,8 +109,8 @@ TestEgrView::StartScene( int nDriver, bool b2Buff, int nColorBits, int nDepthBit void TestEgrView::Destroy( void) { - m_Scene.ResetData() ; - m_Scene.Destroy() ; + if ( m_pScene != nullptr) + m_pScene->Destroy() ; DestroyWindow() ; } @@ -112,11 +119,11 @@ bool TestEgrView::Reshape( int nX, int nY, int nW, int nH) { // se non è ancora stata creata, esco subito - if ( m_pDC == nullptr) + if ( m_pDC == nullptr || m_pScene == nullptr) return true ; MoveWindow( nX, nY, nW, nH, FALSE) ; - m_Scene.Reshape( nW, nH) ; + m_pScene->Reshape( nW, nH) ; return true ; } @@ -124,8 +131,11 @@ TestEgrView::Reshape( int nX, int nY, int nW, int nH) void TestEgrView::OnPaint( void) { + if ( m_pScene == nullptr) + return ; + // ridisegno finestra OpenGL - m_Scene.Draw() ; + m_pScene->Draw() ; ValidateRgn( NULL) ; } @@ -133,18 +143,21 @@ TestEgrView::OnPaint( void) void TestEgrView::Zoom( UINT nID) { + if ( m_pScene == nullptr) + return ; + const double COEFF_PLUS = 0.9 ; const double COEFF_MINUS = 1 / COEFF_PLUS ; switch ( nID) { case IDC_ZOOM_ALL : - m_Scene.ZoomAll() ; + m_pScene->ZoomAll() ; break ; case IDC_ZOOM_P : - m_Scene.ZoomChange( COEFF_PLUS) ; + m_pScene->ZoomChange( COEFF_PLUS) ; break ; case IDC_ZOOM_M : - m_Scene.ZoomChange( COEFF_MINUS) ; + m_pScene->ZoomChange( COEFF_MINUS) ; break ; default : return ; @@ -158,24 +171,27 @@ TestEgrView::Zoom( UINT nID) void TestEgrView::View( UINT nID) { + if ( m_pScene == nullptr) + return ; + switch ( nID) { case IDC_VIEW_TOP : - m_Scene.SetCamera( EGrScene::CT_TOP) ; + m_pScene->SetCamera( CT_TOP) ; break ; case IDC_VIEW_FRONT : - m_Scene.SetCamera( EGrScene::CT_FRONT) ; + m_pScene->SetCamera( CT_FRONT) ; break ; case IDC_VIEW_BACK : - m_Scene.SetCamera( EGrScene::CT_BACK) ; + m_pScene->SetCamera( CT_BACK) ; break ; case IDC_VIEW_LEFT : - m_Scene.SetCamera( EGrScene::CT_LEFT) ; + m_pScene->SetCamera( CT_LEFT) ; break ; case IDC_VIEW_RIGHT : - m_Scene.SetCamera( EGrScene::CT_RIGHT) ; + m_pScene->SetCamera( CT_RIGHT) ; break ; case IDC_VIEW_ISO : - m_Scene.SetCamera( EGrScene::CT_ISO_SW) ; + m_pScene->SetCamera( CT_ISO_SW) ; break ; default : return ; @@ -221,7 +237,8 @@ TestEgrView::OnMouseMove( UINT nFlags, CPoint point) if ( m_nStatus == ST_ROT && nFlags & MK_MBUTTON) { SetCursor( AfxGetApp()->LoadCursor( IDC_ROTATE)) ; // eseguo la rotazione - m_Scene.RotateCamera( Point3d( m_PrevPoint.x, m_PrevPoint.y), Point3d( point.x, point.y)) ; + if ( m_pScene != nullptr) + m_pScene->RotateCamera( Point3d( m_PrevPoint.x, m_PrevPoint.y), Point3d( point.x, point.y)) ; // aggiorno il disegno RedrawWindow() ; // salvo il punto di riferimento @@ -231,7 +248,8 @@ TestEgrView::OnMouseMove( UINT nFlags, CPoint point) else if ( m_nStatus == ST_PAN && nFlags & MK_MBUTTON) { SetCursor( AfxGetApp()->LoadCursor( IDC_PAN)) ; // eseguo il pan - m_Scene.PanCamera( Point3d( m_PrevPoint.x, m_PrevPoint.y), Point3d( point.x, point.y)) ; + if ( m_pScene != nullptr) + m_pScene->PanCamera( Point3d( m_PrevPoint.x, m_PrevPoint.y), Point3d( point.x, point.y)) ; // aggiorno il disegno RedrawWindow() ; // salvo il punto di riferimento @@ -257,7 +275,8 @@ TestEgrView::OnMouseWheel( UINT nFlags, short zDelta, CPoint point) ScreenToClient( &point) ; // eseguo lo zoom sul punto - m_Scene.ZoomOnPoint( Point3d( point.x, point.y), dCoeff) ; + if ( m_pScene != nullptr) + m_pScene->ZoomOnPoint( Point3d( point.x, point.y), dCoeff) ; // aggiorno il disegno RedrawWindow() ; @@ -269,24 +288,27 @@ TestEgrView::OnMouseWheel( UINT nFlags, short zDelta, CPoint point) void TestEgrView::ShowCursorCoordinates( const Point3d& ptWin) { + if ( m_pScene == nullptr) + return ; + // trasformo il punto da coordinate view a coordinate mondo - Point3d ptView( ptWin.x, ptWin.y, m_Scene.GetProjectedCenter().z) ; + Point3d ptView( ptWin.x, ptWin.y, m_pScene->GetProjectedCenter().z) ; Point3d ptWorld ; - if ( ! m_Scene.UnProject( ptView, ptWorld)) + if ( ! m_pScene->UnProject( ptView, ptWorld)) return ; // visualizzo le coordinate std::string sCoord ; - switch ( m_Scene.GetCameraDir()) { - case EGrScene::CT_TOP : - case EGrScene::CT_BOTTOM : + switch ( m_pScene->GetCameraDir()) { + case CT_TOP : + case CT_BOTTOM : sCoord = "X=" + ToString( ptWorld.x, 3) + " Y=" + ToString( ptWorld.y, 3) ; break ; - case EGrScene::CT_FRONT : - case EGrScene::CT_BACK : + case CT_FRONT : + case CT_BACK : sCoord = "X=" + ToString( ptWorld.x, 3) + " Z=" + ToString( ptWorld.z, 3) ; break ; - case EGrScene::CT_LEFT : - case EGrScene::CT_RIGHT : + case CT_LEFT : + case CT_RIGHT : sCoord = "Y=" + ToString( ptWorld.y, 3) + " Z=" + ToString( ptWorld.z, 3) ; break ; default : diff --git a/resource.h b/resource.h index df52e43..31cdb28 100644 Binary files a/resource.h and b/resource.h differ diff --git a/stdafx.h b/stdafx.h index 2faedf6..221cb41 100644 --- a/stdafx.h +++ b/stdafx.h @@ -23,11 +23,8 @@ #include // MFC core and standard components #include // MFC extensions - #include // MFC Automation classes - - #ifndef _AFX_NO_OLE_SUPPORT #include // MFC support for Internet Explorer 4 Common Controls #endif @@ -39,16 +36,10 @@ #include "/EgtDev/Include/EgtLibVer.h" -#pragma comment(lib, "opengl32.lib") -#pragma comment(lib, "glu32.lib") -#if defined( _WIN64) -#pragma comment(lib, EGTEXTDIR "GLEW/lib/x64/glew32mx.lib") -#elif defined( _WIN32) -#pragma comment(lib, EGTEXTDIR "GLEW/lib/x32/glew32mx.lib") -#endif #pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib") #pragma comment(lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib") #pragma comment(lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib") +#pragma comment(lib, EGTLIBDIR "EgtGraphics" EGTLIBVER ".lib") #ifdef _UNICODE #if defined _M_IX86