Sdk/RenderSystem: Fix code duplication (merge fail)
Former-commit-id: ac552375a50d333b53b11c435c88e647a7cd0817
This commit is contained in:
parent
ea3fdaba26
commit
685f8c99da
|
|
@ -48,37 +48,6 @@ namespace Ndk
|
|||
m_lights.Remove(entity);
|
||||
}
|
||||
|
||||
void RenderSystem::OnEntityRemoved(Entity* entity)
|
||||
{
|
||||
m_cameras.Remove(entity);
|
||||
m_drawables.Remove(entity);
|
||||
m_lights.Remove(entity);
|
||||
}
|
||||
|
||||
void RenderSystem::OnEntityValidation(Entity* entity, bool justAdded)
|
||||
{
|
||||
if (entity->HasComponent<CameraComponent>() && entity->HasComponent<NodeComponent>())
|
||||
{
|
||||
m_cameras.Insert(entity);
|
||||
std::sort(m_cameras.begin(), m_cameras.end(), [](const EntityHandle& handle1, const EntityHandle& handle2)
|
||||
{
|
||||
return handle1->GetComponent<CameraComponent>().GetLayer() < handle2->GetComponent<CameraComponent>().GetLayer();
|
||||
});
|
||||
}
|
||||
else
|
||||
m_cameras.Remove(entity);
|
||||
|
||||
if (entity->HasComponent<GraphicsComponent>() && entity->HasComponent<NodeComponent>())
|
||||
m_drawables.Insert(entity);
|
||||
else
|
||||
m_drawables.Remove(entity);
|
||||
|
||||
if (entity->HasComponent<LightComponent>() && entity->HasComponent<NodeComponent>())
|
||||
m_lights.Insert(entity);
|
||||
else
|
||||
m_lights.Remove(entity);
|
||||
}
|
||||
|
||||
void RenderSystem::OnUpdate(float elapsedTime)
|
||||
{
|
||||
UpdateShadowMaps();
|
||||
|
|
|
|||
Loading…
Reference in New Issue