super-three 0.184.0 → 0.185.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 (366) hide show
  1. package/build/three.cjs +1260 -927
  2. package/build/three.core.js +1104 -829
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +156 -98
  5. package/build/three.module.min.js +1 -1
  6. package/build/three.tsl.js +11 -4
  7. package/build/three.tsl.min.js +1 -1
  8. package/build/three.webgpu.js +7538 -3367
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +7538 -3366
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/jsm/Addons.js +3 -0
  13. package/examples/jsm/controls/ArcballControls.js +6 -2
  14. package/examples/jsm/controls/FirstPersonControls.js +79 -42
  15. package/examples/jsm/controls/TransformControls.js +68 -15
  16. package/examples/jsm/csm/CSMFrustum.js +31 -6
  17. package/examples/jsm/csm/CSMShadowNode.js +4 -1
  18. package/examples/jsm/effects/AsciiEffect.js +14 -1
  19. package/examples/jsm/exporters/DRACOExporter.js +27 -6
  20. package/examples/jsm/exporters/GLTFExporter.js +114 -12
  21. package/examples/jsm/exporters/PLYExporter.js +286 -73
  22. package/examples/jsm/exporters/USDZExporter.js +347 -112
  23. package/examples/jsm/generators/CityGenerator.js +346 -0
  24. package/examples/jsm/generators/ForestGenerator.js +347 -0
  25. package/examples/jsm/generators/TerrainGenerator.js +504 -0
  26. package/examples/jsm/generators/TreeGenerator.js +377 -0
  27. package/examples/jsm/generators/city/SidewalkGenerator.js +253 -0
  28. package/examples/jsm/generators/city/SkyscraperGenerator.js +1357 -0
  29. package/examples/jsm/geometries/LoftGeometry.js +355 -0
  30. package/examples/jsm/helpers/LightProbeGridHelper.js +1 -1
  31. package/examples/jsm/helpers/LightProbeHelper.js +5 -4
  32. package/examples/jsm/helpers/ViewHelper.js +16 -6
  33. package/examples/jsm/inspector/Inspector.js +53 -15
  34. package/examples/jsm/inspector/RendererInspector.js +152 -36
  35. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +1 -1
  36. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +1 -1
  37. package/examples/jsm/inspector/tabs/Console.js +200 -18
  38. package/examples/jsm/inspector/tabs/Memory.js +8 -0
  39. package/examples/jsm/inspector/tabs/Parameters.js +64 -4
  40. package/examples/jsm/inspector/tabs/Performance.js +21 -6
  41. package/examples/jsm/inspector/tabs/Settings.js +51 -9
  42. package/examples/jsm/inspector/tabs/Timeline.js +178 -93
  43. package/examples/jsm/inspector/tabs/Viewer.js +628 -16
  44. package/examples/jsm/inspector/ui/Graph.js +162 -25
  45. package/examples/jsm/inspector/ui/Item.js +92 -13
  46. package/examples/jsm/inspector/ui/List.js +1 -1
  47. package/examples/jsm/inspector/ui/Profiler.js +90 -45
  48. package/examples/jsm/inspector/ui/Style.js +1788 -1401
  49. package/examples/jsm/inspector/ui/Tab.js +5 -3
  50. package/examples/jsm/inspector/ui/Values.js +71 -6
  51. package/examples/jsm/inspector/ui/utils.js +130 -10
  52. package/examples/jsm/libs/basis/README.md +0 -1
  53. package/examples/jsm/libs/demuxer_mp4.js +3 -3
  54. package/examples/jsm/libs/draco/README.md +0 -1
  55. package/examples/jsm/libs/meshopt_clusterizer.module.js +421 -0
  56. package/examples/jsm/libs/meshopt_simplifier.module.js +627 -0
  57. package/examples/jsm/libs/mikktspace.module.js +34 -9
  58. package/examples/jsm/lighting/ClusteredLighting.js +55 -0
  59. package/examples/jsm/lighting/LightProbeGrid.js +106 -76
  60. package/examples/jsm/lines/LineMaterial.js +38 -15
  61. package/examples/jsm/lines/LineSegments2.js +8 -0
  62. package/examples/jsm/lines/webgpu/LineSegments2.js +8 -0
  63. package/examples/jsm/loaders/3DMLoader.js +1 -1
  64. package/examples/jsm/loaders/DRACOLoader.js +46 -13
  65. package/examples/jsm/loaders/EXRLoader.js +27 -55
  66. package/examples/jsm/loaders/HDRLoader.js +6 -28
  67. package/examples/jsm/loaders/KTX2Loader.js +31 -12
  68. package/examples/jsm/loaders/LDrawLoader.js +8 -8
  69. package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
  70. package/examples/jsm/loaders/LUTCubeLoader.js +2 -2
  71. package/examples/jsm/loaders/LWOLoader.js +4 -0
  72. package/examples/jsm/loaders/LottieLoader.js +1 -1
  73. package/examples/jsm/loaders/MaterialXLoader.js +31 -9
  74. package/examples/jsm/loaders/NRRDLoader.js +3 -3
  75. package/examples/jsm/loaders/PCDLoader.js +7 -7
  76. package/examples/jsm/loaders/PLYLoader.js +218 -55
  77. package/examples/jsm/loaders/SVGLoader.js +547 -495
  78. package/examples/jsm/loaders/TTFLoader.js +1 -1
  79. package/examples/jsm/loaders/USDLoader.js +33 -9
  80. package/examples/jsm/loaders/VRMLLoader.js +1 -1
  81. package/examples/jsm/loaders/usd/USDAParser.js +93 -20
  82. package/examples/jsm/loaders/usd/USDCParser.js +1 -1
  83. package/examples/jsm/loaders/usd/USDComposer.js +52 -19
  84. package/examples/jsm/misc/TileCreasedNormalsPlugin.js +270 -0
  85. package/examples/jsm/misc/Volume.js +2 -2
  86. package/examples/jsm/objects/GroundedSkybox.js +1 -1
  87. package/examples/jsm/objects/Reflector.js +2 -3
  88. package/examples/jsm/objects/Water2Mesh.js +1 -1
  89. package/examples/jsm/physics/AmmoPhysics.js +15 -8
  90. package/examples/jsm/physics/RapierPhysics.js +27 -2
  91. package/examples/jsm/shaders/VolumeShader.js +31 -44
  92. package/examples/jsm/transpiler/GLSLDecoder.js +6 -6
  93. package/examples/jsm/transpiler/Linker.js +1 -1
  94. package/examples/jsm/tsl/display/BloomNode.js +59 -19
  95. package/examples/jsm/tsl/display/DepthOfFieldNode.js +2 -2
  96. package/examples/jsm/tsl/display/FXAANode.js +11 -12
  97. package/examples/jsm/tsl/display/GTAONode.js +34 -13
  98. package/examples/jsm/tsl/display/GodraysNode.js +1 -1
  99. package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +560 -0
  100. package/examples/jsm/tsl/display/PixelationPassNode.js +2 -2
  101. package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +912 -0
  102. package/examples/jsm/tsl/display/SSAAPassNode.js +13 -25
  103. package/examples/jsm/tsl/display/SSGINode.js +89 -39
  104. package/examples/jsm/tsl/display/SSRNode.js +829 -132
  105. package/examples/jsm/tsl/display/SSSNode.js +2 -2
  106. package/examples/jsm/tsl/display/TemporalReprojectNode.js +1023 -0
  107. package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +622 -0
  108. package/examples/jsm/tsl/lighting/DynamicLightsNode.js +1 -1
  109. package/examples/jsm/tsl/math/curlNoise.js +107 -0
  110. package/examples/jsm/tsl/shadows/TileShadowNode.js +1 -1
  111. package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +3 -3
  112. package/examples/jsm/tsl/utils/GroundedSkybox.js +62 -0
  113. package/examples/jsm/tsl/utils/RNoise.js +51 -0
  114. package/examples/jsm/tsl/utils/SpecularHelpers.js +325 -0
  115. package/examples/jsm/utils/BufferGeometryUtils.js +126 -59
  116. package/examples/jsm/utils/GeometryCompressionUtils.js +1 -1
  117. package/examples/jsm/utils/SceneOptimizer.js +1 -1
  118. package/examples/jsm/webxr/ARButton.js +1 -1
  119. package/examples/jsm/webxr/WebGLXRFallback.js +89 -0
  120. package/examples/jsm/webxr/XRControllerModelFactory.js +2 -2
  121. package/package.json +7 -7
  122. package/src/Three.TSL.js +10 -3
  123. package/src/Three.WebGPU.js +4 -0
  124. package/src/animation/AnimationAction.js +15 -11
  125. package/src/animation/AnimationClip.js +0 -139
  126. package/src/animation/KeyframeTrack.js +2 -2
  127. package/src/animation/PropertyBinding.js +2 -2
  128. package/src/cameras/Camera.js +2 -2
  129. package/src/cameras/StereoCamera.js +5 -2
  130. package/src/constants.js +1 -1
  131. package/src/core/BufferGeometry.js +29 -7
  132. package/src/core/Object3D.js +17 -7
  133. package/src/core/Raycaster.js +1 -1
  134. package/src/core/RenderTarget.js +15 -2
  135. package/src/extras/PMREMGenerator.js +6 -4
  136. package/src/extras/TextureUtils.js +1 -1
  137. package/src/extras/core/ShapePath.js +149 -160
  138. package/src/geometries/SphereGeometry.js +8 -3
  139. package/src/helpers/DirectionalLightHelper.js +2 -0
  140. package/src/helpers/HemisphereLightHelper.js +2 -0
  141. package/src/helpers/PointLightHelper.js +2 -0
  142. package/src/helpers/SpotLightHelper.js +1 -1
  143. package/src/loaders/DataTextureLoader.js +69 -38
  144. package/src/loaders/LoadingManager.js +5 -0
  145. package/src/loaders/MaterialLoader.js +36 -266
  146. package/src/loaders/ObjectLoader.js +3 -1
  147. package/src/materials/LineBasicMaterial.js +4 -0
  148. package/src/materials/Material.js +196 -1
  149. package/src/materials/MeshBasicMaterial.js +24 -0
  150. package/src/materials/MeshDepthMaterial.js +10 -0
  151. package/src/materials/MeshDistanceMaterial.js +10 -0
  152. package/src/materials/MeshLambertMaterial.js +40 -1
  153. package/src/materials/MeshMatcapMaterial.js +25 -1
  154. package/src/materials/MeshNormalMaterial.js +9 -1
  155. package/src/materials/MeshPhongMaterial.js +40 -1
  156. package/src/materials/MeshPhysicalMaterial.js +38 -0
  157. package/src/materials/MeshStandardMaterial.js +42 -1
  158. package/src/materials/MeshToonMaterial.js +34 -1
  159. package/src/materials/PointsMaterial.js +7 -0
  160. package/src/materials/ShaderMaterial.js +86 -0
  161. package/src/materials/SpriteMaterial.js +7 -0
  162. package/src/materials/nodes/Line2NodeMaterial.js +378 -322
  163. package/src/materials/nodes/MeshBasicNodeMaterial.js +2 -2
  164. package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
  165. package/src/materials/nodes/MeshPhongNodeMaterial.js +0 -9
  166. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +0 -30
  167. package/src/materials/nodes/MeshSSSNodeMaterial.js +0 -13
  168. package/src/materials/nodes/MeshStandardNodeMaterial.js +0 -11
  169. package/src/materials/nodes/NodeMaterial.js +115 -71
  170. package/src/materials/nodes/SpriteNodeMaterial.js +0 -10
  171. package/src/materials/nodes/manager/NodeMaterialObserver.js +49 -20
  172. package/src/math/Box3.js +5 -0
  173. package/src/math/FrustumArray.js +103 -133
  174. package/src/math/Interpolant.js +1 -1
  175. package/src/math/MathUtils.js +2 -2
  176. package/src/math/Matrix3.js +11 -0
  177. package/src/math/Matrix4.js +28 -3
  178. package/src/math/Vector2.js +2 -2
  179. package/src/math/Vector3.js +2 -2
  180. package/src/math/Vector4.js +2 -2
  181. package/src/math/interpolants/BezierInterpolant.js +4 -6
  182. package/src/nodes/Nodes.js +2 -5
  183. package/src/nodes/TSL.js +8 -6
  184. package/src/nodes/accessors/Arrays.js +4 -4
  185. package/src/nodes/accessors/Batch.js +108 -0
  186. package/src/nodes/accessors/Bitangent.js +2 -2
  187. package/src/nodes/accessors/BufferAttributeNode.js +13 -2
  188. package/src/nodes/accessors/Camera.js +7 -7
  189. package/src/nodes/accessors/ClippingNode.js +1 -1
  190. package/src/nodes/accessors/Instance.js +264 -0
  191. package/src/nodes/accessors/MaterialNode.js +18 -2
  192. package/src/nodes/accessors/MaterialProperties.js +4 -3
  193. package/src/nodes/accessors/{MorphNode.js → Morph.js} +99 -112
  194. package/src/nodes/accessors/Normal.js +13 -13
  195. package/src/nodes/accessors/Position.js +5 -1
  196. package/src/nodes/accessors/ReferenceNode.js +1 -0
  197. package/src/nodes/accessors/ReflectVector.js +3 -3
  198. package/src/nodes/accessors/SceneProperties.js +1 -1
  199. package/src/nodes/accessors/Skinning.js +263 -0
  200. package/src/nodes/accessors/StorageBufferNode.js +2 -2
  201. package/src/nodes/accessors/StorageTexture3DNode.js +100 -0
  202. package/src/nodes/accessors/StorageTextureNode.js +39 -7
  203. package/src/nodes/accessors/Tangent.js +4 -4
  204. package/src/nodes/accessors/TextureNode.js +60 -5
  205. package/src/nodes/code/FunctionNode.js +2 -16
  206. package/src/nodes/core/MRTNode.js +7 -2
  207. package/src/nodes/core/Node.js +39 -2
  208. package/src/nodes/core/NodeBuilder.js +201 -41
  209. package/src/nodes/core/NodeUtils.js +13 -13
  210. package/src/nodes/core/OutputStructNode.js +1 -1
  211. package/src/nodes/core/OverrideContextNode.js +153 -0
  212. package/src/nodes/core/PropertyNode.js +51 -5
  213. package/src/nodes/core/StackNode.js +56 -34
  214. package/src/nodes/core/StructNode.js +4 -6
  215. package/src/nodes/core/StructTypeNode.js +6 -6
  216. package/src/nodes/core/VarNode.js +8 -0
  217. package/src/nodes/core/VaryingNode.js +12 -2
  218. package/src/nodes/display/BlendModes.js +1 -41
  219. package/src/nodes/display/BumpMapNode.js +6 -1
  220. package/src/nodes/display/ColorAdjustment.js +10 -9
  221. package/src/nodes/display/FrontFacingNode.js +38 -9
  222. package/src/nodes/display/NormalMapNode.js +2 -2
  223. package/src/nodes/display/PassNode.js +35 -43
  224. package/src/nodes/display/PremultiplyAlphaFunctions.js +39 -0
  225. package/src/nodes/display/RenderOutputNode.js +12 -3
  226. package/src/nodes/functions/VolumetricLightingModel.js +40 -7
  227. package/src/nodes/gpgpu/WorkgroupInfoNode.js +1 -1
  228. package/src/nodes/lighting/EnvironmentNode.js +2 -2
  229. package/src/nodes/lighting/IESSpotLightNode.js +40 -2
  230. package/src/nodes/lighting/LightingContextNode.js +10 -2
  231. package/src/nodes/lighting/LightsNode.js +90 -37
  232. package/src/nodes/lighting/PointShadowNode.js +6 -1
  233. package/src/nodes/lighting/ShadowFilterNode.js +21 -52
  234. package/src/nodes/lighting/ShadowNode.js +34 -14
  235. package/src/nodes/materialx/lib/mx_noise.js +2 -2
  236. package/src/nodes/math/ConditionalNode.js +3 -3
  237. package/src/nodes/math/MathNode.js +39 -11
  238. package/src/nodes/math/OperatorNode.js +23 -23
  239. package/src/nodes/parsers/GLSLNodeFunction.js +1 -1
  240. package/src/nodes/pmrem/PMREMNode.js +33 -2
  241. package/src/nodes/tsl/TSLCore.js +63 -18
  242. package/src/nodes/utils/EquirectUV.js +30 -5
  243. package/src/nodes/utils/FunctionOverloadingNode.js +1 -1
  244. package/src/nodes/utils/Packing.js +35 -4
  245. package/src/nodes/utils/RTTNode.js +40 -24
  246. package/src/nodes/utils/ReflectorNode.js +1 -0
  247. package/src/nodes/utils/StorageArrayElementNode.js +1 -1
  248. package/src/objects/BatchedMesh.js +22 -14
  249. package/src/objects/InstancedMesh.js +0 -11
  250. package/src/objects/Skeleton.js +0 -9
  251. package/src/renderers/WebGLRenderer.js +19 -15
  252. package/src/renderers/common/Backend.js +49 -5
  253. package/src/renderers/common/Bindings.js +114 -45
  254. package/src/renderers/common/Buffer.js +9 -0
  255. package/src/renderers/common/ClippingContext.js +10 -2
  256. package/src/renderers/common/Info.js +63 -22
  257. package/src/renderers/common/Lighting.js +53 -5
  258. package/src/renderers/common/RenderList.js +41 -4
  259. package/src/renderers/common/RenderObject.js +73 -13
  260. package/src/renderers/common/Renderer.js +281 -108
  261. package/src/renderers/common/Sampler.js +16 -48
  262. package/src/renderers/common/Textures.js +32 -5
  263. package/src/renderers/common/TimestampQueryPool.js +1 -1
  264. package/src/renderers/common/UniformsGroup.js +31 -9
  265. package/src/renderers/common/XRManager.js +340 -22
  266. package/src/renderers/common/extras/PMREMGenerator.js +15 -38
  267. package/src/renderers/common/nodes/NodeBuilderState.js +9 -1
  268. package/src/renderers/common/nodes/NodeLibrary.js +4 -4
  269. package/src/renderers/common/nodes/NodeManager.js +63 -14
  270. package/src/renderers/common/nodes/NodeUniformBuffer.js +13 -0
  271. package/src/renderers/shaders/ShaderChunk/common.glsl.js +13 -4
  272. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +0 -6
  273. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
  274. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
  275. package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +1 -1
  276. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
  277. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +1 -1
  278. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +2 -2
  279. package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +6 -0
  280. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +1 -1
  281. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  282. package/src/renderers/shaders/ShaderLib/distance.glsl.js +1 -1
  283. package/src/renderers/webgl/WebGLOutput.js +2 -1
  284. package/src/renderers/webgl/WebGLProgram.js +5 -4
  285. package/src/renderers/webgl/WebGLPrograms.js +12 -5
  286. package/src/renderers/webgl/WebGLRenderLists.js +9 -1
  287. package/src/renderers/webgl/WebGLShaderCache.js +5 -11
  288. package/src/renderers/webgl/WebGLTextures.js +20 -7
  289. package/src/renderers/webgl/WebGLUniformsGroups.js +66 -38
  290. package/src/renderers/webgl-fallback/WebGLBackend.js +84 -25
  291. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +138 -8
  292. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
  293. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -22
  294. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +4 -2
  295. package/src/renderers/webgpu/WebGPUBackend.js +480 -169
  296. package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
  297. package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
  298. package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
  299. package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
  300. package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
  301. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
  302. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
  303. package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
  304. package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
  305. package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
  306. package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
  307. package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
  308. package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
  309. package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
  310. package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
  311. package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
  312. package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
  313. package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
  314. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
  315. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
  316. package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
  317. package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
  318. package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
  319. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +0 -1
  320. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +164 -7
  321. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +1 -1
  322. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +98 -38
  323. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -68
  324. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +164 -69
  325. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +158 -95
  326. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +297 -141
  327. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +33 -18
  328. package/src/renderers/webgpu/utils/WebGPUUtils.js +38 -3
  329. package/src/textures/DepthTexture.js +1 -1
  330. package/src/textures/ExternalTexture.js +0 -3
  331. package/examples/fonts/LICENSE +0 -13
  332. package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
  333. package/examples/fonts/MPLUSRounded1c/OFL.txt +0 -91
  334. package/examples/fonts/README.md +0 -11
  335. package/examples/fonts/droid/NOTICE +0 -190
  336. package/examples/fonts/droid/README.txt +0 -18
  337. package/examples/fonts/droid/droid_sans_bold.typeface.json +0 -1
  338. package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +0 -1
  339. package/examples/fonts/droid/droid_sans_regular.typeface.json +0 -1
  340. package/examples/fonts/droid/droid_serif_bold.typeface.json +0 -1
  341. package/examples/fonts/droid/droid_serif_regular.typeface.json +0 -1
  342. package/examples/fonts/gentilis_bold.typeface.json +0 -1
  343. package/examples/fonts/gentilis_regular.typeface.json +0 -1
  344. package/examples/fonts/helvetiker_bold.typeface.json +0 -1
  345. package/examples/fonts/helvetiker_regular.typeface.json +0 -1
  346. package/examples/fonts/optimer_bold.typeface.json +0 -1
  347. package/examples/fonts/optimer_regular.typeface.json +0 -1
  348. package/examples/fonts/ttf/README.md +0 -9
  349. package/examples/fonts/ttf/kenpixel.ttf +0 -0
  350. package/examples/jsm/inspector/extensions/extensions.json +0 -6
  351. package/examples/jsm/libs/ammo.wasm.js +0 -822
  352. package/examples/jsm/libs/ammo.wasm.wasm +0 -0
  353. package/examples/jsm/libs/draco/draco_encoder.js +0 -33
  354. package/examples/jsm/libs/draco/gltf/draco_encoder.js +0 -33
  355. package/examples/jsm/libs/lottie_canvas.module.js +0 -14849
  356. package/examples/jsm/libs/opentype.module.js +0 -14506
  357. package/examples/jsm/libs/rhino3dm/rhino3dm.js +0 -21
  358. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +0 -16
  359. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  360. package/examples/jsm/lighting/TiledLighting.js +0 -42
  361. package/examples/jsm/tsl/display/AnamorphicNode.js +0 -293
  362. package/examples/jsm/tsl/lighting/TiledLightsNode.js +0 -442
  363. package/src/nodes/accessors/BatchNode.js +0 -163
  364. package/src/nodes/accessors/InstanceNode.js +0 -349
  365. package/src/nodes/accessors/InstancedMeshNode.js +0 -50
  366. package/src/nodes/accessors/SkinningNode.js +0 -328
