Pulsar.cpp   Pulsar.cpp 
skipping to change at line 22 skipping to change at line 22
* 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 "Pulsar.hpp" #include "Pulsar.hpp"
#include "Pulsars.hpp" #include "Pulsars.hpp"
#include "StelObject.hpp" #include "StelObject.hpp"
#include "StelPainter.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelTexture.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelSkyDrawer.hpp" #include "StelSkyDrawer.hpp"
#include "renderer/StelRenderer.hpp"
#include <QTextStream> #include <QTextStream>
#include <QDebug> #include <QDebug>
#include <QVariant> #include <QVariant>
#include <QtOpenGL>
#include <QVariantMap> #include <QVariantMap>
#include <QVariant> #include <QVariant>
#include <QList> #include <QList>
#define PSR_INERTIA 1.0e45 /* Typical moment of inertia for a pulsar */ #define PSR_INERTIA 1.0e45 /* Typical moment of inertia for a pulsar */
StelTextureSP Pulsar::markerTexture;
Pulsar::Pulsar(const QVariantMap& map) Pulsar::Pulsar(const QVariantMap& map)
: initialized(false) : initialized(false)
{ {
// return initialized if the mandatory fields are not present // return initialized if the mandatory fields are not present
if (!map.contains("designation")) if (!map.contains("designation"))
return; return;
designation = map.value("designation").toString(); designation = map.value("designation").toString();
parallax = map.value("parallax").toFloat(); parallax = map.value("parallax").toFloat();
period = map.value("period").toDouble(); period = map.value("period").toDouble();
skipping to change at line 336 skipping to change at line 332
double Pulsar::getAngularSize(const StelCore*) const double Pulsar::getAngularSize(const StelCore*) const
{ {
return 0.00001; return 0.00001;
} }
void Pulsar::update(double deltaTime) void Pulsar::update(double deltaTime)
{ {
labelsFader.update((int)(deltaTime*1000)); labelsFader.update((int)(deltaTime*1000));
} }
void Pulsar::draw(StelCore* core, StelPainter& painter) void Pulsar::draw(StelCore* core, StelRenderer* renderer, StelProjectorP pr
ojector,
StelTextureNew* markerTexture)
{ {
StelSkyDrawer* sd = core->getSkyDrawer(); StelSkyDrawer* sd = core->getSkyDrawer();
Vec3f color = Vec3f(0.4f,0.5f,1.2f); Vec3f color = Vec3f(0.4f,0.5f,1.2f);
if (StelApp::getInstance().getVisionModeNight()) if (StelApp::getInstance().getVisionModeNight())
color = StelUtils::getNightColor(color); color = StelUtils::getNightColor(color);
double mag = getVMagnitude(core, true); double mag = getVMagnitude(core, true);
StelUtils::spheToRect(RA, DE, XYZ); StelUtils::spheToRect(RA, DE, XYZ);
glEnable(GL_BLEND); renderer->setBlendMode(BlendMode_Add);
glBlendFunc(GL_ONE, GL_ONE); renderer->setGlobalColor(color[0], color[1], color[2]);
painter.setColor(color[0], color[1], color[2], 1);
if (mag <= sd->getLimitMagnitude()) if (mag <= sd->getLimitMagnitude())
{ {
markerTexture->bind();
Pulsar::markerTexture->bind(); const float size = getAngularSize(NULL)*M_PI/180.*projector-
float size = getAngularSize(NULL)*M_PI/180.*painter.getProje >getPixelPerRadAtCenter();
ctor()->getPixelPerRadAtCenter(); const float shift = 5.f + size/1.6f;
float shift = 5.f + size/1.6f;
if (labelsFader.getInterstate()<=0.f) if (labelsFader.getInterstate()<=0.f)
{ {
Vec3d win;
if(!projector->project(XYZ, win)){return;}
if (GETSTELMODULE(Pulsars)->getDisplayMode()) if (GETSTELMODULE(Pulsars)->getDisplayMode())
{ {
painter.drawSprite2dMode(XYZ, 4); renderer->drawTexturedRect(win[0] - 4, win[1
painter.drawText(XYZ, " ", 0, shift, shift, ] - 4, 8, 8);
false);
} }
else else
{ {
painter.drawSprite2dMode(XYZ, 5); renderer->drawTexturedRect(win[0] - 5, win[1
painter.drawText(XYZ, designation, 0, shift, ] - 5, 10, 10);
shift, false); renderer->drawText(TextParams(XYZ, projector
, designation).shift(shift, shift).useGravity());
} }
} }
} }
} }
 End of changes. 11 change blocks. 
20 lines changed or deleted 18 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/