diff --git a/include/Scene.h b/include/Scene.h index fd2ae01..55dac1a 100644 --- a/include/Scene.h +++ b/include/Scene.h @@ -2,6 +2,7 @@ #define SCENE_H #include "Model.h" +#include "Camera.h" // Класс сцены class Scene @@ -18,6 +19,7 @@ class Scene // Списки объектов, выступающих узлами std::vector nodes; // Список пустых узлов std::vector models; // Список моделей для рендера + std::vector cameras; // Список камер protected: void rebuld_tree(const Scene& from); // Перестройка дерева после копирования или присваивания diff --git a/src/Scene.cpp b/src/Scene.cpp index 51adf71..0301675 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); @@ -53,6 +54,8 @@ void Scene::rebuild_Nodes_vector(T& nodes, const Scene& from) continue; if (move_pointer(nodes[i], from.models, models)) continue; + if (move_pointer(nodes[i], from.cameras, cameras)) + continue; // Не нашли родителя - значит он не часть этой сцены // и изменений по нему не требуется @@ -80,4 +83,5 @@ void Scene::rebuld_tree(const Scene& from) // Восстановим родителей в пустых узлах для копии rebuild_Nodes_vector(nodes, from); rebuild_Nodes_vector(models, from); + rebuild_Nodes_vector(cameras, from); }