cardboard-vr-display
Advanced tools
Comparing version 1.0.18 to 1.0.19
{ | ||
"name": "cardboard-vr-display", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"homepage": "https://github.com/immersive-web/cardboard-vr-display", | ||
@@ -30,2 +30,3 @@ "authors": [ | ||
"scripts": { | ||
"test": "echo \"No tests defined\"", | ||
"build": "rollup -c", | ||
@@ -32,0 +33,0 @@ "watch": "rollup -c -w", |
@@ -188,2 +188,8 @@ # cardboard-vr-display | ||
### Releasing a new version | ||
For maintainers only, to cut a new release for npm, use the [npm version] command. The `preversion`, `version` and `postversion` npm scripts will run tests, build, add built files and tag to git, push to github, and publish the new npm version. | ||
`npm version <semverstring>` | ||
## Running The Demo | ||
@@ -190,0 +196,0 @@ |
@@ -59,2 +59,3 @@ /* | ||
this.ctxAttribs = gl.getContextAttributes(); | ||
this.instanceExt = gl.getExtension('ANGLE_instanced_arrays'); | ||
@@ -64,3 +65,2 @@ this.meshWidth = 20; | ||
this.bufferWidth = gl.drawingBufferWidth; | ||
@@ -427,2 +427,9 @@ this.bufferHeight = gl.drawingBufferHeight; | ||
var positionDivisor = 0; | ||
var texCoordDivisor = 0; | ||
if (self.instanceExt) { | ||
positionDivisor = gl.getVertexAttrib(self.attribs.position, self.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE); | ||
texCoordDivisor = gl.getVertexAttrib(self.attribs.texCoord, self.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE); | ||
} | ||
// Make sure the GL state is in a good place | ||
@@ -454,2 +461,10 @@ if (self.cullFace) { self.realDisable.call(gl, gl.CULL_FACE); } | ||
gl.vertexAttribPointer(self.attribs.texCoord, 3, gl.FLOAT, false, 20, 8); | ||
if (self.instanceExt) { | ||
if (positionDivisor != 0) { | ||
self.instanceExt.vertexAttribDivisorANGLE(self.attribs.position, 0); | ||
} | ||
if (texCoordDivisor != 0) { | ||
self.instanceExt.vertexAttribDivisorANGLE(self.attribs.texCoord, 0); | ||
} | ||
} | ||
@@ -494,2 +509,11 @@ gl.activeTexture(gl.TEXTURE0); | ||
} | ||
if (self.instanceExt) { | ||
if (positionDivisor != 0) { | ||
self.instanceExt.vertexAttribDivisorANGLE(self.attribs.position, positionDivisor); | ||
} | ||
if (texCoordDivisor != 0) { | ||
self.instanceExt.vertexAttribDivisorANGLE(self.attribs.texCoord, texCoordDivisor); | ||
} | ||
} | ||
}); | ||
@@ -496,0 +520,0 @@ |
@@ -44,6 +44,6 @@ /* | ||
this.isDeviceMotionInRadians = !this.isIOS && chromeVersion && chromeVersion < 66; | ||
// In Chrome m65 there's a regression of devicemotion events. Fallback | ||
// In Chrome m65 and Safari 13.4 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.isWithoutDeviceMotion = Util.isChromeWithoutDeviceMotion() || Util.isSafariWithoutDeviceMotion(); | ||
@@ -219,17 +219,20 @@ this.filterToWorldQ = new MathUtil.Quaternion(); | ||
this.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z); | ||
if (Util.isR7()) { | ||
this.gyroscope.set(-rotRate.beta, rotRate.alpha, rotRate.gamma); | ||
} else { | ||
this.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma); | ||
} | ||
if (rotRate) { | ||
if (Util.isR7()) { | ||
this.gyroscope.set(-rotRate.beta, rotRate.alpha, rotRate.gamma); | ||
} else { | ||
this.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma); | ||
} | ||
// DeviceMotionEvents should report `rotationRate` in degrees, so we need | ||
// to convert to radians. However, some browsers (Android Chrome < m66) report | ||
// the rotation as radians, in which case no conversion is needed. | ||
if (!this.isDeviceMotionInRadians) { | ||
this.gyroscope.multiplyScalar(Math.PI / 180); | ||
// DeviceMotionEvents should report `rotationRate` in degrees, so we need | ||
// to convert to radians. However, some browsers (Android Chrome < m66) report | ||
// the rotation as radians, in which case no conversion is needed. | ||
if (!this.isDeviceMotionInRadians) { | ||
this.gyroscope.multiplyScalar(Math.PI / 180); | ||
} | ||
this.filter.addGyroMeasurement(this.gyroscope, timestampS); | ||
} | ||
this.filter.addAccelMeasurement(this.accelerometer, timestampS); | ||
this.filter.addGyroMeasurement(this.gyroscope, timestampS); | ||
@@ -236,0 +239,0 @@ this.previousTimestampS = timestampS; |
@@ -75,2 +75,13 @@ /* | ||
/** | ||
* In Safari 13.4 for iOS `devicemotion` events are broken | ||
*/ | ||
export const isSafariWithoutDeviceMotion = (function() { | ||
let value = false; | ||
value = isIOS() && isSafari() && navigator.userAgent.indexOf('13_4') !== -1; | ||
return function () { | ||
return value; | ||
}; | ||
})(); | ||
/** | ||
* In Chrome m65, `devicemotion` events are broken but subsequently fixed | ||
@@ -77,0 +88,0 @@ * in 65.0.3325.148. Since many browsers use Chromium, ensure that |
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
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
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
370485
7534
222
27
1