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

WebXR WebIDL #1774

Closed
kevthecoder opened this issue Sep 19, 2019 · 6 comments
Closed

WebXR WebIDL #1774

kevthecoder opened this issue Sep 19, 2019 · 6 comments
Labels

Comments

@kevthecoder
Copy link
Contributor

Summary

It looks like the upcoming W3C Standard WebXR is getting some support in browsers. I've been trying to implement the Web IDL based on the Draft Spec (which is the version being implemented in browsers, I believe): https://www.w3.org/TR/2019/WD-webxr-20190521/#idl-index. However I can't seem to produce the bindings - do you know anyone who's had success with this?

Additional Details

I've been following the contribution guide for Web IDL (https://rustwasm.github.io/docs/wasm-bindgen/contributing/web-sys/supporting-more-web-apis.html) and have come up with this attempt: https://github.com/kevthecoder/wasm-bindgen/pull/1/files

I don't seem to be getting any bindings appearing in bindings.rs, but I'm not seeing any Unsupported WebIDL interface warnings when I run:

cd crates/web-sys
RUST_LOG=wasm_bindgen_webidl cargo build -vv

I appreciate it's early days for the standard so this is probably a low priority, but thought I'd be check if anyone could spot a problem with the attempt above, or if anyone has had success implementing WebXR.

Thanks!

@alexcrichton
Copy link
Contributor

If you use the __WASM_BINDGEN_DUMP_FEATURES feature of the build script I think the feature should be named Xr instead of XR, and that should do the trick?

@kevthecoder
Copy link
Contributor Author

Thanks very much @alexcrichton. Looks like I've got the bindings now.

I'll keep working on a basic example then submit a Pull Request once WebXR stabilises.

@kettle11
Copy link

kettle11 commented Dec 12, 2019

WebXR has shipped in Chrome and for the Oculus Browser. It'd be great to see support added here, I would use it immediately! @kevthecoder it looks like your pull request is mostly ready to go, any update on this?

@alexcrichton

@kettle11
Copy link

To add to this it seems like some modifications need to be made to the IDL to have full WebXR support.

While I didn't dig into what it means (I'm not an expert here) the WebXR IDL features a number of "FrozenArrays" that seem to be not supported. Other IDLs have examples of how to modify the FrozenArray lines, but I'm not sure what the implications are.

This is something that would need to be updated in @kevthecoder 's pull request.

@kevthecoder
Copy link
Contributor Author

@kettle11 Sorry for the delay replying. The work above was based on the "VR-complete" Working Draft. I'll look to update it to the "Candidate Recommendation" draft over the next week so we can merge it in quickly if it gets standardised.

I don't think there was a massive amount of change between the drafts, so hopefully it's nearly there. From the Chrome notes, it looks like they're supporting the latest Oct 2019 draft in Chrome 79 (enabled by default, no flags required): https://docs.google.com/document/d/1R8Bz0_vK9YmY5-ZhsbLtZ9-DDJpTOgNeibFD4SdUnbw/edit#. I'm going by the link to the draft in the second paragraph, I can't seem to find any clear reference to the draft version elsewhere.

@kevthecoder
Copy link
Contributor Author

I've closed the old Pull Request and opened #2000 which matches with the "Candidate Recommendation" version of WebXR (https://www.w3.org/TR/2019/WD-webxr-20191010/).

This version of WebXR is supported by Chrome 80 without flags, but not supported by Firefox yet.

There's a new example project added to the examples/ directory. It mainly works - but I'm having trouble getting XrSession.request_animation_frame() working (I think the session goes out of scope before the animation loop is started).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants