CompassMarks.cpp   CompassMarks.cpp 
skipping to change at line 19 skipping to change at line 19
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "config.h"
#include "VecMath.hpp" #include "VecMath.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "LandscapeMgr.hpp" #include "LandscapeMgr.hpp"
skipping to change at line 126 skipping to change at line 124
qWarning() << "WARNING: unable create toolbar button for Com passMarks plugin: " << e.what(); qWarning() << "WARNING: unable create toolbar button for Com passMarks plugin: " << e.what();
} }
} }
//! Draw any parts on the screen which are for our module //! Draw any parts on the screen which are for our module
void CompassMarks::draw(StelCore* core) void CompassMarks::draw(StelCore* core)
{ {
if (markFader.getInterstate() <= 0.0) { return; } if (markFader.getInterstate() <= 0.0) { return; }
Vec3d pos; Vec3d pos, screenPos;
StelProjectorP prj = core->getProjection(StelCore::FrameAltAz, StelC ore::RefractionOff); StelProjectorP prj = core->getProjection(StelCore::FrameAltAz, StelC ore::RefractionOff);
StelPainter painter(prj); StelPainter painter(prj);
painter.setFont(font); painter.setFont(font);
painter.setColor(markColor[0], markColor[1], markColor[2], markFader .getInterstate()); painter.setColor(markColor[0], markColor[1], markColor[2], markFader .getInterstate());
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND); glEnable(GL_BLEND);
// OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH. But it looks much bett
// glEnable(GL_LINE_SMOOTH); er.
#ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().renderableType()==QSu
rfaceFormat::OpenGL)
glEnable(GL_LINE_SMOOTH);
#endif
for(int i=0; i<360; i++) for(int i=0; i<360; i++)
{ {
float a = i*M_PI/180; float a = i*M_PI/180;
pos.set(sin(a),cos(a), 0.f); pos.set(sin(a),cos(a), 0.f);
float h = -0.002; float h = -0.002;
if (i % 15 == 0) if (i % 15 == 0)
{ {
h = -0.02; // the size of the mark every 15 degrees h = -0.02; // the size of the mark every 15 degrees
skipping to change at line 158 skipping to change at line 159
float shiftx = painter.getFontMetrics().width(s) / 2 .; float shiftx = painter.getFontMetrics().width(s) / 2 .;
float shifty = painter.getFontMetrics().height() / 2 .; float shifty = painter.getFontMetrics().height() / 2 .;
painter.drawText(pos, s, 0, -shiftx, shifty); painter.drawText(pos, s, 0, -shiftx, shifty);
} }
else if (i % 5 == 0) else if (i % 5 == 0)
{ {
h = -0.01; // the size of the mark every 5 degrees h = -0.01; // the size of the mark every 5 degrees
} }
glDisable(GL_TEXTURE_2D); // Limit arcs to those that are visible for improved perform
painter.drawGreatCircleArc(pos, Vec3d(pos[0], pos[1], h), NU ance
LL); if (prj->project(pos, screenPos) &&
glEnable(GL_TEXTURE_2D); screenPos[0]>prj->getViewportPosX() && screenPos[0] < p
rj->getViewportPosX() + prj->getViewportWidth()) {
// This has been disabled above already...
//glDisable(GL_TEXTURE_2D);
painter.drawGreatCircleArc(pos, Vec3d(pos[0], pos[1]
, h), NULL);
//glEnable(GL_TEXTURE_2D);
}
} }
// OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH
// glDisable(GL_LINE_SMOOTH); #ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().renderableType()==QSu
rfaceFormat::OpenGL)
glDisable(GL_LINE_SMOOTH);
#endif
glDisable(GL_BLEND); glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }
void CompassMarks::update(double deltaTime) void CompassMarks::update(double deltaTime)
{ {
markFader.update((int)(deltaTime*1000)); markFader.update((int)(deltaTime*1000));
} }
 End of changes. 5 change blocks. 
10 lines changed or deleted 24 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/