fix(app): terrain cull exempt + yaw preservation on Tab toggle

1. Terrain culling: TerrainRenderer.Draw now accepts neverCullLandblockId,
   matching StaticMeshRenderer. Both renderers skip frustum-culling the
   player's current landblock. Previously only entities were exempt but
   the terrain under the player still disappeared when looking away.

2. Yaw drift on Tab toggle: render loop stores rotation as Yaw - PI/2
   (AC model facing offset), but yaw extraction on re-entering player
   mode didn't compensate. Each Tab cycle rotated the player 90 degrees.
   Now adds PI/2 back when extracting from the quaternion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-12 21:35:40 +02:00
parent a3b389603d
commit 29fe0c0714
2 changed files with 10 additions and 7 deletions

View file

@ -116,7 +116,7 @@ public sealed unsafe class TerrainRenderer : IDisposable
_landblocks.Remove(landblockId);
}
public void Draw(ICamera camera, FrustumPlanes? frustum = null)
public void Draw(ICamera camera, FrustumPlanes? frustum = null, uint? neverCullLandblockId = null)
{
_shader.Use();
_shader.SetMatrix4("uView", camera.View);
@ -135,7 +135,7 @@ public sealed unsafe class TerrainRenderer : IDisposable
foreach (var lb in _landblocks.Values)
{
if (frustum is not null)
if (frustum is not null && lb.LandblockId != neverCullLandblockId)
{
var aabbMin = new Vector3(lb.WorldOrigin.X, lb.WorldOrigin.Y, lb.MinZ);
var aabbMax = new Vector3(lb.WorldOrigin.X + 192f, lb.WorldOrigin.Y + 192f, lb.MaxZ);