Skip to content

Class FrustumCulling

Namespace: Apogee.Core.Numerics
Assembly: Apogee.Core.dll

Tests boxes against a , writing a bit per box (set: at least partly inside): bit k of byte b is box 8b + k. There are three kernels with the same arithmetic in the same order, so they give the same bits: , (four boxes per instruction) and (eight). picks the widest one the process runs fast: NativeAOT builds for x86-64-v2 have 128-bit vectors only (see the profiling chapter of the manual), CoreCLR on a modern CPU has 256.

public static class FrustumCulling

Inheritance

object ← FrustumCulling

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Fields

Block

The boxes are processed (and padded) in blocks of this many.

public const int Block = 8

Field Value

int

Methods

CountVisible(ReadOnlySpan<byte>, int)

The number of boxes among the first whose bit is set.

public static int CountVisible(ReadOnlySpan<byte> visible, int count)

Parameters

visible ReadOnlySpan<byte>

count int

Returns

int

Cull(in Frustum, BoxSet, Span<byte>)

public static void Cull(in Frustum frustum, BoxSet boxes, Span<byte> visible)

Parameters

frustum Frustum

boxes BoxSet

visible Span<byte>

CullScalar(in Frustum, BoxSet, Span<byte>)

public static void CullScalar(in Frustum frustum, BoxSet boxes, Span<byte> visible)

Parameters

frustum Frustum

boxes BoxSet

visible Span<byte>

CullVector128(in Frustum, BoxSet, Span<byte>)

public static void CullVector128(in Frustum frustum, BoxSet boxes, Span<byte> visible)

Parameters

frustum Frustum

boxes BoxSet

visible Span<byte>

CullVector256(in Frustum, BoxSet, Span<byte>)

public static void CullVector256(in Frustum frustum, BoxSet boxes, Span<byte> visible)

Parameters

frustum Frustum

boxes BoxSet

visible Span<byte>

IsVisible(ReadOnlySpan<byte>, int)

public static bool IsVisible(ReadOnlySpan<byte> visible, int index)

Parameters

visible ReadOnlySpan<byte>

index int

Returns

bool