You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.
Is your design request related to a problem? Please describe.
A lot of code that does almost exactly the same thing could be prevented by using templates or by smarter design decisions. Examples of these cases:
material_pool
model_pool
Describe the solution you'd like
When using something like setting textures, use an enum to index into a TextureHandle[] instead of duplicating the same function and rewriting the same thing a few times.
Template functions could check for a field to be present in a class, therefore allowing you to do something like:
ifconstexpr(HasField(MyVertexFormat, pos))
; //Copy into pos, since it exists
Note that you'd have to define HasField yourself.
Describe alternatives you've considered
N.A.
Additional context
N.A.
The text was updated successfully, but these errors were encountered:
For example; in model pool, there's the sample code copy pasted 5x one for every vertex type. We could have checks for for example position and then only call the set function if it has it. Makes it easier to modify as well.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
design changeRequest to re-design a system/class/etc.
Is your design request related to a problem? Please describe.
A lot of code that does almost exactly the same thing could be prevented by using templates or by smarter design decisions. Examples of these cases:
Describe the solution you'd like
When using something like setting textures, use an enum to index into a
TextureHandle[]
instead of duplicating the same function and rewriting the same thing a few times.Template functions could check for a field to be present in a class, therefore allowing you to do something like:
Note that you'd have to define HasField yourself.
Describe alternatives you've considered
N.A.
Additional context
N.A.
The text was updated successfully, but these errors were encountered: