aboutsummaryrefslogtreecommitdiff
path: root/src/clouds.h
diff options
context:
space:
mode:
authorBen Deutsch <ben@bendeutsch.de>2017-05-07 18:41:47 +0200
committerSmallJoker <mk939@ymail.com>2017-07-05 15:39:49 +0200
commit6bedb6de408d531c1843888edc6576040c368695 (patch)
tree1415a26e8f4f97121687f9ef8b7f21590ea88f8e /src/clouds.h
parent61a3de42fd9c7c24c06ba8522e4240d4f5e3a04f (diff)
downloadhax-minetest-server-6bedb6de408d531c1843888edc6576040c368695.tar.gz
hax-minetest-server-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/clouds.h')
-rw-r--r--src/clouds.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/clouds.h b/src/clouds.h
index 52ea930f9..66bd9269c 100644
--- a/src/clouds.h
+++ b/src/clouds.h
@@ -73,7 +73,7 @@ public:
void step(float dtime);
- void update(v2f camera_p, video::SColorf color);
+ void update(const v3f &camera_p, const video::SColorf &color);
void updateCameraOffset(v3s16 camera_offset)
{
@@ -116,6 +116,10 @@ public:
updateBox();
}
+ bool isCameraInsideCloud() const { return m_camera_inside_cloud; }
+
+ const video::SColor getColor() const { return m_color.toSColor(); }
+
private:
void updateBox()
{
@@ -125,17 +129,20 @@ private:
BS * 1000000.0f, height_bs + thickness_bs - BS * m_camera_offset.Y, BS * 1000000.0f);
}
+ bool gridFilled(int x, int y) const;
+
video::SMaterial m_material;
aabb3f m_box;
s16 m_passed_cloud_y;
u16 m_cloud_radius_i;
bool m_enable_3d;
u32 m_seed;
- v2f m_camera_pos;
+ v3f m_camera_pos;
v2f m_origin;
v3s16 m_camera_offset;
video::SColorf m_color = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
CloudParams m_params;
+ bool m_camera_inside_cloud = false;
};