3e0e4e55a2
- aggiunta gestione ObjNewGraphics e ObjOldGraphics.
67 lines
1.9 KiB
C++
67 lines
1.9 KiB
C++
//----------------------------------------------------------------------------
|
|
// 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 ;
|
|
}
|