Skip to content

Commit

Permalink
force 90 degree fov in VR
Browse files Browse the repository at this point in the history
  • Loading branch information
nickarora committed Feb 29, 2020
1 parent 4d68ea3 commit eac6a2a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions SGPlayer/Classes/Core/SGVR/SGVRProjection.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit eac6a2a

Please sign in to comment.