Skip to content

Commit 8904cb3

Browse files
authored
Merge pull request #13750 from WestLangley/dev-pmrem_cleanup
PMREM: Clean up
2 parents d00ee6b + bfd9631 commit 8904cb3

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

examples/js/pmrem/PMREMCubeUVPacker.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
* The arrangement of the faces is fixed, as assuming this arrangement, the sampling function has been written.
1414
*/
1515

16-
17-
THREE.PMREMCubeUVPacker = function( cubeTextureLods, numLods ) {
16+
THREE.PMREMCubeUVPacker = function ( cubeTextureLods, numLods ) {
1817

1918
this.cubeLods = cubeTextureLods;
2019
this.numLods = numLods;
@@ -83,8 +82,8 @@ THREE.PMREMCubeUVPacker = function( cubeTextureLods, numLods ) {
8382
material.uniforms[ 'faceIndex' ].value = k;
8483
material.uniforms[ 'mapSize' ].value = mipSize;
8584
var planeMesh = new THREE.Mesh(
86-
new THREE.PlaneGeometry( mipSize, mipSize, 0 ),
87-
material );
85+
new THREE.PlaneGeometry( mipSize, mipSize, 0 ),
86+
material );
8887
planeMesh.position.x = faceOffsets[ k ].x * mipSize - offset1 + mipOffsetX;
8988
planeMesh.position.y = faceOffsets[ k ].y * mipSize - offset1 + offset2 + mipOffsetY;
9089
planeMesh.material.side = THREE.DoubleSide;
@@ -115,7 +114,7 @@ THREE.PMREMCubeUVPacker.prototype = {
115114
var toneMapping = renderer.toneMapping;
116115
var toneMappingExposure = renderer.toneMappingExposure;
117116
var currentRenderTarget = renderer.getRenderTarget();
118-
117+
119118
renderer.gammaInput = false;
120119
renderer.gammaOutput = false;
121120
renderer.toneMapping = THREE.LinearToneMapping;

examples/js/pmrem/PMREMGenerator.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* by this class.
1212
*/
1313

14-
THREE.PMREMGenerator = function( sourceTexture, samplesPerLevel, resolution ) {
14+
THREE.PMREMGenerator = function ( sourceTexture, samplesPerLevel, resolution ) {
1515

1616
this.sourceTexture = sourceTexture;
1717
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 ) {
3838
};
3939

4040
// how many LODs fit in the given CubeUV Texture.
41-
this.numLods = Math.log( size ) / Math.log( 2 ) - 2; // IE11 doesn't support Math.log2
41+
this.numLods = Math.log( size ) / Math.log( 2 ) - 2; // IE11 doesn't support Math.log2
4242

4343
for ( var i = 0; i < this.numLods; i ++ ) {
4444

@@ -52,7 +52,7 @@ THREE.PMREMGenerator = function( sourceTexture, samplesPerLevel, resolution ) {
5252
this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0.0, 1000 );
5353

5454
this.shader = this.getShader();
55-
this.shader.defines['SAMPLES_PER_LEVEL'] = this.samplesPerLevel;
55+
this.shader.defines[ 'SAMPLES_PER_LEVEL' ] = this.samplesPerLevel;
5656
this.planeMesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2, 0 ), this.shader );
5757
this.planeMesh.material.side = THREE.DoubleSide;
5858
this.scene = new THREE.Scene();
@@ -66,7 +66,7 @@ THREE.PMREMGenerator = function( sourceTexture, samplesPerLevel, resolution ) {
6666

6767
THREE.PMREMGenerator.prototype = {
6868

69-
constructor : THREE.PMREMGenerator,
69+
constructor: THREE.PMREMGenerator,
7070

7171
/*
7272
* Prashant Sharma / spidersharma03: More thought and work is needed here.
@@ -81,7 +81,7 @@ THREE.PMREMGenerator.prototype = {
8181
* This method requires the most amount of thinking I guess. Here is a paper which we could try to implement in future::
8282
* http://http.developer.nvidia.com/GPUGems3/gpugems3_ch20.html
8383
*/
84-
update: function( renderer ) {
84+
update: function ( renderer ) {
8585

8686
this.shader.uniforms[ 'envMap' ].value = this.sourceTexture;
8787
this.shader.envMap = this.sourceTexture;
@@ -101,7 +101,7 @@ THREE.PMREMGenerator.prototype = {
101101

102102
var r = i / ( this.numLods - 1 );
103103
this.shader.uniforms[ 'roughness' ].value = r * 0.9; // see comment above, pragmatic choice
104-
this.shader.uniforms[ 'queryScale' ].value.x = ( i == 0 ) ? -1 : 1;
104+
this.shader.uniforms[ 'queryScale' ].value.x = ( i == 0 ) ? - 1 : 1;
105105
var size = this.cubeLods[ i ].width;
106106
this.shader.uniforms[ 'mapSize' ].value = size;
107107
this.renderToCubeMapTarget( renderer, this.cubeLods[ i ] );
@@ -118,25 +118,25 @@ THREE.PMREMGenerator.prototype = {
118118

119119
},
120120

121-
renderToCubeMapTarget: function( renderer, renderTarget ) {
121+
renderToCubeMapTarget: function ( renderer, renderTarget ) {
122122

123123
for ( var i = 0; i < 6; i ++ ) {
124124

125-
this.renderToCubeMapTargetFace( renderer, renderTarget, i )
125+
this.renderToCubeMapTargetFace( renderer, renderTarget, i );
126126

127127
}
128128

129129
},
130130

131-
renderToCubeMapTargetFace: function( renderer, renderTarget, faceIndex ) {
131+
renderToCubeMapTargetFace: function ( renderer, renderTarget, faceIndex ) {
132132

133133
renderTarget.activeCubeFace = faceIndex;
134134
this.shader.uniforms[ 'faceIndex' ].value = faceIndex;
135135
renderer.render( this.scene, this.camera, renderTarget, true );
136136

137137
},
138138

139-
getShader: function() {
139+
getShader: function () {
140140

141141
return new THREE.ShaderMaterial( {
142142

@@ -258,12 +258,14 @@ THREE.PMREMGenerator.prototype = {
258258
//rgbColor = testColorMap( roughness ).rgb;\n\
259259
gl_FragColor = linearToOutputTexel( vec4( rgbColor, 1.0 ) );\n\
260260
}",
261+
261262
blending: THREE.CustomBlending,
262263
blendSrc: THREE.OneFactor,
263264
blendDst: THREE.ZeroFactor,
264265
blendSrcAlpha: THREE.OneFactor,
265266
blendDstAlpha: THREE.ZeroFactor,
266267
blendEquation: THREE.AddEquation
268+
267269
} );
268270

269271
}

0 commit comments

Comments
 (0)