Skip to content

Commit 7979ea6

Browse files
brianchirlsmrdoob
authored andcommitted
VREffect: handle empty arrays for display bounds (mrdoob#9732)
The spec has been updated so that `requestPresent` can accept empty arrays for `leftBounds` and `rightBounds`. Though Chromium returns `null` for these properties by default, Firefox returns empty arrays, and there is a proposal to make those non-nullable. This patch should fix rendering for Firefox, which is currently broken. For reference: immersive-web/webxr#95 immersive-web/webxr#89
1 parent 2e7c04c commit 7979ea6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/js/effects/VREffect.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ THREE.VREffect = function ( renderer, onError ) {
111111
var layers = vrDisplay.getLayers();
112112
if ( layers.length ) {
113113

114-
leftBounds = layers[0].leftBounds || [ 0.0, 0.0, 0.5, 1.0 ];
115-
rightBounds = layers[0].rightBounds || [ 0.5, 0.0, 0.5, 1.0 ];
114+
var layer = layers[0];
115+
116+
leftBounds = layer.leftBounds !== null && layer.leftBounds.length === 4 ? leftBounds : [ 0.0, 0.0, 0.5, 1.0 ];
117+
rightBounds = layer.rightBounds !== null && layer.rightBounds.length === 4 ? rightBounds : [ 0.5, 0.0, 0.5, 1.0 ];
116118

117119
}
118120

0 commit comments

Comments
 (0)