feat(D.2b): Slice 2 — wire paperdoll doll RTT pass + re-dress into GameWindow

Drives the doll 3-D pass in a pre-UI hook (after the world passes, before
_uiHost.Draw), gated on inventory-open AND doll-view (the viewport widget's
Visible, set by the Slots toggle). RefreshPaperdollDoll clones the live
player entity (_entitiesByServerGuid[player]) into a DollEntityBuilder doll
with COPIED MeshRefs (frozen pose); re-dress is triggered by a dirty flag
set in OnLiveAppearanceUpdated (0xF625) — the C# analog of RedressCreature.

Correctness fix: the doll is passed in animatedEntityIds so the dispatcher
BYPASSES the Tier-1 classification cache (WbDrawDispatcher.cs:1142). Without
it, a re-dress (a new WorldEntity with the same fixed DollRenderId) would
serve the previous doll's cached batches and the new gear wouldn't appear.

Renderer disposed in the GameWindow teardown. Build + full App suite green
(594). Static doll (no idle animation yet — next slice). Visual gate next.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-23 09:22:45 +02:00
parent 3cdecb536b
commit 8b0365e7a9
3 changed files with 103 additions and 2 deletions

View file

@ -34,6 +34,17 @@ public static class DollEntityBuilder
/// </summary>
public const uint DollServerGuid = 0xDA11_D011u;
/// <summary>
/// Reserved render-local entity id for the doll. FIXED (the doll is a singleton)
/// and high enough never to collide with <c>_liveEntityIdCounter</c> ids. The
/// renderer passes this in <c>animatedEntityIds</c> so the dispatcher treats the
/// doll as animated — which BYPASSES the Tier-1 classification cache
/// (WbDrawDispatcher.cs:1142). That matters because a re-dress builds a NEW
/// WorldEntity with this SAME id; without the cache bypass the dispatcher would
/// serve the previous doll's cached batches and the new gear wouldn't appear.
/// </summary>
public const uint DollRenderId = 0xDA11_D012u;
// retail set_heading: 191.367905° about +Z, expressed as a Quaternion
// (axis-angle, axis = (0,0,1), θ = 191.367905° in radians).
private static readonly float _headingRad = 191.367905f * (MathF.PI / 180f);
@ -104,7 +115,7 @@ public static class DollEntityBuilder
// replace it before registration.
return new WorldEntity
{
Id = 0u,
Id = DollRenderId,
ServerGuid = DollServerGuid,
SourceGfxObjOrSetupId = setupId,
Position = Vector3.Zero,