diff --git a/include/Scene.h b/include/Scene.h index 4aada7f..6e6e92c 100644 --- a/include/Scene.h +++ b/include/Scene.h @@ -4,6 +4,7 @@ #include #include "Model.h" +#include "Camera.h" // Класс сцены class Scene @@ -20,6 +21,7 @@ class Scene // Списки объектов, выступающих узлами std::list nodes; // Список пустых узлов std::list models; // Список моделей для рендера + std::list cameras; // Список камер protected: void rebuld_tree(const Scene& from); // Перестройка дерева после копирования или присваивания diff --git a/src/Scene.cpp b/src/Scene.cpp index c03dbde..1a36fce 100644 --- a/src/Scene.cpp +++ b/src/Scene.cpp @@ -3,12 +3,12 @@ // Конструктор пустой сцены Scene::Scene() { - + } // Конструктор копирования Scene::Scene(const Scene ©): root(copy.root), -nodes(copy.nodes), models(copy.models) +nodes(copy.nodes), models(copy.models), cameras(copy.cameras) { rebuld_tree(copy); } @@ -19,6 +19,7 @@ Scene& Scene::operator=(const Scene& other) root = other.root; nodes = other.nodes; models = other.models; + cameras = other.cameras; rebuld_tree(other); @@ -51,6 +52,10 @@ void Scene::rebuild_Nodes_list(T& nodes, const Scene& from) // Если можно привести к модели, то ищем родителя среди моделей if (dynamic_cast(parent)) move_parent(*it, from.models, this->models); + else + // Иначе проверяем на принадлежность к камерам + if (dynamic_cast(parent)) + move_parent(*it, from.cameras, this->cameras); // Иначе это пустой узел else move_parent(*it, from.nodes, this->nodes); @@ -80,4 +85,5 @@ void Scene::rebuld_tree(const Scene& from) // Восстановим родителей в пустых узлах для копии rebuild_Nodes_list(nodes, from); rebuild_Nodes_list(models, from); + rebuild_Nodes_list(cameras, from); }