Преглед изворни кода

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

Don McCurdy пре 8 година
родитељ
комит
dc3a469029
1 измењених фајлова са 9 додато и 0 уклоњено
  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;