@onerjs/core 8.55.8 → 8.56.1

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 (423) hide show
  1. package/Animations/animation.pure.js +2 -2
  2. package/Animations/animation.pure.js.map +1 -1
  3. package/Animations/runtimeAnimation.js +4 -0
  4. package/Animations/runtimeAnimation.js.map +1 -1
  5. package/AudioV2/webAudio/webAudioEngine.d.ts +7 -0
  6. package/AudioV2/webAudio/webAudioEngine.js +6 -5
  7. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  8. package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
  9. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  10. package/Behaviors/Meshes/followBehavior.js +1 -0
  11. package/Behaviors/Meshes/followBehavior.js.map +1 -1
  12. package/Behaviors/Meshes/surfaceMagnetismBehavior.js +1 -0
  13. package/Behaviors/Meshes/surfaceMagnetismBehavior.js.map +1 -1
  14. package/Cameras/Inputs/followCameraMouseWheelInput.js +2 -2
  15. package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
  16. package/Cameras/Inputs/followCameraPointersInput.d.ts +15 -0
  17. package/Cameras/Inputs/followCameraPointersInput.js +18 -3
  18. package/Cameras/Inputs/followCameraPointersInput.js.map +1 -1
  19. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js +1 -1
  20. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
  21. package/Cameras/Stereoscopic/stereoscopicUniversalCamera.pure.js +1 -1
  22. package/Cameras/Stereoscopic/stereoscopicUniversalCamera.pure.js.map +1 -1
  23. package/Cameras/arcRotateCamera.pure.js +1 -1
  24. package/Cameras/arcRotateCamera.pure.js.map +1 -1
  25. package/Collisions/gpuPicker.d.ts +1 -0
  26. package/Collisions/gpuPicker.js +5 -4
  27. package/Collisions/gpuPicker.js.map +1 -1
  28. package/Culling/Helper/boundingInfoHelper.js +9 -5
  29. package/Culling/Helper/boundingInfoHelper.js.map +1 -1
  30. package/Culling/boundingSphere.js +7 -4
  31. package/Culling/boundingSphere.js.map +1 -1
  32. package/Engines/AbstractEngine/abstractEngine.textureLoaders.d.ts +5 -1
  33. package/Engines/AbstractEngine/abstractEngine.textureLoaders.js +7 -3
  34. package/Engines/AbstractEngine/abstractEngine.textureLoaders.js.map +1 -1
  35. package/Engines/AbstractEngine/abstractEngine.textureLoaders.pure.d.ts +6 -0
  36. package/Engines/AbstractEngine/abstractEngine.textureLoaders.pure.js +16 -0
  37. package/Engines/AbstractEngine/abstractEngine.textureLoaders.pure.js.map +1 -0
  38. package/Engines/AbstractEngine/pure.d.ts +1 -0
  39. package/Engines/AbstractEngine/pure.js +1 -0
  40. package/Engines/AbstractEngine/pure.js.map +1 -1
  41. package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js +1 -1
  42. package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js.map +1 -1
  43. package/Engines/IDrawContext.d.ts +2 -0
  44. package/Engines/IDrawContext.js.map +1 -1
  45. package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js +48 -6
  46. package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js.map +1 -1
  47. package/Engines/Native/nativeInterfaces.d.ts +1 -1
  48. package/Engines/Native/nativeInterfaces.js.map +1 -1
  49. package/Engines/WebGPU/webgpuDrawContext.d.ts +8 -0
  50. package/Engines/WebGPU/webgpuDrawContext.js +15 -0
  51. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  52. package/Engines/abstractEngine.pure.js +2 -2
  53. package/Engines/abstractEngine.pure.js.map +1 -1
  54. package/Engines/engine.d.ts +21 -4
  55. package/Engines/thinNativeEngine.pure.d.ts +6 -1
  56. package/Engines/thinNativeEngine.pure.js +29 -2
  57. package/Engines/thinNativeEngine.pure.js.map +1 -1
  58. package/Engines/webgpuEngine.d.ts +1 -0
  59. package/Engines/webgpuEngine.js +1 -0
  60. package/Engines/webgpuEngine.js.map +1 -1
  61. package/Engines/webgpuEngine.pure.d.ts +10 -0
  62. package/Engines/webgpuEngine.pure.js +15 -1
  63. package/Engines/webgpuEngine.pure.js.map +1 -1
  64. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.d.ts +3 -63
  65. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js +5 -71
  66. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js.map +1 -1
  67. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.pure.d.ts +71 -0
  68. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.pure.js +86 -0
  69. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.pure.js.map +1 -0
  70. package/FlowGraph/Blocks/Data/pure.d.ts +1 -0
  71. package/FlowGraph/Blocks/Data/pure.js +1 -0
  72. package/FlowGraph/Blocks/Data/pure.js.map +1 -1
  73. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.d.ts +3 -37
  74. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js +5 -39
  75. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js.map +1 -1
  76. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.pure.d.ts +45 -0
  77. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.pure.js +54 -0
  78. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.pure.js.map +1 -0
  79. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.d.ts +3 -17
  80. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js +5 -22
  81. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js.map +1 -1
  82. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.pure.d.ts +25 -0
  83. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.pure.js +37 -0
  84. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.pure.js.map +1 -0
  85. package/FlowGraph/Blocks/Event/pure.d.ts +2 -0
  86. package/FlowGraph/Blocks/Event/pure.js +2 -0
  87. package/FlowGraph/Blocks/Event/pure.js.map +1 -1
  88. package/FlowGraph/Blocks/flowGraphBlockFactory.d.ts +1 -1
  89. package/FlowGraph/Blocks/flowGraphBlockFactory.js +198 -172
  90. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  91. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js +2 -5
  92. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js.map +1 -1
  93. package/FrameGraph/frameGraph.js +10 -1
  94. package/FrameGraph/frameGraph.js.map +1 -1
  95. package/Gamepads/gamepadManager.d.ts +1 -0
  96. package/Gamepads/gamepadManager.js +5 -2
  97. package/Gamepads/gamepadManager.js.map +1 -1
  98. package/Gizmos/scaleGizmo.js +1 -0
  99. package/Gizmos/scaleGizmo.js.map +1 -1
  100. package/Lights/IES/iesLoader.js +6 -8
  101. package/Lights/IES/iesLoader.js.map +1 -1
  102. package/Lights/Shadows/cascadedShadowGenerator.pure.js +4 -6
  103. package/Lights/Shadows/cascadedShadowGenerator.pure.js.map +1 -1
  104. package/Lights/Shadows/shadowGenerator.js +2 -2
  105. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  106. package/Lights/light.js +3 -5
  107. package/Lights/light.js.map +1 -1
  108. package/Lights/spotLight.pure.js +1 -1
  109. package/Lights/spotLight.pure.js.map +1 -1
  110. package/Materials/Background/backgroundMaterial.pure.d.ts +1 -1
  111. package/Materials/Background/backgroundMaterial.pure.js +3 -12
  112. package/Materials/Background/backgroundMaterial.pure.js.map +1 -1
  113. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +2 -0
  114. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
  115. package/Materials/Node/Blocks/Fragment/TBNBlock.pure.js +1 -1
  116. package/Materials/Node/Blocks/Fragment/TBNBlock.pure.js.map +1 -1
  117. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js +2 -0
  118. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js.map +1 -1
  119. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +1 -0
  120. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
  121. package/Materials/Node/Blocks/powBlock.pure.js +2 -1
  122. package/Materials/Node/Blocks/powBlock.pure.js.map +1 -1
  123. package/Materials/Node/Blocks/triPlanarBlock.pure.js +14 -12
  124. package/Materials/Node/Blocks/triPlanarBlock.pure.js.map +1 -1
  125. package/Materials/Node/nodeMaterial.pure.d.ts +1 -0
  126. package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
  127. package/Materials/PBR/openpbrMaterial.pure.d.ts +2 -1
  128. package/Materials/PBR/openpbrMaterial.pure.js +3 -12
  129. package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
  130. package/Materials/PBR/pbrBaseMaterial.pure.d.ts +2 -1
  131. package/Materials/PBR/pbrBaseMaterial.pure.js +3 -12
  132. package/Materials/PBR/pbrBaseMaterial.pure.js.map +1 -1
  133. package/Materials/Textures/index.d.ts +1 -0
  134. package/Materials/Textures/index.js +1 -0
  135. package/Materials/Textures/index.js.map +1 -1
  136. package/Materials/Textures/renderTargetTexture.pure.js +1 -1
  137. package/Materials/Textures/renderTargetTexture.pure.js.map +1 -1
  138. package/Materials/drawWrapper.js +3 -0
  139. package/Materials/drawWrapper.js.map +1 -1
  140. package/Materials/imageProcessingConfiguration.defines.d.ts +3 -0
  141. package/Materials/imageProcessingConfiguration.defines.js +2 -0
  142. package/Materials/imageProcessingConfiguration.defines.js.map +1 -1
  143. package/Materials/imageProcessingConfiguration.functions.js +3 -0
  144. package/Materials/imageProcessingConfiguration.functions.js.map +1 -1
  145. package/Materials/imageProcessingConfiguration.pure.d.ts +58 -0
  146. package/Materials/imageProcessingConfiguration.pure.js +123 -2
  147. package/Materials/imageProcessingConfiguration.pure.js.map +1 -1
  148. package/Materials/material.pure.js +2 -2
  149. package/Materials/material.pure.js.map +1 -1
  150. package/Materials/standardMaterial.pure.d.ts +2 -1
  151. package/Materials/standardMaterial.pure.js +4 -13
  152. package/Materials/standardMaterial.pure.js.map +1 -1
  153. package/Materials/uniformBuffer.d.ts +29 -0
  154. package/Materials/uniformBuffer.js +146 -0
  155. package/Materials/uniformBuffer.js.map +1 -1
  156. package/Maths/colorTemperature.functions.d.ts +29 -0
  157. package/Maths/colorTemperature.functions.js +196 -0
  158. package/Maths/colorTemperature.functions.js.map +1 -0
  159. package/Maths/index.d.ts +1 -0
  160. package/Maths/index.js +1 -0
  161. package/Maths/index.js.map +1 -1
  162. package/Maths/math.path.js +1 -1
  163. package/Maths/math.path.js.map +1 -1
  164. package/Maths/math.polar.js +1 -1
  165. package/Maths/math.polar.js.map +1 -1
  166. package/Maths/math.vector.pure.js +4 -3
  167. package/Maths/math.vector.pure.js.map +1 -1
  168. package/Maths/pure.d.ts +1 -0
  169. package/Maths/pure.js +1 -0
  170. package/Maths/pure.js.map +1 -1
  171. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +72 -0
  172. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +164 -1
  173. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  174. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +2 -1
  175. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +36 -18
  176. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  177. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +5 -4
  178. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +25 -8
  179. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
  180. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +3 -3
  181. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
  182. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js +1 -1
  183. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js.map +1 -1
  184. package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js +2 -2
  185. package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js.map +1 -1
  186. package/Meshes/Node/Blocks/mappingBlock.pure.js +2 -2
  187. package/Meshes/Node/Blocks/mappingBlock.pure.js.map +1 -1
  188. package/Meshes/csg.js +5 -5
  189. package/Meshes/csg.js.map +1 -1
  190. package/Meshes/groundMesh.pure.js +1 -1
  191. package/Meshes/groundMesh.pure.js.map +1 -1
  192. package/Meshes/mesh.pure.js +2 -2
  193. package/Meshes/mesh.pure.js.map +1 -1
  194. package/Misc/deepMerger.js +1 -1
  195. package/Misc/deepMerger.js.map +1 -1
  196. package/Misc/dumpTools.pure.js +1 -1
  197. package/Misc/dumpTools.pure.js.map +1 -1
  198. package/Misc/index.d.ts +1 -0
  199. package/Misc/index.js +1 -0
  200. package/Misc/index.js.map +1 -1
  201. package/Misc/observable.pure.js +1 -3
  202. package/Misc/observable.pure.js.map +1 -1
  203. package/Misc/pure.d.ts +1 -0
  204. package/Misc/pure.js +1 -0
  205. package/Misc/pure.js.map +1 -1
  206. package/Misc/shaderImportLoader.d.ts +25 -0
  207. package/Misc/shaderImportLoader.js +54 -0
  208. package/Misc/shaderImportLoader.js.map +1 -0
  209. package/Misc/tools.pure.js +1 -1
  210. package/Misc/tools.pure.js.map +1 -1
  211. package/Particles/Node/Blocks/particleClampBlock.pure.d.ts +0 -1
  212. package/Particles/Node/Blocks/particleClampBlock.pure.js +1 -6
  213. package/Particles/Node/Blocks/particleClampBlock.pure.js.map +1 -1
  214. package/Particles/Node/Blocks/particleMathBlock.pure.js +1 -1
  215. package/Particles/Node/Blocks/particleMathBlock.pure.js.map +1 -1
  216. package/Particles/Node/Blocks/particleNLerpBlock.pure.js +8 -3
  217. package/Particles/Node/Blocks/particleNLerpBlock.pure.js.map +1 -1
  218. package/Particles/Node/Blocks/particleSmoothStepBlock.pure.js +3 -2
  219. package/Particles/Node/Blocks/particleSmoothStepBlock.pure.js.map +1 -1
  220. package/Particles/Node/Blocks/particleStepBlock.pure.js +3 -2
  221. package/Particles/Node/Blocks/particleStepBlock.pure.js.map +1 -1
  222. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js +1 -1
  223. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js.map +1 -1
  224. package/PostProcesses/depthOfFieldEffect.js +1 -1
  225. package/PostProcesses/depthOfFieldEffect.js.map +1 -1
  226. package/PostProcesses/imageProcessingPostProcess.d.ts +41 -1
  227. package/PostProcesses/imageProcessingPostProcess.js +41 -1
  228. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  229. package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js +1 -1
  230. package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js.map +1 -1
  231. package/PostProcesses/sharpenPostProcess.pure.js +1 -1
  232. package/PostProcesses/sharpenPostProcess.pure.js.map +1 -1
  233. package/PostProcesses/thinImageProcessingPostProcess.d.ts +50 -0
  234. package/PostProcesses/thinImageProcessingPostProcess.js +65 -0
  235. package/PostProcesses/thinImageProcessingPostProcess.js.map +1 -1
  236. package/Rendering/IBLShadows/iblShadowsMaterialCompatibility.pure.d.ts +12 -0
  237. package/Rendering/IBLShadows/iblShadowsMaterialCompatibility.pure.js +22 -0
  238. package/Rendering/IBLShadows/iblShadowsMaterialCompatibility.pure.js.map +1 -0
  239. package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.d.ts +1 -0
  240. package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js +39 -0
  241. package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js.map +1 -1
  242. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.d.ts +12 -0
  243. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +17 -5
  244. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
  245. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.d.ts +14 -0
  246. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +122 -6
  247. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
  248. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.d.ts +7 -0
  249. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +17 -0
  250. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
  251. package/Rendering/IBLShadows/pure.d.ts +1 -0
  252. package/Rendering/IBLShadows/pure.js +1 -0
  253. package/Rendering/IBLShadows/pure.js.map +1 -1
  254. package/Rendering/boundingBoxRenderer.pure.js +3 -3
  255. package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
  256. package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +11 -0
  257. package/Rendering/fluidRenderer/fluidRenderingObject.js +36 -14
  258. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  259. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.d.ts +5 -0
  260. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +16 -3
  261. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
  262. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +5 -0
  263. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +12 -0
  264. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
  265. package/Rendering/iblCdfGenerator.js +10 -1
  266. package/Rendering/iblCdfGenerator.js.map +1 -1
  267. package/Rendering/outlineRenderer.pure.js +1 -0
  268. package/Rendering/outlineRenderer.pure.js.map +1 -1
  269. package/Rendering/subSurfaceConfiguration.js +1 -1
  270. package/Rendering/subSurfaceConfiguration.js.map +1 -1
  271. package/Rendering/subSurfaceSceneComponent.pure.d.ts +1 -1
  272. package/Rendering/subSurfaceSceneComponent.pure.js +1 -1
  273. package/Rendering/subSurfaceSceneComponent.pure.js.map +1 -1
  274. package/Rendering/utilityLayerRenderer.js +1 -1
  275. package/Rendering/utilityLayerRenderer.js.map +1 -1
  276. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +1 -1
  277. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  278. package/Shaders/ShadersInclude/helperFunctions.js +2 -2
  279. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  280. package/Shaders/ShadersInclude/imageProcessingDeclaration.js +3 -0
  281. package/Shaders/ShadersInclude/imageProcessingDeclaration.js.map +1 -1
  282. package/Shaders/ShadersInclude/imageProcessingFunctions.js +3 -0
  283. package/Shaders/ShadersInclude/imageProcessingFunctions.js.map +1 -1
  284. package/Shaders/ShadersInclude/openpbrDirectLighting.js +34 -4
  285. package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  286. package/Shaders/ShadersInclude/openpbrIblFunctions.js +8 -2
  287. package/Shaders/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  288. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +5 -0
  289. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  290. package/Shaders/fluidRenderingParticleDepth.vertex.js +7 -1
  291. package/Shaders/fluidRenderingParticleDepth.vertex.js.map +1 -1
  292. package/Shaders/fluidRenderingParticleDiffuse.vertex.js +7 -1
  293. package/Shaders/fluidRenderingParticleDiffuse.vertex.js.map +1 -1
  294. package/Shaders/fluidRenderingParticleThickness.vertex.js +7 -1
  295. package/Shaders/fluidRenderingParticleThickness.vertex.js.map +1 -1
  296. package/Shaders/gaussianSplattingVoxel.fragment.js +4 -10
  297. package/Shaders/gaussianSplattingVoxel.fragment.js.map +1 -1
  298. package/Shaders/iblCombineVoxelGrids.fragment.js +1 -1
  299. package/Shaders/iblCombineVoxelGrids.fragment.js.map +1 -1
  300. package/Shaders/iblShadowVoxelTracing.fragment.js +24 -7
  301. package/Shaders/iblShadowVoxelTracing.fragment.js.map +1 -1
  302. package/ShadersWGSL/ShadersInclude/iblVoxelOpacityAtomicMax.d.ts +5 -0
  303. package/ShadersWGSL/ShadersInclude/iblVoxelOpacityAtomicMax.js +13 -0
  304. package/ShadersWGSL/ShadersInclude/iblVoxelOpacityAtomicMax.js.map +1 -0
  305. package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js +3 -0
  306. package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js.map +1 -1
  307. package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js +3 -0
  308. package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js.map +1 -1
  309. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +35 -5
  310. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  311. package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js +1 -1
  312. package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js.map +1 -1
  313. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +8 -2
  314. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  315. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +5 -0
  316. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  317. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js +16 -4
  318. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js.map +1 -1
  319. package/ShadersWGSL/fluidRenderingParticleDiffuse.vertex.js +15 -3
  320. package/ShadersWGSL/fluidRenderingParticleDiffuse.vertex.js.map +1 -1
  321. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js +15 -3
  322. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js.map +1 -1
  323. package/ShadersWGSL/gaussianSplattingVoxel.fragment.js +15 -9
  324. package/ShadersWGSL/gaussianSplattingVoxel.fragment.js.map +1 -1
  325. package/ShadersWGSL/iblCombineVoxelGrids.fragment.js +1 -1
  326. package/ShadersWGSL/iblCombineVoxelGrids.fragment.js.map +1 -1
  327. package/ShadersWGSL/iblCopyVoxelBufferToGrid.compute.d.ts +5 -0
  328. package/ShadersWGSL/iblCopyVoxelBufferToGrid.compute.js +14 -0
  329. package/ShadersWGSL/iblCopyVoxelBufferToGrid.compute.js.map +1 -0
  330. package/ShadersWGSL/iblShadowVoxelTracing.fragment.js +24 -7
  331. package/ShadersWGSL/iblShadowVoxelTracing.fragment.js.map +1 -1
  332. package/ShadersWGSL/iblVoxelGrid.fragment.js +26 -6
  333. package/ShadersWGSL/iblVoxelGrid.fragment.js.map +1 -1
  334. package/SmartAssets/smartAssetManager.pure.js +1 -1
  335. package/SmartAssets/smartAssetManager.pure.js.map +1 -1
  336. package/Sprites/thinSprite.js +1 -1
  337. package/Sprites/thinSprite.js.map +1 -1
  338. package/XR/features/Layers/WebXRCompositionLayer.d.ts +182 -12
  339. package/XR/features/Layers/WebXRCompositionLayer.js +272 -3
  340. package/XR/features/Layers/WebXRCompositionLayer.js.map +1 -1
  341. package/XR/features/Layers/WebXRFallbackLayer.d.ts +84 -0
  342. package/XR/features/Layers/WebXRFallbackLayer.js +137 -0
  343. package/XR/features/Layers/WebXRFallbackLayer.js.map +1 -0
  344. package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +4 -4
  345. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
  346. package/XR/features/WebXRAnchorSystem.pure.d.ts +45 -0
  347. package/XR/features/WebXRAnchorSystem.pure.js +153 -13
  348. package/XR/features/WebXRAnchorSystem.pure.js.map +1 -1
  349. package/XR/features/WebXRControllerPointerSelection.pure.js +2 -1
  350. package/XR/features/WebXRControllerPointerSelection.pure.js.map +1 -1
  351. package/XR/features/WebXRControllerTeleportation.pure.js +2 -1
  352. package/XR/features/WebXRControllerTeleportation.pure.js.map +1 -1
  353. package/XR/features/WebXRDepthSensing.pure.d.ts +21 -0
  354. package/XR/features/WebXRDepthSensing.pure.js +42 -0
  355. package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
  356. package/XR/features/WebXRHandTracking.pure.js +2 -0
  357. package/XR/features/WebXRHandTracking.pure.js.map +1 -1
  358. package/XR/features/WebXRLayers.pure.d.ts +183 -8
  359. package/XR/features/WebXRLayers.pure.js +531 -99
  360. package/XR/features/WebXRLayers.pure.js.map +1 -1
  361. package/XR/features/WebXRLayersFallback.d.ts +5 -0
  362. package/XR/features/WebXRLayersFallback.js +8 -0
  363. package/XR/features/WebXRLayersFallback.js.map +1 -0
  364. package/XR/features/WebXRLayersFallback.pure.d.ts +6 -0
  365. package/XR/features/WebXRLayersFallback.pure.js +44 -0
  366. package/XR/features/WebXRLayersFallback.pure.js.map +1 -0
  367. package/XR/features/WebXRLightEstimation.pure.d.ts +3 -4
  368. package/XR/features/WebXRLightEstimation.pure.js +22 -21
  369. package/XR/features/WebXRLightEstimation.pure.js.map +1 -1
  370. package/XR/features/WebXRMeshDetector.pure.d.ts +5 -0
  371. package/XR/features/WebXRMeshDetector.pure.js +1 -0
  372. package/XR/features/WebXRMeshDetector.pure.js.map +1 -1
  373. package/XR/features/WebXRNearInteraction.pure.js +3 -3
  374. package/XR/features/WebXRNearInteraction.pure.js.map +1 -1
  375. package/XR/features/WebXRPlaneDetector.pure.d.ts +9 -5
  376. package/XR/features/WebXRPlaneDetector.pure.js +12 -8
  377. package/XR/features/WebXRPlaneDetector.pure.js.map +1 -1
  378. package/XR/features/WebXRTrackedSources.d.ts +5 -0
  379. package/XR/features/WebXRTrackedSources.js +8 -0
  380. package/XR/features/WebXRTrackedSources.js.map +1 -0
  381. package/XR/features/WebXRTrackedSources.pure.d.ts +70 -0
  382. package/XR/features/WebXRTrackedSources.pure.js +153 -0
  383. package/XR/features/WebXRTrackedSources.pure.js.map +1 -0
  384. package/XR/features/index.d.ts +1 -0
  385. package/XR/features/index.js +1 -0
  386. package/XR/features/index.js.map +1 -1
  387. package/XR/features/pure.d.ts +2 -0
  388. package/XR/features/pure.js +2 -0
  389. package/XR/features/pure.js.map +1 -1
  390. package/XR/motionController/webXRAbstractMotionController.d.ts +53 -1
  391. package/XR/motionController/webXRAbstractMotionController.js +61 -0
  392. package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
  393. package/XR/webXRCamera.d.ts +2 -0
  394. package/XR/webXRCamera.js +8 -2
  395. package/XR/webXRCamera.js.map +1 -1
  396. package/XR/webXRDefaultExperience.js +8 -4
  397. package/XR/webXRDefaultExperience.js.map +1 -1
  398. package/XR/webXRExperienceHelper.js +86 -44
  399. package/XR/webXRExperienceHelper.js.map +1 -1
  400. package/XR/webXRFeaturesManager.d.ts +9 -0
  401. package/XR/webXRFeaturesManager.js +4 -0
  402. package/XR/webXRFeaturesManager.js.map +1 -1
  403. package/XR/webXRGraphicsBinding.d.ts +29 -0
  404. package/XR/webXRGraphicsBinding.js +40 -0
  405. package/XR/webXRGraphicsBinding.js.map +1 -1
  406. package/XR/webXRInputSource.js +1 -1
  407. package/XR/webXRInputSource.js.map +1 -1
  408. package/XR/webXRLayerWrapper.d.ts +26 -10
  409. package/XR/webXRLayerWrapper.js +19 -7
  410. package/XR/webXRLayerWrapper.js.map +1 -1
  411. package/XR/webXRRenderTargetTextureProvider.d.ts +4 -4
  412. package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
  413. package/XR/webXRSessionManager.d.ts +45 -0
  414. package/XR/webXRSessionManager.js +174 -29
  415. package/XR/webXRSessionManager.js.map +1 -1
  416. package/XR/webXRWebGLRenderTargetTextureProvider.d.ts +2 -1
  417. package/XR/webXRWebGLRenderTargetTextureProvider.js.map +1 -1
  418. package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +3 -3
  419. package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
  420. package/package.json +1 -1
  421. package/scene.pure.d.ts +5 -0
  422. package/scene.pure.js +25 -0
  423. package/scene.pure.js.map +1 -1
