Browse Source

Math: Rename to MathUtils.

Mugen87 5 năm trước cách đây
mục cha
commit
e7ca3006b0
100 tập tin đã thay đổi với 285 bổ sung417 xóa
  1. 3 3
      docs/api/en/materials/PointsMaterial.html
  2. 0 0
      docs/api/en/math/MathUtils.html
  3. 3 3
      docs/api/zh/materials/PointsMaterial.html
  4. 0 0
      docs/api/zh/math/MathUtils.html
  5. 2 2
      docs/list.js
  6. 4 4
      editor/js/Sidebar.Geometry.CircleGeometry.js
  7. 4 4
      editor/js/Sidebar.Geometry.RingGeometry.js
  8. 8 8
      editor/js/Sidebar.Geometry.SphereGeometry.js
  9. 2 2
      editor/js/Sidebar.Geometry.TorusGeometry.js
  10. 1 1
      editor/js/Sidebar.Geometry.js
  11. 1 1
      editor/js/Sidebar.Material.js
  12. 5 5
      editor/js/Sidebar.Object.js
  13. 3 3
      examples/css3d_orthographic.html
  14. 3 3
      examples/css3d_panorama.html
  15. 4 4
      examples/js/controls/DeviceOrientationControls.js
  16. 6 6
      examples/js/controls/FirstPersonControls.js
  17. 4 4
      examples/js/exporters/GLTFExporter.js
  18. 3 3
      examples/js/geometries/LightningStrike.js
  19. 1 1
      examples/js/lines/LineSegments2.js
  20. 4 4
      examples/js/loaders/ColladaLoader.js
  21. 10 10
      examples/js/loaders/FBXLoader.js
  22. 1 1
      examples/js/loaders/GLTFLoader.js
  23. 3 3
      examples/js/math/ColorConverter.js
  24. 6 6
      examples/js/misc/MD2CharacterComplex.js
  25. 1 1
      examples/js/misc/MorphBlendMesh.js
  26. 2 2
      examples/js/objects/Fire.js
  27. 3 3
      examples/js/objects/LightningStorm.js
  28. 1 1
      examples/js/objects/Reflector.js
  29. 1 1
      examples/js/objects/Refractor.js
  30. 1 1
      examples/js/objects/Water.js
  31. 12 12
      examples/js/postprocessing/GlitchPass.js
  32. 1 1
      examples/js/postprocessing/SSAOPass.js
  33. 1 1
      examples/js/renderers/RaytracingWorker.js
  34. 0 63
      examples/js/utils/MathUtils.js
  35. 5 5
      examples/jsm/controls/DeviceOrientationControls.js
  36. 7 7
      examples/jsm/controls/FirstPersonControls.js
  37. 5 5
      examples/jsm/exporters/GLTFExporter.js
  38. 4 4
      examples/jsm/geometries/LightningStrike.js
  39. 3 3
      examples/jsm/helpers/PositionalAudioHelper.js
  40. 2 2
      examples/jsm/lines/LineSegments2.js
  41. 5 5
      examples/jsm/loaders/ColladaLoader.js
  42. 11 11
      examples/jsm/loaders/FBXLoader.js
  43. 2 2
      examples/jsm/loaders/GLTFLoader.js
  44. 4 4
      examples/jsm/math/ColorConverter.js
  45. 7 7
      examples/jsm/misc/MD2CharacterComplex.js
  46. 2 2
      examples/jsm/misc/MorphBlendMesh.js
  47. 2 2
      examples/jsm/nodes/core/Node.js
  48. 2 2
      examples/jsm/nodes/core/TempNode.js
  49. 2 2
      examples/jsm/nodes/postprocessing/NodePass.js
  50. 3 3
      examples/jsm/objects/Fire.js
  51. 4 4
      examples/jsm/objects/LightningStorm.js
  52. 2 2
      examples/jsm/objects/Reflector.js
  53. 2 2
      examples/jsm/objects/Refractor.js
  54. 2 2
      examples/jsm/objects/Water.js
  55. 13 13
      examples/jsm/postprocessing/GlitchPass.js
  56. 2 2
      examples/jsm/postprocessing/SSAOPass.js
  57. 0 5
      examples/jsm/utils/MathUtils.d.ts
  58. 0 67
      examples/jsm/utils/MathUtils.js
  59. 2 2
      examples/jsm/utils/RoughnessMipmapper.js
  60. 1 1
      examples/misc_animation_authoring.html
  61. 1 1
      examples/misc_controls_transform.html
  62. 3 3
      examples/webgl_camera.html
  63. 3 3
      examples/webgl_camera_cinematic.html
  64. 1 1
      examples/webgl_camera_logarithmicdepthbuffer.html
  65. 1 1
      examples/webgl_custom_attributes.html
  66. 2 0
      examples/webgl_geometry_cube.html
  67. 1 1
      examples/webgl_geometry_extrude_shapes.html
  68. 1 1
      examples/webgl_geometry_nurbs.html
  69. 1 1
      examples/webgl_gpgpu_protoplanet.html
  70. 3 3
      examples/webgl_interactive_cubes.html
  71. 3 3
      examples/webgl_interactive_cubes_ortho.html
  72. 3 3
      examples/webgl_interactive_lines.html
  73. 3 3
      examples/webgl_layers.html
  74. 2 2
      examples/webgl_loader_collada_kinematics.html
  75. 3 3
      examples/webgl_materials_cubemap_dynamic.html
  76. 2 2
      examples/webgl_materials_nodes.html
  77. 1 1
      examples/webgl_materials_texture_anisotropy.html
  78. 2 2
      examples/webgl_materials_texture_partialupdate.html
  79. 2 2
      examples/webgl_morphtargets_horse.html
  80. 1 1
      examples/webgl_multiple_canvases_circle.html
  81. 3 3
      examples/webgl_panorama_dualfisheye.html
  82. 3 3
      examples/webgl_panorama_equirectangular.html
  83. 1 1
      examples/webgl_postprocessing_crossfade.html
  84. 1 1
      examples/webgl_postprocessing_ssaa_unbiased.html
  85. 3 3
      examples/webgl_video_panorama_equirectangular.html
  86. 2 2
      examples/webxr_vr_ballshooter.html
  87. 3 3
      examples/webxr_vr_cubes.html
  88. 2 2
      examples/webxr_vr_multiview.html
  89. 5 4
      src/Three.Legacy.js
  90. 1 1
      src/Three.d.ts
  91. 1 1
      src/Three.js
  92. 2 2
      src/animation/AnimationClip.js
  93. 2 2
      src/animation/AnimationObjectGroup.js
  94. 6 6
      src/cameras/PerspectiveCamera.js
  95. 2 2
      src/cameras/StereoCamera.js
  96. 2 2
      src/core/BufferGeometry.js
  97. 2 2
      src/core/Geometry.js
  98. 2 2
      src/core/Object3D.js
  99. 3 3
      src/extras/core/Curve.js
  100. 2 2
      src/extras/core/Shape.js

+ 3 - 3
docs/api/en/materials/PointsMaterial.html

