Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/wip5.8.0' into wip5.8.0webport
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Oct 26, 2024
2 parents 02c0ca7 + cadf9eb commit 4588f18
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/client/content_mapblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1750,8 +1750,8 @@ void MapblockMeshGenerator::drawNode()

void MapblockMeshGenerator::generate()
{
const auto lstep = data->lod_step ? data->fscale : 1;
const auto fstep = data->far_step ? data->fscale : 1;
const auto lstep = 1 << data->lod_step;
const auto fstep = 1 << data->far_step;
for (cur_node.pf.Z = cur_node.pr.Z = 0; cur_node.pr.Z < data->side_length_data; cur_node.pr.Z+=lstep, cur_node.pf.Z+=fstep)
for (cur_node.pf.Y = cur_node.pr.Y = 0; cur_node.pr.Y < data->side_length_data; cur_node.pr.Y+=lstep, cur_node.pf.Y+=fstep)
for (cur_node.pf.X = cur_node.pr.X = 0; cur_node.pr.X < data->side_length_data; cur_node.pr.X+=lstep, cur_node.pf.X+=fstep) {
Expand Down
13 changes: 7 additions & 6 deletions src/client/fm_far_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ FarContainer::FarContainer(Client *client) : m_client{client}
namespace
{
thread_local MapBlockP block_cache{};
thread_local v3bpos_t block_cache_p;
thread_local std::pair<block_step_t, v3bpos_t> block_cache_p;
}

const MapNode &FarContainer::getNodeRefUnsafe(const v3pos_t &pos)
Expand All @@ -26,12 +26,13 @@ const MapNode &FarContainer::getNodeRefUnsafe(const v3pos_t &pos)
getNodeBlockPos(m_client->getEnv().getClientMap().far_blocks_last_cam_pos),
bpos);
const auto &shift = step; // + cell_size_pow;
const v3bpos_t bpos_aligned((bpos.X >> shift) << shift, (bpos.Y >> shift) << shift,
(bpos.Z >> shift) << shift);
const v3bpos_t bpos_aligned = getFarActual(bpos,
getNodeBlockPos(m_client->getEnv().getClientMap().far_blocks_last_cam_pos),
step, m_client->getEnv().getClientMap().getControl());

MapBlockP block;

if (block_cache && bpos_aligned == block_cache_p) {
const auto step_block_pos = std::make_pair(step, bpos_aligned);
if (block_cache && step_block_pos == block_cache_p) {
block = block_cache;
}

Expand Down Expand Up @@ -94,7 +95,7 @@ const MapNode &FarContainer::getNodeRefUnsafe(const v3pos_t &pos)
return n;
}

block_cache_p = bpos_aligned;
block_cache_p = step_block_pos;
block_cache = block;
}

Expand Down
4 changes: 2 additions & 2 deletions src/client/mapblock_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ MeshMakeData::MeshMakeData(Client *client, bool use_shaders,
NodeContainer *nodecontainer) :

m_mesh_grid(client->getMeshGrid()),
side_length((MAP_BLOCKSIZE * m_mesh_grid.cell_size) / (pow(2, lod_step))),
side_length((MAP_BLOCKSIZE * m_mesh_grid.cell_size) >> lod_step),
m_client(client),
m_use_shaders(use_shaders)
,
m_vmanip{nodecontainer ? *nodecontainer : m_vmanip_store},
side_length_data(MAP_BLOCKSIZE * m_mesh_grid.cell_size),
lod_step{lod_step},
far_step{far_step},
fscale(pow(2, far_step + lod_step))
fscale(1<<(far_step + lod_step))
{}

void MeshMakeData::fillBlockDataBegin(const v3s16 &blockpos)
Expand Down
3 changes: 3 additions & 0 deletions src/mapgen/mapgen_v7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ MapgenV7Params::MapgenV7Params():

void MapgenV7Params::readParams(const Settings *settings)
{

//freeminer:
settings->getNoiseParamsFromGroup("mg_np_layers", np_layers);
paramsj = settings->getJson("mg_params", paramsj);
Expand Down Expand Up @@ -239,10 +240,12 @@ void MapgenV7Params::readParams(const Settings *settings)

void MapgenV7Params::writeParams(Settings *settings) const
{

//freeminer:
settings->setNoiseParams("mg_np_layers", np_layers);
settings->setJson("mg_params", paramsj);
//----------

settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7);
settings->setS16("mgv7_mount_zero_level", mount_zero_level);
settings->setS16("mgv7_floatland_ymin", floatland_ymin);
Expand Down

0 comments on commit 4588f18

Please sign in to comment.