mirror of
https://github.com/bdnugget/freeminer.git
synced 2026-11-07 06:57:27 +00:00
wip
This commit is contained in:
1 parent
8e297ab31d
commit
ca3af6ba3d
4 files changed
+22
-12
No files matched your search
+7
-4
@@ -21,6 +21,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "fm_far_calc.h"
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
|
||||
#include "client/clientmap.h"
|
||||
#include "irr_v3d.h"
|
||||
@@ -45,7 +46,7 @@ block_step_t getLodStep(const MapDrawControl &draw_control,
|
||||
// return i;
|
||||
// }
|
||||
|
||||
/*
|
||||
/*
|
||||
if (range >= cells + draw_control.lodmesh * 64) // cell_size = 4
|
||||
return 8;
|
||||
if (range >= cells + draw_control.lodmesh * 32)
|
||||
@@ -255,9 +256,10 @@ block_step_t getFarStep(const MapDrawControl &draw_control, const v3bpos_t &ppos
|
||||
}
|
||||
|
||||
v3bpos_t getFarActual(const v3bpos_t &blockpos, const v3bpos_t &ppos, block_step_t step,
|
||||
const MapDrawControl &draw_control)
|
||||
const MapDrawControl &draw_control, const std::optional<uint8_t> &cell_size_pow)
|
||||
{
|
||||
const auto blockpos_aligned_cell = align_shift(blockpos, draw_control.cell_size_pow);
|
||||
const auto blockpos_aligned_cell =
|
||||
align_shift(blockpos, cell_size_pow.value_or(draw_control.cell_size_pow));
|
||||
const auto start =
|
||||
child_t{.pos = v3tpos_t((((tpos_t)ppos.X >> tree_align) << tree_align) -
|
||||
(tree_align_size >> 1),
|
||||
@@ -268,7 +270,8 @@ v3bpos_t getFarActual(const v3bpos_t &blockpos, const v3bpos_t &ppos, block_step
|
||||
.size = tree_size};
|
||||
const auto res = find(
|
||||
{blockpos_aligned_cell.X, blockpos_aligned_cell.Y, blockpos_aligned_cell.Z},
|
||||
{ppos.X, ppos.Y, ppos.Z}, start, draw_control.cell_size_pow,
|
||||
{ppos.X, ppos.Y, ppos.Z}, start,
|
||||
cell_size_pow.value_or(draw_control.cell_size_pow),
|
||||
draw_control.farmesh_quality);
|
||||
|
||||
if (res) {
|
||||
|
||||
+5
-4
@@ -21,6 +21,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include "irr_v3d.h"
|
||||
#include "irrlichttypes.h"
|
||||
|
||||
@@ -52,9 +53,9 @@ block_step_t getFarStepBad(const MapDrawControl &draw_control,
|
||||
bool inFarGrid(const v3bpos_t &blockpos, const v3bpos_t &playerblockpos,
|
||||
block_step_t step, const MapDrawControl &draw_control);
|
||||
v3bpos_t getFarActual(const v3bpos_t &blockpos, const v3bpos_t &playerblockpos,
|
||||
block_step_t step, const MapDrawControl &draw_control);
|
||||
block_step_t step, const MapDrawControl &draw_control,
|
||||
const std::optional<uint8_t> &cell_size_pow = {});
|
||||
v3bpos_t playerBlockAlign(
|
||||
const MapDrawControl &draw_control, const v3bpos_t &playerblockpos);
|
||||
void runFarAll(const v3bpos_t &ppos,
|
||||
uint8_t cell_size_pow, uint8_t farmesh_quality, pos_t two_d,
|
||||
const std::function<bool(const v3bpos_t &, const bpos_t &)> &func);
|
||||
void runFarAll(const v3bpos_t &ppos, uint8_t cell_size_pow, uint8_t farmesh_quality,
|
||||
pos_t two_d, const std::function<bool(const v3bpos_t &, const bpos_t &)> &func);
|
||||
@@ -231,7 +231,7 @@ WorldMerger::one_block_stat_t WorldMerger::merge_one_block(MapDatabase *dbase,
|
||||
// TODO: skip full air;
|
||||
one_block_stat_t one_step_stat;
|
||||
if (farlights) {
|
||||
constexpr auto some_magick_thinner_const = 2; // more -> less far ligts
|
||||
constexpr auto some_magick_thinner_const = 1; // more -> less far ligts
|
||||
constexpr auto min_no_skip_ligts =
|
||||
2; // do not skip this amount lights on block << farstep
|
||||
for (const auto &[bpos, block] : blocks) {
|
||||
@@ -241,12 +241,16 @@ WorldMerger::one_block_stat_t WorldMerger::merge_one_block(MapDatabase *dbase,
|
||||
size_t lights_in_block = 0;
|
||||
// TODO: apply some smart? filtering here
|
||||
// block_up->m_light_points.insert(block->m_light_points.begin(), block->m_light_points.end());
|
||||
const auto size = block->m_light_points.size();
|
||||
if (!size)
|
||||
continue;
|
||||
const auto coef = 16.0 / size;
|
||||
for (const auto &lp : block->m_light_points) {
|
||||
++one_step_stat.lights_count;
|
||||
++lights_in_block;
|
||||
if ((step > 3 || lights_in_block > (min_no_skip_ligts << step)) &&
|
||||
(one_step_stat.lights_count %
|
||||
(some_magick_thinner_const * (16 - lp.second)))) {
|
||||
const auto mod = int(coef * some_magick_thinner_const * (16 - lp.second));
|
||||
if (mod && (step > 1 || lights_in_block > (min_no_skip_ligts << step)) &&
|
||||
(one_step_stat.lights_count % mod)) {
|
||||
continue;
|
||||
}
|
||||
++one_step_stat.lights_used;
|
||||
|
||||
@@ -223,7 +223,9 @@ bool detectVSCodeBuildDir(const std::string &path)
|
||||
"out/build/Debug",
|
||||
"out/build/Build",
|
||||
"out/build/asan",
|
||||
"out/build/asan_debug",
|
||||
"out/build/tsan",
|
||||
"out/build/tsan_debug",
|
||||
"out/build/msan",
|
||||
"out/build/ubsan",
|
||||
"out/build/gperf",
|
||||
|
||||
Reference in new issue
Block a user