< Summary

Information
Class: Gravitas.Colliders.ColliderRuntimeShapeState<T>
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/Colliders/State/ColliderRuntimeShapeState.cs
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 41
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
get_IsDirty()100%11100%
MarkDirty()100%11100%
ShouldRebuild(...)100%44100%
Commit(...)100%11100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/Colliders/State/ColliderRuntimeShapeState.cs

#LineLine coverage
 1//=======================================================================
 2// ColliderRuntimeShapeState.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.Colliders;
 12
 13/// <summary>
 14/// Tracks the last shape snapshot and determines when 3D runtime geometry needs rebuilding.
 15/// </summary>
 16internal class ColliderRuntimeShapeState<TSnapshot>
 17    where TSnapshot : IEquatable<TSnapshot>
 18{
 19    private TSnapshot _snapshot = default!;
 20    private bool _hasSnapshot;
 2493221    private bool _dirty = true;
 22
 23    public uint RuntimeVersion { get; private set; }
 25153624    public bool IsDirty => _dirty;
 25
 26    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 1735027    public void MarkDirty() => _dirty = true;
 28
 29    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 30    public bool ShouldRebuild(in TSnapshot snapshot) =>
 41438431        _dirty || !_hasSnapshot || !_snapshot.Equals(snapshot);
 32
 33    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 34    public void Commit(in TSnapshot snapshot)
 35    {
 21954036        _snapshot = snapshot;
 21954037        _hasSnapshot = true;
 21954038        _dirty = false;
 21954039        RuntimeVersion++;
 21954040    }
 41}