Skip to content

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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

kevyuu
Copy link

@kevyuu kevyuu commented Jul 17, 2025

Fix AABB computation on cpu polygon geometry

Comment on lines +76 to +89
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;
}

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())

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants