eeschema-gal: implemented EnableDepthTest() in GAL, fixed drawing order in eeschema
This commit is contained in:
parent
0777d11188
commit
d66e0d4f7a
|
@ -49,7 +49,7 @@ GPU_MANAGER* GPU_MANAGER::MakeManager( VERTEX_CONTAINER* aContainer )
|
|||
|
||||
|
||||
GPU_MANAGER::GPU_MANAGER( VERTEX_CONTAINER* aContainer ) :
|
||||
m_isDrawing( false ), m_container( aContainer ), m_shader( NULL ), m_shaderAttrib( 0 )
|
||||
m_isDrawing( false ), m_container( aContainer ), m_shader( NULL ), m_shaderAttrib( 0 ), m_enableDepthTest( true )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -154,6 +154,11 @@ void GPU_CACHED_MANAGER::EndDrawing()
|
|||
return;
|
||||
}
|
||||
|
||||
if( m_enableDepthTest )
|
||||
glEnable( GL_DEPTH_TEST );
|
||||
else
|
||||
glDisable( GL_DEPTH_TEST );
|
||||
|
||||
// Prepare buffers
|
||||
glEnableClientState( GL_VERTEX_ARRAY );
|
||||
glEnableClientState( GL_COLOR_ARRAY );
|
||||
|
@ -254,6 +259,11 @@ void GPU_NONCACHED_MANAGER::EndDrawing()
|
|||
GLfloat* coordinates = (GLfloat*) ( vertices );
|
||||
GLubyte* colors = (GLubyte*) ( vertices ) + COLOR_OFFSET;
|
||||
|
||||
if( m_enableDepthTest )
|
||||
glEnable( GL_DEPTH_TEST );
|
||||
else
|
||||
glDisable( GL_DEPTH_TEST );
|
||||
|
||||
// Prepare buffers
|
||||
glEnableClientState( GL_VERTEX_ARRAY );
|
||||
glEnableClientState( GL_COLOR_ARRAY );
|
||||
|
@ -295,3 +305,8 @@ void GPU_NONCACHED_MANAGER::EndDrawing()
|
|||
wxT( "GPU_NONCACHED_MANAGER::EndDrawing(): %.1f ms" ), totalRealTime.msecs() );
|
||||
#endif /* __WXDEBUG__ */
|
||||
}
|
||||
|
||||
void GPU_MANAGER::EnableDepthTest( bool aEnabled )
|
||||
{
|
||||
m_enableDepthTest = aEnabled;
|
||||
}
|
||||
|
|
|
@ -1159,6 +1159,8 @@ void OPENGL_GAL::DrawGrid()
|
|||
SetTarget( TARGET_NONCACHED );
|
||||
compositor->SetBuffer( mainBuffer );
|
||||
|
||||
nonCachedManager->EnableDepthTest( false );
|
||||
|
||||
// sub-pixel lines all render the same
|
||||
double minorLineWidth = std::max( 1.0, gridLineWidth ) * getWorldPixelSize();
|
||||
double majorLineWidth = minorLineWidth * 2.0;
|
||||
|
@ -2072,10 +2074,7 @@ static void InitTesselatorCallbacks( GLUtesselator* aTesselator )
|
|||
|
||||
void OPENGL_GAL::EnableDepthTest( bool aEnabled )
|
||||
{
|
||||
if( aEnabled )
|
||||
glEnable( GL_DEPTH_TEST );
|
||||
else
|
||||
{
|
||||
glDisable( GL_DEPTH_TEST );
|
||||
}
|
||||
cachedManager->EnableDepthTest( aEnabled );
|
||||
nonCachedManager->EnableDepthTest( aEnabled );
|
||||
overlayManager->EnableDepthTest( aEnabled );
|
||||
}
|
||||
|
|
|
@ -284,3 +284,8 @@ void VERTEX_MANAGER::putVertex( VERTEX& aTarget, GLfloat aX, GLfloat aY, GLfloat
|
|||
aTarget.shader[j] = m_shader[j];
|
||||
}
|
||||
}
|
||||
|
||||
void VERTEX_MANAGER::EnableDepthTest( bool aEnabled )
|
||||
{
|
||||
m_gpu->EnableDepthTest( aEnabled );
|
||||
}
|
||||
|
|
|
@ -1427,6 +1427,9 @@ void SCH_EDIT_FRAME::addCurrentItemToScreen( bool aRedraw )
|
|||
}
|
||||
|
||||
item->ClearFlags();
|
||||
|
||||
GetCanvas()->GetView()->Update( item );
|
||||
|
||||
screen->SetModify();
|
||||
screen->SetCurItem( NULL );
|
||||
m_canvas->SetMouseCapture( NULL, NULL );
|
||||
|
|
|
@ -144,8 +144,6 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
|
|||
|
||||
m_schSettings.ImportLegacyColors( nullptr );
|
||||
|
||||
m_gal->EnableDepthTest( false );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
HANDLE_ITEM(LIB_ALIAS_T, LIB_ALIAS);
|
||||
|
@ -1079,6 +1077,8 @@ void SCH_PAINTER::draw( SCH_COMPONENT *aComp, int aLayer )
|
|||
std::vector<SCH_FIELD*> fields;
|
||||
aComp->GetFields( fields, false );
|
||||
|
||||
m_gal->AdvanceDepth();
|
||||
|
||||
for( SCH_FIELD* field : fields )
|
||||
{
|
||||
if( field->GetId() == REFERENCE || !field->IsMoving() )
|
||||
|
|
|
@ -222,6 +222,9 @@ void SCH_VIEW::Redraw()
|
|||
( *i )->items->Query( rect, visitor );
|
||||
}
|
||||
|
||||
|
||||
m_gal->EnableDepthTest( false );
|
||||
|
||||
VIEW::Redraw();
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,12 @@ public:
|
|||
*/
|
||||
virtual void SetShader( SHADER& aShader );
|
||||
|
||||
/**
|
||||
* Function EnableDepthTest()
|
||||
* Enables/disables Z buffer depth test.
|
||||
*/
|
||||
void EnableDepthTest( bool aEnabled );
|
||||
|
||||
protected:
|
||||
GPU_MANAGER( VERTEX_CONTAINER* aContainer );
|
||||
|
||||
|
@ -93,6 +99,9 @@ protected:
|
|||
|
||||
///> Location of shader attributes (for glVertexAttribPointer)
|
||||
int m_shaderAttrib;
|
||||
|
||||
///> true: enable Z test when drawing
|
||||
bool m_enableDepthTest;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -349,6 +349,12 @@ public:
|
|||
*/
|
||||
void EndDrawing() const;
|
||||
|
||||
/**
|
||||
* Function EnableDepthTest()
|
||||
* Enables/disables Z buffer depth test.
|
||||
*/
|
||||
void EnableDepthTest( bool aEnabled );
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Function putVertex()
|
||||
|
|
Loading…
Reference in New Issue