浏览代码

Adding support for normalScale as part of the normalTexture

Clark Lavery 8 年之前
父节点
当前提交
d28ffdb5cb
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      examples/js/loaders/GLTFLoader.js

+ 6 - 1
examples/js/loaders/GLTFLoader.js

@@ -1613,6 +1613,11 @@ THREE.GLTFLoader = ( function () {
 
 				pending.push( parser.assignTexture( materialParams, 'normalMap', material.normalTexture.index ) );
 
+				if ( material.normalTexture.scale ) {
+
+					materialParams.normalScale = new THREE.Vector2( material.normalTexture.scale, material.normalTexture.scale );
+
+				}
 			}
 
 			if ( material.occlusionTexture !== undefined ) {
@@ -1667,7 +1672,7 @@ THREE.GLTFLoader = ( function () {
 
 				// Normal map textures use OpenGL conventions:
 				// https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#materialnormaltexture
-				_material.normalScale.x = -1;
+				_material.normalScale.x = -_material.normalScale.x;
 
 				if ( material.extras ) _material.userData = material.extras;