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

fix: native webvr #45

Merged
merged 3 commits into from
Jan 22, 2018
Merged

fix: native webvr #45

merged 3 commits into from
Jan 22, 2018

Conversation

brandonocasey
Copy link
Contributor

@brandonocasey brandonocasey commented Jan 16, 2018

Fixes #24
Fixes #25
Fixes #18
Fixes #5
Fixes #42

@brandonocasey brandonocasey force-pushed the fix/native-webvr branch 2 times, most recently from 504272b to 2532a19 Compare January 17, 2018 18:33
if (!this.vrDisplay) {
return;
}
this.vrDisplay.requestPresent([{source: this.renderedCanvas}]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is basically all the manager does with the two functions we used to call

@@ -296,31 +304,22 @@ class VR extends Plugin {
}

this.controls3d.update();
this.manager.render(this.scene, this.camera);
this.effect.render(this.scene, this.camera);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

manager did this internally as well

const gamepads = window.navigator.getGamepads();
if (window.navigator.getGamepads) {
// Grab all gamepads
const gamepads = window.navigator.getGamepads();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was just a refactor, as it didn't really make sense the way it used to work

Copy link
Member

@misteroneill misteroneill left a comment

Choose a reason for hiding this comment

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

This looks good to me, so far as I can tell.

this.controls3d = new VRControls(this.camera);
} else {
this.log('no vr displays found going to use OrbitControls');
this.controls3d = new OrbitControls(this.camera, this.renderedCanvas);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When no VRDisplay is found webvr-polyfill no longer inserts one for native vr implementations. So we have to do our own controls.

return;
}
this.vrDisplay.exitPresent();
}

requestAnimationFrame(fn) {
if (this.vrDisplay) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we have a vr display we want to request animation from on that instead of the plugin.

@pagarwal123
Copy link

QA LGTM

@brandonocasey brandonocasey merged commit 4b3a89f into master Jan 22, 2018
@brandonocasey brandonocasey deleted the fix/native-webvr branch January 22, 2018 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants