[Bf-blender-cvs] [8437c6e28e3] HMD_viewport: Fix lens separation applied wrongly onto projection matrix

Julian Eisel noreply at git.blender.org
Wed Apr 12 23:57:53 CEST 2017


Commit: 8437c6e28e3538396dad1af018df51a51e55de7a
Author: Julian Eisel
Date:   Wed Apr 12 23:56:51 2017 +0200
Branches: HMD_viewport
https://developer.blender.org/rB8437c6e28e3538396dad1af018df51a51e55de7a

Fix lens separation applied wrongly onto projection matrix

===================================================================

M	source/blender/editors/space_view3d/view3d_draw.c

===================================================================

diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 38e9248704c..8b4c7c57d71 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -3815,10 +3815,13 @@ static void view3d_hmd_calc_projection_matrix_from_device(
 		const float lens_sep = WM_device_HMD_lens_horizontal_separation_get();
 		const float hsize = WM_device_HMD_screen_horizontal_size_get();
 		const float proj_offset = 1 - ((2 * lens_sep) / hsize);
+		float ofs_mat[4][4];
 
 		/* apply lens separation (IPD is applied onto modelview matrix) */
 		BLI_assert(IN_RANGE_INCL(proj_offset, -1.0f, 1.0f));
-		translate_m4(r_projectionmat, is_left ? proj_offset : -proj_offset, 0, 0);
+		unit_m4(ofs_mat);
+		translate_m4(ofs_mat, is_left ? proj_offset : -proj_offset, 0, 0);
+		mul_m4_m4m4(r_projectionmat, ofs_mat, r_projectionmat);
 	}
 
 	v3d->near = v3d_znear;




More information about the Bf-blender-cvs mailing list