diff options
author | Ben Deutsch <ben@bendeutsch.de> | 2017-05-07 18:41:47 +0200 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2017-07-05 15:39:49 +0200 |
commit | 6bedb6de408d531c1843888edc6576040c368695 (patch) | |
tree | 1415a26e8f4f97121687f9ef8b7f21590ea88f8e /src/sky.h | |
parent | 61a3de42fd9c7c24c06ba8522e4240d4f5e3a04f (diff) | |
download | minetest-6bedb6de408d531c1843888edc6576040c368695.tar.gz minetest-6bedb6de408d531c1843888edc6576040c368695.tar.bz2 minetest-6bedb6de408d531c1843888edc6576040c368695.zip |
Fog effect when camera is inside cloud
Fixes issue #3576
* Clouds now take camera position as 3D, not 2D
* Cloud grid filling extracted to gridFilled method
* Clouds detect whether camera is inside cloud
* Camera in cloud changes fog by overriding sky colors
with cloud color
* Sun, moon and stars can be temporarily disabled
with setBodiesVisible
* Disabling fog also disables all "inside cloud" behaviors
Diffstat (limited to 'src/sky.h')
-rw-r--r-- | src/sky.h | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -64,8 +64,8 @@ public: return m_visible ? m_skycolor : m_fallback_bg_color; } - bool getCloudsVisible() { return m_clouds_visible && m_clouds_enabled; } - const video::SColorf &getCloudColor() { return m_cloudcolor_f; } + bool getCloudsVisible() const { return m_clouds_visible && m_clouds_enabled; } + const video::SColorf &getCloudColor() const { return m_cloudcolor_f; } void setVisible(bool visible) { m_visible = visible; } // Set only from set_sky API @@ -74,6 +74,12 @@ public: { m_fallback_bg_color = fallback_bg_color; } + void overrideColors(const video::SColor &bgcolor, const video::SColor &skycolor) + { + m_bgcolor = bgcolor; + m_skycolor = skycolor; + } + void setBodiesVisible(bool visible) { m_bodies_visible = visible; } private: aabb3f m_box; @@ -128,6 +134,7 @@ private: bool m_clouds_visible; // Whether clouds are disabled due to player underground bool m_clouds_enabled = true; // Initialised to true, reset only by set_sky API bool m_directional_colored_fog; + bool m_bodies_visible = true; // sun, moon, stars 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); |