Merge commit '00a81d6e0461bcb1ad8cab1b0fd81ba14de55ef0' into Cube
This commit is contained in:
Binary file not shown.
+3
-2
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
// EgalTech 2014-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ObjEGrGraphics.h Data : 13.02.14 Versione : 1.5b2
|
||||
// File : ObjEGrGraphics.h Data : 08.07.23 Versione : 2.5g1
|
||||
// Contenuto : Dichiarazione della classe grafica di un oggetto geometrico.
|
||||
//
|
||||
//
|
||||
@@ -37,6 +37,7 @@ class ObjEGrGraphics : public IObjGraphics
|
||||
virtual bool AddMaterial( const Color& colAmb, const Color& colDiff,
|
||||
const Color& colSpec, float fShin) = 0 ;
|
||||
virtual bool AddBackMaterial( const Color& colAmbDiff) = 0 ;
|
||||
virtual bool AddLineStipple( int nFactor, int nPattern) = 0 ;
|
||||
virtual bool AddPoint( const Point3d& ptP, bool bAux = false) = 0 ;
|
||||
virtual bool AddPoints( const PNTVECTOR& vPnt, bool bAux = false) = 0 ;
|
||||
virtual bool AddLines( const PNTVECTOR& vPnt, bool bAux = false) = 0 ;
|
||||
|
||||
@@ -106,6 +106,15 @@ ObjMultiGraphics::AddBackMaterial( const Color& colAmbDiff)
|
||||
return m_vOEGR[m_nCurr]->AddBackMaterial( colAmbDiff) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjMultiGraphics::AddLineStipple( int nFactor, int nPattern)
|
||||
{
|
||||
if ( m_nCurr < 0 || m_nCurr >= int( m_vOEGR.size()))
|
||||
return false ;
|
||||
return m_vOEGR[m_nCurr]->AddLineStipple( nFactor, nPattern) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjMultiGraphics::AddPoint( const Point3d& ptP, bool bAux)
|
||||
|
||||
@@ -36,6 +36,7 @@ class ObjMultiGraphics : public ObjEGrGraphics
|
||||
bool AddMaterial( const Color& colAmb, const Color& colDiff,
|
||||
const Color& colSpec, float fShin) override ;
|
||||
bool AddBackMaterial( const Color& colAmbDiff) override ;
|
||||
bool AddLineStipple( int nFactor, int nPattern) override ;
|
||||
bool AddPoint( const Point3d& ptP, bool bAux = false) override ;
|
||||
bool AddPoints( const PNTVECTOR& vPnt, bool bAux = false) override ;
|
||||
bool AddLines( const PNTVECTOR& vPnt, bool bAux = false) override ;
|
||||
|
||||
+87
-47
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
// EgalTech 2014-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ObjNewGraphics.cpp Data : 23.04.14 Versione : 1.5d5
|
||||
// File : ObjNewGraphics.cpp Data : 08.07.23 Versione : 2.5g1
|
||||
// Contenuto : Implementazione della classe grafica di un oggetto geometrico.
|
||||
//
|
||||
//
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "/EgtDev/Include/EGkPolyLine.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkTriangle3d.h"
|
||||
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
|
||||
//--------------------------- Macro e Costanti -------------------------------
|
||||
// Dimensioni flag per edge di triangoli
|
||||
@@ -27,6 +27,7 @@ const size_t SIZEFLAG = sizeof( unsigned char) ;
|
||||
// Dimensioni record del buffer ( vertice + normale + flag)
|
||||
const size_t SIZEVNF = ( 2 * SIZEV3F + SIZEFLAG) ;
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ObjNewGraphics::~ObjNewGraphics( void)
|
||||
{
|
||||
@@ -55,7 +56,7 @@ ObjNewGraphics::Clear( void)
|
||||
bool
|
||||
ObjNewGraphics::AddColor( const Color& colC)
|
||||
{
|
||||
return AddColor( colC.GetRed(), colC.GetGreen(), colC.GetBlue(), colC.GetAlpha()) ;
|
||||
return AddNgaColor( colC.GetRed(), colC.GetGreen(), colC.GetBlue(), colC.GetAlpha()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -63,21 +64,28 @@ bool
|
||||
ObjNewGraphics::AddMaterial( const Color& colAmb, const Color& colDiff,
|
||||
const Color& colSpec, float fShin)
|
||||
{
|
||||
return AddMaterial( NgAtom::MAT_A, colAmb.GetRed(), colAmb.GetGreen(),
|
||||
colAmb.GetBlue(), colDiff.GetAlpha()) &&
|
||||
AddMaterial( NgAtom::MAT_D, colDiff.GetRed(), colDiff.GetGreen(),
|
||||
colDiff.GetBlue(), colDiff.GetAlpha()) &&
|
||||
AddMaterial( NgAtom::MAT_S, colSpec.GetRed(), colSpec.GetGreen(),
|
||||
colSpec.GetBlue(), colDiff.GetAlpha()) &&
|
||||
AddMaterial( NgAtom::MAT_SH, fShin, 0, 0, 0) ;
|
||||
return AddNgaMaterial( NgAtom::MAT_A, colAmb.GetRed(), colAmb.GetGreen(),
|
||||
colAmb.GetBlue(), colDiff.GetAlpha()) &&
|
||||
AddNgaMaterial( NgAtom::MAT_D, colDiff.GetRed(), colDiff.GetGreen(),
|
||||
colDiff.GetBlue(), colDiff.GetAlpha()) &&
|
||||
AddNgaMaterial( NgAtom::MAT_S, colSpec.GetRed(), colSpec.GetGreen(),
|
||||
colSpec.GetBlue(), colDiff.GetAlpha()) &&
|
||||
AddNgaMaterial( NgAtom::MAT_SH, fShin, 0, 0, 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjNewGraphics::AddBackMaterial( const Color& colAmbDiff)
|
||||
{
|
||||
return AddMaterial( NgAtom::MAT_B, colAmbDiff.GetRed(), colAmbDiff.GetGreen(),
|
||||
colAmbDiff.GetBlue(), colAmbDiff.GetAlpha()) ;
|
||||
return AddNgaMaterial( NgAtom::MAT_B, colAmbDiff.GetRed(), colAmbDiff.GetGreen(),
|
||||
colAmbDiff.GetBlue(), colAmbDiff.GetAlpha()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjNewGraphics::AddLineStipple( int nFactor, int nPattern)
|
||||
{
|
||||
return AddNgaLineStipple( nFactor, nPattern) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -109,7 +117,7 @@ ObjNewGraphics::AddPoint( const Point3d& ptP, bool bAux)
|
||||
glEnableClientState( GL_VERTEX_ARRAY) ;
|
||||
glBindVertexArray( 0) ;
|
||||
// aggiungo i dati in lista
|
||||
AddVerts( GL_POINTS, nCount, nVaoId, nVboId, bAux) ;
|
||||
AddNgaVerts( GL_POINTS, nCount, nVaoId, nVboId, bAux) ;
|
||||
// dichiaro valida la grafica
|
||||
m_bValid = true ;
|
||||
|
||||
@@ -148,7 +156,7 @@ ObjNewGraphics::AddPoints( const PNTVECTOR& vPnt, bool bAux)
|
||||
glEnableClientState( GL_VERTEX_ARRAY) ;
|
||||
glBindVertexArray( 0) ;
|
||||
// aggiungo i dati in lista
|
||||
AddVerts( GL_POINTS, nCount, nVaoId, nVboId, bAux) ;
|
||||
AddNgaVerts( GL_POINTS, nCount, nVaoId, nVboId, bAux) ;
|
||||
// dichiaro valida la grafica
|
||||
m_bValid = true ;
|
||||
|
||||
@@ -187,7 +195,7 @@ ObjNewGraphics::AddLines( const PNTVECTOR& vPnt, bool bAux)
|
||||
glEnableClientState( GL_VERTEX_ARRAY) ;
|
||||
glBindVertexArray( 0) ;
|
||||
// aggiungo i dati in lista
|
||||
AddVerts( GL_LINES, nCount, nVaoId, nVboId, bAux) ;
|
||||
AddNgaVerts( GL_LINES, nCount, nVaoId, nVboId, bAux) ;
|
||||
// dichiaro valida la grafica
|
||||
m_bValid = true ;
|
||||
|
||||
@@ -228,7 +236,7 @@ ObjNewGraphics::AddPolyLine( const PolyLine& PL, bool bAux)
|
||||
glEnableClientState( GL_VERTEX_ARRAY) ;
|
||||
glBindVertexArray( 0) ;
|
||||
// aggiungo i dati in lista
|
||||
AddVerts( GL_LINE_STRIP, nCount, nVaoId, nVboId, bAux) ;
|
||||
AddNgaVerts( GL_LINE_STRIP, nCount, nVaoId, nVboId, bAux) ;
|
||||
// dichiaro valida la grafica
|
||||
m_bValid = true ;
|
||||
|
||||
@@ -261,7 +269,7 @@ ObjNewGraphics::StartTriangles( int nNum, bool bAux)
|
||||
// NumTria * 3 * dimensione( vertice+normale+flag)
|
||||
glBufferData( GL_ARRAY_BUFFER, nNum * 3 * SIZEVNF, NULL, GL_STATIC_DRAW) ;
|
||||
// aggiungo i dati in lista
|
||||
AddVerts( GL_TRIANGLES, 0, nVaoId, nVboId, bAux) ;
|
||||
AddNgaVerts( GL_TRIANGLES, 0, nVaoId, nVboId, bAux) ;
|
||||
// dichiaro modo triangoli
|
||||
m_nCurrMode = GL_TRIANGLES ;
|
||||
return true ;
|
||||
@@ -329,8 +337,8 @@ ObjNewGraphics::EndTriangles( void)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static float*
|
||||
AdjustColor( float fCol[4], bool bDark)
|
||||
static const float*
|
||||
AdjustColor( const float fCol[4], bool bDark)
|
||||
{
|
||||
if ( ! bDark) {
|
||||
return fCol ;
|
||||
@@ -399,42 +407,58 @@ ObjNewGraphics::Draw( int nStat, int nMark, bool bSurfSha, bool bSurf, int nAlph
|
||||
}
|
||||
|
||||
// ciclo di disegno
|
||||
for ( auto iIter = m_ngaVect.begin() ; iIter != m_ngaVect.end() ; ++ iIter) {
|
||||
switch ( iIter->m_nType) {
|
||||
bool bLineStipple = false ;
|
||||
for ( const auto& Nga : m_ngaVect) {
|
||||
switch ( Nga.m_nType) {
|
||||
case NgAtom::VERTS :
|
||||
if ( iIter->m_nCount > 0 && iIter->m_nVaoId != 0) {
|
||||
glBindVertexArray( iIter->m_nVaoId) ;
|
||||
glDrawArrays( iIter->m_nMode, 0, iIter->m_nCount) ;
|
||||
if ( Nga.m_nCount > 0 && Nga.m_nVaoId != 0) {
|
||||
glBindVertexArray( Nga.m_nVaoId) ;
|
||||
glDrawArrays( Nga.m_nMode, 0, Nga.m_nCount) ;
|
||||
glBindVertexArray( 0) ;
|
||||
}
|
||||
break ;
|
||||
case NgAtom::VERTS_A :
|
||||
if ( bShowAux && iIter->m_nCount > 0 && iIter->m_nVaoId != 0) {
|
||||
glBindVertexArray( iIter->m_nVaoId) ;
|
||||
glDrawArrays( iIter->m_nMode, 0, iIter->m_nCount) ;
|
||||
if ( bShowAux && Nga.m_nCount > 0 && Nga.m_nVaoId != 0) {
|
||||
glBindVertexArray( Nga.m_nVaoId) ;
|
||||
glDrawArrays( Nga.m_nMode, 0, Nga.m_nCount) ;
|
||||
glBindVertexArray( 0) ;
|
||||
}
|
||||
break ;
|
||||
case NgAtom::COLOR :
|
||||
glColor4fv( ( bStdCol ? AdjustColor( iIter->m_fCol, bDark) : fSelMarkCol)) ;
|
||||
glColor4fv( ( bStdCol ? AdjustColor( Nga.m_fCol, bDark) : fSelMarkCol)) ;
|
||||
break ;
|
||||
case NgAtom::MAT_A :
|
||||
glMaterialfv( GL_FRONT, GL_AMBIENT, ( bStdCol ? iIter->m_fCol : fSelMarkCol)) ;
|
||||
glMaterialfv( GL_FRONT, GL_AMBIENT, ( bStdCol ? Nga.m_fCol : fSelMarkCol)) ;
|
||||
break ;
|
||||
case NgAtom::MAT_D :
|
||||
glMaterialfv( GL_FRONT, GL_DIFFUSE, ( bStdCol ? iIter->m_fCol : fSelMarkCol)) ;
|
||||
glMaterialfv( GL_FRONT, GL_DIFFUSE, ( bStdCol ? Nga.m_fCol : fSelMarkCol)) ;
|
||||
break ;
|
||||
case NgAtom::MAT_S :
|
||||
glMaterialfv( GL_FRONT, GL_SPECULAR, ( bStdCol ? iIter->m_fCol : fSelMarkCol)) ;
|
||||
glMaterialfv( GL_FRONT, GL_SPECULAR, ( bStdCol ? Nga.m_fCol : fSelMarkCol)) ;
|
||||
break ;
|
||||
case NgAtom::MAT_SH :
|
||||
glMaterialf( GL_FRONT, GL_SHININESS, iIter->m_fCol[0]) ;
|
||||
glMaterialf( GL_FRONT, GL_SHININESS, Nga.m_fCol[0]) ;
|
||||
break ;
|
||||
case NgAtom::MAT_B :
|
||||
glMaterialfv( GL_BACK, GL_AMBIENT_AND_DIFFUSE, ( bStdCol ? iIter->m_fCol : fSelMarkBackCol)) ;
|
||||
glMaterialfv( GL_BACK, GL_AMBIENT_AND_DIFFUSE, ( bStdCol ? Nga.m_fCol : fSelMarkBackCol)) ;
|
||||
break ;
|
||||
case NgAtom::LINE_STIPPLE :
|
||||
if ( Nga.m_nMode > 0) {
|
||||
bLineStipple = true ;
|
||||
glLineStipple( Clamp( Nga.m_nFactor, 1, 256), Clamp( Nga.m_nPattern, 0, 65535)) ;
|
||||
glEnable( GL_LINE_STIPPLE) ;
|
||||
}
|
||||
else {
|
||||
bLineStipple = false ;
|
||||
glDisable( GL_LINE_STIPPLE) ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if ( bLineStipple) {
|
||||
bLineStipple = false ;
|
||||
glDisable( GL_LINE_STIPPLE) ;
|
||||
}
|
||||
|
||||
// se marcato e non superficie in shading, disegno halo
|
||||
if ( nMark == GDB_MK_ON && ! bSurfSha) {
|
||||
@@ -450,25 +474,41 @@ ObjNewGraphics::Draw( int nStat, int nMark, bool bSurfSha, bool bSurf, int nAlph
|
||||
glColor4f( colMark.GetRed(), colMark.GetGreen(), colMark.GetBlue(), colMark.GetAlpha()) ;
|
||||
|
||||
// ciclo di disegno
|
||||
for ( auto iIter = m_ngaVect.begin() ; iIter != m_ngaVect.end() ; ++ iIter) {
|
||||
switch ( iIter->m_nType) {
|
||||
bool bLineStipple = false ;
|
||||
for ( const auto& Nga : m_ngaVect) {
|
||||
switch ( Nga.m_nType) {
|
||||
case NgAtom::VERTS :
|
||||
if ( iIter->m_nCount > 0 && iIter->m_nVaoId != 0) {
|
||||
glBindVertexArray( iIter->m_nVaoId) ;
|
||||
glDrawArrays( iIter->m_nMode, 0, iIter->m_nCount) ;
|
||||
if ( Nga.m_nCount > 0 && Nga.m_nVaoId != 0) {
|
||||
glBindVertexArray( Nga.m_nVaoId) ;
|
||||
glDrawArrays( Nga.m_nMode, 0, Nga.m_nCount) ;
|
||||
glBindVertexArray( 0) ;
|
||||
}
|
||||
break ;
|
||||
case NgAtom::VERTS_A :
|
||||
if ( bShowAux && iIter->m_nCount > 0 && iIter->m_nVaoId != 0) {
|
||||
glBindVertexArray( iIter->m_nVaoId) ;
|
||||
glDrawArrays( iIter->m_nMode, 0, iIter->m_nCount) ;
|
||||
if ( bShowAux && Nga.m_nCount > 0 && Nga.m_nVaoId != 0) {
|
||||
glBindVertexArray( Nga.m_nVaoId) ;
|
||||
glDrawArrays( Nga.m_nMode, 0, Nga.m_nCount) ;
|
||||
glBindVertexArray( 0) ;
|
||||
}
|
||||
break ;
|
||||
// non si impostano i colori, si usa quello di marcatura
|
||||
case NgAtom::LINE_STIPPLE :
|
||||
if ( Nga.m_nMode > 0) {
|
||||
bLineStipple = true ;
|
||||
glLineStipple( Clamp( Nga.m_nFactor, 1, 256), Clamp( Nga.m_nPattern, 0, 65535)) ;
|
||||
glEnable( GL_LINE_STIPPLE) ;
|
||||
}
|
||||
else {
|
||||
bLineStipple = false ;
|
||||
glDisable( GL_LINE_STIPPLE) ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if ( bLineStipple) {
|
||||
bLineStipple = false ;
|
||||
glDisable( GL_LINE_STIPPLE) ;
|
||||
}
|
||||
// ripristino test di depth
|
||||
glDepthFunc( GL_LEQUAL) ;
|
||||
}
|
||||
@@ -490,13 +530,13 @@ ObjNewGraphics::DeleteVaoVbo( void)
|
||||
return false ;
|
||||
|
||||
// ciclo di cancellazione VAO/VBO
|
||||
for ( auto iIter = m_ngaVect.begin() ; iIter != m_ngaVect.end() ; ++ iIter) {
|
||||
if ( iIter->m_nType == NgAtom::VERTS && iIter->m_nCount > 0) {
|
||||
for ( auto& Nga : m_ngaVect) {
|
||||
if ( Nga.m_nType == NgAtom::VERTS && Nga.m_nCount > 0) {
|
||||
glBindBuffer( GL_ARRAY_BUFFER, 0) ;
|
||||
glDeleteBuffers( 1, &iIter->m_nVboId) ;
|
||||
glDeleteBuffers( 1, &Nga.m_nVboId) ;
|
||||
glBindVertexArray( 0) ;
|
||||
glDeleteVertexArrays( 1, &iIter->m_nVaoId) ;
|
||||
iIter->m_nCount = 0 ;
|
||||
glDeleteVertexArrays( 1, &Nga.m_nVaoId) ;
|
||||
Nga.m_nCount = 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-4
@@ -24,7 +24,7 @@ class NgAtom {
|
||||
|
||||
public :
|
||||
enum GrType { NONE = 0, VERTS = 1, VERTS_A = 2, COLOR = 3,
|
||||
MAT_A = 4, MAT_D = 5, MAT_S = 6, MAT_SH = 7, MAT_B = 8} ;
|
||||
MAT_A = 4, MAT_D = 5, MAT_S = 6, MAT_SH = 7, MAT_B = 8, LINE_STIPPLE = 9} ;
|
||||
|
||||
public :
|
||||
GrType m_nType ;
|
||||
@@ -42,6 +42,10 @@ class NgAtom {
|
||||
float m_fAlpha ;
|
||||
} ;
|
||||
float m_fCol[4] ;
|
||||
struct {
|
||||
int m_nFactor ;
|
||||
int m_nPattern ;
|
||||
} ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
@@ -70,6 +74,7 @@ class ObjNewGraphics : public ObjEGrGraphics
|
||||
bool AddMaterial( const Color& colAmb, const Color& colDiff,
|
||||
const Color& colSpec, float fShin) override ;
|
||||
bool AddBackMaterial( const Color& colAmbDiff) override ;
|
||||
bool AddLineStipple( int nFactor, int nPattern) override ;
|
||||
bool AddPoint( const Point3d& ptP, bool bAux = false) override ;
|
||||
bool AddPoints( const PNTVECTOR& vPnt, bool bAux = false) override ;
|
||||
bool AddLines( const PNTVECTOR& vPnt, bool bAux = false) override ;
|
||||
@@ -92,22 +97,28 @@ class ObjNewGraphics : public ObjEGrGraphics
|
||||
{ try { m_ngaVect.push_back( nga) ; }
|
||||
catch(...) { return false ; }
|
||||
return true ; }
|
||||
bool AddVerts( int nMode, int nCount, unsigned int nVaoId, unsigned int nVboId, bool bAux = false)
|
||||
bool AddNgaVerts( int nMode, int nCount, unsigned int nVaoId, unsigned int nVboId, bool bAux = false)
|
||||
{ NgAtom nga ;
|
||||
nga.m_nType = ( bAux ? NgAtom::VERTS_A : NgAtom::VERTS) ;
|
||||
nga.m_nMode = nMode ; nga.m_nCount = nCount ;
|
||||
nga.m_nVaoId = nVaoId ; nga.m_nVboId = nVboId ;
|
||||
return AddNgAtom( nga) ; }
|
||||
bool AddColor( float fRed, float fGreen, float fBlue, float fAlpha = 1)
|
||||
bool AddNgaColor( float fRed, float fGreen, float fBlue, float fAlpha = 1)
|
||||
{ NgAtom nga ;
|
||||
nga.m_nType = NgAtom::COLOR ;
|
||||
nga.m_fRed = fRed ; nga.m_fGreen = fGreen ; nga.m_fBlue = fBlue ; nga.m_fAlpha = fAlpha ;
|
||||
return AddNgAtom( nga) ; }
|
||||
bool AddMaterial( NgAtom::GrType nMat, float fRed, float fGreen, float fBlue, float fAlpha = 1)
|
||||
bool AddNgaMaterial( NgAtom::GrType nMat, float fRed, float fGreen, float fBlue, float fAlpha = 1)
|
||||
{ NgAtom nga ;
|
||||
nga.m_nType = nMat ;
|
||||
nga.m_fRed = fRed ; nga.m_fGreen = fGreen ; nga.m_fBlue = fBlue ; nga.m_fAlpha = fAlpha ;
|
||||
return AddNgAtom( nga) ; }
|
||||
bool AddNgaLineStipple( int nFactor, int nPattern)
|
||||
{ NgAtom nga ;
|
||||
nga.m_nType = NgAtom::LINE_STIPPLE ;
|
||||
nga.m_nFactor = nFactor ;
|
||||
nga.m_nPattern = nPattern ;
|
||||
return AddNgAtom( nga) ; }
|
||||
|
||||
private :
|
||||
Scene* m_pScene ; // puntatore alla scena
|
||||
|
||||
+91
-51
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
// EgalTech 2014-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ObjOldGraphics.cpp Data : 23.04.14 Versione : 1.5d5
|
||||
// File : ObjOldGraphics.cpp Data : 08.07.23 Versione : 2.5g1
|
||||
// Contenuto : Implementazione della classe grafica di un oggetto geometrico.
|
||||
//
|
||||
//
|
||||
@@ -19,8 +19,9 @@
|
||||
#include "/EgtDev/Include/EGkPolyLine.h"
|
||||
#include "/EgtDev/Include/EGkGdbConst.h"
|
||||
#include "/EgtDev/Include/EGkTriangle3d.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//--------------------------- Macro e Costanti -------------------------------
|
||||
const int VECT_HEAP = 20 ;
|
||||
|
||||
|
||||
@@ -51,7 +52,7 @@ ObjOldGraphics::Clear( void)
|
||||
bool
|
||||
ObjOldGraphics::AddColor( const Color& colC)
|
||||
{
|
||||
return AddColor( colC.GetRed(), colC.GetGreen(), colC.GetBlue(), colC.GetAlpha()) ;
|
||||
return AddOgaColor( colC.GetRed(), colC.GetGreen(), colC.GetBlue(), colC.GetAlpha()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -59,21 +60,28 @@ bool
|
||||
ObjOldGraphics::AddMaterial( const Color& colAmb, const Color& colDiff,
|
||||
const Color& colSpec, float fShin)
|
||||
{
|
||||
return AddMaterial( OgAtom::MAT_A, colAmb.GetRed(), colAmb.GetGreen(),
|
||||
colAmb.GetBlue(), colDiff.GetAlpha()) &&
|
||||
AddMaterial( OgAtom::MAT_D, colDiff.GetRed(), colDiff.GetGreen(),
|
||||
colDiff.GetBlue(), colDiff.GetAlpha()) &&
|
||||
AddMaterial( OgAtom::MAT_S, colSpec.GetRed(), colSpec.GetGreen(),
|
||||
colSpec.GetBlue(), colDiff.GetAlpha()) &&
|
||||
AddMaterial( OgAtom::MAT_SH, fShin, 0, 0, 0) ;
|
||||
return AddOgaMaterial( OgAtom::MAT_A, colAmb.GetRed(), colAmb.GetGreen(),
|
||||
colAmb.GetBlue(), colDiff.GetAlpha()) &&
|
||||
AddOgaMaterial( OgAtom::MAT_D, colDiff.GetRed(), colDiff.GetGreen(),
|
||||
colDiff.GetBlue(), colDiff.GetAlpha()) &&
|
||||
AddOgaMaterial( OgAtom::MAT_S, colSpec.GetRed(), colSpec.GetGreen(),
|
||||
colSpec.GetBlue(), colDiff.GetAlpha()) &&
|
||||
AddOgaMaterial( OgAtom::MAT_SH, fShin, 0, 0, 0) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjOldGraphics::AddBackMaterial( const Color& colAmbDiff)
|
||||
{
|
||||
return AddMaterial( OgAtom::MAT_B, colAmbDiff.GetRed(), colAmbDiff.GetGreen(),
|
||||
colAmbDiff.GetBlue(), colAmbDiff.GetAlpha()) ;
|
||||
return AddOgaMaterial( OgAtom::MAT_B, colAmbDiff.GetRed(), colAmbDiff.GetGreen(),
|
||||
colAmbDiff.GetBlue(), colAmbDiff.GetAlpha()) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ObjOldGraphics::AddLineStipple( int nFactor, int nPattern)
|
||||
{
|
||||
return AddOgaLineStipple( nFactor, nPattern) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -84,13 +92,13 @@ ObjOldGraphics::AddPoint( const Point3d& ptP, bool bAux)
|
||||
if ( m_nCurrMode != GL_NONE)
|
||||
return false ;
|
||||
// start
|
||||
AddStart( GL_POINTS, bAux) ;
|
||||
AddOgaStart( GL_POINTS, bAux) ;
|
||||
// inserisco il nuovo vertice
|
||||
AddVert3f( ptP) ;
|
||||
AddOgaVert3f( ptP) ;
|
||||
// aggiorno bbox
|
||||
m_b3Loc.Add( ptP) ;
|
||||
// fine
|
||||
AddEnd() ;
|
||||
AddOgaEnd() ;
|
||||
// dichiaro valida la grafica
|
||||
m_bValid = true ;
|
||||
|
||||
@@ -105,14 +113,14 @@ ObjOldGraphics::AddPoints( const PNTVECTOR& vPnt, bool bAux)
|
||||
if ( m_nCurrMode != GL_NONE)
|
||||
return false ;
|
||||
// start
|
||||
AddStart( GL_POINTS, bAux) ;
|
||||
AddOgaStart( GL_POINTS, bAux) ;
|
||||
// inserisco i vertici + aggiorno bbox
|
||||
for ( int i = 0 ; i < int( vPnt.size()) ; ++ i) {
|
||||
AddVert3f( vPnt[i]) ;
|
||||
AddOgaVert3f( vPnt[i]) ;
|
||||
m_b3Loc.Add( vPnt[i]) ;
|
||||
}
|
||||
// fine
|
||||
AddEnd() ;
|
||||
AddOgaEnd() ;
|
||||
// dichiaro valida la grafica
|
||||
m_bValid = true ;
|
||||
|
||||
@@ -129,14 +137,14 @@ ObjOldGraphics::AddLines( const PNTVECTOR& vPnt, bool bAux)
|
||||
// riservo memoria per vettore
|
||||
m_ogaVect.reserve( VECT_HEAP + vPnt.size()) ;
|
||||
// start
|
||||
AddStart( GL_LINES, bAux) ;
|
||||
AddOgaStart( GL_LINES, bAux) ;
|
||||
// inserisco i vertici + aggiorno bbox
|
||||
for ( int i = 0 ; i < int( vPnt.size()) ; ++ i) {
|
||||
AddVert3f( vPnt[i]) ;
|
||||
AddOgaVert3f( vPnt[i]) ;
|
||||
m_b3Loc.Add( vPnt[i]) ;
|
||||
}
|
||||
// fine
|
||||
AddEnd() ;
|
||||
AddOgaEnd() ;
|
||||
// dichiaro valida la grafica
|
||||
m_bValid = true ;
|
||||
|
||||
@@ -153,15 +161,15 @@ ObjOldGraphics::AddPolyLine( const PolyLine& PL, bool bAux)
|
||||
// riservo memoria per vettore
|
||||
m_ogaVect.reserve( VECT_HEAP + PL.GetPointNbr()) ;
|
||||
// start
|
||||
AddStart( GL_LINE_STRIP, bAux) ;
|
||||
AddOgaStart( GL_LINE_STRIP, bAux) ;
|
||||
// inserisco i nuovi vertici + aggiorno bbox
|
||||
Point3d ptP ;
|
||||
for ( bool bFound = PL.GetFirstPoint( ptP) ; bFound ; bFound = PL.GetNextPoint( ptP)) {
|
||||
AddVert3f( ptP) ;
|
||||
AddOgaVert3f( ptP) ;
|
||||
m_b3Loc.Add( ptP) ;
|
||||
}
|
||||
// fine
|
||||
AddEnd() ;
|
||||
AddOgaEnd() ;
|
||||
// dichiaro valida la grafica
|
||||
m_bValid = true ;
|
||||
|
||||
@@ -178,7 +186,7 @@ ObjOldGraphics::StartTriangles( int nNum, bool bAux)
|
||||
// riservo memoria per vettore
|
||||
m_ogaVect.reserve( VECT_HEAP + 3 * nNum) ;
|
||||
// inizio emissione triangoli
|
||||
AddStart( GL_TRIANGLES, bAux) ;
|
||||
AddOgaStart( GL_TRIANGLES, bAux) ;
|
||||
m_nCurrMode = GL_TRIANGLES ;
|
||||
return true ;
|
||||
}
|
||||
@@ -192,9 +200,9 @@ ObjOldGraphics::AddTriangle( const Triangle3d& Tria, const TriFlags3d& TFlags, c
|
||||
return false ;
|
||||
// emetto i flag, le normali e i vertici del triangolo + aggiorno bbox
|
||||
for ( int i = 0 ; i < 3 ; ++ i) {
|
||||
AddBndFlag( TFlags.bFlag[i]) ;
|
||||
AddNormal3f( TNrms.vtN[i]) ;
|
||||
AddVert3f( Tria.GetP( i)) ;
|
||||
AddOgaBndFlag( TFlags.bFlag[i]) ;
|
||||
AddOgaNormal3f( TNrms.vtN[i]) ;
|
||||
AddOgaVert3f( Tria.GetP( i)) ;
|
||||
m_b3Loc.Add( Tria.GetP( i)) ;
|
||||
}
|
||||
return true ;
|
||||
@@ -208,7 +216,7 @@ ObjOldGraphics::EndTriangles( void)
|
||||
if ( m_nCurrMode != GL_TRIANGLES)
|
||||
return false ;
|
||||
// termino il modo triangoli
|
||||
AddEnd() ;
|
||||
AddOgaEnd() ;
|
||||
m_nCurrMode = GL_NONE ;
|
||||
// dichiaro valida la grafica
|
||||
m_bValid = true ;
|
||||
@@ -217,8 +225,8 @@ ObjOldGraphics::EndTriangles( void)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static float*
|
||||
AdjustColor( float fCol[4], bool bDark)
|
||||
static const float*
|
||||
AdjustColor( const float fCol[4], bool bDark)
|
||||
{
|
||||
if ( ! bDark) {
|
||||
return fCol ;
|
||||
@@ -285,15 +293,16 @@ ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, bool bSurf, int nAlph
|
||||
|
||||
// ciclo di disegno
|
||||
bool bStartA = false ;
|
||||
for ( auto iIter = m_ogaVect.begin() ; iIter != m_ogaVect.end() ; ++ iIter) {
|
||||
switch ( iIter->m_nType) {
|
||||
bool bLineStipple = false ;
|
||||
for ( const auto& Oga : m_ogaVect) {
|
||||
switch ( Oga.m_nType) {
|
||||
case OgAtom::START :
|
||||
glBegin( iIter->m_nMode) ;
|
||||
glBegin( Oga.m_nMode) ;
|
||||
bStartA = false ;
|
||||
break ;
|
||||
case OgAtom::START_A :
|
||||
if ( bShowAux)
|
||||
glBegin( iIter->m_nMode) ;
|
||||
glBegin( Oga.m_nMode) ;
|
||||
bStartA = true ;
|
||||
break ;
|
||||
case OgAtom::END :
|
||||
@@ -303,36 +312,51 @@ ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, bool bSurf, int nAlph
|
||||
break ;
|
||||
case OgAtom::VERT :
|
||||
if ( ! bStartA || bShowAux)
|
||||
glVertex3fv( iIter->m_fVal) ;
|
||||
glVertex3fv( Oga.m_fVal) ;
|
||||
break ;
|
||||
case OgAtom::BND_FLAG :
|
||||
if ( ! bStartA || bShowAux)
|
||||
glEdgeFlag( iIter->m_nFlag) ;
|
||||
glEdgeFlag( Oga.m_nFlag) ;
|
||||
break ;
|
||||
case OgAtom::NORMAL :
|
||||
if ( ! bStartA || bShowAux)
|
||||
glNormal3fv( iIter->m_fVal) ;
|
||||
glNormal3fv( Oga.m_fVal) ;
|
||||
break ;
|
||||
case OgAtom::COLOR :
|
||||
glColor4fv( ( bStdCol ? AdjustColor( iIter->m_fVal, bDark) : fSelMarkCol)) ;
|
||||
glColor4fv( ( bStdCol ? AdjustColor( Oga.m_fVal, bDark) : fSelMarkCol)) ;
|
||||
break ;
|
||||
case OgAtom::MAT_A :
|
||||
glMaterialfv( GL_FRONT, GL_AMBIENT, ( bStdCol ? iIter->m_fVal : fSelMarkCol)) ;
|
||||
glMaterialfv( GL_FRONT, GL_AMBIENT, ( bStdCol ? Oga.m_fVal : fSelMarkCol)) ;
|
||||
break ;
|
||||
case OgAtom::MAT_D :
|
||||
glMaterialfv( GL_FRONT, GL_DIFFUSE, ( bStdCol ? iIter->m_fVal : fSelMarkCol)) ;
|
||||
glMaterialfv( GL_FRONT, GL_DIFFUSE, ( bStdCol ? Oga.m_fVal : fSelMarkCol)) ;
|
||||
break ;
|
||||
case OgAtom::MAT_S :
|
||||
glMaterialfv( GL_FRONT, GL_SPECULAR, ( bStdCol ? iIter->m_fVal : fSelMarkCol)) ;
|
||||
glMaterialfv( GL_FRONT, GL_SPECULAR, ( bStdCol ? Oga.m_fVal : fSelMarkCol)) ;
|
||||
break ;
|
||||
case OgAtom::MAT_SH :
|
||||
glMaterialf( GL_FRONT, GL_SHININESS, iIter->m_fVal[0]) ;
|
||||
glMaterialf( GL_FRONT, GL_SHININESS, Oga.m_fVal[0]) ;
|
||||
break ;
|
||||
case OgAtom::MAT_B :
|
||||
glMaterialfv( GL_BACK, GL_AMBIENT_AND_DIFFUSE, ( bStdCol ? iIter->m_fVal : fSelMarkBackCol)) ;
|
||||
glMaterialfv( GL_BACK, GL_AMBIENT_AND_DIFFUSE, ( bStdCol ? Oga.m_fVal : fSelMarkBackCol)) ;
|
||||
break ;
|
||||
case OgAtom::LINE_STIPPLE :
|
||||
if ( Oga.m_nMode > 0) {
|
||||
bLineStipple = true ;
|
||||
glLineStipple( Clamp( Oga.m_nFactor, 1, 256), Clamp( Oga.m_nPattern, 0, 65535)) ;
|
||||
glEnable( GL_LINE_STIPPLE) ;
|
||||
}
|
||||
else {
|
||||
bLineStipple = false ;
|
||||
glDisable( GL_LINE_STIPPLE) ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if ( bLineStipple) {
|
||||
bLineStipple = false ;
|
||||
glDisable( GL_LINE_STIPPLE) ;
|
||||
}
|
||||
|
||||
// se marcato e non superficie in shading, disegno halo
|
||||
if ( nMark == GDB_MK_ON && ! bSurfSha) {
|
||||
@@ -349,15 +373,16 @@ ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, bool bSurf, int nAlph
|
||||
|
||||
// ciclo di disegno
|
||||
bool bStartA = false ;
|
||||
for ( auto iIter = m_ogaVect.begin() ; iIter != m_ogaVect.end() ; ++ iIter) {
|
||||
switch ( iIter->m_nType) {
|
||||
bool bLineStipple = false ;
|
||||
for ( const auto& Oga : m_ogaVect) {
|
||||
switch ( Oga.m_nType) {
|
||||
case OgAtom::START :
|
||||
glBegin( iIter->m_nMode) ;
|
||||
glBegin( Oga.m_nMode) ;
|
||||
bStartA = false ;
|
||||
break ;
|
||||
case OgAtom::START_A :
|
||||
if ( bShowAux)
|
||||
glBegin( iIter->m_nMode) ;
|
||||
glBegin( Oga.m_nMode) ;
|
||||
bStartA = true ;
|
||||
break ;
|
||||
case OgAtom::END :
|
||||
@@ -367,16 +392,31 @@ ObjOldGraphics::Draw( int nStat, int nMark, bool bSurfSha, bool bSurf, int nAlph
|
||||
break ;
|
||||
case OgAtom::VERT :
|
||||
if ( ! bStartA || bShowAux)
|
||||
glVertex3fv( iIter->m_fVal) ;
|
||||
glVertex3fv( Oga.m_fVal) ;
|
||||
break ;
|
||||
case OgAtom::BND_FLAG :
|
||||
if ( ! bStartA || bShowAux)
|
||||
glEdgeFlag( iIter->m_nFlag) ;
|
||||
glEdgeFlag( Oga.m_nFlag) ;
|
||||
break ;
|
||||
// non si imposta la normale sono solo curve
|
||||
// non si impostano i colori, si usa quello di marcatura
|
||||
case OgAtom::LINE_STIPPLE :
|
||||
if ( Oga.m_nMode > 0) {
|
||||
bLineStipple = true ;
|
||||
glLineStipple( Clamp( Oga.m_nFactor, 1, 256), Clamp( Oga.m_nPattern, 0, 65535)) ;
|
||||
glEnable( GL_LINE_STIPPLE) ;
|
||||
}
|
||||
else {
|
||||
bLineStipple = false ;
|
||||
glDisable( GL_LINE_STIPPLE) ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if ( bLineStipple) {
|
||||
bLineStipple = false ;
|
||||
glDisable( GL_LINE_STIPPLE) ;
|
||||
}
|
||||
// ripristino test di depth
|
||||
glDepthFunc( GL_LEQUAL) ;
|
||||
}
|
||||
|
||||
+21
-10
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
// EgalTech 2014-2023
|
||||
//----------------------------------------------------------------------------
|
||||
// File : ObjOldGraphics.h Data : 13.02.14 Versione : 1.5b1
|
||||
// File : ObjOldGraphics.h Data : 08.07.23 Versione : 2.5g1
|
||||
// Contenuto : Dichiarazione della classe grafica di un oggetto geometrico.
|
||||
//
|
||||
//
|
||||
@@ -27,7 +27,7 @@ class OgAtom {
|
||||
|
||||
public :
|
||||
enum GrType { NONE = 0, START = 1, START_A = 2, END = 3, VERT = 4, BND_FLAG = 5, NORMAL = 6,
|
||||
COLOR = 7, MAT_A = 8, MAT_D = 9, MAT_S = 10, MAT_SH = 11, MAT_B = 12} ;
|
||||
COLOR = 7, MAT_A = 8, MAT_D = 9, MAT_S = 10, MAT_SH = 11, MAT_B = 12, LINE_STIPPLE = 13} ;
|
||||
|
||||
public :
|
||||
GrType m_nType ;
|
||||
@@ -47,6 +47,10 @@ class OgAtom {
|
||||
float m_fAlpha ;
|
||||
} ;
|
||||
float m_fVal[4] ;
|
||||
struct {
|
||||
int m_nFactor ;
|
||||
int m_nPattern ;
|
||||
} ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
@@ -75,6 +79,7 @@ class ObjOldGraphics : public ObjEGrGraphics
|
||||
bool AddMaterial( const Color& colAmb, const Color& colDiff,
|
||||
const Color& colSpec, float fShin) override ;
|
||||
bool AddBackMaterial( const Color& colAmbDiff) override ;
|
||||
bool AddLineStipple( int nFactor, int nPattern) override ;
|
||||
bool AddPoint( const Point3d& ptP, bool bAux = false) override ;
|
||||
bool AddPoints( const PNTVECTOR& vPnt, bool bAux = false) override ;
|
||||
bool AddLines( const PNTVECTOR& vPnt, bool bAux = false) override ;
|
||||
@@ -95,40 +100,46 @@ class ObjOldGraphics : public ObjEGrGraphics
|
||||
{ try { m_ogaVect.push_back( oga) ; }
|
||||
catch(...) { return false ; }
|
||||
return true ; }
|
||||
bool AddStart( int nMode, bool bAux = false)
|
||||
bool AddOgaStart( int nMode, bool bAux = false)
|
||||
{ OgAtom oga ;
|
||||
oga.m_nType = ( bAux ? OgAtom::START_A : OgAtom::START) ;
|
||||
oga.m_nMode = nMode ;
|
||||
return AddOgAtom( oga) ; }
|
||||
bool AddEnd( void)
|
||||
bool AddOgaEnd( void)
|
||||
{ OgAtom oga ;
|
||||
oga.m_nType = OgAtom::END ;
|
||||
return AddOgAtom( oga) ; }
|
||||
bool AddVert3f( const Point3d& ptP)
|
||||
bool AddOgaVert3f( const Point3d& ptP)
|
||||
{ OgAtom oga ;
|
||||
oga.m_nType = OgAtom::VERT ;
|
||||
oga.m_fX = float( ptP.x) ; oga.m_fY = float( ptP.y) ; oga.m_fZ = float( ptP.z) ;
|
||||
return AddOgAtom( oga) ; }
|
||||
bool AddBndFlag( bool bFlag)
|
||||
bool AddOgaBndFlag( bool bFlag)
|
||||
{ OgAtom oga ;
|
||||
oga.m_nType = OgAtom::BND_FLAG ;
|
||||
oga.m_nFlag = ( bFlag ? TRUE : FALSE) ;
|
||||
return AddOgAtom( oga) ; }
|
||||
bool AddNormal3f( const Vector3d& vtN)
|
||||
bool AddOgaNormal3f( const Vector3d& vtN)
|
||||
{ OgAtom oga ;
|
||||
oga.m_nType = OgAtom::NORMAL ;
|
||||
oga.m_fX = float( vtN.x) ; oga.m_fY = float( vtN.y) ; oga.m_fZ = float( vtN.z) ;
|
||||
return AddOgAtom( oga) ; }
|
||||
bool AddColor( float fRed, float fGreen, float fBlue, float fAlpha = 1)
|
||||
bool AddOgaColor( float fRed, float fGreen, float fBlue, float fAlpha = 1)
|
||||
{ OgAtom oga ;
|
||||
oga.m_nType = OgAtom::COLOR ;
|
||||
oga.m_fRed = fRed ; oga.m_fGreen = fGreen ; oga.m_fBlue = fBlue ; oga.m_fAlpha = fAlpha ;
|
||||
return AddOgAtom( oga) ; }
|
||||
bool AddMaterial( OgAtom::GrType nMat, float fRed, float fGreen, float fBlue, float fAlpha = 1)
|
||||
bool AddOgaMaterial( OgAtom::GrType nMat, float fRed, float fGreen, float fBlue, float fAlpha = 1)
|
||||
{ OgAtom nga ;
|
||||
nga.m_nType = nMat ;
|
||||
nga.m_fRed = fRed ; nga.m_fGreen = fGreen ; nga.m_fBlue = fBlue ; nga.m_fAlpha = fAlpha ;
|
||||
return AddOgAtom( nga) ; }
|
||||
bool AddOgaLineStipple( int nFactor, int nPattern)
|
||||
{ OgAtom oga ;
|
||||
oga.m_nType = OgAtom::LINE_STIPPLE ;
|
||||
oga.m_nFactor = nFactor ;
|
||||
oga.m_nPattern = nPattern ;
|
||||
return AddOgAtom( oga) ; }
|
||||
|
||||
private :
|
||||
Scene* m_pScene ; // puntatore alla scena
|
||||
|
||||
+17
-10
@@ -276,6 +276,9 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
// calcolo la grafica
|
||||
pGraphics->Clear() ;
|
||||
pGraphics->AddColor( siObj.colObj) ;
|
||||
int nFactor, nPattern ;
|
||||
if ( iIter.GetStipple( nFactor, nPattern) && nFactor != 0)
|
||||
pGraphics->AddLineStipple( nFactor, nPattern) ;
|
||||
PolyLine PL ;
|
||||
if ( pVector->GetDrawWithArrowHead( 0.1, 10, PL))
|
||||
pGraphics->AddPolyLine(PL) ;
|
||||
@@ -291,6 +294,9 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
// calcolo la grafica
|
||||
pGraphics->Clear() ;
|
||||
pGraphics->AddColor( siObj.colObj) ;
|
||||
int nFactor, nPattern ;
|
||||
if ( iIter.GetStipple( nFactor, nPattern) && nFactor != 0)
|
||||
pGraphics->AddLineStipple( nFactor, nPattern) ;
|
||||
pGraphics->AddPoint( pPoint->GetPoint()) ;
|
||||
}
|
||||
// se riferimento
|
||||
@@ -321,6 +327,9 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
pCurve->ApproxWithLines( EPS_SMALL, ANG_TOL_GRAPH_DEG, ICurve::APL_SPECIAL, PL) ;
|
||||
pGraphics->Clear() ;
|
||||
pGraphics->AddColor( siObj.colObj) ;
|
||||
int nFactor, nPattern ;
|
||||
if ( iIter.GetStipple( nFactor, nPattern) && nFactor != 0)
|
||||
pGraphics->AddLineStipple( nFactor, nPattern) ;
|
||||
pGraphics->AddPolyLine( PL) ;
|
||||
// eventuali segni ausiliari (mark, frecce, ...)
|
||||
Vector3d vtRef ;
|
||||
@@ -725,17 +734,15 @@ Scene::DrawGeoObj( const IGdbIterator& iIter, int nPass, const MdStMkCol& siObj)
|
||||
Frame3d frTxr ;
|
||||
iIter.GetTextureFrame( frTxr) ;
|
||||
// creo piano per la S
|
||||
GLfloat PlaneS[4] ;
|
||||
PlaneS[0] = GLfloat( frTxr.VersX().x / dTextDimS) ;
|
||||
PlaneS[1] = GLfloat( frTxr.VersX().y / dTextDimS) ;
|
||||
PlaneS[2] = GLfloat( frTxr.VersX().z / dTextDimS) ;
|
||||
PlaneS[3] = GLfloat( - frTxr.VersX() * ( frTxr.Orig() - ORIG) / dTextDimS) ;
|
||||
GLfloat PlaneS[4] { GLfloat( frTxr.VersX().x / dTextDimS),
|
||||
GLfloat( frTxr.VersX().y / dTextDimS),
|
||||
GLfloat( frTxr.VersX().z / dTextDimS),
|
||||
GLfloat( -frTxr.VersX() * ( frTxr.Orig() - ORIG) / dTextDimS)} ;
|
||||
// creo piano per la T
|
||||
GLfloat PlaneT[4] ;
|
||||
PlaneT[0] = GLfloat( frTxr.VersY().x / dTextDimT) ;
|
||||
PlaneT[1] = GLfloat( frTxr.VersY().y / dTextDimT) ;
|
||||
PlaneT[2] = GLfloat( frTxr.VersY().z / dTextDimT) ;
|
||||
PlaneT[3] = GLfloat( - frTxr.VersY() * ( frTxr.Orig() - ORIG) / dTextDimT) ;
|
||||
GLfloat PlaneT[4] { GLfloat( frTxr.VersY().x / dTextDimT),
|
||||
GLfloat( frTxr.VersY().y / dTextDimT),
|
||||
GLfloat( frTxr.VersY().z / dTextDimT),
|
||||
GLfloat( -frTxr.VersY() * ( frTxr.Orig() - ORIG) / dTextDimT)} ;
|
||||
// setto generazione automatica coordinate S e T per texture
|
||||
glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR) ;
|
||||
glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR) ;
|
||||
|
||||
Reference in New Issue
Block a user