Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up #24121

Merged
merged 2 commits into from
May 25, 2022
Merged

Clean up #24121

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
13 changes: 7 additions & 6 deletions docs/scenes/ccdiksolver-browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
Float32BufferAttribute,
MeshPhongMaterial,
PerspectiveCamera,
PointLight,
Scene,
SkinnedMesh,
Skeleton,
Expand Down Expand Up @@ -215,18 +214,18 @@
gui.add( mesh, 'pose' ).name( 'mesh.pose()' );

mesh.skeleton.bones
.filter((bone) => bone.name === "target")
.forEach(function (bone) {
.filter( ( bone ) => bone.name === "target" )
.forEach( function (bone) {
const folder = gui.addFolder( bone.name );

const delta = 20;
folder.add( bone.position, 'x', - delta + bone.position.x, delta + bone.position.x );
folder.add( bone.position, 'y', - bone.position.y, bone.position.y );
folder.add( bone.position, 'z', - delta + bone.position.z, delta + bone.position.z );
});
} );

gui.add( ikSolver, 'update' ).name( 'ikSolver.update()' );
gui.add( state, 'ikSolverAutoUpdate' )
gui.add( state, 'ikSolverAutoUpdate' );

}

Expand Down Expand Up @@ -258,7 +257,7 @@
{
target: 5,
effector: 4,
links: [{ index: 3 }, { index: 2 }, { index: 1 }]
links: [ { index: 3 }, { index: 2 }, { index: 1 } ]
}
];
ikSolver = new CCDIKSolver( mesh, iks );
Expand All @@ -271,7 +270,9 @@
requestAnimationFrame( render );

if ( state.ikSolverAutoUpdate ) {

ikSolver?.update();

}

renderer.render( scene, camera );
Expand Down
4 changes: 2 additions & 2 deletions editor/js/EditorControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ function EditorControls( object, domElement ) {

var closest = touches[ 0 ];

for ( var i in touches ) {
for ( var touch2 of touches ) {

if ( closest.distanceTo( touch ) > touches[ i ].distanceTo( touch ) ) closest = touches[ i ];
if ( closest.distanceTo( touch ) > touch2.distanceTo( touch ) ) closest = touch2;

}

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/animation/MMDPhysics.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class MMDPhysics {

let parent = mesh.parent;

if ( parent !== null ) parent = null;
if ( parent !== null ) mesh.parent = null;

const currentPosition = manager.allocThreeVector3();
const currentQuaternion = manager.allocThreeQuaternion();
Expand Down
27 changes: 7 additions & 20 deletions examples/jsm/effects/AsciiEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ class AsciiEffect {

// Some ASCII settings

const bResolution = ! options[ 'resolution' ] ? 0.15 : options[ 'resolution' ]; // Higher for more details
const iScale = ! options[ 'scale' ] ? 1 : options[ 'scale' ];
const bColor = ! options[ 'color' ] ? false : options[ 'color' ]; // nice but slows down rendering!
const bAlpha = ! options[ 'alpha' ] ? false : options[ 'alpha' ]; // Transparency
const bBlock = ! options[ 'block' ] ? false : options[ 'block' ]; // blocked characters. like good O dos
const bInvert = ! options[ 'invert' ] ? false : options[ 'invert' ]; // black is white, white is black

const strResolution = 'low';
const fResolution = options[ 'resolution' ] || 0.15; // Higher for more details
const iScale = options[ 'scale' ] || 1;
const bColor = options[ 'color' ] || false; // nice but slows down rendering!
const bAlpha = options[ 'alpha' ] || false; // Transparency
const bBlock = options[ 'block' ] || false; // blocked characters. like good O dos
const bInvert = options[ 'invert' ] || false; // black is white, white is black
const strResolution = options[ 'strResolution' ] || 'low';

let width, height;

Expand Down Expand Up @@ -122,18 +121,6 @@ class AsciiEffect {

if ( charSet ) aCharList = charSet;

let fResolution = 0.5;

switch ( strResolution ) {

case 'low' : fResolution = 0.25; break;
case 'medium' : fResolution = 0.5; break;
case 'high' : fResolution = 1; break;

}

if ( bResolution ) fResolution = bResolution;

// Setup dom

const fFontSize = ( 2 / fResolution ) * iScale;
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/loaders/DDSLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class DDSLoader extends CompressedTextureLoader {

}

if ( ! header[ off_pfFlags ] & DDPF_FOURCC ) {
if ( ! ( header[ off_pfFlags ] & DDPF_FOURCC ) ) {

console.error( 'THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code.' );
return dds;
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/loaders/FBXLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3564,6 +3564,8 @@ class BinaryParser {

}

break; // cannot happen but is required by the DeepScan

default:
throw new Error( 'THREE.FBXLoader: Unknown property type ' + type );

Expand Down
3 changes: 1 addition & 2 deletions examples/jsm/loaders/NRRDLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ class NRRDLoader extends Loader {

headerObject.isNrrd = true;

} else if ( l.match( /^#/ ) ) {
} else if ( m = l.match( /(.*):(.*)/ ) ) {
} else if ( ! l.match( /^#/ ) && ( m = l.match( /(.*):(.*)/ ) ) ) {

field = m[ 1 ].trim();
data = m[ 2 ].trim();
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/loaders/VOXLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class VOXLoader extends Loader {
}

const chunkSize = data.getUint32( i, true ); i += 4;
data.getUint32( i, true ); i += 4; // childChunks
i += 4; // childChunks

if ( id === 'SIZE' ) {

Expand Down
7 changes: 1 addition & 6 deletions examples/webgl_materials_instance_uniform_nodes.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@

update( frame ) {

const rendererState = frame.renderer.state;
const mesh = frame.object;

const meshColor = mesh.color;

this.uniformNode.value.copy( meshColor );
this.uniformNode.value.copy( frame.object.color );

}

Expand Down
2 changes: 0 additions & 2 deletions examples/webgpu_instance_uniform.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,6 @@

function render() {

const timer = 0.0001 * Date.now();

for ( let i = 0, l = objects.length; i < l; i ++ ) {

const object = objects[ i ];
Expand Down
2 changes: 1 addition & 1 deletion examples/webgpu_materials.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

import { TeapotGeometry } from './jsm/geometries/TeapotGeometry.js';

import { ShaderNode, vec3, dot, sampler } from 'three-nodes/Nodes.js';
import { ShaderNode, vec3, dot } from 'three-nodes/Nodes.js';

import Stats from './jsm/libs/stats.module.js';

Expand Down
22 changes: 1 addition & 21 deletions examples/webxr_vr_teleport.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
let INTERSECTION;
const tempMatrix = new THREE.Matrix4();

const clock = new THREE.Clock();

init();
animate();

Expand Down Expand Up @@ -84,7 +82,7 @@
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.xr.addEventListener( 'sessionstart', () => { baseReferenceSpace = renderer.xr.getReferenceSpace(); } )
renderer.xr.addEventListener( 'sessionstart', () => baseReferenceSpace = renderer.xr.getReferenceSpace() )
renderer.xr.enabled = true;
document.body.appendChild( renderer.domElement );

Expand Down Expand Up @@ -203,24 +201,6 @@

}

function handleController( controller ) {

if ( controller.userData.isSelecting ) {

const object = room.children[ count ++ ];

object.position.copy( controller.position );
object.userData.velocity.x = ( Math.random() - 0.5 ) * 3;
object.userData.velocity.y = ( Math.random() - 0.5 ) * 3;
object.userData.velocity.z = ( Math.random() - 9 );
object.userData.velocity.applyQuaternion( controller.quaternion );

if ( count === room.children.length ) count = 0;

}

}

//

function animate() {
Expand Down
30 changes: 15 additions & 15 deletions manual/resources/prettify.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ var prettyPrint;
var needToFoldCase = false;
var ignoreCase = false;
for (var i = 0, n = regexs.length; i < n; ++i) {
var regex = regexs[i];
const regex = regexs[i];
if (regex.ignoreCase) {
ignoreCase = true;
} else if (/[a-z]/i.test(regex.source.replace(
Expand Down Expand Up @@ -352,7 +352,7 @@ var prettyPrint;
var consolidatedRanges = [];
var lastRange = [];
for (var i = 0; i < ranges.length; ++i) {
var range = ranges[i];
const range = ranges[i];
if (range[0] <= lastRange[1] + 1) {
lastRange[1] = Math.max(lastRange[1], range[1]);
} else {
Expand All @@ -361,7 +361,7 @@ var prettyPrint;
}

for (var i = 0; i < consolidatedRanges.length; ++i) {
var range = consolidatedRanges[i];
const range = consolidatedRanges[i];
out.push(encodeEscape(range[0]));
if (range[1] > range[0]) {
if (range[1] + 1 > range[0]) { out.push('-'); }
Expand Down Expand Up @@ -398,13 +398,13 @@ var prettyPrint;

// Walk over and identify back references to build the capturedGroups
// mapping.
for (var i = 0, groupIndex = 0; i < n; ++i) {
for (let i = 0, groupIndex = 0; i < n; ++i) {
var p = parts[i];
if (p === '(') {
// groups are 1-indexed, so max group index is count of '('
++groupIndex;
} else if ('\\' === p.charAt(0)) {
var decimalValue = +p.substring(1);
const decimalValue = +p.substring(1);
if (decimalValue) {
if (decimalValue <= groupIndex) {
capturedGroups[decimalValue] = -1;
Expand All @@ -425,15 +425,15 @@ var prettyPrint;
capturedGroups[i] = ++capturedGroupIndex;
}
}
for (var i = 0, groupIndex = 0; i < n; ++i) {
for (let i = 0, groupIndex = 0; i < n; ++i) {
var p = parts[i];
if (p === '(') {
++groupIndex;
if (!capturedGroups[groupIndex]) {
parts[i] = '(?:';
}
} else if ('\\' === p.charAt(0)) {
var decimalValue = +p.substring(1);
const decimalValue = +p.substring(1);
if (decimalValue && decimalValue <= groupIndex) {
parts[i] = '\\' + capturedGroups[decimalValue];
}
Expand Down Expand Up @@ -471,7 +471,7 @@ var prettyPrint;

var rewritten = [];
for (var i = 0, n = regexs.length; i < n; ++i) {
var regex = regexs[i];
const regex = regexs[i];
if (regex.global || regex.multiline) { throw new Error('' + regex); }
rewritten.push(
'(?:' + allowAnywhereFoldCaseAndRenumberGroups(regex) + ')');
Expand Down Expand Up @@ -1104,21 +1104,21 @@ var prettyPrint;
}

var ol = document.createElement(opt_numberLines ? 'ol' : 'ul');
var classNames = [];
const classNames = [];
if (opt_numberLines) {
classNames.push('linenums');
}
if (opt_calloutModifiedLines) {
classNames.push('modifiedlines');
}
ol.className = classNames.join(" ");
var offset = Math.max(0, ((opt_startLineNum - 1 /* zero index */)) | 0) || 0;
var offset = Math.max(0, (opt_startLineNum - 1 /* zero index */) | 0) || 0;
for (var i = 0, n = listItems.length; i < n; ++i) {
li = listItems[i];
// Stick a class on the LIs so that stylesheets can
// color odd/even rows, or any other row pattern that
// is co-prime with 10.
var classNames = [];
const classNames = [];
if (opt_numberLines) {
classNames.push('L' + ((i + offset) % 10));
}
Expand Down Expand Up @@ -1217,7 +1217,7 @@ var prettyPrint;
var startPos = decorations[i];
// Conflate all adjacent decorations that use the same style.
var startDec = decorations[i + 1];
var end = i + 2;
let end = i + 2;
while (end + 2 <= nDecorations && decorations[end + 1] === startDec) {
end += 2;
}
Expand All @@ -1241,7 +1241,7 @@ var prettyPrint;

var decEnd = decorations[decorationIndex + 2] || sourceLength;

var end = Math.min(spanEnd, decEnd);
const end = Math.min(spanEnd, decEnd);

var textNode = spans[spanIndex + 1];
var styledText;
Expand Down Expand Up @@ -1686,9 +1686,9 @@ var prettyPrint;
IN_GLOBAL_SCOPE
? (win['prettyPrintOne'] = $prettyPrintOne)
: (prettyPrintOne = $prettyPrintOne),
'prettyPrint': prettyPrint =
'prettyPrint':
IN_GLOBAL_SCOPE
? (win['prettyPrint'] = $prettyPrint)
? (prettyPrint = win['prettyPrint'] = $prettyPrint)
: (prettyPrint = $prettyPrint)
};

Expand Down
2 changes: 1 addition & 1 deletion manual/resources/threejs-post-processing-3dlut.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
'[id$=-Input]',
'[id$=-Output]',
'[id$=-Result]',
].map((selector) => {
].forEach((selector) => {
[...svg.querySelectorAll('[id^=Effect]')].forEach((elem) => {
// because affinity designer doesn't export blend modes (T_T)
// and because I'd prefer not to have to manually fix things as I edit.
Expand Down
2 changes: 1 addition & 1 deletion manual/resources/tools/geo-picking/shapefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function ringContains(ring, point) {
if (segmentContains(pi, pj, point)) {
return 0;
}
if (((yi > y) !== (yj > y)) && ((x < (xj - xi) * (y - yi) / (yj - yi) + xi))) {
if (((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi)) {
contains = -contains;
}
}
Expand Down
10 changes: 0 additions & 10 deletions test/benchmark/core/Float32Array.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@

}

var inputVectors = [];
var outputVectors = [];

for ( var j = 0, jl = input.length / 3; j < jl; j ++ ) {

inputVectors.push( new THREE.Vector3( j * 3, j * 3 + 1, j * 3 + 2 ) );
outputVectors.push( new THREE.Vector3() );

}

var s = Bench.newSuite( 'Float 32 Arrays' );

s.add( 'Float32Array-Float32Array', function () {
Expand Down