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

WebVRUtils: Fix NaNs and Infinity in setProjectionFromUnion().

上级 acaba2e4
......@@ -20,8 +20,8 @@ function setProjectionFromUnion( camera, cameraL, cameraR ) {
var ipd = cameraLPos.distanceTo( cameraRPos );
var projL = cameraL.projectionMatrix;
var projR = cameraR.projectionMatrix;
var projL = cameraL.projectionMatrix.elements;
var projR = cameraR.projectionMatrix.elements;
// VR systems will have identical far and near planes, and
// most likely identical top and bottom frustum extents.
......@@ -40,7 +40,7 @@ function setProjectionFromUnion( camera, cameraL, cameraR ) {
// Calculate the new camera's position offset from the
// left camera.
var zOffset = ipd / ( leftFovL + rightFovR );
var zOffset = ipd / ( Math.abs( leftFovL ) + Math.abs( rightFovR ) );
var xOffset = zOffset * leftFovL;
// TODO: Better way to apply this offset?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册