@@ -38,9 +38,9 @@ var starsGeometry = new THREE.Geometry();
 for ( var i = 0; i < 10000; i ++ ) {
 
 	var star = new THREE.Vector3();
-	star.x = THREE.Math.randFloatSpread( 2000 );
-	star.y = THREE.Math.randFloatSpread( 2000 );
-	star.z = THREE.Math.randFloatSpread( 2000 );
+	star.x = THREE.MathUtils.randFloatSpread( 2000 );
+	star.y = THREE.MathUtils.randFloatSpread( 2000 );
+	star.z = THREE.MathUtils.randFloatSpread( 2000 );
 
 	starsGeometry.vertices.push( star );
 

+ 0 - 0
docs/api/en/math/Math.html → docs/api/en/math/MathUtils.html


+ 3 - 3
docs/api/zh/materials/PointsMaterial.html

@@ -40,9 +40,9 @@ var starsGeometry = new THREE.Geometry();
 for ( var i = 0; i < 10000; i ++ ) {
 
 	var star = new THREE.Vector3();
-	star.x = THREE.Math.randFloatSpread( 2000 );
-	star.y = THREE.Math.randFloatSpread( 2000 );
-	star.z = THREE.Math.randFloatSpread( 2000 );
+	star.x = THREE.MathUtils.randFloatSpread( 2000 );
+	star.y = THREE.MathUtils.randFloatSpread( 2000 );
+	star.z = THREE.MathUtils.randFloatSpread( 2000 );
 
 	starsGeometry.vertices.push( star );
 

+ 0 - 0
docs/api/zh/math/Math.html → docs/api/zh/math/MathUtils.html


+ 2 - 2
docs/list.js

@@ -272,7 +272,7 @@ var list = {
 				"Frustum": "api/en/math/Frustum",
 				"Interpolant": "api/en/math/Interpolant",
 				"Line3": "api/en/math/Line3",
-				"Math": "api/en/math/Math",
+				"MathUtils": "api/en/math/MathUtils",
 				"Matrix3": "api/en/math/Matrix3",
 				"Matrix4": "api/en/math/Matrix4",
 				"Plane": "api/en/math/Plane",
@@ -721,7 +721,7 @@ var list = {
 				"Frustum": "api/zh/math/Frustum",
 				"Interpolant": "api/zh/math/Interpolant",
 				"Line3": "api/zh/math/Line3",
-				"Math": "api/zh/math/Math",
+				"MathUtils": "api/zh/math/MathUtils",
 				"Matrix3": "api/zh/math/Matrix3",
 				"Matrix4": "api/zh/math/Matrix4",
 				"Plane": "api/zh/math/Plane",

+ 4 - 4
editor/js/Sidebar.Geometry.CircleGeometry.js

@@ -40,7 +40,7 @@ var SidebarGeometryCircleGeometry = function ( editor, object ) {
 	// thetaStart
 
 	var thetaStartRow = new UIRow();
-	var thetaStart = new UINumber( parameters.thetaStart * THREE.Math.RAD2DEG ).setStep( 10 ).onChange( update );
+	var thetaStart = new UINumber( parameters.thetaStart * THREE.MathUtils.RAD2DEG ).setStep( 10 ).onChange( update );
 
 	thetaStartRow.add( new UIText( strings.getKey( 'sidebar/geometry/circle_geometry/thetastart' ) ).setWidth( '90px' ) );
 	thetaStartRow.add( thetaStart );
@@ -50,7 +50,7 @@ var SidebarGeometryCircleGeometry = function ( editor, object ) {
 	// thetaLength
 
 	var thetaLengthRow = new UIRow();
-	var thetaLength = new UINumber( parameters.thetaLength * THREE.Math.RAD2DEG ).setStep( 10 ).onChange( update );
+	var thetaLength = new UINumber( parameters.thetaLength * THREE.MathUtils.RAD2DEG ).setStep( 10 ).onChange( update );
 
 	thetaLengthRow.add( new UIText( strings.getKey( 'sidebar/geometry/circle_geometry/thetalength' ) ).setWidth( '90px' ) );
 	thetaLengthRow.add( thetaLength );
@@ -64,8 +64,8 @@ var SidebarGeometryCircleGeometry = function ( editor, object ) {
 		editor.execute( new SetGeometryCommand( editor, object, new THREE.CircleBufferGeometry(
 			radius.getValue(),
 			segments.getValue(),
-			thetaStart.getValue() * THREE.Math.DEG2RAD,
-			thetaLength.getValue() * THREE.Math.DEG2RAD
+			thetaStart.getValue() * THREE.MathUtils.DEG2RAD,
+			thetaLength.getValue() * THREE.MathUtils.DEG2RAD
 		) ) );
 
 	}

+ 4 - 4
editor/js/Sidebar.Geometry.RingGeometry.js

@@ -60,7 +60,7 @@ var SidebarGeometryRingGeometry = function ( editor, object ) {
 	// thetaStart
 
 	var thetaStartRow = new UIRow();
-	var thetaStart = new UINumber( parameters.thetaStart * THREE.Math.RAD2DEG ).setStep( 10 ).onChange( update );
+	var thetaStart = new UINumber( parameters.thetaStart * THREE.MathUtils.RAD2DEG ).setStep( 10 ).onChange( update );
 
 	thetaStartRow.add( new UIText( strings.getKey( 'sidebar/geometry/ring_geometry/thetastart' ) ).setWidth( '90px' ) );
 	thetaStartRow.add( thetaStart );
@@ -70,7 +70,7 @@ var SidebarGeometryRingGeometry = function ( editor, object ) {
 	// thetaLength
 
 	var thetaLengthRow = new UIRow();
-	var thetaLength = new UINumber( parameters.thetaLength * THREE.Math.RAD2DEG ).setStep( 10 ).onChange( update );
+	var thetaLength = new UINumber( parameters.thetaLength * THREE.MathUtils.RAD2DEG ).setStep( 10 ).onChange( update );
 
 	thetaLengthRow.add( new UIText( strings.getKey( 'sidebar/geometry/ring_geometry/thetalength' ) ).setWidth( '90px' ) );
 	thetaLengthRow.add( thetaLength );
@@ -86,8 +86,8 @@ var SidebarGeometryRingGeometry = function ( editor, object ) {
 			outerRadius.getValue(),
 			thetaSegments.getValue(),
 			phiSegments.getValue(),
-			thetaStart.getValue() * THREE.Math.DEG2RAD,
-			thetaLength.getValue() * THREE.Math.DEG2RAD
+			thetaStart.getValue() * THREE.MathUtils.DEG2RAD,
+			thetaLength.getValue() * THREE.MathUtils.DEG2RAD
 		) ) );
 
 	}

+ 8 - 8
editor/js/Sidebar.Geometry.SphereGeometry.js

@@ -50,7 +50,7 @@ var SidebarGeometrySphereGeometry = function ( editor, object ) {
 	// phiStart
 
 	var phiStartRow = new UIRow();
-	var phiStart = new UINumber( parameters.phiStart * THREE.Math.RAD2DEG ).setStep( 10 ).onChange( update );
+	var phiStart = new UINumber( parameters.phiStart * THREE.MathUtils.RAD2DEG ).setStep( 10 ).onChange( update );
 
 	phiStartRow.add( new UIText( strings.getKey( 'sidebar/geometry/sphere_geometry/phistart' ) ).setWidth( '90px' ) );
 	phiStartRow.add( phiStart );
@@ -60,7 +60,7 @@ var SidebarGeometrySphereGeometry = function ( editor, object ) {
 	// phiLength
 
 	var phiLengthRow = new UIRow();
-	var phiLength = new UINumber( parameters.phiLength * THREE.Math.RAD2DEG ).setStep( 10 ).onChange( update );
+	var phiLength = new UINumber( parameters.phiLength * THREE.MathUtils.RAD2DEG ).setStep( 10 ).onChange( update );
 
 	phiLengthRow.add( new UIText( strings.getKey( 'sidebar/geometry/sphere_geometry/philength' ) ).setWidth( '90px' ) );
 	phiLengthRow.add( phiLength );
@@ -70,7 +70,7 @@ var SidebarGeometrySphereGeometry = function ( editor, object ) {
 	// thetaStart
 
 	var thetaStartRow = new UIRow();
-	var thetaStart = new UINumber( parameters.thetaStart * THREE.Math.RAD2DEG ).setStep( 10 ).onChange( update );
+	var thetaStart = new UINumber( parameters.thetaStart * THREE.MathUtils.RAD2DEG ).setStep( 10 ).onChange( update );
 
 	thetaStartRow.add( new UIText( strings.getKey( 'sidebar/geometry/sphere_geometry/thetastart' ) ).setWidth( '90px' ) );
 	thetaStartRow.add( thetaStart );
@@ -80,7 +80,7 @@ var SidebarGeometrySphereGeometry = function ( editor, object ) {
 	// thetaLength
 
 	var thetaLengthRow = new UIRow();
-	var thetaLength = new UINumber( parameters.thetaLength * THREE.Math.RAD2DEG ).setStep( 10 ).onChange( update );
+	var thetaLength = new UINumber( parameters.thetaLength * THREE.MathUtils.RAD2DEG ).setStep( 10 ).onChange( update );
 
 	thetaLengthRow.add( new UIText( strings.getKey( 'sidebar/geometry/sphere_geometry/thetalength' ) ).setWidth( '90px' ) );
 	thetaLengthRow.add( thetaLength );
@@ -96,10 +96,10 @@ var SidebarGeometrySphereGeometry = function ( editor, object ) {
 			radius.getValue(),
 			widthSegments.getValue(),
 			heightSegments.getValue(),
-			phiStart.getValue() * THREE.Math.DEG2RAD,
-			phiLength.getValue() * THREE.Math.DEG2RAD,
-			thetaStart.getValue() * THREE.Math.DEG2RAD,
-			thetaLength.getValue() * THREE.Math.DEG2RAD
+			phiStart.getValue() * THREE.MathUtils.DEG2RAD,
+			phiLength.getValue() * THREE.MathUtils.DEG2RAD,
+			thetaStart.getValue() * THREE.MathUtils.DEG2RAD,
+			thetaLength.getValue() * THREE.MathUtils.DEG2RAD
 		) ) );
 
 	}

+ 2 - 2
editor/js/Sidebar.Geometry.TorusGeometry.js

@@ -60,7 +60,7 @@ var SidebarGeometryTorusGeometry = function ( editor, object ) {
 	// arc
 
 	var arcRow = new UIRow();
-	var arc = new UINumber( parameters.arc * THREE.Math.RAD2DEG ).setStep( 10 ).onChange( update );
+	var arc = new UINumber( parameters.arc * THREE.MathUtils.RAD2DEG ).setStep( 10 ).onChange( update );
 
 	arcRow.add( new UIText( strings.getKey( 'sidebar/geometry/torus_geometry/arc' ) ).setWidth( '90px' ) );
 	arcRow.add( arc );
@@ -77,7 +77,7 @@ var SidebarGeometryTorusGeometry = function ( editor, object ) {
 			tube.getValue(),
 			radialSegments.getValue(),
 			tubularSegments.getValue(),
-			arc.getValue() * THREE.Math.DEG2RAD
+			arc.getValue() * THREE.MathUtils.DEG2RAD
 		) ) );
 
 	}

+ 1 - 1
editor/js/Sidebar.Geometry.js

@@ -150,7 +150,7 @@ var SidebarGeometry = function ( editor ) {
 	var geometryUUID = new UIInput().setWidth( '102px' ).setFontSize( '12px' ).setDisabled( true );
 	var geometryUUIDRenew = new UIButton( strings.getKey( 'sidebar/geometry/new' ) ).setMarginLeft( '7px' ).onClick( function () {
 
-		geometryUUID.setValue( THREE.Math.generateUUID() );
+		geometryUUID.setValue( THREE.MathUtils.generateUUID() );
 
 		editor.execute( new SetGeometryValueCommand( editor, editor.selected, 'uuid', geometryUUID.getValue() ) );
 

+ 1 - 1
editor/js/Sidebar.Material.js

@@ -92,7 +92,7 @@ var SidebarMaterial = function ( editor ) {
 	var materialUUID = new UIInput().setWidth( '102px' ).setFontSize( '12px' ).setDisabled( true );
 	var materialUUIDRenew = new UIButton( strings.getKey( 'sidebar/material/new' ) ).setMarginLeft( '7px' ).onClick( function () {
 
-		materialUUID.setValue( THREE.Math.generateUUID() );
+		materialUUID.setValue( THREE.MathUtils.generateUUID() );
 		update();
 
 	} );

+ 5 - 5
editor/js/Sidebar.Object.js

@@ -84,7 +84,7 @@ var SidebarObject = function ( editor ) {
 	var objectUUID = new UIInput().setWidth( '102px' ).setFontSize( '12px' ).setDisabled( true );
 	var objectUUIDRenew = new UIButton( strings.getKey( 'sidebar/object/new' ) ).setMarginLeft( '7px' ).onClick( function () {
 
-		objectUUID.setValue( THREE.Math.generateUUID() );
+		objectUUID.setValue( THREE.MathUtils.generateUUID() );
 
 		editor.execute( new SetUuidCommand( editor, editor.selected, objectUUID.getValue() ) );
 
@@ -429,7 +429,7 @@ var SidebarObject = function ( editor ) {
 
 			}
 
-			var newRotation = new THREE.Euler( objectRotationX.getValue() * THREE.Math.DEG2RAD, objectRotationY.getValue() * THREE.Math.DEG2RAD, objectRotationZ.getValue() * THREE.Math.DEG2RAD );
+			var newRotation = new THREE.Euler( objectRotationX.getValue() * THREE.MathUtils.DEG2RAD, objectRotationY.getValue() * THREE.MathUtils.DEG2RAD, objectRotationZ.getValue() * THREE.MathUtils.DEG2RAD );
 			if ( object.rotation.toVector3().distanceTo( newRotation.toVector3() ) >= 0.01 ) {
 
 				editor.execute( new SetRotationCommand( editor, object, newRotation ) );
@@ -695,9 +695,9 @@ var SidebarObject = function ( editor ) {
 		objectPositionY.setValue( object.position.y );
 		objectPositionZ.setValue( object.position.z );
 
-		objectRotationX.setValue( object.rotation.x * THREE.Math.RAD2DEG );
-		objectRotationY.setValue( object.rotation.y * THREE.Math.RAD2DEG );
-		objectRotationZ.setValue( object.rotation.z * THREE.Math.RAD2DEG );
+		objectRotationX.setValue( object.rotation.x * THREE.MathUtils.RAD2DEG );
+		objectRotationY.setValue( object.rotation.y * THREE.MathUtils.RAD2DEG );
+		objectRotationZ.setValue( object.rotation.z * THREE.MathUtils.RAD2DEG );
 
 		objectScaleX.setValue( object.scale.x );
 		objectScaleY.setValue( object.scale.y );

+ 3 - 3
examples/css3d_orthographic.html

@@ -54,7 +54,7 @@
 					100, 100,
 					'chocolate',
 					new THREE.Vector3( - 50, 0, 0 ),
-					new THREE.Euler( 0, - 90 * THREE.Math.DEG2RAD, 0 )
+					new THREE.Euler( 0, - 90 * THREE.MathUtils.DEG2RAD, 0 )
 				);
 				// right
 				createPlane(
@@ -68,14 +68,14 @@
 					100, 100,
 					'yellowgreen',
 					new THREE.Vector3( 0, 50, 0 ),
-					new THREE.Euler( - 90 * THREE.Math.DEG2RAD, 0, 0 )
+					new THREE.Euler( - 90 * THREE.MathUtils.DEG2RAD, 0, 0 )
 				);
 				// bottom
 				createPlane(
 					300, 300,
 					'seagreen',
 					new THREE.Vector3( 0, - 50, 0 ),
-					new THREE.Euler( - 90 * THREE.Math.DEG2RAD, 0, 0 )
+					new THREE.Euler( - 90 * THREE.MathUtils.DEG2RAD, 0, 0 )
 				);
 
 				//

+ 3 - 3
examples/css3d_panorama.html

@@ -135,7 +135,7 @@
 
 				var fov = camera.fov + event.deltaY * 0.05;
 
-				camera.fov = THREE.Math.clamp( fov, 10, 75 );
+				camera.fov = THREE.MathUtils.clamp( fov, 10, 75 );
 
 				camera.updateProjectionMatrix();
 
@@ -172,8 +172,8 @@
 
 				lon += 0.1;
 				lat = Math.max( - 85, Math.min( 85, lat ) );
-				phi = THREE.Math.degToRad( 90 - lat );
-				theta = THREE.Math.degToRad( lon );
+				phi = THREE.MathUtils.degToRad( 90 - lat );
+				theta = THREE.MathUtils.degToRad( lon );
 
 				target.x = Math.sin( phi ) * Math.cos( theta );
 				target.y = Math.cos( phi );

+ 4 - 4
examples/js/controls/DeviceOrientationControls.js

@@ -108,13 +108,13 @@ THREE.DeviceOrientationControls = function ( object ) {
 
 		if ( device ) {
 
-			var alpha = device.alpha ? THREE.Math.degToRad( device.alpha ) + scope.alphaOffset : 0; // Z
+			var alpha = device.alpha ? THREE.MathUtils.degToRad( device.alpha ) + scope.alphaOffset : 0; // Z
 
-			var beta = device.beta ? THREE.Math.degToRad( device.beta ) : 0; // X'
+			var beta = device.beta ? THREE.MathUtils.degToRad( device.beta ) : 0; // X'
 
-			var gamma = device.gamma ? THREE.Math.degToRad( device.gamma ) : 0; // Y''
+			var gamma = device.gamma ? THREE.MathUtils.degToRad( device.gamma ) : 0; // Y''
 
-			var orient = scope.screenOrientation ? THREE.Math.degToRad( scope.screenOrientation ) : 0; // O
+			var orient = scope.screenOrientation ? THREE.MathUtils.degToRad( scope.screenOrientation ) : 0; // O
 
 			setObjectQuaternion( scope.object.quaternion, alpha, beta, gamma, orient );
 

+ 6 - 6
examples/js/controls/FirstPersonControls.js

@@ -229,7 +229,7 @@ THREE.FirstPersonControls = function ( object, domElement ) {
 
 			if ( this.heightSpeed ) {
 
-				var y = THREE.Math.clamp( this.object.position.y, this.heightMin, this.heightMax );
+				var y = THREE.MathUtils.clamp( this.object.position.y, this.heightMin, this.heightMax );
 				var heightDelta = y - this.heightMin;
 
 				this.autoSpeedFactor = delta * ( heightDelta * this.heightCoef );
@@ -272,12 +272,12 @@ THREE.FirstPersonControls = function ( object, domElement ) {
 
 			lat = Math.max( - 85, Math.min( 85, lat ) );
 
-			var phi = THREE.Math.degToRad( 90 - lat );
-			var theta = THREE.Math.degToRad( lon );
+			var phi = THREE.MathUtils.degToRad( 90 - lat );
+			var theta = THREE.MathUtils.degToRad( lon );
 
 			if ( this.constrainVertical ) {
 
-				phi = THREE.Math.mapLinear( phi, 0, Math.PI, this.verticalMin, this.verticalMax );
+				phi = THREE.MathUtils.mapLinear( phi, 0, Math.PI, this.verticalMin, this.verticalMax );
 
 			}
 
@@ -340,8 +340,8 @@ THREE.FirstPersonControls = function ( object, domElement ) {
 		lookDirection.set( 0, 0, - 1 ).applyQuaternion( quaternion );
 		spherical.setFromVector3( lookDirection );
 
-		lat = 90 - THREE.Math.radToDeg( spherical.phi );
-		lon = THREE.Math.radToDeg( spherical.theta );
+		lat = 90 - THREE.MathUtils.radToDeg( spherical.phi );
+		lon = THREE.MathUtils.radToDeg( spherical.theta );
 
 	}
 

+ 4 - 4
examples/js/exporters/GLTFExporter.js

@@ -226,7 +226,7 @@ THREE.GLTFExporter.prototype = {
 		 */
 		function isPowerOfTwo( image ) {
 
-			return THREE.Math.isPowerOfTwo( image.width ) && THREE.Math.isPowerOfTwo( image.height );
+			return THREE.MathUtils.isPowerOfTwo( image.width ) && THREE.MathUtils.isPowerOfTwo( image.height );
 
 		}
 
@@ -759,8 +759,8 @@ THREE.GLTFExporter.prototype = {
 
 					console.warn( 'GLTFExporter: Resized non-power-of-two image.', image );
 
-					canvas.width = THREE.Math.floorPowerOfTwo( canvas.width );
-					canvas.height = THREE.Math.floorPowerOfTwo( canvas.height );
+					canvas.width = THREE.MathUtils.floorPowerOfTwo( canvas.width );
+					canvas.height = THREE.MathUtils.floorPowerOfTwo( canvas.height );
 
 				}
 
@@ -1502,7 +1502,7 @@ THREE.GLTFExporter.prototype = {
 				gltfCamera.perspective = {
 
 					aspectRatio: camera.aspect,
-					yfov: THREE.Math.degToRad( camera.fov ),
+					yfov: THREE.MathUtils.degToRad( camera.fov ),
 					zfar: camera.far <= 0 ? 0.001 : camera.far,
 					znear: camera.near < 0 ? 0 : camera.near
 

+ 3 - 3
examples/js/geometries/LightningStrike.js

@@ -577,8 +577,8 @@ THREE.LightningStrike.prototype.fractalRay = function ( time, segmentCallback )
 
 		this.randomGenerator.setSeed( subray.seed );
 
-		subray.endPropagationTime = THREE.Math.lerp( subray.birthTime, subray.deathTime, subray.propagationTimeFactor );
-		subray.beginVanishingTime = THREE.Math.lerp( subray.deathTime, subray.birthTime, 1 - subray.vanishingTimeFactor );
+		subray.endPropagationTime = THREE.MathUtils.lerp( subray.birthTime, subray.deathTime, subray.propagationTimeFactor );
+		subray.beginVanishingTime = THREE.MathUtils.lerp( subray.deathTime, subray.birthTime, 1 - subray.vanishingTimeFactor );
 
 		var random1 = this.randomGenerator.random;
 		subray.linPos0.set( random1(), random1(), random1() ).multiplyScalar( 1000 );
@@ -823,7 +823,7 @@ THREE.LightningStrike.prototype.createDefaultSubrayCreationCallbacks = function
 		var period = lightningStrike.rayParameters.subrayPeriod;
 		var dutyCycle = lightningStrike.rayParameters.subrayDutyCycle;
 
-		var phase0 = ( lightningStrike.rayParameters.isEternal && subray.recursion == 0 ) ? - random1() * period : THREE.Math.lerp( subray.birthTime, subray.endPropagationTime, segment.fraction0 ) - random1() * period;
+		var phase0 = ( lightningStrike.rayParameters.isEternal && subray.recursion == 0 ) ? - random1() * period : THREE.MathUtils.lerp( subray.birthTime, subray.endPropagationTime, segment.fraction0 ) - random1() * period;
 
 		var phase = lightningStrike.time - phase0;
 		var currentCycle = Math.floor( phase / period );

+ 1 - 1
examples/js/lines/LineSegments2.js

@@ -154,7 +154,7 @@ THREE.LineSegments2.prototype = Object.assign( Object.create( THREE.Mesh.prototy
 				line.at( param, closestPoint );
 
 				// check if the intersection point is within clip space
-				var zPos = THREE.Math.lerp( start.z, end.z, param );
+				var zPos = THREE.MathUtils.lerp( start.z, end.z, param );
 				var isInClipSpace = zPos >= - 1 && zPos <= 1;
 
 				var isInside = ssOrigin3.distanceTo( closestPoint ) < lineWidth * 0.5;

+ 4 - 4
examples/js/loaders/ColladaLoader.js

@@ -2728,7 +2728,7 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 				case 'rotate':
 					data.obj = new THREE.Vector3();
 					data.obj.fromArray( array );
-					data.angle = THREE.Math.degToRad( array[ 3 ] );
+					data.angle = THREE.MathUtils.degToRad( array[ 3 ] );
 					break;
 
 			}
@@ -3000,7 +3000,7 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 									switch ( joint.type ) {
 
 										case 'revolute':
-											matrix.multiply( m0.makeRotationAxis( axis, THREE.Math.degToRad( value ) ) );
+											matrix.multiply( m0.makeRotationAxis( axis, THREE.MathUtils.degToRad( value ) ) );
 											break;
 
 										case 'prismatic':
@@ -3096,7 +3096,7 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 					case 'rotate':
 						var array = parseFloats( child.textContent );
 						var vector = new THREE.Vector3().fromArray( array );
-						var angle = THREE.Math.degToRad( array[ 3 ] );
+						var angle = THREE.MathUtils.degToRad( array[ 3 ] );
 						transforms.push( {
 							sid: child.getAttribute( 'sid' ),
 							type: child.nodeName,
@@ -3203,7 +3203,7 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 
 					case 'rotate':
 						var array = parseFloats( child.textContent );
-						var angle = THREE.Math.degToRad( array[ 3 ] );
+						var angle = THREE.MathUtils.degToRad( array[ 3 ] );
 						data.matrix.multiply( matrix.makeRotationAxis( vector.fromArray( array ), angle ) );
 						data.transforms[ child.getAttribute( 'sid' ) ] = child.nodeName;
 						break;

+ 10 - 10
examples/js/loaders/FBXLoader.js

@@ -1122,7 +1122,7 @@ THREE.FBXLoader = ( function () {
 
 						if ( lightAttribute.InnerAngle !== undefined ) {
 
-							angle = THREE.Math.degToRad( lightAttribute.InnerAngle.value );
+							angle = THREE.MathUtils.degToRad( lightAttribute.InnerAngle.value );
 
 						}
 
@@ -1132,7 +1132,7 @@ THREE.FBXLoader = ( function () {
 							// TODO: this is not correct - FBX calculates outer and inner angle in degrees
 							// with OuterAngle > InnerAngle && OuterAngle <= Math.PI
 							// while three.js uses a penumbra between (0, 1) to attenuate the inner angle
-							penumbra = THREE.Math.degToRad( lightAttribute.OuterAngle.value );
+							penumbra = THREE.MathUtils.degToRad( lightAttribute.OuterAngle.value );
 							penumbra = Math.max( penumbra, 1 );
 
 						}
@@ -2685,19 +2685,19 @@ THREE.FBXLoader = ( function () {
 			if ( curves.x !== undefined ) {
 
 				this.interpolateRotations( curves.x );
-				curves.x.values = curves.x.values.map( THREE.Math.degToRad );
+				curves.x.values = curves.x.values.map( THREE.MathUtils.degToRad );
 
 			}
 			if ( curves.y !== undefined ) {
 
 				this.interpolateRotations( curves.y );
-				curves.y.values = curves.y.values.map( THREE.Math.degToRad );
+				curves.y.values = curves.y.values.map( THREE.MathUtils.degToRad );
 
 			}
 			if ( curves.z !== undefined ) {
 
 				this.interpolateRotations( curves.z );
-				curves.z.values = curves.z.values.map( THREE.Math.degToRad );
+				curves.z.values = curves.z.values.map( THREE.MathUtils.degToRad );
 
 			}
 
@@ -2706,7 +2706,7 @@ THREE.FBXLoader = ( function () {
 
 			if ( preRotation !== undefined ) {
 
-				preRotation = preRotation.map( THREE.Math.degToRad );
+				preRotation = preRotation.map( THREE.MathUtils.degToRad );
 				preRotation.push( eulerOrder );
 
 				preRotation = new THREE.Euler().fromArray( preRotation );
@@ -2716,7 +2716,7 @@ THREE.FBXLoader = ( function () {
 
 			if ( postRotation !== undefined ) {
 
-				postRotation = postRotation.map( THREE.Math.degToRad );
+				postRotation = postRotation.map( THREE.MathUtils.degToRad );
 				postRotation.push( eulerOrder );
 
 				postRotation = new THREE.Euler().fromArray( postRotation );
@@ -3947,7 +3947,7 @@ THREE.FBXLoader = ( function () {
 
 		if ( transformData.preRotation ) {
 
-			var array = transformData.preRotation.map( THREE.Math.degToRad );
+			var array = transformData.preRotation.map( THREE.MathUtils.degToRad );
 			array.push( transformData.eulerOrder );
 			lPreRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
 
@@ -3955,7 +3955,7 @@ THREE.FBXLoader = ( function () {
 
 		if ( transformData.rotation ) {
 
-			var array = transformData.rotation.map( THREE.Math.degToRad );
+			var array = transformData.rotation.map( THREE.MathUtils.degToRad );
 			array.push( transformData.eulerOrder );
 			lRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
 
@@ -3963,7 +3963,7 @@ THREE.FBXLoader = ( function () {
 
 		if ( transformData.postRotation ) {
 
-			var array = transformData.postRotation.map( THREE.Math.degToRad );
+			var array = transformData.postRotation.map( THREE.MathUtils.degToRad );
 			array.push( transformData.eulerOrder );
 			lPostRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
 

+ 1 - 1
examples/js/loaders/GLTFLoader.js

@@ -2751,7 +2751,7 @@ THREE.GLTFLoader = ( function () {
 
 		if ( cameraDef.type === 'perspective' ) {
 
-			camera = new THREE.PerspectiveCamera( THREE.Math.radToDeg( params.yfov ), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6 );
+			camera = new THREE.PerspectiveCamera( THREE.MathUtils.radToDeg( params.yfov ), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6 );
 
 		} else if ( cameraDef.type === 'orthographic' ) {
 

+ 3 - 3
examples/js/math/ColorConverter.js

@@ -9,9 +9,9 @@ THREE.ColorConverter = {
 
 		// https://gist.github.com/xpansive/1337890#file-index-js
 
-		h = THREE.Math.euclideanModulo( h, 1 );
-		s = THREE.Math.clamp( s, 0, 1 );
-		v = THREE.Math.clamp( v, 0, 1 );
+		h = THREE.MathUtils.euclideanModulo( h, 1 );
+		s = THREE.MathUtils.clamp( s, 0, 1 );
+		v = THREE.MathUtils.clamp( v, 0, 1 );
 
 		return color.setHSL( h, ( s * v ) / ( ( h = ( 2 - s ) * v ) < 1 ? h : ( 2 - h ) ), h * 0.5 );
 

+ 6 - 6
examples/js/misc/MD2CharacterComplex.js

@@ -451,8 +451,8 @@ THREE.MD2CharacterComplex = function () {
 
 		this.maxReverseSpeed = - this.maxSpeed;
 
-		if ( controls.moveForward ) this.speed = THREE.Math.clamp( this.speed + delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed );
-		if ( controls.moveBackward ) this.speed = THREE.Math.clamp( this.speed - delta * this.backAcceleration, this.maxReverseSpeed, this.maxSpeed );
+		if ( controls.moveForward ) this.speed = THREE.MathUtils.clamp( this.speed + delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed );
+		if ( controls.moveBackward ) this.speed = THREE.MathUtils.clamp( this.speed - delta * this.backAcceleration, this.maxReverseSpeed, this.maxSpeed );
 
 		// orientation based on controls
 		// (don't just stand while turning)
@@ -462,14 +462,14 @@ THREE.MD2CharacterComplex = function () {
 		if ( controls.moveLeft ) {
 
 			this.bodyOrientation += delta * this.angularSpeed;
-			this.speed = THREE.Math.clamp( this.speed + dir * delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed );
+			this.speed = THREE.MathUtils.clamp( this.speed + dir * delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed );
 
 		}
 
 		if ( controls.moveRight ) {
 
 			this.bodyOrientation -= delta * this.angularSpeed;
-			this.speed = THREE.Math.clamp( this.speed + dir * delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed );
+			this.speed = THREE.MathUtils.clamp( this.speed + dir * delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed );
 
 		}
 
@@ -480,12 +480,12 @@ THREE.MD2CharacterComplex = function () {
 			if ( this.speed > 0 ) {
 
 				var k = exponentialEaseOut( this.speed / this.maxSpeed );
-				this.speed = THREE.Math.clamp( this.speed - k * delta * this.frontDecceleration, 0, this.maxSpeed );
+				this.speed = THREE.MathUtils.clamp( this.speed - k * delta * this.frontDecceleration, 0, this.maxSpeed );
 
 			} else {
 
 				var k = exponentialEaseOut( this.speed / this.maxReverseSpeed );
-				this.speed = THREE.Math.clamp( this.speed + k * delta * this.backAcceleration, this.maxReverseSpeed, 0 );
+				this.speed = THREE.MathUtils.clamp( this.speed + k * delta * this.backAcceleration, this.maxReverseSpeed, 0 );
 
 			}
 

+ 1 - 1
examples/js/misc/MorphBlendMesh.js

@@ -282,7 +282,7 @@ THREE.MorphBlendMesh.prototype = Object.assign( Object.create( THREE.Mesh.protot
 
 			}
 
-			var keyframe = animation.start + THREE.Math.clamp( Math.floor( animation.time / frameTime ), 0, animation.length - 1 );
+			var keyframe = animation.start + THREE.MathUtils.clamp( Math.floor( animation.time / frameTime ), 0, animation.length - 1 );
 			var weight = animation.weight;
 
 			if ( keyframe !== animation.currentFrame ) {

+ 2 - 2
examples/js/objects/Fire.js

@@ -145,8 +145,8 @@ THREE.Fire = function ( geometry, options ) {
 
 	this.field0.background = new THREE.Color( 0x000000 );
 
-	if ( ! THREE.Math.isPowerOfTwo( textureWidth ) ||
-		 ! THREE.Math.isPowerOfTwo( textureHeight ) ) {
+	if ( ! THREE.MathUtils.isPowerOfTwo( textureWidth ) ||
+		 ! THREE.MathUtils.isPowerOfTwo( textureHeight ) ) {
 
 		this.field0.texture.generateMipmaps = false;
 		this.field1.texture.generateMipmaps = false;

+ 3 - 3
examples/js/objects/LightningStorm.js

@@ -84,7 +84,7 @@ THREE.LightningStorm = function ( stormParams ) {
 
 			dest.set( ( Math.random() - 0.5 ) * stormParams.size, 0, ( Math.random() - 0.5 ) * stormParams.size );
 
-			var height = THREE.Math.lerp( stormParams.minHeight, stormParams.maxHeight, Math.random() );
+			var height = THREE.MathUtils.lerp( stormParams.minHeight, stormParams.maxHeight, Math.random() );
 
 			source.set( stormParams.maxSlope * ( 2 * Math.random() - 1 ), 1, stormParams.maxSlope * ( 2 * Math.random() - 1 ) ).multiplyScalar( height ).add( dest );
 
@@ -137,7 +137,7 @@ THREE.LightningStorm.prototype.update = function ( time ) {
 			var lightningParams1 = THREE.LightningStrike.copyParameters( lightningMesh.geometry.rayParameters, this.lightningParameters );
 
 			lightningParams1.birthTime = time;
-			lightningParams1.deathTime = time + THREE.Math.lerp( this.stormParams.lightningMinDuration, this.stormParams.lightningMaxDuration, Math.random() );
+			lightningParams1.deathTime = time + THREE.MathUtils.lerp( this.stormParams.lightningMinDuration, this.stormParams.lightningMaxDuration, Math.random() );
 
 			this.onRayPosition( lightningParams1.sourceOffset, lightningParams1.destOffset );
 
@@ -200,7 +200,7 @@ THREE.LightningStorm.prototype.update = function ( time ) {
 
 THREE.LightningStorm.prototype.getNextLightningTime = function ( currentTime ) {
 
-	return currentTime + THREE.Math.lerp( this.stormParams.lightningMinPeriod, this.stormParams.lightningMaxPeriod, Math.random() ) / ( this.stormParams.maxLightnings + 1 );
+	return currentTime + THREE.MathUtils.lerp( this.stormParams.lightningMinPeriod, this.stormParams.lightningMaxPeriod, Math.random() ) / ( this.stormParams.maxLightnings + 1 );
 
 };
 

+ 1 - 1
examples/js/objects/Reflector.js

@@ -45,7 +45,7 @@ THREE.Reflector = function ( geometry, options ) {
 
 	var renderTarget = new THREE.WebGLRenderTarget( textureWidth, textureHeight, parameters );
 
-	if ( ! THREE.Math.isPowerOfTwo( textureWidth ) || ! THREE.Math.isPowerOfTwo( textureHeight ) ) {
+	if ( ! THREE.MathUtils.isPowerOfTwo( textureWidth ) || ! THREE.MathUtils.isPowerOfTwo( textureHeight ) ) {
 
 		renderTarget.texture.generateMipmaps = false;
 

+ 1 - 1
examples/js/objects/Refractor.js

@@ -41,7 +41,7 @@ THREE.Refractor = function ( geometry, options ) {
 
 	var renderTarget = new THREE.WebGLRenderTarget( textureWidth, textureHeight, parameters );
 
-	if ( ! THREE.Math.isPowerOfTwo( textureWidth ) || ! THREE.Math.isPowerOfTwo( textureHeight ) ) {
+	if ( ! THREE.MathUtils.isPowerOfTwo( textureWidth ) || ! THREE.MathUtils.isPowerOfTwo( textureHeight ) ) {
 
 		renderTarget.texture.generateMipmaps = false;
 

+ 1 - 1
examples/js/objects/Water.js

@@ -57,7 +57,7 @@ THREE.Water = function ( geometry, options ) {
 
 	var renderTarget = new THREE.WebGLRenderTarget( textureWidth, textureHeight, parameters );
 
-	if ( ! THREE.Math.isPowerOfTwo( textureWidth ) || ! THREE.Math.isPowerOfTwo( textureHeight ) ) {
+	if ( ! THREE.MathUtils.isPowerOfTwo( textureWidth ) || ! THREE.MathUtils.isPowerOfTwo( textureHeight ) ) {
 
 		renderTarget.texture.generateMipmaps = false;
 

+ 12 - 12
examples/js/postprocessing/GlitchPass.js

@@ -44,22 +44,22 @@ THREE.GlitchPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
 		if ( this.curF % this.randX == 0 || this.goWild == true ) {
 
 			this.uniforms[ 'amount' ].value = Math.random() / 30;
-			this.uniforms[ 'angle' ].value = THREE.Math.randFloat( - Math.PI, Math.PI );
-			this.uniforms[ 'seed_x' ].value = THREE.Math.randFloat( - 1, 1 );
-			this.uniforms[ 'seed_y' ].value = THREE.Math.randFloat( - 1, 1 );
-			this.uniforms[ 'distortion_x' ].value = THREE.Math.randFloat( 0, 1 );
-			this.uniforms[ 'distortion_y' ].value = THREE.Math.randFloat( 0, 1 );
+			this.uniforms[ 'angle' ].value = THREE.MathUtils.randFloat( - Math.PI, Math.PI );
+			this.uniforms[ 'seed_x' ].value = THREE.MathUtils.randFloat( - 1, 1 );
+			this.uniforms[ 'seed_y' ].value = THREE.MathUtils.randFloat( - 1, 1 );
+			this.uniforms[ 'distortion_x' ].value = THREE.MathUtils.randFloat( 0, 1 );
+			this.uniforms[ 'distortion_y' ].value = THREE.MathUtils.randFloat( 0, 1 );
 			this.curF = 0;
 			this.generateTrigger();
 
 		} else if ( this.curF % this.randX < this.randX / 5 ) {
 
 			this.uniforms[ 'amount' ].value = Math.random() / 90;
-			this.uniforms[ 'angle' ].value = THREE.Math.randFloat( - Math.PI, Math.PI );
-			this.uniforms[ 'distortion_x' ].value = THREE.Math.randFloat( 0, 1 );
-			this.uniforms[ 'distortion_y' ].value = THREE.Math.randFloat( 0, 1 );
-			this.uniforms[ 'seed_x' ].value = THREE.Math.randFloat( - 0.3, 0.3 );
-			this.uniforms[ 'seed_y' ].value = THREE.Math.randFloat( - 0.3, 0.3 );
+			this.uniforms[ 'angle' ].value = THREE.MathUtils.randFloat( - Math.PI, Math.PI );
+			this.uniforms[ 'distortion_x' ].value = THREE.MathUtils.randFloat( 0, 1 );
+			this.uniforms[ 'distortion_y' ].value = THREE.MathUtils.randFloat( 0, 1 );
+			this.uniforms[ 'seed_x' ].value = THREE.MathUtils.randFloat( - 0.3, 0.3 );
+			this.uniforms[ 'seed_y' ].value = THREE.MathUtils.randFloat( - 0.3, 0.3 );
 
 		} else if ( this.goWild == false ) {
 
@@ -86,7 +86,7 @@ THREE.GlitchPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
 
 	generateTrigger: function () {
 
-		this.randX = THREE.Math.randInt( 120, 240 );
+		this.randX = THREE.MathUtils.randInt( 120, 240 );
 
 	},
 
@@ -97,7 +97,7 @@ THREE.GlitchPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
 
 		for ( var i = 0; i < length; i ++ ) {
 
-			var val = THREE.Math.randFloat( 0, 1 );
+			var val = THREE.MathUtils.randFloat( 0, 1 );
 			data_arr[ i * 3 + 0 ] = val;
 			data_arr[ i * 3 + 1 ] = val;
 			data_arr[ i * 3 + 2 ] = val;

+ 1 - 1
examples/js/postprocessing/SSAOPass.js

@@ -344,7 +344,7 @@ THREE.SSAOPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ),
 			sample.normalize();
 
 			var scale = i / kernelSize;
-			scale = THREE.Math.lerp( 0.1, 1, scale * scale );
+			scale = THREE.MathUtils.lerp( 0.1, 1, scale * scale );
 			sample.multiplyScalar( scale );
 
 			kernel.push( sample );

+ 1 - 1
examples/js/renderers/RaytracingWorker.js

@@ -503,7 +503,7 @@ THREE.RaytracingRendererWorker = function () {
 
 		cameraNormalMatrix.getNormalMatrix( camera.matrixWorld );
 
-		perspective = 0.5 / Math.tan( THREE.Math.degToRad( camera.fov * 0.5 ) ) * canvasHeight;
+		perspective = 0.5 / Math.tan( THREE.MathUtils.degToRad( camera.fov * 0.5 ) ) * canvasHeight;
 
 		objects = scene.children;
 

+ 0 - 63
examples/js/utils/MathUtils.js

@@ -1,63 +0,0 @@
-/**
- * @author WestLangley / http://github.com/WestLangley
- * @author thezwap / http://github.com/thezwap
- */
-
-THREE.MathUtils = {
-
-	setQuaternionFromProperEuler: function ( q, a, b, c, order ) {
-
-		// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
-
-		// rotations are applied to the axes in the order specified by 'order'
-		// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
-		// angles are in radians
-
-		var cos = Math.cos;
-		var sin = Math.sin;
-
-		var c2 = cos( b / 2 );
-		var s2 = sin( b / 2 );
-
-		var c13 = cos( ( a + c ) / 2 );
-		var s13 = sin( ( a + c ) / 2 );
-
-		var c1_3 = cos( ( a - c ) / 2 );
-		var s1_3 = sin( ( a - c ) / 2 );
-
-		var c3_1 = cos( ( c - a ) / 2 );
-		var s3_1 = sin( ( c - a ) / 2 );
-
-		if ( order === 'XYX' ) {
-
-			q.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );
-
-		} else if ( order === 'YZY' ) {
-
-			q.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );
-
-		} else if ( order === 'ZXZ' ) {
-
-			q.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );
-
-		} else if ( order === 'XZX' ) {
-
-			q.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );
-
-		} else if ( order === 'YXY' ) {
-
-			q.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );
-
-		} else if ( order === 'ZYZ' ) {
-
-			q.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );
-
-		} else {
-
-			console.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.' );
-
-		}
-
-	}
-
-};

+ 5 - 5
examples/jsm/controls/DeviceOrientationControls.js

@@ -7,7 +7,7 @@
 
 import {
 	Euler,
-	Math as _Math,
+	MathUtils,
 	Quaternion,
 	Vector3
 } from "../../../build/three.module.js";
@@ -115,13 +115,13 @@ var DeviceOrientationControls = function ( object ) {
 
 		if ( device ) {
 
-			var alpha = device.alpha ? _Math.degToRad( device.alpha ) + scope.alphaOffset : 0; // Z
+			var alpha = device.alpha ? MathUtils.degToRad( device.alpha ) + scope.alphaOffset : 0; // Z
 
-			var beta = device.beta ? _Math.degToRad( device.beta ) : 0; // X'
+			var beta = device.beta ? MathUtils.degToRad( device.beta ) : 0; // X'
 
-			var gamma = device.gamma ? _Math.degToRad( device.gamma ) : 0; // Y''
+			var gamma = device.gamma ? MathUtils.degToRad( device.gamma ) : 0; // Y''
 
-			var orient = scope.screenOrientation ? _Math.degToRad( scope.screenOrientation ) : 0; // O
+			var orient = scope.screenOrientation ? MathUtils.degToRad( scope.screenOrientation ) : 0; // O
 
 			setObjectQuaternion( scope.object.quaternion, alpha, beta, gamma, orient );
 

+ 7 - 7
examples/jsm/controls/FirstPersonControls.js

@@ -5,7 +5,7 @@
  */
 
 import {
-	Math as _Math,
+	MathUtils,
 	Spherical,
 	Vector3
 } from "../../../build/three.module.js";
@@ -235,7 +235,7 @@ var FirstPersonControls = function ( object, domElement ) {
 
 			if ( this.heightSpeed ) {
 
-				var y = _Math.clamp( this.object.position.y, this.heightMin, this.heightMax );
+				var y = MathUtils.clamp( this.object.position.y, this.heightMin, this.heightMax );
 				var heightDelta = y - this.heightMin;
 
 				this.autoSpeedFactor = delta * ( heightDelta * this.heightCoef );
@@ -278,12 +278,12 @@ var FirstPersonControls = function ( object, domElement ) {
 
 			lat = Math.max( - 85, Math.min( 85, lat ) );
 
-			var phi = _Math.degToRad( 90 - lat );
-			var theta = _Math.degToRad( lon );
+			var phi = MathUtils.degToRad( 90 - lat );
+			var theta = MathUtils.degToRad( lon );
 
 			if ( this.constrainVertical ) {
 
-				phi = _Math.mapLinear( phi, 0, Math.PI, this.verticalMin, this.verticalMax );
+				phi = MathUtils.mapLinear( phi, 0, Math.PI, this.verticalMin, this.verticalMax );
 
 			}
 
@@ -346,8 +346,8 @@ var FirstPersonControls = function ( object, domElement ) {
 		lookDirection.set( 0, 0, - 1 ).applyQuaternion( quaternion );
 		spherical.setFromVector3( lookDirection );
 
-		lat = 90 - _Math.radToDeg( spherical.phi );
-		lon = _Math.radToDeg( spherical.theta );
+		lat = 90 - MathUtils.radToDeg( spherical.phi );
+		lon = MathUtils.radToDeg( spherical.theta );
 
 	}
 

+ 5 - 5
examples/jsm/exporters/GLTFExporter.js

@@ -14,7 +14,7 @@ import {
 	LinearFilter,
 	LinearMipmapLinearFilter,
 	LinearMipmapNearestFilter,
-	Math as _Math,
+	MathUtils,
 	MirroredRepeatWrapping,
 	NearestFilter,
 	NearestMipmapLinearFilter,
@@ -248,7 +248,7 @@ GLTFExporter.prototype = {
 		 */
 		function isPowerOfTwo( image ) {
 
-			return _Math.isPowerOfTwo( image.width ) && _Math.isPowerOfTwo( image.height );
+			return MathUtils.isPowerOfTwo( image.width ) && MathUtils.isPowerOfTwo( image.height );
 
 		}
 
@@ -781,8 +781,8 @@ GLTFExporter.prototype = {
 
 					console.warn( 'GLTFExporter: Resized non-power-of-two image.', image );
 
-					canvas.width = _Math.floorPowerOfTwo( canvas.width );
-					canvas.height = _Math.floorPowerOfTwo( canvas.height );
+					canvas.width = MathUtils.floorPowerOfTwo( canvas.width );
+					canvas.height = MathUtils.floorPowerOfTwo( canvas.height );
 
 				}
 
@@ -1524,7 +1524,7 @@ GLTFExporter.prototype = {
 				gltfCamera.perspective = {
 
 					aspectRatio: camera.aspect,
-					yfov: _Math.degToRad( camera.fov ),
+					yfov: MathUtils.degToRad( camera.fov ),
 					zfar: camera.far <= 0 ? 0.001 : camera.far,
 					znear: camera.near < 0 ? 0 : camera.near
 

+ 4 - 4
examples/jsm/geometries/LightningStrike.js

@@ -105,7 +105,7 @@ import {
 	BufferGeometry,
 	DynamicDrawUsage,
 	Float32BufferAttribute,
-	Math as _Math,
+	MathUtils,
 	Uint32BufferAttribute,
 	Vector3
 } from "../../../build/three.module.js";
@@ -587,8 +587,8 @@ LightningStrike.prototype.fractalRay = function ( time, segmentCallback ) {
 
 		this.randomGenerator.setSeed( subray.seed );
 
-		subray.endPropagationTime = _Math.lerp( subray.birthTime, subray.deathTime, subray.propagationTimeFactor );
-		subray.beginVanishingTime = _Math.lerp( subray.deathTime, subray.birthTime, 1 - subray.vanishingTimeFactor );
+		subray.endPropagationTime = MathUtils.lerp( subray.birthTime, subray.deathTime, subray.propagationTimeFactor );
+		subray.beginVanishingTime = MathUtils.lerp( subray.deathTime, subray.birthTime, 1 - subray.vanishingTimeFactor );
 
 		var random1 = this.randomGenerator.random;
 		subray.linPos0.set( random1(), random1(), random1() ).multiplyScalar( 1000 );
@@ -833,7 +833,7 @@ LightningStrike.prototype.createDefaultSubrayCreationCallbacks = function () {
 		var period = lightningStrike.rayParameters.subrayPeriod;
 		var dutyCycle = lightningStrike.rayParameters.subrayDutyCycle;
 
-		var phase0 = ( lightningStrike.rayParameters.isEternal && subray.recursion == 0 ) ? - random1() * period : _Math.lerp( subray.birthTime, subray.endPropagationTime, segment.fraction0 ) - random1() * period;
+		var phase0 = ( lightningStrike.rayParameters.isEternal && subray.recursion == 0 ) ? - random1() * period : MathUtils.lerp( subray.birthTime, subray.endPropagationTime, segment.fraction0 ) - random1() * period;
 
 		var phase = lightningStrike.time - phase0;
 		var currentCycle = Math.floor( phase / period );

+ 3 - 3
examples/jsm/helpers/PositionalAudioHelper.js

@@ -7,7 +7,7 @@ import {
 	BufferAttribute,
 	LineBasicMaterial,
 	Line,
-	Math as _Math
+	MathUtils
 } from '../../../build/three.module.js';
 
 function PositionalAudioHelper( audio, range, divisionsInnerAngle, divisionsOuterAngle ) {
@@ -41,8 +41,8 @@ PositionalAudioHelper.prototype.update = function () {
 	var divisionsInnerAngle = this.divisionsInnerAngle;
 	var divisionsOuterAngle = this.divisionsOuterAngle;
 
-	var coneInnerAngle = _Math.degToRad( audio.panner.coneInnerAngle );
-	var coneOuterAngle = _Math.degToRad( audio.panner.coneOuterAngle );
+	var coneInnerAngle = MathUtils.degToRad( audio.panner.coneInnerAngle );
+	var coneOuterAngle = MathUtils.degToRad( audio.panner.coneOuterAngle );
 
 	var halfConeInnerAngle = coneInnerAngle / 2;
 	var halfConeOuterAngle = coneOuterAngle / 2;

+ 2 - 2
examples/jsm/lines/LineSegments2.js

@@ -7,7 +7,7 @@ import {
 	InstancedInterleavedBuffer,
 	InterleavedBufferAttribute,
 	Line3,
-	Math as _Math,
+	MathUtils,
 	Matrix4,
 	Mesh,
 	Vector3,
@@ -167,7 +167,7 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
 				line.at( param, closestPoint );
 
 				// check if the intersection point is within clip space
-				var zPos = _Math.lerp( start.z, end.z, param );
+				var zPos = MathUtils.lerp( start.z, end.z, param );
 				var isInClipSpace = zPos >= - 1 && zPos <= 1;
 
 				var isInside = ssOrigin3.distanceTo( closestPoint ) < lineWidth * 0.5;

+ 5 - 5
examples/jsm/loaders/ColladaLoader.js

@@ -21,7 +21,7 @@ import {
 	LineSegments,
 	Loader,
 	LoaderUtils,
-	Math as _Math,
+	MathUtils,
 	Matrix4,
 	Mesh,
 	MeshBasicMaterial,
@@ -2768,7 +2768,7 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				case 'rotate':
 					data.obj = new Vector3();
 					data.obj.fromArray( array );
-					data.angle = _Math.degToRad( array[ 3 ] );
+					data.angle = MathUtils.degToRad( array[ 3 ] );
 					break;
 
 			}
@@ -3040,7 +3040,7 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 									switch ( joint.type ) {
 
 										case 'revolute':
-											matrix.multiply( m0.makeRotationAxis( axis, _Math.degToRad( value ) ) );
+											matrix.multiply( m0.makeRotationAxis( axis, MathUtils.degToRad( value ) ) );
 											break;
 
 										case 'prismatic':
@@ -3136,7 +3136,7 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 					case 'rotate':
 						var array = parseFloats( child.textContent );
 						var vector = new Vector3().fromArray( array );
-						var angle = _Math.degToRad( array[ 3 ] );
+						var angle = MathUtils.degToRad( array[ 3 ] );
 						transforms.push( {
 							sid: child.getAttribute( 'sid' ),
 							type: child.nodeName,
@@ -3243,7 +3243,7 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 					case 'rotate':
 						var array = parseFloats( child.textContent );
-						var angle = _Math.degToRad( array[ 3 ] );
+						var angle = MathUtils.degToRad( array[ 3 ] );
 						data.matrix.multiply( matrix.makeRotationAxis( vector.fromArray( array ), angle ) );
 						data.transforms[ child.getAttribute( 'sid' ) ] = child.nodeName;
 						break;

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

@@ -36,7 +36,7 @@ import {
 	LineBasicMaterial,
 	Loader,
 	LoaderUtils,
-	Math as _Math,
+	MathUtils,
 	Matrix3,
 	Matrix4,
 	Mesh,
@@ -1170,7 +1170,7 @@ var FBXLoader = ( function () {
 
 						if ( lightAttribute.InnerAngle !== undefined ) {
 
-							angle = _Math.degToRad( lightAttribute.InnerAngle.value );
+							angle = MathUtils.degToRad( lightAttribute.InnerAngle.value );
 
 						}
 
@@ -1180,7 +1180,7 @@ var FBXLoader = ( function () {
 							// TODO: this is not correct - FBX calculates outer and inner angle in degrees
 							// with OuterAngle > InnerAngle && OuterAngle <= Math.PI
 							// while three.js uses a penumbra between (0, 1) to attenuate the inner angle
-							penumbra = _Math.degToRad( lightAttribute.OuterAngle.value );
+							penumbra = MathUtils.degToRad( lightAttribute.OuterAngle.value );
 							penumbra = Math.max( penumbra, 1 );
 
 						}
@@ -2733,19 +2733,19 @@ var FBXLoader = ( function () {
 			if ( curves.x !== undefined ) {
 
 				this.interpolateRotations( curves.x );
-				curves.x.values = curves.x.values.map( _Math.degToRad );
+				curves.x.values = curves.x.values.map( MathUtils.degToRad );
 
 			}
 			if ( curves.y !== undefined ) {
 
 				this.interpolateRotations( curves.y );
-				curves.y.values = curves.y.values.map( _Math.degToRad );
+				curves.y.values = curves.y.values.map( MathUtils.degToRad );
 
 			}
 			if ( curves.z !== undefined ) {
 
 				this.interpolateRotations( curves.z );
-				curves.z.values = curves.z.values.map( _Math.degToRad );
+				curves.z.values = curves.z.values.map( MathUtils.degToRad );
 
 			}
 
@@ -2754,7 +2754,7 @@ var FBXLoader = ( function () {
 
 			if ( preRotation !== undefined ) {
 
-				preRotation = preRotation.map( _Math.degToRad );
+				preRotation = preRotation.map( MathUtils.degToRad );
 				preRotation.push( eulerOrder );
 
 				preRotation = new Euler().fromArray( preRotation );
@@ -2764,7 +2764,7 @@ var FBXLoader = ( function () {
 
 			if ( postRotation !== undefined ) {
 
-				postRotation = postRotation.map( _Math.degToRad );
+				postRotation = postRotation.map( MathUtils.degToRad );
 				postRotation.push( eulerOrder );
 
 				postRotation = new Euler().fromArray( postRotation );
@@ -3995,7 +3995,7 @@ var FBXLoader = ( function () {
 
 		if ( transformData.preRotation ) {
 
-			var array = transformData.preRotation.map( _Math.degToRad );
+			var array = transformData.preRotation.map( MathUtils.degToRad );
 			array.push( transformData.eulerOrder );
 			lPreRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
 
@@ -4003,7 +4003,7 @@ var FBXLoader = ( function () {
 
 		if ( transformData.rotation ) {
 
-			var array = transformData.rotation.map( _Math.degToRad );
+			var array = transformData.rotation.map( MathUtils.degToRad );
 			array.push( transformData.eulerOrder );
 			lRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
 
@@ -4011,7 +4011,7 @@ var FBXLoader = ( function () {
 
 		if ( transformData.postRotation ) {
 
-			var array = transformData.postRotation.map( _Math.degToRad );
+			var array = transformData.postRotation.map( MathUtils.degToRad );
 			array.push( transformData.eulerOrder );
 			lPostRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
 

+ 2 - 2
examples/jsm/loaders/GLTFLoader.js

@@ -34,7 +34,7 @@ import {
 	Loader,
 	LoaderUtils,
 	Material,
-	Math as _Math,
+	MathUtils,
 	Matrix4,
 	Mesh,
 	MeshBasicMaterial,
@@ -2818,7 +2818,7 @@ var GLTFLoader = ( function () {
 
 		if ( cameraDef.type === 'perspective' ) {
 
-			camera = new PerspectiveCamera( _Math.radToDeg( params.yfov ), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6 );
+			camera = new PerspectiveCamera( MathUtils.radToDeg( params.yfov ), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6 );
 
 		} else if ( cameraDef.type === 'orthographic' ) {
 

+ 4 - 4
examples/jsm/math/ColorConverter.js

@@ -4,7 +4,7 @@
  */
 
 import {
-	Math as _Math
+	MathUtils
 } from "../../../build/three.module.js";
 
 var ColorConverter = {
@@ -13,9 +13,9 @@ var ColorConverter = {
 
 		// https://gist.github.com/xpansive/1337890#file-index-js
 
-		h = _Math.euclideanModulo( h, 1 );
-		s = _Math.clamp( s, 0, 1 );
-		v = _Math.clamp( v, 0, 1 );
+		h = MathUtils.euclideanModulo( h, 1 );
+		s = MathUtils.clamp( s, 0, 1 );
+		v = MathUtils.clamp( v, 0, 1 );
 
 		return color.setHSL( h, ( s * v ) / ( ( h = ( 2 - s ) * v ) < 1 ? h : ( 2 - h ) ), h * 0.5 );
 

+ 7 - 7
examples/jsm/misc/MD2CharacterComplex.js

@@ -4,7 +4,7 @@
 
 import {
 	Box3,
-	Math as _Math,
+	MathUtils,
 	MeshLambertMaterial,
 	Object3D,
 	TextureLoader,
@@ -463,8 +463,8 @@ var MD2CharacterComplex = function () {
 
 		this.maxReverseSpeed = - this.maxSpeed;
 
-		if ( controls.moveForward ) this.speed = _Math.clamp( this.speed + delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed );
-		if ( controls.moveBackward ) this.speed = _Math.clamp( this.speed - delta * this.backAcceleration, this.maxReverseSpeed, this.maxSpeed );
+		if ( controls.moveForward ) this.speed = MathUtils.clamp( this.speed + delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed );
+		if ( controls.moveBackward ) this.speed = MathUtils.clamp( this.speed - delta * this.backAcceleration, this.maxReverseSpeed, this.maxSpeed );
 
 		// orientation based on controls
 		// (don't just stand while turning)
@@ -474,14 +474,14 @@ var MD2CharacterComplex = function () {
 		if ( controls.moveLeft ) {
 
 			this.bodyOrientation += delta * this.angularSpeed;
-			this.speed = _Math.clamp( this.speed + dir * delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed );
+			this.speed = MathUtils.clamp( this.speed + dir * delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed );
 
 		}
 
 		if ( controls.moveRight ) {
 
 			this.bodyOrientation -= delta * this.angularSpeed;
-			this.speed = _Math.clamp( this.speed + dir * delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed );
+			this.speed = MathUtils.clamp( this.speed + dir * delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed );
 
 		}
 
@@ -492,12 +492,12 @@ var MD2CharacterComplex = function () {
 			if ( this.speed > 0 ) {
 
 				var k = exponentialEaseOut( this.speed / this.maxSpeed );
-				this.speed = _Math.clamp( this.speed - k * delta * this.frontDecceleration, 0, this.maxSpeed );
+				this.speed = MathUtils.clamp( this.speed - k * delta * this.frontDecceleration, 0, this.maxSpeed );
 
 			} else {
 
 				var k = exponentialEaseOut( this.speed / this.maxReverseSpeed );
-				this.speed = _Math.clamp( this.speed + k * delta * this.backAcceleration, this.maxReverseSpeed, 0 );
+				this.speed = MathUtils.clamp( this.speed + k * delta * this.backAcceleration, this.maxReverseSpeed, 0 );
 
 			}
 

+ 2 - 2
examples/jsm/misc/MorphBlendMesh.js

@@ -3,7 +3,7 @@
  */
 
 import {
-	Math as _Math,
+	MathUtils,
 	Mesh
 } from "../../../build/three.module.js";
 
@@ -287,7 +287,7 @@ MorphBlendMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {
 
 			}
 
-			var keyframe = animation.start + _Math.clamp( Math.floor( animation.time / frameTime ), 0, animation.length - 1 );
+			var keyframe = animation.start + MathUtils.clamp( Math.floor( animation.time / frameTime ), 0, animation.length - 1 );
 			var weight = animation.weight;
 
 			if ( keyframe !== animation.currentFrame ) {

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

@@ -2,11 +2,11 @@
  * @author sunag / http://www.sunag.com.br/
  */
 
-import { Math as _Math } from '../../../../build/three.module.js';
+import { MathUtils } from '../../../../build/three.module.js';
 
 function Node( type ) {
 
-	this.uuid = _Math.generateUUID();
+	this.uuid = MathUtils.generateUUID();
 
 	this.name = "";
 

+ 2 - 2
examples/jsm/nodes/core/TempNode.js

@@ -3,7 +3,7 @@
  * @author sunag / http://www.sunag.com.br/
  */
 
-import { Math as _Math } from '../../../../build/three.module.js';
+import { MathUtils } from '../../../../build/three.module.js';
 import { Node } from './Node.js';
 
 function TempNode( type, params ) {
@@ -30,7 +30,7 @@ TempNode.prototype.build = function ( builder, output, uuid, ns ) {
 
 		if ( isUnique && this.constructor.uuid === undefined ) {
 
-			this.constructor.uuid = _Math.generateUUID();
+			this.constructor.uuid = MathUtils.generateUUID();
 
 		}
 

+ 2 - 2
examples/jsm/nodes/postprocessing/NodePass.js

@@ -2,7 +2,7 @@
  * @author sunag / http://www.sunag.com.br/
  */
 
-import { Math as _Math } from '../../../../build/three.module.js';
+import { MathUtils } from '../../../../build/three.module.js';
 
 import { ShaderPass } from '../../postprocessing/ShaderPass.js';
 import { NodeMaterial } from '../materials/NodeMaterial.js';
@@ -13,7 +13,7 @@ function NodePass() {
 	ShaderPass.call( this );
 
 	this.name = "";
-	this.uuid = _Math.generateUUID();
+	this.uuid = MathUtils.generateUUID();
 
 	this.userData = {};
 

+ 3 - 3
examples/jsm/objects/Fire.js

@@ -11,7 +11,7 @@ import {
 	Color,
 	DataTexture,
 	LinearFilter,
-	Math as _Math,
+	MathUtils,
 	Mesh,
 	NearestFilter,
 	NoToneMapping,
@@ -163,8 +163,8 @@ var Fire = function ( geometry, options ) {
 
 	this.field0.background = new Color( 0x000000 );
 
-	if ( ! _Math.isPowerOfTwo( textureWidth ) ||
-		 ! _Math.isPowerOfTwo( textureHeight ) ) {
+	if ( ! MathUtils.isPowerOfTwo( textureWidth ) ||
+		 ! MathUtils.isPowerOfTwo( textureHeight ) ) {
 
 		this.field0.texture.generateMipmaps = false;
 		this.field1.texture.generateMipmaps = false;

+ 4 - 4
examples/jsm/objects/LightningStorm.js

@@ -47,7 +47,7 @@
 */
 
 import {
-	Math as _Math,
+	MathUtils,
 	Mesh,
 	MeshBasicMaterial,
 	Object3D
@@ -92,7 +92,7 @@ var LightningStorm = function ( stormParams ) {
 
 			dest.set( ( Math.random() - 0.5 ) * stormParams.size, 0, ( Math.random() - 0.5 ) * stormParams.size );
 
-			var height = _Math.lerp( stormParams.minHeight, stormParams.maxHeight, Math.random() );
+			var height = MathUtils.lerp( stormParams.minHeight, stormParams.maxHeight, Math.random() );
 
 			source.set( stormParams.maxSlope * ( 2 * Math.random() - 1 ), 1, stormParams.maxSlope * ( 2 * Math.random() - 1 ) ).multiplyScalar( height ).add( dest );
 
@@ -145,7 +145,7 @@ LightningStorm.prototype.update = function ( time ) {
 			var lightningParams1 = LightningStrike.copyParameters( lightningMesh.geometry.rayParameters, this.lightningParameters );
 
 			lightningParams1.birthTime = time;
-			lightningParams1.deathTime = time + _Math.lerp( this.stormParams.lightningMinDuration, this.stormParams.lightningMaxDuration, Math.random() );
+			lightningParams1.deathTime = time + MathUtils.lerp( this.stormParams.lightningMinDuration, this.stormParams.lightningMaxDuration, Math.random() );
 
 			this.onRayPosition( lightningParams1.sourceOffset, lightningParams1.destOffset );
 
@@ -208,7 +208,7 @@ LightningStorm.prototype.update = function ( time ) {
 
 LightningStorm.prototype.getNextLightningTime = function ( currentTime ) {
 
-	return currentTime + _Math.lerp( this.stormParams.lightningMinPeriod, this.stormParams.lightningMaxPeriod, Math.random() ) / ( this.stormParams.maxLightnings + 1 );
+	return currentTime + MathUtils.lerp( this.stormParams.lightningMinPeriod, this.stormParams.lightningMaxPeriod, Math.random() ) / ( this.stormParams.maxLightnings + 1 );
 
 };
 

+ 2 - 2
examples/jsm/objects/Reflector.js

@@ -5,7 +5,7 @@
 import {
 	Color,
 	LinearFilter,
-	Math as _Math,
+	MathUtils,
 	Matrix4,
 	Mesh,
 	PerspectiveCamera,
@@ -61,7 +61,7 @@ var Reflector = function ( geometry, options ) {
 
 	var renderTarget = new WebGLRenderTarget( textureWidth, textureHeight, parameters );
 
-	if ( ! _Math.isPowerOfTwo( textureWidth ) || ! _Math.isPowerOfTwo( textureHeight ) ) {
+	if ( ! MathUtils.isPowerOfTwo( textureWidth ) || ! MathUtils.isPowerOfTwo( textureHeight ) ) {
 
 		renderTarget.texture.generateMipmaps = false;
 

+ 2 - 2
examples/jsm/objects/Refractor.js

@@ -6,7 +6,7 @@
 import {
 	Color,
 	LinearFilter,
-	Math as _Math,
+	MathUtils,
 	Matrix4,
 	Mesh,
 	PerspectiveCamera,
@@ -58,7 +58,7 @@ var Refractor = function ( geometry, options ) {
 
 	var renderTarget = new WebGLRenderTarget( textureWidth, textureHeight, parameters );
 
-	if ( ! _Math.isPowerOfTwo( textureWidth ) || ! _Math.isPowerOfTwo( textureHeight ) ) {
+	if ( ! MathUtils.isPowerOfTwo( textureWidth ) || ! MathUtils.isPowerOfTwo( textureHeight ) ) {
 
 		renderTarget.texture.generateMipmaps = false;
 

+ 2 - 2
examples/jsm/objects/Water.js

@@ -11,7 +11,7 @@ import {
 	Color,
 	FrontSide,
 	LinearFilter,
-	Math as _Math,
+	MathUtils,
 	Matrix4,
 	Mesh,
 	PerspectiveCamera,
@@ -76,7 +76,7 @@ var Water = function ( geometry, options ) {
 
 	var renderTarget = new WebGLRenderTarget( textureWidth, textureHeight, parameters );
 
-	if ( ! _Math.isPowerOfTwo( textureWidth ) || ! _Math.isPowerOfTwo( textureHeight ) ) {
+	if ( ! MathUtils.isPowerOfTwo( textureWidth ) || ! MathUtils.isPowerOfTwo( textureHeight ) ) {
 
 		renderTarget.texture.generateMipmaps = false;
 

+ 13 - 13
examples/jsm/postprocessing/GlitchPass.js

@@ -5,7 +5,7 @@
 import {
 	DataTexture,
 	FloatType,
-	Math as _Math,
+	MathUtils,
 	RGBFormat,
 	ShaderMaterial,
 	UniformsUtils
@@ -55,22 +55,22 @@ GlitchPass.prototype = Object.assign( Object.create( Pass.prototype ), {
 		if ( this.curF % this.randX == 0 || this.goWild == true ) {
 
 			this.uniforms[ 'amount' ].value = Math.random() / 30;
-			this.uniforms[ 'angle' ].value = _Math.randFloat( - Math.PI, Math.PI );
-			this.uniforms[ 'seed_x' ].value = _Math.randFloat( - 1, 1 );
-			this.uniforms[ 'seed_y' ].value = _Math.randFloat( - 1, 1 );
-			this.uniforms[ 'distortion_x' ].value = _Math.randFloat( 0, 1 );
-			this.uniforms[ 'distortion_y' ].value = _Math.randFloat( 0, 1 );
+			this.uniforms[ 'angle' ].value = MathUtils.randFloat( - Math.PI, Math.PI );
+			this.uniforms[ 'seed_x' ].value = MathUtils.randFloat( - 1, 1 );
+			this.uniforms[ 'seed_y' ].value = MathUtils.randFloat( - 1, 1 );
+			this.uniforms[ 'distortion_x' ].value = MathUtils.randFloat( 0, 1 );
+			this.uniforms[ 'distortion_y' ].value = MathUtils.randFloat( 0, 1 );
 			this.curF = 0;
 			this.generateTrigger();
 
 		} else if ( this.curF % this.randX < this.randX / 5 ) {
 
 			this.uniforms[ 'amount' ].value = Math.random() / 90;
-			this.uniforms[ 'angle' ].value = _Math.randFloat( - Math.PI, Math.PI );
-			this.uniforms[ 'distortion_x' ].value = _Math.randFloat( 0, 1 );
-			this.uniforms[ 'distortion_y' ].value = _Math.randFloat( 0, 1 );
-			this.uniforms[ 'seed_x' ].value = _Math.randFloat( - 0.3, 0.3 );
-			this.uniforms[ 'seed_y' ].value = _Math.randFloat( - 0.3, 0.3 );
+			this.uniforms[ 'angle' ].value = MathUtils.randFloat( - Math.PI, Math.PI );
+			this.uniforms[ 'distortion_x' ].value = MathUtils.randFloat( 0, 1 );
+			this.uniforms[ 'distortion_y' ].value = MathUtils.randFloat( 0, 1 );
+			this.uniforms[ 'seed_x' ].value = MathUtils.randFloat( - 0.3, 0.3 );
+			this.uniforms[ 'seed_y' ].value = MathUtils.randFloat( - 0.3, 0.3 );
 
 		} else if ( this.goWild == false ) {
 
@@ -97,7 +97,7 @@ GlitchPass.prototype = Object.assign( Object.create( Pass.prototype ), {
 
 	generateTrigger: function () {
 
-		this.randX = _Math.randInt( 120, 240 );
+		this.randX = MathUtils.randInt( 120, 240 );
 
 	},
 
@@ -108,7 +108,7 @@ GlitchPass.prototype = Object.assign( Object.create( Pass.prototype ), {
 
 		for ( var i = 0; i < length; i ++ ) {
 
-			var val = _Math.randFloat( 0, 1 );
+			var val = MathUtils.randFloat( 0, 1 );
 			data_arr[ i * 3 + 0 ] = val;
 			data_arr[ i * 3 + 1 ] = val;
 			data_arr[ i * 3 + 2 ] = val;

+ 2 - 2
examples/jsm/postprocessing/SSAOPass.js

@@ -12,7 +12,7 @@ import {
 	DstColorFactor,
 	FloatType,
 	LinearFilter,
-	Math as _Math,
+	MathUtils,
 	MeshNormalMaterial,
 	NearestFilter,
 	NoBlending,
@@ -374,7 +374,7 @@ SSAOPass.prototype = Object.assign( Object.create( Pass.prototype ), {
 			sample.normalize();
 
 			var scale = i / kernelSize;
-			scale = _Math.lerp( 0.1, 1, scale * scale );
+			scale = MathUtils.lerp( 0.1, 1, scale * scale );
 			sample.multiplyScalar( scale );
 
 			kernel.push( sample );

+ 0 - 5
examples/jsm/utils/MathUtils.d.ts

@@ -1,5 +0,0 @@
-import { Quaternion } from '../../../src/Three';
-
-export namespace MathUtils {
-	export function setQuaternionFromProperEuler( q: Quaternion, a: number, b: number, c: number, order: string ): void;
-}

+ 0 - 67
examples/jsm/utils/MathUtils.js

@@ -1,67 +0,0 @@
-/**
- * @author WestLangley / http://github.com/WestLangley
- * @author thezwap / http://github.com/thezwap
- */
-
-
-
-var MathUtils = {
-
-	setQuaternionFromProperEuler: function ( q, a, b, c, order ) {
-
-		// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
-
-		// rotations are applied to the axes in the order specified by 'order'
-		// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
-		// angles are in radians
-
-		var cos = Math.cos;
-		var sin = Math.sin;
-
-		var c2 = cos( b / 2 );
-		var s2 = sin( b / 2 );
-
-		var c13 = cos( ( a + c ) / 2 );
-		var s13 = sin( ( a + c ) / 2 );
-
-		var c1_3 = cos( ( a - c ) / 2 );
-		var s1_3 = sin( ( a - c ) / 2 );
-
-		var c3_1 = cos( ( c - a ) / 2 );
-		var s3_1 = sin( ( c - a ) / 2 );
-
-		if ( order === 'XYX' ) {
-
-			q.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );
-
-		} else if ( order === 'YZY' ) {
-
-			q.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );
-
-		} else if ( order === 'ZXZ' ) {
-
-			q.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );
-
-		} else if ( order === 'XZX' ) {
-
-			q.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );
-
-		} else if ( order === 'YXY' ) {
-
-			q.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );
-
-		} else if ( order === 'ZYZ' ) {
-
-			q.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );
-
-		} else {
-
-			console.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.' );
-
-		}
-
-	}
-
-};
-
-export { MathUtils };

+ 2 - 2
examples/jsm/utils/RoughnessMipmapper.js

@@ -10,7 +10,7 @@
 
 import {
 	LinearMipMapLinearFilter,
-	Math as _Math,
+	MathUtils,
 	Mesh,
 	NoBlending,
 	OrthographicCamera,
@@ -53,7 +53,7 @@ var RoughnessMipmapper = ( function () {
 
 			var width = Math.max( roughnessMap.image.width, normalMap.image.width );
 			var height = Math.max( roughnessMap.image.height, normalMap.image.height );
-			if ( ! _Math.isPowerOfTwo( width ) || ! _Math.isPowerOfTwo( height ) ) return;
+			if ( ! MathUtils.isPowerOfTwo( width ) || ! MathUtils.isPowerOfTwo( height ) ) return;
 
 			var autoClear = _renderer.autoClear;
 			_renderer.autoClear = false;

+ 1 - 1
examples/misc_animation_authoring.html

@@ -77,7 +77,7 @@
 
 						case 17: // Ctrl
 							control.setTranslationSnap( 100 );
-							control.setRotationSnap( THREE.Math.degToRad( 15 ) );
+							control.setRotationSnap( THREE.MathUtils.degToRad( 15 ) );
 							break;
 
 						case 87: // W

+ 1 - 1
examples/misc_controls_transform.html

@@ -83,7 +83,7 @@
 
 						case 16: // Shift
 							control.setTranslationSnap( 100 );
-							control.setRotationSnap( THREE.Math.degToRad( 15 ) );
+							control.setRotationSnap( THREE.MathUtils.degToRad( 15 ) );
 							control.setScaleSnap( 0.25 );
 							break;
 

+ 3 - 3
examples/webgl_camera.html

@@ -109,9 +109,9 @@
 
 				for ( var i = 0; i < 10000; i ++ ) {
 
-					vertices.push( THREE.Math.randFloatSpread( 2000 ) ); // x
-					vertices.push( THREE.Math.randFloatSpread( 2000 ) ); // y
-					vertices.push( THREE.Math.randFloatSpread( 2000 ) ); // z
+					vertices.push( THREE.MathUtils.randFloatSpread( 2000 ) ); // x
+					vertices.push( THREE.MathUtils.randFloatSpread( 2000 ) ); // y
+					vertices.push( THREE.MathUtils.randFloatSpread( 2000 ) ); // z
 
 				}
 

+ 3 - 3
examples/webgl_camera_cinematic.html

@@ -175,9 +175,9 @@
 
 				theta += 0.1;
 
-				camera.position.x = radius * Math.sin( THREE.Math.degToRad( theta ) );
-				camera.position.y = radius * Math.sin( THREE.Math.degToRad( theta ) );
-				camera.position.z = radius * Math.cos( THREE.Math.degToRad( theta ) );
+				camera.position.x = radius * Math.sin( THREE.MathUtils.degToRad( theta ) );
+				camera.position.y = radius * Math.sin( THREE.MathUtils.degToRad( theta ) );
+				camera.position.z = radius * Math.cos( THREE.MathUtils.degToRad( theta ) );
 				camera.lookAt( scene.position );
 
 				camera.updateMatrixWorld();

+ 1 - 1
examples/webgl_camera_logarithmicdepthbuffer.html

@@ -249,7 +249,7 @@
 				var damping = ( Math.abs( zoomspeed ) > minzoomspeed ? .95 : 1.0 );
 
 				// Zoom out faster the further out you go
-				var zoom = THREE.Math.clamp( Math.pow( Math.E, zoompos ), minzoom, maxzoom );
+				var zoom = THREE.MathUtils.clamp( Math.pow( Math.E, zoompos ), minzoom, maxzoom );
 				zoompos = Math.log( zoom );
 
 				// Slow down quickly at the zoom limits

+ 1 - 1
examples/webgl_custom_attributes.html

@@ -164,7 +164,7 @@
 					displacement[ i ] = Math.sin( 0.1 * i + time );
 
 					noise[ i ] += 0.5 * ( 0.5 - Math.random() );
-					noise[ i ] = THREE.Math.clamp( noise[ i ], - 5, 5 );
+					noise[ i ] = THREE.MathUtils.clamp( noise[ i ], - 5, 5 );
 
 					displacement[ i ] += noise[ i ];
 

+ 2 - 0
examples/webgl_geometry_cube.html

@@ -33,6 +33,8 @@
 				mesh = new THREE.Mesh( geometry, material );
 				scene.add( mesh );
 
+				console.log( THREE.MathUtils.clamp( 0.6, 0, 1 ) );
+
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );

+ 1 - 1
examples/webgl_geometry_extrude_shapes.html

@@ -111,7 +111,7 @@
 
 				for ( var i = 0; i < 10; i ++ ) {
 
-					randomPoints.push( new THREE.Vector3( ( i - 4.5 ) * 50, THREE.Math.randFloat( - 50, 50 ), THREE.Math.randFloat( - 50, 50 ) ) );
+					randomPoints.push( new THREE.Vector3( ( i - 4.5 ) * 50, THREE.MathUtils.randFloat( - 50, 50 ), THREE.MathUtils.randFloat( - 50, 50 ) ) );
 
 				}
 

+ 1 - 1
examples/webgl_geometry_nurbs.html

@@ -90,7 +90,7 @@
 					);
 
 					var knot = ( i + 1 ) / ( j - nurbsDegree );
-					nurbsKnots.push( THREE.Math.clamp( knot, 0, 1 ) );
+					nurbsKnots.push( THREE.MathUtils.clamp( knot, 0, 1 ) );
 
 				}
 

+ 1 - 1
examples/webgl_gpgpu_protoplanet.html

@@ -523,7 +523,7 @@
 
 			function getCameraConstant( camera ) {
 
-				return window.innerHeight / ( Math.tan( THREE.Math.DEG2RAD * 0.5 * camera.fov ) / camera.zoom );
+				return window.innerHeight / ( Math.tan( THREE.MathUtils.DEG2RAD * 0.5 * camera.fov ) / camera.zoom );
 
 			}
 

+ 3 - 3
examples/webgl_interactive_cubes.html

@@ -123,9 +123,9 @@
 
 				theta += 0.1;
 
-				camera.position.x = radius * Math.sin( THREE.Math.degToRad( theta ) );
-				camera.position.y = radius * Math.sin( THREE.Math.degToRad( theta ) );
-				camera.position.z = radius * Math.cos( THREE.Math.degToRad( theta ) );
+				camera.position.x = radius * Math.sin( THREE.MathUtils.degToRad( theta ) );
+				camera.position.y = radius * Math.sin( THREE.MathUtils.degToRad( theta ) );
+				camera.position.z = radius * Math.cos( THREE.MathUtils.degToRad( theta ) );
 				camera.lookAt( scene.position );
 
 				camera.updateMatrixWorld();

+ 3 - 3
examples/webgl_interactive_cubes_ortho.html

@@ -131,9 +131,9 @@
 
 				theta += 0.1;
 
-				camera.position.x = radius * Math.sin( THREE.Math.degToRad( theta ) );
-				camera.position.y = radius * Math.sin( THREE.Math.degToRad( theta ) );
-				camera.position.z = radius * Math.cos( THREE.Math.degToRad( theta ) );
+				camera.position.x = radius * Math.sin( THREE.MathUtils.degToRad( theta ) );
+				camera.position.y = radius * Math.sin( THREE.MathUtils.degToRad( theta ) );
+				camera.position.z = radius * Math.cos( THREE.MathUtils.degToRad( theta ) );
 				camera.lookAt( scene.position );
 
 				camera.updateMatrixWorld();

+ 3 - 3
examples/webgl_interactive_lines.html

@@ -174,9 +174,9 @@
 
 				theta += 0.1;
 
-				camera.position.x = radius * Math.sin( THREE.Math.degToRad( theta ) );
-				camera.position.y = radius * Math.sin( THREE.Math.degToRad( theta ) );
-				camera.position.z = radius * Math.cos( THREE.Math.degToRad( theta ) );
+				camera.position.x = radius * Math.sin( THREE.MathUtils.degToRad( theta ) );
+				camera.position.y = radius * Math.sin( THREE.MathUtils.degToRad( theta ) );
+				camera.position.z = radius * Math.cos( THREE.MathUtils.degToRad( theta ) );
 				camera.lookAt( scene.position );
 
 				camera.updateMatrixWorld();

+ 3 - 3
examples/webgl_layers.html

@@ -164,9 +164,9 @@
 
 				theta += 0.1;
 
-				camera.position.x = radius * Math.sin( THREE.Math.degToRad( theta ) );
-				camera.position.y = radius * Math.sin( THREE.Math.degToRad( theta ) );
-				camera.position.z = radius * Math.cos( THREE.Math.degToRad( theta ) );
+				camera.position.x = radius * Math.sin( THREE.MathUtils.degToRad( theta ) );
+				camera.position.y = radius * Math.sin( THREE.MathUtils.degToRad( theta ) );
+				camera.position.z = radius * Math.cos( THREE.MathUtils.degToRad( theta ) );
 				camera.lookAt( scene.position );
 
 				renderer.render( scene, camera );

+ 2 - 2
examples/webgl_loader_collada_kinematics.html

@@ -106,7 +106,7 @@
 
 			function setupTween() {
 
-				var duration = THREE.Math.randInt( 1000, 5000 );
+				var duration = THREE.MathUtils.randInt( 1000, 5000 );
 
 				var target = {};
 
@@ -124,7 +124,7 @@
 
 							tweenParameters[ prop ] = position;
 
-							target[ prop ] = THREE.Math.randInt( joint.limits.min, joint.limits.max );
+							target[ prop ] = THREE.MathUtils.randInt( joint.limits.min, joint.limits.max );
 
 						}
 

+ 3 - 3
examples/webgl_materials_cubemap_dynamic.html

@@ -135,7 +135,7 @@
 
 				var fov = camera.fov + event.deltaY * 0.05;
 
-				camera.fov = THREE.Math.clamp( fov, 10, 75 );
+				camera.fov = THREE.MathUtils.clamp( fov, 10, 75 );
 
 				camera.updateProjectionMatrix();
 
@@ -155,8 +155,8 @@
 				lon += .15;
 
 				lat = Math.max( - 85, Math.min( 85, lat ) );
-				phi = THREE.Math.degToRad( 90 - lat );
-				theta = THREE.Math.degToRad( lon );
+				phi = THREE.MathUtils.degToRad( 90 - lat );
+				theta = THREE.MathUtils.degToRad( lon );
 
 				cube.position.x = Math.cos( time * 0.001 ) * 30;
 				cube.position.y = Math.sin( time * 0.001 ) * 30;

+ 2 - 2
examples/webgl_materials_nodes.html

@@ -118,7 +118,7 @@
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				renderer.uuid = THREE.Math.generateUUID(); // generate to library
+				renderer.uuid = THREE.MathUtils.generateUUID(); // generate to library
 				renderer.outputEncoding = THREE.sRGBEncoding;
 				container.appendChild( renderer.domElement );
 
@@ -1146,7 +1146,7 @@
 
 						function updateUVTransform() {
 
-							texture.uv.setUvTransform( translate.x, translate.y, scale.x, scale.y, THREE.Math.degToRad( rotate ) );
+							texture.uv.setUvTransform( translate.x, translate.y, scale.x, scale.y, THREE.MathUtils.degToRad( rotate ) );
 
 						}
 

+ 1 - 1
examples/webgl_materials_texture_anisotropy.html

@@ -192,7 +192,7 @@
 			function render() {
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
-				camera.position.y = THREE.Math.clamp( camera.position.y + ( - ( mouseY - 200 ) - camera.position.y ) * .05, 50, 1000 );
+				camera.position.y = THREE.MathUtils.clamp( camera.position.y + ( - ( mouseY - 200 ) - camera.position.y ) * .05, 50, 1000 );
 
 				camera.lookAt( scene1.position );
 

+ 2 - 2
examples/webgl_materials_texture_partialupdate.html

@@ -84,8 +84,8 @@
 
 					last = elapsedTime;
 
-					position.x = ( 32 * THREE.Math.randInt( 1, 16 ) ) - 32;
-					position.y = ( 32 * THREE.Math.randInt( 1, 16 ) ) - 32;
+					position.x = ( 32 * THREE.MathUtils.randInt( 1, 16 ) ) - 32;
+					position.y = ( 32 * THREE.MathUtils.randInt( 1, 16 ) ) - 32;
 
 					// generate new color data
 

+ 2 - 2
examples/webgl_morphtargets_horse.html

@@ -124,8 +124,8 @@
 
 				theta += 0.1;
 
-				camera.position.x = radius * Math.sin( THREE.Math.degToRad( theta ) );
-				camera.position.z = radius * Math.cos( THREE.Math.degToRad( theta ) );
+				camera.position.x = radius * Math.sin( THREE.MathUtils.degToRad( theta ) );
+				camera.position.z = radius * Math.cos( THREE.MathUtils.degToRad( theta ) );
 
 				camera.lookAt( camera.target );
 

+ 1 - 1
examples/webgl_multiple_canvases_circle.html

@@ -190,7 +190,7 @@
 			var canvas5 = document.getElementById( 'canvas5' );
 
 			var fudge = 0.45; // I don't know why this is needed :-(
-			var rot = 30 * THREE.Math.DEG2RAD;
+			var rot = 30 * THREE.MathUtils.DEG2RAD;
 
 			views.push( new View( canvas1, rot * - 2 * fudge ) );
 			views.push( new View( canvas2, rot * - 1 * fudge ) );

+ 3 - 3
examples/webgl_panorama_dualfisheye.html

@@ -155,7 +155,7 @@
 
 				distance += event.deltaY * 0.05;
 
-				distance = THREE.Math.clamp( distance, 400, 1000 );
+				distance = THREE.MathUtils.clamp( distance, 400, 1000 );
 
 			}
 
@@ -175,8 +175,8 @@
 				}
 
 				lat = Math.max( - 85, Math.min( 85, lat ) );
-				phi = THREE.Math.degToRad( 90 - lat );
-				theta = THREE.Math.degToRad( lon - 180 );
+				phi = THREE.MathUtils.degToRad( 90 - lat );
+				theta = THREE.MathUtils.degToRad( lon - 180 );
 
 				camera.position.x = distance * Math.sin( phi ) * Math.cos( theta );
 				camera.position.y = distance * Math.cos( phi );

+ 3 - 3
examples/webgl_panorama_equirectangular.html

@@ -158,7 +158,7 @@
 
 				var fov = camera.fov + event.deltaY * 0.05;
 
-				camera.fov = THREE.Math.clamp( fov, 10, 75 );
+				camera.fov = THREE.MathUtils.clamp( fov, 10, 75 );
 
 				camera.updateProjectionMatrix();
 
@@ -180,8 +180,8 @@
 				}
 
 				lat = Math.max( - 85, Math.min( 85, lat ) );
-				phi = THREE.Math.degToRad( 90 - lat );
-				theta = THREE.Math.degToRad( lon );
+				phi = THREE.MathUtils.degToRad( 90 - lat );
+				theta = THREE.MathUtils.degToRad( lon );
 
 				camera.target.x = 500 * Math.sin( phi ) * Math.cos( theta );
 				camera.target.y = 500 * Math.cos( phi );

+ 1 - 1
examples/webgl_postprocessing_crossfade.html

@@ -354,7 +354,7 @@
 					if ( transitionParams.animateTransition ) {
 
 						var t = ( 1 + Math.sin( transitionParams.transitionSpeed * clock.getElapsedTime() / Math.PI ) ) / 2;
-						transitionParams.transition = THREE.Math.smoothstep( t, 0.3, 0.7 );
+						transitionParams.transition = THREE.MathUtils.smoothstep( t, 0.3, 0.7 );
 
 						// Change the current alpha texture after each transition
 						if ( transitionParams.loopTexture && ( transitionParams.transition == 0 || transitionParams.transition == 1 ) ) {

+ 1 - 1
examples/webgl_postprocessing_ssaa_unbiased.html

@@ -96,7 +96,7 @@
 				cameraO = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 3, 10 );
 				cameraO.position.z = 7;
 
-				var fov = THREE.Math.degToRad( cameraP.fov );
+				var fov = THREE.MathUtils.degToRad( cameraP.fov );
 				var hyperfocus = ( cameraP.near + cameraP.far ) / 2;
 				var _height = 2 * Math.tan( fov / 2 ) * hyperfocus;
 				cameraO.zoom = height / _height;

+ 3 - 3
examples/webgl_video_panorama_equirectangular.html

@@ -121,7 +121,7 @@
 
 				distance += event.deltaY * 0.05;
 
-				distance = THREE.Math.clamp( distance, 1, 50 );
+				distance = THREE.MathUtils.clamp( distance, 1, 50 );
 
 			}
 
@@ -135,8 +135,8 @@
 			function update() {
 
 				lat = Math.max( - 85, Math.min( 85, lat ) );
-				phi = THREE.Math.degToRad( 90 - lat );
-				theta = THREE.Math.degToRad( lon );
+				phi = THREE.MathUtils.degToRad( 90 - lat );
+				theta = THREE.MathUtils.degToRad( lon );
 
 				camera.position.x = distance * Math.sin( phi ) * Math.cos( theta );
 				camera.position.y = distance * Math.cos( phi );

+ 2 - 2
examples/webxr_vr_ballshooter.html

@@ -218,7 +218,7 @@
 
 					if ( object.position.x < - range || object.position.x > range ) {
 
-						object.position.x = THREE.Math.clamp( object.position.x, - range, range );
+						object.position.x = THREE.MathUtils.clamp( object.position.x, - range, range );
 						object.userData.velocity.x = - object.userData.velocity.x;
 
 					}
@@ -235,7 +235,7 @@
 
 					if ( object.position.z < - range || object.position.z > range ) {
 
-						object.position.z = THREE.Math.clamp( object.position.z, - range, range );
+						object.position.z = THREE.MathUtils.clamp( object.position.z, - range, range );
 						object.userData.velocity.z = - object.userData.velocity.z;
 
 					}

+ 3 - 3
examples/webxr_vr_cubes.html

@@ -230,21 +230,21 @@
 
 					if ( cube.position.x < - 3 || cube.position.x > 3 ) {
 
-						cube.position.x = THREE.Math.clamp( cube.position.x, - 3, 3 );
+						cube.position.x = THREE.MathUtils.clamp( cube.position.x, - 3, 3 );
 						cube.userData.velocity.x = - cube.userData.velocity.x;
 
 					}
 
 					if ( cube.position.y < 0 || cube.position.y > 6 ) {
 
-						cube.position.y = THREE.Math.clamp( cube.position.y, 0, 6 );
+						cube.position.y = THREE.MathUtils.clamp( cube.position.y, 0, 6 );
 						cube.userData.velocity.y = - cube.userData.velocity.y;
 
 					}
 
 					if ( cube.position.z < - 3 || cube.position.z > 3 ) {
 
-						cube.position.z = THREE.Math.clamp( cube.position.z, - 3, 3 );
+						cube.position.z = THREE.MathUtils.clamp( cube.position.z, - 3, 3 );
 						cube.userData.velocity.z = - cube.userData.velocity.z;
 
 					}

+ 2 - 2
examples/webxr_vr_multiview.html

@@ -163,7 +163,7 @@
 
 					if ( object.position.x < - range || object.position.x > range ) {
 
-						object.position.x = THREE.Math.clamp( object.position.x, - range, range );
+						object.position.x = THREE.MathUtils.clamp( object.position.x, - range, range );
 						object.userData.velocity.x = - object.userData.velocity.x;
 
 					}
@@ -177,7 +177,7 @@
 
 					if ( object.position.z < - range || object.position.z > range ) {
 
-						object.position.z = THREE.Math.clamp( object.position.z, - range, range );
+						object.position.z = THREE.MathUtils.clamp( object.position.z, - range, range );
 						object.userData.velocity.z = - object.userData.velocity.z;
 
 					}

+ 5 - 4
src/Three.Legacy.js

@@ -63,7 +63,7 @@ import { Box2 } from './math/Box2.js';
 import { Box3 } from './math/Box3.js';
 import { Color } from './math/Color.js';
 import { Line3 } from './math/Line3.js';
-import { _Math } from './math/Math.js';
+import { MathUtils } from './math/MathUtils.js';
 import { Matrix3 } from './math/Matrix3.js';
 import { Matrix4 } from './math/Matrix4.js';
 import { Plane } from './math/Plane.js';
@@ -89,6 +89,7 @@ import { Shape } from './extras/core/Shape.js';
 import { CubeCamera } from './cameras/CubeCamera.js';
 
 export { BoxGeometry as CubeGeometry };
+export { MathUtils as Math };
 
 export function Face4( a, b, c, d, normal, color, materialIndex ) {
 
@@ -544,7 +545,7 @@ Line3.prototype.center = function ( optionalTarget ) {
 
 };
 
-Object.assign( _Math, {
+Object.assign( MathUtils, {
 
 	random16: function () {
 
@@ -556,14 +557,14 @@ Object.assign( _Math, {
 	nearestPowerOfTwo: function ( value ) {
 
 		console.warn( 'THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo().' );
-		return _Math.floorPowerOfTwo( value );
+		return MathUtils.floorPowerOfTwo( value );
 
 	},
 
 	nextPowerOfTwo: function ( value ) {
 
 		console.warn( 'THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo().' );
-		return _Math.ceilPowerOfTwo( value );
+		return MathUtils.ceilPowerOfTwo( value );
 
 	}
 

+ 1 - 1
src/Three.d.ts

@@ -108,7 +108,7 @@ export * from './math/interpolants/DiscreteInterpolant';
 export * from './math/interpolants/CubicInterpolant';
 export * from './math/Interpolant';
 export * from './math/Triangle';
-export { _Math as Math } from './math/Math';
+export * from './math/MathUtils';
 export * from './math/Spherical';
 export * from './math/Cylindrical';
 export * from './math/Plane';

+ 1 - 1
src/Three.js

@@ -110,7 +110,7 @@ export { DiscreteInterpolant } from './math/interpolants/DiscreteInterpolant.js'
 export { CubicInterpolant } from './math/interpolants/CubicInterpolant.js';
 export { Interpolant } from './math/Interpolant.js';
 export { Triangle } from './math/Triangle.js';
-export { _Math as Math } from './math/Math.js';
+export { MathUtils } from './math/MathUtils.js';
 export { Spherical } from './math/Spherical.js';
 export { Cylindrical } from './math/Cylindrical.js';
 export { Plane } from './math/Plane.js';

+ 2 - 2
src/animation/AnimationClip.js

@@ -6,7 +6,7 @@ import { NumberKeyframeTrack } from './tracks/NumberKeyframeTrack.js';
 import { QuaternionKeyframeTrack } from './tracks/QuaternionKeyframeTrack.js';
 import { StringKeyframeTrack } from './tracks/StringKeyframeTrack.js';
 import { VectorKeyframeTrack } from './tracks/VectorKeyframeTrack.js';
-import { _Math } from '../math/Math.js';
+import { MathUtils } from '../math/MathUtils.js';
 
 /**
  *
@@ -22,7 +22,7 @@ function AnimationClip( name, duration, tracks ) {
 	this.tracks = tracks;
 	this.duration = ( duration !== undefined ) ? duration : - 1;
 
-	this.uuid = _Math.generateUUID();
+	this.uuid = MathUtils.generateUUID();
 
 	// this means it should figure out its duration by scanning the tracks
 	if ( this.duration < 0 ) {

+ 2 - 2
src/animation/AnimationObjectGroup.js

@@ -1,5 +1,5 @@
 import { PropertyBinding } from './PropertyBinding.js';
-import { _Math } from '../math/Math.js';
+import { MathUtils } from '../math/MathUtils.js';
 
 /**
  *
@@ -34,7 +34,7 @@ import { _Math } from '../math/Math.js';
 
 function AnimationObjectGroup() {
 
-	this.uuid = _Math.generateUUID();
+	this.uuid = MathUtils.generateUUID();
 
 	// cached objects followed by the active ones
 	this._objects = Array.prototype.slice.call( arguments );

+ 6 - 6
src/cameras/PerspectiveCamera.js

@@ -1,6 +1,6 @@
 import { Camera } from './Camera.js';
 import { Object3D } from '../core/Object3D.js';
-import { _Math } from '../math/Math.js';
+import { MathUtils } from '../math/MathUtils.js';
 
 /**
  * @author mrdoob / http://mrdoob.com/
@@ -72,7 +72,7 @@ PerspectiveCamera.prototype = Object.assign( Object.create( Camera.prototype ),
 		// see http://www.bobatkins.com/photography/technical/field_of_view.html
 		var vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;
 
-		this.fov = _Math.RAD2DEG * 2 * Math.atan( vExtentSlope );
+		this.fov = MathUtils.RAD2DEG * 2 * Math.atan( vExtentSlope );
 		this.updateProjectionMatrix();
 
 	},
@@ -82,7 +82,7 @@ PerspectiveCamera.prototype = Object.assign( Object.create( Camera.prototype ),
 	 */
 	getFocalLength: function () {
 
-		var vExtentSlope = Math.tan( _Math.DEG2RAD * 0.5 * this.fov );
+		var vExtentSlope = Math.tan( MathUtils.DEG2RAD * 0.5 * this.fov );
 
 		return 0.5 * this.getFilmHeight() / vExtentSlope;
 
@@ -90,8 +90,8 @@ PerspectiveCamera.prototype = Object.assign( Object.create( Camera.prototype ),
 
 	getEffectiveFOV: function () {
 
-		return _Math.RAD2DEG * 2 * Math.atan(
-			Math.tan( _Math.DEG2RAD * 0.5 * this.fov ) / this.zoom );
+		return MathUtils.RAD2DEG * 2 * Math.atan(
+			Math.tan( MathUtils.DEG2RAD * 0.5 * this.fov ) / this.zoom );
 
 	},
 
@@ -189,7 +189,7 @@ PerspectiveCamera.prototype = Object.assign( Object.create( Camera.prototype ),
 	updateProjectionMatrix: function () {
 
 		var near = this.near,
-			top = near * Math.tan( _Math.DEG2RAD * 0.5 * this.fov ) / this.zoom,
+			top = near * Math.tan( MathUtils.DEG2RAD * 0.5 * this.fov ) / this.zoom,
 			height = 2 * top,
 			width = this.aspect * height,
 			left = - 0.5 * width,

+ 2 - 2
src/cameras/StereoCamera.js

@@ -1,5 +1,5 @@
 import { Matrix4 } from '../math/Matrix4.js';
-import { _Math } from '../math/Math.js';
+import { MathUtils } from '../math/MathUtils.js';
 import { PerspectiveCamera } from './PerspectiveCamera.js';
 
 var _eyeRight = new Matrix4();
@@ -63,7 +63,7 @@ Object.assign( StereoCamera.prototype, {
 			var projectionMatrix = camera.projectionMatrix.clone();
 			var eyeSepHalf = cache.eyeSep / 2;
 			var eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;
-			var ymax = ( cache.near * Math.tan( _Math.DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;
+			var ymax = ( cache.near * Math.tan( MathUtils.DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;
 			var xmin, xmax;
 
 			// translate xOffset

+ 2 - 2
src/core/BufferGeometry.js

@@ -7,7 +7,7 @@ import { DirectGeometry } from './DirectGeometry.js';
 import { Object3D } from './Object3D.js';
 import { Matrix4 } from '../math/Matrix4.js';
 import { Matrix3 } from '../math/Matrix3.js';
-import { _Math } from '../math/Math.js';
+import { MathUtils } from '../math/MathUtils.js';
 import { arrayMax } from '../utils.js';
 
 /**
@@ -28,7 +28,7 @@ function BufferGeometry() {
 
 	Object.defineProperty( this, 'id', { value: _bufferGeometryId += 2 } );
 
-	this.uuid = _Math.generateUUID();
+	this.uuid = MathUtils.generateUUID();
 
 	this.name = '';
 	this.type = 'BufferGeometry';

+ 2 - 2
src/core/Geometry.js

@@ -8,7 +8,7 @@ import { Matrix4 } from '../math/Matrix4.js';
 import { Vector2 } from '../math/Vector2.js';
 import { Color } from '../math/Color.js';
 import { Object3D } from './Object3D.js';
-import { _Math } from '../math/Math.js';
+import { MathUtils } from '../math/MathUtils.js';
 
 /**
  * @author mrdoob / http://mrdoob.com/
@@ -28,7 +28,7 @@ function Geometry() {
 
 	Object.defineProperty( this, 'id', { value: _geometryId += 2 } );
 
-	this.uuid = _Math.generateUUID();
+	this.uuid = MathUtils.generateUUID();
 
 	this.name = '';
 	this.type = 'Geometry';

+ 2 - 2
src/core/Object3D.js

@@ -5,7 +5,7 @@ import { EventDispatcher } from './EventDispatcher.js';
 import { Euler } from '../math/Euler.js';
 import { Layers } from './Layers.js';
 import { Matrix3 } from '../math/Matrix3.js';
-import { _Math } from '../math/Math.js';
+import { MathUtils } from '../math/MathUtils.js';
 
 var _object3DId = 0;
 
@@ -37,7 +37,7 @@ function Object3D() {
 
 	Object.defineProperty( this, 'id', { value: _object3DId ++ } );
 
-	this.uuid = _Math.generateUUID();
+	this.uuid = MathUtils.generateUUID();
 
 	this.name = '';
 	this.type = 'Object3D';

+ 3 - 3
src/extras/core/Curve.js

@@ -1,4 +1,4 @@
-import { _Math } from '../../math/Math.js';
+import { MathUtils } from '../../math/MathUtils.js';
 import { Vector3 } from '../../math/Vector3.js';
 import { Matrix4 } from '../../math/Matrix4.js';
 
@@ -339,7 +339,7 @@ Object.assign( Curve.prototype, {
 
 				vec.normalize();
 
-				theta = Math.acos( _Math.clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors
+				theta = Math.acos( MathUtils.clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors
 
 				normals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );
 
@@ -353,7 +353,7 @@ Object.assign( Curve.prototype, {
 
 		if ( closed === true ) {
 
-			theta = Math.acos( _Math.clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );
+			theta = Math.acos( MathUtils.clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );
 			theta /= segments;
 
 			if ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {

+ 2 - 2
src/extras/core/Shape.js

@@ -1,5 +1,5 @@
 import { Path } from './Path.js';
-import { _Math } from '../../math/Math.js';
+import { MathUtils } from '../../math/MathUtils.js';
 
 /**
  * @author zz85 / http://www.lab4games.net/zz85/blog
@@ -16,7 +16,7 @@ function Shape( points ) {
 
 	Path.call( this, points );
 
-	this.uuid = _Math.generateUUID();
+	this.uuid = MathUtils.generateUUID();
 
 	this.type = 'Shape';
 

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác