perf(vfx): port retail particle visibility degradation
Resolve DAT-authored particle ranges from the hardware GfxObj, apply retail distance and completed-cell visibility gates, and preserve the exact finite/infinite off-view update semantics. This removes dense-world simulation work without shortening terrain, entity, fog, or streaming distance. Publish doorway-clipped outdoor cells through a focused frame controller, retain effect cell identity for outdoor statics, reject hidden emitters before particle-slot scans, and offer an explicit opt-in Extended particle range. Release build succeeds and all 5,857 tests pass with five intentional skips. Retail-conformance, architecture, and adversarial review cycles are clean; connected Aerlinthe visual/performance gate pending. Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
parent
82789eea88
commit
f1ba147ac5
29 changed files with 1810 additions and 125 deletions
|
|
@ -45,7 +45,7 @@ public sealed class EntityEffectPoseRegistry : IEntityEffectPoseSource, IEntityE
|
|||
Matrix4x4.CreateFromQuaternion(entity.Rotation)
|
||||
* Matrix4x4.CreateTranslation(entity.Position),
|
||||
partLocal,
|
||||
entity.ParentCellId ?? 0u,
|
||||
entity.EffectCellId ?? entity.ParentCellId ?? 0u,
|
||||
availability);
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ public sealed class EntityEffectPoseRegistry : IEntityEffectPoseSource, IEntityE
|
|||
}
|
||||
|
||||
record.RootWorld = rootWorld;
|
||||
record.CellId = entity.ParentCellId ?? 0u;
|
||||
record.CellId = entity.EffectCellId ?? entity.ParentCellId ?? 0u;
|
||||
if (entity.IndexedPartTransforms.Count > 0)
|
||||
{
|
||||
CopyParts(
|
||||
|
|
@ -119,7 +119,7 @@ public sealed class EntityEffectPoseRegistry : IEntityEffectPoseSource, IEntityE
|
|||
return false;
|
||||
record.RootWorld = Matrix4x4.CreateFromQuaternion(entity.Rotation)
|
||||
* Matrix4x4.CreateTranslation(entity.Position);
|
||||
record.CellId = entity.ParentCellId ?? 0u;
|
||||
record.CellId = entity.EffectCellId ?? entity.ParentCellId ?? 0u;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,93 @@
|
|||
using System.Numerics;
|
||||
using AcDream.Core.Vfx;
|
||||
|
||||
namespace AcDream.App.Rendering.Vfx;
|
||||
|
||||
/// <summary>
|
||||
/// Bridges the retained retail PView result into the next physics update's
|
||||
/// <c>CObjCell::IsInView</c> particle gate. The controller owns only immutable
|
||||
/// frame meaning: one completed viewer position plus the AC cells admitted by
|
||||
/// that completed view. It neither creates emitters nor performs rendering.
|
||||
/// </summary>
|
||||
public sealed class ParticleVisibilityController
|
||||
{
|
||||
public const float ExtendedRangeMultiplier = 2f;
|
||||
|
||||
private readonly HashSet<uint> _buildingCellIds = new();
|
||||
private readonly HashSet<uint> _completedCellIds = new();
|
||||
private Vector3 _buildingViewerPosition;
|
||||
private Vector3 _completedViewerPosition;
|
||||
private bool _frameOpen;
|
||||
private bool _frameUsesWorldView;
|
||||
private bool _hasCompletedWorldView;
|
||||
|
||||
public void BeginFrame(Vector3 viewerPosition)
|
||||
{
|
||||
_buildingCellIds.Clear();
|
||||
_buildingViewerPosition = viewerPosition;
|
||||
_frameUsesWorldView = false;
|
||||
_frameOpen = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Declares that this frame has an authoritative world-visibility product.
|
||||
/// That product can come from the unified retail PView or from the outdoor
|
||||
/// landscape fallback. Login and portal-space frames deliberately omit it;
|
||||
/// dedicated pass and examination emitters carry explicit bypass policies.
|
||||
/// </summary>
|
||||
public void UseWorldView()
|
||||
{
|
||||
if (_frameOpen)
|
||||
_frameUsesWorldView = true;
|
||||
}
|
||||
|
||||
public void MarkVisibleCells(HashSet<uint> cellIds)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(cellIds);
|
||||
if (!_frameOpen || !_frameUsesWorldView)
|
||||
return;
|
||||
|
||||
_buildingCellIds.UnionWith(cellIds);
|
||||
}
|
||||
|
||||
public void CompleteFrame()
|
||||
{
|
||||
if (!_frameOpen)
|
||||
return;
|
||||
|
||||
_frameOpen = false;
|
||||
if (!_frameUsesWorldView)
|
||||
{
|
||||
_completedCellIds.Clear();
|
||||
_completedViewerPosition = _buildingViewerPosition;
|
||||
_hasCompletedWorldView = false;
|
||||
return;
|
||||
}
|
||||
|
||||
_completedCellIds.Clear();
|
||||
_completedCellIds.UnionWith(_buildingCellIds);
|
||||
_completedViewerPosition = _buildingViewerPosition;
|
||||
_hasCompletedWorldView = true;
|
||||
}
|
||||
|
||||
public void Apply(ParticleSystem particles, float rangeMultiplier)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(particles);
|
||||
particles.ApplyRetailView(
|
||||
_completedViewerPosition,
|
||||
_completedCellIds,
|
||||
_hasCompletedWorldView,
|
||||
rangeMultiplier);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_buildingCellIds.Clear();
|
||||
_completedCellIds.Clear();
|
||||
_frameOpen = false;
|
||||
_frameUsesWorldView = false;
|
||||
_hasCompletedWorldView = false;
|
||||
_buildingViewerPosition = default;
|
||||
_completedViewerPosition = default;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue