super-three 0.169.1 → 0.170.1

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 (255) hide show
  1. package/build/three.cjs +24628 -24228
  2. package/build/three.core.js +37002 -0
  3. package/build/three.core.min.js +6 -0
  4. package/build/three.module.js +10519 -47108
  5. package/build/three.module.min.js +1 -1
  6. package/build/three.tsl.js +533 -0
  7. package/build/three.tsl.min.js +6 -0
  8. package/build/three.webgpu.js +17071 -53583
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +17134 -53623
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/jsm/Addons.js +3 -3
  13. package/examples/jsm/animation/MMDAnimationHelper.js +2 -0
  14. package/examples/jsm/animation/MMDPhysics.js +2 -0
  15. package/examples/jsm/capabilities/WebGPU.js +1 -10
  16. package/examples/jsm/controls/ArcballControls.js +25 -21
  17. package/examples/jsm/controls/OrbitControls.js +41 -9
  18. package/examples/jsm/controls/PointerLockControls.js +2 -5
  19. package/examples/jsm/controls/TransformControls.js +22 -6
  20. package/examples/jsm/csm/CSM.js +2 -2
  21. package/examples/jsm/csm/CSMFrustum.js +7 -4
  22. package/examples/jsm/csm/CSMHelper.js +2 -0
  23. package/examples/jsm/csm/CSMShadowNode.js +437 -0
  24. package/examples/jsm/curves/NURBSCurve.js +34 -3
  25. package/examples/jsm/exporters/GLTFExporter.js +138 -71
  26. package/examples/jsm/exporters/KTX2Exporter.js +35 -12
  27. package/examples/jsm/exporters/MMDExporter.js +6 -0
  28. package/examples/jsm/exporters/USDZExporter.js +21 -3
  29. package/examples/jsm/geometries/DecalGeometry.js +70 -21
  30. package/examples/jsm/geometries/InstancedPointsGeometry.js +2 -0
  31. package/examples/jsm/helpers/TextureHelperGPU.js +175 -0
  32. package/examples/jsm/interactive/HTMLMesh.js +1 -0
  33. package/examples/jsm/lighting/TiledLighting.js +18 -0
  34. package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -1
  35. package/examples/jsm/lines/LineGeometry.js +25 -0
  36. package/examples/jsm/lines/LineMaterial.js +0 -1
  37. package/examples/jsm/lines/LineSegmentsGeometry.js +2 -0
  38. package/examples/jsm/lines/webgpu/Line2.js +2 -1
  39. package/examples/jsm/lines/webgpu/LineSegments2.js +2 -16
  40. package/examples/jsm/lines/webgpu/Wireframe.js +57 -0
  41. package/examples/jsm/loaders/3DMLoader.js +1 -0
  42. package/examples/jsm/loaders/3MFLoader.js +91 -0
  43. package/examples/jsm/loaders/FBXLoader.js +12 -2
  44. package/examples/jsm/loaders/GLTFLoader.js +2 -0
  45. package/examples/jsm/loaders/KTX2Loader.js +143 -49
  46. package/examples/jsm/loaders/LDrawLoader.js +22 -136
  47. package/examples/jsm/loaders/LottieLoader.js +1 -0
  48. package/examples/jsm/loaders/MMDLoader.js +3 -0
  49. package/examples/jsm/loaders/MaterialXLoader.js +2 -2
  50. package/examples/jsm/materials/LDrawConditionalLineMaterial.js +143 -0
  51. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +114 -0
  52. package/examples/jsm/math/ColorSpaces.js +76 -0
  53. package/examples/jsm/misc/ProgressiveLightMap.js +52 -40
  54. package/examples/jsm/misc/ProgressiveLightMapGPU.js +293 -0
  55. package/examples/jsm/misc/VolumeSlice.js +1 -0
  56. package/examples/jsm/objects/InstancedPoints.js +2 -4
  57. package/examples/jsm/objects/LensflareMesh.js +4 -2
  58. package/examples/jsm/objects/SkyMesh.js +5 -3
  59. package/examples/jsm/objects/Water2Mesh.js +7 -3
  60. package/examples/jsm/objects/WaterMesh.js +12 -10
  61. package/examples/jsm/postprocessing/AfterimagePass.js +14 -3
  62. package/examples/jsm/postprocessing/SSRPass.js +6 -0
  63. package/examples/jsm/renderers/CSS2DRenderer.js +6 -3
  64. package/examples/jsm/renderers/CSS3DRenderer.js +7 -4
  65. package/examples/jsm/shaders/FXAAShader.js +225 -224
  66. package/examples/jsm/transpiler/AST.js +2 -2
  67. package/examples/jsm/transpiler/GLSLDecoder.js +57 -25
  68. package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
  69. package/examples/jsm/transpiler/TSLEncoder.js +11 -6
  70. package/{src/nodes → examples/jsm/tsl}/display/AfterImageNode.js +18 -21
  71. package/{src/nodes → examples/jsm/tsl}/display/AnaglyphPassNode.js +2 -6
  72. package/{src/nodes → examples/jsm/tsl}/display/AnamorphicNode.js +12 -18
  73. package/{src/nodes → examples/jsm/tsl}/display/BleachBypass.js +1 -3
  74. package/{src/nodes → examples/jsm/tsl}/display/BloomNode.js +12 -41
  75. package/{src/nodes → examples/jsm/tsl}/display/DenoiseNode.js +60 -47
  76. package/{src/nodes → examples/jsm/tsl}/display/DepthOfFieldNode.js +4 -9
  77. package/{src/nodes → examples/jsm/tsl}/display/DotScreenNode.js +2 -9
  78. package/examples/jsm/tsl/display/FXAANode.js +316 -0
  79. package/{src/nodes → examples/jsm/tsl}/display/FilmNode.js +4 -7
  80. package/{src/nodes → examples/jsm/tsl}/display/GTAONode.js +73 -78
  81. package/{src/nodes → examples/jsm/tsl}/display/GaussianBlurNode.js +78 -42
  82. package/examples/jsm/tsl/display/LensflareNode.js +161 -0
  83. package/{src/nodes → examples/jsm/tsl}/display/Lut3DNode.js +3 -5
  84. package/{src/nodes → examples/jsm/tsl}/display/MotionBlur.js +2 -3
  85. package/examples/jsm/tsl/display/OutlineNode.js +434 -0
  86. package/{src/nodes → examples/jsm/tsl}/display/ParallaxBarrierPassNode.js +2 -5
  87. package/{src/nodes → examples/jsm/tsl}/display/PixelationPassNode.js +5 -17
  88. package/{src/nodes → examples/jsm/tsl}/display/RGBShiftNode.js +2 -6
  89. package/examples/jsm/tsl/display/SMAANode.js +620 -0
  90. package/{src/nodes → examples/jsm/tsl}/display/SSAAPassNode.js +10 -25
  91. package/examples/jsm/tsl/display/SSRNode.js +366 -0
  92. package/{src/nodes → examples/jsm/tsl}/display/Sepia.js +1 -2
  93. package/{src/nodes → examples/jsm/tsl}/display/SobelOperatorNode.js +4 -12
  94. package/{src/nodes → examples/jsm/tsl}/display/StereoCompositePassNode.js +9 -11
  95. package/{src/nodes → examples/jsm/tsl}/display/StereoPassNode.js +10 -11
  96. package/examples/jsm/tsl/display/TRAAPassNode.js +355 -0
  97. package/{src/nodes → examples/jsm/tsl}/display/TransitionNode.js +3 -7
  98. package/examples/jsm/tsl/display/hashBlur.js +24 -0
  99. package/examples/jsm/tsl/lighting/TiledLightsNode.js +389 -0
  100. package/examples/jsm/utils/SceneOptimizer.js +410 -0
  101. package/examples/jsm/utils/UVsDebug.js +1 -1
  102. package/examples/jsm/utils/{TextureUtilsGPU.js → WebGPUTextureUtils.js} +2 -1
  103. package/examples/jsm/webxr/OculusHandPointerModel.js +21 -21
  104. package/examples/jsm/webxr/Text2D.js +6 -6
  105. package/package.json +4 -4
  106. package/src/Three.Core.js +178 -0
  107. package/src/Three.TSL.js +526 -0
  108. package/src/Three.WebGPU.Nodes.js +9 -186
  109. package/src/Three.WebGPU.js +8 -186
  110. package/src/Three.js +1 -177
  111. package/src/animation/AnimationClip.js +2 -2
  112. package/src/animation/AnimationObjectGroup.js +2 -2
  113. package/src/audio/Audio.js +38 -0
  114. package/src/cameras/PerspectiveCamera.js +6 -6
  115. package/src/cameras/StereoCamera.js +2 -2
  116. package/src/constants.js +1 -6
  117. package/src/core/BufferGeometry.js +48 -8
  118. package/src/core/InterleavedBuffer.js +4 -4
  119. package/src/core/Object3D.js +2 -2
  120. package/src/extras/core/Curve.js +3 -3
  121. package/src/extras/core/Shape.js +2 -2
  122. package/src/geometries/CylinderGeometry.js +2 -2
  123. package/src/geometries/EdgesGeometry.js +2 -2
  124. package/src/geometries/LatheGeometry.js +2 -2
  125. package/src/lights/SpotLightShadow.js +2 -2
  126. package/src/materials/LineDashedMaterial.js +0 -1
  127. package/src/materials/Material.js +2 -2
  128. package/src/materials/MeshPhongMaterial.js +1 -1
  129. package/src/materials/MeshPhysicalMaterial.js +2 -2
  130. package/src/materials/MeshStandardMaterial.js +2 -2
  131. package/src/materials/nodes/Line2NodeMaterial.js +32 -13
  132. package/src/materials/nodes/LineDashedNodeMaterial.js +4 -2
  133. package/src/materials/nodes/NodeMaterial.js +93 -23
  134. package/src/materials/nodes/SpriteNodeMaterial.js +11 -2
  135. package/src/materials/nodes/manager/NodeMaterialObserver.js +119 -7
  136. package/src/math/ColorManagement.js +143 -102
  137. package/src/math/Line3.js +2 -2
  138. package/src/math/Quaternion.js +2 -2
  139. package/src/math/Spherical.js +3 -3
  140. package/src/math/Vector2.js +7 -7
  141. package/src/math/Vector3.js +9 -9
  142. package/src/math/Vector4.js +22 -9
  143. package/src/nodes/Nodes.js +2 -21
  144. package/src/nodes/TSL.js +9 -25
  145. package/src/nodes/accessors/Arrays.js +27 -0
  146. package/src/nodes/accessors/BuiltinNode.js +26 -0
  147. package/src/nodes/accessors/Camera.js +0 -1
  148. package/src/nodes/accessors/ClippingNode.js +76 -42
  149. package/src/nodes/accessors/InstanceNode.js +17 -20
  150. package/src/nodes/accessors/InstancedMeshNode.js +26 -0
  151. package/src/nodes/accessors/Lights.js +32 -0
  152. package/src/nodes/accessors/SceneNode.js +35 -1
  153. package/src/nodes/accessors/StorageBufferNode.js +61 -19
  154. package/src/nodes/accessors/StorageTextureNode.js +10 -4
  155. package/src/nodes/accessors/TextureNode.js +1 -1
  156. package/src/nodes/accessors/VelocityNode.js +13 -3
  157. package/src/nodes/code/FunctionCallNode.js +16 -5
  158. package/src/nodes/code/ScriptableNode.js +4 -4
  159. package/src/nodes/core/Node.js +1 -0
  160. package/src/nodes/core/NodeBuilder.js +31 -14
  161. package/src/nodes/core/NodeUtils.js +28 -0
  162. package/src/nodes/core/VarNode.js +15 -3
  163. package/src/nodes/core/constants.js +6 -0
  164. package/src/nodes/display/BlendModes.js +99 -0
  165. package/src/nodes/display/ColorAdjustment.js +53 -4
  166. package/src/nodes/display/ColorSpaceFunctions.js +5 -5
  167. package/src/nodes/display/ColorSpaceNode.js +27 -39
  168. package/src/nodes/display/PassNode.js +6 -4
  169. package/src/nodes/display/ToneMappingNode.js +1 -1
  170. package/src/nodes/display/ToonOutlinePassNode.js +3 -3
  171. package/src/nodes/display/ViewportDepthNode.js +48 -1
  172. package/src/nodes/functions/PhysicalLightingModel.js +21 -15
  173. package/src/nodes/functions/material/getAlphaHashThreshold.js +70 -0
  174. package/src/nodes/functions/material/getGeometryRoughness.js +8 -2
  175. package/src/nodes/functions/material/getParallaxCorrectNormal.js +22 -0
  176. package/src/nodes/gpgpu/ComputeNode.js +9 -1
  177. package/src/nodes/lighting/AnalyticLightNode.js +23 -419
  178. package/src/nodes/lighting/LightsNode.js +24 -12
  179. package/src/nodes/lighting/PointLightNode.js +41 -22
  180. package/src/nodes/lighting/PointShadowNode.js +254 -0
  181. package/src/nodes/lighting/RectAreaLightNode.js +3 -0
  182. package/src/nodes/lighting/ShadowNode.js +593 -0
  183. package/src/nodes/lighting/SpotLightNode.js +14 -2
  184. package/src/nodes/utils/LoopNode.js +2 -2
  185. package/src/nodes/utils/Oscillators.js +6 -0
  186. package/src/nodes/utils/PostProcessingUtils.js +89 -0
  187. package/src/nodes/utils/RTTNode.js +9 -1
  188. package/src/nodes/utils/ReflectorNode.js +101 -15
  189. package/src/nodes/utils/StorageArrayElementNode.js +2 -2
  190. package/src/nodes/utils/Timer.js +29 -0
  191. package/src/objects/BatchedMesh.js +472 -296
  192. package/src/objects/ClippingGroup.js +19 -0
  193. package/src/objects/Skeleton.js +2 -2
  194. package/src/renderers/WebGLRenderer.js +183 -109
  195. package/src/renderers/common/Animation.js +23 -11
  196. package/src/renderers/common/Attributes.js +4 -0
  197. package/src/renderers/common/Backend.js +2 -0
  198. package/src/renderers/common/Background.js +15 -5
  199. package/src/renderers/common/Bindings.js +23 -6
  200. package/src/renderers/common/ClippingContext.js +77 -85
  201. package/src/renderers/common/Constants.js +2 -1
  202. package/src/renderers/common/Geometries.js +20 -0
  203. package/src/renderers/common/IndirectStorageBufferAttribute.js +15 -0
  204. package/src/renderers/common/Lighting.js +45 -0
  205. package/src/renderers/common/PostProcessingUtils.js +86 -0
  206. package/src/renderers/common/RenderList.js +48 -17
  207. package/src/renderers/common/RenderLists.js +4 -2
  208. package/src/renderers/common/RenderObject.js +45 -28
  209. package/src/renderers/common/RenderObjects.js +12 -6
  210. package/src/renderers/common/Renderer.js +222 -77
  211. package/src/renderers/common/Textures.js +41 -17
  212. package/src/renderers/common/UniformsGroup.js +16 -4
  213. package/src/renderers/common/extras/PMREMGenerator.js +89 -13
  214. package/src/renderers/common/nodes/NodeLibrary.js +2 -15
  215. package/src/renderers/common/nodes/NodeStorageBuffer.js +2 -3
  216. package/src/renderers/common/nodes/NodeUniform.js +42 -0
  217. package/src/renderers/common/nodes/Nodes.js +2 -2
  218. package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +4 -24
  219. package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +8 -0
  220. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +2 -2
  221. package/src/renderers/webgl/WebGLBackground.js +20 -1
  222. package/src/renderers/webgl/WebGLBufferRenderer.js +2 -6
  223. package/src/renderers/webgl/WebGLCapabilities.js +0 -7
  224. package/src/renderers/webgl/WebGLGeometries.js +0 -28
  225. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +2 -6
  226. package/src/renderers/webgl/WebGLProgram.js +24 -28
  227. package/src/renderers/webgl/WebGLPrograms.js +5 -2
  228. package/src/renderers/webgl/WebGLState.js +37 -1
  229. package/src/renderers/webgl/WebGLTextures.js +29 -12
  230. package/src/renderers/webgl-fallback/WebGLBackend.js +111 -37
  231. package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +2 -7
  232. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +43 -12
  233. package/src/renderers/webgl-fallback/utils/WebGLState.js +26 -1
  234. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +37 -9
  235. package/src/renderers/webgpu/WebGPUBackend.js +152 -56
  236. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +1 -1
  237. package/src/renderers/webgpu/WebGPURenderer.js +1 -1
  238. package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +0 -8
  239. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +13 -34
  240. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +192 -92
  241. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +12 -4
  242. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -2
  243. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -7
  244. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +29 -9
  245. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +29 -7
  246. package/src/renderers/webgpu/utils/WebGPUUtils.js +0 -1
  247. package/src/renderers/webxr/WebXRManager.js +4 -4
  248. package/src/textures/Source.js +2 -2
  249. package/src/textures/Texture.js +2 -2
  250. package/examples/jsm/cameras/CinematicCamera.js +0 -208
  251. package/src/nodes/display/BlendMode.js +0 -54
  252. package/src/nodes/display/FXAANode.js +0 -332
  253. package/src/nodes/utils/OscNode.js +0 -85
  254. package/src/nodes/utils/TimerNode.js +0 -97
  255. /package/examples/jsm/utils/{TextureUtils.js → WebGLTextureUtils.js} +0 -0
