Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
Sky Class Reference

#include <sky.h>

+ Inheritance diagram for Sky:
+ Collaboration diagram for Sky:

Public Member Functions

 Sky (s32 id, RenderingEngine *rendering_engine, ITextureSource *tsrc, IShaderSource *ssrc)
 constructor
 
virtual void OnRegisterSceneNode ()
 
virtual void render ()
 renders the node.
 
virtual const aabb3fgetBoundingBox () const
 
virtual video::SMaterial & getMaterial (u32 i)
 
virtual u32 getMaterialCount () const
 
void update (float m_time_of_day, float time_brightness, float direct_brightness, bool sunlight_seen, CameraMode cam_mode, float yaw, float pitch)
 
float getBrightness ()
 
video::SColor getBgColor () const
 
video::SColor getSkyColor () const
 
void setSunVisible (bool sun_visible)
 
bool getSunVisible () const
 
void setSunTexture (const std::string &sun_texture, const std::string &sun_tonemap, ITextureSource *tsrc)
 
void setSunScale (f32 sun_scale)
 
void setSunriseVisible (bool glow_visible)
 
void setSunriseTexture (const std::string &sunglow_texture, ITextureSource *tsrc)
 
v3f getSunDirection ()
 
void setMoonVisible (bool moon_visible)
 
bool getMoonVisible () const
 
void setMoonTexture (const std::string &moon_texture, const std::string &moon_tonemap, ITextureSource *tsrc)
 
void setMoonScale (f32 moon_scale)
 
v3f getMoonDirection ()
 
void setStarsVisible (bool stars_visible)
 
void setStarCount (u16 star_count)
 
void setStarColor (video::SColor star_color)
 
void setStarScale (f32 star_scale)
 
void setStarDayOpacity (f32 day_opacity)
 
bool getCloudsVisible () const
 
const video::SColorf & getCloudColor () const
 
void setVisible (bool visible)
 
void setCloudsEnabled (bool clouds_enabled)
 
void setFallbackBgColor (video::SColor fallback_bg_color)
 
void setBodyOrbitTilt (float body_orbit_tilt)
 
void overrideColors (video::SColor bgcolor, video::SColor skycolor)
 
void setSkyColors (const SkyColor &sky_color)
 
void setHorizonTint (video::SColor sun_tint, video::SColor moon_tint, const std::string &use_sun_tint)
 
void setInClouds (bool clouds)
 
void clearSkyboxTextures ()
 
void addTextureToSkybox (const std::string &texture, int material_id, ITextureSource *tsrc)
 
void setFogDistance (s16 fog_distance)
 
s16 getFogDistance () const
 
void setFogStart (float fog_start)
 
float getFogStart () const
 
void setFogColor (video::SColor v)
 
video::SColor getFogColor () const
 

Private Member Functions

float m_horizon_blend ()
 
void updateStars ()
 
void draw_sun (video::IVideoDriver *driver, const video::SColor &suncolor, const video::SColor &suncolor2, float wicked_time_of_day)
 
void draw_moon (video::IVideoDriver *driver, const video::SColor &mooncolor, const video::SColor &mooncolor2, float wicked_time_of_day)
 
void draw_sky_body (std::array< video::S3DVertex, 4 > &vertices, float pos_1, float pos_2, const video::SColor &c)
 
void draw_stars (video::IVideoDriver *driver, float wicked_time_of_day)
 
void place_sky_body (std::array< video::S3DVertex, 4 > &vertices, float horizon_position, float day_position)
 

Static Private Member Functions

static video::SColor m_mix_scolor (video::SColor col1, video::SColor col2, f32 factor)
 
static video::SColorf m_mix_scolorf (video::SColorf col1, video::SColorf col2, f32 factor)
 

Private Attributes

aabb3f m_box
 
video::SMaterial m_materials [SKY_MATERIAL_COUNT]
 
bool m_visible = true
 
video::SColor m_fallback_bg_color = video::SColor(255, 255, 255, 255)
 
bool m_first_update = true
 
float m_time_of_day
 
float m_time_brightness
 
bool m_sunlight_seen
 
float m_brightness = 0.5f
 
float m_cloud_brightness = 0.5f
 
bool m_clouds_visible
 
bool m_clouds_enabled = true
 
bool m_directional_colored_fog
 
bool m_in_clouds = true
 
video::SColorf m_bgcolor_bright_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f)
 
video::SColorf m_skycolor_bright_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f)
 
video::SColorf m_cloudcolor_bright_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f)
 
video::SColor m_bgcolor
 
video::SColor m_skycolor
 
