Header menu logo Mibo

Culling (visibility helpers)

Mibo.Elmish.Culling is a tiny helper module that keeps visibility math separate from your renderer and your spatial partitioning.

It operates on MonoGame primitives:

3D: frustum culling

let frustum = Camera3D.boundingFrustum camera

if Culling.isVisible frustum entitySphere then
  // submit draw commands
  ()

Or for AABBs:

if Culling.isGenericVisible frustum nodeBounds then
  ()

2D: rectangle overlap

This is typically paired with Camera2D.viewportBounds:

let viewBounds = Camera2D.viewportBounds camera viewport

if Culling.isVisible2D viewBounds spriteBounds then
  ()

What this is not

This module doesn’t try to be your spatial index.

val frustum: obj
val viewBounds: obj

Type something to start searching.