From kde-commits Sun Feb 27 19:14:43 2011 From: =?utf-8?q?J=C3=A9r=C3=B4me=20Sonrier?= Date: Sun, 27 Feb 2011 19:14:43 +0000 To: kde-commits Subject: KDE/kdeedu/kstars/kstars Message-Id: <20110227191443.35620AC8C0 () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=129883412918216 SVN commit 1222966 by jsonrier: Implement SkyGLPainter::drawSkyLine(). Trails are now drawn also in GL mode. CCMAIL: kstars-devel@kde.org M +23 -0 skyglpainter.cpp --- trunk/KDE/kdeedu/kstars/kstars/skyglpainter.cpp #1222965:1222966 @@ -624,7 +624,30 @@ void SkyGLPainter::drawSkyLine(SkyPoint* a, SkyPoint* b) { + bool aVisible, bVisible; + Vector2f aScreen = m_proj->toScreenVec( a, true, &aVisible ); + Vector2f bScreen = m_proj->toScreenVec( b, true, &bVisible ); + glDisable( GL_TEXTURE_2D ); + glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); + glBegin( GL_LINE_STRIP ); + + //THREE CASES: + if( aVisible && bVisible ) { + //Both a,b visible, so paint the line normally: + glVertex2fv( aScreen.data() ); + glVertex2fv( bScreen.data() ); + } else if( aVisible ) { + //a is visible but b isn't: + glVertex2fv( aScreen.data() ); + glVertex2fv( m_proj->clipLineVec( a, b ).data() ); + } else if( bVisible ) { + //b is visible but a isn't: + glVertex2fv( bScreen.data() ); + glVertex2fv( m_proj->clipLineVec( b, a ).data() ); + } //FIXME: what if both are offscreen but the line isn't? + + glEnd(); } void SkyGLPainter::drawSkyBackground()