From 2f466726e6e8c318d3277eff6d987197c13e8bd3 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 4 Apr 2011 02:05:12 +0300 Subject: 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. --- src/map.cpp | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index 1608f3e05..39742a892 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -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 -- cgit v1.2.3