1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

Portals - improve PVS tracing

The existing tracing routine for building the PVS was rather simple compared to the main portal tracing, and could not correctly cope with paths that went through multiple portals from room A to B, and as a result would sometimes miss room entries in the PVS resulting in too many culled rooms in these circumstances.

This PR adds an improved function that can cope with entering a room multiple times during a trace. As a result it has to take care of portal directions (to prevent going back on itself) in a similar, but not identical way to the main portal tracing routine, and internal rooms, to prevent recursive loops.
This commit is contained in:
lawnjelly
2021-08-07 17:57:30 +01:00
parent 41cf7f2760
commit 69cc759b65
4 changed files with 203 additions and 3 deletions

View File

@@ -278,6 +278,9 @@ void PortalRenderer::portal_set_geometry(PortalHandle p_portal, const Vector<Vec
}
average_pt /= portal._pts_world.size();
// record the center for use in PVS
portal._pt_center = average_pt;
// use the average point and normal to derive the plane
portal._plane = Plane(average_pt, average_normal);