@gnsx/three 0.184.19 → 0.185.2

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 (367) hide show
  1. package/build/three.cjs +1667 -1189
  2. package/build/three.core.js +1289 -871
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +157 -97
  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 +7542 -3371
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +7542 -3370
  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 +57 -64
  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 +124 -91
  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 -74
  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 +92 -37
  232. package/src/nodes/lighting/PointShadowNode.js +7 -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/profiler/ProfilerService.js +185 -42
  252. package/src/renderers/WebGLRenderer.js +21 -15
  253. package/src/renderers/common/Backend.js +49 -5
  254. package/src/renderers/common/Bindings.js +114 -45
  255. package/src/renderers/common/Buffer.js +9 -0
  256. package/src/renderers/common/ClippingContext.js +10 -2
  257. package/src/renderers/common/Info.js +63 -22
  258. package/src/renderers/common/Lighting.js +53 -5
  259. package/src/renderers/common/RenderList.js +42 -4
  260. package/src/renderers/common/RenderObject.js +73 -13
  261. package/src/renderers/common/Renderer.js +282 -109
  262. package/src/renderers/common/Sampler.js +16 -48
  263. package/src/renderers/common/Textures.js +32 -5
  264. package/src/renderers/common/TimestampQueryPool.js +1 -1
  265. package/src/renderers/common/UniformsGroup.js +31 -9
  266. package/src/renderers/common/XRManager.js +340 -22
  267. package/src/renderers/common/extras/PMREMGenerator.js +15 -38
  268. package/src/renderers/common/nodes/NodeBuilderState.js +9 -1
  269. package/src/renderers/common/nodes/NodeLibrary.js +4 -4
  270. package/src/renderers/common/nodes/NodeManager.js +63 -14
  271. package/src/renderers/common/nodes/NodeUniformBuffer.js +13 -0
  272. package/src/renderers/shaders/ShaderChunk/common.glsl.js +13 -4
  273. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +0 -6
  274. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
  275. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
  276. package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +1 -1
  277. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
  278. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +1 -1
  279. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +2 -2
  280. package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +6 -0
  281. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +1 -1
  282. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  283. package/src/renderers/shaders/ShaderLib/distance.glsl.js +1 -1
  284. package/src/renderers/webgl/WebGLOutput.js +2 -1
  285. package/src/renderers/webgl/WebGLProgram.js +5 -4
  286. package/src/renderers/webgl/WebGLPrograms.js +11 -4
  287. package/src/renderers/webgl/WebGLRenderLists.js +9 -1
  288. package/src/renderers/webgl/WebGLShaderCache.js +5 -11
  289. package/src/renderers/webgl/WebGLTextures.js +20 -7
  290. package/src/renderers/webgl/WebGLUniformsGroups.js +66 -38
  291. package/src/renderers/webgl-fallback/WebGLBackend.js +84 -25
  292. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +138 -8
  293. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
  294. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -22
  295. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +4 -2
  296. package/src/renderers/webgpu/WebGPUBackend.js +480 -169
  297. package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
  298. package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
  299. package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
  300. package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
  301. package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
  302. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
  303. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
  304. package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
  305. package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
  306. package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
  307. package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
  308. package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
  309. package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
  310. package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
  311. package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
  312. package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
  313. package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
  314. package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
  315. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
  316. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
  317. package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
  318. package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
  319. package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
  320. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +0 -1
  321. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +164 -7
  322. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +1 -1
  323. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +98 -38
  324. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -68
  325. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +164 -69
  326. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +158 -95
  327. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +297 -141
  328. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +33 -18
  329. package/src/renderers/webgpu/utils/WebGPUUtils.js +38 -3
  330. package/src/textures/DepthTexture.js +1 -1
  331. package/src/textures/ExternalTexture.js +0 -3
  332. package/examples/fonts/LICENSE +0 -13
  333. package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
  334. package/examples/fonts/MPLUSRounded1c/OFL.txt +0 -91
  335. package/examples/fonts/README.md +0 -11
  336. package/examples/fonts/droid/NOTICE +0 -190
  337. package/examples/fonts/droid/README.txt +0 -18
  338. package/examples/fonts/droid/droid_sans_bold.typeface.json +0 -1
  339. package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +0 -1
  340. package/examples/fonts/droid/droid_sans_regular.typeface.json +0 -1
  341. package/examples/fonts/droid/droid_serif_bold.typeface.json +0 -1
  342. package/examples/fonts/droid/droid_serif_regular.typeface.json +0 -1
  343. package/examples/fonts/gentilis_bold.typeface.json +0 -1
  344. package/examples/fonts/gentilis_regular.typeface.json +0 -1
  345. package/examples/fonts/helvetiker_bold.typeface.json +0 -1
  346. package/examples/fonts/helvetiker_regular.typeface.json +0 -1
  347. package/examples/fonts/optimer_bold.typeface.json +0 -1
  348. package/examples/fonts/optimer_regular.typeface.json +0 -1
  349. package/examples/fonts/ttf/README.md +0 -9
  350. package/examples/fonts/ttf/kenpixel.ttf +0 -0
  351. package/examples/jsm/inspector/extensions/extensions.json +0 -6
  352. package/examples/jsm/libs/ammo.wasm.js +0 -822
  353. package/examples/jsm/libs/ammo.wasm.wasm +0 -0
  354. package/examples/jsm/libs/draco/draco_encoder.js +0 -33
  355. package/examples/jsm/libs/draco/gltf/draco_encoder.js +0 -33
  356. package/examples/jsm/libs/lottie_canvas.module.js +0 -14849
  357. package/examples/jsm/libs/opentype.module.js +0 -14506
  358. package/examples/jsm/libs/rhino3dm/rhino3dm.js +0 -21
  359. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +0 -16
  360. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  361. package/examples/jsm/lighting/TiledLighting.js +0 -42
  362. package/examples/jsm/tsl/display/AnamorphicNode.js +0 -293
  363. package/examples/jsm/tsl/lighting/TiledLightsNode.js +0 -442
  364. package/src/nodes/accessors/BatchNode.js +0 -163
  365. package/src/nodes/accessors/InstanceNode.js +0 -349
  366. package/src/nodes/accessors/InstancedMeshNode.js +0 -50
  367. package/src/nodes/accessors/SkinningNode.js +0 -328
