Przeglądaj źródła

Texture rotation: auto-update texture.matrix

WestLangley 8 lat temu
rodzic
commit
4e015df1c1
1 zmienionych plików z 10 dodań i 16 usunięć
  1. 10 16
      src/renderers/WebGLRenderer.js

+ 10 - 16
src/renderers/WebGLRenderer.js

@@ -1984,17 +1984,14 @@ function WebGLRenderer( parameters ) {
 
 			if ( uvScaleMap.matrixAutoUpdate === true ) {
 
-				var offset = uvScaleMap.offset;
-				var repeat = uvScaleMap.repeat;
-
-				uniforms.uvTransform.value.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, 0, 0, 0 );
-
-			} else {
-
-				uniforms.uvTransform.value.copy( uvScaleMap.matrix );
+			    var offset = uvScaleMap.offset;
+			    var repeat = uvScaleMap.repeat;
+			    uvScaleMap.matrix.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, 0, 0, 0 );
 
 			}
 
+			uniforms.uvTransform.value.copy( uvScaleMap.matrix );
+
 		}
 
 	}
@@ -2027,17 +2024,14 @@ function WebGLRenderer( parameters ) {
 
 			if ( material.map.matrixAutoUpdate === true ) {
 
-				var offset = material.map.offset;
-				var repeat = material.map.repeat;
-
-				uniforms.uvTransform.value.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, 0, 0, 0 );
-
-			} else {
-
-				uniforms.uvTransform.value.copy( material.map.matrix );
+			    var offset = material.map.offset;
+			    var repeat = material.map.repeat;
+			    material.map.matrix.setUvTransform( offset.x, offset.y, repeat.x, repeat.y, 0, 0, 0 );
 
 			}
 
+			uniforms.uvTransform.value.copy( material.map.matrix );
+
 		}
 
 	}