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

BVH trait definition is hard to implement when bounding volumes are generated on demand #363

Open
bonsairobo opened this issue Oct 14, 2020 · 0 comments

Comments

@bonsairobo
Copy link

My use case is that I have a voxel octree which needs to be very memory efficient. So I can't store an AABB for every single voxel. That's 6 floats, i.e. 24 bytes per voxel.

Rather, voxel presence is encoded in bitsets, and the efficiency is such that a single voxel can be stored in far less than 1 bit per voxel.

So the issue is that when I tried to impl BVH for this octree, I could not implement fn content(&self, node: Self::Node) -> (&BV, Option<&T>) because it returns a reference to a bounding volume. I could easily generate an AABB for a given voxel, but it would not live long enough to return a reference. The only hack I can think of is to keep an AABB temporary variable on self that gets unsafely mutated to overcome &self, but that may be unsound depending on the code that's using this structure.

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

No branches or pull requests

1 participant