@plastic-software/three 0.181.3 → 0.182.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 (253) hide show
  1. package/README.md +3 -4
  2. package/build/three.cjs +1192 -522
  3. package/build/three.core.js +345 -219
  4. package/build/three.core.min.js +1 -1
  5. package/build/three.module.js +864 -328
  6. package/build/three.module.min.js +1 -1
  7. package/build/three.tsl.js +15 -3
  8. package/build/three.tsl.min.js +1 -1
  9. package/build/three.webgpu.js +3660 -1545
  10. package/build/three.webgpu.min.js +1 -1
  11. package/build/three.webgpu.nodes.js +3659 -1544
  12. package/build/three.webgpu.nodes.min.js +1 -1
  13. package/examples/jsm/controls/MapControls.js +55 -1
  14. package/examples/jsm/controls/OrbitControls.js +6 -6
  15. package/examples/jsm/controls/TrackballControls.js +6 -6
  16. package/examples/jsm/csm/CSM.js +2 -1
  17. package/examples/jsm/environments/RoomEnvironment.js +2 -0
  18. package/examples/jsm/geometries/DecalGeometry.js +1 -1
  19. package/examples/jsm/helpers/LightProbeHelperGPU.js +1 -1
  20. package/examples/jsm/helpers/TextureHelperGPU.js +1 -1
  21. package/examples/jsm/inspector/Inspector.js +53 -9
  22. package/examples/jsm/inspector/RendererInspector.js +12 -2
  23. package/examples/jsm/inspector/tabs/Console.js +2 -2
  24. package/examples/jsm/inspector/tabs/Parameters.js +2 -2
  25. package/examples/jsm/inspector/tabs/Performance.js +2 -2
  26. package/examples/jsm/inspector/tabs/Viewer.js +4 -4
  27. package/examples/jsm/inspector/ui/Profiler.js +1836 -31
  28. package/examples/jsm/inspector/ui/Style.js +948 -13
  29. package/examples/jsm/inspector/ui/Tab.js +188 -1
  30. package/examples/jsm/inspector/ui/Values.js +17 -1
  31. package/examples/jsm/loaders/3DMLoader.js +5 -4
  32. package/examples/jsm/loaders/DRACOLoader.js +5 -5
  33. package/examples/jsm/loaders/FBXLoader.js +0 -2
  34. package/examples/jsm/loaders/HDRLoader.js +0 -1
  35. package/examples/jsm/loaders/KTX2Loader.js +16 -0
  36. package/examples/jsm/loaders/LDrawLoader.js +2 -3
  37. package/examples/jsm/loaders/PCDLoader.js +1 -0
  38. package/examples/jsm/loaders/SVGLoader.js +1 -1
  39. package/examples/jsm/loaders/TDSLoader.js +0 -2
  40. package/examples/jsm/loaders/TGALoader.js +0 -2
  41. package/examples/jsm/loaders/UltraHDRLoader.js +110 -137
  42. package/examples/jsm/loaders/VOXLoader.js +660 -117
  43. package/examples/jsm/loaders/VRMLLoader.js +2 -2
  44. package/examples/jsm/loaders/usd/USDCParser.js +1 -1
  45. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +1 -1
  46. package/examples/jsm/materials/MeshGouraudMaterial.js +0 -1
  47. package/examples/jsm/materials/WoodNodeMaterial.js +11 -11
  48. package/examples/jsm/math/Octree.js +131 -1
  49. package/examples/jsm/misc/Volume.js +0 -1
  50. package/examples/jsm/misc/VolumeSlice.js +0 -1
  51. package/examples/jsm/objects/SkyMesh.js +13 -3
  52. package/examples/jsm/physics/AmmoPhysics.js +12 -7
  53. package/examples/jsm/physics/JoltPhysics.js +3 -1
  54. package/examples/jsm/physics/RapierPhysics.js +3 -1
  55. package/examples/jsm/postprocessing/OutputPass.js +9 -0
  56. package/examples/jsm/postprocessing/RenderPass.js +10 -0
  57. package/examples/jsm/postprocessing/UnrealBloomPass.js +48 -18
  58. package/examples/jsm/renderers/Projector.js +268 -30
  59. package/examples/jsm/renderers/SVGRenderer.js +191 -58
  60. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +2 -4
  61. package/examples/jsm/transpiler/AST.js +44 -0
  62. package/examples/jsm/transpiler/GLSLDecoder.js +61 -4
  63. package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -0
  64. package/examples/jsm/transpiler/TSLEncoder.js +46 -3
  65. package/examples/jsm/transpiler/TranspilerUtils.js +3 -3
  66. package/examples/jsm/transpiler/WGSLEncoder.js +27 -0
  67. package/examples/jsm/tsl/display/AnaglyphPassNode.js +2 -0
  68. package/examples/jsm/tsl/display/BloomNode.js +11 -1
  69. package/examples/jsm/tsl/display/GTAONode.js +3 -2
  70. package/examples/jsm/tsl/display/PixelationPassNode.js +2 -1
  71. package/examples/jsm/tsl/display/SSGINode.js +7 -19
  72. package/examples/jsm/tsl/display/SSRNode.js +1 -1
  73. package/examples/jsm/tsl/display/SSSNode.js +4 -2
  74. package/examples/jsm/tsl/display/StereoCompositePassNode.js +8 -1
  75. package/examples/jsm/tsl/display/TRAANode.js +265 -114
  76. package/examples/jsm/tsl/display/radialBlur.js +68 -0
  77. package/examples/jsm/utils/ShadowMapViewer.js +24 -10
  78. package/examples/jsm/utils/ShadowMapViewerGPU.js +1 -1
  79. package/examples/jsm/utils/WebGPUTextureUtils.js +1 -1
  80. package/package.json +14 -12
  81. package/src/Three.Core.js +1 -0
  82. package/src/Three.TSL.js +14 -2
  83. package/src/animation/AnimationUtils.js +1 -12
  84. package/src/animation/KeyframeTrack.js +1 -1
  85. package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
  86. package/src/animation/tracks/ColorKeyframeTrack.js +1 -1
  87. package/src/animation/tracks/NumberKeyframeTrack.js +1 -1
  88. package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -1
  89. package/src/animation/tracks/StringKeyframeTrack.js +1 -1
  90. package/src/animation/tracks/VectorKeyframeTrack.js +1 -1
  91. package/src/constants.js +61 -5
  92. package/src/core/BufferGeometry.js +14 -2
  93. package/src/core/Raycaster.js +2 -2
  94. package/src/extras/PMREMGenerator.js +3 -10
  95. package/src/extras/TextureUtils.js +5 -1
  96. package/src/geometries/ExtrudeGeometry.js +2 -2
  97. package/src/geometries/PolyhedronGeometry.js +1 -1
  98. package/src/helpers/PointLightHelper.js +1 -1
  99. package/src/lights/DirectionalLight.js +13 -0
  100. package/src/lights/HemisphereLight.js +10 -0
  101. package/src/lights/Light.js +1 -11
  102. package/src/lights/LightProbe.js +0 -15
  103. package/src/lights/LightShadow.js +0 -3
  104. package/src/lights/PointLight.js +15 -0
  105. package/src/lights/PointLightShadow.js +0 -86
  106. package/src/lights/SpotLight.js +22 -1
  107. package/src/loaders/MaterialLoader.js +2 -1
  108. package/src/loaders/ObjectLoader.js +3 -1
  109. package/src/loaders/nodes/NodeLoader.js +2 -2
  110. package/src/materials/Material.js +2 -0
  111. package/src/materials/ShaderMaterial.js +20 -1
  112. package/src/materials/nodes/Line2NodeMaterial.js +2 -2
  113. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +3 -2
  114. package/src/materials/nodes/MeshStandardNodeMaterial.js +5 -4
  115. package/src/materials/nodes/NodeMaterial.js +59 -3
  116. package/src/materials/nodes/manager/NodeMaterialObserver.js +1 -1
  117. package/src/math/Matrix4.js +40 -40
  118. package/src/math/Sphere.js +1 -1
  119. package/src/math/Vector3.js +0 -2
  120. package/src/nodes/TSL.js +4 -1
  121. package/src/nodes/accessors/BatchNode.js +10 -10
  122. package/src/nodes/accessors/BufferAttributeNode.js +98 -12
  123. package/src/nodes/accessors/BufferNode.js +29 -2
  124. package/src/nodes/accessors/ClippingNode.js +4 -4
  125. package/src/nodes/accessors/CubeTextureNode.js +20 -1
  126. package/src/nodes/accessors/InstanceNode.js +69 -29
  127. package/src/nodes/accessors/MaterialNode.js +9 -1
  128. package/src/nodes/accessors/MaterialReferenceNode.js +1 -2
  129. package/src/nodes/accessors/ModelNode.js +1 -1
  130. package/src/nodes/accessors/Normal.js +2 -2
  131. package/src/nodes/accessors/ReferenceBaseNode.js +4 -4
  132. package/src/nodes/accessors/ReferenceNode.js +4 -4
  133. package/src/nodes/accessors/RendererReferenceNode.js +1 -2
  134. package/src/nodes/accessors/SkinningNode.js +15 -2
  135. package/src/nodes/accessors/StorageBufferNode.js +4 -2
  136. package/src/nodes/accessors/Tangent.js +1 -11
  137. package/src/nodes/accessors/Texture3DNode.js +26 -1
  138. package/src/nodes/accessors/UniformArrayNode.js +2 -2
  139. package/src/nodes/accessors/UserDataNode.js +1 -2
  140. package/src/nodes/accessors/VertexColorNode.js +1 -2
  141. package/src/nodes/code/FunctionNode.js +1 -2
  142. package/src/nodes/core/ArrayNode.js +20 -1
  143. package/src/nodes/core/AssignNode.js +2 -2
  144. package/src/nodes/core/AttributeNode.js +2 -2
  145. package/src/nodes/core/ContextNode.js +103 -4
  146. package/src/nodes/core/NodeBuilder.js +56 -14
  147. package/src/nodes/core/NodeFrame.js +12 -4
  148. package/src/nodes/core/NodeUtils.js +5 -5
  149. package/src/nodes/core/ParameterNode.js +1 -2
  150. package/src/nodes/core/PropertyNode.js +19 -3
  151. package/src/nodes/core/StackNode.js +56 -8
  152. package/src/nodes/core/StructNode.js +1 -2
  153. package/src/nodes/core/StructTypeNode.js +11 -17
  154. package/src/nodes/core/UniformNode.js +19 -4
  155. package/src/nodes/core/VarNode.js +46 -21
  156. package/src/nodes/display/NormalMapNode.js +37 -2
  157. package/src/nodes/display/PassNode.js +77 -7
  158. package/src/nodes/display/ScreenNode.js +1 -0
  159. package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +3 -3
  160. package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
  161. package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
  162. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +1 -1
  163. package/src/nodes/functions/PhysicalLightingModel.js +102 -43
  164. package/src/nodes/gpgpu/ComputeBuiltinNode.js +1 -2
  165. package/src/nodes/gpgpu/SubgroupFunctionNode.js +1 -1
  166. package/src/nodes/gpgpu/WorkgroupInfoNode.js +2 -3
  167. package/src/nodes/lighting/AnalyticLightNode.js +53 -0
  168. package/src/nodes/lighting/LightsNode.js +2 -2
  169. package/src/nodes/lighting/PointShadowNode.js +141 -140
  170. package/src/nodes/lighting/ShadowFilterNode.js +53 -37
  171. package/src/nodes/lighting/ShadowNode.js +53 -19
  172. package/src/nodes/math/BitcountNode.js +433 -0
  173. package/src/nodes/math/PackFloatNode.js +98 -0
  174. package/src/nodes/math/UnpackFloatNode.js +96 -0
  175. package/src/nodes/pmrem/PMREMNode.js +1 -1
  176. package/src/nodes/tsl/TSLCore.js +4 -4
  177. package/src/nodes/utils/ArrayElementNode.js +13 -0
  178. package/src/nodes/utils/EventNode.js +1 -2
  179. package/src/nodes/utils/Packing.js +13 -1
  180. package/src/nodes/utils/PostProcessingUtils.js +33 -1
  181. package/src/nodes/utils/ReflectorNode.js +1 -1
  182. package/src/nodes/utils/SampleNode.js +1 -1
  183. package/src/nodes/utils/UVUtils.js +26 -0
  184. package/src/objects/BatchedMesh.js +5 -2
  185. package/src/objects/Line.js +1 -1
  186. package/src/objects/Mesh.js +1 -1
  187. package/src/objects/Points.js +1 -1
  188. package/src/objects/Skeleton.js +9 -0
  189. package/src/renderers/WebGLRenderer.js +145 -33
  190. package/src/renderers/common/Backend.js +8 -0
  191. package/src/renderers/common/Background.js +19 -9
  192. package/src/renderers/common/Binding.js +11 -0
  193. package/src/renderers/common/Bindings.js +7 -7
  194. package/src/renderers/common/Buffer.js +40 -0
  195. package/src/renderers/common/ChainMap.js +30 -6
  196. package/src/renderers/common/Geometries.js +12 -0
  197. package/src/renderers/common/RenderContexts.js +8 -1
  198. package/src/renderers/common/RenderObject.js +14 -1
  199. package/src/renderers/common/Renderer.js +53 -35
  200. package/src/renderers/common/Textures.js +1 -1
  201. package/src/renderers/common/UniformsGroup.js +1 -0
  202. package/src/renderers/common/XRManager.js +1 -0
  203. package/src/renderers/common/extras/PMREMGenerator.js +2 -8
  204. package/src/renderers/common/nodes/NodeUniformBuffer.js +52 -0
  205. package/src/renderers/shaders/DFGLUTData.js +19 -34
  206. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +5 -2
  207. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +8 -4
  208. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +90 -51
  209. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +194 -186
  210. package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +1 -1
  211. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  212. package/src/renderers/shaders/ShaderChunk.js +3 -3
  213. package/src/renderers/shaders/ShaderLib/depth.glsl.js +3 -0
  214. package/src/renderers/shaders/ShaderLib/{distanceRGBA.glsl.js → distance.glsl.js} +1 -2
  215. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +0 -1
  216. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +1 -2
  217. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +0 -1
  218. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -9
  219. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +0 -1
  220. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +0 -1
  221. package/src/renderers/shaders/ShaderLib/vsm.glsl.js +4 -6
  222. package/src/renderers/shaders/ShaderLib.js +3 -3
  223. package/src/renderers/webgl/WebGLCapabilities.js +3 -4
  224. package/src/renderers/webgl/WebGLLights.js +18 -1
  225. package/src/renderers/webgl/WebGLOutput.js +267 -0
  226. package/src/renderers/webgl/WebGLProgram.js +43 -107
  227. package/src/renderers/webgl/WebGLPrograms.js +35 -45
  228. package/src/renderers/webgl/WebGLShadowMap.js +188 -25
  229. package/src/renderers/webgl/WebGLState.js +20 -20
  230. package/src/renderers/webgl/WebGLTextures.js +89 -28
  231. package/src/renderers/webgl/WebGLUniforms.js +40 -3
  232. package/src/renderers/webgl/WebGLUtils.js +6 -2
  233. package/src/renderers/webgl-fallback/WebGLBackend.js +79 -13
  234. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +59 -7
  235. package/src/renderers/webgl-fallback/utils/WebGLState.js +18 -3
  236. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +5 -3
  237. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +9 -9
  238. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +6 -2
  239. package/src/renderers/webgpu/WebGPUBackend.js +61 -4
  240. package/src/renderers/webgpu/WebGPURenderer.js +1 -1
  241. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +65 -23
  242. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +4 -17
  243. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +354 -186
  244. package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -0
  245. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +20 -7
  246. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +40 -17
  247. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +7 -7
  248. package/src/renderers/webgpu/utils/WebGPUUtils.js +7 -5
  249. package/src/textures/CubeDepthTexture.js +76 -0
  250. package/src/textures/Source.js +1 -1
  251. package/src/textures/Texture.js +1 -1
  252. package/src/utils.js +13 -1
  253. package/src/nodes/functions/BSDF/DFGApprox.js +0 -71
@@ -1,11 +1,43 @@
1
1
  import InputNode from '../core/InputNode.js';
2
- import { nodeObject, addMethodChaining } from '../tsl/TSLCore.js';
2
+ import { addMethodChaining, mat3, mat4 } from '../tsl/TSLCore.js';
3
3
  import { varying } from '../core/VaryingNode.js';
4
4
 
5
5
  import { InterleavedBufferAttribute } from '../../core/InterleavedBufferAttribute.js';
6
6
  import { InterleavedBuffer } from '../../core/InterleavedBuffer.js';
7
7
  import { StaticDrawUsage, DynamicDrawUsage } from '../../constants.js';
8
8
 
9
+ /**
10
+ * Internal buffer attribute library.
11
+ *
12
+ * @private
13
+ * @type {WeakMap<TypedArray, InterleavedBuffer>}
14
+ */
15
+ const _bufferLib = new WeakMap();
16
+
17
+ /**
18
+ * Internal method for retrieving or creating interleaved buffers.
19
+ *
20
+ * @private
21
+ * @param {TypedArray} value - The attribute data.
22
+ * @param {number} itemSize - The attribute item size.
23
+ * @returns {InterleavedBuffer} The interleaved buffer.
24
+ */
25
+ function _getBufferAttribute( value, itemSize ) {
26
+
27
+ let buffer = _bufferLib.get( value );
28
+
29
+ if ( buffer === undefined ) {
30
+
31
+ buffer = new InterleavedBuffer( value, itemSize );
32
+
33
+ _bufferLib.set( value, buffer );
34
+
35
+ }
36
+
37
+ return buffer;
38
+
39
+ }
40
+
9
41
  /**
10
42
  * In earlier `three.js` versions it was only possible to define attribute data
11
43
  * on geometry level. With `BufferAttributeNode`, it is also possible to do this
@@ -114,7 +146,7 @@ class BufferAttributeNode extends InputNode {
114
146
  */
115
147
  this.global = true;
116
148
 
117
- if ( value && value.isBufferAttribute === true ) {
149
+ if ( value && value.isBufferAttribute === true && value.itemSize <= 4 ) {
118
150
 
119
151
  this.attribute = value;
120
152
  this.usage = value.usage;
@@ -185,13 +217,30 @@ class BufferAttributeNode extends InputNode {
185
217
 
186
218
  if ( this.attribute !== null ) return;
187
219
 
220
+ //
221
+
188
222
  const type = this.getNodeType( builder );
189
- const array = this.value;
190
223
  const itemSize = builder.getTypeLength( type );
224
+ const value = this.value;
191
225
  const stride = this.bufferStride || itemSize;
192
226
  const offset = this.bufferOffset;
193
227
 
194
- const buffer = array.isInterleavedBuffer === true ? array : new InterleavedBuffer( array, stride );
228
+ let buffer;
229
+
230
+ if ( value.isInterleavedBuffer === true ) {
231
+
232
+ buffer = value;
233
+
234
+ } else if ( value.isBufferAttribute === true ) {
235
+
236
+ buffer = _getBufferAttribute( value.array, stride );
237
+
238
+ } else {
239
+
240
+ buffer = _getBufferAttribute( value, stride );
241
+
242
+ }
243
+
195
244
  const bufferAttribute = new InterleavedBufferAttribute( buffer, itemSize, offset );
196
245
 
197
246
  buffer.setUsage( this.usage );
@@ -284,6 +333,43 @@ class BufferAttributeNode extends InputNode {
284
333
 
285
334
  export default BufferAttributeNode;
286
335
 
336
+ /**
337
+ * Internal method for creating buffer attribute nodes.
338
+ *
339
+ * @private
340
+ * @param {BufferAttribute|InterleavedBuffer|TypedArray} array - The attribute data.
341
+ * @param {?string} [type=null] - The buffer type (e.g. `'vec3'`).
342
+ * @param {number} [stride=0] - The buffer stride.
343
+ * @param {number} [offset=0] - The buffer offset.
344
+ * @param {number} [usage=StaticDrawUsage] - The buffer usage.
345
+ * @param {boolean} [instanced=false] - Whether the buffer is instanced.
346
+ * @returns {BufferAttributeNode|Node} The buffer attribute node.
347
+ */
348
+ function createBufferAttribute( array, type = null, stride = 0, offset = 0, usage = StaticDrawUsage, instanced = false ) {
349
+
350
+ if ( type === 'mat3' || ( type === null && array.itemSize === 9 ) ) {
351
+
352
+ return mat3(
353
+ new BufferAttributeNode( array, 'vec3', 9, 0 ).setUsage( usage ).setInstanced( instanced ),
354
+ new BufferAttributeNode( array, 'vec3', 9, 3 ).setUsage( usage ).setInstanced( instanced ),
355
+ new BufferAttributeNode( array, 'vec3', 9, 6 ).setUsage( usage ).setInstanced( instanced )
356
+ );
357
+
358
+ } else if ( type === 'mat4' || ( type === null && array.itemSize === 16 ) ) {
359
+
360
+ return mat4(
361
+ new BufferAttributeNode( array, 'vec4', 16, 0 ).setUsage( usage ).setInstanced( instanced ),
362
+ new BufferAttributeNode( array, 'vec4', 16, 4 ).setUsage( usage ).setInstanced( instanced ),
363
+ new BufferAttributeNode( array, 'vec4', 16, 8 ).setUsage( usage ).setInstanced( instanced ),
364
+ new BufferAttributeNode( array, 'vec4', 16, 12 ).setUsage( usage ).setInstanced( instanced )
365
+ );
366
+
367
+ }
368
+
369
+ return new BufferAttributeNode( array, type, stride, offset );
370
+
371
+ }
372
+
287
373
  /**
288
374
  * TSL function for creating a buffer attribute node.
289
375
  *
@@ -293,9 +379,9 @@ export default BufferAttributeNode;
293
379
  * @param {?string} [type=null] - The buffer type (e.g. `'vec3'`).
294
380
  * @param {number} [stride=0] - The buffer stride.
295
381
  * @param {number} [offset=0] - The buffer offset.
296
- * @returns {BufferAttributeNode}
382
+ * @returns {BufferAttributeNode|Node}
297
383
  */
298
- export const bufferAttribute = ( array, type = null, stride = 0, offset = 0 ) => nodeObject( new BufferAttributeNode( array, type, stride, offset ) );
384
+ export const bufferAttribute = ( array, type = null, stride = 0, offset = 0 ) => createBufferAttribute( array, type, stride, offset );
299
385
 
300
386
  /**
301
387
  * TSL function for creating a buffer attribute node but with dynamic draw usage.
@@ -307,9 +393,9 @@ export const bufferAttribute = ( array, type = null, stride = 0, offset = 0 ) =>
307
393
  * @param {?string} [type=null] - The buffer type (e.g. `'vec3'`).
308
394
  * @param {number} [stride=0] - The buffer stride.
309
395
  * @param {number} [offset=0] - The buffer offset.
310
- * @returns {BufferAttributeNode}
396
+ * @returns {BufferAttributeNode|Node}
311
397
  */
312
- export const dynamicBufferAttribute = ( array, type = null, stride = 0, offset = 0 ) => bufferAttribute( array, type, stride, offset ).setUsage( DynamicDrawUsage );
398
+ export const dynamicBufferAttribute = ( array, type = null, stride = 0, offset = 0 ) => createBufferAttribute( array, type, stride, offset, DynamicDrawUsage );
313
399
 
314
400
  /**
315
401
  * TSL function for creating a buffer attribute node but with enabled instancing
@@ -320,9 +406,9 @@ export const dynamicBufferAttribute = ( array, type = null, stride = 0, offset =
320
406
  * @param {?string} [type=null] - The buffer type (e.g. `'vec3'`).
321
407
  * @param {number} [stride=0] - The buffer stride.
322
408
  * @param {number} [offset=0] - The buffer offset.
323
- * @returns {BufferAttributeNode}
409
+ * @returns {BufferAttributeNode|Node}
324
410
  */
325
- export const instancedBufferAttribute = ( array, type = null, stride = 0, offset = 0 ) => bufferAttribute( array, type, stride, offset ).setInstanced( true );
411
+ export const instancedBufferAttribute = ( array, type = null, stride = 0, offset = 0 ) => createBufferAttribute( array, type, stride, offset, StaticDrawUsage, true );
326
412
 
327
413
  /**
328
414
  * TSL function for creating a buffer attribute node but with dynamic draw usage and enabled instancing
@@ -333,8 +419,8 @@ export const instancedBufferAttribute = ( array, type = null, stride = 0, offset
333
419
  * @param {?string} [type=null] - The buffer type (e.g. `'vec3'`).
334
420
  * @param {number} [stride=0] - The buffer stride.
335
421
  * @param {number} [offset=0] - The buffer offset.
336
- * @returns {BufferAttributeNode}
422
+ * @returns {BufferAttributeNode|Node}
337
423
  */
338
- export const instancedDynamicBufferAttribute = ( array, type = null, stride = 0, offset = 0 ) => dynamicBufferAttribute( array, type, stride, offset ).setInstanced( true );
424
+ export const instancedDynamicBufferAttribute = ( array, type = null, stride = 0, offset = 0 ) => createBufferAttribute( array, type, stride, offset, DynamicDrawUsage, true );
339
425
 
340
426
  addMethodChaining( 'toAttribute', ( bufferNode ) => bufferAttribute( bufferNode.value ) );
@@ -1,5 +1,4 @@
1
1
  import UniformNode from '../core/UniformNode.js';
2
- import { nodeObject } from '../tsl/TSLBase.js';
3
2
 
4
3
  /**
5
4
  * A special type of uniform node which represents array-like data
@@ -58,6 +57,34 @@ class BufferNode extends UniformNode {
58
57
  */
59
58
  this.bufferCount = bufferCount;
60
59
 
60
+ /**
61
+ * An array of update ranges.
62
+ *
63
+ * @type {Array<{start: number, count: number}>}
64
+ */
65
+ this.updateRanges = [];
66
+
67
+ }
68
+
69
+ /**
70
+ * Adds a range of data in the data array to be updated on the GPU.
71
+ *
72
+ * @param {number} start - Position at which to start update.
73
+ * @param {number} count - The number of components to update.
74
+ */
75
+ addUpdateRange( start, count ) {
76
+
77
+ this.updateRanges.push( { start, count } );
78
+
79
+ }
80
+
81
+ /**
82
+ * Clears the update ranges.
83
+ */
84
+ clearUpdateRanges() {
85
+
86
+ this.updateRanges.length = 0;
87
+
61
88
  }
62
89
 
63
90
  /**
@@ -98,4 +125,4 @@ export default BufferNode;
98
125
  * @param {number} count - The count of buffer elements.
99
126
  * @returns {BufferNode}
100
127
  */
101
- export const buffer = ( value, type, count ) => nodeObject( new BufferNode( value, type, count ) );
128
+ export const buffer = ( value, type, count ) => new BufferNode( value, type, count );
@@ -1,6 +1,6 @@
1
1
 
2
2
  import Node from '../core/Node.js';
3
- import { nodeObject, Fn, bool, float } from '../tsl/TSLBase.js';
3
+ import { Fn, bool, float } from '../tsl/TSLBase.js';
4
4
  import { positionView } from './Position.js';
5
5
  import { diffuseColor } from '../core/PropertyNode.js';
6
6
  import { Loop } from '../utils/LoopNode.js';
@@ -234,7 +234,7 @@ export default ClippingNode;
234
234
  * @function
235
235
  * @returns {ClippingNode}
236
236
  */
237
- export const clipping = () => nodeObject( new ClippingNode() );
237
+ export const clipping = () => new ClippingNode();
238
238
 
239
239
  /**
240
240
  * TSL function for setting up alpha to coverage.
@@ -243,7 +243,7 @@ export const clipping = () => nodeObject( new ClippingNode() );
243
243
  * @function
244
244
  * @returns {ClippingNode}
245
245
  */
246
- export const clippingAlpha = () => nodeObject( new ClippingNode( ClippingNode.ALPHA_TO_COVERAGE ) );
246
+ export const clippingAlpha = () => new ClippingNode( ClippingNode.ALPHA_TO_COVERAGE );
247
247
 
248
248
  /**
249
249
  * TSL function for setting up hardware-based clipping.
@@ -252,4 +252,4 @@ export const clippingAlpha = () => nodeObject( new ClippingNode( ClippingNode.AL
252
252
  * @function
253
253
  * @returns {ClippingNode}
254
254
  */
255
- export const hardwareClipping = () => nodeObject( new ClippingNode( ClippingNode.HARDWARE ) );
255
+ export const hardwareClipping = () => new ClippingNode( ClippingNode.HARDWARE );
@@ -47,13 +47,19 @@ class CubeTextureNode extends TextureNode {
47
47
  }
48
48
 
49
49
  /**
50
- * Overwrites the default implementation to return a fixed value `'cubeTexture'`.
50
+ * Overwrites the default implementation to return the appropriate cube texture type.
51
51
  *
52
52
  * @param {NodeBuilder} builder - The current node builder.
53
53
  * @return {string} The input type.
54
54
  */
55
55
  getInputType( /*builder*/ ) {
56
56
 
57
+ if ( this.value.isDepthTexture === true ) {
58
+
59
+ return 'cubeDepthTexture';
60
+
61
+ }
62
+
57
63
  return 'cubeTexture';
58
64
 
59
65
  }
@@ -105,6 +111,19 @@ class CubeTextureNode extends TextureNode {
105
111
 
106
112
  const texture = this.value;
107
113
 
114
+ // Depth textures (shadow maps) - no environment rotation, Y flip for WebGPU
115
+ if ( texture.isDepthTexture === true ) {
116
+
117
+ if ( builder.renderer.coordinateSystem === WebGPUCoordinateSystem ) {
118
+
119
+ return vec3( uvNode.x, uvNode.y.negate(), uvNode.z );
120
+
121
+ }
122
+
123
+ return uvNode;
124
+
125
+ }
126
+
108
127
  if ( builder.renderer.coordinateSystem === WebGPUCoordinateSystem || ! texture.isRenderTargetTexture ) {
109
128
 
110
129
  uvNode = vec3( uvNode.x.negate(), uvNode.yz );
@@ -6,6 +6,7 @@ import { positionLocal } from './Position.js';
6
6
  import { nodeProxy, vec3, mat4 } from '../tsl/TSLBase.js';
7
7
  import { NodeUpdateType } from '../core/constants.js';
8
8
  import { buffer } from '../accessors/BufferNode.js';
9
+ import { storage } from './StorageBufferNode.js';
9
10
  import { instanceIndex } from '../core/IndexNode.js';
10
11
 
11
12
  import { InstancedInterleavedBuffer } from '../../core/InstancedInterleavedBuffer.js';
@@ -32,8 +33,8 @@ class InstanceNode extends Node {
32
33
  * Constructs a new instance node.
33
34
  *
34
35
  * @param {number} count - The number of instances.
35
- * @param {InstancedBufferAttribute} instanceMatrix - Instanced buffer attribute representing the instance transformations.
36
- * @param {?InstancedBufferAttribute} instanceColor - Instanced buffer attribute representing the instance colors.
36
+ * @param {InstancedBufferAttribute|StorageInstancedBufferAttribute} instanceMatrix - Instanced buffer attribute representing the instance transformations.
37
+ * @param {?InstancedBufferAttribute|StorageInstancedBufferAttribute} instanceColor - Instanced buffer attribute representing the instance colors.
37
38
  */
38
39
  constructor( count, instanceMatrix, instanceColor = null ) {
39
40
 
@@ -100,6 +101,32 @@ class InstanceNode extends Node {
100
101
 
101
102
  }
102
103
 
104
+ /**
105
+ * Tracks whether the matrix data is provided via a storage buffer.
106
+ *
107
+ * @type {boolean}
108
+ */
109
+ get isStorageMatrix() {
110
+
111
+ const { instanceMatrix } = this;
112
+
113
+ return instanceMatrix && instanceMatrix.isStorageInstancedBufferAttribute === true;
114
+
115
+ }
116
+
117
+ /**
118
+ * Tracks whether the color data is provided via a storage buffer.
119
+ *
120
+ * @type {boolean}
121
+ */
122
+ get isStorageColor() {
123
+
124
+ const { instanceColor } = this;
125
+
126
+ return instanceColor && instanceColor.isStorageInstancedBufferAttribute === true;
127
+
128
+ }
129
+
103
130
  /**
104
131
  * Setups the internal buffers and nodes and assigns the transformed vertex data
105
132
  * to predefined node variables for accumulation. That follows the same patterns
@@ -109,7 +136,7 @@ class InstanceNode extends Node {
109
136
  */
110
137
  setup( builder ) {
111
138
 
112
- const { instanceMatrix, instanceColor } = this;
139
+ const { instanceMatrix, instanceColor, isStorageMatrix, isStorageColor } = this;
113
140
 
114
141
  const { count } = instanceMatrix;
115
142
 
@@ -117,29 +144,36 @@ class InstanceNode extends Node {
117
144
 
118
145
  if ( instanceMatrixNode === null ) {
119
146
 
120
- // Both WebGPU and WebGL backends have UBO max limited to 64kb. Matrix count number bigger than 1000 ( 16 * 4 * 1000 = 64kb ) will fallback to attribute.
121
-
122
- if ( count <= 1000 ) {
147
+ if ( isStorageMatrix ) {
123
148
 
124
- instanceMatrixNode = buffer( instanceMatrix.array, 'mat4', Math.max( count, 1 ) ).element( instanceIndex );
149
+ instanceMatrixNode = storage( instanceMatrix, 'mat4', Math.max( count, 1 ) ).element( instanceIndex );
125
150
 
126
151
  } else {
127
152
 
128
- const buffer = new InstancedInterleavedBuffer( instanceMatrix.array, 16, 1 );
153
+ // Both backends have ~64kb UBO limit; fallback to attributes above 1000 matrices.
154
+
155
+ if ( count <= 1000 ) {
156
+
157
+ instanceMatrixNode = buffer( instanceMatrix.array, 'mat4', Math.max( count, 1 ) ).element( instanceIndex );
158
+
159
+ } else {
160
+
161
+ const interleaved = new InstancedInterleavedBuffer( instanceMatrix.array, 16, 1 );
162
+
163
+ this.buffer = interleaved;
129
164
 
130
- this.buffer = buffer;
165
+ const bufferFn = instanceMatrix.usage === DynamicDrawUsage ? instancedDynamicBufferAttribute : instancedBufferAttribute;
131
166
 
132
- const bufferFn = instanceMatrix.usage === DynamicDrawUsage ? instancedDynamicBufferAttribute : instancedBufferAttribute;
167
+ const instanceBuffers = [
168
+ bufferFn( interleaved, 'vec4', 16, 0 ),
169
+ bufferFn( interleaved, 'vec4', 16, 4 ),
170
+ bufferFn( interleaved, 'vec4', 16, 8 ),
171
+ bufferFn( interleaved, 'vec4', 16, 12 )
172
+ ];
133
173
 
134
- const instanceBuffers = [
135
- // F.Signature -> bufferAttribute( array, type, stride, offset )
136
- bufferFn( buffer, 'vec4', 16, 0 ),
137
- bufferFn( buffer, 'vec4', 16, 4 ),
138
- bufferFn( buffer, 'vec4', 16, 8 ),
139
- bufferFn( buffer, 'vec4', 16, 12 )
140
- ];
174
+ instanceMatrixNode = mat4( ...instanceBuffers );
141
175
 
142
- instanceMatrixNode = mat4( ...instanceBuffers );
176
+ }
143
177
 
144
178
  }
145
179
 
@@ -149,13 +183,21 @@ class InstanceNode extends Node {
149
183
 
150
184
  if ( instanceColor && instanceColorNode === null ) {
151
185
 
152
- const buffer = new InstancedBufferAttribute( instanceColor.array, 3 );
186
+ if ( isStorageColor ) {
153
187
 
154
- const bufferFn = instanceColor.usage === DynamicDrawUsage ? instancedDynamicBufferAttribute : instancedBufferAttribute;
188
+ instanceColorNode = storage( instanceColor, 'vec3', Math.max( instanceColor.count, 1 ) ).element( instanceIndex );
155
189
 
156
- this.bufferColor = buffer;
190
+ } else {
191
+
192
+ const bufferAttribute = new InstancedBufferAttribute( instanceColor.array, 3 );
193
+
194
+ const bufferFn = instanceColor.usage === DynamicDrawUsage ? instancedDynamicBufferAttribute : instancedBufferAttribute;
195
+
196
+ this.bufferColor = bufferAttribute;
157
197
 
158
- instanceColorNode = vec3( bufferFn( buffer, 'vec3', 3, 0 ) );
198
+ instanceColorNode = vec3( bufferFn( bufferAttribute, 'vec3', 3, 0 ) );
199
+
200
+ }
159
201
 
160
202
  this.instanceColorNode = instanceColorNode;
161
203
 
@@ -189,15 +231,13 @@ class InstanceNode extends Node {
189
231
  }
190
232
 
191
233
  /**
192
- * Checks if the internal buffers required an update.
234
+ * Checks if the internal buffers require an update.
193
235
  *
194
236
  * @param {NodeFrame} frame - The current node frame.
195
237
  */
196
238
  update( /*frame*/ ) {
197
239
 
198
- if ( this.buffer !== null ) {
199
-
200
- // keep update ranges in sync
240
+ if ( this.buffer !== null && this.isStorageMatrix !== true ) {
201
241
 
202
242
  this.buffer.clearUpdateRanges();
203
243
  this.buffer.updateRanges.push( ... this.instanceMatrix.updateRanges );
@@ -212,7 +252,7 @@ class InstanceNode extends Node {
212
252
 
213
253
  }
214
254
 
215
- if ( this.instanceColor && this.bufferColor !== null ) {
255
+ if ( this.instanceColor && this.bufferColor !== null && this.isStorageColor !== true ) {
216
256
 
217
257
  this.bufferColor.clearUpdateRanges();
218
258
  this.bufferColor.updateRanges.push( ... this.instanceColor.updateRanges );
@@ -237,8 +277,8 @@ export default InstanceNode;
237
277
  * @tsl
238
278
  * @function
239
279
  * @param {number} count - The number of instances.
240
- * @param {InstancedBufferAttribute} instanceMatrix - Instanced buffer attribute representing the instance transformations.
241
- * @param {?InstancedBufferAttribute} instanceColor - Instanced buffer attribute representing the instance colors.
280
+ * @param {InstancedBufferAttribute|StorageInstancedBufferAttribute} instanceMatrix - Instanced buffer attribute representing the instance transformations.
281
+ * @param {?InstancedBufferAttribute|StorageInstancedBufferAttribute} instanceColor - Instanced buffer attribute representing the instance colors.
242
282
  * @returns {InstanceNode}
243
283
  */
244
284
  export const instance = /*@__PURE__*/ nodeProxy( InstanceNode ).setParameterLength( 2, 3 );
@@ -7,6 +7,8 @@ import { uniform } from '../core/UniformNode.js';
7
7
  import { normalMap } from '../display/NormalMapNode.js';
8
8
  import { bumpMap } from '../display/BumpMapNode.js';
9
9
  import { Vector2 } from '../../math/Vector2.js';
10
+ import { RGFormat, RED_GREEN_RGTC2_Format, RG11_EAC_Format, NormalRGPacking } from '../../constants.js';
11
+
10
12
 
11
13
  const _propertyCache = new Map();
12
14
 
@@ -235,6 +237,12 @@ class MaterialNode extends Node {
235
237
  node = normalMap( this.getTexture( 'normal' ), this.getCache( 'normalScale', 'vec2' ) );
236
238
  node.normalMapType = material.normalMapType;
237
239
 
240
+ if ( material.normalMap.format == RGFormat || material.normalMap.format == RED_GREEN_RGTC2_Format || material.normalMap.format == RG11_EAC_Format ) {
241
+
242
+ node.unpackNormalMode = NormalRGPacking;
243
+
244
+ }
245
+
238
246
  } else if ( material.bumpMap ) {
239
247
 
240
248
  node = bumpMap( this.getTexture( 'bump' ).r, this.getFloat( 'bumpScale' ) );
@@ -313,7 +321,7 @@ class MaterialNode extends Node {
313
321
 
314
322
  }
315
323
 
316
- node = node.clamp( 0.07, 1.0 );
324
+ node = node.clamp( 0.0001, 1.0 );
317
325
 
318
326
  } else if ( scope === MaterialNode.ANISOTROPY ) {
319
327
 
@@ -1,5 +1,4 @@
1
1
  import ReferenceNode from './ReferenceNode.js';
2
- import { nodeObject } from '../tsl/TSLBase.js';
3
2
 
4
3
  /**
5
4
  * This node is a special type of reference node which is intended
@@ -82,4 +81,4 @@ export default MaterialReferenceNode;
82
81
  * When no material is set, the node refers to the material of the current rendered object.
83
82
  * @returns {MaterialReferenceNode}
84
83
  */
85
- export const materialReference = ( name, type, material = null ) => nodeObject( new MaterialReferenceNode( name, type, material ) );
84
+ export const materialReference = ( name, type, material = null ) => new MaterialReferenceNode( name, type, material );
@@ -123,7 +123,7 @@ export const modelWorldMatrixInverse = /*@__PURE__*/ uniform( new Matrix4() ).on
123
123
  */
124
124
  export const modelViewMatrix = /*@__PURE__*/ ( Fn( ( builder ) => {
125
125
 
126
- return builder.renderer.overrideNodes.modelViewMatrix || mediumpModelViewMatrix;
126
+ return builder.context.modelViewMatrix || mediumpModelViewMatrix;
127
127
 
128
128
  } ).once() )().toVar( 'modelViewMatrix' );
129
129
 
@@ -182,9 +182,9 @@ export const transformNormal = /*@__PURE__*/ Fn( ( [ normal, matrix = modelWorld
182
182
  */
183
183
  export const transformNormalToView = /*@__PURE__*/ Fn( ( [ normal ], builder ) => {
184
184
 
185
- const modelNormalViewMatrix = builder.renderer.overrideNodes.modelNormalViewMatrix;
185
+ const modelNormalViewMatrix = builder.context.modelNormalViewMatrix;
186
186
 
187
- if ( modelNormalViewMatrix !== null ) {
187
+ if ( modelNormalViewMatrix ) {
188
188
 
189
189
  return modelNormalViewMatrix.transformDirection( normal );
190
190
 
@@ -4,7 +4,7 @@ import { uniform } from '../core/UniformNode.js';
4
4
  import { nodeObject } from '../tsl/TSLCore.js';
5
5
  import ArrayElementNode from '../utils/ArrayElementNode.js';
6
6
 
7
- // TODO: Avoid duplicated code and ues only ReferenceBaseNode or ReferenceNode
7
+ // TODO: Avoid duplicated code and use only ReferenceBaseNode or ReferenceNode
8
8
 
9
9
  /**
10
10
  * This class is only relevant if the referenced property is array-like.
@@ -199,7 +199,7 @@ class ReferenceBaseNode extends Node {
199
199
  */
200
200
  element( indexNode ) {
201
201
 
202
- return nodeObject( new ReferenceElementNode( this, nodeObject( indexNode ) ) );
202
+ return new ReferenceElementNode( this, nodeObject( indexNode ) );
203
203
 
204
204
  }
205
205
 
@@ -340,7 +340,7 @@ export default ReferenceBaseNode;
340
340
  * @param {Object} object - The object the property belongs to.
341
341
  * @returns {ReferenceBaseNode}
342
342
  */
343
- export const reference = ( name, type, object ) => nodeObject( new ReferenceBaseNode( name, type, object ) );
343
+ export const reference = ( name, type, object ) => new ReferenceBaseNode( name, type, object );
344
344
 
345
345
  /**
346
346
  * TSL function for creating a reference base node. Use this function if you want need a reference
@@ -354,4 +354,4 @@ export const reference = ( name, type, object ) => nodeObject( new ReferenceBase
354
354
  * @param {Object} [object] - An array-like object the property belongs to.
355
355
  * @returns {ReferenceBaseNode}
356
356
  */
357
- export const referenceBuffer = ( name, type, count, object ) => nodeObject( new ReferenceBaseNode( name, type, object, count ) );
357
+ export const referenceBuffer = ( name, type, count, object ) => new ReferenceBaseNode( name, type, object, count );
@@ -9,7 +9,7 @@ import { uniformArray } from './UniformArrayNode.js';
9
9
  import ArrayElementNode from '../utils/ArrayElementNode.js';
10
10
  import { warn } from '../../utils.js';
11
11
 
12
- // TODO: Avoid duplicated code and ues only ReferenceBaseNode or ReferenceNode
12
+ // TODO: Avoid duplicated code and use only ReferenceBaseNode or ReferenceNode
13
13
 
14
14
  /**
15
15
  * This class is only relevant if the referenced property is array-like.
@@ -198,7 +198,7 @@ class ReferenceNode extends Node {
198
198
  */
199
199
  element( indexNode ) {
200
200
 
201
- return nodeObject( new ReferenceElementNode( this, nodeObject( indexNode ) ) );
201
+ return new ReferenceElementNode( this, nodeObject( indexNode ) );
202
202
 
203
203
  }
204
204
 
@@ -407,7 +407,7 @@ export default ReferenceNode;
407
407
  * @param {?Object} [object] - The object the property belongs to.
408
408
  * @returns {ReferenceNode}
409
409
  */
410
- export const reference = ( name, type, object ) => nodeObject( new ReferenceNode( name, type, object ) );
410
+ export const reference = ( name, type, object ) => new ReferenceNode( name, type, object );
411
411
 
412
412
  /**
413
413
  * TSL function for creating a reference node. Use this function if you want need a reference
@@ -421,4 +421,4 @@ export const reference = ( name, type, object ) => nodeObject( new ReferenceNode
421
421
  * @param {Object} object - An array-like object the property belongs to.
422
422
  * @returns {ReferenceNode}
423
423
  */
424
- export const referenceBuffer = ( name, type, count, object ) => nodeObject( new ReferenceNode( name, type, object, count ) );
424
+ export const referenceBuffer = ( name, type, count, object ) => new ReferenceNode( name, type, object, count );
@@ -1,5 +1,4 @@
1
1
  import ReferenceBaseNode from './ReferenceBaseNode.js';
2
- import { nodeObject } from '../tsl/TSLCore.js';
3
2
  import { renderGroup } from '../core/UniformGroupNode.js';
4
3
 
5
4
  /**
@@ -76,4 +75,4 @@ export default RendererReferenceNode;
76
75
  * the node refers to the renderer of the current state.
77
76
  * @returns {RendererReferenceNode}
78
77
  */
79
- export const rendererReference = ( name, type, renderer = null ) => nodeObject( new RendererReferenceNode( name, type, renderer ) );
78
+ export const rendererReference = ( name, type, renderer = null ) => new RendererReferenceNode( name, type, renderer );
@@ -282,7 +282,20 @@ class SkinningNode extends Node {
282
282
 
283
283
  _frameId.set( skeleton, frame.frameId );
284
284
 
285
- if ( this.previousBoneMatricesNode !== null ) skeleton.previousBoneMatrices.set( skeleton.boneMatrices );
285
+ if ( this.previousBoneMatricesNode !== null ) {
286
+
287
+ if ( skeleton.previousBoneMatrices === null ) {
288
+
289
+ // cloned skeletons miss "previousBoneMatrices" in their first updated
290
+
291
+ skeleton.previousBoneMatrices = new Float32Array( skeleton.boneMatrices );
292
+
293
+ }
294
+
295
+ skeleton.previousBoneMatrices.set( skeleton.boneMatrices );
296
+
297
+
298
+ }
286
299
 
287
300
  skeleton.update();
288
301
 
@@ -300,7 +313,7 @@ export default SkinningNode;
300
313
  * @param {SkinnedMesh} skinnedMesh - The skinned mesh.
301
314
  * @returns {SkinningNode}
302
315
  */
303
- export const skinning = ( skinnedMesh ) => nodeObject( new SkinningNode( skinnedMesh ) );
316
+ export const skinning = ( skinnedMesh ) => new SkinningNode( skinnedMesh );
304
317
 
305
318
  /**
306
319
  * TSL function for computing skinning.