Skip to content

Commit 8a02b1b

Browse files
authored
Examples: Clean up. (#21482)
1 parent 024cfe8 commit 8a02b1b

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

examples/js/loaders/SVGLoader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ THREE.SVGLoader.createShapes = function ( shapePath ) {
16341634
const classifyResult = {
16351635
loc: IntersectionLocationType.ORIGIN,
16361636
t: 0
1637-
}
1637+
};
16381638

16391639
function findEdgeIntersection( a0, a1, b0, b1 ) {
16401640

@@ -1796,7 +1796,7 @@ THREE.SVGLoader.createShapes = function ( shapePath ) {
17961796

17971797
const intersection = findEdgeIntersection( path1EdgeStart, path1EdgeEnd, path2EdgeStart, path2EdgeEnd );
17981798

1799-
if ( intersection !== null && intersectionsRaw.find(i => i.t <= intersection.t + Number.EPSILON && i.t >= intersection.t - Number.EPSILON) === undefined ) {
1799+
if ( intersection !== null && intersectionsRaw.find( i => i.t <= intersection.t + Number.EPSILON && i.t >= intersection.t - Number.EPSILON ) === undefined ) {
18001800

18011801
intersectionsRaw.push( intersection );
18021802
intersections.push( new THREE.Vector2( intersection.x, intersection.y ) );

examples/jsm/loaders/SVGLoader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,7 @@ SVGLoader.createShapes = function ( shapePath ) {
16491649
const classifyResult = {
16501650
loc: IntersectionLocationType.ORIGIN,
16511651
t: 0
1652-
}
1652+
};
16531653

16541654
function findEdgeIntersection( a0, a1, b0, b1 ) {
16551655

@@ -1811,7 +1811,7 @@ SVGLoader.createShapes = function ( shapePath ) {
18111811

18121812
const intersection = findEdgeIntersection( path1EdgeStart, path1EdgeEnd, path2EdgeStart, path2EdgeEnd );
18131813

1814-
if ( intersection !== null && intersectionsRaw.find(i => i.t <= intersection.t + Number.EPSILON && i.t >= intersection.t - Number.EPSILON) === undefined ) {
1814+
if ( intersection !== null && intersectionsRaw.find( i => i.t <= intersection.t + Number.EPSILON && i.t >= intersection.t - Number.EPSILON ) === undefined ) {
18151815

18161816
intersectionsRaw.push( intersection );
18171817
intersections.push( new Vector2( intersection.x, intersection.y ) );

examples/jsm/misc/ProgressiveLightMap.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ProgressiveLightMap {
3333
this.warned = false;
3434

3535
// Create the Progressive LightMap Texture
36-
let format = /(Android|iPad|iPhone|iPod)/g.test( navigator.userAgent ) ? THREE.HalfFloatType : THREE.FloatType;
36+
const format = /(Android|iPad|iPhone|iPod)/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

Comments
 (0)