immersive-web / cardboard-vr-display

A JavaScript implementation of a WebVR 1.1 VRDisplay
https://immersive-web.github.io/cardboard-vr-display
Apache License 2.0
91 stars 43 forks source link

Add support for additional VR viewers parameters to be passed in #22

Closed wan-hellopupil closed 6 years ago

wan-hellopupil commented 6 years ago

Allows for other viewer parameters to be used. The goal is to then be able to do this:

var polyfill = new WebVRPolyfill({
    ADDITIONAL_VIEWERS: [{
        id: 'Some_different_cardboard_viewer',
        label: 'My Best Viewer',
        fov: 50,
        interLensDistance: 0.053,
        baselineLensDistance: 0.035,
        screenLensDistance: 0.053,
        distortionCoefficients: [0.15, 0.11],
    }],
    DEFAULT_VIEWER: 'Some_different_cardboard_viewer',
});

and have the new viewer present in the list when clicking on the gear icon.

wan-hellopupil commented 6 years ago

(this would also need the following change in the webvr-polyfill to work):

       BUFFER_SCALE:                 this.config.BUFFER_SCALE,
       DIRTY_SUBMIT_FRAME_BINDINGS:  this.config.DIRTY_SUBMIT_FRAME_BINDINGS,
+      ADDITIONAL_VIEWERS:           this.config.ADDITIONAL_VIEWERS,
+      DEFAULT_VIEWER:               this.config.DEFAULT_VIEWER,
     });

     this.polyfillDisplays.push(vrDisplay);
wan-hellopupil commented 6 years ago
jsantell commented 6 years ago

Thanks for sending a PR, @wan-hellopupil! Sorry it's taken me a bit to respond, I'll look over this and do some testing over the next week and get this into WebVR polyfill, this is a great feature that I know a handful of folks interested in. Thank you!