瀏覽代碼

Clean up formatting

WestLangley 7 年之前
父節點
當前提交
bfd9631b5d
共有 2 個文件被更改,包括 16 次插入15 次删除
  1. 4 5
      examples/js/pmrem/PMREMCubeUVPacker.js
  2. 12 10
      examples/js/pmrem/PMREMGenerator.js

+ 4 - 5
examples/js/pmrem/PMREMCubeUVPacker.js

@@ -13,8 +13,7 @@
  * The arrangement of the faces is fixed, as assuming this arrangement, the sampling function has been written.
  */
 
-
-THREE.PMREMCubeUVPacker = function( cubeTextureLods, numLods ) {
+THREE.PMREMCubeUVPacker = function ( cubeTextureLods, numLods ) {
 
 	this.cubeLods = cubeTextureLods;
 	this.numLods = numLods;
@@ -83,8 +82,8 @@ THREE.PMREMCubeUVPacker = function( cubeTextureLods, numLods ) {
 				material.uniforms[ 'faceIndex' ].value = k;
 				material.uniforms[ 'mapSize' ].value = mipSize;
 				var planeMesh = new THREE.Mesh(
-				new THREE.PlaneGeometry( mipSize, mipSize, 0 ),
-				material );
+					new THREE.PlaneGeometry( mipSize, mipSize, 0 ),
+					material );
 				planeMesh.position.x = faceOffsets[ k ].x * mipSize - offset1 + mipOffsetX;
 				planeMesh.position.y = faceOffsets[ k ].y * mipSize - offset1 + offset2 + mipOffsetY;
 				planeMesh.material.side = THREE.DoubleSide;
@@ -115,7 +114,7 @@ THREE.PMREMCubeUVPacker.prototype = {
 		var toneMapping = renderer.toneMapping;
 		var toneMappingExposure = renderer.toneMappingExposure;
 		var currentRenderTarget = renderer.getRenderTarget();
-		
+
 		renderer.gammaInput = false;
 		renderer.gammaOutput = false;
 		renderer.toneMapping = THREE.LinearToneMapping;

+ 12 - 10
examples/js/pmrem/PMREMGenerator.js

@@ -11,7 +11,7 @@
  *	by this class.
  */
 
-THREE.PMREMGenerator = function( sourceTexture, samplesPerLevel, resolution ) {
+THREE.PMREMGenerator = function ( sourceTexture, samplesPerLevel, resolution ) {
 
 	this.sourceTexture = sourceTexture;
 	this.resolution = ( resolution !== undefined ) ? resolution : 256; // NODE: 256 is currently hard coded in the glsl code for performance reasons
@@ -38,7 +38,7 @@ THREE.PMREMGenerator = function( sourceTexture, samplesPerLevel, resolution ) {
 	 };
 
 	// how many LODs fit in the given CubeUV Texture.
-	this.numLods = Math.log( size ) / Math.log( 2 ) - 2;  // IE11 doesn't support Math.log2
+	this.numLods = Math.log( size ) / Math.log( 2 ) - 2; // IE11 doesn't support Math.log2
 
 	for ( var i = 0; i < this.numLods; i ++ ) {
 
@@ -52,7 +52,7 @@ THREE.PMREMGenerator = function( sourceTexture, samplesPerLevel, resolution ) {
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0.0, 1000 );
 
 	this.shader = this.getShader();
-	this.shader.defines['SAMPLES_PER_LEVEL'] = this.samplesPerLevel;
+	this.shader.defines[ 'SAMPLES_PER_LEVEL' ] = this.samplesPerLevel;
 	this.planeMesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2, 0 ), this.shader );
 	this.planeMesh.material.side = THREE.DoubleSide;
 	this.scene = new THREE.Scene();
@@ -66,7 +66,7 @@ THREE.PMREMGenerator = function( sourceTexture, samplesPerLevel, resolution ) {
 
 THREE.PMREMGenerator.prototype = {
 
-	constructor : THREE.PMREMGenerator,
+	constructor: THREE.PMREMGenerator,
 
 	/*
 	 * Prashant Sharma / spidersharma03: More thought and work is needed here.
@@ -81,7 +81,7 @@ THREE.PMREMGenerator.prototype = {
 	 * This method requires the most amount of thinking I guess. Here is a paper which we could try to implement in future::
 	 * http://http.developer.nvidia.com/GPUGems3/gpugems3_ch20.html
 	 */
-	update: function( renderer ) {
+	update: function ( renderer ) {
 
 		this.shader.uniforms[ 'envMap' ].value = this.sourceTexture;
 		this.shader.envMap = this.sourceTexture;
@@ -101,7 +101,7 @@ THREE.PMREMGenerator.prototype = {
 
 			var r = i / ( this.numLods - 1 );
 			this.shader.uniforms[ 'roughness' ].value = r * 0.9; // see comment above, pragmatic choice
-			this.shader.uniforms[ 'queryScale' ].value.x = ( i == 0 ) ? -1 : 1;
+			this.shader.uniforms[ 'queryScale' ].value.x = ( i == 0 ) ? - 1 : 1;
 			var size = this.cubeLods[ i ].width;
 			this.shader.uniforms[ 'mapSize' ].value = size;
 			this.renderToCubeMapTarget( renderer, this.cubeLods[ i ] );
@@ -118,17 +118,17 @@ THREE.PMREMGenerator.prototype = {
 
 	},
 
-	renderToCubeMapTarget: function( renderer, renderTarget ) {
+	renderToCubeMapTarget: function ( renderer, renderTarget ) {
 
 		for ( var i = 0; i < 6; i ++ ) {
 
-			this.renderToCubeMapTargetFace( renderer, renderTarget, i )
+			this.renderToCubeMapTargetFace( renderer, renderTarget, i );
 
 		}
 
 	},
 
-	renderToCubeMapTargetFace: function( renderer, renderTarget, faceIndex ) {
+	renderToCubeMapTargetFace: function ( renderer, renderTarget, faceIndex ) {
 
 		renderTarget.activeCubeFace = faceIndex;
 		this.shader.uniforms[ 'faceIndex' ].value = faceIndex;
@@ -136,7 +136,7 @@ THREE.PMREMGenerator.prototype = {
 
 	},
 
-	getShader: function() {
+	getShader: function () {
 
 		return new THREE.ShaderMaterial( {
 
@@ -258,12 +258,14 @@ THREE.PMREMGenerator.prototype = {
 					//rgbColor = testColorMap( roughness ).rgb;\n\
 					gl_FragColor = linearToOutputTexel( vec4( rgbColor, 1.0 ) );\n\
 				}",
+
 			blending: THREE.CustomBlending,
 			blendSrc: THREE.OneFactor,
 			blendDst: THREE.ZeroFactor,
 			blendSrcAlpha: THREE.OneFactor,
 			blendDstAlpha: THREE.ZeroFactor,
 			blendEquation: THREE.AddEquation
+
 		} );
 
 	}