fix #451: stabilize portal seam rendering
This commit is contained in:
parent
f6fe0f2a4f
commit
1d2f2f738f
29 changed files with 1650 additions and 239 deletions
|
|
@ -128,6 +128,39 @@ public class ClipFrameAssemblerTests
|
|||
Assert.Equal(TerrainClipMode.Planes, asm.TerrainMode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AppendLookInFrames_PacksEveryNestedCellViewWithoutReplacingMainRoutes()
|
||||
{
|
||||
const uint mainCell = 0xA9B40100;
|
||||
const uint lookInCell = 0xA9B40106;
|
||||
var main = new PortalVisibilityFrame();
|
||||
main.CellViews[mainCell] = ViewOf(Square(0f, 0f, 0.8f));
|
||||
main.OrderedVisibleCells.Add(mainCell);
|
||||
main.OutsideView.Add(Square(0f, 0f, 0.7f));
|
||||
|
||||
var nested = new PortalVisibilityFrame();
|
||||
nested.CellViews[lookInCell] = ViewOf(
|
||||
Square(-0.35f, 0f, 0.15f),
|
||||
Square(0.35f, 0f, 0.15f));
|
||||
nested.OrderedVisibleCells.Add(lookInCell);
|
||||
|
||||
using ClipFrame frame = ClipFrame.NoClip();
|
||||
ClipFrameAssembly assembly = ClipFrameAssembler.Assemble(frame, main);
|
||||
int mainSlot = assembly.CellIdToSlot[mainCell];
|
||||
int slotsBeforeLookIn = frame.SlotCount;
|
||||
|
||||
ClipFrameAssembler.AppendLookInFrames(frame, [nested], assembly);
|
||||
|
||||
var key = new LookInClipCell(0, lookInCell);
|
||||
ClipViewSlice[] slices = assembly.LookInCellToViewSlices[key];
|
||||
Assert.Equal(2, slices.Length);
|
||||
Assert.All(slices, slice => Assert.True(slice.Slot >= slotsBeforeLookIn));
|
||||
Assert.NotEqual(slices[0].Slot, slices[1].Slot);
|
||||
Assert.Equal(slices[0].Slot, assembly.LookInCellToSlot[key]);
|
||||
Assert.Equal(mainSlot, assembly.CellIdToSlot[mainCell]);
|
||||
Assert.DoesNotContain(lookInCell, assembly.CellIdToSlot.Keys);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Assemble_OutsideViewWithExitPortal_HasOutsideViewTrue_AabbMatchesBounds()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue