|
@@ -1468,6 +1468,9 @@ var GLTFLoader = ( function () {
|
|
|
// loader object cache
|
|
|
this.cache = new GLTFRegistry();
|
|
|
|
|
|
+ // associations between Three.js objects and glTF elements
|
|
|
+ this.associations = new Map();
|
|
|
+
|
|
|
// BufferGeometry caching
|
|
|
this.primitiveCache = {};
|
|
|
|
|
@@ -1977,6 +1980,11 @@ var GLTFLoader = ( function () {
|
|
|
texture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS ] || RepeatWrapping;
|
|
|
texture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT ] || RepeatWrapping;
|
|
|
|
|
|
+ parser.associations.set( texture, {
|
|
|
+ type: 'textures',
|
|
|
+ index: textureIndex
|
|
|
+ } );
|
|
|
+
|
|
|
return texture;
|
|
|
|
|
|
} );
|
|
@@ -2026,7 +2034,9 @@ var GLTFLoader = ( function () {
|
|
|
|
|
|
if ( transform ) {
|
|
|
|
|
|
+ var gltfReference = this.associations.get( texture );
|
|
|
texture = parser.extensions[ EXTENSIONS.KHR_TEXTURE_TRANSFORM ].extendTexture( texture, transform );
|
|
|
+ this.associations.set( texture, gltfReference );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -2125,7 +2135,7 @@ var GLTFLoader = ( function () {
|
|
|
if ( useMorphNormals ) cachedMaterial.morphNormals = true;
|
|
|
|
|
|
this.cache.add( cacheKey, cachedMaterial );
|
|
|
-
|
|
|
+ this.associations.set( cachedMaterial, this.associations.get( material ) );
|
|
|
}
|
|
|
|
|
|
material = cachedMaterial;
|
|
@@ -2321,6 +2331,8 @@ var GLTFLoader = ( function () {
|
|
|
|
|
|
assignExtrasToUserData( material, materialDef );
|
|
|
|
|
|
+ parser.associations.set( material, { type: 'materials', index: materialIndex } );
|
|
|
+
|
|
|
if ( materialDef.extensions ) addUnknownExtensionsToUserData( extensions, material, materialDef );
|
|
|
|
|
|
return material;
|
|
@@ -3161,6 +3173,8 @@ var GLTFLoader = ( function () {
|
|
|
|
|
|
assignExtrasToUserData( node, nodeDef );
|
|
|
|
|
|
+ parser.associations.set( node, { type: 'nodes', index: nodeIndex } );
|
|
|
+
|
|
|
if ( nodeDef.extensions ) addUnknownExtensionsToUserData( extensions, node, nodeDef );
|
|
|
|
|
|
if ( nodeDef.matrix !== undefined ) {
|