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

@@ -13,6 +13,7 @@
namespace Nz
{
class CameraComponent;
class GraphicsComponent;
class NodeComponent;
class RigidBody3DComponent;

View File

@@ -8,6 +8,19 @@
namespace Nz
{
namespace Detail
{
template<typename T>
struct RegisterComponent
{
void operator()(entt::id_type& expectedId)
{
if (entt::type_seq<T>() != expectedId++)
throw std::runtime_error(std::string(entt::type_name<T>::value()) + " has wrong index, please initialize Nazara ECS before instancing your own components");
}
};
}
/*!
* \ingroup core
* \class Nz::ECS
@@ -21,14 +34,8 @@ namespace Nz
inline void ECS::RegisterComponents()
{
if (entt::type_seq<NodeComponent>() != 0)
throw std::runtime_error("NodeComponent has wrong index, please initialize Nazara ECS before instancing your own components");
if (entt::type_seq<GraphicsComponent>() != 1)
throw std::runtime_error("GraphicsComponent has wrong index, please initialize Nazara ECS before instancing your own components");
if (entt::type_seq<RigidBody3DComponent>() != 2)
throw std::runtime_error("GraphicsComponent has wrong index, please initialize Nazara ECS before instancing your own components");
entt::id_type expectedId = 0;
TypeListApply<TypeList<NodeComponent, CameraComponent, GraphicsComponent, RigidBody3DComponent>, Detail::RegisterComponent>(expectedId);
}
}