cardboard-vr-display
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "cardboard-vr-display", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/googlevr/cardboard-vr-display", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -47,2 +47,6 @@ # cardboard-vr-display | ||
const options = { | ||
// Whether or not CardboardVRDisplay is in debug mode. Logs extra | ||
// messages. Added in 1.0.2. | ||
DEBUG: false, | ||
// The URL to JSON of DPDB information. By default, uses the data | ||
@@ -49,0 +53,0 @@ // from https://github.com/WebVRRocks/webvr-polyfill-dpdb; if left |
@@ -49,3 +49,4 @@ /* | ||
this.config.TOUCH_PANNER_DISABLED, | ||
this.config.YAW_ONLY); | ||
this.config.YAW_ONLY, | ||
this.config.DEBUG); | ||
this.distorter_ = null; | ||
@@ -114,3 +115,3 @@ this.cardboardUI_ = null; | ||
CardboardVRDisplay.prototype.onDeviceParamsUpdated_ = function(newParams) { | ||
if (Util.isDebug()) { | ||
if (this.config.DEBUG) { | ||
console.log('DPDB reported that device params were updated.'); | ||
@@ -117,0 +118,0 @@ } |
@@ -17,2 +17,6 @@ /* | ||
module.exports = { | ||
// Whether or not CardboardVRDisplay is in debug mode. Logs extra | ||
// messages. Added in 1.0.2. | ||
DEBUG: false, | ||
// The URL to JSON of DPDB information. By default, uses the data | ||
@@ -19,0 +23,0 @@ // from https://github.com/WebVRRocks/webvr-polyfill-dpdb; if left |
@@ -34,4 +34,5 @@ /* | ||
*/ | ||
function ComplementaryFilter(kFilter) { | ||
function ComplementaryFilter(kFilter, isDebug) { | ||
this.kFilter = kFilter; | ||
this.isDebug = isDebug; | ||
@@ -119,3 +120,3 @@ // Raw sensor measurements. | ||
if (Util.isDebug()) { | ||
if (this.isDebug) { | ||
console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)', | ||
@@ -122,0 +123,0 @@ MathUtil.radToDeg * Util.getQuaternionAngle(deltaQ), |
@@ -28,4 +28,5 @@ /* | ||
* @param {boolean} yawOnly | ||
* @param {boolean} isDebug | ||
*/ | ||
function FusionPoseSensor(kFilter, predictionTime, touchPannerDisabled, yawOnly) { | ||
function FusionPoseSensor(kFilter, predictionTime, touchPannerDisabled, yawOnly, isDebug) { | ||
this.deviceId = 'webvr-polyfill:fused'; | ||
@@ -41,4 +42,4 @@ this.deviceName = 'VR Position Device (webvr-polyfill:fused)'; | ||
this.filter = new ComplementaryFilter(kFilter); | ||
this.posePredictor = new PosePredictor(predictionTime); | ||
this.filter = new ComplementaryFilter(kFilter, isDebug); | ||
this.posePredictor = new PosePredictor(predictionTime, isDebug); | ||
this.touchPanner = new TouchPanner(); | ||
@@ -45,0 +46,0 @@ |
@@ -16,3 +16,2 @@ /* | ||
var MathUtil = require('../math-util'); | ||
var Util = require('../util'); | ||
@@ -28,4 +27,5 @@ /** | ||
*/ | ||
function PosePredictor(predictionTimeS) { | ||
function PosePredictor(predictionTimeS, isDebug) { | ||
this.predictionTimeS = predictionTimeS; | ||
this.isDebug = isDebug; | ||
@@ -59,3 +59,3 @@ // The quaternion corresponding to the previous state. | ||
if (angularSpeed < MathUtil.degToRad * 20) { | ||
if (Util.isDebug()) { | ||
if (this.isDebug) { | ||
console.log('Moving slowly, at %s deg/s: no prediction', | ||
@@ -62,0 +62,0 @@ (MathUtil.radToDeg * angularSpeed).toFixed(1)); |
@@ -267,13 +267,2 @@ /* | ||
Util.isDebug = function() { | ||
return Util.getQueryParameter('debug'); | ||
}; | ||
Util.getQueryParameter = function(name) { | ||
var name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); | ||
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), | ||
results = regex.exec(location.search); | ||
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); | ||
}; | ||
Util.frameDataFromPose = (function() { | ||
@@ -482,2 +471,13 @@ var piOver180 = Math.PI / 180.0; | ||
Util.getQuaternionAngle = function(quat) { | ||
// angle = 2 * acos(qw) | ||
// If w is greater than 1 (THREE.js, how can this be?), arccos is not defined. | ||
if (quat.w > 1) { | ||
console.warn('getQuaternionAngle: w > 1'); | ||
return 0; | ||
} | ||
var angle = 2 * Math.acos(quat.w); | ||
return angle; | ||
}; | ||
module.exports = Util; |
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
212681
3792
135