copied draft of updateNodeMeshes from backup
authorPerttu Ahola <celeron55@gmail.com>
Sun, 3 Apr 2011 09:48:20 +0000 (12:48 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 3 Apr 2011 09:48:20 +0000 (12:48 +0300)
src/main.cpp
src/map.cpp

index b069ee87f0be5a48c14cc1e7ce7c6206915b2f6a..c9db0bdc45451b2a972d4bac5b4de8b99c48cdda 100644 (file)
@@ -183,8 +183,6 @@ TODO: Remove IrrlichtWrapper
 Server:\r
 -------\r
 \r
-TODO: When player dies, throw items on map\r
-\r
 SUGG: Make an option to the server to disable building and digging near\r
       the starting position\r
 \r
@@ -202,6 +200,8 @@ FIXME: Server sometimes goes into some infinite PeerNotFoundException loop
 * Make a small history check to transformLiquids to detect and log\r
   continuous oscillations, in such detail that they can be fixed.\r
 \r
+TODO: When player dies, throw items on map\r
+\r
 Objects:\r
 --------\r
 \r
@@ -215,11 +215,11 @@ Block object server side:
       - A "near blocks" buffer, in which some nearby blocks are stored.\r
          - For all blocks in the buffer, objects are stepped(). This\r
            means they are active.\r
-         - TODO: A global active buffer is needed for the server\r
-         - TODO: A timestamp to blocks\r
-      - TODO: All blocks going in and out of the buffer are recorded.\r
-           - TODO: For outgoing blocks, timestamp is written.\r
-           - TODO: For incoming blocks, time difference is calculated and\r
+         - A global active buffer is needed for the server\r
+         - A timestamp to blocks\r
+      - All blocks going in and out of the buffer are recorded.\r
+           - For outgoing blocks, timestamp is written.\r
+           - For incoming blocks, time difference is calculated and\r
              objects are stepped according to it.\r
 \r
 - When an active object goes far from a player, either delete\r
index 0ed2d7da2d1ba640258fbe7e57a9b063dc608607..0a1b65ace389f5be874f529d9e37c1f04a617e02 100644 (file)
@@ -5692,26 +5692,44 @@ 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);
+}
+
+#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; j<i; j++)
+               {
+                       if(blockposes[j] == blockposes[i])
+                       {
+                               already_updated = true;
+                               break;
+                       }
+               }
+               if(already_updated)
+                       continue;
+               // Update mesh
+               MapBlock *b = getBlockNoCreate(blockposes[i]);
                b->updateMesh(daynight_ratio);
        }
-       catch(InvalidPositionException &e){}*/
 }
+#endif
 
 void ClientMap::PrintInfo(std::ostream &out)
 {