add SurroundMap intergration to world generator (WIP)

This commit is contained in:
MihailRis
2024-09-11 11:35:56 +03:00
parent 80d8a6738b
commit 8268176527
6 changed files with 76 additions and 10 deletions
+5 -1
View File
@@ -35,7 +35,11 @@ ChunksController::ChunksController(Level* level, uint padding)
ChunksController::~ChunksController() = default;
void ChunksController::update(int64_t maxDuration) {
void ChunksController::update(
int64_t maxDuration, int loadDistance, int centerX, int centerY
) {
generator->update(centerX, centerY, loadDistance);
int64_t mcstotal = 0;
for (uint i = 0; i < MAX_WORK_PER_FRAME; i++) {
+5 -1
View File
@@ -28,5 +28,9 @@ public:
~ChunksController();
/// @param maxDuration milliseconds reserved for chunks loading
void update(int64_t maxDuration);
void update(
int64_t maxDuration,
int loadDistance,
int centerX,
int centerY);
};
+5 -1
View File
@@ -10,6 +10,7 @@
#include "settings.hpp"
#include "world/Level.hpp"
#include "world/World.hpp"
#include "maths/voxmaths.hpp"
#include "scripting/scripting.hpp"
static debug::Logger logger("level-control");
@@ -38,7 +39,10 @@ void LevelController::update(float delta, bool input, bool pause) {
position.z,
settings.chunks.loadDistance.get() + settings.chunks.padding.get() * 2
);
chunks->update(settings.chunks.loadSpeed.get());
chunks->update(
settings.chunks.loadSpeed.get(), settings.chunks.loadDistance.get(),
floordiv(position.x, CHUNK_W), floordiv(position.z, CHUNK_D)
);
if (!pause) {
// update all objects that needed