浏览代码

Cleanup (#24181)

* Cleanup

* Fix one super()

* Fix another super()

* Cleanup webgpu_sprites

* Return lost lint line
Levi Pesin 3 年之前
父节点
当前提交
cac2e49415
共有 38 个文件被更改,包括 1347 次插入1373 次删除
  1. 12 10
      docs/scenes/ccdiksolver-browser.html
  2. 202 199
      editor/js/EditorControls.js
  3. 36 37
      editor/js/History.js
  4. 1 1
      examples/jsm/animation/MMDPhysics.js
  5. 1 1
      examples/jsm/controls/ArcballControls.js
  6. 654 652
      examples/jsm/controls/experimental/CameraControls.js
  7. 29 29
      examples/jsm/exporters/KTX2Exporter.js
  8. 9 9
      examples/jsm/interactive/HTMLMesh.js
  9. 3 13
      examples/jsm/loaders/EXRLoader.js
  10. 1 1
      examples/jsm/loaders/FontLoader.js
  11. 30 33
      examples/jsm/loaders/GLTFLoader.js
  12. 27 27
      examples/jsm/loaders/KTX2Loader.js
  13. 1 1
      examples/jsm/loaders/RGBELoader.js
  14. 23 25
      examples/jsm/loaders/VRMLLoader.js
  15. 1 1
      examples/jsm/loaders/VTKLoader.js
  16. 6 8
      examples/jsm/loaders/lwo/LWO2Parser.js
  17. 6 8
      examples/jsm/loaders/lwo/LWO3Parser.js
  18. 169 171
      examples/jsm/misc/Volume.js
  19. 78 80
      examples/jsm/misc/VolumeSlice.js
  20. 1 1
      examples/jsm/nodes/core/Node.js
  21. 1 1
      examples/jsm/nodes/core/NodeUtils.js
  22. 4 4
      examples/jsm/nodes/lighting/LightingContextNode.js
  23. 2 2
      examples/jsm/nodes/loaders/NodeLoader.js
  24. 1 1
      examples/jsm/nodes/materials/Materials.js
  25. 4 1
      examples/jsm/nodes/materials/MeshStandardNodeMaterial.js
  26. 5 5
      examples/jsm/nodes/shadernode/ShaderNode.js
  27. 1 1
      examples/jsm/renderers/webgl/nodes/WebGLNodes.js
  28. 1 1
      examples/jsm/renderers/webgpu/WebGPURenderStates.js
  29. 2 2
      examples/jsm/renderers/webgpu/WebGPUTextures.js
  30. 1 1
      examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js
  31. 2 1
      examples/jsm/utils/BufferGeometryUtils.js
  32. 17 25
      examples/jsm/utils/GeometryUtils.js
  33. 9 13
      examples/webgpu_sprites.html
  34. 3 4
      examples/webxr_vr_teleport.html
  35. 1 1
      package.json
  36. 1 1
      src/core/BufferAttribute.js
  37. 1 1
      src/core/InterleavedBuffer.js
  38. 1 1
      src/textures/Source.js

+ 12 - 10
docs/scenes/ccdiksolver-browser.html

@@ -58,7 +58,7 @@
 				Uint16BufferAttribute,
 				Uint16BufferAttribute,
 				WebGLRenderer
 				WebGLRenderer
 			} from 'three';
 			} from 'three';
-			import { CCDIKSolver, CCDIKHelper } from "../../examples/jsm/animation/CCDIKSolver.js";
+			import { CCDIKSolver, CCDIKHelper } from '../../examples/jsm/animation/CCDIKSolver.js';
 
 
 			import { GUI } from '../../examples/jsm/libs/lil-gui.module.min.js';
 			import { GUI } from '../../examples/jsm/libs/lil-gui.module.min.js';
 			import { OrbitControls } from '../../examples/jsm/controls/OrbitControls.js';
 			import { OrbitControls } from '../../examples/jsm/controls/OrbitControls.js';
@@ -146,9 +146,9 @@
 				bones = [];
 				bones = [];
 
 
 				// "root bone"
 				// "root bone"
-				let rootBone = new Bone();
-				rootBone.name = "root";
-				rootBone.position.y = -sizing.halfHeight;
+				const rootBone = new Bone();
+				rootBone.name = 'root';
+				rootBone.position.y = - sizing.halfHeight;
 				bones.push( rootBone );
 				bones.push( rootBone );
 
 
 				//
 				//
@@ -158,7 +158,7 @@
 				// "bone0"
 				// "bone0"
 				let prevBone = new Bone();
 				let prevBone = new Bone();
 				prevBone.position.y = 0;
 				prevBone.position.y = 0;
-				rootBone.add(prevBone);
+				rootBone.add( prevBone );
 				bones.push( prevBone );
 				bones.push( prevBone );
 
 
 				// "bone1", "bone2", "bone3"
 				// "bone1", "bone2", "bone3"
@@ -175,7 +175,7 @@
 
 
 				// "target"
 				// "target"
 				const targetBone = new Bone();
 				const targetBone = new Bone();
-				targetBone.name = "target";
+				targetBone.name = 'target';
 				targetBone.position.y = sizing.height + sizing.segmentHeight; // relative to parent: rootBone
 				targetBone.position.y = sizing.height + sizing.segmentHeight; // relative to parent: rootBone
 				rootBone.add( targetBone );
 				rootBone.add( targetBone );
 				bones.push( targetBone );
 				bones.push( targetBone );
@@ -214,16 +214,18 @@
 				gui.add( mesh, 'pose' ).name( 'mesh.pose()' );
 				gui.add( mesh, 'pose' ).name( 'mesh.pose()' );
 
 
 				mesh.skeleton.bones
 				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 folder = gui.addFolder( bone.name );
 
 
 						const delta = 20;
 						const delta = 20;
 						folder.add( bone.position, 'x', - delta + bone.position.x, delta + bone.position.x );
 						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, 'y', - bone.position.y, bone.position.y );
 						folder.add( bone.position, 'z', - delta + bone.position.z, delta + bone.position.z );
 						folder.add( bone.position, 'z', - delta + bone.position.z, delta + bone.position.z );
-					} );
-				
+			
+		} );
+			
 				gui.add( ikSolver, 'update' ).name( 'ikSolver.update()' );
 				gui.add( ikSolver, 'update' ).name( 'ikSolver.update()' );
 				gui.add( state, 'ikSolverAutoUpdate' );
 				gui.add( state, 'ikSolverAutoUpdate' );
 
 

+ 202 - 199
editor/js/EditorControls.js

@@ -1,354 +1,357 @@
 import * as THREE from 'three';
 import * as THREE from 'three';
 
 
