diff --git a/tests/AcDream.Core.Tests/Rendering/Wb/WbDispatcherDepthMaskTests.cs b/tests/AcDream.Core.Tests/Rendering/Wb/WbDispatcherDepthMaskTests.cs new file mode 100644 index 0000000..216a736 --- /dev/null +++ b/tests/AcDream.Core.Tests/Rendering/Wb/WbDispatcherDepthMaskTests.cs @@ -0,0 +1,39 @@ +using AcDream.App.Rendering.Wb; +using AcDream.Core.Meshing; +using Xunit; + +namespace AcDream.Core.Tests.Rendering.Wb; + +/// +/// A.5 T21: lock in the depth-write attribution per translucency kind. +/// +/// WbDrawDispatcher.Draw uses a two-pass structure: +/// +/// Opaque pass — DepthMask(true): writes depth so that +/// later transparent geometry sorts correctly against solid surfaces. +/// Transparent pass — DepthMask(false): reads depth but +/// does NOT write it, so alpha-blended surfaces don't occlude each +/// other by Z-fighting. +/// +/// The partition that decides which pass a batch enters is +/// : +/// Opaque and ClipMap go to the opaque pass (depth write); +/// AlphaBlend, Additive, InvAlpha go to the +/// transparent pass (no depth write). +/// +/// +public sealed class WbDispatcherDepthMaskTests +{ + [Theory] + [InlineData(TranslucencyKind.Opaque, true)] // opaque pass — depth write + [InlineData(TranslucencyKind.ClipMap, true)] // foliage — depth write (binary alpha / A2C) + [InlineData(TranslucencyKind.AlphaBlend, false)] // transparent — no depth write + [InlineData(TranslucencyKind.Additive, false)] + [InlineData(TranslucencyKind.InvAlpha, false)] + public void IsOpaquePartition_ImpliesDepthWriteAttribution( + TranslucencyKind kind, bool expectsDepthWrite) + { + bool isOpaque = WbDrawDispatcher.IsOpaquePublic(kind); + Assert.Equal(expectsDepthWrite, isOpaque); + } +}