Table of Contents

Class ShapeBatch

Namespace
BepuPhysics.Collidables
Assembly
BepuPhysics.dll
public abstract class ShapeBatch
Inheritance
ShapeBatch
Derived
Inherited Members

Fields

idPool

protected IdPool idPool

Field Value

IdPool

pool

protected BufferPool pool

Field Value

BufferPool

shapeDataSize

protected int shapeDataSize

Field Value

int

shapesData

protected Buffer<byte> shapesData

Field Value

Buffer<byte>

Properties

Capacity

Gets the number of shapes that the batch can currently hold without resizing.

public int Capacity { get; }

Property Value

int

Compound

Gets whether this shape batch's contained type potentially contains children that require other shape batches.

public bool Compound { get; protected set; }

Property Value

bool

ShapeDataSize

Gets the size of the shape type stored in this batch in bytes.

public int ShapeDataSize { get; }

Property Value

int

TypeId

Gets the type id of the shape type in this batch.

public int TypeId { get; protected set; }

Property Value

int

Methods

Clear()

Frees all shape slots without returning any resources to the pool.

public abstract void Clear()

ComputeBounds(ref BoundingBoxBatcher)

public abstract void ComputeBounds(ref BoundingBoxBatcher batcher)

Parameters

batcher BoundingBoxBatcher

ComputeBounds(int, RigidPose, out Vector3, out Vector3)

public void ComputeBounds(int shapeIndex, RigidPose pose, out Vector3 min, out Vector3 max)

Parameters

shapeIndex int
pose RigidPose
min Vector3
max Vector3

ComputeBounds(int, Quaternion, out Vector3, out Vector3)

public abstract void ComputeBounds(int shapeIndex, Quaternion orientation, out Vector3 min, out Vector3 max)

Parameters

shapeIndex int
orientation Quaternion
min Vector3
max Vector3

ComputeBounds(int, Vector3, Quaternion, out Vector3, out Vector3)

public void ComputeBounds(int shapeIndex, Vector3 position, Quaternion orientation, out Vector3 min, out Vector3 max)

Parameters

shapeIndex int
position Vector3
orientation Quaternion
min Vector3
max Vector3

Dispose()

Returns all backing resources to the pool, leaving the batch in an unusable state.

public abstract void Dispose()

Dispose(int, BufferPool)

protected abstract void Dispose(int index, BufferPool pool)

Parameters

index int
pool BufferPool

EnsureCapacity(int)

Increases the size of the type batch if necessary to hold the target capacity.

public abstract void EnsureCapacity(int shapeCapacity)

Parameters

shapeCapacity int

Target capacity.

GetShapeData(int, out void*, out int)

Gets a raw untyped pointer to a shape's data.

public void GetShapeData(int shapeIndex, out void* shapePointer, out int shapeSize)

Parameters

shapeIndex int

Index of the shape to look up.

shapePointer void*

Pointer to the indexed shape data.

shapeSize int

Size of the shape data in bytes.

RayTest<TRayHitHandler>(int, in RigidPose, in RayData, ref float, BufferPool, ref TRayHitHandler)

Tests a ray against a shape in the batch.

public abstract void RayTest<TRayHitHandler>(int shapeIndex, in RigidPose pose, in RayData ray, ref float maximumT, BufferPool pool, ref TRayHitHandler hitHandler) where TRayHitHandler : struct, IShapeRayHitHandler

Parameters

shapeIndex int

Index of the shape in the batch to test.

pose RigidPose

Pose of the shape to use for the test.

ray RayData

Ray to test against the shape.

maximumT float

The maximum parametric distance along the line. May be mutated by the hit handler.

pool BufferPool

Pool used for temporary allocations required by the test, if any.

hitHandler TRayHitHandler

Hit handler that will process the reported hits.

Type Parameters

TRayHitHandler

Type of the hit handler that will have results reported to it.

RayTest<TRayHitHandler>(int, in RigidPose, ref RaySource, BufferPool, ref TRayHitHandler)

Tests a bunch of rays against a shape in the batch.

public abstract void RayTest<TRayHitHandler>(int shapeIndex, in RigidPose pose, ref RaySource rays, BufferPool pool, ref TRayHitHandler hitHandler) where TRayHitHandler : struct, IShapeRayHitHandler

Parameters

shapeIndex int

Index of the shape in the batch to test.

pose RigidPose

Pose of the shape to use for the test.

rays RaySource

Rays to test against the shape.

pool BufferPool

Pool used for temporary allocations required by the test, if any.

hitHandler TRayHitHandler

Hit handler that will process the reported hits.

Type Parameters

TRayHitHandler

Type of the hit handler that will have results reported to it.

RecursivelyRemoveAndDispose(int, Shapes, BufferPool)

public void RecursivelyRemoveAndDispose(int index, Shapes shapes, BufferPool pool)

Parameters

index int
shapes Shapes
pool BufferPool

Remove(int)

public void Remove(int index)

Parameters

index int

RemoveAndDispose(int, BufferPool)

public void RemoveAndDispose(int index, BufferPool pool)

Parameters

index int
pool BufferPool

RemoveAndDisposeChildren(int, Shapes, BufferPool)

protected abstract void RemoveAndDisposeChildren(int index, Shapes shapes, BufferPool pool)

Parameters

index int
shapes Shapes
pool BufferPool

Resize(int)

Changes the size of the type batch if the target capacity is different than the current capacity. Note that shrinking allocations is conservative; resizing will never allow an existing shape to point to unallocated memory.

public abstract void Resize(int shapeCapacity)

Parameters

shapeCapacity int

Target capacity.

ResizeIdPool(int)

Shrinks or expands the allocation of the batch's id pool. Note that shrinking allocations is conservative; resizing will never allow any pending ids to be lost.

public void ResizeIdPool(int targetIdCapacity)

Parameters

targetIdCapacity int

Number of slots to allocate space for in the id pool.