Ndk: Add RenderSystem (experimental)
Former-commit-id: 23b11c6e9a21a4f26df6bde3d161578101cb2b29
This commit is contained in:
40
SDK/src/NDK/Systems/RenderSystem.cpp
Normal file
40
SDK/src/NDK/Systems/RenderSystem.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Development Kit"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||
|
||||
#include <NDK/Systems/RenderSystem.hpp>
|
||||
#include <NDK/Components/CameraComponent.hpp>
|
||||
#include <NDK/Components/GraphicsComponent.hpp>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
RenderSystem::RenderSystem()
|
||||
{
|
||||
}
|
||||
|
||||
void RenderSystem::Update(float elapsedTime)
|
||||
{
|
||||
}
|
||||
|
||||
void RenderSystem::OnEntityValidation(Entity* entity, bool justAdded)
|
||||
{
|
||||
if (entity->HasComponent<CameraComponent>())
|
||||
{
|
||||
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>())
|
||||
m_drawables.Insert(entity);
|
||||
else
|
||||
m_drawables.Remove(entity);
|
||||
|
||||
}
|
||||
|
||||
SystemIndex RenderSystem::systemIndex;
|
||||
}
|
||||
Reference in New Issue
Block a user