Add setting preload_item_visuals
authorPerttu Ahola <celeron55@gmail.com>
Sat, 1 Dec 2012 21:54:15 +0000 (23:54 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Sat, 1 Dec 2012 22:46:10 +0000 (00:46 +0200)
minetest.conf.example
src/client.cpp
src/defaultsettings.cpp

index 7d471dc05a09aa48ae82125c46cabaf1e488fb43..6f023094aeb4743860b5c1733b9b3b0fab6b9755 100644 (file)
 #sound_volume = 0.7
 # Whether node texture animations should be desynchronized per MapBlock
 #desynchronize_mapblock_texture_animation = true
+# Texture filtering settings
+#mip_map = false
+#anisotropic_filter = false
+#bilinear_filter = false
+#trilinear_filter = false
+# Set to true to pre-generate all item visuals
+#preload_item_visuals = false
 
 #
 # Server stuff
index 3c69db076121b0eb01e751d1fa96e2932a5fb32e..c0c513fefa81c52dc52cdeeb2fa307dc7e40f374 100644 (file)
@@ -2464,6 +2464,19 @@ void Client::afterContentReceived()
        infostream<<"- Updating node textures"<<std::endl;
        m_nodedef->updateTextures(m_tsrc);
 
+       // Preload item textures and meshes if configured to
+       if(g_settings->getBool("preload_item_visuals"))
+       {
+               verbosestream<<"Updating item textures and meshes"<<std::endl;
+               std::set<std::string> names = m_itemdef->getAll();
+               for(std::set<std::string>::const_iterator
+                               i = names.begin(); i != names.end(); ++i){
+                       // Asking for these caches the result
+                       m_itemdef->getInventoryTexture(*i, this);
+                       m_itemdef->getWieldMesh(*i, this);
+               }
+       }
+
        // Start mesh update thread after setting up content definitions
        infostream<<"- Starting mesh update thread"<<std::endl;
        m_mesh_update_thread.Start();
index 333d98cd862cbb032211234858392c6a78e5bdcd..4fde4b5b330fb9005eef1a1e8215a875fcdb7572 100644 (file)
@@ -113,6 +113,7 @@ void set_default_settings(Settings *settings)
        settings->setDefault("anisotropic_filter", "false");
        settings->setDefault("bilinear_filter", "false");
        settings->setDefault("trilinear_filter", "false");
+       settings->setDefault("preload_item_visuals", "false");
 
        // Server stuff
        // "map-dir" doesn't exist by default.