9#include <SMeshBuffer.h>
15#define SKY_MATERIAL_COUNT 12
26class Sky :
public scene::ISceneNode
44 bool sunlight_seen,
CameraMode cam_mode,
float yaw,
float pitch);
102 void setHorizonTint(video::SColor sun_tint, video::SColor moon_tint,
103 const std::string &use_sun_tint);
137 return (x - 0.3) * 10;
139 return (0.5 - x) * 10;
144 static video::SColor
m_mix_scolor(video::SColor col1, video::SColor col2, f32 factor)
146 video::SColor result = video::SColor(
147 col1.getAlpha() * (1 - factor) + col2.getAlpha() * factor,
148 col1.getRed() * (1 - factor) + col2.getRed() * factor,
149 col1.getGreen() * (1 - factor) + col2.getGreen() * factor,
150 col1.getBlue() * (1 - factor) + col2.getBlue() * factor);
153 static video::SColorf
m_mix_scolorf(video::SColorf col1, video::SColorf col2, f32 factor)
155 video::SColorf result =
156 video::SColorf(col1.r * (1 - factor) + col2.r * factor,
157 col1.g * (1 - factor) + col2.g * factor,
158 col1.b * (1 - factor) + col2.b * factor,
159 col1.a * (1 - factor) + col2.a * factor);
211 void draw_sun(video::IVideoDriver *driver,
const video::SColor &suncolor,
212 const video::SColor &suncolor2,
float wicked_time_of_day);
213 void draw_moon(video::IVideoDriver *driver,
const video::SColor &mooncolor,
214 const video::SColor &mooncolor2,
float wicked_time_of_day);
215 void draw_sky_body(std::array<video::S3DVertex, 4> &vertices,
216 float pos_1,
float pos_2,
const video::SColor &c);
217 void draw_stars(video::IVideoDriver *driver,
float wicked_time_of_day);
219 float horizon_position,
float day_position);
CameraMode
Definition camera.h:60
Definition texturesource.h:36
Definition renderingengine.h:68
bool m_in_clouds
Definition sky.h:175
v3f getSunDirection()
Definition sky.cpp:545
void setCloudsEnabled(bool clouds_enabled)
Definition sky.h:86
void place_sky_body(std::array< video::S3DVertex, 4 > &vertices, float horizon_position, float day_position)
Definition sky.cpp:701
void setStarCount(u16 star_count)
Definition sky.cpp:792
void update(float m_time_of_day, float time_brightness, float direct_brightness, bool sunlight_seen, CameraMode cam_mode, float yaw, float pitch)
Definition sky.cpp:321
static video::SColor m_mix_scolor(video::SColor col1, video::SColor col2, f32 factor)
Definition sky.h:144
s16 getFogDistance() const
Definition sky.h:111
void setHorizonTint(video::SColor sun_tint, video::SColor moon_tint, const std::string &use_sun_tint)
Definition sky.cpp:853
void draw_sun(video::IVideoDriver *driver, const video::SColor &suncolor, const video::SColor &suncolor2, float wicked_time_of_day)
Definition sky.cpp:555
v3f getMoonDirection()
Definition sky.cpp:550
bool m_directional_colored_fog
Definition sky.h:174
MoonParams m_moon_params
Definition sky.h:196
void setSunriseVisible(bool glow_visible)
Definition sky.h:63
void setMoonVisible(bool moon_visible)
Definition sky.h:67
static video::SColorf m_mix_scolorf(video::SColorf col1, video::SColorf col2, f32 factor)
Definition sky.h:153
void setSunScale(f32 sun_scale)
Definition sky.h:62
bool m_visible
Definition sky.h:163
virtual video::SMaterial & getMaterial(u32 i)
Definition sky.h:40
video::SColor m_skycolor
Definition sky.h:182
video::SColorf m_cloudcolor_bright_f
Definition sky.h:180
void draw_moon(video::IVideoDriver *driver, const video::SColor &mooncolor, const video::SColor &mooncolor2, float wicked_time_of_day)
Definition sky.cpp:601
void setStarColor(video::SColor star_color)
Definition sky.h:76
video::SMaterial m_materials[SKY_MATERIAL_COUNT]
Definition sky.h:125
SunParams m_sun_params
Definition sky.h:195
void setStarDayOpacity(f32 day_opacity)
Definition sky.h:78
float m_time_of_day
Definition sky.h:167
StarParams m_star_params
Definition sky.h:197
void draw_sky_body(std::array< video::S3DVertex, 4 > &vertices, float pos_1, float pos_2, const video::SColor &c)
Definition sky.cpp:684
void updateStars()
Definition sky.cpp:801
video::ITexture * m_sun_texture
Definition sky.h:204
video::ITexture * m_moon_texture
Definition sky.h:205
const video::SColorf & getCloudColor() const
Definition sky.h:81
void setStarScale(f32 star_scale)
Definition sky.h:77
video::SColor getBgColor() const
Definition sky.h:48
bool m_clouds_enabled
Definition sky.h:173
float m_horizon_blend()
Definition sky.h:127
video::SColor m_fallback_bg_color
Definition sky.h:165
float getFogStart() const
Definition sky.h:114
video::ITexture * m_moon_tonemap
Definition sky.h:207
video::SColorf m_skycolor_bright_f
Definition sky.h:179
video::SColor getSkyColor() const
Definition sky.h:53
bool m_enable_shaders
Definition sky.h:176
video::SColorf m_cloudcolor_day_f
Definition sky.h:186
video::SColor getFogColor() const
Definition sky.h:117
void setFallbackBgColor(video::SColor fallback_bg_color)
Definition sky.h:87
void clearSkyboxTextures()
Definition sky.h:105
void overrideColors(video::SColor bgcolor, video::SColor skycolor)
Definition sky.h:96
virtual void OnRegisterSceneNode()
Definition sky.cpp:93
bool m_first_update
Definition sky.h:166
void setFogColor(video::SColor v)
Definition sky.h:116
void setFogStart(float fog_start)
Definition sky.h:113
video::SColorf m_bgcolor_bright_f
Definition sky.h:178
virtual u32 getMaterialCount() const
Definition sky.h:41
float m_time_brightness
Definition sky.h:168
video::SColor m_bgcolor
Definition sky.h:181
void setStarsVisible(bool stars_visible)
Definition sky.h:74
bool getCloudsVisible() const
Definition sky.h:80
float m_cloud_brightness
Definition sky.h:171
video::ITexture * m_sun_tonemap
Definition sky.h:206
virtual void render()
renders the node.
Definition sky.cpp:101
void setSunriseTexture(const std::string &sunglow_texture, ITextureSource *tsrc)
Definition sky.cpp:750
void setFogDistance(s16 fog_distance)
Definition sky.h:110
void setBodyOrbitTilt(float body_orbit_tilt)
Definition sky.h:91
bool m_clouds_visible
Definition sky.h:172
void setSunVisible(bool sun_visible)
Definition sky.h:58
irr_ptr< scene::SMeshBuffer > m_stars
Definition sky.h:202
void draw_stars(video::IVideoDriver *driver, float wicked_time_of_day)
Definition sky.cpp:654
virtual const aabb3f & getBoundingBox() const
Definition sky.h:37
void setMoonScale(f32 moon_scale)
Definition sky.h:71
bool m_default_tint
Definition sky.h:199
bool getMoonVisible() const
Definition sky.h:68
float getBrightness()
Definition sky.h:46
bool m_sunlight_seen
Definition sky.h:169
SkyboxParams m_sky_params
Definition sky.h:194
video::SColorf m_cloudcolor_f
Definition sky.h:183
aabb3f m_box
Definition sky.h:124
Sky(s32 id, RenderingEngine *rendering_engine, ITextureSource *tsrc, IShaderSource *ssrc)
constructor
Definition sky.cpp:46
void setInClouds(bool clouds)
Definition sky.h:104
bool getSunVisible() const
Definition sky.h:59
void setMoonTexture(const std::string &moon_texture, const std::string &moon_tonemap, ITextureSource *tsrc)
Definition sky.cpp:762
float m_brightness
Definition sky.h:170
void setSkyColors(const SkyColor &sky_color)
Definition sky.cpp:848
video::SColorf m_cloudcolor_dawn_f
Definition sky.h:188
void setSunTexture(const std::string &sun_texture, const std::string &sun_tonemap, ITextureSource *tsrc)
Definition sky.cpp:720
void setVisible(bool visible)
Definition sky.h:83
void addTextureToSkybox(const std::string &texture, int material_id, ITextureSource *tsrc)
Definition sky.cpp:868
u64 m_seed
Definition sky.h:201
core::aabbox3d< f32 > aabb3f
Definition irr_aabb3d.h:11
core::vector3df v3f
Definition irr_v3d.h:11
Definition clientmap.h:35
#define rangelim(d, min, max)
Definition numeric.h:18
#define SKY_MATERIAL_COUNT
Definition sky.h:15
float getWickedTimeOfDay(float time_of_day)
Definition sky.cpp:882
Definition skyparams.h:48
f32 scale
Definition skyparams.h:52
bool visible
Definition skyparams.h:49
Definition skyparams.h:20
std::vector< std::string > textures
Definition skyparams.h:25
s16 fog_distance
Definition skyparams.h:32
video::SColor fog_color
Definition skyparams.h:34
static constexpr float INVALID_SKYBOX_TILT
Definition skyparams.h:21
float fog_start
Definition skyparams.h:33
float body_orbit_tilt
Definition skyparams.h:31
Definition skyparams.h:56
video::SColor starcolor
Definition skyparams.h:59
f32 scale
Definition skyparams.h:60
bool visible
Definition skyparams.h:57
f32 day_opacity
Definition skyparams.h:61
Definition skyparams.h:38
bool visible
Definition skyparams.h:39
f32 scale
Definition skyparams.h:44
bool sunrise_visible
Definition skyparams.h:43