From 06eb0ad4d063c696afa53cad75824c7778c5c157 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 3 Apr 2011 12:48:20 +0300 Subject: [PATCH] copied draft of updateNodeMeshes from backup --- src/main.cpp | 14 ++++++------- src/map.cpp | 56 ++++++++++++++++++++++++++++++++++------------------ 2 files changed, 44 insertions(+), 26 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b069ee87f..c9db0bdc4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -183,8 +183,6 @@ TODO: Remove IrrlichtWrapper Server: ------- -TODO: When player dies, throw items on map - SUGG: Make an option to the server to disable building and digging near the starting position @@ -202,6 +200,8 @@ FIXME: Server sometimes goes into some infinite PeerNotFoundException loop * Make a small history check to transformLiquids to detect and log continuous oscillations, in such detail that they can be fixed. +TODO: When player dies, throw items on map + Objects: -------- @@ -215,11 +215,11 @@ Block object server side: - A "near blocks" buffer, in which some nearby blocks are stored. - For all blocks in the buffer, objects are stepped(). This means they are active. - - TODO: A global active buffer is needed for the server - - TODO: A timestamp to blocks - - TODO: All blocks going in and out of the buffer are recorded. - - TODO: For outgoing blocks, timestamp is written. - - TODO: For incoming blocks, time difference is calculated and + - A global active buffer is needed for the server + - A timestamp to blocks + - All blocks going in and out of the buffer are recorded. + - For outgoing blocks, timestamp is written. + - For incoming blocks, time difference is calculated and objects are stepped according to it. - When an active object goes far from a player, either delete diff --git a/src/map.cpp b/src/map.cpp index 0ed2d7da2..0a1b65ace 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -5692,27 +5692,45 @@ void ClientMap::updateMeshes(v3s16 blockpos, u32 daynight_ratio) b->updateMesh(daynight_ratio); } catch(InvalidPositionException &e){} - /*// Trailing edge - try{ - v3s16 p = blockpos + v3s16(1,0,0); - MapBlock *b = getBlockNoCreate(p); - b->updateMesh(daynight_ratio); - } - catch(InvalidPositionException &e){} - try{ - v3s16 p = blockpos + v3s16(0,1,0); - MapBlock *b = getBlockNoCreate(p); - b->updateMesh(daynight_ratio); - } - catch(InvalidPositionException &e){} - try{ - v3s16 p = blockpos + v3s16(0,0,1); - MapBlock *b = getBlockNoCreate(p); - b->updateMesh(daynight_ratio); - } - catch(InvalidPositionException &e){}*/ } +#if 0 +/* + Update mesh of block in which the node is, and if the node is at the + leading edge, update the appropriate leading blocks too. +*/ +void ClientMap::updateNodeMeshes(v3s16 nodepos, u32 daynight_ratio) +{ + v3s16 dirs[4] = { + v3s16(0,0,0), + v3s16(-1,0,0), + v3s16(0,-1,0), + v3s16(0,0,-1), + }; + v3s16 blockposes[4]; + for(u32 i=0; i<4; i++) + { + v3s16 np = nodepos + dirs[i]; + blockposes[i] = getNodeBlockPos(np); + // Don't update mesh of block if it has been done already + bool already_updated = false; + for(u32 j=0; jupdateMesh(daynight_ratio); + } +} +#endif + void ClientMap::PrintInfo(std::ostream &out) { out<<"ClientMap: ";