three-mesh-bvh icon indicating copy to clipboard operation
three-mesh-bvh copied to clipboard

Add "indirectBuffer" option

Open gkjohnson opened this issue 2 years ago • 1 comments

Fix #294

Also fixed web worker not transferring root buffers.

TODO

  • [x] Index no longer has to be ensured (buildTree function)
  • [x] Instead of bookkeeping an index array we keep an indirect "triangleIndex" array that is 1/3 the size (buildTree function)
  • [x] "partition" function needs to sort an array that is 1 / 3 the size (partition function)
  • [x] "raycast" function needs to be adjusted to take an indirect array or take function for running intersections (raycast cast function)
  • [x] "raycastFirst" function needs to be adjusted to take an indirect array or take function for running intersections (raycastFirst cast function)
  • [x] Worker generation / serialization
  • [ ] "shapecast" functions needs to be adjusted to take an indirect array or it can be wrapped in MeshBVH call (MeshBVH.shapecast or shapecast cast function)
  • [ ] Fix "bvhcast" function
  • [ ] Shader BVH packing needs to know about the indirect storage.
    • deindex the buffer here
  • [ ] Adjust code to be agnostic to index presence.
  • [ ] Tests
    • [x] Randomized tests
    • [ ] Serialized tests
    • [ ] Removed index tests
    • [ ] Option tests
  • [ ] Performance

gkjohnson avatar May 19 '22 03:05 gkjohnson

This touches a lot more than I thought it might and the value may not be that high for the applications I initially anticipated. Putting on hold for now

gkjohnson avatar May 19 '22 17:05 gkjohnson