|
@@ -685,7 +685,8 @@ var GLTFLoader = ( function () {
|
|
|
|
|
|
var scale = extension.clearcoatNormalTexture.scale;
|
|
|
|
|
|
- materialParams.clearcoatNormalScale = new Vector2( scale, scale );
|
|
|
+ // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995
|
|
|
+ materialParams.clearcoatNormalScale = new Vector2( scale, -scale );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -2686,12 +2687,21 @@ var GLTFLoader = ( function () {
|
|
|
cachedMaterial = material.clone();
|
|
|
|
|
|
if ( useSkinning ) cachedMaterial.skinning = true;
|
|
|
- if ( useVertexTangents ) cachedMaterial.vertexTangents = true;
|
|
|
if ( useVertexColors ) cachedMaterial.vertexColors = true;
|
|
|
if ( useFlatShading ) cachedMaterial.flatShading = true;
|
|
|
if ( useMorphTargets ) cachedMaterial.morphTargets = true;
|
|
|
if ( useMorphNormals ) cachedMaterial.morphNormals = true;
|
|
|
|
|
|
+ if ( useVertexTangents ) {
|
|
|
+
|
|
|
+ cachedMaterial.vertexTangents = true;
|
|
|
+
|
|
|
+ // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995
|
|
|
+ if ( material.normalScale ) material.normalScale.y *= -1;
|
|
|
+ if ( material.clearcoatNormalScale ) material.clearcoatNormalScale.y *= -1;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
this.cache.add( cacheKey, cachedMaterial );
|
|
|
|
|
|
this.associations.set( cachedMaterial, this.associations.get( material ) );
|
|
@@ -2710,19 +2720,6 @@ var GLTFLoader = ( function () {
|
|
|
|
|
|
}
|
|
|
|
|
|
- // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995
|
|
|
- if ( material.normalScale && ! useVertexTangents ) {
|
|
|
-
|
|
|
- material.normalScale.y = - material.normalScale.y;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if ( material.clearcoatNormalScale && ! useVertexTangents ) {
|
|
|
-
|
|
|
- material.clearcoatNormalScale.y = - material.clearcoatNormalScale.y;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
mesh.material = material;
|
|
|
|
|
|
};
|
|
@@ -2843,11 +2840,12 @@ var GLTFLoader = ( function () {
|
|
|
|
|
|
pending.push( parser.assignTexture( materialParams, 'normalMap', materialDef.normalTexture ) );
|
|
|
|
|
|
- materialParams.normalScale = new Vector2( 1, 1 );
|
|
|
+ // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995
|
|
|
+ materialParams.normalScale = new Vector2( 1, -1 );
|
|
|
|
|
|
if ( materialDef.normalTexture.scale !== undefined ) {
|
|
|
|
|
|
- materialParams.normalScale.set( materialDef.normalTexture.scale, materialDef.normalTexture.scale );
|
|
|
+ materialParams.normalScale.set( materialDef.normalTexture.scale, -materialDef.normalTexture.scale );
|
|
|
|
|
|
}
|
|
|
|