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

Portals - fix recursive loop looking out from internal rooms

In some situations looking out from an internal room it was possible to look back into the portal into the internal room.

This PR fixes this by keeping a single item 'stack' record of the last external room, and preventing recursing into this room. This also makes tracing significantly more efficient out of internal rooms, as there is no need to trace the external room multiple times.
This commit is contained in:
lawnjelly
2021-08-05 12:20:08 +01:00
parent 63047093c9
commit 2c88517a7b
5 changed files with 39 additions and 6 deletions

View File

@@ -684,7 +684,7 @@ void PortalRenderer::rooms_finalize(bool p_generate_pvs, bool p_cull_using_pvs,
// calculate PVS
if (p_generate_pvs) {
PVSBuilder pvs;
pvs.calculate_pvs(*this, p_pvs_filename);
pvs.calculate_pvs(*this, p_pvs_filename, _tracer.get_depth_limit());
_cull_using_pvs = p_cull_using_pvs; // hard code to on for test
} else {
_cull_using_pvs = false;