Nebula.cpp   Nebula.cpp 
/* /*
* Stellarium * Stellarium
* Copyright (C) 2002 Fabien Chereau * Copyright (C) 2002 Fabien Chereau
* Copyright (C) 2011 Alexander Wolf
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* 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.
skipping to change at line 27 skipping to change at line 28
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#include <QTextStream> #include <QTextStream>
#include <QFile> #include <QFile>
#include <QString> #include <QString>
#include "Nebula.hpp" #include "Nebula.hpp"
#include "NebulaMgr.hpp" #include "NebulaMgr.hpp"
#include "StelTexture.hpp" #include "StelTexture.hpp"
#include "StelNavigator.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelTextureMgr.hpp" #include "StelTextureMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include <QDebug> #include <QDebug>
#include <QBuffer> #include <QBuffer>
StelTextureSP Nebula::texCircle; StelTextureSP Nebula::texCircle;
StelTextureSP Nebula::texOpenCluster;
StelTextureSP Nebula::texGlobularCluster;
StelTextureSP Nebula::texPlanetNebula;
float Nebula::circleScale = 1.f; float Nebula::circleScale = 1.f;
float Nebula::hintsBrightness = 0; float Nebula::hintsBrightness = 0;
Vec3f Nebula::labelColor = Vec3f(0.4,0.3,0.5); Vec3f Nebula::labelColor = Vec3f(0.4,0.3,0.5);
Vec3f Nebula::circleColor = Vec3f(0.8,0.8,0.1); Vec3f Nebula::circleColor = Vec3f(0.8,0.8,0.1);
Nebula::Nebula() : Nebula::Nebula() :
M_nb(0), M_nb(0),
NGC_nb(0), NGC_nb(0),
IC_nb(0) IC_nb(0)
{ {
skipping to change at line 107 skipping to change at line 111
oss << getPositionInfoString(core, flags); oss << getPositionInfoString(core, flags);
if (angularSize>0 && flags&Size) if (angularSize>0 && flags&Size)
oss << q_("Size: %1").arg(StelUtils::radToDmsStr(angularSize *M_PI/180.)) << "<br>"; oss << q_("Size: %1").arg(StelUtils::radToDmsStr(angularSize *M_PI/180.)) << "<br>";
postProcessInfoString(str, flags); postProcessInfoString(str, flags);
return str; return str;
} }
float Nebula::getSelectPriority(const StelNavigator *nav) const float Nebula::getSelectPriority(const StelCore* core) const
{ {
if( ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("Ne bulaMgr"))->getFlagHints() ) if( ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("Ne bulaMgr"))->getFlagHints() )
{ {
// make very easy to select IF LABELED // make very easy to select IF LABELED
return -10; return -10.f;
} }
else else
{ {
if (getVMagnitude(nav)>20) return 20; if (getVMagnitude(core)>20.f) return 20.f;
return getVMagnitude(nav); return getVMagnitude(core);
} }
} }
Vec3f Nebula::getInfoColor(void) const Vec3f Nebula::getInfoColor(void) const
{ {
return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.4) : ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("Nebul aMgr"))->getLabelsColor(); return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.4) : ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("Nebul aMgr"))->getLabelsColor();
} }
double Nebula::getCloseViewFov(const StelNavigator*) const double Nebula::getCloseViewFov(const StelCore*) const
{ {
return angularSize>0 ? angularSize * 4 : 1; return angularSize>0 ? angularSize * 4 : 1;
} }
void Nebula::drawHints(StelPainter& sPainter, float maxMagHints) void Nebula::drawHints(StelPainter& sPainter, float maxMagHints)
{ {
if (mag>maxMagHints) if (mag>maxMagHints)
return; return;
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_ONE, GL_ONE);
float lum = 1.f;//qMin(1,4.f/getOnScreenSize(core))*0.8; float lum = 1.f;//qMin(1,4.f/getOnScreenSize(core))*0.8;
sPainter.setColor(circleColor[0]*lum*hintsBrightness, circleColor[1] *lum*hintsBrightness, circleColor[2]*lum*hintsBrightness, 1); sPainter.setColor(circleColor[0]*lum*hintsBrightness, circleColor[1] *lum*hintsBrightness, circleColor[2]*lum*hintsBrightness, 1);
Nebula::texCircle->bind(); if (nType == 1)
sPainter.drawSprite2dMode(XY[0], XY[1], 4); Nebula::texOpenCluster->bind();
if (nType == 2)
Nebula::texGlobularCluster->bind();
if (nType == 4)
Nebula::texPlanetNebula->bind();
if (nType != 1 && nType != 2 && nType != 4)
Nebula::texCircle->bind();
sPainter.drawSprite2dMode(XY[0], XY[1], 6);
} }
void Nebula::drawLabel(StelPainter& sPainter, float maxMagLabel) void Nebula::drawLabel(StelPainter& sPainter, float maxMagLabel)
{ {
if (mag>maxMagLabel) if (mag>maxMagLabel)
return; return;
sPainter.setColor(labelColor[0], labelColor[1], labelColor[2], hints Brightness); sPainter.setColor(labelColor[0], labelColor[1], labelColor[2], hints Brightness);
float size = getAngularSize(NULL)*M_PI/180.*sPainter.getProjector()- >getPixelPerRadAtCenter(); float size = getAngularSize(NULL)*M_PI/180.*sPainter.getProjector()- >getPixelPerRadAtCenter();
float shift = 4.f + size/1.8f; float shift = 4.f + size/1.8f;
QString str; QString str;
 End of changes. 8 change blocks. 
8 lines changed or deleted 23 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/