-function EditorControls( object, domElement ) {
+class EditorControls extends THREE.EventDispatcher {
 
 
-	// API
+	constructor( object, domElement ) {
 
 
-	this.enabled = true;
-	this.center = new THREE.Vector3();
-	this.panSpeed = 0.002;
-	this.zoomSpeed = 0.1;
-	this.rotationSpeed = 0.005;
+		super();
 
 
-	// internals
+		// API
 
 
-	var scope = this;
-	var vector = new THREE.Vector3();
-	var delta = new THREE.Vector3();
-	var box = new THREE.Box3();
+		this.enabled = true;
+		this.center = new THREE.Vector3();
+		this.panSpeed = 0.002;
+		this.zoomSpeed = 0.1;
+		this.rotationSpeed = 0.005;
 
 
-	var STATE = { NONE: - 1, ROTATE: 0, ZOOM: 1, PAN: 2 };
-	var state = STATE.NONE;
+		// internals
 
 
-	var center = this.center;
-	var normalMatrix = new THREE.Matrix3();
-	var pointer = new THREE.Vector2();
-	var pointerOld = new THREE.Vector2();
-	var spherical = new THREE.Spherical();
-	var sphere = new THREE.Sphere();
+		var scope = this;
+		var vector = new THREE.Vector3();
+		var delta = new THREE.Vector3();
+		var box = new THREE.Box3();
 
 
-	// events
+		var STATE = { NONE: - 1, ROTATE: 0, ZOOM: 1, PAN: 2 };
+		var state = STATE.NONE;
 
 
-	var changeEvent = { type: 'change' };
+		var center = this.center;
+		var normalMatrix = new THREE.Matrix3();
+		var pointer = new THREE.Vector2();
+		var pointerOld = new THREE.Vector2();
+		var spherical = new THREE.Spherical();
+		var sphere = new THREE.Sphere();
 
 
-	this.focus = function ( target ) {
+		// events
 
 
-		var distance;
+		var changeEvent = { type: 'change' };
 
 
-		box.setFromObject( target );
+		this.focus = function ( target ) {
 
 
-		if ( box.isEmpty() === false ) {
+			var distance;
 
 
-			box.getCenter( center );
-			distance = box.getBoundingSphere( sphere ).radius;
+			box.setFromObject( target );
 
 
-		} else {
+			if ( box.isEmpty() === false ) {
 
 
-			// Focusing on an Group, AmbientLight, etc
+				box.getCenter( center );
+				distance = box.getBoundingSphere( sphere ).radius;
 
 
-			center.setFromMatrixPosition( target.matrixWorld );
-			distance = 0.1;
+			} else {
 
 
-		}
+				// Focusing on an Group, AmbientLight, etc
 
 
-		delta.set( 0, 0, 1 );
-		delta.applyQuaternion( object.quaternion );
-		delta.multiplyScalar( distance * 4 );
+				center.setFromMatrixPosition( target.matrixWorld );
+				distance = 0.1;
 
 
-		object.position.copy( center ).add( delta );
+			}
 
 
-		scope.dispatchEvent( changeEvent );
+			delta.set( 0, 0, 1 );
+			delta.applyQuaternion( object.quaternion );
+			delta.multiplyScalar( distance * 4 );
 
 
-	};
+			object.position.copy( center ).add( delta );
 
 
-	this.pan = function ( delta ) {
+			scope.dispatchEvent( changeEvent );
 
 
-		var distance = object.position.distanceTo( center );
+		};
 
 
-		delta.multiplyScalar( distance * scope.panSpeed );
-		delta.applyMatrix3( normalMatrix.getNormalMatrix( object.matrix ) );
+		this.pan = function ( delta ) {
 
 
-		object.position.add( delta );
-		center.add( delta );
+			var distance = object.position.distanceTo( center );
 
 
-		scope.dispatchEvent( changeEvent );
+			delta.multiplyScalar( distance * scope.panSpeed );
+			delta.applyMatrix3( normalMatrix.getNormalMatrix( object.matrix ) );
 
 
-	};
+			object.position.add( delta );
+			center.add( delta );
 
 
-	this.zoom = function ( delta ) {
+			scope.dispatchEvent( changeEvent );
 
 
-		var distance = object.position.distanceTo( center );
+		};
 
 
-		delta.multiplyScalar( distance * scope.zoomSpeed );
+		this.zoom = function ( delta ) {
 
 
-		if ( delta.length() > distance ) return;
+			var distance = object.position.distanceTo( center );
 
 
-		delta.applyMatrix3( normalMatrix.getNormalMatrix( object.matrix ) );
+			delta.multiplyScalar( distance * scope.zoomSpeed );
 
 
-		object.position.add( delta );
+			if ( delta.length() > distance ) return;
 
 
-		scope.dispatchEvent( changeEvent );
+			delta.applyMatrix3( normalMatrix.getNormalMatrix( object.matrix ) );
 
 
-	};
+			object.position.add( delta );
 
 
-	this.rotate = function ( delta ) {
+			scope.dispatchEvent( changeEvent );
 
 
-		vector.copy( object.position ).sub( center );
+		};
 
 
-		spherical.setFromVector3( vector );
+		this.rotate = function ( delta ) {
 
 
-		spherical.theta += delta.x * scope.rotationSpeed;
-		spherical.phi += delta.y * scope.rotationSpeed;
+			vector.copy( object.position ).sub( center );
 
 
-		spherical.makeSafe();
+			spherical.setFromVector3( vector );
 
 
-		vector.setFromSpherical( spherical );
+			spherical.theta += delta.x * scope.rotationSpeed;
+			spherical.phi += delta.y * scope.rotationSpeed;
 
 
-		object.position.copy( center ).add( vector );
+			spherical.makeSafe();
 
 
-		object.lookAt( center );
+			vector.setFromSpherical( spherical );
 
 
-		scope.dispatchEvent( changeEvent );
+			object.position.copy( center ).add( vector );
 
 
-	};
+			object.lookAt( center );
 
 
-	//
+			scope.dispatchEvent( changeEvent );
 
 
-	function onPointerDown( event ) {
+		};
 
 
-		if ( scope.enabled === false ) return;
+		//
 
 
-		switch ( event.pointerType ) {
+		function onPointerDown( event ) {
 
 
-			case 'mouse':
-			case 'pen':
-				onMouseDown( event );
-				break;
+			if ( scope.enabled === false ) return;
 
 
-			// TODO touch
+			switch ( event.pointerType ) {
 
 
-		}
+				case 'mouse':
+				case 'pen':
+					onMouseDown( event );
+					break;
 
 
-		domElement.ownerDocument.addEventListener( 'pointermove', onPointerMove );
-		domElement.ownerDocument.addEventListener( 'pointerup', onPointerUp );
+				// TODO touch
 
 
-	}
+			}
+
+			domElement.ownerDocument.addEventListener( 'pointermove', onPointerMove );
+			domElement.ownerDocument.addEventListener( 'pointerup', onPointerUp );
+
+		}
 
 
-	function onPointerMove( event ) {
+		function onPointerMove( event ) {
 
 
-		if ( scope.enabled === false ) return;
+			if ( scope.enabled === false ) return;
 
 
-		switch ( event.pointerType ) {
+			switch ( event.pointerType ) {
 
 
-			case 'mouse':
-			case 'pen':
-				onMouseMove( event );
-				break;
+				case 'mouse':
+				case 'pen':
+					onMouseMove( event );
+					break;
 
 
-			// TODO touch
+				// TODO touch
+
+			}
 
 
 		}
 		}
 
 
-	}
+		function onPointerUp( event ) {
 
 
-	function onPointerUp( event ) {
+			switch ( event.pointerType ) {
 
 
-		switch ( event.pointerType ) {
+				case 'mouse':
+				case 'pen':
+					onMouseUp();
+					break;
 
 
-			case 'mouse':
-			case 'pen':
-				onMouseUp();
-				break;
+				// TODO touch
 
 
-			// TODO touch
+			}
+
+			domElement.ownerDocument.removeEventListener( 'pointermove', onPointerMove );
+			domElement.ownerDocument.removeEventListener( 'pointerup', onPointerUp );
 
 
 		}
 		}
 
 
-		domElement.ownerDocument.removeEventListener( 'pointermove', onPointerMove );
-		domElement.ownerDocument.removeEventListener( 'pointerup', onPointerUp );
+		// mouse
 
 
-	}
+		function onMouseDown( event ) {
 
 
-	// mouse
+			if ( event.button === 0 ) {
 
 
-	function onMouseDown( event ) {
+				state = STATE.ROTATE;
 
 
-		if ( event.button === 0 ) {
+			} else if ( event.button === 1 ) {
 
 
-			state = STATE.ROTATE;
+				state = STATE.ZOOM;
 
 
-		} else if ( event.button === 1 ) {
+			} else if ( event.button === 2 ) {
 
 
-			state = STATE.ZOOM;
+				state = STATE.PAN;
 
 
-		} else if ( event.button === 2 ) {
+			}
 
 
-			state = STATE.PAN;
+			pointerOld.set( event.clientX, event.clientY );
 
 
 		}
 		}
 
 
-		pointerOld.set( event.clientX, event.clientY );
+		function onMouseMove( event ) {
 
 
-	}
+			pointer.set( event.clientX, event.clientY );
 
 
-	function onMouseMove( event ) {
+			var movementX = pointer.x - pointerOld.x;
+			var movementY = pointer.y - pointerOld.y;
 
 
-		pointer.set( event.clientX, event.clientY );
+			if ( state === STATE.ROTATE ) {
 
 
-		var movementX = pointer.x - pointerOld.x;
-		var movementY = pointer.y - pointerOld.y;
+				scope.rotate( delta.set( - movementX, - movementY, 0 ) );
 
 
-		if ( state === STATE.ROTATE ) {
+			} else if ( state === STATE.ZOOM ) {
 
 
-			scope.rotate( delta.set( - movementX, - movementY, 0 ) );
+				scope.zoom( delta.set( 0, 0, movementY ) );
 
 
-		} else if ( state === STATE.ZOOM ) {
+			} else if ( state === STATE.PAN ) {
 
 
-			scope.zoom( delta.set( 0, 0, movementY ) );
+				scope.pan( delta.set( - movementX, movementY, 0 ) );
 
 
-		} else if ( state === STATE.PAN ) {
+			}
 
 
-			scope.pan( delta.set( - movementX, movementY, 0 ) );
+			pointerOld.set( event.clientX, event.clientY );
 
 
 		}
 		}
 
 
-		pointerOld.set( event.clientX, event.clientY );
+		function onMouseUp() {
 
 
-	}
+			state = STATE.NONE;
 
 
-	function onMouseUp() {
+		}
 
 
-		state = STATE.NONE;
+		function onMouseWheel( event ) {
 
 
-	}
+			if ( scope.enabled === false ) return;
 
 
-	function onMouseWheel( event ) {
+			event.preventDefault();
 
 
-		if ( scope.enabled === false ) return;
+			// Normalize deltaY due to https://bugzilla.mozilla.org/show_bug.cgi?id=1392460
+			scope.zoom( delta.set( 0, 0, event.deltaY > 0 ? 1 : - 1 ) );
 
 
-		event.preventDefault();
+		}
 
 
-		// Normalize deltaY due to https://bugzilla.mozilla.org/show_bug.cgi?id=1392460
-		scope.zoom( delta.set( 0, 0, event.deltaY > 0 ? 1 : - 1 ) );
+		function contextmenu( event ) {
 
 
-	}
+			event.preventDefault();
 
 
-	function contextmenu( event ) {
+		}
 
 
-		event.preventDefault();
+		this.dispose = function () {
 
 
-	}
+			domElement.removeEventListener( 'contextmenu', contextmenu );
+			domElement.removeEventListener( 'dblclick', onMouseUp );
+			domElement.removeEventListener( 'wheel', onMouseWheel );
 
 
-	this.dispose = function () {
+			domElement.removeEventListener( 'pointerdown', onPointerDown );
 
 
-		domElement.removeEventListener( 'contextmenu', contextmenu );
-		domElement.removeEventListener( 'dblclick', onMouseUp );
-		domElement.removeEventListener( 'wheel', onMouseWheel );
+			domElement.removeEventListener( 'touchstart', touchStart );
+			domElement.removeEventListener( 'touchmove', touchMove );
 
 
-		domElement.removeEventListener( 'pointerdown', onPointerDown );
+		};
 
 
-		domElement.removeEventListener( 'touchstart', touchStart );
-		domElement.removeEventListener( 'touchmove', touchMove );
+		domElement.addEventListener( 'contextmenu', contextmenu );
+		domElement.addEventListener( 'dblclick', onMouseUp );
+		domElement.addEventListener( 'wheel', onMouseWheel );
 
 
-	};
+		domElement.addEventListener( 'pointerdown', onPointerDown );
 
 
-	domElement.addEventListener( 'contextmenu', contextmenu );
-	domElement.addEventListener( 'dblclick', onMouseUp );
-	domElement.addEventListener( 'wheel', onMouseWheel );
+		// touch
 
 
-	domElement.addEventListener( 'pointerdown', onPointerDown );
+		var touches = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
+		var prevTouches = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
 
 
-	// touch
+		var prevDistance = null;
 
 
-	var touches = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
-	var prevTouches = [ new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3() ];
+		function touchStart( event ) {
 
 
-	var prevDistance = null;
+			if ( scope.enabled === false ) return;
 
 
-	function touchStart( event ) {
+			switch ( event.touches.length ) {
 
 
-		if ( scope.enabled === false ) return;
+				case 1:
+					touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
+					touches[ 1 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
+					break;
 
 
-		switch ( event.touches.length ) {
+				case 2:
+					touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
+					touches[ 1 ].set( event.touches[ 1 ].pageX, event.touches[ 1 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
+					prevDistance = touches[ 0 ].distanceTo( touches[ 1 ] );
+					break;
 
 
-			case 1:
-				touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
-				touches[ 1 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
-				break;
+			}
 
 
-			case 2:
-				touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
-				touches[ 1 ].set( event.touches[ 1 ].pageX, event.touches[ 1 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
-				prevDistance = touches[ 0 ].distanceTo( touches[ 1 ] );
-				break;
+			prevTouches[ 0 ].copy( touches[ 0 ] );
+			prevTouches[ 1 ].copy( touches[ 1 ] );
 
 
 		}
 		}
 
 
-		prevTouches[ 0 ].copy( touches[ 0 ] );
-		prevTouches[ 1 ].copy( touches[ 1 ] );
 
 
-	}
+		function touchMove( event ) {
 
 
+			if ( scope.enabled === false ) return;
 
 
-	function touchMove( event ) {
+			event.preventDefault();
+			event.stopPropagation();
 
 
-		if ( scope.enabled === false ) return;
+			function getClosest( touch, touches ) {
 
 
-		event.preventDefault();
-		event.stopPropagation();
+				var closest = touches[ 0 ];
 
 
-		function getClosest( touch, touches ) {
+				for ( var touch2 of touches ) {
 
 
-			var closest = touches[ 0 ];
+					if ( closest.distanceTo( touch ) > touch2.distanceTo( touch ) ) closest = touch2;
 
 
-			for ( var touch2 of touches ) {
+				}
 
 
-				if ( closest.distanceTo( touch ) > touch2.distanceTo( touch ) ) closest = touch2;
+				return closest;
 
 
 			}
 			}
 
 
-			return closest;
+			switch ( event.touches.length ) {
 
 
-		}
+				case 1:
+					touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
+					touches[ 1 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
+					scope.rotate( touches[ 0 ].sub( getClosest( touches[ 0 ], prevTouches ) ).multiplyScalar( - 1 ) );
+					break;
 
 
-		switch ( event.touches.length ) {
+				case 2:
+					touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
+					touches[ 1 ].set( event.touches[ 1 ].pageX, event.touches[ 1 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
+					var distance = touches[ 0 ].distanceTo( touches[ 1 ] );
+					scope.zoom( delta.set( 0, 0, prevDistance - distance ) );
+					prevDistance = distance;
 
 
-			case 1:
-				touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
-				touches[ 1 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
-				scope.rotate( touches[ 0 ].sub( getClosest( touches[ 0 ], prevTouches ) ).multiplyScalar( - 1 ) );
-				break;
 
 
-			case 2:
-				touches[ 0 ].set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
-				touches[ 1 ].set( event.touches[ 1 ].pageX, event.touches[ 1 ].pageY, 0 ).divideScalar( window.devicePixelRatio );
-				var distance = touches[ 0 ].distanceTo( touches[ 1 ] );
-				scope.zoom( delta.set( 0, 0, prevDistance - distance ) );
-				prevDistance = distance;
+					var offset0 = touches[ 0 ].clone().sub( getClosest( touches[ 0 ], prevTouches ) );
+					var offset1 = touches[ 1 ].clone().sub( getClosest( touches[ 1 ], prevTouches ) );
+					offset0.x = - offset0.x;
+					offset1.x = - offset1.x;
 
 
+					scope.pan( offset0.add( offset1 ) );
 
 
-				var offset0 = touches[ 0 ].clone().sub( getClosest( touches[ 0 ], prevTouches ) );
-				var offset1 = touches[ 1 ].clone().sub( getClosest( touches[ 1 ], prevTouches ) );
-				offset0.x = - offset0.x;
-				offset1.x = - offset1.x;
+					break;
 
 
-				scope.pan( offset0.add( offset1 ) );
+			}
 
 
-				break;
+			prevTouches[ 0 ].copy( touches[ 0 ] );
+			prevTouches[ 1 ].copy( touches[ 1 ] );
 
 
 		}
 		}
 
 
-		prevTouches[ 0 ].copy( touches[ 0 ] );
-		prevTouches[ 1 ].copy( touches[ 1 ] );
+		domElement.addEventListener( 'touchstart', touchStart );
+		domElement.addEventListener( 'touchmove', touchMove );
 
 
 	}
 	}
 
 
-	domElement.addEventListener( 'touchstart', touchStart );
-	domElement.addEventListener( 'touchmove', touchMove );
-
 }
 }
 
 
-EditorControls.prototype = Object.create( THREE.EventDispatcher.prototype );
-EditorControls.prototype.constructor = EditorControls;
-
 export { EditorControls };
 export { EditorControls };

+ 36 - 37
editor/js/History.js

@@ -1,41 +1,40 @@
-
 import * as Commands from './commands/Commands.js';
 import * as Commands from './commands/Commands.js';
 
 
-function History( editor ) {
+class History {
 
 
-	this.editor = editor;
-	this.undos = [];
-	this.redos = [];
-	this.lastCmdTime = new Date();
-	this.idCounter = 0;
+	constructor( editor ) {
 
 
-	this.historyDisabled = false;
-	this.config = editor.config;
+		this.editor = editor;
+		this.undos = [];
+		this.redos = [];
+		this.lastCmdTime = Date.now();
+		this.idCounter = 0;
 
 
-	// signals
+		this.historyDisabled = false;
+		this.config = editor.config;
 
 
-	const scope = this;
+		// signals
 
 
-	this.editor.signals.startPlayer.add( function () {
+		const scope = this;
 
 
-		scope.historyDisabled = true;
+		this.editor.signals.startPlayer.add( function () {
 
 
-	} );
+			scope.historyDisabled = true;
 
 
-	this.editor.signals.stopPlayer.add( function () {
+		} );
 
 
-		scope.historyDisabled = false;
+		this.editor.signals.stopPlayer.add( function () {
 
 
-	} );
+			scope.historyDisabled = false;
 
 
-}
+		} );
 
 
-History.prototype = {
+	}
 
 
-	execute: function ( cmd, optionalName ) {
+	execute( cmd, optionalName ) {
 
 
 		const lastCmd = this.undos[ this.undos.length - 1 ];
 		const lastCmd = this.undos[ this.undos.length - 1 ];
-		const timeDifference = new Date().getTime() - this.lastCmdTime.getTime();
+		const timeDifference = Date.now() - this.lastCmdTime;
 
 
 		const isUpdatableCmd = lastCmd &&
 		const isUpdatableCmd = lastCmd &&
 			lastCmd.updatable &&
 			lastCmd.updatable &&
@@ -76,16 +75,16 @@ History.prototype = {
 
 
 		}
 		}
 
 
-		this.lastCmdTime = new Date();
+		this.lastCmdTime = Date.now();
 
 
 		// clearing all the redo-commands
 		// clearing all the redo-commands
 
 
 		this.redos = [];
 		this.redos = [];
 		this.editor.signals.historyChanged.dispatch( cmd );
 		this.editor.signals.historyChanged.dispatch( cmd );
 
 
-	},
+	}
 
 
-	undo: function () {
+	undo() {
 
 
 		if ( this.historyDisabled ) {
 		if ( this.historyDisabled ) {
 
 
@@ -118,9 +117,9 @@ History.prototype = {
 
 
 		return cmd;
 		return cmd;
 
 
-	},
+	}
 
 
-	redo: function () {
+	redo() {
 
 
 		if ( this.historyDisabled ) {
 		if ( this.historyDisabled ) {
 
 
@@ -153,9 +152,9 @@ History.prototype = {
 
 
 		return cmd;
 		return cmd;
 
 
-	},
+	}
 
 
-	toJSON: function () {
+	toJSON() {
 
 
 		const history = {};
 		const history = {};
 		history.undos = [];
 		history.undos = [];
@@ -193,9 +192,9 @@ History.prototype = {
 
 
 		return history;
 		return history;
 
 
-	},
+	}
 
 
-	fromJSON: function ( json ) {
+	fromJSON( json ) {
 
 
 		if ( json === undefined ) return;
 		if ( json === undefined ) return;
 
 
@@ -226,9 +225,9 @@ History.prototype = {
 		// Select the last executed undo-command
 		// Select the last executed undo-command
 		this.editor.signals.historyChanged.dispatch( this.undos[ this.undos.length - 1 ] );
 		this.editor.signals.historyChanged.dispatch( this.undos[ this.undos.length - 1 ] );
 
 
-	},
+	}
 
 
-	clear: function () {
+	clear() {
 
 
 		this.undos = [];
 		this.undos = [];
 		this.redos = [];
 		this.redos = [];
@@ -236,9 +235,9 @@ History.prototype = {
 
 
 		this.editor.signals.historyChanged.dispatch();
 		this.editor.signals.historyChanged.dispatch();
 
 
-	},
+	}
 
 
-	goToState: function ( id ) {
+	goToState( id ) {
 
 
 		if ( this.historyDisabled ) {
 		if ( this.historyDisabled ) {
 
 
@@ -281,9 +280,9 @@ History.prototype = {
 		this.editor.signals.sceneGraphChanged.dispatch();
 		this.editor.signals.sceneGraphChanged.dispatch();
 		this.editor.signals.historyChanged.dispatch( cmd );
 		this.editor.signals.historyChanged.dispatch( cmd );
 
 
-	},
+	}
 
 
-	enableSerialization: function ( id ) {
+	enableSerialization( id ) {
 
 
 		/**
 		/**
 		 * because there might be commands in this.undos and this.redos
 		 * because there might be commands in this.undos and this.redos
@@ -317,6 +316,6 @@ History.prototype = {
 
 
 	}
 	}
 
 
-};
+}
 
 
 export { History };
 export { History };

+ 1 - 1
examples/jsm/animation/MMDPhysics.js

@@ -209,7 +209,7 @@ class MMDPhysics {
 		// mesh's default world transform as position(0, 0, 0),
 		// mesh's default world transform as position(0, 0, 0),
 		// quaternion(0, 0, 0, 1) and scale(0, 0, 0)
 		// quaternion(0, 0, 0, 1) and scale(0, 0, 0)
 
 
-		let parent = mesh.parent;
+		const parent = mesh.parent;
 
 
 		if ( parent !== null ) mesh.parent = null;
 		if ( parent !== null ) mesh.parent = null;
 
 

+ 1 - 1
examples/jsm/controls/ArcballControls.js

@@ -1040,7 +1040,7 @@ class ArcballControls extends EventDispatcher {
 
 
 							}
 							}
 
 
-							this._v3_1.setFromMatrixPosition(this._gizmoMatrixState);
+							this._v3_1.setFromMatrixPosition( this._gizmoMatrixState );
 
 
 							this.applyTransformMatrix( this.scale( size, this._v3_1 ) );
 							this.applyTransformMatrix( this.scale( size, this._v3_1 ) );
 
 

文件差异内容过多而无法显示
+ 654 - 652
examples/jsm/controls/experimental/CameraControls.js


+ 29 - 29
examples/jsm/exporters/KTX2Exporter.js

@@ -39,46 +39,46 @@ import {
 	VK_FORMAT_R8G8_UNORM,
 	VK_FORMAT_R8G8_UNORM,
 	VK_FORMAT_R8G8B8A8_SRGB,
 	VK_FORMAT_R8G8B8A8_SRGB,
 	VK_FORMAT_R8G8B8A8_UNORM,
 	VK_FORMAT_R8G8B8A8_UNORM,
- } from '../libs/ktx-parse.module.js';
+} from '../libs/ktx-parse.module.js';
 
 
 const VK_FORMAT_MAP = {
 const VK_FORMAT_MAP = {
 
 
-	[RGBAFormat]: {
-		[FloatType]: {
-			[LinearEncoding]: VK_FORMAT_R32G32B32A32_SFLOAT,
+	[ RGBAFormat ]: {
+		[ FloatType ]: {
+			[ LinearEncoding ]: VK_FORMAT_R32G32B32A32_SFLOAT,
 		},
 		},
-		[HalfFloatType]: {
-			[LinearEncoding]: VK_FORMAT_R16G16B16A16_SFLOAT,
+		[ HalfFloatType ]: {
+			[ LinearEncoding ]: VK_FORMAT_R16G16B16A16_SFLOAT,
 		},
 		},
-		[UnsignedByteType]: {
-			[LinearEncoding]: VK_FORMAT_R8G8B8A8_UNORM,
-			[sRGBEncoding]: VK_FORMAT_R8G8B8A8_SRGB,
+		[ UnsignedByteType ]: {
+			[ LinearEncoding ]: VK_FORMAT_R8G8B8A8_UNORM,
+			[ sRGBEncoding ]: VK_FORMAT_R8G8B8A8_SRGB,
 		},
 		},
 	},
 	},
 
 
-	[RGFormat]: {
-		[FloatType]: {
-			[LinearEncoding]: VK_FORMAT_R32G32_SFLOAT,
+	[ RGFormat ]: {
+		[ FloatType ]: {
+			[ LinearEncoding ]: VK_FORMAT_R32G32_SFLOAT,
 		},
 		},
-		[HalfFloatType]: {
-			[LinearEncoding]: VK_FORMAT_R16G16_SFLOAT,
+		[ HalfFloatType ]: {
+			[ LinearEncoding ]: VK_FORMAT_R16G16_SFLOAT,
 		},
 		},
-		[UnsignedByteType]: {
-			[LinearEncoding]: VK_FORMAT_R8G8_UNORM,
-			[sRGBEncoding]: VK_FORMAT_R8G8_SRGB,
+		[ UnsignedByteType ]: {
+			[ LinearEncoding ]: VK_FORMAT_R8G8_UNORM,
+			[ sRGBEncoding ]: VK_FORMAT_R8G8_SRGB,
 		},
 		},
 	},
 	},
 
 
-	[RedFormat]: {
-		[FloatType]: {
-			[LinearEncoding]: VK_FORMAT_R32_SFLOAT,
+	[ RedFormat ]: {
+		[ FloatType ]: {
+			[ LinearEncoding ]: VK_FORMAT_R32_SFLOAT,
 		},
 		},
-		[HalfFloatType]: {
-			[LinearEncoding]: VK_FORMAT_R16_SFLOAT,
+		[ HalfFloatType ]: {
+			[ LinearEncoding ]: VK_FORMAT_R16_SFLOAT,
 		},
 		},
-		[UnsignedByteType]: {
-			[LinearEncoding]: VK_FORMAT_R8_SRGB,
-			[sRGBEncoding]: VK_FORMAT_R8_UNORM,
+		[ UnsignedByteType ]: {
+			[ LinearEncoding ]: VK_FORMAT_R8_SRGB,
+			[ sRGBEncoding ]: VK_FORMAT_R8_UNORM,
 		},
 		},
 	},
 	},
 
 
@@ -195,8 +195,8 @@ export class KTX2Exporter {
 				channelType: channelType,
 				channelType: channelType,
 				bitOffset: i * array.BYTES_PER_ELEMENT,
 				bitOffset: i * array.BYTES_PER_ELEMENT,
 				bitLength: array.BYTES_PER_ELEMENT * 8 - 1,
 				bitLength: array.BYTES_PER_ELEMENT * 8 - 1,
-				samplePosition: [0, 0, 0, 0],
-				sampleLower: texture.type === UnsignedByteType ? 0 : -1,
+				samplePosition: [ 0, 0, 0, 0 ],
+				sampleLower: texture.type === UnsignedByteType ? 0 : - 1,
 				sampleUpper: texture.type === UnsignedByteType ? 255 : 1,
 				sampleUpper: texture.type === UnsignedByteType ? 255 : 1,
 
 
 			} );
 			} );
@@ -214,7 +214,7 @@ export class KTX2Exporter {
 
 
 		//
 		//
 
 
-		container.keyValue['KTXwriter'] = `three.js ${ REVISION }`;
+		container.keyValue[ 'KTXwriter' ] = `three.js ${ REVISION }`;
 
 
 		//
 		//
 
 
@@ -250,7 +250,7 @@ function toDataTexture( renderer, rtt ) {
 
 
 	renderer.readRenderTargetPixels( rtt, 0, 0, rtt.width, rtt.height, view );
 	renderer.readRenderTargetPixels( rtt, 0, 0, rtt.width, rtt.height, view );
 
 
-	return new DataTexture( view, rtt.width, rt.height, rtt.texture.format, rtt.texture.type );
+	return new DataTexture( view, rtt.width, rtt.height, rtt.texture.format, rtt.texture.type );
 
 
 }
 }
 
 

+ 9 - 9
examples/jsm/interactive/HTMLMesh.js

@@ -203,7 +203,7 @@ function html2canvas( element ) {
 
 
 	}
 	}
 
 
-	function buildRectPath(x, y, w, h, r) {
+	function buildRectPath( x, y, w, h, r ) {
 
 
 		if ( w < 2 * r ) r = w / 2;
 		if ( w < 2 * r ) r = w / 2;
 		if ( h < 2 * r ) r = h / 2;
 		if ( h < 2 * r ) r = h / 2;
@@ -356,7 +356,7 @@ function html2canvas( element ) {
 				const luminance = Math.sqrt( 0.299 * ( color.r ** 2 ) + 0.587 * ( color.g ** 2 ) + 0.114 * ( color.b ** 2 ) );
 				const luminance = Math.sqrt( 0.299 * ( color.r ** 2 ) + 0.587 * ( color.g ** 2 ) + 0.114 * ( color.b ** 2 ) );
 				const accentTextColor = luminance < 0.5 ? 'white' : '#111111';
 				const accentTextColor = luminance < 0.5 ? 'white' : '#111111';
 
 
-				if ( element.type  === 'radio' ) {
+				if ( element.type === 'radio' ) {
 
 
 					buildRectPath( x, y, width, height, height );
 					buildRectPath( x, y, width, height, height );
 
 
@@ -380,7 +380,7 @@ function html2canvas( element ) {
 
 
 				}
 				}
 
 
-				if ( element.type  === 'checkbox' ) {
+				if ( element.type === 'checkbox' ) {
 
 
 					buildRectPath( x, y, width, height, 2 );
 					buildRectPath( x, y, width, height, 2 );
 
 
@@ -395,7 +395,7 @@ function html2canvas( element ) {
 						const currentTextAlign = context.textAlign;
 						const currentTextAlign = context.textAlign;
 
 
 						context.textAlign = 'center';
 						context.textAlign = 'center';
-						
+
 						const properties = {
 						const properties = {
 							color: accentTextColor,
 							color: accentTextColor,
 							fontFamily: style.fontFamily,
 							fontFamily: style.fontFamily,
@@ -411,10 +411,10 @@ function html2canvas( element ) {
 
 
 				}
 				}
 
 
-				if ( element.type  === 'range' ) {
+				if ( element.type === 'range' ) {
 
 
-					const [min,max,value] = ['min','max','value'].map(property => parseFloat(element[property]));
-					const position = ((value-min)/(max-min)) * (width - height);
+					const [ min, max, value ] = [ 'min', 'max', 'value' ].map( property => parseFloat( element[ property ] ) );
+					const position = ( ( value - min ) / ( max - min ) ) * ( width - height );
 
 
 					buildRectPath( x, y + ( height / 4 ), width, height / 2, height / 4 );
 					buildRectPath( x, y + ( height / 4 ), width, height / 2, height / 4 );
 					context.fillStyle = accentTextColor;
 					context.fillStyle = accentTextColor;
@@ -423,7 +423,7 @@ function html2canvas( element ) {
 					context.fill();
 					context.fill();
 					context.stroke();
 					context.stroke();
 
 
-					buildRectPath( x, y + ( height / 4 ),position + ( height / 2 ), height / 2, height / 4 );
+					buildRectPath( x, y + ( height / 4 ), position + ( height / 2 ), height / 2, height / 4 );
 					context.fillStyle = accentColor;
 					context.fillStyle = accentColor;
 					context.fill();
 					context.fill();
 
 
@@ -522,7 +522,7 @@ function htmlevent( element, event, x, y ) {
 
 
 				element.dispatchEvent( new MouseEvent( event, mouseEventInit ) );
 				element.dispatchEvent( new MouseEvent( event, mouseEventInit ) );
 
 
-				if ( element instanceof HTMLInputElement && element.type  === 'range' && ( event === 'mousedown' || event === 'click' ) ) {
+				if ( element instanceof HTMLInputElement && element.type === 'range' && ( event === 'mousedown' || event === 'click' ) ) {
 
 
 					const [ min, max ] = [ 'min', 'max' ].map( property => parseFloat( element[ property ] ) );
 					const [ min, max ] = [ 'min', 'max' ].map( property => parseFloat( element[ property ] ) );
 
 

+ 3 - 13
examples/jsm/loaders/EXRLoader.js

@@ -1761,21 +1761,11 @@ class EXRLoader extends DataTextureLoader {
 
 
 		const parseInt64 = function ( dataView, offset ) {
 		const parseInt64 = function ( dataView, offset ) {
 
 
-			let int;
-
-			if ( 'getBigInt64' in DataView.prototype ) {
-
-				int = Number( dataView.getBigInt64( offset.value, true ) );
-
-			} else {
-
-				int = dataView.getUint32( offset.value + 4, true ) + Number( dataView.getUint32( offset.value, true ) << 32 );
-
-			}
+			const Int64 = Number( dataView.getBigInt64( offset.value, true ) );
 
 
 			offset.value += ULONG_SIZE;
 			offset.value += ULONG_SIZE;
 
 
-			return int;
+			return Int64;
 
 
 		};
 		};
 
 
@@ -2056,7 +2046,7 @@ class EXRLoader extends DataTextureLoader {
 
 
 			}
 			}
 
 
-			if ( ( spec & ~0x04 ) != 0 ) { // unsupported tiled, deep-image, multi-part
+			if ( ( spec & ~ 0x04 ) != 0 ) { // unsupported tiled, deep-image, multi-part
 
 
 				console.error( 'EXRHeader:', EXRHeader );
 				console.error( 'EXRHeader:', EXRHeader );
 				throw new Error( 'THREE.EXRLoader: provided file is currently unsupported.' );
 				throw new Error( 'THREE.EXRLoader: provided file is currently unsupported.' );

+ 1 - 1
examples/jsm/loaders/FontLoader.js

@@ -72,7 +72,7 @@ class Font {
 
 
 		for ( let p = 0, pl = paths.length; p < pl; p ++ ) {
 		for ( let p = 0, pl = paths.length; p < pl; p ++ ) {
 
 
-			Array.prototype.push.apply( shapes, paths[ p ].toShapes() );
+			shapes.push( ...paths[ p ].toShapes() );
 
 
 		}
 		}
 
 

+ 30 - 33
examples/jsm/loaders/GLTFLoader.js

@@ -1955,47 +1955,47 @@ class GLTFCubicSplineInterpolant extends Interpolant {
 
 
 	}
 	}
 
 
-}
+	interpolate_( i1, t0, t, t1 ) {
 
 
-GLTFCubicSplineInterpolant.prototype.interpolate_ = function ( i1, t0, t, t1 ) {
+		const result = this.resultBuffer;
+		const values = this.sampleValues;
+		const stride = this.valueSize;
 
 
-	const result = this.resultBuffer;
-	const values = this.sampleValues;
-	const stride = this.valueSize;
+		const stride2 = stride * 2;
+		const stride3 = stride * 3;
 
 
-	const stride2 = stride * 2;
-	const stride3 = stride * 3;
+		const td = t1 - t0;
 
 
-	const td = t1 - t0;
+		const p = ( t - t0 ) / td;
+		const pp = p * p;
+		const ppp = pp * p;
 
 
-	const p = ( t - t0 ) / td;
-	const pp = p * p;
-	const ppp = pp * p;
+		const offset1 = i1 * stride3;
+		const offset0 = offset1 - stride3;
 
 
-	const offset1 = i1 * stride3;
-	const offset0 = offset1 - stride3;
+		const s2 = - 2 * ppp + 3 * pp;
+		const s3 = ppp - pp;
+		const s0 = 1 - s2;
+		const s1 = s3 - pp + p;
 
 
-	const s2 = - 2 * ppp + 3 * pp;
-	const s3 = ppp - pp;
-	const s0 = 1 - s2;
-	const s1 = s3 - pp + p;
+		// Layout of keyframe output values for CUBICSPLINE animations:
+		//   [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]
+		for ( let i = 0; i !== stride; i ++ ) {
 
 
-	// Layout of keyframe output values for CUBICSPLINE animations:
-	//   [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]
-	for ( let i = 0; i !== stride; i ++ ) {
+			const p0 = values[ offset0 + i + stride ]; // splineVertex_k
+			const m0 = values[ offset0 + i + stride2 ] * td; // outTangent_k * (t_k+1 - t_k)
+			const p1 = values[ offset1 + i + stride ]; // splineVertex_k+1
+			const m1 = values[ offset1 + i ] * td; // inTangent_k+1 * (t_k+1 - t_k)
 
 
-		const p0 = values[ offset0 + i + stride ]; // splineVertex_k
-		const m0 = values[ offset0 + i + stride2 ] * td; // outTangent_k * (t_k+1 - t_k)
-		const p1 = values[ offset1 + i + stride ]; // splineVertex_k+1
-		const m1 = values[ offset1 + i ] * td; // inTangent_k+1 * (t_k+1 - t_k)
+			result[ i ] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;
 
 
-		result[ i ] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;
+		}
 
 
-	}
+		return result;
 
 
-	return result;
+	}
 
 
-};
+}
 
 
 const _q = new Quaternion();
 const _q = new Quaternion();
 
 
@@ -3197,9 +3197,7 @@ class GLTFParser {
 			if ( ! pointsMaterial ) {
 			if ( ! pointsMaterial ) {
 
 
 				pointsMaterial = new PointsMaterial();
 				pointsMaterial = new PointsMaterial();
-				Material.prototype.copy.call( pointsMaterial, material );
-				pointsMaterial.color.copy( material.color );
-				pointsMaterial.map = material.map;
+				pointsMaterial.copy( material );
 				pointsMaterial.sizeAttenuation = false; // glTF spec says points should be 1px
 				pointsMaterial.sizeAttenuation = false; // glTF spec says points should be 1px
 
 
 				this.cache.add( cacheKey, pointsMaterial );
 				this.cache.add( cacheKey, pointsMaterial );
@@ -3217,8 +3215,7 @@ class GLTFParser {
 			if ( ! lineMaterial ) {
 			if ( ! lineMaterial ) {
 
 
 				lineMaterial = new LineBasicMaterial();
 				lineMaterial = new LineBasicMaterial();
-				Material.prototype.copy.call( lineMaterial, material );
-				lineMaterial.color.copy( material.color );
+				lineMaterial.copy( material );
 
 
 				this.cache.add( cacheKey, lineMaterial );
 				this.cache.add( cacheKey, lineMaterial );
 
 

+ 27 - 27
examples/jsm/loaders/KTX2Loader.js

@@ -614,47 +614,47 @@ KTX2Loader.BasisWorker = function () {
 
 
 const FORMAT_MAP = {
 const FORMAT_MAP = {
 
 
-	[VK_FORMAT_R32G32B32A32_SFLOAT]: RGBAFormat,
-	[VK_FORMAT_R16G16B16A16_SFLOAT]: RGBAFormat,
-	[VK_FORMAT_R8G8B8A8_UNORM]: RGBAFormat,
-	[VK_FORMAT_R8G8B8A8_SRGB]: RGBAFormat,
+	[ VK_FORMAT_R32G32B32A32_SFLOAT ]: RGBAFormat,
+	[ VK_FORMAT_R16G16B16A16_SFLOAT ]: RGBAFormat,
+	[ VK_FORMAT_R8G8B8A8_UNORM ]: RGBAFormat,
+	[ VK_FORMAT_R8G8B8A8_SRGB ]: RGBAFormat,
 
 
-	[VK_FORMAT_R32G32_SFLOAT]: RGFormat,
-	[VK_FORMAT_R16G16_SFLOAT]: RGFormat,
-	[VK_FORMAT_R8G8_UNORM]: RGFormat,
-	[VK_FORMAT_R8G8_SRGB]: RGFormat,
+	[ VK_FORMAT_R32G32_SFLOAT ]: RGFormat,
+	[ VK_FORMAT_R16G16_SFLOAT ]: RGFormat,
+	[ VK_FORMAT_R8G8_UNORM ]: RGFormat,
+	[ VK_FORMAT_R8G8_SRGB ]: RGFormat,
 
 
-	[VK_FORMAT_R32_SFLOAT]: RedFormat,
-	[VK_FORMAT_R16_SFLOAT]: RedFormat,
-	[VK_FORMAT_R8_SRGB]: RedFormat,
-	[VK_FORMAT_R8_UNORM]: RedFormat,
+	[ VK_FORMAT_R32_SFLOAT ]: RedFormat,
+	[ VK_FORMAT_R16_SFLOAT ]: RedFormat,
+	[ VK_FORMAT_R8_SRGB ]: RedFormat,
+	[ VK_FORMAT_R8_UNORM ]: RedFormat,
 
 
 };
 };
 
 
 const TYPE_MAP = {
 const TYPE_MAP = {
 
 
-	[VK_FORMAT_R32G32B32A32_SFLOAT]: FloatType,
-	[VK_FORMAT_R16G16B16A16_SFLOAT]: HalfFloatType,
-	[VK_FORMAT_R8G8B8A8_UNORM]: UnsignedByteType,
-	[VK_FORMAT_R8G8B8A8_SRGB]: UnsignedByteType,
+	[ VK_FORMAT_R32G32B32A32_SFLOAT ]: FloatType,
+	[ VK_FORMAT_R16G16B16A16_SFLOAT ]: HalfFloatType,
+	[ VK_FORMAT_R8G8B8A8_UNORM ]: UnsignedByteType,
+	[ VK_FORMAT_R8G8B8A8_SRGB ]: UnsignedByteType,
 
 
-	[VK_FORMAT_R32G32_SFLOAT]: FloatType,
-	[VK_FORMAT_R16G16_SFLOAT]: HalfFloatType,
-	[VK_FORMAT_R8G8_UNORM]: UnsignedByteType,
-	[VK_FORMAT_R8G8_SRGB]: UnsignedByteType,
+	[ VK_FORMAT_R32G32_SFLOAT ]: FloatType,
+	[ VK_FORMAT_R16G16_SFLOAT ]: HalfFloatType,
+	[ VK_FORMAT_R8G8_UNORM ]: UnsignedByteType,
+	[ VK_FORMAT_R8G8_SRGB ]: UnsignedByteType,
 
 
-	[VK_FORMAT_R32_SFLOAT]: FloatType,
-	[VK_FORMAT_R16_SFLOAT]: HalfFloatType,
-	[VK_FORMAT_R8_SRGB]: UnsignedByteType,
-	[VK_FORMAT_R8_UNORM]: UnsignedByteType,
+	[ VK_FORMAT_R32_SFLOAT ]: FloatType,
+	[ VK_FORMAT_R16_SFLOAT ]: HalfFloatType,
+	[ VK_FORMAT_R8_SRGB ]: UnsignedByteType,
+	[ VK_FORMAT_R8_UNORM ]: UnsignedByteType,
 
 
 };
 };
 
 
 const ENCODING_MAP = {
 const ENCODING_MAP = {
 
 
-	[VK_FORMAT_R8G8B8A8_SRGB]: sRGBEncoding,
-	[VK_FORMAT_R8G8_SRGB]: sRGBEncoding,
-	[VK_FORMAT_R8_SRGB]: sRGBEncoding,
+	[ VK_FORMAT_R8G8B8A8_SRGB ]: sRGBEncoding,
+	[ VK_FORMAT_R8G8_SRGB ]: sRGBEncoding,
+	[ VK_FORMAT_R8_SRGB ]: sRGBEncoding,
 
 
 };
 };
 
 

+ 1 - 1
examples/jsm/loaders/RGBELoader.js

@@ -450,7 +450,7 @@ class RGBELoader extends DataTextureLoader {
 					texture.magFilter = LinearFilter;
 					texture.magFilter = LinearFilter;
 					texture.generateMipmaps = false;
 					texture.generateMipmaps = false;
 					texture.flipY = true;
 					texture.flipY = true;
-			
+
 					break;
 					break;
 
 
 			}
 			}

+ 23 - 25
examples/jsm/loaders/VRMLLoader.js

@@ -258,19 +258,17 @@ class VRMLLoader extends Loader {
 
 
 			// the visitor is created dynmaically based on the given base class
 			// the visitor is created dynmaically based on the given base class
 
 
-			function VRMLToASTVisitor() {
+			class VRMLToASTVisitor extends BaseVRMLVisitor {
 
 
-				BaseVRMLVisitor.call( this );
+				constructor() {
 
 
-				this.validateVisitor();
+					super();
 
 
-			}
-
-			VRMLToASTVisitor.prototype = Object.assign( Object.create( BaseVRMLVisitor.prototype ), {
+					this.validateVisitor();
 
 
-				constructor: VRMLToASTVisitor,
+				}
 
 
-				vrml: function ( ctx ) {
+				vrml( ctx ) {
 
 
 					const data = {
 					const data = {
 						version: this.visit( ctx.version ),
 						version: this.visit( ctx.version ),
@@ -300,15 +298,15 @@ class VRMLLoader extends Loader {
 
 
 					return data;
 					return data;
 
 
-				},
+				}
 
 
-				version: function ( ctx ) {
+				version( ctx ) {
 
 
 					return ctx.Version[ 0 ].image;
 					return ctx.Version[ 0 ].image;
 
 
-				},
+				}
 
 
-				node: function ( ctx ) {
+				node( ctx ) {
 
 
 					const data = {
 					const data = {
 						name: ctx.NodeName[ 0 ].image,
 						name: ctx.NodeName[ 0 ].image,
@@ -337,9 +335,9 @@ class VRMLLoader extends Loader {
 
 
 					return data;
 					return data;
 
 
-				},
+				}
 
 
-				field: function ( ctx ) {
+				field( ctx ) {
 
 
 					const data = {
 					const data = {
 						name: ctx.Identifier[ 0 ].image,
 						name: ctx.Identifier[ 0 ].image,
@@ -370,33 +368,33 @@ class VRMLLoader extends Loader {
 
 
 					return data;
 					return data;
 
 
-				},
+				}
 
 
-				def: function ( ctx ) {
+				def( ctx ) {
 
 
 					return ( ctx.Identifier || ctx.NodeName )[ 0 ].image;
 					return ( ctx.Identifier || ctx.NodeName )[ 0 ].image;
 
 
-				},
+				}
 
 
-				use: function ( ctx ) {
+				use( ctx ) {
 
 
 					return { USE: ( ctx.Identifier || ctx.NodeName )[ 0 ].image };
 					return { USE: ( ctx.Identifier || ctx.NodeName )[ 0 ].image };
 
 
-				},
+				}
 
 
-				singleFieldValue: function ( ctx ) {
+				singleFieldValue( ctx ) {
 
 
 					return processField( this, ctx );
 					return processField( this, ctx );
 
 
-				},
+				}
 
 
-				multiFieldValue: function ( ctx ) {
+				multiFieldValue( ctx ) {
 
 
 					return processField( this, ctx );
 					return processField( this, ctx );
 
 
-				},
+				}
 
 
-				route: function ( ctx ) {
+				route( ctx ) {
 
 
 					const data = {
 					const data = {
 						FROM: ctx.RouteIdentifier[ 0 ].image,
 						FROM: ctx.RouteIdentifier[ 0 ].image,
@@ -407,7 +405,7 @@ class VRMLLoader extends Loader {
 
 
 				}
 				}
 
 
-			} );
+			}
 
 
 			function processField( scope, ctx ) {
 			function processField( scope, ctx ) {
 
 

+ 1 - 1
examples/jsm/loaders/VTKLoader.js

@@ -910,7 +910,7 @@ class VTKLoader extends Loader {
 
 
 						let arr;
 						let arr;
 
 
-						if ( Object.prototype.toString.call( section.DataArray ) === '[object Array]' ) {
+						if ( Array.isArray( section.DataArray ) ) {
 
 
 							arr = section.DataArray;
 							arr = section.DataArray;
 
 

+ 6 - 8
examples/jsm/loaders/lwo/LWO2Parser.js

@@ -1,14 +1,12 @@
-function LWO2Parser( IFFParser ) {
+class LWO2Parser {
 
 
-	this.IFF = IFFParser;
+	constructor( IFFParser ) {
 
 
-}
-
-LWO2Parser.prototype = {
+		this.IFF = IFFParser;
 
 
-	constructor: LWO2Parser,
+	}
 
 
-	parseBlock: function () {
+	parseBlock() {
 
 
 		this.IFF.debugger.offset = this.IFF.reader.offset;
 		this.IFF.debugger.offset = this.IFF.reader.offset;
 		this.IFF.debugger.closeForms();
 		this.IFF.debugger.closeForms();
@@ -411,6 +409,6 @@ LWO2Parser.prototype = {
 
 
 	}
 	}
 
 
-};
+}
 
 
 export { LWO2Parser };
 export { LWO2Parser };

+ 6 - 8
examples/jsm/loaders/lwo/LWO3Parser.js

@@ -1,14 +1,12 @@
-function LWO3Parser( IFFParser ) {
+class LWO3Parser {
 
 
-	this.IFF = IFFParser;
+	constructor( IFFParser ) {
 
 
-}
-
-LWO3Parser.prototype = {
+		this.IFF = IFFParser;
 
 
-	constructor: LWO3Parser,
+	}
 
 
-	parseBlock: function () {
+	parseBlock() {
 
 
 		this.IFF.debugger.offset = this.IFF.reader.offset;
 		this.IFF.debugger.offset = this.IFF.reader.offset;
 		this.IFF.debugger.closeForms();
 		this.IFF.debugger.closeForms();
@@ -370,6 +368,6 @@ LWO3Parser.prototype = {
 
 
 	}
 	}
 
 
-};
+}
 
 
 export { LWO3Parser };
 export { LWO3Parser };

+ 169 - 171
examples/jsm/misc/Volume.js

@@ -17,190 +17,188 @@ import { VolumeSlice } from '../misc/VolumeSlice.js';
  * @param   {string}        type            The type of data (uint8, uint16, ...)
  * @param   {string}        type            The type of data (uint8, uint16, ...)
  * @param   {ArrayBuffer}   arrayBuffer     The buffer with volume data
  * @param   {ArrayBuffer}   arrayBuffer     The buffer with volume data
  */
  */
-function Volume( xLength, yLength, zLength, type, arrayBuffer ) {
+class Volume {
+
+	constructor( xLength, yLength, zLength, type, arrayBuffer ) {
+
+		if ( xLength !== undefined ) {
+
+			/**
+			 * @member {number} xLength Width of the volume in the IJK coordinate system
+			 */
+			this.xLength = Number( xLength ) || 1;
+			/**
+			 * @member {number} yLength Height of the volume in the IJK coordinate system
+			 */
+			this.yLength = Number( yLength ) || 1;
+			/**
+			 * @member {number} zLength Depth of the volume in the IJK coordinate system
+			 */
+			this.zLength = Number( zLength ) || 1;
+			/**
+			 * @member {Array<string>} The order of the Axis dictated by the NRRD header
+			 */
+			this.axisOrder = [ 'x', 'y', 'z' ];
+			/**
+			 * @member {TypedArray} data Data of the volume
+			 */
+
+			switch ( type ) {
+
+				case 'Uint8' :
+				case 'uint8' :
+				case 'uchar' :
+				case 'unsigned char' :
+				case 'uint8_t' :
+					this.data = new Uint8Array( arrayBuffer );
+					break;
+				case 'Int8' :
+				case 'int8' :
+				case 'signed char' :
+				case 'int8_t' :
+					this.data = new Int8Array( arrayBuffer );
+					break;
+				case 'Int16' :
+				case 'int16' :
+				case 'short' :
+				case 'short int' :
+				case 'signed short' :
+				case 'signed short int' :
+				case 'int16_t' :
+					this.data = new Int16Array( arrayBuffer );
+					break;
+				case 'Uint16' :
+				case 'uint16' :
+				case 'ushort' :
+				case 'unsigned short' :
+				case 'unsigned short int' :
+				case 'uint16_t' :
+					this.data = new Uint16Array( arrayBuffer );
+					break;
+				case 'Int32' :
+				case 'int32' :
+				case 'int' :
+				case 'signed int' :
+				case 'int32_t' :
+					this.data = new Int32Array( arrayBuffer );
+					break;
+				case 'Uint32' :
+				case 'uint32' :
+				case 'uint' :
+				case 'unsigned int' :
+				case 'uint32_t' :
+					this.data = new Uint32Array( arrayBuffer );
+					break;
+				case 'longlong' :
+				case 'long long' :
+				case 'long long int' :
+				case 'signed long long' :
+				case 'signed long long int' :
+				case 'int64' :
+				case 'int64_t' :
+				case 'ulonglong' :
+				case 'unsigned long long' :
+				case 'unsigned long long int' :
+				case 'uint64' :
+				case 'uint64_t' :
+					throw new Error( 'Error in Volume constructor : this type is not supported in JavaScript' );
+					break;
+				case 'Float32' :
+				case 'float32' :
+				case 'float' :
+					this.data = new Float32Array( arrayBuffer );
+					break;
+				case 'Float64' :
+				case 'float64' :
+				case 'double' :
+					this.data = new Float64Array( arrayBuffer );
+					break;
+				default :
+					this.data = new Uint8Array( arrayBuffer );
 
 
-	if ( arguments.length > 0 ) {
+			}
+
+			if ( this.data.length !== this.xLength * this.yLength * this.zLength ) {
+
+				throw new Error( 'Error in Volume constructor, lengths are not matching arrayBuffer size' );
+
+			}
+
+		}
 
 
 		/**
 		/**
-		 * @member {number} xLength Width of the volume in the IJK coordinate system
+		 * @member {Array}  spacing Spacing to apply to the volume from IJK to RAS coordinate system
 		 */
 		 */
-		this.xLength = Number( xLength ) || 1;
+		this.spacing = [ 1, 1, 1 ];
 		/**
 		/**
-		 * @member {number} yLength Height of the volume in the IJK coordinate system
+		 * @member {Array}  offset Offset of the volume in the RAS coordinate system
 		 */
 		 */
-		this.yLength = Number( yLength ) || 1;
+		this.offset = [ 0, 0, 0 ];
 		/**
 		/**
-		 * @member {number} zLength Depth of the volume in the IJK coordinate system
+		 * @member {Martrix3} matrix The IJK to RAS matrix
 		 */
 		 */
-		this.zLength = Number( zLength ) || 1;
+		this.matrix = new Matrix3();
+		this.matrix.identity();
 		/**
 		/**
-		 * @member {Array<string>} The order of the Axis dictated by the NRRD header
+		 * @member {Martrix3} inverseMatrix The RAS to IJK matrix
 		 */
 		 */
-		this.axisOrder = [ 'x', 'y', 'z' ];
 		/**
 		/**
-		 * @member {TypedArray} data Data of the volume
+		 * @member {number} lowerThreshold The voxels with values under this threshold won't appear in the slices.
+		 *                      If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume
 		 */
 		 */
+		let lowerThreshold = - Infinity;
+		Object.defineProperty( this, 'lowerThreshold', {
+			get: function () {
 
 
-		switch ( type ) {
-
-			case 'Uint8' :
-			case 'uint8' :
-			case 'uchar' :
-			case 'unsigned char' :
-			case 'uint8_t' :
-				this.data = new Uint8Array( arrayBuffer );
-				break;
-			case 'Int8' :
-			case 'int8' :
-			case 'signed char' :
-			case 'int8_t' :
-				this.data = new Int8Array( arrayBuffer );
-				break;
-			case 'Int16' :
-			case 'int16' :
-			case 'short' :
-			case 'short int' :
-			case 'signed short' :
-			case 'signed short int' :
-			case 'int16_t' :
-				this.data = new Int16Array( arrayBuffer );
-				break;
-			case 'Uint16' :
-			case 'uint16' :
-			case 'ushort' :
-			case 'unsigned short' :
-			case 'unsigned short int' :
-			case 'uint16_t' :
-				this.data = new Uint16Array( arrayBuffer );
-				break;
-			case 'Int32' :
-			case 'int32' :
-			case 'int' :
-			case 'signed int' :
-			case 'int32_t' :
-				this.data = new Int32Array( arrayBuffer );
-				break;
-			case 'Uint32' :
-			case 'uint32' :
-			case 'uint' :
-			case 'unsigned int' :
-			case 'uint32_t' :
-				this.data = new Uint32Array( arrayBuffer );
-				break;
-			case 'longlong' :
-			case 'long long' :
-			case 'long long int' :
-			case 'signed long long' :
-			case 'signed long long int' :
-			case 'int64' :
-			case 'int64_t' :
-			case 'ulonglong' :
-			case 'unsigned long long' :
-			case 'unsigned long long int' :
-			case 'uint64' :
-			case 'uint64_t' :
-				throw new Error( 'Error in Volume constructor : this type is not supported in JavaScript' );
-				break;
-			case 'Float32' :
-			case 'float32' :
-			case 'float' :
-				this.data = new Float32Array( arrayBuffer );
-				break;
-			case 'Float64' :
-			case 'float64' :
-			case 'double' :
-				this.data = new Float64Array( arrayBuffer );
-				break;
-			default :
-				this.data = new Uint8Array( arrayBuffer );
-
-		}
-
-		if ( this.data.length !== this.xLength * this.yLength * this.zLength ) {
-
-			throw new Error( 'Error in Volume constructor, lengths are not matching arrayBuffer size' );
-
-		}
-
-	}
-
-	/**
-	 * @member {Array}  spacing Spacing to apply to the volume from IJK to RAS coordinate system
-	 */
-	this.spacing = [ 1, 1, 1 ];
-	/**
-	 * @member {Array}  offset Offset of the volume in the RAS coordinate system
-	 */
-	this.offset = [ 0, 0, 0 ];
-	/**
-	 * @member {Martrix3} matrix The IJK to RAS matrix
-	 */
-	this.matrix = new Matrix3();
-	this.matrix.identity();
-	/**
-	 * @member {Martrix3} inverseMatrix The RAS to IJK matrix
-	 */
-	/**
-	 * @member {number} lowerThreshold The voxels with values under this threshold won't appear in the slices.
-	 *                      If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume
-	 */
-	let lowerThreshold = - Infinity;
-	Object.defineProperty( this, 'lowerThreshold', {
-		get: function () {
-
-			return lowerThreshold;
-
-		},
-		set: function ( value ) {
+				return lowerThreshold;
 
 
-			lowerThreshold = value;
-			this.sliceList.forEach( function ( slice ) {
+			},
+			set: function ( value ) {
 
 
-				slice.geometryNeedsUpdate = true;
+				lowerThreshold = value;
+				this.sliceList.forEach( function ( slice ) {
 
 
-			} );
-
-		}
-	} );
-	/**
-	 * @member {number} upperThreshold The voxels with values over this threshold won't appear in the slices.
-	 *                      If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume
-	 */
-	let upperThreshold = Infinity;
-	Object.defineProperty( this, 'upperThreshold', {
-		get: function () {
+					slice.geometryNeedsUpdate = true;
 
 
-			return upperThreshold;
+				} );
 
 
-		},
-		set: function ( value ) {
+			}
+		} );
+		/**
+		 * @member {number} upperThreshold The voxels with values over this threshold won't appear in the slices.
+		 *                      If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume
+		 */
+		let upperThreshold = Infinity;
+		Object.defineProperty( this, 'upperThreshold', {
+			get: function () {
 
 
-			upperThreshold = value;
-			this.sliceList.forEach( function ( slice ) {
+				return upperThreshold;
 
 
-				slice.geometryNeedsUpdate = true;
+			},
+			set: function ( value ) {
 
 
-			} );
+				upperThreshold = value;
+				this.sliceList.forEach( function ( slice ) {
 
 
-		}
-	} );
+					slice.geometryNeedsUpdate = true;
 
 
+				} );
 
 
-	/**
-	 * @member {Array} sliceList The list of all the slices associated to this volume
-	 */
-	this.sliceList = [];
+			}
+		} );
 
 
 
 
-	/**
-	 * @member {Array} RASDimensions This array holds the dimensions of the volume in the RAS space
-	 */
+		/**
+		 * @member {Array} sliceList The list of all the slices associated to this volume
+		 */
+		this.sliceList = [];
 
 
-}
 
 
-Volume.prototype = {
+		/**
+		 * @member {Array} RASDimensions This array holds the dimensions of the volume in the RAS space
+		 */
 
 
-	constructor: Volume,
+	}
 
 
 	/**
 	/**
 	 * @member {Function} getData Shortcut for data[access(i,j,k)]
 	 * @member {Function} getData Shortcut for data[access(i,j,k)]
@@ -210,11 +208,11 @@ Volume.prototype = {
 	 * @param {number} k    Third coordinate
 	 * @param {number} k    Third coordinate
 	 * @returns {number}  value in the data array
 	 * @returns {number}  value in the data array
 	 */
 	 */
-	getData: function ( i, j, k ) {
+	getData( i, j, k ) {
 
 
 		return this.data[ k * this.xLength * this.yLength + j * this.xLength + i ];
 		return this.data[ k * this.xLength * this.yLength + j * this.xLength + i ];
 
 
-	},
+	}
 
 
 	/**
 	/**
 	 * @member {Function} access compute the index in the data array corresponding to the given coordinates in IJK system
 	 * @member {Function} access compute the index in the data array corresponding to the given coordinates in IJK system
@@ -224,11 +222,11 @@ Volume.prototype = {
 	 * @param {number} k    Third coordinate
 	 * @param {number} k    Third coordinate
 	 * @returns {number}  index
 	 * @returns {number}  index
 	 */
 	 */
-	access: function ( i, j, k ) {
+	access( i, j, k ) {
 
 
 		return k * this.xLength * this.yLength + j * this.xLength + i;
 		return k * this.xLength * this.yLength + j * this.xLength + i;
 
 
-	},
+	}
 
 
 	/**
 	/**
 	 * @member {Function} reverseAccess Retrieve the IJK coordinates of the voxel corresponding of the given index in the data
 	 * @member {Function} reverseAccess Retrieve the IJK coordinates of the voxel corresponding of the given index in the data
@@ -236,14 +234,14 @@ Volume.prototype = {
 	 * @param {number} index index of the voxel
 	 * @param {number} index index of the voxel
 	 * @returns {Array}  [x,y,z]
 	 * @returns {Array}  [x,y,z]
 	 */
 	 */
-	reverseAccess: function ( index ) {
+	reverseAccess( index ) {
 
 
 		const z = Math.floor( index / ( this.yLength * this.xLength ) );
 		const z = Math.floor( index / ( this.yLength * this.xLength ) );
 		const y = Math.floor( ( index - z * this.yLength * this.xLength ) / this.xLength );
 		const y = Math.floor( ( index - z * this.yLength * this.xLength ) / this.xLength );
 		const x = index - z * this.yLength * this.xLength - y * this.xLength;
 		const x = index - z * this.yLength * this.xLength - y * this.xLength;
 		return [ x, y, z ];
 		return [ x, y, z ];
 
 
-	},
+	}
 
 
 	/**
 	/**
 	 * @member {Function} map Apply a function to all the voxels, be careful, the value will be replaced
 	 * @member {Function} map Apply a function to all the voxels, be careful, the value will be replaced
@@ -255,7 +253,7 @@ Volume.prototype = {
 	 * @param {Object}   context    You can specify a context in which call the function, default if this Volume
 	 * @param {Object}   context    You can specify a context in which call the function, default if this Volume
 	 * @returns {Volume}   this
 	 * @returns {Volume}   this
 	 */
 	 */
-	map: function ( functionToMap, context ) {
+	map( functionToMap, context ) {
 
 
 		const length = this.data.length;
 		const length = this.data.length;
 		context = context || this;
 		context = context || this;
@@ -268,7 +266,7 @@ Volume.prototype = {
 
 
 		return this;
 		return this;
 
 
-	},
+	}
 
 
 	/**
 	/**
 	 * @member {Function} extractPerpendicularPlane Compute the orientation of the slice and returns all the information relative to the geometry such as sliceAccess, the plane matrix (orientation and position in RAS coordinate) and the dimensions of the plane in both coordinate system.
 	 * @member {Function} extractPerpendicularPlane Compute the orientation of the slice and returns all the information relative to the geometry such as sliceAccess, the plane matrix (orientation and position in RAS coordinate) and the dimensions of the plane in both coordinate system.
@@ -277,7 +275,7 @@ Volume.prototype = {
 	 * @param {number}            index the index of the slice
 	 * @param {number}            index the index of the slice
 	 * @returns {Object} an object containing all the usefull information on the geometry of the slice
 	 * @returns {Object} an object containing all the usefull information on the geometry of the slice
 	 */
 	 */
-	extractPerpendicularPlane: function ( axis, RASIndex ) {
+	extractPerpendicularPlane( axis, RASIndex ) {
 
 
 		let firstSpacing,
 		let firstSpacing,
 			secondSpacing,
 			secondSpacing,
@@ -387,7 +385,7 @@ Volume.prototype = {
 			planeHeight: planeHeight
 			planeHeight: planeHeight
 		};
 		};
 
 
-	},
+	}
 
 
 	/**
 	/**
 	 * @member {Function} extractSlice Returns a slice corresponding to the given axis and index
 	 * @member {Function} extractSlice Returns a slice corresponding to the given axis and index
@@ -397,13 +395,13 @@ Volume.prototype = {
 	 * @param {number}            index the index of the slice
 	 * @param {number}            index the index of the slice
 	 * @returns {VolumeSlice} the extracted slice
 	 * @returns {VolumeSlice} the extracted slice
 	 */
 	 */
-	extractSlice: function ( axis, index ) {
+	extractSlice( axis, index ) {
 
 
 		const slice = new VolumeSlice( this, index, axis );
 		const slice = new VolumeSlice( this, index, axis );
 		this.sliceList.push( slice );
 		this.sliceList.push( slice );
 		return slice;
 		return slice;
 
 
-	},
+	}
 
 
 	/**
 	/**
 	 * @member {Function} repaintAllSlices Call repaint on all the slices extracted from this volume
 	 * @member {Function} repaintAllSlices Call repaint on all the slices extracted from this volume
@@ -411,7 +409,7 @@ Volume.prototype = {
 	 * @memberof Volume
 	 * @memberof Volume
 	 * @returns {Volume} this
 	 * @returns {Volume} this
 	 */
 	 */
-	repaintAllSlices: function () {
+	repaintAllSlices() {
 
 
 		this.sliceList.forEach( function ( slice ) {
 		this.sliceList.forEach( function ( slice ) {
 
 
@@ -421,14 +419,14 @@ Volume.prototype = {
 
 
 		return this;
 		return this;
 
 
-	},
+	}
 
 
 	/**
 	/**
 	 * @member {Function} computeMinMax Compute the minimum and the maximum of the data in the volume
 	 * @member {Function} computeMinMax Compute the minimum and the maximum of the data in the volume
 	 * @memberof Volume
 	 * @memberof Volume
 	 * @returns {Array} [min,max]
 	 * @returns {Array} [min,max]
 	 */
 	 */
-	computeMinMax: function () {
+	computeMinMax() {
 
 
 		let min = Infinity;
 		let min = Infinity;
 		let max = - Infinity;
 		let max = - Infinity;
@@ -457,6 +455,6 @@ Volume.prototype = {
 
 
 	}
 	}
 
 
-};
+}
 
 
 export { Volume };
 export { Volume };

+ 78 - 80
examples/jsm/misc/VolumeSlice.js

@@ -16,96 +16,94 @@ import {
  * @param   {string}       [axis='z']      For now only 'x', 'y' or 'z' but later it will change to a normal vector
  * @param   {string}       [axis='z']      For now only 'x', 'y' or 'z' but later it will change to a normal vector
  * @see Volume
  * @see Volume
  */
  */
-function VolumeSlice( volume, index, axis ) {
+class VolumeSlice {
 
 
-	const slice = this;
-	/**
-	 * @member {Volume} volume The associated volume
-	 */
-	this.volume = volume;
-	/**
-	 * @member {Number} index The index of the slice, if changed, will automatically call updateGeometry at the next repaint
-	 */
-	index = index || 0;
-	Object.defineProperty( this, 'index', {
-		get: function () {
-
-			return index;
-
-		},
-		set: function ( value ) {
-
-			index = value;
-			slice.geometryNeedsUpdate = true;
-			return index;
-
-		}
-	} );
-	/**
-	 * @member {String} axis The normal axis
-	 */
-	this.axis = axis || 'z';
-
-	/**
-	 * @member {HTMLCanvasElement} canvas The final canvas used for the texture
-	 */
-	/**
-	 * @member {CanvasRenderingContext2D} ctx Context of the canvas
-	 */
-	this.canvas = document.createElement( 'canvas' );
-	/**
-	 * @member {HTMLCanvasElement} canvasBuffer The intermediary canvas used to paint the data
-	 */
-	/**
-	 * @member {CanvasRenderingContext2D} ctxBuffer Context of the canvas buffer
-	 */
-	this.canvasBuffer = document.createElement( 'canvas' );
-	this.updateGeometry();
+	constructor( volume, index, axis ) {
 
 
+		const slice = this;
+		/**
+		 * @member {Volume} volume The associated volume
+		 */
+		this.volume = volume;
+		/**
+		 * @member {Number} index The index of the slice, if changed, will automatically call updateGeometry at the next repaint
+		 */
+		index = index || 0;
+		Object.defineProperty( this, 'index', {
+			get: function () {
 
 
-	const canvasMap = new Texture( this.canvas );
-	canvasMap.minFilter = LinearFilter;
-	canvasMap.wrapS = canvasMap.wrapT = ClampToEdgeWrapping;
-	const material = new MeshBasicMaterial( { map: canvasMap, side: DoubleSide, transparent: true } );
-	/**
-	 * @member {Mesh} mesh The mesh ready to get used in the scene
-	 */
-	this.mesh = new Mesh( this.geometry, material );
-	this.mesh.matrixAutoUpdate = false;
-	/**
-	 * @member {Boolean} geometryNeedsUpdate If set to true, updateGeometry will be triggered at the next repaint
-	 */
-	this.geometryNeedsUpdate = true;
-	this.repaint();
+				return index;
 
 
-	/**
-	 * @member {Number} iLength Width of slice in the original coordinate system, corresponds to the width of the buffer canvas
-	 */
+			},
+			set: function ( value ) {
 
 
-	/**
-	 * @member {Number} jLength Height of slice in the original coordinate system, corresponds to the height of the buffer canvas
-	 */
+				index = value;
+				slice.geometryNeedsUpdate = true;
+				return index;
 
 
-	/**
-	 * @member {Function} sliceAccess Function that allow the slice to access right data
-	 * @see Volume.extractPerpendicularPlane
-	 * @param {Number} i The first coordinate
-	 * @param {Number} j The second coordinate
-	 * @returns {Number} the index corresponding to the voxel in volume.data of the given position in the slice
-	 */
-
-
-}
+			}
+		} );
+		/**
+		 * @member {String} axis The normal axis
+		 */
+		this.axis = axis || 'z';
+
+		/**
+		 * @member {HTMLCanvasElement} canvas The final canvas used for the texture
+		 */
+		/**
+		 * @member {CanvasRenderingContext2D} ctx Context of the canvas
+		 */
+		this.canvas = document.createElement( 'canvas' );
+		/**
+		 * @member {HTMLCanvasElement} canvasBuffer The intermediary canvas used to paint the data
+		 */
+		/**
+		 * @member {CanvasRenderingContext2D} ctxBuffer Context of the canvas buffer
+		 */
+		this.canvasBuffer = document.createElement( 'canvas' );
+		this.updateGeometry();
+
+
+		const canvasMap = new Texture( this.canvas );
+		canvasMap.minFilter = LinearFilter;
+		canvasMap.wrapS = canvasMap.wrapT = ClampToEdgeWrapping;
+		const material = new MeshBasicMaterial( { map: canvasMap, side: DoubleSide, transparent: true } );
+		/**
+		 * @member {Mesh} mesh The mesh ready to get used in the scene
+		 */
+		this.mesh = new Mesh( this.geometry, material );
+		this.mesh.matrixAutoUpdate = false;
+		/**
+		 * @member {Boolean} geometryNeedsUpdate If set to true, updateGeometry will be triggered at the next repaint
+		 */
+		this.geometryNeedsUpdate = true;
+		this.repaint();
+
+		/**
+		 * @member {Number} iLength Width of slice in the original coordinate system, corresponds to the width of the buffer canvas
+		 */
+
+		/**
+		 * @member {Number} jLength Height of slice in the original coordinate system, corresponds to the height of the buffer canvas
+		 */
+
+		/**
+		 * @member {Function} sliceAccess Function that allow the slice to access right data
+		 * @see Volume.extractPerpendicularPlane
+		 * @param {Number} i The first coordinate
+		 * @param {Number} j The second coordinate
+		 * @returns {Number} the index corresponding to the voxel in volume.data of the given position in the slice
+		 */
 
 
-VolumeSlice.prototype = {
 
 
-	constructor: VolumeSlice,
+	}
 
 
 	/**
 	/**
 	 * @member {Function} repaint Refresh the texture and the geometry if geometryNeedsUpdate is set to true
 	 * @member {Function} repaint Refresh the texture and the geometry if geometryNeedsUpdate is set to true
 	 * @memberof VolumeSlice
 	 * @memberof VolumeSlice
 	 */
 	 */
-	repaint: function () {
+	repaint() {
 
 
 		if ( this.geometryNeedsUpdate ) {
 		if ( this.geometryNeedsUpdate ) {
 
 
@@ -185,14 +183,14 @@ VolumeSlice.prototype = {
 
 
 		this.mesh.material.map.needsUpdate = true;
 		this.mesh.material.map.needsUpdate = true;
 
 
-	},
+	}
 
 
 	/**
 	/**
 	 * @member {Function} Refresh the geometry according to axis and index
 	 * @member {Function} Refresh the geometry according to axis and index
 	 * @see Volume.extractPerpendicularPlane
 	 * @see Volume.extractPerpendicularPlane
 	 * @memberof VolumeSlice
 	 * @memberof VolumeSlice
 	 */
 	 */
-	updateGeometry: function () {
+	updateGeometry() {
 
 
 		const extracted = this.volume.extractPerpendicularPlane( this.axis, this.index );
 		const extracted = this.volume.extractPerpendicularPlane( this.axis, this.index );
 		this.sliceAccess = extracted.sliceAccess;
 		this.sliceAccess = extracted.sliceAccess;
@@ -224,6 +222,6 @@ VolumeSlice.prototype = {
 
 
 	}
 	}
 
 
-};
+}
 
 
 export { VolumeSlice };
 export { VolumeSlice };

+ 1 - 1
examples/jsm/nodes/core/Node.js

@@ -182,7 +182,7 @@ class Node {
 
 
 				nodeData.initied = true;
 				nodeData.initied = true;
 
 
-				properties.outputNode =  this.construct( builder );
+				properties.outputNode = this.construct( builder );
 
 
 				for ( const childNode of Object.values( properties ) ) {
 				for ( const childNode of Object.values( properties ) ) {
 
 

+ 1 - 1
examples/jsm/nodes/core/NodeUtils.js

@@ -62,7 +62,7 @@ export const getValueType = ( value ) => {
 
 
 export const getValueFromType = ( type, ...params ) => {
 export const getValueFromType = ( type, ...params ) => {
 
 
-	const last4 = type?.slice( -4 );
+	const last4 = type?.slice( - 4 );
 
 
 	if ( type === 'color' ) {
 	if ( type === 'color' ) {
 
 

+ 4 - 4
examples/jsm/nodes/lighting/LightingContextNode.js

@@ -39,10 +39,10 @@ class LightingContextNode extends ContextNode {
 		};
 		};
 
 
 		const lighting = {
 		const lighting = {
-			radiance : temp( vec3() ),
-			irradiance : temp( vec3() ),
-			iblIrradiance : temp( vec3() ),
-			ambientOcclusion : temp( float( 1 ) )
+			radiance: temp( vec3() ),
+			irradiance: temp( vec3() ),
+			iblIrradiance: temp( vec3() ),
+			ambientOcclusion: temp( float( 1 ) )
 		};
 		};
 
 
 		Object.assign( properties, reflectedLight, lighting );
 		Object.assign( properties, reflectedLight, lighting );

+ 2 - 2
examples/jsm/nodes/loaders/NodeLoader.js

@@ -1,5 +1,5 @@
 import * as Nodes from '../Nodes.js';
 import * as Nodes from '../Nodes.js';
-import { Loader } from 'three';
+import { FileLoader, Loader } from 'three';
 
 
 class NodeLoader extends Loader {
 class NodeLoader extends Loader {
 
 
@@ -79,7 +79,7 @@ class NodeLoader extends Loader {
 
 
 	parse( json ) {
 	parse( json ) {
 
 
-		const node = Nodes.fromType( type );
+		const node = Nodes.fromType( json.type );
 		node.uuid = json.uuid;
 		node.uuid = json.uuid;
 
 
 		const nodes = this.parseNodes( json.inputNodes );
 		const nodes = this.parseNodes( json.inputNodes );

+ 1 - 1
examples/jsm/nodes/materials/Materials.js

@@ -50,7 +50,7 @@ NodeMaterial.fromMaterial = function ( material ) {
 
 
 	const nodeMaterial = new materialLib[ type ]( material );
 	const nodeMaterial = new materialLib[ type ]( material );
 
 
-	for ( let key in material ) {
+	for ( const key in material ) {
 
 
 		if ( nodeMaterial[ key ] === undefined ) {
 		if ( nodeMaterial[ key ] === undefined ) {
 
 

+ 4 - 1
examples/jsm/nodes/materials/MeshStandardNodeMaterial.js

@@ -54,7 +54,10 @@ export default class MeshStandardNodeMaterial extends NodeMaterial {
 
 
 		this.generatePosition( builder );
 		this.generatePosition( builder );
 
 
-		let { colorNode, diffuseColorNode } = this.generateDiffuseColor( builder );
+		const colorNodes = this.generateDiffuseColor( builder );
+		const { colorNode } = colorNodes;
+		let { diffuseColorNode } = colorNodes;
+
 		const envNode = this.envNode || builder.scene.environmentNode;
 		const envNode = this.envNode || builder.scene.environmentNode;
 
 
 		diffuseColorNode = this.generateStandardMaterial( builder, { colorNode, diffuseColorNode } );
 		diffuseColorNode = this.generateStandardMaterial( builder, { colorNode, diffuseColorNode } );

+ 5 - 5
examples/jsm/nodes/shadernode/ShaderNode.js

@@ -187,17 +187,17 @@ const ints = [ - 1, - 2 ];
 const floats = [ 0.5, 1.5, 1 / 3, 1e-6, 1e6, Math.PI, Math.PI * 2, 1 / Math.PI, 2 / Math.PI, 1 / ( Math.PI * 2 ), Math.PI / 2 ];
 const floats = [ 0.5, 1.5, 1 / 3, 1e-6, 1e6, Math.PI, Math.PI * 2, 1 / Math.PI, 2 / Math.PI, 1 / ( Math.PI * 2 ), Math.PI / 2 ];
 
 
 const boolsCacheMap = new Map();
 const boolsCacheMap = new Map();
-for ( let bool of bools ) boolsCacheMap.set( bool, new ConstNode( bool ) );
+for ( const bool of bools ) boolsCacheMap.set( bool, new ConstNode( bool ) );
 
 
 const uintsCacheMap = new Map();
 const uintsCacheMap = new Map();
-for ( let uint of uints ) uintsCacheMap.set( uint, new ConstNode( uint, 'uint' ) );
+for ( const uint of uints ) uintsCacheMap.set( uint, new ConstNode( uint, 'uint' ) );
 
 
 const intsCacheMap = new Map( [ ...uintsCacheMap ].map( el => new ConstNode( el.value, 'int' ) ) );
 const intsCacheMap = new Map( [ ...uintsCacheMap ].map( el => new ConstNode( el.value, 'int' ) ) );
-for ( let int of ints ) intsCacheMap.set( int, new ConstNode( int, 'int' ) );
+for ( const int of ints ) intsCacheMap.set( int, new ConstNode( int, 'int' ) );
 
 
 const floatsCacheMap = new Map( [ ...intsCacheMap ].map( el => new ConstNode( el.value ) ) );
 const floatsCacheMap = new Map( [ ...intsCacheMap ].map( el => new ConstNode( el.value ) ) );
-for ( let float of floats ) floatsCacheMap.set( float, new ConstNode( float ) );
-for ( let float of floats ) floatsCacheMap.set( - float, new ConstNode( - float ) );
+for ( const float of floats ) floatsCacheMap.set( float, new ConstNode( float ) );
+for ( const float of floats ) floatsCacheMap.set( - float, new ConstNode( - float ) );
 
 
 export const cacheMaps = { bool: boolsCacheMap, uint: uintsCacheMap, ints: intsCacheMap, float: floatsCacheMap };
 export const cacheMaps = { bool: boolsCacheMap, uint: uintsCacheMap, ints: intsCacheMap, float: floatsCacheMap };
 
 

+ 1 - 1
examples/jsm/renderers/webgl/nodes/WebGLNodes.js

@@ -37,7 +37,7 @@ Material.prototype.onBeforeRender = function ( renderer, scene, camera, geometry
 				nodeFrame.updateNode( node );
 				nodeFrame.updateNode( node );
 
 
 			}
 			}
-			
+
 		}
 		}
 
 
 	}
 	}

+ 1 - 1
examples/jsm/renderers/webgpu/WebGPURenderStates.js

@@ -38,7 +38,7 @@ class WebGPURenderStates {
 
 
 	}
 	}
 
 
-	get( scene, camera ) {
+	get( scene, /* camera */ ) {
 
 
 		const renderStates = this.renderStates;
 		const renderStates = this.renderStates;
 
 

+ 2 - 2
examples/jsm/renderers/webgpu/WebGPUTextures.js

@@ -428,7 +428,7 @@ class WebGPUTextures {
 
 
 			if ( image.isDataTexture ) {
 			if ( image.isDataTexture ) {
 
 
-				this._copyBufferToTexture( image.image, format, textureGPU, { z : i } );
+				this._copyBufferToTexture( image.image, format, textureGPU, { z: i } );
 
 
 				if ( needsMipmaps === true ) this._generateMipmaps( textureGPU, textureGPUDescriptor, i );
 				if ( needsMipmaps === true ) this._generateMipmaps( textureGPU, textureGPUDescriptor, i );
 
 
@@ -436,7 +436,7 @@ class WebGPUTextures {
 
 
 				this._getImageBitmap( image, texture ).then( imageBitmap => {
 				this._getImageBitmap( image, texture ).then( imageBitmap => {
 
 
-					this._copyExternalImageToTexture( imageBitmap, textureGPU, { z : i } );
+					this._copyExternalImageToTexture( imageBitmap, textureGPU, { z: i } );
 
 
 					if ( needsMipmaps === true ) this._generateMipmaps( textureGPU, textureGPUDescriptor, i );
 					if ( needsMipmaps === true ) this._generateMipmaps( textureGPU, textureGPUDescriptor, i );
 
 

+ 1 - 1
examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js

@@ -444,7 +444,7 @@ class WebGPUNodeBuilder extends NodeBuilder {
 		const snippets = [];
 		const snippets = [];
 		const vars = this.vars[ shaderStage ];
 		const vars = this.vars[ shaderStage ];
 
 
-		for (const variable of vars) {
+		for ( const variable of vars ) {
 
 
 			const name = variable.name;
 			const name = variable.name;
 			const type = this.getType( variable.type );
 			const type = this.getType( variable.type );

+ 2 - 1
examples/jsm/utils/BufferGeometryUtils.js

@@ -2,6 +2,7 @@ import {
 	BufferAttribute,
 	BufferAttribute,
 	BufferGeometry,
 	BufferGeometry,
 	Float32BufferAttribute,
 	Float32BufferAttribute,
+	InstancedBufferAttribute,
 	InterleavedBuffer,
 	InterleavedBuffer,
 	InterleavedBufferAttribute,
 	InterleavedBufferAttribute,
 	MathUtils,
 	MathUtils,
@@ -98,7 +99,7 @@ function computeMikkTSpaceTangents( geometry, MikkTSpace, negateSign = true ) {
 
 
 	if ( geometry !== _geometry ) {
 	if ( geometry !== _geometry ) {
 
 
-		geometry.copy( _geometry )
+		geometry.copy( _geometry );
 
 
 	}
 	}
 
 

+ 17 - 25
examples/jsm/utils/GeometryUtils.js

@@ -1,6 +1,4 @@
-import {
-	Vector3
-} from 'three';
+import { Vector3 } from 'three';
 
 
 
 
 /**
 /**
@@ -38,15 +36,12 @@ function hilbert2D( center = new Vector3( 0, 0, 0 ), size = 10, iterations = 1,
 	// Recurse iterations
 	// Recurse iterations
 	if ( 0 <= -- iterations ) {
 	if ( 0 <= -- iterations ) {
 
 
-		const tmp = [];
-
-		Array.prototype.push.apply( tmp, hilbert2D( vec[ 0 ], half, iterations, v0, v3, v2, v1 ) );
-		Array.prototype.push.apply( tmp, hilbert2D( vec[ 1 ], half, iterations, v0, v1, v2, v3 ) );
-		Array.prototype.push.apply( tmp, hilbert2D( vec[ 2 ], half, iterations, v0, v1, v2, v3 ) );
-		Array.prototype.push.apply( tmp, hilbert2D( vec[ 3 ], half, iterations, v2, v1, v0, v3 ) );
-
-		// Return recursive call
-		return tmp;
+		return [
+			...hilbert2D( vec[ 0 ], half, iterations, v0, v3, v2, v1 ),
+			...hilbert2D( vec[ 1 ], half, iterations, v0, v1, v2, v3 ),
+			...hilbert2D( vec[ 2 ], half, iterations, v0, v1, v2, v3 ),
+			...hilbert2D( vec[ 3 ], half, iterations, v2, v1, v0, v3 )
+		];
 
 
 	}
 	}
 
 
@@ -103,19 +98,16 @@ function hilbert3D( center = new Vector3( 0, 0, 0 ), size = 10, iterations = 1,
 	// Recurse iterations
 	// Recurse iterations
 	if ( -- iterations >= 0 ) {
 	if ( -- iterations >= 0 ) {
 
 
-		const tmp = [];
-
-		Array.prototype.push.apply( tmp, hilbert3D( vec[ 0 ], half, iterations, v0, v3, v4, v7, v6, v5, v2, v1 ) );
-		Array.prototype.push.apply( tmp, hilbert3D( vec[ 1 ], half, iterations, v0, v7, v6, v1, v2, v5, v4, v3 ) );
-		Array.prototype.push.apply( tmp, hilbert3D( vec[ 2 ], half, iterations, v0, v7, v6, v1, v2, v5, v4, v3 ) );
-		Array.prototype.push.apply( tmp, hilbert3D( vec[ 3 ], half, iterations, v2, v3, v0, v1, v6, v7, v4, v5 ) );
-		Array.prototype.push.apply( tmp, hilbert3D( vec[ 4 ], half, iterations, v2, v3, v0, v1, v6, v7, v4, v5 ) );
-		Array.prototype.push.apply( tmp, hilbert3D( vec[ 5 ], half, iterations, v4, v3, v2, v5, v6, v1, v0, v7 ) );
-		Array.prototype.push.apply( tmp, hilbert3D( vec[ 6 ], half, iterations, v4, v3, v2, v5, v6, v1, v0, v7 ) );
-		Array.prototype.push.apply( tmp, hilbert3D( vec[ 7 ], half, iterations, v6, v5, v2, v1, v0, v3, v4, v7 ) );
-
-		// Return recursive call
-		return tmp;
+		return [
+			...hilbert3D( vec[ 0 ], half, iterations, v0, v3, v4, v7, v6, v5, v2, v1 ),
+			...hilbert3D( vec[ 1 ], half, iterations, v0, v7, v6, v1, v2, v5, v4, v3 ),
+			...hilbert3D( vec[ 2 ], half, iterations, v0, v7, v6, v1, v2, v5, v4, v3 ),
+			...hilbert3D( vec[ 3 ], half, iterations, v2, v3, v0, v1, v6, v7, v4, v5 ),
+			...hilbert3D( vec[ 4 ], half, iterations, v2, v3, v0, v1, v6, v7, v4, v5 ),
+			...hilbert3D( vec[ 5 ], half, iterations, v4, v3, v2, v5, v6, v1, v0, v7 ),
+			...hilbert3D( vec[ 6 ], half, iterations, v4, v3, v2, v5, v6, v1, v0, v7 ),
+			...hilbert3D( vec[ 7 ], half, iterations, v6, v5, v2, v1, v0, v3, v4, v7 )
+		];
 
 
 	}
 	}
 
 

+ 9 - 13
examples/webgpu_sprites.html

@@ -27,7 +27,7 @@
 			import * as THREE from 'three';
 			import * as THREE from 'three';
 			import * as Nodes from 'three-nodes/Nodes.js';
 			import * as Nodes from 'three-nodes/Nodes.js';
 
 
-			import { texture, uv, mul, float, color, reference, userData } from 'three-nodes/Nodes.js';
+			import { texture, uv, mul, float, color, userData } from 'three-nodes/Nodes.js';
 
 
 			import WebGPU from './jsm/capabilities/WebGPU.js';
 			import WebGPU from './jsm/capabilities/WebGPU.js';
 			import WebGPURenderer from './jsm/renderers/webgpu/WebGPURenderer.js';
 			import WebGPURenderer from './jsm/renderers/webgpu/WebGPURenderer.js';
@@ -38,6 +38,8 @@
 
 
 			let group;
 			let group;
 
 
+			let imageWidth = 1, imageHeight = 1;
+
 			init().then( animate ).catch( error );
 			init().then( animate ).catch( error );
 
 
 			async function init() {
 			async function init() {
@@ -66,7 +68,12 @@
 
 
 				const textureLoader = new THREE.TextureLoader();
 				const textureLoader = new THREE.TextureLoader();
 
 
-				map = textureLoader.load( 'textures/sprite1.png' );
+				map = textureLoader.load( 'textures/sprite1.png', ( map ) => {
+
+					imageWidth = map.image.width;
+					imageHeight = map.image.height;
+
+				} );
 
 
 				group = new THREE.Group();
 				group = new THREE.Group();
 
 
@@ -138,19 +145,8 @@
 				for ( let i = 0, l = group.children.length; i < l; i ++ ) {
 				for ( let i = 0, l = group.children.length; i < l; i ++ ) {
 
 
 					const sprite = group.children[ i ];
 					const sprite = group.children[ i ];
-					const material = sprite.material;
 					const scale = Math.sin( time + sprite.position.x * 0.01 ) * 0.3 + 1.0;
 					const scale = Math.sin( time + sprite.position.x * 0.01 ) * 0.3 + 1.0;
 
 
-					let imageWidth = 1;
-					let imageHeight = 1;
-
-					if ( map && map.image && map.image.width ) {
-
-						imageWidth = map.image.width;
-						imageHeight = map.image.height;
-
-					}
-
 					sprite.userData.rotation += 0.1 * ( i / l );
 					sprite.userData.rotation += 0.1 * ( i / l );
 					sprite.scale.set( scale * imageWidth, scale * imageHeight, 1.0 );
 					sprite.scale.set( scale * imageWidth, scale * imageHeight, 1.0 );
 
 

+ 3 - 4
examples/webxr_vr_teleport.html

@@ -82,12 +82,11 @@
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.outputEncoding = THREE.sRGBEncoding;
 				renderer.outputEncoding = THREE.sRGBEncoding;
-				renderer.xr.addEventListener( 'sessionstart', () => baseReferenceSpace = renderer.xr.getReferenceSpace() )
-				renderer.xr.enabled = true;
-				document.body.appendChild( renderer.domElement );
 
 
-				//
+				renderer.xr.addEventListener( 'sessionstart', () => baseReferenceSpace = renderer.xr.getReferenceSpace() );
+				renderer.xr.enabled = true;
 
 
+				document.body.appendChild( renderer.domElement );
 				document.body.appendChild( VRButton.createButton( renderer ) );
 				document.body.appendChild( VRButton.createButton( renderer ) );
 
 
 				// controllers
 				// controllers

+ 1 - 1
package.json

@@ -106,8 +106,8 @@
     "dev": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"servez -p 8080\"",
     "dev": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"servez -p 8080\"",
     "lint": "eslint src --ext js",
     "lint": "eslint src --ext js",
     "lint-examples": "eslint examples/js examples/jsm --ext js --ignore-pattern libs --ignore-pattern ifc",
     "lint-examples": "eslint examples/js examples/jsm --ext js --ignore-pattern libs --ignore-pattern ifc",
-    "lint-fix": "npm run lint -- --fix && npm run lint-examples -- --fix",
     "lint-docs": "eslint docs --ext html",
     "lint-docs": "eslint docs --ext html",
+    "lint-fix": "npm run lint -- --fix && npm run lint-examples -- --fix && npm run lint-docs -- --fix",
     "test-unit": "npm run unit --prefix test",
     "test-unit": "npm run unit --prefix test",
     "test-e2e": "node test/e2e/puppeteer.js",
     "test-e2e": "node test/e2e/puppeteer.js",
     "test-e2e-cov": "node test/e2e/check-coverage.js",
     "test-e2e-cov": "node test/e2e/check-coverage.js",

+ 1 - 1
src/core/BufferAttribute.js

@@ -387,7 +387,7 @@ class BufferAttribute {
 		const data = {
 		const data = {
 			itemSize: this.itemSize,
 			itemSize: this.itemSize,
 			type: this.array.constructor.name,
 			type: this.array.constructor.name,
-			array: Array.prototype.slice.call( this.array ),
+			array: Array.from( this.array ),
 			normalized: this.normalized
 			normalized: this.normalized
 		};
 		};
 
 

+ 1 - 1
src/core/InterleavedBuffer.js

@@ -125,7 +125,7 @@ class InterleavedBuffer {
 
 
 		if ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {
 		if ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {
 
 
-			data.arrayBuffers[ this.array.buffer._uuid ] = Array.prototype.slice.call( new Uint32Array( this.array.buffer ) );
+			data.arrayBuffers[ this.array.buffer._uuid ] = Array.from( new Uint32Array( this.array.buffer ) );
 
 
 		}
 		}
 
 

+ 1 - 1
src/textures/Source.js

@@ -103,7 +103,7 @@ function serializeImage( image ) {
 			// images of DataTexture
 			// images of DataTexture
 
 
 			return {
 			return {
-				data: Array.prototype.slice.call( image.data ),
+				data: Array.from( image.data ),
 				width: image.width,
 				width: image.width,
 				height: image.height,
 				height: image.height,
 				type: image.data.constructor.name
 				type: image.data.constructor.name

部分文件因为文件数量过多而无法显示