@plastic-software/three 0.183.4 → 0.184.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 (277) hide show
  1. package/build/three.cjs +773 -286
  2. package/build/three.core.js +372 -110
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +426 -180
  5. package/build/three.module.min.js +1 -1
  6. package/build/three.tsl.js +7 -1
  7. package/build/three.tsl.min.js +1 -1
  8. package/build/three.webgpu.js +2979 -1281
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +2942 -1281
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/jsm/Addons.js +11 -0
  13. package/examples/jsm/animation/CCDIKSolver.js +5 -1
  14. package/examples/jsm/controls/ArcballControls.js +4 -1
  15. package/examples/jsm/controls/DragControls.js +2 -2
  16. package/examples/jsm/controls/FirstPersonControls.js +58 -54
  17. package/examples/jsm/controls/FlyControls.js +4 -0
  18. package/examples/jsm/controls/OrbitControls.js +2 -2
  19. package/examples/jsm/controls/TrackballControls.js +2 -2
  20. package/examples/jsm/controls/TransformControls.js +34 -2
  21. package/examples/jsm/csm/CSMShadowNode.js +6 -2
  22. package/examples/jsm/exporters/GLTFExporter.js +21 -5
  23. package/examples/jsm/geometries/TextGeometry.js +18 -0
  24. package/examples/jsm/helpers/LightProbeGridHelper.js +221 -0
  25. package/examples/jsm/inspector/Extension.js +13 -0
  26. package/examples/jsm/inspector/Inspector.js +169 -114
  27. package/examples/jsm/inspector/RendererInspector.js +2 -2
  28. package/examples/jsm/inspector/extensions/extensions.json +6 -0
  29. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +916 -0
  30. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +281 -0
  31. package/examples/jsm/inspector/tabs/Memory.js +128 -0
  32. package/examples/jsm/inspector/tabs/Parameters.js +34 -2
  33. package/examples/jsm/inspector/tabs/Performance.js +2 -2
  34. package/examples/jsm/inspector/tabs/Settings.js +264 -0
  35. package/examples/jsm/inspector/tabs/Timeline.js +1611 -0
  36. package/examples/jsm/inspector/tabs/Viewer.js +105 -3
  37. package/examples/jsm/inspector/ui/Graph.js +2 -2
  38. package/examples/jsm/inspector/ui/List.js +1 -1
  39. package/examples/jsm/inspector/ui/Profiler.js +273 -176
  40. package/examples/jsm/inspector/ui/Style.js +64 -10
  41. package/examples/jsm/inspector/ui/Tab.js +39 -7
  42. package/examples/jsm/inspector/ui/Values.js +39 -2
  43. package/examples/jsm/inspector/ui/utils.js +13 -0
  44. package/examples/jsm/interaction/InteractionManager.js +226 -0
  45. package/examples/jsm/libs/meshopt_decoder.module.js +8 -8
  46. package/examples/jsm/lighting/DynamicLighting.js +82 -0
  47. package/examples/jsm/lighting/LightProbeGrid.js +651 -0
  48. package/examples/jsm/lines/LineMaterial.js +1 -1
  49. package/examples/jsm/loaders/EXRLoader.js +682 -43
  50. package/examples/jsm/loaders/FBXLoader.js +233 -33
  51. package/examples/jsm/loaders/GLTFLoader.js +24 -7
  52. package/examples/jsm/loaders/HDRLoader.js +1 -1
  53. package/examples/jsm/loaders/KTX2Loader.js +8 -2
  54. package/examples/jsm/loaders/LDrawLoader.js +39 -47
  55. package/examples/jsm/loaders/SVGLoader.js +1 -1
  56. package/examples/jsm/loaders/VTKLoader.js +5 -1
  57. package/examples/jsm/loaders/collada/ColladaComposer.js +101 -7
  58. package/examples/jsm/loaders/collada/ColladaParser.js +19 -4
  59. package/examples/jsm/loaders/usd/USDAParser.js +6 -0
  60. package/examples/jsm/loaders/usd/USDCParser.js +26 -0
  61. package/examples/jsm/loaders/usd/USDComposer.js +656 -103
  62. package/examples/jsm/misc/GPUComputationRenderer.js +2 -0
  63. package/examples/jsm/misc/RollerCoaster.js +42 -4
  64. package/examples/jsm/modifiers/TessellateModifier.js +1 -1
  65. package/examples/jsm/objects/Reflector.js +73 -25
  66. package/examples/jsm/objects/Sky.js +14 -2
  67. package/examples/jsm/objects/SkyMesh.js +23 -6
  68. package/examples/jsm/renderers/Projector.js +18 -38
  69. package/examples/jsm/renderers/SVGRenderer.js +6 -25
  70. package/examples/jsm/transpiler/GLSLDecoder.js +2 -2
  71. package/examples/jsm/tsl/WebGLNodesHandler.js +605 -0
  72. package/examples/jsm/tsl/display/AfterImageNode.js +10 -0
  73. package/examples/jsm/tsl/display/AnamorphicNode.js +11 -0
  74. package/examples/jsm/tsl/display/BilateralBlurNode.js +10 -0
  75. package/examples/jsm/tsl/display/ChromaticAberrationNode.js +3 -36
  76. package/examples/jsm/tsl/display/FSR1Node.js +477 -0
  77. package/examples/jsm/tsl/display/GTAONode.js +2 -1
  78. package/examples/jsm/tsl/display/GaussianBlurNode.js +10 -0
  79. package/examples/jsm/tsl/display/GodraysNode.js +2 -11
  80. package/examples/jsm/tsl/display/OutlineNode.js +66 -16
  81. package/examples/jsm/tsl/display/SSGINode.js +0 -4
  82. package/examples/jsm/tsl/display/SharpenNode.js +283 -0
  83. package/examples/jsm/tsl/display/TAAUNode.js +835 -0
  84. package/examples/jsm/tsl/display/TRAANode.js +48 -7
  85. package/examples/jsm/tsl/lighting/DynamicLightsNode.js +300 -0
  86. package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +61 -0
  87. package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +111 -0
  88. package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +99 -0
  89. package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +134 -0
  90. package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +161 -0
  91. package/examples/jsm/tsl/math/Bayer.js +13 -2
  92. package/examples/jsm/utils/BufferGeometryUtils.js +2 -3
  93. package/examples/jsm/utils/ColorUtils.js +76 -0
  94. package/examples/jsm/utils/SkeletonUtils.js +14 -8
  95. package/examples/jsm/webxr/XRHandMeshModel.js +36 -10
  96. package/examples/jsm/webxr/XRHandModelFactory.js +2 -1
  97. package/package.json +4 -4
  98. package/src/Three.Core.js +1 -0
  99. package/src/Three.TSL.js +6 -0
  100. package/src/Three.WebGPU.Nodes.js +3 -0
  101. package/src/Three.WebGPU.js +6 -0
  102. package/src/animation/AnimationAction.js +11 -1
  103. package/src/audio/AudioContext.js +2 -2
  104. package/src/constants.js +1 -1
  105. package/src/core/BufferAttribute.js +13 -1
  106. package/src/core/Clock.js +1 -1
  107. package/src/core/Object3D.js +1 -5
  108. package/src/core/RenderTarget.js +1 -0
  109. package/src/extras/curves/CatmullRomCurve3.js +3 -2
  110. package/src/loaders/AudioLoader.js +11 -1
  111. package/src/loaders/DataTextureLoader.js +6 -4
  112. package/src/loaders/FileLoader.js +1 -2
  113. package/src/loaders/ImageBitmapLoader.js +4 -6
  114. package/src/loaders/MaterialLoader.js +1 -1
  115. package/src/loaders/ObjectLoader.js +25 -4
  116. package/src/loaders/nodes/NodeObjectLoader.js +18 -0
  117. package/src/materials/MeshToonMaterial.js +1 -1
  118. package/src/materials/nodes/Line2NodeMaterial.js +27 -0
  119. package/src/materials/nodes/NodeMaterial.js +0 -27
  120. package/src/materials/nodes/manager/NodeMaterialObserver.js +188 -89
  121. package/src/math/Line3.js +3 -0
  122. package/src/math/Matrix2.js +13 -9
  123. package/src/math/Matrix3.js +13 -9
  124. package/src/math/Matrix4.js +13 -9
  125. package/src/math/Plane.js +4 -3
  126. package/src/math/Triangle.js +1 -1
  127. package/src/math/Vector2.js +11 -7
  128. package/src/math/Vector3.js +12 -8
  129. package/src/math/Vector4.js +13 -9
  130. package/src/nodes/Nodes.js +0 -1
  131. package/src/nodes/TSL.js +1 -1
  132. package/src/nodes/accessors/BufferAttributeNode.js +9 -3
  133. package/src/nodes/accessors/CubeTextureNode.js +7 -1
  134. package/src/nodes/accessors/MaterialProperties.js +2 -5
  135. package/src/nodes/accessors/Object3DNode.js +1 -1
  136. package/src/nodes/accessors/ReferenceBaseNode.js +2 -2
  137. package/src/nodes/accessors/ReferenceNode.js +4 -4
  138. package/src/nodes/accessors/SceneProperties.js +2 -8
  139. package/src/nodes/accessors/StorageBufferNode.js +10 -4
  140. package/src/nodes/accessors/StorageTextureNode.js +4 -9
  141. package/src/nodes/accessors/TextureNode.js +10 -2
  142. package/src/nodes/accessors/UniformArrayNode.js +2 -2
  143. package/src/nodes/code/FunctionCallNode.js +1 -1
  144. package/src/nodes/code/FunctionNode.js +1 -1
  145. package/src/nodes/core/ArrayNode.js +1 -1
  146. package/src/nodes/core/AssignNode.js +1 -1
  147. package/src/nodes/core/AttributeNode.js +1 -1
  148. package/src/nodes/core/BypassNode.js +1 -1
  149. package/src/nodes/core/ContextNode.js +1 -1
  150. package/src/nodes/core/IndexNode.js +2 -1
  151. package/src/nodes/core/InputNode.js +1 -1
  152. package/src/nodes/core/InspectorNode.js +1 -1
  153. package/src/nodes/core/IsolateNode.js +1 -1
  154. package/src/nodes/core/Node.js +83 -12
  155. package/src/nodes/core/NodeBuilder.js +117 -16
  156. package/src/nodes/core/NodeUtils.js +1 -1
  157. package/src/nodes/core/OutputStructNode.js +1 -1
  158. package/src/nodes/core/ParameterNode.js +1 -1
  159. package/src/nodes/core/StackNode.js +1 -1
  160. package/src/nodes/core/StructNode.js +1 -1
  161. package/src/nodes/core/StructTypeNode.js +1 -1
  162. package/src/nodes/core/SubBuildNode.js +1 -1
  163. package/src/nodes/core/UniformGroupNode.js +36 -6
  164. package/src/nodes/core/VarNode.js +1 -1
  165. package/src/nodes/core/VaryingNode.js +1 -1
  166. package/src/nodes/display/NormalMapNode.js +2 -2
  167. package/src/nodes/display/PassNode.js +27 -7
  168. package/src/nodes/display/RenderOutputNode.js +4 -4
  169. package/src/nodes/display/ScreenNode.js +1 -1
  170. package/src/nodes/display/ViewportDepthTextureNode.js +11 -15
  171. package/src/nodes/display/ViewportTextureNode.js +18 -7
  172. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
  173. package/src/nodes/geometry/RangeNode.js +1 -1
  174. package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
  175. package/src/nodes/gpgpu/BarrierNode.js +9 -0
  176. package/src/nodes/gpgpu/ComputeBuiltinNode.js +1 -1
  177. package/src/nodes/gpgpu/ComputeNode.js +69 -44
  178. package/src/nodes/gpgpu/SubgroupFunctionNode.js +1 -1
  179. package/src/nodes/lighting/LightsNode.js +6 -27
  180. package/src/nodes/lighting/ShadowNode.js +24 -2
  181. package/src/nodes/math/BitcastNode.js +1 -1
  182. package/src/nodes/math/ConditionalNode.js +1 -1
  183. package/src/nodes/math/MathNode.js +73 -1
  184. package/src/nodes/math/OperatorNode.js +1 -1
  185. package/src/nodes/math/PackFloatNode.js +1 -1
  186. package/src/nodes/math/UnpackFloatNode.js +1 -1
  187. package/src/nodes/tsl/TSLBase.js +1 -1
  188. package/src/nodes/tsl/TSLCore.js +21 -3
  189. package/src/nodes/utils/ArrayElementNode.js +1 -1
  190. package/src/nodes/utils/ConvertNode.js +1 -1
  191. package/src/nodes/utils/DebugNode.js +1 -1
  192. package/src/nodes/utils/EventNode.js +30 -0
  193. package/src/nodes/utils/FlipNode.js +1 -1
  194. package/src/nodes/utils/FunctionOverloadingNode.js +1 -1
  195. package/src/nodes/utils/JoinNode.js +1 -1
  196. package/src/nodes/utils/MemberNode.js +1 -1
  197. package/src/nodes/utils/Remap.js +48 -0
  198. package/src/nodes/utils/RotateNode.js +1 -1
  199. package/src/nodes/utils/SetNode.js +1 -1
  200. package/src/nodes/utils/SplitNode.js +1 -1
  201. package/src/objects/BatchedMesh.js +17 -2
  202. package/src/objects/InstancedMesh.js +19 -3
  203. package/src/objects/SkinnedMesh.js +26 -9
  204. package/src/renderers/WebGLRenderer.js +147 -48
  205. package/src/renderers/common/Animation.js +3 -3
  206. package/src/renderers/common/Attributes.js +15 -1
  207. package/src/renderers/common/Backend.js +0 -8
  208. package/src/renderers/common/Background.js +2 -2
  209. package/src/renderers/common/BindGroup.js +1 -8
  210. package/src/renderers/common/Bindings.js +2 -2
  211. package/src/renderers/common/ComputePipeline.js +1 -1
  212. package/src/renderers/common/CubeRenderTarget.js +1 -1
  213. package/src/renderers/common/Info.js +333 -4
  214. package/src/renderers/common/InspectorBase.js +6 -1
  215. package/src/renderers/common/Pipelines.js +36 -3
  216. package/src/renderers/common/ReadbackBuffer.js +78 -0
  217. package/src/renderers/common/RenderBundle.js +3 -1
  218. package/src/renderers/common/RenderBundles.js +5 -2
  219. package/src/renderers/common/RenderObject.js +2 -2
  220. package/src/renderers/common/RenderObjects.js +3 -3
  221. package/src/renderers/common/RenderPipeline.js +35 -6
  222. package/src/renderers/common/Renderer.js +232 -53
  223. package/src/renderers/common/Textures.js +72 -3
  224. package/src/renderers/common/UniformsGroup.js +1 -1
  225. package/src/renderers/common/XRManager.js +34 -27
  226. package/src/renderers/common/extras/PMREMGenerator.js +23 -15
  227. package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
  228. package/src/renderers/common/nodes/NodeManager.js +230 -99
  229. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +0 -1
  230. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
  231. package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +80 -0
  232. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +8 -0
  233. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +2 -0
  234. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +1 -3
  235. package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +7 -0
  236. package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +0 -1
  237. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +12 -2
  238. package/src/renderers/shaders/ShaderChunk.js +2 -0
  239. package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +1 -2
  240. package/src/renderers/shaders/ShaderLib.js +0 -1
  241. package/src/renderers/shaders/UniformsLib.js +7 -2
  242. package/src/renderers/shaders/UniformsUtils.js +27 -5
  243. package/src/renderers/webgl/WebGLAnimation.js +2 -1
  244. package/src/renderers/webgl/WebGLBackground.js +13 -13
  245. package/src/renderers/webgl/WebGLBufferRenderer.js +0 -32
  246. package/src/renderers/webgl/WebGLCapabilities.js +6 -0
  247. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +0 -32
  248. package/src/renderers/webgl/WebGLMaterials.js +12 -13
  249. package/src/renderers/webgl/WebGLOutput.js +4 -1
  250. package/src/renderers/webgl/WebGLProgram.js +4 -0
  251. package/src/renderers/webgl/WebGLPrograms.js +19 -3
  252. package/src/renderers/webgl/WebGLRenderStates.js +13 -2
  253. package/src/renderers/webgl/WebGLState.js +43 -0
  254. package/src/renderers/webgl/WebGLTextures.js +129 -26
  255. package/src/renderers/webgl/WebGLUniformsGroups.js +19 -0
  256. package/src/renderers/webgl-fallback/WebGLBackend.js +106 -65
  257. package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +0 -41
  258. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +29 -51
  259. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +53 -19
  260. package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +25 -0
  261. package/src/renderers/webgl-fallback/utils/WebGLState.js +42 -1
  262. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +63 -50
  263. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +1 -1
  264. package/src/renderers/webgpu/WebGPUBackend.js +160 -146
  265. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +55 -33
  266. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +103 -17
  267. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +1 -1
  268. package/src/renderers/webgpu/utils/WebGPUCapabilities.js +48 -0
  269. package/src/renderers/webgpu/utils/WebGPUConstants.js +8 -0
  270. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +91 -17
  271. package/src/renderers/webgpu/utils/WebGPUUtils.js +18 -2
  272. package/src/renderers/webxr/WebXRController.js +12 -0
  273. package/src/textures/HTMLTexture.js +74 -0
  274. package/src/textures/Source.js +1 -1
  275. package/src/textures/Texture.js +13 -2
  276. package/src/utils.js +23 -1
  277. package/src/nodes/utils/RemapNode.js +0 -125
@@ -41,6 +41,15 @@ class AnimationAction {
41
41
 
42
42
  const interpolant = tracks[ i ].createInterpolant( null );
43
43
  interpolants[ i ] = interpolant;
44
+
45
+ // preserve interpolant settings (like tangent data from BezierInterpolant)
46
+
47
+ if ( interpolant.settings ) {
48
+
49
+ Object.assign( interpolantSettings, interpolant.settings );
50
+
51
+ }
52
+
44
53
  interpolant.settings = interpolantSettings;
45
54
 
46
55
  }
@@ -847,6 +856,7 @@ class AnimationAction {
847
856
 
848
857
  } else {
849
858
 
859
+ this._loopCount = loopCount;
850
860
  this.time = time;
851
861
 
852
862
  }
@@ -894,7 +904,7 @@ class AnimationAction {
894
904
 
895
905
  } else {
896
906
 
897
- settings.endingEnd = WrapAroundEnding;
907
+ settings.endingEnd = WrapAroundEnding;
898
908
 
899
909
  }
900
910
 
@@ -10,7 +10,7 @@ class AudioContext {
10
10
  /**
11
11
  * Returns the global native audio context.
12
12
  *
13
- * @return {AudioContext} The native audio context.
13
+ * @return {Window.AudioContext} The native audio context.
14
14
  */
15
15
  static getContext() {
16
16
 
@@ -27,7 +27,7 @@ class AudioContext {
27
27
  /**
28
28
  * Allows to set the global native audio context from outside.
29
29
  *
30
- * @param {AudioContext} value - The native context to set.
30
+ * @param {Window.AudioContext} value - The native context to set.
31
31
  */
32
32
  static setContext( value ) {
33
33
 
package/src/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- export const REVISION = '183';
1
+ export const REVISION = '184';
2
2
 
3
3
  /**
4
4
  * Represents mouse buttons and interaction types in context of controls.
@@ -3,6 +3,7 @@ import { Vector2 } from '../math/Vector2.js';
3
3
  import { denormalize, normalize } from '../math/MathUtils.js';
4
4
  import { StaticDrawUsage, FloatType } from '../constants.js';
5
5
  import { fromHalfFloat, toHalfFloat } from '../extras/DataUtils.js';
6
+ import { EventDispatcher } from './EventDispatcher.js';
6
7
 
7
8
  const _vector = /*@__PURE__*/ new Vector3();
8
9
  const _vector2 = /*@__PURE__*/ new Vector2();
@@ -17,7 +18,7 @@ let _id = 0;
17
18
  * When working with vector-like data, the `fromBufferAttribute( attribute, index )`
18
19
  * helper methods on vector and color class might be helpful. E.g. {@link Vector3#fromBufferAttribute}.
19
20
  */
20
- class BufferAttribute {
21
+ class BufferAttribute extends EventDispatcher {
21
22
 
22
23
  /**
23
24
  * Constructs a new buffer attribute.
@@ -28,6 +29,8 @@ class BufferAttribute {
28
29
  */
29
30
  constructor( array, itemSize, normalized = false ) {
30
31
 
32
+ super();
33
+
31
34
  if ( Array.isArray( array ) ) {
32
35
 
33
36
  throw new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );
@@ -674,6 +677,15 @@ class BufferAttribute {
674
677
 
675
678
  }
676
679
 
680
+ /**
681
+ * Disposes of the buffer attribute. Available only in {@link WebGPURenderer}.
682
+ */
683
+ dispose() {
684
+
685
+ this.dispatchEvent( { type: 'dispose' } );
686
+
687
+ }
688
+
677
689
  }
678
690
 
679
691
  /**
package/src/core/Clock.js CHANGED
@@ -58,7 +58,7 @@ class Clock {
58
58
  */
59
59
  this.running = false;
60
60
 
61
- warn( 'THREE.Clock: This module has been deprecated. Please use THREE.Timer instead.' ); // @deprecated, r183
61
+ warn( 'Clock: This module has been deprecated. Please use THREE.Timer instead.' ); // @deprecated, r183
62
62
 
63
63
  }
64
64
 
@@ -1592,11 +1592,7 @@ class Object3D extends EventDispatcher {
1592
1592
  this.quaternion.copy( source.quaternion );
1593
1593
  this.scale.copy( source.scale );
1594
1594
 
1595
- if ( source.pivot !== null ) {
1596
-
1597
- this.pivot = source.pivot.clone();
1598
-
1599
- }
1595
+ this.pivot = ( source.pivot !== null ) ? source.pivot.clone() : null;
1600
1596
 
1601
1597
  this.matrix.copy( source.matrix );
1602
1598
  this.matrixWorld.copy( source.matrixWorld );
@@ -369,6 +369,7 @@ class RenderTarget extends EventDispatcher {
369
369
  if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();
370
370
 
371
371
  this.samples = source.samples;
372
+ this.multiview = source.multiview;
372
373
 
373
374
  return this;
374
375
 
@@ -78,6 +78,7 @@ function CubicPoly() {
78
78
  //
79
79
 
80
80
  const tmp = /*@__PURE__*/ new Vector3();
81
+ const tmp2 = /*@__PURE__*/ new Vector3();
81
82
  const px = /*@__PURE__*/ new CubicPoly();
82
83
  const py = /*@__PURE__*/ new CubicPoly();
83
84
  const pz = /*@__PURE__*/ new CubicPoly();
@@ -202,8 +203,8 @@ class CatmullRomCurve3 extends Curve {
202
203
  } else {
203
204
 
204
205
  // extrapolate first point
205
- tmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );
206
- p0 = tmp;
206
+ tmp2.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );
207
+ p0 = tmp2;
207
208
 
208
209
  }
209
210
 
@@ -60,11 +60,21 @@ class AudioLoader extends Loader {
60
60
  const bufferCopy = buffer.slice( 0 );
61
61
 
62
62
  const context = AudioContext.getContext();
63
+
64
+ const decodeUrl = url + '#decode';
65
+ scope.manager.itemStart( decodeUrl ); // prevent loading manager from completing too early, see #33378
66
+
63
67
  context.decodeAudioData( bufferCopy, function ( audioBuffer ) {
64
68
 
65
69
  onLoad( audioBuffer );
70
+ scope.manager.itemEnd( decodeUrl );
71
+
72
+ } ).catch( function ( e ) {
73
+
74
+ handleError( e );
75
+ scope.manager.itemEnd( decodeUrl );
66
76
 
67
- } ).catch( handleError );
77
+ } );
68
78
 
69
79
  } catch ( e ) {
70
80
 
@@ -2,6 +2,7 @@ import { LinearFilter, LinearMipmapLinearFilter, ClampToEdgeWrapping } from '../
2
2
  import { FileLoader } from './FileLoader.js';
3
3
  import { DataTexture } from '../textures/DataTexture.js';
4
4
  import { Loader } from './Loader.js';
5
+ import { error } from '../utils.js';
5
6
 
6
7
  /**
7
8
  * Abstract base class for loading binary texture formats RGBE, EXR or TGA.
@@ -57,19 +58,20 @@ class DataTextureLoader extends Loader {
57
58
 
58
59
  texData = scope.parse( buffer );
59
60
 
60
- } catch ( error ) {
61
+ } catch ( e ) {
61
62
 
62
63
  if ( onError !== undefined ) {
63
64
 
64
- onError( error );
65
+ onError( e );
65
66
 
66
67
  } else {
67
68
 
68
- error( error );
69
- return;
69
+ error( e );
70
70
 
71
71
  }
72
72
 
73
+ return;
74
+
73
75
  }
74
76
 
75
77
  if ( texData.image !== undefined ) {
@@ -74,7 +74,6 @@ class FileLoader extends Loader {
74
74
  * @param {function(any)} onLoad - Executed when the loading process has been finished.
75
75
  * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.
76
76
  * @param {onErrorCallback} [onError] - Executed when errors occur.
77
- * @return {any|undefined} The cached resource if available.
78
77
  */
79
78
  load( url, onLoad, onProgress, onError ) {
80
79
 
@@ -98,7 +97,7 @@ class FileLoader extends Loader {
98
97
 
99
98
  }, 0 );
100
99
 
101
- return cached;
100
+ return;
102
101
 
103
102
  }
104
103
 
@@ -86,6 +86,9 @@ class ImageBitmapLoader extends Loader {
86
86
  * Sets the given loader options. The structure of the object must match the `options` parameter of
87
87
  * [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap).
88
88
  *
89
+ * Note: When caching is enabled, the cache key is based on the URL only. Loading the same URL with
90
+ * different options will return the cached result of the first request.
91
+ *
89
92
  * @param {Object} options - The loader options to set.
90
93
  * @return {ImageBitmapLoader} A reference to this image bitmap loader.
91
94
  */
@@ -104,7 +107,6 @@ class ImageBitmapLoader extends Loader {
104
107
  * @param {function(ImageBitmap)} onLoad - Executed when the loading process has been finished.
105
108
  * @param {onProgressCallback} onProgress - Unsupported in this loader.
106
109
  * @param {onErrorCallback} onError - Executed when errors occur.
107
- * @return {ImageBitmap|undefined} The image bitmap.
108
110
  */
109
111
  load( url, onLoad, onProgress, onError ) {
110
112
 
@@ -142,8 +144,6 @@ class ImageBitmapLoader extends Loader {
142
144
 
143
145
  scope.manager.itemEnd( url );
144
146
 
145
- return imageBitmap;
146
-
147
147
  }
148
148
 
149
149
  } );
@@ -161,7 +161,7 @@ class ImageBitmapLoader extends Loader {
161
161
 
162
162
  }, 0 );
163
163
 
164
- return cached;
164
+ return;
165
165
 
166
166
  }
167
167
 
@@ -186,8 +186,6 @@ class ImageBitmapLoader extends Loader {
186
186
 
187
187
  scope.manager.itemEnd( url );
188
188
 
189
- return imageBitmap;
190
-
191
189
  } ).catch( function ( e ) {
192
190
 
193
191
  if ( onError ) onError( e );
@@ -215,7 +215,7 @@ class MaterialLoader extends Loader {
215
215
 
216
216
  if ( typeof json.vertexColors === 'number' ) {
217
217
 
218
- material.vertexColors = ( json.vertexColors > 0 ) ? true : false;
218
+ material.vertexColors = json.vertexColors > 0;
219
219
 
220
220
  } else {
221
221
 
@@ -67,6 +67,8 @@ import { Box3 } from '../math/Box3.js';
67
67
  import { Sphere } from '../math/Sphere.js';
68
68
  import { SphericalHarmonics3 } from '../math/SphericalHarmonics3.js';
69
69
 
70
+ const _customGeometries = {};
71
+
70
72
  /**
71
73
  * A loader for loading a JSON resource in the [JSON Object/Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4).
72
74
  * The files are internally loaded via {@link FileLoader}.
@@ -123,11 +125,11 @@ class ObjectLoader extends Loader {
123
125
 
124
126
  json = JSON.parse( text );
125
127
 
126
- } catch ( error ) {
128
+ } catch ( e ) {
127
129
 
128
- if ( onError !== undefined ) onError( error );
130
+ if ( onError !== undefined ) onError( e );
129
131
 
130
- error( 'ObjectLoader: Can\'t parse ' + url + '.', error.message );
132
+ error( 'ObjectLoader: Can\'t parse ' + url + '.', e.message );
131
133
 
132
134
  return;
133
135
 
@@ -277,6 +279,20 @@ class ObjectLoader extends Loader {
277
279
 
278
280
  }
279
281
 
282
+ /**
283
+ * Registers the given geometry at the internal
284
+ * geometry library.
285
+ *
286
+ * @static
287
+ * @param {string} type - The geometry type.
288
+ * @param {BufferGeometry.constructor} geometryClass - The geometry class.
289
+ */
290
+ static registerGeometry( type, geometryClass ) {
291
+
292
+ _customGeometries[ type ] = geometryClass;
293
+
294
+ }
295
+
280
296
  // internals
281
297
 
282
298
  parseShapes( json ) {
@@ -357,9 +373,13 @@ class ObjectLoader extends Loader {
357
373
 
358
374
  geometry = Geometries[ data.type ].fromJSON( data, shapes );
359
375
 
376
+ } else if ( data.type in _customGeometries ) {
377
+
378
+ geometry = _customGeometries[ data.type ].fromJSON( data, shapes );
379
+
360
380
  } else {
361
381
 
362
- warn( `ObjectLoader: Unsupported geometry type "${ data.type }"` );
382
+ warn( `ObjectLoader: Unknown geometry type "${ data.type }". Use .registerGeometry() before starting the deserialization process.` );
363
383
 
364
384
  }
365
385
 
@@ -739,6 +759,7 @@ class ObjectLoader extends Loader {
739
759
  if ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;
740
760
  if ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;
741
761
  if ( data.compareFunction !== undefined ) texture.compareFunction = data.compareFunction;
762
+ if ( data.normalized !== undefined ) texture.normalized = data.normalized;
742
763
 
743
764
  if ( data.userData !== undefined ) texture.userData = data.userData;
744
765
 
@@ -89,6 +89,24 @@ class NodeObjectLoader extends ObjectLoader {
89
89
 
90
90
  }
91
91
 
92
+ /**
93
+ * Async version of {@link NodeObjectLoader#parse}.
94
+ *
95
+ * @param {Object} json - The JSON definition
96
+ * @return {Promise<Object3D>} A Promise that resolves with the parsed 3D object.
97
+ */
98
+ async parseAsync( json ) {
99
+
100
+ this._nodesJSON = json.nodes;
101
+
102
+ const data = await super.parseAsync( json );
103
+
104
+ this._nodesJSON = null; // dispose
105
+
106
+ return data;
107
+
108
+ }
109
+
92
110
  /**
93
111
  * Parses the node objects from the given JSON and textures.
94
112
  *
@@ -57,7 +57,7 @@ class MeshToonMaterial extends Material {
57
57
 
58
58
  /**
59
59
  * Gradient map for toon shading. It's required to set
60
- * {@link Texture#minFilter} and {@link Texture#magFilter} to {@linkNearestFilter}
60
+ * {@link Texture#minFilter} and {@link Texture#magFilter} to {@link NearestFilter}
61
61
  * when using this type of texture.
62
62
  *
63
63
  * @type {?Texture}
@@ -537,6 +537,33 @@ class Line2NodeMaterial extends NodeMaterial {
537
537
 
538
538
  }
539
539
 
540
+ /**
541
+ * Copies the properties of the given material to this instance.
542
+ *
543
+ * @param {Line2NodeMaterial} source - The material to copy.
544
+ * @return {Line2NodeMaterial} A reference to this material.
545
+ */
546
+ copy( source ) {
547
+
548
+ super.copy( source );
549
+
550
+ this.vertexColors = source.vertexColors;
551
+ this.dashOffset = source.dashOffset;
552
+
553
+ this.lineColorNode = source.lineColorNode;
554
+ this.offsetNode = source.offsetNode;
555
+ this.dashScaleNode = source.dashScaleNode;
556
+ this.dashSizeNode = source.dashSizeNode;
557
+ this.gapSizeNode = source.gapSizeNode;
558
+
559
+ this._useDash = source._useDash;
560
+ this._useAlphaToCoverage = source._useAlphaToCoverage;
561
+ this._useWorldUnits = source._useWorldUnits;
562
+
563
+ return this;
564
+
565
+ }
566
+
540
567
  }
541
568
 
542
569
  export default Line2NodeMaterial;
@@ -25,7 +25,6 @@ import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
25
25
  import { vertexColor } from '../../nodes/accessors/VertexColorNode.js';
26
26
  import { premultiplyAlpha } from '../../nodes/display/BlendModes.js';
27
27
  import { subBuild } from '../../nodes/core/SubBuildNode.js';
28
- import { error } from '../../utils.js';
29
28
 
30
29
  /**
31
30
  * Base class for all node materials.
@@ -485,32 +484,6 @@ class NodeMaterial extends Material {
485
484
  const renderer = builder.renderer;
486
485
  const renderTarget = renderer.getRenderTarget();
487
486
 
488
- // < CONTEXT >
489
-
490
- if ( renderer.contextNode.isContextNode === true ) {
491
-
492
- builder.context = { ...builder.context, ...renderer.contextNode.getFlowContextData() };
493
-
494
- } else {
495
-
496
- error( 'NodeMaterial: "renderer.contextNode" must be an instance of `context()`.' );
497
-
498
- }
499
-
500
- if ( this.contextNode !== null ) {
501
-
502
- if ( this.contextNode.isContextNode === true ) {
503
-
504
- builder.context = { ...builder.context, ...this.contextNode.getFlowContextData() };
505
-
506
- } else {
507
-
508
- error( 'NodeMaterial: "material.contextNode" must be an instance of `context()`.' );
509
-
510
- }
511
-
512
- }
513
-
514
487
  // < VERTEX STAGE >
515
488
 
516
489
  builder.addStack();