diff options
| author | untodesu <kirill@untode.su> | 2025-03-22 16:32:33 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-03-22 16:32:33 +0500 |
| commit | de5abf13da7e2a7663929da9d76be2161e574b64 (patch) | |
| tree | 498c7e2ce198f8539fe6963a7480689fc70b5a92 /game/server | |
| parent | 1d0a621722f35d1a742ba8f5503ff1efa725d2d0 (diff) | |
| download | voxelius-de5abf13da7e2a7663929da9d76be2161e574b64.tar.bz2 voxelius-de5abf13da7e2a7663929da9d76be2161e574b64.zip | |
A small tree generation update
Diffstat (limited to 'game/server')
| -rw-r--r-- | game/server/overworld.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/game/server/overworld.cc b/game/server/overworld.cc index 608fd01..29bfd64 100644 --- a/game/server/overworld.cc +++ b/game/server/overworld.cc @@ -212,11 +212,10 @@ const Overworld_Metadata &Overworld::get_or_create_metadata(const chunk_pos_xz & } } - auto nvdi_value = fnlGetNoise2D(&m_fnl_nvdi, cpos.x, cpos.y); - auto tree_density = (nvdi_value > 0.0f) ? 4U : 0U; + auto nvdi_value = 0.5f + 0.5f * fnlGetNoise2D(&m_fnl_nvdi, cpos.x, cpos.y); + auto tree_density = (nvdi_value >= 0.33f) ? cxpr::floor<unsigned int>(nvdi_value * 4.0f) : 0U; - // Generate tree locations for this chunk - while(metadata.trees.size() < tree_density) { + for(unsigned int i = 0U; i < tree_density; ++i) { auto lpos = local_pos((twister() % CHUNK_SIZE), (twister() % OW_NUM_TREES), (twister() % CHUNK_SIZE)); auto is_unique = true; |
