super-three 0.135.0 → 0.136.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/build/three.js +527 -332
  2. package/build/three.min.js +1 -1
  3. package/build/three.module.js +752 -370
  4. package/examples/fonts/tabler-icons/fonts/tabler-icons.svg +3966 -0
  5. package/examples/js/animation/CCDIKSolver.js +0 -1
  6. package/examples/js/animation/MMDPhysics.js +1 -3
  7. package/examples/js/controls/ArcballControls.js +38 -52
  8. package/examples/js/controls/TransformControls.js +24 -1
  9. package/examples/js/curves/CurveExtras.js +0 -2
  10. package/examples/js/effects/AsciiEffect.js +2 -9
  11. package/examples/js/exporters/GLTFExporter.js +1 -1
  12. package/examples/js/geometries/TeapotGeometry.js +0 -1
  13. package/examples/js/interactive/SelectionBox.js +2 -0
  14. package/examples/js/interactive/SelectionHelper.js +22 -7
  15. package/examples/js/lights/RectAreaLightUniformsLib.js +4 -0
  16. package/examples/js/loaders/AMFLoader.js +0 -2
  17. package/examples/js/loaders/ColladaLoader.js +1 -2
  18. package/examples/js/loaders/EXRLoader.js +185 -262
  19. package/examples/js/loaders/FBXLoader.js +3 -4
  20. package/examples/js/loaders/GLTFLoader.js +2 -2
  21. package/examples/js/loaders/HDRCubeTextureLoader.js +0 -8
  22. package/examples/js/loaders/KTX2Loader.js +11 -2
  23. package/examples/js/loaders/KTXLoader.js +1 -1
  24. package/examples/js/loaders/LDrawLoader.js +26 -30
  25. package/examples/js/loaders/LUT3dlLoader.js +2 -0
  26. package/examples/js/loaders/LUTCubeLoader.js +2 -0
  27. package/examples/js/loaders/MMDLoader.js +0 -1
  28. package/examples/js/loaders/NRRDLoader.js +9 -2
  29. package/examples/js/loaders/OBJLoader.js +0 -2
  30. package/examples/js/loaders/PLYLoader.js +1 -1
  31. package/examples/js/loaders/RGBELoader.js +0 -15
  32. package/examples/js/loaders/RGBMLoader.js +55 -5
  33. package/examples/js/loaders/SVGLoader.js +2 -2
  34. package/examples/js/loaders/VOXLoader.js +1 -0
  35. package/examples/js/loaders/VRMLLoader.js +2 -1
  36. package/examples/js/math/ImprovedNoise.js +1 -1
  37. package/examples/js/misc/GPUComputationRenderer.js +3 -1
  38. package/examples/js/objects/Lensflare.js +2 -10
  39. package/examples/js/objects/Reflector.js +7 -0
  40. package/examples/js/objects/Refractor.js +7 -0
  41. package/examples/js/objects/Sky.js +1 -1
  42. package/examples/js/objects/Water.js +2 -2
  43. package/examples/js/objects/Water2.js +4 -7
  44. package/examples/js/postprocessing/GlitchPass.js +3 -1
  45. package/examples/js/postprocessing/SSAOPass.js +1 -0
  46. package/examples/js/shaders/ConvolutionShader.js +0 -1
  47. package/examples/js/shaders/FXAAShader.js +1 -1
  48. package/examples/js/shaders/FilmShader.js +1 -1
  49. package/examples/js/shaders/GammaCorrectionShader.js +1 -1
  50. package/examples/js/shaders/HorizontalBlurShader.js +1 -2
  51. package/examples/js/shaders/SSRShader.js +1 -1
  52. package/examples/js/shaders/SSRrShader.js +1 -1
  53. package/examples/js/shaders/VerticalBlurShader.js +1 -2
  54. package/examples/js/utils/GeometryUtils.js +1 -1
  55. package/examples/js/utils/RoughnessMipmapper.js +18 -29
  56. package/examples/jsm/animation/CCDIKSolver.js +0 -1
  57. package/examples/jsm/animation/MMDPhysics.js +0 -2
  58. package/examples/jsm/controls/ArcballControls.js +27 -56
  59. package/examples/jsm/controls/TransformControls.js +24 -1
  60. package/examples/jsm/curves/CurveExtras.js +0 -2
  61. package/examples/jsm/effects/AsciiEffect.js +2 -9
  62. package/examples/jsm/exporters/GLTFExporter.js +1 -1
  63. package/examples/jsm/geometries/TeapotGeometry.js +0 -1
  64. package/examples/jsm/interactive/SelectionBox.js +1 -0
  65. package/examples/jsm/interactive/SelectionHelper.js +19 -7
  66. package/examples/jsm/libs/flow.module.js +256 -136
  67. package/examples/jsm/lights/RectAreaLightUniformsLib.js +7 -0
  68. package/examples/jsm/loaders/AMFLoader.js +0 -2
  69. package/examples/jsm/loaders/ColladaLoader.js +1 -2
  70. package/examples/jsm/loaders/EXRLoader.js +184 -293
  71. package/examples/jsm/loaders/FBXLoader.js +3 -4
  72. package/examples/jsm/loaders/GLTFLoader.js +2 -2
  73. package/examples/jsm/loaders/HDRCubeTextureLoader.js +1 -14
  74. package/examples/jsm/loaders/KTX2Loader.js +13 -4
  75. package/examples/jsm/loaders/KTXLoader.js +1 -1
  76. package/examples/jsm/loaders/LDrawLoader.js +23 -24
  77. package/examples/jsm/loaders/LUT3dlLoader.js +2 -0
  78. package/examples/jsm/loaders/LUTCubeLoader.js +2 -0
  79. package/examples/jsm/loaders/MMDLoader.js +0 -1
  80. package/examples/jsm/loaders/NRRDLoader.js +10 -2
  81. package/examples/jsm/loaders/OBJLoader.js +0 -2
  82. package/examples/jsm/loaders/PLYLoader.js +1 -1
  83. package/examples/jsm/loaders/RGBELoader.js +0 -20
  84. package/examples/jsm/loaders/RGBMLoader.js +61 -7
  85. package/examples/jsm/loaders/SVGLoader.js +2 -2
  86. package/examples/jsm/loaders/TDSLoader.js +30 -9
  87. package/examples/jsm/loaders/VOXLoader.js +1 -0
  88. package/examples/jsm/loaders/VRMLLoader.js +2 -1
  89. package/examples/jsm/math/ImprovedNoise.js +1 -1
  90. package/examples/jsm/misc/GPUComputationRenderer.js +3 -1
  91. package/examples/jsm/node-editor/NodeEditor.js +23 -22
  92. package/examples/jsm/node-editor/examples/rim.json +1 -1
  93. package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +48 -9
  94. package/examples/jsm/node-editor/utils/OscillatorEditor.js +1 -1
  95. package/examples/jsm/nodes/core/NodeBuilder.js +2 -2
  96. package/examples/jsm/nodes/materials/nodes/StandardNode.js +1 -0
  97. package/examples/jsm/nodes/math/MathNode.js +12 -0
  98. package/examples/jsm/nodes/misc/BumpMapNode.js +1 -1
  99. package/examples/jsm/nodes/misc/TextureCubeUVNode.js +1 -4
  100. package/examples/jsm/nodes/utils/ColorSpaceNode.js +1 -116
  101. package/examples/jsm/objects/Lensflare.js +3 -14
  102. package/examples/jsm/objects/Reflector.js +7 -0
  103. package/examples/jsm/objects/Refractor.js +7 -0
  104. package/examples/jsm/objects/Sky.js +1 -1
  105. package/examples/jsm/objects/Water.js +2 -2
  106. package/examples/jsm/objects/Water2.js +4 -8
  107. package/examples/jsm/postprocessing/GlitchPass.js +3 -1
  108. package/examples/jsm/postprocessing/SAOPass.js +1 -1
  109. package/examples/jsm/postprocessing/SSAOPass.js +1 -0
  110. package/examples/jsm/renderers/nodes/Nodes.js +1 -0
  111. package/examples/jsm/renderers/nodes/ShaderNode.js +7 -6
  112. package/examples/jsm/renderers/nodes/core/InputNode.js +1 -1
  113. package/examples/jsm/renderers/nodes/core/NodeBuilder.js +1 -1
  114. package/examples/jsm/renderers/nodes/display/ColorSpaceNode.js +26 -31
  115. package/examples/jsm/renderers/nodes/functions/BSDFs.js +2 -2
  116. package/examples/jsm/renderers/nodes/functions/PhysicalMaterialFunctions.js +27 -0
  117. package/examples/jsm/renderers/nodes/inputs/TextureNode.js +1 -1
  118. package/examples/jsm/renderers/nodes/math/MathNode.js +5 -3
  119. package/examples/jsm/renderers/nodes/math/OperatorNode.js +2 -2
  120. package/examples/jsm/renderers/nodes/utils/TimerNode.js +1 -1
  121. package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +14 -14
  122. package/examples/jsm/renderers/webgpu/WebGPUBindings.js +7 -6
  123. package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +1 -1
  124. package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +42 -61
  125. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +2 -2
  126. package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +0 -1
  127. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +30 -4
  128. package/examples/jsm/shaders/ConvolutionShader.js +0 -1
  129. package/examples/jsm/shaders/FXAAShader.js +1 -1
  130. package/examples/jsm/shaders/FilmShader.js +1 -1
  131. package/examples/jsm/shaders/GammaCorrectionShader.js +1 -1
  132. package/examples/jsm/shaders/HorizontalBlurShader.js +1 -2
  133. package/examples/jsm/shaders/SSRShader.js +1 -1
  134. package/examples/jsm/shaders/SSRrShader.js +1 -1
  135. package/examples/jsm/shaders/VerticalBlurShader.js +1 -2
  136. package/examples/jsm/utils/GeometryUtils.js +1 -1
  137. package/examples/jsm/utils/RoughnessMipmapper.js +19 -32
  138. package/examples/jsm/utils/WorkerPool.js +11 -11
  139. package/package.json +15 -9
  140. package/src/Three.Legacy.js +12 -0
  141. package/src/Three.js +1 -2
  142. package/src/constants.js +1 -7
  143. package/src/core/Object3D.js +1 -1
  144. package/src/extras/PMREMGenerator.js +19 -110
  145. package/src/extras/core/Interpolations.js +1 -1
  146. package/src/geometries/LatheGeometry.js +70 -47
  147. package/src/helpers/CameraHelper.js +1 -1
  148. package/src/loaders/FileLoader.js +23 -6
  149. package/src/math/Color.js +0 -38
  150. package/src/math/Ray.js +2 -2
  151. package/src/math/Sphere.js +10 -1
  152. package/src/objects/Skeleton.js +1 -0
  153. package/src/renderers/WebGLRenderer.js +23 -16
  154. package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +1 -1
  155. package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +2 -24
  156. package/src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js +0 -47
  157. package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +1 -1
  158. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +27 -1
  159. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +1 -1
  160. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +10 -0
  161. package/src/renderers/webgl/WebGLCapabilities.js +0 -2
  162. package/src/renderers/webgl/WebGLMorphtargets.js +1 -0
  163. package/src/renderers/webgl/WebGLProgram.js +2 -19
  164. package/src/renderers/webgl/WebGLPrograms.js +191 -35
  165. package/src/renderers/webgl/WebGLRenderLists.js +4 -14
  166. package/src/renderers/webgl/WebGLShaderCache.js +120 -0
  167. package/src/renderers/webgl/WebGLState.js +45 -0
  168. package/src/renderers/webgl/WebGLTextures.js +195 -26
  169. package/src/renderers/webxr/WebXRManager.js +10 -3
  170. package/src/scenes/Scene.js +1 -1
  171. package/src/textures/DataTexture.js +0 -2
  172. package/src/textures/DataTexture2DArray.js +0 -2
  173. package/src/textures/DataTexture3D.js +0 -2
  174. package/src/textures/FramebufferTexture.js +25 -0
  175. package/src/utils.js +1 -37
@@ -55,34 +55,23 @@
55
55
 
56
56
  }
57
57
 
58
- if ( width !== roughnessMap.image.width || height !== roughnessMap.image.height ) {
59
-
60
- const params = {
61
- wrapS: roughnessMap.wrapS,
62
- wrapT: roughnessMap.wrapT,
63
- magFilter: roughnessMap.magFilter,
64
- minFilter: roughnessMap.minFilter,
65
- depthBuffer: false
66
- };
67
- const newRoughnessTarget = new THREE.WebGLRenderTarget( width, height, params );
68
- newRoughnessTarget.texture.generateMipmaps = true; // Setting the render target causes the memory to be allocated.
69
-
70
- _renderer.setRenderTarget( newRoughnessTarget );
71
-
72
- material.roughnessMap = newRoughnessTarget.texture;
73
- if ( material.metalnessMap == roughnessMap ) material.metalnessMap = material.roughnessMap;
74
- if ( material.aoMap == roughnessMap ) material.aoMap = material.roughnessMap; // Copy UV transform parameters
75
-
76
- material.roughnessMap.offset.copy( roughnessMap.offset );
77
- material.roughnessMap.repeat.copy( roughnessMap.repeat );
78
- material.roughnessMap.center.copy( roughnessMap.center );
79
- material.roughnessMap.rotation = roughnessMap.rotation;
80
- material.roughnessMap.image = roughnessMap.image;
81
- material.roughnessMap.matrixAutoUpdate = roughnessMap.matrixAutoUpdate;
82
- material.roughnessMap.matrix.copy( roughnessMap.matrix );
83
-
84
- }
85
-
58
+ const newRoughnessTexture = new THREE.FramebufferTexture( width, height, roughnessMap.format );
59
+ newRoughnessTexture.wrapS = roughnessMap.wrapS;
60
+ newRoughnessTexture.wrapT = roughnessMap.wrapT;
61
+ newRoughnessTexture.minFilter = roughnessMap.minFilter;
62
+ newRoughnessTexture.magFilter = roughnessMap.magFilter;
63
+ material.roughnessMap = newRoughnessTexture;
64
+ if ( material.metalnessMap == roughnessMap ) material.metalnessMap = material.roughnessMap;
65
+ if ( material.aoMap == roughnessMap ) material.aoMap = material.roughnessMap; // Copy UV transform parameters
66
+
67
+ material.roughnessMap.offset.copy( roughnessMap.offset );
68
+ material.roughnessMap.repeat.copy( roughnessMap.repeat );
69
+ material.roughnessMap.center.copy( roughnessMap.center );
70
+ material.roughnessMap.rotation = roughnessMap.rotation;
71
+ material.roughnessMap.image = roughnessMap.image; // required for USDZExporter, see #22741
72
+
73
+ material.roughnessMap.matrixAutoUpdate = roughnessMap.matrixAutoUpdate;
74
+ material.roughnessMap.matrix.copy( roughnessMap.matrix );
86
75
  _mipmapMaterial.uniforms.roughnessMap.value = roughnessMap;
