Files
bearstonem--openmohaa-vr/code
bearstonemandClaude Opus 5 5267bc66c0 fix(vr): size the terrain visibility cone to the headset, not the game's fov
MOHAA decides which terrain patches are visible with a cone test:
R_MarkTerrainPatch rejects anything further off the view axis than
g_fClipDotSquared allows, and that value is a table lookup indexed by
tr.refdef.fov_x. At the game's 80 degrees the half angle is about 46.

In VR nothing else reads fov_x any more. The projection is built from the
runtime's four tangents in R_SetupProjection, and the culling frustum from the
same in R_SetupFrustum. So refdef.fov_x stayed at whatever the game asked for
while a Quest 3 eye sees closer to 100 degrees, and terrain that was inside the
headset's view but outside an 80 degree cone was never marked visible and never
drawn - with nothing anywhere reporting it, because that cvar has no other
consumer left in this path.

The fov now comes from the widest horizontal tangent when a headset view is
active. Widest rather than the sum: the per-eye frustum is asymmetric and the
cone is symmetric about the view axis, so it has to cover the wider side.

The index is also clamped away from zero. g_fDistanceTable[0] is
443.5 / sqrt(1 - 1) - infinity - which poisons g_vClipOrigin and culls every
patch in the level. Not reachable today, but nothing checked, and the failure
would be total and silent.

MOHAA specific: RTCWQuest has no terrain, so the reference could not have caught
this one.

Not yet tested on the device.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-27 02:46:53 -07:00
..
2025-09-07 20:19:05 +02:00
2025-10-19 21:03:23 +02:00
2025-10-09 00:14:37 +02:00
2023-05-24 19:29:36 +02:00
2025-10-09 00:16:29 +02:00
2025-08-13 19:51:45 +02:00