made screen go slightly blue when underwater
authorPerttu Ahola <celeron55@gmail.com>
Fri, 1 Jul 2011 18:25:31 +0000 (21:25 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Fri, 1 Jul 2011 18:25:31 +0000 (21:25 +0300)
src/client.h
src/environment.cpp
src/environment.h
src/game.cpp

index bd838fee08165778657de65d1a4e84ae6d036ee6..0150b687e9414dac1f19fa22ce8520ac852031b4 100644 (file)
@@ -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:
        
index ac78107a3d641196922312540950210e0d5ab400..d55aa38d172bc96eda77f07c0e217687afa10778 100644 (file)
@@ -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<s32> rect(0,0, ss.X, ss.Y);
+               driver->draw2DRectangle(video::SColor(64, 100, 100, 200), rect);
+       }
+}
+
 #endif // #ifndef SERVER
 
 
index ce6b5ae1e76bb1c6912f99198b259ea2c8746789..b6767858ad5c49100a188e501e7c7bea05cc68a5 100644 (file)
@@ -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;
index 30206bf40cd5cbee42be58bd47ce6c9f5407548b..faadd0fe70a8be168f6b0651a4164519a47b6aa1 100644 (file)
@@ -2241,6 +2241,13 @@ void the_game(
                                        core::rect<s32>(0,0,screensize.X,screensize.Y),
                                        NULL);
                }
+
+               /*
+                       Environment post fx
+               */
+               {
+                       client.getEnv()->drawPostFx(driver, camera_position);
+               }
                
                /*
                        End scene