CalcMySky
v0.3.1
|
Classes | |
struct | Direction |
View direction of a pixel. More... | |
struct | LoadingStatus |
Status of data loading process. More... | |
struct | SpectralRadiance |
Spectral radiance of a pixel. More... | |
Public Member Functions | |
virtual void | setDrawSurfaceCallback (std::function< void(QOpenGLShaderProgram &shprog)> const &drawSurface)=0 |
Set the callback that will draw the screen surface. More... | |
virtual int | initDataLoading (QByteArray viewDirVertShaderSrc, QByteArray viewDirFragShaderSrc, std::vector< std::pair< std::string, GLuint >> viewDirBindAttribLocations={})=0 |
Initialize step-by-step process of loading of data. More... | |
virtual void | setViewDirShaders (QByteArray viewDirVertShaderSrc, QByteArray viewDirFragShaderSrc, std::vector< std::pair< std::string, GLuint >> viewDirBindAttribLocations={})=0 |
Replace the current view direction shaders with a new set. More... | |
virtual LoadingStatus | stepDataLoading ()=0 |
Perform a single step of data loading. More... | |
virtual int | initPreparationToDraw ()=0 |
Initialize step-by-step process of preparation to render. More... | |
virtual LoadingStatus | stepPreparationToDraw ()=0 |
Perform a single step of preparation to draw. More... | |
virtual QString | currentActivity () const =0 |
Get a string describing current activity. More... | |
virtual bool | isReadyToRender () const =0 |
Tell whether the renderer is ready for a draw call. More... | |
virtual bool | isLoading () const =0 |
Tell whether the renderer is in process of loading data. More... | |
virtual bool | canGrabRadiance () const =0 |
Tell whether radiance of a pixel can be queried. More... | |
virtual bool | canSetSolarSpectrum () const =0 |
Tell whether solar spectrum can be changed. More... | |
virtual bool | canRenderPrecomputedEclipsedDoubleScattering () const =0 |
Tell whether precomputed eclipsed double scattering can be rendered. More... | |
virtual GLuint | getLuminanceTexture ()=0 |
Get OpenGL name of the luminance render target. More... | |
virtual void | draw (double brightness, bool clear)=0 |
Do the drawing. More... | |
virtual void | resizeEvent (int width, int height)=0 |
Update render target size. More... | |
virtual QVector4D | getPixelLuminance (QPoint const &pixelPos)=0 |
Get luminance of a pixel. More... | |
virtual SpectralRadiance | getPixelSpectralRadiance (QPoint const &pixelPos)=0 |
Get spectral radiance of a pixel. More... | |
virtual std::vector< float > | getWavelengths ()=0 |
Get the wavelengths used in computations. More... | |
virtual void | setSolarSpectrum (std::vector< float > const &spectralIrradianceAtTOA)=0 |
Set a custom solar spectrum. More... | |
virtual void | resetSolarSpectrum ()=0 |
Reset solar spectrum to the default. More... | |
virtual Direction | getViewDirection (QPoint const &pixelPos)=0 |
Get view direction of a pixel. More... | |
virtual int | initShaderReloading ()=0 |
Initialize step-by-step process of reloading of shaders. More... | |
virtual LoadingStatus | stepShaderReloading ()=0 |
Perform a single step of reloading of shaders. More... | |
virtual void | setScattererEnabled (QString const &name, bool enable)=0 |
Enable or disable a single-scattering layer. More... | |
|
pure virtual |
Implemented in AtmosphereRenderer.
|
pure virtual |
The calcmysky
utility has an option to disable generation of the texture for second-order scattering during solar eclipse. If this option was used for generation of the current atmosphere model, this function will return false
. In this case, it is only valid for ShowMySky::Settings::multipleScatteringEnabled to return true
either with ShowMySky::Settings::onTheFlyPrecompDoubleScatteringEnabled returning true
, or ShowMySky::Settings::usingEclipseShader returning false
.
Implemented in AtmosphereRenderer.
|
pure virtual |
Implemented in AtmosphereRenderer.
|
pure virtual |
This is a string intended for the user to see what's going on, e.g. "Loading textures and shaders...".
Implemented in AtmosphereRenderer.
|
pure virtual |
This is the method that performs all the drawing logic.
brightness | relative brightness of the scene. 0 effectively means draw nothing (or NaNs in case of broken textures or shaders), 1 means normal brightness. |
clear | whether to clear the screen surface to zeros prior to drawing. This can be set to false to accumulate subsequent draws, and to true to draw the first render. |
Implemented in AtmosphereRenderer.
|
pure virtual |
This method returns the OpenGL name suitable for use with glBindTexture
for the render target containing photopic and scotopic luminance values packed into vec4
pixels (see getPixelLuminance for details). This is the main output of draw that can be used to finally render the data to screen in the desired color space.
Implemented in AtmosphereRenderer.
|
pure virtual |
This method obtains luminance of the pixel specified by pixelPos
. First three components of the 4D vector are the CIE 1931 tristimulus values in lumens, while the fourth one is the scotopic luminance in lumens (CIE 1951).
Maximum luminous efficacy is 683.002 lm/W for photopic values and 1700.13 lm/W for scotopic ones. Reference: Rapport BIPM-2019/05. Principles Governing Photometry, 2nd edition. Sections 6.2, 6.3.
pixelPos | pixel position in window coordinates: (0,0) corresponds to top-left point. |
Implemented in AtmosphereRenderer.
|
pure virtual |
This method obtains spectral radiance of the pixel specified by pixelPos
.
pixelPos | pixel position in window coordinates: (0,0) corresponds to top-left point. |
Implemented in AtmosphereRenderer.
|
pure virtual |
This method obtains view direction corresponding to the pixel specified by pixelPos
.
pixelPos | pixel position in window coordinates: (0,0) corresponds to top-left point. |
Implemented in AtmosphereRenderer.
|
pure virtual |
Implemented in AtmosphereRenderer.
|
pure virtual |
This method initializes the process of loading of shaders and textures for the current atmosphere model. The actual loading is done step-by-step by calling stepDataLoading.
The fragment shader viewDirFragShaderSrc
passed here implements vec3 calcViewDir(void)
function that is used as an application-agnostic way of determining view direction of the ray associated with a given fragment of the surface being rendered.
viewDirVertShaderSrc | a vertex shader that will be used by all the shader programs that implement the atmosphere model; |
viewDirFragShaderSrc | a fragment shader that implements calcViewDir function; |
viewDirBindAttribLocations | locations of vertex attributes necessary to render the screen surface. Each pair consists of an attribute name and its location. |
Implemented in AtmosphereRenderer.
|
pure virtual |
The renderer loads different slices of textures depending on current scene parameters (e.g. altitude). Whenever such parameters change, it may become necessary to reload another slice.
The application might want to show a progress indicator for this reloading process. In this case, calling this method will initialize the process if it's needed and tell whether there's anything to do (return value is positive). If the return value is positive, stepPreparationToDraw should be called repeatedly until its return value indicates completion (or failure).
If there's no need for progress indication, this function (and stepPreparationToDraw) can be ignored. Otherwise, use this method to initialize the process of reloading data.
This method can also be called during the preparation to render to find out the number of steps to do.
Implemented in AtmosphereRenderer.
|
pure virtual |
This is a debug method. It initializes the process of reloading of shaders for the current atmosphere model. The actual reloading is done step-by-step by calling stepShaderReloading.
The reloading can be used to quickly update the current model when a shader has been edited or regenerated with another parameters.
Implemented in AtmosphereRenderer.
|
pure virtual |
Implemented in AtmosphereRenderer.
|
pure virtual |
Implemented in AtmosphereRenderer.
|
pure virtual |
This method undoes what setSolarSpectrum did, returning the current spectrum to the one used by calcmysky
utility when generating the textures.
Implemented in AtmosphereRenderer.
|
pure virtual |
This method should be called whenever the render target changes its size.
width | width of the render target; |
height | height of the rener target. |
Implemented in AtmosphereRenderer.
|
pure virtual |
This method sets a callback function that will be called each time a surface is to be rendered.
The callback has one parameter: a shader program shprog
that includes, aside from the core atmosphere model GLSL code, the shaders viewDirVertShaderSrc
and viewDirFragShaderSrc
that were passed to initDataLoading method (or to the constructor of AtmosphereRenderer). By the point when this callback is called, shprog
has already been bound to current OpenGL context (via glUseProgram
).
The purpose of shprog
is to enable setting of the necessary uniform values via the glUniform*
family of functions to make the drawing work. It also includes the calcViewDir
function implemented in viewDirVertShaderSrc
shader, so the necessary uniform values (if any) for the operation of calcViewDir
should also to be set in this callback before issuing any draw calls.
drawSurface | the callback that renders the surface. |
Implemented in AtmosphereRenderer.
|
pure virtual |
This is a debug option that lets one toggle a single-scattering layer associated with a particular scattering species.
This option doesn't affect transmittance of air, it only controls whether first-order inscattered light from the species specified is included in the render.
name | name of the species, as given in the Scatterer section of the model description file; |
enable | whether first-order inscattered light from this species should be rendered. |
Implemented in AtmosphereRenderer.
|
pure virtual |
This method lets one change the solar spectrum that was used in computations by calcmysky
utility, to aid easy switching between types of the illuminating star.
This method can only be called if canSetSolarSpectrum returns true
.
spectralIrradianceAtTOA | Spectral irradiance at the top of atmosphere (i.e. at the highest altitude for which the model has data), in \(\mathrm{\frac{W}{m^2\,sr\,nm}}\). |
Implemented in AtmosphereRenderer.
|
pure virtual |
This method lets the user change the way view direction is computed (e.g. to switch projections). The new vertex and fragment shaders replace the old ones that initially are passed to initDataLoading. This action may take some time because it causes relinking of all the shader programs in use.
viewDirVertShaderSrc | a vertex shader that will be used by all the shader programs that implement the atmosphere model; |
viewDirFragShaderSrc | a fragment shader that implements calcViewDir function; |
viewDirBindAttribLocations | locations of vertex attributes necessary to render the screen surface. Each pair consists of an attribute name and its location. |
Implemented in AtmosphereRenderer.
|
pure virtual |
This method performs a single step of data loading.
Implemented in AtmosphereRenderer.
|
pure virtual |
This method performs a single step of preparation to draw started by initPreparationToDraw.
Implemented in AtmosphereRenderer.
|
pure virtual |
This is a debug method. It performs a single step of the process of reloading of shaders initialized by initShaderReloading.
Implemented in AtmosphereRenderer.