Graphics: Add RenderSystem and frame pipeline

This commit is contained in:
Jérôme Leclercq
2021-07-06 11:04:22 +02:00
parent 428a706fbe
commit 4ac5fe7cba
37 changed files with 1202 additions and 141 deletions

View File

@@ -2,22 +2,32 @@
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
#include <Nazara/Utility/Components/NodeComponent.hpp>
#include <Nazara/Utility/Debug.hpp>
#include "GraphicsComponent.hpp"
#include <Nazara/Graphics/Components/GraphicsComponent.hpp>
#include <Nazara/Graphics/Debug.hpp>
namespace Nz
{
inline GraphicsComponent::GraphicsComponent()
{
m_worldInstance = std::make_unique<WorldInstance>(); //< FIXME
}
inline void GraphicsComponent::AttachRenderable(std::shared_ptr<InstancedRenderable> renderable)
{
m_renderables.push_back(std::move(renderable));
OnRenderableAttached(this, m_renderables.back());
}
inline void GraphicsComponent::DetachRenderable(const std::shared_ptr<InstancedRenderable>& renderable)
{
auto it = std::find(m_renderables.begin(), m_renderables.end(), renderable);
if (it != m_renderables.end())
{
OnRenderableDetach(this, renderable);
m_renderables.erase(it);
}
}
inline const std::vector<std::shared_ptr<InstancedRenderable>>& GraphicsComponent::GetRenderables() const
@@ -27,11 +37,11 @@ namespace Nz
inline WorldInstance& GraphicsComponent::GetWorldInstance()
{
return m_worldInstance;
return *m_worldInstance;
}
inline const WorldInstance& GraphicsComponent::GetWorldInstance() const
{
return m_worldInstance;
return *m_worldInstance;
}
}