|
|
|
|
@ -79,17 +79,42 @@ namespace lunarium
|
|
|
|
|
// pGraphics->DrawQuad(rect, color, nullptr, 0.0f, Rectangle(-1, -1, -1, -1), parent_transform);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
mECSRegistry.view<TransformComponent, BlockOutComponent>().each([&](auto entity, auto &transform, auto &blockout)
|
|
|
|
|
// OLD RENDER HEIRARCHY RENDER SYSTEM
|
|
|
|
|
// mECSRegistry.view<TransformComponent, BlockOutComponent>().each([&](auto entity, auto &transform, auto &blockout)
|
|
|
|
|
// {
|
|
|
|
|
// Rectangle rect(transform.Position.x, transform.Position.y, blockout.Size.x, blockout.Size.y);
|
|
|
|
|
// Color color(blockout.Color.x, blockout.Color.y, blockout.Color.z, blockout.Color.w);
|
|
|
|
|
|
|
|
|
|
// if (!mECSRegistry.all_of<ParentEntityComponent>(entity))
|
|
|
|
|
// {
|
|
|
|
|
// DrawHeirarchy(pGraphics, entity, transform, blockout, glm::mat4(1.0f));
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// NEW RENDER SYSTEM
|
|
|
|
|
// First get the group we want
|
|
|
|
|
auto group = mECSRegistry.group<>(entt::get<BlockOutComponent, TransformComponent>);
|
|
|
|
|
|
|
|
|
|
// Next sort the group
|
|
|
|
|
group.sort<BlockOutComponent>([](const BlockOutComponent &lhs, const BlockOutComponent &rhs)
|
|
|
|
|
{
|
|
|
|
|
return lhs.RenderLayer < rhs.RenderLayer;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Render the group
|
|
|
|
|
for(auto entity: group)
|
|
|
|
|
{
|
|
|
|
|
auto &transform = group.get<TransformComponent>(entity);
|
|
|
|
|
auto &blockout = group.get<BlockOutComponent>(entity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle rect(transform.Position.x, transform.Position.y, blockout.Size.x, blockout.Size.y);
|
|
|
|
|
Color color(blockout.Color.x, blockout.Color.y, blockout.Color.z, blockout.Color.w);
|
|
|
|
|
|
|
|
|
|
if (!mECSRegistry.all_of<ParentEntityComponent>(entity))
|
|
|
|
|
{
|
|
|
|
|
DrawHeirarchy(pGraphics, entity, transform, blockout, glm::mat4(1.0f));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// TODO: Get and apply parent transforms
|
|
|
|
|
|
|
|
|
|
pGraphics->DrawQuad(rect, color, nullptr, -transform.Rotation.z, Rectangle(-1, -1, -1, -1), glm::mat4(1.0f));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|