-
Couldn't load subscription status.
- Fork 31
WIP implement #211: native min and max over arrays via glm::min / glm::max
#213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Unfortunately, this is a bit more complex than it might seem at first. If the array has elements of a number type (e.g. 32-bit floating point values), it's trivial to perform a |
I was imagining that, if PyGLM already has an implementation of |
That would be a good idea
Well, actually I was wrong. It is probably the most efficient way. That is, using |
|
Ok thanks, I see that the code has switch-case blocks where you check the type of something, then call the correct templated implementation. I think I need to do the same here but call a templated implementation of PyGLM/PyGLM/functions/detail/func_common.h Lines 239 to 263 in 9f2cdfe
What fields should I be checking on the array to switch-case on? Which fields on Lines 291 to 303 in 9f2cdfe
Does |
|
min and max over arrays via glm::min / glm::max
|
This'll need a lot more macro work to support all possible data types that you can store in a pyglm array, but I have it prototyped for arrays of floats and vec2s. Benchmark shows it's definitely much faster. |
Fixes #211
I think I found where this needs to be added in the code, but it would be way faster for you to point out what exactly I should be copying to generate the correct switch-case block to call all the templated implementations of
apply_min. I see thatapply_mintakes astd::vecand I'm pretty sure thatglmArrayis not astd::vec. So does this need a newapply_min_of_glmArraytemplate?