The remaining code-bearing findings from the round review, F4-F16 minus the doc-only items (batched separately): - F4: three client-wide UiButton corpus sweeps (LabelBox path — exactly the 4 Town buttons, confined to chargen; conflicting custom-selection- pair + standard Normal/Highlight media — zero found, no gate tightening needed; per-state label-color map — 209 matches beyond chargen, confirming AP-222's mechanism has always been broadly active since it shipped generically in DatWidgetFactory). - F5/F6: LayoutImporter's Batch C un-consumed-children carve-out now honors a child's own AuthoredInvisible flag (a narrow honor scoped to exactly that carve-out, not the general #408 client-wide one) — the chat transcript's new-text indicator (0x1000048C) was building as a visible phantom element retail never shows; verified both directions against the gold-frame pieces, which do not author Invisible. - F7: BoundedProcessOutputCapture.AppendLine combines the line text and its trailing newline into one buffer and one file open/write/close instead of two. - F9: corrected a stale comment in RuntimeSettingsTargets — #407 split DisplayModeCatalog's Resolutions/WindowedResolutions in two, so the fullscreen validator's own narrower list is now DELIBERATELY different from the Config dropdown's fuller offering, not the "must match" bug the comment described. - F10: documented (not changed) why the LabelBox path's default 3px inset and the face-relative +4px gap in DatWidgetFactory.BuildButton are deliberately different numbers — neither carries a retail citation, and moving either to match the other would be an unfounded guess on a button that currently works correctly. - F11: Heritage/Profession/Summary/Town description pages now compose DatRichText.Compose's result ONCE inside their already revision-gated Refresh, caching the built line list instead of re-wrapping on every draw call. - F14: documented (not changed) why PrivateEntityViewportRenderer's _animatedIds set carrying a reserved-but-never-drawn backdrop id is harmless — BuildDrawEntities already excludes a null/empty backdrop from the actual draw list, so the id is never looked up. - F16: the Summary preview now uses its own render-id pair (SummaryPreviewRenderId/SummaryPreviewBackdropRenderId, 0xDA11D035/ 0xDA11D036) instead of sharing the Appearance page's (0xDA11D032/0xDA11D034) — confirmed by tracing FixedEntityTextureOwnerLease through TextureCache to CompositeTextureArrayCache's shared owner tracker that both pages' previews share ONE process-wide TextureCache, so sharing render ids was a real cross-page texture-release collision (either page's own re-dress or disposal could release the OTHER page's still-active textures), not a theoretical one. F3's own register bookkeeping (AP-229 addendum) and F12's register/AD header-count corrections land in the docs-only commit alongside F15. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
136 lines
5.8 KiB
C#
136 lines
5.8 KiB
C#
using AcDream.App.Rendering.Wb;
|
|
using AcDream.App.UI;
|
|
using AcDream.Core.Lighting;
|
|
using AcDream.Core.World;
|
|
|
|
namespace AcDream.App.Rendering;
|
|
|
|
/// <summary>
|
|
/// CC6b-MOUNT: narrow seam mirroring <c>IPaperdollDollRenderer</c> so
|
|
/// <see cref="ChargenPreviewController"/>'s rebuild/render logic can be
|
|
/// exercised with a fake in tests without a live GPU device.
|
|
/// </summary>
|
|
internal interface IChargenPreviewRenderer
|
|
{
|
|
void SetPreview(WorldEntity? entity);
|
|
|
|
/// <summary>
|
|
/// Sets or clears the environment backdrop entity drawn BEHIND the
|
|
/// preview (Campaign CC gate round 1 Batch D, GF-7/GF-14) — retail's
|
|
/// <c>gmCG3DView::m_pbgObject</c>. See
|
|
/// <see cref="ChargenPreviewEntityBuilder.TryBuildBackdrop"/> for the
|
|
/// decomp-cited placement.
|
|
/// </summary>
|
|
void SetBackdrop(WorldEntity? entity);
|
|
|
|
uint Render(int width, int height);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Chargen-specific facade over the shared private creature viewport
|
|
/// (<see cref="PrivateEntityViewportRenderer"/>) — CC6a's foundation half of
|
|
/// the campaign plan's "chargen preview renderer" deliverable. Mirrors
|
|
/// <see cref="PaperdollViewportRenderer"/>'s shape exactly, with a
|
|
/// heading-capable <see cref="ChargenPreviewViewportCamera"/> in place of the
|
|
/// paperdoll's fixed one.
|
|
///
|
|
/// <para>
|
|
/// <b>NOT wired here (CC6b page-mount half, after CC4 merges per the
|
|
/// campaign's parallelism contract):</b> mounting into the authored
|
|
/// Appearance/Summary viewport ids (<c>0x100003bb</c> / <c>0x10000406</c>)
|
|
/// and binding the spin/color-wheel/rotate/zoom widgets to
|
|
/// <see cref="ChargenPreviewAnimator"/>/<see cref="ChargenPreviewRotationController"/>/
|
|
/// <see cref="ChargenPreviewZoomController"/>. This class is a standalone,
|
|
/// composition-root-agnostic renderer — nothing in
|
|
/// <c>AcDream.App/UI/Layout/</c> or <c>RetailUiRuntime.cs</c> references it
|
|
/// yet.
|
|
/// </para>
|
|
///
|
|
/// <para>
|
|
/// <b>CC6b (pre-mount half):</b> the preview now HAS a real live idle loop
|
|
/// (<see cref="ChargenPreviewAnimator"/>, retail's <c>m_didAnimation</c> DID
|
|
/// at 30fps via <c>set_sequence_animation</c>) instead of the CC6a-only held
|
|
/// rest pose — TS-83 is retired. <see cref="SetPreview"/> still accepts a
|
|
/// static <c>WorldEntity</c> for callers that only want
|
|
/// <c>ChargenPreviewEntityBuilder.TryBuild</c>'s unchanged rest-pose
|
|
/// snapshot; a caller that wants the animated preview constructs a
|
|
/// <see cref="ChargenPreviewAnimator"/> from
|
|
/// <c>ChargenPreviewEntityBuilder.TryBuildAnimated</c> and passes its
|
|
/// <c>Entity</c> here once — the animator mutates that SAME entity's
|
|
/// <c>MeshRefs</c> in place every <c>Tick</c>, and <c>Render</c> reads it
|
|
/// fresh (no re-<c>SetPreview</c> needed per frame; see
|
|
/// <c>WorldEntity.MeshRefs</c>'s own "mutable so the animation tick can
|
|
/// replace it each frame" doc comment).
|
|
/// </para>
|
|
/// </summary>
|
|
internal sealed class ChargenPreviewRenderer :
|
|
IUiViewportRenderer,
|
|
IChargenPreviewRenderer,
|
|
IDisposable
|
|
{
|
|
private readonly PrivateEntityViewportRenderer _renderer;
|
|
private readonly ChargenPreviewViewportCamera _camera;
|
|
|
|
internal ChargenPreviewRenderer(
|
|
IWorldPassScope scope,
|
|
AcDream.App.Rendering.Gpu.IGpuDevice device,
|
|
ICurrentGpuFrameSource frames,
|
|
WbDrawDispatcher dispatcher,
|
|
SceneLightingUboBinding lightUbo,
|
|
IEntityTextureLifetime textureLifetime,
|
|
IWbMeshAdapter meshAdapter,
|
|
uint heritageId = 0u,
|
|
ChargenPreviewCamera? camera = null,
|
|
// F16 (Campaign CC gate round 1 closeout): the Appearance and
|
|
// Summary pages each construct their OWN ChargenPreviewRenderer but
|
|
// share ONE process-wide TextureCache — see
|
|
// ChargenPreviewEntityBuilder.SummaryPreviewRenderId's own doc for
|
|
// the full collision trace. Defaulting to the Appearance page's
|
|
// pair keeps every pre-existing call site byte-identical; the
|
|
// composition root passes the Summary pair explicitly for its own
|
|
// instance.
|
|
uint renderId = ChargenPreviewEntityBuilder.PreviewRenderId,
|
|
uint backdropRenderId = ChargenPreviewEntityBuilder.PreviewBackdropRenderId)
|
|
{
|
|
// CC6b-MOUNT: when a caller supplies its own camera instance (the
|
|
// page-mount composition, which needs a SETTABLE camera for
|
|
// ChargenPreviewZoomController to tween — see
|
|
// ChargenPreviewController's own doc comment), wrap that exact
|
|
// instance instead of building a private, unreachable one.
|
|
_camera = camera is not null
|
|
? new ChargenPreviewViewportCamera(camera)
|
|
: new ChargenPreviewViewportCamera(heritageId);
|
|
_renderer = new PrivateEntityViewportRenderer(
|
|
scope,
|
|
device,
|
|
frames,
|
|
dispatcher,
|
|
lightUbo,
|
|
textureLifetime,
|
|
meshAdapter,
|
|
renderId,
|
|
_camera,
|
|
"chargen preview",
|
|
// Batch D (GF-7/GF-14): reserves the second draw-entity slot for
|
|
// the heritage's environment Setup — see PrivateEntityViewportRenderer's
|
|
// own doc comment on backdropRenderId.
|
|
backdropRenderId);
|
|
}
|
|
|
|
public bool TextureIsBottomUp => _renderer.TextureIsBottomUp;
|
|
|
|
/// <summary>
|
|
/// Re-derives the fixed per-heritage camera eye
|
|
/// (<see cref="ChargenPreviewCamera.ResolveDefaultEye"/>) — call whenever
|
|
/// the selected heritage changes, BEFORE the next <see cref="Render"/>.
|
|
/// </summary>
|
|
public void SetHeritage(uint heritageId) => _camera.SetHeritage(heritageId);
|
|
|
|
public void SetPreview(WorldEntity? entity) => _renderer.SetEntity(entity);
|
|
|
|
public void SetBackdrop(WorldEntity? entity) => _renderer.SetBackdrop(entity);
|
|
|
|
public uint Render(int width, int height) => _renderer.Render(width, height);
|
|
|
|
public void Dispose() => _renderer.Dispose();
|
|
}
|