Камера как часть сцены
This commit is contained in:
parent
5578a43c15
commit
7e6f1c8678
@ -2,6 +2,7 @@
|
||||
#define SCENE_H
|
||||
|
||||
#include "Model.h"
|
||||
#include "Camera.h"
|
||||
|
||||
// Класс сцены
|
||||
class Scene
|
||||
@ -18,6 +19,7 @@ class Scene
|
||||
// Списки объектов, выступающих узлами
|
||||
std::vector<Node> nodes; // Список пустых узлов
|
||||
std::vector<Model> models; // Список моделей для рендера
|
||||
std::vector<Camera> cameras; // Список камер
|
||||
|
||||
protected:
|
||||
void rebuld_tree(const Scene& from); // Перестройка дерева после копирования или присваивания
|
||||
|
@ -8,7 +8,7 @@ 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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user