@@ -5,7 +5,7 @@ import BasicLightMapNode from '../../nodes/lighting/BasicLightMapNode.js';
5
5
  import BasicLightingModel from '../../nodes/functions/BasicLightingModel.js';
6
6
  import { normalViewGeometry } from '../../nodes/accessors/Normal.js';
7
7
  import { diffuseColor } from '../../nodes/core/PropertyNode.js';
8
- import { directionToFaceDirection } from '../../nodes/display/FrontFacingNode.js';
8
+ import { negateOnBackSide } from '../../nodes/display/FrontFacingNode.js';
9
9
 
10
10
  import { MeshBasicMaterial } from '../MeshBasicMaterial.js';
11
11
 
@@ -66,7 +66,7 @@ class MeshBasicNodeMaterial extends NodeMaterial {
66
66
  */
67
67
  setupNormal() {
68
68
 
69
- return directionToFaceDirection( normalViewGeometry ); // see #28839
69
+ return negateOnBackSide( normalViewGeometry ); // see #28839
70
70
 
71
71
  }
72
72
 
@@ -1,6 +1,6 @@
1
1
  import NodeMaterial from './NodeMaterial.js';
2
2
  import { diffuseColor } from '../../nodes/core/PropertyNode.js';
3
- import { directionToColor } from '../../nodes/utils/Packing.js';
3
+ import { packNormalToRGB } from '../../nodes/utils/Packing.js';
4
4
  import { materialOpacity } from '../../nodes/accessors/MaterialNode.js';
5
5
  import { normalView } from '../../nodes/accessors/Normal.js';
6
6
  import { colorSpaceToWorking } from '../../nodes/display/ColorSpaceNode.js';
@@ -58,7 +58,7 @@ class MeshNormalNodeMaterial extends NodeMaterial {
58
58
 
59
59
  // By convention, a normal packed to RGB is in sRGB color space. Convert it to working color space.
60
60
 
61
- diffuseColor.assign( colorSpaceToWorking( vec4( directionToColor( normalView ), opacityNode ), SRGBColorSpace ) );
61
+ diffuseColor.assign( colorSpaceToWorking( vec4( packNormalToRGB( normalView ), opacityNode ), SRGBColorSpace ) );
62
62
 
63
63
  }
64
64
 
@@ -127,15 +127,6 @@ class MeshPhongNodeMaterial extends NodeMaterial {
127
127
 
128
128
  }
129
129
 
130
- copy( source ) {
131
-
132
- this.shininessNode = source.shininessNode;
133
- this.specularNode = source.specularNode;
134
-
135
- return super.copy( source );
136
-
137
- }
138
-
139
130
  }
