@babylonjs/core 6.38.1 → 6.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (710) hide show
  1. package/Actions/action.js +3 -1
  2. package/Actions/action.js.map +1 -1
  3. package/Actions/condition.js +1 -0
  4. package/Actions/condition.js.map +1 -1
  5. package/Actions/directActions.d.ts +2 -2
  6. package/Actions/directActions.js +2 -2
  7. package/Actions/directActions.js.map +1 -1
  8. package/Animations/pathCursor.js +1 -0
  9. package/Animations/pathCursor.js.map +1 -1
  10. package/Animations/runtimeAnimation.js +1 -1
  11. package/Animations/runtimeAnimation.js.map +1 -1
  12. package/Audio/audioEngine.js +5 -0
  13. package/Audio/audioEngine.js.map +1 -1
  14. package/Behaviors/Cameras/autoRotationBehavior.d.ts +3 -0
  15. package/Behaviors/Cameras/autoRotationBehavior.js +3 -0
  16. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  17. package/Behaviors/Meshes/pointerDragBehavior.d.ts +1 -0
  18. package/Behaviors/Meshes/pointerDragBehavior.js +2 -0
  19. package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
  20. package/Behaviors/Meshes/sixDofDragBehavior.js +14 -20
  21. package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
  22. package/Bones/bone.d.ts +2 -0
  23. package/Bones/bone.js +2 -0
  24. package/Bones/bone.js.map +1 -1
  25. package/Cameras/Inputs/BaseCameraPointersInput.d.ts +11 -11
  26. package/Cameras/Inputs/BaseCameraPointersInput.js +12 -12
  27. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  28. package/Cameras/Inputs/arcRotateCameraPointersInput.d.ts +9 -9
  29. package/Cameras/Inputs/arcRotateCameraPointersInput.js +9 -9
  30. package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
  31. package/Cameras/Inputs/followCameraKeyboardMoveInput.d.ts +3 -0
  32. package/Cameras/Inputs/followCameraKeyboardMoveInput.js +3 -0
  33. package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
  34. package/Cameras/Inputs/freeCameraMouseInput.d.ts +1 -1
  35. package/Cameras/Inputs/freeCameraMouseInput.js +1 -1
  36. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  37. package/Cameras/VR/vrExperienceHelper.d.ts +2 -2
  38. package/Cameras/VR/vrExperienceHelper.js +2 -2
  39. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  40. package/Cameras/arcRotateCamera.d.ts +2 -0
  41. package/Cameras/arcRotateCamera.js +2 -0
  42. package/Cameras/arcRotateCamera.js.map +1 -1
  43. package/Cameras/camera.d.ts +2 -0
  44. package/Cameras/camera.js +4 -0
  45. package/Cameras/camera.js.map +1 -1
  46. package/Cameras/followCamera.d.ts +1 -0
  47. package/Cameras/followCamera.js +1 -0
  48. package/Cameras/followCamera.js.map +1 -1
  49. package/Culling/Octrees/octree.d.ts +4 -4
  50. package/Culling/Octrees/octree.js +4 -4
  51. package/Culling/Octrees/octree.js.map +1 -1
  52. package/Debug/debugLayer.d.ts +4 -1
  53. package/Debug/debugLayer.js +4 -1
  54. package/Debug/debugLayer.js.map +1 -1
  55. package/Debug/physicsViewer.d.ts +6 -1
  56. package/Debug/physicsViewer.js +6 -1
  57. package/Debug/physicsViewer.js.map +1 -1
  58. package/Decorators/nodeDecorator.d.ts +5 -4
  59. package/Decorators/nodeDecorator.js +5 -4
  60. package/Decorators/nodeDecorator.js.map +1 -1
  61. package/DeviceInput/eventFactory.d.ts +2 -0
  62. package/DeviceInput/eventFactory.js +3 -0
  63. package/DeviceInput/eventFactory.js.map +1 -1
  64. package/DeviceInput/webDeviceInputSystem.js +3 -0
  65. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  66. package/Engines/Extensions/engine.multiview.js +2 -0
  67. package/Engines/Extensions/engine.multiview.js.map +1 -1
  68. package/Engines/Native/nativeDataStream.d.ts +32 -0
  69. package/Engines/Native/nativeDataStream.js +32 -0
  70. package/Engines/Native/nativeDataStream.js.map +1 -1
  71. package/Engines/Native/nativePipelineContext.d.ts +0 -3
  72. package/Engines/Native/nativePipelineContext.js +0 -3
  73. package/Engines/Native/nativePipelineContext.js.map +1 -1
  74. package/Engines/Native/nativeRenderTargetWrapper.js +2 -0
  75. package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
  76. package/Engines/WebGL/webGLHardwareTexture.js +1 -0
  77. package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
  78. package/Engines/WebGL/webGLPipelineContext.d.ts +0 -3
  79. package/Engines/WebGL/webGLPipelineContext.js +0 -3
  80. package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
  81. package/Engines/WebGL/webGLRenderTargetWrapper.js +1 -0
  82. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  83. package/Engines/WebGPU/Extensions/engine.readTexture.js +1 -0
  84. package/Engines/WebGPU/Extensions/engine.readTexture.js.map +1 -1
  85. package/Engines/WebGPU/webgpuCacheBindGroups.d.ts +1 -0
  86. package/Engines/WebGPU/webgpuCacheBindGroups.js +1 -0
  87. package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
  88. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +3 -0
  89. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  90. package/Engines/WebGPU/webgpuPipelineContext.d.ts +0 -3
  91. package/Engines/WebGPU/webgpuPipelineContext.js +0 -3
  92. package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
  93. package/Engines/WebGPU/webgpuShaderProcessingContext.js +1 -0
  94. package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
  95. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +1 -1
  96. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +11 -2
  97. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  98. package/Engines/WebGPU/webgpuTextureHelper.js +22 -0
  99. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  100. package/Engines/WebGPU/webgpuTextureManager.js +2 -1
  101. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  102. package/Engines/WebGPU/webgpuTintWASM.d.ts +1 -1
  103. package/Engines/WebGPU/webgpuTintWASM.js +5 -5
  104. package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
  105. package/Engines/engine.d.ts +1 -0
  106. package/Engines/engine.js +1 -0
  107. package/Engines/engine.js.map +1 -1
  108. package/Engines/nativeEngine.d.ts +4 -0
  109. package/Engines/nativeEngine.js +5 -0
  110. package/Engines/nativeEngine.js.map +1 -1
  111. package/Engines/thinEngine.js +7 -2
  112. package/Engines/thinEngine.js.map +1 -1
  113. package/Engines/webgpuEngine.d.ts +1 -1
  114. package/Engines/webgpuEngine.js +17 -1
  115. package/Engines/webgpuEngine.js.map +1 -1
  116. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +214 -2
  117. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +214 -6
  118. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
  119. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +15 -0
  120. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +9 -0
  121. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  122. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +6 -6
  123. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  124. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +4 -0
  125. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +4 -0
  126. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  127. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +17 -1
  128. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +14 -1
  129. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  130. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +9 -0
  131. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +9 -0
  132. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
  133. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.d.ts +5 -0
  134. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js +5 -0
  135. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +1 -1
  136. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +16 -1
  137. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +13 -1
  138. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
  139. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +12 -1
  140. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +12 -1
  141. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  142. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.d.ts +18 -0
  143. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js +9 -0
  144. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js.map +1 -1
  145. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +12 -0
  146. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +9 -0
  147. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  148. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +15 -1
  149. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +12 -1
  150. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  151. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +18 -2
  152. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +15 -4
  153. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  154. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +6 -0
  155. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +6 -0
  156. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  157. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +6 -0
  158. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +6 -0
  159. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  160. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +5 -2
  161. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +4 -1
  162. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  163. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +15 -1
  164. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +12 -1
  165. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  166. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +4 -1
  167. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +3 -0
  168. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  169. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +3 -0
  170. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +3 -0
  171. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  172. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +3 -0
  173. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +3 -0
  174. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  175. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +3 -0
  176. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +3 -0
  177. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  178. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +14 -1
  179. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +11 -1
  180. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  181. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +3 -0
  182. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +3 -0
  183. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  184. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +3 -0
  185. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +3 -0
  186. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  187. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +15 -2
  188. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +12 -4
  189. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  190. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.d.ts +14 -2
  191. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js +11 -4
  192. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
  193. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +15 -2
  194. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +12 -4
  195. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  196. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -0
  197. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +3 -0
  198. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  199. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +6 -0
  200. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +6 -0
  201. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +1 -1
  202. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +15 -2
  203. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +12 -3
  204. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  205. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +18 -1
  206. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +15 -1
  207. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  208. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +6 -0
  209. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +6 -0
  210. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  211. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.d.ts +14 -2
  212. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +11 -4
  213. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
  214. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +15 -1
  215. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +12 -1
  216. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  217. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +14 -1
  218. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +11 -1
  219. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  220. package/FlowGraph/flowGraph.d.ts +16 -8
  221. package/FlowGraph/flowGraph.js +13 -8
  222. package/FlowGraph/flowGraph.js.map +1 -1
  223. package/FlowGraph/flowGraphBlock.d.ts +54 -5
  224. package/FlowGraph/flowGraphBlock.js +50 -11
  225. package/FlowGraph/flowGraphBlock.js.map +1 -1
  226. package/FlowGraph/flowGraphConnection.d.ts +10 -6
  227. package/FlowGraph/flowGraphConnection.js +10 -6
  228. package/FlowGraph/flowGraphConnection.js.map +1 -1
  229. package/FlowGraph/flowGraphContext.d.ts +10 -8
  230. package/FlowGraph/flowGraphContext.js +10 -8
  231. package/FlowGraph/flowGraphContext.js.map +1 -1
  232. package/FlowGraph/flowGraphCoordinator.d.ts +27 -1
  233. package/FlowGraph/flowGraphCoordinator.js +18 -2
  234. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  235. package/FlowGraph/flowGraphDataConnection.d.ts +26 -1
  236. package/FlowGraph/flowGraphDataConnection.js +23 -1
  237. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  238. package/FlowGraph/flowGraphExecutionBlock.d.ts +27 -1
  239. package/FlowGraph/flowGraphExecutionBlock.js +22 -4
  240. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  241. package/FlowGraph/flowGraphRichTypes.d.ts +24 -1
  242. package/FlowGraph/flowGraphRichTypes.js +18 -1
  243. package/FlowGraph/flowGraphRichTypes.js.map +1 -1
  244. package/FlowGraph/flowGraphSignalConnection.d.ts +2 -0
  245. package/FlowGraph/flowGraphSignalConnection.js +2 -0
  246. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  247. package/Gamepads/gamepad.d.ts +2 -2
  248. package/Gamepads/gamepad.js +2 -2
  249. package/Gamepads/gamepad.js.map +1 -1
  250. package/Gamepads/gamepadSceneComponent.js +2 -0
  251. package/Gamepads/gamepadSceneComponent.js.map +1 -1
  252. package/Gizmos/axisScaleGizmo.d.ts +2 -0
  253. package/Gizmos/axisScaleGizmo.js +2 -0
  254. package/Gizmos/axisScaleGizmo.js.map +1 -1
  255. package/Gizmos/boundingBoxGizmo.d.ts +19 -0
  256. package/Gizmos/boundingBoxGizmo.js +36 -15
  257. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  258. package/Gizmos/cameraGizmo.js +1 -0
  259. package/Gizmos/cameraGizmo.js.map +1 -1
  260. package/Gizmos/gizmo.d.ts +4 -1
  261. package/Gizmos/gizmo.js +1 -0
  262. package/Gizmos/gizmo.js.map +1 -1
  263. package/Gizmos/gizmoManager.d.ts +18 -0
  264. package/Gizmos/gizmoManager.js +34 -0
  265. package/Gizmos/gizmoManager.js.map +1 -1
  266. package/Gizmos/lightGizmo.d.ts +1 -0
  267. package/Gizmos/lightGizmo.js +1 -0
  268. package/Gizmos/lightGizmo.js.map +1 -1
  269. package/Gizmos/planeRotationGizmo.d.ts +2 -0
  270. package/Gizmos/planeRotationGizmo.js +2 -0
  271. package/Gizmos/planeRotationGizmo.js.map +1 -1
  272. package/Gizmos/positionGizmo.d.ts +11 -0
  273. package/Gizmos/positionGizmo.js +19 -0
  274. package/Gizmos/positionGizmo.js.map +1 -1
  275. package/Gizmos/rotationGizmo.d.ts +14 -0
  276. package/Gizmos/rotationGizmo.js +14 -0
  277. package/Gizmos/rotationGizmo.js.map +1 -1
  278. package/Gizmos/scaleGizmo.d.ts +18 -1
  279. package/Gizmos/scaleGizmo.js +19 -1
  280. package/Gizmos/scaleGizmo.js.map +1 -1
  281. package/Helpers/environmentHelper.d.ts +4 -2
  282. package/Helpers/environmentHelper.js +4 -2
  283. package/Helpers/environmentHelper.js.map +1 -1
  284. package/Layers/effectLayer.d.ts +1 -0
  285. package/Layers/effectLayer.js +1 -0
  286. package/Layers/effectLayer.js.map +1 -1
  287. package/Layers/glowLayer.d.ts +3 -1
  288. package/Layers/glowLayer.js +3 -1
  289. package/Layers/glowLayer.js.map +1 -1
  290. package/Layers/highlightLayer.d.ts +3 -2
  291. package/Layers/highlightLayer.js +3 -2
  292. package/Layers/highlightLayer.js.map +1 -1
  293. package/Lights/light.d.ts +1 -1
  294. package/Lights/light.js +1 -1
  295. package/Lights/light.js.map +1 -1
  296. package/Loading/sceneLoader.d.ts +9 -0
  297. package/Loading/sceneLoader.js +11 -0
  298. package/Loading/sceneLoader.js.map +1 -1
  299. package/Materials/Background/backgroundMaterial.d.ts +2 -2
  300. package/Materials/Background/backgroundMaterial.js +2 -2
  301. package/Materials/Background/backgroundMaterial.js.map +1 -1
  302. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +72 -0
  303. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +230 -0
  304. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -0
  305. package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +1 -1
  306. package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
  307. package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +2 -2
  308. package/Materials/GreasedLine/greasedLinePluginMaterial.js +2 -2
  309. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  310. package/Materials/GreasedLine/greasedLineSimpleMaterial.d.ts +0 -1
  311. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +0 -1
  312. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  313. package/Materials/Node/Blocks/Dual/index.d.ts +1 -0
  314. package/Materials/Node/Blocks/Dual/index.js +1 -0
  315. package/Materials/Node/Blocks/Dual/index.js.map +1 -1
  316. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +7 -1
  317. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +6 -1
  318. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  319. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +1 -0
  320. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
  321. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js +1 -0
  322. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
  323. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +1 -0
  324. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  325. package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +1 -1
  326. package/Materials/Node/Blocks/Input/prePassTextureBlock.js +1 -1
  327. package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
  328. package/Materials/Node/Blocks/Teleport/teleportInBlock.d.ts +3 -1
  329. package/Materials/Node/Blocks/Teleport/teleportInBlock.js +3 -1
  330. package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
  331. package/Materials/Node/Blocks/triPlanarBlock.d.ts +1 -0
  332. package/Materials/Node/Blocks/triPlanarBlock.js +1 -0
  333. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  334. package/Materials/Node/Blocks/worleyNoise3DBlock.d.ts +2 -0
  335. package/Materials/Node/Blocks/worleyNoise3DBlock.js +2 -0
  336. package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
  337. package/Materials/Node/nodeMaterial.d.ts +11 -3
  338. package/Materials/Node/nodeMaterial.js +15 -3
  339. package/Materials/Node/nodeMaterial.js.map +1 -1
  340. package/Materials/Node/nodeMaterialBlock.d.ts +3 -1
  341. package/Materials/Node/nodeMaterialBlock.js +4 -1
  342. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  343. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +1 -0
  344. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  345. package/Materials/Node/nodeMaterialBuildStateSharedData.js +1 -0
  346. package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
  347. package/Materials/PBR/pbrBaseMaterial.d.ts +10 -9
  348. package/Materials/PBR/pbrBaseMaterial.js +10 -9
  349. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  350. package/Materials/PBR/pbrMaterial.d.ts +2 -1
  351. package/Materials/PBR/pbrMaterial.js +3 -2
  352. package/Materials/PBR/pbrMaterial.js.map +1 -1
  353. package/Materials/PBR/pbrMetallicRoughnessMaterial.d.ts +7 -4
  354. package/Materials/PBR/pbrMetallicRoughnessMaterial.js +7 -4
  355. package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
  356. package/Materials/PBR/pbrSpecularGlossinessMaterial.d.ts +7 -4
  357. package/Materials/PBR/pbrSpecularGlossinessMaterial.js +7 -4
  358. package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
  359. package/Materials/Textures/Loaders/envTextureLoader.js +1 -0
  360. package/Materials/Textures/Loaders/envTextureLoader.js.map +1 -1
  361. package/Materials/Textures/Loaders/hdrTextureLoader.js +1 -0
  362. package/Materials/Textures/Loaders/hdrTextureLoader.js.map +1 -1
  363. package/Materials/Textures/Loaders/tgaTextureLoader.js +1 -0
  364. package/Materials/Textures/Loaders/tgaTextureLoader.js.map +1 -1
  365. package/Materials/Textures/Packer/packer.d.ts +0 -1
  366. package/Materials/Textures/Packer/packer.js +0 -1
  367. package/Materials/Textures/Packer/packer.js.map +1 -1
  368. package/Materials/Textures/Procedurals/noiseProceduralTexture.d.ts +1 -1
  369. package/Materials/Textures/Procedurals/noiseProceduralTexture.js +1 -1
  370. package/Materials/Textures/Procedurals/noiseProceduralTexture.js.map +1 -1
  371. package/Materials/Textures/baseTexture.js +3 -0
  372. package/Materials/Textures/baseTexture.js.map +1 -1
  373. package/Materials/Textures/colorGradingTexture.d.ts +4 -1
  374. package/Materials/Textures/colorGradingTexture.js +4 -1
  375. package/Materials/Textures/colorGradingTexture.js.map +1 -1
  376. package/Materials/Textures/equiRectangularCubeTexture.d.ts +1 -0
  377. package/Materials/Textures/equiRectangularCubeTexture.js +1 -0
  378. package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
  379. package/Materials/Textures/hdrCubeTexture.d.ts +3 -2
  380. package/Materials/Textures/hdrCubeTexture.js +3 -2
  381. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  382. package/Materials/Textures/htmlElementTexture.d.ts +1 -1
  383. package/Materials/Textures/htmlElementTexture.js +1 -1
  384. package/Materials/Textures/htmlElementTexture.js.map +1 -1
  385. package/Materials/Textures/multiRenderTarget.d.ts +1 -1
  386. package/Materials/Textures/multiRenderTarget.js +1 -1
  387. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  388. package/Materials/Textures/texture.d.ts +4 -1
  389. package/Materials/Textures/texture.js +4 -1
  390. package/Materials/Textures/texture.js.map +1 -1
  391. package/Materials/Textures/thinRenderTargetTexture.d.ts +1 -1
  392. package/Materials/Textures/thinRenderTargetTexture.js +1 -1
  393. package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
  394. package/Materials/Textures/thinTexture.js +3 -0
  395. package/Materials/Textures/thinTexture.js.map +1 -1
  396. package/Materials/index.d.ts +1 -0
  397. package/Materials/index.js +1 -0
  398. package/Materials/index.js.map +1 -1
  399. package/Materials/material.d.ts +2 -1
  400. package/Materials/material.decalMapConfiguration.d.ts +0 -5
  401. package/Materials/material.decalMapConfiguration.js +5 -5
  402. package/Materials/material.decalMapConfiguration.js.map +1 -1
  403. package/Materials/material.js +3 -2
  404. package/Materials/material.js.map +1 -1
  405. package/Materials/materialHelper.d.ts +1 -1
  406. package/Materials/materialHelper.js +4 -3
  407. package/Materials/materialHelper.js.map +1 -1
  408. package/Materials/materialPluginManager.js +1 -0
  409. package/Materials/materialPluginManager.js.map +1 -1
  410. package/Materials/standardMaterial.d.ts +2 -2
  411. package/Materials/standardMaterial.js +3 -3
  412. package/Materials/standardMaterial.js.map +1 -1
  413. package/Materials/uniformBuffer.js +2 -1
  414. package/Materials/uniformBuffer.js.map +1 -1
  415. package/Maths/math.like.d.ts +3 -0
  416. package/Maths/math.like.js.map +1 -1
  417. package/Maths/math.path.d.ts +2 -1
  418. package/Maths/math.path.js +2 -1
  419. package/Maths/math.path.js.map +1 -1
  420. package/Maths/math.polar.d.ts +3 -2
  421. package/Maths/math.polar.js +8 -2
  422. package/Maths/math.polar.js.map +1 -1
  423. package/Maths/math.vector.d.ts +12 -5
  424. package/Maths/math.vector.js +12 -5
  425. package/Maths/math.vector.js.map +1 -1
  426. package/Meshes/Builders/hemisphereBuilder.js +1 -0
  427. package/Meshes/Builders/hemisphereBuilder.js.map +1 -1
  428. package/Meshes/Builders/textBuilder.d.ts +26 -5
  429. package/Meshes/Builders/textBuilder.js +26 -5
  430. package/Meshes/Builders/textBuilder.js.map +1 -1
  431. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +84 -0
  432. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +288 -0
  433. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -0
  434. package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +2 -0
  435. package/Meshes/GreasedLine/greasedLineBaseMesh.js +2 -0
  436. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  437. package/Meshes/GreasedLine/greasedLineRibbonMesh.d.ts +2 -0
  438. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +9 -0
  439. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  440. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +1 -1
  441. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +1 -1
  442. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  443. package/Meshes/Node/Blocks/geometryCurveBlock.d.ts +92 -0
  444. package/Meshes/Node/Blocks/geometryCurveBlock.js +292 -0
  445. package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -0
  446. package/Meshes/Node/Blocks/noiseBlock.d.ts +5 -3
  447. package/Meshes/Node/Blocks/noiseBlock.js +5 -3
  448. package/Meshes/Node/Blocks/noiseBlock.js.map +1 -1
  449. package/Meshes/Node/index.d.ts +1 -0
  450. package/Meshes/Node/index.js +1 -0
  451. package/Meshes/Node/index.js.map +1 -1
  452. package/Meshes/Node/nodeGeometry.d.ts +6 -2
  453. package/Meshes/Node/nodeGeometry.js +7 -2
  454. package/Meshes/Node/nodeGeometry.js.map +1 -1
  455. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +1 -0
  456. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  457. package/Meshes/Node/nodeGeometryBuildState.js +1 -0
  458. package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
  459. package/Meshes/abstractMesh.d.ts +1 -0
  460. package/Meshes/abstractMesh.js +3 -0
  461. package/Meshes/abstractMesh.js.map +1 -1
  462. package/Meshes/csg.d.ts +7 -1
  463. package/Meshes/csg.js +9 -1
  464. package/Meshes/csg.js.map +1 -1
  465. package/Meshes/geodesicMesh.d.ts +32 -1
  466. package/Meshes/geodesicMesh.js +17 -1
  467. package/Meshes/geodesicMesh.js.map +1 -1
  468. package/Meshes/index.d.ts +1 -0
  469. package/Meshes/index.js +1 -0
  470. package/Meshes/index.js.map +1 -1
  471. package/Meshes/instancedMesh.d.ts +34 -17
  472. package/Meshes/instancedMesh.js +34 -17
  473. package/Meshes/instancedMesh.js.map +1 -1
  474. package/Meshes/linesMesh.d.ts +6 -5
  475. package/Meshes/linesMesh.js +6 -5
  476. package/Meshes/linesMesh.js.map +1 -1
  477. package/Meshes/mesh.d.ts +1 -0
  478. package/Meshes/mesh.js +1 -0
  479. package/Meshes/mesh.js.map +1 -1
  480. package/Meshes/mesh.vertexData.d.ts +0 -145
  481. package/Meshes/mesh.vertexData.js +0 -145
  482. package/Meshes/mesh.vertexData.js.map +1 -1
  483. package/Meshes/transformNode.d.ts +1 -1
  484. package/Meshes/transformNode.js +19 -1
  485. package/Meshes/transformNode.js.map +1 -1
  486. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +1 -0
  487. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +1 -0
  488. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  489. package/Misc/HighDynamicRange/hdr.d.ts +1 -0
  490. package/Misc/HighDynamicRange/hdr.js +8 -0
  491. package/Misc/HighDynamicRange/hdr.js.map +1 -1
  492. package/Misc/HighDynamicRange/panoramaToCubemap.d.ts +1 -0
  493. package/Misc/HighDynamicRange/panoramaToCubemap.js +3 -0
  494. package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
  495. package/Misc/assetsManager.d.ts +3 -0
  496. package/Misc/assetsManager.js +3 -0
  497. package/Misc/assetsManager.js.map +1 -1
  498. package/Misc/basis.js +1 -0
  499. package/Misc/basis.js.map +1 -1
  500. package/Misc/decorators.d.ts +2 -0
  501. package/Misc/decorators.js +3 -1
  502. package/Misc/decorators.js.map +1 -1
  503. package/Misc/fileTools.js +2 -0
  504. package/Misc/fileTools.js.map +1 -1
  505. package/Misc/filesInput.d.ts +7 -2
  506. package/Misc/filesInput.js +7 -2
  507. package/Misc/filesInput.js.map +1 -1
  508. package/Misc/greasedLineTools.d.ts +6 -1
  509. package/Misc/greasedLineTools.js +6 -1
  510. package/Misc/greasedLineTools.js.map +1 -1
  511. package/Misc/textureTools.d.ts +2 -0
  512. package/Misc/textureTools.js +2 -0
  513. package/Misc/textureTools.js.map +1 -1
  514. package/Misc/timer.d.ts +2 -1
  515. package/Misc/timer.js +1 -0
  516. package/Misc/timer.js.map +1 -1
  517. package/Misc/tools.d.ts +5 -1
  518. package/Misc/tools.js +9 -1
  519. package/Misc/tools.js.map +1 -1
  520. package/Misc/videoRecorder.d.ts +4 -1
  521. package/Misc/videoRecorder.js +11 -5
  522. package/Misc/videoRecorder.js.map +1 -1
  523. package/Misc/webRequest.d.ts +3 -0
  524. package/Misc/webRequest.js +4 -1
  525. package/Misc/webRequest.js.map +1 -1
  526. package/Morph/morphTargetManager.d.ts +11 -0
  527. package/Morph/morphTargetManager.js +22 -2
  528. package/Morph/morphTargetManager.js.map +1 -1
  529. package/Particles/EmitterTypes/customParticleEmitter.js +10 -2
  530. package/Particles/EmitterTypes/customParticleEmitter.js.map +1 -1
  531. package/Particles/EmitterTypes/cylinderParticleEmitter.d.ts +3 -1
  532. package/Particles/EmitterTypes/cylinderParticleEmitter.js +7 -1
  533. package/Particles/EmitterTypes/cylinderParticleEmitter.js.map +1 -1
  534. package/Particles/IParticleSystem.d.ts +2 -2
  535. package/Particles/IParticleSystem.js.map +1 -1
  536. package/Particles/gpuParticleSystem.js +1 -0
  537. package/Particles/gpuParticleSystem.js.map +1 -1
  538. package/Particles/particleSystem.d.ts +1 -2
  539. package/Particles/particleSystem.js +5 -1
  540. package/Particles/particleSystem.js.map +1 -1
  541. package/Particles/solidParticleSystem.d.ts +1 -1
  542. package/Particles/solidParticleSystem.js +1 -1
  543. package/Particles/solidParticleSystem.js.map +1 -1
  544. package/Physics/physicsHelper.d.ts +3 -2
  545. package/Physics/physicsHelper.js +5 -4
  546. package/Physics/physicsHelper.js.map +1 -1
  547. package/Physics/physicsRaycastResult.d.ts +2 -1
  548. package/Physics/physicsRaycastResult.js +2 -1
  549. package/Physics/physicsRaycastResult.js.map +1 -1
  550. package/Physics/v1/Plugins/ammoJSPlugin.d.ts +5 -0
  551. package/Physics/v1/Plugins/ammoJSPlugin.js +6 -0
  552. package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
  553. package/Physics/v1/physicsEngine.d.ts +2 -0
  554. package/Physics/v1/physicsEngine.js +2 -0
  555. package/Physics/v1/physicsEngine.js.map +1 -1
  556. package/Physics/v1/physicsImpostor.d.ts +2 -3
  557. package/Physics/v1/physicsImpostor.js +2 -3
  558. package/Physics/v1/physicsImpostor.js.map +1 -1
  559. package/Physics/v2/IPhysicsEnginePlugin.d.ts +1 -0
  560. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  561. package/Physics/v2/Plugins/havokPlugin.d.ts +61 -10
  562. package/Physics/v2/Plugins/havokPlugin.js +89 -10
  563. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  564. package/Physics/v2/physicsBody.d.ts +41 -3
  565. package/Physics/v2/physicsBody.js +42 -9
  566. package/Physics/v2/physicsBody.js.map +1 -1
  567. package/Physics/v2/physicsConstraint.d.ts +0 -2
  568. package/Physics/v2/physicsConstraint.js +0 -2
  569. package/Physics/v2/physicsConstraint.js.map +1 -1
  570. package/Physics/v2/physicsEngine.d.ts +5 -3
  571. package/Physics/v2/physicsEngine.js +6 -3
  572. package/Physics/v2/physicsEngine.js.map +1 -1
  573. package/Physics/v2/physicsShape.d.ts +2 -0
  574. package/Physics/v2/physicsShape.js +5 -0
  575. package/Physics/v2/physicsShape.js.map +1 -1
  576. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -1
  577. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +1 -1
  578. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  579. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.d.ts +1 -1
  580. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +1 -1
  581. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
  582. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.d.ts +1 -1
  583. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +1 -1
  584. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  585. package/PostProcesses/motionBlurPostProcess.d.ts +1 -0
  586. package/PostProcesses/motionBlurPostProcess.js +1 -0
  587. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  588. package/PostProcesses/postProcess.d.ts +0 -1
  589. package/PostProcesses/postProcess.js +0 -1
  590. package/PostProcesses/postProcess.js.map +1 -1
  591. package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +1 -1
  592. package/PostProcesses/volumetricLightScatteringPostProcess.js +1 -1
  593. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  594. package/Rendering/GlobalIllumination/giRSMManager.d.ts +2 -1
  595. package/Rendering/GlobalIllumination/giRSMManager.js +5 -2
  596. package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
  597. package/Rendering/depthRendererSceneComponent.js +1 -0
  598. package/Rendering/depthRendererSceneComponent.js.map +1 -1
  599. package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +1 -1
  600. package/Rendering/fluidRenderer/fluidRenderingObject.js +1 -1
  601. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  602. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.d.ts +1 -1
  603. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +1 -1
  604. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
  605. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +1 -1
  606. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +1 -1
  607. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
  608. package/Rendering/geometryBufferRenderer.d.ts +2 -2
  609. package/Rendering/geometryBufferRenderer.js +2 -2
  610. package/Rendering/geometryBufferRenderer.js.map +1 -1
  611. package/Rendering/index.d.ts +0 -1
  612. package/Rendering/index.js +0 -1
  613. package/Rendering/index.js.map +1 -1
  614. package/Rendering/prePassRenderer.d.ts +2 -2
  615. package/Rendering/prePassRenderer.js +2 -2
  616. package/Rendering/prePassRenderer.js.map +1 -1
  617. package/Rendering/reflectiveShadowMap.d.ts +4 -0
  618. package/Rendering/reflectiveShadowMap.js +7 -0
  619. package/Rendering/reflectiveShadowMap.js.map +1 -1
  620. package/Rendering/renderingGroup.d.ts +0 -1
  621. package/Rendering/renderingGroup.js +3 -4
  622. package/Rendering/renderingGroup.js.map +1 -1
  623. package/Rendering/renderingManager.d.ts +2 -1
  624. package/Rendering/renderingManager.js +2 -1
  625. package/Rendering/renderingManager.js.map +1 -1
  626. package/Rendering/subSurfaceConfiguration.d.ts +1 -0
  627. package/Rendering/subSurfaceConfiguration.js +1 -0
  628. package/Rendering/subSurfaceConfiguration.js.map +1 -1
  629. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.d.ts +7 -0
  630. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js +13 -0
  631. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -0
  632. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.d.ts +5 -0
  633. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +10 -0
  634. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -0
  635. package/Shaders/ShadersInclude/morphTargetsVertex.js +8 -5
  636. package/Shaders/ShadersInclude/morphTargetsVertex.js.map +1 -1
  637. package/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js +2 -0
  638. package/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js.map +1 -1
  639. package/Shaders/gaussianSplatting.fragment.d.ts +11 -0
  640. package/Shaders/gaussianSplatting.fragment.js +27 -0
  641. package/Shaders/gaussianSplatting.fragment.js.map +1 -0
  642. package/Shaders/gaussianSplatting.vertex.d.ts +13 -0
  643. package/Shaders/gaussianSplatting.vertex.js +49 -0
  644. package/Shaders/gaussianSplatting.vertex.js.map +1 -0
  645. package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js +5 -1
  646. package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js.map +1 -1
  647. package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js +2 -0
  648. package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js.map +1 -1
  649. package/XR/features/WebXRAbstractFeature.d.ts +7 -1
  650. package/XR/features/WebXRAbstractFeature.js +20 -4
  651. package/XR/features/WebXRAbstractFeature.js.map +1 -1
  652. package/XR/features/WebXRAnchorSystem.d.ts +1 -0
  653. package/XR/features/WebXRAnchorSystem.js +1 -0
  654. package/XR/features/WebXRAnchorSystem.js.map +1 -1
  655. package/XR/features/WebXRControllerTeleportation.js +9 -2
  656. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  657. package/XR/features/WebXRDepthSensing.d.ts +1 -1
  658. package/XR/features/WebXRDepthSensing.js +1 -1
  659. package/XR/features/WebXRDepthSensing.js.map +1 -1
  660. package/XR/features/WebXREyeTracking.js +1 -1
  661. package/XR/features/WebXREyeTracking.js.map +1 -1
  662. package/XR/features/WebXRHandTracking.d.ts +4 -1
  663. package/XR/features/WebXRHandTracking.js +18 -4
  664. package/XR/features/WebXRHandTracking.js.map +1 -1
  665. package/XR/features/WebXRHitTest.js +1 -1
  666. package/XR/features/WebXRHitTest.js.map +1 -1
  667. package/XR/features/WebXRNearInteraction.d.ts +6 -3
  668. package/XR/features/WebXRNearInteraction.js +9 -4
  669. package/XR/features/WebXRNearInteraction.js.map +1 -1
  670. package/XR/features/WebXRPlaneDetector.d.ts +2 -0
  671. package/XR/features/WebXRPlaneDetector.js +2 -0
  672. package/XR/features/WebXRPlaneDetector.js.map +1 -1
  673. package/XR/features/WebXRRawCameraAccess.d.ts +2 -0
  674. package/XR/features/WebXRRawCameraAccess.js +2 -0
  675. package/XR/features/WebXRRawCameraAccess.js.map +1 -1
  676. package/XR/features/WebXRSpaceWarp.d.ts +0 -27
  677. package/XR/features/WebXRSpaceWarp.js +0 -27
  678. package/XR/features/WebXRSpaceWarp.js.map +1 -1
  679. package/XR/index.d.ts +1 -0
  680. package/XR/index.js +1 -0
  681. package/XR/index.js.map +1 -1
  682. package/XR/motionController/webXROculusTouchMotionController.d.ts +1 -0
  683. package/XR/motionController/webXROculusTouchMotionController.js +1 -0
  684. package/XR/motionController/webXROculusTouchMotionController.js.map +1 -1
  685. package/XR/webXRCamera.d.ts +2 -0
  686. package/XR/webXRCamera.js +8 -6
  687. package/XR/webXRCamera.js.map +1 -1
  688. package/XR/webXRExperienceHelper.js +1 -0
  689. package/XR/webXRExperienceHelper.js.map +1 -1
  690. package/XR/webXRInput.js +1 -1
  691. package/XR/webXRInput.js.map +1 -1
  692. package/XR/webXRInputSource.d.ts +3 -1
  693. package/XR/webXRInputSource.js +6 -3
  694. package/XR/webXRInputSource.js.map +1 -1
  695. package/XR/webXRSessionManager.d.ts +13 -0
  696. package/XR/webXRSessionManager.js +21 -1
  697. package/XR/webXRSessionManager.js.map +1 -1
  698. package/assetContainer.d.ts +5 -2
  699. package/assetContainer.js +5 -2
  700. package/assetContainer.js.map +1 -1
  701. package/package.json +1 -1
  702. package/scene.d.ts +1 -0
  703. package/scene.js +11 -0
  704. package/scene.js.map +1 -1
  705. package/Rendering/GaussianSplatting/gaussianSplatting.d.ts +0 -81
  706. package/Rendering/GaussianSplatting/gaussianSplatting.js +0 -400
  707. package/Rendering/GaussianSplatting/gaussianSplatting.js.map +0 -1
  708. package/Rendering/GaussianSplatting/index.d.ts +0 -1
  709. package/Rendering/GaussianSplatting/index.js +0 -2
  710. package/Rendering/GaussianSplatting/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"cubemapToSphericalPolynomial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAG1F,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,M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O,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnG,IAAI,mBAAmB,CAAC,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/F,IAAI,mBAAmB,CAAC,MAAM,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnG,IAAI,mBAAmB,CAAC,OAAO,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnG,IAAI,mBAAmB,CAAC,MAAM,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY;CACrH,CAAC;AAEF,gBAAgB;AACF,gDAAc,GAAG,IAAI,CAAC;AACpC,gBAAgB;AACF,yDAAuB,GAAG,KAAK,CAAC","sourcesContent":["import { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Scalar } from \"../../Maths/math.scalar\";\r\nimport { SphericalPolynomial, SphericalHarmonics } from \"../../Maths/sphericalPolynomial\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { CubeMapInfo } from \"./panoramaToCubemap\";\r\nimport { ToLinearSpace } from \"../../Maths/math.constants\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\n\r\nclass FileFaceOrientation {\r\n public name: string;\r\n public worldAxisForNormal: Vector3; // the world axis corresponding to the normal to the face\r\n public worldAxisForFileX: Vector3; // the world axis corresponding to texture right x-axis in file\r\n public worldAxisForFileY: Vector3; // the world axis corresponding to texture down y-axis in file\r\n\r\n public constructor(name: string, worldAxisForNormal: Vector3, worldAxisForFileX: Vector3, worldAxisForFileY: Vector3) {\r\n this.name = name;\r\n this.worldAxisForNormal = worldAxisForNormal;\r\n this.worldAxisForFileX = worldAxisForFileX;\r\n this.worldAxisForFileY = worldAxisForFileY;\r\n }\r\n}\r\n\r\n/**\r\n * Helper class dealing with the extraction of spherical polynomial dataArray\r\n * from a cube map.\r\n */\r\nexport class CubeMapToSphericalPolynomialTools {\r\n private static _FileFaces: FileFaceOrientation[] = [\r\n new FileFaceOrientation(\"right\", new Vector3(1, 0, 0), new Vector3(0, 0, -1), new Vector3(0, -1, 0)), // +X east\r\n new FileFaceOrientation(\"left\", new Vector3(-1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, -1, 0)), // -X west\r\n new FileFaceOrientation(\"up\", new Vector3(0, 1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, 1)), // +Y north\r\n new FileFaceOrientation(\"down\", new Vector3(0, -1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, -1)), // -Y south\r\n new FileFaceOrientation(\"front\", new Vector3(0, 0, 1), new Vector3(1, 0, 0), new Vector3(0, -1, 0)), // +Z top\r\n new FileFaceOrientation(\"back\", new Vector3(0, 0, -1), new Vector3(-1, 0, 0), new Vector3(0, -1, 0)), // -Z bottom\r\n ];\r\n\r\n /** @internal */\r\n public static MAX_HDRI_VALUE = 4096;\r\n /** @internal */\r\n public static PRESERVE_CLAMPED_COLORS = false;\r\n\r\n /**\r\n * Converts a texture to the according Spherical Polynomial data.\r\n * This extracts the first 3 orders only as they are the only one used in the lighting.\r\n *\r\n * @param texture The texture to extract the information from.\r\n * @returns The Spherical Polynomial data.\r\n */\r\n public static ConvertCubeMapTextureToSphericalPolynomial(texture: BaseTexture): Nullable<Promise<SphericalPolynomial>> {\r\n if (!texture.isCube) {\r\n // Only supports cube Textures currently.\r\n return null;\r\n }\r\n\r\n texture.getScene()?.getEngine().flushFramebuffer();\r\n\r\n const size = texture.getSize().width;\r\n const rightPromise = texture.readPixels(0, undefined, undefined, false);\r\n const leftPromise = texture.readPixels(1, undefined, undefined, false);\r\n\r\n let upPromise: Nullable<Promise<ArrayBufferView>>;\r\n let downPromise: Nullable<Promise<ArrayBufferView>>;\r\n if (texture.isRenderTarget) {\r\n upPromise = texture.readPixels(3, undefined, undefined, false);\r\n downPromise = texture.readPixels(2, undefined, undefined, false);\r\n } else {\r\n upPromise = texture.readPixels(2, undefined, undefined, false);\r\n downPromise = texture.readPixels(3, undefined, undefined, false);\r\n }\r\n\r\n const frontPromise = texture.readPixels(4, undefined, undefined, false);\r\n const backPromise = texture.readPixels(5, undefined, undefined, false);\r\n\r\n const gammaSpace = texture.gammaSpace;\r\n // Always read as RGBA.\r\n const format = Constants.TEXTUREFORMAT_RGBA;\r\n let type = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n if (texture.textureType == Constants.TEXTURETYPE_FLOAT || texture.textureType == Constants.TEXTURETYPE_HALF_FLOAT) {\r\n type = Constants.TEXTURETYPE_FLOAT;\r\n }\r\n\r\n return new Promise((resolve) => {\r\n Promise.all([leftPromise, rightPromise, upPromise, downPromise, frontPromise, backPromise]).then(([left, right, up, down, front, back]) => {\r\n const cubeInfo: CubeMapInfo = {\r\n size,\r\n right,\r\n left,\r\n up,\r\n down,\r\n front,\r\n back,\r\n format,\r\n type,\r\n gammaSpace,\r\n };\r\n\r\n resolve(this.ConvertCubeMapToSphericalPolynomial(cubeInfo));\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Compute the area on the unit sphere of the rectangle defined by (x,y) and the origin\r\n * See https://www.rorydriscoll.com/2012/01/15/cubemap-texel-solid-angle/\r\n * @param x\r\n * @param y\r\n */\r\n private static _AreaElement(x: number, y: number): number {\r\n return Math.atan2(x * y, Math.sqrt(x * x + y * y + 1));\r\n }\r\n\r\n /**\r\n * Converts a cubemap to the according Spherical Polynomial data.\r\n * This extracts the first 3 orders only as they are the only one used in the lighting.\r\n *\r\n * @param cubeInfo The Cube map to extract the information from.\r\n * @returns The Spherical Polynomial data.\r\n */\r\n public static ConvertCubeMapToSphericalPolynomial(cubeInfo: CubeMapInfo): SphericalPolynomial {\r\n const sphericalHarmonics = new SphericalHarmonics();\r\n let totalSolidAngle = 0.0;\r\n\r\n // The (u,v) range is [-1,+1], so the distance between each texel is 2/Size.\r\n const du = 2.0 / cubeInfo.size;\r\n const dv = du;\r\n\r\n const halfTexel = 0.5 * du;\r\n\r\n // The (u,v) of the first texel is half a texel from the corner (-1,-1).\r\n const minUV = halfTexel - 1.0;\r\n\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n const fileFace = this._FileFaces[faceIndex];\r\n const dataArray = (<any>cubeInfo)[fileFace.name];\r\n let v = minUV;\r\n\r\n // TODO: we could perform the summation directly into a SphericalPolynomial (SP), which is more efficient than SphericalHarmonic (SH).\r\n // This is possible because during the summation we do not need the SH-specific properties, e.g. orthogonality.\r\n // Because SP is still linear, so summation is fine in that basis.\r\n const stride = cubeInfo.format === Constants.TEXTUREFORMAT_RGBA ? 4 : 3;\r\n for (let y = 0; y < cubeInfo.size; y++) {\r\n let u = minUV;\r\n\r\n for (let x = 0; x < cubeInfo.size; x++) {\r\n // World direction (not normalised)\r\n const worldDirection = fileFace.worldAxisForFileX.scale(u).add(fileFace.worldAxisForFileY.scale(v)).add(fileFace.worldAxisForNormal);\r\n worldDirection.normalize();\r\n\r\n const deltaSolidAngle =\r\n this._AreaElement(u - halfTexel, v - halfTexel) -\r\n this._AreaElement(u - halfTexel, v + halfTexel) -\r\n this._AreaElement(u + halfTexel, v - halfTexel) +\r\n this._AreaElement(u + halfTexel, v + halfTexel);\r\n\r\n let r = dataArray[y * cubeInfo.size * stride + x * stride + 0];\r\n let g = dataArray[y * cubeInfo.size * stride + x * stride + 1];\r\n let b = dataArray[y * cubeInfo.size * stride + x * stride + 2];\r\n\r\n // Prevent NaN harmonics with extreme HDRI data.\r\n if (isNaN(r)) {\r\n r = 0;\r\n }\r\n if (isNaN(g)) {\r\n g = 0;\r\n }\r\n if (isNaN(b)) {\r\n b = 0;\r\n }\r\n\r\n // Handle Integer types.\r\n if (cubeInfo.type === Constants.TEXTURETYPE_UNSIGNED_INT) {\r\n r /= 255;\r\n g /= 255;\r\n b /= 255;\r\n }\r\n\r\n // Handle Gamma space textures.\r\n if (cubeInfo.gammaSpace) {\r\n r = Math.pow(Scalar.Clamp(r), ToLinearSpace);\r\n g = Math.pow(Scalar.Clamp(g), ToLinearSpace);\r\n b = Math.pow(Scalar.Clamp(b), ToLinearSpace);\r\n }\r\n\r\n // Prevent to explode in case of really high dynamic ranges.\r\n // sh 3 would not be enough to accurately represent it.\r\n const max = this.MAX_HDRI_VALUE;\r\n if (this.PRESERVE_CLAMPED_COLORS) {\r\n const currentMax = Math.max(r, g, b);\r\n if (currentMax > max) {\r\n const factor = max / currentMax;\r\n r *= factor;\r\n g *= factor;\r\n b *= factor;\r\n }\r\n } else {\r\n r = Scalar.Clamp(r, 0, max);\r\n g = Scalar.Clamp(g, 0, max);\r\n b = Scalar.Clamp(b, 0, max);\r\n }\r\n\r\n const color = new Color3(r, g, b);\r\n\r\n sphericalHarmonics.addLight(worldDirection, color, deltaSolidAngle);\r\n\r\n totalSolidAngle += deltaSolidAngle;\r\n\r\n u += du;\r\n }\r\n\r\n v += dv;\r\n }\r\n }\r\n\r\n // Solid angle for entire sphere is 4*pi\r\n const sphereSolidAngle = 4.0 * Math.PI;\r\n\r\n // Adjust the solid angle to allow for how many faces we processed.\r\n const facesProcessed = 6.0;\r\n const expectedSolidAngle = (sphereSolidAngle * facesProcessed) / 6.0;\r\n\r\n // Adjust the harmonics so that the accumulated solid angle matches the expected solid angle.\r\n // This is needed because the numerical integration over the cube uses a\r\n // small angle approximation of solid angle for each texel (see deltaSolidAngle),\r\n // and also to compensate for accumulative error due to float precision in the summation.\r\n const correctionFactor = expectedSolidAngle / totalSolidAngle;\r\n sphericalHarmonics.scaleInPlace(correctionFactor);\r\n\r\n sphericalHarmonics.convertIncidentRadianceToIrradiance();\r\n sphericalHarmonics.convertIrradianceToLambertianRadiance();\r\n\r\n return SphericalPolynomial.FromHarmonics(sphericalHarmonics);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"cubemapToSphericalPolynomial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Misc/HighDynamicRange/cubemapToSphericalPolynomial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAG1F,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,mBAAmB;IAMrB,YAAmB,IAAY,EAAE,kBAA2B,EAAE,iBAA0B,EAAE,iBAA0B;QAChH,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC/C,CAAC;CACJ;AAED;;;GAGG;AACH,MAAM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MAAM,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnG,IAAI,mBAAmB,CAAC,OAAO,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnG,IAAI,mBAAmB,CAAC,MAAM,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY;CACrH,CAAC;AAEF,gBAAgB;AACF,gDAAc,GAAG,IAAI,CAAC;AACpC,gBAAgB;AACF,yDAAuB,GAAG,KAAK,CAAC","sourcesContent":["import { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Scalar } from \"../../Maths/math.scalar\";\r\nimport { SphericalPolynomial, SphericalHarmonics } from \"../../Maths/sphericalPolynomial\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { CubeMapInfo } from \"./panoramaToCubemap\";\r\nimport { ToLinearSpace } from \"../../Maths/math.constants\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\n\r\nclass FileFaceOrientation {\r\n public name: string;\r\n public worldAxisForNormal: Vector3; // the world axis corresponding to the normal to the face\r\n public worldAxisForFileX: Vector3; // the world axis corresponding to texture right x-axis in file\r\n public worldAxisForFileY: Vector3; // the world axis corresponding to texture down y-axis in file\r\n\r\n public constructor(name: string, worldAxisForNormal: Vector3, worldAxisForFileX: Vector3, worldAxisForFileY: Vector3) {\r\n this.name = name;\r\n this.worldAxisForNormal = worldAxisForNormal;\r\n this.worldAxisForFileX = worldAxisForFileX;\r\n this.worldAxisForFileY = worldAxisForFileY;\r\n }\r\n}\r\n\r\n/**\r\n * Helper class dealing with the extraction of spherical polynomial dataArray\r\n * from a cube map.\r\n */\r\nexport class CubeMapToSphericalPolynomialTools {\r\n private static _FileFaces: FileFaceOrientation[] = [\r\n new FileFaceOrientation(\"right\", new Vector3(1, 0, 0), new Vector3(0, 0, -1), new Vector3(0, -1, 0)), // +X east\r\n new FileFaceOrientation(\"left\", new Vector3(-1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, -1, 0)), // -X west\r\n new FileFaceOrientation(\"up\", new Vector3(0, 1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, 1)), // +Y north\r\n new FileFaceOrientation(\"down\", new Vector3(0, -1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, -1)), // -Y south\r\n new FileFaceOrientation(\"front\", new Vector3(0, 0, 1), new Vector3(1, 0, 0), new Vector3(0, -1, 0)), // +Z top\r\n new FileFaceOrientation(\"back\", new Vector3(0, 0, -1), new Vector3(-1, 0, 0), new Vector3(0, -1, 0)), // -Z bottom\r\n ];\r\n\r\n /** @internal */\r\n public static MAX_HDRI_VALUE = 4096;\r\n /** @internal */\r\n public static PRESERVE_CLAMPED_COLORS = false;\r\n\r\n /**\r\n * Converts a texture to the according Spherical Polynomial data.\r\n * This extracts the first 3 orders only as they are the only one used in the lighting.\r\n *\r\n * @param texture The texture to extract the information from.\r\n * @returns The Spherical Polynomial data.\r\n */\r\n public static ConvertCubeMapTextureToSphericalPolynomial(texture: BaseTexture): Nullable<Promise<SphericalPolynomial>> {\r\n if (!texture.isCube) {\r\n // Only supports cube Textures currently.\r\n return null;\r\n }\r\n\r\n texture.getScene()?.getEngine().flushFramebuffer();\r\n\r\n const size = texture.getSize().width;\r\n const rightPromise = texture.readPixels(0, undefined, undefined, false);\r\n const leftPromise = texture.readPixels(1, undefined, undefined, false);\r\n\r\n let upPromise: Nullable<Promise<ArrayBufferView>>;\r\n let downPromise: Nullable<Promise<ArrayBufferView>>;\r\n if (texture.isRenderTarget) {\r\n upPromise = texture.readPixels(3, undefined, undefined, false);\r\n downPromise = texture.readPixels(2, undefined, undefined, false);\r\n } else {\r\n upPromise = texture.readPixels(2, undefined, undefined, false);\r\n downPromise = texture.readPixels(3, undefined, undefined, false);\r\n }\r\n\r\n const frontPromise = texture.readPixels(4, undefined, undefined, false);\r\n const backPromise = texture.readPixels(5, undefined, undefined, false);\r\n\r\n const gammaSpace = texture.gammaSpace;\r\n // Always read as RGBA.\r\n const format = Constants.TEXTUREFORMAT_RGBA;\r\n let type = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n if (texture.textureType == Constants.TEXTURETYPE_FLOAT || texture.textureType == Constants.TEXTURETYPE_HALF_FLOAT) {\r\n type = Constants.TEXTURETYPE_FLOAT;\r\n }\r\n\r\n return new Promise((resolve) => {\r\n Promise.all([leftPromise, rightPromise, upPromise, downPromise, frontPromise, backPromise]).then(([left, right, up, down, front, back]) => {\r\n const cubeInfo: CubeMapInfo = {\r\n size,\r\n right,\r\n left,\r\n up,\r\n down,\r\n front,\r\n back,\r\n format,\r\n type,\r\n gammaSpace,\r\n };\r\n\r\n resolve(this.ConvertCubeMapToSphericalPolynomial(cubeInfo));\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Compute the area on the unit sphere of the rectangle defined by (x,y) and the origin\r\n * See https://www.rorydriscoll.com/2012/01/15/cubemap-texel-solid-angle/\r\n * @param x\r\n * @param y\r\n * @returns the area\r\n */\r\n private static _AreaElement(x: number, y: number): number {\r\n return Math.atan2(x * y, Math.sqrt(x * x + y * y + 1));\r\n }\r\n\r\n /**\r\n * Converts a cubemap to the according Spherical Polynomial data.\r\n * This extracts the first 3 orders only as they are the only one used in the lighting.\r\n *\r\n * @param cubeInfo The Cube map to extract the information from.\r\n * @returns The Spherical Polynomial data.\r\n */\r\n public static ConvertCubeMapToSphericalPolynomial(cubeInfo: CubeMapInfo): SphericalPolynomial {\r\n const sphericalHarmonics = new SphericalHarmonics();\r\n let totalSolidAngle = 0.0;\r\n\r\n // The (u,v) range is [-1,+1], so the distance between each texel is 2/Size.\r\n const du = 2.0 / cubeInfo.size;\r\n const dv = du;\r\n\r\n const halfTexel = 0.5 * du;\r\n\r\n // The (u,v) of the first texel is half a texel from the corner (-1,-1).\r\n const minUV = halfTexel - 1.0;\r\n\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n const fileFace = this._FileFaces[faceIndex];\r\n const dataArray = (<any>cubeInfo)[fileFace.name];\r\n let v = minUV;\r\n\r\n // TODO: we could perform the summation directly into a SphericalPolynomial (SP), which is more efficient than SphericalHarmonic (SH).\r\n // This is possible because during the summation we do not need the SH-specific properties, e.g. orthogonality.\r\n // Because SP is still linear, so summation is fine in that basis.\r\n const stride = cubeInfo.format === Constants.TEXTUREFORMAT_RGBA ? 4 : 3;\r\n for (let y = 0; y < cubeInfo.size; y++) {\r\n let u = minUV;\r\n\r\n for (let x = 0; x < cubeInfo.size; x++) {\r\n // World direction (not normalised)\r\n const worldDirection = fileFace.worldAxisForFileX.scale(u).add(fileFace.worldAxisForFileY.scale(v)).add(fileFace.worldAxisForNormal);\r\n worldDirection.normalize();\r\n\r\n const deltaSolidAngle =\r\n this._AreaElement(u - halfTexel, v - halfTexel) -\r\n this._AreaElement(u - halfTexel, v + halfTexel) -\r\n this._AreaElement(u + halfTexel, v - halfTexel) +\r\n this._AreaElement(u + halfTexel, v + halfTexel);\r\n\r\n let r = dataArray[y * cubeInfo.size * stride + x * stride + 0];\r\n let g = dataArray[y * cubeInfo.size * stride + x * stride + 1];\r\n let b = dataArray[y * cubeInfo.size * stride + x * stride + 2];\r\n\r\n // Prevent NaN harmonics with extreme HDRI data.\r\n if (isNaN(r)) {\r\n r = 0;\r\n }\r\n if (isNaN(g)) {\r\n g = 0;\r\n }\r\n if (isNaN(b)) {\r\n b = 0;\r\n }\r\n\r\n // Handle Integer types.\r\n if (cubeInfo.type === Constants.TEXTURETYPE_UNSIGNED_INT) {\r\n r /= 255;\r\n g /= 255;\r\n b /= 255;\r\n }\r\n\r\n // Handle Gamma space textures.\r\n if (cubeInfo.gammaSpace) {\r\n r = Math.pow(Scalar.Clamp(r), ToLinearSpace);\r\n g = Math.pow(Scalar.Clamp(g), ToLinearSpace);\r\n b = Math.pow(Scalar.Clamp(b), ToLinearSpace);\r\n }\r\n\r\n // Prevent to explode in case of really high dynamic ranges.\r\n // sh 3 would not be enough to accurately represent it.\r\n const max = this.MAX_HDRI_VALUE;\r\n if (this.PRESERVE_CLAMPED_COLORS) {\r\n const currentMax = Math.max(r, g, b);\r\n if (currentMax > max) {\r\n const factor = max / currentMax;\r\n r *= factor;\r\n g *= factor;\r\n b *= factor;\r\n }\r\n } else {\r\n r = Scalar.Clamp(r, 0, max);\r\n g = Scalar.Clamp(g, 0, max);\r\n b = Scalar.Clamp(b, 0, max);\r\n }\r\n\r\n const color = new Color3(r, g, b);\r\n\r\n sphericalHarmonics.addLight(worldDirection, color, deltaSolidAngle);\r\n\r\n totalSolidAngle += deltaSolidAngle;\r\n\r\n u += du;\r\n }\r\n\r\n v += dv;\r\n }\r\n }\r\n\r\n // Solid angle for entire sphere is 4*pi\r\n const sphereSolidAngle = 4.0 * Math.PI;\r\n\r\n // Adjust the solid angle to allow for how many faces we processed.\r\n const facesProcessed = 6.0;\r\n const expectedSolidAngle = (sphereSolidAngle * facesProcessed) / 6.0;\r\n\r\n // Adjust the harmonics so that the accumulated solid angle matches the expected solid angle.\r\n // This is needed because the numerical integration over the cube uses a\r\n // small angle approximation of solid angle for each texel (see deltaSolidAngle),\r\n // and also to compensate for accumulative error due to float precision in the summation.\r\n const correctionFactor = expectedSolidAngle / totalSolidAngle;\r\n sphericalHarmonics.scaleInPlace(correctionFactor);\r\n\r\n sphericalHarmonics.convertIncidentRadianceToIrradiance();\r\n sphericalHarmonics.convertIrradianceToLambertianRadiance();\r\n\r\n return SphericalPolynomial.FromHarmonics(sphericalHarmonics);\r\n }\r\n}\r\n"]}
