phase(N.4): AcSurfaceMetadata side-table for WB-pristine surface props
Holds Translucency / Luminosity / Diffuse / SurfOpacity / NeedsUvRepeat / DisableFog keyed by (gfxObjId, surfaceIdx). Populated at extraction time, queried by the draw dispatcher. ConcurrentDictionary because mesh extraction happens on background workers. No fork patches required — keeps WB's MeshBatchData pristine. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
81b5ed8c68
commit
46deed6019
3 changed files with 120 additions and 0 deletions
21
src/AcDream.App/Rendering/Wb/AcSurfaceMetadata.cs
Normal file
21
src/AcDream.App/Rendering/Wb/AcSurfaceMetadata.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using AcDream.Core.Meshing;
|
||||
|
||||
namespace AcDream.App.Rendering.Wb;
|
||||
|
||||
/// <summary>
|
||||
/// AC-specific surface render metadata that WB's <c>MeshBatchData</c>
|
||||
/// doesn't carry. Computed at mesh-extraction time and looked up by the
|
||||
/// draw dispatcher to drive translucency / sky-pass / fog behavior.
|
||||
///
|
||||
/// <para>
|
||||
/// All fields mirror those on today's <see cref="GfxObjSubMesh"/> so
|
||||
/// behavior is preserved bit-for-bit through the migration.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public sealed record AcSurfaceMetadata(
|
||||
TranslucencyKind Translucency,
|
||||
float Luminosity,
|
||||
float Diffuse,
|
||||
float SurfOpacity,
|
||||
bool NeedsUvRepeat,
|
||||
bool DisableFog);
|
||||
27
src/AcDream.App/Rendering/Wb/AcSurfaceMetadataTable.cs
Normal file
27
src/AcDream.App/Rendering/Wb/AcSurfaceMetadataTable.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using System.Collections.Concurrent;
|
||||
|
||||
namespace AcDream.App.Rendering.Wb;
|
||||
|
||||
/// <summary>
|
||||
/// Thread-safe side-table mapping <c>(gfxObjId, surfaceIdx)</c> to
|
||||
/// <see cref="AcSurfaceMetadata"/>. Populated when a GfxObj's mesh data
|
||||
/// is extracted; queried at draw time.
|
||||
///
|
||||
/// <para>
|
||||
/// Keyed by <c>(gfxObjId, surfaceIdx)</c> not by WB's runtime batch
|
||||
/// identity because batch objects can be evicted and re-loaded by WB's
|
||||
/// LRU; the (gfxObj, surface) pair is stable across cycles.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public sealed class AcSurfaceMetadataTable
|
||||
{
|
||||
private readonly ConcurrentDictionary<(ulong gfxObjId, int surfaceIdx), AcSurfaceMetadata> _table = new();
|
||||
|
||||
public void Add(ulong gfxObjId, int surfaceIdx, AcSurfaceMetadata meta)
|
||||
=> _table[(gfxObjId, surfaceIdx)] = meta;
|
||||
|
||||
public bool TryLookup(ulong gfxObjId, int surfaceIdx, out AcSurfaceMetadata meta)
|
||||
=> _table.TryGetValue((gfxObjId, surfaceIdx), out meta!);
|
||||
|
||||
public void Clear() => _table.Clear();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue