#include <sky.h>
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 aabb3f & | getBoundingBox () 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 |
bool | m_enable_shaders = false |
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 |
video::ITexture * | m_moon_texture |
video::ITexture * | m_sun_tonemap |
video::ITexture * | m_moon_tonemap |
Sky::Sky | ( | s32 | id, |
RenderingEngine * | rendering_engine, | ||
ITextureSource * | tsrc, | ||
IShaderSource * | ssrc ) |
constructor
References baseMaterial(), SkyboxParams::body_orbit_tilt, SkyboxParams::fog_start, g_settings, Settings::getBool(), Settings::getFloat(), SkyboxDefaults::getMoonDefaults(), IShaderSource::getShader(), IShaderSource::getShaderInfo(), SkyboxDefaults::getSkyDefaults(), SkyboxDefaults::getStarDefaults(), SkyboxDefaults::getSunDefaults(), ITextureSource::getTextureForMesh(), m_box, m_directional_colored_fog, m_enable_shaders, m_materials, m_moon_params, m_seed, m_sky_params, m_star_params, m_sun_params, ShaderInfo::material, myrand(), rangelim, setMoonTexture(), setStarCount(), setSunTexture(), MoonParams::texture, SunParams::texture, TILE_MATERIAL_ALPHA, MoonParams::tonemap, and SunParams::tonemap.
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.
|
inline |
References m_sky_params, and SkyboxParams::textures.
|
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().
|
private |
|
private |
References StarParams::day_opacity, m_enable_shaders, m_materials, m_star_params, m_stars, setMeshBufferColor(), and StarParams::starcolor.
Referenced by render().
|
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().
|
inline |
References m_bgcolor, m_fallback_bg_color, and m_visible.
Referenced by getFogColor().
|
inline |
References m_brightness.
|
inline |
References m_cloudcolor_f.
|
inline |
References m_clouds_enabled, and m_clouds_visible.
|
inline |
References SkyboxParams::fog_color, getBgColor(), and m_sky_params.
|
inline |
References SkyboxParams::fog_distance, and m_sky_params.
|
inline |
References SkyboxParams::fog_start, and m_sky_params.
|
inlinevirtual |
References m_materials.
|
inlinevirtual |
References SKY_MATERIAL_COUNT.
v3f Sky::getMoonDirection | ( | ) |
References SkyboxParams::body_orbit_tilt, getSkyBodyPosition(), getWickedTimeOfDay(), m_sky_params, and m_time_of_day.
Referenced by GameGlobalShaderConstantSetter::onSetConstants().
|
inline |
References m_moon_params, and MoonParams::visible.
Referenced by GameGlobalShaderConstantSetter::onSetConstants().
|
inline |
References m_fallback_bg_color, m_skycolor, and m_visible.
v3f Sky::getSunDirection | ( | ) |
References SkyboxParams::body_orbit_tilt, getSkyBodyPosition(), getWickedTimeOfDay(), m_sky_params, and m_time_of_day.
Referenced by GameGlobalShaderConstantSetter::onSetConstants().
|
inline |
References m_sun_params, and SunParams::visible.
Referenced by GameGlobalShaderConstantSetter::onSetConstants().
|
inlineprivate |
References m_sunlight_seen, and m_time_of_day.
Referenced by update().
|
inlinestaticprivate |
|
inlinestaticprivate |
|
virtual |
|
inline |
References m_bgcolor, and m_skycolor.
|
private |
References SkyboxParams::body_orbit_tilt, getSkyBodyPosition(), and m_sky_params.
Referenced by draw_moon(), and draw_sun().
|
virtual |
renders the node.
References draw_moon(), draw_stars(), draw_sun(), easeCurve(), g_profiler, getWickedTimeOfDay(), m_bgcolor, m_brightness, m_in_clouds, m_materials, m_moon_params, m_moon_tonemap, m_sky_params, m_skycolor, m_star_params, m_sun_params, m_sun_tonemap, m_sunlight_seen, m_time_brightness, m_time_of_day, m_visible, MYMAX, MYMIN, PRECISION_MICRO, SPT_AVG, SunParams::sunrise_visible, SkyboxParams::textures, MoonParams::visible, StarParams::visible, and SunParams::visible.
|
inline |
References SkyboxParams::body_orbit_tilt, SkyboxParams::INVALID_SKYBOX_TILT, m_sky_params, and rangelim.
|
inline |
References m_clouds_enabled.
|
inline |
References m_fallback_bg_color.
|
inline |
References SkyboxParams::fog_color, and m_sky_params.
|
inline |
References SkyboxParams::fog_distance, and m_sky_params.
|
inline |
References SkyboxParams::fog_start, and m_sky_params.
void Sky::setHorizonTint | ( | video::SColor | sun_tint, |
video::SColor | moon_tint, | ||
const std::string & | use_sun_tint ) |
References SkyboxParams::fog_moon_tint, SkyboxParams::fog_sun_tint, m_default_tint, and m_sky_params.
|
inline |
References m_in_clouds.
|
inline |
References m_moon_params, and MoonParams::scale.
void Sky::setMoonTexture | ( | const std::string & | moon_texture, |
const std::string & | moon_tonemap, | ||
ITextureSource * | tsrc ) |
References baseMaterial(), disableTextureFiltering(), ITextureSource::getTexture(), 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().
|
inline |
References m_moon_params, and MoonParams::visible.
void Sky::setSkyColors | ( | const SkyColor & | sky_color | ) |
References m_sky_params, and SkyboxParams::sky_color.
|
inline |
References m_star_params, and StarParams::starcolor.
void Sky::setStarCount | ( | u16 | star_count | ) |
References StarParams::count, m_first_update, m_star_params, and updateStars().
Referenced by Sky().
|
inline |
References StarParams::day_opacity, and m_star_params.
|
inline |
References m_star_params, StarParams::scale, and updateStars().
|
inline |
References m_star_params, and StarParams::visible.
void Sky::setSunriseTexture | ( | const std::string & | sunglow_texture, |
ITextureSource * | tsrc ) |
References ITextureSource::getTextureForMesh(), m_materials, m_sun_params, and SunParams::sunrise.
|
inline |
References m_sun_params, and SunParams::sunrise_visible.
|
inline |
References m_sun_params, and SunParams::scale.
void Sky::setSunTexture | ( | const std::string & | sun_texture, |
const std::string & | sun_tonemap, | ||
ITextureSource * | tsrc ) |
References baseMaterial(), disableTextureFiltering(), ITextureSource::getTexture(), 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().
|
inline |
References m_sun_params, and SunParams::visible.
|
inline |
References m_visible.
void Sky::update | ( | float | m_time_of_day, |
float | time_brightness, | ||
float | direct_brightness, | ||
bool | sunlight_seen, | ||
CameraMode | cam_mode, | ||
float | yaw, | ||
float | pitch ) |
References CAMERA_MODE_THIRD, SkyColor::dawn_horizon, SkyColor::dawn_sky, SkyColor::day_horizon, SkyColor::day_sky, SkyboxParams::fog_moon_tint, SkyboxParams::fog_sun_tint, SkyColor::indoors, m_bgcolor, m_bgcolor_bright_f, m_brightness, m_cloud_brightness, m_cloudcolor_bright_f, m_cloudcolor_dawn_f, m_cloudcolor_day_f, m_cloudcolor_f, m_clouds_visible, m_default_tint, m_directional_colored_fog, m_first_update, m_horizon_blend(), m_in_clouds, m_materials, m_mix_scolor(), m_mix_scolorf(), m_moon_tonemap, m_sky_params, m_skycolor, m_skycolor_bright_f, m_sun_tonemap, m_sunlight_seen, m_time_brightness, m_time_of_day, MYMIN, SkyColor::night_horizon, SkyColor::night_sky, rangelim, SkyboxParams::sky_color, update(), and wrapDegrees_0_360().
Referenced by update().
|
private |
References StarParams::count, m_enable_shaders, m_seed, m_star_params, m_stars, p(), PcgRandom::range(), StarParams::scale, and warningstream.
Referenced by setStarCount(), and setStarScale().
|
private |
Referenced by getBgColor(), overrideColors(), render(), and update().
|
private |
Referenced by update().
|
private |
Referenced by Sky(), and getBoundingBox().
|
private |
Referenced by getBrightness(), render(), and update().
|
private |
Referenced by update().
|
private |
Referenced by update().
|
private |
Referenced by update().
|
private |
Referenced by update().
|
private |
Referenced by getCloudColor(), and update().
|
private |
Referenced by getCloudsVisible(), and setCloudsEnabled().
|
private |
Referenced by getCloudsVisible(), and update().
|
private |
Referenced by setHorizonTint(), and update().
|
private |
Referenced by Sky(), draw_stars(), and updateStars().
|
private |
Referenced by getBgColor(), getSkyColor(), and setFallbackBgColor().
|
private |
Referenced by setMoonTexture(), setStarCount(), setSunTexture(), and update().
|
private |
Referenced by render(), setInClouds(), and update().
|
private |
Referenced by Sky(), addTextureToSkybox(), draw_moon(), draw_stars(), draw_sun(), getMaterial(), render(), setMoonTexture(), setSunriseTexture(), setSunTexture(), and update().
|
private |
Referenced by Sky(), draw_moon(), getMoonVisible(), render(), setMoonScale(), setMoonTexture(), and setMoonVisible().
|
private |
Referenced by draw_moon(), and setMoonTexture().
|
private |
Referenced by render(), setMoonTexture(), and update().
|
private |
Referenced by Sky(), and updateStars().
|
private |
|
private |
Referenced by getSkyColor(), overrideColors(), render(), and update().
|
private |
Referenced by update().
|
private |
Referenced by Sky(), draw_stars(), render(), setStarColor(), setStarCount(), setStarDayOpacity(), setStarScale(), setStarsVisible(), and updateStars().
|
private |
Referenced by draw_stars(), and updateStars().
|
private |
Referenced by Sky(), draw_sun(), getSunVisible(), render(), setSunriseTexture(), setSunriseVisible(), setSunScale(), setSunTexture(), and setSunVisible().
|
private |
Referenced by draw_sun(), and setSunTexture().
|
private |
Referenced by draw_moon(), draw_sun(), render(), setSunTexture(), and update().
|
private |
Referenced by m_horizon_blend(), render(), and update().
|
private |
Referenced by getMoonDirection(), getSunDirection(), m_horizon_blend(), render(), and update().
|
private |
Referenced by getBgColor(), getSkyColor(), render(), and setVisible().