| | | 1 | | //======================================================================= |
| | | 2 | | // PhysicsRuntimeModeSupport.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 | | |
| | | 8 | | using System.Runtime.CompilerServices; |
| | | 9 | | |
| | | 10 | | namespace Gravitas; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Validates runtime modes and identifies the physics paths each mode enables. |
| | | 14 | | /// </summary> |
| | | 15 | | internal static class PhysicsRuntimeModeSupport |
| | | 16 | | { |
| | | 17 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 18 | | internal static bool IsValid(this PhysicsRuntimeMode mode) |
| | | 19 | | { |
| | 6173 | 20 | | return mode == PhysicsRuntimeMode.TwoD |
| | 6173 | 21 | | || mode == PhysicsRuntimeMode.ThreeD |
| | 6173 | 22 | | || mode == PhysicsRuntimeMode.Both |
| | 6173 | 23 | | || mode == PhysicsRuntimeMode.Mixed; |
| | | 24 | | } |
| | | 25 | | |
| | | 26 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 27 | | internal static bool Runs2D(this PhysicsRuntimeMode mode) |
| | | 28 | | { |
| | 158084 | 29 | | return (mode & PhysicsRuntimeMode.TwoD) != 0; |
| | | 30 | | } |
| | | 31 | | |
| | | 32 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 33 | | internal static bool Runs3D(this PhysicsRuntimeMode mode) |
| | | 34 | | { |
| | 221054 | 35 | | return (mode & PhysicsRuntimeMode.ThreeD) != 0; |
| | | 36 | | } |
| | | 37 | | |
| | | 38 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 39 | | internal static bool RunsMixedContacts(this PhysicsRuntimeMode mode) |
| | | 40 | | { |
| | 349681 | 41 | | return mode == PhysicsRuntimeMode.Mixed; |
| | | 42 | | } |
| | | 43 | | } |