20 #ifndef _STELSKYDRAWER_HPP_ 21 #define _STELSKYDRAWER_HPP_ 23 #include "RefractionExtinction.hpp" 26 #include "VecMath.hpp" 27 #include "StelOpenGL.hpp" 51 Q_PROPERTY(
double relativeStarScale READ getRelativeStarScale WRITE setRelativeStarScale NOTIFY relativeStarScaleChanged)
53 Q_PROPERTY(
double absoluteStarScale READ getAbsoluteStarScale WRITE setAbsoluteStarScale NOTIFY absoluteStarScaleChanged)
54 Q_PROPERTY(
double twinkleAmount READ getTwinkleAmount WRITE setTwinkleAmount NOTIFY twinkleAmountChanged)
55 Q_PROPERTY(
bool flagTwinkle READ getFlagTwinkle WRITE setFlagTwinkle NOTIFY flagTwinkleChanged)
56 Q_PROPERTY(
int bortleScaleIndex READ getBortleScaleIndex WRITE setBortleScaleIndex NOTIFY bortleScaleIndexChanged)
58 Q_PROPERTY(
bool flagStarMagnitudeLimit READ getFlagStarMagnitudeLimit WRITE setFlagStarMagnitudeLimit NOTIFY flagStarMagnitudeLimitChanged)
59 Q_PROPERTY(
bool flagNebulaMagnitudeLimit READ getFlagNebulaMagnitudeLimit WRITE setFlagNebulaMagnitudeLimit NOTIFY flagNebulaMagnitudeLimitChanged)
60 Q_PROPERTY(
bool flagPlanetMagnitudeLimit READ getFlagPlanetMagnitudeLimit WRITE setFlagPlanetMagnitudeLimit NOTIFY flagPlanetMagnitudeLimitChanged)
62 Q_PROPERTY(
double customStarMagLimit READ getCustomStarMagnitudeLimit WRITE setCustomStarMagnitudeLimit NOTIFY customStarMagLimitChanged)
63 Q_PROPERTY(
double customNebulaMagLimit READ getCustomNebulaMagnitudeLimit WRITE setCustomNebulaMagnitudeLimit NOTIFY customNebulaMagLimitChanged)
64 Q_PROPERTY(
double customPlanetMagLimit READ getCustomPlanetMagnitudeLimit WRITE setCustomPlanetMagnitudeLimit NOTIFY customPlanetMagLimitChanged)
66 Q_PROPERTY(
bool flagLuminanceAdaptation READ getFlagLuminanceAdaptation WRITE setFlagLuminanceAdaptation NOTIFY flagLuminanceAdaptationChanged)
68 Q_PROPERTY(
double extinctionCoefficient READ getExtinctionCoefficient WRITE setExtinctionCoefficient NOTIFY extinctionCoefficientChanged)
69 Q_PROPERTY(
double atmosphereTemperature READ getAtmosphereTemperature WRITE setAtmosphereTemperature NOTIFY atmosphereTemperatureChanged)
70 Q_PROPERTY(
double atmospherePressure READ getAtmospherePressure WRITE setAtmospherePressure NOTIFY atmospherePressureChanged)
84 void update(
double deltaTime);
101 bool drawPointSource(
StelPainter* sPainter, const
Vec3f& v, const
RCMag &rcMag,
unsigned int bV,
bool checkInScreen=false,
float twinkleFactor=1.0f)
103 return drawPointSource(sPainter, v, rcMag, colorTable[bV], checkInScreen, twinkleFactor);
106 bool drawPointSource(
StelPainter* sPainter,
const Vec3f& v,
const RCMag &rcMag,
const Vec3f& bcolor,
bool checkInScreen=
false,
float twinkleFactor=1.0f);
108 void drawSunCorona(
StelPainter* painter,
const Vec3f& v,
float radius,
const Vec3f& color,
const float alpha);
116 void postDrawSky3dModel(
StelPainter* p,
const Vec3f& v,
float illuminatedArea,
float mag,
const Vec3f& color =
Vec3f(1.f,1.f,1.f));
122 bool computeRCMag(
float mag,
RCMag*)
const;
129 void reportLuminanceInFov(
float lum,
bool fastAdaptation=
false);
137 static float surfacebrightnessToLuminance(
float sb);
141 static float luminanceToSurfacebrightness(
float lum);
146 return (
float)bV*(4.f/127.f)-0.5f;
152 return colorTable[bV];
157 void setRelativeStarScale(
double b=1.0) {
if(b!=starRelativeScale){ starRelativeScale=b; emit relativeStarScaleChanged(b);}}
162 void setAbsoluteStarScale(
double b=1.0) {
if(b!=starAbsoluteScaleF){ starAbsoluteScaleF=b; emit absoluteStarScaleChanged(b);}}
167 void setTwinkleAmount(
double b) {
if(b!=twinkleAmount){ twinkleAmount=b; emit twinkleAmountChanged(b);}}
172 void setFlagTwinkle(
bool b) {
if(b!=flagStarTwinkle){ flagStarTwinkle=b; emit flagTwinkleChanged(b);}}
186 void setBortleScaleIndex(
int index);
200 void setFlagStarMagnitudeLimit(
bool b) {
if(b!=flagStarMagnitudeLimit){ flagStarMagnitudeLimit = b; emit flagStarMagnitudeLimitChanged(b);}}
207 void setFlagNebulaMagnitudeLimit(
bool b) {
if(b!=flagNebulaMagnitudeLimit){ flagNebulaMagnitudeLimit = b; emit flagNebulaMagnitudeLimitChanged(b);}}
214 void setFlagPlanetMagnitudeLimit(
bool b) {
if(b!=flagPlanetMagnitudeLimit){ flagPlanetMagnitudeLimit = b; emit flagPlanetMagnitudeLimitChanged(b);}}
240 void setFlagLuminanceAdaptation(
bool b) {
if(b!=flagLuminanceAdaptation){ flagLuminanceAdaptation=b; emit flagLuminanceAdaptationChanged(b);}}
251 void setExtinctionCoefficient(
double extCoeff) {
if(extCoeff!=extinction.getExtinctionCoefficient()){ extinction.setExtinctionCoefficient(extCoeff); emit extinctionCoefficientChanged(extinction.getExtinctionCoefficient());}}
255 void setAtmosphereTemperature(
double celsius) {
if(celsius!=refraction.getTemperature()){refraction.setTemperature(celsius); emit atmosphereTemperatureChanged(refraction.getTemperature());}}
259 void setAtmospherePressure(
double mbar) {
if(mbar!=refraction.getPressure()){ refraction.setPressure(mbar); emit atmospherePressureChanged(refraction.getPressure());}}
274 void relativeStarScaleChanged(
double b);
276 void absoluteStarScaleChanged(
double b);
278 void twinkleAmountChanged(
double b);
280 void flagTwinkleChanged(
bool b);
282 void bortleScaleIndexChanged(
int index);
285 void flagStarMagnitudeLimitChanged(
bool b);
287 void flagNebulaMagnitudeLimitChanged(
bool b);
289 void flagPlanetMagnitudeLimitChanged(
bool b);
292 void customStarMagLimitChanged(
double limit);
294 void customNebulaMagLimitChanged(
double limit);
296 void customPlanetMagLimitChanged(
double limit);
299 void flagLuminanceAdaptationChanged(
bool b);
301 void extinctionCoefficientChanged(
double coeff);
302 void atmosphereTemperatureChanged(
double celsius);
303 void atmospherePressureChanged(
double mbar);
307 float reverseComputeRCMag(
float rmag)
const;
310 float computeLimitMagnitude()
const;
313 float computeLimitLuminance()
const;
316 float getMaxAdaptFov(
void)
const {
return maxAdaptFov;}
321 void setMaxAdaptFov(
float fov) {maxAdaptFov = (fov < 60.f) ? 60.f : fov;}
324 float getMinAdaptFov(
void)
const {
return minAdaptFov;}
329 void setMinAdaptFov(
float fov) {minAdaptFov = (fov > 60.f) ? 60.f : fov;}
332 void setInputScale(
float in) {inScale = in;}
334 float getInputScale()
const {
return inScale;}
339 inline float pointSourceMagToLuminance(
float mag)
const {
return std::exp(pointSourceMagToLnLuminance(mag));}
344 float pointSourceLuminanceToMag(
float lum);
349 float pointSourceMagToLnLuminance(
float mag)
const;
353 float findWorldLumForMag(
float mag,
float targetRadius);
361 float maxAdaptFov, minAdaptFov, lnfovFactor;
362 bool flagStarTwinkle;
363 bool flagForcedTwinkle;
364 double twinkleAmount;
368 bool flagHasAtmosphere;
372 bool flagStarMagnitudeLimit;
375 bool flagNebulaMagnitudeLimit;
378 bool flagPlanetMagnitudeLimit;
380 double starRelativeScale;
381 double starAbsoluteScaleF;
383 float starLinearScale;
386 float limitMagnitude;
389 float limitLuminance;
395 double customStarMagLimit;
402 double customNebulaMagLimit;
407 double customPlanetMagLimit;
413 void initColorTableFromConfigFile(
class QSettings* conf);
416 static Vec3f colorTable[128];
419 int bortleScaleIndex;
429 unsigned char color[4];
433 StarVertex* vertexArray;
436 unsigned char* textureCoordArray;
438 class QOpenGLShaderProgram* starShaderProgram;
439 struct StarShaderVars {
440 int projectionMatrix;
446 StarShaderVars starShaderVars;
449 unsigned int nbPointSources;
451 unsigned int maxPointSources;
463 bool flagLuminanceAdaptation;
465 float big3dModelHaloRadius;
468 #endif // _STELSKYDRAWER_HPP_ static const Vec3f & indexToColor(unsigned char bV)
Convert quantized B-V index to RGB colors.
void setFlagForcedTwinkle(bool b)
Set flag for enable twinkling of stars without atmosphere.
bool getFlagTwinkle() const
Get flag for source twinkling.
double getCustomStarMagnitudeLimit() const
Get the value used for forced star magnitude limiting.
bool getFlagNebulaMagnitudeLimit() const
Provide a set of methods used to draw sky objects taking into account eyes adaptation, zoom level, instrument model and artificially set magnitude limits.
void setFlagHasAtmosphere(bool b)
Informing the drawer whether atmosphere is displayed.
void setExtinctionCoefficient(double extCoeff)
Set extinction coefficient, mag/airmass (for extinction).
void setCustomNebulaMagnitudeLimit(double limit)
Sets a lower limit for nebula magnitudes (anything fainter is ignored).
void setBig3dModelHaloRadius(float r)
Set the radius of the big halo texture used when a 3d model is very bright.
Define the StelTextureSP type.
void setFlagStarMagnitudeLimit(bool b)
Toggle the application of user-defined star magnitude limit.
const Extinction & getExtinction() const
Get the current valid extinction computation object.
This class performs extinction computations, following literature from atmospheric optics and astrono...
const Refraction & getRefraction() const
Get the current valid refraction computation object.
float getLimitLuminance() const
Get the luminance of the faintest visible object (e.g.
This class performs refraction computations, following literature from atmospheric optics and astrono...
float getBig3dModelHaloRadius() const
Get the radius of the big halo texture used when a 3d model is very bright.
void setFlagLuminanceAdaptation(bool b)
Set the value of the eye adaptation flag.
void setRelativeStarScale(double b=1.0)
Set the way brighter stars will look bigger as the fainter ones.
Main class for Stellarium core processing.
void setAtmosphereTemperature(double celsius)
Set atmospheric (ground) temperature in deg celsius (for refraction).
void setFlagNebulaMagnitudeLimit(bool b)
Toggle the application of user-defined deep-sky object magnitude limit.
double getAtmospherePressure() const
Get atmospheric (ground) pressure in mbar (for refraction).
double getAtmosphereTemperature() const
Get atmospheric (ground) temperature in deg celsius (for refraction).
bool getFlagStarMagnitudeLimit() const
double getAbsoluteStarScale() const
Get the absolute star brightness scale.
void setAbsoluteStarScale(double b=1.0)
Set the absolute star brightness scale.
double getExtinctionCoefficient() const
Get extinction coefficient, mag/airmass (for extinction).
Converts tones in function of the eye adaptation to luminance.
bool getFlagPlanetMagnitudeLimit() const
Contains the 2 parameters necessary to draw a star on screen.
Provides functions for performing openGL drawing operations.
void setFlagTwinkle(bool b)
Set flag for source twinkling.
void setCustomPlanetMagnitudeLimit(double limit)
Sets a lower limit for solar system object magnitudes (anything fainter is ignored).
float getLimitMagnitude() const
Get the magnitude of the currently faintest visible point source It depends on the zoom level...
double getCustomNebulaMagnitudeLimit() const
Get the value used for forced nebula magnitude limiting.
bool getFlagHasAtmosphere() const
This is used to decide whether to apply refraction/extinction before rendering point sources et al...
void setCustomStarMagnitudeLimit(double limit)
Sets a lower limit for star magnitudes (anything fainter is ignored).
bool getFlagLuminanceAdaptation() const
Get the current value of eye adaptation flag.
A templatized 3d vector compatible with openGL.
Define the StelProjectorP type.
double getRelativeStarScale() const
Get the way brighter stars will look bigger as the fainter ones.
double getCustomPlanetMagnitudeLimit() const
Get the value used for forced solar system object magnitude limiting.
bool getFlagForcedTwinkle() const
Get flag for enable twinkling of stars without atmosphere.
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
void setAtmospherePressure(double mbar)
Set atmospheric (ground) pressure in mbar (for refraction).
int getBortleScaleIndex() const
Get the current Bortle scale index.
double getTwinkleAmount() const
Get source twinkle amount.
void setFlagPlanetMagnitudeLimit(bool b)
Toggle the application of user-defined solar system object magnitude limit.
static float indexToBV(unsigned char bV)
Convert quantized B-V index to float B-V.
void setTwinkleAmount(double b)
Set source twinkle amount.