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);
191 float getNELMFromBortleScale()
const;
202 void setFlagStarMagnitudeLimit(
bool b) {
if(b!=flagStarMagnitudeLimit){ flagStarMagnitudeLimit = b; emit flagStarMagnitudeLimitChanged(b);}}
209 void setFlagNebulaMagnitudeLimit(
bool b) {
if(b!=flagNebulaMagnitudeLimit){ flagNebulaMagnitudeLimit = b; emit flagNebulaMagnitudeLimitChanged(b);}}
216 void setFlagPlanetMagnitudeLimit(
bool b) {
if(b!=flagPlanetMagnitudeLimit){ flagPlanetMagnitudeLimit = b; emit flagPlanetMagnitudeLimitChanged(b);}}
242 void setFlagLuminanceAdaptation(
bool b) {
if(b!=flagLuminanceAdaptation){ flagLuminanceAdaptation=b; emit flagLuminanceAdaptationChanged(b);}}
253 void setExtinctionCoefficient(
double extCoeff) {
if(extCoeff!=extinction.getExtinctionCoefficient()){ extinction.setExtinctionCoefficient(extCoeff); emit extinctionCoefficientChanged(extinction.getExtinctionCoefficient());}}
257 void setAtmosphereTemperature(
double celsius) {
if(celsius!=refraction.getTemperature()){refraction.setTemperature(celsius); emit atmosphereTemperatureChanged(refraction.getTemperature());}}
261 void setAtmospherePressure(
double mbar) {
if(mbar!=refraction.getPressure()){ refraction.setPressure(mbar); emit atmospherePressureChanged(refraction.getPressure());}}
276 void relativeStarScaleChanged(
double b);
278 void absoluteStarScaleChanged(
double b);
280 void twinkleAmountChanged(
double b);
282 void flagTwinkleChanged(
bool b);
284 void bortleScaleIndexChanged(
int index);
287 void flagStarMagnitudeLimitChanged(
bool b);
289 void flagNebulaMagnitudeLimitChanged(
bool b);
291 void flagPlanetMagnitudeLimitChanged(
bool b);
294 void customStarMagLimitChanged(
double limit);
296 void customNebulaMagLimitChanged(
double limit);
298 void customPlanetMagLimitChanged(
double limit);
301 void flagLuminanceAdaptationChanged(
bool b);
303 void extinctionCoefficientChanged(
double coeff);
304 void atmosphereTemperatureChanged(
double celsius);
305 void atmospherePressureChanged(
double mbar);
309 float reverseComputeRCMag(
float rmag)
const;
312 float computeLimitMagnitude()
const;
315 float computeLimitLuminance()
const;
318 float getMaxAdaptFov(
void)
const {
return maxAdaptFov;}
323 void setMaxAdaptFov(
float fov) {maxAdaptFov = (fov < 60.f) ? 60.f : fov;}
326 float getMinAdaptFov(
void)
const {
return minAdaptFov;}
331 void setMinAdaptFov(
float fov) {minAdaptFov = (fov > 60.f) ? 60.f : fov;}
334 void setInputScale(
float in) {inScale = in;}
336 float getInputScale()
const {
return inScale;}
341 inline float pointSourceMagToLuminance(
float mag)
const {
return std::exp(pointSourceMagToLnLuminance(mag));}
346 float pointSourceLuminanceToMag(
float lum);
351 float pointSourceMagToLnLuminance(
float mag)
const;
355 float findWorldLumForMag(
float mag,
float targetRadius);
363 float maxAdaptFov, minAdaptFov, lnfovFactor;
364 bool flagStarTwinkle;
365 bool flagForcedTwinkle;
366 double twinkleAmount;
370 bool flagHasAtmosphere;
374 bool flagStarMagnitudeLimit;
377 bool flagNebulaMagnitudeLimit;
380 bool flagPlanetMagnitudeLimit;
382 double starRelativeScale;
383 double starAbsoluteScaleF;
385 float starLinearScale;
388 float limitMagnitude;
391 float limitLuminance;
397 double customStarMagLimit;
404 double customNebulaMagLimit;
409 double customPlanetMagLimit;
415 void initColorTableFromConfigFile(
class QSettings* conf);
418 static Vec3f colorTable[128];
421 int bortleScaleIndex;
431 unsigned char color[4];
435 StarVertex* vertexArray;
438 unsigned char* textureCoordArray;
440 class QOpenGLShaderProgram* starShaderProgram;
441 struct StarShaderVars {
442 int projectionMatrix;
448 StarShaderVars starShaderVars;
451 unsigned int nbPointSources;
453 unsigned int maxPointSources;
465 bool flagLuminanceAdaptation;
467 float big3dModelHaloRadius;
470 #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.