Boresight parallax FIXED + the #4/#5 verdict instrumentation (Gitea #16, #4, #5)

PARALLAX (#16): the pick/fire ray was anchored at mech.y+5.0 (a port
improvisation) while the sight line ran from the eyepoint (y=6.23) --
two parallel rays whose constant offset grew into the reported low-miss
as range closed (measured ry +0.072 @50u -> +1.54 @2.7u).  The decomp's
sight and pick share the eye origin (HudSimulation @4b7830 chain).  Fix:
the viewpoint mech's cockpit eye owns the aim-camera publish in BOTH
views, origin = its own eye translation; leveling + deliberate elevation
untouched; chase view now converges to cockpit ballistics (V cannot
change where shots land).  After: pick pinned to the crosshair (ry <=
5e-6) from 50u to point-blank; 26 laser + 8 missile center-mass hits at
3/4-screen.  Awaiting the reporters' approach-test.

VERDICT INSTRUMENTATION (#4 closed authentic, #5 verdict posted):
BT_RANGE_LOG per-frame pick tracing + BTGroundRayHitExact analytic
cross-check (0/8000 arena fall-throughs; cavern 6/8400 single-frame
grazes -- the 'crazy sliding' is the authentic world-pick + 500 m/s
slide over depth discontinuities); BT_AUD_TAIL StopNote/fade timing +
BT_FIRE_PULSE single-shot driver (the energy 'buzz' is the AUTHORED
charging loop: crescendo through recharge, 1.309s authored release,
measured within one frame).  CAVERN.EGG: solo cavern test egg.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-20 14:51:54 -05:00
co-authored by Claude Fable 5
parent d7158f1f82
commit 70eea6c1a4
13 changed files with 744 additions and 18 deletions
+65
View File
@@ -133,6 +133,31 @@ static float gBTAimVpW = 0.0f; // D3D viewport (backbuffer) size --
static float gBTAimVpH = 0.0f; // the dpl2d frame's pixel space
static int gBTAimCamValid = 0;
// issue #16 (boresight parallax) diagnostics: the RENDER camera pose -- the
// frame the crosshair is actually drawn in (screen centre of the ACTIVE view).
// Published unconditionally by the active eye each frame; BT_PARALLAX_LOG
// projects the PICK point back into this view to measure how far the shot
// lands from the crosshair. A healthy boresight keeps the pick point pinned
// at reticle (0,0) in cockpit view from max range all the way in.
static float gBTRenderCamPos[3] = {0, 0, 0};
static float gBTRenderCamX[3] = {1, 0, 0}; // camera right
static float gBTRenderCamY[3] = {0, 1, 0}; // camera up
static float gBTRenderCamZ[3] = {0, 0, 1}; // camera BACK (view dir = -Z)
static int gBTRenderCamValid = 0;
void BTSetRenderCamera(const float pos[3], const float xax[3],
const float yax[3], const float zax[3])
{
for (int i = 0; i < 3; ++i)
{
gBTRenderCamPos[i] = pos[i];
gBTRenderCamX[i] = xax[i];
gBTRenderCamY[i] = yax[i];
gBTRenderCamZ[i] = zax[i];
}
gBTRenderCamValid = 1;
}
void BTSetAimCamera(const float pos[3], const float xax[3],
const float yax[3], const float zax[3])
{
@@ -263,6 +288,46 @@ int BTProjectToReticle(const float world[3], float *rx, float *ry)
return 1;
}
//
// issue #16 (boresight parallax) diag: world point -> reticle coords through
// the RENDER camera (the view the crosshair is drawn in), NOT the aim camera
// (projecting the pick point through the aim camera is trivially (0,0) --
// the pick point lies ON the aim ray). eyeOut receives the render eye
// position so the caller can log the true sight-line range. Same reticle
// frame as BTProjectToReticle (+y down; unit = half the viewport height).
//
int BTProjectToRenderView(const float world[3], float *rx, float *ry,
float eyeOut[3])
{
if (!gBTRenderCamValid || gBTAimP11 <= 0.0f || gBTAimP22 <= 0.0f
|| gBTAimVpH <= 0.0f)
{
*rx = 0.0f; *ry = 0.0f;
return 0;
}
if (eyeOut != 0)
for (int i = 0; i < 3; ++i)
eyeOut[i] = gBTRenderCamPos[i];
float rel[3];
for (int i = 0; i < 3; ++i)
rel[i] = world[i] - gBTRenderCamPos[i];
const float xc = rel[0]*gBTRenderCamX[0] + rel[1]*gBTRenderCamX[1] + rel[2]*gBTRenderCamX[2];
const float yc = rel[0]*gBTRenderCamY[0] + rel[1]*gBTRenderCamY[1] + rel[2]*gBTRenderCamY[2];
const float zc = rel[0]*gBTRenderCamZ[0] + rel[1]*gBTRenderCamZ[1] + rel[2]*gBTRenderCamZ[2];
const float depth = -zc; // camera looks down -Z
if (depth < 0.1f)
{
*rx = (xc >= 0.0f) ? 2.0f : -2.0f;
*ry = 0.0f;
return 0;
}
const float ndcX = (xc * gBTAimP11) / depth;
const float ndcY = (yc * gBTAimP22) / depth;
*rx = ndcX * BTGetPresentAspect();
*ry = -ndcY;
return 1;
}
//
// The target HOTBOX projection (the recovered reticle Execute @4cdff7-4ce0f9
// [T1]): project the box hugging the target's extents -- x +-4 around the