Ver Fonte

Merge pull request #11295 from donmccurdy/feat-duplicate-uvs-for-aomap

[glTF] Duplicate UVs when aoMap is present.
Mr.doob há 8 anos atrás
pai
commit
9f101766d2
1 ficheiros alterados com 9 adições e 0 exclusões
  1. 9 0
      examples/js/loaders/GLTF2Loader.js

+ 9 - 0
examples/js/loaders/GLTF2Loader.js

@@ -2093,6 +2093,15 @@ THREE.GLTF2Loader = ( function () {
 
 						}
 
+						if ( material.aoMap !== undefined
+								&& geometry.attributes.uv2 === undefined
+								&& geometry.attributes.uv !== undefined ) {
+
+							console.log( 'GLTF2Loader: Duplicating UVs to support aoMap.' );
+							geometry.addAttribute( 'uv2', new THREE.BufferAttribute( geometry.attributes.uv.array, 2 ) );
+
+						}
+
 						meshNode = new THREE.Mesh( geometry, material );
 						meshNode.castShadow = true;