| | | 1 | | //======================================================================= |
| | | 2 | | // CollisionSatScratch.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; |
| | | 9 | | using FixedMathSharp; |
| | | 10 | | using SwiftCollections; |
| | | 11 | | |
| | | 12 | | namespace Gravitas.CollisionHandling; |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Owns reusable SAT and mesh-query buffers for one world context. |
| | | 16 | | /// </summary> |
| | | 17 | | internal sealed class CollisionSatScratch |
| | | 18 | | { |
| | 10191 | 19 | | internal Vector3d[] PolyhedronVertices = Array.Empty<Vector3d>(); |
| | 20382 | 20 | | internal int[] PolyhedronTriangles = Array.Empty<int>(), PolyhedronEdges = Array.Empty<int>(); |
| | | 21 | | internal SwiftList<MeshTriangleContactGenerator.HullSample> HullSamples { get; } = new(8); |
| | | 22 | | internal SwiftList<Vector3d> ConvexPatchVertices { get; } = new(); |
| | | 23 | | internal SwiftList<int> ConvexPatchTriangles { get; } = new(); |
| | | 24 | | internal SwiftList<int> ConvexPatchEdges { get; } = new(); |
| | | 25 | | |
| | | 26 | | public SwiftList<int> MeshCylinderTriangles { get; } = new(8); |
| | | 27 | | |
| | | 28 | | public SwiftList<int> MeshTriangleCandidatesA { get; } = new(16); |
| | | 29 | | |
| | | 30 | | public SwiftList<int> MeshTriangleCandidatesB { get; } = new(16); |
| | | 31 | | |
| | | 32 | | public SwiftHashSet<int> MeshSurfaces { get; } = new(8); |
| | | 33 | | |
| | | 34 | | public MeshSurfaceConnectivity MeshConnectivity { get; } = new(); |
| | | 35 | | |
| | | 36 | | public MeshConeFaceRegions MeshConeFaces { get; } = new(); |
| | | 37 | | |
| | | 38 | | public MeshCapsuleFaceRegions MeshCapsuleFaces { get; } = new(); |
| | | 39 | | |
| | | 40 | | public MeshSlabFaceRegions MeshSlabFaces { get; } = new(); |
| | | 41 | | |
| | | 42 | | public MeshSlabSurfaceBoundary MeshSlabBoundary { get; } = new(); |
| | | 43 | | |
| | | 44 | | public MeshCapsuleSurfaceBoundary MeshCapsuleBoundary { get; } = new(); |
| | | 45 | | |
| | | 46 | | public MeshConeSurfaceBoundary MeshConeBoundary { get; } = new(); |
| | | 47 | | |
| | | 48 | | public ContactManifold MeshSurfaceManifold { get; } = new(); |
| | | 49 | | |
| | | 50 | | public ContactManifold CompoundPartManifold { get; } = new(); |
| | | 51 | | |
| | | 52 | | public ContactManifold MixedManifold { get; } = new(); |
| | | 53 | | |
| | | 54 | | // Pair refreshes borrow these only during synchronous narrow phase after a matrix edit. |
| | | 55 | | private ContactManifold? _surfaceContactSnapshot3D; |
| | 5 | 56 | | internal ContactManifold SurfaceContactSnapshot3D => _surfaceContactSnapshot3D ??= new(); |
| | | 57 | | private ContactManifold2D? _surfaceContactSnapshot2D; |
| | 8 | 58 | | internal ContactManifold2D SurfaceContactSnapshot2D => _surfaceContactSnapshot2D ??= new(); |
| | | 59 | | } |