Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webvr-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webvr-polyfill - npm Package Compare versions

Comparing version 0.9.15 to 0.9.16

3

package.json
{
"name": "webvr-polyfill",
"version": "0.9.15",
"version": "0.9.16",
"homepage": "https://github.com/borismus/webvr-polyfill",

@@ -11,3 +11,2 @@ "authors": [

"dependencies": {
"es6-promise": "^3.0.2",
"object-assign": "^4.0.1"

@@ -14,0 +13,0 @@ },

@@ -81,3 +81,3 @@ # WebVR Polyfill

// performance.
BUFFER_SCALE: 0.5, // Default: 1.0.
BUFFER_SCALE: 0.5, // Default: 0.5.

@@ -98,4 +98,4 @@ // Allow VRDisplay.submitFrame to change gl bindings, which is more

Performance is critical for VR. If you find your application is too sluggish,
consider tweaking some of the above parameters. In particular, reducing
`BUFFER_SCALE` to 0.5 (from its default 1.0) will likely help a lot.
consider tweaking some of the above parameters. In particular, keeping
`BUFFER_SCALE` at 0.5 (the default) will likely help a lot.

@@ -102,0 +102,0 @@ ## Development

@@ -23,2 +23,5 @@ /*

var defaultLeftBounds = [0, 0, 0.5, 1];
var defaultRightBounds = [0.5, 0, 0.5, 1];
/**

@@ -155,6 +158,3 @@ * The base class for all VR displays.

VRDisplay.prototype.requestPresent = function(layers) {
if (this.isPresenting) {
console.error('Already presenting!');
return;
}
var wasPresenting = this.isPresenting;
var self = this;

@@ -181,4 +181,48 @@

self.layer_ = layers[0];
var incomingLayer = layers[0];
if (!incomingLayer.source) {
/*
todo: figure out the correct behavior if the source is not provided.
see https://github.com/w3c/webvr/issues/58
*/
resolve();
return;
}
var leftBounds = incomingLayer.leftBounds || defaultLeftBounds;
var rightBounds = incomingLayer.rightBounds || defaultRightBounds;
if (wasPresenting) {
// Already presenting, just changing configuration
var changed = false;
var layer = self.layer_;
if (layer.source !== incomingLayer.source) {
layer.source = incomingLayer.source;
changed = true;
}
for (var i = 0; i < 4; i++) {
if (layer.leftBounds[i] !== leftBounds[i]) {
layer.leftBounds[i] = leftBounds[i];
changed = true;
}
if (layer.rightBounds[i] !== rightBounds[i]) {
layer.rightBounds[i] = rightBounds[i];
changed = true;
}
}
if (changed) {
self.fireVRDisplayPresentChange_();
}
resolve();
return;
}
// Was not already presenting
self.layer_ = {
source: incomingLayer.source,
leftBounds: leftBounds.slice(0),
rightBounds: rightBounds.slice(0)
};
self.waitingForPresent_ = false;

@@ -185,0 +229,0 @@ if (self.layer_ && self.layer_.source) {

@@ -114,2 +114,8 @@ /*

CardboardVRDisplay.prototype.updateBounds_ = function () {
if (this.layer_ && this.distorter_ && (this.layer_.leftBounds || this.layer_.rightBounds)) {
this.distorter_.setTextureBounds(this.layer_.leftBounds, this.layer_.rightBounds);
}
};
CardboardVRDisplay.prototype.beginPresent_ = function() {

@@ -137,6 +143,2 @@ var gl = this.layer_.source.getContext('webgl');

this.cardboardUI_ = this.distorter_.cardboardUI;
if (this.layer_.leftBounds || this.layer_.rightBounds) {
this.distorter_.setTextureBounds(this.layer_.leftBounds, this.layer_.rightBounds);
}
}

@@ -172,2 +174,6 @@

// Listen for present display change events in order to update distorter dimensions
this.vrdisplaypresentchangeHandler = this.updateBounds_.bind(this);
window.addEventListener('vrdisplaypresentchange', this.vrdisplaypresentchangeHandler);
// Fire this event initially, to give geometry-distortion clients the chance

@@ -194,2 +200,3 @@ // to do something custom.

window.removeEventListener('orientationchange', this.orientationHandler);
window.removeEventListener('vrdisplaypresentchange', this.vrdisplaypresentchangeHandler);
};

@@ -196,0 +203,0 @@

@@ -16,5 +16,2 @@ /*

// Polyfill ES6 Promises (mostly for IE 11).
require('es6-promise').polyfill();
var CardboardVRDisplay = require('./cardboard-vr-display.js');

@@ -21,0 +18,0 @@ var MouseKeyboardVRDisplay = require('./mouse-keyboard-vr-display.js');

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc