1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Properly update textures in node definitions

This commit is contained in:
Perttu Ahola 2011-11-15 13:13:18 +02:00
parent 45fc45a49e
commit 01ae0daea5
7 changed files with 301 additions and 192 deletions

View file

@ -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
{