fix(render): eliminate EnvCell identity collisions
This commit is contained in:
parent
999201cca7
commit
b7b9aaa9dd
7 changed files with 129 additions and 23 deletions
|
|
@ -5,18 +5,18 @@ namespace AcDream.Core.Tests.Rendering.Wb;
|
|||
public sealed class EnvCellGeometryIdentityTests
|
||||
{
|
||||
[Fact]
|
||||
public void Compute_EmptySurfaces_MatchesExtractedWorldBuilderValue()
|
||||
public void Compute_EmptySurfaces_IsStableGoldenValue()
|
||||
{
|
||||
Assert.Equal(
|
||||
0x2_0000_47D6UL,
|
||||
0xEC48_CD4F_7A03_5AD0UL,
|
||||
EnvCellGeometryIdentity.Compute(0x42, 7, Array.Empty<ushort>()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Compute_OrderedSurfaces_MatchesExtractedWorldBuilderValue()
|
||||
public void Compute_OrderedSurfaces_IsStableGoldenValue()
|
||||
{
|
||||
Assert.Equal(
|
||||
0x2_20A7_A46CUL,
|
||||
0xEE36_FCB2_C067_E94BUL,
|
||||
EnvCellGeometryIdentity.Compute(0x42, 7, new ushort[] { 1, 2, 3 }));
|
||||
}
|
||||
|
||||
|
|
@ -38,5 +38,28 @@ public sealed class EnvCellGeometryIdentityTests
|
|||
new ushort[] { ushort.MaxValue, ushort.MaxValue });
|
||||
|
||||
Assert.NotEqual(0UL, id & 0x2_0000_0000UL);
|
||||
Assert.Equal(0xE000_0000_0000_0000UL, id & 0xF000_0000_0000_0000UL);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LegacyWorldBuilderCollision_InstalledDatTuples_GetDistinctModernIds()
|
||||
{
|
||||
ushort[] firstSurfaces = [0x013B, 0x0034];
|
||||
ushort[] secondSurfaces = [0x04FC, 0x0034];
|
||||
|
||||
ulong firstLegacy = EnvCellGeometryIdentity.ComputeLegacyWorldBuilder(
|
||||
0x0277,
|
||||
0,
|
||||
firstSurfaces);
|
||||
ulong secondLegacy = EnvCellGeometryIdentity.ComputeLegacyWorldBuilder(
|
||||
0x0276,
|
||||
0,
|
||||
secondSurfaces);
|
||||
|
||||
Assert.Equal(0x2_020E_8C13UL, firstLegacy);
|
||||
Assert.Equal(firstLegacy, secondLegacy);
|
||||
Assert.NotEqual(
|
||||
EnvCellGeometryIdentity.Compute(0x0277, 0, firstSurfaces),
|
||||
EnvCellGeometryIdentity.Compute(0x0276, 0, secondSurfaces));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue