mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 00:03:50 +00:00
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:
parent
a96ea0758c
commit
125cf588bb
3 changed files with 13 additions and 2 deletions
BIN
cache/wmo_floor_cache.bin
vendored
Normal file
BIN
cache/wmo_floor_cache.bin
vendored
Normal file
Binary file not shown.
|
|
@ -317,8 +317,12 @@ void Application::shutdown() {
|
||||||
|
|
||||||
// Save floor cache before renderer is destroyed
|
// Save floor cache before renderer is destroyed
|
||||||
if (renderer && renderer->getWMORenderer()) {
|
if (renderer && renderer->getWMORenderer()) {
|
||||||
|
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");
|
renderer->getWMORenderer()->saveFloorCache("cache/wmo_floor_cache.bin");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Stop renderer first: terrain streaming workers may still be reading via
|
// Stop renderer first: terrain streaming workers may still be reading via
|
||||||
// AssetManager during shutdown, so renderer/terrain teardown must complete
|
// AssetManager during shutdown, so renderer/terrain teardown must complete
|
||||||
|
|
|
||||||
|
|
@ -517,8 +517,15 @@ void WMORenderer::resetQueryStats() {
|
||||||
bool WMORenderer::saveFloorCache(const std::string& filepath) const {
|
bool WMORenderer::saveFloorCache(const std::string& filepath) const {
|
||||||
// Create directory if needed
|
// Create directory if needed
|
||||||
std::filesystem::path path(filepath);
|
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()) {
|
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);
|
std::ofstream file(filepath, std::ios::binary);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue