copied draft of updateNodeMeshes from backup

master
Perttu Ahola 2011-04-03 12:48:20 +03:00
parent e4f7f97e6c
commit 06eb0ad4d0
2 changed files with 44 additions and 26 deletions

View File

@ -183,8 +183,6 @@ TODO: Remove IrrlichtWrapper
Server: Server:
------- -------
TODO: When player dies, throw items on map
SUGG: Make an option to the server to disable building and digging near SUGG: Make an option to the server to disable building and digging near
the starting position 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 * Make a small history check to transformLiquids to detect and log
continuous oscillations, in such detail that they can be fixed. continuous oscillations, in such detail that they can be fixed.
TODO: When player dies, throw items on map
Objects: Objects:
-------- --------
@ -215,11 +215,11 @@ Block object server side:
- A "near blocks" buffer, in which some nearby blocks are stored. - A "near blocks" buffer, in which some nearby blocks are stored.
- For all blocks in the buffer, objects are stepped(). This - For all blocks in the buffer, objects are stepped(). This
means they are active. means they are active.
- TODO: A global active buffer is needed for the server - A global active buffer is needed for the server
- TODO: A timestamp to blocks - A timestamp to blocks
- TODO: All blocks going in and out of the buffer are recorded. - All blocks going in and out of the buffer are recorded.
- TODO: For outgoing blocks, timestamp is written. - For outgoing blocks, timestamp is written.
- TODO: For incoming blocks, time difference is calculated and - For incoming blocks, time difference is calculated and
objects are stepped according to it. objects are stepped according to it.
- When an active object goes far from a player, either delete - When an active object goes far from a player, either delete

View File

@ -5692,26 +5692,44 @@ void ClientMap::updateMeshes(v3s16 blockpos, u32 daynight_ratio)
b->updateMesh(daynight_ratio); b->updateMesh(daynight_ratio);
} }
catch(InvalidPositionException &e){} catch(InvalidPositionException &e){}
/*// Trailing edge }
try{
v3s16 p = blockpos + v3s16(1,0,0); #if 0
MapBlock *b = getBlockNoCreate(p); /*
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); 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){}*/
} }
#endif
void ClientMap::PrintInfo(std::ostream &out) void ClientMap::PrintInfo(std::ostream &out)
{ {