Clean project structure.
This commit is contained in:
parent
78a4fa99ff
commit
947bf937fd
496 changed files with 206 additions and 137 deletions
92
src/rendering/visual_elements/scene/Scene.cpp
Normal file
92
src/rendering/visual_elements/scene/Scene.cpp
Normal file
|
@ -0,0 +1,92 @@
|
|||
#include "Scene.h"
|
||||
|
||||
#include "RootNode.h"
|
||||
#include "FontsManager.h"
|
||||
#include "SceneItem.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
Scene::Scene()
|
||||
: mRootNode(std::make_unique<RootNode>()),
|
||||
mSceneInfo(std::make_unique<SceneInfo>()),
|
||||
mBackGroundColor(Color(255, 255, 255))
|
||||
{
|
||||
mRootNode->setName("Scene_RootNode");
|
||||
}
|
||||
|
||||
Scene::~Scene()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Scene::update()
|
||||
{
|
||||
mSceneItems.clear();
|
||||
updateNode(mRootNode.get());
|
||||
}
|
||||
|
||||
void Scene::addNode(AbstractVisualNode* node)
|
||||
{
|
||||
mRootNode->addChild(node);
|
||||
}
|
||||
|
||||
bool Scene::isEmpty() const
|
||||
{
|
||||
return mRootNode->getNumChildren() == 0;
|
||||
}
|
||||
|
||||
const Color& Scene::getBackgroundColor() const
|
||||
{
|
||||
return mBackGroundColor;
|
||||
}
|
||||
|
||||
void Scene::setBackgroundColor(const Color& color)
|
||||
{
|
||||
mBackGroundColor = color;
|
||||
}
|
||||
|
||||
void Scene::updateNode(AbstractVisualNode* node)
|
||||
{
|
||||
node->update(mSceneInfo.get());
|
||||
|
||||
for (auto child : node->getChildren())
|
||||
{
|
||||
if (child->getIsVisible())
|
||||
{
|
||||
updateNode(child);
|
||||
}
|
||||
}
|
||||
|
||||
for (std::size_t idx=0; idx< node->getNumSceneItems(); idx++)
|
||||
{
|
||||
if (auto item = node->getSceneItem(idx))
|
||||
{
|
||||
mSceneItems.push_back(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<SceneItem*>& Scene::getItems() const
|
||||
{
|
||||
return mSceneItems;
|
||||
}
|
||||
|
||||
bool Scene::shouldShowMeshOutline() const
|
||||
{
|
||||
return mSceneInfo->mShowMeshOutline;
|
||||
}
|
||||
|
||||
void Scene::setShowMeshOutline(bool shouldShow)
|
||||
{
|
||||
mSceneInfo->mShowMeshOutline = shouldShow;
|
||||
}
|
||||
|
||||
void Scene::setSupportsGeometryPrimitives(bool supports)
|
||||
{
|
||||
mSceneInfo->mSupportsGeometryPrimitives = true;
|
||||
}
|
||||
|
||||
void Scene::setFontsManager(FontsManager* fontsManager)
|
||||
{
|
||||
mSceneInfo->mFontsManager = fontsManager;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue