Skip to content

Different function calls for different Conditions #885

Answered by skypjack
AaronBeardless asked this question in Q&A
Discussion options

You must be logged in to vote

If I get it correctly, this is what you're looking for?

for(auto [entity, cmesh]: registry.view<mesh>(entt::exclude<material>).each()) { Draw1(cmesh); } // (1)
for(auto [entity, cmesh, cmaterial]: registry.view<mesh, material>().each()) { Draw2(cmesh. cmaterial); } // (2)

That is:

  1. If an entity only has a mesh component, use Draw1 (and therefore it has not material component)
  2. If an entity has both components, use Draw2

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
2 replies
@Green-Sky
Comment options

@Green-Sky
Comment options

Comment options

You must be logged in to vote
2 replies
@AaronBeardless
Comment options

@skypjack
Comment options

Answer selected by AaronBeardless
Comment options

You must be logged in to vote
1 reply
@skypjack
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
discussion it sounds interesting, let's discuss it
4 participants