Files
Seele/src/Engine/UI/RenderHierarchy.cpp
T

73 lines
1.6 KiB
C++
Raw Normal View History

2021-09-23 10:10:39 +02:00
#include "RenderHierarchy.h"
using namespace Seele;
using namespace Seele::UI;
2021-10-05 12:24:41 +02:00
void AddElementRenderHierarchyUpdate::apply(Array<RenderElement>& elements)
2021-09-23 10:10:39 +02:00
{
2021-10-05 12:24:41 +02:00
for(auto element : elements)
{
if(element.parent == parent)
{
}
}
2021-09-23 10:10:39 +02:00
}
2021-10-05 12:24:41 +02:00
void RemoveElementRenderHierarchyUpdate::apply(Array<RenderElement>& elements)
2021-09-23 10:10:39 +02:00
{
}
RenderHierarchy::RenderHierarchy()
{
}
RenderHierarchy::~RenderHierarchy()
{
}
2021-09-29 22:12:56 +02:00
2021-10-05 12:24:41 +02:00
void RenderHierarchy::addElement(PElement addedElement)
2021-09-29 22:12:56 +02:00
{
2021-10-05 12:24:41 +02:00
std::lock_guard lock(updateLock);
updates.add(new AddElementRenderHierarchyUpdate{
addedElement.getHandle(),
addedElement->getParent().getHandle()
}));
}
void RenderHierarchy::removeElement(PElement elementToRemove)
{
std::lock_guard lock(updateLock);
updates.add(new RemoveElementRenderHierarchyUpdate{
elementToRemove.getHandle(),
});
}
void RenderHierarchy::moveElement(PElement elementToMove, PElement newParent)
{
std::lock_guard lock(updateLock);
updates.add(new AddElementRenderHierarchyUpdate{
elementToMove.getHandle(),
newParent.getHandle()
});
updates.add(new RemoveElementRenderHierarchyUpdate{
elementToMove.getHandle()
});
}
void RenderHierarchy::updateHierarchy()
{
Array<RenderHierarchyUpdate*> localUpdates;
{ // make a local copy of the updates so we dont hold the lock for too long
std::lock_guard lock(updateLock);
localUpdates = updates;
updates.clear();
}
for(auto update : localUpdates)
2021-09-29 22:12:56 +02:00
{
2021-10-05 12:24:41 +02:00
2021-09-29 22:12:56 +02:00
}
}