Struct BroadPhaseRayBatcher<TRayTester>
- Namespace
- BepuPhysics.CollisionDetection
- Assembly
- BepuPhysics.dll
Helps test the broad phase's active and static trees with a custom leaf tester.
public struct BroadPhaseRayBatcher<TRayTester> : IDisposable where TRayTester : struct, IBroadPhaseBatchedRayTester
Type Parameters
TRayTesterType used to test rays against leaves.
- Implements
- Inherited Members
Constructors
BroadPhaseRayBatcher(BufferPool, BroadPhase, TRayTester, int)
Constructs a ray batcher for the broad phase and initializes its backing resources.
public BroadPhaseRayBatcher(BufferPool pool, BroadPhase broadPhase, TRayTester rayTester, int batcherRayCapacity = 2048)
Parameters
poolBufferPoolPool to pull resources from.
broadPhaseBroadPhaseBroad phase to be tested.
rayTesterTRayTesterRay tester used to test leaves found by the broad phase tree traversals.
batcherRayCapacityintMaximum number of rays to execute in each traversal. This should typically be chosen as the highest value which avoids spilling data out of L2 cache.
Methods
Add(ref Vector3, ref Vector3, float, int)
Adds a ray to the batcher to test against the broad phase trees. If the underlying ray batcher hits its maximum capacity, all the accumulated rays will be tested against the broad phase trees and the accumulator will be reset.
public void Add(ref Vector3 origin, ref Vector3 direction, float maximumT, int id = 0)
Parameters
originVector3Origin of the ray to test against the tree.
directionVector3Direction of the ray to test against the tree.
maximumTfloatMaximum distance that the ray will travel in units of the ray's length.
idintIdentifier value for the ray. Leaf tests will have access to the id.
Dispose()
Disposes the underlying batcher resources.
public void Dispose()
Flush()
Tests any accumulated rays against the broad phase trees and then resets the batcher.
public void Flush()