From 2b119e1e192ead701e69e261fe94ccb7382dbee7 Mon Sep 17 00:00:00 2001 From: Craig Robbins Date: Sun, 7 Dec 2014 00:37:37 +1000 Subject: Performance of main client loop up to 2x faster In places, up to 3 times faster NOTE 1: This does not mean a 2x increase in framerate. Increase in fps may be up to 1-2fps NOTE 2: This local 'caching' of settings is not optimal and an alternative solution will be worked on after 0.4.11 is released --- src/clientmap.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/clientmap.cpp') diff --git a/src/clientmap.cpp b/src/clientmap.cpp index fac59b0f1..a5d364b73 100644 --- a/src/clientmap.cpp +++ b/src/clientmap.cpp @@ -53,6 +53,20 @@ ClientMap::ClientMap( { m_box = core::aabbox3d(-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() @@ -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 = -- cgit v1.2.3