Ver Fonte

Examples: Clean up.

Mugen87 há 4 anos atrás
pai
commit
bd850dc3d5

+ 5 - 3
examples/js/loaders/SVGLoader.js

@@ -123,11 +123,13 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 						parseNode( usedNode, style );
 
+					} else {
+
+						console.warn( "SVGLoader: 'use node' references non-existent node id: " + usedNodeId );
+
 					}
-					else console.warn( "SVGLoader: 'use node' references non-existent node id: " + usedNodeId );
-					break;
 
-				break;
+					break;
 
 				default:
 					// console.log( node );

+ 2 - 2
examples/jsm/csm/CSM.js

@@ -321,8 +321,8 @@ export class CSM {
 
 		for ( let i = 0; i < this.cascades; i ++ ) {
 
-			let amount = this.breaks[ i ];
-			let prev = this.breaks[ i - 1 ] || 0;
+			const amount = this.breaks[ i ];
+			const prev = this.breaks[ i - 1 ] || 0;
 			target[ i ].x = prev;
 			target[ i ].y = amount;
 

+ 11 - 11
examples/jsm/loaders/OBJLoader2.js

@@ -32,8 +32,8 @@ const OBJLoader2 = function ( manager ) {
 	this.meshReceiver = new MeshReceiver( this.materialHandler );
 
 	// as OBJLoader2 is no longer derived from OBJLoader2Parser, we need to override the default onAssetAvailable callback
-	let scope = this;
-	let defaultOnAssetAvailable = function ( payload ) {
+	const scope = this;
+	const defaultOnAssetAvailable = function ( payload ) {
 
 		scope._onAssetAvailable( payload );
 
@@ -227,10 +227,10 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
 	 */
 	load: function ( url, onLoad, onFileLoadProgress, onError, onMeshAlter ) {
 
-		let scope = this;
+		const scope = this;
 		if ( onLoad === null || onLoad === undefined || ! ( onLoad instanceof Function ) ) {
 
-			let errorMessage = 'onLoad is not a function! Aborting...';
+			const errorMessage = 'onLoad is not a function! Aborting...';
 			scope.parser.callbacks.onError( errorMessage );
 			throw errorMessage;
 
@@ -264,9 +264,9 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		}
 
-		let urlFull = new URL( url, window.location.href ).href;
+		const urlFull = new URL( url, window.location.href ).href;
 		let filename = urlFull;
-		let urlParts = urlFull.split( '/' );
+		const urlParts = urlFull.split( '/' );
 		if ( urlParts.length > 2 ) {
 
 			filename = urlParts[ urlParts.length - 1 ];
@@ -287,7 +287,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
 				if ( numericalValue > numericalValueRef ) {
 
 					numericalValueRef = numericalValue;
-					let output = 'Download of "' + url + '": ' + ( numericalValue * 100 ).toFixed( 2 ) + '%';
+					const output = 'Download of "' + url + '": ' + ( numericalValue * 100 ).toFixed( 2 ) + '%';
 					scope.parser.callbacks.onProgress( 'progressLoad', output, numericalValue );
 
 				}
@@ -297,13 +297,13 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
 		}
 
 		this.setCallbackOnMeshAlter( onMeshAlter );
-		let fileLoaderOnLoad = function ( content ) {
+		const fileLoaderOnLoad = function ( content ) {
 
 			scope.parser.callbacks.onLoad( scope.parse( content ), "OBJLoader2#load: Parsing completed" );
 
 		};
 
-		let fileLoader = new FileLoader( this.manager );
+		const fileLoader = new FileLoader( this.manager );
 		fileLoader.setPath( this.path || this.resourcePath );
 		fileLoader.setResponseType( 'arraybuffer' );
 		fileLoader.load( filename, fileLoaderOnLoad, onFileLoadProgress, onError );
@@ -369,8 +369,8 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		if ( payload.type === 'mesh' ) {
 
-			let meshes = this.meshReceiver.buildMeshes( payload );
-			for ( let mesh of meshes ) {
+			const meshes = this.meshReceiver.buildMeshes( payload );
+			for ( const mesh of meshes ) {
 
 				this.baseObject3d.add( mesh );
 

+ 9 - 9
examples/jsm/loaders/OBJLoader2Parallel.js

@@ -99,7 +99,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
 	 */
 	buildWorkerCode: function () {
 
-		let codeBuilderInstructions = new CodeBuilderInstructions( true, true, this.preferJsmWorker );
+		const codeBuilderInstructions = new CodeBuilderInstructions( true, true, this.preferJsmWorker );
 
 		if ( codeBuilderInstructions.isSupportsJsmWorker() ) {
 
@@ -109,15 +109,15 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
 
 		if ( codeBuilderInstructions.isSupportsStandardWorker() ) {
 
-			let objectManipulator = new ObjectManipulator();
-			let defaultWorkerPayloadHandler = new DefaultWorkerPayloadHandler( this.parser );
-			let workerRunner = new WorkerRunner( {} );
+			const objectManipulator = new ObjectManipulator();
+			const defaultWorkerPayloadHandler = new DefaultWorkerPayloadHandler( this.parser );
+			const workerRunner = new WorkerRunner( {} );
 			codeBuilderInstructions.addCodeFragment( CodeSerializer.serializeClass( OBJLoader2Parser, this.parser ) );
 			codeBuilderInstructions.addCodeFragment( CodeSerializer.serializeClass( ObjectManipulator, objectManipulator ) );
 			codeBuilderInstructions.addCodeFragment( CodeSerializer.serializeClass( DefaultWorkerPayloadHandler, defaultWorkerPayloadHandler ) );
 			codeBuilderInstructions.addCodeFragment( CodeSerializer.serializeClass( WorkerRunner, workerRunner ) );
 
-			let startCode = 'new ' + workerRunner.constructor.name + '( new ' + defaultWorkerPayloadHandler.constructor.name + '( new ' + this.parser.constructor.name + '() ) );';
+			const startCode = 'new ' + workerRunner.constructor.name + '( new ' + defaultWorkerPayloadHandler.constructor.name + '( new ' + this.parser.constructor.name + '() ) );';
 			codeBuilderInstructions.addStartCode( startCode );
 
 		}
@@ -131,7 +131,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
 	 */
 	load: function ( content, onLoad, onFileLoadProgress, onError, onMeshAlter ) {
 
- 		let scope = this;
+ 		const scope = this;
 		function interceptOnLoad( object3d, message ) {
 
 			if ( object3d.name === 'OBJLoader2ParallelDummy' ) {
@@ -174,8 +174,8 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
 
 				this.workerExecutionSupport.buildWorker( this.buildWorkerCode() );
 
-				let scope = this;
-				let scopedOnAssetAvailable = function ( payload ) {
+				const scope = this;
+				const scopedOnAssetAvailable = function ( payload ) {
 
 					scope._onAssetAvailable( payload );
 
@@ -215,7 +215,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
 					}
 				} );
 
-			let dummy = new Object3D();
+			const dummy = new Object3D();
 			dummy.name = 'OBJLoader2ParallelDummy';
 			return dummy;
 

+ 5 - 3
examples/jsm/loaders/SVGLoader.js

@@ -133,11 +133,13 @@ SVGLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 						parseNode( usedNode, style );
 
+					} else {
+
+						console.warn( "SVGLoader: 'use node' references non-existent node id: " + usedNodeId );
+
 					}
-					else console.warn( "SVGLoader: 'use node' references non-existent node id: " + usedNodeId );
-					break;
 
-				break;
+					break;
 
 				default:
 					// console.log( node );

+ 2 - 2
examples/jsm/loaders/VOXLoader.d.ts

@@ -7,7 +7,7 @@ export class VOXLoader extends Loader {
 
 	constructor( manager?: LoadingManager );
 
-	load( url: string, onLoad: ( chunks: Array ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
-	parse( data: ArrayBuffer ): Array;
+	load( url: string, onLoad: ( chunks: Array<object> ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ): void;
+	parse( data: ArrayBuffer ): Array<object>;
 
 }

+ 51 - 51
examples/jsm/loaders/obj2/OBJLoader2Parser.js

@@ -12,7 +12,7 @@ const OBJLoader2Parser = function () {
 		debug: false
 	};
 
-	let scope = this;
+	const scope = this;
 	this.callbacks = {
 		onProgress: function ( text ) {
 
@@ -250,7 +250,7 @@ OBJLoader2Parser.prototype = {
 	 */
 	_onProgress: function ( text ) {
 
-		let message = text ? text : '';
+		const message = text ? text : '';
 		if ( this.logging.enabled && this.logging.debug ) {
 
 			console.log( message );
@@ -275,9 +275,9 @@ OBJLoader2Parser.prototype = {
 
 	},
 
-	_onAssetAvailable: function ( payload ) {
+	_onAssetAvailable: function ( /*payload*/ ) {
 
-		let errorMessage = 'OBJLoader2Parser does not provide implementation for onAssetAvailable. Aborting...';
+		const errorMessage = 'OBJLoader2Parser does not provide implementation for onAssetAvailable. Aborting...';
 		this.callbacks.onError( errorMessage );
 		throw errorMessage;
 
@@ -310,8 +310,8 @@ OBJLoader2Parser.prototype = {
 		this._pushSmoothingGroup( 1 );
 		if ( this.logging.enabled ) {
 
-			let matKeys = Object.keys( this.materials );
-			let matNames = ( matKeys.length > 0 ) ? '\n\tmaterialNames:\n\t\t- ' + matKeys.join( '\n\t\t- ' ) : '\n\tmaterialNames: None';
+			const matKeys = Object.keys( this.materials );
+			const matNames = ( matKeys.length > 0 ) ? '\n\tmaterialNames:\n\t\t- ' + matKeys.join( '\n\t\t- ' ) : '\n\tmaterialNames: None';
 			let printedConfig = 'OBJLoader.Parser configuration:'
 				+ matNames
 				+ '\n\tmaterialPerSmoothingGroup: ' + this.materialPerSmoothingGroup
@@ -337,17 +337,17 @@ OBJLoader2Parser.prototype = {
 		if ( this.logging.enabled ) console.time( 'OBJLoader2Parser.execute' );
 		this._configure();
 
-		let arrayBufferView = new Uint8Array( arrayBuffer );
+		const arrayBufferView = new Uint8Array( arrayBuffer );
 		this.contentRef = arrayBufferView;
-		let length = arrayBufferView.byteLength;
+		const length = arrayBufferView.byteLength;
 		this.globalCounts.totalBytes = length;
-		let buffer = new Array( 128 );
+		const buffer = new Array( 128 );
 
 		let bufferPointer = 0;
 		let slashesCount = 0;
 		let word = '';
 		let currentByte = 0;
-		for ( let code, currentByte = 0; currentByte < length; currentByte ++ ) {
+		for ( let code; currentByte < length; currentByte ++ ) {
 
 			code = arrayBufferView[ currentByte ];
 			switch ( code ) {
@@ -401,9 +401,9 @@ OBJLoader2Parser.prototype = {
 		this._configure();
 		this.legacyMode = true;
 		this.contentRef = text;
-		let length = text.length;
+		const length = text.length;
 		this.globalCounts.totalBytes = length;
-		let buffer = new Array( 128 );
+		const buffer = new Array( 128 );
 
 		let bufferPointer = 0;
 		let slashesCount = 0;
@@ -456,7 +456,7 @@ OBJLoader2Parser.prototype = {
 
 		if ( word.length > 0 ) buffer[ bufferPointer ++ ] = word;
 
-		let reconstructString = function ( content, legacyMode, start, stop ) {
+		const reconstructString = function ( content, legacyMode, start, stop ) {
 
 			let line = '';
 			if ( stop > start ) {
@@ -481,8 +481,8 @@ OBJLoader2Parser.prototype = {
 
 		};
 
-		let bufferLength, length, i, lineDesignation;
-		lineDesignation = buffer[ 0 ];
+		let bufferLength, length, i;
+		const lineDesignation = buffer[ 0 ];
 		switch ( lineDesignation ) {
 
 			case 'v':
@@ -606,7 +606,7 @@ OBJLoader2Parser.prototype = {
 				break;
 
 			case 'usemtl':
-				let mtlName = reconstructString( this.contentRef, this.legacyMode, this.globalCounts.lineByte + 7, this.globalCounts.currentByte );
+				const mtlName = reconstructString( this.contentRef, this.legacyMode, this.globalCounts.lineByte + 7, this.globalCounts.currentByte );
 				if ( mtlName !== '' && this.rawMesh.activeMtlName !== mtlName ) {
 
 					this.rawMesh.activeMtlName = mtlName;
@@ -633,7 +633,7 @@ OBJLoader2Parser.prototype = {
 
 		}
 
-		let smoothCheck = this.rawMesh.smoothingGroup.normalized;
+		const smoothCheck = this.rawMesh.smoothingGroup.normalized;
 		this.rawMesh.smoothingGroup.normalized = this.rawMesh.smoothingGroup.splitMaterials ? smoothingGroupInt : ( smoothingGroupInt === 0 ) ? 0 : 1;
 		this.rawMesh.smoothingGroup.real = smoothingGroupInt;
 
@@ -670,7 +670,7 @@ OBJLoader2Parser.prototype = {
 
 	_checkSubGroup: function () {
 
-		let index = this.rawMesh.activeMtlName + '|' + this.rawMesh.smoothingGroup.normalized;
+		const index = this.rawMesh.activeMtlName + '|' + this.rawMesh.smoothingGroup.normalized;
 		this.rawMesh.subGroupInUse = this.rawMesh.subGroups[ index ];
 
 		if ( this.rawMesh.subGroupInUse === undefined || this.rawMesh.subGroupInUse === null ) {
@@ -697,22 +697,22 @@ OBJLoader2Parser.prototype = {
 
 	_buildFace: function ( faceIndexV, faceIndexU, faceIndexN ) {
 
-		let subGroupInUse = this.rawMesh.subGroupInUse;
-		let scope = this;
-		let updateSubGroupInUse = function () {
+		const subGroupInUse = this.rawMesh.subGroupInUse;
+		const scope = this;
+		const updateSubGroupInUse = function () {
 
-			let faceIndexVi = parseInt( faceIndexV );
+			const faceIndexVi = parseInt( faceIndexV );
 			let indexPointerV = 3 * ( faceIndexVi > 0 ? faceIndexVi - 1 : faceIndexVi + scope.vertices.length / 3 );
 			let indexPointerC = scope.colors.length > 0 ? indexPointerV : null;
 
-			let vertices = subGroupInUse.vertices;
+			const vertices = subGroupInUse.vertices;
 			vertices.push( scope.vertices[ indexPointerV ++ ] );
 			vertices.push( scope.vertices[ indexPointerV ++ ] );
 			vertices.push( scope.vertices[ indexPointerV ] );
 
 			if ( indexPointerC !== null ) {
 
-				let colors = subGroupInUse.colors;
+				const colors = subGroupInUse.colors;
 				colors.push( scope.colors[ indexPointerC ++ ] );
 				colors.push( scope.colors[ indexPointerC ++ ] );
 				colors.push( scope.colors[ indexPointerC ] );
@@ -721,9 +721,9 @@ OBJLoader2Parser.prototype = {
 
 			if ( faceIndexU ) {
 
-				let faceIndexUi = parseInt( faceIndexU );
+				const faceIndexUi = parseInt( faceIndexU );
 				let indexPointerU = 2 * ( faceIndexUi > 0 ? faceIndexUi - 1 : faceIndexUi + scope.uvs.length / 2 );
-				let uvs = subGroupInUse.uvs;
+				const uvs = subGroupInUse.uvs;
 				uvs.push( scope.uvs[ indexPointerU ++ ] );
 				uvs.push( scope.uvs[ indexPointerU ] );
 
@@ -731,9 +731,9 @@ OBJLoader2Parser.prototype = {
 
 			if ( faceIndexN && ! scope.disregardNormals ) {
 
-				let faceIndexNi = parseInt( faceIndexN );
+				const faceIndexNi = parseInt( faceIndexN );
 				let indexPointerN = 3 * ( faceIndexNi > 0 ? faceIndexNi - 1 : faceIndexNi + scope.normals.length / 3 );
-				let normals = subGroupInUse.normals;
+				const normals = subGroupInUse.normals;
 				normals.push( scope.normals[ indexPointerN ++ ] );
 				normals.push( scope.normals[ indexPointerN ++ ] );
 				normals.push( scope.normals[ indexPointerN ] );
@@ -745,7 +745,7 @@ OBJLoader2Parser.prototype = {
 		if ( this.useIndices ) {
 
 			if ( this.disregardNormals ) faceIndexN = undefined;
-			let mappingName = faceIndexV + ( faceIndexU ? '_' + faceIndexU : '_n' ) + ( faceIndexN ? '_' + faceIndexN : '_n' );
+			const mappingName = faceIndexV + ( faceIndexU ? '_' + faceIndexU : '_n' ) + ( faceIndexN ? '_' + faceIndexN : '_n' );
 			let indicesPointer = subGroupInUse.indexMappings[ mappingName ];
 			if ( indicesPointer === undefined || indicesPointer === null ) {
 
@@ -792,7 +792,7 @@ OBJLoader2Parser.prototype = {
 	 */
 	_finalizeRawMesh: function () {
 
-		let meshOutputGroupTemp = [];
+		const meshOutputGroupTemp = [];
 		let meshOutputGroup;
 		let absoluteVertexCount = 0;
 		let absoluteIndexMappingsCount = 0;
@@ -801,7 +801,7 @@ OBJLoader2Parser.prototype = {
 		let absoluteNormalCount = 0;
 		let absoluteUvCount = 0;
 		let indices;
-		for ( let name in this.rawMesh.subGroups ) {
+		for ( const name in this.rawMesh.subGroups ) {
 
 			meshOutputGroup = this.rawMesh.subGroups[ name ];
 			if ( meshOutputGroup.vertices.length > 0 ) {
@@ -853,8 +853,8 @@ OBJLoader2Parser.prototype = {
 
 	_processCompletedMesh: function () {
 
-		let result = this._finalizeRawMesh();
-		let haveMesh = result !== null;
+		const result = this._finalizeRawMesh();
+		const haveMesh = result !== null;
 		if ( haveMesh ) {
 
 			if ( this.colors.length > 0 && this.colors.length !== this.vertices.length ) {
@@ -867,7 +867,7 @@ OBJLoader2Parser.prototype = {
 			this.inputObjectCount ++;
 
 			this._buildMesh( result );
-			let progressBytesPercent = this.globalCounts.currentByte / this.globalCounts.totalBytes;
+			const progressBytesPercent = this.globalCounts.currentByte / this.globalCounts.totalBytes;
 			this._onProgress( 'Completed [o: ' + this.rawMesh.objectName + ' g:' + this.rawMesh.groupName + '' +
 				'] Total progress: ' + ( progressBytesPercent * 100 ).toFixed( 2 ) + '%' );
 			this._resetRawMesh();
@@ -886,27 +886,27 @@ OBJLoader2Parser.prototype = {
 	 */
 	_buildMesh: function ( result ) {
 
-		let meshOutputGroups = result.subGroups;
+		const meshOutputGroups = result.subGroups;
 
-		let vertexFA = new Float32Array( result.absoluteVertexCount );
+		const vertexFA = new Float32Array( result.absoluteVertexCount );
 		this.globalCounts.vertices += result.absoluteVertexCount / 3;
 		this.globalCounts.faces += result.faceCount;
 		this.globalCounts.doubleIndicesCount += result.doubleIndicesCount;
-		let indexUA = ( result.absoluteIndexCount > 0 ) ? new Uint32Array( result.absoluteIndexCount ) : null;
-		let colorFA = ( result.absoluteColorCount > 0 ) ? new Float32Array( result.absoluteColorCount ) : null;
-		let normalFA = ( result.absoluteNormalCount > 0 ) ? new Float32Array( result.absoluteNormalCount ) : null;
-		let uvFA = ( result.absoluteUvCount > 0 ) ? new Float32Array( result.absoluteUvCount ) : null;
-		let haveVertexColors = colorFA !== null;
+		const indexUA = ( result.absoluteIndexCount > 0 ) ? new Uint32Array( result.absoluteIndexCount ) : null;
+		const colorFA = ( result.absoluteColorCount > 0 ) ? new Float32Array( result.absoluteColorCount ) : null;
+		const normalFA = ( result.absoluteNormalCount > 0 ) ? new Float32Array( result.absoluteNormalCount ) : null;
+		const uvFA = ( result.absoluteUvCount > 0 ) ? new Float32Array( result.absoluteUvCount ) : null;
+		const haveVertexColors = colorFA !== null;
 
 		let meshOutputGroup;
-		let materialNames = [];
+		const materialNames = [];
 
-		let createMultiMaterial = ( meshOutputGroups.length > 1 );
+		const createMultiMaterial = ( meshOutputGroups.length > 1 );
 		let materialIndex = 0;
-		let materialIndexMapping = [];
+		const materialIndexMapping = [];
 		let selectedMaterialIndex;
 		let materialGroup;
-		let materialGroups = [];
+		const materialGroups = [];
 
 		let vertexFAOffset = 0;
 		let indexUAOffset = 0;
@@ -918,7 +918,7 @@ OBJLoader2Parser.prototype = {
 
 		let materialOrg, material, materialName, materialNameOrg;
 		// only one specific face type
-		for ( let oodIndex in meshOutputGroups ) {
+		for ( const oodIndex in meshOutputGroups ) {
 
 			if ( ! meshOutputGroups.hasOwnProperty( oodIndex ) ) continue;
 			meshOutputGroup = meshOutputGroups[ oodIndex ];
@@ -955,7 +955,7 @@ OBJLoader2Parser.prototype = {
 
 			if ( material === undefined || material === null ) {
 
-				let materialCloneInstructions = {
+				const materialCloneInstructions = {
 					materialNameOrg: materialNameOrg,
 					materialName: materialName,
 					materialProperties: {
@@ -963,7 +963,7 @@ OBJLoader2Parser.prototype = {
 						flatShading: meshOutputGroup.smoothingGroup === 0
 					}
 				};
-				let payload = {
+				const payload = {
 					cmd: 'assetAvailable',
 					type: 'material',
 					materials: {
@@ -973,7 +973,7 @@ OBJLoader2Parser.prototype = {
 				this.callbacks.onAssetAvailable( payload );
 
 				// only set materials if they don't exist, yet
-				let matCheck = this.materials[ materialName ];
+				const matCheck = this.materials[ materialName ];
 				if ( matCheck === undefined || matCheck === null ) {
 
 					this.materials[ materialName ] = materialCloneInstructions;
@@ -1050,7 +1050,7 @@ OBJLoader2Parser.prototype = {
 
 				}
 
-				let createdReport = '\tOutput Object no.: ' + this.outputObjectCount +
+				const createdReport = '\tOutput Object no.: ' + this.outputObjectCount +
 					'\n\t\tgroupName: ' + meshOutputGroup.groupName +
 					'\n\t\tIndex: ' + meshOutputGroup.index +
 					'\n\t\tfaceType: ' + this.rawMesh.faceType +
@@ -1109,7 +1109,7 @@ OBJLoader2Parser.prototype = {
 		if ( this.logging.enabled ) console.info( 'Global output object count: ' + this.outputObjectCount );
 		if ( this._processCompletedMesh() && this.logging.enabled ) {
 
-			let parserFinalReport = 'Overall counts: ' +
+			const parserFinalReport = 'Overall counts: ' +
 				'\n\tVertices: ' + this.globalCounts.vertices +
 				'\n\tFaces: ' + this.globalCounts.faces +
 				'\n\tMultiple definitions: ' + this.globalCounts.doubleIndicesCount;

+ 11 - 11
examples/jsm/loaders/obj2/shared/MaterialHandler.js

@@ -58,20 +58,20 @@ MaterialHandler.prototype = {
 	 */
 	createDefaultMaterials: function ( overrideExisting ) {
 
-		let defaultMaterial = new MeshStandardMaterial( { color: 0xDCF1FF } );
+		const defaultMaterial = new MeshStandardMaterial( { color: 0xDCF1FF } );
 		defaultMaterial.name = 'defaultMaterial';
 
-		let defaultVertexColorMaterial = new MeshStandardMaterial( { color: 0xDCF1FF } );
+		const defaultVertexColorMaterial = new MeshStandardMaterial( { color: 0xDCF1FF } );
 		defaultVertexColorMaterial.name = 'defaultVertexColorMaterial';
 		defaultVertexColorMaterial.vertexColors = true;
 
-		let defaultLineMaterial = new LineBasicMaterial();
+		const defaultLineMaterial = new LineBasicMaterial();
 		defaultLineMaterial.name = 'defaultLineMaterial';
 
-		let defaultPointMaterial = new PointsMaterial( { size: 0.1 } );
+		const defaultPointMaterial = new PointsMaterial( { size: 0.1 } );
 		defaultPointMaterial.name = 'defaultPointMaterial';
 
-		let runtimeMaterials = {};
+		const runtimeMaterials = {};
 		runtimeMaterials[ defaultMaterial.name ] = defaultMaterial;
 		runtimeMaterials[ defaultVertexColorMaterial.name ] = defaultVertexColorMaterial;
 		runtimeMaterials[ defaultLineMaterial.name ] = defaultLineMaterial;
@@ -90,14 +90,14 @@ MaterialHandler.prototype = {
 	addPayloadMaterials: function ( materialPayload ) {
 
 		let material, materialName;
-		let materialCloneInstructions = materialPayload.materials.materialCloneInstructions;
+		const materialCloneInstructions = materialPayload.materials.materialCloneInstructions;
 		let newMaterials = {};
 
 		if ( materialCloneInstructions !== undefined && materialCloneInstructions !== null ) {
 
 			let materialNameOrg = materialCloneInstructions.materialNameOrg;
 			materialNameOrg = ( materialNameOrg !== undefined && materialNameOrg !== null ) ? materialNameOrg : "";
-			let materialOrg = this.materials[ materialNameOrg ];
+			const materialOrg = this.materials[ materialNameOrg ];
 			if ( materialOrg ) {
 
 				material = materialOrg.clone();
@@ -126,7 +126,7 @@ MaterialHandler.prototype = {
 
 		if ( materials !== undefined && materials !== null && Object.keys( materials ).length > 0 ) {
 
-			let loader = new MaterialLoader();
+			const loader = new MaterialLoader();
 			let materialJson;
 
 			for ( materialName in materials ) {
@@ -180,7 +180,7 @@ MaterialHandler.prototype = {
 			let existingMaterial;
 			let add;
 
-			for ( let materialName in materials ) {
+			for ( const materialName in materials ) {
 
 				material = materials[ materialName ];
 				add = overrideExisting === true;
@@ -248,10 +248,10 @@ MaterialHandler.prototype = {
 	 */
 	getMaterialsJSON: function () {
 
-		let materialsJSON = {};
+		const materialsJSON = {};
 		let material;
 
-		for ( let materialName in this.materials ) {
+		for ( const materialName in this.materials ) {
 
 			material = this.materials[ materialName ];
 			materialsJSON[ materialName ] = material.toJSON();

+ 12 - 12
examples/jsm/loaders/obj2/shared/MeshReceiver.js

@@ -78,10 +78,10 @@ MeshReceiver.prototype = {
 	 */
 	buildMeshes: function ( meshPayload ) {
 
-		let meshName = meshPayload.params.meshName;
-		let buffers = meshPayload.buffers;
+		const meshName = meshPayload.params.meshName;
+		const buffers = meshPayload.buffers;
 
-		let bufferGeometry = new BufferGeometry();
+		const bufferGeometry = new BufferGeometry();
 		if ( buffers.vertices !== undefined && buffers.vertices !== null ) {
 
 			bufferGeometry.setAttribute( 'position', new BufferAttribute( new Float32Array( buffers.vertices ), 3 ) );
@@ -129,9 +129,9 @@ MeshReceiver.prototype = {
 		}
 
 		let material, materialName, key;
-		let materialNames = meshPayload.materials.materialNames;
-		let createMultiMaterial = meshPayload.materials.multiMaterial;
-		let multiMaterials = [];
+		const materialNames = meshPayload.materials.materialNames;
+		const createMultiMaterial = meshPayload.materials.multiMaterial;
+		const multiMaterials = [];
 
 		for ( key in materialNames ) {
 
@@ -144,7 +144,7 @@ MeshReceiver.prototype = {
 		if ( createMultiMaterial ) {
 
 			material = multiMaterials;
-			let materialGroups = meshPayload.materials.materialGroups;
+			const materialGroups = meshPayload.materials.materialGroups;
 			let materialGroup;
 			for ( key in materialGroups ) {
 
@@ -155,11 +155,11 @@ MeshReceiver.prototype = {
 
 		}
 
-		let meshes = [];
+		const meshes = [];
 		let mesh;
 		let callbackOnMeshAlterResult;
 		let useOrgMesh = true;
-		let geometryType = meshPayload.geometryType === null ? 0 : meshPayload.geometryType;
+		const geometryType = meshPayload.geometryType === null ? 0 : meshPayload.geometryType;
 
 		if ( this.callbacks.onMeshAlter ) {
 
@@ -185,7 +185,7 @@ MeshReceiver.prototype = {
 
 			} else if ( callbackOnMeshAlterResult.providesAlteredMeshes() ) {
 
-				for ( let i in callbackOnMeshAlterResult.meshes ) {
+				for ( const i in callbackOnMeshAlterResult.meshes ) {
 
 					meshes.push( callbackOnMeshAlterResult.meshes[ i ] );
 
@@ -222,8 +222,8 @@ MeshReceiver.prototype = {
 		let progressMessage = meshPayload.params.meshName;
 		if ( meshes.length > 0 ) {
 
-			let meshNames = [];
-			for ( let i in meshes ) {
+			const meshNames = [];
+			for ( const i in meshes ) {
 
 				mesh = meshes[ i ];
 				meshNames[ i ] = mesh.name;

+ 7 - 7
examples/jsm/loaders/obj2/utils/CodeSerializer.js

@@ -17,15 +17,15 @@ const CodeSerializer = {
 	serializeClass: function ( targetPrototype, targetPrototypeInstance, basePrototypeName, overrideFunctions ) {
 
 		let objectPart, constructorString, i, funcInstructions, funcTemp;
-		let fullObjectName = targetPrototypeInstance.constructor.name;
-		let prototypeFunctions = [];
-		let objectProperties = [];
-		let objectFunctions = [];
-		let isExtended = ( basePrototypeName !== null && basePrototypeName !== undefined );
+		const fullObjectName = targetPrototypeInstance.constructor.name;
+		const prototypeFunctions = [];
+		const objectProperties = [];
+		const objectFunctions = [];
+		const isExtended = ( basePrototypeName !== null && basePrototypeName !== undefined );
 
 		if ( ! Array.isArray( overrideFunctions ) ) overrideFunctions = [];
 
-		for ( let name in targetPrototype.prototype ) {
+		for ( const name in targetPrototype.prototype ) {
 
 			objectPart = targetPrototype.prototype[ name ];
 			funcInstructions = new CodeSerializationInstruction( name, fullObjectName + '.prototype.' + name );
@@ -67,7 +67,7 @@ const CodeSerializer = {
 
 		}
 
-		for ( let name in targetPrototype ) {
+		for ( const name in targetPrototype ) {
 
 			objectPart = targetPrototype[ name ];
 			funcInstructions = new CodeSerializationInstruction( name, fullObjectName + '.' + name );

+ 15 - 15
examples/jsm/loaders/obj2/worker/main/WorkerExecutionSupport.js

@@ -86,8 +86,8 @@ CodeBuilderInstructions.prototype = {
 	 */
 	addLibraryImport: function ( libraryPath ) {
 
-		let libraryUrl = new URL( libraryPath, window.location.href ).href;
-		let code = 'importScripts( "' + libraryUrl + '" );';
+		const libraryUrl = new URL( libraryPath, window.location.href ).href;
+		const code = 'importScripts( "' + libraryUrl + '" );';
 		this.importStatements.push(	code );
 
 	},
@@ -142,8 +142,8 @@ WorkerExecutionSupport.prototype = {
 			debug: false
 		};
 
-		let scope = this;
-		let scopeTerminate = function ( ) {
+		const scope = this;
+		const scopeTerminate = function ( ) {
 
 			scope._terminate();
 
@@ -290,13 +290,13 @@ WorkerExecutionSupport.prototype = {
 	_buildWorkerJsm: function ( codeBuilderInstructions ) {
 
 		let jsmSuccess = true;
-		let timeLabel = 'buildWorkerJsm';
-		let workerAvailable = this._buildWorkerCheckPreconditions( true, timeLabel );
+		const timeLabel = 'buildWorkerJsm';
+		const workerAvailable = this._buildWorkerCheckPreconditions( true, timeLabel );
 		if ( ! workerAvailable ) {
 
 			try {
 
-				let worker = new Worker( codeBuilderInstructions.jsmWorkerUrl.href, { type: "module" } );
+				const worker = new Worker( codeBuilderInstructions.jsmWorkerUrl.href, { type: "module" } );
 				this._configureWorkerCommunication( worker, true, codeBuilderInstructions.defaultGeometryType, timeLabel );
 
 			} catch ( e ) {
@@ -330,8 +330,8 @@ WorkerExecutionSupport.prototype = {
 	 */
 	_buildWorkerStandard: function ( codeBuilderInstructions ) {
 
-		let timeLabel = 'buildWorkerStandard';
-		let workerAvailable = this._buildWorkerCheckPreconditions( false, timeLabel );
+		const timeLabel = 'buildWorkerStandard';
+		const workerAvailable = this._buildWorkerCheckPreconditions( false, timeLabel );
 		if ( ! workerAvailable ) {
 
 			let concatenateCode = '';
@@ -349,8 +349,8 @@ WorkerExecutionSupport.prototype = {
 			concatenateCode += '\n';
 			concatenateCode += codeBuilderInstructions.getStartCode();
 
-			let blob = new Blob( [ concatenateCode ], { type: 'application/javascript' } );
-			let worker = new Worker( window.URL.createObjectURL( blob ) );
+			const blob = new Blob( [ concatenateCode ], { type: 'application/javascript' } );
+			const worker = new Worker( window.URL.createObjectURL( blob ) );
 
 			this._configureWorkerCommunication( worker, false, codeBuilderInstructions.defaultGeometryType, timeLabel );
 
@@ -385,8 +385,8 @@ WorkerExecutionSupport.prototype = {
 		this.worker.native = worker;
 		this.worker.jsmWorker = haveJsmWorker;
 
-		let scope = this;
-		let scopedReceiveWorkerMessage = function ( event ) {
+		const scope = this;
+		const scopedReceiveWorkerMessage = function ( event ) {
 
 			scope._receiveWorkerMessage( event );
 
@@ -433,8 +433,8 @@ WorkerExecutionSupport.prototype = {
 
 		}
 
-		let payload = event.data;
-		let workerRunnerName = this.worker.workerRunner.name;
+		const payload = event.data;
+		const workerRunnerName = this.worker.workerRunner.name;
 		switch ( payload.cmd ) {
 
 			case 'assetAvailable':

+ 7 - 7
examples/jsm/loaders/obj2/worker/parallel/WorkerRunner.js

@@ -67,8 +67,8 @@ DefaultWorkerPayloadHandler.prototype = {
 
 		if ( payload.cmd === 'parse' ) {
 
-			let scope = this;
-			let callbacks = {
+			const scope = this;
+			const callbacks = {
 				callbackOnAssetAvailable: function ( payload ) {
 
 					self.postMessage( payload );
@@ -81,18 +81,18 @@ DefaultWorkerPayloadHandler.prototype = {
 				}
 			};
 
-			let parser = this.parser;
+			const parser = this.parser;
 			if ( typeof parser[ 'setLogging' ] === 'function' ) {
 
 				parser.setLogging( this.logging.enabled, this.logging.debug );
 
 			}
 
-			let objectManipulator = new ObjectManipulator();
+			const objectManipulator = new ObjectManipulator();
 			objectManipulator.applyProperties( parser, payload.params, false );
 			objectManipulator.applyProperties( parser, callbacks, false );
 
-			let arraybuffer = payload.data.input;
+			const arraybuffer = payload.data.input;
 			let executeFunctionName = 'execute';
 			if ( typeof parser.getParseFunctionName === 'function' ) executeFunctionName = parser.getParseFunctionName();
 			if ( payload.usesMeshDisassembler ) {
@@ -130,8 +130,8 @@ const WorkerRunner = function ( payloadHandler ) {
 
 	this.payloadHandler = payloadHandler;
 
-	let scope = this;
-	let scopedRunner = function ( event ) {
+	const scope = this;
+	const scopedRunner = function ( event ) {
 
 		scope.processMessage( event.data );
 

+ 2 - 2
examples/jsm/misc/GPUComputationRenderer.d.ts

@@ -6,8 +6,8 @@ import {
 	Material,
 	ShaderMaterial,
 	Wrapping,
-	TextureFilter
-
+	TextureFilter,
+	TextureDataType
 } from '../../../src/Three';
 
 export interface Variable {

+ 26 - 26
examples/jsm/misc/TubePainter.js

@@ -13,41 +13,41 @@ function TubePainter() {
 
 	const BUFFER_SIZE = 1000000 * 3;
 
-	let positions = new BufferAttribute( new Float32Array( BUFFER_SIZE ), 3 );
+	const positions = new BufferAttribute( new Float32Array( BUFFER_SIZE ), 3 );
 	positions.usage = DynamicDrawUsage;
 
-	let normals = new BufferAttribute( new Float32Array( BUFFER_SIZE ), 3 );
+	const normals = new BufferAttribute( new Float32Array( BUFFER_SIZE ), 3 );
 	normals.usage = DynamicDrawUsage;
 
-	let colors = new BufferAttribute( new Float32Array( BUFFER_SIZE ), 3 );
+	const colors = new BufferAttribute( new Float32Array( BUFFER_SIZE ), 3 );
 	colors.usage = DynamicDrawUsage;
 
-	let geometry = new BufferGeometry();
+	const geometry = new BufferGeometry();
 	geometry.setAttribute( 'position', positions );
 	geometry.setAttribute( 'normal', normals );
 	geometry.setAttribute( 'color', colors );
 	geometry.drawRange.count = 0;
 
-	let material = new MeshStandardMaterial( {
+	const material = new MeshStandardMaterial( {
 		vertexColors: true
 	} );
 
-	let mesh = new Mesh( geometry, material );
+	const mesh = new Mesh( geometry, material );
 	mesh.frustumCulled = false;
 
 	//
 
 	function getPoints( size ) {
 
-		let PI2 = Math.PI * 2;
+		const PI2 = Math.PI * 2;
 
-		let sides = 10;
-		let array = [];
-		let radius = 0.01 * size;
+		const sides = 10;
+		const array = [];
+		const radius = 0.01 * size;
 
 		for ( let i = 0; i < sides; i ++ ) {
 
-			let angle = ( i / sides ) * PI2;
+			const angle = ( i / sides ) * PI2;
 			array.push( new Vector3( Math.sin( angle ) * radius, Math.cos( angle ) * radius, 0 ) );
 
 		}
@@ -58,12 +58,12 @@ function TubePainter() {
 
 	//
 
-	let vector1 = new Vector3();
-	let vector2 = new Vector3();
-	let vector3 = new Vector3();
-	let vector4 = new Vector3();
+	const vector1 = new Vector3();
+	const vector2 = new Vector3();
+	const vector3 = new Vector3();
+	const vector4 = new Vector3();
 
-	let color = new Color( 0xffffff );
+	const color = new Color( 0xffffff );
 	let size = 1;
 
 	function stroke( position1, position2, matrix1, matrix2 ) {
@@ -72,12 +72,12 @@ function TubePainter() {
 
 		let count = geometry.drawRange.count;
 
-		let points = getPoints( size );
+		const points = getPoints( size );
 
 		for ( let i = 0, il = points.length; i < il; i ++ ) {
 
-			let vertex1 = points[ i ];
-			let vertex2 = points[ ( i + 1 ) % il ];
+			const vertex1 = points[ i ];
+			const vertex2 = points[ ( i + 1 ) % il ];
 
 			// positions
 
@@ -129,13 +129,13 @@ function TubePainter() {
 
 	//
 
-	let up = new Vector3( 0, 1, 0 );
+	const up = new Vector3( 0, 1, 0 );
 
-	let point1 = new Vector3();
-	let point2 = new Vector3();
+	const point1 = new Vector3();
+	const point2 = new Vector3();
 
-	let matrix1 = new Matrix4();
-	let matrix2 = new Matrix4();
+	const matrix1 = new Matrix4();
+	const matrix2 = new Matrix4();
 
 	function moveTo( position ) {
 
@@ -171,8 +171,8 @@ function TubePainter() {
 
 	function update() {
 
-		let start = count;
-		let end = geometry.drawRange.count;
+		const start = count;
+		const end = geometry.drawRange.count;
 
 		if ( start === end ) return;
 

+ 1 - 1
examples/jsm/shaders/DepthLimitedBlurShader.d.ts

@@ -28,4 +28,4 @@ export const BlurShaderUtils: {
 	createSampleWeights( kernelRadius: number, stdDev: number ): number[];
 	createSampleOffsets( kernelRadius: number, uvIncrement: Vector2 ): Vector2[];
 	configure( configure: Material, kernelRadius: number, stdDev: number, uvIncrement: Vector2 ): void;
-}
+};

+ 33 - 45
examples/jsm/utils/GeometryCompressionUtils.js

@@ -34,7 +34,7 @@ var GeometryCompressionUtils = {
 
 		}
 
-		let normal = mesh.geometry.attributes.normal;
+		const normal = mesh.geometry.attributes.normal;
 
 		if ( ! normal ) {
 
@@ -50,8 +50,8 @@ var GeometryCompressionUtils = {
 
 		}
 
-		let array = normal.array;
-		let count = normal.count;
+		const array = normal.array;
+		const count = normal.count;
 
 		let result;
 		if ( encodeMethod == "DEFAULT" ) {
@@ -61,9 +61,7 @@ var GeometryCompressionUtils = {
 
 			for ( let idx = 0; idx < array.length; idx += 3 ) {
 
-				let encoded;
-
-				encoded = this.EncodingFuncs.defaultEncode( array[ idx ], array[ idx + 1 ], array[ idx + 2 ], 1 );
+				const encoded = this.EncodingFuncs.defaultEncode( array[ idx ], array[ idx + 1 ], array[ idx + 2 ], 1 );
 
 				result[ idx + 0 ] = encoded[ 0 ];
 				result[ idx + 1 ] = encoded[ 1 ];
@@ -86,9 +84,7 @@ var GeometryCompressionUtils = {
 
 			for ( let idx = 0; idx < array.length; idx += 3 ) {
 
-				let encoded;
-
-				encoded = this.EncodingFuncs.octEncodeBest( array[ idx ], array[ idx + 1 ], array[ idx + 2 ], 1 );
+				const encoded = this.EncodingFuncs.octEncodeBest( array[ idx ], array[ idx + 1 ], array[ idx + 2 ], 1 );
 
 				result[ idx / 3 * 2 + 0 ] = encoded[ 0 ];
 				result[ idx / 3 * 2 + 1 ] = encoded[ 1 ];
@@ -104,9 +100,7 @@ var GeometryCompressionUtils = {
 
 			for ( let idx = 0; idx < array.length; idx += 3 ) {
 
-				let encoded;
-
-				encoded = this.EncodingFuncs.octEncodeBest( array[ idx ], array[ idx + 1 ], array[ idx + 2 ], 2 );
+				const encoded = this.EncodingFuncs.octEncodeBest( array[ idx ], array[ idx + 1 ], array[ idx + 2 ], 2 );
 
 				result[ idx / 3 * 2 + 0 ] = encoded[ 0 ];
 				result[ idx / 3 * 2 + 1 ] = encoded[ 1 ];
@@ -122,9 +116,7 @@ var GeometryCompressionUtils = {
 
 			for ( let idx = 0; idx < array.length; idx += 3 ) {
 
-				let encoded;
-
-				encoded = this.EncodingFuncs.anglesEncode( array[ idx ], array[ idx + 1 ], array[ idx + 2 ] );
+				const encoded = this.EncodingFuncs.anglesEncode( array[ idx ], array[ idx + 1 ], array[ idx + 2 ] );
 
 				result[ idx / 3 * 2 + 0 ] = encoded[ 0 ];
 				result[ idx / 3 * 2 + 1 ] = encoded[ 1 ];
@@ -193,7 +185,7 @@ var GeometryCompressionUtils = {
 
 		}
 
-		let position = mesh.geometry.attributes.position;
+		const position = mesh.geometry.attributes.position;
 
 		if ( ! position ) {
 
@@ -209,13 +201,13 @@ var GeometryCompressionUtils = {
 
 		}
 
-		let array = position.array;
-		let encodingBytes = 2;
+		const array = position.array;
+		const encodingBytes = 2;
 
-		let result = this.EncodingFuncs.quantizedEncode( array, encodingBytes );
+		const result = this.EncodingFuncs.quantizedEncode( array, encodingBytes );
 
-		let quantized = result.quantized;
-		let decodeMat = result.decodeMat;
+		const quantized = result.quantized;
+		const decodeMat = result.decodeMat;
 
 		// IMPORTANT: calculate original geometry bounding info first, before updating packed positions
 		if ( mesh.geometry.boundingBox == null ) mesh.geometry.computeBoundingBox();
@@ -255,7 +247,7 @@ var GeometryCompressionUtils = {
 
 		}
 
-		let uvs = mesh.geometry.attributes.uv;
+		const uvs = mesh.geometry.attributes.uv;
 
 		if ( ! uvs ) {
 
@@ -265,9 +257,9 @@ var GeometryCompressionUtils = {
 
 		if ( uvs.isPacked ) return;
 
-		let range = { min: Infinity, max: - Infinity };
+		const range = { min: Infinity, max: - Infinity };
 
-		let array = uvs.array;
+		const array = uvs.array;
 
 		for ( let i = 0; i < array.length; i ++ ) {
 
@@ -285,7 +277,7 @@ var GeometryCompressionUtils = {
 
 			for ( let i = 0; i < array.length; i += 2 ) {
 
-				let encoded = this.EncodingFuncs.defaultEncode( array[ i ], array[ i + 1 ], 0, 2 );
+				const encoded = this.EncodingFuncs.defaultEncode( array[ i ], array[ i + 1 ], 0, 2 );
 
 				result[ i ] = encoded[ 0 ];
 				result[ i + 1 ] = encoded[ 1 ];
@@ -328,28 +320,24 @@ var GeometryCompressionUtils = {
 
 		}
 
-
-
-
 	},
 
-
 	EncodingFuncs: {
 
 		defaultEncode: function ( x, y, z, bytes ) {
 
 			if ( bytes == 1 ) {
 
-				let tmpx = Math.round( ( x + 1 ) * 0.5 * 255 );
-				let tmpy = Math.round( ( y + 1 ) * 0.5 * 255 );
-				let tmpz = Math.round( ( z + 1 ) * 0.5 * 255 );
+				const tmpx = Math.round( ( x + 1 ) * 0.5 * 255 );
+				const tmpy = Math.round( ( y + 1 ) * 0.5 * 255 );
+				const tmpz = Math.round( ( z + 1 ) * 0.5 * 255 );
 				return new Uint8Array( [ tmpx, tmpy, tmpz ] );
 
 			} else if ( bytes == 2 ) {
 
-				let tmpx = Math.round( ( x + 1 ) * 0.5 * 65535 );
-				let tmpy = Math.round( ( y + 1 ) * 0.5 * 65535 );
-				let tmpz = Math.round( ( z + 1 ) * 0.5 * 65535 );
+				const tmpx = Math.round( ( x + 1 ) * 0.5 * 65535 );
+				const tmpy = Math.round( ( y + 1 ) * 0.5 * 65535 );
+				const tmpz = Math.round( ( z + 1 ) * 0.5 * 65535 );
 				return new Uint16Array( [ tmpx, tmpy, tmpz ] );
 
 			} else {
@@ -389,8 +377,8 @@ var GeometryCompressionUtils = {
 		// for `Angles` encoding
 		anglesEncode: function ( x, y, z ) {
 
-			let normal0 = parseInt( 0.5 * ( 1.0 + Math.atan2( y, x ) / Math.PI ) * 65535 );
-			let normal1 = parseInt( 0.5 * ( 1.0 + z ) * 65535 );
+			const normal0 = parseInt( 0.5 * ( 1.0 + Math.atan2( y, x ) / Math.PI ) * 65535 );
+			const normal1 = parseInt( 0.5 * ( 1.0 + z ) * 65535 );
 			return new Uint16Array( [ normal0, normal1 ] );
 
 		},
@@ -551,10 +539,10 @@ var GeometryCompressionUtils = {
 
 			}
 
-			let decodeMat = new Matrix4();
+			const decodeMat = new Matrix4();
 
-			let min = new Float32Array( 3 );
-			let max = new Float32Array( 3 );
+			const min = new Float32Array( 3 );
+			const max = new Float32Array( 3 );
 
 			min[ 0 ] = min[ 1 ] = min[ 2 ] = Number.MAX_VALUE;
 			max[ 0 ] = max[ 1 ] = max[ 2 ] = - Number.MAX_VALUE;
@@ -583,7 +571,7 @@ var GeometryCompressionUtils = {
 			decodeMat.transpose();
 
 
-			let multiplier = new Float32Array( [
+			const multiplier = new Float32Array( [
 				max[ 0 ] !== min[ 0 ] ? segments / ( max[ 0 ] - min[ 0 ] ) : 0,
 				max[ 1 ] !== min[ 1 ] ? segments / ( max[ 1 ] - min[ 1 ] ) : 0,
 				max[ 2 ] !== min[ 2 ] ? segments / ( max[ 2 ] - min[ 2 ] ) : 0
@@ -625,10 +613,10 @@ var GeometryCompressionUtils = {
 
 			}
 
-			let decodeMat = new Matrix3();
+			const decodeMat = new Matrix3();
 
-			let min = new Float32Array( 2 );
-			let max = new Float32Array( 2 );
+			const min = new Float32Array( 2 );
+			const max = new Float32Array( 2 );
 
 			min[ 0 ] = min[ 1 ] = Number.MAX_VALUE;
 			max[ 0 ] = max[ 1 ] = - Number.MAX_VALUE;
@@ -652,7 +640,7 @@ var GeometryCompressionUtils = {
 
 			decodeMat.transpose();
 
-			let multiplier = new Float32Array( [
+			const multiplier = new Float32Array( [
 				max[ 0 ] !== min[ 0 ] ? segments / ( max[ 0 ] - min[ 0 ] ) : 0,
 				max[ 1 ] !== min[ 1 ] ? segments / ( max[ 1 ] - min[ 1 ] ) : 0
 			] );

+ 1 - 1
examples/jsm/webxr/XRControllerModelFactory.js

@@ -248,7 +248,7 @@ var XRControllerModelFactory = ( function () {
 						assetPath
 					);
 
-					let cachedAsset = this._assetCache[ controllerModel.motionController.assetUrl ];
+					const cachedAsset = this._assetCache[ controllerModel.motionController.assetUrl ];
 					if ( cachedAsset ) {
 
 						scene = cachedAsset.scene.clone();

+ 1 - 1
examples/jsm/webxr/XRHandOculusMeshModel.js

@@ -87,7 +87,7 @@ class XRHandOculusMeshModel {
 
 				if ( XRJoint.visible ) {
 
-					let position = XRJoint.position;
+					const position = XRJoint.position;
 
 					if ( bone ) {