Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Jun 20, 2024
1 parent dd8bd7b commit b8f7d2d
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 34 deletions.
3 changes: 2 additions & 1 deletion src/client/activeobjectmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ void ActiveObjectMgr::removeObject(u16 id)
return;
}

m_active_objects_deleted.emplace_back(obj);

//std::unique_ptr<ClientActiveObject> obj = std::move(it->second);
m_active_objects.erase(id);

obj->removeFromScene(true);

m_active_objects_deleted.emplace_back(std::move(obj));
}

// clang-format on
Expand Down
21 changes: 17 additions & 4 deletions src/client/clientmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,16 +907,21 @@ void ClientMap::updateDrawListFm(float dtime, unsigned int max_cycle_ms)
Ignore if mesh doesn't exist
*/
{
if((!mesh && smesh_size < 0) || mesh_step != mesh->lod_step) {
if ((!mesh && smesh_size < 0) || mesh_step != mesh->lod_step) {
blocks_in_range_without_mesh++;
if (m_mesh_queued < maxq || range <= 1) {
const auto bts = block->getTimestamp();
if (block->mesh_requested_timestamp < bts) {
block->mesh_requested_timestamp = bts;
m_client->addUpdateMeshTask(bp, false);
++m_mesh_queued;
}
}
if (!mesh)
continue;
}
if(mesh_step == mesh->lod_step && block->getTimestamp() <= mesh->timestamp && !smesh_size) {
if (mesh_step == mesh->lod_step &&
block->getTimestamp() <= mesh->timestamp && !smesh_size) {
++blocks_in_range_without_mesh;
continue;
}
Expand Down Expand Up @@ -1031,10 +1036,18 @@ void ClientMap::updateDrawListFm(float dtime, unsigned int max_cycle_ms)
continue;
*/

if (mesh_step != mesh->lod_step && smesh_size < 0 && (m_mesh_queued < maxq*1.2 || range <= 2)) {
if (mesh_step != mesh->lod_step && smesh_size < 0 &&
(m_mesh_queued < maxq * 1.2 || range <= 2)) {
DUMP(bp, mesh_step, mesh->lod_step, range);
m_client->addUpdateMeshTask(bp);
++m_mesh_queued;
} else if (block->getTimestamp() > mesh->timestamp + (smesh_size ? 0 : range >= 1 ? 60 : 5) && (m_mesh_queued < maxq*1.5 || range <= 2)) {
} else if (const auto bts = block->getTimestamp();
bts != BLOCK_TIMESTAMP_UNDEFINED &&
block->getTimestamp() > mesh->timestamp + (smesh_size ? 0
: range >= 1
? 60
: 5) &&
(m_mesh_queued < maxq * 1.5 || range <= 2)) {
if (mesh_step > 1)
m_client->addUpdateMeshTask(bp);
else
Expand Down
1 change: 0 additions & 1 deletion src/client/fm_farmesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ void FarMesh::makeFarBlock(const v3bpos_t &blockpos)
const auto lock = std::lock_guard(block->far_mutex);
if (!block->getFarMesh(step)) {
MeshMakeData mdat(m_client, false, 0, step, &farcontainer);
mdat.block = block.get();
mdat.m_blockpos = blockpos_actual;
auto mbmsh = std::make_shared<MapBlockMesh>(&mdat, m_camera_offset);
block->setFarMesh(mbmsh, m_client->m_uptime);
Expand Down
21 changes: 0 additions & 21 deletions src/client/mapblock_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,6 @@ MeshMakeData::MeshMakeData(Client *client, bool use_shaders,
fscale(pow(2, far_step + lod_step))
{}

bool MeshMakeData::fill_data()
{
if (filled)
return filled;

if (!block)
block = m_client->m_env.getClientMap().getBlockNoCreateNoEx(m_blockpos);

if (!block)
return filled;
filled = true;
timestamp = block->getTimestamp();

return filled;
}


void MeshMakeData::fillBlockDataBegin(const v3s16 &blockpos)
{
m_blockpos = blockpos;
Expand Down Expand Up @@ -694,10 +677,6 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
m_enable_shaders = data->m_use_shaders;
m_enable_vbo = g_settings->getBool("enable_vbo");

if (!data->fill_data()) {
return;
}

v3s16 bp = data->m_blockpos;
// Only generate minimap mapblocks at even coordinates.
if (fscale<=1) // || !data->block->getMesh())
Expand Down
5 changes: 0 additions & 5 deletions src/client/mapblock_mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ struct MeshMakeData
int range = 1;
bool no_draw = false;
unsigned int timestamp = 0;
MapBlock * block = nullptr;
//Map & map;
//MapDrawControl& draw_control;
bool debug = false;
bool filled = false;
bool fill_data();

explicit MeshMakeData(Client *client, bool use_shaders
, int lod_step = 0
Expand Down
5 changes: 5 additions & 0 deletions src/client/mesh_generator_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ void MeshUpdateQueue::fillDataFromMapBlocks(QueuedMeshUpdate *q)
if (block) {
auto lock = block->lock_shared_rec();
data->fillBlockData(pos, block->getData());

if (const auto bts = block->getTimestamp();
bts != BLOCK_TIMESTAMP_UNDEFINED) {
data->timestamp = std::max(data->timestamp, bts);
}
} else {
data->fillBlockData(pos, block_placeholder.data);
}
Expand Down
1 change: 1 addition & 0 deletions src/cmake_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#cmakedefine01 MINETEST_TRANSPORT
#cmakedefine01 STATIC_BUILD
#cmakedefine01 USE_ENET
#cmakedefine01 USE_GPERF
#cmakedefine01 USE_ICONV
#cmakedefine01 USE_IPV4_DEFAULT
#cmakedefine01 USE_MANDELBULBER
Expand Down
1 change: 1 addition & 0 deletions src/mapblock.h
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ class MapBlock
MapBlock::mesh_type getFarMesh(int step);
void setFarMesh(const MapBlock::mesh_type & rmesh, uint32_t time);
std::mutex far_mutex;
u32 mesh_requested_timestamp = 0;
#endif
//===

Expand Down
20 changes: 18 additions & 2 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,6 @@ void Server::start()
std::cerr << line << std::endl;
}



actionstream << "\033[1mfree\033[1;33mminer \033[1;36mv" << g_version_hash
<< "\033[0m \t"
#if ENABLE_THREADS
Expand All @@ -645,6 +643,24 @@ void Server::start()
#ifndef NDEBUG
<< " debug \t"
#endif
#if USE_GPERF
<< " gperf \t"
#endif
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
<< " asan \t"
#endif
#endif
#if defined(__has_feature)
#if __has_feature(thread_sanitizer)
<< " tsan \t"
#endif
#endif
#if defined(__has_feature)
#if __has_feature(memory_sanitizer)
<< " msan \t"
#endif
#endif
#if USE_MULTI
<< " multi: \t"
#endif
Expand Down
3 changes: 3 additions & 0 deletions src/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ const char *g_build_info =
#if ENABLE_THREADS
"\n" "ENABLE_THREADS"
#endif
#if USE_GPERF
"\n" "USE_GPERF"
#endif
#if USE_MULTI
"\n" "USE_MULTI"
#endif
Expand Down
1 change: 1 addition & 0 deletions util/autotest/auto.pl
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ ()
init => sub { init_config(); 0 },
'---' => 'init',
cmake_prepare => sub {
$config->{cmake_clang} //= 1 if $config->{clang_version};
$config->{clang_version} = $config->{cmake_clang} if $config->{cmake_clang} and $config->{cmake_clang} ne '1';
$config->{cmake_libcxx} //= 1 if $config->{cmake_clang};
$g->{build_names}{x_clang} = $config->{clang_version} if $config->{cmake_clang};
Expand Down

0 comments on commit b8f7d2d

Please sign in to comment.