-
Notifications
You must be signed in to change notification settings - Fork 147
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
Conversation
504272b
to
2532a19
Compare
2532a19
to
977d8cb
Compare
if (!this.vrDisplay) { | ||
return; | ||
} | ||
this.vrDisplay.requestPresent([{source: this.renderedCanvas}]); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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
There was a problem hiding this 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); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
QA LGTM |
Fixes #24
Fixes #25
Fixes #18
Fixes #5
Fixes #42