1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-19 14:31:59 +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

@@ -46,7 +46,7 @@ class PVSBuilder {
};
public:
void calculate_pvs(PortalRenderer &p_portal_renderer, String p_filename);
void calculate_pvs(PortalRenderer &p_portal_renderer, String p_filename, int p_depth_limit);
private:
#ifdef GODOT_PVS_SUPPORT_SAVE_FILE
@@ -64,6 +64,7 @@ private:
PortalRenderer *_portal_renderer = nullptr;
PVS *_pvs = nullptr;
int _depth_limit = 16;
static bool _log_active;
};