EgtGraphics 1.5c3 :
- aggiunta visualizzaziono di punti, vettori e frame - aggiunti NewGrAtom per gestione potenziata e con colori di VAO/VBO - aggiunti OldGrAtom per displaylist proprietarie in modo OpenGL immediato.
This commit is contained in:
+58
-13
@@ -15,11 +15,13 @@
|
||||
#include "stdafx.h"
|
||||
#include "ObjOldGraphics.h"
|
||||
#include "OpenGL.h"
|
||||
#include "/EgtDev/Include/EGkColor.h"
|
||||
#include "/EgtDev/Include/EGkPolyLine.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ObjOldGraphics::~ObjOldGraphics( void)
|
||||
{
|
||||
m_v3fList.clear() ;
|
||||
Clear() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -29,19 +31,51 @@ ObjOldGraphics::Reset( void)
|
||||
m_bValid = false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
ObjOldGraphics::Clear( void)
|
||||
{
|
||||
m_ogaList.clear() ;
|
||||
m_bValid = false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjOldGraphics::AddColor( const Color& colC)
|
||||
{
|
||||
return AddColor( colC.GetRed(), colC.GetGreen(), colC.GetBlue(), colC.GetAlpha()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjOldGraphics::AddPoint( const Point3d& ptP)
|
||||
{
|
||||
// start
|
||||
AddStart( GL_POINTS) ;
|
||||
// inserisco il nuovo vertice
|
||||
AddVert3f( ptP.x, ptP.y, ptP.z) ;
|
||||
// fine
|
||||
AddEnd() ;
|
||||
// dichiaro valida la grafica
|
||||
m_bValid = true ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
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 ;
|
||||
// start
|
||||
AddStart( 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)) ;
|
||||
AddVert3f( ptP.x, ptP.y, ptP.z) ;
|
||||
// fine
|
||||
AddEnd() ;
|
||||
// dichiaro valida la grafica
|
||||
m_bValid = true ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -51,16 +85,27 @@ bool
|
||||
ObjOldGraphics::Draw( void)
|
||||
{
|
||||
// se vuoto non faccio alcunché
|
||||
if ( m_v3fList.size() == 0)
|
||||
if ( m_ogaList.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) ;
|
||||
OGALIST::iterator iIter ;
|
||||
for ( iIter = m_ogaList.begin() ; iIter != m_ogaList.end() ; ++ iIter) {
|
||||
switch ( iIter->m_nType) {
|
||||
case OldGrAtom::START :
|
||||
glBegin( iIter->m_nMode) ;
|
||||
break ;
|
||||
case OldGrAtom::VERT :
|
||||
glVertex3f( iIter->m_fX, iIter->m_fY, iIter->m_fZ) ;
|
||||
break ;
|
||||
case OldGrAtom::COLOR :
|
||||
glColor4f( iIter->m_fRed, iIter->m_fGreen, iIter->m_fBlue, iIter->m_fAlpha) ;
|
||||
break ;
|
||||
case OldGrAtom::END :
|
||||
glEnd() ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
glEnd() ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user