Quasar.cpp   Quasar.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 "Quasar.hpp" #include "Quasar.hpp"
#include "Quasars.hpp" #include "Quasars.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>
StelTextureSP Quasar::markerTexture;
Quasar::Quasar(const QVariantMap& map) Quasar::Quasar(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();
VMagnitude = map.value("Vmag").toFloat(); VMagnitude = map.value("Vmag").toFloat();
AMagnitude = map.value("Amag").toFloat(); AMagnitude = map.value("Amag").toFloat();
skipping to change at line 173 skipping to change at line 169
double Quasar::getAngularSize(const StelCore*) const double Quasar::getAngularSize(const StelCore*) const
{ {
return 0.00001; return 0.00001;
} }
void Quasar::update(double deltaTime) void Quasar::update(double deltaTime)
{ {
labelsFader.update((int)(deltaTime*1000)); labelsFader.update((int)(deltaTime*1000));
} }
void Quasar::draw(StelCore* core, StelPainter& painter) void Quasar::draw(StelCore* core, StelRenderer* renderer, StelProjectorP pr ojector, StelTextureNew* markerTexture)
{ {
StelSkyDrawer* sd = core->getSkyDrawer(); StelSkyDrawer* sd = core->getSkyDrawer();
Vec3f color = sd->indexToColor(BvToColorIndex(bV))*0.75f; const Vec3f color = sd->indexToColor(BvToColorIndex(bV))*0.75f;
Vec3f dcolor = Vec3f(1.2f,0.5f,0.4f); Vec3f dcolor = Vec3f(1.2f,0.5f,0.4f);
if (StelApp::getInstance().getVisionModeNight()) if (StelApp::getInstance().getVisionModeNight())
dcolor = StelUtils::getNightColor(dcolor); dcolor = StelUtils::getNightColor(dcolor);
float rcMag[2], size, shift; float rcMag[2], size, shift;
double mag; double mag;
StelUtils::spheToRect(qRA, qDE, XYZ); StelUtils::spheToRect(qRA, qDE, XYZ);
mag = getVMagnitude(core, true); mag = getVMagnitude(core, true);
if (GETSTELMODULE(Quasars)->getDisplayMode()) if (GETSTELMODULE(Quasars)->getDisplayMode())
{ {
glEnable(GL_BLEND); renderer->setBlendMode(BlendMode_Add);
glBlendFunc(GL_ONE, GL_ONE); renderer->setGlobalColor(dcolor[0], dcolor[1], dcolor[2], 1)
painter.setColor(dcolor[0], dcolor[1], dcolor[2], 1); ;
markerTexture->bind();
Quasar::markerTexture->bind();
size = getAngularSize(NULL)*M_PI/180.*painter.getProjector()
->getPixelPerRadAtCenter();
shift = 5.f + size/1.6f;
if (labelsFader.getInterstate()<=0.f) if (labelsFader.getInterstate()<=0.f)
{ {
painter.drawSprite2dMode(XYZ, 4); Vec3d win;
painter.drawText(XYZ, " ", 0, shift, shift, false); if(projector->project(XYZ, win))
{
renderer->drawTexturedRect(win[0] - 4, win[1
] - 4, 8, 8);
}
} }
} }
else else
{ {
sd->preDrawPointSource(&painter); sd->preDrawPointSource();
if (mag <= sd->getLimitMagnitude()) if (mag <= sd->getLimitMagnitude())
{ {
sd->computeRCMag(mag, rcMag); sd->computeRCMag(mag, rcMag);
//sd->drawPointSource(&painter, Vec3f(XYZ[0], XYZ[1] const Vec3f XYZf(XYZ[0], XYZ[1], XYZ[2]);
, XYZ[2]), rcMag, sd->indexToColor(BvToColorIndex(bV)), false); Vec3f win;
sd->drawPointSource(&painter, XYZ, rcMag, sd->indexT if(sd->pointSourceVisible(&(*projector), XYZf, rcMag
oColor(BvToColorIndex(bV)), false); , false, win))
painter.setColor(color[0], color[1], color[2], 1); {
size = getAngularSize(NULL)*M_PI/180.*painter.getPro sd->drawPointSource(win, rcMag, sd->indexToC
jector()->getPixelPerRadAtCenter(); olor(BvToColorIndex(bV)));
}
renderer->setGlobalColor(color[0], color[1], color[2
], 1.0f);
size = getAngularSize(NULL)*M_PI/180.*projector->get
PixelPerRadAtCenter();
shift = 6.f + size/1.8f; shift = 6.f + size/1.8f;
if (labelsFader.getInterstate()<=0.f) if (labelsFader.getInterstate()<=0.f)
{ {
painter.drawText(XYZ, designation, 0, shift, shift, false); renderer->drawText(TextParams(XYZ, projector , designation).shift(shift, shift).useGravity());
} }
} }
sd->postDrawPointSource(&painter); sd->postDrawPointSource(projector);
} }
} }
unsigned char Quasar::BvToColorIndex(float b_v) unsigned char Quasar::BvToColorIndex(float b_v)
{ {
double dBV = b_v; double dBV = b_v;
dBV *= 1000.0; dBV *= 1000.0;
if (dBV < -500) if (dBV < -500)
{ {
dBV = -500; dBV = -500;
 End of changes. 14 change blocks. 
28 lines changed or deleted 29 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/