|
@@ -1300,46 +1300,41 @@ THREE.GLTFLoader = ( function () {
|
|
|
|
|
|
}
|
|
|
|
|
|
- function getCachedGeometry( cache, newPrimitive ) {
|
|
|
-
|
|
|
- for ( var i = 0, il = cache.length; i < il; i ++ ) {
|
|
|
-
|
|
|
- var cached = cache[ i ];
|
|
|
+ function isArrayEqual( a, b ) {
|
|
|
|
|
|
- if ( isPrimitiveEqual( cached.primitive, newPrimitive ) ) {
|
|
|
+ if ( a.length !== b.length ) return false;
|
|
|
|
|
|
- return cached.promise;
|
|
|
+ for ( var i = 0, il = a.length; i < il; i ++ ) {
|
|
|
|
|
|
- }
|
|
|
+ if ( a[ i ] !== b[ i ] ) return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
- return null;
|
|
|
+ return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
- function getCachedCombinedGeometry( cache, geometries ) {
|
|
|
+ function getCachedGeometry( cache, newPrimitive ) {
|
|
|
|
|
|
for ( var i = 0, il = cache.length; i < il; i ++ ) {
|
|
|
|
|
|
- var entry = cache[ i ];
|
|
|
+ var cached = cache[ i ];
|
|
|
|
|
|
- if ( geometries.length !== entry.baseGeometries.length ) continue;
|
|
|
+ if ( isPrimitiveEqual( cached.primitive, newPrimitive ) ) return cached.promise;
|
|
|
|
|
|
- var match = true;
|
|
|
+ }
|
|
|
|
|
|
- for ( var j = 0, jl = geometries.length; j < jl; j ++ ) {
|
|
|
+ return null;
|
|
|
|
|
|
- if ( geometries[ j ] !== entry.baseGeometries[ j ] ) {
|
|
|
+ }
|
|
|
|
|
|
- match = false;
|
|
|
- break;
|
|
|
+ function getCachedCombinedGeometry( cache, geometries ) {
|
|
|
|
|
|
- }
|
|
|
+ for ( var i = 0, il = cache.length; i < il; i ++ ) {
|
|
|
|
|
|
- }
|
|
|
+ var entry = cache[ i ];
|
|
|
|
|
|
- if ( match ) return entry.geometry;
|
|
|
+ if ( isArrayEqual( geometries, entry.baseGeometries ) ) return entry.geometry;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1353,23 +1348,7 @@ THREE.GLTFLoader = ( function () {
|
|
|
|
|
|
var entry = cache[ i ];
|
|
|
|
|
|
- if ( geometry !== entry.baseGeometry ) continue;
|
|
|
- if ( primitives.length !== entry.primitives.length ) continue;
|
|
|
-
|
|
|
- var match = true;
|
|
|
-
|
|
|
- for ( var j = 0, jl = primitives.length; j < jl; j ++ ) {
|
|
|
-
|
|
|
- if ( primitives[ j ].indices !== entry.primitives[ j ].indices ) {
|
|
|
-
|
|
|
- match = false;
|
|
|
- break;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( match ) return entry.geometry;
|
|
|
+ if ( geometry === entry.baseGeometry && isArrayEqual( primitives, entry.primitives ) ) return entry.geometry;
|
|
|
|
|
|
}
|
|
|
|