< Summary

Information
Class: Gravitas.PhysicsRuntimeModeSupport
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/Settings/PhysicsRuntimeMode.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 73
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
IsValid(...)100%66100%
Runs2D(...)100%11100%
Runs3D(...)100%11100%
RunsMixedContacts(...)100%11100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/Settings/PhysicsRuntimeMode.cs

#LineLine coverage
 1//=======================================================================
 2// PhysicsRuntimeMode.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2026–present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9using System.Runtime.CompilerServices;
 10
 11namespace Gravitas;
 12
 13/// <summary>
 14/// Selects which dimensional runtime path a context advances.
 15/// </summary>
 16[Flags]
 17public enum PhysicsRuntimeMode : byte
 18{
 19    /// <summary>
 20    /// No physics runtime path. This is not a valid settings value.
 21    /// </summary>
 22    None = 0,
 23
 24    /// <summary>
 25    /// Advance only the pure 2D runtime path.
 26    /// </summary>
 27    TwoD = 1 << 0,
 28
 29    /// <summary>
 30    /// Advance only the 3D runtime path.
 31    /// </summary>
 32    ThreeD = 1 << 1,
 33
 34    /// <summary>
 35    /// Advance pure 2D and pure 3D runtime paths without cross-dimensional contacts.
 36    /// </summary>
 37    Both = TwoD | ThreeD,
 38
 39    /// <summary>
 40    /// Advance pure 2D, pure 3D, and explicit mixed 2D/3D collision paths.
 41    /// </summary>
 42    Mixed = Both | (1 << 2)
 43}
 44
 45internal static class PhysicsRuntimeModeSupport
 46{
 47    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 48    internal static bool IsValid(this PhysicsRuntimeMode mode)
 49    {
 345550        return mode == PhysicsRuntimeMode.TwoD
 345551            || mode == PhysicsRuntimeMode.ThreeD
 345552            || mode == PhysicsRuntimeMode.Both
 345553            || mode == PhysicsRuntimeMode.Mixed;
 54    }
 55
 56    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 57    internal static bool Runs2D(this PhysicsRuntimeMode mode)
 58    {
 716759        return (mode & PhysicsRuntimeMode.TwoD) != 0;
 60    }
 61
 62    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 63    internal static bool Runs3D(this PhysicsRuntimeMode mode)
 64    {
 716765        return (mode & PhysicsRuntimeMode.ThreeD) != 0;
 66    }
 67
 68    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 69    internal static bool RunsMixedContacts(this PhysicsRuntimeMode mode)
 70    {
 3181671        return mode == PhysicsRuntimeMode.Mixed;
 72    }
 73}