Fixed freezing with NPCs

This commit is contained in:
2026-02-25 17:53:42 +03:00
parent cb2ce23009
commit fe083f13da
3 changed files with 15 additions and 1 deletions

View File

@@ -59,6 +59,7 @@ CharacterModule::CharacterModule(flecs::world &ecs)
body_parts[age][sex].end())
body_parts[age][sex][slot] = nlohmann::json::array();
body_parts[age][sex][slot].push_back(mesh);
mesh_names.insert(mesh);
Ogre::MeshManager::getSingleton().load(mesh, "Characters");
}
std::cout << body_parts.dump(4) << std::endl;
@@ -768,4 +769,13 @@ void CharacterModule::getSlotMeshes(const Ogre::String &age,
for (auto &slots : body_parts[age][sex][slotName])
meshes.push_back(slots.get<Ogre::String>());
}
void CharacterModule::preloadMeshes()
{
for (const auto &mesh : mesh_names) {
Ogre::Entity *ent =
ECS::get<EngineData>().mScnMgr->createEntity(mesh);
ECS::get<EngineData>().mScnMgr->destroyEntity(ent);
}
}
}