87
76
  _mipmapMaterial.uniforms.normalMap.value = normalMap;
88
77
  const position = new THREE.Vector2( 0, 0 );
@@ -110,7 +99,7 @@
110
99
 
111
100
  }
112
101
 
113
- if ( roughnessMap !== material.roughnessMap ) roughnessMap.dispose();
102
+ roughnessMap.dispose();
114
103
 
115
104
  _renderer.setRenderTarget( oldTarget );
116
105
 
@@ -149,7 +149,6 @@ class CCDIKSolver {
149
149
  angle = math.acos( angle );
150
150
 
151
151
  // skip if changing angle is too small to prevent vibration of bone
152
- // Refer to http://www20.atpages.jp/katwat/three.js_r58/examples/mytest37/mmd.three.js
153
152
  if ( angle < 1e-5 ) continue;
154
153
 
155
154
  if ( ik.minAngle !== undefined && angle < ik.minAngle ) {
@@ -1203,7 +1203,6 @@ class Constraint {
1203
1203
 
1204
1204
  for ( let i = 0; i < 6; i ++ ) {
1205
1205
 
1206
- // this parameter is from http://www20.atpages.jp/katwat/three.js_r58/examples/mytest37/mmd.three.js
1207
1206
  constraint.setParam( 2, 0.475, i );
1208
1207
 
1209
1208
  }
@@ -1368,7 +1367,6 @@ class MMDPhysicsHelper extends Object3D {
1368
1367
 
1369
1368
  }
1370
1369
 
1371
- // copy from http://www20.atpages.jp/katwat/three.js_r58/examples/mytest37/mytest37.js?ver=20160815
1372
1370
  function createCapsuleGeometry( radius, cylinderHeight, segmentsRadius, segmentsHeight ) {
1373
1371
 
1374
1372
  var geometry = new CylinderGeometry( radius, radius, cylinderHeight, segmentsRadius, segmentsHeight, true );
@@ -67,7 +67,9 @@ const _endEvent = { type: 'end' };
67
67
  const _raycaster = new Raycaster();
68
68
  const _offset = new Vector3();
69
69
 
70
-
70
+ const _gizmoMatrixStateTemp = new Matrix4();
71
+ const _cameraMatrixStateTemp = new Matrix4();
72
+ const _scalePointTemp = new Vector3();
71
73
  /**
72
74
  *
73
75
  * @param {Camera} camera Virtual camera used in the scene
@@ -82,7 +84,8 @@ class ArcballControls extends EventDispatcher {
82
84
  this.camera = null;
83
85
  this.domElement = domElement;
84
86
  this.scene = scene;
85
- this.target = new Vector3( 0, 0, 0 );
87
+ this.target = new Vector3();
88
+ this._currentTarget = new Vector3();
86
89
  this.radiusFactor = 0.67;
87
90
 
88
91
  this.mouseActions = [];
@@ -232,7 +235,6 @@ class ArcballControls extends EventDispatcher {
232
235
  this.domElement.addEventListener( 'pointerdown', this.onPointerDown );
233
236
  this.domElement.addEventListener( 'pointercancel', this.onPointerCancel );
234
237
 
235
- window.addEventListener( 'keydown', this.onKeyDown );
236
238
  window.addEventListener( 'resize', this.onWindowResize );
237
239
 
238
240
  }
@@ -774,28 +776,6 @@ class ArcballControls extends EventDispatcher {
774
776
 
775
777
  };
776
778
 
777
- onKeyDown = ( event ) => {
778
-
779
- if ( event.key == 'c' ) {
780
-
781
- if ( event.ctrlKey || event.metaKey ) {
782
-
783
- this.copyState();
784
-
785
- }
786
-
787
- } else if ( event.key == 'v' ) {
788
-
789
- if ( event.ctrlKey || event.metaKey ) {
790
-
791
- this.pasteState();
792
-
793
- }
794
-
795
- }
796
-
797
- };
798
-
799
779
  onSinglePanStart = ( event, operation ) => {
800
780
 
801
781
  if ( this.enabled ) {
@@ -2006,11 +1986,11 @@ class ArcballControls extends EventDispatcher {
2006
1986
  _offset.copy( point ).sub( this._gizmos.position ).multiplyScalar( amount );
2007
1987
  this._translationMatrix.makeTranslation( _offset.x, _offset.y, _offset.z );
2008
1988
 
2009
- const gizmoStateTemp = this._gizmoMatrixState.clone();
1989
+ _gizmoMatrixStateTemp.copy( this._gizmoMatrixState );
2010
1990
  this._gizmoMatrixState.premultiply( this._translationMatrix );
2011
1991
  this._gizmoMatrixState.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale );
2012
1992
 
2013
- const cameraStateTemp = this._cameraMatrixState.clone();
1993
+ _cameraMatrixStateTemp.copy( this._cameraMatrixState );
2014
1994
  this._cameraMatrixState.premultiply( this._translationMatrix );
2015
1995
  this._cameraMatrixState.decompose( this.camera.position, this.camera.quaternion, this.camera.scale );
2016
1996
 
@@ -2021,8 +2001,8 @@ class ArcballControls extends EventDispatcher {
2021
2001
 
2022
2002
  }
2023
2003
 
2024
- this._gizmoMatrixState.copy( gizmoStateTemp );
2025
- this._cameraMatrixState.copy( cameraStateTemp );
2004
+ this._gizmoMatrixState.copy( _gizmoMatrixStateTemp );
2005
+ this._cameraMatrixState.copy( _cameraMatrixStateTemp );
2026
2006
 
2027
2007
  };
2028
2008
 
@@ -2098,7 +2078,6 @@ class ArcballControls extends EventDispatcher {
2098
2078
  window.removeEventListener( 'pointerup', this.onPointerUp );
2099
2079
 
2100
2080
  window.removeEventListener( 'resize', this.onWindowResize );
2101
- window.removeEventListener( 'keydown', this.onKeyDown );
2102
2081
 
2103
2082
  if ( this.scene !== null ) this.scene.remove( this._gizmos );
2104
2083
  this.disposeGrid();
@@ -2623,7 +2602,7 @@ class ArcballControls extends EventDispatcher {
2623
2602
  */
2624
2603
  scale = ( size, point, scaleGizmos = true ) => {
2625
2604
 
2626
- const scalePoint = point.clone();
2605
+ _scalePointTemp.copy( point );
2627
2606
  let sizeInverse = 1 / size;
2628
2607
 
2629
2608
  if ( this.camera.isOrthographicCamera ) {
@@ -2658,12 +2637,12 @@ class ArcballControls extends EventDispatcher {
2658
2637
 
2659
2638
 
2660
2639
  //move camera and gizmos to obtain pinch effect
2661
- scalePoint.sub( this._v3_1 );
2640
+ _scalePointTemp.sub( this._v3_1 );
2662
2641
 
2663
- const amount = scalePoint.clone().multiplyScalar( sizeInverse );
2664
- scalePoint.sub( amount );
2642
+ const amount = _scalePointTemp.clone().multiplyScalar( sizeInverse );
2643
+ _scalePointTemp.sub( amount );
2665
2644
 
2666
- this._m4_1.makeTranslation( scalePoint.x, scalePoint.y, scalePoint.z );
2645
+ this._m4_1.makeTranslation( _scalePointTemp.x, _scalePointTemp.y, _scalePointTemp.z );
2667
2646
  this._m4_2.premultiply( this._m4_1 );
2668
2647
 
2669
2648
  this.setTransformationMatrices( this._m4_1, this._m4_2 );
@@ -2675,7 +2654,7 @@ class ArcballControls extends EventDispatcher {
2675
2654
  this._v3_2.setFromMatrixPosition( this._gizmoMatrixState );
2676
2655
 
2677
2656
  //move camera
2678
- let distance = this._v3_1.distanceTo( scalePoint );
2657
+ let distance = this._v3_1.distanceTo( _scalePointTemp );
2679
2658
  let amount = distance - ( distance * sizeInverse );
2680
2659
 
2681
2660
  //check min and max distance
@@ -2692,7 +2671,7 @@ class ArcballControls extends EventDispatcher {
2692
2671
 
2693
2672
  }
2694
2673
 
2695
- _offset.copy( scalePoint ).sub( this._v3_1 ).normalize().multiplyScalar( amount );
2674
+ _offset.copy( _scalePointTemp ).sub( this._v3_1 ).normalize().multiplyScalar( amount );
2696
2675
 
2697
2676
  this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z );
2698
2677
 
@@ -2702,9 +2681,9 @@ class ArcballControls extends EventDispatcher {
2702
2681
  //scale gizmos so they appear in the same spot having the same dimension
2703
2682
  const pos = this._v3_2;
2704
2683
 
2705
- distance = pos.distanceTo( scalePoint );
2684
+ distance = pos.distanceTo( _scalePointTemp );
2706
2685
  amount = distance - ( distance * sizeInverse );
2707
- _offset.copy( scalePoint ).sub( this._v3_2 ).normalize().multiplyScalar( amount );
2686
+ _offset.copy( _scalePointTemp ).sub( this._v3_2 ).normalize().multiplyScalar( amount );
2708
2687
 
2709
2688
  this._translationMatrix.makeTranslation( pos.x, pos.y, pos.z );
2710
2689
  this._scaleMatrix.makeScale( sizeInverse, sizeInverse, sizeInverse );
@@ -2745,23 +2724,6 @@ class ArcballControls extends EventDispatcher {
2745
2724
 
2746
2725
  };
2747
2726
 
2748
- /**
2749
- * Set the trackball's center point
2750
- * @param {Number} x X coordinate
2751
- * @param {Number} y Y coordinate
2752
- * @param {Number} z Z coordinate
2753
- */
2754
- setTarget = ( x, y, z ) => {
2755
-
2756
- this.target.set( x, y, z );
2757
- this._gizmos.position.set( x, y, z ); //for correct radius calculation
2758
- this._tbRadius = this.calculateTbRadius( this.camera );
2759
-
2760
- this.makeGizmos( this.target, this._tbRadius );
2761
- this.camera.lookAt( this.target );
2762
-
2763
- };
2764
-
2765
2727
  /**
2766
2728
  * Set values in transformation object
2767
2729
  * @param {Matrix4} camera Transformation to be applied to the camera
@@ -3123,6 +3085,15 @@ class ArcballControls extends EventDispatcher {
3123
3085
 
3124
3086
  const EPS = 0.000001;
3125
3087
 
3088
+ if ( this.target.equals( this._currentTarget ) === false ) {
3089
+
3090
+ this._gizmos.position.copy( this.target ); //for correct radius calculation
3091
+ this._tbRadius = this.calculateTbRadius( this.camera );
3092
+ this.makeGizmos( this.target, this._tbRadius );
3093
+ this._currentTarget.copy( this.target );
3094
+
3095
+ }
3096
+
3126
3097
  //check min/max parameters
3127
3098
  if ( this.camera.isOrthographicCamera ) {
3128
3099
 
@@ -564,6 +564,25 @@ class TransformControls extends Object3D {
564
564
 
565
565
  }
566
566
 
567
+ reset() {
568
+
569
+ if ( ! this.enabled ) return;
570
+
571
+ if ( this.dragging ) {
572
+
573
+ this.object.position.copy( this._positionStart );
574
+ this.object.quaternion.copy( this._quaternionStart );
575
+ this.object.scale.copy( this._scaleStart );
576
+
577
+ this.dispatchEvent( _changeEvent );
578
+ this.dispatchEvent( _objectChangeEvent );
579
+
580
+ this.pointStart.copy( this.pointEnd );
581
+
582
+ }
583
+
584
+ }
585
+
567
586
  getRaycaster() {
568
587
 
569
588
  return _raycaster;
@@ -669,7 +688,11 @@ function onPointerDown( event ) {
669
688
 
670
689
  if ( ! this.enabled ) return;
671
690
 
672
- this.domElement.setPointerCapture( event.pointerId );
691
+ if ( ! document.pointerLockElement ) {
692
+
693
+ this.domElement.setPointerCapture( event.pointerId );
694
+
695
+ }
673
696
 
674
697
  this.domElement.addEventListener( 'pointermove', this._onPointerMove );
675
698
 
@@ -8,9 +8,7 @@ import {
8
8
  *
9
9
  * Formulas collected from various sources
10
10
  * http://mathworld.wolfram.com/HeartCurve.html
11
- * http://mathdl.maa.org/images/upload_library/23/stemkoski/knots/page6.html
12
11
  * http://en.wikipedia.org/wiki/Viviani%27s_curve
13
- * http://mathdl.maa.org/images/upload_library/23/stemkoski/knots/page4.html
14
12
  * http://www.mi.sanu.ac.rs/vismath/taylorapril2011/Taylor.pdf
15
13
  * https://prideout.net/blog/old/blog/index.html@p=44.html
16
14
  */
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Ascii generation is based on http://www.nihilogic.dk/labs/jsascii/
3
- * Maybe more about this later with a blog post at http://lab4games.net/zz85/blog
2
+ * Ascii generation is based on https://github.com/hassadee/jsascii/blob/master/jsascii.js
4
3
  *
5
4
  * 16 April 2012 - @blurspline
6
5
  */
@@ -57,13 +56,7 @@ class AsciiEffect {
57
56
  this.domElement = domElement;
58
57
 
59
58
 
60
- // Throw in ascii library from http://www.nihilogic.dk/labs/jsascii/jsascii.js
61
-
62
- /*
63
- * jsAscii 0.1
64
- * Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
65
- * MIT License [http://www.nihilogic.dk/licenses/mit-license.txt]
66
- */
59
+ // Throw in ascii library from https://github.com/hassadee/jsascii/blob/master/jsascii.js (MIT License)
67
60
 
68
61
  function initAsciiSize() {
69
62
 
@@ -2199,7 +2199,7 @@ class GLTFMaterialsUnlitExtension {
2199
2199
  /**
2200
2200
  * Specular-Glossiness Extension
2201
2201
  *
2202
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness
2202
+ * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness
2203
2203
  */
2204
2204
  class GLTFMaterialsPBRSpecularGlossiness {
2205
2205
 
@@ -48,7 +48,6 @@ import {
48
48
  *
49
49
  * Code converted from my ancient SPD software, http://tog.acm.org/resources/SPD/
50
50
  * Created for the Udacity course "Interactive Rendering", http://bit.ly/ericity
51
- * Lesson: https://www.udacity.com/course/viewer#!/c-cs291/l-68866048/m-106482448
52
51
  * YouTube video on teapot history: https://www.youtube.com/watch?v=DxMfblPzFNc
53
52
  *
54
53
  * See https://en.wikipedia.org/wiki/Utah_teapot for the history of the teapot
@@ -182,6 +182,7 @@ class SelectionBox {
182
182
 
183
183
  object.getMatrixAt( instanceId, _matrix );
184
184
  _matrix.decompose( _center, _quaternion, _scale );
185
+ _center.applyMatrix4( object.matrixWorld );
185
186
 
186
187
  if ( frustum.containsPoint( _center ) ) {
187
188
 
@@ -18,14 +18,14 @@ class SelectionHelper {
18
18
 
19
19
  this.isDown = false;
20
20
 
21
- this.renderer.domElement.addEventListener( 'pointerdown', function ( event ) {
21
+ this.onPointerDown = function ( event ) {
22
22
 
23
23
  this.isDown = true;
24
24
  this.onSelectStart( event );
25
25
 
26
- }.bind( this ) );
26
+ }.bind( this );
27
27
 
28
- this.renderer.domElement.addEventListener( 'pointermove', function ( event ) {
28
+ this.onPointerMove = function ( event ) {
29
29
 
30
30
  if ( this.isDown ) {
31
31
 
@@ -33,14 +33,26 @@ class SelectionHelper {
33
33
 
34
34
  }
35
35
 
36
- }.bind( this ) );
36
+ }.bind( this );
37
37
 
38
- this.renderer.domElement.addEventListener( 'pointerup', function ( event ) {
38
+ this.onPointerUp = function ( ) {
39
39
 
40
40
  this.isDown = false;
41
- this.onSelectOver( event );
41
+ this.onSelectOver();
42
42
 
43
- }.bind( this ) );
43
+ }.bind( this );
44
+
45
+ this.renderer.domElement.addEventListener( 'pointerdown', this.onPointerDown );
46
+ this.renderer.domElement.addEventListener( 'pointermove', this.onPointerMove );
47
+ this.renderer.domElement.addEventListener( 'pointerup', this.onPointerUp );
48
+
49
+ }
50
+
51
+ dispose() {
52
+
53
+ this.renderer.domElement.removeEventListener( 'pointerdown', this.onPointerDown );
54
+ this.renderer.domElement.removeEventListener( 'pointermove', this.onPointerMove );
55
+ this.renderer.domElement.removeEventListener( 'pointerup', this.onPointerUp );
44
56
 
45
57
  }
46
58