Ver código fonte

Deprecate .clearTarget()

WestLangley 6 anos atrás
pai
commit
016bb8c373

+ 2 - 1
examples/js/postprocessing/SAOPass.js

@@ -200,7 +200,8 @@ THREE.SAOPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ),
 		var oldAutoClear = renderer.autoClear;
 		var oldAutoClear = renderer.autoClear;
 		renderer.autoClear = false;
 		renderer.autoClear = false;
 
 
-		renderer.clearTarget( this.depthRenderTarget );
+		renderer.setRenderTarget( this.depthRenderTarget );
+		renderer.clear();
 
 
 		this.saoMaterial.uniforms[ 'bias' ].value = this.params.saoBias;
 		this.saoMaterial.uniforms[ 'bias' ].value = this.params.saoBias;
 		this.saoMaterial.uniforms[ 'intensity' ].value = this.params.saoIntensity;
 		this.saoMaterial.uniforms[ 'intensity' ].value = this.params.saoIntensity;

+ 2 - 1
examples/webgl_postprocessing_godrays.html

@@ -300,7 +300,8 @@
 
 
 					// Clear colors and depths, will clear to sky color
 					// Clear colors and depths, will clear to sky color
 
 
-					renderer.clearTarget( postprocessing.rtTextureColors, true, true, false );
+					renderer.setRenderTarget( postprocessing.rtTextureColors );
+					renderer.clear( true, true, false );
 
 
 					// Sun render. Runs a shader that gives a brightness based on the screen
 					// Sun render. Runs a shader that gives a brightness based on the screen
 					// space distance to the sun. Not very efficient, so i make a scissor
 					// space distance to the sun. Not very efficient, so i make a scissor

+ 8 - 0
src/Three.Legacy.js

@@ -1330,6 +1330,14 @@ Object.defineProperties( ShaderMaterial.prototype, {
 
 
 Object.assign( WebGLRenderer.prototype, {
 Object.assign( WebGLRenderer.prototype, {
 
 
+	clearTarget: function ( renderTarget, color, depth, stencil ) {
+
+		console.warn( 'THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.' );
+		this.setRenderTarget( renderTarget );
+		this.clear( color, depth, stencil );
+
+	},
+
 	animate: function ( callback ) {
 	animate: function ( callback ) {
 
 
 		console.warn( 'THREE.WebGLRenderer: .animate() is now .setAnimationLoop().' );
 		console.warn( 'THREE.WebGLRenderer: .animate() is now .setAnimationLoop().' );

+ 0 - 7
src/renderers/WebGLRenderer.js

@@ -494,13 +494,6 @@ function WebGLRenderer( parameters ) {
 
 
 	};
 	};
 
 
-	this.clearTarget = function ( renderTarget, color, depth, stencil ) {
-
-		this.setRenderTarget( renderTarget );
-		this.clear( color, depth, stencil );
-
-	};
-
 	//
 	//
 
 
 	this.dispose = function () {
 	this.dispose = function () {