Add pre-computed WMO floor cache and improve save logging

- Add initial floor cache for faster collision on first run
- Log absolute path when saving cache for debugging
This commit is contained in:
Kelsi 2026-02-05 17:26:18 -08:00
parent a96ea0758c
commit 125cf588bb
3 changed files with 13 additions and 2 deletions

BIN
cache/wmo_floor_cache.bin vendored Normal file

Binary file not shown.

View file

@ -317,7 +317,11 @@ void Application::shutdown() {
// Save floor cache before renderer is destroyed
if (renderer && renderer->getWMORenderer()) {
renderer->getWMORenderer()->saveFloorCache("cache/wmo_floor_cache.bin");
size_t cacheSize = renderer->getWMORenderer()->getFloorCacheSize();
if (cacheSize > 0) {
LOG_INFO("Saving WMO floor cache (", cacheSize, " entries)...");
renderer->getWMORenderer()->saveFloorCache("cache/wmo_floor_cache.bin");
}
}
// Stop renderer first: terrain streaming workers may still be reading via

View file

@ -517,8 +517,15 @@ void WMORenderer::resetQueryStats() {
bool WMORenderer::saveFloorCache(const std::string& filepath) const {
// Create directory if needed
std::filesystem::path path(filepath);
std::filesystem::path absPath = std::filesystem::absolute(path);
core::Logger::getInstance().info("Saving floor cache to: ", absPath.string());
if (path.has_parent_path()) {
std::filesystem::create_directories(path.parent_path());
std::error_code ec;
std::filesystem::create_directories(path.parent_path(), ec);
if (ec) {
core::Logger::getInstance().error("Failed to create cache directory: ", ec.message());
}
}
std::ofstream file(filepath, std::ios::binary);