Graphics/GraphicsComponent: Make renderMask a mandatory parameter

This commit is contained in:
Jérôme Leclercq 2021-12-01 18:58:25 +01:00
parent 8b899253b1
commit 653c9e0028
2 changed files with 5 additions and 7 deletions

View File

@ -202,7 +202,7 @@ int main()
entt::entity textEntity = registry.create(); entt::entity textEntity = registry.create();
{ {
auto& entityGfx = registry.emplace<Nz::GraphicsComponent>(textEntity); auto& entityGfx = registry.emplace<Nz::GraphicsComponent>(textEntity);
entityGfx.AttachRenderable(sprite); entityGfx.AttachRenderable(sprite, 1);
auto& entityNode = registry.emplace<Nz::NodeComponent>(textEntity); auto& entityNode = registry.emplace<Nz::NodeComponent>(textEntity);
entityNode.SetPosition(0.f, 5.f, 0.f); entityNode.SetPosition(0.f, 5.f, 0.f);
@ -297,7 +297,7 @@ int main()
{ {
auto view = registry.view<Nz::GraphicsComponent>(); auto view = registry.view<Nz::GraphicsComponent>();
for (auto [entity, gfxComponent] : view.each()) for (auto [entity, gfxComponent] : view.each())
gfxComponent.AttachRenderable(colliderModel); gfxComponent.AttachRenderable(colliderModel, 1);
} }
else else
{ {
@ -310,9 +310,9 @@ int main()
{ {
entt::entity entity = registry.create(); entt::entity entity = registry.create();
auto& entityGfx = registry.emplace<Nz::GraphicsComponent>(entity); auto& entityGfx = registry.emplace<Nz::GraphicsComponent>(entity);
entityGfx.AttachRenderable(model); entityGfx.AttachRenderable(model, 1);
if (showColliders) if (showColliders)
entityGfx.AttachRenderable(colliderModel); entityGfx.AttachRenderable(colliderModel, 1);
registry.emplace<Nz::NodeComponent>(entity); registry.emplace<Nz::NodeComponent>(entity);
@ -416,7 +416,5 @@ int main()
} }
} }
registry.clear();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -26,7 +26,7 @@ namespace Nz
GraphicsComponent(GraphicsComponent&&) = default; GraphicsComponent(GraphicsComponent&&) = default;
~GraphicsComponent() = default; ~GraphicsComponent() = default;
inline void AttachRenderable(std::shared_ptr<InstancedRenderable> renderable, UInt32 renderMask = 0xFFFFFFFF); inline void AttachRenderable(std::shared_ptr<InstancedRenderable> renderable, UInt32 renderMask);
inline void Clear(); inline void Clear();