]> git.lizzy.rs Git - minetest.git/blobdiff - src/clientmap.cpp
Revert binary database block position encoding
[minetest.git] / src / clientmap.cpp
index e0c41c7629a24ee2ca46e00865612ebdb25e3ec1..0a5d00b99a01d7b649457bf43238d39ab9ca620b 100644 (file)
@@ -29,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "mapblock.h"
 #include "profiler.h"
 #include "settings.h"
+#include "camera.h" // CameraModes
 #include "util/mathconstants.h"
 #include <algorithm>
 
@@ -50,9 +51,6 @@ ClientMap::ClientMap(
        m_camera_direction(0,0,1),
        m_camera_fov(M_PI)
 {
-       m_camera_mutex.Init();
-       assert(m_camera_mutex.IsInitialized());
-       
        m_box = core::aabbox3d<f32>(-BS*1000000,-BS*1000000,-BS*1000000,
                        BS*1000000,BS*1000000,BS*1000000);
 }
@@ -178,6 +176,7 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
        v3f camera_position = m_camera_position;
        v3f camera_direction = m_camera_direction;
        f32 camera_fov = m_camera_fov;
+       v3s16 camera_offset = m_camera_offset;
        m_camera_mutex.Unlock();
 
        // Use a higher fov to accomodate faster camera movements.
@@ -253,6 +252,9 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
                                if not seen on display
                        */
                        
+                       if (block->mesh != NULL)
+                               block->mesh->updateCameraOffset(m_camera_offset);
+                       
                        float range = 100000 * BS;
                        if(m_control.range_all == false)
                                range = m_control.wanted_range * BS;
@@ -865,13 +867,16 @@ void ClientMap::renderPostFx()
        v3f camera_position = m_camera_position;
        m_camera_mutex.Unlock();
 
+       LocalPlayer *player = m_client->getEnv().getLocalPlayer();
+
        MapNode n = getNodeNoEx(floatToInt(camera_position, BS));
 
        // - If the player is in a solid node, make everything black.
        // - If the player is in liquid, draw a semi-transparent overlay.
+       // - Do not if player is in third person mode
        const ContentFeatures& features = nodemgr->get(n);
        video::SColor post_effect_color = features.post_effect_color;
-       if(features.solidness == 2 && !(g_settings->getBool("noclip") && m_gamedef->checkLocalPrivilege("noclip")))
+       if(features.solidness == 2 && !(g_settings->getBool("noclip") && m_gamedef->checkLocalPrivilege("noclip")) && player->camera_mode == CAMERA_MODE_FIRST)
        {
                post_effect_color = video::SColor(255, 0, 0, 0);
        }