diff options
Diffstat (limited to 'src/clientmap.cpp')
-rw-r--r-- | src/clientmap.cpp | 85 |
1 files changed, 17 insertions, 68 deletions
diff --git a/src/clientmap.cpp b/src/clientmap.cpp index b9516fcbe..1c420b5f9 100644 --- a/src/clientmap.cpp +++ b/src/clientmap.cpp @@ -391,12 +391,12 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver) struct MeshBufList { video::SMaterial m; - std::list<scene::IMeshBuffer*> bufs; + std::vector<scene::IMeshBuffer*> bufs; }; struct MeshBufListList { - std::list<MeshBufList> lists; + std::vector<MeshBufList> lists; void clear() { @@ -405,7 +405,7 @@ struct MeshBufListList void add(scene::IMeshBuffer *buf) { - for(std::list<MeshBufList>::iterator i = lists.begin(); + for(std::vector<MeshBufList>::iterator i = lists.begin(); i != lists.end(); ++i){ MeshBufList &l = *i; video::SMaterial &m = buf->getMaterial(); @@ -595,25 +595,20 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass) } } - std::list<MeshBufList> &lists = drawbufs.lists; + std::vector<MeshBufList> &lists = drawbufs.lists; int timecheck_counter = 0; - for(std::list<MeshBufList>::iterator i = lists.begin(); - i != lists.end(); ++i) - { - { - timecheck_counter++; - if(timecheck_counter > 50) - { - timecheck_counter = 0; - int time2 = time(0); - if(time2 > time1 + 4) - { - infostream<<"ClientMap::renderMap(): " - "Rendering takes ages, returning." - <<std::endl; - return; - } + for(std::vector<MeshBufList>::iterator i = lists.begin(); + i != lists.end(); ++i) { + timecheck_counter++; + if(timecheck_counter > 50) { + timecheck_counter = 0; + int time2 = time(0); + if(time2 > time1 + 4) { + infostream << "ClientMap::renderMap(): " + "Rendering takes ages, returning." + << std::endl; + return; } } @@ -621,60 +616,14 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass) driver->setMaterial(list.m); - for(std::list<scene::IMeshBuffer*>::iterator j = list.bufs.begin(); - j != list.bufs.end(); ++j) - { + for(std::vector<scene::IMeshBuffer*>::iterator j = list.bufs.begin(); + j != list.bufs.end(); ++j) { scene::IMeshBuffer *buf = *j; driver->drawMeshBuffer(buf); vertex_count += buf->getVertexCount(); meshbuffer_count++; } -#if 0 - /* - Draw the faces of the block - */ - { - //JMutexAutoLock lock(block->mesh_mutex); - - MapBlockMesh *mapBlockMesh = block->mesh; - assert(mapBlockMesh); - - scene::SMesh *mesh = mapBlockMesh->getMesh(); - assert(mesh); - u32 c = mesh->getMeshBufferCount(); - bool stuff_actually_drawn = false; - for(u32 i=0; i<c; i++) - { - scene::IMeshBuffer *buf = mesh->getMeshBuffer(i); - const video::SMaterial& material = buf->getMaterial(); - video::IMaterialRenderer* rnd = - driver->getMaterialRenderer(material.MaterialType); - bool transparent = (rnd && rnd->isTransparent()); - // Render transparent on transparent pass and likewise. - if(transparent == is_transparent_pass) - { - if(buf->getVertexCount() == 0) - errorstream<<"Block ["<<analyze_block(block) - <<"] contains an empty meshbuf"<<std::endl; - /* - This *shouldn't* hurt too much because Irrlicht - doesn't change opengl textures if the old - material has the same texture. - */ - driver->setMaterial(buf->getMaterial()); - driver->drawMeshBuffer(buf); - vertex_count += buf->getVertexCount(); - meshbuffer_count++; - stuff_actually_drawn = true; - } - } - if(stuff_actually_drawn) - blocks_had_pass_meshbuf++; - else - blocks_without_stuff++; - } -#endif } } // ScopeProfiler |