Improve visibility and update caching.

This commit is contained in:
James Grogan 2022-11-16 17:27:19 +00:00
parent 70891ce7b4
commit 722bda2801
8 changed files with 41 additions and 24 deletions

View file

@ -72,6 +72,11 @@ public:
return mName;
}
bool getIsVisible() const
{
return mIsVisible;
}
protected:
DiscretePoint mLocation;
std::unique_ptr<SceneItem> mSceneItem;

View file

@ -14,6 +14,7 @@ Scene::Scene()
void Scene::update(FontsManager* fontsManager)
{
mSceneItems.clear();
updateNode(mRootNode.get(), fontsManager);
}
@ -21,7 +22,10 @@ void Scene::updateNode(AbstractVisualNode* node, FontsManager* fontsManager)
{
for (auto child : node->getChildren())
{
updateNode(child, fontsManager);
if (child->getIsVisible())
{
updateNode(child, fontsManager);
}
}
node->update(fontsManager);