Recover Grappler aim gating and implement verified ray constraint components

This commit is contained in:
UnixNight committed 2026-11-03 22:22:45 -05:00
1 parent 0c913d15aa
commit ffea678e90
21 files changed
+1604 -16

No files matched your search

+14 -3
View File
@@ -6,6 +6,7 @@ namespace GamePort.Game;
public readonly record struct CameraRayPolygon(SupportTriangle Triangle, Vector3 StoredNormal,
string? ShapeName = null, string? MaterialName = null, int? MaterialId = null);
public readonly record struct CameraRayResult(Vector3 Eye, float Gain, SupportHit? Hit);
public readonly record struct CameraRaySelection(SupportHit Hit, CameraRayPolygon Polygon);
/// <summary>
/// Source47C210 static camera predicate: first accepted wall-grid polygon, then
@@ -20,6 +21,7 @@ public sealed class OriginalCameraRay
public const float CellOrigin = 130; //49B1FC.
private readonly Dictionary<int, List<SupportTriangle>> walls = [];
private readonly Dictionary<int, List<SupportTriangle>> all = [];
private readonly Dictionary<(int Shape,int Polygon),CameraRayPolygon> sources = [];
public bool Enabled { get; set; } = true; // Modern camera-only debug override.
public int PolygonCount { get; }
public int WallPolygonCount { get; }
@@ -44,6 +46,7 @@ public sealed class OriginalCameraRay
RequireFinite(polygon.StoredNormal);
if (!identities.Add((triangle.ShapeId, triangle.PolygonId)))
throw new InvalidDataException("Camera query needs one source triangle per polygon; fan-triangulated polygons are unsupported");
sources.Add((triangle.ShapeId,triangle.PolygonId),polygon);
var wall = polygon.StoredNormal.Y < .7f; //4798B3; equality excluded.
var min = Vector3.Min(triangle.A, Vector3.Min(triangle.B, triangle.C));
var max = Vector3.Max(triangle.A, Vector3.Max(triangle.B, triangle.C));
@@ -59,15 +62,15 @@ public sealed class OriginalCameraRay
/// <summary>
/// Route/tutorial complete game slot134 is475CD0 (false), including VR02's
///4CDD30 table (rocketship.md), so only the proven
///4CDD30 and VR08's4D00D0 tables, so only the proven
/// NC/checkpoint gates apply. Reject other levels rather than inventing masks.
/// Prepared source metadata is required; raw render visibility is irrelevant.
/// </summary>
public static OriginalCameraRay FromRouteScene(Mesh mesh, string levelCode)
{
ArgumentNullException.ThrowIfNull(mesh);
if (levelCode is not ("LV1B" or "VR01" or "VR02" or "VR04" or "VR07" or "LEV1"))
throw new NotSupportedException("Static camera game-filter recovery covers the route and VR01");
if (levelCode is not ("LV1B" or "VR01" or "VR02" or "VR04" or "VR07" or "VR08" or "LEV1"))
throw new NotSupportedException("Static camera game-filter recovery covers only selected route/tutorial scenes");
if (mesh.Indices.Length % 3 != 0 || mesh.CollisionPolygons.Length != mesh.Indices.Length / 3)
throw new InvalidDataException("Original camera query requires source polygon metadata");
var polygons = new CameraRayPolygon[mesh.CollisionPolygons.Length];
@@ -100,6 +103,14 @@ public sealed class OriginalCameraRay
return TraceCore(start, end, twoSided, diagnostic: false);
}
/// <summary>Capture47C210's hit and selected polygon/material together.
/// This geometry query is independent of the modern camera debug toggle.</summary>
public CameraRaySelection? TraceSelectedGeometry(Vector3 start,Vector3 end,bool twoSided=false)
{
var hit=TraceGeometry(start,end,twoSided);
return hit is{} h?new(h,sources[(h.ShapeId,h.PolygonId)]):null;
}
private SupportHit? TraceCore(Vector3 start, Vector3 end, bool twoSided, bool diagnostic)
{
foreach (var grid in new[] { walls, all })