@@ -18,6 +18,7 @@ export declare class GaussianSplattingPartProxyMesh extends Mesh {
18
18
  */
19
19
  private _minimum;
20
20
  private _maximum;
21
+ private _disabledVisibility;
21
22
  /**
22
23
  * The index of the part in the compound mesh (internal storage)
23
24
  */
@@ -111,19 +112,19 @@ export declare class GaussianSplattingPartProxyMesh extends Mesh {
111
112
  */
112
113
  updatePartMetadata(vertexCount: number, splatsDataOffset: number, shDataOffset?: number): void;
113
114
  /**
114
- * Gets whether the part is visible
115
+ * Gets whether the part should be visible when this proxy is enabled
115
116
  */
116
117
  get isVisible(): boolean;
117
118
  /**
118
- * Sets whether the part is visible
119
+ * Sets whether the part should be visible when this proxy is enabled
119
120
  */
120
121
  set isVisible(value: boolean);
121
122
  /**
122
- * Gets the visibility of the part (0.0 to 1.0)
123
+ * Gets the visibility applied to the part while this proxy is enabled (0.0 to 1.0)
123
124
  */
124
125
  get visibility(): number;
125
126
  /**
126
- * Sets the visibility of the part (0.0 to 1.0)
127
+ * Sets the visibility to apply to the part while this proxy is enabled (0.0 to 1.0)
127
128
  */
128
129
  set visibility(value: number);
129
130
  /**
@@ -33,6 +33,7 @@ export class GaussianSplattingPartProxyMesh extends Mesh {
33
33
  */
34
34
  constructor(name, scene, compoundSplatMesh, partIndex, boundingInfo, vertexCount, splatsDataOffset, shDataOffset = splatsDataOffset) {
35
35
  super(name, scene);
36
+ this._disabledVisibility = null;
36
37
  this._partIndex = partIndex;
37
38
  this._vertexCount = vertexCount;
38
39
  this._splatsDataOffset = splatsDataOffset;
@@ -46,6 +47,16 @@ export class GaussianSplattingPartProxyMesh extends Mesh {
46
47
  this.onAfterWorldMatrixUpdateObservable.add(() => {
47
48
  this.compoundSplatMesh.setWorldMatrixForPart(this.partIndex, this.getWorldMatrix());
48
49
  });
50
+ this.onEffectiveEnabledStateChangedObservable.add((isEnabled) => {
51
+ if (isEnabled) {
52
+ this.compoundSplatMesh.setPartVisibility(this.partIndex, this._disabledVisibility ?? this.compoundSplatMesh.getPartVisibility(this.partIndex));
53
+ this._disabledVisibility = null;
54
+ }
55
+ else {
56
+ this._disabledVisibility = this.compoundSplatMesh.getPartVisibility(this.partIndex);
57
+ this.compoundSplatMesh.setPartVisibility(this.partIndex, 0);
58
+ }
59
+ });
49
60
  }
50
61
  /**
51
62
  * Updates the bounding info of this proxy mesh from its stored part metadata.
@@ -116,28 +127,34 @@ export class GaussianSplattingPartProxyMesh extends Mesh {
116
127
  this._shDataOffset = shDataOffset;
117
128
  }
118
129
  /**
119
- * Gets whether the part is visible
130
+ * Gets whether the part should be visible when this proxy is enabled
120
131
  */
121
132
  get isVisible() {
122
- return this.compoundSplatMesh.getPartVisibility(this.partIndex) > 0;
133
+ return this.visibility > 0;
123
134
  }
124
135
  /**
125
- * Sets whether the part is visible
136
+ * Sets whether the part should be visible when this proxy is enabled
126
137
  */
127
138
  set isVisible(value) {
128
- this.compoundSplatMesh.setPartVisibility(this.partIndex, value ? 1.0 : 0.0);
139
+ this.visibility = value ? 1.0 : 0.0;
129
140
  }
130
141
  /**
131
- * Gets the visibility of the part (0.0 to 1.0)
142
+ * Gets the visibility applied to the part while this proxy is enabled (0.0 to 1.0)
132
143
  */
133
144
  get visibility() {
134
- return this.compoundSplatMesh.getPartVisibility(this.partIndex);
145
+ return this._disabledVisibility ?? this.compoundSplatMesh.getPartVisibility(this.partIndex);
135
146
  }
136
147
  /**
137
- * Sets the visibility of the part (0.0 to 1.0)
148
+ * Sets the visibility to apply to the part while this proxy is enabled (0.0 to 1.0)
138
149
  */
139
150
  set visibility(value) {
140
- this.compoundSplatMesh.setPartVisibility(this.partIndex, value);
151
+ const visibility = Math.max(0.0, Math.min(1.0, value));
152
+ if (this.isEnabled()) {
153
+ this.compoundSplatMesh.setPartVisibility(this.partIndex, visibility);
154
+ }
155
+ else {
156
+ this._disabledVisibility = visibility;
157
+ }
141
158
  }
142
159
  /**
143
160
  * Checks if a ray intersects with this proxy mesh using only bounding info
@@ -1 +1 @@
1
- {"version":3,"file":"gaussianSplattingPartProxyM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;GAGG;AACH,MAAM,UAAU,sCAAsC;IAClD,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,IAAI,CAAC,qCAAqC,GAAG,8BAA8B,CAAC,KAAK,CAAC;AACtF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type Nullable } from \"core/types\";\r\nimport { type Scene } from \"core/scene.pure\";\r\nimport { type AbstractMesh } from \"../abstractMesh.pure\";\r\nimport { Mesh } from \"../mesh.pure\";\r\nimport { BoundingInfo } from \"../../Culling/boundingInfo\";\r\nimport { type GaussianSplattingMesh } from \"./gaussianSplattingMesh.pure\";\r\nimport { type Ray } from \"../../Culling/ray.core\";\r\nimport { PickingInfo } from \"../../Collisions/pickingInfo\";\r\nimport { Vector3 } from \"../../Maths/math.vector.pure\";\r\n\r\n/**\r\n * Class used as a proxy mesh for a part of a compound Gaussian Splatting mesh\r\n */\r\nexport class GaussianSplattingPartProxyMesh extends Mesh {\r\n /**\r\n * Local-space bounds for this part, stored directly on the proxy so it does not\r\n * need to retain a reference to the original source mesh.\r\n */\r\n private _minimum: Vector3;\r\n private _maximum: Vector3;\r\n\r\n /**\r\n * The index of the part in the compound mesh (internal storage)\r\n */\r\n private _partIndex: number;\r\n\r\n /**\r\n * Number of splats owned by this part.\r\n * @internal\r\n */\r\n public _vertexCount: number;\r\n\r\n /**\r\n * Offset of this part in the compound splat ordering.\r\n * @internal\r\n */\r\n public _splatsDataOffset: number;\r\n\r\n /**\r\n * Texel offset of this part inside the compound SH textures.\r\n * This matches the splat offset because SH data is stored one texel per splat.\r\n * @internal\r\n */\r\n public _shDataOffset: number;\r\n\r\n /**\r\n * Gets the index of the part in the compound mesh\r\n */\r\n public get partIndex(): number {\r\n return this._partIndex;\r\n }\r\n\r\n /**\r\n * The compound mesh that owns this part proxy\r\n */\r\n public readonly compoundSplatMesh: GaussianSplattingMesh;\r\n\r\n /**\r\n * Backward-compatible alias for the owning compound mesh.\r\n * @deprecated Use `compoundSplatMesh` instead.\r\n */\r\n public get proxiedMesh(): GaussianSplattingMesh {\r\n return this.compoundSplatMesh;\r\n }\r\n\r\n /**\r\n * Creates a new Gaussian Splatting part proxy mesh\r\n * @param name The name of the proxy mesh\r\n * @param scene The scene the proxy mesh belongs to\r\n * @param compoundSplatMesh The compound mesh that owns this part proxy\r\n * @param partIndex The index of the part in the compound mesh\r\n * @param boundingInfo Local-space bounds of the part inside the compound mesh\r\n * @param vertexCount Number of splats owned by the part\r\n * @param splatsDataOffset Offset of the part in the compound splat ordering\r\n * @param shDataOffset Offset of the part in the compound SH textures\r\n */\r\n constructor(\r\n name: string,\r\n scene: Nullable<Scene>,\r\n compoundSplatMesh: GaussianSplattingMesh,\r\n partIndex: number,\r\n boundingInfo: BoundingInfo,\r\n vertexCount: number,\r\n splatsDataOffset: number,\r\n shDataOffset: number = splatsDataOffset\r\n ) {\r\n super(name, scene);\r\n this._partIndex = partIndex;\r\n this._vertexCount = vertexCount;\r\n this._splatsDataOffset = splatsDataOffset;\r\n this._shDataOffset = shDataOffset;\r\n this._minimum = boundingInfo.minimum.clone();\r\n this._maximum = boundingInfo.maximum.clone();\r\n this.compoundSplatMesh = compoundSplatMesh;\r\n\r\n this._applyBoundingInfo();\r\n this.compoundSplatMesh.setWorldMatrixForPart(this.partIndex, this.getWorldMatrix());\r\n\r\n // Update the compound mesh's part matrix when this proxy's world matrix changes.\r\n this.onAfterWorldMatrixUpdateObservable.add(() => {\r\n this.compoundSplatMesh.setWorldMatrixForPart(this.partIndex, this.getWorldMatrix());\r\n });\r\n }\r\n\r\n /**\r\n * Updates the bounding info of this proxy mesh from its stored part metadata.\r\n */\r\n public updateBoundingInfoFromPartData(): void {\r\n this._applyBoundingInfo();\r\n }\r\n\r\n /**\r\n * Backward-compatible alias retained while callers move away from source-mesh based semantics.\r\n */\r\n public updateBoundingInfoFromProxiedMesh(): void {\r\n this.updateBoundingInfoFromPartData();\r\n }\r\n\r\n private _applyBoundingInfo(): void {\r\n this.setBoundingInfo(new BoundingInfo(this._minimum.clone(), this._maximum.clone()));\r\n }\r\n\r\n /**\r\n * Returns the class name\r\n * @returns \"GaussianSplattingPartProxyMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GaussianSplattingPartProxyMesh\";\r\n }\r\n\r\n /**\r\n * Returns the world-space bounding vectors spanning this part (and any descendants).\r\n *\r\n * A part proxy carries real bounds (set via {@link setBoundingInfo}) but owns NO geometry — the compound\r\n * holds the splats. The base {@link Node.getHierarchyBoundingVectors} only folds in a mesh's own bounds\r\n * when it has a `subMeshes` array (a geometry-less mesh's is `undefined`) and skips zero-vertex descendants,\r\n * so for a bare proxy it returns a degenerate ±MAX_VALUE box. Callers that treat the proxy as a normal mesh\r\n * (camera framing, grounding, picking) would then derive NaN / astronomically large offsets. This override\r\n * folds the proxy's own world-space box into whatever the base returns for descendants.\r\n * @param includeDescendants include bounding vectors from descendant meshes\r\n * @param predicate optional filter applied to each descendant mesh\r\n * @returns the world-space min/max spanning this part (and any descendants)\r\n */\r\n public override getHierarchyBoundingVectors(\r\n includeDescendants: boolean = true,\r\n predicate: Nullable<(abstractMesh: AbstractMesh) => boolean> = null\r\n ): { min: Vector3; max: Vector3 } {\r\n // Base recomputes this proxy's world matrix but skips its (geometry-less) own bounds.\r\n const result = super.getHierarchyBoundingVectors(includeDescendants, predicate);\r\n // Refresh the world-space corners against the just-computed world matrix, then extend the result:\r\n // CheckExtends turns the base's ±MAX_VALUE sentinel seed into this part's real box.\r\n const info = this.getBoundingInfo();\r\n info.update(this.getWorldMatrix());\r\n Vector3.CheckExtends(info.boundingBox.minimumWorld, result.min, result.max);\r\n Vector3.CheckExtends(info.boundingBox.maximumWorld, result.min, result.max);\r\n return result;\r\n }\r\n\r\n /**\r\n * Updates the part index for this proxy mesh.\r\n * This should only be called internally when parts are removed from the compound mesh.\r\n * @param newPartIndex the new part index\r\n * @internal\r\n */\r\n public updatePartIndex(newPartIndex: number): void {\r\n this._partIndex = newPartIndex;\r\n }\r\n\r\n /**\r\n * Updates the per-part metadata for this proxy mesh.\r\n * This is used internally when compound parts are rebuilt and re-indexed.\r\n * @param vertexCount the number of splats owned by the part\r\n * @param splatsDataOffset the new splat offset in the compound\r\n * @param shDataOffset the new SH texel offset in the compound\r\n * @internal\r\n */\r\n public updatePartMetadata(vertexCount: number, splatsDataOffset: number, shDataOffset: number = splatsDataOffset): void {\r\n this._vertexCount = vertexCount;\r\n this._splatsDataOffset = splatsDataOffset;\r\n this._shDataOffset = shDataOffset;\r\n }\r\n\r\n /**\r\n * Gets whether the part is visible\r\n */\r\n public override get isVisible(): boolean {\r\n return this.compoundSplatMesh.getPartVisibility(this.partIndex) > 0;\r\n }\r\n\r\n /**\r\n * Sets whether the part is visible\r\n */\r\n public override set isVisible(value: boolean) {\r\n this.compoundSplatMesh.setPartVisibility(this.partIndex, value ? 1.0 : 0.0);\r\n }\r\n\r\n /**\r\n * Gets the visibility of the part (0.0 to 1.0)\r\n */\r\n public override get visibility(): number {\r\n return this.compoundSplatMesh.getPartVisibility(this.partIndex);\r\n }\r\n\r\n /**\r\n * Sets the visibility of the part (0.0 to 1.0)\r\n */\r\n public override set visibility(value: number) {\r\n this.compoundSplatMesh.setPartVisibility(this.partIndex, value);\r\n }\r\n\r\n /**\r\n * Checks if a ray intersects with this proxy mesh using only bounding info\r\n * @param ray defines the ray to test\r\n * @returns the picking info with this mesh set as pickedMesh if hit\r\n */\r\n public override intersects(ray: Ray): PickingInfo {\r\n const pickingInfo = new PickingInfo();\r\n const boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n return pickingInfo;\r\n }\r\n\r\n // Always check against bounding info for proxy meshes\r\n if (!ray.intersectsSphere(boundingInfo.boundingSphere) || !ray.intersectsBox(boundingInfo.boundingBox)) {\r\n return pickingInfo;\r\n }\r\n\r\n // If we hit the bounding volume, report this mesh as picked\r\n pickingInfo.hit = true;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.distance = Vector3.Distance(ray.origin, boundingInfo.boundingSphere.center);\r\n pickingInfo.subMeshId = 0;\r\n\r\n return pickingInfo;\r\n }\r\n\r\n /**\r\n * Serialize current GaussianSplattingPartProxyMesh\r\n * @param serializationObject defines the object which will receive the serialization data\r\n * @returns the serialized object\r\n */\r\n public override serialize(serializationObject: any = {}): any {\r\n serializationObject = super.serialize(serializationObject);\r\n // GaussianSplattingPartProxyMesh needs no SubMesh, Geometry, or Material\r\n serializationObject.subMeshes = [];\r\n serializationObject.geometryUniqueId = undefined;\r\n serializationObject.geometryId = undefined;\r\n serializationObject.materialUniqueId = undefined;\r\n serializationObject.materialId = undefined;\r\n serializationObject.instances = [];\r\n serializationObject.actions = undefined;\r\n serializationObject.type = this.getClassName();\r\n serializationObject.compoundSplatMeshId = this.compoundSplatMesh.id;\r\n // Part metadata is needed to reconnect the proxy to the correct compound segment.\r\n serializationObject.partIndex = this._partIndex;\r\n serializationObject.vertexCount = this._vertexCount;\r\n serializationObject.splatsDataOffset = this._splatsDataOffset;\r\n serializationObject.shDataOffset = this._shDataOffset;\r\n const boundingInfo = this.getBoundingInfo();\r\n serializationObject.boundingInfo = {\r\n minimum: boundingInfo.minimum.asArray(),\r\n maximum: boundingInfo.maximum.asArray(),\r\n };\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized GaussianSplattingPartProxyMesh\r\n * @param parsedMesh the serialized mesh\r\n * @param scene the scene to create the GaussianSplattingPartProxyMesh in\r\n * @returns the created GaussianSplattingPartProxyMesh\r\n */\r\n public static override Parse(parsedMesh: any, scene: Scene): GaussianSplattingPartProxyMesh {\r\n const partIndex = parsedMesh.partIndex;\r\n const compoundSplatMesh =\r\n (parsedMesh.compoundSplatMesh as GaussianSplattingMesh | undefined) ?? (scene.getLastMeshById(parsedMesh.compoundSplatMeshId) as GaussianSplattingMesh | null);\r\n if (!compoundSplatMesh) {\r\n throw new Error(`GaussianSplattingPartProxyMesh: compound mesh not found with ID ${parsedMesh.compoundSplatMeshId}`);\r\n }\r\n const minimum = Vector3.FromArray(parsedMesh.boundingInfo.minimum);\r\n const maximum = Vector3.FromArray(parsedMesh.boundingInfo.maximum);\r\n const boundingInfo = new BoundingInfo(minimum, maximum);\r\n const vertexCount = parsedMesh.vertexCount ?? 0;\r\n const splatsDataOffset = parsedMesh.splatsDataOffset ?? 0;\r\n const shDataOffset = parsedMesh.shDataOffset ?? splatsDataOffset;\r\n return new GaussianSplattingPartProxyMesh(parsedMesh.name, scene, compoundSplatMesh, partIndex, boundingInfo, vertexCount, splatsDataOffset, shDataOffset);\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for gaussianSplattingPartProxyMesh.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterGaussianSplattingPartProxyMesh(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n Mesh._GaussianSplattingPartProxyMeshParser = GaussianSplattingPartProxyMesh.Parse;\r\n}\r\n"]}
1
+ {"version":3,"file":"gaussianSplattingPartProxyMesh.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAK7D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAEvD;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,IAAI;IAkCpD;;OAEG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAOD;;;OAGG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;IAED;;;;;;;;;;OAUG;IACH,YACI,IAAY,EACZ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B,CAAC;QACjE,OAAO,IAAI,8BAA8B,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;IAC/J,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,sCAAsC;IAClD,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,IAAI,CAAC,qCAAqC,GAAG,8BAA8B,CAAC,KAAK,CAAC;AACtF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type Nullable } from \"core/types\";\r\nimport { type Scene } from \"core/scene.pure\";\r\nimport { type AbstractMesh } from \"../abstractMesh.pure\";\r\nimport { Mesh } from \"../mesh.pure\";\r\nimport { BoundingInfo } from \"../../Culling/boundingInfo\";\r\nimport { type GaussianSplattingMesh } from \"./gaussianSplattingMesh.pure\";\r\nimport { type Ray } from \"../../Culling/ray.core\";\r\nimport { PickingInfo } from \"../../Collisions/pickingInfo\";\r\nimport { Vector3 } from \"../../Maths/math.vector.pure\";\r\n\r\n/**\r\n * Class used as a proxy mesh for a part of a compound Gaussian Splatting mesh\r\n */\r\nexport class GaussianSplattingPartProxyMesh extends Mesh {\r\n /**\r\n * Local-space bounds for this part, stored directly on the proxy so it does not\r\n * need to retain a reference to the original source mesh.\r\n */\r\n private _minimum: Vector3;\r\n private _maximum: Vector3;\r\n\r\n private _disabledVisibility: Nullable<number> = null;\r\n\r\n /**\r\n * The index of the part in the compound mesh (internal storage)\r\n */\r\n private _partIndex: number;\r\n\r\n /**\r\n * Number of splats owned by this part.\r\n * @internal\r\n */\r\n public _vertexCount: number;\r\n\r\n /**\r\n * Offset of this part in the compound splat ordering.\r\n * @internal\r\n */\r\n public _splatsDataOffset: number;\r\n\r\n /**\r\n * Texel offset of this part inside the compound SH textures.\r\n * This matches the splat offset because SH data is stored one texel per splat.\r\n * @internal\r\n */\r\n public _shDataOffset: number;\r\n\r\n /**\r\n * Gets the index of the part in the compound mesh\r\n */\r\n public get partIndex(): number {\r\n return this._partIndex;\r\n }\r\n\r\n /**\r\n * The compound mesh that owns this part proxy\r\n */\r\n public readonly compoundSplatMesh: GaussianSplattingMesh;\r\n\r\n /**\r\n * Backward-compatible alias for the owning compound mesh.\r\n * @deprecated Use `compoundSplatMesh` instead.\r\n */\r\n public get proxiedMesh(): GaussianSplattingMesh {\r\n return this.compoundSplatMesh;\r\n }\r\n\r\n /**\r\n * Creates a new Gaussian Splatting part proxy mesh\r\n * @param name The name of the proxy mesh\r\n * @param scene The scene the proxy mesh belongs to\r\n * @param compoundSplatMesh The compound mesh that owns this part proxy\r\n * @param partIndex The index of the part in the compound mesh\r\n * @param boundingInfo Local-space bounds of the part inside the compound mesh\r\n * @param vertexCount Number of splats owned by the part\r\n * @param splatsDataOffset Offset of the part in the compound splat ordering\r\n * @param shDataOffset Offset of the part in the compound SH textures\r\n */\r\n constructor(\r\n name: string,\r\n scene: Nullable<Scene>,\r\n compoundSplatMesh: GaussianSplattingMesh,\r\n partIndex: number,\r\n boundingInfo: BoundingInfo,\r\n vertexCount: number,\r\n splatsDataOffset: number,\r\n shDataOffset: number = splatsDataOffset\r\n ) {\r\n super(name, scene);\r\n this._partIndex = partIndex;\r\n this._vertexCount = vertexCount;\r\n this._splatsDataOffset = splatsDataOffset;\r\n this._shDataOffset = shDataOffset;\r\n this._minimum = boundingInfo.minimum.clone();\r\n this._maximum = boundingInfo.maximum.clone();\r\n this.compoundSplatMesh = compoundSplatMesh;\r\n\r\n this._applyBoundingInfo();\r\n this.compoundSplatMesh.setWorldMatrixForPart(this.partIndex, this.getWorldMatrix());\r\n\r\n // Update the compound mesh's part matrix when this proxy's world matrix changes.\r\n this.onAfterWorldMatrixUpdateObservable.add(() => {\r\n this.compoundSplatMesh.setWorldMatrixForPart(this.partIndex, this.getWorldMatrix());\r\n });\r\n this.onEffectiveEnabledStateChangedObservable.add((isEnabled) => {\r\n if (isEnabled) {\r\n this.compoundSplatMesh.setPartVisibility(this.partIndex, this._disabledVisibility ?? this.compoundSplatMesh.getPartVisibility(this.partIndex));\r\n this._disabledVisibility = null;\r\n } else {\r\n this._disabledVisibility = this.compoundSplatMesh.getPartVisibility(this.partIndex);\r\n this.compoundSplatMesh.setPartVisibility(this.partIndex, 0);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Updates the bounding info of this proxy mesh from its stored part metadata.\r\n */\r\n public updateBoundingInfoFromPartData(): void {\r\n this._applyBoundingInfo();\r\n }\r\n\r\n /**\r\n * Backward-compatible alias retained while callers move away from source-mesh based semantics.\r\n */\r\n public updateBoundingInfoFromProxiedMesh(): void {\r\n this.updateBoundingInfoFromPartData();\r\n }\r\n\r\n private _applyBoundingInfo(): void {\r\n this.setBoundingInfo(new BoundingInfo(this._minimum.clone(), this._maximum.clone()));\r\n }\r\n\r\n /**\r\n * Returns the class name\r\n * @returns \"GaussianSplattingPartProxyMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GaussianSplattingPartProxyMesh\";\r\n }\r\n\r\n /**\r\n * Returns the world-space bounding vectors spanning this part (and any descendants).\r\n *\r\n * A part proxy carries real bounds (set via {@link setBoundingInfo}) but owns NO geometry — the compound\r\n * holds the splats. The base {@link Node.getHierarchyBoundingVectors} only folds in a mesh's own bounds\r\n * when it has a `subMeshes` array (a geometry-less mesh's is `undefined`) and skips zero-vertex descendants,\r\n * so for a bare proxy it returns a degenerate ±MAX_VALUE box. Callers that treat the proxy as a normal mesh\r\n * (camera framing, grounding, picking) would then derive NaN / astronomically large offsets. This override\r\n * folds the proxy's own world-space box into whatever the base returns for descendants.\r\n * @param includeDescendants include bounding vectors from descendant meshes\r\n * @param predicate optional filter applied to each descendant mesh\r\n * @returns the world-space min/max spanning this part (and any descendants)\r\n */\r\n public override getHierarchyBoundingVectors(\r\n includeDescendants: boolean = true,\r\n predicate: Nullable<(abstractMesh: AbstractMesh) => boolean> = null\r\n ): { min: Vector3; max: Vector3 } {\r\n // Base recomputes this proxy's world matrix but skips its (geometry-less) own bounds.\r\n const result = super.getHierarchyBoundingVectors(includeDescendants, predicate);\r\n // Refresh the world-space corners against the just-computed world matrix, then extend the result:\r\n // CheckExtends turns the base's ±MAX_VALUE sentinel seed into this part's real box.\r\n const info = this.getBoundingInfo();\r\n info.update(this.getWorldMatrix());\r\n Vector3.CheckExtends(info.boundingBox.minimumWorld, result.min, result.max);\r\n Vector3.CheckExtends(info.boundingBox.maximumWorld, result.min, result.max);\r\n return result;\r\n }\r\n\r\n /**\r\n * Updates the part index for this proxy mesh.\r\n * This should only be called internally when parts are removed from the compound mesh.\r\n * @param newPartIndex the new part index\r\n * @internal\r\n */\r\n public updatePartIndex(newPartIndex: number): void {\r\n this._partIndex = newPartIndex;\r\n }\r\n\r\n /**\r\n * Updates the per-part metadata for this proxy mesh.\r\n * This is used internally when compound parts are rebuilt and re-indexed.\r\n * @param vertexCount the number of splats owned by the part\r\n * @param splatsDataOffset the new splat offset in the compound\r\n * @param shDataOffset the new SH texel offset in the compound\r\n * @internal\r\n */\r\n public updatePartMetadata(vertexCount: number, splatsDataOffset: number, shDataOffset: number = splatsDataOffset): void {\r\n this._vertexCount = vertexCount;\r\n this._splatsDataOffset = splatsDataOffset;\r\n this._shDataOffset = shDataOffset;\r\n }\r\n\r\n /**\r\n * Gets whether the part should be visible when this proxy is enabled\r\n */\r\n public override get isVisible(): boolean {\r\n return this.visibility > 0;\r\n }\r\n\r\n /**\r\n * Sets whether the part should be visible when this proxy is enabled\r\n */\r\n public override set isVisible(value: boolean) {\r\n this.visibility = value ? 1.0 : 0.0;\r\n }\r\n\r\n /**\r\n * Gets the visibility applied to the part while this proxy is enabled (0.0 to 1.0)\r\n */\r\n public override get visibility(): number {\r\n return this._disabledVisibility ?? this.compoundSplatMesh.getPartVisibility(this.partIndex);\r\n }\r\n\r\n /**\r\n * Sets the visibility to apply to the part while this proxy is enabled (0.0 to 1.0)\r\n */\r\n public override set visibility(value: number) {\r\n const visibility = Math.max(0.0, Math.min(1.0, value));\r\n if (this.isEnabled()) {\r\n this.compoundSplatMesh.setPartVisibility(this.partIndex, visibility);\r\n } else {\r\n this._disabledVisibility = visibility;\r\n }\r\n }\r\n\r\n /**\r\n * Checks if a ray intersects with this proxy mesh using only bounding info\r\n * @param ray defines the ray to test\r\n * @returns the picking info with this mesh set as pickedMesh if hit\r\n */\r\n public override intersects(ray: Ray): PickingInfo {\r\n const pickingInfo = new PickingInfo();\r\n const boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n return pickingInfo;\r\n }\r\n\r\n // Always check against bounding info for proxy meshes\r\n if (!ray.intersectsSphere(boundingInfo.boundingSphere) || !ray.intersectsBox(boundingInfo.boundingBox)) {\r\n return pickingInfo;\r\n }\r\n\r\n // If we hit the bounding volume, report this mesh as picked\r\n pickingInfo.hit = true;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.distance = Vector3.Distance(ray.origin, boundingInfo.boundingSphere.center);\r\n pickingInfo.subMeshId = 0;\r\n\r\n return pickingInfo;\r\n }\r\n\r\n /**\r\n * Serialize current GaussianSplattingPartProxyMesh\r\n * @param serializationObject defines the object which will receive the serialization data\r\n * @returns the serialized object\r\n */\r\n public override serialize(serializationObject: any = {}): any {\r\n serializationObject = super.serialize(serializationObject);\r\n // GaussianSplattingPartProxyMesh needs no SubMesh, Geometry, or Material\r\n serializationObject.subMeshes = [];\r\n serializationObject.geometryUniqueId = undefined;\r\n serializationObject.geometryId = undefined;\r\n serializationObject.materialUniqueId = undefined;\r\n serializationObject.materialId = undefined;\r\n serializationObject.instances = [];\r\n serializationObject.actions = undefined;\r\n serializationObject.type = this.getClassName();\r\n serializationObject.compoundSplatMeshId = this.compoundSplatMesh.id;\r\n // Part metadata is needed to reconnect the proxy to the correct compound segment.\r\n serializationObject.partIndex = this._partIndex;\r\n serializationObject.vertexCount = this._vertexCount;\r\n serializationObject.splatsDataOffset = this._splatsDataOffset;\r\n serializationObject.shDataOffset = this._shDataOffset;\r\n const boundingInfo = this.getBoundingInfo();\r\n serializationObject.boundingInfo = {\r\n minimum: boundingInfo.minimum.asArray(),\r\n maximum: boundingInfo.maximum.asArray(),\r\n };\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized GaussianSplattingPartProxyMesh\r\n * @param parsedMesh the serialized mesh\r\n * @param scene the scene to create the GaussianSplattingPartProxyMesh in\r\n * @returns the created GaussianSplattingPartProxyMesh\r\n */\r\n public static override Parse(parsedMesh: any, scene: Scene): GaussianSplattingPartProxyMesh {\r\n const partIndex = parsedMesh.partIndex;\r\n const compoundSplatMesh =\r\n (parsedMesh.compoundSplatMesh as GaussianSplattingMesh | undefined) ?? (scene.getLastMeshById(parsedMesh.compoundSplatMeshId) as GaussianSplattingMesh | null);\r\n if (!compoundSplatMesh) {\r\n throw new Error(`GaussianSplattingPartProxyMesh: compound mesh not found with ID ${parsedMesh.compoundSplatMeshId}`);\r\n }\r\n const minimum = Vector3.FromArray(parsedMesh.boundingInfo.minimum);\r\n const maximum = Vector3.FromArray(parsedMesh.boundingInfo.maximum);\r\n const boundingInfo = new BoundingInfo(minimum, maximum);\r\n const vertexCount = parsedMesh.vertexCount ?? 0;\r\n const splatsDataOffset = parsedMesh.splatsDataOffset ?? 0;\r\n const shDataOffset = parsedMesh.shDataOffset ?? splatsDataOffset;\r\n return new GaussianSplattingPartProxyMesh(parsedMesh.name, scene, compoundSplatMesh, partIndex, boundingInfo, vertexCount, splatsDataOffset, shDataOffset);\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for gaussianSplattingPartProxyMesh.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterGaussianSplattingPartProxyMesh(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n Mesh._GaussianSplattingPartProxyMeshParser = GaussianSplattingPartProxyMesh.Parse;\r\n}\r\n"]}
@@ -249,7 +249,7 @@ export class GreasedLineRibbonMesh extends GreasedLineBaseMesh {
249
249
  }
250
250
  for (let i = 0, c = 0; i < pathArrayCopy[0].length; i++) {
251
251
  const widthLower = this._uSegmentLengths[i][0] / 2;
252
- const widthUpper = this._uSegmentLengths[i][pathArrayLength - 1] / 2;
252
+ const widthUpper = this._uSegmentLengths[i][pathArrayLength - 2] / 2;
253
253
  this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthLower);
254
254
  for (let pi = 0; pi < pathArrayLength - 2; pi++) {
255
255
  this._ribbonWidths.push(0);
@@ -406,8 +406,8 @@ export class GreasedLineRibbonMesh extends GreasedLineBaseMesh {
406
406
  this._vTotalLengths[pi] = length;
407
407
  }
408
408
  const positionsLength = pathArray[0].length;
409
- this._uSegmentLengths = new Array(positionsLength).fill([]);
410
- this._uTotalLengths = new Array(positionsLength).fill([]);
409
+ this._uSegmentLengths = Array.from({ length: positionsLength }, () => []);
410
+ this._uTotalLengths = new Array(positionsLength);
411
411
  const uLength = new Vector3();
412
412
  for (let i = 0; i < positionsLength; i++) {
413
413
  length = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"greasedLineRibbonMesh.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GreasedLine/greasedLineRibbonMesh.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACH,mBAAmB,GAMtB,MAAM,uBAAuB,CAAC;AAK/B;;;GAGG;AACH,MAAM,OAAO,qBAAs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Vector3 } from \"../../Maths/math.vector.pure\";\r\nimport { Mesh } from \"../mesh.pure\";\r\nimport { Buffer } from \"../../Buffers/buffer.pure\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { type Node } from \"../../node\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport {\r\n GreasedLineBaseMesh,\r\n GreasedLineRibbonAutoDirectionMode,\r\n GreasedLineRibbonFacesMode,\r\n GreasedLineRibbonPointsMode,\r\n type GreasedLineMeshOptions,\r\n type GreasedLineRibbonOptions,\r\n} from \"./greasedLineBaseMesh\";\r\n\r\nimport { type VertexData } from \"../mesh.vertexData\";\r\nimport { type Scene } from \"../../scene.pure\";\r\n\r\n/**\r\n * GreasedLineRibbonMesh\r\n * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.\r\n */\r\nexport class GreasedLineRibbonMesh extends GreasedLineBaseMesh {\r\n /**\r\n * Default line width\r\n */\r\n public static DEFAULT_WIDTH = 0.1;\r\n\r\n private static _RightHandedForwardReadOnlyQuaternion = /*#__PURE__*/ Quaternion.RotationAxis(Vector3.RightHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftHandedForwardReadOnlyQuaternion = /*#__PURE__*/ Quaternion.RotationAxis(Vector3.LeftHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftReadOnlyQuaternion = /*#__PURE__*/ Quaternion.RotationAxis(Vector3.LeftReadOnly, Math.PI / 2);\r\n\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XY plane\r\n */\r\n public static DIRECTION_XY = Vector3.LeftHandedForwardReadOnly; // doesn't matter in which handed system the scene operates\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XZ plane\r\n */\r\n public static DIRECTION_XZ = Vector3.UpReadOnly;\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the YZ plane\r\n */\r\n public static DIRECTION_YZ = Vector3.LeftReadOnly;\r\n\r\n private _paths: Vector3[][];\r\n private _pathsOptions: { options: GreasedLineMeshOptions; pathCount: number }[];\r\n private _vSegmentLengths: number[][];\r\n private _uSegmentLengths: number[][];\r\n private _vTotalLengths: number[];\r\n private _uTotalLengths: number[];\r\n\r\n private _counters: number[];\r\n private _slopes: number[];\r\n private _ribbonWidths: number[];\r\n\r\n /**\r\n * GreasedLineRibbonMesh\r\n * @param name name of the mesh\r\n * @param scene the scene\r\n * @param _options mesh options\r\n * @param _pathOptions used internaly when parsing a serialized GreasedLineRibbonMesh\r\n */\r\n constructor(\r\n public override readonly name: string,\r\n scene: Scene,\r\n _options: GreasedLineMeshOptions,\r\n _pathOptions?: { options: GreasedLineMeshOptions; pathCount: number }[]\r\n ) {\r\n super(name, scene, _options);\r\n\r\n if (!_options.ribbonOptions) {\r\n throw \"'GreasedLineMeshOptions.ribbonOptions' is not set.\";\r\n }\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._widths = _options.widths ?? [];\r\n this._ribbonWidths = [];\r\n this._pathsOptions = _pathOptions ?? [];\r\n\r\n if (_options.points) {\r\n this.addPoints(GreasedLineTools.ConvertPoints(_options.points), _options, !!_pathOptions);\r\n }\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n * @param options mesh options\r\n * @param hasPathOptions defaults to false\r\n */\r\n public override addPoints(points: number[][], options: GreasedLineMeshOptions, hasPathOptions = false) {\r\n if (!options.ribbonOptions) {\r\n throw \"addPoints() on GreasedLineRibbonMesh instance requires 'GreasedLineMeshOptions.ribbonOptions'.\";\r\n }\r\n\r\n if (!hasPathOptions) {\r\n this._pathsOptions.push({ options, pathCount: points.length });\r\n }\r\n\r\n super.addPoints(points, options);\r\n }\r\n\r\n /**\r\n * \"GreasedLineRibbonMesh\"\r\n * @returns \"GreasedLineRibbonMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GreasedLineRibbonMesh\";\r\n }\r\n\r\n /**\r\n * Return true if the line was created from two edge paths or one points path.\r\n * In this case the line is always flat.\r\n */\r\n public get isFlatLine() {\r\n return this._paths.length < 3;\r\n }\r\n\r\n /**\r\n * Returns the slopes of the line at each point relative to the center of the line\r\n */\r\n get slopes() {\r\n return this._slopes;\r\n }\r\n\r\n /**\r\n * Set the slopes of the line at each point relative to the center of the line\r\n */\r\n set slopes(slopes: number[]) {\r\n this._slopes = slopes;\r\n }\r\n\r\n protected _updateColorPointers() {\r\n if (this._options.colorPointers) {\r\n return;\r\n }\r\n\r\n let colorPointer = 0;\r\n this._colorPointers = [];\r\n for (let i = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const points = this._points[i];\r\n\r\n if (pathOptions.ribbonOptions!.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n for (let k = 0; k < pathCount; k++) {\r\n for (let j = 0; j < points.length; j += 3) {\r\n this._colorPointers.push(colorPointer);\r\n this._colorPointers.push(colorPointer++);\r\n }\r\n }\r\n } else {\r\n for (let j = 0; j < points.length; j += 3) {\r\n for (let k = 0; k < pathCount; k++) {\r\n this._colorPointers.push(colorPointer);\r\n }\r\n colorPointer++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _updateWidths(): void {\r\n super._updateWidthsWithValue(1);\r\n }\r\n\r\n protected _setPoints(points: number[][], _options: GreasedLineMeshOptions) {\r\n if (!this._options.ribbonOptions) {\r\n throw \"No 'GreasedLineMeshOptions.ribbonOptions' provided.\";\r\n }\r\n this._points = points;\r\n this._options.points = points;\r\n\r\n this._initGreasedLine();\r\n\r\n let indiceOffset = 0;\r\n let directionPlanes: Vector3[] | undefined = undefined;\r\n for (let i = 0, c = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const subPoints = points.slice(c, c + pathCount);\r\n c += pathCount;\r\n if (pathOptions.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS) {\r\n indiceOffset = this._preprocess(GreasedLineTools.ToVector3Array(subPoints) as Vector3[][], indiceOffset, pathOptions);\r\n } else {\r\n if (pathOptions.ribbonOptions?.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE) {\r\n if (!pathOptions.ribbonOptions.directions) {\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE 'GreasedLineMeshOptions.ribbonOptions.directions' must be defined.\";\r\n }\r\n directionPlanes = GreasedLineRibbonMesh._GetDirectionPlanesFromDirectionsOption(subPoints.length, pathOptions.ribbonOptions.directions);\r\n }\r\n for (let idx = 0; idx < subPoints.length; idx++) {\r\n const p = subPoints[idx];\r\n\r\n const pathArray = GreasedLineRibbonMesh._ConvertToRibbonPath(\r\n p,\r\n pathOptions.ribbonOptions!,\r\n this._scene.useRightHandedSystem,\r\n directionPlanes ? directionPlanes[idx] : directionPlanes\r\n );\r\n indiceOffset = this._preprocess(pathArray, indiceOffset, pathOptions);\r\n }\r\n }\r\n }\r\n\r\n if (!this._lazy) {\r\n this._createVertexBuffers();\r\n !this.doNotSyncBoundingInfo && this.refreshBoundingInfo();\r\n }\r\n }\r\n\r\n private static _GetDirectionPlanesFromDirectionsOption(count: number, directions: Vector3 | Vector3[]) {\r\n if (Array.isArray(directions)) {\r\n return directions;\r\n }\r\n\r\n return new Array(count).fill(directions) as Vector3[];\r\n }\r\n\r\n private static _CreateRibbonVertexData(pathArray: Vector3[][], options: GreasedLineMeshOptions) {\r\n const numOfPaths = pathArray.length;\r\n if (numOfPaths < 2) {\r\n throw \"Minimum of two paths are required to create a GreasedLineRibbonMesh.\";\r\n }\r\n\r\n const positions = [];\r\n const indices = [];\r\n\r\n const path = pathArray[0];\r\n for (let i = 0; i < path.length; i++) {\r\n for (let pi = 0; pi < pathArray.length; pi++) {\r\n const v = pathArray[pi][i];\r\n positions.push(v.x, v.y, v.z);\r\n }\r\n }\r\n\r\n const v: number[] = [1, 0, numOfPaths];\r\n const doubleSided = options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED;\r\n\r\n const closePath = options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath;\r\n if (numOfPaths > 2) {\r\n for (let i = 0; i < path.length - 1; i++) {\r\n v[0] = 1 + numOfPaths * i;\r\n v[1] = numOfPaths * i;\r\n v[2] = (i + 1) * numOfPaths;\r\n for (let pi = 0; pi < (numOfPaths - 1) * 2; pi++) {\r\n if (pi % 2 !== 0) {\r\n v[2] += 1;\r\n }\r\n if (pi % 2 === 0 && pi > 0) {\r\n v[0] += 1;\r\n v[1] += 1;\r\n }\r\n indices.push(v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[0], v[2]);\r\n if (doubleSided) {\r\n indices.push(v[0], v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[2]);\r\n }\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < positions.length / 3 - 3; i += 2) {\r\n indices.push(i, i + 1, i + 2);\r\n indices.push(i + 2, i + 1, i + 3);\r\n if (doubleSided) {\r\n indices.push(i + 1, i, i + 2);\r\n indices.push(i + 1, i + 2, i + 3);\r\n }\r\n }\r\n }\r\n if (closePath) {\r\n let lastIndice = numOfPaths * (path.length - 1);\r\n for (let pi = 0; pi < numOfPaths - 1; pi++) {\r\n indices.push(lastIndice, pi + 1, pi);\r\n indices.push(lastIndice + 1, pi + 1, lastIndice);\r\n if (doubleSided) {\r\n indices.push(pi, pi + 1, lastIndice);\r\n indices.push(lastIndice, pi + 1, lastIndice + 1);\r\n }\r\n lastIndice++;\r\n }\r\n }\r\n\r\n return {\r\n positions,\r\n indices,\r\n };\r\n }\r\n\r\n private _preprocess(pathArray: Vector3[][], indiceOffset: number, options: GreasedLineMeshOptions) {\r\n this._paths = pathArray;\r\n\r\n const ribbonVertexData = GreasedLineRibbonMesh._CreateRibbonVertexData(pathArray, options);\r\n\r\n const positions = ribbonVertexData.positions;\r\n\r\n if (!this._options.widths) {\r\n throw \"No 'GreasedLineMeshOptions.widths' table is specified.\";\r\n }\r\n\r\n const vertexPositions = Array.isArray(this._vertexPositions) ? this._vertexPositions : Array.from(this._vertexPositions);\r\n this._vertexPositions = vertexPositions;\r\n const uvs = Array.isArray(this._uvs) ? this._uvs : Array.from(this._uvs);\r\n this._uvs = uvs;\r\n const indices = Array.isArray(this._indices) ? this._indices : Array.from(this._indices);\r\n this._indices = indices;\r\n\r\n for (const p of positions) {\r\n vertexPositions.push(p);\r\n }\r\n\r\n let pathArrayCopy = pathArray;\r\n if (options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath) {\r\n pathArrayCopy = [];\r\n for (let i = 0; i < pathArray.length; i++) {\r\n const pathCopy = pathArray[i].slice();\r\n pathCopy.push(pathArray[i][0].clone());\r\n pathArrayCopy.push(pathCopy);\r\n }\r\n }\r\n\r\n this._calculateSegmentLengths(pathArrayCopy);\r\n\r\n const pathArrayLength = pathArrayCopy.length;\r\n const previousCounters = new Array(pathArrayLength).fill(0);\r\n for (let i = 0; i < pathArrayCopy[0].length; i++) {\r\n let v = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const counter = previousCounters[pi] + this._vSegmentLengths[pi][i] / this._vTotalLengths[pi];\r\n this._counters.push(counter);\r\n uvs.push(counter, v);\r\n\r\n previousCounters[pi] = counter;\r\n v += this._uSegmentLengths[i][pi] / this._uTotalLengths[i];\r\n }\r\n }\r\n\r\n for (let i = 0, c = 0; i < pathArrayCopy[0].length; i++) {\r\n const widthLower = this._uSegmentLengths[i][0] / 2;\r\n const widthUpper = this._uSegmentLengths[i][pathArrayLength - 1] / 2;\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthLower);\r\n for (let pi = 0; pi < pathArrayLength - 2; pi++) {\r\n this._ribbonWidths.push(0);\r\n }\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthUpper);\r\n }\r\n\r\n const slopes =\r\n options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS\r\n ? new Array(pathArrayCopy[0].length * pathArrayCopy.length * 6).fill(0)\r\n : GreasedLineRibbonMesh._CalculateSlopes(pathArrayCopy);\r\n for (const s of slopes) {\r\n this._slopes.push(s);\r\n }\r\n\r\n if (ribbonVertexData.indices) {\r\n for (let i = 0; i < ribbonVertexData.indices.length; i++) {\r\n indices.push(ribbonVertexData.indices[i] + indiceOffset);\r\n }\r\n }\r\n indiceOffset += positions.length / 3;\r\n\r\n return indiceOffset;\r\n }\r\n\r\n private static _ConvertToRibbonPath(points: number[], ribbonInfo: GreasedLineRibbonOptions, rightHandedSystem: boolean, directionPlane?: Vector3) {\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS && !ribbonInfo.width) {\r\n throw \"'GreasedLineMeshOptions.ribbonOptiosn.width' must be specified in GreasedLineRibbonPointsMode.POINTS_MODE_POINTS.\";\r\n }\r\n const path1 = [];\r\n const path2 = [];\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n const width = ribbonInfo.width! / 2;\r\n const pointVectors = GreasedLineTools.ToVector3Array(points) as Vector3[];\r\n let direction: Nullable<Vector3> = null;\r\n let fatDirection: Nullable<Vector3> = null;\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT) {\r\n // set the direction plane from the first line segment for the whole line\r\n directionPlane = GreasedLineRibbonMesh._GetDirectionFromPoints(pointVectors[0], pointVectors[1], null);\r\n }\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO && !(ribbonInfo.directions instanceof Vector3)) {\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO 'GreasedLineMeshOptions.ribbonOptions.directions' must be a Vector3.\";\r\n }\r\n\r\n // Copy into the scratch vector instead of rebinding the slot. Assigning would make\r\n // TmpVectors.Vector3[1] alias either the caller's vector or one of the DIRECTION_*\r\n // constants (which are themselves Vector3.UpReadOnly / LeftReadOnly / ...), so the next\r\n // write to that shared scratch slot anywhere in the engine would silently corrupt them.\r\n TmpVectors.Vector3[1].copyFrom(ribbonInfo.directions instanceof Vector3 ? ribbonInfo.directions : GreasedLineRibbonMesh.DIRECTION_XZ);\r\n for (let i = 0; i < pointVectors.length - (directionPlane ? 0 : 1); i++) {\r\n const p1 = pointVectors[i];\r\n const p2 = pointVectors[i + 1];\r\n\r\n if (directionPlane) {\r\n direction = directionPlane;\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO) {\r\n p2.subtractToRef(p1, TmpVectors.Vector3[0]);\r\n direction = Vector3.CrossToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2]).normalize();\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_ALL_SEGMENTS) {\r\n direction = GreasedLineRibbonMesh._GetDirectionFromPoints(p1, p2, direction);\r\n } else {\r\n // GreasedLineRibbonAutoDirectionMode.DIRECTION_ENHANCED\r\n const directionTemp = p2.subtract(p1);\r\n directionTemp.applyRotationQuaternionInPlace(\r\n directionTemp.x > directionTemp.y && directionTemp.x > directionTemp.z\r\n ? rightHandedSystem\r\n ? GreasedLineRibbonMesh._RightHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftReadOnlyQuaternion\r\n );\r\n direction = directionTemp.normalize();\r\n }\r\n\r\n fatDirection = direction.multiplyByFloats(width, width, width);\r\n path1.push(p1.add(fatDirection));\r\n path2.push(p1.subtract(fatDirection));\r\n }\r\n if (!directionPlane) {\r\n path1.push(pointVectors[pointVectors.length - 1].add(fatDirection!));\r\n path2.push(pointVectors[pointVectors.length - 1].subtract(fatDirection!));\r\n }\r\n }\r\n return [path1, path2];\r\n }\r\n\r\n private static _GetDirectionFromPoints(p1: Vector3, p2: Vector3, previousDirection: Nullable<Vector3>) {\r\n // handle straight lines\r\n if (p1.x === p2.x && (!previousDirection || previousDirection?.x === 1)) {\r\n return GreasedLineRibbonMesh.DIRECTION_YZ;\r\n }\r\n\r\n if (p1.y === p2.y) {\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n if (p1.z === p2.z) {\r\n return GreasedLineRibbonMesh.DIRECTION_XY;\r\n }\r\n\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n /**\r\n * Clones the GreasedLineRibbonMesh.\r\n * @param name new line name\r\n * @param newParent new parent node\r\n * @returns cloned line\r\n */\r\n public override clone(name: string = `${this.name}-cloned`, newParent?: Nullable<Node>) {\r\n const lineOptions = this._createLineOptions();\r\n const deepCopiedLineOptions: any = {};\r\n const pathOptionsCloned: any = [];\r\n DeepCopier.DeepCopy(this._pathsOptions, pathOptionsCloned, undefined, undefined, true);\r\n DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, [\"instance\"], undefined, true);\r\n\r\n const cloned = new GreasedLineRibbonMesh(name, this._scene, <GreasedLineMeshOptions>deepCopiedLineOptions, pathOptionsCloned);\r\n if (newParent) {\r\n cloned.parent = newParent;\r\n }\r\n\r\n cloned.material = this.material;\r\n\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineRibbonMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n serializationObject.pathsOptions = this._pathsOptions;\r\n }\r\n\r\n /**\r\n * Parses a serialized GreasedLineRibbonMesh\r\n * @param parsedMesh the serialized GreasedLineRibbonMesh\r\n * @param scene the scene to create the GreasedLineRibbonMesh in\r\n * @returns the created GreasedLineRibbonMesh\r\n */\r\n public static override Parse(parsedMesh: any, scene: Scene): Mesh {\r\n const lineOptions = <GreasedLineMeshOptions>parsedMesh.lineOptions;\r\n const name = <string>parsedMesh.name;\r\n const pathOptions = parsedMesh.pathOptions;\r\n const result = new GreasedLineRibbonMesh(name, scene, lineOptions, pathOptions);\r\n return result;\r\n }\r\n\r\n protected override _initGreasedLine() {\r\n super._initGreasedLine();\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._ribbonWidths = [];\r\n }\r\n\r\n private _calculateSegmentLengths(pathArray: Vector3[][]) {\r\n const pathArrayLength = pathArray.length;\r\n this._vSegmentLengths = new Array(pathArrayLength);\r\n this._vTotalLengths = new Array(pathArrayLength);\r\n let length: number;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const points = pathArray[pi];\r\n this._vSegmentLengths[pi] = [0]; // first point has 0 distance\r\n length = 0;\r\n for (let i = 0; i < points.length - 1; i++) {\r\n const l = Math.abs(points[i].subtract(points[i + 1]).lengthSquared()); // it's ok to have lengthSquared() here\r\n length += l;\r\n this._vSegmentLengths[pi].push(l);\r\n }\r\n this._vTotalLengths[pi] = length;\r\n }\r\n\r\n const positionsLength = pathArray[0].length;\r\n this._uSegmentLengths = new Array(positionsLength).fill([]);\r\n this._uTotalLengths = new Array(positionsLength).fill([]);\r\n const uLength = new Vector3();\r\n for (let i = 0; i < positionsLength; i++) {\r\n length = 0;\r\n for (let pi = 1; pi < pathArrayLength; pi++) {\r\n pathArray[pi][i].subtractToRef(pathArray[pi - 1][i], uLength);\r\n const l = uLength.length(); // must be length()\r\n length += l;\r\n this._uSegmentLengths[i].push(l);\r\n }\r\n this._uTotalLengths[i] = length;\r\n }\r\n }\r\n\r\n private static _CalculateSlopes(paths: Vector3[][]) {\r\n const points1 = paths[0];\r\n const points2 = paths.length === 2 ? paths[1] : paths[paths.length - 1];\r\n const slopes: number[] = [];\r\n\r\n const slope = new Vector3();\r\n for (let i = 0; i < points1.length; i++) {\r\n for (let pi = 0; pi < paths.length; pi++) {\r\n if (pi === 0 || pi === paths.length - 1) {\r\n points1[i].subtract(points2[i]).normalizeToRef(slope);\r\n slopes.push(slope.x, slope.y, slope.z);\r\n slopes.push(-slope.x, -slope.y, -slope.z);\r\n } else {\r\n slopes.push(0, 0, 0, 0, 0, 0);\r\n }\r\n }\r\n }\r\n\r\n return slopes;\r\n }\r\n\r\n protected override _createVertexBuffers(): VertexData {\r\n this._uvs = this._options.uvs ?? this._uvs;\r\n const vertexData = super._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n\r\n const countersBuffer = new Buffer(this._engine, this._counters, this._updatable, 1);\r\n this.setVerticesBuffer(countersBuffer.createVertexBuffer(\"grl_counters\", 0, 1));\r\n\r\n const colorPointersBuffer = new Buffer(this._engine, this._colorPointers, this._updatable, 1);\r\n this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer(\"grl_colorPointers\", 0, 1));\r\n\r\n const slopesBuffer = new Buffer(this._engine, this._slopes, this._updatable, 3);\r\n this.setVerticesBuffer(slopesBuffer.createVertexBuffer(\"grl_slopes\", 0, 3));\r\n\r\n const widthsBuffer = new Buffer(this._engine, this._ribbonWidths, this._updatable, 1);\r\n this.setVerticesBuffer(widthsBuffer.createVertexBuffer(\"grl_widths\", 0, 1));\r\n this._widthsBuffer = widthsBuffer;\r\n\r\n return vertexData;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for greasedLineRibbonMesh.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterGreasedLineRibbonMesh(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n Mesh._GreasedLineRibbonMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GreasedLineRibbonMesh.Parse(parsedMesh, scene);\r\n };\r\n}\r\n"]}
1
+ {"version":3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3H;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,UAAU,CAAC;AAChD;;GAEG;AACW,kCAAY,GAAG,OAAO,CAAC,YAAY,CAAC;AAshBtD,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,6BAA6B;IACzC,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,IAAI,CAAC,4BAA4B,GAAG,CAAC,UAAe,EAAE,KAAY,EAAQ,EAAE;QACxE,OAAO,qBAAqB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC,CAAC;AACN,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { Quaternion, TmpVectors, Vector3 } from \"../../Maths/math.vector.pure\";\r\nimport { Mesh } from \"../mesh.pure\";\r\nimport { Buffer } from \"../../Buffers/buffer.pure\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { type Node } from \"../../node\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport { GreasedLineTools } from \"../../Misc/greasedLineTools\";\r\nimport {\r\n GreasedLineBaseMesh,\r\n GreasedLineRibbonAutoDirectionMode,\r\n GreasedLineRibbonFacesMode,\r\n GreasedLineRibbonPointsMode,\r\n type GreasedLineMeshOptions,\r\n type GreasedLineRibbonOptions,\r\n} from \"./greasedLineBaseMesh\";\r\n\r\nimport { type VertexData } from \"../mesh.vertexData\";\r\nimport { type Scene } from \"../../scene.pure\";\r\n\r\n/**\r\n * GreasedLineRibbonMesh\r\n * Use the GreasedLineBuilder.CreateGreasedLine function to create an instance of this class.\r\n */\r\nexport class GreasedLineRibbonMesh extends GreasedLineBaseMesh {\r\n /**\r\n * Default line width\r\n */\r\n public static DEFAULT_WIDTH = 0.1;\r\n\r\n private static _RightHandedForwardReadOnlyQuaternion = /*#__PURE__*/ Quaternion.RotationAxis(Vector3.RightHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftHandedForwardReadOnlyQuaternion = /*#__PURE__*/ Quaternion.RotationAxis(Vector3.LeftHandedForwardReadOnly, Math.PI / 2);\r\n private static _LeftReadOnlyQuaternion = /*#__PURE__*/ Quaternion.RotationAxis(Vector3.LeftReadOnly, Math.PI / 2);\r\n\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XY plane\r\n */\r\n public static DIRECTION_XY = Vector3.LeftHandedForwardReadOnly; // doesn't matter in which handed system the scene operates\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the XZ plane\r\n */\r\n public static DIRECTION_XZ = Vector3.UpReadOnly;\r\n /**\r\n * Direction which the line segment will be thickened if drawn on the YZ plane\r\n */\r\n public static DIRECTION_YZ = Vector3.LeftReadOnly;\r\n\r\n private _paths: Vector3[][];\r\n private _pathsOptions: { options: GreasedLineMeshOptions; pathCount: number }[];\r\n private _vSegmentLengths: number[][];\r\n private _uSegmentLengths: number[][];\r\n private _vTotalLengths: number[];\r\n private _uTotalLengths: number[];\r\n\r\n private _counters: number[];\r\n private _slopes: number[];\r\n private _ribbonWidths: number[];\r\n\r\n /**\r\n * GreasedLineRibbonMesh\r\n * @param name name of the mesh\r\n * @param scene the scene\r\n * @param _options mesh options\r\n * @param _pathOptions used internaly when parsing a serialized GreasedLineRibbonMesh\r\n */\r\n constructor(\r\n public override readonly name: string,\r\n scene: Scene,\r\n _options: GreasedLineMeshOptions,\r\n _pathOptions?: { options: GreasedLineMeshOptions; pathCount: number }[]\r\n ) {\r\n super(name, scene, _options);\r\n\r\n if (!_options.ribbonOptions) {\r\n throw \"'GreasedLineMeshOptions.ribbonOptions' is not set.\";\r\n }\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._widths = _options.widths ?? [];\r\n this._ribbonWidths = [];\r\n this._pathsOptions = _pathOptions ?? [];\r\n\r\n if (_options.points) {\r\n this.addPoints(GreasedLineTools.ConvertPoints(_options.points), _options, !!_pathOptions);\r\n }\r\n }\r\n\r\n /**\r\n * Adds new points to the line. It doesn't rerenders the line if in lazy mode.\r\n * @param points points table\r\n * @param options mesh options\r\n * @param hasPathOptions defaults to false\r\n */\r\n public override addPoints(points: number[][], options: GreasedLineMeshOptions, hasPathOptions = false) {\r\n if (!options.ribbonOptions) {\r\n throw \"addPoints() on GreasedLineRibbonMesh instance requires 'GreasedLineMeshOptions.ribbonOptions'.\";\r\n }\r\n\r\n if (!hasPathOptions) {\r\n this._pathsOptions.push({ options, pathCount: points.length });\r\n }\r\n\r\n super.addPoints(points, options);\r\n }\r\n\r\n /**\r\n * \"GreasedLineRibbonMesh\"\r\n * @returns \"GreasedLineRibbonMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GreasedLineRibbonMesh\";\r\n }\r\n\r\n /**\r\n * Return true if the line was created from two edge paths or one points path.\r\n * In this case the line is always flat.\r\n */\r\n public get isFlatLine() {\r\n return this._paths.length < 3;\r\n }\r\n\r\n /**\r\n * Returns the slopes of the line at each point relative to the center of the line\r\n */\r\n get slopes() {\r\n return this._slopes;\r\n }\r\n\r\n /**\r\n * Set the slopes of the line at each point relative to the center of the line\r\n */\r\n set slopes(slopes: number[]) {\r\n this._slopes = slopes;\r\n }\r\n\r\n protected _updateColorPointers() {\r\n if (this._options.colorPointers) {\r\n return;\r\n }\r\n\r\n let colorPointer = 0;\r\n this._colorPointers = [];\r\n for (let i = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const points = this._points[i];\r\n\r\n if (pathOptions.ribbonOptions!.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n for (let k = 0; k < pathCount; k++) {\r\n for (let j = 0; j < points.length; j += 3) {\r\n this._colorPointers.push(colorPointer);\r\n this._colorPointers.push(colorPointer++);\r\n }\r\n }\r\n } else {\r\n for (let j = 0; j < points.length; j += 3) {\r\n for (let k = 0; k < pathCount; k++) {\r\n this._colorPointers.push(colorPointer);\r\n }\r\n colorPointer++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _updateWidths(): void {\r\n super._updateWidthsWithValue(1);\r\n }\r\n\r\n protected _setPoints(points: number[][], _options: GreasedLineMeshOptions) {\r\n if (!this._options.ribbonOptions) {\r\n throw \"No 'GreasedLineMeshOptions.ribbonOptions' provided.\";\r\n }\r\n this._points = points;\r\n this._options.points = points;\r\n\r\n this._initGreasedLine();\r\n\r\n let indiceOffset = 0;\r\n let directionPlanes: Vector3[] | undefined = undefined;\r\n for (let i = 0, c = 0; i < this._pathsOptions.length; i++) {\r\n const { options: pathOptions, pathCount } = this._pathsOptions[i];\r\n const subPoints = points.slice(c, c + pathCount);\r\n c += pathCount;\r\n if (pathOptions.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS) {\r\n indiceOffset = this._preprocess(GreasedLineTools.ToVector3Array(subPoints) as Vector3[][], indiceOffset, pathOptions);\r\n } else {\r\n if (pathOptions.ribbonOptions?.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE) {\r\n if (!pathOptions.ribbonOptions.directions) {\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_NONE 'GreasedLineMeshOptions.ribbonOptions.directions' must be defined.\";\r\n }\r\n directionPlanes = GreasedLineRibbonMesh._GetDirectionPlanesFromDirectionsOption(subPoints.length, pathOptions.ribbonOptions.directions);\r\n }\r\n for (let idx = 0; idx < subPoints.length; idx++) {\r\n const p = subPoints[idx];\r\n\r\n const pathArray = GreasedLineRibbonMesh._ConvertToRibbonPath(\r\n p,\r\n pathOptions.ribbonOptions!,\r\n this._scene.useRightHandedSystem,\r\n directionPlanes ? directionPlanes[idx] : directionPlanes\r\n );\r\n indiceOffset = this._preprocess(pathArray, indiceOffset, pathOptions);\r\n }\r\n }\r\n }\r\n\r\n if (!this._lazy) {\r\n this._createVertexBuffers();\r\n !this.doNotSyncBoundingInfo && this.refreshBoundingInfo();\r\n }\r\n }\r\n\r\n private static _GetDirectionPlanesFromDirectionsOption(count: number, directions: Vector3 | Vector3[]) {\r\n if (Array.isArray(directions)) {\r\n return directions;\r\n }\r\n\r\n return new Array(count).fill(directions) as Vector3[];\r\n }\r\n\r\n private static _CreateRibbonVertexData(pathArray: Vector3[][], options: GreasedLineMeshOptions) {\r\n const numOfPaths = pathArray.length;\r\n if (numOfPaths < 2) {\r\n throw \"Minimum of two paths are required to create a GreasedLineRibbonMesh.\";\r\n }\r\n\r\n const positions = [];\r\n const indices = [];\r\n\r\n const path = pathArray[0];\r\n for (let i = 0; i < path.length; i++) {\r\n for (let pi = 0; pi < pathArray.length; pi++) {\r\n const v = pathArray[pi][i];\r\n positions.push(v.x, v.y, v.z);\r\n }\r\n }\r\n\r\n const v: number[] = [1, 0, numOfPaths];\r\n const doubleSided = options.ribbonOptions?.facesMode === GreasedLineRibbonFacesMode.FACES_MODE_DOUBLE_SIDED;\r\n\r\n const closePath = options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath;\r\n if (numOfPaths > 2) {\r\n for (let i = 0; i < path.length - 1; i++) {\r\n v[0] = 1 + numOfPaths * i;\r\n v[1] = numOfPaths * i;\r\n v[2] = (i + 1) * numOfPaths;\r\n for (let pi = 0; pi < (numOfPaths - 1) * 2; pi++) {\r\n if (pi % 2 !== 0) {\r\n v[2] += 1;\r\n }\r\n if (pi % 2 === 0 && pi > 0) {\r\n v[0] += 1;\r\n v[1] += 1;\r\n }\r\n indices.push(v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[0], v[2]);\r\n if (doubleSided) {\r\n indices.push(v[0], v[1] + (pi % 2 !== 0 ? numOfPaths : 0), v[2]);\r\n }\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < positions.length / 3 - 3; i += 2) {\r\n indices.push(i, i + 1, i + 2);\r\n indices.push(i + 2, i + 1, i + 3);\r\n if (doubleSided) {\r\n indices.push(i + 1, i, i + 2);\r\n indices.push(i + 1, i + 2, i + 3);\r\n }\r\n }\r\n }\r\n if (closePath) {\r\n let lastIndice = numOfPaths * (path.length - 1);\r\n for (let pi = 0; pi < numOfPaths - 1; pi++) {\r\n indices.push(lastIndice, pi + 1, pi);\r\n indices.push(lastIndice + 1, pi + 1, lastIndice);\r\n if (doubleSided) {\r\n indices.push(pi, pi + 1, lastIndice);\r\n indices.push(lastIndice, pi + 1, lastIndice + 1);\r\n }\r\n lastIndice++;\r\n }\r\n }\r\n\r\n return {\r\n positions,\r\n indices,\r\n };\r\n }\r\n\r\n private _preprocess(pathArray: Vector3[][], indiceOffset: number, options: GreasedLineMeshOptions) {\r\n this._paths = pathArray;\r\n\r\n const ribbonVertexData = GreasedLineRibbonMesh._CreateRibbonVertexData(pathArray, options);\r\n\r\n const positions = ribbonVertexData.positions;\r\n\r\n if (!this._options.widths) {\r\n throw \"No 'GreasedLineMeshOptions.widths' table is specified.\";\r\n }\r\n\r\n const vertexPositions = Array.isArray(this._vertexPositions) ? this._vertexPositions : Array.from(this._vertexPositions);\r\n this._vertexPositions = vertexPositions;\r\n const uvs = Array.isArray(this._uvs) ? this._uvs : Array.from(this._uvs);\r\n this._uvs = uvs;\r\n const indices = Array.isArray(this._indices) ? this._indices : Array.from(this._indices);\r\n this._indices = indices;\r\n\r\n for (const p of positions) {\r\n vertexPositions.push(p);\r\n }\r\n\r\n let pathArrayCopy = pathArray;\r\n if (options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS && options.ribbonOptions.closePath) {\r\n pathArrayCopy = [];\r\n for (let i = 0; i < pathArray.length; i++) {\r\n const pathCopy = pathArray[i].slice();\r\n pathCopy.push(pathArray[i][0].clone());\r\n pathArrayCopy.push(pathCopy);\r\n }\r\n }\r\n\r\n this._calculateSegmentLengths(pathArrayCopy);\r\n\r\n const pathArrayLength = pathArrayCopy.length;\r\n const previousCounters = new Array(pathArrayLength).fill(0);\r\n for (let i = 0; i < pathArrayCopy[0].length; i++) {\r\n let v = 0;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const counter = previousCounters[pi] + this._vSegmentLengths[pi][i] / this._vTotalLengths[pi];\r\n this._counters.push(counter);\r\n uvs.push(counter, v);\r\n\r\n previousCounters[pi] = counter;\r\n v += this._uSegmentLengths[i][pi] / this._uTotalLengths[i];\r\n }\r\n }\r\n\r\n for (let i = 0, c = 0; i < pathArrayCopy[0].length; i++) {\r\n const widthLower = this._uSegmentLengths[i][0] / 2;\r\n const widthUpper = this._uSegmentLengths[i][pathArrayLength - 2] / 2;\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthLower);\r\n for (let pi = 0; pi < pathArrayLength - 2; pi++) {\r\n this._ribbonWidths.push(0);\r\n }\r\n this._ribbonWidths.push(((this._widths[c++] ?? 1) - 1) * widthUpper);\r\n }\r\n\r\n const slopes =\r\n options.ribbonOptions?.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_PATHS\r\n ? new Array(pathArrayCopy[0].length * pathArrayCopy.length * 6).fill(0)\r\n : GreasedLineRibbonMesh._CalculateSlopes(pathArrayCopy);\r\n for (const s of slopes) {\r\n this._slopes.push(s);\r\n }\r\n\r\n if (ribbonVertexData.indices) {\r\n for (let i = 0; i < ribbonVertexData.indices.length; i++) {\r\n indices.push(ribbonVertexData.indices[i] + indiceOffset);\r\n }\r\n }\r\n indiceOffset += positions.length / 3;\r\n\r\n return indiceOffset;\r\n }\r\n\r\n private static _ConvertToRibbonPath(points: number[], ribbonInfo: GreasedLineRibbonOptions, rightHandedSystem: boolean, directionPlane?: Vector3) {\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS && !ribbonInfo.width) {\r\n throw \"'GreasedLineMeshOptions.ribbonOptiosn.width' must be specified in GreasedLineRibbonPointsMode.POINTS_MODE_POINTS.\";\r\n }\r\n const path1 = [];\r\n const path2 = [];\r\n if (ribbonInfo.pointsMode === GreasedLineRibbonPointsMode.POINTS_MODE_POINTS) {\r\n const width = ribbonInfo.width! / 2;\r\n const pointVectors = GreasedLineTools.ToVector3Array(points) as Vector3[];\r\n let direction: Nullable<Vector3> = null;\r\n let fatDirection: Nullable<Vector3> = null;\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_FIRST_SEGMENT) {\r\n // set the direction plane from the first line segment for the whole line\r\n directionPlane = GreasedLineRibbonMesh._GetDirectionFromPoints(pointVectors[0], pointVectors[1], null);\r\n }\r\n\r\n if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO && !(ribbonInfo.directions instanceof Vector3)) {\r\n throw \"In GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO 'GreasedLineMeshOptions.ribbonOptions.directions' must be a Vector3.\";\r\n }\r\n\r\n // Copy into the scratch vector instead of rebinding the slot. Assigning would make\r\n // TmpVectors.Vector3[1] alias either the caller's vector or one of the DIRECTION_*\r\n // constants (which are themselves Vector3.UpReadOnly / LeftReadOnly / ...), so the next\r\n // write to that shared scratch slot anywhere in the engine would silently corrupt them.\r\n TmpVectors.Vector3[1].copyFrom(ribbonInfo.directions instanceof Vector3 ? ribbonInfo.directions : GreasedLineRibbonMesh.DIRECTION_XZ);\r\n for (let i = 0; i < pointVectors.length - (directionPlane ? 0 : 1); i++) {\r\n const p1 = pointVectors[i];\r\n const p2 = pointVectors[i + 1];\r\n\r\n if (directionPlane) {\r\n direction = directionPlane;\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FACE_TO) {\r\n p2.subtractToRef(p1, TmpVectors.Vector3[0]);\r\n direction = Vector3.CrossToRef(TmpVectors.Vector3[0], TmpVectors.Vector3[1], TmpVectors.Vector3[2]).normalize();\r\n } else if (ribbonInfo.directionsAutoMode === GreasedLineRibbonAutoDirectionMode.AUTO_DIRECTIONS_FROM_ALL_SEGMENTS) {\r\n direction = GreasedLineRibbonMesh._GetDirectionFromPoints(p1, p2, direction);\r\n } else {\r\n // GreasedLineRibbonAutoDirectionMode.DIRECTION_ENHANCED\r\n const directionTemp = p2.subtract(p1);\r\n directionTemp.applyRotationQuaternionInPlace(\r\n directionTemp.x > directionTemp.y && directionTemp.x > directionTemp.z\r\n ? rightHandedSystem\r\n ? GreasedLineRibbonMesh._RightHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftHandedForwardReadOnlyQuaternion\r\n : GreasedLineRibbonMesh._LeftReadOnlyQuaternion\r\n );\r\n direction = directionTemp.normalize();\r\n }\r\n\r\n fatDirection = direction.multiplyByFloats(width, width, width);\r\n path1.push(p1.add(fatDirection));\r\n path2.push(p1.subtract(fatDirection));\r\n }\r\n if (!directionPlane) {\r\n path1.push(pointVectors[pointVectors.length - 1].add(fatDirection!));\r\n path2.push(pointVectors[pointVectors.length - 1].subtract(fatDirection!));\r\n }\r\n }\r\n return [path1, path2];\r\n }\r\n\r\n private static _GetDirectionFromPoints(p1: Vector3, p2: Vector3, previousDirection: Nullable<Vector3>) {\r\n // handle straight lines\r\n if (p1.x === p2.x && (!previousDirection || previousDirection?.x === 1)) {\r\n return GreasedLineRibbonMesh.DIRECTION_YZ;\r\n }\r\n\r\n if (p1.y === p2.y) {\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n if (p1.z === p2.z) {\r\n return GreasedLineRibbonMesh.DIRECTION_XY;\r\n }\r\n\r\n return GreasedLineRibbonMesh.DIRECTION_XZ;\r\n }\r\n\r\n /**\r\n * Clones the GreasedLineRibbonMesh.\r\n * @param name new line name\r\n * @param newParent new parent node\r\n * @returns cloned line\r\n */\r\n public override clone(name: string = `${this.name}-cloned`, newParent?: Nullable<Node>) {\r\n const lineOptions = this._createLineOptions();\r\n const deepCopiedLineOptions: any = {};\r\n const pathOptionsCloned: any = [];\r\n DeepCopier.DeepCopy(this._pathsOptions, pathOptionsCloned, undefined, undefined, true);\r\n DeepCopier.DeepCopy(lineOptions, deepCopiedLineOptions, [\"instance\"], undefined, true);\r\n\r\n const cloned = new GreasedLineRibbonMesh(name, this._scene, <GreasedLineMeshOptions>deepCopiedLineOptions, pathOptionsCloned);\r\n if (newParent) {\r\n cloned.parent = newParent;\r\n }\r\n\r\n cloned.material = this.material;\r\n\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Serializes this GreasedLineRibbonMesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public override serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.type = this.getClassName();\r\n\r\n serializationObject.lineOptions = this._createLineOptions();\r\n serializationObject.pathsOptions = this._pathsOptions;\r\n }\r\n\r\n /**\r\n * Parses a serialized GreasedLineRibbonMesh\r\n * @param parsedMesh the serialized GreasedLineRibbonMesh\r\n * @param scene the scene to create the GreasedLineRibbonMesh in\r\n * @returns the created GreasedLineRibbonMesh\r\n */\r\n public static override Parse(parsedMesh: any, scene: Scene): Mesh {\r\n const lineOptions = <GreasedLineMeshOptions>parsedMesh.lineOptions;\r\n const name = <string>parsedMesh.name;\r\n const pathOptions = parsedMesh.pathOptions;\r\n const result = new GreasedLineRibbonMesh(name, scene, lineOptions, pathOptions);\r\n return result;\r\n }\r\n\r\n protected override _initGreasedLine() {\r\n super._initGreasedLine();\r\n\r\n this._paths = [];\r\n this._counters = [];\r\n this._slopes = [];\r\n this._ribbonWidths = [];\r\n }\r\n\r\n private _calculateSegmentLengths(pathArray: Vector3[][]) {\r\n const pathArrayLength = pathArray.length;\r\n this._vSegmentLengths = new Array(pathArrayLength);\r\n this._vTotalLengths = new Array(pathArrayLength);\r\n let length: number;\r\n for (let pi = 0; pi < pathArrayLength; pi++) {\r\n const points = pathArray[pi];\r\n this._vSegmentLengths[pi] = [0]; // first point has 0 distance\r\n length = 0;\r\n for (let i = 0; i < points.length - 1; i++) {\r\n const l = Math.abs(points[i].subtract(points[i + 1]).lengthSquared()); // it's ok to have lengthSquared() here\r\n length += l;\r\n this._vSegmentLengths[pi].push(l);\r\n }\r\n this._vTotalLengths[pi] = length;\r\n }\r\n\r\n const positionsLength = pathArray[0].length;\r\n this._uSegmentLengths = Array.from({ length: positionsLength }, () => []);\r\n this._uTotalLengths = new Array(positionsLength);\r\n const uLength = new Vector3();\r\n for (let i = 0; i < positionsLength; i++) {\r\n length = 0;\r\n for (let pi = 1; pi < pathArrayLength; pi++) {\r\n pathArray[pi][i].subtractToRef(pathArray[pi - 1][i], uLength);\r\n const l = uLength.length(); // must be length()\r\n length += l;\r\n this._uSegmentLengths[i].push(l);\r\n }\r\n this._uTotalLengths[i] = length;\r\n }\r\n }\r\n\r\n private static _CalculateSlopes(paths: Vector3[][]) {\r\n const points1 = paths[0];\r\n const points2 = paths.length === 2 ? paths[1] : paths[paths.length - 1];\r\n const slopes: number[] = [];\r\n\r\n const slope = new Vector3();\r\n for (let i = 0; i < points1.length; i++) {\r\n for (let pi = 0; pi < paths.length; pi++) {\r\n if (pi === 0 || pi === paths.length - 1) {\r\n points1[i].subtract(points2[i]).normalizeToRef(slope);\r\n slopes.push(slope.x, slope.y, slope.z);\r\n slopes.push(-slope.x, -slope.y, -slope.z);\r\n } else {\r\n slopes.push(0, 0, 0, 0, 0, 0);\r\n }\r\n }\r\n }\r\n\r\n return slopes;\r\n }\r\n\r\n protected override _createVertexBuffers(): VertexData {\r\n this._uvs = this._options.uvs ?? this._uvs;\r\n const vertexData = super._createVertexBuffers(this._options.ribbonOptions?.smoothShading);\r\n\r\n const countersBuffer = new Buffer(this._engine, this._counters, this._updatable, 1);\r\n this.setVerticesBuffer(countersBuffer.createVertexBuffer(\"grl_counters\", 0, 1));\r\n\r\n const colorPointersBuffer = new Buffer(this._engine, this._colorPointers, this._updatable, 1);\r\n this.setVerticesBuffer(colorPointersBuffer.createVertexBuffer(\"grl_colorPointers\", 0, 1));\r\n\r\n const slopesBuffer = new Buffer(this._engine, this._slopes, this._updatable, 3);\r\n this.setVerticesBuffer(slopesBuffer.createVertexBuffer(\"grl_slopes\", 0, 3));\r\n\r\n const widthsBuffer = new Buffer(this._engine, this._ribbonWidths, this._updatable, 1);\r\n this.setVerticesBuffer(widthsBuffer.createVertexBuffer(\"grl_widths\", 0, 1));\r\n this._widthsBuffer = widthsBuffer;\r\n\r\n return vertexData;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for greasedLineRibbonMesh.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterGreasedLineRibbonMesh(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n Mesh._GreasedLineRibbonMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GreasedLineRibbonMesh.Parse(parsedMesh, scene);\r\n };\r\n}\r\n"]}
@@ -139,7 +139,7 @@ let InstantiateOnVolumeBlock = (() => {
139
139
  * Gets the grid size input component
140
140
  */
141
141
  get gridSize() {
142
- return this._inputs[6];
142
+ return this._inputs[7];
143
143
  }
144
144
  /**
145
145
  * Gets the geometry output component
@@ -1 +1 @@
1
- {"version":3,"file":"instantiateOnVolumeBlock.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AAIrG,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EAA0B,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAEtG,OAAO,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;GAEG;IACU,wBAAwB;;sBAAS,iBAAiB;;;;;;;sBAAlD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GAAG,IAAI,CAAC,QAAQ,CAAC;gBAE7C,OAAO,mBAAmB,CAAC;YAC/B,CAAC;YAED,gBAAgB;YACA,YAAY,CAAC,mBAAwB;gBACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;gBAExC,IAAI,mBAAmB,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;oBACpD,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;gBAC/D,CAAC;gBAED,IAAI,mBAAmB,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;oBAC7C,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;gBACjD,CAAC;YACL,CAAC;;;;2CAxUA,sBAAsB,CAAC,kBAAkB,0CAAkC,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;oCAMxH,sBAAsB,CAAC,WAAW,0CAAkC,OAAO,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;YAL/G,+LAAO,eAAe,6BAAf,eAAe,yGAAQ;YAM9B,0KAAO,QAAQ,6BAAR,QAAQ,2FAAS;;;;;SAnBf,wBAAwB;AAuVrC,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,gCAAgC;IAC5C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC;AAChF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport { type NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { type NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport { type INodeGeometryExecutionContext } from \"../../Interfaces/nodeGeometryExecutionContext\";\r\nimport { type VertexData } from \"../../../mesh.vertexData\";\r\nimport { Vector3 } from \"../../../../Maths/math.vector.pure\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\nimport { type Nullable } from \"../../../../types\";\r\nimport { Ray } from \"../../../../Culling/ray.pure\";\r\nimport { extractMinAndMax } from \"../../../../Maths/math.functions\";\r\nimport { type INodeGeometryInstancingContext } from \"../../Interfaces/nodeGeometryInstancingContext\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\n\r\n/**\r\n * Block used to instance geometry inside a geometry\r\n */\r\nexport class InstantiateOnVolumeBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext, INodeGeometryInstancingContext {\r\n private _vertexData: VertexData;\r\n private _currentLoopIndex: number;\r\n private _currentPosition = new Vector3();\r\n private _vertex0 = new Vector3();\r\n private _vertex1 = new Vector3();\r\n private _vertex2 = new Vector3();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that a grid pattern should be used\r\n */\r\n @editableInPropertyPage(\"Grid mode\", PropertyTypeForEdition.Boolean, \"MODES\", { notifiers: { rebuild: true } })\r\n public gridMode = false;\r\n\r\n /**\r\n * Create a new InstantiateOnVolumeBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"instance\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"count\", NodeGeometryBlockConnectionPointTypes.Int, true, 256);\r\n this.registerInput(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"offset\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n this.registerInput(\"gridSize\", NodeGeometryBlockConnectionPointTypes.Int, true, 10);\r\n\r\n this.scaling.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current instance index in the current flow\r\n * @returns the current index\r\n */\r\n public getInstanceIndex(): number {\r\n return this._currentLoopIndex;\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentLoopIndex;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual positions\r\n * @returns the value associated with the source\r\n */\r\n public getOverridePositionsContextualValue() {\r\n return this._currentPosition;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"InstantiateOnVolumeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry input component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the instance input component\r\n */\r\n public get instance(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the count input component\r\n */\r\n public get count(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the offset input component\r\n */\r\n public get offset(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the grid size input component\r\n */\r\n public get gridSize(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n private _getValueOnGrid(step: number, size: number, min: number, max: number): number {\r\n const cellSize = (max - min) / size;\r\n return min + cellSize / 2 + step * cellSize;\r\n }\r\n\r\n private _getIndexinGrid(x: number, y: number, z: number, size: number) {\r\n return x + y * size + z * size * size;\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n state.pushInstancingContext(this);\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n state.pushGeometryContext(this._vertexData);\r\n\r\n if (!this._vertexData || !this._vertexData.positions || !this._vertexData.indices || !this.instance.isConnected) {\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n state.restoreGeometryContext();\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n // Processing\r\n let instanceGeometry: Nullable<VertexData>;\r\n const instanceCount = this.count.getConnectedValue(state);\r\n const additionalVertexData: VertexData[] = [];\r\n const boundingInfo = extractMinAndMax(this._vertexData.positions, 0, this._vertexData.positions.length / 3);\r\n const min = boundingInfo.minimum;\r\n const max = boundingInfo.maximum;\r\n const direction = new Vector3(0.5, 0.8, 0.2);\r\n const faceCount = this._vertexData.indices.length / 3;\r\n const gridSize = this.gridSize.getConnectedValue(state);\r\n this._currentLoopIndex = 0;\r\n\r\n let candidatesCells: Array<boolean>;\r\n if (this.gridMode) {\r\n candidatesCells = [];\r\n // Generates the list of candidates cells\r\n for (let index = 0; index < gridSize * gridSize * gridSize; index++) {\r\n candidatesCells[index] = false;\r\n }\r\n }\r\n\r\n for (let index = 0; index < instanceCount; index++) {\r\n if (this.gridMode) {\r\n // Get a random cell\r\n let cellX = Math.floor(Math.random() * gridSize);\r\n let cellY = Math.floor(Math.random() * gridSize);\r\n let cellZ = Math.floor(Math.random() * gridSize);\r\n let cellIndex = this._getIndexinGrid(cellX, cellY, cellZ, gridSize);\r\n\r\n if (candidatesCells![cellIndex]) {\r\n // Find the first one that is free\r\n let found = false;\r\n for (let candidateIndex = 0; candidateIndex < gridSize * gridSize * gridSize; candidateIndex++) {\r\n if (!candidatesCells![candidateIndex]) {\r\n cellZ = Math.floor(candidateIndex / (gridSize * gridSize));\r\n cellY = Math.floor((candidateIndex - cellZ * gridSize * gridSize) / gridSize);\r\n cellX = candidateIndex - cellZ * gridSize * gridSize - cellY * gridSize;\r\n cellIndex = this._getIndexinGrid(cellX, cellY, cellZ, gridSize);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (!found) {\r\n // No more free cells\r\n break;\r\n }\r\n }\r\n\r\n if (!candidatesCells![cellIndex]) {\r\n // Cell is free\r\n const x = this._getValueOnGrid(cellX, gridSize, min.x, max.x);\r\n const y = this._getValueOnGrid(cellY, gridSize, min.y, max.y);\r\n const z = this._getValueOnGrid(cellZ, gridSize, min.z, max.z);\r\n this._currentPosition.set(x, y, z);\r\n candidatesCells![cellIndex] = true;\r\n }\r\n } else {\r\n this._currentPosition.set(Math.random() * (max.x - min.x) + min.x, Math.random() * (max.y - min.y) + min.y, Math.random() * (max.z - min.z) + min.z);\r\n }\r\n\r\n // Cast a ray from the random point in an arbitrary direction\r\n const ray = new Ray(this._currentPosition, direction);\r\n\r\n let intersectionCount = 0;\r\n for (let currentFaceIndex = 0; currentFaceIndex < faceCount; currentFaceIndex++) {\r\n // Extract face vertices\r\n this._vertex0.fromArray(this._vertexData.positions, this._vertexData.indices[currentFaceIndex * 3] * 3);\r\n this._vertex1.fromArray(this._vertexData.positions, this._vertexData.indices[currentFaceIndex * 3 + 1] * 3);\r\n this._vertex2.fromArray(this._vertexData.positions, this._vertexData.indices[currentFaceIndex * 3 + 2] * 3);\r\n\r\n const currentIntersectInfo = ray.intersectsTriangle(this._vertex0, this._vertex1, this._vertex2);\r\n\r\n if (currentIntersectInfo && currentIntersectInfo.distance > 0) {\r\n intersectionCount++;\r\n }\r\n }\r\n\r\n if (intersectionCount % 2 === 0) {\r\n // We are outside, try again\r\n index--;\r\n continue;\r\n }\r\n\r\n // Clone the instance\r\n instanceGeometry = this.instance.getConnectedValue(state) as VertexData;\r\n\r\n if (!instanceGeometry || !instanceGeometry.positions || instanceGeometry.positions.length === 0) {\r\n continue;\r\n }\r\n const clone = instanceGeometry.clone();\r\n\r\n if (this.matrix.isConnected) {\r\n const transform = this.matrix.getConnectedValue(state);\r\n state._instantiateWithPositionAndMatrix(clone, this._currentPosition, transform, additionalVertexData);\r\n } else {\r\n const offset = state.adaptInput(this.offset, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.ZeroReadOnly);\r\n const scaling = state.adaptInput(this.scaling, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.OneReadOnly);\r\n const rotation = this.rotation.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n\r\n this._currentPosition.addInPlace(offset);\r\n\r\n state._instantiate(clone, this._currentPosition, rotation, scaling, additionalVertexData);\r\n }\r\n this._currentLoopIndex++;\r\n }\r\n\r\n // Merge\r\n if (additionalVertexData.length) {\r\n if (additionalVertexData.length === 1) {\r\n this._vertexData = additionalVertexData[0];\r\n } else {\r\n // We do not merge the main one as user can use a merge node if wanted\r\n const main = additionalVertexData.splice(0, 1)[0];\r\n this._vertexData = main.merge(additionalVertexData, true, false, true, true);\r\n }\r\n }\r\n\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n return this._vertexData;\r\n };\r\n\r\n // Storage\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n codeString += `${this._codeVariableName}.gridMode = ${this.gridMode ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n serializationObject.gridMode = this.gridMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /** @internal */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n\r\n if (serializationObject.gridMode !== undefined) {\r\n this.gridMode = serializationObject.gridMode;\r\n }\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for instantiateOnVolumeBlock.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterInstantiateOnVolumeBlock(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(\"BABYLON.InstantiateOnVolumeBlock\", InstantiateOnVolumeBlock);\r\n}\r\n"]}
1
+ {"version":3,"file":"instantiateOnVolumeBlock.pure.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.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AuVrC,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,gCAAgC;IAC5C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC;AAChF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock\";\r\nimport { type NodeGeometryConnectionPoint } from \"../../nodeGeometryBlockConnectionPoint\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { type NodeGeometryBuildState } from \"../../nodeGeometryBuildState\";\r\nimport { type INodeGeometryExecutionContext } from \"../../Interfaces/nodeGeometryExecutionContext\";\r\nimport { type VertexData } from \"../../../mesh.vertexData\";\r\nimport { Vector3 } from \"../../../../Maths/math.vector.pure\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../../Decorators/nodeDecorator\";\r\nimport { type Nullable } from \"../../../../types\";\r\nimport { Ray } from \"../../../../Culling/ray.pure\";\r\nimport { extractMinAndMax } from \"../../../../Maths/math.functions\";\r\nimport { type INodeGeometryInstancingContext } from \"../../Interfaces/nodeGeometryInstancingContext\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\n\r\n/**\r\n * Block used to instance geometry inside a geometry\r\n */\r\nexport class InstantiateOnVolumeBlock extends NodeGeometryBlock implements INodeGeometryExecutionContext, INodeGeometryInstancingContext {\r\n private _vertexData: VertexData;\r\n private _currentLoopIndex: number;\r\n private _currentPosition = new Vector3();\r\n private _vertex0 = new Vector3();\r\n private _vertex1 = new Vector3();\r\n private _vertex2 = new Vector3();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block can evaluate context\r\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\r\n */\r\n @editableInPropertyPage(\"Evaluate context\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { notifiers: { rebuild: true } })\r\n public evaluateContext = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that a grid pattern should be used\r\n */\r\n @editableInPropertyPage(\"Grid mode\", PropertyTypeForEdition.Boolean, \"MODES\", { notifiers: { rebuild: true } })\r\n public gridMode = false;\r\n\r\n /**\r\n * Create a new InstantiateOnVolumeBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this.registerInput(\"instance\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\r\n this.registerInput(\"count\", NodeGeometryBlockConnectionPointTypes.Int, true, 256);\r\n this.registerInput(\"matrix\", NodeGeometryBlockConnectionPointTypes.Matrix, true);\r\n this.registerInput(\"offset\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"rotation\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\r\n this.registerInput(\"scaling\", NodeGeometryBlockConnectionPointTypes.Vector3, true, Vector3.One());\r\n this.registerInput(\"gridSize\", NodeGeometryBlockConnectionPointTypes.Int, true, 10);\r\n\r\n this.scaling.acceptedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Float);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\r\n }\r\n\r\n /**\r\n * Gets the current instance index in the current flow\r\n * @returns the current index\r\n */\r\n public getInstanceIndex(): number {\r\n return this._currentLoopIndex;\r\n }\r\n\r\n /**\r\n * Gets the current index in the current flow\r\n * @returns the current index\r\n */\r\n public getExecutionIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current face index in the current flow\r\n * @returns the current face index\r\n */\r\n public getExecutionFaceIndex(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Gets the current loop index in the current flow\r\n * @returns the current loop index\r\n */\r\n public getExecutionLoopIndex(): number {\r\n return this._currentLoopIndex;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual positions\r\n * @returns the value associated with the source\r\n */\r\n public getOverridePositionsContextualValue() {\r\n return this._currentPosition;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"InstantiateOnVolumeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the geometry input component\r\n */\r\n public get geometry(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the instance input component\r\n */\r\n public get instance(): NodeGeometryConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the count input component\r\n */\r\n public get count(): NodeGeometryConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the matrix input component\r\n */\r\n public get matrix(): NodeGeometryConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the offset input component\r\n */\r\n public get offset(): NodeGeometryConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the rotation input component\r\n */\r\n public get rotation(): NodeGeometryConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the scaling input component\r\n */\r\n public get scaling(): NodeGeometryConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the grid size input component\r\n */\r\n public get gridSize(): NodeGeometryConnectionPoint {\r\n return this._inputs[7];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n private _getValueOnGrid(step: number, size: number, min: number, max: number): number {\r\n const cellSize = (max - min) / size;\r\n return min + cellSize / 2 + step * cellSize;\r\n }\r\n\r\n private _getIndexinGrid(x: number, y: number, z: number, size: number) {\r\n return x + y * size + z * size * size;\r\n }\r\n\r\n protected override _buildBlock(state: NodeGeometryBuildState) {\r\n const func = (state: NodeGeometryBuildState) => {\r\n state.pushExecutionContext(this);\r\n state.pushInstancingContext(this);\r\n\r\n this._vertexData = this.geometry.getConnectedValue(state);\r\n state.pushGeometryContext(this._vertexData);\r\n\r\n if (!this._vertexData || !this._vertexData.positions || !this._vertexData.indices || !this.instance.isConnected) {\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n state.restoreGeometryContext();\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n // Processing\r\n let instanceGeometry: Nullable<VertexData>;\r\n const instanceCount = this.count.getConnectedValue(state);\r\n const additionalVertexData: VertexData[] = [];\r\n const boundingInfo = extractMinAndMax(this._vertexData.positions, 0, this._vertexData.positions.length / 3);\r\n const min = boundingInfo.minimum;\r\n const max = boundingInfo.maximum;\r\n const direction = new Vector3(0.5, 0.8, 0.2);\r\n const faceCount = this._vertexData.indices.length / 3;\r\n const gridSize = this.gridSize.getConnectedValue(state);\r\n this._currentLoopIndex = 0;\r\n\r\n let candidatesCells: Array<boolean>;\r\n if (this.gridMode) {\r\n candidatesCells = [];\r\n // Generates the list of candidates cells\r\n for (let index = 0; index < gridSize * gridSize * gridSize; index++) {\r\n candidatesCells[index] = false;\r\n }\r\n }\r\n\r\n for (let index = 0; index < instanceCount; index++) {\r\n if (this.gridMode) {\r\n // Get a random cell\r\n let cellX = Math.floor(Math.random() * gridSize);\r\n let cellY = Math.floor(Math.random() * gridSize);\r\n let cellZ = Math.floor(Math.random() * gridSize);\r\n let cellIndex = this._getIndexinGrid(cellX, cellY, cellZ, gridSize);\r\n\r\n if (candidatesCells![cellIndex]) {\r\n // Find the first one that is free\r\n let found = false;\r\n for (let candidateIndex = 0; candidateIndex < gridSize * gridSize * gridSize; candidateIndex++) {\r\n if (!candidatesCells![candidateIndex]) {\r\n cellZ = Math.floor(candidateIndex / (gridSize * gridSize));\r\n cellY = Math.floor((candidateIndex - cellZ * gridSize * gridSize) / gridSize);\r\n cellX = candidateIndex - cellZ * gridSize * gridSize - cellY * gridSize;\r\n cellIndex = this._getIndexinGrid(cellX, cellY, cellZ, gridSize);\r\n found = true;\r\n break;\r\n }\r\n }\r\n if (!found) {\r\n // No more free cells\r\n break;\r\n }\r\n }\r\n\r\n if (!candidatesCells![cellIndex]) {\r\n // Cell is free\r\n const x = this._getValueOnGrid(cellX, gridSize, min.x, max.x);\r\n const y = this._getValueOnGrid(cellY, gridSize, min.y, max.y);\r\n const z = this._getValueOnGrid(cellZ, gridSize, min.z, max.z);\r\n this._currentPosition.set(x, y, z);\r\n candidatesCells![cellIndex] = true;\r\n }\r\n } else {\r\n this._currentPosition.set(Math.random() * (max.x - min.x) + min.x, Math.random() * (max.y - min.y) + min.y, Math.random() * (max.z - min.z) + min.z);\r\n }\r\n\r\n // Cast a ray from the random point in an arbitrary direction\r\n const ray = new Ray(this._currentPosition, direction);\r\n\r\n let intersectionCount = 0;\r\n for (let currentFaceIndex = 0; currentFaceIndex < faceCount; currentFaceIndex++) {\r\n // Extract face vertices\r\n this._vertex0.fromArray(this._vertexData.positions, this._vertexData.indices[currentFaceIndex * 3] * 3);\r\n this._vertex1.fromArray(this._vertexData.positions, this._vertexData.indices[currentFaceIndex * 3 + 1] * 3);\r\n this._vertex2.fromArray(this._vertexData.positions, this._vertexData.indices[currentFaceIndex * 3 + 2] * 3);\r\n\r\n const currentIntersectInfo = ray.intersectsTriangle(this._vertex0, this._vertex1, this._vertex2);\r\n\r\n if (currentIntersectInfo && currentIntersectInfo.distance > 0) {\r\n intersectionCount++;\r\n }\r\n }\r\n\r\n if (intersectionCount % 2 === 0) {\r\n // We are outside, try again\r\n index--;\r\n continue;\r\n }\r\n\r\n // Clone the instance\r\n instanceGeometry = this.instance.getConnectedValue(state) as VertexData;\r\n\r\n if (!instanceGeometry || !instanceGeometry.positions || instanceGeometry.positions.length === 0) {\r\n continue;\r\n }\r\n const clone = instanceGeometry.clone();\r\n\r\n if (this.matrix.isConnected) {\r\n const transform = this.matrix.getConnectedValue(state);\r\n state._instantiateWithPositionAndMatrix(clone, this._currentPosition, transform, additionalVertexData);\r\n } else {\r\n const offset = state.adaptInput(this.offset, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.ZeroReadOnly);\r\n const scaling = state.adaptInput(this.scaling, NodeGeometryBlockConnectionPointTypes.Vector3, Vector3.OneReadOnly);\r\n const rotation = this.rotation.getConnectedValue(state) || Vector3.ZeroReadOnly;\r\n\r\n this._currentPosition.addInPlace(offset);\r\n\r\n state._instantiate(clone, this._currentPosition, rotation, scaling, additionalVertexData);\r\n }\r\n this._currentLoopIndex++;\r\n }\r\n\r\n // Merge\r\n if (additionalVertexData.length) {\r\n if (additionalVertexData.length === 1) {\r\n this._vertexData = additionalVertexData[0];\r\n } else {\r\n // We do not merge the main one as user can use a merge node if wanted\r\n const main = additionalVertexData.splice(0, 1)[0];\r\n this._vertexData = main.merge(additionalVertexData, true, false, true, true);\r\n }\r\n }\r\n\r\n state.restoreGeometryContext();\r\n state.restoreExecutionContext();\r\n state.restoreInstancingContext();\r\n return this._vertexData;\r\n };\r\n\r\n // Storage\r\n\r\n if (this.evaluateContext) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\r\n codeString += `${this._codeVariableName}.gridMode = ${this.gridMode ? \"true\" : \"false\"};\\n`;\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.evaluateContext = this.evaluateContext;\r\n serializationObject.gridMode = this.gridMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /** @internal */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.evaluateContext !== undefined) {\r\n this.evaluateContext = serializationObject.evaluateContext;\r\n }\r\n\r\n if (serializationObject.gridMode !== undefined) {\r\n this.gridMode = serializationObject.gridMode;\r\n }\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for instantiateOnVolumeBlock.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterInstantiateOnVolumeBlock(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(\"BABYLON.InstantiateOnVolumeBlock\", InstantiateOnVolumeBlock);\r\n}\r\n"]}
@@ -177,10 +177,10 @@ let GeometryOptimizeBlock = (() => {
177
177
  else {
178
178
  newVertexData.indices = indices;
179
179
  }
180
+ state.restoreGeometryContext();
181
+ state.restoreExecutionContext();
180
182
  return newVertexData;
181
183
  };
182
- state.restoreGeometryContext();
183
- state.restoreExecutionContext();
184
184
  if (this.evaluateContext) {
185
185
  this.output._storedFunction = func;
186
186
  }