CompassMarks.cpp   CompassMarks.cpp 
skipping to change at line 37 skipping to change at line 37
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "LandscapeMgr.hpp" #include "LandscapeMgr.hpp"
#include "CompassMarks.hpp" #include "CompassMarks.hpp"
#include "StelGui.hpp" #include "StelGui.hpp"
#include "StelGuiItems.hpp" #include "StelGuiItems.hpp"
#include <QDebug> #include <QDebug>
#include <QPixmap> #include <QPixmap>
#include <QSettings> #include <QSettings>
#include <QKeyEvent> #include <QKeyEvent>
#include <QtNetwork>
#include <cmath> #include <cmath>
StelModule* CompassMarksStelPluginInterface::getStelModule() const StelModule* CompassMarksStelPluginInterface::getStelModule() const
{ {
return new CompassMarks(); return new CompassMarks();
} }
StelPluginInfo CompassMarksStelPluginInterface::getPluginInfo() const StelPluginInfo CompassMarksStelPluginInterface::getPluginInfo() const
{ {
// Allow to load the resources when used as a static plugin // Allow to load the resources when used as a static plugin
skipping to change at line 130 skipping to change at line 129
void CompassMarks::draw(StelCore* core) void CompassMarks::draw(StelCore* core)
{ {
if (markFader.getInterstate() <= 0.0) { return; } if (markFader.getInterstate() <= 0.0) { return; }
Vec3d pos, screenPos; 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); painter.setBlending(true);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); painter.setLineSmooth(true);
glEnable(GL_BLEND);
// OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH. But it looks much bett
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 162 skipping to change at line 155
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
} }
// Limit arcs to those that are visible for improved perform ance // Limit arcs to those that are visible for improved perform ance
if (prj->project(pos, screenPos) && if (prj->project(pos, screenPos) &&
screenPos[0]>prj->getViewportPosX() && screenPos[0] < p rj->getViewportPosX() + prj->getViewportWidth()) { 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); painter.drawGreatCircleArc(pos, Vec3d(pos[0], pos[1] , h), NULL);
//glEnable(GL_TEXTURE_2D);
} }
} }
// OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH painter.setBlending(false);
#ifdef GL_LINE_SMOOTH painter.setLineSmooth(false);
if (QOpenGLContext::currentContext()->format().renderableType()==QSu
rfaceFormat::OpenGL)
glDisable(GL_LINE_SMOOTH);
#endif
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
} }
void CompassMarks::update(double deltaTime) void CompassMarks::update(double deltaTime)
{ {
markFader.update((int)(deltaTime*1000)); markFader.update((int)(deltaTime*1000));
} }
void CompassMarks::setCompassMarks(bool b) void CompassMarks::setCompassMarks(bool b)
{ {
if (b == markFader) if (b == markFader)
 End of changes. 5 change blocks. 
23 lines changed or deleted 4 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/