소스 검색

SMAAPass: Clean up.

Mr.doob 6 년 전
부모
커밋
c286362af9
1개의 변경된 파일7개의 추가작업 그리고 9개의 파일을 삭제
  1. 7 9
      examples/js/postprocessing/SMAAPass.js

+ 7 - 9
examples/js/postprocessing/SMAAPass.js

@@ -27,17 +27,16 @@ THREE.SMAAPass = function ( width, height ) {
 	this.weightsRT.texture.name = "SMAAPass.weights";
 	this.weightsRT.texture.name = "SMAAPass.weights";
 
 
 	// textures
 	// textures
-	var self = this;
+	var scope = this;
 
 
 	var areaTextureImage = new Image();
 	var areaTextureImage = new Image();
-	this.areaTexture = new THREE.Texture();
-
 	areaTextureImage.src = this.getAreaTexture();
 	areaTextureImage.src = this.getAreaTexture();
 	areaTextureImage.onload = function() {
 	areaTextureImage.onload = function() {
 		// assigning data to HTMLImageElement.src is asynchronous (see #15162)
 		// assigning data to HTMLImageElement.src is asynchronous (see #15162)
-		self.areaTexture.needsUpdate = true;
+		scope.areaTexture.needsUpdate = true;
 	};
 	};
-	
+
+	this.areaTexture = new THREE.Texture();
 	this.areaTexture.name = "SMAAPass.area";
 	this.areaTexture.name = "SMAAPass.area";
 	this.areaTexture.image = areaTextureImage;
 	this.areaTexture.image = areaTextureImage;
 	this.areaTexture.format = THREE.RGBFormat;
 	this.areaTexture.format = THREE.RGBFormat;
@@ -46,14 +45,13 @@ THREE.SMAAPass = function ( width, height ) {
 	this.areaTexture.flipY = false;
 	this.areaTexture.flipY = false;
 
 
 	var searchTextureImage = new Image();
 	var searchTextureImage = new Image();
-	this.searchTexture = new THREE.Texture();
-	
 	searchTextureImage.src = this.getSearchTexture();
 	searchTextureImage.src = this.getSearchTexture();
 	searchTextureImage.onload = function() {
 	searchTextureImage.onload = function() {
 		// assigning data to HTMLImageElement.src is asynchronous (see #15162)
 		// assigning data to HTMLImageElement.src is asynchronous (see #15162)
-		self.searchTexture.needsUpdate = true;
+		scope.searchTexture.needsUpdate = true;
 	};
 	};
-	
+
+	this.searchTexture = new THREE.Texture();
 	this.searchTexture.name = "SMAAPass.search";
 	this.searchTexture.name = "SMAAPass.search";
 	this.searchTexture.image = searchTextureImage;
 	this.searchTexture.image = searchTextureImage;
 	this.searchTexture.magFilter = THREE.NearestFilter;
 	this.searchTexture.magFilter = THREE.NearestFilter;