fix(render): eliminate EnvCell identity collisions

This commit is contained in:
Erik 2026-07-24 13:44:56 +02:00
parent 999201cca7
commit b7b9aaa9dd
7 changed files with 129 additions and 23 deletions

View file

@ -120,7 +120,9 @@ public sealed class EnvCellLandblockBuildBuilder
}
/// <summary>
/// Source: WB EnvCellRenderManager.cs:94-103 (verbatim arithmetic).
/// Collision-resistant successor to WB EnvCellRenderManager.cs:94-103.
/// The legacy polynomial and its installed-DAT collision remain covered by
/// Core conformance tests.
/// </summary>
public static ulong ComputeGeometryId(
uint environmentId,

View file

@ -4,7 +4,7 @@
// four reverted RR7 variants couldn't fix.
//
// Sources ported byte-for-byte:
// GetEnvCellGeomId <- WB EnvCellRenderManager.cs:94-103
// GetEnvCellGeomId <- collision-resistant successor to WB's content key
// PrepareRenderBatches <- WB EnvCellRenderManager.cs:247-373
// Render(filter:) <- WB EnvCellRenderManager.cs:395-511
// RenderModernMDIInternal <- WB BaseObjectRenderManager.cs:709-848 (single-slot variant)
@ -353,14 +353,15 @@ public sealed unsafe class EnvCellRenderer : IDisposable
// ---------------------------------------------------------------------------
// GetEnvCellGeomId
// Verbatim copy of WB EnvCellRenderManager.cs:94-103.
// Shared collision-resistant content identity. Core retains WB's original
// polynomial for conformance evidence and the installed-DAT collision test.
// ---------------------------------------------------------------------------
/// <summary>
/// Returns a deduplicated geometry ID for an EnvCell based on its environment,
/// cell structure index, and surface IDs. Bit 33 is set to distinguish from
/// per-cell IDs (which use bit 32).
/// Source: WB EnvCellRenderManager.cs:94-103 (verbatim).
/// See <see cref="AcDream.Core.Rendering.Wb.EnvCellGeometryIdentity"/>.
/// </summary>
public static ulong GetEnvCellGeomId(uint environmentId, ushort cellStructure, List<ushort> surfaces)
=> EnvCellLandblockBuildBuilder.ComputeGeometryId(