2.7 KiB
Static source camera query checks
Run from GamePort:
source scripts/env.sh
dotnet run --project tests/GamePort.CameraRayTests
dotnet run --project tests/GamePort.SupportTests
Optional first argument selects the prepared-scene root (default
artifacts/extracted). Original geometry is prepared separately; these tests
do not modify or execute original files.
OriginalCameraRay.FromRouteScene(mesh, levelCode) accepts only LV1B, VR04 and
LEV1, whose original game polygon-filter slot134 is475CD0 (false). It retains
source shape/polygon identity and stored normals, excludes NC/checkpoint records,
and rejects included fan-triangulated polygon identities rather than changing the
original first-three-corner rule. All included polygons in these three original
scenes are triangles. Original registration counts are2851/2483 wall (lab),
508/420 (VR04),5231/3860 (outside).
Source anchors and exact file offsets are recorded in
docs/checkpoint/camera-ray-predicate.md and checked by
tests/test_checkpoint_camera_ray.py. Critical contracts are47C210 wall-first
then general-grid fallback;47C280/47C4B0 inclusive ascending X/Z rectangle and
FIFO first accepted polygon;479800 tail insertion and4798B3 normal.Y<.7;
469A10/469B70 one-sided segment/triangle kernel and strict endpoint rejection.
43B820 applies .25*look+.75*hit and returns gain1.5; a miss leaves eye/gain1.
API: Trace(start,end,twoSided=false) returns optional SupportHit;
Constrain(look,desired) returns CameraRayResult(Eye,Gain,Hit). Enabled is the
per-adapter representation of source global4F69E5. PolygonCount/WallPolygonCount
and LastTriangleTests are modern diagnostics; repeated cells count repeated
triangle tests. OriginalBodySupport.IntersectSegment shares the recovered
individual kernel while its existing Trace retains nearest reduction.
The checks exercise source route counts and deliberately non-nearest results, cell direction, FIFO identity, repeated candidates, fallback, normal threshold, winding/sidedness, beginning/end, degenerate segments, filters, proxy retention, enable flag, look-point weighting, negative/signed16 cells and malformed inputs. They verify this port implementation and source data, not original running-game behavior or whole-camera integration.
Limits: grid conversion uses double intermediates in place of x87 extended precision; exact boundary equivalence and integer overflow remain unrecovered. Finite values outside supported signed64 conversion throw. Lookup tables retain the existing support module's modern-trig limitation. Other level-specific polygon filters, missing shape IDs, nonidentity terrain transforms, camera input modes and shared viewport/follow update state remain outside this adapter.