forked from oerkki/voxelands
some meshgen tweaks
This commit is contained in:
parent
d884e607be
commit
9e7d6cced1
|
@ -577,7 +577,8 @@ void Client::step(float dtime)
|
|||
while (m_mesh_update_thread.m_queue_out.size() > 0) {
|
||||
MeshUpdateResult r = m_mesh_update_thread.m_queue_out.pop_front();
|
||||
MapBlock *block = m_env.getMap().getBlockNoCreateNoEx(r.p);
|
||||
if (block && r.mesh != NULL) {
|
||||
if (block) {
|
||||
if (r.mesh != NULL) {
|
||||
JMutexAutoLock lock(block->mesh_mutex);
|
||||
|
||||
MapBlockMesh *mesh_old = block->mesh;
|
||||
|
@ -586,6 +587,9 @@ void Client::step(float dtime)
|
|||
|
||||
if (mesh_old != NULL)
|
||||
delete mesh_old;
|
||||
}else{
|
||||
block->setMeshExpired(false);
|
||||
}
|
||||
}
|
||||
if (r.ack_block_to_server) {
|
||||
/*infostream<<"Client: ACK block ("<<r.p.X<<","<<r.p.Y
|
||||
|
|
|
@ -3188,8 +3188,6 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
|||
*/
|
||||
int time1 = time(0);
|
||||
|
||||
u32 daynight_ratio = m_client->getEnv().getDayNightRatio();
|
||||
|
||||
m_camera_mutex.Lock();
|
||||
v3f camera_position = m_camera_position;
|
||||
v3f camera_direction = m_camera_direction;
|
||||
|
@ -3348,11 +3346,8 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
|||
|
||||
// Mesh has been expired: generate new mesh
|
||||
if (block->mesh) {
|
||||
JMutexAutoLock lock(block->mesh_mutex);
|
||||
block->mesh->refresh(daynight_ratio);
|
||||
block->setMeshExpired(false);
|
||||
}else{
|
||||
m_client->addUpdateMeshTask(block->getPos(),false,true);
|
||||
block->setMeshExpired(false);
|
||||
}
|
||||
|
||||
mesh_expired = false;
|
||||
|
|
|
@ -783,11 +783,12 @@ void RemoteClient::GotBlock(v3s16 p)
|
|||
|
||||
void RemoteClient::SentBlock(v3s16 p)
|
||||
{
|
||||
if(m_blocks_sending.find(p) == NULL)
|
||||
if (m_blocks_sending.find(p) == NULL) {
|
||||
m_blocks_sending.insert(p, 0.0);
|
||||
else
|
||||
}else{
|
||||
infostream<<"RemoteClient::SentBlock(): Sent block"
|
||||
" already in m_blocks_sending"<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteClient::SetBlockNotSent(v3s16 p)
|
||||
|
@ -5409,6 +5410,8 @@ void Server::SendBlocks(float dtime)
|
|||
JMutexAutoLock envlock(m_env_mutex);
|
||||
JMutexAutoLock conlock(m_con_mutex);
|
||||
|
||||
s32 max = g_settings->getS32("max_simultaneous_block_sends_server_total");
|
||||
|
||||
//TimeTaker timer("Server::SendBlocks");
|
||||
|
||||
core::array<PrioritySortedBlockTransfer> queue;
|
||||
|
@ -5418,16 +5421,13 @@ void Server::SendBlocks(float dtime)
|
|||
{
|
||||
ScopeProfiler sp(g_profiler, "Server: selecting blocks for sending");
|
||||
|
||||
for(core::map<u16, RemoteClient*>::Iterator
|
||||
i = m_clients.getIterator();
|
||||
i.atEnd() == false; i++)
|
||||
{
|
||||
for (core::map<u16, RemoteClient*>::Iterator i = m_clients.getIterator(); i.atEnd() == false; i++) {
|
||||
RemoteClient *client = i.getNode()->getValue();
|
||||
assert(client->peer_id == i.getNode()->getKey());
|
||||
|
||||
total_sending += client->SendingCount();
|
||||
|
||||
if(client->serialization_version == SER_FMT_VER_INVALID)
|
||||
if (client->serialization_version == SER_FMT_VER_INVALID)
|
||||
continue;
|
||||
|
||||
client->GetNextBlocks(this, dtime, queue);
|
||||
|
@ -5439,22 +5439,17 @@ void Server::SendBlocks(float dtime)
|
|||
// Lowest is most important.
|
||||
queue.sort();
|
||||
|
||||
for(u32 i=0; i<queue.size(); i++)
|
||||
{
|
||||
for (u32 i=0; i<queue.size(); i++) {
|
||||
//TODO: Calculate limit dynamically
|
||||
if(total_sending >= g_settings->getS32
|
||||
("max_simultaneous_block_sends_server_total"))
|
||||
if (total_sending >= max)
|
||||
break;
|
||||
|
||||
PrioritySortedBlockTransfer q = queue[i];
|
||||
|
||||
MapBlock *block = NULL;
|
||||
try
|
||||
{
|
||||
try{
|
||||
block = m_env.getMap().getBlockNoCreate(q.pos);
|
||||
}
|
||||
catch(InvalidPositionException &e)
|
||||
{
|
||||
}catch (InvalidPositionException &e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue