Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/js/loaders/SVGLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ THREE.SVGLoader.createShapes = function ( shapePath ) {
const classifyResult = {
loc: IntersectionLocationType.ORIGIN,
t: 0
}
};

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

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

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

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

intersectionsRaw.push( intersection );
intersections.push( new THREE.Vector2( intersection.x, intersection.y ) );
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/loaders/SVGLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ SVGLoader.createShapes = function ( shapePath ) {
const classifyResult = {
loc: IntersectionLocationType.ORIGIN,
t: 0
}
};

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

Expand Down Expand Up @@ -1811,7 +1811,7 @@ SVGLoader.createShapes = function ( shapePath ) {

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

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

intersectionsRaw.push( intersection );
intersections.push( new Vector2( intersection.x, intersection.y ) );
Expand Down
36 changes: 18 additions & 18 deletions examples/jsm/misc/ProgressiveLightMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ProgressiveLightMap {
this.warned = false;

// Create the Progressive LightMap Texture
let format = /(Android|iPad|iPhone|iPod)/g.test( navigator.userAgent ) ? THREE.HalfFloatType : THREE.FloatType;
const format = /(Android|iPad|iPhone|iPod)/g.test( navigator.userAgent ) ? THREE.HalfFloatType : THREE.FloatType;
this.progressiveLightMap1 = new THREE.WebGLRenderTarget( this.res, this.res, { type: format } );
this.progressiveLightMap2 = new THREE.WebGLRenderTarget( this.res, this.res, { type: format } );

Expand All @@ -49,7 +49,7 @@ class ProgressiveLightMap {
' gl_Position = vec4((uv2 - 0.5) * 2.0, 1.0, 1.0); }';

// Fragment Shader: Set Pixels to average in the Previous frame's Shadows
let bodyStart = shader.fragmentShader.indexOf( 'void main() {' );
const bodyStart = shader.fragmentShader.indexOf( 'void main() {' );
shader.fragmentShader =
'varying vec2 vUv2;\n' +
shader.fragmentShader.slice( 0, bodyStart ) +
Expand Down Expand Up @@ -81,11 +81,11 @@ class ProgressiveLightMap {
addObjectsToLightMap( objects ) {

// Prepare list of UV bounding boxes for packing later...
this.uv_boxes = []; let padding = 3 / this.res;
this.uv_boxes = []; const padding = 3 / this.res;

for ( let ob = 0; ob < objects.length; ob ++ ) {

let object = objects[ ob ];
const object = objects[ ob ];

// If this object is a light, simply add it to the internal scene
if ( object.isLight ) {
Expand All @@ -94,9 +94,9 @@ class ProgressiveLightMap {

}

if ( ! object.geometry.hasAttribute( "uv" ) ) {
if ( ! object.geometry.hasAttribute( 'uv' ) ) {

console.warn( "All lightmap objects need UVs!" ); continue;
console.warn( 'All lightmap objects need UVs!' ); continue;

}

Expand Down Expand Up @@ -128,16 +128,16 @@ class ProgressiveLightMap {
const dimensions = potpack( this.uv_boxes );
this.uv_boxes.forEach( ( box ) => {

let uv2 = objects[ box.index ].geometry.getAttribute( "uv" ).clone();
const uv2 = objects[ box.index ].geometry.getAttribute( 'uv' ).clone();
for ( let i = 0; i < uv2.array.length; i += uv2.itemSize ) {

uv2.array[ i ] = ( uv2.array[ i ] + box.x + padding ) / dimensions.w;
uv2.array[ i + 1 ] = ( uv2.array[ i + 1 ] + box.y + padding ) / dimensions.h;

}

objects[ box.index ].geometry.setAttribute( "uv2", uv2 );
objects[ box.index ].geometry.getAttribute( "uv2" ).needsUpdate = true;
objects[ box.index ].geometry.setAttribute( 'uv2', uv2 );
objects[ box.index ].geometry.getAttribute( 'uv2' ).needsUpdate = true;

} );

Expand All @@ -158,7 +158,7 @@ class ProgressiveLightMap {
}

// Store the original Render Target
let oldTarget = this.renderer.getRenderTarget();
const oldTarget = this.renderer.getRenderTarget();

// The blurring plane applies blur to the seams of the lightmap
this.blurringPlane.visible = blurEdges;
Expand Down Expand Up @@ -193,8 +193,8 @@ class ProgressiveLightMap {
}

// Ping-pong two surface buffers for reading/writing
let activeMap = this.buffer1Active ? this.progressiveLightMap1 : this.progressiveLightMap2;
let inactiveMap = this.buffer1Active ? this.progressiveLightMap2 : this.progressiveLightMap1;
const activeMap = this.buffer1Active ? this.progressiveLightMap1 : this.progressiveLightMap2;
const inactiveMap = this.buffer1Active ? this.progressiveLightMap2 : this.progressiveLightMap1;

// Render the object's surface maps
this.renderer.setRenderTarget( activeMap );
Expand Down Expand Up @@ -229,7 +229,7 @@ class ProgressiveLightMap {

if ( ! this.warned ) {

console.warn( "Call this after adding the objects!" ); this.warned = true;
console.warn( 'Call this after adding the objects!' ); this.warned = true;

}

Expand Down Expand Up @@ -265,7 +265,7 @@ class ProgressiveLightMap {
*/
_initializeBlurPlane( res, lightMap = null ) {

let blurMaterial = new THREE.MeshBasicMaterial();
const blurMaterial = new THREE.MeshBasicMaterial();
blurMaterial.uniforms = { previousShadowMap: { value: null },
pixelOffset: { value: 1.0 / res },
polygonOffset: true, polygonOffsetFactor: - 1, polygonOffsetUnits: 3.0 };
Expand All @@ -278,18 +278,18 @@ class ProgressiveLightMap {
' gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }';

// Fragment Shader: Set Pixels to 9-tap box blur the current frame's Shadows
let bodyStart = shader.fragmentShader.indexOf( 'void main() {' );
const bodyStart = shader.fragmentShader.indexOf( 'void main() {' );
shader.fragmentShader =
'#define USE_UV\n' +
shader.fragmentShader.slice( 0, bodyStart ) +
' uniform sampler2D previousShadowMap;\n uniform float pixelOffset;\n' +
shader.fragmentShader.slice( bodyStart - 1, - 1 ) +
` gl_FragColor.rgb = (
texture2D(previousShadowMap, vUv + vec2( pixelOffset, 0.0 )).rgb +
texture2D(previousShadowMap, vUv + vec2( pixelOffset, 0.0 )).rgb +
texture2D(previousShadowMap, vUv + vec2( 0.0 , pixelOffset)).rgb +
texture2D(previousShadowMap, vUv + vec2( 0.0 , -pixelOffset)).rgb +
texture2D(previousShadowMap, vUv + vec2(-pixelOffset, 0.0 )).rgb +
texture2D(previousShadowMap, vUv + vec2( pixelOffset, pixelOffset)).rgb +
texture2D(previousShadowMap, vUv + vec2( pixelOffset, pixelOffset)).rgb +
texture2D(previousShadowMap, vUv + vec2(-pixelOffset, pixelOffset)).rgb +
texture2D(previousShadowMap, vUv + vec2( pixelOffset, -pixelOffset)).rgb +
texture2D(previousShadowMap, vUv + vec2(-pixelOffset, -pixelOffset)).rgb)/8.0;
Expand All @@ -308,7 +308,7 @@ class ProgressiveLightMap {
};

this.blurringPlane = new THREE.Mesh( new THREE.PlaneBufferGeometry( 1, 1 ), blurMaterial );
this.blurringPlane.name = "Blurring Plane";
this.blurringPlane.name = 'Blurring Plane';
this.blurringPlane.frustumCulled = false;
this.blurringPlane.renderOrder = 0;
this.blurringPlane.material.depthWrite = false;
Expand Down