Giter Club home page Giter Club logo

webvr-polyfill's Introduction

WebVR Polyfill

This project provides a JavaScript implementation of the WebVR spec.

The goal of this project is two fold:

  1. Use WebVR today, without requiring a special browser build.
  2. View (mono) content without a virtual reality headset.

Implementation

The polyfill decides which VRDevices to provide, depending on the configuration of your browser. Mobile devices provide both the FusedPositionSensorVRDevice and the CardboardHMDVRDevice. Desktop devices use the MouseKeyboardPositionSensorVRDevice.

CardboardHMDVRDevice provides default parameters for Cardboard's interpupillary distance and headset.

MouseKeyboardPositionSensorVRDevice uses mouse events to allow you to do the equivalent of mouselook. It also uses keyboard arrows and WASD keys to look around the scene with the keyboard.

FusedPositionSensorVRDevice uses DeviceMotionEvents and implements a complementary filter which does sensor fusion. This device also implements pose prediction, which greatly improves head tracking performance.

Deprecated: OrientationPositionSensorVRDevice uses DeviceOrientationEvents to polyfill head-tracking on mobile devices.

Experimental: WebcamPositionSensorVRDevice uses your laptop's webcam in order to introduce translational degrees of freedom.

Configuration

The polyfill can be configured and debugged with various options. The following are supported:

WebVRConfig = {
  // Forces availability of VR mode.
  //FORCE_ENABLE_VR: true, // Default: false.
  // Complementary filter coefficient. 0 for accelerometer, 1 for gyro.
  //K_FILTER: 0.98, // Default: 0.98.
  // How far into the future to predict during fast motion.
  //PREDICTION_TIME_S: 0.050, // Default: 0.050s.
  // Flag to disable touch panner. In case you have your own touch controls
  //TOUCH_PANNER_DISABLED: true, // Default: false.
  // Enable yaw panning only, disabling roll and pitch. This can be useful
  // for panoramas with nothing interesting above or below.
  //YAW_ONLY: true, // Default: false.
  // To disable keyboard and mouse controls. If you implement your own.
  //MOUSE_KEYBOARD_CONTROLS_DISABLED: true // Default: false
}

webvr-polyfill's People

Contributors

borismus avatar dmarcos avatar cvan avatar autonome avatar santanm avatar caseyyee avatar deathcap avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.