@@ -328,6 +328,7 @@ class Audio extends Object3D {
328
328
  onEnded() {
329
329
 
330
330
  this.isPlaying = false;
331
+ this._progress = 0;
331
332
 
332
333
  }
333
334
 
@@ -395,6 +396,43 @@ class Audio extends Object3D {
395
396
 
396
397
  }
397
398
 
399
+ copy( source, recursive ) {
400
+
401
+ super.copy( source, recursive );
402
+
403
+ if ( source.sourceType !== 'buffer' ) {
404
+
405
+ console.warn( 'THREE.Audio: Audio source type cannot be copied.' );
406
+
407
+ return this;
408
+
409
+ }
410
+
411
+ this.autoplay = source.autoplay;
412
+
413
+ this.buffer = source.buffer;
414
+ this.detune = source.detune;
415
+ this.loop = source.loop;
416
+ this.loopStart = source.loopStart;
417
+ this.loopEnd = source.loopEnd;
418
+ this.offset = source.offset;
419
+ this.duration = source.duration;
420
+ this.playbackRate = source.playbackRate;
421
+ this.hasPlaybackControl = source.hasPlaybackControl;
422
+ this.sourceType = source.sourceType;
423
+
424
+ this.filters = source.filters.slice();
425
+
426
+ return this;
427
+
428
+ }
429
+
430
+ clone( recursive ) {
431
+
432
+ return new this.constructor( this.listener ).copy( this, recursive );
433
+
434
+ }
435
+
398
436
  }
