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>
67 lines
2.3 KiB
C#
67 lines
2.3 KiB
C#
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);
|
|
}
|
|
}
|