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);
119 return (
float)bV*(4.f/127.f)-0.5f;
125 return colorTable[bV];
228 float reverseComputeRCMag(
float rmag)
const;
231 float computeLimitMagnitude()
const;
234 float computeLimitLuminance()
const;
237 float getMaxAdaptFov(
void)
const {
return maxAdaptFov;}
242 void setMaxAdaptFov(
float fov) {maxAdaptFov = (fov < 60.f) ? 60.f : fov;}
245 float getMinAdaptFov(
void)
const {
return minAdaptFov;}
250 void setMinAdaptFov(
float fov) {minAdaptFov = (fov > 60.f) ? 60.f : fov;}
253 void setInputScale(
float in) {inScale = in;}
255 float getInputScale()
const {
return inScale;}
260 inline float pointSourceMagToLuminance(
float mag)
const {
return std::exp(pointSourceMagToLnLuminance(mag));}
265 float pointSourceLuminanceToMag(
float lum);
270 float pointSourceMagToLnLuminance(
float mag)
const;
274 float findWorldLumForMag(
float mag,
float targetRadius);
282 float maxAdaptFov, minAdaptFov, lnfovFactor;
283 bool flagStarTwinkle;
288 bool flagHasAtmosphere;
292 bool flagStarMagnitudeLimit;
295 bool flagNebulaMagnitudeLimit;
297 float starRelativeScale;
298 float starAbsoluteScaleF;
300 float starLinearScale;
303 float limitMagnitude;
306 float limitLuminance;
312 float customStarMagLimit;
318 float customNebulaMagLimit;
324 void initColorTableFromConfigFile(
class QSettings* conf);
327 static Vec3f colorTable[128];
330 int bortleScaleIndex;
340 unsigned char color[4];
344 StarVertex* vertexArray;
347 unsigned char* textureCoordArray;
349 class QOpenGLShaderProgram* starShaderProgram;
350 struct StarShaderVars {
351 int projectionMatrix;
357 StarShaderVars starShaderVars;
360 unsigned int nbPointSources;
362 unsigned int maxPointSources;
373 bool flagLuminanceAdaptation;
375 float big3dModelHaloRadius;
378 #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.
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.
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).
A templatized 2d vector compatible with openGL.
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.
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.
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.
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.