EgtGraphics 1.5b2 :
- aggiunta gestione ObjNewGraphics e ObjOldGraphics.
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ObjOldGraphics.cpp Data : 10.02.14 Versione : 1.5b1
|
||||
// Contenuto : Implementazione della classe grafica di un oggetto geometrico.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 10.02.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "ObjOldGraphics.h"
|
||||
#include "OpenGL.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ObjOldGraphics::~ObjOldGraphics( void)
|
||||
{
|
||||
m_v3fList.clear() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
ObjOldGraphics::Invalidate( void)
|
||||
{
|
||||
m_bValid = false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjOldGraphics::AddPolyLine( const PolyLine& PL)
|
||||
{
|
||||
// cancello eventuali vecchi vertici
|
||||
m_v3fList.clear() ;
|
||||
// imposto il nuovo stato
|
||||
m_bValid = true ;
|
||||
m_nMode = GL_LINE_STRIP ;
|
||||
// inserisco i nuovi vertici
|
||||
Point3d ptP ;
|
||||
for ( bool bFound = PL.GetFirstPoint( ptP) ; bFound ; bFound = PL.GetNextPoint( ptP))
|
||||
m_v3fList.push_back( Vert3f( (float)ptP.x, (float)ptP.y, (float)ptP.z)) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjOldGraphics::Draw( void)
|
||||
{
|
||||
// se vuoto non faccio alcunché
|
||||
if ( m_v3fList.size() == 0)
|
||||
return true ;
|
||||
|
||||
// ciclo di disegno
|
||||
glBegin( m_nMode) ;
|
||||
V3FLIST::iterator iIter ;
|
||||
for ( iIter = m_v3fList.begin() ; iIter != m_v3fList.end() ; ++ iIter) {
|
||||
glVertex3f( iIter->x, iIter->y, iIter->z) ;
|
||||
}
|
||||
glEnd() ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
Reference in New Issue
Block a user