140
131
 
141
132
  export default MeshPhongNodeMaterial;
@@ -486,36 +486,6 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
486
486
 
487
487
  }
488
488
 
489
- copy( source ) {
490
-
491
- this.clearcoatNode = source.clearcoatNode;
492
- this.clearcoatRoughnessNode = source.clearcoatRoughnessNode;
493
- this.clearcoatNormalNode = source.clearcoatNormalNode;
494
-
495
- this.sheenNode = source.sheenNode;
496
- this.sheenRoughnessNode = source.sheenRoughnessNode;
497
-
498
- this.iridescenceNode = source.iridescenceNode;
499
- this.iridescenceIORNode = source.iridescenceIORNode;
500
- this.iridescenceThicknessNode = source.iridescenceThicknessNode;
501
-
502
- this.specularIntensityNode = source.specularIntensityNode;
503
- this.specularColorNode = source.specularColorNode;
504
-
505
- this.iorNode = source.iorNode;
506
-
507
- this.transmissionNode = source.transmissionNode;
508
- this.thicknessNode = source.thicknessNode;
509
- this.attenuationDistanceNode = source.attenuationDistanceNode;
510
- this.attenuationColorNode = source.attenuationColorNode;
511
- this.dispersionNode = source.dispersionNode;
512
-
513
- this.anisotropyNode = source.anisotropyNode;
514
-
515
- return super.copy( source );
516
-
517
- }
518
-
519
489
  }
