Try to tune fog to work well on high-end machines also
authorPerttu Ahola <celeron55@gmail.com>
Tue, 18 Oct 2011 18:08:31 +0000 (21:08 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Tue, 18 Oct 2011 18:08:31 +0000 (21:08 +0300)
src/camera.cpp
src/defaultsettings.cpp
src/game.cpp
src/map.cpp

index ecb5a17f40c5ab47b1b1e977d6f621485a8c2bb9..a32336714fdadcd4a53db4b55d7a5ae79b4bbf5b 100644 (file)
@@ -342,7 +342,7 @@ void Camera::updateViewingRange(f32 frametime_in)
                        <<std::endl;*/
 
        m_draw_control.wanted_min_range = m_viewing_range_min;
-       m_draw_control.wanted_max_blocks = (1.5*m_draw_control.blocks_would_have_drawn)+1;
+       m_draw_control.wanted_max_blocks = (2.0*m_draw_control.blocks_would_have_drawn)+1;
        if (m_draw_control.wanted_max_blocks < 10)
                m_draw_control.wanted_max_blocks = 10;
 
@@ -366,7 +366,7 @@ void Camera::updateViewingRange(f32 frametime_in)
        // If needed frametime change is small, just return
        // This value was 0.4 for many months until 2011-10-18 by c55;
        // Let's see how this works out.
-       if (fabs(wanted_frametime_change) < m_wanted_frametime*0.25)
+       if (fabs(wanted_frametime_change) < m_wanted_frametime*0.33)
        {
                //dstream<<"ignoring small wanted_frametime_change"<<std::endl;
                return;
index b05d060ac10f037e0e63eef7eb3dfdb4106bc191..d88440812f6c0f75c2fc28196922382c702c902f 100644 (file)
@@ -45,6 +45,7 @@ void set_default_settings(Settings *settings)
        settings->setDefault("keymap_frametime_graph", "KEY_F1");
        settings->setDefault("keymap_screenshot", "KEY_F12");
        settings->setDefault("keymap_toggle_profiler", "KEY_F2");
+       settings->setDefault("keymap_toggle_force_fog_off", "KEY_F3");
        // Some (temporary) keys for debugging
        settings->setDefault("keymap_print_debug_stacks", "KEY_KEY_P");
 
index e3380ace401da06211dceab384d822c2ca63dee0..c67660ec8084e5ee702961b4f99608043c0b6b51 100644 (file)
@@ -952,6 +952,8 @@ void the_game(
 
        bool show_profiler = false;
 
+       bool force_fog_off = false;
+
        /*
                Main loop
        */
@@ -1323,6 +1325,10 @@ void the_game(
                        show_profiler = !show_profiler;
                        guitext_profiler->setVisible(show_profiler);
                }
+               else if(input->wasKeyDown(getKeySetting("keymap_toggle_force_fog_off")))
+               {
+                       force_fog_off = !force_fog_off;
+               }
 
                // Item selection with mouse wheel
                {
@@ -1971,7 +1977,7 @@ void the_game(
                        Fog
                */
                
-               if(g_settings->getBool("enable_fog") == true)
+               if(g_settings->getBool("enable_fog") == true && !force_fog_off)
                {
                        f32 range;
                        if(farmesh)
@@ -1981,12 +1987,11 @@ void the_game(
                        else
                        {
                                range = draw_control.wanted_range*BS + MAP_BLOCKSIZE*BS*1.5;
+                               range *= 0.9;
                                if(draw_control.range_all)
                                        range = 100000*BS;
                                /*if(range < 50*BS)
                                        range = range * 0.5 + 25*BS;*/
-                               // Move the invisible limit a bit further
-                               //range *= 1.2;
                        }
 
                        driver->setFog(
index febc40ddd98321affbdb33a9d2d9387c7366e1f6..ba4130ca29e860a9b6196cc66a1be5ecdb990988 100644 (file)
@@ -3659,13 +3659,13 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
        // Take a fair amount as we will be dropping more out later
        // Umm... these additions are a bit strange but they are needed.
        v3s16 p_blocks_min(
-                       p_nodes_min.X / MAP_BLOCKSIZE - 2,
-                       p_nodes_min.Y / MAP_BLOCKSIZE - 2,
-                       p_nodes_min.Z / MAP_BLOCKSIZE - 2);
+                       p_nodes_min.X / MAP_BLOCKSIZE - 3,
+                       p_nodes_min.Y / MAP_BLOCKSIZE - 3,
+                       p_nodes_min.Z / MAP_BLOCKSIZE - 3);
        v3s16 p_blocks_max(
-                       p_nodes_max.X / MAP_BLOCKSIZE + 0,
-                       p_nodes_max.Y / MAP_BLOCKSIZE + 0,
-                       p_nodes_max.Z / MAP_BLOCKSIZE + 0);
+                       p_nodes_max.X / MAP_BLOCKSIZE + 1,
+                       p_nodes_max.Y / MAP_BLOCKSIZE + 1,
+                       p_nodes_max.Z / MAP_BLOCKSIZE + 1);
        
        u32 vertex_count = 0;
        u32 meshbuffer_count = 0;