video::SColorf m_cloudcolor_f
 
video::SColorf m_cloudcolor_day_f = video::SColorf(1, 1, 1, 1)
 
video::SColorf m_cloudcolor_dawn_f
 
SkyboxParams m_sky_params
 
SunParams m_sun_params
 
MoonParams m_moon_params
 
StarParams m_star_params
 
bool m_default_tint = true
 
u64 m_seed = 0
 
irr_ptr< scene::SMeshBuffer > m_stars
 
video::ITexture * m_sun_texture = nullptr
 
video::ITexture * m_moon_texture = nullptr
 
video::IImage * m_sun_tonemap = nullptr
 
video::IImage * m_moon_tonemap = nullptr
 

Constructor & Destructor Documentation

◆ Sky()

Member Function Documentation

◆ addTextureToSkybox()

void Sky::addTextureToSkybox ( const std::string & texture,
int material_id,
ITextureSource * tsrc )

References baseMaterial(), ITextureSource::getTextureForMesh(), m_materials, m_sky_params, SKY_MATERIAL_COUNT, and SkyboxParams::textures.

+ Here is the call graph for this function:

◆ clearSkyboxTextures()

void Sky::clearSkyboxTextures ( )
inline

◆ draw_moon()

void Sky::draw_moon ( video::IVideoDriver * driver,
const video::SColor & mooncolor,
const video::SColor & mooncolor2,
float wicked_time_of_day )
private

References draw_sky_body(), m_materials, m_moon_params, m_moon_texture, m_sun_tonemap, place_sky_body(), and MoonParams::scale.

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_sky_body()

void Sky::draw_sky_body ( std::array< video::S3DVertex, 4 > & vertices,
float pos_1,
float pos_2,
const video::SColor & c )
private

Referenced by draw_moon(), and draw_sun().

+ Here is the caller graph for this function:

◆ draw_stars()

void Sky::draw_stars ( video::IVideoDriver * driver,
float wicked_time_of_day )
private

References StarParams::day_opacity, m_materials, m_star_params, m_stars, and StarParams::starcolor.

Referenced by render().

+ Here is the caller graph for this function:

◆ draw_sun()

void Sky::draw_sun ( video::IVideoDriver * driver,
const video::SColor & suncolor,
const video::SColor & suncolor2,
float wicked_time_of_day )
private

References draw_sky_body(), m_materials, m_sun_params, m_sun_texture, m_sun_tonemap, place_sky_body(), and SunParams::scale.

Referenced by render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBgColor()

video::SColor Sky::getBgColor ( ) const
inline

References m_bgcolor, m_fallback_bg_color, and m_visible.

Referenced by getFogColor().

+ Here is the caller graph for this function:

◆ getBoundingBox()

virtual const aabb3f & Sky::getBoundingBox ( ) const
inlinevirtual

References m_box.

◆ getBrightness()

float Sky::getBrightness ( )
inline

References m_brightness.

◆ getCloudColor()

const video::SColorf & Sky::getCloudColor ( ) const
inline

References m_cloudcolor_f.

◆ getCloudsVisible()

bool Sky::getCloudsVisible ( ) const
inline

◆ getFogColor()

video::SColor Sky::getFogColor ( ) const
inline

References SkyboxParams::fog_color, getBgColor(), and m_sky_params.

+ Here is the call graph for this function:

◆ getFogDistance()

s16 Sky::getFogDistance ( ) const
inline

◆ getFogStart()

float Sky::getFogStart ( ) const
inline

◆ getMaterial()

virtual video::SMaterial & Sky::getMaterial ( u32 i)
inlinevirtual

References m_materials.

◆ getMaterialCount()

virtual u32 Sky::getMaterialCount ( ) const
inlinevirtual

References SKY_MATERIAL_COUNT.

◆ getMoonDirection()

v3f Sky::getMoonDirection ( )

References SkyboxParams::body_orbit_tilt, getSkyBodyPosition(), getWickedTimeOfDay(), m_sky_params, and m_time_of_day.

Referenced by GameGlobalShaderConstantSetter::onSetConstants().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMoonVisible()

bool Sky::getMoonVisible ( ) const
inline

References m_moon_params, and MoonParams::visible.

Referenced by GameGlobalShaderConstantSetter::onSetConstants().

+ Here is the caller graph for this function:

◆ getSkyColor()

video::SColor Sky::getSkyColor ( ) const
inline

◆ getSunDirection()

v3f Sky::getSunDirection ( )

References SkyboxParams::body_orbit_tilt, getSkyBodyPosition(), getWickedTimeOfDay(), m_sky_params, and m_time_of_day.

Referenced by GameGlobalShaderConstantSetter::onSetConstants().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSunVisible()

bool Sky::getSunVisible ( ) const
inline

References m_sun_params, and SunParams::visible.

Referenced by GameGlobalShaderConstantSetter::onSetConstants().

+ Here is the caller graph for this function:

◆ m_horizon_blend()

float Sky::m_horizon_blend ( )
inlineprivate

References m_sunlight_seen, and m_time_of_day.

Referenced by update().

+ Here is the caller graph for this function:

◆ m_mix_scolor()

static video::SColor Sky::m_mix_scolor ( video::SColor col1,
video::SColor col2,
f32 factor )
inlinestaticprivate

Referenced by update().

+ Here is the caller graph for this function:

◆ m_mix_scolorf()

static video::SColorf Sky::m_mix_scolorf ( video::SColorf col1,
video::SColorf col2,
f32 factor )
inlinestaticprivate

Referenced by update().

+ Here is the caller graph for this function:

◆ OnRegisterSceneNode()

void Sky::OnRegisterSceneNode ( )
virtual

◆ overrideColors()

void Sky::overrideColors ( video::SColor bgcolor,
video::SColor skycolor )
inline

References m_bgcolor, and m_skycolor.

◆ place_sky_body()

void Sky::place_sky_body ( std::array< video::S3DVertex, 4 > & vertices,
float horizon_position,
float day_position )
private

References SkyboxParams::body_orbit_tilt, getSkyBodyPosition(), and m_sky_params.

Referenced by draw_moon(), and draw_sun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

void Sky::render ( )
virtual

◆ setBodyOrbitTilt()

void Sky::setBodyOrbitTilt ( float body_orbit_tilt)
inline

◆ setCloudsEnabled()

void Sky::setCloudsEnabled ( bool clouds_enabled)
inline

References m_clouds_enabled.

◆ setFallbackBgColor()

void Sky::setFallbackBgColor ( video::SColor fallback_bg_color)
inline

References m_fallback_bg_color.

◆ setFogColor()

void Sky::setFogColor ( video::SColor v)
inline

◆ setFogDistance()

void Sky::setFogDistance ( s16 fog_distance)
inline

◆ setFogStart()

void Sky::setFogStart ( float fog_start)
inline

◆ setHorizonTint()

void Sky::setHorizonTint ( video::SColor sun_tint,
video::SColor moon_tint,
const std::string & use_sun_tint )

◆ setInClouds()

void Sky::setInClouds ( bool clouds)
inline

References m_in_clouds.

◆ setMoonScale()

void Sky::setMoonScale ( f32 moon_scale)
inline

References m_moon_params, and MoonParams::scale.

◆ setMoonTexture()

void Sky::setMoonTexture ( const std::string & moon_texture,
const std::string & moon_tonemap,
ITextureSource * tsrc )

References baseMaterial(), disableTextureFiltering(), ITextureSource::getTexture(), getTextureAsImage(), ITextureSource::getTextureForMesh(), ITextureSource::isKnownSourceImage(), m_first_update, m_materials, m_moon_params, m_moon_texture, m_moon_tonemap, MoonParams::texture, and MoonParams::tonemap.

Referenced by Sky().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMoonVisible()

void Sky::setMoonVisible ( bool moon_visible)
inline

◆ setSkyColors()

void Sky::setSkyColors ( const SkyColor & sky_color)

◆ setStarColor()

void Sky::setStarColor ( video::SColor star_color)
inline

◆ setStarCount()

void Sky::setStarCount ( u16 star_count)

References StarParams::count, m_first_update, m_star_params, and updateStars().

Referenced by Sky().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setStarDayOpacity()

void Sky::setStarDayOpacity ( f32 day_opacity)
inline

◆ setStarScale()

void Sky::setStarScale ( f32 star_scale)
inline

References m_star_params, StarParams::scale, and updateStars().

+ Here is the call graph for this function:

◆ setStarsVisible()

void Sky::setStarsVisible ( bool stars_visible)
inline

◆ setSunriseTexture()

void Sky::setSunriseTexture ( const std::string & sunglow_texture,
ITextureSource * tsrc )

References ITextureSource::getTextureForMesh(), m_materials, m_sun_params, and SunParams::sunrise.

+ Here is the call graph for this function:

◆ setSunriseVisible()

void Sky::setSunriseVisible ( bool glow_visible)
inline

◆ setSunScale()

void Sky::setSunScale ( f32 sun_scale)
inline

References m_sun_params, and SunParams::scale.

◆ setSunTexture()

void Sky::setSunTexture ( const std::string & sun_texture,
const std::string & sun_tonemap,
ITextureSource * tsrc )

References baseMaterial(), disableTextureFiltering(), ITextureSource::getTexture(), getTextureAsImage(), ITextureSource::getTextureForMesh(), ITextureSource::isKnownSourceImage(), m_first_update, m_materials, m_sun_params, m_sun_texture, m_sun_tonemap, SunParams::texture, and SunParams::tonemap.

Referenced by Sky().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSunVisible()

void Sky::setSunVisible ( bool sun_visible)
inline

References m_sun_params, and SunParams::visible.

◆ setVisible()

void Sky::setVisible ( bool visible)
inline

References m_visible.

◆ update()

void Sky::update ( float m_time_of_day,
float time_brightness,
float direct_brightness,
bool sunlight_seen,
CameraMode cam_mode,
float yaw,
float pitch )

◆ updateStars()

void Sky::updateStars ( )
private

References StarParams::count, m_seed, m_star_params, m_stars, p(), PcgRandom::range(), StarParams::scale, and warningstream.

Referenced by setStarCount(), and setStarScale().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_bgcolor

video::SColor Sky::m_bgcolor
private

◆ m_bgcolor_bright_f

video::SColorf Sky::m_bgcolor_bright_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f)
private

Referenced by update().

◆ m_box

aabb3f Sky::m_box
private

Referenced by Sky(), and getBoundingBox().

◆ m_brightness

float Sky::m_brightness = 0.5f
private

Referenced by getBrightness(), render(), and update().

◆ m_cloud_brightness

float Sky::m_cloud_brightness = 0.5f
private

Referenced by update().

◆ m_cloudcolor_bright_f

video::SColorf Sky::m_cloudcolor_bright_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f)
private

Referenced by update().

◆ m_cloudcolor_dawn_f

video::SColorf Sky::m_cloudcolor_dawn_f
private
Initial value:
= video::SColorf(
255.0f/240.0f,
223.0f/240.0f,
191.0f/255.0f
)

Referenced by update().

◆ m_cloudcolor_day_f

video::SColorf Sky::m_cloudcolor_day_f = video::SColorf(1, 1, 1, 1)
private

Referenced by update().

◆ m_cloudcolor_f

video::SColorf Sky::m_cloudcolor_f
private

Referenced by getCloudColor(), and update().

◆ m_clouds_enabled

bool Sky::m_clouds_enabled = true
private

◆ m_clouds_visible

bool Sky::m_clouds_visible
private

Referenced by getCloudsVisible(), and update().

◆ m_default_tint

bool Sky::m_default_tint = true
private

Referenced by setHorizonTint(), and update().

◆ m_directional_colored_fog

bool Sky::m_directional_colored_fog
private

Referenced by Sky(), and update().

◆ m_fallback_bg_color

video::SColor Sky::m_fallback_bg_color = video::SColor(255, 255, 255, 255)
private

◆ m_first_update

bool Sky::m_first_update = true
private

◆ m_in_clouds

bool Sky::m_in_clouds = true
private

Referenced by render(), setInClouds(), and update().

◆ m_materials

◆ m_moon_params

◆ m_moon_texture

video::ITexture* Sky::m_moon_texture = nullptr
private

Referenced by draw_moon(), and setMoonTexture().

◆ m_moon_tonemap

video::IImage* Sky::m_moon_tonemap = nullptr
private

Referenced by render(), setMoonTexture(), and update().

◆ m_seed

u64 Sky::m_seed = 0
private

Referenced by Sky(), and updateStars().

◆ m_sky_params

◆ m_skycolor

video::SColor Sky::m_skycolor
private

◆ m_skycolor_bright_f

video::SColorf Sky::m_skycolor_bright_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f)
private

Referenced by update().

◆ m_star_params

◆ m_stars

irr_ptr<scene::SMeshBuffer> Sky::m_stars
private

Referenced by draw_stars(), and updateStars().

◆ m_sun_params

◆ m_sun_texture

video::ITexture* Sky::m_sun_texture = nullptr
private

Referenced by draw_sun(), and setSunTexture().

◆ m_sun_tonemap

video::IImage* Sky::m_sun_tonemap = nullptr
private

◆ m_sunlight_seen

bool Sky::m_sunlight_seen
private

Referenced by m_horizon_blend(), render(), and update().

◆ m_time_brightness

float Sky::m_time_brightness
private

Referenced by render(), and update().

◆ m_time_of_day

float Sky::m_time_of_day
private

◆ m_visible

bool Sky::m_visible = true
private

The documentation for this class was generated from the following files: