Improve performance and tune ramp/planter collision behavior

This commit is contained in:
Kelsi 2026-02-03 17:21:04 -08:00
parent f43e6bf834
commit f00d13bfc0
12 changed files with 310 additions and 164 deletions

View file

@ -13,6 +13,7 @@
#include <mutex>
#include <atomic>
#include <queue>
#include <vector>
#include <condition_variable>
#include <glm/glm.hpp>
@ -246,8 +247,8 @@ private:
// Streaming parameters
bool streamingEnabled = true;
int loadRadius = 2; // Load tiles within this radius (5x5 grid for performance)
int unloadRadius = 3; // Unload tiles beyond this radius
int loadRadius = 1; // Load tiles within this radius (3x3 grid for better CPU/GPU perf)
int unloadRadius = 2; // Unload tiles beyond this radius
float updateInterval = 0.1f; // Check streaming every 0.1 seconds
float timeSinceLastUpdate = 0.0f;
@ -257,8 +258,9 @@ private:
static constexpr float TILE_SIZE = 533.33333f; // One tile = 533.33 units
static constexpr float CHUNK_SIZE = 33.33333f; // One chunk = 33.33 units
// Background loading thread
std::thread workerThread;
// Background loading worker pool
std::vector<std::thread> workerThreads;
int workerCount = 0;
std::mutex queueMutex;
std::condition_variable queueCV;
std::queue<TileCoord> loadQueue;