520
490
 
521
491
  export default MeshPhysicalNodeMaterial;
@@ -157,19 +157,6 @@ class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial {
157
157
 
158
158
  }
159
159
 
160
- copy( source ) {
161
-
162
- this.thicknessColorNode = source.thicknessColorNode;
163
- this.thicknessDistortionNode = source.thicknessDistortionNode;
164
- this.thicknessAmbientNode = source.thicknessAmbientNode;
165
- this.thicknessAttenuationNode = source.thicknessAttenuationNode;
166
- this.thicknessPowerNode = source.thicknessPowerNode;
167
- this.thicknessScaleNode = source.thicknessScaleNode;
168
-
169
- return super.copy( source );
170
-
171
- }
172
-
173
160
  }
174
161
 
175
162
  export default MeshSSSNodeMaterial;
@@ -171,17 +171,6 @@ class MeshStandardNodeMaterial extends NodeMaterial {
171
171
 
172
172
  }
173
173
 
174
- copy( source ) {
175
-
176
- this.emissiveNode = source.emissiveNode;
177
-
178
- this.metalnessNode = source.metalnessNode;
179
- this.roughnessNode = source.roughnessNode;
180
-
181
- return super.copy( source );
182
-
183
- }
184
-
185
174
  }
186
175
 
187
176
  export default MeshStandardNodeMaterial;