@@ -79,21 +79,15 @@ class Bindings extends DataMap {
79
79
 
80
80
  const bindings = renderObject.getBindings();
81
81
 
82
- for ( const bindGroup of bindings ) {
83
-
84
- const groupData = this.get( bindGroup );
85
-
86
- if ( groupData.bindGroup === undefined ) {
87
-
88
- // each object defines an array of bindings (ubos, textures, samplers etc.)
82
+ const renderObjectData = this.get( renderObject );
89
83
 
90
- this._init( bindGroup );
84
+ if ( renderObjectData.initialized !== true ) {
91
85
 
92
- this.backend.createBindings( bindGroup, bindings, 0 );
86
+ // bind groups are created once per object
93
87
 
94
- groupData.bindGroup = bindGroup;
88
+ this._createBindings( bindings );
95
89
 
96
- }
90
+ renderObjectData.initialized = true;
97
91
 
98
92
  }
99
93
 
@@ -110,20 +104,22 @@ class Bindings extends DataMap {
110
104
  getForCompute( computeNode ) {
111
105
 
112
106
  const bindings = this.nodes.getForCompute( computeNode ).bindings;
107
+ const computeNodeData = this.get( computeNode );
113
108
 
114
- for ( const bindGroup of bindings ) {
109
+ if ( computeNodeData.initialized !== true || computeNodeData.bindings !== bindings ) {
115
110
 
116
- const groupData = this.get( bindGroup );
111
+ // bind groups are created once per compute node version
117
112
 
118
- if ( groupData.bindGroup === undefined ) {
113
+ if ( computeNodeData.bindings !== undefined ) {
119
114
 
120
- this._init( bindGroup );
115
+ this._destroyBindings( computeNodeData.bindings );
121
116
 
122
- this.backend.createBindings( bindGroup, bindings, 0 );
117
+ }
123
118
 
124
- groupData.bindGroup = bindGroup;
119
+ this._createBindings( bindings );
125
120
 
126
- }
121
+ computeNodeData.initialized = true;
122
+ computeNodeData.bindings = bindings;
127
123
 
128
124
  }
129
125
 
@@ -160,14 +156,12 @@ class Bindings extends DataMap {
160
156
  */
161
157
  deleteForCompute( computeNode ) {
162
158
 
163
- const bindings = this.nodes.getForCompute( computeNode ).bindings;
159
+ const computeNodeData = this.get( computeNode );
160
+ const bindings = computeNodeData.bindings || this.nodes.getForCompute( computeNode ).bindings;
164
161
 
165
- for ( const bindGroup of bindings ) {
166
-
167
- this.backend.deleteBindGroupData( bindGroup );
168
- this.delete( bindGroup );
162
+ this._destroyBindings( bindings );
169
163
 
170
- }
164
+ this.delete( computeNode );
171
165
 
172
166
  }
173
167
 
@@ -180,53 +174,113 @@ class Bindings extends DataMap {
180
174
 
181
175
  const bindings = renderObject.getBindings();
182
176
 
183
- for ( const bindGroup of bindings ) {
177
+ this._destroyBindings( bindings );
184
178
 
185
- this.backend.deleteBindGroupData( bindGroup );
186
- this.delete( bindGroup );
187
-
188
- }
179
+ this.delete( renderObject );
189
180
 
190
181
  }
191
182
 
192
183
  /**
193
- * Updates the given array of bindings.
184
+ * Creates the bindings for the given array of bindings.
194
185
  *
195
186
  * @param {Array<BindGroup>} bindings - The bind groups.
196
187
  */
197
- _updateBindings( bindings ) {
188
+ _createBindings( bindings ) {
198
189
 
199
190
  for ( const bindGroup of bindings ) {
200
191
 
201
- this._update( bindGroup, bindings );
192
+ // binding group
193
+
194
+ const groupData = this.get( bindGroup );
195
+
196
+ if ( groupData.bindGroup === undefined ) {
197
+
198
+ // initialize
199
+
200
+ for ( const binding of bindGroup.bindings ) {
201
+
202
+ if ( binding.isUniformBuffer ) {
203
+
204
+ this.backend.createUniformBuffer( binding );
205
+ this.info.createUniformBuffer( binding );
206
+
207
+ } else if ( binding.isSampledTexture ) {
208
+
209
+ this.textures.updateTexture( binding.texture );
210
+
211
+ } else if ( binding.isSampler ) {
212
+
213
+ this.textures.updateSampler( binding );
214
+
215
+ } else if ( binding.isStorageBuffer ) {
216
+
217
+ const attribute = binding.attribute;
218
+ const attributeType = attribute.isIndirectStorageBufferAttribute ? AttributeType.INDIRECT : AttributeType.STORAGE;
219
+
220
+ this.attributes.update( attribute, attributeType );
221
+
222
+ }
223
+
224
+ }
225
+
226
+ // each object defines an array of bindings (ubos, textures, samplers etc.)
227
+
228
+ this.backend.createBindings( bindGroup, bindings, 0 );
229
+
230
+ groupData.bindGroup = bindGroup;
231
+ groupData.usedTimes = 1;
232
+
233
+ } else {
234
+
235
+ groupData.usedTimes ++;
236
+
237
+ }
202
238
 
203
239
  }
204
240
 
205
241
  }
206
242
 
207
243
  /**
208
- * Initializes the given bind group.
244
+ * Deletes the given array of bindings.
209
245
  *
210
- * @param {BindGroup} bindGroup - The bind group to initialize.
246
+ * @param {Array<BindGroup>} bindings - The bind groups.
211
247
  */
212
- _init( bindGroup ) {
248
+ _destroyBindings( bindings ) {
213
249
 
214
- for ( const binding of bindGroup.bindings ) {
250
+ for ( const bindGroup of bindings ) {
215
251
 
216
- if ( binding.isSampledTexture ) {
252
+ const groupData = this.get( bindGroup );
253
+ groupData.usedTimes --;
217
254
 
218
- this.textures.updateTexture( binding.texture );
255
+ if ( groupData.usedTimes === 0 ) {
219
256
 
220
- } else if ( binding.isSampler ) {
257
+ for ( const binding of bindGroup.bindings ) {
221
258
 
222
- this.textures.updateSampler( binding.texture );
259
+ if ( binding.isUniformBuffer ) {
223
260
 
224
- } else if ( binding.isStorageBuffer ) {
261
+ this.backend.destroyUniformBuffer( binding );
262
+ this.info.destroyUniformBuffer( binding );
225
263
 
226
- const attribute = binding.attribute;
227
- const attributeType = attribute.isIndirectStorageBufferAttribute ? AttributeType.INDIRECT : AttributeType.STORAGE;
264
+ // release arrays
228
265
 
229
- this.attributes.update( attribute, attributeType );
266
+ binding.release();
267
+
268
+ } else if ( binding.isSampler ) {
269
+
270
+ if ( binding.isSampledTexture !== true ) {
271
+
272
+ this.backend.destroySampler( binding );
273
+
274
+ }
275
+
276
+ binding.release();
277
+
278
+ }
279
+
280
+ }
281
+
282
+ this.backend.deleteBindGroupData( bindGroup );
283
+ this.delete( bindGroup );
230
284
 
231
285
  }
232
286
 
@@ -234,6 +288,21 @@ class Bindings extends DataMap {
234
288
 
235
289
  }
236
290
 
291
+ /**
292
+ * Updates the given array of bindings.
293
+ *
294
+ * @param {Array<BindGroup>} bindings - The bind groups.
295
+ */
296
+ _updateBindings( bindings ) {
297
+
298
+ for ( const bindGroup of bindings ) {
299
+
300
+ this._update( bindGroup, bindings );
301
+
302
+ }
303
+
304
+ }
305
+
237
306
  /**
238
307
  * Updates the given bind group.
239
308
  *
@@ -359,7 +428,7 @@ class Bindings extends DataMap {
359
428
 
360
429
  if ( updated ) {
361
430
 
362
- const samplerKey = this.textures.updateSampler( binding.texture );
431
+ const samplerKey = this.textures.updateSampler( binding );
363
432
 
364
433
  if ( binding.samplerKey !== samplerKey ) {
365
434
 
@@ -122,6 +122,15 @@ class Buffer extends Binding {
122
122
 
123
123
  }
124
124
 
125
+ /**
126
+ * Releases the buffer.
127
+ */
128
+ release() {
129
+
130
+ this._buffer = null;
131
+
132
+ }
133
+
125
134
  }
126
135
 
127
136
  export default Buffer;
@@ -1,4 +1,5 @@
1
1
  import { Matrix3 } from '../../math/Matrix3.js';
2
+ import { Matrix4 } from '../../math/Matrix4.js';
2
3
  import { Plane } from '../../math/Plane.js';
3
4
  import { Vector4 } from '../../math/Vector4.js';
4
5
 
@@ -52,6 +53,13 @@ class ClippingContext {
52
53
  */
53
54
  this.shadowPass = false;
54
55
 
56
+ /**
57
+ * The view matrix.
58
+ *
59
+ * @type {Matrix4}
60
+ */
61
+ this.viewMatrix = new Matrix4();
62
+
55
63
  /**
56
64
  * The view normal matrix.
57
65
  *
@@ -90,11 +98,11 @@ class ClippingContext {
90
98
 
91
99
  if ( parentContext !== null ) {
92
100
 
101
+ this.viewMatrix = parentContext.viewMatrix;
93
102
  this.viewNormalMatrix = parentContext.viewNormalMatrix;
94
103
  this.clippingGroupContexts = parentContext.clippingGroupContexts;
95
104
 
96
105
  this.shadowPass = parentContext.shadowPass;
97
- this.viewMatrix = parentContext.viewMatrix;
98
106
 
99
107
  }
100
108
 
@@ -137,8 +145,8 @@ class ClippingContext {
137
145
  updateGlobal( scene, camera ) {
138
146
 
139
147
  this.shadowPass = ( scene.overrideMaterial !== null && scene.overrideMaterial.isShadowPassMaterial );
140
- this.viewMatrix = camera.matrixWorldInverse;
141
148
 
149
+ this.viewMatrix.copy( camera.matrixWorldInverse );
142
150
  this.viewNormalMatrix.getNormalMatrix( this.viewMatrix );
143
151
 
144
152
  }
@@ -94,42 +94,46 @@ class Info {
94
94
  *
95
95
  * @type {Object}
96
96
  * @readonly
97
- * @property {number} geometries - The number of active geometries.
98
- * @property {number} textures - The number of active textures.
99
97
  * @property {number} attributes - The number of active attributes.
98
+ * @property {number} attributesSize - The memory size of active attributes in bytes.
99
+ * @property {number} geometries - The number of active geometries.
100
100
  * @property {number} indexAttributes - The number of active index attributes.
101
- * @property {number} storageAttributes - The number of active storage attributes.
101
+ * @property {number} indexAttributesSize - The memory size of active index attributes in bytes.
102
102
  * @property {number} indirectStorageAttributes - The number of active indirect storage attributes.
103
- * @property {number} readbackBuffers - The number of active readback buffers.
103
+ * @property {number} indirectStorageAttributesSize - The memory size of active indirect storage attributes in bytes.
104
104
  * @property {number} programs - The number of active programs.
105
+ * @property {number} programsSize - The memory size of active programs in bytes.
106
+ * @property {number} readbackBuffers - The number of active readback buffers.
107
+ * @property {number} readbackBuffersSize - The memory size of active readback buffers in bytes.
105
108
  * @property {number} renderTargets - The number of active renderTargets.
106
- * @property {number} total - The total memory size in bytes.
107
- * @property {number} texturesSize - The memory size of active textures in bytes.
108
- * @property {number} attributesSize - The memory size of active attributes in bytes.
109
- * @property {number} indexAttributesSize - The memory size of active index attributes in bytes.
109
+ * @property {number} storageAttributes - The number of active storage attributes.
110
110
  * @property {number} storageAttributesSize - The memory size of active storage attributes in bytes.
111
- * @property {number} indirectStorageAttributesSize - The memory size of active indirect storage attributes in bytes.
112
- * @property {number} readbackBuffersSize - The memory size of active readback buffers in bytes.
113
- * @property {number} programsSize - The memory size of active programs in bytes.
111
+ * @property {number} textures - The number of active textures.
112
+ * @property {number} texturesSize - The memory size of active textures in bytes.
113
+ * @property {number} uniformBuffers - The number of active uniform buffers.
114
+ * @property {number} uniformBuffersSize - The memory size of active uniform buffers in bytes.
115
+ * @property {number} total - The total memory size in bytes.
114
116
  */
115
117
  this.memory = {
116
- geometries: 0,
117
- textures: 0,
118
118
  attributes: 0,
119
+ attributesSize: 0,
120
+ geometries: 0,
119
121
  indexAttributes: 0,
120
- storageAttributes: 0,
122
+ indexAttributesSize: 0,
121
123
  indirectStorageAttributes: 0,
122
- readbackBuffers: 0,
124
+ indirectStorageAttributesSize: 0,
123
125
  programs: 0,
126
+ programsSize: 0,
127
+ readbackBuffers: 0,
128
+ readbackBuffersSize: 0,
124
129
  renderTargets: 0,
125
- total: 0,
126
- texturesSize: 0,
127
- attributesSize: 0,
128
- indexAttributesSize: 0,
130
+ storageAttributes: 0,
129
131
  storageAttributesSize: 0,
130
- indirectStorageAttributesSize: 0,
131
- readbackBuffersSize: 0,
132
- programsSize: 0
132
+ textures: 0,
133
+ texturesSize: 0,
134
+ uniformBuffers: 0,
135
+ uniformBuffersSize: 0,
136
+ total: 0
133
137
  };
134
138
 
135
139
  /**
@@ -365,6 +369,43 @@ class Info {
365
369
 
366
370
  }
367
371
 
372
+ /**
373
+ * Tracks a uniform buffer memory explicitly.
374
+ *
375
+ * @param {UniformBuffer} uniformBuffer - The uniform buffer to track.
376
+ */
377
+ createUniformBuffer( uniformBuffer ) {
378
+
379
+ const size = uniformBuffer.byteLength;
380
+ this.memoryMap.set( uniformBuffer, { size, type: 'uniformBuffers' } );
381
+
382
+ this.memory.uniformBuffers ++;
383
+ this.memory.total += size;
384
+ this.memory.uniformBuffersSize += size;
385
+
386
+ }
387
+
388
+ /**
389
+ * Tracks a uniform buffer memory explicitly.
390
+ *
391
+ * @param {UniformBuffer} uniformBuffer - The uniform buffer to track.
392
+ */
393
+ destroyUniformBuffer( uniformBuffer ) {
394
+
395
+ const data = this.memoryMap.get( uniformBuffer );
396
+
397
+ if ( data ) {
398
+
399
+ this.memoryMap.delete( uniformBuffer );
400
+
401
+ this.memory.uniformBuffers --;
402
+ this.memory.total -= data.size;
403
+ this.memory.uniformBuffersSize -= data.size;
404
+
405
+ }
406
+
407
+ }
408
+
368
409
  /**
369
410
  * Tracks program memory explicitly, updating counts and byte tracking.
370
411
  *
@@ -19,6 +19,29 @@ const _weakMap = /*@__PURE__*/ new WeakMap();
19
19
  */
20
20
  class Lighting {
21
21
 
22
+ /**
23
+ * Constructs a new lighting manager.
24
+ */
25
+ constructor() {
26
+
27
+ /**
28
+ * Whether this lighting manager is enabled or not.
29
+ *
30
+ * @type {boolean}
31
+ * @default true
32
+ */
33
+ this.enabled = true;
34
+
35
+ /**
36
+ * A stack of light arrays saved per render via {@link Lighting#beginRender}.
37
+ *
38
+ * @private
39
+ * @type {Array<Array<Light>>}
40
+ */
41
+ this._cache = [];
42
+
43
+ }
44
+
22
45
  /**
23
46
  * Creates a new lights node for the given array of lights.
24
47
  *
@@ -48,17 +71,15 @@ class Lighting {
48
71
  // !WITH_GENESYS
49
72
 
50
73
  /**
51
- * Returns a lights node for the given scene and camera.
74
+ * Returns a lights node for the given scene.
52
75
  *
53
76
  * @param {Scene} scene - The scene.
54
- * @param {Camera} camera - The camera.
55
77
  * @return {LightsNode} The lights node.
56
78
  */
57
79
  getNode( scene ) {
58
80
 
59
- // ignore post-processing
60
-
61
- if ( scene.isQuadMesh ) return _defaultLights;
81
+ // Ignore renderable objects, e.g: Mesh, Sprite, etc.
82
+ if ( scene.isScene !== true && scene.isGroup !== true ) return _defaultLights;
62
83
 
63
84
  let node = _weakMap.get( scene );
64
85
 
@@ -73,6 +94,33 @@ class Lighting {
73
94
 
74
95
  }
75
96
 
97
+ /**
98
+ * Saves the current lights of the scene's lights node so they can be restored
99
+ * in {@link Lighting#finishRender}. Must be paired with a `finishRender()` call
100
+ * to avoid memory leaks.
101
+ *
102
+ * Nested render calls might mutate the lights array so a save/restore is required
103
+ * for each render call.
104
+ *
105
+ * @param {Scene} scene - The scene.
106
+ */
107
+ beginRender( scene ) {
108
+
109
+ this._cache.push( this.getNode( scene ).getLights() );
110
+
111
+ }
112
+
113
+ /**
114
+ * Restores the lights saved by the matching {@link Lighting#beginRender} call.
115
+ *
116
+ * @param {Scene} scene - The scene.
117
+ */
118
+ finishRender( scene ) {
119
+
120
+ this.getNode( scene ).setLights( this._cache.pop() );
121
+
122
+ }
123
+
76
124
  }
77
125
 
78
126
  export default Lighting;
@@ -1,5 +1,7 @@
1
1
  import { DoubleSide } from '../../constants.js';
2
2
 
3
+ const _emptyArray = /*@__PURE__*/ Object.freeze( [] );
4
+
3
5
  /**
4
6
  * Default sorting function for opaque render items.
5
7
  *
@@ -144,6 +146,13 @@ class RenderList {
144
146
  */
145
147
  this.bundles = [];
146
148
 
149
+ /**
150
+ * The lighting management component.
151
+ *
152
+ * @type {Lighting}
153
+ */
154
+ this.lighting = lighting;
155
+
147
156
  /**
148
157
  * The render list's lights node. This node is later
149
158
  * relevant for the actual analytical light nodes which
@@ -151,7 +160,7 @@ class RenderList {
151
160
  *
152
161
  * @type {LightsNode}
153
162
  */
154
- this.lightsNode = lighting.getNode( scene, camera );
163
+ this.lightsNode = lighting.getNode( scene );
155
164
 
156
165
  /**
157
166
  * The scene's lights stored in an array. This array
@@ -192,6 +201,18 @@ class RenderList {
192
201
  */
193
202
  this.occlusionQueryCount = 0;
194
203
 
204
+ /**
205
+ * The last object that was counted for occlusion query testing. Used to
206
+ * avoid counting an object more than once when it produces multiple render
207
+ * items (e.g. a mesh with multiple material groups), since such an object
208
+ * is covered by a single occlusion query.
209
+ *
210
+ * @private
211
+ * @type {?Object3D}
212
+ * @default null
213
+ */
214
+ this._lastOcclusionObject = null;
215
+
195
216
  }
196
217
 
197
218
  /**
@@ -293,7 +314,12 @@ class RenderList {
293
314
 
294
315
  const renderItem = this.getNextRenderItem( object, geometry, material, groupOrder, z, group, clippingContext );
295
316
 
296
- if ( object.occlusionTest === true ) this.occlusionQueryCount ++;
317
+ if ( object.occlusionTest === true && this._lastOcclusionObject !== object ) {
318
+
319
+ this.occlusionQueryCount ++;
320
+ this._lastOcclusionObject = object;
321
+
322
+ }
297
323
 
298
324
  if ( material.transparent === true || material.transmission > 0 ||
299
325
  ( material.transmissionNode && material.transmissionNode.isNode ) ||
@@ -383,13 +409,22 @@ class RenderList {
383
409
  *
384
410
  * @param {?function(any, any): number} customOpaqueSort - A custom sort function for opaque objects.
385
411
  * @param {?function(any, any): number} customTransparentSort - A custom sort function for transparent objects.
412
+ * @param {boolean} reversedDepth - Whether a reversed depth buffer is used or not.
386
413
  */
387
- sort( customOpaqueSort, customTransparentSort ) {
414
+ sort( customOpaqueSort, customTransparentSort, reversedDepth ) {
388
415
 
389
416
  if ( this.opaque.length > 1 ) this.opaque.sort( customOpaqueSort || painterSortStable );
390
417
  if ( this.transparentDoublePass.length > 1 ) this.transparentDoublePass.sort( customTransparentSort || reversePainterSortStable );
391
418
  if ( this.transparent.length > 1 ) this.transparent.sort( customTransparentSort || reversePainterSortStable );
392
419
 
420
+ if ( reversedDepth ) {
421
+
422
+ this.opaque.reverse();
423
+ this.transparentDoublePass.reverse();
424
+ this.transparent.reverse();
425
+
426
+ }
427
+
393
428
  }
394
429
 
395
430
  /**
@@ -400,7 +435,8 @@ class RenderList {
400
435
 
401
436
  // update lights
402
437
 
403
- this.lightsNode.setLights( this.lightsArray );
438
+ this.lightsNode.setLights( this.lighting.enabled ? this.lightsArray : _emptyArray );
439
+
404
440
  // WITH_GENESYS
405
441
  this.lightsNode.setLightProbeGrids( this.lightProbeGridsArray );
406
442
  // !WITH_GENESYS
@@ -425,6 +461,8 @@ class RenderList {
425
461
 
426
462
  }
427
463
 
464
+ this._lastOcclusionObject = null;
465
+
428
466
  }
429
467
 
430
468
  }