#pragma once #include "TextureManager.h" #include "Math.h" #include namespace ZL { struct ActiveObject { std::string name; std::shared_ptr activeObjectTexturePtr; ZL::VertexDataStruct activeObjectMesh; ZL::VertexRenderStruct activeObjectMeshMutable; std::shared_ptr activeObjectScreenTexturePtr; ZL::VertexDataStruct activeObjectScreenMesh; ZL::VertexRenderStruct activeObjectScreenMeshMutable; ZL::Vector3f objectPos; bool highlighted = false; }; class ActiveObjectManager { public: // Добавить или обновить объект в контейнере void addActiveObject(const ActiveObject& object) { activeObjects[object.name] = object; } // Найти объект по имени (возвращает указатель, nullptr — если не найден) ActiveObject* findByName(const std::string& name) { auto it = activeObjects.find(name); if (it != activeObjects.end()) { return &it->second; } return nullptr; } // Найти все объекты с нужным значением highlighted // (возвращает список указателей на найденные объекты) std::vector findByHighlighted(bool highlighted) { std::vector result; result.reserve(activeObjects.size()); for (auto& [key, object] : activeObjects) { if (object.highlighted == highlighted) { result.push_back(&object); } } return result; } private: // Хранение объектов по ключу name std::unordered_map activeObjects; }; }