[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/kstars/kstars
From: Jérôme Sonrier <jsid () emor3j ! fr ! eu ! org>
Date: 2011-02-27 19:14:43
Message-ID: 20110227191443.35620AC8C0 () svn ! kde ! org
[Download RAW message or body]
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()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic