namespace Brutal.JoltApi; // Hand-written bits the generator can't express (see Generator.Interop.cs for what it does emit): // Factory.Instance, and the one down-cast Jolt keeps no type information for (the checked AsX() casts on // Shape, Constraint and VehicleController are generated). public readonly partial struct Factory { /// Mirrors JPH::Factory::sInstance. /// /// Assigning hands the factory to the global, and the getter borrows it back. Tear it down with /// ; never Dispose the handle you assigned or the one you get back. /// public static Factory Instance { get => GetInstance(); set => SetInstance(value); } /// Deletes the global factory instance and clears . public static void DestroyInstance() { var instance = GetInstance(); if (!instance.IsNull()) instance.Dispose(); SetInstance(default); } } public readonly partial struct MotionProperties { /// Views these motion properties as the soft-body ones they are. /// /// hands back the base type, so this is how a soft body's /// vertices are reached. Same handle, not a new reference, so don't Dispose it. Unchecked: /// only valid on a soft body. /// public SoftBodyMotionProperties AsSoftBodyMotionProperties() => Unsafe.BitCast(this); }