Skip to content

Commit 180893e

Browse files
kahrlparamat
authored andcommittedFeb 9, 2016
Remove ClientMap::m_camera_mutex
All places that lock this mutex are only called by the main thread: ClientMap::updateCamera(), ClientMap::updateDrawList(), ClientMap::renderMap(), ClientMap::renderPostFx().
1 parent 4adbd69 commit 180893e

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed
 

‎src/clientmap.cpp

+1-10
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,9 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
157157
}
158158
m_drawlist.clear();
159159

160-
m_camera_mutex.lock();
161160
v3f camera_position = m_camera_position;
162161
v3f camera_direction = m_camera_direction;
163162
f32 camera_fov = m_camera_fov;
164-
//v3s16 camera_offset = m_camera_offset;
165-
m_camera_mutex.unlock();
166163

167164
// Use a higher fov to accomodate faster camera movements.
168165
// Blocks are cropped better when they are drawn.
@@ -433,11 +430,9 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
433430
int crack = m_client->getCrackLevel();
434431
u32 daynight_ratio = m_client->getEnv().getDayNightRatio();
435432

436-
m_camera_mutex.lock();
437433
v3f camera_position = m_camera_position;
438434
v3f camera_direction = m_camera_direction;
439435
f32 camera_fov = m_camera_fov;
440-
m_camera_mutex.unlock();
441436

442437
/*
443438
Get all blocks and draw all visible ones
@@ -799,11 +794,7 @@ void ClientMap::renderPostFx(CameraMode cam_mode)
799794
// Sadly ISceneManager has no "post effects" render pass, in that case we
800795
// could just register for that and handle it in renderMap().
801796

802-
m_camera_mutex.lock();
803-
v3f camera_position = m_camera_position;
804-
m_camera_mutex.unlock();
805-
806-
MapNode n = getNodeNoEx(floatToInt(camera_position, BS));
797+
MapNode n = getNodeNoEx(floatToInt(m_camera_position, BS));
807798

808799
// - If the player is in a solid node, make everything black.
809800
// - If the player is in liquid, draw a semi-transparent overlay.

‎src/clientmap.h

-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ class ClientMap : public Map, public scene::ISceneNode
8989

9090
void updateCamera(v3f pos, v3f dir, f32 fov, v3s16 offset)
9191
{
92-
MutexAutoLock lock(m_camera_mutex);
9392
m_camera_position = pos;
9493
m_camera_direction = dir;
9594
m_camera_fov = fov;
@@ -149,7 +148,6 @@ class ClientMap : public Map, public scene::ISceneNode
149148
v3f m_camera_direction;
150149
f32 m_camera_fov;
151150
v3s16 m_camera_offset;
152-
Mutex m_camera_mutex;
153151

154152
std::map<v3s16, MapBlock*> m_drawlist;
155153

0 commit comments

Comments
 (0)
Please sign in to comment.