You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Portals - Fix sending portal margins to VisualServer
Portal margins were not being correctly sent to the PortalRenderer from the SceneTree, so all margins were being used as default (1.0). This PR fixes this.
This commit is contained in:
@@ -240,12 +240,13 @@ void PortalRenderer::portal_destroy(PortalHandle p_portal) {
|
||||
_portal_pool.free(p_portal);
|
||||
}
|
||||
|
||||
void PortalRenderer::portal_set_geometry(PortalHandle p_portal, const Vector<Vector3> &p_points) {
|
||||
void PortalRenderer::portal_set_geometry(PortalHandle p_portal, const Vector<Vector3> &p_points, real_t p_margin) {
|
||||
ERR_FAIL_COND(!p_portal);
|
||||
p_portal--; // plus 1 based
|
||||
VSPortal &portal = _portal_pool[p_portal];
|
||||
|
||||
portal._pts_world = p_points;
|
||||
portal._margin = p_margin;
|
||||
|
||||
if (portal._pts_world.size() < 3) {
|
||||
WARN_PRINT("Portal must have at least 3 vertices");
|
||||
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
|
||||
PortalHandle portal_create();
|
||||
void portal_destroy(PortalHandle p_portal);
|
||||
void portal_set_geometry(PortalHandle p_portal, const Vector<Vector3> &p_points);
|
||||
void portal_set_geometry(PortalHandle p_portal, const Vector<Vector3> &p_points, real_t p_margin);
|
||||
void portal_link(PortalHandle p_portal, RoomHandle p_room_from, RoomHandle p_room_to, bool p_two_way);
|
||||
void portal_set_active(PortalHandle p_portal, bool p_active);
|
||||
|
||||
|
||||
@@ -567,7 +567,7 @@ public:
|
||||
|
||||
BIND0R(RID, portal_create)
|
||||
BIND2(portal_set_scenario, RID, RID)
|
||||
BIND3(portal_set_geometry, RID, const Vector<Vector3> &, float)
|
||||
BIND3(portal_set_geometry, RID, const Vector<Vector3> &, real_t)
|
||||
BIND4(portal_link, RID, RID, RID, bool)
|
||||
BIND2(portal_set_active, RID, bool)
|
||||
|
||||
|
||||
@@ -1006,11 +1006,11 @@ void VisualServerScene::portal_set_scenario(RID p_portal, RID p_scenario) {
|
||||
}
|
||||
}
|
||||
|
||||
void VisualServerScene::portal_set_geometry(RID p_portal, const Vector<Vector3> &p_points, float p_margin) {
|
||||
void VisualServerScene::portal_set_geometry(RID p_portal, const Vector<Vector3> &p_points, real_t p_margin) {
|
||||
Portal *portal = portal_owner.getornull(p_portal);
|
||||
ERR_FAIL_COND(!portal);
|
||||
ERR_FAIL_COND(!portal->scenario);
|
||||
portal->scenario->_portal_renderer.portal_set_geometry(portal->scenario_portal_id, p_points);
|
||||
portal->scenario->_portal_renderer.portal_set_geometry(portal->scenario_portal_id, p_points, p_margin);
|
||||
}
|
||||
|
||||
void VisualServerScene::portal_link(RID p_portal, RID p_room_from, RID p_room_to, bool p_two_way) {
|
||||
|
||||
@@ -593,7 +593,7 @@ public:
|
||||
|
||||
virtual RID portal_create();
|
||||
virtual void portal_set_scenario(RID p_portal, RID p_scenario);
|
||||
virtual void portal_set_geometry(RID p_portal, const Vector<Vector3> &p_points, float p_margin);
|
||||
virtual void portal_set_geometry(RID p_portal, const Vector<Vector3> &p_points, real_t p_margin);
|
||||
virtual void portal_link(RID p_portal, RID p_room_from, RID p_room_to, bool p_two_way);
|
||||
virtual void portal_set_active(RID p_portal, bool p_active);
|
||||
|
||||
|
||||
@@ -490,7 +490,7 @@ public:
|
||||
|
||||
FUNCRID(portal)
|
||||
FUNC2(portal_set_scenario, RID, RID)
|
||||
FUNC3(portal_set_geometry, RID, const Vector<Vector3> &, float)
|
||||
FUNC3(portal_set_geometry, RID, const Vector<Vector3> &, real_t)
|
||||
FUNC4(portal_link, RID, RID, RID, bool)
|
||||
FUNC2(portal_set_active, RID, bool)
|
||||
|
||||
|
||||
@@ -874,7 +874,7 @@ public:
|
||||
|
||||
virtual RID portal_create() = 0;
|
||||
virtual void portal_set_scenario(RID p_portal, RID p_scenario) = 0;
|
||||
virtual void portal_set_geometry(RID p_portal, const Vector<Vector3> &p_points, float p_margin) = 0;
|
||||
virtual void portal_set_geometry(RID p_portal, const Vector<Vector3> &p_points, real_t p_margin) = 0;
|
||||
virtual void portal_link(RID p_portal, RID p_room_from, RID p_room_to, bool p_two_way) = 0;
|
||||
virtual void portal_set_active(RID p_portal, bool p_active) = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user