9#include <SMeshBuffer.h>
15#define SKY_MATERIAL_COUNT 12
27class Sky :
public scene::ISceneNode
45 bool sunlight_seen,
CameraMode cam_mode,
float yaw,
float pitch);
103 void setHorizonTint(video::SColor sun_tint, video::SColor moon_tint,
104 const std::string &use_sun_tint);
138 return (x - 0.3) * 10;
140 return (0.5 - x) * 10;
145 static video::SColor
m_mix_scolor(video::SColor col1, video::SColor col2, f32 factor)
147 video::SColor result = video::SColor(
148 col1.getAlpha() * (1 - factor) + col2.getAlpha() * factor,
149 col1.getRed() * (1 - factor) + col2.getRed() * factor,
150 col1.getGreen() * (1 - factor) + col2.getGreen() * factor,
151 col1.getBlue() * (1 - factor) + col2.getBlue() * factor);
154 static video::SColorf
m_mix_scolorf(video::SColorf col1, video::SColorf col2, f32 factor)
156 video::SColorf result =
157 video::SColorf(col1.r * (1 - factor) + col2.r * factor,
158 col1.g * (1 - factor) + col2.g * factor,
159 col1.b * (1 - factor) + col2.b * factor,
160 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:176
v3f getSunDirection()
Definition sky.cpp:536
void setCloudsEnabled(bool clouds_enabled)
Definition sky.h:87
void place_sky_body(std::array< video::S3DVertex, 4 > &vertices, float horizon_position, float day_position)
Definition sky.cpp:689
void setStarCount(u16 star_count)
Definition sky.cpp:800
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:312
static video::SColor m_mix_scolor(video::SColor col1, video::SColor col2, f32 factor)
Definition sky.h:145
s16 getFogDistance() const
Definition sky.h:112
void setHorizonTint(video::SColor sun_tint, video::SColor moon_tint, const std::string &use_sun_tint)
Definition sky.cpp:860
void draw_sun(video::IVideoDriver *driver, const video::SColor &suncolor, const video::SColor &suncolor2, float wicked_time_of_day)
Definition sky.cpp:546
v3f getMoonDirection()
Definition sky.cpp:541
bool m_directional_colored_fog
Definition sky.h:175
MoonParams m_moon_params
Definition sky.h:196
void setSunriseVisible(bool glow_visible)
Definition sky.h:64
void setMoonVisible(bool moon_visible)
Definition sky.h:68
static video::SColorf m_mix_scolorf(video::SColorf col1, video::SColorf col2, f32 factor)
Definition sky.h:154
void setSunScale(f32 sun_scale)
Definition sky.h:63
bool m_visible
Definition sky.h:164
virtual video::SMaterial & getMaterial(u32 i)
Definition sky.h:41
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:592
void setStarColor(video::SColor star_color)
Definition sky.h:77
video::SMaterial m_materials[SKY_MATERIAL_COUNT]
Definition sky.h:126
SunParams m_sun_params
Definition sky.h:195
void setStarDayOpacity(f32 day_opacity)
Definition sky.h:79
float m_time_of_day
Definition sky.h:168
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:672
void updateStars()
Definition sky.cpp:809
video::ITexture * m_sun_texture
Definition sky.h:204
video::ITexture * m_moon_texture
Definition sky.h:205
video::IImage * m_sun_tonemap
Definition sky.h:206
const video::SColorf & getCloudColor() const
Definition sky.h:82
void setStarScale(f32 star_scale)
Definition sky.h:78
video::SColor getBgColor() const
Definition sky.h:49
bool m_clouds_enabled
Definition sky.h:174
float m_horizon_blend()
Definition sky.h:128
video::SColor m_fallback_bg_color
Definition sky.h:166
float getFogStart() const
Definition sky.h:115
video::IImage * m_moon_tonemap
Definition sky.h:207
video::SColorf m_skycolor_bright_f
Definition sky.h:179
video::SColor getSkyColor() const
Definition sky.h:54
video::SColorf m_cloudcolor_day_f
Definition sky.h:186
video::SColor getFogColor() const
Definition sky.h:118
void setFallbackBgColor(video::SColor fallback_bg_color)
Definition sky.h:88
void clearSkyboxTextures()
Definition sky.h:106
void overrideColors(video::SColor bgcolor, video::SColor skycolor)
Definition sky.h:97
virtual void OnRegisterSceneNode()
Definition sky.cpp:90
bool m_first_update
Definition sky.h:167
void setFogColor(video::SColor v)
Definition sky.h:117
void setFogStart(float fog_start)
Definition sky.h:114
video::SColorf m_bgcolor_bright_f
Definition sky.h:178
virtual u32 getMaterialCount() const
Definition sky.h:42
float m_time_brightness
Definition sky.h:169
video::SColor m_bgcolor
Definition sky.h:181
void setStarsVisible(bool stars_visible)
Definition sky.h:75
bool getCloudsVisible() const
Definition sky.h:81
float m_cloud_brightness
Definition sky.h:172
virtual void render()
renders the node.
Definition sky.cpp:98
void setSunriseTexture(const std::string &sunglow_texture, ITextureSource *tsrc)
Definition sky.cpp:757
void setFogDistance(s16 fog_distance)
Definition sky.h:111
void setBodyOrbitTilt(float body_orbit_tilt)
Definition sky.h:92
bool m_clouds_visible
Definition sky.h:173
void setSunVisible(bool sun_visible)
Definition sky.h:59
irr_ptr< scene::SMeshBuffer > m_stars
Definition sky.h:202
void draw_stars(video::IVideoDriver *driver, float wicked_time_of_day)
Definition sky.cpp:645
virtual const aabb3f & getBoundingBox() const
Definition sky.h:38
void setMoonScale(f32 moon_scale)
Definition sky.h:72
bool m_default_tint
Definition sky.h:199
bool getMoonVisible() const
Definition sky.h:69
float getBrightness()
Definition sky.h:47
bool m_sunlight_seen
Definition sky.h:170
SkyboxParams m_sky_params
Definition sky.h:194
video::SColorf m_cloudcolor_f
Definition sky.h:183
aabb3f m_box
Definition sky.h:125
Sky(s32 id, RenderingEngine *rendering_engine, ITextureSource *tsrc, IShaderSource *ssrc)
constructor
Definition sky.cpp:46
void setInClouds(bool clouds)
Definition sky.h:105
bool getSunVisible() const
Definition sky.h:60
void setMoonTexture(const std::string &moon_texture, const std::string &moon_tonemap, ITextureSource *tsrc)
Definition sky.cpp:769
float m_brightness
Definition sky.h:171
void setSkyColors(const SkyColor &sky_color)
Definition sky.cpp:855
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:726
void setVisible(bool visible)
Definition sky.h:84
void addTextureToSkybox(const std::string &texture, int material_id, ITextureSource *tsrc)
Definition sky.cpp:875
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:889
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