@@ -41,6 +41,7 @@ export declare class HDRTools {
41
41
  *
42
42
  * @param buffer The binary file stored in an array buffer.
43
43
  * @param size The expected size of the extracted cubemap.
44
+ * @param supersample enable supersampling the cubemap (default: false)
44
45
  * @returns The Cube Map information.
45
46
  */
46
47
  static GetCubeMapTextureData(buffer: ArrayBuffer, size: number, supersample?: boolean): CubeMapInfo;
@@ -52,6 +52,7 @@ export class HDRTools {
52
52
  let width = 0;
53
53
  let line = this._ReadStringLine(uint8array, 0);
54
54
  if (line[0] != "#" || line[1] != "?") {
55
+ // eslint-disable-next-line no-throw-literal
55
56
  throw "Bad HDR Format.";
56
57
  }
57
58
  let endOfHeader = false;
@@ -68,6 +69,7 @@ export class HDRTools {
68
69
  }
69
70
  } while (!endOfHeader);
70
71
  if (!findFormat) {
72
+ // eslint-disable-next-line no-throw-literal
71
73
  throw "HDR Bad header format, unsupported FORMAT";
72
74
  }
73
75
  lineIndex += line.length + 1;
@@ -76,11 +78,13 @@ export class HDRTools {
76
78
  const match = sizeRegexp.exec(line);
77
79
  // TODO. Support +Y and -X if needed.
78
80
  if (!match || match.length < 3) {
81
+ // eslint-disable-next-line no-throw-literal
79
82
  throw "HDR Bad header format, no size";
80
83
  }
81
84
  width = parseInt(match[2]);
82
85
  height = parseInt(match[1]);
83
86
  if (width < 8 || width > 0x7fff) {
87
+ // eslint-disable-next-line no-throw-literal
84
88
  throw "HDR Bad header format, unsupported size";
85
89
  }
86
90
  lineIndex += line.length + 1;
@@ -99,6 +103,7 @@ export class HDRTools {
99
103
  *
100
104
  * @param buffer The binary file stored in an array buffer.
101
105
  * @param size The expected size of the extracted cubemap.
106
+ * @param supersample enable supersampling the cubemap (default: false)
102
107
  * @returns The Cube Map information.
103
108
  */
104
109
  static GetCubeMapTextureData(buffer, size, supersample = false) {
@@ -144,6 +149,7 @@ export class HDRTools {
144
149
  return this._RGBEReadPixelsNOTRLE(uint8array, hdrInfo);
145
150
  }
146
151
  if (((c << 8) | d) != scanline_width) {
152
+ // eslint-disable-next-line no-throw-literal
147
153
  throw "HDR Bad header format, wrong scan line width";
148
154
  }
149
155
  index = 0;
@@ -157,6 +163,7 @@ export class HDRTools {
157
163
  // a run of the same value
158
164
  count = a - 128;
159
165
  if (count == 0 || count > endIndex - index) {
166
+ // eslint-disable-next-line no-throw-literal
160
167
  throw "HDR Bad Format, bad scanline data (run)";
161
168
  }
162
169
  while (count-- > 0) {
@@ -167,6 +174,7 @@ export class HDRTools {
167
174
  // a non-run
168
175
  count = a;
169
176
  if (count == 0 || count > endIndex - index) {
177
+ // eslint-disable-next-line no-throw-literal
170
178
  throw "HDR Bad Format, bad scanline data (non-run)";
171
179
  }
172
180
  scanLineArray[index++] = b;
@@ -1 +1 @@
1
- {"version":3,"file":"hdr.js","sourceRoot":"","sources":["../../../../../dev/core/src/Misc/HighDynamicRange/hdr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAsB7D;;GAEG;AACH,MAAM,OAAO,QAAQ;IACT,MAAM,CAAC,MAAM,CAAC,QAAgB,EAAE,QAAgB;QACpD,IAAI,QAAQ,GAAG,IAAI,EAAE;YACjB,OAAO,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC,CAAC;SACtE;QAED,IAAI,QAAQ,GAAG,CAAC,IAAI,EAAE;YAClB,OAAO,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,I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AAC,SAAS,EAAE,CAAC,CAAC;gBAE5B,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,cAAc,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;aAC5G;YAED,aAAa,EAAE,CAAC;SACnB;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ","sourcesContent":["import type { CubeMapInfo } from \"./panoramaToCubemap\";\r\nimport { PanoramaToCubeMapTools } from \"./panoramaToCubemap\";\r\n\r\n/**\r\n * Header information of HDR texture files.\r\n */\r\nexport interface HDRInfo {\r\n /**\r\n * The height of the texture in pixels.\r\n */\r\n height: number;\r\n\r\n /**\r\n * The width of the texture in pixels.\r\n */\r\n width: number;\r\n\r\n /**\r\n * The index of the beginning of the data in the binary file.\r\n */\r\n dataPosition: number;\r\n}\r\n\r\n/**\r\n * This groups tools to convert HDR texture to native colors array.\r\n */\r\nexport class HDRTools {\r\n private static _Ldexp(mantissa: number, exponent: number): number {\r\n if (exponent > 1023) {\r\n return mantissa * Math.pow(2, 1023) * Math.pow(2, exponent - 1023);\r\n }\r\n\r\n if (exponent < -1074) {\r\n return mantissa * Math.pow(2, -1074) * Math.pow(2, exponent + 1074);\r\n }\r\n\r\n return mantissa * Math.pow(2, exponent);\r\n }\r\n\r\n private static _Rgbe2float(float32array: Float32Array, red: number, green: number, blue: number, exponent: number, index: number) {\r\n if (exponent > 0) {\r\n /*nonzero pixel*/\r\n exponent = this._Ldexp(1.0, exponent - (128 + 8));\r\n\r\n float32array[index + 0] = red * exponent;\r\n float32array[index + 1] = green * exponent;\r\n float32array[index + 2] = blue * exponent;\r\n } else {\r\n float32array[index + 0] = 0;\r\n float32array[index + 1] = 0;\r\n float32array[index + 2] = 0;\r\n }\r\n }\r\n\r\n private static _ReadStringLine(uint8array: Uint8Array, startIndex: number): string {\r\n let line = \"\";\r\n let character = \"\";\r\n\r\n for (let i = startIndex; i < uint8array.length - startIndex; i++) {\r\n character = String.fromCharCode(uint8array[i]);\r\n\r\n if (character == \"\\n\") {\r\n break;\r\n }\r\n\r\n line += character;\r\n }\r\n\r\n return line;\r\n }\r\n\r\n /**\r\n * Reads header information from an RGBE texture stored in a native array.\r\n * More information on this format are available here:\r\n * https://en.wikipedia.org/wiki/RGBE_image_format\r\n *\r\n * @param uint8array The binary file stored in native array.\r\n * @returns The header information.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public static RGBE_ReadHeader(uint8array: Uint8Array): HDRInfo {\r\n let height: number = 0;\r\n let width: number = 0;\r\n\r\n let line = this._ReadStringLine(uint8array, 0);\r\n if (line[0] != \"#\" || line[1] != \"?\") {\r\n throw \"Bad HDR Format.\";\r\n }\r\n\r\n let endOfHeader = false;\r\n let findFormat = false;\r\n let lineIndex: number = 0;\r\n\r\n do {\r\n lineIndex += line.length + 1;\r\n line = this._ReadStringLine(uint8array, lineIndex);\r\n\r\n if (line == \"FORMAT=32-bit_rle_rgbe\") {\r\n findFormat = true;\r\n } else if (line.length == 0) {\r\n endOfHeader = true;\r\n }\r\n } while (!endOfHeader);\r\n\r\n if (!findFormat) {\r\n throw \"HDR Bad header format, unsupported FORMAT\";\r\n }\r\n\r\n lineIndex += line.length + 1;\r\n line = this._ReadStringLine(uint8array, lineIndex);\r\n\r\n const sizeRegexp = /^-Y (.*) \\+X (.*)$/g;\r\n const match = sizeRegexp.exec(line);\r\n\r\n // TODO. Support +Y and -X if needed.\r\n if (!match || match.length < 3) {\r\n throw \"HDR Bad header format, no size\";\r\n }\r\n width = parseInt(match[2]);\r\n height = parseInt(match[1]);\r\n\r\n if (width < 8 || width > 0x7fff) {\r\n throw \"HDR Bad header format, unsupported size\";\r\n }\r\n\r\n lineIndex += line.length + 1;\r\n\r\n return {\r\n height: height,\r\n width: width,\r\n dataPosition: lineIndex,\r\n };\r\n }\r\n\r\n /**\r\n * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.\r\n * This RGBE texture needs to store the information as a panorama.\r\n *\r\n * More information on this format are available here:\r\n * https://en.wikipedia.org/wiki/RGBE_image_format\r\n *\r\n * @param buffer The binary file stored in an array buffer.\r\n * @param size The expected size of the extracted cubemap.\r\n * @returns The Cube Map information.\r\n */\r\n public static GetCubeMapTextureData(buffer: ArrayBuffer, size: number, supersample = false): CubeMapInfo {\r\n const uint8array = new Uint8Array(buffer);\r\n const hdrInfo = this.RGBE_ReadHeader(uint8array);\r\n const data = this.RGBE_ReadPixels(uint8array, hdrInfo);\r\n\r\n const cubeMapData = PanoramaToCubeMapTools.ConvertPanoramaToCubemap(data, hdrInfo.width, hdrInfo.height, size, supersample);\r\n\r\n return cubeMapData;\r\n }\r\n\r\n /**\r\n * Returns the pixels data extracted from an RGBE texture.\r\n * This pixels will be stored left to right up to down in the R G B order in one array.\r\n *\r\n * More information on this format are available here:\r\n * https://en.wikipedia.org/wiki/RGBE_image_format\r\n *\r\n * @param uint8array The binary file stored in an array buffer.\r\n * @param hdrInfo The header information of the file.\r\n * @returns The pixels data in RGB right to left up to down order.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public static RGBE_ReadPixels(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array {\r\n return this._RGBEReadPixelsRLE(uint8array, hdrInfo);\r\n }\r\n\r\n private static _RGBEReadPixelsRLE(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array {\r\n let num_scanlines = hdrInfo.height;\r\n const scanline_width = hdrInfo.width;\r\n\r\n let a: number, b: number, c: number, d: number, count: number;\r\n let dataIndex = hdrInfo.dataPosition;\r\n let index = 0,\r\n endIndex = 0,\r\n i = 0;\r\n\r\n const scanLineArrayBuffer = new ArrayBuffer(scanline_width * 4); // four channel R G B E\r\n const scanLineArray = new Uint8Array(scanLineArrayBuffer);\r\n\r\n // 3 channels of 4 bytes per pixel in float.\r\n const resultBuffer = new ArrayBuffer(hdrInfo.width * hdrInfo.height * 4 * 3);\r\n const resultArray = new Float32Array(resultBuffer);\r\n\r\n // read in each successive scanline\r\n while (num_scanlines > 0) {\r\n a = uint8array[dataIndex++];\r\n b = uint8array[dataIndex++];\r\n c = uint8array[dataIndex++];\r\n d = uint8array[dataIndex++];\r\n\r\n if (a != 2 || b != 2 || c & 0x80 || hdrInfo.width < 8 || hdrInfo.width > 32767) {\r\n return this._RGBEReadPixelsNOTRLE(uint8array, hdrInfo);\r\n }\r\n\r\n if (((c << 8) | d) != scanline_width) {\r\n throw \"HDR Bad header format, wrong scan line width\";\r\n }\r\n\r\n index = 0;\r\n\r\n // read each of the four channels for the scanline into the buffer\r\n for (i = 0; i < 4; i++) {\r\n endIndex = (i + 1) * scanline_width;\r\n\r\n while (index < endIndex) {\r\n a = uint8array[dataIndex++];\r\n b = uint8array[dataIndex++];\r\n\r\n if (a > 128) {\r\n // a run of the same value\r\n count = a - 128;\r\n if (count == 0 || count > endIndex - index) {\r\n throw \"HDR Bad Format, bad scanline data (run)\";\r\n }\r\n\r\n while (count-- > 0) {\r\n scanLineArray[index++] = b;\r\n }\r\n } else {\r\n // a non-run\r\n count = a;\r\n if (count == 0 || count > endIndex - index) {\r\n throw \"HDR Bad Format, bad scanline data (non-run)\";\r\n }\r\n\r\n scanLineArray[index++] = b;\r\n if (--count > 0) {\r\n for (let j = 0; j < count; j++) {\r\n scanLineArray[index++] = uint8array[dataIndex++];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // now convert data from buffer into floats\r\n for (i = 0; i < scanline_width; i++) {\r\n a = scanLineArray[i];\r\n b = scanLineArray[i + scanline_width];\r\n c = scanLineArray[i + 2 * scanline_width];\r\n d = scanLineArray[i + 3 * scanline_width];\r\n\r\n this._Rgbe2float(resultArray, a, b, c, d, (hdrInfo.height - num_scanlines) * scanline_width * 3 + i * 3);\r\n }\r\n\r\n num_scanlines--;\r\n }\r\n\r\n return resultArray;\r\n }\r\n\r\n private static _RGBEReadPixelsNOTRLE(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array {\r\n // this file is not run length encoded\r\n // read values sequentially\r\n\r\n let num_scanlines = hdrInfo.height;\r\n const scanline_width = hdrInfo.width;\r\n\r\n let a: number, b: number, c: number, d: number, i: number;\r\n let dataIndex = hdrInfo.dataPosition;\r\n\r\n // 3 channels of 4 bytes per pixel in float.\r\n const resultBuffer = new ArrayBuffer(hdrInfo.width * hdrInfo.height * 4 * 3);\r\n const resultArray = new Float32Array(resultBuffer);\r\n\r\n // read in each successive scanline\r\n while (num_scanlines > 0) {\r\n for (i = 0; i < hdrInfo.width; i++) {\r\n a = uint8array[dataIndex++];\r\n b = uint8array[dataIndex++];\r\n c = uint8array[dataIndex++];\r\n d = uint8array[dataIndex++];\r\n\r\n this._Rgbe2float(resultArray, a, b, c, d, (hdrInfo.height - num_scanlines) * scanline_width * 3 + i * 3);\r\n }\r\n\r\n num_scanlines--;\r\n }\r\n\r\n return resultArray;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"hdr.js","sourceRoot":"","sources":["../../../../../dev/core/src/Misc/HighDynamicRange/hdr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAsB7D;;GAEG;AACH,MAAM,OAAO,QAAQ;IACT,MAAM,CAAC,MAAM,CAAC,QAAgB,EAAE,QAAgB;QACpD,IAAI,QAAQ,GAAG,IAAI,EAAE;YACjB,OAAO,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC,CAAC;SACtE;QAED,IAAI,QAAQ,GAAG,CAAC,IAAI,EAAE;YAClB,OAAO,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC,CAAC;SAC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AAC,CAAC;gBAC5B,CAAC,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBAC5B,CAAC,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBAE5B,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,cAAc,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;aAC5G;YAED,aAAa,EAAE,CAAC;SACnB;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ","sourcesContent":["import type { CubeMapInfo } from \"./panoramaToCubemap\";\r\nimport { PanoramaToCubeMapTools } from \"./panoramaToCubemap\";\r\n\r\n/**\r\n * Header information of HDR texture files.\r\n */\r\nexport interface HDRInfo {\r\n /**\r\n * The height of the texture in pixels.\r\n */\r\n height: number;\r\n\r\n /**\r\n * The width of the texture in pixels.\r\n */\r\n width: number;\r\n\r\n /**\r\n * The index of the beginning of the data in the binary file.\r\n */\r\n dataPosition: number;\r\n}\r\n\r\n/**\r\n * This groups tools to convert HDR texture to native colors array.\r\n */\r\nexport class HDRTools {\r\n private static _Ldexp(mantissa: number, exponent: number): number {\r\n if (exponent > 1023) {\r\n return mantissa * Math.pow(2, 1023) * Math.pow(2, exponent - 1023);\r\n }\r\n\r\n if (exponent < -1074) {\r\n return mantissa * Math.pow(2, -1074) * Math.pow(2, exponent + 1074);\r\n }\r\n\r\n return mantissa * Math.pow(2, exponent);\r\n }\r\n\r\n private static _Rgbe2float(float32array: Float32Array, red: number, green: number, blue: number, exponent: number, index: number) {\r\n if (exponent > 0) {\r\n /*nonzero pixel*/\r\n exponent = this._Ldexp(1.0, exponent - (128 + 8));\r\n\r\n float32array[index + 0] = red * exponent;\r\n float32array[index + 1] = green * exponent;\r\n float32array[index + 2] = blue * exponent;\r\n } else {\r\n float32array[index + 0] = 0;\r\n float32array[index + 1] = 0;\r\n float32array[index + 2] = 0;\r\n }\r\n }\r\n\r\n private static _ReadStringLine(uint8array: Uint8Array, startIndex: number): string {\r\n let line = \"\";\r\n let character = \"\";\r\n\r\n for (let i = startIndex; i < uint8array.length - startIndex; i++) {\r\n character = String.fromCharCode(uint8array[i]);\r\n\r\n if (character == \"\\n\") {\r\n break;\r\n }\r\n\r\n line += character;\r\n }\r\n\r\n return line;\r\n }\r\n\r\n /**\r\n * Reads header information from an RGBE texture stored in a native array.\r\n * More information on this format are available here:\r\n * https://en.wikipedia.org/wiki/RGBE_image_format\r\n *\r\n * @param uint8array The binary file stored in native array.\r\n * @returns The header information.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public static RGBE_ReadHeader(uint8array: Uint8Array): HDRInfo {\r\n let height: number = 0;\r\n let width: number = 0;\r\n\r\n let line = this._ReadStringLine(uint8array, 0);\r\n if (line[0] != \"#\" || line[1] != \"?\") {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Bad HDR Format.\";\r\n }\r\n\r\n let endOfHeader = false;\r\n let findFormat = false;\r\n let lineIndex: number = 0;\r\n\r\n do {\r\n lineIndex += line.length + 1;\r\n line = this._ReadStringLine(uint8array, lineIndex);\r\n\r\n if (line == \"FORMAT=32-bit_rle_rgbe\") {\r\n findFormat = true;\r\n } else if (line.length == 0) {\r\n endOfHeader = true;\r\n }\r\n } while (!endOfHeader);\r\n\r\n if (!findFormat) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"HDR Bad header format, unsupported FORMAT\";\r\n }\r\n\r\n lineIndex += line.length + 1;\r\n line = this._ReadStringLine(uint8array, lineIndex);\r\n\r\n const sizeRegexp = /^-Y (.*) \\+X (.*)$/g;\r\n const match = sizeRegexp.exec(line);\r\n\r\n // TODO. Support +Y and -X if needed.\r\n if (!match || match.length < 3) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"HDR Bad header format, no size\";\r\n }\r\n width = parseInt(match[2]);\r\n height = parseInt(match[1]);\r\n\r\n if (width < 8 || width > 0x7fff) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"HDR Bad header format, unsupported size\";\r\n }\r\n\r\n lineIndex += line.length + 1;\r\n\r\n return {\r\n height: height,\r\n width: width,\r\n dataPosition: lineIndex,\r\n };\r\n }\r\n\r\n /**\r\n * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.\r\n * This RGBE texture needs to store the information as a panorama.\r\n *\r\n * More information on this format are available here:\r\n * https://en.wikipedia.org/wiki/RGBE_image_format\r\n *\r\n * @param buffer The binary file stored in an array buffer.\r\n * @param size The expected size of the extracted cubemap.\r\n * @param supersample enable supersampling the cubemap (default: false)\r\n * @returns The Cube Map information.\r\n */\r\n public static GetCubeMapTextureData(buffer: ArrayBuffer, size: number, supersample = false): CubeMapInfo {\r\n const uint8array = new Uint8Array(buffer);\r\n const hdrInfo = this.RGBE_ReadHeader(uint8array);\r\n const data = this.RGBE_ReadPixels(uint8array, hdrInfo);\r\n\r\n const cubeMapData = PanoramaToCubeMapTools.ConvertPanoramaToCubemap(data, hdrInfo.width, hdrInfo.height, size, supersample);\r\n\r\n return cubeMapData;\r\n }\r\n\r\n /**\r\n * Returns the pixels data extracted from an RGBE texture.\r\n * This pixels will be stored left to right up to down in the R G B order in one array.\r\n *\r\n * More information on this format are available here:\r\n * https://en.wikipedia.org/wiki/RGBE_image_format\r\n *\r\n * @param uint8array The binary file stored in an array buffer.\r\n * @param hdrInfo The header information of the file.\r\n * @returns The pixels data in RGB right to left up to down order.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public static RGBE_ReadPixels(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array {\r\n return this._RGBEReadPixelsRLE(uint8array, hdrInfo);\r\n }\r\n\r\n private static _RGBEReadPixelsRLE(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array {\r\n let num_scanlines = hdrInfo.height;\r\n const scanline_width = hdrInfo.width;\r\n\r\n let a: number, b: number, c: number, d: number, count: number;\r\n let dataIndex = hdrInfo.dataPosition;\r\n let index = 0,\r\n endIndex = 0,\r\n i = 0;\r\n\r\n const scanLineArrayBuffer = new ArrayBuffer(scanline_width * 4); // four channel R G B E\r\n const scanLineArray = new Uint8Array(scanLineArrayBuffer);\r\n\r\n // 3 channels of 4 bytes per pixel in float.\r\n const resultBuffer = new ArrayBuffer(hdrInfo.width * hdrInfo.height * 4 * 3);\r\n const resultArray = new Float32Array(resultBuffer);\r\n\r\n // read in each successive scanline\r\n while (num_scanlines > 0) {\r\n a = uint8array[dataIndex++];\r\n b = uint8array[dataIndex++];\r\n c = uint8array[dataIndex++];\r\n d = uint8array[dataIndex++];\r\n\r\n if (a != 2 || b != 2 || c & 0x80 || hdrInfo.width < 8 || hdrInfo.width > 32767) {\r\n return this._RGBEReadPixelsNOTRLE(uint8array, hdrInfo);\r\n }\r\n\r\n if (((c << 8) | d) != scanline_width) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"HDR Bad header format, wrong scan line width\";\r\n }\r\n\r\n index = 0;\r\n\r\n // read each of the four channels for the scanline into the buffer\r\n for (i = 0; i < 4; i++) {\r\n endIndex = (i + 1) * scanline_width;\r\n\r\n while (index < endIndex) {\r\n a = uint8array[dataIndex++];\r\n b = uint8array[dataIndex++];\r\n\r\n if (a > 128) {\r\n // a run of the same value\r\n count = a - 128;\r\n if (count == 0 || count > endIndex - index) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"HDR Bad Format, bad scanline data (run)\";\r\n }\r\n\r\n while (count-- > 0) {\r\n scanLineArray[index++] = b;\r\n }\r\n } else {\r\n // a non-run\r\n count = a;\r\n if (count == 0 || count > endIndex - index) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"HDR Bad Format, bad scanline data (non-run)\";\r\n }\r\n\r\n scanLineArray[index++] = b;\r\n if (--count > 0) {\r\n for (let j = 0; j < count; j++) {\r\n scanLineArray[index++] = uint8array[dataIndex++];\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // now convert data from buffer into floats\r\n for (i = 0; i < scanline_width; i++) {\r\n a = scanLineArray[i];\r\n b = scanLineArray[i + scanline_width];\r\n c = scanLineArray[i + 2 * scanline_width];\r\n d = scanLineArray[i + 3 * scanline_width];\r\n\r\n this._Rgbe2float(resultArray, a, b, c, d, (hdrInfo.height - num_scanlines) * scanline_width * 3 + i * 3);\r\n }\r\n\r\n num_scanlines--;\r\n }\r\n\r\n return resultArray;\r\n }\r\n\r\n private static _RGBEReadPixelsNOTRLE(uint8array: Uint8Array, hdrInfo: HDRInfo): Float32Array {\r\n // this file is not run length encoded\r\n // read values sequentially\r\n\r\n let num_scanlines = hdrInfo.height;\r\n const scanline_width = hdrInfo.width;\r\n\r\n let a: number, b: number, c: number, d: number, i: number;\r\n let dataIndex = hdrInfo.dataPosition;\r\n\r\n // 3 channels of 4 bytes per pixel in float.\r\n const resultBuffer = new ArrayBuffer(hdrInfo.width * hdrInfo.height * 4 * 3);\r\n const resultArray = new Float32Array(resultBuffer);\r\n\r\n // read in each successive scanline\r\n while (num_scanlines > 0) {\r\n for (i = 0; i < hdrInfo.width; i++) {\r\n a = uint8array[dataIndex++];\r\n b = uint8array[dataIndex++];\r\n c = uint8array[dataIndex++];\r\n d = uint8array[dataIndex++];\r\n\r\n this._Rgbe2float(resultArray, a, b, c, d, (hdrInfo.height - num_scanlines) * scanline_width * 3 + i * 3);\r\n }\r\n\r\n num_scanlines--;\r\n }\r\n\r\n return resultArray;\r\n }\r\n}\r\n"]}
@@ -73,6 +73,7 @@ export declare class PanoramaToCubeMapTools {
73
73
  * @param inputWidth The width of the input panorama.
74
74
  * @param inputHeight The height of the input panorama.
75
75
  * @param size The willing size of the generated cubemap (each faces will be size * size pixels)
76
+ * @param supersample enable supersampling the cubemap
76
77
  * @returns The cubemap data
77
78
  */
78
79
  static ConvertPanoramaToCubemap(float32Array: Float32Array, inputWidth: number, inputHeight: number, size: number, supersample?: boolean): CubeMapInfo;
@@ -11,13 +11,16 @@ export class PanoramaToCubeMapTools {
11
11
  * @param inputWidth The width of the input panorama.
12
12
  * @param inputHeight The height of the input panorama.
13
13
  * @param size The willing size of the generated cubemap (each faces will be size * size pixels)
14
+ * @param supersample enable supersampling the cubemap
14
15
  * @returns The cubemap data
15
16
  */
16
17
  static ConvertPanoramaToCubemap(float32Array, inputWidth, inputHeight, size, supersample = false) {
17
18
  if (!float32Array) {
19
+ // eslint-disable-next-line no-throw-literal
18
20
  throw "ConvertPanoramaToCubemap: input cannot be null";
19
21
  }
20
22
  if (float32Array.length != inputWidth * inputHeight * 3) {
23
+ // eslint-disable-next-line no-throw-literal
21
24
  throw "ConvertPanoramaToCubemap: input size is wrong";
22
25
  }
23
26
  const textureFront = this.CreateCubemapTexture(size, this.FACE_FRONT, float32Array, inputWidth, inputHeight, supersample);
@@ -1 +1 @@
1
- {"version":3,"file":"panoramaToCubemap.js","sourceRoot":"","sources":["../../../../../dev/core/src/Misc/HighDynamicRange/panoramaToCubemap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAqEpD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAQ/B;;;;;;;;OAQG;IACI,MAAM,CAAC,wBAAwB,CAAC,YAA0B,EAAE,UAAkB,EAAE,WAAmB,EAAE,IAAY,EAAE,WAAW,GAAG,KAAK;QACzI,IAAI,CAAC,YAAY,EAAE;YACf,MAAM,gDAAgD,CAAC;SAC1D;QAED,IAAI,YAAY,CAAC,MAAM,IAAI,UAAU,GAAG,WAAW,GAAG,CAAC,EAAE;YACrD,MAAM,+CAA+C,CAAC;SACzD;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QAC1H,MAAM,WAAW,GAAG,IAAI,CAAC,oBAAoB,CA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C;AACrI,gCAAS,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AACjI,8BAAO,GAAG,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"../../types\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Constants } from \"../../Engines/constants\";\r\n\r\n/**\r\n * CubeMap information grouping all the data for each faces as well as the cubemap size.\r\n */\r\nexport interface CubeMapInfo {\r\n /**\r\n * The pixel array for the front face.\r\n * This is stored in format, left to right, up to down format.\r\n */\r\n front: Nullable<ArrayBufferView>;\r\n\r\n /**\r\n * The pixel array for the back face.\r\n * This is stored in format, left to right, up to down format.\r\n */\r\n back: Nullable<ArrayBufferView>;\r\n\r\n /**\r\n * The pixel array for the left face.\r\n * This is stored in format, left to right, up to down format.\r\n */\r\n left: Nullable<ArrayBufferView>;\r\n\r\n /**\r\n * The pixel array for the right face.\r\n * This is stored in format, left to right, up to down format.\r\n */\r\n right: Nullable<ArrayBufferView>;\r\n\r\n /**\r\n * The pixel array for the up face.\r\n * This is stored in format, left to right, up to down format.\r\n */\r\n up: Nullable<ArrayBufferView>;\r\n\r\n /**\r\n * The pixel array for the down face.\r\n * This is stored in format, left to right, up to down format.\r\n */\r\n down: Nullable<ArrayBufferView>;\r\n\r\n /**\r\n * The size of the cubemap stored.\r\n *\r\n * Each faces will be size * size pixels.\r\n */\r\n size: number;\r\n\r\n /**\r\n * The format of the texture.\r\n *\r\n * RGBA, RGB.\r\n */\r\n format: number;\r\n\r\n /**\r\n * The type of the texture data.\r\n *\r\n * UNSIGNED_INT, FLOAT.\r\n */\r\n type: number;\r\n\r\n /**\r\n * Specifies whether the texture is in gamma space.\r\n */\r\n gammaSpace: boolean;\r\n}\r\n\r\n/**\r\n * Helper class useful to convert panorama picture to their cubemap representation in 6 faces.\r\n */\r\nexport class PanoramaToCubeMapTools {\r\n private static FACE_LEFT = [new Vector3(-1.0, -1.0, -1.0), new Vector3(1.0, -1.0, -1.0), new Vector3(-1.0, 1.0, -1.0), new Vector3(1.0, 1.0, -1.0)];\r\n private static FACE_RIGHT = [new Vector3(1.0, -1.0, 1.0), new Vector3(-1.0, -1.0, 1.0), new Vector3(1.0, 1.0, 1.0), new Vector3(-1.0, 1.0, 1.0)];\r\n private static FACE_FRONT = [new Vector3(1.0, -1.0, -1.0), new Vector3(1.0, -1.0, 1.0), new Vector3(1.0, 1.0, -1.0), new Vector3(1.0, 1.0, 1.0)];\r\n private static FACE_BACK = [new Vector3(-1.0, -1.0, 1.0), new Vector3(-1.0, -1.0, -1.0), new Vector3(-1.0, 1.0, 1.0), new Vector3(-1.0, 1.0, -1.0)];\r\n private static FACE_DOWN = [new Vector3(1.0, 1.0, -1.0), new Vector3(1.0, 1.0, 1.0), new Vector3(-1.0, 1.0, -1.0), new Vector3(-1.0, 1.0, 1.0)];\r\n private static FACE_UP = [new Vector3(-1.0, -1.0, -1.0), new Vector3(-1.0, -1.0, 1.0), new Vector3(1.0, -1.0, -1.0), new Vector3(1.0, -1.0, 1.0)];\r\n\r\n /**\r\n * Converts a panorama stored in RGB right to left up to down format into a cubemap (6 faces).\r\n *\r\n * @param float32Array The source data.\r\n * @param inputWidth The width of the input panorama.\r\n * @param inputHeight The height of the input panorama.\r\n * @param size The willing size of the generated cubemap (each faces will be size * size pixels)\r\n * @returns The cubemap data\r\n */\r\n public static ConvertPanoramaToCubemap(float32Array: Float32Array, inputWidth: number, inputHeight: number, size: number, supersample = false): CubeMapInfo {\r\n if (!float32Array) {\r\n throw \"ConvertPanoramaToCubemap: input cannot be null\";\r\n }\r\n\r\n if (float32Array.length != inputWidth * inputHeight * 3) {\r\n throw \"ConvertPanoramaToCubemap: input size is wrong\";\r\n }\r\n\r\n const textureFront = this.CreateCubemapTexture(size, this.FACE_FRONT, float32Array, inputWidth, inputHeight, supersample);\r\n const textureBack = this.CreateCubemapTexture(size, this.FACE_BACK, float32Array, inputWidth, inputHeight, supersample);\r\n const textureLeft = this.CreateCubemapTexture(size, this.FACE_LEFT, float32Array, inputWidth, inputHeight, supersample);\r\n const textureRight = this.CreateCubemapTexture(size, this.FACE_RIGHT, float32Array, inputWidth, inputHeight, supersample);\r\n const textureUp = this.CreateCubemapTexture(size, this.FACE_UP, float32Array, inputWidth, inputHeight, supersample);\r\n const textureDown = this.CreateCubemapTexture(size, this.FACE_DOWN, float32Array, inputWidth, inputHeight, supersample);\r\n\r\n return {\r\n front: textureFront,\r\n back: textureBack,\r\n left: textureLeft,\r\n right: textureRight,\r\n up: textureUp,\r\n down: textureDown,\r\n size: size,\r\n type: Constants.TEXTURETYPE_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGB,\r\n gammaSpace: false,\r\n };\r\n }\r\n\r\n private static CreateCubemapTexture(texSize: number, faceData: Vector3[], float32Array: Float32Array, inputWidth: number, inputHeight: number, supersample = false) {\r\n const buffer = new ArrayBuffer(texSize * texSize * 4 * 3);\r\n const textureArray = new Float32Array(buffer);\r\n\r\n // If supersampling, determine number of samples needed when source texture width is divided for 4 cube faces\r\n const samples = supersample ? Math.max(1, Math.round(inputWidth / 4 / texSize)) : 1;\r\n const sampleFactor = 1 / samples;\r\n const sampleFactorSqr = sampleFactor * sampleFactor;\r\n\r\n const rotDX1 = faceData[1].subtract(faceData[0]).scale(sampleFactor / texSize);\r\n const rotDX2 = faceData[3].subtract(faceData[2]).scale(sampleFactor / texSize);\r\n\r\n const dy = 1 / texSize;\r\n let fy = 0;\r\n\r\n for (let y = 0; y < texSize; y++) {\r\n for (let sy = 0; sy < samples; sy++) {\r\n let xv1 = faceData[0];\r\n let xv2 = faceData[2];\r\n\r\n for (let x = 0; x < texSize; x++) {\r\n for (let sx = 0; sx < samples; sx++) {\r\n const v = xv2.subtract(xv1).scale(fy).add(xv1);\r\n v.normalize();\r\n\r\n const color = this.CalcProjectionSpherical(v, float32Array, inputWidth, inputHeight);\r\n\r\n // 3 channels per pixels\r\n textureArray[y * texSize * 3 + x * 3 + 0] += color.r * sampleFactorSqr;\r\n textureArray[y * texSize * 3 + x * 3 + 1] += color.g * sampleFactorSqr;\r\n textureArray[y * texSize * 3 + x * 3 + 2] += color.b * sampleFactorSqr;\r\n\r\n xv1 = xv1.add(rotDX1);\r\n xv2 = xv2.add(rotDX2);\r\n }\r\n }\r\n\r\n fy += dy * sampleFactor;\r\n }\r\n }\r\n\r\n return textureArray;\r\n }\r\n\r\n private static CalcProjectionSpherical(vDir: Vector3, float32Array: Float32Array, inputWidth: number, inputHeight: number): any {\r\n let theta = Math.atan2(vDir.z, vDir.x);\r\n const phi = Math.acos(vDir.y);\r\n\r\n while (theta < -Math.PI) {\r\n theta += 2 * Math.PI;\r\n }\r\n while (theta > Math.PI) {\r\n theta -= 2 * Math.PI;\r\n }\r\n\r\n let dx = theta / Math.PI;\r\n const dy = phi / Math.PI;\r\n\r\n // recenter.\r\n dx = dx * 0.5 + 0.5;\r\n\r\n let px = Math.round(dx * inputWidth);\r\n if (px < 0) {\r\n px = 0;\r\n } else if (px >= inputWidth) {\r\n px = inputWidth - 1;\r\n }\r\n\r\n let py = Math.round(dy * inputHeight);\r\n if (py < 0) {\r\n py = 0;\r\n } else if (py >= inputHeight) {\r\n py = inputHeight - 1;\r\n }\r\n\r\n const inputY = inputHeight - py - 1;\r\n const r = float32Array[inputY * inputWidth * 3 + px * 3 + 0];\r\n const g = float32Array[inputY * inputWidth * 3 + px * 3 + 1];\r\n const b = float32Array[inputY * inputWidth * 3 + px * 3 + 2];\r\n\r\n return {\r\n r: r,\r\n g: g,\r\n b: b,\r\n };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"panoramaToCubemap.js","sourceRoot":"","sources":["../../../../../dev/core/src/Misc/HighDynamicRange/panoramaToCubemap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAqEpD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAQ/B;;;;;;;;;OASG;IACI,MAAM,CAAC,wBAAwB,CAAC,YAA0B,EAAE,UAAkB,EAAE,WAAmB,EAAE,IAAY,EAAE,WAAW,GAAG,KAAK;QACzI,IAAI,CAAC,YAAY,EAAE;YACf,4CAA4C;YAC5C,MAAM,gDAAgD,CAAC;SAC1D;QAED,IAAI,YAAY,CAAC,MAAM,IAAI,UAAU,GAAG,WAAW,GAAG,CAAC,EAAE;YACrD,4CAA4C;YAC5C,MAAM,+CAA+C,CAAC;SACzD;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QAC1H,MAAM,WAAW,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QACxH,MAAM,WAAW,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,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AC,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AACjI,8BAAO,GAAG,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"../../types\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Constants } from \"../../Engines/constants\";\r\n\r\n/**\r\n * CubeMap information grouping all the data for each faces as well as the cubemap size.\r\n */\r\nexport interface CubeMapInfo {\r\n /**\r\n * The pixel array for the front face.\r\n * This is stored in format, left to right, up to down format.\r\n */\r\n front: Nullable<ArrayBufferView>;\r\n\r\n /**\r\n * The pixel array for the back face.\r\n * This is stored in format, left to right, up to down format.\r\n */\r\n back: Nullable<ArrayBufferView>;\r\n\r\n /**\r\n * The pixel array for the left face.\r\n * This is stored in format, left to right, up to down format.\r\n */\r\n left: Nullable<ArrayBufferView>;\r\n\r\n /**\r\n * The pixel array for the right face.\r\n * This is stored in format, left to right, up to down format.\r\n */\r\n right: Nullable<ArrayBufferView>;\r\n\r\n /**\r\n * The pixel array for the up face.\r\n * This is stored in format, left to right, up to down format.\r\n */\r\n up: Nullable<ArrayBufferView>;\r\n\r\n /**\r\n * The pixel array for the down face.\r\n * This is stored in format, left to right, up to down format.\r\n */\r\n down: Nullable<ArrayBufferView>;\r\n\r\n /**\r\n * The size of the cubemap stored.\r\n *\r\n * Each faces will be size * size pixels.\r\n */\r\n size: number;\r\n\r\n /**\r\n * The format of the texture.\r\n *\r\n * RGBA, RGB.\r\n */\r\n format: number;\r\n\r\n /**\r\n * The type of the texture data.\r\n *\r\n * UNSIGNED_INT, FLOAT.\r\n */\r\n type: number;\r\n\r\n /**\r\n * Specifies whether the texture is in gamma space.\r\n */\r\n gammaSpace: boolean;\r\n}\r\n\r\n/**\r\n * Helper class useful to convert panorama picture to their cubemap representation in 6 faces.\r\n */\r\nexport class PanoramaToCubeMapTools {\r\n private static FACE_LEFT = [new Vector3(-1.0, -1.0, -1.0), new Vector3(1.0, -1.0, -1.0), new Vector3(-1.0, 1.0, -1.0), new Vector3(1.0, 1.0, -1.0)];\r\n private static FACE_RIGHT = [new Vector3(1.0, -1.0, 1.0), new Vector3(-1.0, -1.0, 1.0), new Vector3(1.0, 1.0, 1.0), new Vector3(-1.0, 1.0, 1.0)];\r\n private static FACE_FRONT = [new Vector3(1.0, -1.0, -1.0), new Vector3(1.0, -1.0, 1.0), new Vector3(1.0, 1.0, -1.0), new Vector3(1.0, 1.0, 1.0)];\r\n private static FACE_BACK = [new Vector3(-1.0, -1.0, 1.0), new Vector3(-1.0, -1.0, -1.0), new Vector3(-1.0, 1.0, 1.0), new Vector3(-1.0, 1.0, -1.0)];\r\n private static FACE_DOWN = [new Vector3(1.0, 1.0, -1.0), new Vector3(1.0, 1.0, 1.0), new Vector3(-1.0, 1.0, -1.0), new Vector3(-1.0, 1.0, 1.0)];\r\n private static FACE_UP = [new Vector3(-1.0, -1.0, -1.0), new Vector3(-1.0, -1.0, 1.0), new Vector3(1.0, -1.0, -1.0), new Vector3(1.0, -1.0, 1.0)];\r\n\r\n /**\r\n * Converts a panorama stored in RGB right to left up to down format into a cubemap (6 faces).\r\n *\r\n * @param float32Array The source data.\r\n * @param inputWidth The width of the input panorama.\r\n * @param inputHeight The height of the input panorama.\r\n * @param size The willing size of the generated cubemap (each faces will be size * size pixels)\r\n * @param supersample enable supersampling the cubemap\r\n * @returns The cubemap data\r\n */\r\n public static ConvertPanoramaToCubemap(float32Array: Float32Array, inputWidth: number, inputHeight: number, size: number, supersample = false): CubeMapInfo {\r\n if (!float32Array) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"ConvertPanoramaToCubemap: input cannot be null\";\r\n }\r\n\r\n if (float32Array.length != inputWidth * inputHeight * 3) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"ConvertPanoramaToCubemap: input size is wrong\";\r\n }\r\n\r\n const textureFront = this.CreateCubemapTexture(size, this.FACE_FRONT, float32Array, inputWidth, inputHeight, supersample);\r\n const textureBack = this.CreateCubemapTexture(size, this.FACE_BACK, float32Array, inputWidth, inputHeight, supersample);\r\n const textureLeft = this.CreateCubemapTexture(size, this.FACE_LEFT, float32Array, inputWidth, inputHeight, supersample);\r\n const textureRight = this.CreateCubemapTexture(size, this.FACE_RIGHT, float32Array, inputWidth, inputHeight, supersample);\r\n const textureUp = this.CreateCubemapTexture(size, this.FACE_UP, float32Array, inputWidth, inputHeight, supersample);\r\n const textureDown = this.CreateCubemapTexture(size, this.FACE_DOWN, float32Array, inputWidth, inputHeight, supersample);\r\n\r\n return {\r\n front: textureFront,\r\n back: textureBack,\r\n left: textureLeft,\r\n right: textureRight,\r\n up: textureUp,\r\n down: textureDown,\r\n size: size,\r\n type: Constants.TEXTURETYPE_FLOAT,\r\n format: Constants.TEXTUREFORMAT_RGB,\r\n gammaSpace: false,\r\n };\r\n }\r\n\r\n private static CreateCubemapTexture(texSize: number, faceData: Vector3[], float32Array: Float32Array, inputWidth: number, inputHeight: number, supersample = false) {\r\n const buffer = new ArrayBuffer(texSize * texSize * 4 * 3);\r\n const textureArray = new Float32Array(buffer);\r\n\r\n // If supersampling, determine number of samples needed when source texture width is divided for 4 cube faces\r\n const samples = supersample ? Math.max(1, Math.round(inputWidth / 4 / texSize)) : 1;\r\n const sampleFactor = 1 / samples;\r\n const sampleFactorSqr = sampleFactor * sampleFactor;\r\n\r\n const rotDX1 = faceData[1].subtract(faceData[0]).scale(sampleFactor / texSize);\r\n const rotDX2 = faceData[3].subtract(faceData[2]).scale(sampleFactor / texSize);\r\n\r\n const dy = 1 / texSize;\r\n let fy = 0;\r\n\r\n for (let y = 0; y < texSize; y++) {\r\n for (let sy = 0; sy < samples; sy++) {\r\n let xv1 = faceData[0];\r\n let xv2 = faceData[2];\r\n\r\n for (let x = 0; x < texSize; x++) {\r\n for (let sx = 0; sx < samples; sx++) {\r\n const v = xv2.subtract(xv1).scale(fy).add(xv1);\r\n v.normalize();\r\n\r\n const color = this.CalcProjectionSpherical(v, float32Array, inputWidth, inputHeight);\r\n\r\n // 3 channels per pixels\r\n textureArray[y * texSize * 3 + x * 3 + 0] += color.r * sampleFactorSqr;\r\n textureArray[y * texSize * 3 + x * 3 + 1] += color.g * sampleFactorSqr;\r\n textureArray[y * texSize * 3 + x * 3 + 2] += color.b * sampleFactorSqr;\r\n\r\n xv1 = xv1.add(rotDX1);\r\n xv2 = xv2.add(rotDX2);\r\n }\r\n }\r\n\r\n fy += dy * sampleFactor;\r\n }\r\n }\r\n\r\n return textureArray;\r\n }\r\n\r\n private static CalcProjectionSpherical(vDir: Vector3, float32Array: Float32Array, inputWidth: number, inputHeight: number): any {\r\n let theta = Math.atan2(vDir.z, vDir.x);\r\n const phi = Math.acos(vDir.y);\r\n\r\n while (theta < -Math.PI) {\r\n theta += 2 * Math.PI;\r\n }\r\n while (theta > Math.PI) {\r\n theta -= 2 * Math.PI;\r\n }\r\n\r\n let dx = theta / Math.PI;\r\n const dy = phi / Math.PI;\r\n\r\n // recenter.\r\n dx = dx * 0.5 + 0.5;\r\n\r\n let px = Math.round(dx * inputWidth);\r\n if (px < 0) {\r\n px = 0;\r\n } else if (px >= inputWidth) {\r\n px = inputWidth - 1;\r\n }\r\n\r\n let py = Math.round(dy * inputHeight);\r\n if (py < 0) {\r\n py = 0;\r\n } else if (py >= inputHeight) {\r\n py = inputHeight - 1;\r\n }\r\n\r\n const inputY = inputHeight - py - 1;\r\n const r = float32Array[inputY * inputWidth * 3 + px * 3 + 0];\r\n const g = float32Array[inputY * inputWidth * 3 + px * 3 + 1];\r\n const b = float32Array[inputY * inputWidth * 3 + px * 3 + 2];\r\n\r\n return {\r\n r: r,\r\n g: g,\r\n b: b,\r\n };\r\n }\r\n}\r\n"]}
@@ -205,6 +205,7 @@ export declare class ContainerAssetTask extends AbstractAssetTask {
205
205
  * @param meshesNames defines the list of mesh's names you want to load
206
206
  * @param rootUrl defines the root url to use as a base to load your meshes and associated resources
207
207
  * @param sceneFilename defines the filename or File of the scene to load from
208
+ * @param extension defines the extension to use to load the scene (if not defined, ".babylon" will be used)
208
209
  */
209
210
  constructor(
210
211
  /**
@@ -293,6 +294,7 @@ export declare class MeshAssetTask extends AbstractAssetTask {
293
294
  * @param meshesNames defines the list of mesh's names you want to load
294
295
  * @param rootUrl defines the root url to use as a base to load your meshes and associated resources
295
296
  * @param sceneFilename defines the filename or File of the scene to load from
297
+ * @param extension defines the extension to use to load the scene (if not defined, ".babylon" will be used)
296
298
  */
297
299
  constructor(
298
300
  /**
@@ -369,6 +371,7 @@ export declare class AnimationAssetTask extends AbstractAssetTask {
369
371
  * @param rootUrl defines the root url to use as a base to load your meshes and associated resources
370
372
  * @param filename defines the filename or File of the scene to load from
371
373
  * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)
374
+ * @param extension defines the extension to use to load the scene (if not defined, ".babylon" will be used)
372
375
  */
373
376
  constructor(
374
377
  /**
@@ -158,6 +158,7 @@ export class ContainerAssetTask extends AbstractAssetTask {
158
158
  * @param meshesNames defines the list of mesh's names you want to load
159
159
  * @param rootUrl defines the root url to use as a base to load your meshes and associated resources
160
160
  * @param sceneFilename defines the filename or File of the scene to load from
161
+ * @param extension defines the extension to use to load the scene (if not defined, ".babylon" will be used)
161
162
  */
162
163
  constructor(
163
164
  /**
@@ -217,6 +218,7 @@ export class MeshAssetTask extends AbstractAssetTask {
217
218
  * @param meshesNames defines the list of mesh's names you want to load
218
219
  * @param rootUrl defines the root url to use as a base to load your meshes and associated resources
219
220
  * @param sceneFilename defines the filename or File of the scene to load from
221
+ * @param extension defines the extension to use to load the scene (if not defined, ".babylon" will be used)
220
222
  */
221
223
  constructor(
222
224
  /**
@@ -275,6 +277,7 @@ export class AnimationAssetTask extends AbstractAssetTask {
275
277
  * @param rootUrl defines the root url to use as a base to load your meshes and associated resources
276
278
  * @param filename defines the filename or File of the scene to load from
277
279
  * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)
280
+ * @param extension defines the extension to use to load the scene (if not defined, ".babylon" will be used)
278
281
  */
279
282
  constructor(
280
283
  /**