summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_rd
diff options
context:
space:
mode:
authorAnilforextra <anilforextra@gmail.com>2021-09-21 00:33:52 +0545
committerAnilforextra <anilforextra@gmail.com>2021-09-21 21:14:17 +0545
commit90908cd67d3f44ba70cc4b7b32f024ce508cc0ee (patch)
tree4c3f64aa550e6dc763b9776dded65560b67db2cc /servers/rendering/renderer_rd
parent87de2e7c4a38b1258d9a554c7f50cdbd8ac825fa (diff)
Add Get Center Method for Rect2/Rect2i and AABB.
Diffstat (limited to 'servers/rendering/renderer_rd')
-rw-r--r--servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp2
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
index 3c66fadbe9..f507a83072 100644
--- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
@@ -1621,7 +1621,7 @@ void RendererCanvasRenderRD::light_update_directional_shadow(RID p_rid, int p_sh
Vector2 light_dir = p_light_xform.elements[1].normalized();
- Vector2 center = p_clip_rect.position + p_clip_rect.size * 0.5;
+ Vector2 center = p_clip_rect.get_center();
float to_edge_distance = ABS(light_dir.dot(p_clip_rect.get_support(light_dir)) - light_dir.dot(center));
diff --git a/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp
index 36943c5e5c..fb308da38d 100644
--- a/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp
@@ -2575,7 +2575,7 @@ void RendererSceneGIRD::VoxelGIInstance::update(bool p_update_light_instances, c
Vector3 render_dir = render_z[j];
Vector3 up_dir = render_up[j];
- Vector3 center = aabb.position + aabb.size * 0.5;
+ Vector3 center = aabb.get_center();
Transform3D xform;
xform.set_look_at(center - aabb.size * 0.5 * render_dir, center, up_dir);