From 7ae2810848338033d9e71834a2cea294025cb214 Mon Sep 17 00:00:00 2001 From: Peter Kim Date: Tue, 26 Oct 2021 13:33:21 +0900 Subject: XR: View adjustments for variable viewer scale This adjusts some calculations and visibility flags for XR viewports in order to account for a possible scale factor in the XR view matrix. This scale factor can be introduced via the XR session settings base scale, which allows a viewer to begin their session at a specific reference scale, or the XR session state navigation scale, which allows a viewer to adjust their scale relative to the reference scale during the session. Reviewed by Severin as part of D11501, but requested to be committed separately. --- source/blender/editors/space_view3d/view3d_view.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_view3d/view3d_view.c') diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index f5da7c14a88..46a664f10fa 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1730,7 +1730,12 @@ void ED_view3d_xr_shading_update(wmWindowManager *wm, const View3D *v3d, const S if (v3d->runtime.flag & V3D_RUNTIME_XR_SESSION_ROOT) { View3DShading *xr_shading = &wm->xr.session_settings.shading; /* Flags that shouldn't be overridden by the 3D View shading. */ - const int flag_copy = V3D_SHADING_WORLD_ORIENTATION; + int flag_copy = 0; + if (v3d->shading.type != + OB_SOLID) { /* Don't set V3D_SHADING_WORLD_ORIENTATION for solid shading since it results + in distorted lighting when the view matrix has a scale factor. */ + flag_copy |= V3D_SHADING_WORLD_ORIENTATION; + } BLI_assert(WM_xr_session_exists(&wm->xr)); -- cgit v1.2.3