fix(render): particles draw unclipped, once, in their retail stage

Retail never clips a particle to a portal view: each emitter's polys
join the ONE alpha list during its owner cell's far-to-near walk turn
(LScape::draw @0x00506330 iterates block_draw_list reversed; DrawBlock
@0x005A17C0 walks cells; ShouldDrawParticles @0x0050FE60 gates by cell
and distance), and occlusion is the depth test at FlushAlphaList
@0x0059D2E0 (its float is a COUNT threshold - 0f = flush all). The
1d2f2f73 architecture instead re-submitted particles once per
OutsideView slice under that slice's hardware clip slot, which cut
effects at aperture boundaries and drew nothing when no outside slice
was in view (the cathedral look-north disappearance).

Now: unattached emitters submit once per frame by owner-cell kind
(outdoor landcells in the landscape stage, interior EnvCells in the
final world scope - new UnattachedEmitterCellScope filter); cell,
shell-route, barrier-static, and late-stage owners submit their
per-slice cone-cull UNION once with clipSlot 0; and particles emit in
the stage matching their PARENT CELL - an interior dynamic whose
sphere straddles an exit-portal plane keeps its mesh in both stages
(#118) but its particles move to the final pass, so the interior
stage can no longer repaint over them (the aperture-band star cut).

Also lands the inert Change-2 primitives for the AP-236 retirement
(candle-behind-door): RetailAlphaQueue.FlushFartherThan drains only
the far prefix without resetting sources, plus the executor
passthrough and the conservative look-in threshold helper - nothing
calls them yet.

User-gated 2026-08-29 round 2 at the Sanctuary Cathedral: spell and
recall stars cover the whole room at every camera direction including
north; waterfall containment holds on retail's depth/seal mechanism;
adjacent-room particles/lights, walls, Holtburg, recall unregressed
(paperdoll remains pre-existing intermittent #443). Register: AP-236
filed for the remaining barrier-order divergence.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-29 12:35:30 +02:00
parent 85530c0b7e
commit 684380d421
10 changed files with 518 additions and 85 deletions

View file

@ -742,6 +742,58 @@ public sealed class ParticleSystemTests
Assert.Equal(new[] { ownerNine }, destination.Select(emitter => emitter.Handle));
}
[Fact]
public void UnattachedCellScope_SplitsEmittersByOwnerCellKind()
{
// One submission per retail stage: outdoor-landcell unattached
// emitters ride the landscape stage and interior-EnvCell ones the
// final world stage, because retail draws each particle during its
// owner CELL's walk turn (ShouldDrawParticles @0x0050FE60). AC cell
// convention: low word < 0x0100 is a landcell, >= 0x0100 an EnvCell;
// cell 0 matches neither scoped mode.
var sys = MakeSystem();
var desc = new EmitterDesc
{
DatId = 0x32000083u,
Type = ParticleType.Still,
MaxParticles = 1,
};
int outdoor = sys.SpawnEmitter(desc, Vector3.Zero);
sys.UpdateEmitterOwnerCell(outdoor, 0xA9B40021u);
int interior = sys.SpawnEmitter(desc, Vector3.Zero);
sys.UpdateEmitterOwnerCell(interior, 0xA9B40100u);
int cellLess = sys.SpawnEmitter(desc, Vector3.Zero);
var destination = new List<ParticleEmitter>();
var none = new HashSet<uint>();
sys.CopyRenderableEmittersForOwners(
ParticleRenderPass.Scene,
none,
includeUnattached: true,
destination,
unattachedCellScope: UnattachedEmitterCellScope.OutdoorCells);
Assert.Equal(new[] { outdoor }, destination.Select(e => e.Handle));
sys.CopyRenderableEmittersForOwners(
ParticleRenderPass.Scene,
none,
includeUnattached: true,
destination,
unattachedCellScope: UnattachedEmitterCellScope.InteriorCells);
Assert.Equal(new[] { interior }, destination.Select(e => e.Handle));
sys.CopyRenderableEmittersForOwners(
ParticleRenderPass.Scene,
none,
includeUnattached: true,
destination,
unattachedCellScope: UnattachedEmitterCellScope.Any);
Assert.Equal(
new[] { outdoor, interior, cellLess },
destination.Select(e => e.Handle));
}
[Fact]
public void SpatialReentryWaitsForFreshRetailViewBeforeBecomingRenderable()
{