20 #ifndef _STELSKYDRAWER_HPP_
21 #define _STELSKYDRAWER_HPP_
23 #include "RefractionExtinction.hpp"
26 #include "VecMath.hpp"
60 void update(
double deltaTime);
78 return drawPointSource(sPainter, v, rcMag, colorTable[bV], checkInScreen);
83 void drawSunCorona(
StelPainter* painter,
const Vec3f& v,
float radius,
const Vec3f& color,
const float alpha);
121 return (
float)bV*(4.f/127.f)-0.5f;
127 return colorTable[bV];
242 float reverseComputeRCMag(
float rmag)
const;
245 float computeLimitMagnitude()
const;
248 float computeLimitLuminance()
const;
251 float getMaxAdaptFov(
void)
const {
return maxAdaptFov;}
256 void setMaxAdaptFov(
float fov) {maxAdaptFov = (fov < 60.f) ? 60.f : fov;}
259 float getMinAdaptFov(
void)
const {
return minAdaptFov;}
264 void setMinAdaptFov(
float fov) {minAdaptFov = (fov > 60.f) ? 60.f : fov;}
267 void setInputScale(
float in) {inScale = in;}
269 float getInputScale()
const {
return inScale;}
274 inline float pointSourceMagToLuminance(
float mag)
const {
return std::exp(pointSourceMagToLnLuminance(mag));}
279 float pointSourceLuminanceToMag(
float lum);
284 float pointSourceMagToLnLuminance(
float mag)
const;
288 float findWorldLumForMag(
float mag,
float targetRadius);
296 float maxAdaptFov, minAdaptFov, lnfovFactor;
297 bool flagStarTwinkle;
302 bool flagHasAtmosphere;
306 bool flagStarMagnitudeLimit;
309 bool flagNebulaMagnitudeLimit;
312 bool flagPlanetMagnitudeLimit;
314 float starRelativeScale;
315 float starAbsoluteScaleF;
317 float starLinearScale;
320 float limitMagnitude;
323 float limitLuminance;
329 float customStarMagLimit;
336 float customNebulaMagLimit;
341 float customPlanetMagLimit;
347 void initColorTableFromConfigFile(
class QSettings* conf);
350 static Vec3f colorTable[128];
353 int bortleScaleIndex;
363 unsigned char color[4];
367 StarVertex* vertexArray;
370 unsigned char* textureCoordArray;
372 class QOpenGLShaderProgram* starShaderProgram;
373 struct StarShaderVars {
374 int projectionMatrix;
380 StarShaderVars starShaderVars;
383 unsigned int nbPointSources;
385 unsigned int maxPointSources;
397 bool flagLuminanceAdaptation;
399 float big3dModelHaloRadius;
402 #endif // _STELSKYDRAWER_HPP_
void setExtinctionCoefficient(float k)
Set visual extinction coefficient (mag/airmass), influences extinction computation.
static const Vec3f & indexToColor(unsigned char bV)
Convert quantized B-V index to RGB colors.
StelSkyDrawer(StelCore *core)
Constructor.
void preDraw()
To be called before the drawing stage starts.
bool getFlagTwinkle() const
Get flag for source twinkling.
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 update(double deltaTime)
Update with respect to the time and StelProjector/StelToneReproducer state.
void setBig3dModelHaloRadius(float r)
Set the radius of the big halo texture used when a 3d model is very bright.
static float surfacebrightnessToLuminance(float sb)
Compute the luminance for an extended source with the given surface brightness.
A templatized 3d vector compatible with openGL.
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...
void preDrawPointSource(StelPainter *p)
Set the proper openGL state before making calls to drawPointSource.
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.
A templatized 2d vector compatible with openGL.
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 setPressure(float p_mbar)
Set surface air pressure (mbars), influences refraction computation.
void setFlagNebulaMagnitudeLimit(bool b)
Toggle the application of user-defined deep-sky object magnitude limit.
void postDrawSky3dModel(StelPainter *p, const Vec3f &v, float illuminatedArea, float mag, const Vec3f &color=Vec3f(1.f, 1.f, 1.f))
Terminate drawing of a 3D model, draw the halo.
~StelSkyDrawer()
Destructor.
float getCustomStarMagnitudeLimit() const
Get the value used for forced star magnitude limiting.
double getAtmospherePressure() const
Get atmospheric (ground) pressure in mbar (for refraction).
float getCustomPlanetMagnitudeLimit() const
Get the value used for forced solar system object magnitude limiting.
double getAtmosphereTemperature() const
Get atmospheric (ground) temperature in deg celsius (for refraction).
bool getFlagStarMagnitudeLimit() const
void setAbsoluteStarScale(double b=1.0)
Set the absolute star brightness scale.
double getExtinctionCoefficient() const
Get extinction coefficient, mag/airmass (for extinction).
bool computeRCMag(float mag, RCMag *) const
Compute RMag and CMag from magnitude.
Converts tones in function of the eye adaptation to luminance.
bool getFlagPlanetMagnitudeLimit() const
float getCustomNebulaMagnitudeLimit() const
Get the value used for forced nebula magnitude limiting.
void init()
Init parameters from config file.
bool drawPointSource(StelPainter *sPainter, const Vec3f &v, const RCMag &rcMag, unsigned int bV, bool checkInScreen=false)
Draw a point source halo.
Contains the 2 parameters necessary to draw a star on screen.
Provides functions for performing openGL drawing operations.
float getTwinkleAmount() const
Get source twinkle amount.
void setBortleScaleIndex(int index)
Set the parameters so that the stars disappear at about the limit given by the bortle scale The limit...
float getRelativeStarScale() const
Get the way brighter stars will look bigger as the fainter ones.
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...
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.
void setTemperature(float t_C)
Set surface air temperature (degrees Celsius), influences refraction computation. ...
Define the StelProjectorP type.
void reportLuminanceInFov(float lum, bool fastAdaptation=false)
Report that an object of luminance lum with an on-screen area of area pixels is currently displayed T...
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
static float luminanceToSurfacebrightness(float lum)
Compute the surface brightness from the luminance of an extended source.
void setAtmospherePressure(double mbar)
Set atmospheric (ground) pressure in mbar (for refraction).
int getBortleScaleIndex() const
Get the current Bortle scale index.
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.
float getAbsoluteStarScale() const
Get the absolute star brightness scale.
void postDrawPointSource(StelPainter *sPainter)
Finalize the drawing of point sources.
void setTwinkleAmount(double b)
Set source twinkle amount.