Skip to content
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

Fix top-level BVH implementation #79

Merged
merged 4 commits into from
Jun 17, 2020

Conversation

madmann91
Copy link
Contributor

This fixes the top-level BVH implementation and enables it during rendering. A couple of additional notes:

  • I'm not sure about having a global polygon array. Why not have this be part of the mesh? After all, each mesh owns its polygon array, so having global data there is strange.
  • If the remark above is taken care of, then callbacks in the BVH can be simplified by having their user data being the scene for the top-level, and a mesh for the bottom level.
  • You can strip the meshIndex and polyIndex out of the poly structure. Just add a meshIndex to the hitRecord and let the BVH set it when it iterates over the meshes contained in a top-level leaf. The same can be said for the bottom-level leaves and the polyIndex member.

@vkoskiv vkoskiv merged commit 7ba922a into vkoskiv:top-level-bvh Jun 17, 2020
vkoskiv added a commit that referenced this pull request Jun 17, 2020
* Start work on an experimental top-level BVH + traversal. It's disabled for now,
switch the implementations in getClosestIsect()
Still some issues to work out, but it's something.
I don't really like the meshIndex hack I had to add to the polygon struct, but
I gues it's not that bad since I managed to shrink it anyway.

* Maybe MSVC dislikes compound literals, let's try getting rid of those here.

* Make bvh construction truly generic to limit code duplication (#78)

* Make bvh construction truly generic

* Spaces -> tabs

* Update .xcodeproj to reflect changes in pull request 78

* Hide `struct bvhNode` and `struct bvh` and present them as opaque structs in the API instead.

* Continue implementing generic BVH traversal

* Rename rayIntersectsWithGenericBvh -> rayIntersectsWithBvhGeneric
Fix incorrect function call in rayIntersectsWithBvh()

* Rename `rayIntersectsWith*` -> `traverse*`

* Fix naming
Add inline qualifiers to a few functions.

* Fix top-level BVH implementation (#79)

* Fix top-level BVH implementation

* Minor performance improvements to the BVH traversal

* Remove redundant assignment

* Move address offset inside indirect access

Co-authored-by: Arsène Pérard-Gayot <arsene.perard@laposte.net>
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