fix #451: stabilize portal seam rendering
This commit is contained in:
parent
f6fe0f2a4f
commit
1d2f2f738f
29 changed files with 1650 additions and 239 deletions
|
|
@ -30,6 +30,7 @@ internal readonly record struct CurrentRenderProjectionFingerprint(
|
|||
internal enum CurrentRenderPViewRoute : byte
|
||||
{
|
||||
LandscapeOutdoorStatic,
|
||||
LandscapeBuildingShell,
|
||||
LandscapeOutsideDynamic,
|
||||
LookInObject,
|
||||
CellStatic,
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ internal enum RenderFrameBlendClass : byte
|
|||
internal enum RenderFrameCandidateRoute : byte
|
||||
{
|
||||
LandscapeOutdoorStatic,
|
||||
LandscapeBuildingShell,
|
||||
LandscapeOutsideDynamic,
|
||||
LookInObject,
|
||||
CellStatic,
|
||||
|
|
|
|||
|
|
@ -992,6 +992,8 @@ internal sealed class RenderScenePViewFrameProductController :
|
|||
{
|
||||
CurrentRenderPViewRoute.LandscapeOutdoorStatic =>
|
||||
RenderFrameCandidateRoute.LandscapeOutdoorStatic,
|
||||
CurrentRenderPViewRoute.LandscapeBuildingShell =>
|
||||
RenderFrameCandidateRoute.LandscapeBuildingShell,
|
||||
CurrentRenderPViewRoute.LandscapeOutsideDynamic =>
|
||||
RenderFrameCandidateRoute.LandscapeOutsideDynamic,
|
||||
CurrentRenderPViewRoute.LookInObject =>
|
||||
|
|
@ -1157,7 +1159,21 @@ internal sealed class RenderScenePViewFrameBuilder
|
|||
LoadSceneIndices(input.Scene);
|
||||
|
||||
BuildOutdoorRoutes(writer, in input);
|
||||
BuildLookInRoutes(writer, in input);
|
||||
int lookInRouteIndex = 0;
|
||||
for (int frameIndex = 0;
|
||||
frameIndex < input.LookInFrames.Count;
|
||||
frameIndex++)
|
||||
{
|
||||
BuildLookInRoutes(
|
||||
writer,
|
||||
in input,
|
||||
frameIndex,
|
||||
ref lookInRouteIndex);
|
||||
BuildLookInBuildingShellRoutes(
|
||||
writer,
|
||||
in input,
|
||||
frameIndex);
|
||||
}
|
||||
BuildOutsideDynamicRoutes(writer, in input);
|
||||
BuildCellStaticRoute(writer, in input);
|
||||
BuildDynamicLastRoute(writer, in input);
|
||||
|
|
@ -1279,6 +1295,14 @@ internal sealed class RenderScenePViewFrameBuilder
|
|||
for (int i = 0; i < _outdoorCount; i++)
|
||||
{
|
||||
RenderProjectionRecord record = _outdoor[i];
|
||||
if (record.EntityPayload.IsBuildingShell
|
||||
&& RetailPViewRenderer.FindLookInFrameIndex(
|
||||
record.Source.BuildingShellAnchorCellId,
|
||||
input.LookInFrames,
|
||||
input.Cells) >= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Sphere(in record, out Vector3 center, out float radius);
|
||||
if (!input.Viewcone.SphereVisibleInOutsideSlice(
|
||||
sliceIndex,
|
||||
|
|
@ -1304,22 +1328,84 @@ internal sealed class RenderScenePViewFrameBuilder
|
|||
}
|
||||
}
|
||||
|
||||
private void BuildLookInBuildingShellRoutes(
|
||||
RenderFrameWriter writer,
|
||||
in RenderScenePViewBuildInput input,
|
||||
int frameIndex)
|
||||
{
|
||||
int sliceCount = input.ClipAssembly.OutsideViewSlices.Length;
|
||||
for (int sliceIndex = 0; sliceIndex < sliceCount; sliceIndex++)
|
||||
{
|
||||
int count = 0;
|
||||
EnsureCapacity(ref _survivors, _outdoorCount);
|
||||
for (int i = 0; i < _outdoorCount; i++)
|
||||
{
|
||||
RenderProjectionRecord record = _outdoor[i];
|
||||
if (!record.EntityPayload.IsBuildingShell
|
||||
|| RetailPViewRenderer.FindLookInFrameIndex(
|
||||
record.Source.BuildingShellAnchorCellId,
|
||||
input.LookInFrames,
|
||||
input.Cells) != frameIndex)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Sphere(in record, out Vector3 center, out float radius);
|
||||
if (!input.Viewcone.SphereVisibleInOutsideSlice(
|
||||
sliceIndex,
|
||||
in center,
|
||||
radius))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_survivors[count++] = record;
|
||||
writer.AddOutdoor(in record);
|
||||
AddProjection(
|
||||
writer,
|
||||
in record,
|
||||
input.AnimatedEntityIds);
|
||||
}
|
||||
|
||||
int routeIndex =
|
||||
RetailPViewRenderer.LookInBuildingShellRouteIndex(
|
||||
frameIndex,
|
||||
sliceCount,
|
||||
sliceIndex);
|
||||
writer.AddRouteRange(
|
||||
RenderFrameCandidateRoute.LandscapeBuildingShell,
|
||||
routeIndex,
|
||||
0,
|
||||
_survivors.AsSpan(0, count));
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildLookInRoutes(
|
||||
RenderFrameWriter writer,
|
||||
in RenderScenePViewBuildInput input)
|
||||
in RenderScenePViewBuildInput input,
|
||||
int frameIndex,
|
||||
ref int routeIndex)
|
||||
{
|
||||
for (int frameIndex = 0;
|
||||
frameIndex < input.LookInFrames.Count;
|
||||
frameIndex++)
|
||||
PortalVisibilityFrame frame = input.LookInFrames[frameIndex];
|
||||
for (int i = frame.OrderedVisibleCells.Count - 1; i >= 0; i--)
|
||||
{
|
||||
PortalVisibilityFrame frame = input.LookInFrames[frameIndex];
|
||||
for (int i = frame.OrderedVisibleCells.Count - 1; i >= 0; i--)
|
||||
uint cellId = frame.OrderedVisibleCells[i];
|
||||
var clipKey = new LookInClipCell(frameIndex, cellId);
|
||||
if (!input.ClipAssembly.LookInCellToViewSlices.TryGetValue(
|
||||
clipKey,
|
||||
out ClipViewSlice[]? slices)
|
||||
|| slices.Length == 0)
|
||||
{
|
||||
uint cellId = frame.OrderedVisibleCells[i];
|
||||
int count = LoadCell(
|
||||
input.Scene,
|
||||
cellId,
|
||||
includeDynamics: true);
|
||||
continue;
|
||||
}
|
||||
|
||||
int count = LoadCell(
|
||||
input.Scene,
|
||||
cellId,
|
||||
includeDynamics: true);
|
||||
for (int sliceIndex = 0; sliceIndex < slices.Length; sliceIndex++)
|
||||
{
|
||||
int currentRouteIndex = routeIndex++;
|
||||
if (count == 0)
|
||||
continue;
|
||||
|
||||
|
|
@ -1330,7 +1416,7 @@ internal sealed class RenderScenePViewFrameBuilder
|
|||
input.AnimatedEntityIds);
|
||||
writer.AddRouteRange(
|
||||
RenderFrameCandidateRoute.LookInObject,
|
||||
i,
|
||||
currentRouteIndex,
|
||||
cellId,
|
||||
_cell.AsSpan(0, count));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue