summaryrefslogtreecommitdiff
path: root/drivers/gles2/rasterizer_scene_gles2.cpp
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 /drivers/gles2/rasterizer_scene_gles2.cpp
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 'drivers/gles2/rasterizer_scene_gles2.cpp')
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index a315684ce9..c0ba93db6a 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -2658,14 +2658,14 @@ void RasterizerSceneGLES2::_draw_sky(RasterizerStorageGLES2::Sky *p_sky, const C
};
if (!asymmetrical) {
- float vw, vh, zn;
- camera.get_viewport_size(vw, vh);
+ Vector2 vp_he = camera.get_viewport_half_extents();
+ float zn;
zn = p_projection.get_z_near();
for (int i = 0; i < 4; i++) {
Vector3 uv = vertices[i * 2 + 1];
- uv.x = (uv.x * 2.0 - 1.0) * vw;
- uv.y = -(uv.y * 2.0 - 1.0) * vh;
+ uv.x = (uv.x * 2.0 - 1.0) * vp_he.x;
+ uv.y = -(uv.y * 2.0 - 1.0) * vp_he.y;
uv.z = -zn;
vertices[i * 2 + 1] = p_transform.basis.xform(uv).normalized();
vertices[i * 2 + 1].z = -vertices[i * 2 + 1].z;