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

Made a proper queued thread to client for handling some block mesh updates. Also made client mutex-free to allow easier adding of new stuff.

This commit is contained in:
Perttu Ahola 2011-04-04 02:05:12 +03:00
parent e0f7bd4d57
commit 2f466726e6
7 changed files with 722 additions and 390 deletions

View file

@ -5335,7 +5335,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
*/
int time1 = time(0);
u32 daynight_ratio = m_client->getDayNightRatio();
//u32 daynight_ratio = m_client->getDayNightRatio();
m_camera_mutex.Lock();
v3f camera_position = m_camera_position;
@ -5438,7 +5438,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
continue;
}
// This is ugly
// This is ugly (spherical distance limit?)
/*if(m_control.range_all == false &&
d - 0.5*BS*MAP_BLOCKSIZE > range)
continue;*/
@ -5446,6 +5446,9 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
#if 1
/*
Update expired mesh (used for day/night change)
It doesn't work exactly like it should now with the
tasked mesh update but whatever.
*/
bool mesh_expired = false;
@ -5482,28 +5485,12 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
mesh_update_count++;
// Mesh has been expired: generate new mesh
block->updateMesh(daynight_ratio);
//m_client->addUpdateMeshTask(block);
//block->updateMesh(daynight_ratio);
m_client->addUpdateMeshTask(block->getPos());
mesh_expired = false;
}
/*
Don't draw an expired mesh that is far away
*/
/*if(mesh_expired && d >= faraway)
//if(mesh_expired)
{
// Instead, delete it
JMutexAutoLock lock(block->mesh_mutex);
if(block->mesh)
{
block->mesh->drop();
block->mesh = NULL;
}
// And continue to next block
continue;
}*/
#endif
/*
Draw the faces of the block