~ubuntu-branches/debian/jessie/stellarium/jessie

« back to all changes in this revision

Viewing changes to src/modules/Nebula.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cédric Delfosse
  • Date: 2009-03-13 20:07:22 UTC
  • mfrom: (1.1.8 upstream)
  • mto: (11.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20090313200722-gbgujsmzsa8a02ty
Import upstream version 0.10.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include "Nebula.hpp"
25
25
#include "NebulaMgr.hpp"
26
 
#include "STexture.hpp"
27
 
#include "SFont.hpp"
28
 
#include "Navigator.hpp"
 
26
#include "StelTexture.hpp"
 
27
#include "StelFont.hpp"
 
28
#include "StelNavigator.hpp"
29
29
#include "StelUtils.hpp"
30
30
#include "StelApp.hpp"
31
31
#include "StelTextureMgr.hpp"
32
 
#include "SFont.hpp"
 
32
#include "StelFont.hpp"
33
33
#include "StelModuleMgr.hpp"
34
34
#include "StelCore.hpp"
 
35
#include "StelPainter.hpp"
35
36
 
36
37
#include <QDebug>
37
38
 
38
 
STextureSP Nebula::texCircle;
39
 
SFont* Nebula::nebulaFont = NULL;
 
39
StelTextureSP Nebula::texCircle;
 
40
StelFont* Nebula::nebulaFont = NULL;
40
41
float Nebula::circleScale = 1.f;
41
42
float Nebula::hintsBrightness = 0;
42
43
Vec3f Nebula::labelColor = Vec3f(0.4,0.3,0.5);
105
106
        return str;
106
107
}
107
108
 
108
 
float Nebula::getSelectPriority(const Navigator *nav) const
 
109
float Nebula::getSelectPriority(const StelNavigator *nav) const
109
110
{
110
111
        if( ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("NebulaMgr"))->getFlagHints() )
111
112
        {
124
125
        return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.4) : ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("NebulaMgr"))->getLabelsColor();
125
126
}
126
127
 
127
 
double Nebula::getCloseViewFov(const Navigator*) const
 
128
double Nebula::getCloseViewFov(const StelNavigator*) const
128
129
{
129
 
        return angularSize * 4;
 
130
        return angularSize>0 ? angularSize * 4 : 1;
130
131
}
131
132
                                                   
132
 
void Nebula::drawHints(const StelCore* core, float maxMagHints)
 
133
void Nebula::drawHints(const StelPainter& sPainter, float maxMagHints)
133
134
{
134
135
        if (mag>maxMagHints)
135
136
                return;
138
139
        float lum = 1.;//qMin(1,4.f/getOnScreenSize(core))*0.8;
139
140
        glColor3f(circleColor[0]*lum*hintsBrightness, circleColor[1]*lum*hintsBrightness, circleColor[2]*lum*hintsBrightness);
140
141
        Nebula::texCircle->bind();
141
 
        core->getProjection()->drawSprite2dMode(XY[0], XY[1], 8);
 
142
        sPainter.drawSprite2dMode(XY[0], XY[1], 8);
142
143
}
143
144
 
144
 
void Nebula::drawLabel(const StelCore* core, float maxMagLabel)
 
145
void Nebula::drawLabel(const StelCore* core, const StelPainter& sPainter, float maxMagLabel)
145
146
{
146
147
        if (mag>maxMagLabel)
147
148
                return;
148
149
        glColor4f(labelColor[0], labelColor[1], labelColor[2], hintsBrightness);
149
 
        float size = getOnScreenSize(core);
 
150
        float size = getAngularSize(core)*M_PI/180.*core->getProjection(StelCore::FrameJ2000)->getPixelPerRadAtCenter();
150
151
        float shift = 4.f + size/1.8f;
151
152
        QString str;
152
153
        if (nameI18!="")
161
162
                        str = QString("IC %1").arg(IC_nb);
162
163
        }
163
164
        
164
 
        core->getProjection()->drawText(nebulaFont,XY[0]+shift, XY[1]+shift, str, 0, 0, 0, false);
 
165
        sPainter.drawText(nebulaFont,XY[0]+shift, XY[1]+shift, str, 0, 0, 0, false);
165
166
}
166
167
 
167
168
bool Nebula::readNGC(char *recordstr)