-
Notifications
You must be signed in to change notification settings - Fork 65
Fix polygon manipulator aabb computation #903
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
uint32_t vertex_i; | ||
const auto indexBuffer = geo->getIndexView().getPointer(); | ||
switch (geo->getIndexType()) | ||
{ | ||
case EIT_16BIT: | ||
vertex_i = reinterpret_cast<const uint16_t*>(indexBuffer)[i]; | ||
break; | ||
case EIT_32BIT: | ||
vertex_i = reinterpret_cast<const uint32_t*>(indexBuffer)[i]; | ||
break; | ||
default: | ||
assert(false); | ||
break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its better to pack up the whole for
loop into a templated lambda, and hoist the switch above (so it dispatches a separate specialized for loop per case)
this way you avoid dealing with the switch and different inted buffer decodes at every index
{ | ||
uint32_t vertex_i; | ||
const auto indexBuffer = geo->getIndexView().getPointer(); | ||
switch (geo->getIndexType()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is meant to be for Graphics Pipelines, use non-index-view specific methods (decodeElement
like a normal view) to decode indices (this way you'll be able to support int8 indices
Fix AABB computation on cpu polygon geometry