From eac6a2a9e7d28c0c8e4c73a2f1500e7eedac4e9c Mon Sep 17 00:00:00 2001 From: nickarora Date: Fri, 28 Feb 2020 16:33:13 -0800 Subject: [PATCH] force 90 degree fov in VR --- SGPlayer/Classes/Core/SGVR/SGVRProjection.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/SGPlayer/Classes/Core/SGVR/SGVRProjection.m b/SGPlayer/Classes/Core/SGVR/SGVRProjection.m index 05d1cbfb..bda4d8f7 100644 --- a/SGPlayer/Classes/Core/SGVR/SGVRProjection.m +++ b/SGPlayer/Classes/Core/SGVR/SGVRProjection.m @@ -94,11 +94,18 @@ - (BOOL)matrixWithAspect:(Float64)aspect matrix1:(GLKMatrix4 *)matrix1 modelMatrix = GLKMatrix4Multiply(modelMatrix, self.sensor.matrix); } #endif + // model modelMatrix = GLKMatrix4RotateY(modelMatrix, GLKMathDegreesToRadians(self.viewport.x) * (self.viewport.flipX ? -1 : 1)); - GLKMatrix4 viewMatrix = GLKMatrix4MakeLookAt(0, 0, 0.0, 0, 0, -1000, 0, 1, 0); - GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(self.viewport.degress), aspect, 0.1f, 400.0f); + + // view + GLKMatrix4 viewMatrix = GLKMatrix4MakeLookAt(0, 0, 0, 0, 0, -1000, 0, 1, 0); + + // projection + GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(90), aspect, 0.1f, 400.0f); + GLKMatrix4 modelViewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, viewMatrix); modelViewProjectionMatrix = GLKMatrix4Multiply(modelViewProjectionMatrix, modelMatrix); + *matrix1 = modelViewProjectionMatrix; self.lastMatrix1Available = YES; self.lastMatrix11 = modelViewProjectionMatrix;