@babylonjs/core 7.2.2 → 7.2.3

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 (376) hide show
  1. package/Animations/runtimeAnimation.d.ts +1 -0
  2. package/Animations/runtimeAnimation.js +12 -3
  3. package/Animations/runtimeAnimation.js.map +1 -1
  4. package/Audio/audioEngine.js +2 -2
  5. package/Audio/audioEngine.js.map +1 -1
  6. package/Bones/boneLookController.js +3 -0
  7. package/Bones/boneLookController.js.map +1 -1
  8. package/Buffers/buffer.d.ts +5 -5
  9. package/Buffers/buffer.js.map +1 -1
  10. package/Buffers/storageBuffer.d.ts +2 -2
  11. package/Buffers/storageBuffer.js.map +1 -1
  12. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
  13. package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
  14. package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
  15. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
  16. package/Compute/computeEffect.d.ts +3 -3
  17. package/Compute/computeEffect.js.map +1 -1
  18. package/Compute/computeShader.d.ts +10 -2
  19. package/Compute/computeShader.js +53 -35
  20. package/Compute/computeShader.js.map +1 -1
  21. package/DeviceInput/InputDevices/deviceSourceManager.d.ts +2 -2
  22. package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
  23. package/DeviceInput/internalDeviceSourceManager.d.ts +4 -4
  24. package/DeviceInput/internalDeviceSourceManager.js.map +1 -1
  25. package/DeviceInput/webDeviceInputSystem.d.ts +2 -2
  26. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  27. package/Engines/AbstractEngine/abstractEngine.alpha.d.ts +10 -0
  28. package/Engines/AbstractEngine/abstractEngine.alpha.js +29 -0
  29. package/Engines/AbstractEngine/abstractEngine.alpha.js.map +1 -0
  30. package/Engines/AbstractEngine/abstractEngine.cubeTexture.d.ts +17 -0
  31. package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +138 -0
  32. package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -0
  33. package/Engines/AbstractEngine/abstractEngine.dom.d.ts +61 -0
  34. package/Engines/AbstractEngine/abstractEngine.dom.js +27 -0
  35. package/Engines/AbstractEngine/abstractEngine.dom.js.map +1 -0
  36. package/Engines/AbstractEngine/abstractEngine.loadingScreen.d.ts +30 -0
  37. package/Engines/AbstractEngine/abstractEngine.loadingScreen.js +48 -0
  38. package/Engines/AbstractEngine/abstractEngine.loadingScreen.js.map +1 -0
  39. package/Engines/AbstractEngine/abstractEngine.query.d.ts +122 -0
  40. package/Engines/AbstractEngine/abstractEngine.query.js +175 -0
  41. package/Engines/AbstractEngine/abstractEngine.query.js.map +1 -0
  42. package/Engines/AbstractEngine/abstractEngine.renderPass.d.ts +26 -0
  43. package/Engines/AbstractEngine/abstractEngine.renderPass.js +29 -0
  44. package/Engines/AbstractEngine/abstractEngine.renderPass.js.map +1 -0
  45. package/Engines/AbstractEngine/abstractEngine.states.d.ts +162 -0
  46. package/Engines/AbstractEngine/abstractEngine.states.js +105 -0
  47. package/Engines/AbstractEngine/abstractEngine.states.js.map +1 -0
  48. package/Engines/AbstractEngine/abstractEngine.texture.d.ts +16 -0
  49. package/Engines/AbstractEngine/abstractEngine.texture.js +11 -0
  50. package/Engines/AbstractEngine/abstractEngine.texture.js.map +1 -0
  51. package/Engines/AbstractEngine/index.d.ts +8 -0
  52. package/Engines/AbstractEngine/index.js +10 -0
  53. package/Engines/AbstractEngine/index.js.map +1 -0
  54. package/Engines/Extensions/engine.alpha.d.ts +0 -24
  55. package/Engines/Extensions/engine.alpha.js +0 -35
  56. package/Engines/Extensions/engine.alpha.js.map +1 -1
  57. package/Engines/Extensions/engine.computeShader.d.ts +15 -2
  58. package/Engines/Extensions/engine.computeShader.js +5 -1
  59. package/Engines/Extensions/engine.computeShader.js.map +1 -1
  60. package/Engines/Extensions/engine.cubeTexture.d.ts +0 -8
  61. package/Engines/Extensions/engine.cubeTexture.js +2 -135
  62. package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
  63. package/Engines/Extensions/engine.debugging.d.ts +2 -2
  64. package/Engines/Extensions/engine.debugging.js +5 -5
  65. package/Engines/Extensions/engine.debugging.js.map +1 -1
  66. package/Engines/Extensions/engine.dynamicTexture.js +3 -2
  67. package/Engines/Extensions/engine.dynamicTexture.js.map +1 -1
  68. package/Engines/Extensions/engine.multiview.js.map +1 -1
  69. package/Engines/Extensions/engine.query.d.ts +5 -120
  70. package/Engines/Extensions/engine.query.js +14 -150
  71. package/Engines/Extensions/engine.query.js.map +1 -1
  72. package/Engines/Extensions/engine.renderTarget.js +0 -9
  73. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  74. package/Engines/Extensions/engine.views.d.ts +3 -2
  75. package/Engines/Extensions/engine.views.js.map +1 -1
  76. package/Engines/Processors/iShaderProcessor.d.ts +2 -2
  77. package/Engines/Processors/iShaderProcessor.js.map +1 -1
  78. package/Engines/Processors/shaderProcessor.d.ts +3 -3
  79. package/Engines/Processors/shaderProcessor.js.map +1 -1
  80. package/Engines/WebGL/webGLRenderTargetWrapper.js +12 -9
  81. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  82. package/Engines/WebGL/webGLShaderProcessors.d.ts +2 -2
  83. package/Engines/WebGL/webGLShaderProcessors.js.map +1 -1
  84. package/Engines/WebGPU/Extensions/engine.alpha.d.ts +35 -0
  85. package/Engines/WebGPU/Extensions/engine.alpha.js +4 -4
  86. package/Engines/WebGPU/Extensions/engine.alpha.js.map +1 -1
  87. package/Engines/WebGPU/Extensions/engine.computeShader.d.ts +9 -0
  88. package/Engines/WebGPU/Extensions/engine.computeShader.js +13 -2
  89. package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
  90. package/Engines/WebGPU/Extensions/engine.cubeTexture.d.ts +78 -1
  91. package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
  92. package/Engines/WebGPU/Extensions/engine.dynamicTexture.d.ts +27 -1
  93. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +3 -3
  94. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
  95. package/Engines/WebGPU/Extensions/engine.externalTexture.d.ts +16 -0
  96. package/Engines/WebGPU/Extensions/engine.externalTexture.js.map +1 -1
  97. package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +55 -1
  98. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  99. package/Engines/WebGPU/Extensions/engine.query.d.ts +1 -1
  100. package/Engines/WebGPU/Extensions/engine.query.js +1 -0
  101. package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
  102. package/Engines/WebGPU/Extensions/engine.rawTexture.d.ts +185 -1
  103. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  104. package/Engines/WebGPU/Extensions/engine.readTexture.d.ts +10 -1
  105. package/Engines/WebGPU/Extensions/engine.readTexture.js.map +1 -1
  106. package/Engines/WebGPU/Extensions/engine.renderTarget.d.ts +38 -1
  107. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  108. package/Engines/WebGPU/Extensions/engine.renderTargetCube.d.ts +13 -1
  109. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
  110. package/Engines/WebGPU/Extensions/engine.storageBuffer.d.ts +38 -1
  111. package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
  112. package/Engines/WebGPU/Extensions/engine.textureSampler.d.ts +10 -0
  113. package/Engines/WebGPU/Extensions/engine.textureSampler.js.map +1 -1
  114. package/Engines/WebGPU/Extensions/engine.videoTexture.d.ts +14 -1
  115. package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
  116. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.d.ts +2 -2
  117. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  118. package/Engines/abstractEngine.d.ts +1688 -0
  119. package/Engines/abstractEngine.js +1354 -0
  120. package/Engines/abstractEngine.js.map +1 -0
  121. package/Engines/engine.common.d.ts +39 -0
  122. package/Engines/engine.common.js +226 -0
  123. package/Engines/engine.common.js.map +1 -0
  124. package/Engines/engine.d.ts +40 -447
  125. package/Engines/engine.js +64 -810
  126. package/Engines/engine.js.map +1 -1
  127. package/Engines/engineFactory.d.ts +2 -2
  128. package/Engines/engineFactory.js.map +1 -1
  129. package/Engines/engineStore.d.ts +4 -4
  130. package/Engines/engineStore.js.map +1 -1
  131. package/Engines/index.d.ts +3 -0
  132. package/Engines/index.js +3 -0
  133. package/Engines/index.js.map +1 -1
  134. package/Engines/nativeEngine.d.ts +1 -1
  135. package/Engines/nativeEngine.js +2 -1
  136. package/Engines/nativeEngine.js.map +1 -1
  137. package/Engines/nullEngine.d.ts +2 -2
  138. package/Engines/nullEngine.js +2 -3
  139. package/Engines/nullEngine.js.map +1 -1
  140. package/Engines/renderTargetWrapper.d.ts +3 -3
  141. package/Engines/renderTargetWrapper.js.map +1 -1
  142. package/Engines/thinEngine.d.ts +35 -591
  143. package/Engines/thinEngine.js +84 -1134
  144. package/Engines/thinEngine.js.map +1 -1
  145. package/Engines/webgpuEngine.d.ts +149 -109
  146. package/Engines/webgpuEngine.js +249 -161
  147. package/Engines/webgpuEngine.js.map +1 -1
  148. package/Instrumentation/engineInstrumentation.d.ts +5 -4
  149. package/Instrumentation/engineInstrumentation.js.map +1 -1
  150. package/Layers/effectLayer.d.ts +2 -2
  151. package/Layers/effectLayer.js +3 -3
  152. package/Layers/effectLayer.js.map +1 -1
  153. package/Layers/effectLayerSceneComponent.js.map +1 -1
  154. package/Layers/glowLayer.js +3 -3
  155. package/Layers/glowLayer.js.map +1 -1
  156. package/Layers/highlightLayer.js +3 -3
  157. package/Layers/highlightLayer.js.map +1 -1
  158. package/Layers/layerSceneComponent.js.map +1 -1
  159. package/Loading/loadingScreen.js +2 -2
  160. package/Loading/loadingScreen.js.map +1 -1
  161. package/Loading/sceneLoader.d.ts +3 -3
  162. package/Loading/sceneLoader.js +1 -1
  163. package/Loading/sceneLoader.js.map +1 -1
  164. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  165. package/Materials/Textures/Filtering/hdrFiltering.d.ts +2 -2
  166. package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
  167. package/Materials/Textures/Loaders/basisTextureLoader.js +2 -2
  168. package/Materials/Textures/Loaders/basisTextureLoader.js.map +1 -1
  169. package/Materials/Textures/MultiviewRenderTarget.d.ts +1 -0
  170. package/Materials/Textures/MultiviewRenderTarget.js +1 -0
  171. package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
  172. package/Materials/Textures/Procedurals/proceduralTexture.js +1 -1
  173. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  174. package/Materials/Textures/baseTexture.d.ts +3 -3
  175. package/Materials/Textures/baseTexture.js.map +1 -1
  176. package/Materials/Textures/colorGradingTexture.d.ts +2 -2
  177. package/Materials/Textures/colorGradingTexture.js.map +1 -1
  178. package/Materials/Textures/cubeTexture.d.ts +3 -2
  179. package/Materials/Textures/cubeTexture.js +1 -0
  180. package/Materials/Textures/cubeTexture.js.map +1 -1
  181. package/Materials/Textures/hdrCubeTexture.d.ts +2 -2
  182. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  183. package/Materials/Textures/htmlElementTexture.d.ts +2 -2
  184. package/Materials/Textures/htmlElementTexture.js.map +1 -1
  185. package/Materials/Textures/internalTexture.d.ts +3 -3
  186. package/Materials/Textures/internalTexture.js.map +1 -1
  187. package/Materials/Textures/rawTexture.d.ts +10 -10
  188. package/Materials/Textures/rawTexture.js.map +1 -1
  189. package/Materials/Textures/renderTargetTexture.d.ts +4 -4
  190. package/Materials/Textures/renderTargetTexture.js +4 -4
  191. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  192. package/Materials/Textures/texture.d.ts +2 -2
  193. package/Materials/Textures/texture.js.map +1 -1
  194. package/Materials/Textures/thinTexture.d.ts +3 -3
  195. package/Materials/Textures/thinTexture.js +1 -1
  196. package/Materials/Textures/thinTexture.js.map +1 -1
  197. package/Materials/drawWrapper.d.ts +2 -3
  198. package/Materials/drawWrapper.functions.d.ts +8 -0
  199. package/Materials/drawWrapper.functions.js +9 -0
  200. package/Materials/drawWrapper.functions.js.map +1 -0
  201. package/Materials/drawWrapper.js +0 -3
  202. package/Materials/drawWrapper.js.map +1 -1
  203. package/Materials/effect.d.ts +4 -5
  204. package/Materials/effect.js.map +1 -1
  205. package/Materials/effectRenderer.d.ts +4 -4
  206. package/Materials/effectRenderer.js.map +1 -1
  207. package/Materials/index.d.ts +1 -0
  208. package/Materials/index.js +1 -0
  209. package/Materials/index.js.map +1 -1
  210. package/Materials/materialHelper.functions.d.ts +2 -2
  211. package/Materials/materialHelper.functions.js.map +1 -1
  212. package/Materials/materialPluginBase.d.ts +4 -4
  213. package/Materials/materialPluginBase.js.map +1 -1
  214. package/Materials/materialPluginManager.d.ts +2 -2
  215. package/Materials/materialPluginManager.js.map +1 -1
  216. package/Materials/meshDebugPluginMaterial.js +1 -1
  217. package/Materials/meshDebugPluginMaterial.js.map +1 -1
  218. package/Materials/uniformBuffer.d.ts +2 -2
  219. package/Materials/uniformBuffer.js.map +1 -1
  220. package/Meshes/Builders/greasedLineBuilder.d.ts +6 -0
  221. package/Meshes/Builders/greasedLineBuilder.js +15 -8
  222. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  223. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +1 -1
  224. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  225. package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +2 -2
  226. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  227. package/Meshes/GreasedLine/greasedLineMesh.js +1 -1
  228. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  229. package/Meshes/geometry.d.ts +2 -2
  230. package/Meshes/geometry.js +3 -2
  231. package/Meshes/geometry.js.map +1 -1
  232. package/Meshes/instancedMesh.js.map +1 -1
  233. package/Meshes/mesh.d.ts +3 -3
  234. package/Meshes/mesh.js.map +1 -1
  235. package/Meshes/subMesh.d.ts +2 -2
  236. package/Meshes/subMesh.js.map +1 -1
  237. package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js.map +1 -1
  238. package/Misc/copyTextureToTexture.d.ts +2 -2
  239. package/Misc/copyTextureToTexture.js.map +1 -1
  240. package/Misc/dds.d.ts +3 -2
  241. package/Misc/dds.js +2 -1
  242. package/Misc/dds.js.map +1 -1
  243. package/Misc/dumpTools.d.ts +2 -2
  244. package/Misc/dumpTools.js.map +1 -1
  245. package/Misc/fileTools.js +3 -3
  246. package/Misc/fileTools.js.map +1 -1
  247. package/Misc/khronosTextureContainer2.d.ts +8 -2
  248. package/Misc/khronosTextureContainer2.js +3 -2
  249. package/Misc/khronosTextureContainer2.js.map +1 -1
  250. package/Misc/minMaxReducer.d.ts +2 -2
  251. package/Misc/minMaxReducer.js.map +1 -1
  252. package/Misc/textureTools.js.map +1 -1
  253. package/Misc/tools.d.ts +7 -7
  254. package/Misc/tools.functions.d.ts +26 -0
  255. package/Misc/tools.functions.js +62 -0
  256. package/Misc/tools.functions.js.map +1 -1
  257. package/Misc/tools.js.map +1 -1
  258. package/Misc/videoRecorder.d.ts +3 -3
  259. package/Misc/videoRecorder.js.map +1 -1
  260. package/Particles/baseParticleSystem.d.ts +2 -2
  261. package/Particles/baseParticleSystem.js.map +1 -1
  262. package/Particles/computeShaderParticleSystem.d.ts +2 -2
  263. package/Particles/computeShaderParticleSystem.js.map +1 -1
  264. package/Particles/gpuParticleSystem.d.ts +3 -3
  265. package/Particles/gpuParticleSystem.js +2 -2
  266. package/Particles/gpuParticleSystem.js.map +1 -1
  267. package/Particles/particle.js +1 -1
  268. package/Particles/particle.js.map +1 -1
  269. package/Particles/particleSystem.d.ts +3 -3
  270. package/Particles/particleSystem.js +3 -3
  271. package/Particles/particleSystem.js.map +1 -1
  272. package/Particles/particleSystemComponent.d.ts +2 -2
  273. package/Particles/particleSystemComponent.js +2 -2
  274. package/Particles/particleSystemComponent.js.map +1 -1
  275. package/Particles/subEmitter.d.ts +3 -3
  276. package/Particles/subEmitter.js.map +1 -1
  277. package/Particles/thinParticleSystem.d.ts +2 -2
  278. package/Particles/thinParticleSystem.js.map +1 -1
  279. package/Physics/v2/physicsBody.js +3 -3
  280. package/Physics/v2/physicsBody.js.map +1 -1
  281. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  282. package/PostProcesses/RenderPipeline/postProcessRenderEffect.d.ts +2 -2
  283. package/PostProcesses/RenderPipeline/postProcessRenderEffect.js.map +1 -1
  284. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.d.ts +2 -2
  285. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
  286. package/PostProcesses/blackAndWhitePostProcess.d.ts +2 -2
  287. package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
  288. package/PostProcesses/bloomMergePostProcess.d.ts +2 -2
  289. package/PostProcesses/bloomMergePostProcess.js.map +1 -1
  290. package/PostProcesses/blurPostProcess.d.ts +2 -2
  291. package/PostProcesses/blurPostProcess.js.map +1 -1
  292. package/PostProcesses/chromaticAberrationPostProcess.d.ts +2 -2
  293. package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
  294. package/PostProcesses/circleOfConfusionPostProcess.d.ts +2 -2
  295. package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
  296. package/PostProcesses/colorCorrectionPostProcess.d.ts +2 -2
  297. package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
  298. package/PostProcesses/convolutionPostProcess.d.ts +2 -2
  299. package/PostProcesses/convolutionPostProcess.js.map +1 -1
  300. package/PostProcesses/depthOfFieldBlurPostProcess.d.ts +2 -2
  301. package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
  302. package/PostProcesses/depthOfFieldEffect.js +1 -1
  303. package/PostProcesses/depthOfFieldEffect.js.map +1 -1
  304. package/PostProcesses/depthOfFieldMergePostProcess.d.ts +2 -2
  305. package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
  306. package/PostProcesses/displayPassPostProcess.d.ts +2 -2
  307. package/PostProcesses/displayPassPostProcess.js.map +1 -1
  308. package/PostProcesses/extractHighlightsPostProcess.d.ts +2 -2
  309. package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
  310. package/PostProcesses/filterPostProcess.d.ts +2 -2
  311. package/PostProcesses/filterPostProcess.js.map +1 -1
  312. package/PostProcesses/fxaaPostProcess.d.ts +2 -2
  313. package/PostProcesses/fxaaPostProcess.js +2 -2
  314. package/PostProcesses/fxaaPostProcess.js.map +1 -1
  315. package/PostProcesses/grainPostProcess.d.ts +2 -2
  316. package/PostProcesses/grainPostProcess.js.map +1 -1
  317. package/PostProcesses/imageProcessingPostProcess.d.ts +2 -2
  318. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  319. package/PostProcesses/motionBlurPostProcess.d.ts +2 -2
  320. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  321. package/PostProcesses/passPostProcess.d.ts +3 -3
  322. package/PostProcesses/passPostProcess.js +2 -2
  323. package/PostProcesses/passPostProcess.js.map +1 -1
  324. package/PostProcesses/postProcess.d.ts +4 -4
  325. package/PostProcesses/postProcess.js +3 -3
  326. package/PostProcesses/postProcess.js.map +1 -1
  327. package/PostProcesses/refractionPostProcess.d.ts +2 -2
  328. package/PostProcesses/refractionPostProcess.js.map +1 -1
  329. package/PostProcesses/screenSpaceCurvaturePostProcess.d.ts +2 -2
  330. package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
  331. package/PostProcesses/screenSpaceReflectionPostProcess.d.ts +2 -2
  332. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  333. package/PostProcesses/sharpenPostProcess.d.ts +2 -2
  334. package/PostProcesses/sharpenPostProcess.js.map +1 -1
  335. package/PostProcesses/subSurfaceScatteringPostProcess.d.ts +2 -2
  336. package/PostProcesses/subSurfaceScatteringPostProcess.js.map +1 -1
  337. package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +2 -2
  338. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  339. package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
  340. package/Rendering/depthPeelingRenderer.js.map +1 -1
  341. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  342. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.d.ts +2 -2
  343. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -1
  344. package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +2 -2
  345. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  346. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +2 -2
  347. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  348. package/Rendering/fluidRenderer/fluidRenderingTextures.d.ts +2 -2
  349. package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -1
  350. package/Rendering/geometryBufferRenderer.js +24 -18
  351. package/Rendering/geometryBufferRenderer.js.map +1 -1
  352. package/Rendering/outlineRenderer.js.map +1 -1
  353. package/Rendering/prePassRenderer.js.map +1 -1
  354. package/Sprites/spriteRenderer.d.ts +2 -2
  355. package/Sprites/spriteRenderer.js.map +1 -1
  356. package/XR/features/WebXRDepthSensing.js.map +1 -1
  357. package/XR/features/WebXRImageTracking.js.map +1 -1
  358. package/XR/features/WebXRLayers.d.ts +2 -2
  359. package/XR/features/WebXRLayers.js.map +1 -1
  360. package/XR/features/WebXRLightEstimation.js.map +1 -1
  361. package/XR/features/WebXRRawCameraAccess.d.ts +1 -1
  362. package/XR/features/WebXRRawCameraAccess.js.map +1 -1
  363. package/XR/features/WebXRSpaceWarp.js +1 -3
  364. package/XR/features/WebXRSpaceWarp.js.map +1 -1
  365. package/XR/features/WebXRWalkingLocomotion.js.map +1 -1
  366. package/XR/webXRExperienceHelper.js.map +1 -1
  367. package/XR/webXRManagedOutputCanvas.d.ts +2 -2
  368. package/XR/webXRManagedOutputCanvas.js.map +1 -1
  369. package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
  370. package/XR/webXRSessionManager.js.map +1 -1
  371. package/assetContainer.js.map +1 -1
  372. package/node.d.ts +2 -2
  373. package/node.js.map +1 -1
  374. package/package.json +1 -1
  375. package/scene.d.ts +3 -3
  376. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"uniformBuffer.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/uniformBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAQxC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,4CAA4C,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,OAAO,aAAa;IA4MtB;;;;;;;;;;;;;;OAcG;IACH,YAAY,MAAkB,EAAE,IAAe,EAAE,OAAiB,EAAE,IAAa,EAAE,oBAAoB,GAAG,KAAK;QA2jB/G,eAAe;QACP,gBAAW,GAA8B,EAAE,CAAC;QA3jBhD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,sBAAsB,IAAI,oBAAoB,CAAC;QACrE,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,SAAS,CAAC;QAE/B,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;QAExB,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,uBAAuB,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QAEvB,IAAI,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C,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;gBAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACnC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,MAAO,CAAC,CAAC;aACxC;SACJ;aAAM,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YAClE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;SACvB;IACL,CAAC;;AA3pCD,gBAAgB;AACF,iCAAmB,GAA+B,EAAE,AAAjC,CAAkC;AAqBnE,iCAAiC;AAClB,+BAAiB,GAAG,GAAG,AAAN,CAAO;AACxB,yBAAW,GAAG,IAAI,YAAY,CAAC,aAAa,CAAC,iBAAiB,CAAC,AAApD,CAAqD;AAChE,kCAAoB,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,AAAnD,CAAoD;AACxE,mCAAqB,GAAG,IAAI,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,AAApD,CAAqD","sourcesContent":["import { Logger } from \"../Misc/logger\";\r\nimport type { Nullable, FloatArray } from \"../types\";\r\nimport type { IMatrixLike, IVector3Like, IVector4Like, IColor3Like, IColor4Like } from \"../Maths/math.like\";\r\nimport type { Effect } from \"./effect\";\r\nimport type { ThinTexture } from \"../Materials/Textures/thinTexture\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport type { InternalTexture } from \"./Textures/internalTexture\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport \"../Engines/Extensions/engine.uniformBuffer\";\r\n\r\n/**\r\n * Uniform buffer objects.\r\n *\r\n * Handles blocks of uniform on the GPU.\r\n *\r\n * If WebGL 2 is not available, this class falls back on traditional setUniformXXX calls.\r\n *\r\n * For more information, please refer to :\r\n * https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\r\n */\r\nexport class UniformBuffer {\r\n /** @internal */\r\n public static _UpdatedUbosInFrame: { [name: string]: number } = {};\r\n\r\n private _engine: ThinEngine;\r\n private _buffer: Nullable<DataBuffer>;\r\n private _buffers: Array<[DataBuffer, Float32Array | undefined]>;\r\n private _bufferIndex: number;\r\n private _createBufferOnWrite: boolean;\r\n private _data: number[];\r\n private _bufferData: Float32Array;\r\n private _dynamic?: boolean;\r\n private _uniformLocations: { [key: string]: number };\r\n private _uniformSizes: { [key: string]: number };\r\n private _uniformArraySizes: { [key: string]: { strideSize: number; arraySize: number } };\r\n private _uniformLocationPointer: number;\r\n private _needSync: boolean;\r\n private _noUBO: boolean;\r\n private _currentEffect: Effect;\r\n private _currentEffectName: string;\r\n private _name: string;\r\n private _currentFrameId: number;\r\n\r\n // Pool for avoiding memory leaks\r\n private static _MAX_UNIFORM_SIZE = 256;\r\n private static _TempBuffer = new Float32Array(UniformBuffer._MAX_UNIFORM_SIZE);\r\n private static _TempBufferInt32View = new Int32Array(UniformBuffer._TempBuffer.buffer);\r\n private static _TempBufferUInt32View = new Uint32Array(UniformBuffer._TempBuffer.buffer);\r\n\r\n /**\r\n * Lambda to Update a 3x3 Matrix in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateMatrix3x3: (name: string, matrix: Float32Array) => void;\r\n\r\n /**\r\n * Lambda to Update a 2x2 Matrix in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateMatrix2x2: (name: string, matrix: Float32Array) => void;\r\n\r\n /**\r\n * Lambda to Update a single float in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateFloat: (name: string, x: number) => void;\r\n\r\n /**\r\n * Lambda to Update a vec2 of float in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateFloat2: (name: string, x: number, y: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec3 of float in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateFloat3: (name: string, x: number, y: number, z: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec4 of float in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateFloat4: (name: string, x: number, y: number, z: number, w: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update an array of float in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateFloatArray: (name: string, array: Float32Array) => void;\r\n\r\n /**\r\n * Lambda to Update an array of number in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateArray: (name: string, array: number[]) => void;\r\n\r\n /**\r\n * Lambda to Update an array of number in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateIntArray: (name: string, array: Int32Array) => void;\r\n\r\n /**\r\n * Lambda to Update an array of number in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateUIntArray: (name: string, array: Uint32Array) => void;\r\n\r\n /**\r\n * Lambda to Update a 4x4 Matrix in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateMatrix: (name: string, mat: IMatrixLike) => void;\r\n\r\n /**\r\n * Lambda to Update an array of 4x4 Matrix in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateMatrices: (name: string, mat: Float32Array) => void;\r\n\r\n /**\r\n * Lambda to Update vec3 of float from a Vector in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateVector3: (name: string, vector: IVector3Like) => void;\r\n\r\n /**\r\n * Lambda to Update vec4 of float from a Vector in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateVector4: (name: string, vector: IVector4Like) => void;\r\n\r\n /**\r\n * Lambda to Update vec3 of float from a Color in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateColor3: (name: string, color: IColor3Like, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update vec4 of float from a Color in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateColor4: (name: string, color: IColor3Like, alpha: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update vec4 of float from a Color in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateDirectColor4: (name: string, color: IColor4Like, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a int a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateInt: (name: string, x: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec2 of int in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateInt2: (name: string, x: number, y: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec3 of int in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateInt3: (name: string, x: number, y: number, z: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec4 of int in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateInt4: (name: string, x: number, y: number, z: number, w: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a unsigned int a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateUInt: (name: string, x: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec2 of unsigned int in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateUInt2: (name: string, x: number, y: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec3 of unsigned int in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateUInt3: (name: string, x: number, y: number, z: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec4 of unsigned int in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateUInt4: (name: string, x: number, y: number, z: number, w: number, suffix?: string) => void;\r\n\r\n /**\r\n * Instantiates a new Uniform buffer objects.\r\n *\r\n * Handles blocks of uniform on the GPU.\r\n *\r\n * If WebGL 2 is not available, this class falls back on traditional setUniformXXX calls.\r\n *\r\n * For more information, please refer to :\r\n * @see https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\r\n * @param engine Define the engine the buffer is associated with\r\n * @param data Define the data contained in the buffer\r\n * @param dynamic Define if the buffer is updatable\r\n * @param name to assign to the buffer (debugging purpose)\r\n * @param forceNoUniformBuffer define that this object must not rely on UBO objects\r\n */\r\n constructor(engine: ThinEngine, data?: number[], dynamic?: boolean, name?: string, forceNoUniformBuffer = false) {\r\n this._engine = engine;\r\n this._noUBO = !engine.supportsUniformBuffers || forceNoUniformBuffer;\r\n this._dynamic = dynamic;\r\n this._name = name ?? \"no-name\";\r\n\r\n this._data = data || [];\r\n\r\n this._uniformLocations = {};\r\n this._uniformSizes = {};\r\n this._uniformArraySizes = {};\r\n this._uniformLocationPointer = 0;\r\n this._needSync = false;\r\n\r\n if (this._engine._features.trackUbosInFrame) {\r\n this._buffers = [];\r\n this._bufferIndex = -1;\r\n this._createBufferOnWrite = false;\r\n this._currentFrameId = 0;\r\n }\r\n\r\n if (this._noUBO) {\r\n this.updateMatrix3x3 = this._updateMatrix3x3ForEffect;\r\n this.updateMatrix2x2 = this._updateMatrix2x2ForEffect;\r\n this.updateFloat = this._updateFloatForEffect;\r\n this.updateFloat2 = this._updateFloat2ForEffect;\r\n this.updateFloat3 = this._updateFloat3ForEffect;\r\n this.updateFloat4 = this._updateFloat4ForEffect;\r\n this.updateFloatArray = this._updateFloatArrayForEffect;\r\n this.updateArray = this._updateArrayForEffect;\r\n this.updateIntArray = this._updateIntArrayForEffect;\r\n this.updateUIntArray = this._updateUIntArrayForEffect;\r\n this.updateMatrix = this._updateMatrixForEffect;\r\n this.updateMatrices = this._updateMatricesForEffect;\r\n this.updateVector3 = this._updateVector3ForEffect;\r\n this.updateVector4 = this._updateVector4ForEffect;\r\n this.updateColor3 = this._updateColor3ForEffect;\r\n this.updateColor4 = this._updateColor4ForEffect;\r\n this.updateDirectColor4 = this._updateDirectColor4ForEffect;\r\n this.updateInt = this._updateIntForEffect;\r\n this.updateInt2 = this._updateInt2ForEffect;\r\n this.updateInt3 = this._updateInt3ForEffect;\r\n this.updateInt4 = this._updateInt4ForEffect;\r\n this.updateUInt = this._updateUIntForEffect;\r\n this.updateUInt2 = this._updateUInt2ForEffect;\r\n this.updateUInt3 = this._updateUInt3ForEffect;\r\n this.updateUInt4 = this._updateUInt4ForEffect;\r\n } else {\r\n this._engine._uniformBuffers.push(this);\r\n\r\n this.updateMatrix3x3 = this._updateMatrix3x3ForUniform;\r\n this.updateMatrix2x2 = this._updateMatrix2x2ForUniform;\r\n this.updateFloat = this._updateFloatForUniform;\r\n this.updateFloat2 = this._updateFloat2ForUniform;\r\n this.updateFloat3 = this._updateFloat3ForUniform;\r\n this.updateFloat4 = this._updateFloat4ForUniform;\r\n this.updateFloatArray = this._updateFloatArrayForUniform;\r\n this.updateArray = this._updateArrayForUniform;\r\n this.updateIntArray = this._updateIntArrayForUniform;\r\n this.updateUIntArray = this._updateUIntArrayForUniform;\r\n this.updateMatrix = this._updateMatrixForUniform;\r\n this.updateMatrices = this._updateMatricesForUniform;\r\n this.updateVector3 = this._updateVector3ForUniform;\r\n this.updateVector4 = this._updateVector4ForUniform;\r\n this.updateColor3 = this._updateColor3ForUniform;\r\n this.updateColor4 = this._updateColor4ForUniform;\r\n this.updateDirectColor4 = this._updateDirectColor4ForUniform;\r\n this.updateInt = this._updateIntForUniform;\r\n this.updateInt2 = this._updateInt2ForUniform;\r\n this.updateInt3 = this._updateInt3ForUniform;\r\n this.updateInt4 = this._updateInt4ForUniform;\r\n this.updateUInt = this._updateUIntForUniform;\r\n this.updateUInt2 = this._updateUInt2ForUniform;\r\n this.updateUInt3 = this._updateUInt3ForUniform;\r\n this.updateUInt4 = this._updateUInt4ForUniform;\r\n }\r\n }\r\n\r\n /**\r\n * Indicates if the buffer is using the WebGL2 UBO implementation,\r\n * or just falling back on setUniformXXX calls.\r\n */\r\n public get useUbo(): boolean {\r\n return !this._noUBO;\r\n }\r\n\r\n /**\r\n * Indicates if the WebGL underlying uniform buffer is in sync\r\n * with the javascript cache data.\r\n */\r\n public get isSync(): boolean {\r\n return !this._needSync;\r\n }\r\n\r\n /**\r\n * Indicates if the WebGL underlying uniform buffer is dynamic.\r\n * Also, a dynamic UniformBuffer will disable cache verification and always\r\n * update the underlying WebGL uniform buffer to the GPU.\r\n * @returns if Dynamic, otherwise false\r\n */\r\n public isDynamic(): boolean {\r\n return this._dynamic !== undefined;\r\n }\r\n\r\n /**\r\n * The data cache on JS side.\r\n * @returns the underlying data as a float array\r\n */\r\n public getData(): Float32Array {\r\n return this._bufferData;\r\n }\r\n\r\n /**\r\n * The underlying WebGL Uniform buffer.\r\n * @returns the webgl buffer\r\n */\r\n public getBuffer(): Nullable<DataBuffer> {\r\n return this._buffer;\r\n }\r\n\r\n /**\r\n * std140 layout specifies how to align data within an UBO structure.\r\n * See https://khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf#page=159\r\n * for specs.\r\n * @param size\r\n */\r\n private _fillAlignment(size: number) {\r\n // This code has been simplified because we only use floats, vectors of 1, 2, 3, 4 components\r\n // and 4x4 matrices\r\n // TODO : change if other types are used\r\n\r\n let alignment;\r\n if (size <= 2) {\r\n alignment = size;\r\n } else {\r\n alignment = 4;\r\n }\r\n\r\n if (this._uniformLocationPointer % alignment !== 0) {\r\n const oldPointer = this._uniformLocationPointer;\r\n this._uniformLocationPointer += alignment - (this._uniformLocationPointer % alignment);\r\n const diff = this._uniformLocationPointer - oldPointer;\r\n\r\n for (let i = 0; i < diff; i++) {\r\n this._data.push(0);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Adds an uniform in the buffer.\r\n * Warning : the subsequents calls of this function must be in the same order as declared in the shader\r\n * for the layout to be correct ! The addUniform function only handles types like float, vec2, vec3, vec4, mat4,\r\n * meaning size=1,2,3,4 or 16. It does not handle struct types.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param size Data size, or data directly.\r\n * @param arraySize The number of elements in the array, 0 if not an array.\r\n */\r\n public addUniform(name: string, size: number | number[], arraySize = 0) {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n\r\n if (this._uniformLocations[name] !== undefined) {\r\n // Already existing uniform\r\n return;\r\n }\r\n // This function must be called in the order of the shader layout !\r\n // size can be the size of the uniform, or data directly\r\n let data;\r\n\r\n // std140 FTW...\r\n if (arraySize > 0) {\r\n if (size instanceof Array) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"addUniform should not be use with Array in UBO: \" + name;\r\n }\r\n\r\n this._fillAlignment(4);\r\n\r\n this._uniformArraySizes[name] = { strideSize: size, arraySize };\r\n if (size == 16) {\r\n size = size * arraySize;\r\n } else {\r\n const perElementPadding = 4 - size;\r\n const totalPadding = perElementPadding * arraySize;\r\n size = size * arraySize + totalPadding;\r\n }\r\n\r\n data = [];\r\n // Fill with zeros\r\n for (let i = 0; i < size; i++) {\r\n data.push(0);\r\n }\r\n } else {\r\n if (size instanceof Array) {\r\n data = size;\r\n size = data.length;\r\n } else {\r\n size = <number>size;\r\n data = [];\r\n\r\n // Fill with zeros\r\n for (let i = 0; i < size; i++) {\r\n data.push(0);\r\n }\r\n }\r\n this._fillAlignment(<number>size);\r\n }\r\n\r\n this._uniformSizes[name] = <number>size;\r\n this._uniformLocations[name] = this._uniformLocationPointer;\r\n this._uniformLocationPointer += <number>size;\r\n\r\n for (let i = 0; i < size; i++) {\r\n this._data.push(data[i]);\r\n }\r\n\r\n this._needSync = true;\r\n }\r\n\r\n /**\r\n * Adds a Matrix 4x4 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param mat A 4x4 matrix.\r\n */\r\n public addMatrix(name: string, mat: IMatrixLike) {\r\n this.addUniform(name, Array.prototype.slice.call(mat.asArray()));\r\n }\r\n\r\n /**\r\n * Adds a vec2 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param x Define the x component value of the vec2\r\n * @param y Define the y component value of the vec2\r\n */\r\n public addFloat2(name: string, x: number, y: number) {\r\n const temp = [x, y];\r\n this.addUniform(name, temp);\r\n }\r\n\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param x Define the x component value of the vec3\r\n * @param y Define the y component value of the vec3\r\n * @param z Define the z component value of the vec3\r\n */\r\n public addFloat3(name: string, x: number, y: number, z: number) {\r\n const temp = [x, y, z];\r\n this.addUniform(name, temp);\r\n }\r\n\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param color Define the vec3 from a Color\r\n */\r\n public addColor3(name: string, color: IColor3Like) {\r\n const temp = [color.r, color.g, color.b];\r\n this.addUniform(name, temp);\r\n }\r\n\r\n /**\r\n * Adds a vec4 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param color Define the rgb components from a Color\r\n * @param alpha Define the a component of the vec4\r\n */\r\n public addColor4(name: string, color: IColor3Like, alpha: number) {\r\n const temp = [color.r, color.g, color.b, alpha];\r\n this.addUniform(name, temp);\r\n }\r\n\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param vector Define the vec3 components from a Vector\r\n */\r\n public addVector3(name: string, vector: IVector3Like) {\r\n const temp = [vector.x, vector.y, vector.z];\r\n this.addUniform(name, temp);\r\n }\r\n\r\n /**\r\n * Adds a Matrix 3x3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n */\r\n public addMatrix3x3(name: string) {\r\n this.addUniform(name, 12);\r\n }\r\n\r\n /**\r\n * Adds a Matrix 2x2 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n */\r\n public addMatrix2x2(name: string) {\r\n this.addUniform(name, 8);\r\n }\r\n\r\n /**\r\n * Effectively creates the WebGL Uniform Buffer, once layout is completed with `addUniform`.\r\n */\r\n public create(): void {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n if (this._buffer) {\r\n return; // nothing to do\r\n }\r\n\r\n // See spec, alignment must be filled as a vec4\r\n this._fillAlignment(4);\r\n this._bufferData = new Float32Array(this._data);\r\n\r\n this._rebuild();\r\n\r\n this._needSync = true;\r\n }\r\n\r\n // The result of this method is used for debugging purpose, as part of the buffer name\r\n // It is meant to more easily know what this buffer is about when debugging\r\n // Some buffers can have a lot of uniforms (several dozens), so the method only returns the first 10 of them\r\n // (should be enough to understand what the buffer is for)\r\n private _getNames() {\r\n const names = [];\r\n let i = 0;\r\n for (const name in this._uniformLocations) {\r\n names.push(name);\r\n if (++i === 10) {\r\n break;\r\n }\r\n }\r\n return names.join(\",\");\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n if (this._noUBO || !this._bufferData) {\r\n return;\r\n }\r\n\r\n if (this._dynamic) {\r\n this._buffer = this._engine.createDynamicUniformBuffer(this._bufferData, this._name + \"_UniformList:\" + this._getNames());\r\n } else {\r\n this._buffer = this._engine.createUniformBuffer(this._bufferData, this._name + \"_UniformList:\" + this._getNames());\r\n }\r\n\r\n if (this._engine._features.trackUbosInFrame) {\r\n this._buffers.push([this._buffer, this._engine._features.checkUbosContentBeforeUpload ? this._bufferData.slice() : undefined]);\r\n this._bufferIndex = this._buffers.length - 1;\r\n this._createBufferOnWrite = false;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _rebuildAfterContextLost(): void {\r\n if (this._engine._features.trackUbosInFrame) {\r\n this._buffers = [];\r\n this._currentFrameId = 0;\r\n }\r\n this._rebuild();\r\n }\r\n\r\n /** @internal */\r\n public get _numBuffers(): number {\r\n return this._buffers.length;\r\n }\r\n\r\n /** @internal */\r\n public get _indexBuffer(): number {\r\n return this._bufferIndex;\r\n }\r\n\r\n /** Gets the name of this buffer */\r\n public get name(): string {\r\n return this._name;\r\n }\r\n\r\n /** Gets the current effect */\r\n public get currentEffect(): Nullable<Effect> {\r\n return this._currentEffect;\r\n }\r\n\r\n private _buffersEqual(buf1: Float32Array, buf2: Float32Array): boolean {\r\n for (let i = 0; i < buf1.length; ++i) {\r\n if (buf1[i] !== buf2[i]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n private _copyBuffer(src: Float32Array, dst: Float32Array): void {\r\n for (let i = 0; i < src.length; ++i) {\r\n dst[i] = src[i];\r\n }\r\n }\r\n\r\n /**\r\n * Updates the WebGL Uniform Buffer on the GPU.\r\n * If the `dynamic` flag is set to true, no cache comparison is done.\r\n * Otherwise, the buffer will be updated only if the cache differs.\r\n */\r\n public update(): void {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n\r\n this.bindUniformBuffer();\r\n\r\n if (!this._buffer) {\r\n this.create();\r\n return;\r\n }\r\n\r\n if (!this._dynamic && !this._needSync) {\r\n this._createBufferOnWrite = this._engine._features.trackUbosInFrame;\r\n return;\r\n }\r\n\r\n if (this._buffers && this._buffers.length > 1 && this._buffers[this._bufferIndex][1]) {\r\n if (this._buffersEqual(this._bufferData, this._buffers[this._bufferIndex][1]!)) {\r\n this._needSync = false;\r\n this._createBufferOnWrite = this._engine._features.trackUbosInFrame;\r\n return;\r\n } else {\r\n this._copyBuffer(this._bufferData, this._buffers[this._bufferIndex][1]!);\r\n }\r\n }\r\n\r\n this._engine.updateUniformBuffer(this._buffer, this._bufferData);\r\n\r\n if (this._engine._features._collectUbosUpdatedInFrame) {\r\n if (!UniformBuffer._UpdatedUbosInFrame[this._name]) {\r\n UniformBuffer._UpdatedUbosInFrame[this._name] = 0;\r\n }\r\n UniformBuffer._UpdatedUbosInFrame[this._name]++;\r\n }\r\n\r\n this._needSync = false;\r\n this._createBufferOnWrite = this._engine._features.trackUbosInFrame;\r\n }\r\n\r\n private _createNewBuffer() {\r\n if (this._bufferIndex + 1 < this._buffers.length) {\r\n this._bufferIndex++;\r\n this._buffer = this._buffers[this._bufferIndex][0];\r\n this._createBufferOnWrite = false;\r\n this._needSync = true;\r\n } else {\r\n this._rebuild();\r\n }\r\n }\r\n\r\n private _checkNewFrame(): void {\r\n if (this._engine._features.trackUbosInFrame && this._currentFrameId !== this._engine.frameId) {\r\n this._currentFrameId = this._engine.frameId;\r\n this._createBufferOnWrite = false;\r\n if (this._buffers && this._buffers.length > 0) {\r\n this._needSync = this._bufferIndex !== 0;\r\n this._bufferIndex = 0;\r\n this._buffer = this._buffers[this._bufferIndex][0];\r\n } else {\r\n this._bufferIndex = -1;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n * @param size Define the size of the data.\r\n */\r\n public updateUniform(uniformName: string, data: FloatArray, size: number) {\r\n this._checkNewFrame();\r\n\r\n let location = this._uniformLocations[uniformName];\r\n if (location === undefined) {\r\n if (this._buffer) {\r\n // Cannot add an uniform if the buffer is already created\r\n Logger.Error(\"Cannot add an uniform after UBO has been created. uniformName=\" + uniformName);\r\n return;\r\n }\r\n this.addUniform(uniformName, size);\r\n location = this._uniformLocations[uniformName];\r\n }\r\n\r\n if (!this._buffer) {\r\n this.create();\r\n }\r\n\r\n if (!this._dynamic) {\r\n // Cache for static uniform buffers\r\n let changed = false;\r\n\r\n for (let i = 0; i < size; i++) {\r\n // We are checking the matrix cache before calling updateUniform so we do not need to check it here\r\n // Hence the test for size === 16 to simply commit the matrix values\r\n if ((size === 16 && !this._engine._features.uniformBufferHardCheckMatrix) || this._bufferData[location + i] !== Math.fround(data[i])) {\r\n changed = true;\r\n if (this._createBufferOnWrite) {\r\n this._createNewBuffer();\r\n }\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n\r\n this._needSync = this._needSync || changed;\r\n } else {\r\n // No cache for dynamic\r\n for (let i = 0; i < size; i++) {\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n * @param size Define the size of the data.\r\n */\r\n public updateUniformArray(uniformName: string, data: FloatArray, size: number) {\r\n this._checkNewFrame();\r\n\r\n const location = this._uniformLocations[uniformName];\r\n if (location === undefined) {\r\n Logger.Error(\"Cannot add an uniform Array dynamically. Please, add it using addUniform and make sure that uniform buffers are supported by the current engine.\");\r\n return;\r\n }\r\n\r\n if (!this._buffer) {\r\n this.create();\r\n }\r\n\r\n const arraySizes = this._uniformArraySizes[uniformName];\r\n\r\n if (!this._dynamic) {\r\n // Cache for static uniform buffers\r\n let changed = false;\r\n let countToFour = 0;\r\n let baseStride = 0;\r\n for (let i = 0; i < size; i++) {\r\n if (this._bufferData[location + baseStride * 4 + countToFour] !== Tools.FloatRound(data[i])) {\r\n changed = true;\r\n if (this._createBufferOnWrite) {\r\n this._createNewBuffer();\r\n }\r\n this._bufferData[location + baseStride * 4 + countToFour] = data[i];\r\n }\r\n countToFour++;\r\n if (countToFour === arraySizes.strideSize) {\r\n for (; countToFour < 4; countToFour++) {\r\n this._bufferData[location + baseStride * 4 + countToFour] = 0;\r\n }\r\n countToFour = 0;\r\n baseStride++;\r\n }\r\n }\r\n\r\n this._needSync = this._needSync || changed;\r\n } else {\r\n // No cache for dynamic\r\n for (let i = 0; i < size; i++) {\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n }\r\n\r\n // Matrix cache\r\n private _valueCache: { [key: string]: number } = {};\r\n private _cacheMatrix(name: string, matrix: IMatrixLike): boolean {\r\n this._checkNewFrame();\r\n\r\n const cache = this._valueCache[name];\r\n const flag = matrix.updateFlag;\r\n if (cache !== undefined && cache === flag) {\r\n return false;\r\n }\r\n\r\n this._valueCache[name] = flag;\r\n return true;\r\n }\r\n\r\n // Update methods\r\n\r\n private _updateMatrix3x3ForUniform(name: string, matrix: Float32Array): void {\r\n // To match std140, matrix must be realigned\r\n for (let i = 0; i < 3; i++) {\r\n UniformBuffer._TempBuffer[i * 4] = matrix[i * 3];\r\n UniformBuffer._TempBuffer[i * 4 + 1] = matrix[i * 3 + 1];\r\n UniformBuffer._TempBuffer[i * 4 + 2] = matrix[i * 3 + 2];\r\n UniformBuffer._TempBuffer[i * 4 + 3] = 0.0;\r\n }\r\n\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 12);\r\n }\r\n\r\n private _updateMatrix3x3ForEffect(name: string, matrix: Float32Array): void {\r\n this._currentEffect.setMatrix3x3(name, matrix);\r\n }\r\n\r\n private _updateMatrix2x2ForEffect(name: string, matrix: Float32Array): void {\r\n this._currentEffect.setMatrix2x2(name, matrix);\r\n }\r\n\r\n private _updateMatrix2x2ForUniform(name: string, matrix: Float32Array): void {\r\n // To match std140, matrix must be realigned\r\n for (let i = 0; i < 2; i++) {\r\n UniformBuffer._TempBuffer[i * 4] = matrix[i * 2];\r\n UniformBuffer._TempBuffer[i * 4 + 1] = matrix[i * 2 + 1];\r\n UniformBuffer._TempBuffer[i * 4 + 2] = 0.0;\r\n UniformBuffer._TempBuffer[i * 4 + 3] = 0.0;\r\n }\r\n\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 8);\r\n }\r\n\r\n private _updateFloatForEffect(name: string, x: number) {\r\n this._currentEffect.setFloat(name, x);\r\n }\r\n\r\n private _updateFloatForUniform(name: string, x: number) {\r\n UniformBuffer._TempBuffer[0] = x;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 1);\r\n }\r\n\r\n private _updateFloat2ForEffect(name: string, x: number, y: number, suffix = \"\") {\r\n this._currentEffect.setFloat2(name + suffix, x, y);\r\n }\r\n\r\n private _updateFloat2ForUniform(name: string, x: number, y: number) {\r\n UniformBuffer._TempBuffer[0] = x;\r\n UniformBuffer._TempBuffer[1] = y;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 2);\r\n }\r\n\r\n private _updateFloat3ForEffect(name: string, x: number, y: number, z: number, suffix = \"\") {\r\n this._currentEffect.setFloat3(name + suffix, x, y, z);\r\n }\r\n\r\n private _updateFloat3ForUniform(name: string, x: number, y: number, z: number) {\r\n UniformBuffer._TempBuffer[0] = x;\r\n UniformBuffer._TempBuffer[1] = y;\r\n UniformBuffer._TempBuffer[2] = z;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\r\n }\r\n\r\n private _updateFloat4ForEffect(name: string, x: number, y: number, z: number, w: number, suffix = \"\") {\r\n this._currentEffect.setFloat4(name + suffix, x, y, z, w);\r\n }\r\n\r\n private _updateFloat4ForUniform(name: string, x: number, y: number, z: number, w: number) {\r\n UniformBuffer._TempBuffer[0] = x;\r\n UniformBuffer._TempBuffer[1] = y;\r\n UniformBuffer._TempBuffer[2] = z;\r\n UniformBuffer._TempBuffer[3] = w;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\r\n }\r\n\r\n private _updateFloatArrayForEffect(name: string, array: Float32Array) {\r\n this._currentEffect.setFloatArray(name, array);\r\n }\r\n\r\n private _updateFloatArrayForUniform(name: string, array: Float32Array) {\r\n this.updateUniformArray(name, array, array.length);\r\n }\r\n\r\n private _updateArrayForEffect(name: string, array: number[]) {\r\n this._currentEffect.setArray(name, array);\r\n }\r\n\r\n private _updateArrayForUniform(name: string, array: number[]) {\r\n this.updateUniformArray(name, array, array.length);\r\n }\r\n\r\n private _updateIntArrayForEffect(name: string, array: Int32Array) {\r\n this._currentEffect.setIntArray(name, array);\r\n }\r\n\r\n private _updateIntArrayForUniform(name: string, array: Int32Array) {\r\n UniformBuffer._TempBufferInt32View.set(array);\r\n this.updateUniformArray(name, UniformBuffer._TempBuffer, array.length);\r\n }\r\n\r\n private _updateUIntArrayForEffect(name: string, array: Uint32Array) {\r\n this._currentEffect.setUIntArray(name, array);\r\n }\r\n\r\n private _updateUIntArrayForUniform(name: string, array: Uint32Array) {\r\n UniformBuffer._TempBufferUInt32View.set(array);\r\n this.updateUniformArray(name, UniformBuffer._TempBuffer, array.length);\r\n }\r\n\r\n private _updateMatrixForEffect(name: string, mat: IMatrixLike) {\r\n this._currentEffect.setMatrix(name, mat);\r\n }\r\n\r\n private _updateMatrixForUniform(name: string, mat: IMatrixLike) {\r\n if (this._cacheMatrix(name, mat)) {\r\n this.updateUniform(name, <any>mat.asArray(), 16);\r\n }\r\n }\r\n\r\n private _updateMatricesForEffect(name: string, mat: Float32Array) {\r\n this._currentEffect.setMatrices(name, mat);\r\n }\r\n\r\n private _updateMatricesForUniform(name: string, mat: Float32Array) {\r\n this.updateUniform(name, mat, mat.length);\r\n }\r\n\r\n private _updateVector3ForEffect(name: string, vector: IVector3Like) {\r\n this._currentEffect.setVector3(name, vector);\r\n }\r\n\r\n private _updateVector3ForUniform(name: string, vector: IVector3Like) {\r\n UniformBuffer._TempBuffer[0] = vector.x;\r\n UniformBuffer._TempBuffer[1] = vector.y;\r\n UniformBuffer._TempBuffer[2] = vector.z;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\r\n }\r\n\r\n private _updateVector4ForEffect(name: string, vector: IVector4Like) {\r\n this._currentEffect.setVector4(name, vector);\r\n }\r\n\r\n private _updateVector4ForUniform(name: string, vector: IVector4Like) {\r\n UniformBuffer._TempBuffer[0] = vector.x;\r\n UniformBuffer._TempBuffer[1] = vector.y;\r\n UniformBuffer._TempBuffer[2] = vector.z;\r\n UniformBuffer._TempBuffer[3] = vector.w;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\r\n }\r\n\r\n private _updateColor3ForEffect(name: string, color: IColor3Like, suffix = \"\") {\r\n this._currentEffect.setColor3(name + suffix, color);\r\n }\r\n\r\n private _updateColor3ForUniform(name: string, color: IColor3Like) {\r\n UniformBuffer._TempBuffer[0] = color.r;\r\n UniformBuffer._TempBuffer[1] = color.g;\r\n UniformBuffer._TempBuffer[2] = color.b;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\r\n }\r\n\r\n private _updateColor4ForEffect(name: string, color: IColor3Like, alpha: number, suffix = \"\") {\r\n this._currentEffect.setColor4(name + suffix, color, alpha);\r\n }\r\n\r\n private _updateDirectColor4ForEffect(name: string, color: IColor4Like, suffix = \"\") {\r\n this._currentEffect.setDirectColor4(name + suffix, color);\r\n }\r\n\r\n private _updateColor4ForUniform(name: string, color: IColor3Like, alpha: number) {\r\n UniformBuffer._TempBuffer[0] = color.r;\r\n UniformBuffer._TempBuffer[1] = color.g;\r\n UniformBuffer._TempBuffer[2] = color.b;\r\n UniformBuffer._TempBuffer[3] = alpha;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\r\n }\r\n\r\n private _updateDirectColor4ForUniform(name: string, color: IColor4Like) {\r\n UniformBuffer._TempBuffer[0] = color.r;\r\n UniformBuffer._TempBuffer[1] = color.g;\r\n UniformBuffer._TempBuffer[2] = color.b;\r\n UniformBuffer._TempBuffer[3] = color.a;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\r\n }\r\n\r\n private _updateIntForEffect(name: string, x: number, suffix = \"\") {\r\n this._currentEffect.setInt(name + suffix, x);\r\n }\r\n\r\n private _updateIntForUniform(name: string, x: number) {\r\n UniformBuffer._TempBufferInt32View[0] = x;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 1);\r\n }\r\n\r\n private _updateInt2ForEffect(name: string, x: number, y: number, suffix = \"\") {\r\n this._currentEffect.setInt2(name + suffix, x, y);\r\n }\r\n\r\n private _updateInt2ForUniform(name: string, x: number, y: number) {\r\n UniformBuffer._TempBufferInt32View[0] = x;\r\n UniformBuffer._TempBufferInt32View[1] = y;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 2);\r\n }\r\n\r\n private _updateInt3ForEffect(name: string, x: number, y: number, z: number, suffix = \"\") {\r\n this._currentEffect.setInt3(name + suffix, x, y, z);\r\n }\r\n\r\n private _updateInt3ForUniform(name: string, x: number, y: number, z: number) {\r\n UniformBuffer._TempBufferInt32View[0] = x;\r\n UniformBuffer._TempBufferInt32View[1] = y;\r\n UniformBuffer._TempBufferInt32View[2] = z;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\r\n }\r\n\r\n private _updateInt4ForEffect(name: string, x: number, y: number, z: number, w: number, suffix = \"\") {\r\n this._currentEffect.setInt4(name + suffix, x, y, z, w);\r\n }\r\n\r\n private _updateInt4ForUniform(name: string, x: number, y: number, z: number, w: number) {\r\n UniformBuffer._TempBufferInt32View[0] = x;\r\n UniformBuffer._TempBufferInt32View[1] = y;\r\n UniformBuffer._TempBufferInt32View[2] = z;\r\n UniformBuffer._TempBufferInt32View[3] = w;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\r\n }\r\n\r\n private _updateUIntForEffect(name: string, x: number, suffix = \"\") {\r\n this._currentEffect.setUInt(name + suffix, x);\r\n }\r\n\r\n private _updateUIntForUniform(name: string, x: number) {\r\n UniformBuffer._TempBufferUInt32View[0] = x;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 1);\r\n }\r\n\r\n private _updateUInt2ForEffect(name: string, x: number, y: number, suffix = \"\") {\r\n this._currentEffect.setUInt2(name + suffix, x, y);\r\n }\r\n\r\n private _updateUInt2ForUniform(name: string, x: number, y: number) {\r\n UniformBuffer._TempBufferUInt32View[0] = x;\r\n UniformBuffer._TempBufferUInt32View[1] = y;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 2);\r\n }\r\n\r\n private _updateUInt3ForEffect(name: string, x: number, y: number, z: number, suffix = \"\") {\r\n this._currentEffect.setUInt3(name + suffix, x, y, z);\r\n }\r\n\r\n private _updateUInt3ForUniform(name: string, x: number, y: number, z: number) {\r\n UniformBuffer._TempBufferUInt32View[0] = x;\r\n UniformBuffer._TempBufferUInt32View[1] = y;\r\n UniformBuffer._TempBufferUInt32View[2] = z;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\r\n }\r\n\r\n private _updateUInt4ForEffect(name: string, x: number, y: number, z: number, w: number, suffix = \"\") {\r\n this._currentEffect.setUInt4(name + suffix, x, y, z, w);\r\n }\r\n\r\n private _updateUInt4ForUniform(name: string, x: number, y: number, z: number, w: number) {\r\n UniformBuffer._TempBufferUInt32View[0] = x;\r\n UniformBuffer._TempBufferUInt32View[1] = y;\r\n UniformBuffer._TempBufferUInt32View[2] = z;\r\n UniformBuffer._TempBufferUInt32View[3] = w;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\r\n }\r\n\r\n /**\r\n * Sets a sampler uniform on the effect.\r\n * @param name Define the name of the sampler.\r\n * @param texture Define the texture to set in the sampler\r\n */\r\n public setTexture(name: string, texture: Nullable<ThinTexture>) {\r\n this._currentEffect.setTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Sets a sampler uniform on the effect.\r\n * @param name Define the name of the sampler.\r\n * @param texture Define the (internal) texture to set in the sampler\r\n */\r\n public bindTexture(name: string, texture: Nullable<InternalTexture>) {\r\n this._currentEffect._bindTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Directly updates the value of the uniform in the cache AND on the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n */\r\n public updateUniformDirectly(uniformName: string, data: FloatArray) {\r\n this.updateUniform(uniformName, data, data.length);\r\n\r\n this.update();\r\n }\r\n\r\n /**\r\n * Associates an effect to this uniform buffer\r\n * @param effect Define the effect to associate the buffer to\r\n * @param name Name of the uniform block in the shader.\r\n */\r\n public bindToEffect(effect: Effect, name: string): void {\r\n this._currentEffect = effect;\r\n this._currentEffectName = name;\r\n }\r\n\r\n /**\r\n * Binds the current (GPU) buffer to the effect\r\n */\r\n public bindUniformBuffer(): void {\r\n if (!this._noUBO && this._buffer && this._currentEffect) {\r\n this._currentEffect.bindUniformBuffer(this._buffer, this._currentEffectName);\r\n }\r\n }\r\n\r\n /**\r\n * Dissociates the current effect from this uniform buffer\r\n */\r\n public unbindEffect(): void {\r\n this._currentEffect = undefined as any;\r\n this._currentEffectName = undefined as any;\r\n }\r\n\r\n /**\r\n * Sets the current state of the class (_bufferIndex, _buffer) to point to the data buffer passed in parameter if this buffer is one of the buffers handled by the class (meaning if it can be found in the _buffers array)\r\n * This method is meant to be able to update a buffer at any time: just call setDataBuffer to set the class in the right state, call some updateXXX methods and then call udpate() => that will update the GPU buffer on the graphic card\r\n * @param dataBuffer buffer to look for\r\n * @returns true if the buffer has been found and the class internal state points to it, else false\r\n */\r\n public setDataBuffer(dataBuffer: DataBuffer): boolean {\r\n if (!this._buffers) {\r\n return this._buffer === dataBuffer;\r\n }\r\n\r\n for (let b = 0; b < this._buffers.length; ++b) {\r\n const buffer = this._buffers[b];\r\n if (buffer[0] === dataBuffer) {\r\n this._bufferIndex = b;\r\n this._buffer = dataBuffer;\r\n this._createBufferOnWrite = false;\r\n this._currentEffect = undefined as any;\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Disposes the uniform buffer.\r\n */\r\n public dispose(): void {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n\r\n const uniformBuffers = this._engine._uniformBuffers;\r\n const index = uniformBuffers.indexOf(this);\r\n\r\n if (index !== -1) {\r\n uniformBuffers[index] = uniformBuffers[uniformBuffers.length - 1];\r\n uniformBuffers.pop();\r\n }\r\n\r\n if (this._engine._features.trackUbosInFrame && this._buffers) {\r\n for (let i = 0; i < this._buffers.length; ++i) {\r\n const buffer = this._buffers[i][0];\r\n this._engine._releaseBuffer(buffer!);\r\n }\r\n } else if (this._buffer && this._engine._releaseBuffer(this._buffer)) {\r\n this._buffer = null;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"uniformBuffer.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/uniformBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAOxC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,4CAA4C,CAAC;AAGpD;;;;;;;;;GASG;AACH,MAAM,OAAO,aAAa;IA4MtB;;;;;;;;;;;;;;OAcG;IACH,YAAY,MAAsB,EAAE,IAAe,EAAE,OAAiB,EAAE,IAAa,EAAE,oBAAoB,GAAG,KAAK;QA2jBnH,eAAe;QACP,gBAAW,GAA8B,EAAE,CAAC;QA3jBhD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,sBAAsB,IAAI,oBAAoB,CAAC;QACrE,IAAI,CAAC,QAAQ,GA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C,OAAO,CAAC,IAAI,CAAC,CAAC;QAE3C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,cAAc,CAAC,KAAK,CAAC,GAAG,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAClE,cAAc,CAAC,GAAG,EAAE,CAAC;SACxB;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,gBAAgB,IAAI,IAAI,CAAC,QAAQ,EAAE;YAC1D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;gBAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACnC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,MAAO,CAAC,CAAC;aACxC;SACJ;aAAM,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YAClE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;SACvB;IACL,CAAC;;AA3pCD,gBAAgB;AACF,iCAAmB,GAA+B,EAAE,AAAjC,CAAkC;AAqBnE,iCAAiC;AAClB,+BAAiB,GAAG,GAAG,AAAN,CAAO;AACxB,yBAAW,GAAG,IAAI,YAAY,CAAC,aAAa,CAAC,iBAAiB,CAAC,AAApD,CAAqD;AAChE,kCAAoB,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,AAAnD,CAAoD;AACxE,mCAAqB,GAAG,IAAI,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,AAApD,CAAqD","sourcesContent":["import { Logger } from \"../Misc/logger\";\r\nimport type { Nullable, FloatArray } from \"../types\";\r\nimport type { IMatrixLike, IVector3Like, IVector4Like, IColor3Like, IColor4Like } from \"../Maths/math.like\";\r\nimport type { Effect } from \"./effect\";\r\nimport type { ThinTexture } from \"../Materials/Textures/thinTexture\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport type { InternalTexture } from \"./Textures/internalTexture\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport \"../Engines/Extensions/engine.uniformBuffer\";\r\nimport type { AbstractEngine } from \"core/Engines/abstractEngine\";\r\n\r\n/**\r\n * Uniform buffer objects.\r\n *\r\n * Handles blocks of uniform on the GPU.\r\n *\r\n * If WebGL 2 is not available, this class falls back on traditional setUniformXXX calls.\r\n *\r\n * For more information, please refer to :\r\n * https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\r\n */\r\nexport class UniformBuffer {\r\n /** @internal */\r\n public static _UpdatedUbosInFrame: { [name: string]: number } = {};\r\n\r\n private _engine: AbstractEngine;\r\n private _buffer: Nullable<DataBuffer>;\r\n private _buffers: Array<[DataBuffer, Float32Array | undefined]>;\r\n private _bufferIndex: number;\r\n private _createBufferOnWrite: boolean;\r\n private _data: number[];\r\n private _bufferData: Float32Array;\r\n private _dynamic?: boolean;\r\n private _uniformLocations: { [key: string]: number };\r\n private _uniformSizes: { [key: string]: number };\r\n private _uniformArraySizes: { [key: string]: { strideSize: number; arraySize: number } };\r\n private _uniformLocationPointer: number;\r\n private _needSync: boolean;\r\n private _noUBO: boolean;\r\n private _currentEffect: Effect;\r\n private _currentEffectName: string;\r\n private _name: string;\r\n private _currentFrameId: number;\r\n\r\n // Pool for avoiding memory leaks\r\n private static _MAX_UNIFORM_SIZE = 256;\r\n private static _TempBuffer = new Float32Array(UniformBuffer._MAX_UNIFORM_SIZE);\r\n private static _TempBufferInt32View = new Int32Array(UniformBuffer._TempBuffer.buffer);\r\n private static _TempBufferUInt32View = new Uint32Array(UniformBuffer._TempBuffer.buffer);\r\n\r\n /**\r\n * Lambda to Update a 3x3 Matrix in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateMatrix3x3: (name: string, matrix: Float32Array) => void;\r\n\r\n /**\r\n * Lambda to Update a 2x2 Matrix in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateMatrix2x2: (name: string, matrix: Float32Array) => void;\r\n\r\n /**\r\n * Lambda to Update a single float in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateFloat: (name: string, x: number) => void;\r\n\r\n /**\r\n * Lambda to Update a vec2 of float in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateFloat2: (name: string, x: number, y: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec3 of float in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateFloat3: (name: string, x: number, y: number, z: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec4 of float in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateFloat4: (name: string, x: number, y: number, z: number, w: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update an array of float in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateFloatArray: (name: string, array: Float32Array) => void;\r\n\r\n /**\r\n * Lambda to Update an array of number in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateArray: (name: string, array: number[]) => void;\r\n\r\n /**\r\n * Lambda to Update an array of number in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateIntArray: (name: string, array: Int32Array) => void;\r\n\r\n /**\r\n * Lambda to Update an array of number in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateUIntArray: (name: string, array: Uint32Array) => void;\r\n\r\n /**\r\n * Lambda to Update a 4x4 Matrix in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateMatrix: (name: string, mat: IMatrixLike) => void;\r\n\r\n /**\r\n * Lambda to Update an array of 4x4 Matrix in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateMatrices: (name: string, mat: Float32Array) => void;\r\n\r\n /**\r\n * Lambda to Update vec3 of float from a Vector in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateVector3: (name: string, vector: IVector3Like) => void;\r\n\r\n /**\r\n * Lambda to Update vec4 of float from a Vector in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateVector4: (name: string, vector: IVector4Like) => void;\r\n\r\n /**\r\n * Lambda to Update vec3 of float from a Color in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateColor3: (name: string, color: IColor3Like, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update vec4 of float from a Color in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateColor4: (name: string, color: IColor3Like, alpha: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update vec4 of float from a Color in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateDirectColor4: (name: string, color: IColor4Like, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a int a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateInt: (name: string, x: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec2 of int in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateInt2: (name: string, x: number, y: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec3 of int in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateInt3: (name: string, x: number, y: number, z: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec4 of int in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateInt4: (name: string, x: number, y: number, z: number, w: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a unsigned int a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateUInt: (name: string, x: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec2 of unsigned int in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateUInt2: (name: string, x: number, y: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec3 of unsigned int in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateUInt3: (name: string, x: number, y: number, z: number, suffix?: string) => void;\r\n\r\n /**\r\n * Lambda to Update a vec4 of unsigned int in a uniform buffer.\r\n * This is dynamic to allow compat with webgl 1 and 2.\r\n * You will need to pass the name of the uniform as well as the value.\r\n */\r\n public updateUInt4: (name: string, x: number, y: number, z: number, w: number, suffix?: string) => void;\r\n\r\n /**\r\n * Instantiates a new Uniform buffer objects.\r\n *\r\n * Handles blocks of uniform on the GPU.\r\n *\r\n * If WebGL 2 is not available, this class falls back on traditional setUniformXXX calls.\r\n *\r\n * For more information, please refer to :\r\n * @see https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\r\n * @param engine Define the engine the buffer is associated with\r\n * @param data Define the data contained in the buffer\r\n * @param dynamic Define if the buffer is updatable\r\n * @param name to assign to the buffer (debugging purpose)\r\n * @param forceNoUniformBuffer define that this object must not rely on UBO objects\r\n */\r\n constructor(engine: AbstractEngine, data?: number[], dynamic?: boolean, name?: string, forceNoUniformBuffer = false) {\r\n this._engine = engine;\r\n this._noUBO = !engine.supportsUniformBuffers || forceNoUniformBuffer;\r\n this._dynamic = dynamic;\r\n this._name = name ?? \"no-name\";\r\n\r\n this._data = data || [];\r\n\r\n this._uniformLocations = {};\r\n this._uniformSizes = {};\r\n this._uniformArraySizes = {};\r\n this._uniformLocationPointer = 0;\r\n this._needSync = false;\r\n\r\n if (this._engine._features.trackUbosInFrame) {\r\n this._buffers = [];\r\n this._bufferIndex = -1;\r\n this._createBufferOnWrite = false;\r\n this._currentFrameId = 0;\r\n }\r\n\r\n if (this._noUBO) {\r\n this.updateMatrix3x3 = this._updateMatrix3x3ForEffect;\r\n this.updateMatrix2x2 = this._updateMatrix2x2ForEffect;\r\n this.updateFloat = this._updateFloatForEffect;\r\n this.updateFloat2 = this._updateFloat2ForEffect;\r\n this.updateFloat3 = this._updateFloat3ForEffect;\r\n this.updateFloat4 = this._updateFloat4ForEffect;\r\n this.updateFloatArray = this._updateFloatArrayForEffect;\r\n this.updateArray = this._updateArrayForEffect;\r\n this.updateIntArray = this._updateIntArrayForEffect;\r\n this.updateUIntArray = this._updateUIntArrayForEffect;\r\n this.updateMatrix = this._updateMatrixForEffect;\r\n this.updateMatrices = this._updateMatricesForEffect;\r\n this.updateVector3 = this._updateVector3ForEffect;\r\n this.updateVector4 = this._updateVector4ForEffect;\r\n this.updateColor3 = this._updateColor3ForEffect;\r\n this.updateColor4 = this._updateColor4ForEffect;\r\n this.updateDirectColor4 = this._updateDirectColor4ForEffect;\r\n this.updateInt = this._updateIntForEffect;\r\n this.updateInt2 = this._updateInt2ForEffect;\r\n this.updateInt3 = this._updateInt3ForEffect;\r\n this.updateInt4 = this._updateInt4ForEffect;\r\n this.updateUInt = this._updateUIntForEffect;\r\n this.updateUInt2 = this._updateUInt2ForEffect;\r\n this.updateUInt3 = this._updateUInt3ForEffect;\r\n this.updateUInt4 = this._updateUInt4ForEffect;\r\n } else {\r\n this._engine._uniformBuffers.push(this);\r\n\r\n this.updateMatrix3x3 = this._updateMatrix3x3ForUniform;\r\n this.updateMatrix2x2 = this._updateMatrix2x2ForUniform;\r\n this.updateFloat = this._updateFloatForUniform;\r\n this.updateFloat2 = this._updateFloat2ForUniform;\r\n this.updateFloat3 = this._updateFloat3ForUniform;\r\n this.updateFloat4 = this._updateFloat4ForUniform;\r\n this.updateFloatArray = this._updateFloatArrayForUniform;\r\n this.updateArray = this._updateArrayForUniform;\r\n this.updateIntArray = this._updateIntArrayForUniform;\r\n this.updateUIntArray = this._updateUIntArrayForUniform;\r\n this.updateMatrix = this._updateMatrixForUniform;\r\n this.updateMatrices = this._updateMatricesForUniform;\r\n this.updateVector3 = this._updateVector3ForUniform;\r\n this.updateVector4 = this._updateVector4ForUniform;\r\n this.updateColor3 = this._updateColor3ForUniform;\r\n this.updateColor4 = this._updateColor4ForUniform;\r\n this.updateDirectColor4 = this._updateDirectColor4ForUniform;\r\n this.updateInt = this._updateIntForUniform;\r\n this.updateInt2 = this._updateInt2ForUniform;\r\n this.updateInt3 = this._updateInt3ForUniform;\r\n this.updateInt4 = this._updateInt4ForUniform;\r\n this.updateUInt = this._updateUIntForUniform;\r\n this.updateUInt2 = this._updateUInt2ForUniform;\r\n this.updateUInt3 = this._updateUInt3ForUniform;\r\n this.updateUInt4 = this._updateUInt4ForUniform;\r\n }\r\n }\r\n\r\n /**\r\n * Indicates if the buffer is using the WebGL2 UBO implementation,\r\n * or just falling back on setUniformXXX calls.\r\n */\r\n public get useUbo(): boolean {\r\n return !this._noUBO;\r\n }\r\n\r\n /**\r\n * Indicates if the WebGL underlying uniform buffer is in sync\r\n * with the javascript cache data.\r\n */\r\n public get isSync(): boolean {\r\n return !this._needSync;\r\n }\r\n\r\n /**\r\n * Indicates if the WebGL underlying uniform buffer is dynamic.\r\n * Also, a dynamic UniformBuffer will disable cache verification and always\r\n * update the underlying WebGL uniform buffer to the GPU.\r\n * @returns if Dynamic, otherwise false\r\n */\r\n public isDynamic(): boolean {\r\n return this._dynamic !== undefined;\r\n }\r\n\r\n /**\r\n * The data cache on JS side.\r\n * @returns the underlying data as a float array\r\n */\r\n public getData(): Float32Array {\r\n return this._bufferData;\r\n }\r\n\r\n /**\r\n * The underlying WebGL Uniform buffer.\r\n * @returns the webgl buffer\r\n */\r\n public getBuffer(): Nullable<DataBuffer> {\r\n return this._buffer;\r\n }\r\n\r\n /**\r\n * std140 layout specifies how to align data within an UBO structure.\r\n * See https://khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf#page=159\r\n * for specs.\r\n * @param size\r\n */\r\n private _fillAlignment(size: number) {\r\n // This code has been simplified because we only use floats, vectors of 1, 2, 3, 4 components\r\n // and 4x4 matrices\r\n // TODO : change if other types are used\r\n\r\n let alignment;\r\n if (size <= 2) {\r\n alignment = size;\r\n } else {\r\n alignment = 4;\r\n }\r\n\r\n if (this._uniformLocationPointer % alignment !== 0) {\r\n const oldPointer = this._uniformLocationPointer;\r\n this._uniformLocationPointer += alignment - (this._uniformLocationPointer % alignment);\r\n const diff = this._uniformLocationPointer - oldPointer;\r\n\r\n for (let i = 0; i < diff; i++) {\r\n this._data.push(0);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Adds an uniform in the buffer.\r\n * Warning : the subsequents calls of this function must be in the same order as declared in the shader\r\n * for the layout to be correct ! The addUniform function only handles types like float, vec2, vec3, vec4, mat4,\r\n * meaning size=1,2,3,4 or 16. It does not handle struct types.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param size Data size, or data directly.\r\n * @param arraySize The number of elements in the array, 0 if not an array.\r\n */\r\n public addUniform(name: string, size: number | number[], arraySize = 0) {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n\r\n if (this._uniformLocations[name] !== undefined) {\r\n // Already existing uniform\r\n return;\r\n }\r\n // This function must be called in the order of the shader layout !\r\n // size can be the size of the uniform, or data directly\r\n let data;\r\n\r\n // std140 FTW...\r\n if (arraySize > 0) {\r\n if (size instanceof Array) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"addUniform should not be use with Array in UBO: \" + name;\r\n }\r\n\r\n this._fillAlignment(4);\r\n\r\n this._uniformArraySizes[name] = { strideSize: size, arraySize };\r\n if (size == 16) {\r\n size = size * arraySize;\r\n } else {\r\n const perElementPadding = 4 - size;\r\n const totalPadding = perElementPadding * arraySize;\r\n size = size * arraySize + totalPadding;\r\n }\r\n\r\n data = [];\r\n // Fill with zeros\r\n for (let i = 0; i < size; i++) {\r\n data.push(0);\r\n }\r\n } else {\r\n if (size instanceof Array) {\r\n data = size;\r\n size = data.length;\r\n } else {\r\n size = <number>size;\r\n data = [];\r\n\r\n // Fill with zeros\r\n for (let i = 0; i < size; i++) {\r\n data.push(0);\r\n }\r\n }\r\n this._fillAlignment(<number>size);\r\n }\r\n\r\n this._uniformSizes[name] = <number>size;\r\n this._uniformLocations[name] = this._uniformLocationPointer;\r\n this._uniformLocationPointer += <number>size;\r\n\r\n for (let i = 0; i < size; i++) {\r\n this._data.push(data[i]);\r\n }\r\n\r\n this._needSync = true;\r\n }\r\n\r\n /**\r\n * Adds a Matrix 4x4 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param mat A 4x4 matrix.\r\n */\r\n public addMatrix(name: string, mat: IMatrixLike) {\r\n this.addUniform(name, Array.prototype.slice.call(mat.asArray()));\r\n }\r\n\r\n /**\r\n * Adds a vec2 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param x Define the x component value of the vec2\r\n * @param y Define the y component value of the vec2\r\n */\r\n public addFloat2(name: string, x: number, y: number) {\r\n const temp = [x, y];\r\n this.addUniform(name, temp);\r\n }\r\n\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param x Define the x component value of the vec3\r\n * @param y Define the y component value of the vec3\r\n * @param z Define the z component value of the vec3\r\n */\r\n public addFloat3(name: string, x: number, y: number, z: number) {\r\n const temp = [x, y, z];\r\n this.addUniform(name, temp);\r\n }\r\n\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param color Define the vec3 from a Color\r\n */\r\n public addColor3(name: string, color: IColor3Like) {\r\n const temp = [color.r, color.g, color.b];\r\n this.addUniform(name, temp);\r\n }\r\n\r\n /**\r\n * Adds a vec4 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param color Define the rgb components from a Color\r\n * @param alpha Define the a component of the vec4\r\n */\r\n public addColor4(name: string, color: IColor3Like, alpha: number) {\r\n const temp = [color.r, color.g, color.b, alpha];\r\n this.addUniform(name, temp);\r\n }\r\n\r\n /**\r\n * Adds a vec3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n * @param vector Define the vec3 components from a Vector\r\n */\r\n public addVector3(name: string, vector: IVector3Like) {\r\n const temp = [vector.x, vector.y, vector.z];\r\n this.addUniform(name, temp);\r\n }\r\n\r\n /**\r\n * Adds a Matrix 3x3 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n */\r\n public addMatrix3x3(name: string) {\r\n this.addUniform(name, 12);\r\n }\r\n\r\n /**\r\n * Adds a Matrix 2x2 to the uniform buffer.\r\n * @param name Name of the uniform, as used in the uniform block in the shader.\r\n */\r\n public addMatrix2x2(name: string) {\r\n this.addUniform(name, 8);\r\n }\r\n\r\n /**\r\n * Effectively creates the WebGL Uniform Buffer, once layout is completed with `addUniform`.\r\n */\r\n public create(): void {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n if (this._buffer) {\r\n return; // nothing to do\r\n }\r\n\r\n // See spec, alignment must be filled as a vec4\r\n this._fillAlignment(4);\r\n this._bufferData = new Float32Array(this._data);\r\n\r\n this._rebuild();\r\n\r\n this._needSync = true;\r\n }\r\n\r\n // The result of this method is used for debugging purpose, as part of the buffer name\r\n // It is meant to more easily know what this buffer is about when debugging\r\n // Some buffers can have a lot of uniforms (several dozens), so the method only returns the first 10 of them\r\n // (should be enough to understand what the buffer is for)\r\n private _getNames() {\r\n const names = [];\r\n let i = 0;\r\n for (const name in this._uniformLocations) {\r\n names.push(name);\r\n if (++i === 10) {\r\n break;\r\n }\r\n }\r\n return names.join(\",\");\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n if (this._noUBO || !this._bufferData) {\r\n return;\r\n }\r\n\r\n if (this._dynamic) {\r\n this._buffer = this._engine.createDynamicUniformBuffer(this._bufferData, this._name + \"_UniformList:\" + this._getNames());\r\n } else {\r\n this._buffer = this._engine.createUniformBuffer(this._bufferData, this._name + \"_UniformList:\" + this._getNames());\r\n }\r\n\r\n if (this._engine._features.trackUbosInFrame) {\r\n this._buffers.push([this._buffer, this._engine._features.checkUbosContentBeforeUpload ? this._bufferData.slice() : undefined]);\r\n this._bufferIndex = this._buffers.length - 1;\r\n this._createBufferOnWrite = false;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _rebuildAfterContextLost(): void {\r\n if (this._engine._features.trackUbosInFrame) {\r\n this._buffers = [];\r\n this._currentFrameId = 0;\r\n }\r\n this._rebuild();\r\n }\r\n\r\n /** @internal */\r\n public get _numBuffers(): number {\r\n return this._buffers.length;\r\n }\r\n\r\n /** @internal */\r\n public get _indexBuffer(): number {\r\n return this._bufferIndex;\r\n }\r\n\r\n /** Gets the name of this buffer */\r\n public get name(): string {\r\n return this._name;\r\n }\r\n\r\n /** Gets the current effect */\r\n public get currentEffect(): Nullable<Effect> {\r\n return this._currentEffect;\r\n }\r\n\r\n private _buffersEqual(buf1: Float32Array, buf2: Float32Array): boolean {\r\n for (let i = 0; i < buf1.length; ++i) {\r\n if (buf1[i] !== buf2[i]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n private _copyBuffer(src: Float32Array, dst: Float32Array): void {\r\n for (let i = 0; i < src.length; ++i) {\r\n dst[i] = src[i];\r\n }\r\n }\r\n\r\n /**\r\n * Updates the WebGL Uniform Buffer on the GPU.\r\n * If the `dynamic` flag is set to true, no cache comparison is done.\r\n * Otherwise, the buffer will be updated only if the cache differs.\r\n */\r\n public update(): void {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n\r\n this.bindUniformBuffer();\r\n\r\n if (!this._buffer) {\r\n this.create();\r\n return;\r\n }\r\n\r\n if (!this._dynamic && !this._needSync) {\r\n this._createBufferOnWrite = this._engine._features.trackUbosInFrame;\r\n return;\r\n }\r\n\r\n if (this._buffers && this._buffers.length > 1 && this._buffers[this._bufferIndex][1]) {\r\n if (this._buffersEqual(this._bufferData, this._buffers[this._bufferIndex][1]!)) {\r\n this._needSync = false;\r\n this._createBufferOnWrite = this._engine._features.trackUbosInFrame;\r\n return;\r\n } else {\r\n this._copyBuffer(this._bufferData, this._buffers[this._bufferIndex][1]!);\r\n }\r\n }\r\n\r\n this._engine.updateUniformBuffer(this._buffer, this._bufferData);\r\n\r\n if (this._engine._features._collectUbosUpdatedInFrame) {\r\n if (!UniformBuffer._UpdatedUbosInFrame[this._name]) {\r\n UniformBuffer._UpdatedUbosInFrame[this._name] = 0;\r\n }\r\n UniformBuffer._UpdatedUbosInFrame[this._name]++;\r\n }\r\n\r\n this._needSync = false;\r\n this._createBufferOnWrite = this._engine._features.trackUbosInFrame;\r\n }\r\n\r\n private _createNewBuffer() {\r\n if (this._bufferIndex + 1 < this._buffers.length) {\r\n this._bufferIndex++;\r\n this._buffer = this._buffers[this._bufferIndex][0];\r\n this._createBufferOnWrite = false;\r\n this._needSync = true;\r\n } else {\r\n this._rebuild();\r\n }\r\n }\r\n\r\n private _checkNewFrame(): void {\r\n if (this._engine._features.trackUbosInFrame && this._currentFrameId !== this._engine.frameId) {\r\n this._currentFrameId = this._engine.frameId;\r\n this._createBufferOnWrite = false;\r\n if (this._buffers && this._buffers.length > 0) {\r\n this._needSync = this._bufferIndex !== 0;\r\n this._bufferIndex = 0;\r\n this._buffer = this._buffers[this._bufferIndex][0];\r\n } else {\r\n this._bufferIndex = -1;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n * @param size Define the size of the data.\r\n */\r\n public updateUniform(uniformName: string, data: FloatArray, size: number) {\r\n this._checkNewFrame();\r\n\r\n let location = this._uniformLocations[uniformName];\r\n if (location === undefined) {\r\n if (this._buffer) {\r\n // Cannot add an uniform if the buffer is already created\r\n Logger.Error(\"Cannot add an uniform after UBO has been created. uniformName=\" + uniformName);\r\n return;\r\n }\r\n this.addUniform(uniformName, size);\r\n location = this._uniformLocations[uniformName];\r\n }\r\n\r\n if (!this._buffer) {\r\n this.create();\r\n }\r\n\r\n if (!this._dynamic) {\r\n // Cache for static uniform buffers\r\n let changed = false;\r\n\r\n for (let i = 0; i < size; i++) {\r\n // We are checking the matrix cache before calling updateUniform so we do not need to check it here\r\n // Hence the test for size === 16 to simply commit the matrix values\r\n if ((size === 16 && !this._engine._features.uniformBufferHardCheckMatrix) || this._bufferData[location + i] !== Math.fround(data[i])) {\r\n changed = true;\r\n if (this._createBufferOnWrite) {\r\n this._createNewBuffer();\r\n }\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n\r\n this._needSync = this._needSync || changed;\r\n } else {\r\n // No cache for dynamic\r\n for (let i = 0; i < size; i++) {\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n * @param size Define the size of the data.\r\n */\r\n public updateUniformArray(uniformName: string, data: FloatArray, size: number) {\r\n this._checkNewFrame();\r\n\r\n const location = this._uniformLocations[uniformName];\r\n if (location === undefined) {\r\n Logger.Error(\"Cannot add an uniform Array dynamically. Please, add it using addUniform and make sure that uniform buffers are supported by the current engine.\");\r\n return;\r\n }\r\n\r\n if (!this._buffer) {\r\n this.create();\r\n }\r\n\r\n const arraySizes = this._uniformArraySizes[uniformName];\r\n\r\n if (!this._dynamic) {\r\n // Cache for static uniform buffers\r\n let changed = false;\r\n let countToFour = 0;\r\n let baseStride = 0;\r\n for (let i = 0; i < size; i++) {\r\n if (this._bufferData[location + baseStride * 4 + countToFour] !== Tools.FloatRound(data[i])) {\r\n changed = true;\r\n if (this._createBufferOnWrite) {\r\n this._createNewBuffer();\r\n }\r\n this._bufferData[location + baseStride * 4 + countToFour] = data[i];\r\n }\r\n countToFour++;\r\n if (countToFour === arraySizes.strideSize) {\r\n for (; countToFour < 4; countToFour++) {\r\n this._bufferData[location + baseStride * 4 + countToFour] = 0;\r\n }\r\n countToFour = 0;\r\n baseStride++;\r\n }\r\n }\r\n\r\n this._needSync = this._needSync || changed;\r\n } else {\r\n // No cache for dynamic\r\n for (let i = 0; i < size; i++) {\r\n this._bufferData[location + i] = data[i];\r\n }\r\n }\r\n }\r\n\r\n // Matrix cache\r\n private _valueCache: { [key: string]: number } = {};\r\n private _cacheMatrix(name: string, matrix: IMatrixLike): boolean {\r\n this._checkNewFrame();\r\n\r\n const cache = this._valueCache[name];\r\n const flag = matrix.updateFlag;\r\n if (cache !== undefined && cache === flag) {\r\n return false;\r\n }\r\n\r\n this._valueCache[name] = flag;\r\n return true;\r\n }\r\n\r\n // Update methods\r\n\r\n private _updateMatrix3x3ForUniform(name: string, matrix: Float32Array): void {\r\n // To match std140, matrix must be realigned\r\n for (let i = 0; i < 3; i++) {\r\n UniformBuffer._TempBuffer[i * 4] = matrix[i * 3];\r\n UniformBuffer._TempBuffer[i * 4 + 1] = matrix[i * 3 + 1];\r\n UniformBuffer._TempBuffer[i * 4 + 2] = matrix[i * 3 + 2];\r\n UniformBuffer._TempBuffer[i * 4 + 3] = 0.0;\r\n }\r\n\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 12);\r\n }\r\n\r\n private _updateMatrix3x3ForEffect(name: string, matrix: Float32Array): void {\r\n this._currentEffect.setMatrix3x3(name, matrix);\r\n }\r\n\r\n private _updateMatrix2x2ForEffect(name: string, matrix: Float32Array): void {\r\n this._currentEffect.setMatrix2x2(name, matrix);\r\n }\r\n\r\n private _updateMatrix2x2ForUniform(name: string, matrix: Float32Array): void {\r\n // To match std140, matrix must be realigned\r\n for (let i = 0; i < 2; i++) {\r\n UniformBuffer._TempBuffer[i * 4] = matrix[i * 2];\r\n UniformBuffer._TempBuffer[i * 4 + 1] = matrix[i * 2 + 1];\r\n UniformBuffer._TempBuffer[i * 4 + 2] = 0.0;\r\n UniformBuffer._TempBuffer[i * 4 + 3] = 0.0;\r\n }\r\n\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 8);\r\n }\r\n\r\n private _updateFloatForEffect(name: string, x: number) {\r\n this._currentEffect.setFloat(name, x);\r\n }\r\n\r\n private _updateFloatForUniform(name: string, x: number) {\r\n UniformBuffer._TempBuffer[0] = x;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 1);\r\n }\r\n\r\n private _updateFloat2ForEffect(name: string, x: number, y: number, suffix = \"\") {\r\n this._currentEffect.setFloat2(name + suffix, x, y);\r\n }\r\n\r\n private _updateFloat2ForUniform(name: string, x: number, y: number) {\r\n UniformBuffer._TempBuffer[0] = x;\r\n UniformBuffer._TempBuffer[1] = y;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 2);\r\n }\r\n\r\n private _updateFloat3ForEffect(name: string, x: number, y: number, z: number, suffix = \"\") {\r\n this._currentEffect.setFloat3(name + suffix, x, y, z);\r\n }\r\n\r\n private _updateFloat3ForUniform(name: string, x: number, y: number, z: number) {\r\n UniformBuffer._TempBuffer[0] = x;\r\n UniformBuffer._TempBuffer[1] = y;\r\n UniformBuffer._TempBuffer[2] = z;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\r\n }\r\n\r\n private _updateFloat4ForEffect(name: string, x: number, y: number, z: number, w: number, suffix = \"\") {\r\n this._currentEffect.setFloat4(name + suffix, x, y, z, w);\r\n }\r\n\r\n private _updateFloat4ForUniform(name: string, x: number, y: number, z: number, w: number) {\r\n UniformBuffer._TempBuffer[0] = x;\r\n UniformBuffer._TempBuffer[1] = y;\r\n UniformBuffer._TempBuffer[2] = z;\r\n UniformBuffer._TempBuffer[3] = w;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\r\n }\r\n\r\n private _updateFloatArrayForEffect(name: string, array: Float32Array) {\r\n this._currentEffect.setFloatArray(name, array);\r\n }\r\n\r\n private _updateFloatArrayForUniform(name: string, array: Float32Array) {\r\n this.updateUniformArray(name, array, array.length);\r\n }\r\n\r\n private _updateArrayForEffect(name: string, array: number[]) {\r\n this._currentEffect.setArray(name, array);\r\n }\r\n\r\n private _updateArrayForUniform(name: string, array: number[]) {\r\n this.updateUniformArray(name, array, array.length);\r\n }\r\n\r\n private _updateIntArrayForEffect(name: string, array: Int32Array) {\r\n this._currentEffect.setIntArray(name, array);\r\n }\r\n\r\n private _updateIntArrayForUniform(name: string, array: Int32Array) {\r\n UniformBuffer._TempBufferInt32View.set(array);\r\n this.updateUniformArray(name, UniformBuffer._TempBuffer, array.length);\r\n }\r\n\r\n private _updateUIntArrayForEffect(name: string, array: Uint32Array) {\r\n this._currentEffect.setUIntArray(name, array);\r\n }\r\n\r\n private _updateUIntArrayForUniform(name: string, array: Uint32Array) {\r\n UniformBuffer._TempBufferUInt32View.set(array);\r\n this.updateUniformArray(name, UniformBuffer._TempBuffer, array.length);\r\n }\r\n\r\n private _updateMatrixForEffect(name: string, mat: IMatrixLike) {\r\n this._currentEffect.setMatrix(name, mat);\r\n }\r\n\r\n private _updateMatrixForUniform(name: string, mat: IMatrixLike) {\r\n if (this._cacheMatrix(name, mat)) {\r\n this.updateUniform(name, <any>mat.asArray(), 16);\r\n }\r\n }\r\n\r\n private _updateMatricesForEffect(name: string, mat: Float32Array) {\r\n this._currentEffect.setMatrices(name, mat);\r\n }\r\n\r\n private _updateMatricesForUniform(name: string, mat: Float32Array) {\r\n this.updateUniform(name, mat, mat.length);\r\n }\r\n\r\n private _updateVector3ForEffect(name: string, vector: IVector3Like) {\r\n this._currentEffect.setVector3(name, vector);\r\n }\r\n\r\n private _updateVector3ForUniform(name: string, vector: IVector3Like) {\r\n UniformBuffer._TempBuffer[0] = vector.x;\r\n UniformBuffer._TempBuffer[1] = vector.y;\r\n UniformBuffer._TempBuffer[2] = vector.z;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\r\n }\r\n\r\n private _updateVector4ForEffect(name: string, vector: IVector4Like) {\r\n this._currentEffect.setVector4(name, vector);\r\n }\r\n\r\n private _updateVector4ForUniform(name: string, vector: IVector4Like) {\r\n UniformBuffer._TempBuffer[0] = vector.x;\r\n UniformBuffer._TempBuffer[1] = vector.y;\r\n UniformBuffer._TempBuffer[2] = vector.z;\r\n UniformBuffer._TempBuffer[3] = vector.w;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\r\n }\r\n\r\n private _updateColor3ForEffect(name: string, color: IColor3Like, suffix = \"\") {\r\n this._currentEffect.setColor3(name + suffix, color);\r\n }\r\n\r\n private _updateColor3ForUniform(name: string, color: IColor3Like) {\r\n UniformBuffer._TempBuffer[0] = color.r;\r\n UniformBuffer._TempBuffer[1] = color.g;\r\n UniformBuffer._TempBuffer[2] = color.b;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\r\n }\r\n\r\n private _updateColor4ForEffect(name: string, color: IColor3Like, alpha: number, suffix = \"\") {\r\n this._currentEffect.setColor4(name + suffix, color, alpha);\r\n }\r\n\r\n private _updateDirectColor4ForEffect(name: string, color: IColor4Like, suffix = \"\") {\r\n this._currentEffect.setDirectColor4(name + suffix, color);\r\n }\r\n\r\n private _updateColor4ForUniform(name: string, color: IColor3Like, alpha: number) {\r\n UniformBuffer._TempBuffer[0] = color.r;\r\n UniformBuffer._TempBuffer[1] = color.g;\r\n UniformBuffer._TempBuffer[2] = color.b;\r\n UniformBuffer._TempBuffer[3] = alpha;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\r\n }\r\n\r\n private _updateDirectColor4ForUniform(name: string, color: IColor4Like) {\r\n UniformBuffer._TempBuffer[0] = color.r;\r\n UniformBuffer._TempBuffer[1] = color.g;\r\n UniformBuffer._TempBuffer[2] = color.b;\r\n UniformBuffer._TempBuffer[3] = color.a;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\r\n }\r\n\r\n private _updateIntForEffect(name: string, x: number, suffix = \"\") {\r\n this._currentEffect.setInt(name + suffix, x);\r\n }\r\n\r\n private _updateIntForUniform(name: string, x: number) {\r\n UniformBuffer._TempBufferInt32View[0] = x;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 1);\r\n }\r\n\r\n private _updateInt2ForEffect(name: string, x: number, y: number, suffix = \"\") {\r\n this._currentEffect.setInt2(name + suffix, x, y);\r\n }\r\n\r\n private _updateInt2ForUniform(name: string, x: number, y: number) {\r\n UniformBuffer._TempBufferInt32View[0] = x;\r\n UniformBuffer._TempBufferInt32View[1] = y;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 2);\r\n }\r\n\r\n private _updateInt3ForEffect(name: string, x: number, y: number, z: number, suffix = \"\") {\r\n this._currentEffect.setInt3(name + suffix, x, y, z);\r\n }\r\n\r\n private _updateInt3ForUniform(name: string, x: number, y: number, z: number) {\r\n UniformBuffer._TempBufferInt32View[0] = x;\r\n UniformBuffer._TempBufferInt32View[1] = y;\r\n UniformBuffer._TempBufferInt32View[2] = z;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\r\n }\r\n\r\n private _updateInt4ForEffect(name: string, x: number, y: number, z: number, w: number, suffix = \"\") {\r\n this._currentEffect.setInt4(name + suffix, x, y, z, w);\r\n }\r\n\r\n private _updateInt4ForUniform(name: string, x: number, y: number, z: number, w: number) {\r\n UniformBuffer._TempBufferInt32View[0] = x;\r\n UniformBuffer._TempBufferInt32View[1] = y;\r\n UniformBuffer._TempBufferInt32View[2] = z;\r\n UniformBuffer._TempBufferInt32View[3] = w;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\r\n }\r\n\r\n private _updateUIntForEffect(name: string, x: number, suffix = \"\") {\r\n this._currentEffect.setUInt(name + suffix, x);\r\n }\r\n\r\n private _updateUIntForUniform(name: string, x: number) {\r\n UniformBuffer._TempBufferUInt32View[0] = x;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 1);\r\n }\r\n\r\n private _updateUInt2ForEffect(name: string, x: number, y: number, suffix = \"\") {\r\n this._currentEffect.setUInt2(name + suffix, x, y);\r\n }\r\n\r\n private _updateUInt2ForUniform(name: string, x: number, y: number) {\r\n UniformBuffer._TempBufferUInt32View[0] = x;\r\n UniformBuffer._TempBufferUInt32View[1] = y;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 2);\r\n }\r\n\r\n private _updateUInt3ForEffect(name: string, x: number, y: number, z: number, suffix = \"\") {\r\n this._currentEffect.setUInt3(name + suffix, x, y, z);\r\n }\r\n\r\n private _updateUInt3ForUniform(name: string, x: number, y: number, z: number) {\r\n UniformBuffer._TempBufferUInt32View[0] = x;\r\n UniformBuffer._TempBufferUInt32View[1] = y;\r\n UniformBuffer._TempBufferUInt32View[2] = z;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\r\n }\r\n\r\n private _updateUInt4ForEffect(name: string, x: number, y: number, z: number, w: number, suffix = \"\") {\r\n this._currentEffect.setUInt4(name + suffix, x, y, z, w);\r\n }\r\n\r\n private _updateUInt4ForUniform(name: string, x: number, y: number, z: number, w: number) {\r\n UniformBuffer._TempBufferUInt32View[0] = x;\r\n UniformBuffer._TempBufferUInt32View[1] = y;\r\n UniformBuffer._TempBufferUInt32View[2] = z;\r\n UniformBuffer._TempBufferUInt32View[3] = w;\r\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\r\n }\r\n\r\n /**\r\n * Sets a sampler uniform on the effect.\r\n * @param name Define the name of the sampler.\r\n * @param texture Define the texture to set in the sampler\r\n */\r\n public setTexture(name: string, texture: Nullable<ThinTexture>) {\r\n this._currentEffect.setTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Sets a sampler uniform on the effect.\r\n * @param name Define the name of the sampler.\r\n * @param texture Define the (internal) texture to set in the sampler\r\n */\r\n public bindTexture(name: string, texture: Nullable<InternalTexture>) {\r\n this._currentEffect._bindTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Directly updates the value of the uniform in the cache AND on the GPU.\r\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\r\n * @param data Define the flattened data\r\n */\r\n public updateUniformDirectly(uniformName: string, data: FloatArray) {\r\n this.updateUniform(uniformName, data, data.length);\r\n\r\n this.update();\r\n }\r\n\r\n /**\r\n * Associates an effect to this uniform buffer\r\n * @param effect Define the effect to associate the buffer to\r\n * @param name Name of the uniform block in the shader.\r\n */\r\n public bindToEffect(effect: Effect, name: string): void {\r\n this._currentEffect = effect;\r\n this._currentEffectName = name;\r\n }\r\n\r\n /**\r\n * Binds the current (GPU) buffer to the effect\r\n */\r\n public bindUniformBuffer(): void {\r\n if (!this._noUBO && this._buffer && this._currentEffect) {\r\n this._currentEffect.bindUniformBuffer(this._buffer, this._currentEffectName);\r\n }\r\n }\r\n\r\n /**\r\n * Dissociates the current effect from this uniform buffer\r\n */\r\n public unbindEffect(): void {\r\n this._currentEffect = undefined as any;\r\n this._currentEffectName = undefined as any;\r\n }\r\n\r\n /**\r\n * Sets the current state of the class (_bufferIndex, _buffer) to point to the data buffer passed in parameter if this buffer is one of the buffers handled by the class (meaning if it can be found in the _buffers array)\r\n * This method is meant to be able to update a buffer at any time: just call setDataBuffer to set the class in the right state, call some updateXXX methods and then call udpate() => that will update the GPU buffer on the graphic card\r\n * @param dataBuffer buffer to look for\r\n * @returns true if the buffer has been found and the class internal state points to it, else false\r\n */\r\n public setDataBuffer(dataBuffer: DataBuffer): boolean {\r\n if (!this._buffers) {\r\n return this._buffer === dataBuffer;\r\n }\r\n\r\n for (let b = 0; b < this._buffers.length; ++b) {\r\n const buffer = this._buffers[b];\r\n if (buffer[0] === dataBuffer) {\r\n this._bufferIndex = b;\r\n this._buffer = dataBuffer;\r\n this._createBufferOnWrite = false;\r\n this._currentEffect = undefined as any;\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Disposes the uniform buffer.\r\n */\r\n public dispose(): void {\r\n if (this._noUBO) {\r\n return;\r\n }\r\n\r\n const uniformBuffers = this._engine._uniformBuffers;\r\n const index = uniformBuffers.indexOf(this);\r\n\r\n if (index !== -1) {\r\n uniformBuffers[index] = uniformBuffers[uniformBuffers.length - 1];\r\n uniformBuffers.pop();\r\n }\r\n\r\n if (this._engine._features.trackUbosInFrame && this._buffers) {\r\n for (let i = 0; i < this._buffers.length; ++i) {\r\n const buffer = this._buffers[i][0];\r\n this._engine._releaseBuffer(buffer!);\r\n }\r\n } else if (this._buffer && this._engine._releaseBuffer(this._buffer)) {\r\n this._buffer = null;\r\n }\r\n }\r\n}\r\n"]}
@@ -114,6 +114,12 @@ export declare function CreateGreasedLineMaterial(name: string, options: Greased
114
114
  * @returns instance of GreasedLineMesh
115
115
  */
116
116
  export declare function CreateGreasedLine(name: string, options: GreasedLineMeshBuilderOptions, materialOptions?: Nullable<GreasedLineMaterialBuilderOptions>, scene?: Nullable<Scene>): import("../GreasedLine/greasedLineBaseMesh").GreasedLineBaseMesh | GreasedLineMesh | GreasedLineRibbonMesh;
117
+ /**
118
+ * Counts the number of points
119
+ * @param allPoints Array of points [[x, y, z], [x, y, z], ...] or Array of points [x, y, z, x, y, z, ...]
120
+ * @returns total number of points
121
+ */
122
+ export declare function GetPointsCount(allPoints: number[][]): number;
117
123
  /**
118
124
  * Completes the width table/fills the missing entries. It means it creates a width entry for every point of the line mesh.
119
125
  * You can provide more points the widths when creating the mesh. This function will fill the empty entries.
@@ -125,15 +125,10 @@ export function CreateGreasedLine(name, options, materialOptions, scene) {
125
125
  materialOptions.createAndAssignMaterial = materialOptions.createAndAssignMaterial ?? true;
126
126
  materialOptions.colorDistribution = materialOptions?.colorDistribution ?? GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START;
127
127
  materialOptions.materialType = materialOptions.materialType ?? GreasedLineMeshMaterialType.MATERIAL_TYPE_STANDARD;
128
- let length = 0;
129
- if (Array.isArray(allPoints[0])) {
130
- allPoints.forEach((points) => {
131
- length += points.length / 3;
132
- });
133
- }
134
- const widths = CompleteGreasedLineWidthTable(length, options.widths ?? [], options.widthDistribution);
128
+ const pointsCount = GetPointsCount(allPoints);
129
+ const widths = CompleteGreasedLineWidthTable(pointsCount, options.widths ?? [], options.widthDistribution);
135
130
  const colors = materialOptions?.colors
136
- ? CompleteGreasedLineColorTable(length, materialOptions.colors, materialOptions.colorDistribution, materialOptions.color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR)
131
+ ? CompleteGreasedLineColorTable(pointsCount, materialOptions.colors, materialOptions.colorDistribution, materialOptions.color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR)
137
132
  : undefined;
138
133
  // create new mesh if instance is not defined
139
134
  const initialGreasedLineOptions = {
@@ -231,6 +226,18 @@ export function CreateGreasedLine(name, options, materialOptions, scene) {
231
226
  }
232
227
  return instance;
233
228
  }
229
+ /**
230
+ * Counts the number of points
231
+ * @param allPoints Array of points [[x, y, z], [x, y, z], ...] or Array of points [x, y, z, x, y, z, ...]
232
+ * @returns total number of points
233
+ */
234
+ export function GetPointsCount(allPoints) {
235
+ let pointCount = 0;
236
+ for (const points of allPoints) {
237
+ pointCount += points.length / 3;
238
+ }
239
+ return pointCount;
240
+ }
234
241
  /**
235
242
  * Completes the width table/fills the missing entries. It means it creates a width entry for every point of the line mesh.
236
243
  * You can provide more points the widths when creating the mesh. This function will fill the empty entries.
@@ -1 +1 @@
1
- {"version":3,"file":"greasedLineBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/greasedLineBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,kCAAkC,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjJ,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAAC;AACxG,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AAEtG;;;GAGG;AACH,MAAM,CAAN,IAAY,gCAyBX;AAzBD,WAAY,gCAAgC;IACxC;;OAEG;IACH,6HAA2B,CAAA;IAC3B;;OAEG;IACH,iIAA6B,CAAA;IAC7B;;OAEG;IACH,6HAA2B,CAAA;IAC3B;;OAEG;IACH,+HAA4B,CAAA;IAC5B;;OAEG;IACH,2HAA0B,CAAA;IAC1B;;OAEG;I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AAE;oBACrB,CAAC,GAAG,CAAC,CAAC;iBACT;aACJ;SACJ;aAAM,IAAI,iBAAiB,KAAK,gCAAgC,CAAC,uBAAuB,EAAE;YACvF,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;YAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;gBACrC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAExB,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBAE3B,CAAC,IAAI,iBAAiB,CAAC;aAC1B;SACJ;aAAM,IAAI,iBAAiB,KAAK,gCAAgC,CAAC,uBAAuB,EAAE;YACvF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;aAC9B;SACJ;KACJ;SAAM;QACH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE;YACjC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9B;KACJ;IAED,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["import { StandardMaterial } from \"./../../Materials/standardMaterial\";\r\nimport { PBRMaterial } from \"../../Materials/PBR/pbrMaterial\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { GreasedLineMesh } from \"../GreasedLine/greasedLineMesh\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\nimport { GreasedLineSimpleMaterial } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions } from \"../GreasedLine/greasedLineBaseMesh\";\r\nimport { GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from \"../GreasedLine/greasedLineBaseMesh\";\r\nimport { GreasedLineRibbonMesh } from \"../GreasedLine/greasedLineRibbonMesh\";\r\nimport type { GreasedLineMaterialOptions } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshMaterialType } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { GreasedLineMaterialDefaults } from \"../../Materials/GreasedLine/greasedLineMaterialDefaults\";\r\n\r\n/**\r\n * How are the colors distributed along the color table\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colors-and-colordistribution}\r\n */\r\nexport enum GreasedLineMeshColorDistribution {\r\n /**\r\n * Do no modify the color table\r\n */\r\n COLOR_DISTRIBUTION_NONE = 0,\r\n /**\r\n * Repeat the colors until the color table is full\r\n */\r\n COLOR_DISTRIBUTION_REPEAT = 1,\r\n /**\r\n * Distribute the colors evenly through the color table\r\n */\r\n COLOR_DISTRIBUTION_EVEN = 2,\r\n /**\r\n * Put the colors to start of the color table a fill the rest with the default color\r\n */\r\n COLOR_DISTRIBUTION_START = 3,\r\n /**\r\n * Put the colors to the end of the color table and fill the rest with the default color\r\n */\r\n COLOR_DISTRIBUTION_END = 4,\r\n /**\r\n * Put the colors to start and to the end of the color table and fill the gap between with the default color\r\n */\r\n COLOR_DISTRIBUTION_START_END = 5,\r\n}\r\n\r\n/**\r\n * How are the widths distributed along the width table\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#widths-and-widthdistribution}\r\n */\r\nexport enum GreasedLineMeshWidthDistribution {\r\n /**\r\n * Do no modify the width table\r\n */\r\n WIDTH_DISTRIBUTION_NONE = 0,\r\n /**\r\n * Repeat the widths until the width table is full\r\n */\r\n WIDTH_DISTRIBUTION_REPEAT = 1,\r\n /**\r\n * Distribute the widths evenly through the width table\r\n */\r\n WIDTH_DISTRIBUTION_EVEN = 2,\r\n /**\r\n * Put the widths to start of the width table a fill the rest with the default width\r\n */\r\n WIDTH_DISTRIBUTION_START = 3,\r\n /**\r\n * Put the widths to the end of the width table and fill the rest with the default width\r\n */\r\n WIDTH_DISTRIBUTION_END = 4,\r\n /**\r\n * Put the widths to start and to the end of the width table and fill the gap between with the default width\r\n */\r\n WIDTH_DISTRIBUTION_START_END = 5,\r\n}\r\n\r\n/**\r\n * Material options for GreasedLineBuilder\r\n */\r\nexport interface GreasedLineMaterialBuilderOptions extends GreasedLineMaterialOptions {\r\n /**\r\n * If set to true a new material will be created and a new material plugin will be attached\r\n * to the material. The material will be set on the mesh. If the instance option is specified in the mesh options,\r\n * no material will be created/assigned. Defaults to true.\r\n */\r\n createAndAssignMaterial?: boolean;\r\n /**\r\n * Distribution of the colors if the color table contains fewer entries than needed. Defaults to GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START\r\n * @see CompleteGreasedLineColorTable\r\n */\r\n colorDistribution?: GreasedLineMeshColorDistribution;\r\n}\r\n\r\n/**\r\n * Line mesh options for GreasedLineBuilder\r\n */\r\nexport interface GreasedLineMeshBuilderOptions extends GreasedLineMeshOptions {\r\n /**\r\n * Distribution of the widths if the width table contains fewer entries than needed. Defaults to GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START\r\n * @see CompleteGreasedLineWidthTable\r\n */\r\n widthDistribution?: GreasedLineMeshWidthDistribution;\r\n}\r\n\r\n/**\r\n * Builder functions for creating GreasedLineMeshes\r\n */\r\n\r\n/**\r\n * Creates a new @see GreasedLinePluginMaterial\r\n * @param name name of the material\r\n * @param options material options @see GreasedLineMaterialOptions\r\n * @param scene scene or null to use the last scene\r\n * @returns StandardMaterial or PBRMaterial with the @see GreasedLinePluginMaterial attached to it\r\n */\r\nexport function CreateGreasedLineMaterial(name: string, options: GreasedLineMaterialOptions, scene: Nullable<Scene>) {\r\n scene = <Scene>(scene ?? EngineStore.LastCreatedScene);\r\n\r\n let material;\r\n switch (options.materialType) {\r\n case GreasedLineMeshMaterialType.MATERIAL_TYPE_PBR:\r\n material = new PBRMaterial(name, scene);\r\n new GreasedLinePluginMaterial(material, scene, options);\r\n break;\r\n case GreasedLineMeshMaterialType.MATERIAL_TYPE_SIMPLE:\r\n material = new GreasedLineSimpleMaterial(name, scene, options);\r\n break;\r\n default:\r\n material = new StandardMaterial(name, scene);\r\n new GreasedLinePluginMaterial(material, scene, options);\r\n break;\r\n }\r\n\r\n return material;\r\n}\r\n\r\n/**\r\n * Creates a GreasedLine mesh\r\n * @param name name of the mesh\r\n * @param options options for the mesh\r\n * @param materialOptions material options for the mesh\r\n * @param scene scene where the mesh will be created\r\n * @returns instance of GreasedLineMesh\r\n */\r\nexport function CreateGreasedLine(name: string, options: GreasedLineMeshBuilderOptions, materialOptions?: Nullable<GreasedLineMaterialBuilderOptions>, scene?: Nullable<Scene>) {\r\n scene = <Scene>(scene ?? EngineStore.LastCreatedScene);\r\n\r\n let instance;\r\n const allPoints = GreasedLineTools.ConvertPoints(options.points);\r\n\r\n options.widthDistribution = options.widthDistribution ?? GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START;\r\n if (options.ribbonOptions) {\r\n options.ribbonOptions.facesMode = options.ribbonOptions.facesMode ?? GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING;\r\n options.ribbonOptions.pointsMode = options.ribbonOptions.pointsMode ?? GreasedLineRibbonPointsMode.POINTS_MODE_POINTS;\r\n options.ribbonOptions.directionsAutoMode =\r\n options.ribbonOptions.directionsAutoMode ??\r\n (options.ribbonOptions.directions ? GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE : GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT);\r\n }\r\n\r\n materialOptions = materialOptions ?? {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n materialOptions.createAndAssignMaterial = materialOptions.createAndAssignMaterial ?? true;\r\n materialOptions.colorDistribution = materialOptions?.colorDistribution ?? GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START;\r\n materialOptions.materialType = materialOptions.materialType ?? GreasedLineMeshMaterialType.MATERIAL_TYPE_STANDARD;\r\n\r\n let length = 0;\r\n if (Array.isArray(allPoints[0])) {\r\n allPoints.forEach((points) => {\r\n length += points.length / 3;\r\n });\r\n }\r\n\r\n const widths = CompleteGreasedLineWidthTable(length, options.widths ?? [], options.widthDistribution);\r\n\r\n const colors = materialOptions?.colors\r\n ? CompleteGreasedLineColorTable(length, materialOptions.colors, materialOptions.colorDistribution, materialOptions.color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR)\r\n : undefined;\r\n\r\n // create new mesh if instance is not defined\r\n const initialGreasedLineOptions: GreasedLineMeshOptions = {\r\n points: allPoints,\r\n updatable: options.updatable,\r\n widths,\r\n lazy: options.lazy,\r\n ribbonOptions: options.ribbonOptions,\r\n uvs: options.uvs,\r\n colorPointers: options.colorPointers,\r\n };\r\n\r\n if (initialGreasedLineOptions.ribbonOptions) {\r\n if (initialGreasedLineOptions.ribbonOptions.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n initialGreasedLineOptions.ribbonOptions.width = materialOptions.width ?? initialGreasedLineOptions.ribbonOptions.width ?? GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n }\r\n }\r\n\r\n if (!options.instance) {\r\n instance = initialGreasedLineOptions.ribbonOptions\r\n ? new GreasedLineRibbonMesh(name, scene, initialGreasedLineOptions)\r\n : new GreasedLineMesh(name, scene, initialGreasedLineOptions);\r\n\r\n if (materialOptions) {\r\n const initialMaterialOptions: GreasedLineMaterialOptions = {\r\n materialType: materialOptions.materialType,\r\n dashCount: materialOptions.dashCount,\r\n dashOffset: materialOptions.dashOffset,\r\n dashRatio: materialOptions.dashRatio,\r\n resolution: materialOptions.resolution,\r\n sizeAttenuation: materialOptions.sizeAttenuation,\r\n useColors: materialOptions.useColors,\r\n useDash: materialOptions.useDash,\r\n visibility: materialOptions.visibility,\r\n width: materialOptions.width,\r\n color: materialOptions.color,\r\n colorMode: materialOptions.colorMode,\r\n colorsSampling: materialOptions.colorsSampling,\r\n colorDistributionType: materialOptions.colorDistributionType,\r\n colors,\r\n cameraFacing: !options.ribbonOptions,\r\n colorsTexture: materialOptions.colorsTexture,\r\n };\r\n\r\n if (materialOptions.createAndAssignMaterial) {\r\n const material = CreateGreasedLineMaterial(name, initialMaterialOptions, scene);\r\n instance.material = material;\r\n\r\n if (options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING) {\r\n material.backFaceCulling = false;\r\n }\r\n }\r\n }\r\n } else {\r\n // update the data on the mesh instance\r\n instance = options.instance;\r\n if (instance instanceof GreasedLineRibbonMesh) {\r\n instance.addPoints(allPoints, initialGreasedLineOptions);\r\n } else {\r\n // add widths\r\n const currentWidths = instance.widths;\r\n if (currentWidths) {\r\n const newWidths = currentWidths.slice();\r\n for (const w of widths) {\r\n newWidths.push(w);\r\n }\r\n instance.widths = newWidths;\r\n } else {\r\n instance.widths = widths;\r\n }\r\n\r\n instance.addPoints(allPoints);\r\n\r\n // add UVs\r\n if (options.uvs) {\r\n const currentUVs = instance.uvs;\r\n if (currentUVs) {\r\n const newUVs = new Float32Array(currentUVs.length + options.uvs.length);\r\n newUVs.set(currentUVs, 0);\r\n newUVs.set(options.uvs, currentUVs.length);\r\n instance.uvs = newUVs;\r\n } else {\r\n instance.uvs = options.uvs;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // add colors\r\n // it will merge if any colors already on the instance\r\n if (colors && options.instance) {\r\n if (options.instance.greasedLineMaterial) {\r\n const currentColors = options.instance.greasedLineMaterial.colors;\r\n if (currentColors) {\r\n const newColors = currentColors.concat(colors);\r\n options.instance.greasedLineMaterial.setColors(newColors, instance.isLazy());\r\n }\r\n }\r\n }\r\n\r\n return instance;\r\n}\r\n\r\n/**\r\n * Completes the width table/fills the missing entries. It means it creates a width entry for every point of the line mesh.\r\n * You can provide more points the widths when creating the mesh. This function will fill the empty entries.\r\n * The algorithm used to fill the empty entries can be\r\n * GreasedLineMeshWidthDistribution.REPEAT - the width table will be repeatedly copied to the empty values [wL, wU] = [wL, wU, wL, wU, wL, wU, wL, wU, ...]\r\n * GreasedLineMeshWidthDistribution.EVEN - the width table will be evenly copied to the empty values [wL, wU] = [wL, wL, wL, wL, wU, wU, wU, wU]\r\n * GreasedLineMeshWidthDistribution.START - the width table will be copied at the start of the empty values\r\n * and rest will be filled width the default width upper and default width lower values [wU, wL] = [wL, wU, dwL, dwU, dwL, dwU, dwL, dwU]\r\n * GreasedLineMeshWidthDistribution.END - the width table will be copied at the end of the empty values\r\n * and rest will be filled width the default values [wL, wU] = [wL, wU, dwL, dwU, dwL, dwU, wL, wU]\r\n * @param pointCount number of points of the line mesh\r\n * @param widths array of widths [widhtLower, widthUpper, widthLower, widthUpper ...]. Two widths (lower/upper) per point.\r\n * @param widthsDistribution how to distribute widths if the widths array has fewer entries than pointCount\r\n * @param defaultWidthUpper the default value which will be used to fill empty width entries - upper width\r\n * @param defaultWidthLower the default value which will be used to fill empty width entries - lower width\r\n * @returns completed width table.\r\n */\r\nexport function CompleteGreasedLineWidthTable(\r\n pointCount: number,\r\n widths: number[],\r\n widthsDistribution: GreasedLineMeshWidthDistribution,\r\n defaultWidthUpper = 1,\r\n defaultWidthLower = 1\r\n): number[] {\r\n const missingCount = pointCount - widths.length / 2;\r\n\r\n const widthsData: number[] = [];\r\n if (missingCount < 0) {\r\n return widths.slice(0, pointCount * 2);\r\n }\r\n\r\n // is the width table shorter than the point table?\r\n if (missingCount > 0) {\r\n if (widths.length % 2 != 0) {\r\n widths.push(defaultWidthUpper);\r\n }\r\n // it is, fill in the missing elements\r\n if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START_END) {\r\n const halfCount = Math.floor(widths.length / 2);\r\n\r\n // start sector\r\n for (let i = 0, j = 0; i < halfCount - 1; i++) {\r\n widthsData.push(widths[j++]);\r\n widthsData.push(widths[j++]);\r\n }\r\n\r\n // middle sector\r\n const widthL = widths[halfCount / 2];\r\n const widthU = widths[halfCount / 2 + 1];\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(widthU);\r\n widthsData.push(widthL);\r\n }\r\n\r\n // end sector\r\n for (let i = halfCount; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START) {\r\n // start sector\r\n for (let i = 0; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(defaultWidthUpper);\r\n widthsData.push(defaultWidthLower);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_END) {\r\n // start sector\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(defaultWidthUpper);\r\n widthsData.push(defaultWidthLower);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_REPEAT) {\r\n let i = 0;\r\n for (let x = 0; x < pointCount; x++) {\r\n widthsData.push(widths[i++]);\r\n widthsData.push(widths[i++]);\r\n\r\n if (i === widths.length) {\r\n i = 0;\r\n }\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_EVEN) {\r\n let j = 0;\r\n const widthsectorLength = widths.length / ((pointCount - 1) * 2);\r\n for (let x = 0; x < pointCount; x++) {\r\n const i = Math.floor(j);\r\n\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n\r\n j += widthsectorLength;\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < widths.length; i++) {\r\n widthsData.push(widths[i]);\r\n }\r\n }\r\n\r\n return widthsData;\r\n}\r\n\r\n/**\r\n * Completes the color table/fill the missing color entries. It means it creates a color entry for every point of the line mesh.\r\n * You can provide more points the colors when creating the mesh. This function will fill the empty entries.\r\n * The algorithm used to fill the empty entries can be\r\n * GreasedLineMesColorhDistribution.REPEAT - the color table will be repeatedly copied to the empty values [c1, c2] = [c1, c2, c1, c2, c1, c2, c1, c2]\r\n * GreasedLineMesColorhDistribution.EVEN - the color table will be evenly copied to the empty values [c1, c2] = [c1, c1, c1, c1, c2, c2, c2, c2]\r\n * GreasedLineMesColorhDistribution.START - the color table will be copied at the start of the empty values\r\n * and rest will be filled color the default color value [c1, c2] = [c1, c2, dc, dc, dc, dc, dc, dc]\r\n * GreasedLineMesColorhDistribution.START_END - the color table will be copied at the start and the end of the empty values\r\n * and rest will be filled color the default color value [c1, c2] = [c1, c2, dc, dc, dc, dc, c1, c2]\r\n * @param pointCount number of points of the line mesh\r\n * @param colors array of Color3 for the color table\r\n * @param colorDistribution how to distribute colors if the colors array has fewer entries than pointCount\r\n * @param defaultColor default color to be used to fill empty entries in the color table\r\n * @returns completed array of Color3s\r\n */\r\nexport function CompleteGreasedLineColorTable(pointCount: number, colors: Color3[], colorDistribution: GreasedLineMeshColorDistribution, defaultColor: Color3): Color3[] {\r\n pointCount = Math.max(colors.length, pointCount);\r\n const missingCount = pointCount - colors.length;\r\n if (missingCount < 0) {\r\n return colors.slice(0, pointCount);\r\n }\r\n\r\n const colorsData: Color3[] = [];\r\n // is the color table shorter than the point table?\r\n if (missingCount > 0) {\r\n // it is, fill in the missing elements\r\n if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START_END) {\r\n const halfCount = Math.floor(colors.length / 2);\r\n\r\n // start sector\r\n for (let i = 0; i < halfCount; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n\r\n // middle sector\r\n for (let i = 0; i < missingCount - 1; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n\r\n // end sector\r\n for (let i = halfCount; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START) {\r\n // start sector\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < missingCount; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_END) {\r\n // start sector\r\n for (let i = 0; i < missingCount - 1; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_REPEAT) {\r\n let i = 0;\r\n for (let x = 0; x < pointCount; x++) {\r\n colorsData.push(colors[i]);\r\n\r\n i++;\r\n\r\n if (i === colors.length) {\r\n i = 0;\r\n }\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_EVEN) {\r\n let j = 0;\r\n const colorSectorLength = colors.length / (pointCount - 1);\r\n for (let x = 0; x < pointCount - 1; x++) {\r\n const i = Math.floor(j);\r\n\r\n colorsData.push(colors[i]);\r\n\r\n j += colorSectorLength;\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_NONE) {\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < pointCount; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n }\r\n\r\n return colorsData;\r\n}\r\n"]}
1
+ {"version":3,"file":"greasedLineBuilder.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Builders/greasedLineBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,kCAAkC,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjJ,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAAC;AACxG,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AAEtG;;;GAGG;AACH,MAAM,CAAN,IAAY,gCAyBX;AAzBD,WAAY,gCAAgC;IACxC;;OAEG;IACH,6HAA2B,CAAA;IAC3B;;OAEG;IACH,iIAA6B,CAAA;IAC7B;;OAEG;IACH,6HAA2B,CAAA;IAC3B;;OAEG;IACH,+HAA4B,CAAA;IAC5B;;OAEG;IACH,2HAA0B,CAAA;IAC1B;;OAEG;IACH,uIAAgC,CAAA;AACpC,CAAC,EAzBW,gCAAgC,KAAhC,gCAAgC,QAyB3C;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,gCAyBX;AAzBD,WAAY,gCAAgC;IACxC;;OAEG;IACH,6HAA2B,CAAA;IAC3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AAC,CAAC;YACV,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;YAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;gBACrC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAExB,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBAE3B,CAAC,IAAI,iBAAiB,CAAC;aAC1B;SACJ;aAAM,IAAI,iBAAiB,KAAK,gCAAgC,CAAC,uBAAuB,EAAE;YACvF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;aAC9B;SACJ;KACJ;SAAM;QACH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE;YACjC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9B;KACJ;IAED,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["import { StandardMaterial } from \"./../../Materials/standardMaterial\";\r\nimport { PBRMaterial } from \"../../Materials/PBR/pbrMaterial\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { GreasedLineMesh } from \"../GreasedLine/greasedLineMesh\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\nimport { GreasedLineSimpleMaterial } from \"../../Materials/GreasedLine/greasedLineSimpleMaterial\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport type { GreasedLineMeshOptions } from \"../GreasedLine/greasedLineBaseMesh\";\r\nimport { GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonPointsMode } from \"../GreasedLine/greasedLineBaseMesh\";\r\nimport { GreasedLineRibbonMesh } from \"../GreasedLine/greasedLineRibbonMesh\";\r\nimport type { GreasedLineMaterialOptions } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLineMeshMaterialType } from \"../../Materials/GreasedLine/greasedLineMaterialInterfaces\";\r\nimport { GreasedLinePluginMaterial } from \"../../Materials/GreasedLine/greasedLinePluginMaterial\";\r\nimport { GreasedLineMaterialDefaults } from \"../../Materials/GreasedLine/greasedLineMaterialDefaults\";\r\n\r\n/**\r\n * How are the colors distributed along the color table\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colors-and-colordistribution}\r\n */\r\nexport enum GreasedLineMeshColorDistribution {\r\n /**\r\n * Do no modify the color table\r\n */\r\n COLOR_DISTRIBUTION_NONE = 0,\r\n /**\r\n * Repeat the colors until the color table is full\r\n */\r\n COLOR_DISTRIBUTION_REPEAT = 1,\r\n /**\r\n * Distribute the colors evenly through the color table\r\n */\r\n COLOR_DISTRIBUTION_EVEN = 2,\r\n /**\r\n * Put the colors to start of the color table a fill the rest with the default color\r\n */\r\n COLOR_DISTRIBUTION_START = 3,\r\n /**\r\n * Put the colors to the end of the color table and fill the rest with the default color\r\n */\r\n COLOR_DISTRIBUTION_END = 4,\r\n /**\r\n * Put the colors to start and to the end of the color table and fill the gap between with the default color\r\n */\r\n COLOR_DISTRIBUTION_START_END = 5,\r\n}\r\n\r\n/**\r\n * How are the widths distributed along the width table\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#widths-and-widthdistribution}\r\n */\r\nexport enum GreasedLineMeshWidthDistribution {\r\n /**\r\n * Do no modify the width table\r\n */\r\n WIDTH_DISTRIBUTION_NONE = 0,\r\n /**\r\n * Repeat the widths until the width table is full\r\n */\r\n WIDTH_DISTRIBUTION_REPEAT = 1,\r\n /**\r\n * Distribute the widths evenly through the width table\r\n */\r\n WIDTH_DISTRIBUTION_EVEN = 2,\r\n /**\r\n * Put the widths to start of the width table a fill the rest with the default width\r\n */\r\n WIDTH_DISTRIBUTION_START = 3,\r\n /**\r\n * Put the widths to the end of the width table and fill the rest with the default width\r\n */\r\n WIDTH_DISTRIBUTION_END = 4,\r\n /**\r\n * Put the widths to start and to the end of the width table and fill the gap between with the default width\r\n */\r\n WIDTH_DISTRIBUTION_START_END = 5,\r\n}\r\n\r\n/**\r\n * Material options for GreasedLineBuilder\r\n */\r\nexport interface GreasedLineMaterialBuilderOptions extends GreasedLineMaterialOptions {\r\n /**\r\n * If set to true a new material will be created and a new material plugin will be attached\r\n * to the material. The material will be set on the mesh. If the instance option is specified in the mesh options,\r\n * no material will be created/assigned. Defaults to true.\r\n */\r\n createAndAssignMaterial?: boolean;\r\n /**\r\n * Distribution of the colors if the color table contains fewer entries than needed. Defaults to GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START\r\n * @see CompleteGreasedLineColorTable\r\n */\r\n colorDistribution?: GreasedLineMeshColorDistribution;\r\n}\r\n\r\n/**\r\n * Line mesh options for GreasedLineBuilder\r\n */\r\nexport interface GreasedLineMeshBuilderOptions extends GreasedLineMeshOptions {\r\n /**\r\n * Distribution of the widths if the width table contains fewer entries than needed. Defaults to GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START\r\n * @see CompleteGreasedLineWidthTable\r\n */\r\n widthDistribution?: GreasedLineMeshWidthDistribution;\r\n}\r\n\r\n/**\r\n * Builder functions for creating GreasedLineMeshes\r\n */\r\n\r\n/**\r\n * Creates a new @see GreasedLinePluginMaterial\r\n * @param name name of the material\r\n * @param options material options @see GreasedLineMaterialOptions\r\n * @param scene scene or null to use the last scene\r\n * @returns StandardMaterial or PBRMaterial with the @see GreasedLinePluginMaterial attached to it\r\n */\r\nexport function CreateGreasedLineMaterial(name: string, options: GreasedLineMaterialOptions, scene: Nullable<Scene>) {\r\n scene = <Scene>(scene ?? EngineStore.LastCreatedScene);\r\n\r\n let material;\r\n switch (options.materialType) {\r\n case GreasedLineMeshMaterialType.MATERIAL_TYPE_PBR:\r\n material = new PBRMaterial(name, scene);\r\n new GreasedLinePluginMaterial(material, scene, options);\r\n break;\r\n case GreasedLineMeshMaterialType.MATERIAL_TYPE_SIMPLE:\r\n material = new GreasedLineSimpleMaterial(name, scene, options);\r\n break;\r\n default:\r\n material = new StandardMaterial(name, scene);\r\n new GreasedLinePluginMaterial(material, scene, options);\r\n break;\r\n }\r\n\r\n return material;\r\n}\r\n\r\n/**\r\n * Creates a GreasedLine mesh\r\n * @param name name of the mesh\r\n * @param options options for the mesh\r\n * @param materialOptions material options for the mesh\r\n * @param scene scene where the mesh will be created\r\n * @returns instance of GreasedLineMesh\r\n */\r\nexport function CreateGreasedLine(name: string, options: GreasedLineMeshBuilderOptions, materialOptions?: Nullable<GreasedLineMaterialBuilderOptions>, scene?: Nullable<Scene>) {\r\n scene = <Scene>(scene ?? EngineStore.LastCreatedScene);\r\n\r\n let instance;\r\n const allPoints = GreasedLineTools.ConvertPoints(options.points);\r\n\r\n options.widthDistribution = options.widthDistribution ?? GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START;\r\n if (options.ribbonOptions) {\r\n options.ribbonOptions.facesMode = options.ribbonOptions.facesMode ?? GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING;\r\n options.ribbonOptions.pointsMode = options.ribbonOptions.pointsMode ?? GreasedLineRibbonPointsMode.POINTS_MODE_POINTS;\r\n options.ribbonOptions.directionsAutoMode =\r\n options.ribbonOptions.directionsAutoMode ??\r\n (options.ribbonOptions.directions ? GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE : GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT);\r\n }\r\n\r\n materialOptions = materialOptions ?? {\r\n color: GreasedLineMaterialDefaults.DEFAULT_COLOR,\r\n };\r\n materialOptions.createAndAssignMaterial = materialOptions.createAndAssignMaterial ?? true;\r\n materialOptions.colorDistribution = materialOptions?.colorDistribution ?? GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START;\r\n materialOptions.materialType = materialOptions.materialType ?? GreasedLineMeshMaterialType.MATERIAL_TYPE_STANDARD;\r\n\r\n const pointsCount = GetPointsCount(allPoints);\r\n const widths = CompleteGreasedLineWidthTable(pointsCount, options.widths ?? [], options.widthDistribution);\r\n\r\n const colors = materialOptions?.colors\r\n ? CompleteGreasedLineColorTable(pointsCount, materialOptions.colors, materialOptions.colorDistribution, materialOptions.color ?? GreasedLineMaterialDefaults.DEFAULT_COLOR)\r\n : undefined;\r\n\r\n // create new mesh if instance is not defined\r\n const initialGreasedLineOptions: GreasedLineMeshOptions = {\r\n points: allPoints,\r\n updatable: options.updatable,\r\n widths,\r\n lazy: options.lazy,\r\n ribbonOptions: options.ribbonOptions,\r\n uvs: options.uvs,\r\n colorPointers: options.colorPointers,\r\n };\r\n\r\n if (initialGreasedLineOptions.ribbonOptions) {\r\n if (initialGreasedLineOptions.ribbonOptions.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n initialGreasedLineOptions.ribbonOptions.width = materialOptions.width ?? initialGreasedLineOptions.ribbonOptions.width ?? GreasedLineMaterialDefaults.DEFAULT_WIDTH;\r\n }\r\n }\r\n\r\n if (!options.instance) {\r\n instance = initialGreasedLineOptions.ribbonOptions\r\n ? new GreasedLineRibbonMesh(name, scene, initialGreasedLineOptions)\r\n : new GreasedLineMesh(name, scene, initialGreasedLineOptions);\r\n\r\n if (materialOptions) {\r\n const initialMaterialOptions: GreasedLineMaterialOptions = {\r\n materialType: materialOptions.materialType,\r\n dashCount: materialOptions.dashCount,\r\n dashOffset: materialOptions.dashOffset,\r\n dashRatio: materialOptions.dashRatio,\r\n resolution: materialOptions.resolution,\r\n sizeAttenuation: materialOptions.sizeAttenuation,\r\n useColors: materialOptions.useColors,\r\n useDash: materialOptions.useDash,\r\n visibility: materialOptions.visibility,\r\n width: materialOptions.width,\r\n color: materialOptions.color,\r\n colorMode: materialOptions.colorMode,\r\n colorsSampling: materialOptions.colorsSampling,\r\n colorDistributionType: materialOptions.colorDistributionType,\r\n colors,\r\n cameraFacing: !options.ribbonOptions,\r\n colorsTexture: materialOptions.colorsTexture,\r\n };\r\n\r\n if (materialOptions.createAndAssignMaterial) {\r\n const material = CreateGreasedLineMaterial(name, initialMaterialOptions, scene);\r\n instance.material = material;\r\n\r\n if (options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING) {\r\n material.backFaceCulling = false;\r\n }\r\n }\r\n }\r\n } else {\r\n // update the data on the mesh instance\r\n instance = options.instance;\r\n if (instance instanceof GreasedLineRibbonMesh) {\r\n instance.addPoints(allPoints, initialGreasedLineOptions);\r\n } else {\r\n // add widths\r\n const currentWidths = instance.widths;\r\n if (currentWidths) {\r\n const newWidths = currentWidths.slice();\r\n for (const w of widths) {\r\n newWidths.push(w);\r\n }\r\n instance.widths = newWidths;\r\n } else {\r\n instance.widths = widths;\r\n }\r\n\r\n instance.addPoints(allPoints);\r\n\r\n // add UVs\r\n if (options.uvs) {\r\n const currentUVs = instance.uvs;\r\n if (currentUVs) {\r\n const newUVs = new Float32Array(currentUVs.length + options.uvs.length);\r\n newUVs.set(currentUVs, 0);\r\n newUVs.set(options.uvs, currentUVs.length);\r\n instance.uvs = newUVs;\r\n } else {\r\n instance.uvs = options.uvs;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // add colors\r\n // it will merge if any colors already on the instance\r\n if (colors && options.instance) {\r\n if (options.instance.greasedLineMaterial) {\r\n const currentColors = options.instance.greasedLineMaterial.colors;\r\n if (currentColors) {\r\n const newColors = currentColors.concat(colors);\r\n options.instance.greasedLineMaterial.setColors(newColors, instance.isLazy());\r\n }\r\n }\r\n }\r\n\r\n return instance;\r\n}\r\n\r\n/**\r\n * Counts the number of points\r\n * @param allPoints Array of points [[x, y, z], [x, y, z], ...] or Array of points [x, y, z, x, y, z, ...]\r\n * @returns total number of points\r\n */\r\nexport function GetPointsCount(allPoints: number[][]) {\r\n let pointCount = 0;\r\n for (const points of allPoints) {\r\n pointCount += (<number[]>points).length / 3;\r\n }\r\n return pointCount;\r\n}\r\n\r\n/**\r\n * Completes the width table/fills the missing entries. It means it creates a width entry for every point of the line mesh.\r\n * You can provide more points the widths when creating the mesh. This function will fill the empty entries.\r\n * The algorithm used to fill the empty entries can be\r\n * GreasedLineMeshWidthDistribution.REPEAT - the width table will be repeatedly copied to the empty values [wL, wU] = [wL, wU, wL, wU, wL, wU, wL, wU, ...]\r\n * GreasedLineMeshWidthDistribution.EVEN - the width table will be evenly copied to the empty values [wL, wU] = [wL, wL, wL, wL, wU, wU, wU, wU]\r\n * GreasedLineMeshWidthDistribution.START - the width table will be copied at the start of the empty values\r\n * and rest will be filled width the default width upper and default width lower values [wU, wL] = [wL, wU, dwL, dwU, dwL, dwU, dwL, dwU]\r\n * GreasedLineMeshWidthDistribution.END - the width table will be copied at the end of the empty values\r\n * and rest will be filled width the default values [wL, wU] = [wL, wU, dwL, dwU, dwL, dwU, wL, wU]\r\n * @param pointCount number of points of the line mesh\r\n * @param widths array of widths [widhtLower, widthUpper, widthLower, widthUpper ...]. Two widths (lower/upper) per point.\r\n * @param widthsDistribution how to distribute widths if the widths array has fewer entries than pointCount\r\n * @param defaultWidthUpper the default value which will be used to fill empty width entries - upper width\r\n * @param defaultWidthLower the default value which will be used to fill empty width entries - lower width\r\n * @returns completed width table.\r\n */\r\nexport function CompleteGreasedLineWidthTable(\r\n pointCount: number,\r\n widths: number[],\r\n widthsDistribution: GreasedLineMeshWidthDistribution,\r\n defaultWidthUpper = 1,\r\n defaultWidthLower = 1\r\n): number[] {\r\n const missingCount = pointCount - widths.length / 2;\r\n\r\n const widthsData: number[] = [];\r\n if (missingCount < 0) {\r\n return widths.slice(0, pointCount * 2);\r\n }\r\n\r\n // is the width table shorter than the point table?\r\n if (missingCount > 0) {\r\n if (widths.length % 2 != 0) {\r\n widths.push(defaultWidthUpper);\r\n }\r\n // it is, fill in the missing elements\r\n if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START_END) {\r\n const halfCount = Math.floor(widths.length / 2);\r\n\r\n // start sector\r\n for (let i = 0, j = 0; i < halfCount - 1; i++) {\r\n widthsData.push(widths[j++]);\r\n widthsData.push(widths[j++]);\r\n }\r\n\r\n // middle sector\r\n const widthL = widths[halfCount / 2];\r\n const widthU = widths[halfCount / 2 + 1];\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(widthU);\r\n widthsData.push(widthL);\r\n }\r\n\r\n // end sector\r\n for (let i = halfCount; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_START) {\r\n // start sector\r\n for (let i = 0; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(defaultWidthUpper);\r\n widthsData.push(defaultWidthLower);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_END) {\r\n // start sector\r\n for (let i = 0; i < missingCount; i++) {\r\n widthsData.push(defaultWidthUpper);\r\n widthsData.push(defaultWidthLower);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < widths.length; i += 2) {\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_REPEAT) {\r\n let i = 0;\r\n for (let x = 0; x < pointCount; x++) {\r\n widthsData.push(widths[i++]);\r\n widthsData.push(widths[i++]);\r\n\r\n if (i === widths.length) {\r\n i = 0;\r\n }\r\n }\r\n } else if (widthsDistribution === GreasedLineMeshWidthDistribution.WIDTH_DISTRIBUTION_EVEN) {\r\n let j = 0;\r\n const widthsectorLength = widths.length / ((pointCount - 1) * 2);\r\n for (let x = 0; x < pointCount; x++) {\r\n const i = Math.floor(j);\r\n\r\n widthsData.push(widths[i]);\r\n widthsData.push(widths[i + 1]);\r\n\r\n j += widthsectorLength;\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < widths.length; i++) {\r\n widthsData.push(widths[i]);\r\n }\r\n }\r\n\r\n return widthsData;\r\n}\r\n\r\n/**\r\n * Completes the color table/fill the missing color entries. It means it creates a color entry for every point of the line mesh.\r\n * You can provide more points the colors when creating the mesh. This function will fill the empty entries.\r\n * The algorithm used to fill the empty entries can be\r\n * GreasedLineMesColorhDistribution.REPEAT - the color table will be repeatedly copied to the empty values [c1, c2] = [c1, c2, c1, c2, c1, c2, c1, c2]\r\n * GreasedLineMesColorhDistribution.EVEN - the color table will be evenly copied to the empty values [c1, c2] = [c1, c1, c1, c1, c2, c2, c2, c2]\r\n * GreasedLineMesColorhDistribution.START - the color table will be copied at the start of the empty values\r\n * and rest will be filled color the default color value [c1, c2] = [c1, c2, dc, dc, dc, dc, dc, dc]\r\n * GreasedLineMesColorhDistribution.START_END - the color table will be copied at the start and the end of the empty values\r\n * and rest will be filled color the default color value [c1, c2] = [c1, c2, dc, dc, dc, dc, c1, c2]\r\n * @param pointCount number of points of the line mesh\r\n * @param colors array of Color3 for the color table\r\n * @param colorDistribution how to distribute colors if the colors array has fewer entries than pointCount\r\n * @param defaultColor default color to be used to fill empty entries in the color table\r\n * @returns completed array of Color3s\r\n */\r\nexport function CompleteGreasedLineColorTable(pointCount: number, colors: Color3[], colorDistribution: GreasedLineMeshColorDistribution, defaultColor: Color3): Color3[] {\r\n pointCount = Math.max(colors.length, pointCount);\r\n const missingCount = pointCount - colors.length;\r\n if (missingCount < 0) {\r\n return colors.slice(0, pointCount);\r\n }\r\n\r\n const colorsData: Color3[] = [];\r\n // is the color table shorter than the point table?\r\n if (missingCount > 0) {\r\n // it is, fill in the missing elements\r\n if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START_END) {\r\n const halfCount = Math.floor(colors.length / 2);\r\n\r\n // start sector\r\n for (let i = 0; i < halfCount; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n\r\n // middle sector\r\n for (let i = 0; i < missingCount - 1; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n\r\n // end sector\r\n for (let i = halfCount; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_START) {\r\n // start sector\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < missingCount; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_END) {\r\n // start sector\r\n for (let i = 0; i < missingCount - 1; i++) {\r\n colorsData.push(defaultColor);\r\n }\r\n\r\n // end sector\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_REPEAT) {\r\n let i = 0;\r\n for (let x = 0; x < pointCount; x++) {\r\n colorsData.push(colors[i]);\r\n\r\n i++;\r\n\r\n if (i === colors.length) {\r\n i = 0;\r\n }\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_EVEN) {\r\n let j = 0;\r\n const colorSectorLength = colors.length / (pointCount - 1);\r\n for (let x = 0; x < pointCount - 1; x++) {\r\n const i = Math.floor(j);\r\n\r\n colorsData.push(colors[i]);\r\n\r\n j += colorSectorLength;\r\n }\r\n } else if (colorDistribution === GreasedLineMeshColorDistribution.COLOR_DISTRIBUTION_NONE) {\r\n for (let i = 0; i < colors.length; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < pointCount; i++) {\r\n colorsData.push(colors[i]);\r\n }\r\n }\r\n\r\n return colorsData;\r\n}\r\n"]}
@@ -372,7 +372,7 @@ export class GaussianSplattingMesh extends Mesh {
372
372
  const engine = this._scene.getEngine();
373
373
  const width = engine.getCaps().maxTextureSize;
374
374
  let height = 1;
375
- if (engine.webGLVersion === 1 && !engine.isWebGPU) {
375
+ if (engine.version === 1 && !engine.isWebGPU) {
376
376
  while (width * height < length) {
377
377
  height *= 2;
378
378
  }