diff options
author | Bastiaan Olij <mux213@gmail.com> | 2022-06-16 22:02:18 +1000 |
---|---|---|
committer | Bastiaan Olij <mux213@gmail.com> | 2022-06-17 19:39:34 +1000 |
commit | b4821fe2e0ed589ad078536584aea0d607a21fab (patch) | |
tree | 0b5e16f84e9952b5e78be36ca06481a0cac5da0d /servers/rendering/renderer_rd/forward_mobile | |
parent | 7cc99d213f4eb3b73f9169140dff2f7a6f02065f (diff) |
Introduce eye_offset for correcting stereoscopic reflections
Use view instead of vertex for reflections.
Diffstat (limited to 'servers/rendering/renderer_rd/forward_mobile')
-rw-r--r-- | servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp | 5 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp index b2e0af06cd..eae5685dd1 100644 --- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp @@ -1542,6 +1542,11 @@ void RenderForwardMobile::_setup_environment(const RenderDataRD *p_render_data, projection = correction * p_render_data->view_projection[v]; RendererStorageRD::store_camera(projection, scene_state.ubo.projection_matrix_view[v]); RendererStorageRD::store_camera(projection.inverse(), scene_state.ubo.inv_projection_matrix_view[v]); + + scene_state.ubo.eye_offset[v][0] = p_render_data->view_eye_offset[v].x; + scene_state.ubo.eye_offset[v][1] = p_render_data->view_eye_offset[v].y; + scene_state.ubo.eye_offset[v][2] = p_render_data->view_eye_offset[v].z; + scene_state.ubo.eye_offset[v][3] = 0.0; } scene_state.ubo.z_far = p_render_data->z_far; diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h index fc6f32ecb0..1b2df0ab9f 100644 --- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h +++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h @@ -260,6 +260,7 @@ protected: float projection_matrix_view[RendererSceneRender::MAX_RENDER_VIEWS][16]; float inv_projection_matrix_view[RendererSceneRender::MAX_RENDER_VIEWS][16]; + float eye_offset[RendererSceneRender::MAX_RENDER_VIEWS][4]; float viewport_size[2]; float screen_pixel_size[2]; |