diff --git a/src/clientmap.cpp b/src/clientmap.cpp index aad7512e..45d85f89 100644 --- a/src/clientmap.cpp +++ b/src/clientmap.cpp @@ -151,11 +151,11 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver) INodeDefManager *nodemgr = m_gamedef->ndef(); - for(std::map::iterator + for (std::vector::iterator i = m_drawlist.begin(); i != m_drawlist.end(); ++i) { - MapBlock *block = i->second; + MapBlock *block = *i; block->refDrop(); } m_drawlist.clear(); @@ -205,6 +205,8 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver) // Distance to farthest drawn block float farthest_drawn = 0; + bool free_move = g_settings->getBool("free_move"); + for(std::map::iterator si = m_sectors.begin(); si != m_sectors.end(); ++si) @@ -281,7 +283,7 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver) // No occlusion culling when free_move is on and camera is // inside ground bool occlusion_culling_enabled = true; - if(g_settings->getBool("free_move")){ + if (free_move){ MapNode n = getNodeNoEx(cam_pos_nodes); if(n.getContent() == CONTENT_IGNORE || nodemgr->get(n).solidness == 2) @@ -335,7 +337,7 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver) // Add to set block->refGrab(); - m_drawlist[block->getPos()] = block; + m_drawlist.push_back(block); sector_blocks_drawn++; blocks_drawn++; @@ -343,9 +345,6 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver) farthest_drawn = d/BS; } // foreach sectorblocks - - if(sector_blocks_drawn != 0) - m_last_drawn_sectors.insert(sp); } m_control.blocks_would_have_drawn = blocks_would_have_drawn; @@ -413,14 +412,6 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass) else prefix = "CM: transparent: "; - /* - This is called two times per frame, reset on the non-transparent one - */ - if(pass == scene::ESNRP_SOLID) - { - m_last_drawn_sectors.clear(); - } - /* Get time for measuring timeout. @@ -487,11 +478,11 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass) MeshBufListList drawbufs; - for(std::map::iterator + for(std::vector::iterator i = m_drawlist.begin(); i != m_drawlist.end(); ++i) { - MapBlock *block = i->second; + MapBlock *block = *i; // If the mesh of the block happened to get deleted, ignore it if(block->mesh == NULL) diff --git a/src/clientmap.h b/src/clientmap.h index d931c1bb..01b6566c 100644 --- a/src/clientmap.h +++ b/src/clientmap.h @@ -135,12 +135,6 @@ public: // For debug printing virtual void PrintInfo(std::ostream &out); - // Check if sector was drawn on last render() - bool sectorWasDrawn(v2s16 p) - { - return (m_last_drawn_sectors.find(p) != m_last_drawn_sectors.end()); - } - private: Client *m_client; @@ -154,9 +148,7 @@ private: v3s16 m_camera_offset; Mutex m_camera_mutex; - std::map m_drawlist; - - std::set m_last_drawn_sectors; + std::vector m_drawlist; bool m_cache_trilinear_filter; bool m_cache_bilinear_filter;