Skip to content

Fix out-of-bounds end index in SphereBVH::fromScene#233

Merged
FriedricNietzsche merged 2 commits into
191-pbr-ibl-ambient-lightingfrom
copilot/sub-pr-230
Mar 16, 2026
Merged

Fix out-of-bounds end index in SphereBVH::fromScene#233
FriedricNietzsche merged 2 commits into
191-pbr-ibl-ambient-lightingfrom
copilot/sub-pr-230

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 16, 2026

SphereBVH::fromScene passed entities.size() as the end argument to buildBVH, but entities lacking a MeshRendererComponent are skipped, so spheres can be smaller than entities. This causes buildBVH to operate past the end of the spheres vector.

Change

  • src/physics/SphereBVH.cpp: Replace entities.size() with spheres.size() in the buildBVH call.
// Before
return SphereBVH(buildBVH(spheres, 0, entities.size()));

// After
return SphereBVH(buildBVH(spheres, 0, spheres.size()));

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ze()

Co-authored-by: FriedricNietzsche <142739679+FriedricNietzsche@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on IBL ambient lighting integration in PBR shader Fix out-of-bounds end index in SphereBVH::fromScene Mar 16, 2026
Copilot AI requested a review from FriedricNietzsche March 16, 2026 22:16
@FriedricNietzsche FriedricNietzsche marked this pull request as ready for review March 16, 2026 22:21
@FriedricNietzsche FriedricNietzsche merged commit 3fbfedf into 191-pbr-ibl-ambient-lighting Mar 16, 2026
@FriedricNietzsche FriedricNietzsche deleted the copilot/sub-pr-230 branch March 16, 2026 22:21
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