diff --git a/examples/js/pmrem/PMREMCubeUVPacker.js b/examples/js/pmrem/PMREMCubeUVPacker.js index 9c6b93a484547202464754cb93ec9d57b3109309..7ee0cf8fc430814cebdfc0298c75a9cfc4554be0 100644 --- a/examples/js/pmrem/PMREMCubeUVPacker.js +++ b/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; diff --git a/examples/js/pmrem/PMREMGenerator.js b/examples/js/pmrem/PMREMGenerator.js index 30b26922b3536dcfd7a0aa87fad28e69df86609d..75b623900c5de637f050b59cf924c6963c0951a5 100644 --- a/examples/js/pmrem/PMREMGenerator.js +++ b/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 + } ); }