@@ -1,16 +1,16 @@
1
1
  import { Material } from '../Material.js';
2
2
 
3
3
  import { hashArray, hashString } from '../../nodes/core/NodeUtils.js';
4
- import { output, diffuseColor, emissive, varyingProperty } from '../../nodes/core/PropertyNode.js';
4
+ import { output, diffuseColor, ambientOcclusion, emissive } from '../../nodes/core/PropertyNode.js';
5
5
  import { materialAlphaTest, materialColor, materialOpacity, materialEmissive, materialNormal, materialLightMap, materialAO } from '../../nodes/accessors/MaterialNode.js';
6
6
  import { modelViewProjection } from '../../nodes/accessors/ModelViewProjectionNode.js';
7
7
  import { normalLocal } from '../../nodes/accessors/Normal.js';
8
- import { instancedMesh } from '../../nodes/accessors/InstancedMeshNode.js';
9
- import { batch } from '../../nodes/accessors/BatchNode.js';
8
+ import { instancedMesh, instanceColor } from '../../nodes/accessors/Instance.js';
9
+ import { batch, batchColor } from '../../nodes/accessors/Batch.js';
10
10
  import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js';
11
11
  import { positionLocal, positionView } from '../../nodes/accessors/Position.js';
12
- import { skinning } from '../../nodes/accessors/SkinningNode.js';
13
- import { morphReference } from '../../nodes/accessors/MorphNode.js';
12
+ import { skinning } from '../../nodes/accessors/Skinning.js';
13
+ import { morphReference } from '../../nodes/accessors/Morph.js';
14
14
  import { fwidth, mix, smoothstep } from '../../nodes/math/MathNode.js';
15
15
  import { float, vec3, vec4, bool } from '../../nodes/tsl/TSLBase.js';
16
16
  import AONode from '../../nodes/lighting/AONode.js';
@@ -23,7 +23,7 @@ import NodeMaterialObserver from './manager/NodeMaterialObserver.js';
23
23
  import getAlphaHashThreshold from '../../nodes/functions/material/getAlphaHashThreshold.js';
24
24
  import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
25
25
  import { vertexColor } from '../../nodes/accessors/VertexColorNode.js';
26
- import { premultiplyAlpha } from '../../nodes/display/BlendModes.js';
26
+ import { premultiplyAlpha } from '../../nodes/display/PremultiplyAlphaFunctions.js';
27
27
  import { subBuild } from '../../nodes/core/SubBuildNode.js';
28
28
 
29
29
  /**
@@ -84,16 +84,6 @@ class NodeMaterial extends Material {
84
84
  */
85
85
  this.lights = false;
86
86
 
87
- /**
88
- * Whether this material uses hardware clipping or not.
89
- * This property is managed by the engine and should not be
90
- * modified by apps.
91
- *
92
- * @type {boolean}
93
- * @default false
94
- */
95
- this.hardwareClipping = false;
96
-
97
87
  /**
98
88
  * Node materials which set their `lights` property to `true`
99
89
  * are affected by all lights of the scene. Sometimes selective
@@ -533,6 +523,7 @@ class NodeMaterial extends Material {
533
523
  if ( this.fragmentNode === null ) {
534
524
 
535
525
  this.setupDiffuseColor( builder );
526
+ this.setupAmbientOcclusion( builder );
536
527
  this.setupVariants( builder );
537
528
 
538
529
  const outgoingLightNode = this.setupLighting( builder );
@@ -596,7 +587,7 @@ class NodeMaterial extends Material {
596
587
 
597
588
  if ( fragmentNode.isOutputStructNode !== true ) {
598
589
 
599
- fragmentNode = vec4( fragmentNode );
590
+ fragmentNode = fragmentNode.convert( builder.getOutputType() );
600
591
 
601
592
  }
602
593
 
@@ -656,7 +647,7 @@ class NodeMaterial extends Material {
656
647
  */
657
648
  setupHardwareClipping( builder ) {
658
649
 
659
- this.hardwareClipping = false;
650
+ builder.hardwareClipping = false;
660
651
 
661
652
  if ( builder.clippingContext === null ) return;
662
653
 
@@ -668,7 +659,7 @@ class NodeMaterial extends Material {
668
659
 
669
660
  builder.stack.addToStack( hardwareClipping() );
670
661
 
671
- this.hardwareClipping = true;
662
+ builder.hardwareClipping = true;
672
663
 
673
664
  }
674
665
 
@@ -776,13 +767,13 @@ class NodeMaterial extends Material {
776
767
 
777
768
  if ( geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color ) {
778
769
 
779
- morphReference( object ).toStack();
770
+ morphReference( object );
780
771
 
781
772
  }
782
773
 
783
774
  if ( object.isSkinnedMesh === true ) {
784
775
 
785
- skinning( object ).toStack();
776
+ skinning( object );
786
777
 
787
778
  }
788
779
 
@@ -798,13 +789,13 @@ class NodeMaterial extends Material {
798
789
 
799
790
  if ( object.isBatchedMesh ) {
800
791
 
801
- batch( object ).toStack();
792
+ batch( object );
802
793
 
803
794
  }
804
795
 
805
796
  if ( ( object.isInstancedMesh && object.instanceMatrix && object.instanceMatrix.isInstancedBufferAttribute === true ) ) {
806
797
 
807
- instancedMesh( object ).toStack();
798
+ instancedMesh( object );
808
799
 
809
800
  }
810
801
 
@@ -854,16 +845,12 @@ class NodeMaterial extends Material {
854
845
 
855
846
  if ( object.instanceColor ) {
856
847
 
857
- const instanceColor = varyingProperty( 'vec3', 'vInstanceColor' );
858
-
859
848
  colorNode = instanceColor.mul( colorNode );
860
849
 
861
850
  }
862
851
 
863
852
  if ( object.isBatchedMesh && object._colorsTexture ) {
864
853
 
865
- const batchColor = varyingProperty( 'vec3', 'vBatchColor' );
866
-
867
854
  colorNode = batchColor.mul( colorNode );
868
855
 
869
856
  }
@@ -999,12 +986,18 @@ class NodeMaterial extends Material {
999
986
  * Setups the lights node based on the scene, environment and material.
1000
987
  *
1001
988
  * @param {NodeBuilder} builder - The current node builder.
1002
- * @return {LightsNode} The lights node.
989
+ * @return {LightingNode<Array>} The lights node.
1003
990
  */
1004
- setupLights( builder ) {
991
+ setupMaterialLightings( builder ) {
1005
992
 
1006
993
  const materialLightsNode = [];
1007
994
 
995
+ if ( builder.renderer.lighting.enabled === false ) {
996
+
997
+ return materialLightsNode;
998
+
999
+ }
1000
+
1008
1001
  //
1009
1002
 
1010
1003
  const envNode = this.setupEnvironment( builder );
@@ -1023,6 +1016,24 @@ class NodeMaterial extends Material {
1023
1016
 
1024
1017
  }
1025
1018
 
1019
+ if ( builder.context.ambientOcclusion ) {
1020
+
1021
+ materialLightsNode.push( new AONode( builder.context.ambientOcclusion ) );
1022
+
1023
+ }
1024
+
1025
+ return materialLightsNode;
1026
+
1027
+ }
1028
+
1029
+ /**
1030
+ * Setups the ambient occlusion node from the material.
1031
+ *
1032
+ * @param {NodeBuilder} builder - The current node builder.
1033
+ * @return {Node} The ambient occlusion node.
1034
+ */
1035
+ setupAmbientOcclusion( builder ) {
1036
+
1026
1037
  let aoNode = this.aoNode;
1027
1038
 
1028
1039
  if ( aoNode === null && builder.material.aoMap ) {
@@ -1037,22 +1048,14 @@ class NodeMaterial extends Material {
1037
1048
 
1038
1049
  }
1039
1050
 
1040
- if ( aoNode ) {
1051
+ if ( aoNode !== null ) {
1041
1052
 
1042
- materialLightsNode.push( new AONode( aoNode ) );
1043
-
1044
- }
1053
+ ambientOcclusion.assign( aoNode );
1045
1054
 
1046
- let lightsN = this.lightsNode || builder.lightsNode;
1047
-
1048
- if ( materialLightsNode.length > 0 ) {
1049
-
1050
- lightsN = builder.renderer.lighting.createNode( [ ...lightsN.getLights(), ...materialLightsNode ] );
1055
+ builder.context.ambientOcclusion = ambientOcclusion;
1051
1056
 
1052
1057
  }
1053
1058
 
1054
- return lightsN;
1055
-
1056
1059
  }
1057
1060
 
1058
1061
  /**
@@ -1084,15 +1087,16 @@ class NodeMaterial extends Material {
1084
1087
 
1085
1088
  const lights = this.lights === true || this.lightsNode !== null;
1086
1089
 
1087
- const lightsNode = lights ? this.setupLights( builder ) : null;
1090
+ const materialLightings = this.lights === true ? this.setupMaterialLightings( builder ) : [];
1091
+ const lightsNode = lights ? ( this.lightsNode || builder.lightsNode ) : null;
1088
1092
 
1089
1093
  let outgoingLightNode = this.setupOutgoingLight( builder );
1090
1094
 
1091
- if ( lightsNode && lightsNode.getScope().hasLights ) {
1095
+ if ( lightsNode && ( materialLightings.length > 0 || lightsNode.getScope().hasLights ) ) {
1092
1096
 
1093
1097
  const lightingModel = this.setupLightingModel( builder ) || null;
1094
1098
 
1095
- outgoingLightNode = lightingContext( lightsNode, lightingModel, backdropNode, backdropAlphaNode );
1099
+ outgoingLightNode = lightingContext( lightsNode, lightingModel, materialLightings, backdropNode, backdropAlphaNode );
1096
1100
 
1097
1101
  } else if ( backdropNode !== null ) {
1098
1102
 
@@ -1153,6 +1157,26 @@ class NodeMaterial extends Material {
1153
1157
  /**
1154
1158
  * Setups the output node.
1155
1159
  *
1160
+ * This method can be implemented by derived materials to extend the functionality
1161
+ * of the material's output or replace it altogether.
1162
+ *
1163
+ * ```js
1164
+ * class ColoredShadowMaterial extends MeshPhongNodeMaterial {
1165
+ * constructor( parameters ) {
1166
+ * super( parameters );
1167
+ * this._shadeColor = uniform( new Color( parameters.shadeColor ?? 0xff0000 ) );
1168
+ * }
1169
+ *
1170
+ * setupOutput( builder, outputNode ) {
1171
+ * // Modify the native output of the MeshPhongNodeMaterial fragment shader
1172
+ * const brightness = min( outputNode.r, 1.0 );
1173
+ * const mixedColor = mix( this._shadeColor, diffuseColor.rgb, brightness );
1174
+ * // Return new output back into NodeMaterial flow
1175
+ * return super.setupOutput( builder, vec4( mixedColor, outputNode.a ) );
1176
+ * }
1177
+ * }
1178
+ * ```
1179
+ *
1156
1180
  * @param {NodeBuilder} builder - The current node builder.
1157
1181
  * @param {Node<vec4>} outputNode - The existing output node.
1158
1182
  * @return {Node<vec4>} The output node.
@@ -1209,8 +1233,7 @@ class NodeMaterial extends Material {
1209
1233
 
1210
1234
  for ( const key in descriptors ) {
1211
1235
 
1212
- if ( Object.getOwnPropertyDescriptor( this.constructor.prototype, key ) === undefined &&
1213
- descriptors[ key ].get !== undefined ) {
1236
+ if ( Object.getOwnPropertyDescriptor( this.constructor.prototype, key ) === undefined && descriptors[ key ].get !== undefined ) {
1214
1237
 
1215
1238
  Object.defineProperty( this.constructor.prototype, key, descriptors[ key ] );
1216
1239
 
@@ -1284,44 +1307,65 @@ class NodeMaterial extends Material {
1284
1307
  }
1285
1308
 
1286
1309
  /**
1287
- * Copies the properties of the given node material to this instance.
1310
+ * Copies the common properties of the given material to this instance.
1288
1311
  *
1289
- * @param {NodeMaterial} source - The material to copy.
1312
+ * @param {Material} source - The material to copy.
1290
1313
  * @return {NodeMaterial} A reference to this node material.
1291
1314
  */
1292
1315
  copy( source ) {
1293
1316
 
1294
- this.lightsNode = source.lightsNode;
1295
- this.envNode = source.envNode;
1296
- this.aoNode = source.aoNode;
1317
+ const descriptors = Object.getOwnPropertyDescriptors( this.constructor.prototype );
1318
+
1319
+ for ( const property in descriptors ) {
1297
1320
 
1298
- this.colorNode = source.colorNode;
1299
- this.normalNode = source.normalNode;
1300
- this.opacityNode = source.opacityNode;
1301
- this.backdropNode = source.backdropNode;
1302
- this.backdropAlphaNode = source.backdropAlphaNode;
1303
- this.alphaTestNode = source.alphaTestNode;
1304
- this.maskNode = source.maskNode;
1305
- this.maskShadowNode = source.maskShadowNode;
1321
+ if ( descriptors[ property ].set !== undefined && source[ property ] !== undefined ) {
1306
1322
 
1307
- this.positionNode = source.positionNode;
1308
- this.geometryNode = source.geometryNode;
1323
+ const value = source[ property ];
1324
+
1325
+ if ( this[ property ] && this[ property ].copy !== undefined ) {
1326
+
1327
+ this[ property ].copy( value );
1328
+
1329
+ } else {
1330
+
1331
+ this[ property ] = value;
1332
+
1333
+ }
1334
+
1335
+ }
1336
+
1337
+ }
1309
1338
 
1310
- this.depthNode = source.depthNode;
1311
- this.receivedShadowPositionNode = source.receivedShadowPositionNode;
1312
- this.castShadowPositionNode = source.castShadowPositionNode;
1313
- this.receivedShadowNode = source.receivedShadowNode;
1314
- this.castShadowNode = source.castShadowNode;
1339
+ for ( const property in this ) {
1315
1340
 
1316
- this.outputNode = source.outputNode;
1317
- this.mrtNode = source.mrtNode;
1341
+ // Skip internal/private properties (starting with '_'), flags (starting with 'is' + uppercase),
1342
+ // and properties that are handled separately or should not be copied (id, uuid, version, type, userData, clippingPlanes).
1343
+
1344
+ if ( /^(?:is[A-Z]|_)|^(?:id|uuid|version|type|userData|clippingPlanes)$/.test( property ) ) continue;
1345
+
1346
+ if ( this[ property ] !== undefined && source[ property ] !== undefined ) {
1347
+
1348
+ const value = source[ property ];
1349
+
1350
+ if ( this[ property ] && this[ property ].copy !== undefined ) {
1351
+
1352
+ this[ property ].copy( value );
1353
+
1354
+ } else {
1355
+
1356
+ this[ property ] = value;
1357
+
1358
+ }
1359
+
1360
+ }
1361
+
1362
+ }
1318
1363
 
1319
- this.fragmentNode = source.fragmentNode;
1320
- this.vertexNode = source.vertexNode;
1364
+ this.clippingPlanes = source.clippingPlanes ? source.clippingPlanes.map( ( plane ) => plane.clone() ) : null;
1321
1365
 
1322
- this.contextNode = source.contextNode;
1366
+ this.userData = JSON.parse( JSON.stringify( source.userData ) );
1323
1367
 
1324
- return super.copy( source );
1368
+ return this;
1325
1369
 
1326
1370
  }
1327
1371
 
@@ -148,16 +148,6 @@ class SpriteNodeMaterial extends NodeMaterial {
148
148
 
149
149
  }
150
150
 
151
- copy( source ) {
152
-
153
- this.positionNode = source.positionNode;
154
- this.rotationNode = source.rotationNode;
155
- this.scaleNode = source.scaleNode;
156
-
157
- return super.copy( source );
158
-
159
- }
160
-
161
151
  /**
162
152
  * Whether to use size attenuation or not.
163
153
  *
@@ -22,6 +22,7 @@ const refreshUniforms = [
22
22
  'emissiveMap',
23
23
  'envMap',
24
24
  'envMapIntensity',
25
+ 'envMapRotation',
25
26
  'gradientMap',
26
27
  'ior',
27
28
  'iridescence',
@@ -216,7 +217,12 @@ class NodeMaterialObserver {
216
217
 
217
218
  }
218
219
 
219
- data.lights = this.getLightsData( renderObject.lightsNode.getLights() );
220
+ const { environmentIntensity, environmentRotation } = renderObject.scene;
221
+
222
+ data.environmentIntensity = environmentIntensity;
223
+ data.environmentRotation = environmentRotation.clone();
224
+
225
+ data.lights = this.getLightsData( renderObject.lightsNode.getLights(), [] );
220
226
 
221
227
  this.renderObjects.set( renderObject, data );
222
228
 
@@ -242,8 +248,8 @@ class NodeMaterialObserver {
242
248
  const attribute = attributes[ name ];
243
249
 
244
250
  attributesData[ name ] = {
245
- id: attribute.id,
246
- version: attribute.version,
251
+ id: attribute.isInterleavedBufferAttribute ? attribute.data.uuid : attribute.id,
252
+ version: attribute.isInterleavedBufferAttribute ? attribute.data.version : attribute.version,
247
253
  };
248
254
 
249
255
  }
@@ -333,7 +339,7 @@ class NodeMaterialObserver {
333
339
 
334
340
  if ( value.isTexture === true ) {
335
341
 
336
- data[ property ] = { id: value.id, version: value.version };
342
+ data[ property ] = { id: value.id, version: 0 };
337
343
 
338
344
  } else {
339
345
 
@@ -363,7 +369,7 @@ class NodeMaterialObserver {
363
369
  * @param {RenderObject} renderObject - The render object.
364
370
  * @param {Array<Light>} lightsData - The current material lights.
365
371
  * @param {number} renderId - The current render ID.
366
- * @return {boolean} Whether the given render object has changed its state or not.
372
+ * @return {boolean} Whether the given render object is equal to its cached state or not.
367
373
  */
368
374
  equals( renderObject, lightsData, renderId ) {
369
375
 
@@ -501,10 +507,13 @@ class NodeMaterialObserver {
501
507
 
502
508
  }
503
509
 
504
- if ( storedAttributeData.id !== attribute.id || storedAttributeData.version !== attribute.version ) {
510
+ const id = attribute.isInterleavedBufferAttribute ? attribute.data.uuid : attribute.id;
511
+ const version = attribute.isInterleavedBufferAttribute ? attribute.data.version : attribute.version;
512
+
513
+ if ( storedAttributeData.id !== id || storedAttributeData.version !== version ) {
505
514
 
506
- storedAttributeData.id = attribute.id;
507
- storedAttributeData.version = attribute.version;
515
+ storedAttributeData.id = id;
516
+ storedAttributeData.version = version;
508
517
 
509
518
  geometryData._equal = false;
510
519
  return false;
@@ -597,6 +606,24 @@ class NodeMaterialObserver {
597
606
 
598
607
  }
599
608
 
609
+ // scene
610
+
611
+ const scene = renderObject.scene;
612
+
613
+ if ( scene.environment !== null && material.envMap === null ) {
614
+
615
+ if ( renderObjectData.environmentIntensity !== scene.environmentIntensity ||
616
+ renderObjectData.environmentRotation.equals( scene.environmentRotation ) === false ) {
617
+
618
+ renderObjectData.environmentIntensity = scene.environmentIntensity;
619
+ renderObjectData.environmentRotation.copy( scene.environmentRotation );
620
+
621
+ return false;
622
+
623
+ }
624
+
625
+ }
626
+
600
627
  // center
601
628
 
602
629
  if ( renderObjectData.center ) {
@@ -605,7 +632,7 @@ class NodeMaterialObserver {
605
632
 
606
633
  renderObjectData.center.copy( object.center );
607
634
 
608
- return true;
635
+ return false;
609
636
 
610
637
  }
611
638
 
@@ -629,9 +656,9 @@ class NodeMaterialObserver {
629
656
  * @param {Array<Light>} materialLights - The material lights.
630
657
  * @return {Array<Object>} The lights data for the given material lights.
631
658
  */
632
- getLightsData( materialLights ) {
659
+ getLightsData( materialLights, lights ) {
633
660
 
634
- const lights = [];
661
+ lights.length = 0;
635
662
 
636
663
  for ( const light of materialLights ) {
637
664
 
@@ -658,23 +685,25 @@ class NodeMaterialObserver {
658
685
  */
659
686
  getLights( lightsNode, renderId ) {
660
687
 
661
- if ( _lightsCache.has( lightsNode ) ) {
688
+ let cached = _lightsCache.get( lightsNode );
662
689
 
663
- const cached = _lightsCache.get( lightsNode );
690
+ if ( cached === undefined ) {
664
691
 
665
- if ( cached.renderId === renderId ) {
692
+ cached = { renderId: - 1, lightsData: [] };
693
+ _lightsCache.set( lightsNode, cached );
666
694
 
667
- return cached.lightsData;
695
+ }
668
696
 
669
- }
697
+ if ( cached.renderId === renderId ) {
670
698
 
671
- }
699
+ return cached.lightsData;
672
700
 
673
- const lightsData = this.getLightsData( lightsNode.getLights() );
701
+ }
674
702
 
675
- _lightsCache.set( lightsNode, { renderId, lightsData } );
703
+ cached.renderId = renderId;
704
+ this.getLightsData( lightsNode.getLights(), cached.lightsData );
676
705
 
677
- return lightsData;
706
+ return cached.lightsData;
678
707
 
679
708
  }
680
709
 
package/src/math/Box3.js CHANGED
@@ -142,6 +142,11 @@ class Box3 {
142
142
  * (including its children), accounting for the object's, and children's,
143
143
  * world transforms. The function may result in a larger box than strictly necessary.
144
144
  *
145
+ * Note: To compute the correct bounding box, make sure the given 3D object
146
+ * has an up-to-date world matrix that reflects the current transformation of its
147
+ * ancestor nodes. Call `object.updateWorldMatrix( true, false )` beforehand if
148
+ * you're unsure.
149
+ *
145
150
  * @param {Object3D} object - The 3D object to compute the bounding box for.
146
151
  * @param {boolean} [precise=false] - If set to `true`, the method computes the smallest
147
152
  * world-axis-aligned bounding box at the expense of more computation.