Conversation
There was a problem hiding this comment.
This looks great! I think a triangle adapter could be quite useful for mesh collisions (I presume that's the use case?)
The only additional thing I would request is adding a unit test for the triangle adapter so there is an example of its usage, and a concrete assertion that its working as intended.
Thanks so much for PRing back into this repo. Sorry it took so long to get to this!
| @@ -1,4 +1,4 @@ | |||
| # Unity Bounding Volume Heirachy | |||
| # Unity Bounding Volume Hierachy | |||
| Graphics.DrawMeshInstanced(mesh, 0, _debugRenderMaterial, matricies.GetRange(0, 1023)); | ||
| matricies.RemoveRange(0, 1023); | ||
| } | ||
| Graphics.DrawMeshInstanced(mesh, 0, _debugRenderMaterial, matricies); |
There was a problem hiding this comment.
Should this not be removed after adding the split draw or are both calls necessary?
There was a problem hiding this comment.
Both calls would be necessary as the for-loop should only execute when the limit is exceeded, which often occurs when each triangle in a scene has its own AABB.
| mesh.SetIndices(indices, MeshTopology.Lines, 0); | ||
| if(_debugRenderMaterial == null) | ||
| { | ||
| _debugRenderMaterial = new Material(Shader.Find("Standard")) |
There was a problem hiding this comment.
Is this compatible with SRP?
There was a problem hiding this comment.
I will test this to make sure it is and will come back to you :)
| return hits; | ||
| } | ||
|
|
||
| public SortedList<float, BVHNode<T>> SortedTraverse(NodeTraversalTest hitTest) { |
There was a problem hiding this comment.
Can you please double check the curly braces are following the same convention across the project
As far as I know they should be on a newline
|
Hi! My current use case for the Triangle Adapter is ray-triangle intersections in a scene, which I'm using for ray tracing. I'll keep you updated on this. |
Hi,
I've added an implementation of a triangle adapter I needed - figured it might be useful to others. I'm still testing it, but seems to work.
P.S. I'm also suggesting a fix for the render method where it would fail due to too many matrices passed in the DrawMeshInstanced.