Browse Source

Merge pull request #15818 from Mugen87/dev27

Examples: Clean up
Michael Herzog 6 years ago
parent
commit
2a8a3faef5

+ 23 - 23
examples/js/postprocessing/AdaptiveToneMappingPass.js

@@ -49,7 +49,7 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 
 
 	this.adaptLuminanceShader = {
 	this.adaptLuminanceShader = {
 		defines: {
 		defines: {
-			"MIP_LEVEL_1X1" : ( Math.log( this.resolution ) / Math.log( 2.0 ) ).toFixed( 1 )
+			"MIP_LEVEL_1X1": ( Math.log( this.resolution ) / Math.log( 2.0 ) ).toFixed( 1 )
 		},
 		},
 		uniforms: {
 		uniforms: {
 			"lastLum": { value: null },
 			"lastLum": { value: null },
@@ -63,8 +63,8 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 
 
 			"void main() {",
 			"void main() {",
 
 
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+			"	vUv = uv;",
+			"	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
 
 
 			"}"
 			"}"
 		].join( '\n' ),
 		].join( '\n' ),
@@ -79,20 +79,20 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 
 
 			"void main() {",
 			"void main() {",
 
 
-				"vec4 lastLum = texture2D( lastLum, vUv, MIP_LEVEL_1X1 );",
-				"vec4 currentLum = texture2D( currentLum, vUv, MIP_LEVEL_1X1 );",
+			"	vec4 lastLum = texture2D( lastLum, vUv, MIP_LEVEL_1X1 );",
+			"	vec4 currentLum = texture2D( currentLum, vUv, MIP_LEVEL_1X1 );",
 
 
-				"float fLastLum = max( minLuminance, lastLum.r );",
-				"float fCurrentLum = max( minLuminance, currentLum.r );",
+			"	float fLastLum = max( minLuminance, lastLum.r );",
+			"	float fCurrentLum = max( minLuminance, currentLum.r );",
 
 
-				//The adaption seems to work better in extreme lighting differences
-				//if the input luminance is squared.
-				"fCurrentLum *= fCurrentLum;",
+			//The adaption seems to work better in extreme lighting differences
+			//if the input luminance is squared.
+			"	fCurrentLum *= fCurrentLum;",
 
 
-				// Adapt the luminance using Pattanaik's technique
-				"float fAdaptedLum = fLastLum + (fCurrentLum - fLastLum) * (1.0 - exp(-delta * tau));",
-				// "fAdaptedLum = sqrt(fAdaptedLum);",
-				"gl_FragColor.r = fAdaptedLum;",
+			// Adapt the luminance using Pattanaik's technique
+			"	float fAdaptedLum = fLastLum + (fCurrentLum - fLastLum) * (1.0 - exp(-delta * tau));",
+			// "fAdaptedLum = sqrt(fAdaptedLum);",
+			"	gl_FragColor.r = fAdaptedLum;",
 			"}"
 			"}"
 		].join( '\n' )
 		].join( '\n' )
 	};
 	};
@@ -118,7 +118,7 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 	} );
 	} );
 
 
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
-	this.scene  = new THREE.Scene();
+	this.scene = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.quad.frustumCulled = false; // Avoid getting clipped
@@ -188,7 +188,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
 
 
 	},
 	},
 
 
-	reset: function( renderer ) {
+	reset: function ( renderer ) {
 
 
 		// render targets
 		// render targets
 		if ( this.luminanceRT ) {
 		if ( this.luminanceRT ) {
@@ -240,7 +240,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
 
 
 	},
 	},
 
 
-	setAdaptive: function( adaptive ) {
+	setAdaptive: function ( adaptive ) {
 
 
 		if ( adaptive ) {
 		if ( adaptive ) {
 
 
@@ -259,7 +259,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
 
 
 	},
 	},
 
 
-	setAdaptionRate: function( rate ) {
+	setAdaptionRate: function ( rate ) {
 
 
 		if ( rate ) {
 		if ( rate ) {
 
 
@@ -269,7 +269,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
 
 
 	},
 	},
 
 
-	setMinLuminance: function( minLum ) {
+	setMinLuminance: function ( minLum ) {
 
 
 		if ( minLum ) {
 		if ( minLum ) {
 
 
@@ -280,7 +280,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
 
 
 	},
 	},
 
 
-	setMaxLuminance: function( maxLum ) {
+	setMaxLuminance: function ( maxLum ) {
 
 
 		if ( maxLum ) {
 		if ( maxLum ) {
 
 
@@ -290,7 +290,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
 
 
 	},
 	},
 
 
-	setAverageLuminance: function( avgLum ) {
+	setAverageLuminance: function ( avgLum ) {
 
 
 		if ( avgLum ) {
 		if ( avgLum ) {
 
 
@@ -300,7 +300,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
 
 
 	},
 	},
 
 
-	setMiddleGrey: function( middleGrey ) {
+	setMiddleGrey: function ( middleGrey ) {
 
 
 		if ( middleGrey ) {
 		if ( middleGrey ) {
 
 
@@ -310,7 +310,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
 
 
 	},
 	},
 
 
-	dispose: function() {
+	dispose: function () {
 
 
 		if ( this.luminanceRT ) {
 		if ( this.luminanceRT ) {
 
 

+ 2 - 2
examples/js/postprocessing/AfterimagePass.js

@@ -42,7 +42,7 @@ THREE.AfterimagePass = function ( damp ) {
 	this.sceneComp = new THREE.Scene();
 	this.sceneComp = new THREE.Scene();
 	this.scene = new THREE.Scene();
 	this.scene = new THREE.Scene();
 
 
-	this.camera = new THREE.OrthographicCamera( -1, 1, 1, -1, 0, 1 );
+	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
 	this.camera.position.z = 1;
 	this.camera.position.z = 1;
 
 
 	var geometry = new THREE.PlaneBufferGeometry( 2, 2 );
 	var geometry = new THREE.PlaneBufferGeometry( 2, 2 );
@@ -50,7 +50,7 @@ THREE.AfterimagePass = function ( damp ) {
 	this.quadComp = new THREE.Mesh( geometry, this.shaderMaterial );
 	this.quadComp = new THREE.Mesh( geometry, this.shaderMaterial );
 	this.sceneComp.add( this.quadComp );
 	this.sceneComp.add( this.quadComp );
 
 
-	var material = new THREE.MeshBasicMaterial( { 
+	var material = new THREE.MeshBasicMaterial( {
 		map: this.textureComp.texture
 		map: this.textureComp.texture
 	} );
 	} );
 
 

+ 2 - 2
examples/js/postprocessing/BloomPass.js

@@ -56,7 +56,7 @@ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
 	this.materialConvolution = new THREE.ShaderMaterial( {
 	this.materialConvolution = new THREE.ShaderMaterial( {
 
 
 		uniforms: this.convolutionUniforms,
 		uniforms: this.convolutionUniforms,
-		vertexShader:  convolutionShader.vertexShader,
+		vertexShader: convolutionShader.vertexShader,
 		fragmentShader: convolutionShader.fragmentShader,
 		fragmentShader: convolutionShader.fragmentShader,
 		defines: {
 		defines: {
 			"KERNEL_SIZE_FLOAT": kernelSize.toFixed( 1 ),
 			"KERNEL_SIZE_FLOAT": kernelSize.toFixed( 1 ),
@@ -68,7 +68,7 @@ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
 	this.needsSwap = false;
 	this.needsSwap = false;
 
 
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
-	this.scene  = new THREE.Scene();
+	this.scene = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.quad.frustumCulled = false; // Avoid getting clipped

+ 1 - 1
examples/js/postprocessing/BokehPass.js

@@ -67,7 +67,7 @@ THREE.BokehPass = function ( scene, camera, params ) {
 	this.needsSwap = false;
 	this.needsSwap = false;
 
 
 	this.camera2 = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
 	this.camera2 = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
-	this.scene2  = new THREE.Scene();
+	this.scene2 = new THREE.Scene();
 
 
 	this.quad2 = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad2 = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad2.frustumCulled = false; // Avoid getting clipped
 	this.quad2.frustumCulled = false; // Avoid getting clipped

+ 1 - 1
examples/js/postprocessing/DotScreenPass.js

@@ -26,7 +26,7 @@ THREE.DotScreenPass = function ( center, angle, scale ) {
 	} );
 	} );
 
 
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
-	this.scene  = new THREE.Scene();
+	this.scene = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.quad.frustumCulled = false; // Avoid getting clipped

+ 1 - 1
examples/js/postprocessing/FilmPass.js

@@ -27,7 +27,7 @@ THREE.FilmPass = function ( noiseIntensity, scanlinesIntensity, scanlinesCount,
 	if ( scanlinesCount !== undefined ) this.uniforms.sCount.value = scanlinesCount;
 	if ( scanlinesCount !== undefined ) this.uniforms.sCount.value = scanlinesCount;
 
 
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
-	this.scene  = new THREE.Scene();
+	this.scene = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.quad.frustumCulled = false; // Avoid getting clipped

+ 3 - 3
examples/js/postprocessing/GlitchPass.js

@@ -24,7 +24,7 @@ THREE.GlitchPass = function ( dt_size ) {
 	} );
 	} );
 
 
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
-	this.scene  = new THREE.Scene();
+	this.scene = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.quad.frustumCulled = false; // Avoid getting clipped
@@ -90,13 +90,13 @@ THREE.GlitchPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
 
 
 	},
 	},
 
 
-	generateTrigger: function() {
+	generateTrigger: function () {
 
 
 		this.randX = THREE.Math.randInt( 120, 240 );
 		this.randX = THREE.Math.randInt( 120, 240 );
 
 
 	},
 	},
 
 
-	generateHeightmap: function( dt_size ) {
+	generateHeightmap: function ( dt_size ) {
 
 
 		var data_arr = new Float32Array( dt_size * dt_size * 3 );
 		var data_arr = new Float32Array( dt_size * dt_size * 3 );
 		var length = dt_size * dt_size;
 		var length = dt_size * dt_size;

+ 3 - 3
examples/js/postprocessing/HalftonePass.js

@@ -30,7 +30,7 @@ THREE.HalftonePass = function ( width, height, params ) {
 
 
 		if ( params.hasOwnProperty( key ) && this.uniforms.hasOwnProperty( key ) ) {
 		if ( params.hasOwnProperty( key ) && this.uniforms.hasOwnProperty( key ) ) {
 
 
-			this.uniforms[key].value = params[key];
+			this.uniforms[ key ].value = params[ key ];
 
 
 		}
 		}
 
 
@@ -42,9 +42,9 @@ THREE.HalftonePass = function ( width, height, params ) {
  	this.quad.frustumCulled = false;
  	this.quad.frustumCulled = false;
  	this.scene.add( this.quad );
  	this.scene.add( this.quad );
 
 
- };
+};
 
 
- THREE.HalftonePass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), {
+THREE.HalftonePass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), {
 
 
 	constructor: THREE.HalftonePass,
 	constructor: THREE.HalftonePass,
 
 

+ 1 - 1
examples/js/postprocessing/MaskPass.js

@@ -73,7 +73,7 @@ THREE.MaskPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ),
 
 
 		// only render where stencil is set to 1
 		// only render where stencil is set to 1
 
 
-		state.buffers.stencil.setFunc( context.EQUAL, 1, 0xffffffff );  // draw if == 1
+		state.buffers.stencil.setFunc( context.EQUAL, 1, 0xffffffff ); // draw if == 1
 		state.buffers.stencil.setOp( context.KEEP, context.KEEP, context.KEEP );
 		state.buffers.stencil.setOp( context.KEEP, context.KEEP, context.KEEP );
 
 
 	}
 	}

+ 1 - 0
examples/js/postprocessing/RenderPass.js

@@ -60,6 +60,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
 
 
 		this.scene.overrideMaterial = null;
 		this.scene.overrideMaterial = null;
 		renderer.autoClear = oldAutoClear;
 		renderer.autoClear = oldAutoClear;
+
 	}
 	}
 
 
 } );
 } );

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

@@ -319,7 +319,7 @@ THREE.SAOPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ),
 		var originalClearAlpha = renderer.getClearAlpha();
 		var originalClearAlpha = renderer.getClearAlpha();
 		var originalAutoClear = renderer.autoClear;
 		var originalAutoClear = renderer.autoClear;
 
 
-		renderer.setRenderTarget( renderTarget);
+		renderer.setRenderTarget( renderTarget );
 
 
 		// setup pass state
 		// setup pass state
 		renderer.autoClear = false;
 		renderer.autoClear = false;

+ 3 - 1
examples/js/postprocessing/SMAAPass.js

@@ -31,9 +31,11 @@ THREE.SMAAPass = function ( width, height ) {
 
 
 	var areaTextureImage = new Image();
 	var areaTextureImage = new Image();
 	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)
 		scope.areaTexture.needsUpdate = true;
 		scope.areaTexture.needsUpdate = true;
+
 	};
 	};
 
 
 	this.areaTexture = new THREE.Texture();
 	this.areaTexture = new THREE.Texture();

+ 1 - 1
examples/js/postprocessing/SSAARenderPass.js

@@ -100,7 +100,7 @@ THREE.SSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.protot
 			if ( this.camera.setViewOffset ) {
 			if ( this.camera.setViewOffset ) {
 
 
 				this.camera.setViewOffset( width, height,
 				this.camera.setViewOffset( width, height,
-					jitterOffset[ 0 ] * 0.0625, jitterOffset[ 1 ] * 0.0625,   // 0.0625 = 1 / 16
+					jitterOffset[ 0 ] * 0.0625, jitterOffset[ 1 ] * 0.0625, // 0.0625 = 1 / 16
 					width, height );
 					width, height );
 
 
 			}
 			}

+ 1 - 1
examples/js/postprocessing/ShaderPass.js

@@ -42,7 +42,7 @@ THREE.ShaderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
 
 
 	constructor: THREE.ShaderPass,
 	constructor: THREE.ShaderPass,
 
 
-	render: function( renderer, writeBuffer, readBuffer, deltaTime, maskActive ) {
+	render: function ( renderer, writeBuffer, readBuffer, deltaTime, maskActive ) {
 
 
 		if ( this.uniforms[ this.textureID ] ) {
 		if ( this.uniforms[ this.textureID ] ) {
 
 

+ 1 - 1
examples/js/postprocessing/TAARenderPass.js

@@ -88,7 +88,7 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.SSAARenderPa
 				if ( this.camera.setViewOffset ) {
 				if ( this.camera.setViewOffset ) {
 
 
 					this.camera.setViewOffset( readBuffer.width, readBuffer.height,
 					this.camera.setViewOffset( readBuffer.width, readBuffer.height,
-						jitterOffset[ 0 ] * 0.0625, jitterOffset[ 1 ] * 0.0625,   // 0.0625 = 1 / 16
+						jitterOffset[ 0 ] * 0.0625, jitterOffset[ 1 ] * 0.0625, // 0.0625 = 1 / 16
 						readBuffer.width, readBuffer.height );
 						readBuffer.width, readBuffer.height );
 
 
 				}
 				}

+ 1 - 1
examples/js/postprocessing/TexturePass.js

@@ -29,7 +29,7 @@ THREE.TexturePass = function ( map, opacity ) {
 	this.needsSwap = false;
 	this.needsSwap = false;
 
 
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
-	this.scene  = new THREE.Scene();
+	this.scene = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.quad.frustumCulled = false; // Avoid getting clipped

BIN
examples/textures/tri_pattern.jpg