009/3d-visual-communication

/src/algorithm/scene/SceneManager.cpp
#include "SceneManager.h"
#include "Scene.h"
#include "SceneNode.h"

using namespace std;
using namespace v3d;

SceneManager::SceneManager() : m_scene(nullptr)
{
}

void SceneManager::addScene(const Scene * scene)
{
assert(scene);
if (m_scene)
{
delete m_scene;
m_scene = nullptr;
}
m_scene = scene;
}

Scene * SceneManager::getScene() const
{
return m_scene;
}

void SceneManager::clearScene()
{
delete m_scene;
m_scene = nullptr;
}

Scene * SceneManager::getScene() const
{
return m_scene;
}

void SceneManager::removeScene()
{
delete m_scene;
m_scene = nullptr;
}

void SceneManager::setScene(const Scene * scene)
{
m_scene = scene;
}

void SceneManager::setScene(Scene * scene)
{
m_scene = scene;
}

/src/algorithm/scene/Scene.cpp
#include "Scene.h"
#include "SceneNode.h"
#include "Material.h"
#include "MaterialManager.h"
#include "Light.h"
#include "LightManager.h"
#include "Camera.h"
#include "CameraManager.h"
#include "Model.h"
#include "ModelManager.h"
#include "RenderManager.h"
#include "Texture.h"
#include "TextureManager.h"

using namespace std;
using namespace v3d;

Scene::Scene(const string & name) : m_name(name)
{
}

void Scene::addNode(SceneNode * node)
{
m_nodeList.push_back(node);
node->setScene(this);
}

void Scene::removeNode(SceneNode * node)
{
m_nodeList.erase(remove(m_nodeList.begin(), m_nodeList.end(), node), m_nodeList.end());
node->setScene(nullptr);
}

void Scene::render()
{
if (m_nodeList.empty())
return;

for (auto & node : m_nodeList)
node->render();
}

void Scene::render(float dt)
{
if (m_nodeList.empty())
return;

for (auto & node : m_nodeList)
node->render(dt);
}

void Scene::update(float dt)
{
if (m_nodeList.empty())
return;

for (auto & node : m_nodeList)
node->update(dt);
}

void Scene::update(float dt, int32_t frameCount)
{
if (m_nodeList.empty())
return;

for (auto & node : m_nodeList)
node->update(dt, frameCount);
}

void Scene::update(float dt, int32_t frameCount, int32_t cameraIndex)
{
if (m_nodeList.empty())
return;

for (auto & node : m_nodeList)
node->update(dt, frameCount, cameraIndex);
}

void Scene::addLight(Light * light)
{
m_lightList.push_back(light);
}

void Scene::removeLight(Light * light)
{
m_lightList.erase(remove(m_lightList.begin(), m_lightList.end(), light), m_lightList.end());
light->setScene(nullptr);
}

void Scene::addCamera(Camera * camera)
{
m_cameraList.push_back(camera);
}

void Scene::removeCamera(Camera * camera)
{
m_cameraList.erase(remove(m_cameraList.begin(), m_cameraList.end(), camera), m_cameraList.end());
camera->setScene(nullptr);
}

void Scene::addModel(Model * model)
{
m_modelList.push_back(model);
}

void Scene::removeModel(Model * model)
{
m_modelList.erase(remove(m_modelList.begin(), m_modelList.end(), model), m_modelList.end());
model->setScene(nullptr);
}

void Scene::addMaterial(Material * material)
{
m_materialList.push_back(material);
}

void Scene::removeMaterial(Material * material)
{
m_materialList.erase(remove(m_materialList.begin(), m_materialList.end(), material), m_materialList.end());
material->setScene(nullptr);
}

void Scene::addTexture(Texture * texture)
{
m_textureList.push_back(texture);
}

void Scene::removeTexture(Texture * texture)
{
m_textureList.erase(remove(m_textureList.begin(), m_textureList.end(), texture), m_textureList.end());
texture->setScene(nullptr);
}

void Scene::updateLight(float dt)
{
for (auto & light : m_lightList)
light->update(dt);
}

void Scene::updateLight(float dt, int32_t frameCount)
{
for (auto & light : m_lightList)
light->update(dt, frameCount);
}

void Scene::updateLight(float dt, int32_t frameCount, int32_t cameraIndex)
{
for (auto & light : m_lightList)
light->update(dt, frameCount, cameraIndex);
}

void Scene::updateCamera(float dt)
{
for (auto & camera : m_cameraList)
camera->update(dt);
}

void Scene::updateCamera(float dt, int32_t frameCount)
{
for (auto & camera : m_cameraList)
camera->update(dt, frameCount);
}

void Scene::updateCamera(float dt, int32_t frameCount, int32_t cameraIndex)
{
for (auto & camera : m_cameraList)
camera->update(dt, frameCount, cameraIndex);
}

void Scene::updateModel(float dt)
{
for (auto & model : m_modelList)
model->update(dt);
}

void Scene::updateModel(float dt, int32_t frameCount)
{
for (auto & model : m_modelList)
model->update(dt, frameCount);
}

void Scene::updateModel(float dt, int32_t frameCount, int32_t cameraIndex)
{
for (auto & model : m_modelList)
model->update(dt, frameCount, cameraIndex);
}

void Scene::updateMaterial(float dt)
{
for