@@ -33,7 +33,7 @@ class ProgressiveLightMap {
3333 this . warned = false ;
3434
3535 // Create the Progressive LightMap Texture
36- let format = / ( A n d r o i d | i P a d | i P h o n e | i P o d ) / g. test ( navigator . userAgent ) ? THREE . HalfFloatType : THREE . FloatType ;
36+ const format = / ( A n d r o i d | i P a d | i P h o n e | i P o d ) / g. test ( navigator . userAgent ) ? THREE . HalfFloatType : THREE . FloatType ;
3737 this . progressiveLightMap1 = new THREE . WebGLRenderTarget ( this . res , this . res , { type : format } ) ;
3838 this . progressiveLightMap2 = new THREE . WebGLRenderTarget ( this . res , this . res , { type : format } ) ;
3939
@@ -49,7 +49,7 @@ class ProgressiveLightMap {
4949 ' gl_Position = vec4((uv2 - 0.5) * 2.0, 1.0, 1.0); }' ;
5050
5151 // Fragment Shader: Set Pixels to average in the Previous frame's Shadows
52- let bodyStart = shader . fragmentShader . indexOf ( 'void main() {' ) ;
52+ const bodyStart = shader . fragmentShader . indexOf ( 'void main() {' ) ;
5353 shader . fragmentShader =
5454 'varying vec2 vUv2;\n' +
5555 shader . fragmentShader . slice ( 0 , bodyStart ) +
@@ -81,11 +81,11 @@ class ProgressiveLightMap {
8181 addObjectsToLightMap ( objects ) {
8282
8383 // Prepare list of UV bounding boxes for packing later...
84- this . uv_boxes = [ ] ; let padding = 3 / this . res ;
84+ this . uv_boxes = [ ] ; const padding = 3 / this . res ;
8585
8686 for ( let ob = 0 ; ob < objects . length ; ob ++ ) {
8787
88- let object = objects [ ob ] ;
88+ const object = objects [ ob ] ;
8989
9090 // If this object is a light, simply add it to the internal scene
9191 if ( object . isLight ) {
@@ -94,9 +94,9 @@ class ProgressiveLightMap {
9494
9595 }
9696
97- if ( ! object . geometry . hasAttribute ( "uv" ) ) {
97+ if ( ! object . geometry . hasAttribute ( 'uv' ) ) {
9898
99- console . warn ( " All lightmap objects need UVs!" ) ; continue ;
99+ console . warn ( ' All lightmap objects need UVs!' ) ; continue ;
100100
101101 }
102102
@@ -128,16 +128,16 @@ class ProgressiveLightMap {
128128 const dimensions = potpack ( this . uv_boxes ) ;
129129 this . uv_boxes . forEach ( ( box ) => {
130130
131- let uv2 = objects [ box . index ] . geometry . getAttribute ( "uv" ) . clone ( ) ;
131+ const uv2 = objects [ box . index ] . geometry . getAttribute ( 'uv' ) . clone ( ) ;
132132 for ( let i = 0 ; i < uv2 . array . length ; i += uv2 . itemSize ) {
133133
134134 uv2 . array [ i ] = ( uv2 . array [ i ] + box . x + padding ) / dimensions . w ;
135135 uv2 . array [ i + 1 ] = ( uv2 . array [ i + 1 ] + box . y + padding ) / dimensions . h ;
136136
137137 }
138138
139- objects [ box . index ] . geometry . setAttribute ( " uv2" , uv2 ) ;
140- objects [ box . index ] . geometry . getAttribute ( " uv2" ) . needsUpdate = true ;
139+ objects [ box . index ] . geometry . setAttribute ( ' uv2' , uv2 ) ;
140+ objects [ box . index ] . geometry . getAttribute ( ' uv2' ) . needsUpdate = true ;
141141
142142 } ) ;
143143
@@ -158,7 +158,7 @@ class ProgressiveLightMap {
158158 }
159159
160160 // Store the original Render Target
161- let oldTarget = this . renderer . getRenderTarget ( ) ;
161+ const oldTarget = this . renderer . getRenderTarget ( ) ;
162162
163163 // The blurring plane applies blur to the seams of the lightmap
164164 this . blurringPlane . visible = blurEdges ;
@@ -193,8 +193,8 @@ class ProgressiveLightMap {
193193 }
194194
195195 // Ping-pong two surface buffers for reading/writing
196- let activeMap = this . buffer1Active ? this . progressiveLightMap1 : this . progressiveLightMap2 ;
197- let inactiveMap = this . buffer1Active ? this . progressiveLightMap2 : this . progressiveLightMap1 ;
196+ const activeMap = this . buffer1Active ? this . progressiveLightMap1 : this . progressiveLightMap2 ;
197+ const inactiveMap = this . buffer1Active ? this . progressiveLightMap2 : this . progressiveLightMap1 ;
198198
199199 // Render the object's surface maps
200200 this . renderer . setRenderTarget ( activeMap ) ;
@@ -229,7 +229,7 @@ class ProgressiveLightMap {
229229
230230 if ( ! this . warned ) {
231231
232- console . warn ( " Call this after adding the objects!" ) ; this . warned = true ;
232+ console . warn ( ' Call this after adding the objects!' ) ; this . warned = true ;
233233
234234 }
235235
@@ -265,7 +265,7 @@ class ProgressiveLightMap {
265265 */
266266 _initializeBlurPlane ( res , lightMap = null ) {
267267
268- let blurMaterial = new THREE . MeshBasicMaterial ( ) ;
268+ const blurMaterial = new THREE . MeshBasicMaterial ( ) ;
269269 blurMaterial . uniforms = { previousShadowMap : { value : null } ,
270270 pixelOffset : { value : 1.0 / res } ,
271271 polygonOffset : true , polygonOffsetFactor : - 1 , polygonOffsetUnits : 3.0 } ;
@@ -278,18 +278,18 @@ class ProgressiveLightMap {
278278 ' gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }' ;
279279
280280 // Fragment Shader: Set Pixels to 9-tap box blur the current frame's Shadows
281- let bodyStart = shader . fragmentShader . indexOf ( 'void main() {' ) ;
281+ const bodyStart = shader . fragmentShader . indexOf ( 'void main() {' ) ;
282282 shader . fragmentShader =
283283 '#define USE_UV\n' +
284284 shader . fragmentShader . slice ( 0 , bodyStart ) +
285285 ' uniform sampler2D previousShadowMap;\n uniform float pixelOffset;\n' +
286286 shader . fragmentShader . slice ( bodyStart - 1 , - 1 ) +
287287 ` gl_FragColor.rgb = (
288- texture2D(previousShadowMap, vUv + vec2( pixelOffset, 0.0 )).rgb +
288+ texture2D(previousShadowMap, vUv + vec2( pixelOffset, 0.0 )).rgb +
289289 texture2D(previousShadowMap, vUv + vec2( 0.0 , pixelOffset)).rgb +
290290 texture2D(previousShadowMap, vUv + vec2( 0.0 , -pixelOffset)).rgb +
291291 texture2D(previousShadowMap, vUv + vec2(-pixelOffset, 0.0 )).rgb +
292- texture2D(previousShadowMap, vUv + vec2( pixelOffset, pixelOffset)).rgb +
292+ texture2D(previousShadowMap, vUv + vec2( pixelOffset, pixelOffset)).rgb +
293293 texture2D(previousShadowMap, vUv + vec2(-pixelOffset, pixelOffset)).rgb +
294294 texture2D(previousShadowMap, vUv + vec2( pixelOffset, -pixelOffset)).rgb +
295295 texture2D(previousShadowMap, vUv + vec2(-pixelOffset, -pixelOffset)).rgb)/8.0;
@@ -308,7 +308,7 @@ class ProgressiveLightMap {
308308 } ;
309309
310310 this . blurringPlane = new THREE . Mesh ( new THREE . PlaneBufferGeometry ( 1 , 1 ) , blurMaterial ) ;
311- this . blurringPlane . name = " Blurring Plane" ;
311+ this . blurringPlane . name = ' Blurring Plane' ;
312312 this . blurringPlane . frustumCulled = false ;
313313 this . blurringPlane . renderOrder = 0 ;
314314 this . blurringPlane . material . depthWrite = false ;
0 commit comments