Constellation.cpp   Constellation.cpp 
skipping to change at line 40 skipping to change at line 40
#include <algorithm> #include <algorithm>
#include <QString> #include <QString>
#include <QTextStream> #include <QTextStream>
#include <QDebug> #include <QDebug>
#include <QFontMetrics> #include <QFontMetrics>
Vec3f Constellation::lineColor = Vec3f(0.4,0.4,0.8); Vec3f Constellation::lineColor = Vec3f(0.4,0.4,0.8);
Vec3f Constellation::labelColor = Vec3f(0.4,0.4,0.8); Vec3f Constellation::labelColor = Vec3f(0.4,0.4,0.8);
Vec3f Constellation::boundaryColor = Vec3f(0.8,0.3,0.3); Vec3f Constellation::boundaryColor = Vec3f(0.8,0.3,0.3);
bool Constellation::singleSelected = false; bool Constellation::singleSelected = false;
bool Constellation::seasonalRuleEnabled = false;
Constellation::Constellation() Constellation::Constellation()
: numberOfSegments(0) : numberOfSegments(0)
, asterism(NULL) , asterism(NULL)
{ {
} }
Constellation::~Constellation() Constellation::~Constellation()
{ {
delete[] asterism; delete[] asterism;
skipping to change at line 106 skipping to change at line 107
XYZname.normalize(); XYZname.normalize();
return true; return true;
} }
void Constellation::drawOptim(StelPainter& sPainter, const StelCore* core, const SphericalCap& viewportHalfspace) const void Constellation::drawOptim(StelPainter& sPainter, const StelCore* core, const SphericalCap& viewportHalfspace) const
{ {
if (lineFader.getInterstate()<=0.0001f) if (lineFader.getInterstate()<=0.0001f)
return; return;
sPainter.setColor(lineColor[0], lineColor[1], lineColor[2], lineFade if (checkVisibility())
r.getInterstate()); {
sPainter.setColor(lineColor[0], lineColor[1], lineColor[2],
lineFader.getInterstate());
Vec3d star1; Vec3d star1;
Vec3d star2; Vec3d star2;
for (unsigned int i=0;i<numberOfSegments;++i) for (unsigned int i=0;i<numberOfSegments;++i)
{ {
star1=asterism[2*i]->getJ2000EquatorialPos(core); star1=asterism[2*i]->getJ2000EquatorialPos(core);
star2=asterism[2*i+1]->getJ2000EquatorialPos(core); star2=asterism[2*i+1]->getJ2000EquatorialPos(core);
star1.normalize(); star1.normalize();
star2.normalize(); star2.normalize();
sPainter.drawGreatCircleArc(star1, star2, &viewportHalfspace sPainter.drawGreatCircleArc(star1, star2, &viewportH
); alfspace);
}
} }
} }
void Constellation::drawName(StelPainter& sPainter) const void Constellation::drawName(StelPainter& sPainter) const
{ {
if (!nameFader.getInterstate()) if (!nameFader.getInterstate())
return; return;
sPainter.setColor(labelColor[0], labelColor[1], labelColor[2], nameF
ader.getInterstate()); if (checkVisibility())
sPainter.drawText(XYname[0], XYname[1], nameI18, 0., -sPainter.getFo {
ntMetrics().width(nameI18)/2, 0, false); sPainter.setColor(labelColor[0], labelColor[1], labelColor[2
], nameFader.getInterstate());
sPainter.drawText(XYname[0], XYname[1], nameI18, 0., -sPaint
er.getFontMetrics().width(nameI18)/2, 0, false);
}
} }
void Constellation::drawArtOptim(StelPainter& sPainter, const SphericalRegi on& region) const void Constellation::drawArtOptim(StelPainter& sPainter, const SphericalRegi on& region) const
{ {
const float intensity = artFader.getInterstate(); if (checkVisibility())
if (artTexture && intensity && region.intersects(boundingCap))
{ {
sPainter.setColor(intensity,intensity,intensity); const float intensity = artFader.getInterstate();
if (artTexture && intensity && region.intersects(boundingCap
))
{
sPainter.setColor(intensity,intensity,intensity);
// The texture is not fully loaded // The texture is not fully loaded
if (artTexture->bind()==false) if (artTexture->bind()==false)
return; return;
sPainter.drawStelVertexArray(artPolygon); sPainter.drawStelVertexArray(artPolygon);
}
} }
} }
// Draw the art texture // Draw the art texture
void Constellation::drawArt(StelPainter& sPainter) const void Constellation::drawArt(StelPainter& sPainter) const
{ {
glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_ONE, GL_ONE);
sPainter.enableTexture2d(true); sPainter.enableTexture2d(true);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
skipping to change at line 218 skipping to change at line 229
pt2 = points->at(j+1); pt2 = points->at(j+1);
if (pt1*pt2>0.9999999f) if (pt1*pt2>0.9999999f)
continue; continue;
ptd1.set(pt1[0], pt1[1], pt1[2]); ptd1.set(pt1[0], pt1[1], pt1[2]);
ptd2.set(pt2[0], pt2[1], pt2[2]); ptd2.set(pt2[0], pt2[1], pt2[2]);
sPainter.drawGreatCircleArc(ptd1, ptd2, &viewportHal fspace); sPainter.drawGreatCircleArc(ptd1, ptd2, &viewportHal fspace);
} }
} }
} }
bool Constellation::checkVisibility() const
{
// Is supported seasonal rules by current starlore?
if (!seasonalRuleEnabled)
return true;
bool visible = false;
int year, month, day;
// Get the current month
StelUtils::getDateFromJulianDay(StelApp::getInstance().getCore()->ge
tJDay(), &year, &month, &day);
if (endSeason >= beginSeason)
{
// OK, it's a "normal" season rule...
if ((month >= beginSeason) && (month <= endSeason))
visible = true;
}
else
{
// ...oops, it's a "inverted" season rule
if (((month>=1) && (month<=endSeason)) || ((month>=beginSeas
on) && (month<=12)))
visible = true;
}
return visible;
}
StelObjectP Constellation::getBrightestStarInConstellation(void) const StelObjectP Constellation::getBrightestStarInConstellation(void) const
{ {
float maxMag = 99.f; float maxMag = 99.f;
StelObjectP brightest; StelObjectP brightest;
// maybe the brightest star has always odd index, // maybe the brightest star has always odd index,
// so check all segment endpoints: // so check all segment endpoints:
for (int i=2*numberOfSegments-1;i>=0;i--) for (int i=2*numberOfSegments-1;i>=0;i--)
{ {
const float Mag = asterism[i]->getVMagnitude(0); const float Mag = asterism[i]->getVMagnitude(0);
if (Mag < maxMag) if (Mag < maxMag)
 End of changes. 9 change blocks. 
23 lines changed or deleted 63 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/