]> git.lizzy.rs Git - minetest.git/blobdiff - src/clientmap.cpp
Rename --do-unittests to --run-unittests as @Zeno- and @sfan5 requested
[minetest.git] / src / clientmap.cpp
index fac59b0f1afdecbc43e3c685ad59410b0fe1bf6a..4ceb7bc9037f1761d51c49d74c7150e6051f2be1 100644 (file)
@@ -53,6 +53,20 @@ ClientMap::ClientMap(
 {
        m_box = core::aabbox3d<f32>(-BS*1000000,-BS*1000000,-BS*1000000,
                        BS*1000000,BS*1000000,BS*1000000);
+
+       /* TODO: Add a callback function so these can be updated when a setting
+        *       changes.  At this point in time it doesn't matter (e.g. /set
+        *       is documented to change server settings only)
+        *
+        * TODO: Local caching of settings is not optimal and should at some stage
+        *       be updated to use a global settings object for getting thse values
+        *       (as opposed to the this local caching). This can be addressed in
+        *       a later release.
+        */
+       m_cache_trilinear_filter  = g_settings->getBool("trilinear_filter");
+       m_cache_bilinear_filter   = g_settings->getBool("bilinear_filter");
+       m_cache_anistropic_filter = g_settings->getBool("anisotropic_filter");
+
 }
 
 ClientMap::~ClientMap()
@@ -176,7 +190,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;
+       //v3s16 camera_offset = m_camera_offset;
        m_camera_mutex.Unlock();
 
        // Use a higher fov to accomodate faster camera movements.
@@ -233,7 +247,7 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
                                continue;
                }
 
-               std::list< MapBlock * > sectorblocks;
+               MapBlockVect sectorblocks;
                sector->getBlocks(sectorblocks);
 
                /*
@@ -242,8 +256,8 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
 
                u32 sector_blocks_drawn = 0;
 
-               std::list< MapBlock * >::iterator i;
-               for(i=sectorblocks.begin(); i!=sectorblocks.end(); i++)
+               for(MapBlockVect::iterator i = sectorblocks.begin();
+                               i != sectorblocks.end(); i++)
                {
                        MapBlock *block = *i;
 
@@ -433,10 +447,6 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
                m_last_drawn_sectors.clear();
        }
 
-       bool use_trilinear_filter = g_settings->getBool("trilinear_filter");
-       bool use_bilinear_filter = g_settings->getBool("bilinear_filter");
-       bool use_anisotropic_filter = g_settings->getBool("anisotropic_filter");
-
        /*
                Get time for measuring timeout.
 
@@ -566,9 +576,9 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
                        {
                                scene::IMeshBuffer *buf = mesh->getMeshBuffer(i);
 
-                               buf->getMaterial().setFlag(video::EMF_TRILINEAR_FILTER, use_trilinear_filter);
-                               buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, use_bilinear_filter);
-                               buf->getMaterial().setFlag(video::EMF_ANISOTROPIC_FILTER, use_anisotropic_filter);
+                               buf->getMaterial().setFlag(video::EMF_TRILINEAR_FILTER, m_cache_trilinear_filter);
+                               buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, m_cache_bilinear_filter);
+                               buf->getMaterial().setFlag(video::EMF_ANISOTROPIC_FILTER, m_cache_anistropic_filter);
 
                                const video::SMaterial& material = buf->getMaterial();
                                video::IMaterialRenderer* rnd =
@@ -844,7 +854,6 @@ int ClientMap::getBackgroundBrightness(float max_d, u32 daylight_factor,
                        ret = decode_light(n.getLightBlend(daylight_factor, ndef));
                } else {
                        ret = oldvalue;
-                       //ret = blend_light(255, 0, daylight_factor);
                }
        } else {
                /*float pre = (float)brightness_sum / (float)brightness_count;