4#include <unordered_map>
12using std::unordered_map;
19MeshManager::MeshManager()
24 for (
auto it =
meshes.begin(); it !=
meshes.end(); ++it) {
32 auto meshManagedIt =
meshes.find(meshId);
33 if (meshManagedIt !=
meshes.end()) {
34 auto meshManaged = meshManagedIt->second;
35 meshManaged->incrementReferenceCounter();
36 return meshManaged->getMesh();
46 meshManaged->incrementReferenceCounter();
48 meshes[meshManaged->getId()] = meshManaged;
53 auto meshManagedIt =
meshes.find(meshId);
54 if (meshManagedIt !=
meshes.end()) {
55 auto meshManaged = meshManagedIt->second;
56 if (meshManaged->decrementReferenceCounter()) {
58 meshes.erase(meshManagedIt);
63 Console::println(
string(
"Warning: mesh not managed by mesh manager: " + meshId));
unordered_map< string, MeshManager_MeshManaged * > meshes
void removeMesh(const string &meshId)
Removes a mesh from manager.
Object3DNodeMesh * getMesh(const string &meshId)
Get mesh from managed meshes.
~MeshManager()
Destructor.
void addMesh(const string &meshId, Object3DNodeMesh *mesh)
Adds a mesh to manager.
Object 3D node mesh specifically for rendering.