three-stdlib 2.23.9 → 2.23.11
Sign up to get free protection for your applications and to get access to all the features.
package/loaders/GLTFLoader.cjs
CHANGED
@@ -1304,7 +1304,7 @@ class GLTFParser {
|
|
1304
1304
|
let isSafari = false;
|
1305
1305
|
let isFirefox = false;
|
1306
1306
|
let firefoxVersion = -1;
|
1307
|
-
if (typeof navigator !== "undefined") {
|
1307
|
+
if (typeof navigator !== "undefined" && typeof navigator.userAgent !== "undefined") {
|
1308
1308
|
isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === true;
|
1309
1309
|
isFirefox = navigator.userAgent.indexOf("Firefox") > -1;
|
1310
1310
|
firefoxVersion = isFirefox ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
package/loaders/GLTFLoader.js
CHANGED
@@ -1302,7 +1302,7 @@ class GLTFParser {
|
|
1302
1302
|
let isSafari = false;
|
1303
1303
|
let isFirefox = false;
|
1304
1304
|
let firefoxVersion = -1;
|
1305
|
-
if (typeof navigator !== "undefined") {
|
1305
|
+
if (typeof navigator !== "undefined" && typeof navigator.userAgent !== "undefined") {
|
1306
1306
|
isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === true;
|
1307
1307
|
isFirefox = navigator.userAgent.indexOf("Firefox") > -1;
|
1308
1308
|
firefoxVersion = isFirefox ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
package/package.json
CHANGED
@@ -578,7 +578,7 @@ function toCreasedNormals(geometry, creaseAngle = Math.PI / 3) {
|
|
578
578
|
const z = ~~(v.z * hashMultiplier);
|
579
579
|
return `${x},${y},${z}`;
|
580
580
|
}
|
581
|
-
const resultGeometry = geometry.toNonIndexed();
|
581
|
+
const resultGeometry = geometry.index ? geometry.toNonIndexed() : geometry;
|
582
582
|
const posAttr = resultGeometry.attributes.position;
|
583
583
|
const vertexMap = {};
|
584
584
|
for (let i = 0, l = posAttr.count / 3; i < l; i++) {
|
@@ -45,4 +45,19 @@ export type ComputedMorphedAttribute = {
|
|
45
45
|
morphedNormalAttribute: Float32BufferAttribute;
|
46
46
|
};
|
47
47
|
export declare function computeMorphedAttributes(object: Mesh | Line | Points): ComputedMorphedAttribute | null;
|
48
|
+
/**
|
49
|
+
* Modifies the supplied geometry if it is non-indexed, otherwise creates a new,
|
50
|
+
* non-indexed geometry. Returns the geometry with smooth normals everywhere except
|
51
|
+
* faces that meet at an angle greater than the crease angle.
|
52
|
+
*
|
53
|
+
* Backwards compatible with code such as @react-three/drei's `<RoundedBox>`
|
54
|
+
* which uses this method to operate on the original geometry.
|
55
|
+
*
|
56
|
+
* As of this writing, BufferGeometry.toNonIndexed() warns if the geometry is
|
57
|
+
* non-indexed and returns `this`, i.e. the same geometry on which it was called:
|
58
|
+
* `BufferGeometry is already non-indexed.`
|
59
|
+
*
|
60
|
+
* @param geometry
|
61
|
+
* @param creaseAngle
|
62
|
+
*/
|
48
63
|
export declare function toCreasedNormals(geometry: BufferGeometry, creaseAngle?: number): BufferGeometry;
|
@@ -576,7 +576,7 @@ function toCreasedNormals(geometry, creaseAngle = Math.PI / 3) {
|
|
576
576
|
const z = ~~(v.z * hashMultiplier);
|
577
577
|
return `${x},${y},${z}`;
|
578
578
|
}
|
579
|
-
const resultGeometry = geometry.toNonIndexed();
|
579
|
+
const resultGeometry = geometry.index ? geometry.toNonIndexed() : geometry;
|
580
580
|
const posAttr = resultGeometry.attributes.position;
|
581
581
|
const vertexMap = {};
|
582
582
|
for (let i = 0, l = posAttr.count / 3; i < l; i++) {
|