fix(lighting): trigger indoor ambient on PLAYER cell, not camera cell
User report: third-person chase camera enters interiors before the player body does, so the camera-based cameraInsideCell flag was flipping the scene to indoor lighting prematurely (ambient drops to 0.2 white before the player has actually crossed the doorway). Retail keys lighting off the PLAYER's cell. CellManager::ChangePosition @ 0x004559B0 reads CObjCell::seen_outside on the player's current cell — never on the camera. Match that semantics. - CellVisibility.IsInsideAnyCell(Vector3): new non-caching brute-force scan that's safe to call alongside ComputeVisibility(cameraPos) without thrashing the camera cell cache. - GameWindow render loop: derive playerInsideCell from the player's Position when in player mode, otherwise fall back to cameraInsideCell (orbit/fly debug camera). - UpdateSunFromSky now takes playerInsideCell. The sky-render and depth-buffer-clear decisions still use cameraInsideCell — those are legitimately camera-POV concerns. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a54cd7bef6
commit
1024ba34e0
2 changed files with 34 additions and 3 deletions
|
|
@ -330,6 +330,21 @@ public sealed class CellVisibility
|
|||
local.Z <= cell.LocalBoundsMax.Z + PointInCellEpsilon;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Brute-force scan of every loaded cell to test whether
|
||||
/// <paramref name="worldPoint"/> is inside any of them. Does not touch
|
||||
/// the camera cache (<see cref="_lastCameraCell"/>), so this is safe
|
||||
/// to call alongside <see cref="ComputeVisibility"/> in the same frame
|
||||
/// for a different position (e.g. player position when the camera is
|
||||
/// in third-person chase mode).
|
||||
/// </summary>
|
||||
public bool IsInsideAnyCell(Vector3 worldPoint)
|
||||
{
|
||||
foreach (var cell in _cellLookup.Values)
|
||||
if (PointInCell(worldPoint, cell)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// GetVisibleCells (BFS)
|
||||
// ------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue