Vixen
02b45cc4
csharp
public static class JoltRuntime

Owns the one-per-process half of Jolt: the allocator, the factory and the registered shape types, which JPH_Init sets up and JPH_Shutdown tears down.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Jolt's initialisation is global, not per PhysicsWorld, and calling it twice leaks the first factory while calling shutdown while a world is alive frees shape types out from under it. Both are native crashes with no managed stack, so this counts instead: the first world in takes the runtime up, the last one out takes it down, and a test that builds and disposes forty worlds in a row does not care which order they happened in.

Trace and assert are routed once, at the first init. Jolt writes to stdout by default, which in a shipped game is nowhere and in a test run is interleaved with everything else. Trace and AssertFailed let the host point them at a logger; both are read on native threads, so they are set before the first world exists and never changed after.

Fields and properties (3)

  • public static int ReferenceCount

    How many live objects are holding the runtime up.

  • public static Action<string>? Trace

    Where Jolt's trace output goes. Set it before the first PhysicsWorld exists.

  • public static Func<string, string, string, uint, bool>? AssertFailed

    What to do when a Jolt assertion fails: the expression, the message, the file and the line. Returning breaks into the debugger.

Methods (2)

  • public static void Acquire()

    Takes the runtime up if it is not already, and adds a reference to it.

  • public static void Release()

    Drops a reference, and takes the runtime down when the last one goes.

Used by (1)

  • PhysicsWorldVixen.Physics