From 807a0d313ba667356ee8af8ef5ae82b6c4881d15 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Tue, 13 Mar 2012 18:56:12 +0100 Subject: MapBlockMesh, mesh animation system, urgent mesh updates, athmospheric light, removed footprints --- src/mapblock.cpp | 87 ++------------------------------------------------------ 1 file changed, 3 insertions(+), 84 deletions(-) (limited to 'src/mapblock.cpp') diff --git a/src/mapblock.cpp b/src/mapblock.cpp index b436378da..70cb0e370 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -59,10 +59,8 @@ MapBlock::MapBlock(Map *parent, v3s16 pos, IGameDef *gamedef, bool dummy): reallocate(); #ifndef SERVER - m_mesh_expired = false; - mesh_mutex.Init(); + //mesh_mutex.Init(); mesh = NULL; - m_temp_mods_mutex.Init(); #endif } @@ -70,11 +68,11 @@ MapBlock::~MapBlock() { #ifndef SERVER { - JMutexAutoLock lock(mesh_mutex); + //JMutexAutoLock lock(mesh_mutex); if(mesh) { - mesh->drop(); + delete mesh; mesh = NULL; } } @@ -147,78 +145,6 @@ MapNode MapBlock::getNodeParentNoEx(v3s16 p) } } -#ifndef SERVER - -#if 1 -void MapBlock::updateMesh(u32 daynight_ratio) -{ -#if 0 - /* - DEBUG: If mesh has been generated, don't generate it again - */ - { - JMutexAutoLock meshlock(mesh_mutex); - if(mesh != NULL) - return; - } -#endif - - MeshMakeData data; - data.fill(daynight_ratio, this); - - scene::SMesh *mesh_new = makeMapBlockMesh(&data, m_gamedef); - - /* - Replace the mesh - */ - - replaceMesh(mesh_new); - -} -#endif - -void MapBlock::replaceMesh(scene::SMesh *mesh_new) -{ - mesh_mutex.Lock(); - - //scene::SMesh *mesh_old = mesh[daynight_i]; - //mesh[daynight_i] = mesh_new; - - scene::SMesh *mesh_old = mesh; - mesh = mesh_new; - setMeshExpired(false); - - if(mesh_old != NULL) - { - // Remove hardware buffers of meshbuffers of mesh - // NOTE: No way, this runs in a different thread and everything - /*u32 c = mesh_old->getMeshBufferCount(); - for(u32 i=0; igetMeshBuffer(i); - }*/ - - /*infostream<<"mesh_old->getReferenceCount()=" - <getReferenceCount()<getMeshBufferCount(); - for(u32 i=0; igetMeshBuffer(i); - infostream<<"buf->getReferenceCount()=" - <getReferenceCount()<drop(); - - //delete mesh_old; - } - - mesh_mutex.Unlock(); -} - -#endif // !SERVER - /* Propagates sunlight down through the block. Doesn't modify nodes that are not affected by sunlight. @@ -1232,13 +1158,6 @@ std::string analyze_block(MapBlock *block) else desc<<"is_ug [ ], "; -#ifndef SERVER - if(block->getMeshExpired()) - desc<<"mesh_exp [X], "; - else - desc<<"mesh_exp [ ], "; -#endif - if(block->getLightingExpired()) desc<<"lighting_exp [X], "; else -- cgit v1.2.3