immersive-web / webxr-polyfill

Use the WebXR Device API today, providing fallbacks to native WebVR 1.1 and Cardboard
Apache License 2.0
386 stars 86 forks source link

Update XR interface and remove XRDevice #59

Closed toji closed 5 years ago

toji commented 5 years ago

Fixes #55. Also changes the syntax of the WebGL context compatibility methods because they required an XRDevice to function properly.

This required more restructuring than I expected (but it should have been obvious in retrospect.) It does introduce one polyfill-specific error, in which developers are required to have confirmed their desired immersive mode is supported before calling requestSession. This is due to the WebVR implementation having a two-step async process in the equivalent area instead of a one-step, which may cause the user gesture token to get lost if the developer hasn't taken some other asynchronous action prior to calling requestSession. Not happy with that, but at least it reinforces best practices rather than being something totally arbitrary.

Note that this change leaves inline content non-functional because the changes listed in #53 are required to get that portion of the API back up to spec, and in the meantime there's no way to set the output context.

jsantell commented 5 years ago

Thanks @toji! Just taking a look at this now, juggling the user gesture is certainly non-trivial :sob:

toji commented 5 years ago

Sorry, I've been working on updating the tests for this but my laptop just flipped out and needed to be wiped, so I lost my progress on that part. :( I'll see what I can do to bring it back up again, but I'll warn you now that the tests changes are pretty extensive.

toji commented 5 years ago

Made a bunch of updates in response to your feedback and our call. Sorry it's been taking so long to push through. I haven't had a chance to test this everywhere I'd like just yet, but it should be much closer to a mergeable state now.

toji commented 5 years ago

Okay! Addressed your latest feedback, re-targeted this PR at the webxr-2019 branch, squashed the commits to keep the branch history a bit cleaner, and merged! Thank you for the reviews and sorry for the slow dev cycle on this one.

jsantell commented 5 years ago

:tada: thanks @toji!