提交 a2663dfd 编写于 作者: M Mr.doob

Clean up.

上级 148fe362
......@@ -19,8 +19,6 @@ function WebVRManager( renderer ) {
var standingMatrix = new Matrix4();
var standingMatrixInverse = new Matrix4();
scope.userHeight = 1.6;
if ( typeof window !== 'undefined' && 'VRFrameData' in window ) {
frameData = new window.VRFrameData();
......@@ -75,6 +73,7 @@ function WebVRManager( renderer ) {
//
this.enabled = false;
this.userHeight = 1.6;
this.getDevice = function () {
......@@ -126,13 +125,16 @@ function WebVRManager( renderer ) {
var stageParameters = device.stageParameters;
if (stageParameters) {
standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
if ( stageParameters ) {
standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
} else {
standingMatrix.makeTranslation(0, scope.userHeight, 0);
standingMatrix.makeTranslation( 0, scope.userHeight, 0 );
}
standingMatrixInverse.getInverse( standingMatrix );
poseObject.position.applyMatrix4( standingMatrix );
poseObject.updateMatrixWorld();
......@@ -152,6 +154,10 @@ function WebVRManager( renderer ) {
cameraL.matrixWorldInverse.fromArray( frameData.leftViewMatrix );
cameraR.matrixWorldInverse.fromArray( frameData.rightViewMatrix );
// TODO (mrdoob) Double check this code
standingMatrixInverse.getInverse( standingMatrix );
cameraL.matrixWorldInverse.multiply( standingMatrixInverse );
cameraR.matrixWorldInverse.multiply( standingMatrixInverse );
......@@ -174,7 +180,7 @@ function WebVRManager( renderer ) {
cameraL.projectionMatrix.fromArray( frameData.leftProjectionMatrix );
cameraR.projectionMatrix.fromArray( frameData.rightProjectionMatrix );
// HACK @mrdoob
// HACK (mrdoob)
// https://github.com/w3c/webvr/issues/203
cameraVR.projectionMatrix.copy( cameraL.projectionMatrix );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册