Table of Contents

Interface IDebugShapeFactory

Namespace
Box3D
Assembly
Box3D.NET.dll

Builds and releases the drawable that represents a shape.

public interface IDebugShapeFactory

Remarks

Box3D draws shapes in two phases rather than emitting their geometry every frame. The first time a shape needs drawing it asks for a drawable through Box3D.IDebugShapeFactory.CreateShape(Box3D.DebugShape@); from then on it hands that handle back to Box3D.IDebugDrawer.DrawShape(System.IntPtr,System.Numerics.Vector3,System.Numerics.Quaternion,Box3D.DebugColor) with a transform. For a real renderer that means uploading a mesh once and issuing a draw call per frame, which is the difference between debug draw being usable and being a slideshow.

Pass an implementation to Box3D.PhysicsWorld.#ctor(Box3D.WorldSettings,Box3D.IDebugShapeFactory). Box3D needs these callbacks when the world is built, not when it is drawn, so they cannot be supplied later.

Box3D.IDebugShapeFactory.DestroyShape(System.IntPtr) is called when a shape is modified or destroyed, and for everything still alive when the world is disposed. Neither method may touch the world.

Methods

CreateShape(in DebugShape)

Builds the drawable for a shape.

DestroyShape(nint)

Releases a drawable built earlier.