cardboard-vr-display
Advanced tools
Comparing version 1.0.9 to 1.0.10
{ | ||
"name": "cardboard-vr-display", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"homepage": "https://github.com/immersive-web/cardboard-vr-display", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -37,2 +37,14 @@ /* | ||
this.isFirefoxAndroid = Util.isFirefoxAndroid(); | ||
this.isIOS = Util.isIOS(); | ||
// Chrome as of m66 started reporting `rotationRate` in degrees rather | ||
// than radians, to be consistent with other browsers. | ||
// https://github.com/immersive-web/cardboard-vr-display/issues/18 | ||
let chromeVersion = Util.getChromeVersion(); | ||
this.isDeviceMotionInRadians = !this.isIOS && chromeVersion && chromeVersion < 66; | ||
// In Chrome m65 there's a regression of devicemotion events. Fallback | ||
// to using deviceorientation for these specific builds. More information | ||
// at `Util.isChromeWithoutDeviceMotion`. | ||
this.isWithoutDeviceMotion = Util.isChromeWithoutDeviceMotion(); | ||
this.filterToWorldQ = new MathUtil.Quaternion(); | ||
@@ -62,14 +74,2 @@ | ||
this.isFirefoxAndroid = Util.isFirefoxAndroid(); | ||
this.isIOS = Util.isIOS(); | ||
// Chrome as of m66 started reporting `rotationRate` in degrees rather | ||
// than radians, to be consistent with other browsers. | ||
// https://github.com/immersive-web/cardboard-vr-display/issues/18 | ||
let chromeVersion = Util.getChromeVersion(); | ||
this.isDeviceMotionInRadians = !this.isIOS && chromeVersion && chromeVersion < 66; | ||
// In Chrome m65 there's a regression of devicemotion events. Fallback | ||
// to using deviceorientation for these specific builds. More information | ||
// at `Util.isChromeWithoutDeviceMotion`. | ||
this.isWithoutDeviceMotion = Util.isChromeWithoutDeviceMotion(); | ||
this.orientationOut_ = new Float32Array(4); | ||
@@ -90,13 +90,27 @@ | ||
if (this.isWithoutDeviceMotion && this._deviceOrientationQ) { | ||
// We must rotate 90 degrees on the Y axis to get the correct | ||
// orientation of looking down the -Z axis. | ||
// We must rotate 90 (or -90, based on initial rotation) degrees | ||
// on the Y axis to get the correct orientation of looking down the -Z axis. | ||
this.deviceOrientationFixQ = this.deviceOrientationFixQ || (function () { | ||
const z = new MathUtil.Quaternion().setFromAxisAngle(new MathUtil.Vector3(0, 0, -1), 0); | ||
const y = new MathUtil.Quaternion().setFromAxisAngle(new MathUtil.Vector3(0, 1, 0), Math.PI / 2); | ||
const y = new MathUtil.Quaternion() | ||
if (window.orientation === -90) { | ||
y.setFromAxisAngle(new MathUtil.Vector3(0, 1, 0), Math.PI / -2); | ||
} else { | ||
y.setFromAxisAngle(new MathUtil.Vector3(0, 1, 0), Math.PI / 2); | ||
} | ||
return z.multiply(y); | ||
})(); | ||
this.deviceOrientationFilterToWorldQ = this.deviceOrientationFilterToWorldQ || (function () { | ||
const q = new MathUtil.Quaternion(); | ||
q.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), -Math.PI / 2); | ||
return q; | ||
})(); | ||
orientation = this._deviceOrientationQ; | ||
var out = new MathUtil.Quaternion(); | ||
out.copy(orientation); | ||
out.multiply(this.filterToWorldQ); | ||
out.multiply(this.deviceOrientationFilterToWorldQ); | ||
out.multiply(this.resetQ); | ||
@@ -103,0 +117,0 @@ out.multiply(this.worldToScreenQ); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
418194
7659