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
|
|
@ -0,0 +1,67 @@
|
|||
using System.Numerics;
|
||||
using AcDream.App.Rendering.Vfx;
|
||||
using AcDream.Core.Vfx;
|
||||
|
||||
namespace AcDream.App.Tests.Rendering.Vfx;
|
||||
|
||||
public sealed class ParticleVisibilityControllerTests
|
||||
{
|
||||
[Fact]
|
||||
public void CompletedRetailViewFeedsNextParticleUpdate()
|
||||
{
|
||||
var particles = new ParticleSystem(new EmitterDescRegistry(), new Random(1));
|
||||
int handle = particles.SpawnEmitter(
|
||||
new EmitterDesc
|
||||
{
|
||||
DatId = 0x32000001u,
|
||||
Type = ParticleType.Still,
|
||||
MaxDegradeDistance = 100f,
|
||||
MaxParticles = 1,
|
||||
InitialParticles = 1,
|
||||
LifetimeMin = 10f,
|
||||
LifetimeMax = 10f,
|
||||
},
|
||||
Vector3.Zero,
|
||||
attachedObjectId: 99u);
|
||||
particles.UpdateEmitterOwnerCell(handle, 0x01010001u);
|
||||
var controller = new ParticleVisibilityController();
|
||||
|
||||
controller.BeginFrame(Vector3.Zero);
|
||||
controller.UseWorldView();
|
||||
controller.MarkVisibleCells(new HashSet<uint> { 0x01010001u });
|
||||
controller.CompleteFrame();
|
||||
controller.Apply(particles, 1f);
|
||||
|
||||
Assert.True(Assert.Single(particles.EnumerateEmitters()).ViewEligible);
|
||||
Assert.Equal(handle, Assert.Single(particles.EnumerateEmitters()).Handle);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnresolvedFramePublishesEmptyWorldView()
|
||||
{
|
||||
var particles = new ParticleSystem(new EmitterDescRegistry(), new Random(1));
|
||||
int handle = particles.SpawnEmitter(
|
||||
new EmitterDesc
|
||||
{
|
||||
DatId = 0x32000002u,
|
||||
Type = ParticleType.Still,
|
||||
MaxDegradeDistance = 100f,
|
||||
MaxParticles = 1,
|
||||
},
|
||||
Vector3.Zero,
|
||||
attachedObjectId: 42u);
|
||||
particles.UpdateEmitterOwnerCell(handle, 0x01010001u);
|
||||
var controller = new ParticleVisibilityController();
|
||||
|
||||
controller.BeginFrame(Vector3.Zero);
|
||||
controller.UseWorldView();
|
||||
controller.CompleteFrame();
|
||||
controller.Apply(particles, 1f);
|
||||
Assert.False(Assert.Single(particles.EnumerateEmitters()).ViewEligible);
|
||||
|
||||
controller.BeginFrame(Vector3.Zero);
|
||||
controller.CompleteFrame();
|
||||
controller.Apply(particles, 1f);
|
||||
Assert.False(Assert.Single(particles.EnumerateEmitters()).ViewEligible);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue