@gnsx/three 0.184.20 → 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 (366) hide show
  1. package/build/three.cjs +1261 -926
  2. package/build/three.core.js +1104 -829
  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/renderers/WebGLRenderer.js +21 -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 +42 -4
  259. package/src/renderers/common/RenderObject.js +73 -13
  260. package/src/renderers/common/Renderer.js +282 -109
  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 +11 -4
  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
@@ -298,6 +298,10 @@ class WebGLRenderer {
298
298
  let _isContextLost = false;
299
299
  let _nodesHandler = null;
300
300
 
301
+ let _scratchFramebuffer = null;
302
+ let _srcFramebuffer = null;
303
+ let _dstFramebuffer = null;
304
+
301
305
  // internal state cache
302
306
 
303
307
  this._outputColorSpace = SRGBColorSpace;
@@ -397,11 +401,11 @@ class WebGLRenderer {
397
401
 
398
402
  if ( getContext( contextName ) ) {
399
403
 
400
- throw new Error( 'Error creating WebGL context with your selected attributes.' );
404
+ throw new Error( 'THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.' );
401
405
 
402
406
  } else {
403
407
 
404
- throw new Error( 'Error creating WebGL context.' );
408
+ throw new Error( 'THREE.WebGLRenderer: Error creating WebGL context.' );
405
409
 
406
410
  }
407
411
 
@@ -441,6 +445,10 @@ class WebGLRenderer {
441
445
 
442
446
  }
443
447
 
448
+ _scratchFramebuffer = _gl.createFramebuffer();
449
+ _srcFramebuffer = _gl.createFramebuffer();
450
+ _dstFramebuffer = _gl.createFramebuffer();
451
+
444
452
  info = new WebGLInfo( _gl );
445
453
  properties = new WebGLProperties();
446
454
  textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
@@ -547,7 +555,7 @@ class WebGLRenderer {
547
555
 
548
556
  if ( _outputBufferType !== UnsignedByteType ) {
549
557
 
550
- output = new WebGLOutput( _outputBufferType, canvas.width, canvas.height, depth, stencil );
558
+ output = new WebGLOutput( _outputBufferType, canvas.width, canvas.height, antialias, depth, stencil );
551
559
 
552
560
  }
553
561
 
@@ -731,7 +739,7 @@ class WebGLRenderer {
731
739
 
732
740
  if ( _outputBufferType === UnsignedByteType ) {
733
741
 
734
- error( 'THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.' );
742
+ error( 'WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.' );
735
743
  return;
736
744
 
737
745
  }
@@ -742,7 +750,7 @@ class WebGLRenderer {
742
750
 
743
751
  if ( effects[ i ].isOutputPass === true ) {
744
752
 
745
- warn( 'THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.' );
753
+ warn( 'WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.' );
746
754
  break;
747
755
 
748
756
  }
@@ -1180,7 +1188,7 @@ class WebGLRenderer {
1180
1188
 
1181
1189
  if ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)
1182
1190
 
1183
- const frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );
1191
+ const frontFaceCW = ( object.isMesh && object.matrixWorld.determinantAffine() < 0 );
1184
1192
 
1185
1193
  const program = setProgram( camera, scene, geometry, material, object );
1186
1194
 
@@ -1714,7 +1722,9 @@ class WebGLRenderer {
1714
1722
  // WITH_GENESYS
1715
1723
  ProfilerService.begin( 'sortRenderList' );
1716
1724
  // !WITH_GENESYS
1717
- currentRenderList.sort( _opaqueSort, _transparentSort );
1725
+
1726
+ currentRenderList.sort( _opaqueSort, _transparentSort, camera.reversedDepth );
1727
+
1718
1728
  // WITH_GENESYS
1719
1729
  ProfilerService.end( 'sortRenderList' );
1720
1730
  // !WITH_GENESYS
@@ -1736,6 +1746,8 @@ class WebGLRenderer {
1736
1746
 
1737
1747
  this.info.render.frame ++;
1738
1748
 
1749
+ if ( this.info.autoReset === true ) this.info.reset();
1750
+
1739
1751
  if ( _clippingEnabled === true ) clipping.beginShadows();
1740
1752
 
1741
1753
  const shadowsArray = currentRenderState.state.shadowsArray;
@@ -1752,8 +1764,6 @@ class WebGLRenderer {
1752
1764
 
1753
1765
  //
1754
1766
 
1755
- if ( this.info.autoReset === true ) this.info.reset();
1756
-
1757
1767
  // render scene (skip if first effect is a render pass - it will render the scene itself)
1758
1768
 
1759
1769
  const skipSceneRender = useOutput && output.hasRenderPass();
@@ -2959,8 +2969,6 @@ class WebGLRenderer {
2959
2969
 
2960
2970
  };
2961
2971
 
2962
- const _scratchFrameBuffer = _gl.createFramebuffer();
2963
-
2964
2972
  /**
2965
2973
  * Sets the active rendertarget.
2966
2974
  *
@@ -3024,7 +3032,7 @@ class WebGLRenderer {
3024
3032
  ( renderTarget.width !== depthTexture.image.width || renderTarget.height !== depthTexture.image.height )
3025
3033
  ) {
3026
3034
 
3027
- throw new Error( 'WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.' );
3035
+ throw new Error( 'THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.' );
3028
3036
 
3029
3037
  }
3030
3038
 
@@ -3093,7 +3101,7 @@ class WebGLRenderer {
3093
3101
  // being bound that are different sizes.
3094
3102
  if ( activeMipmapLevel !== 0 ) {
3095
3103
 
3096
- framebuffer = _scratchFrameBuffer;
3104
+ framebuffer = _scratchFramebuffer;
3097
3105
 
3098
3106
  }
3099
3107
 
@@ -3336,8 +3344,6 @@ class WebGLRenderer {
3336
3344
 
3337
3345
  };
3338
3346
 
3339
- const _srcFramebuffer = _gl.createFramebuffer();
3340
- const _dstFramebuffer = _gl.createFramebuffer();
3341
3347
 
3342
3348
  /**
3343
3349
  * Copies data of the given source texture into a destination texture.
@@ -16,7 +16,6 @@ import { REVISION, TimestampQuery } from '../../constants.js';
16
16
  * implement the interface.
17
17
  *
18
18
  * @abstract
19
- * @private
20
19
  */
21
20
  class Backend {
22
21
 
@@ -124,6 +123,15 @@ class Backend {
124
123
  */
125
124
  finishRender( /*renderContext*/ ) {}
126
125
 
126
+ /**
127
+ * Sets the XR rendering destination.
128
+ *
129
+ * Backends that render directly into XR framebuffers can override this hook.
130
+ *
131
+ * @param {?Object} xrTarget - The XR rendering destination.
132
+ */
133
+ setXRTarget( /*xrTarget*/ ) {}
134
+
127
135
  /**
128
136
  * This method is executed at the beginning of a compute call and
129
137
  * can be used by the backend to prepare the state for upcoming
@@ -276,10 +284,18 @@ class Backend {
276
284
  * Updates a GPU sampler for the given texture.
277
285
  *
278
286
  * @abstract
279
- * @param {Texture} texture - The texture to update the sampler for.
287
+ * @param {Sampler} binding - The sampler binding to update.
280
288
  * @return {string} The current sampler key.
281
289
  */
282
- updateSampler( /*texture*/ ) { }
290
+ updateSampler( /*binding*/ ) { }
291
+
292
+ /**
293
+ * Frees the GPU sampler for the given sampler binding.
294
+ *
295
+ * @abstract
296
+ * @param {Sampler} binding - The sampler binding to free.
297
+ */
298
+ destroySampler( /*binding*/ ) { }
283
299
 
284
300
  /**
285
301
  * Creates a default texture for the given texture that can be used
@@ -389,6 +405,22 @@ class Backend {
389
405
  */
390
406
  createStorageAttribute( /*attribute*/ ) { }
391
407
 
408
+ /**
409
+ * Creates a uniform buffer.
410
+ *
411
+ * @abstract
412
+ * @param {Buffer} uniformBuffer - The uniform buffer.
413
+ */
414
+ createUniformBuffer( /*uniformBuffer*/ ) { }
415
+
416
+ /**
417
+ * Destroys a uniform buffer.
418
+ *
419
+ * @abstract
420
+ * @param {Buffer} uniformBuffer - The uniform buffer.
421
+ */
422
+ destroyUniformBuffer( /*uniformBuffer*/ ) { }
423
+
392
424
  /**
393
425
  * Updates the GPU buffer of a shader attribute.
394
426
  *
@@ -516,17 +548,29 @@ class Backend {
516
548
 
517
549
  }
518
550
 
551
+ /**
552
+ * Whether the backend supports query timestamps or not.
553
+ *
554
+ * @type {boolean}
555
+ * @readonly
556
+ */
557
+ get hasTimestamp() {
558
+
559
+ return false;
560
+
561
+ }
562
+
519
563
  /**
520
564
  * Returns `true` if a timestamp for the given uid is available.
521
565
  *
522
566
  * @param {string} uid - The unique identifier.
523
567
  * @return {boolean} Whether the timestamp is available or not.
524
568
  */
525
- hasTimestamp( uid ) {
569
+ hasTimestampQuery( uid ) {
526
570
 
527
571
  const queryPool = this._getQueryPool( uid );
528
572
 
529
- return queryPool.hasTimestamp( uid );
573
+ return queryPool.hasTimestampQuery( uid );
530
574
 
531
575
  }
532
576
 
@@ -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
  *