399
437
 
400
438
  export { Audio };
@@ -1,5 +1,5 @@
1
1
  import { Camera } from './Camera.js';
2
- import * as MathUtils from '../math/MathUtils.js';
2
+ import { RAD2DEG, DEG2RAD } from '../math/MathUtils.js';
3
3
  import { Vector2 } from '../math/Vector2.js';
4
4
  import { Vector3 } from '../math/Vector3.js';
5
5
 
@@ -69,7 +69,7 @@ class PerspectiveCamera extends Camera {
69
69
  /** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */
70
70
  const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;
71
71
 
72
- this.fov = MathUtils.RAD2DEG * 2 * Math.atan( vExtentSlope );
72
+ this.fov = RAD2DEG * 2 * Math.atan( vExtentSlope );
73
73
  this.updateProjectionMatrix();
74
74
 
75
75
  }
@@ -79,7 +79,7 @@ class PerspectiveCamera extends Camera {
79
79
  */
80
80
  getFocalLength() {
81
81
 
82
- const vExtentSlope = Math.tan( MathUtils.DEG2RAD * 0.5 * this.fov );
82
+ const vExtentSlope = Math.tan( DEG2RAD * 0.5 * this.fov );
83
83
 
84
84
  return 0.5 * this.getFilmHeight() / vExtentSlope;
85
85
 
@@ -87,8 +87,8 @@ class PerspectiveCamera extends Camera {
87
87
 
88
88
  getEffectiveFOV() {
89
89
 
90
- return MathUtils.RAD2DEG * 2 * Math.atan(
91
- Math.tan( MathUtils.DEG2RAD * 0.5 * this.fov ) / this.zoom );
90
+ return RAD2DEG * 2 * Math.atan(
91
+ Math.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom );
92
92
 
93
93
  }
94
94
 
@@ -214,7 +214,7 @@ class PerspectiveCamera extends Camera {
214
214
  updateProjectionMatrix() {
215
215
 
216
216
  const near = this.near;
217
- let top = near * Math.tan( MathUtils.DEG2RAD * 0.5 * this.fov ) / this.zoom;
217
+ let top = near * Math.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom;
218
218
  let height = 2 * top;
219
219
  let width = this.aspect * height;
220
220
  let left = - 0.5 * width;
@@ -1,5 +1,5 @@
1
1
  import { Matrix4 } from '../math/Matrix4.js';
2
- import * as MathUtils from '../math/MathUtils.js';
2
+ import { DEG2RAD } from '../math/MathUtils.js';
3
3
  import { PerspectiveCamera } from './PerspectiveCamera.js';
4
4
 
5
5
  const _eyeRight = /*@__PURE__*/ new Matrix4();
@@ -60,7 +60,7 @@ class StereoCamera {
60
60
  _projectionMatrix.copy( camera.projectionMatrix );
61
61
  const eyeSepHalf = cache.eyeSep / 2;
62
62
  const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;
63
- const ymax = ( cache.near * Math.tan( MathUtils.DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;
63
+ const ymax = ( cache.near * Math.tan( DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;
64
64
  let xmin, xmax;
65
65
 
66
66
  // translate xOffset
package/src/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- export const REVISION = '169';
1
+ export const REVISION = '171';
2
2
 
3
3
  export const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
4
4
  export const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -163,15 +163,10 @@ export const ObjectSpaceNormalMap = 1;
163
163
  export const NoColorSpace = '';
164
164
  export const SRGBColorSpace = 'srgb';
165
165
  export const LinearSRGBColorSpace = 'srgb-linear';
166
- export const DisplayP3ColorSpace = 'display-p3';
167
- export const LinearDisplayP3ColorSpace = 'display-p3-linear';
168
166
 
169
167
  export const LinearTransfer = 'linear';
170
168
  export const SRGBTransfer = 'srgb';
171
169
 
172
- export const Rec709Primaries = 'rec709';
173
- export const P3Primaries = 'p3';
174
-
175
170
  export const ZeroStencilOp = 0;
176
171
  export const KeepStencilOp = 7680;
177
172
  export const ReplaceStencilOp = 7681;
@@ -7,7 +7,7 @@ import { Sphere } from '../math/Sphere.js';
7
7
  import { Object3D } from './Object3D.js';
8
8
  import { Matrix4 } from '../math/Matrix4.js';
9
9
  import { Matrix3 } from '../math/Matrix3.js';
10
- import * as MathUtils from '../math/MathUtils.js';
10
+ import { generateUUID } from '../math/MathUtils.js';
11
11
  import { arrayNeedsUint32 } from '../utils.js';
12
12
 
13
13
  let _id = 0;
@@ -29,12 +29,13 @@ class BufferGeometry extends EventDispatcher {
29
29
 
30
30
  Object.defineProperty( this, 'id', { value: _id ++ } );
31
31
 
32
- this.uuid = MathUtils.generateUUID();
32
+ this.uuid = generateUUID();
33
33
 
34
34
  this.name = '';
35
35
  this.type = 'BufferGeometry';
36
36
 
37
37
  this.index = null;
38
+ this.indirect = null;
38
39
  this.attributes = {};
39
40
 
40
41
  this.morphAttributes = {};
@@ -73,6 +74,20 @@ class BufferGeometry extends EventDispatcher {
73
74
 
74
75
  }
75
76
 
77
+ setIndirect( indirect ) {
78
+
79
+ this.indirect = indirect;
80
+
81
+ return this;
82
+
83
+ }
84
+
85
+ getIndirect() {
86
+
87
+ return this.indirect;
88
+
89
+ }
90
+
76
91
  getAttribute( name ) {
77
92
 
78
93
  return this.attributes[ name ];
@@ -272,16 +287,41 @@ class BufferGeometry extends EventDispatcher {
272
287
 
273
288
  setFromPoints( points ) {
274
289
 
275
- const position = [];
290
+ const positionAttribute = this.getAttribute( 'position' );
276
291
 
277
- for ( let i = 0, l = points.length; i < l; i ++ ) {
292
+ if ( positionAttribute === undefined ) {
278
293
 
279
- const point = points[ i ];
280
- position.push( point.x, point.y, point.z || 0 );
294
+ const position = [];
281
295
 
282
- }
296
+ for ( let i = 0, l = points.length; i < l; i ++ ) {
297
+
298
+ const point = points[ i ];
299
+ position.push( point.x, point.y, point.z || 0 );
300
+
301
+ }
283
302
 
284
- this.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );
303
+ this.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );
304
+
305
+ } else {
306
+
307
+ const l = Math.min( points.length, positionAttribute.count ); // make sure data do not exceed buffer size
308
+
309
+ for ( let i = 0; i < l; i ++ ) {
310
+
311
+ const point = points[ i ];
312
+ positionAttribute.setXYZ( i, point.x, point.y, point.z || 0 );
313
+
314
+ }
315
+
316
+ if ( points.length > positionAttribute.count ) {
317
+
318
+ console.warn( 'THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.' );
319
+
320
+ }
321
+
322
+ positionAttribute.needsUpdate = true;
323
+
324
+ }
285
325
 
286
326
  return this;
287
327
 
@@ -1,4 +1,4 @@
1
- import * as MathUtils from '../math/MathUtils.js';
1
+ import { generateUUID } from '../math/MathUtils.js';
2
2
  import { StaticDrawUsage } from '../constants.js';
3
3
 
4
4
  class InterleavedBuffer {
@@ -16,7 +16,7 @@ class InterleavedBuffer {
16
16
 
17
17
  this.version = 0;
18
18
 
19
- this.uuid = MathUtils.generateUUID();
19
+ this.uuid = generateUUID();
20
20
 
21
21
  }
22
22
 
@@ -92,7 +92,7 @@ class InterleavedBuffer {
92
92
 
93
93
  if ( this.array.buffer._uuid === undefined ) {
94
94
 
95
- this.array.buffer._uuid = MathUtils.generateUUID();
95
+ this.array.buffer._uuid = generateUUID();
96
96
 
97
97
  }
98
98
 
@@ -131,7 +131,7 @@ class InterleavedBuffer {
131
131
 
132
132
  if ( this.array.buffer._uuid === undefined ) {
133
133
 
134
- this.array.buffer._uuid = MathUtils.generateUUID();
134
+ this.array.buffer._uuid = generateUUID();
135
135
 
136
136
  }
137
137
 
@@ -5,7 +5,7 @@ import { EventDispatcher } from './EventDispatcher.js';
5
5
  import { Euler } from '../math/Euler.js';
6
6
  import { Layers } from './Layers.js';
7
7
  import { Matrix3 } from '../math/Matrix3.js';
8
- import * as MathUtils from '../math/MathUtils.js';
8
+ import { generateUUID } from '../math/MathUtils.js';
9
9
 
10
10
  let _object3DId = 0;
11
11
 
@@ -38,7 +38,7 @@ class Object3D extends EventDispatcher {
38
38
 
39
39
  Object.defineProperty( this, 'id', { value: _object3DId ++ } );
40
40
 
41
- this.uuid = MathUtils.generateUUID();
41
+ this.uuid = generateUUID();
42
42
 
43
43
  this.name = '';
44
44
  this.type = 'Object3D';
@@ -1,4 +1,4 @@
1
- import * as MathUtils from '../../math/MathUtils.js';
1
+ import { clamp } from '../../math/MathUtils.js';
2
2
  import { Vector2 } from '../../math/Vector2.js';
3
3
  import { Vector3 } from '../../math/Vector3.js';
4
4
  import { Matrix4 } from '../../math/Matrix4.js';
@@ -330,7 +330,7 @@ class Curve {
330
330
 
331
331
  vec.normalize();
332
332
 
333
- const theta = Math.acos( MathUtils.clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors
333
+ const theta = Math.acos( clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors
334
334
 
335
335
  normals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );
336
336
 
@@ -344,7 +344,7 @@ class Curve {
344
344
 
345
345
  if ( closed === true ) {
346
346
 
347
- let theta = Math.acos( MathUtils.clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );
347
+ let theta = Math.acos( clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );
348
348
  theta /= segments;
349
349
 
350
350
  if ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {
@@ -1,5 +1,5 @@
1
1
  import { Path } from './Path.js';
2
- import * as MathUtils from '../../math/MathUtils.js';
2
+ import { generateUUID } from '../../math/MathUtils.js';
3
3
 
4
4
  class Shape extends Path {
5
5
 
@@ -7,7 +7,7 @@ class Shape extends Path {
7
7
 
8
8
  super( points );
9
9
 
10
- this.uuid = MathUtils.generateUUID();
10
+ this.uuid = generateUUID();
11
11
 
12
12
  this.type = 'Shape';
13
13
 
@@ -133,14 +133,14 @@ class CylinderGeometry extends BufferGeometry {
133
133
 
134
134
  // faces
135
135
 
136
- if ( radiusTop > 0 ) {
136
+ if ( radiusTop > 0 || y !== 0 ) {
137
137
 
138
138
  indices.push( a, b, d );
139
139
  groupCount += 3;
140
140
 
141
141
  }
142
142
 
143
- if ( radiusBottom > 0 ) {
143
+ if ( radiusBottom > 0 || y !== heightSegments - 1 ) {
144
144
 
145
145
  indices.push( b, c, d );
146
146
  groupCount += 3;
@@ -1,6 +1,6 @@
1
1
  import { BufferGeometry } from '../core/BufferGeometry.js';
2
2
  import { Float32BufferAttribute } from '../core/BufferAttribute.js';
3
- import * as MathUtils from '../math/MathUtils.js';
3
+ import { DEG2RAD } from '../math/MathUtils.js';
4
4
  import { Triangle } from '../math/Triangle.js';
5
5
  import { Vector3 } from '../math/Vector3.js';
6
6
 
@@ -26,7 +26,7 @@ class EdgesGeometry extends BufferGeometry {
26
26
 
27
27
  const precisionPoints = 4;
28
28
  const precision = Math.pow( 10, precisionPoints );
29
- const thresholdDot = Math.cos( MathUtils.DEG2RAD * thresholdAngle );
29
+ const thresholdDot = Math.cos( DEG2RAD * thresholdAngle );
30
30
 
31
31
  const indexAttr = geometry.getIndex();
32
32
  const positionAttr = geometry.getAttribute( 'position' );
@@ -2,7 +2,7 @@ import { Float32BufferAttribute } from '../core/BufferAttribute.js';
2
2
  import { BufferGeometry } from '../core/BufferGeometry.js';
3
3
  import { Vector3 } from '../math/Vector3.js';
4
4
  import { Vector2 } from '../math/Vector2.js';
5
- import * as MathUtils from '../math/MathUtils.js';
5
+ import { clamp } from '../math/MathUtils.js';
6
6
 
7
7
  class LatheGeometry extends BufferGeometry {
8
8
 
@@ -23,7 +23,7 @@ class LatheGeometry extends BufferGeometry {
23
23
 
24
24
  // clamp phiLength so it's in range of [ 0, 2PI ]
25
25
 
26
- phiLength = MathUtils.clamp( phiLength, 0, Math.PI * 2 );
26
+ phiLength = clamp( phiLength, 0, Math.PI * 2 );
27
27
 
28
28
  // buffers
29
29
 
@@ -1,5 +1,5 @@
1
1
  import { LightShadow } from './LightShadow.js';
2
- import * as MathUtils from '../math/MathUtils.js';
2
+ import { RAD2DEG } from '../math/MathUtils.js';
3
3
  import { PerspectiveCamera } from '../cameras/PerspectiveCamera.js';
4
4
 
5
5
  class SpotLightShadow extends LightShadow {
@@ -18,7 +18,7 @@ class SpotLightShadow extends LightShadow {
18
18
 
19
19
  const camera = this.camera;
20
20
 
21
- const fov = MathUtils.RAD2DEG * 2 * light.angle * this.focus;
21
+ const fov = RAD2DEG * 2 * light.angle * this.focus;
22
22
  const aspect = this.mapSize.width / this.mapSize.height;
23
23
  const far = light.distance || camera.far;
24
24
 
@@ -7,7 +7,6 @@ class LineDashedMaterial extends LineBasicMaterial {
7
7
  super();
8
8
 
9
9
  this.isLineDashedMaterial = true;
10
-
11
10
  this.type = 'LineDashedMaterial';
12
11
 
13
12
  this.scale = 1;
@@ -1,7 +1,7 @@
1
1
  import { Color } from '../math/Color.js';
2
2
  import { EventDispatcher } from '../core/EventDispatcher.js';
3
3
  import { FrontSide, NormalBlending, LessEqualDepth, AddEquation, OneMinusSrcAlphaFactor, SrcAlphaFactor, AlwaysStencilFunc, KeepStencilOp } from '../constants.js';
4
- import * as MathUtils from '../math/MathUtils.js';
4
+ import { generateUUID } from '../math/MathUtils.js';
5
5
 
6
6
  let _materialId = 0;
7
7
 
@@ -15,7 +15,7 @@ class Material extends EventDispatcher {
15
15
 
16
16
  Object.defineProperty( this, 'id', { value: _materialId ++ } );
17
17
 
18
- this.uuid = MathUtils.generateUUID();
18
+ this.uuid = generateUUID();
19
19
 
20
20
  this.name = '';
21
21
  this.type = 'Material';
@@ -3,7 +3,6 @@ import { Material } from './Material.js';
3
3
  import { Vector2 } from '../math/Vector2.js';
4
4
  import { Color } from '../math/Color.js';
5
5
  import { Euler } from '../math/Euler.js';
6
-
7
6
  class MeshPhongMaterial extends Material {
8
7
 
9
8
  constructor( parameters ) {
@@ -47,6 +46,7 @@ class MeshPhongMaterial extends Material {
47
46
 
48
47
  this.envMap = null;
49
48
  this.envMapRotation = new Euler();
49
+
50
50
  this.combine = MultiplyOperation;
51
51
  this.reflectivity = 1;
52
52
  this.refractionRatio = 0.98;
@@ -1,7 +1,7 @@
1
1
  import { Vector2 } from '../math/Vector2.js';
2
2
  import { MeshStandardMaterial } from './MeshStandardMaterial.js';
3
3
  import { Color } from '../math/Color.js';
4
- import * as MathUtils from '../math/MathUtils.js';
4
+ import { clamp } from '../math/MathUtils.js';
5
5
 
6
6
  class MeshPhysicalMaterial extends MeshStandardMaterial {
7
7
 
@@ -34,7 +34,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
34
34
  Object.defineProperty( this, 'reflectivity', {
35
35
  get: function () {
36
36
 
37
- return ( MathUtils.clamp( 2.5 * ( this.ior - 1 ) / ( this.ior + 1 ), 0, 1 ) );
37
+ return ( clamp( 2.5 * ( this.ior - 1 ) / ( this.ior + 1 ), 0, 1 ) );
38
38
 
39
39
  },
40
40
  set: function ( reflectivity ) {
@@ -12,10 +12,10 @@ class MeshStandardMaterial extends Material {
12
12
 
13
13
  this.isMeshStandardMaterial = true;
14
14
 
15
- this.defines = { 'STANDARD': '' };
16
-
17
15
  this.type = 'MeshStandardMaterial';
18
16
 
17
+ this.defines = { 'STANDARD': '' };
18
+
19
19
  this.color = new Color( 0xffffff ); // diffuse
20
20
  this.roughness = 1.0;
21
21
  this.metalness = 0.0;
@@ -2,16 +2,18 @@ import NodeMaterial from './NodeMaterial.js';
2
2
  import { varyingProperty } from '../../nodes/core/PropertyNode.js';
3
3
  import { attribute } from '../../nodes/core/AttributeNode.js';
4
4
  import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
5
- import { materialColor, materialLineScale, materialLineDashSize, materialLineGapSize, materialLineDashOffset, materialLineWidth } from '../../nodes/accessors/MaterialNode.js';
5
+ import { materialColor, materialLineScale, materialLineDashSize, materialLineGapSize, materialLineDashOffset, materialLineWidth, materialOpacity } from '../../nodes/accessors/MaterialNode.js';
6
6
  import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
7
7
  import { positionGeometry } from '../../nodes/accessors/Position.js';
8
8
  import { mix, smoothstep } from '../../nodes/math/MathNode.js';
9
- import { Fn, varying, float, vec2, vec3, vec4, If } from '../../nodes/tsl/TSLBase.js';
9
+ import { Fn, float, vec2, vec3, vec4, If } from '../../nodes/tsl/TSLBase.js';
10
10
  import { uv } from '../../nodes/accessors/UV.js';
11
11
  import { viewport } from '../../nodes/display/ScreenNode.js';
12
12
  import { dashSize, gapSize } from '../../nodes/core/PropertyNode.js';
13
+ import { viewportSharedTexture } from '../../nodes/display/ViewportSharedTextureNode.js';
13
14
 
14
15
  import { LineDashedMaterial } from '../LineDashedMaterial.js';
16
+ import { NoBlending } from '../../constants.js';
15
17
 
16
18
  const _defaultValues = /*@__PURE__*/ new LineDashedMaterial();
17
19
 
@@ -46,6 +48,8 @@ class Line2NodeMaterial extends NodeMaterial {
46
48
  this.dashSizeNode = null;
47
49
  this.gapSizeNode = null;
48
50
 
51
+ this.blending = NoBlending;
52
+
49
53
  this.setValues( params );
50
54
 
51
55
  }
@@ -94,6 +98,21 @@ class Line2NodeMaterial extends NodeMaterial {
94
98
  const start = vec4( modelViewMatrix.mul( vec4( instanceStart, 1.0 ) ) ).toVar( 'start' );
95
99
  const end = vec4( modelViewMatrix.mul( vec4( instanceEnd, 1.0 ) ) ).toVar( 'end' );
96
100
 
101
+ if ( useDash ) {
102
+
103
+ const dashScaleNode = this.dashScaleNode ? float( this.dashScaleNode ) : materialLineScale;
104
+ const offsetNode = this.offsetNode ? float( this.offsetNodeNode ) : materialLineDashOffset;
105
+
106
+ const instanceDistanceStart = attribute( 'instanceDistanceStart' );
107
+ const instanceDistanceEnd = attribute( 'instanceDistanceEnd' );
108
+
109
+ let lineDistance = positionGeometry.y.lessThan( 0.5 ).select( dashScaleNode.mul( instanceDistanceStart ), dashScaleNode.mul( instanceDistanceEnd ) );
110
+ lineDistance = lineDistance.add( offsetNode );
111
+
112
+ varyingProperty( 'float', 'lineDistance' ).assign( lineDistance );
113
+
114
+ }
115
+
97
116
  if ( useWorldUnits ) {
98
117
 
99
118
  varyingProperty( 'vec3', 'worldStart' ).assign( start.xyz );
@@ -252,30 +271,22 @@ class Line2NodeMaterial extends NodeMaterial {
252
271
 
253
272
  } );
254
273
 
255
- this.fragmentNode = Fn( () => {
274
+ this.colorNode = Fn( () => {
256
275
 
257
276
  const vUv = uv();
258
277
 
259
278
  if ( useDash ) {
260
279
 
261
- const offsetNode = this.offsetNode ? float( this.offsetNodeNode ) : materialLineDashOffset;
262
- const dashScaleNode = this.dashScaleNode ? float( this.dashScaleNode ) : materialLineScale;
263
280
  const dashSizeNode = this.dashSizeNode ? float( this.dashSizeNode ) : materialLineDashSize;
264
281
  const gapSizeNode = this.dashSizeNode ? float( this.dashGapNode ) : materialLineGapSize;
265
282
 
266
283
  dashSize.assign( dashSizeNode );
267
284
  gapSize.assign( gapSizeNode );
268
285
 
269
- const instanceDistanceStart = attribute( 'instanceDistanceStart' );
270
- const instanceDistanceEnd = attribute( 'instanceDistanceEnd' );
271
-
272
- const lineDistance = positionGeometry.y.lessThan( 0.5 ).select( dashScaleNode.mul( instanceDistanceStart ), materialLineScale.mul( instanceDistanceEnd ) );
273
-
274
- const vLineDistance = varying( lineDistance.add( materialLineDashOffset ) );
275
- const vLineDistanceOffset = offsetNode ? vLineDistance.add( offsetNode ) : vLineDistance;
286
+ const vLineDistance = varyingProperty( 'float', 'lineDistance' );
276
287
 
277
288
  vUv.y.lessThan( - 1.0 ).or( vUv.y.greaterThan( 1.0 ) ).discard(); // discard endcaps
278
- vLineDistanceOffset.mod( dashSize.add( gapSize ) ).greaterThan( dashSize ).discard(); // todo - FIX
289
+ vLineDistance.mod( dashSize.add( gapSize ) ).greaterThan( dashSize ).discard(); // todo - FIX
279
290
 
280
291
  }
281
292
 
@@ -376,6 +387,14 @@ class Line2NodeMaterial extends NodeMaterial {
376
387
 
377
388
  } )();
378
389
 
390
+ if ( this.transparent ) {
391
+
392
+ const opacityNode = this.opacityNode ? float( this.opacityNode ) : materialOpacity;
393
+
394
+ this.outputNode = vec4( this.colorNode.rgb.mul( opacityNode ).add( viewportSharedTexture().rgb.mul( opacityNode.oneMinus() ) ), this.colorNode.a );
395
+
396
+ }
397
+
379
398
  }
380
399
 
381
400
 
@@ -1,6 +1,6 @@
1
1
  import NodeMaterial from './NodeMaterial.js';
2
2
  import { attribute } from '../../nodes/core/AttributeNode.js';
3
- import { materialLineDashSize, materialLineGapSize, materialLineScale } from '../../nodes/accessors/MaterialNode.js';
3
+ import { materialLineDashOffset, materialLineDashSize, materialLineGapSize, materialLineScale } from '../../nodes/accessors/MaterialNode.js';
4
4
  import { dashSize, gapSize } from '../../nodes/core/PropertyNode.js';
5
5
  import { varying, float } from '../../nodes/tsl/TSLBase.js';
6
6
 
@@ -26,6 +26,8 @@ class LineDashedNodeMaterial extends NodeMaterial {
26
26
 
27
27
  this.setDefaultValues( _defaultValues );
28
28
 
29
+ this.dashOffset = 0;
30
+
29
31
  this.offsetNode = null;
30
32
  this.dashScaleNode = null;
31
33
  this.dashSizeNode = null;
@@ -37,7 +39,7 @@ class LineDashedNodeMaterial extends NodeMaterial {
37
39
 
38
40
  setupVariants() {
39
41
 
40
- const offsetNode = this.offsetNode;
42
+ const offsetNode = this.offsetNode ? float( this.offsetNodeNode ) : materialLineDashOffset;
41
43
  const dashScaleNode = this.dashScaleNode ? float( this.dashScaleNode ) : materialLineScale;
42
44
  const dashSizeNode = this.dashSizeNode ? float( this.dashSizeNode ) : materialLineDashSize;
43
45
  const gapSizeNode = this.dashSizeNode ? float( this.dashGapNode ) : materialLineGapSize;