Different function calls for different Conditions #885
-
Current SetupI´ve got a simple Renderer which has 2 "Draw"-functions ProblemUsing the second function works just fine, I use a "view" to get both components and pass them onto the function. It would (in theory) work like this:
How could I achieve that with ENTT? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Maybe you could use a view that gives both entity identifier and mesh component, then try to look up the material by entity identifier? I'm not sure if and how that would work, though; maybe someone else can verify. |
Beta Was this translation helpful? Give feedback.
-
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:
|
Beta Was this translation helpful? Give feedback.
-
The following is an idea I came up with:
Maybe use a view that gives both entity and mesh component, then try to
look up the material by entity ID? Someone else can confirm whether that
works....
…
Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
If I get it correctly, this is what you're looking for?
That is:
Draw1
(and therefore it has not material component)Draw2