Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose VR displays from THREE.VREffect/THREE.VRControls #9133

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion examples/js/controls/VRControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ THREE.VRControls = function ( object, onError ) {

var standingMatrix = new THREE.Matrix4();

function gotVRDevices( devices ) {
function gotVRDevices ( devices ) {

scope.displays = devices;

for ( var i = 0; i < devices.length; i ++ ) {

Expand Down
8 changes: 5 additions & 3 deletions examples/js/effects/VREffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@

THREE.VREffect = function ( renderer, onError ) {

var scope = this;

var vrHMD;
var isDeprecatedAPI = false;
var eyeTranslationL = new THREE.Vector3();
var eyeTranslationR = new THREE.Vector3();
var renderRectL, renderRectR;
var eyeFOVL, eyeFOVR;

function gotVRDevices( devices ) {
function gotVRDevices ( devices ) {

scope.displays = devices;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sneaky... I would, instead, define a local variable displays and add a .getDisplays() public method.

Copy link
Owner

@mrdoob mrdoob Jun 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I guess .getDevices() would match the WebVR API better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had that originally; can change, for sure. well, actually the v1.0 API calls for navigator.getVRDisplays() instead of navigator.getVRDevices(), so I'd suggest the former.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!


for ( var i = 0; i < devices.length; i ++ ) {

Expand Down Expand Up @@ -62,8 +66,6 @@ THREE.VREffect = function ( renderer, onError ) {
this.isPresenting = false;
this.scale = 1;

var scope = this;

var rendererSize = renderer.getSize();
var rendererPixelRatio = renderer.getPixelRatio();

Expand Down