Constellation.cpp   Constellation.cpp 
skipping to change at line 24 skipping to change at line 24
* *
* 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., 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 <algorithm> #include <algorithm>
#include <QString> #include <QString>
#include <QTextStream> #include <QTextStream>
#include <QDebug> #include <QDebug>
#include "Projector.hpp" #include "StelProjector.hpp"
#include "Constellation.hpp" #include "Constellation.hpp"
#include "StarMgr.hpp" #include "StarMgr.hpp"
#include "Navigator.hpp" #include "StelNavigator.hpp"
#include "STexture.hpp" #include "StelTexture.hpp"
#include "SFont.hpp" #include "StelFont.hpp"
#include "StelPainter.hpp"
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;
Constellation::Constellation() : asterism(NULL) Constellation::Constellation() : asterism(NULL)
{ {
} }
skipping to change at line 84 skipping to change at line 85
asterism[i]=starMgr->searchHP(HP); asterism[i]=starMgr->searchHP(HP);
if (!asterism[i]) if (!asterism[i])
{ {
qWarning() << "Error in Constellation " << abbreviat ion << " asterism : can't find star HP= " << HP; qWarning() << "Error in Constellation " << abbreviat ion << " asterism : can't find star HP= " << HP;
// TODO: why is this delete commented? // TODO: why is this delete commented?
// delete[] asterism; // delete[] asterism;
return false; return false;
} }
} }
XYZname.set(0.,0.,0.);
for(unsigned int ii=0;ii<numberOfSegments*2;++ii) for(unsigned int ii=0;ii<numberOfSegments*2;++ii)
{ {
XYZname+= asterism[ii]->getObsJ2000Pos(0); XYZname+= asterism[ii]->getJ2000EquatorialPos(0);
} }
XYZname*=1./(numberOfSegments*2); XYZname*=1./(numberOfSegments*2);
return true; return true;
} }
void Constellation::drawOptim(Projector* prj) const void Constellation::drawOptim(const StelProjectorP& prj) const
{ {
if(!lineFader.getInterstate()) return; if(!lineFader.getInterstate()) return;
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transpa rency mode glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transpa rency mode
glColor4f(lineColor[0], lineColor[1], lineColor[2], lineFader.getInt erstate()); glColor4f(lineColor[0], lineColor[1], lineColor[2], lineFader.getInt erstate());
Vec3d star1; Vec3d star1;
Vec3d star2; Vec3d star2;
for (unsigned int i=0;i<numberOfSegments;++i) for (unsigned int i=0;i<numberOfSegments;++i)
{ {
if (prj->projectLineCheck(asterism[2*i]->getObsJ2000Pos(0),s tar1,asterism[2*i+1]->getObsJ2000Pos(0),star2)) if (prj->projectLineCheck(asterism[2*i]->getJ2000EquatorialP os(0),star1,asterism[2*i+1]->getJ2000EquatorialPos(0),star2))
{ {
glBegin(GL_LINES); glBegin(GL_LINES);
glVertex2f(star1[0],star1[1]); glVertex2f(star1[0],star1[1]);
glVertex2f(star2[0],star2[1]); glVertex2f(star2[0],star2[1]);
glEnd(); glEnd();
} }
} }
} }
void Constellation::drawName(SFont *constfont, Projector* prj) const void Constellation::drawName(StelFont *constfont, const StelPainter& sPaint er) const
{ {
if(!nameFader.getInterstate()) return; if(!nameFader.getInterstate())
return;
glColor4f(labelColor[0], labelColor[1], labelColor[2], nameFader.get Interstate()); glColor4f(labelColor[0], labelColor[1], labelColor[2], nameFader.get Interstate());
prj->drawText(constfont, XYname[0], XYname[1], nameI18, sPainter.drawText(constfont, XYname[0], XYname[1], nameI18, 0., -con
0., -constfont->getStrLen(nameI18)/2, 0, false); stfont->getStrLen(nameI18)/2, 0, false);
} }
void Constellation::drawArtOptim(Projector* prj, const Navigator* nav) cons t void Constellation::drawArtOptim(const StelProjectorP& prj, const StelNavig ator* nav) const
{ {
float intensity = artFader.getInterstate(); float intensity = artFader.getInterstate();
if (artTexture && intensity) if (artTexture && intensity)
{ {
glColor3f(intensity,intensity,intensity); glColor3f(intensity,intensity,intensity);
Vec3d v0, v1, v2, v3, v4, v5, v6, v7, v8; Vec3d v0, v1, v2, v3, v4, v5, v6, v7, v8;
bool b0, b1, b2, b3, b4, b5, b6, b7, b8; bool b0, b1, b2, b3, b4, b5, b6, b7, b8;
// If one of the point is in the screen // If one of the point is in the screen
b0 = prj->projectCheck(artVertex[0],v0) || (nav->getJ2000Equ b0 = prj->projectCheck(artVertex[0],v0) || (nav->getJ2000Equ
Vision().dot(artVertex[0])>0.9); VisionDirection().dot(artVertex[0])>0.9);
b1 = prj->projectCheck(artVertex[1],v1) || (nav->getJ2000Equ b1 = prj->projectCheck(artVertex[1],v1) || (nav->getJ2000Equ
Vision().dot(artVertex[1])>0.9); VisionDirection().dot(artVertex[1])>0.9);
b2 = prj->projectCheck(artVertex[2],v2) || (nav->getJ2000Equ b2 = prj->projectCheck(artVertex[2],v2) || (nav->getJ2000Equ
Vision().dot(artVertex[2])>0.9); VisionDirection().dot(artVertex[2])>0.9);
b3 = prj->projectCheck(artVertex[3],v3) || (nav->getJ2000Equ b3 = prj->projectCheck(artVertex[3],v3) || (nav->getJ2000Equ
Vision().dot(artVertex[3])>0.9); VisionDirection().dot(artVertex[3])>0.9);
b4 = prj->projectCheck(artVertex[4],v4) || (nav->getJ2000Equ b4 = prj->projectCheck(artVertex[4],v4) || (nav->getJ2000Equ
Vision().dot(artVertex[4])>0.9); VisionDirection().dot(artVertex[4])>0.9);
b5 = prj->projectCheck(artVertex[5],v5) || (nav->getJ2000Equ b5 = prj->projectCheck(artVertex[5],v5) || (nav->getJ2000Equ
Vision().dot(artVertex[5])>0.9); VisionDirection().dot(artVertex[5])>0.9);
b6 = prj->projectCheck(artVertex[6],v6) || (nav->getJ2000Equ b6 = prj->projectCheck(artVertex[6],v6) || (nav->getJ2000Equ
Vision().dot(artVertex[6])>0.9); VisionDirection().dot(artVertex[6])>0.9);
b7 = prj->projectCheck(artVertex[7],v7) || (nav->getJ2000Equ b7 = prj->projectCheck(artVertex[7],v7) || (nav->getJ2000Equ
Vision().dot(artVertex[7])>0.9); VisionDirection().dot(artVertex[7])>0.9);
b8 = prj->projectCheck(artVertex[8],v8) || (nav->getJ2000Equ b8 = prj->projectCheck(artVertex[8],v8) || (nav->getJ2000Equ
Vision().dot(artVertex[8])>0.9); VisionDirection().dot(artVertex[8])>0.9);
if (b0 || b1 || b2 || b3 || b4 || b5 || b6 || b7 || b8) if (b0 || b1 || b2 || b3 || b4 || b5 || b6 || b7 || b8)
{ {
// The texture is not fully loaded // The texture is not fully loaded
if (artTexture->bind()==false) if (artTexture->bind()==false)
return; return;
if ((b0 || b1 || b2 || b3) && (v0[2]<1 && v1[2]<1 && v2[2]<1 && v3[2]<1)) if ((b0 || b1 || b2 || b3) && (v0[2]<1 && v1[2]<1 && v2[2]<1 && v3[2]<1))
{ {
glBegin(GL_QUADS); glBegin(GL_QUADS);
skipping to change at line 193 skipping to change at line 195
glTexCoord2f(0.5,0.5); glVertex2f(v 2[0],v2[1]); glTexCoord2f(0.5,0.5); glVertex2f(v 2[0],v2[1]);
glTexCoord2f(0.5,1); glVertex2f(v 7[0],v7[1]); glTexCoord2f(0.5,1); glVertex2f(v 7[0],v7[1]);
glTexCoord2f(0,1); glVe rtex2f(v8[0],v8[1]); glTexCoord2f(0,1); glVe rtex2f(v8[0],v8[1]);
glEnd(); glEnd();
} }
} }
} }
} }
// Draw the art texture // Draw the art texture
void Constellation::drawArt(Projector* prj, const Navigator* nav) const void Constellation::drawArt(const StelProjectorP& prj, const StelNavigator* nav) const
{ {
glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_ONE, GL_ONE);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
drawArtOptim(prj, nav); drawArtOptim(prj, nav);
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
} }
skipping to change at line 228 skipping to change at line 230
} }
void Constellation::update(int deltaTime) void Constellation::update(int deltaTime)
{ {
lineFader.update(deltaTime); lineFader.update(deltaTime);
nameFader.update(deltaTime); nameFader.update(deltaTime);
artFader.update(deltaTime); artFader.update(deltaTime);
boundaryFader.update(deltaTime); boundaryFader.update(deltaTime);
} }
void Constellation::drawBoundaryOptim(Projector* prj) const void Constellation::drawBoundaryOptim(const StelProjectorP& prj) const
{ {
if(!boundaryFader.getInterstate()) return; if(!boundaryFader.getInterstate()) return;
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transpa rency mode glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transpa rency mode
glColor4f(boundaryColor[0], boundaryColor[1], boundaryColor[2], boun daryFader.getInterstate()); glColor4f(boundaryColor[0], boundaryColor[1], boundaryColor[2], boun daryFader.getInterstate());
unsigned int i, j, size; unsigned int i, j, size;
 End of changes. 13 change blocks. 
32 lines changed or deleted 35 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/