summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-11-15 13:13:18 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-11-29 19:13:43 +0200
commit01ae0daea501f47ec56a8368e530cb4176fc44cd (patch)
treee96893df69b86481dcc6d36d613d4b67e72c205f /src/client.cpp
parent45fc45a49e61c61646b9997840e92f25bb8ccde9 (diff)
downloadminetest-01ae0daea501f47ec56a8368e530cb4176fc44cd.tar.gz
minetest-01ae0daea501f47ec56a8368e530cb4176fc44cd.tar.bz2
minetest-01ae0daea501f47ec56a8368e530cb4176fc44cd.zip
Properly update textures in node definitions
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/client.cpp b/src/client.cpp
index c89273a80..7093a5190 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -222,16 +222,14 @@ Client::Client(
// Build main texture atlas, now that the GameDef exists (that is, us)
if(g_settings->getBool("enable_texture_atlas"))
- tsrc->buildMainAtlas(this);
+ m_tsrc->buildMainAtlas(this);
else
infostream<<"Not building texture atlas."<<std::endl;
- // Update textures
- m_nodedef->updateTextures(tsrc);
+ // Update node textures
+ m_nodedef->updateTextures(m_tsrc);
- // NOTE: This should be done only after getting possible dynamic
- // game definitions from the server, or at least shut down and
- // restarted when doing so
+ // Start threads after setting up content definitions
m_mesh_update_thread.Start();
/*
@@ -1568,17 +1566,28 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
rfile->drop();
continue;
}
- m_tsrc->insertImage(name, img);
+ m_tsrc->insertSourceImage(name, img);
+ img->drop();
rfile->drop();
}
+
+ // Rebuild inherited images and recreate textures
+ m_tsrc->rebuildImagesAndTextures();
// Update texture atlas
if(g_settings->getBool("enable_texture_atlas"))
m_tsrc->buildMainAtlas(this);
+ // Update node textures
+ m_nodedef->updateTextures(m_tsrc);
+
// Resume threads
m_mesh_update_thread.setRun(true);
m_mesh_update_thread.Start();
+
+ ClientEvent event;
+ event.type = CE_TEXTURES_UPDATED;
+ m_client_event_queue.push_back(event);
}
else
{