Explorar o código

[gltf-loader] Duplicate UVs when aoMap is present.

Don McCurdy %!s(int64=8) %!d(string=hai) anos
pai
achega
dc3a469029
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      examples/js/loaders/GLTF2Loader.js

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

@@ -2092,6 +2092,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;