summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-22 22:02:09 +0100
committerGitHub <noreply@github.com>2020-01-22 22:02:09 +0100
commit37897dba80ae88785ca1cc7e0a717a6b15081a5b (patch)
treea5f03261aac00dd417b6e3ce731527da078d6e26 /editor/plugins
parent91b0be18dcc3ba3b1ecd35e8a7e416883776cf7b (diff)
parenteaf8e5ce52331d05ee117c21e114ab0990dd3a9b (diff)
Merge pull request #35406 from lawnjelly/ortho-shadow
Replace CameraMatrix::get_viewport_size with get_viewport_half_extents, shadow culling with ortho camera and other affected issues
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index bf87bfc14d..31e6b65640 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -428,8 +428,7 @@ Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3 &p_vector3) {
} else {
cm.set_perspective(get_fov(), get_size().aspect(), get_znear() + p_vector3.z, get_zfar());
}
- float screen_w, screen_h;
- cm.get_viewport_size(screen_w, screen_h);
+ Vector2 screen_he = cm.get_viewport_half_extents();
Transform camera_transform;
camera_transform.translate(cursor.pos);
@@ -437,7 +436,7 @@ Vector3 SpatialEditorViewport::_get_screen_to_space(const Vector3 &p_vector3) {
camera_transform.basis.rotate(Vector3(0, 1, 0), -cursor.y_rot);
camera_transform.translate(0, 0, cursor.distance);
- return camera_transform.xform(Vector3(((p_vector3.x / get_size().width) * 2.0 - 1.0) * screen_w, ((1.0 - (p_vector3.y / get_size().height)) * 2.0 - 1.0) * screen_h, -(get_znear() + p_vector3.z)));
+ return camera_transform.xform(Vector3(((p_vector3.x / get_size().width) * 2.0 - 1.0) * screen_he.x, ((1.0 - (p_vector3.y / get_size().height)) * 2.0 - 1.0) * screen_he.y, -(get_znear() + p_vector3.z)));
}
void SpatialEditorViewport::_select_region() {