From 7b290660ead5e9cfc7ee2762217212ff995a6c85 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Fri, 1 Jul 2011 21:25:31 +0300 Subject: [PATCH] made screen go slightly blue when underwater --- src/client.h | 9 +++++++++ src/environment.cpp | 16 ++++++++++++++++ src/environment.h | 3 +++ src/game.cpp | 7 +++++++ 4 files changed, 35 insertions(+) diff --git a/src/client.h b/src/client.h index bd838fee0..0150b687e 100644 --- a/src/client.h +++ b/src/client.h @@ -292,6 +292,15 @@ public: { return m_access_denied_reason; } + + /* + This should only be used for calling the special drawing stuff in + ClientEnvironment + */ + ClientEnvironment * getEnv() + { + return &m_env; + } private: diff --git a/src/environment.cpp b/src/environment.cpp index ac78107a3..d55aa38d1 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1865,6 +1865,22 @@ ClientEnvEvent ClientEnvironment::getClientEvent() return m_client_event_queue.pop_front(); } +void ClientEnvironment::drawPostFx(video::IVideoDriver* driver, v3f camera_pos) +{ + /*LocalPlayer *player = getLocalPlayer(); + assert(player); + v3f pos_f = player->getPosition() + v3f(0,BS*1.625,0);*/ + v3f pos_f = camera_pos; + v3s16 p_nodes = floatToInt(pos_f, BS); + MapNode n = m_map->getNodeNoEx(p_nodes); + if(n.d == CONTENT_WATER || n.d == CONTENT_WATERSOURCE) + { + v2u32 ss = driver->getScreenSize(); + core::rect rect(0,0, ss.X, ss.Y); + driver->draw2DRectangle(video::SColor(64, 100, 100, 200), rect); + } +} + #endif // #ifndef SERVER diff --git a/src/environment.h b/src/environment.h index ce6b5ae1e..b6767858a 100644 --- a/src/environment.h +++ b/src/environment.h @@ -406,6 +406,9 @@ public: // Get event from queue. CEE_NONE is returned if queue is empty. ClientEnvEvent getClientEvent(); + + // Post effects + void drawPostFx(video::IVideoDriver* driver, v3f camera_pos); private: ClientMap *m_map; diff --git a/src/game.cpp b/src/game.cpp index 30206bf40..faadd0fe7 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2241,6 +2241,13 @@ void the_game( core::rect(0,0,screensize.X,screensize.Y), NULL); } + + /* + Environment post fx + */ + { + client.getEnv()->drawPostFx(driver, camera_position); + } /* End scene -- 2.25.1