@onerjs/core 8.53.5 → 8.53.6

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 (841) hide show
  1. package/Animations/animationGroup.d.ts +0 -1
  2. package/Animations/animationGroup.js +0 -1
  3. package/Animations/animationGroup.js.map +1 -1
  4. package/Animations/animationGroup.pure.js +2 -0
  5. package/Animations/animationGroup.pure.js.map +1 -1
  6. package/Animations/runtimeAnimation.js +11 -0
  7. package/Animations/runtimeAnimation.js.map +1 -1
  8. package/Audio/audioSceneComponent.pure.js +1 -1
  9. package/AudioV2/abstractAudio/abstractSound.d.ts +2 -1
  10. package/AudioV2/abstractAudio/abstractSound.js +7 -2
  11. package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
  12. package/AudioV2/abstractAudio/abstractSoundInstance.d.ts +3 -1
  13. package/AudioV2/abstractAudio/abstractSoundInstance.js.map +1 -1
  14. package/AudioV2/abstractAudio/staticSound.d.ts +6 -0
  15. package/AudioV2/abstractAudio/staticSound.js +17 -1
  16. package/AudioV2/abstractAudio/staticSound.js.map +1 -1
  17. package/AudioV2/abstractAudio/staticSoundInstance.d.ts +4 -2
  18. package/AudioV2/abstractAudio/staticSoundInstance.js.map +1 -1
  19. package/AudioV2/abstractAudio/streamingSound.d.ts +6 -0
  20. package/AudioV2/abstractAudio/streamingSound.js +9 -1
  21. package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
  22. package/AudioV2/webAudio/webAudioStaticSound.d.ts +7 -1
  23. package/AudioV2/webAudio/webAudioStaticSound.js +56 -8
  24. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  25. package/AudioV2/webAudio/webAudioStreamingSound.d.ts +3 -1
  26. package/AudioV2/webAudio/webAudioStreamingSound.js +16 -4
  27. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  28. package/BakedVertexAnimation/bakedVertexAnimationManager.d.ts +2 -2
  29. package/BakedVertexAnimation/bakedVertexAnimationManager.js +151 -121
  30. package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
  31. package/Behaviors/Cameras/interpolatingBehavior.d.ts +17 -2
  32. package/Behaviors/Cameras/interpolatingBehavior.js +53 -23
  33. package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
  34. package/Bones/bone.pure.js +3 -3
  35. package/Buffers/buffer.pure.js +0 -12
  36. package/Buffers/buffer.pure.js.map +1 -1
  37. package/Cameras/Inputs/BaseCameraMouseWheelInput.js +141 -126
  38. package/Cameras/Inputs/BaseCameraMouseWheelInput.js.map +1 -1
  39. package/Cameras/Inputs/BaseCameraPointersInput.d.ts +2 -1
  40. package/Cameras/Inputs/BaseCameraPointersInput.js +290 -277
  41. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  42. package/Cameras/Inputs/arcRotateCameraGamepadInput.js +115 -102
  43. package/Cameras/Inputs/arcRotateCameraGamepadInput.js.map +1 -1
  44. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.d.ts +3 -0
  45. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js +334 -273
  46. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
  47. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +273 -258
  48. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
  49. package/Cameras/Inputs/arcRotateCameraPointersInput.js +237 -213
  50. package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
  51. package/Cameras/Inputs/flyCameraKeyboardInput.js +199 -168
  52. package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
  53. package/Cameras/Inputs/flyCameraMouseInput.js +243 -229
  54. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  55. package/Cameras/Inputs/followCameraKeyboardMoveInput.js +311 -266
  56. package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
  57. package/Cameras/Inputs/followCameraMouseWheelInput.js +139 -119
  58. package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
  59. package/Cameras/Inputs/followCameraPointersInput.js +239 -203
  60. package/Cameras/Inputs/followCameraPointersInput.js.map +1 -1
  61. package/Cameras/Inputs/freeCameraGamepadInput.js +127 -114
  62. package/Cameras/Inputs/freeCameraGamepadInput.js.map +1 -1
  63. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +278 -244
  64. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
  65. package/Cameras/Inputs/freeCameraMouseInput.js +216 -202
  66. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  67. package/Cameras/Inputs/freeCameraMouseWheelInput.js +368 -353
  68. package/Cameras/Inputs/freeCameraMouseWheelInput.js.map +1 -1
  69. package/Cameras/Inputs/freeCameraTouchInput.js +185 -172
  70. package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
  71. package/Cameras/Inputs/geospatialCameraKeyboardInput.d.ts +2 -0
  72. package/Cameras/Inputs/geospatialCameraKeyboardInput.js +291 -246
  73. package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
  74. package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +11 -1
  75. package/Cameras/Inputs/geospatialCameraPointersInput.js +18 -2
  76. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  77. package/Cameras/Inputs/orbitCameraPointersInput.js +112 -96
  78. package/Cameras/Inputs/orbitCameraPointersInput.js.map +1 -1
  79. package/Cameras/VR/vrExperienceHelper.d.ts +0 -2
  80. package/Cameras/VR/vrExperienceHelper.js +0 -2
  81. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  82. package/Cameras/VR/vrExperienceHelper.pure.js +5 -0
  83. package/Cameras/VR/vrExperienceHelper.pure.js.map +1 -1
  84. package/Cameras/arcRotateCamera.pure.js +1559 -1479
  85. package/Cameras/arcRotateCamera.pure.js.map +1 -1
  86. package/Cameras/camera.pure.js +1225 -1178
  87. package/Cameras/camera.pure.js.map +1 -1
  88. package/Cameras/flyCamera.pure.js +369 -351
  89. package/Cameras/flyCamera.pure.js.map +1 -1
  90. package/Cameras/followCamera.pure.js +229 -192
  91. package/Cameras/followCamera.pure.js.map +1 -1
  92. package/Cameras/freeCamera.pure.js +373 -351
  93. package/Cameras/freeCamera.pure.js.map +1 -1
  94. package/Cameras/geospatialCamera.pure.d.ts +30 -7
  95. package/Cameras/geospatialCamera.pure.js +502 -457
  96. package/Cameras/geospatialCamera.pure.js.map +1 -1
  97. package/Cameras/geospatialCameraMovement.js +2 -2
  98. package/Cameras/geospatialCameraMovement.js.map +1 -1
  99. package/Cameras/targetCamera.pure.d.ts +7 -0
  100. package/Cameras/targetCamera.pure.js +550 -509
  101. package/Cameras/targetCamera.pure.js.map +1 -1
  102. package/Cameras/universalCamera.pure.js +98 -85
  103. package/Cameras/universalCamera.pure.js.map +1 -1
  104. package/Collisions/gpuPicker.d.ts +111 -4
  105. package/Collisions/gpuPicker.js +696 -119
  106. package/Collisions/gpuPicker.js.map +1 -1
  107. package/Compute/computeShader.pure.js +372 -355
  108. package/Compute/computeShader.pure.js.map +1 -1
  109. package/Culling/Helper/transformFeedbackBoundingHelper.pure.js +2 -2
  110. package/Decorators/nodeDecorator.d.ts +11 -1
  111. package/Decorators/nodeDecorator.js +43 -6
  112. package/Decorators/nodeDecorator.js.map +1 -1
  113. package/Engines/AbstractEngine/abstractEngine.loadFile.pure.js +8 -0
  114. package/Engines/AbstractEngine/abstractEngine.loadFile.pure.js.map +1 -1
  115. package/Engines/Native/nativeHelpers.js +15 -0
  116. package/Engines/Native/nativeHelpers.js.map +1 -1
  117. package/Engines/Native/nativeInterfaces.d.ts +7 -2
  118. package/Engines/Native/nativeInterfaces.js.map +1 -1
  119. package/Engines/Native/nativeRenderTargetWrapper.d.ts +5 -0
  120. package/Engines/Native/nativeRenderTargetWrapper.js +35 -1
  121. package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
  122. package/Engines/Processors/shaderProcessor.js +5 -3
  123. package/Engines/Processors/shaderProcessor.js.map +1 -1
  124. package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js +16 -3
  125. package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js.map +1 -1
  126. package/Engines/WebGPU/webgpuClearQuad.pure.js +7 -1
  127. package/Engines/WebGPU/webgpuClearQuad.pure.js.map +1 -1
  128. package/Engines/abstractEngine.functions.d.ts +8 -2
  129. package/Engines/abstractEngine.functions.js +12 -4
  130. package/Engines/abstractEngine.functions.js.map +1 -1
  131. package/Engines/abstractEngine.pure.d.ts +20 -1
  132. package/Engines/abstractEngine.pure.js +21 -134
  133. package/Engines/abstractEngine.pure.js.map +1 -1
  134. package/Engines/engine.d.ts +208 -0
  135. package/Engines/engine.pure.js +0 -15
  136. package/Engines/engine.pure.js.map +1 -1
  137. package/Engines/nullEngine.pure.d.ts +66 -0
  138. package/Engines/nullEngine.pure.js +97 -0
  139. package/Engines/nullEngine.pure.js.map +1 -1
  140. package/Engines/thinEngine.pure.d.ts +0 -13
  141. package/Engines/thinEngine.pure.js +4 -23
  142. package/Engines/thinEngine.pure.js.map +1 -1
  143. package/Engines/thinNativeEngine.d.ts +0 -1
  144. package/Engines/thinNativeEngine.js +0 -1
  145. package/Engines/thinNativeEngine.js.map +1 -1
  146. package/Engines/thinNativeEngine.pure.d.ts +27 -0
  147. package/Engines/thinNativeEngine.pure.js +383 -17
  148. package/Engines/thinNativeEngine.pure.js.map +1 -1
  149. package/Engines/webgpuEngine.d.ts +1 -0
  150. package/Engines/webgpuEngine.js +1 -0
  151. package/Engines/webgpuEngine.js.map +1 -1
  152. package/Engines/webgpuEngine.pure.d.ts +9 -0
  153. package/Engines/webgpuEngine.pure.js +7 -0
  154. package/Engines/webgpuEngine.pure.js.map +1 -1
  155. package/FlowGraph/flowGraph.js +9 -0
  156. package/FlowGraph/flowGraph.js.map +1 -1
  157. package/FlowGraph/flowGraphContext.js +597 -584
  158. package/FlowGraph/flowGraphContext.js.map +1 -1
  159. package/FlowGraph/flowGraphDataConnection.pure.d.ts +14 -0
  160. package/FlowGraph/flowGraphDataConnection.pure.js +38 -1
  161. package/FlowGraph/flowGraphDataConnection.pure.js.map +1 -1
  162. package/FlowGraph/serialization.d.ts +11 -0
  163. package/FlowGraph/serialization.js +11 -1
  164. package/FlowGraph/serialization.js.map +1 -1
  165. package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.pure.js +182 -170
  166. package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.pure.js.map +1 -1
  167. package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.pure.js +196 -184
  168. package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.pure.js.map +1 -1
  169. package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js +222 -210
  170. package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js.map +1 -1
  171. package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +123 -111
  172. package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -1
  173. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +158 -146
  174. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js.map +1 -1
  175. package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.pure.js +63 -51
  176. package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.pure.js.map +1 -1
  177. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.pure.js +122 -110
  178. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.pure.js.map +1 -1
  179. package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.pure.js +76 -64
  180. package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.pure.js.map +1 -1
  181. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.pure.js +89 -77
  182. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.pure.js.map +1 -1
  183. package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.pure.js +134 -122
  184. package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.pure.js.map +1 -1
  185. package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.pure.js +58 -46
  186. package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.pure.js.map +1 -1
  187. package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.pure.js +107 -95
  188. package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.pure.js.map +1 -1
  189. package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.pure.js +181 -169
  190. package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.pure.js.map +1 -1
  191. package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.pure.js +63 -51
  192. package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.pure.js.map +1 -1
  193. package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.pure.js +63 -51
  194. package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.pure.js.map +1 -1
  195. package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.pure.js +76 -64
  196. package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.pure.js.map +1 -1
  197. package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.pure.js +246 -234
  198. package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.pure.js.map +1 -1
  199. package/FrameGraph/Node/Blocks/PostProcesses/motionBlurPostProcessBlock.pure.js +108 -96
  200. package/FrameGraph/Node/Blocks/PostProcesses/motionBlurPostProcessBlock.pure.js.map +1 -1
  201. package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.pure.js +87 -75
  202. package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.pure.js.map +1 -1
  203. package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.pure.js +76 -64
  204. package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.pure.js.map +1 -1
  205. package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.pure.js +313 -301
  206. package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.pure.js.map +1 -1
  207. package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.pure.js +502 -490
  208. package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.pure.js.map +1 -1
  209. package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.pure.js +147 -135
  210. package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.pure.js.map +1 -1
  211. package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.pure.js +90 -78
  212. package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.pure.js.map +1 -1
  213. package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.pure.js +179 -167
  214. package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.pure.js.map +1 -1
  215. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +462 -451
  216. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  217. package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.js +265 -253
  218. package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.js.map +1 -1
  219. package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.pure.js +204 -192
  220. package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.pure.js.map +1 -1
  221. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js +611 -550
  222. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js.map +1 -1
  223. package/FrameGraph/Node/Blocks/Rendering/iblShadowsRendererBlock.pure.js +320 -308
  224. package/FrameGraph/Node/Blocks/Rendering/iblShadowsRendererBlock.pure.js.map +1 -1
  225. package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.pure.js +87 -75
  226. package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.pure.js.map +1 -1
  227. package/FrameGraph/Node/Blocks/Textures/clearBlock.pure.js +154 -142
  228. package/FrameGraph/Node/Blocks/Textures/clearBlock.pure.js.map +1 -1
  229. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.pure.js +150 -138
  230. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.pure.js.map +1 -1
  231. package/FrameGraph/Node/Blocks/inputBlock.pure.js +270 -256
  232. package/FrameGraph/Node/Blocks/inputBlock.pure.js.map +1 -1
  233. package/FrameGraph/Node/Blocks/lightingVolumeBlock.pure.js +95 -83
  234. package/FrameGraph/Node/Blocks/lightingVolumeBlock.pure.js.map +1 -1
  235. package/FrameGraph/Node/nodeRenderGraph.js +715 -693
  236. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  237. package/FrameGraph/Node/nodeRenderGraphBlock.js +548 -533
  238. package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
  239. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.d.ts +2 -2
  240. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js +43 -51
  241. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js.map +1 -1
  242. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.d.ts +0 -1
  243. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js +0 -1
  244. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js.map +1 -1
  245. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.d.ts +0 -1
  246. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js +66 -35
  247. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js.map +1 -1
  248. package/Helpers/environmentHelper.js +2 -2
  249. package/Helpers/environmentHelper.js.map +1 -1
  250. package/Layers/effectLayer.js +529 -519
  251. package/Layers/effectLayer.js.map +1 -1
  252. package/Layers/glowLayer.pure.js +428 -413
  253. package/Layers/glowLayer.pure.js.map +1 -1
  254. package/Layers/highlightLayer.pure.js +473 -458
  255. package/Layers/highlightLayer.pure.js.map +1 -1
  256. package/Layers/selectionOutlineLayer.pure.js +360 -345
  257. package/Layers/selectionOutlineLayer.pure.js.map +1 -1
  258. package/Lights/Clustered/clusteredLightContainer.pure.d.ts +1 -1
  259. package/Lights/Clustered/clusteredLightContainer.pure.js +583 -558
  260. package/Lights/Clustered/clusteredLightContainer.pure.js.map +1 -1
  261. package/Lights/Shadows/shadowGenerator.js +6 -1
  262. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  263. package/Lights/areaLight.pure.js +61 -39
  264. package/Lights/areaLight.pure.js.map +1 -1
  265. package/Lights/directionalLight.pure.js +308 -284
  266. package/Lights/directionalLight.pure.js.map +1 -1
  267. package/Lights/hemisphericLight.pure.js +123 -104
  268. package/Lights/hemisphericLight.pure.js.map +1 -1
  269. package/Lights/light.d.ts +5 -3
  270. package/Lights/light.js +869 -827
  271. package/Lights/light.js.map +1 -1
  272. package/Lights/pointLight.pure.js +185 -174
  273. package/Lights/pointLight.pure.js.map +1 -1
  274. package/Lights/rectAreaLight.pure.d.ts +17 -0
  275. package/Lights/rectAreaLight.pure.js +238 -159
  276. package/Lights/rectAreaLight.pure.js.map +1 -1
  277. package/Lights/shadowLight.js +280 -268
  278. package/Lights/shadowLight.js.map +1 -1
  279. package/Lights/spotLight.pure.js +460 -427
  280. package/Lights/spotLight.pure.js.map +1 -1
  281. package/Loading/Plugins/babylonFileLoader.pure.js +17 -5
  282. package/Loading/Plugins/babylonFileLoader.pure.js.map +1 -1
  283. package/Loading/sceneLoader.d.ts +5 -1
  284. package/Loading/sceneLoader.js +299 -402
  285. package/Loading/sceneLoader.js.map +1 -1
  286. package/Materials/Background/backgroundMaterial.pure.d.ts +18 -18
  287. package/Materials/Background/backgroundMaterial.pure.js +949 -794
  288. package/Materials/Background/backgroundMaterial.pure.js.map +1 -1
  289. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.d.ts +15 -0
  290. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js +34 -1
  291. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js.map +1 -1
  292. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +9 -0
  293. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +26 -2
  294. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
  295. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.d.ts +2 -1
  296. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js +169 -149
  297. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js.map +1 -1
  298. package/Materials/Node/Blocks/Dual/imageSourceBlock.pure.js +1 -1
  299. package/Materials/Node/Blocks/Dual/lightBlock.pure.js +442 -429
  300. package/Materials/Node/Blocks/Dual/lightBlock.pure.js.map +1 -1
  301. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js +396 -383
  302. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js.map +1 -1
  303. package/Materials/Node/Blocks/Dual/sceneDepthBlock.pure.js +237 -220
  304. package/Materials/Node/Blocks/Dual/sceneDepthBlock.pure.js.map +1 -1
  305. package/Materials/Node/Blocks/Dual/textureBlock.pure.js +1 -1
  306. package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.pure.js +150 -133
  307. package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.pure.js.map +1 -1
  308. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js +265 -250
  309. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js.map +1 -1
  310. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.pure.js +159 -142
  311. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.pure.js.map +1 -1
  312. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js +214 -201
  313. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js.map +1 -1
  314. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.pure.js +419 -400
  315. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.pure.js.map +1 -1
  316. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js +3 -1
  317. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js.map +1 -1
  318. package/Materials/Node/Blocks/PBR/clearCoatBlock.pure.js +302 -289
  319. package/Materials/Node/Blocks/PBR/clearCoatBlock.pure.js.map +1 -1
  320. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +1327 -1272
  321. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
  322. package/Materials/Node/Blocks/PBR/reflectionBlock.pure.js +352 -337
  323. package/Materials/Node/Blocks/PBR/reflectionBlock.pure.js.map +1 -1
  324. package/Materials/Node/Blocks/PBR/refractionBlock.pure.js +297 -277
  325. package/Materials/Node/Blocks/PBR/refractionBlock.pure.js.map +1 -1
  326. package/Materials/Node/Blocks/PBR/sheenBlock.pure.js +146 -131
  327. package/Materials/Node/Blocks/PBR/sheenBlock.pure.js.map +1 -1
  328. package/Materials/Node/Blocks/PBR/subSurfaceBlock.pure.js +158 -145
  329. package/Materials/Node/Blocks/PBR/subSurfaceBlock.pure.js.map +1 -1
  330. package/Materials/Node/Blocks/clampBlock.pure.js +92 -77
  331. package/Materials/Node/Blocks/clampBlock.pure.js.map +1 -1
  332. package/Materials/Node/Blocks/cloudBlock.pure.js +145 -132
  333. package/Materials/Node/Blocks/cloudBlock.pure.js.map +1 -1
  334. package/Materials/Node/Blocks/conditionalBlock.pure.js +182 -169
  335. package/Materials/Node/Blocks/conditionalBlock.pure.js.map +1 -1
  336. package/Materials/Node/Blocks/curveBlock.pure.js +259 -246
  337. package/Materials/Node/Blocks/curveBlock.pure.js.map +1 -1
  338. package/Materials/Node/Blocks/debugBlock.pure.js +119 -106
  339. package/Materials/Node/Blocks/debugBlock.pure.js.map +1 -1
  340. package/Materials/Node/Blocks/loopBlock.pure.js +123 -110
  341. package/Materials/Node/Blocks/loopBlock.pure.js.map +1 -1
  342. package/Materials/Node/Blocks/meshAttributeExistsBlock.pure.js +185 -172
  343. package/Materials/Node/Blocks/meshAttributeExistsBlock.pure.js.map +1 -1
  344. package/Materials/Node/Blocks/remapBlock.pure.js +127 -112
  345. package/Materials/Node/Blocks/remapBlock.pure.js.map +1 -1
  346. package/Materials/Node/Blocks/transformBlock.pure.js +196 -185
  347. package/Materials/Node/Blocks/transformBlock.pure.js.map +1 -1
  348. package/Materials/Node/Blocks/triPlanarBlock.pure.js +451 -438
  349. package/Materials/Node/Blocks/triPlanarBlock.pure.js.map +1 -1
  350. package/Materials/Node/Blocks/trigonometryBlock.pure.js +184 -171
  351. package/Materials/Node/Blocks/trigonometryBlock.pure.js.map +1 -1
  352. package/Materials/Node/Blocks/waveBlock.pure.js +97 -84
  353. package/Materials/Node/Blocks/waveBlock.pure.js.map +1 -1
  354. package/Materials/Node/Blocks/worleyNoise3DBlock.pure.js +276 -263
  355. package/Materials/Node/Blocks/worleyNoise3DBlock.pure.js.map +1 -1
  356. package/Materials/Node/nodeMaterial.pure.js +1765 -1737
  357. package/Materials/Node/nodeMaterial.pure.js.map +1 -1
  358. package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
  359. package/Materials/PBR/openpbrMaterial.pure.d.ts +102 -102
  360. package/Materials/PBR/openpbrMaterial.pure.js +3115 -2243
  361. package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
  362. package/Materials/PBR/pbrAnisotropicConfiguration.d.ts +3 -3
  363. package/Materials/PBR/pbrAnisotropicConfiguration.js +255 -227
  364. package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
  365. package/Materials/PBR/pbrBRDFConfiguration.d.ts +9 -9
  366. package/Materials/PBR/pbrBRDFConfiguration.js +203 -155
  367. package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
  368. package/Materials/PBR/pbrBaseMaterial.pure.d.ts +1 -1
  369. package/Materials/PBR/pbrBaseMaterial.pure.js +1751 -1736
  370. package/Materials/PBR/pbrBaseMaterial.pure.js.map +1 -1
  371. package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +13 -13
  372. package/Materials/PBR/pbrBaseSimpleMaterial.js +205 -117
  373. package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
  374. package/Materials/PBR/pbrClearCoatConfiguration.d.ts +9 -9
  375. package/Materials/PBR/pbrClearCoatConfiguration.js +464 -406
  376. package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
  377. package/Materials/PBR/pbrIridescenceConfiguration.d.ts +3 -3
  378. package/Materials/PBR/pbrIridescenceConfiguration.js +271 -239
  379. package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
  380. package/Materials/PBR/pbrMaterial.pure.d.ts +66 -66
  381. package/Materials/PBR/pbrMaterial.pure.js +1041 -685
  382. package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
  383. package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.d.ts +5 -5
  384. package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js +176 -115
  385. package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js.map +1 -1
  386. package/Materials/PBR/pbrSheenConfiguration.d.ts +7 -7
  387. package/Materials/PBR/pbrSheenConfiguration.js +314 -270
  388. package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
  389. package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.d.ts +5 -5
  390. package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js +172 -117
  391. package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js.map +1 -1
  392. package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +16 -16
  393. package/Materials/PBR/pbrSubSurfaceConfiguration.js +864 -764
  394. package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
  395. package/Materials/Textures/HTML/htmlInCanvasPolyfill.d.ts +43 -0
  396. package/Materials/Textures/HTML/htmlInCanvasPolyfill.js +64 -0
  397. package/Materials/Textures/HTML/htmlInCanvasPolyfill.js.map +1 -0
  398. package/Materials/Textures/HTML/htmlInteractionManager.d.ts +69 -0
  399. package/Materials/Textures/HTML/htmlInteractionManager.js +130 -0
  400. package/Materials/Textures/HTML/htmlInteractionManager.js.map +1 -0
  401. package/Materials/Textures/HTML/htmlRaycastInteractionManager.d.ts +84 -0
  402. package/Materials/Textures/HTML/htmlRaycastInteractionManager.js +246 -0
  403. package/Materials/Textures/HTML/htmlRaycastInteractionManager.js.map +1 -0
  404. package/Materials/Textures/HTML/htmlTexture.d.ts +148 -0
  405. package/Materials/Textures/HTML/htmlTexture.js +455 -0
  406. package/Materials/Textures/HTML/htmlTexture.js.map +1 -0
  407. package/Materials/Textures/HTML/index.d.ts +4 -0
  408. package/Materials/Textures/HTML/index.js +5 -0
  409. package/Materials/Textures/HTML/index.js.map +1 -0
  410. package/Materials/Textures/HTML/pure.d.ts +5 -0
  411. package/Materials/Textures/HTML/pure.js +6 -0
  412. package/Materials/Textures/HTML/pure.js.map +1 -0
  413. package/Materials/Textures/Procedurals/proceduralTexture.pure.js +671 -643
  414. package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
  415. package/Materials/Textures/baseTexture.pure.js +880 -825
  416. package/Materials/Textures/baseTexture.pure.js.map +1 -1
  417. package/Materials/Textures/cubeTexture.d.ts +0 -1
  418. package/Materials/Textures/cubeTexture.js +0 -1
  419. package/Materials/Textures/cubeTexture.js.map +1 -1
  420. package/Materials/Textures/cubeTexture.pure.js +368 -333
  421. package/Materials/Textures/cubeTexture.pure.js.map +1 -1
  422. package/Materials/Textures/dynamicTexture.d.ts +0 -1
  423. package/Materials/Textures/dynamicTexture.js +0 -1
  424. package/Materials/Textures/dynamicTexture.js.map +1 -1
  425. package/Materials/Textures/dynamicTexture.pure.js +2 -0
  426. package/Materials/Textures/dynamicTexture.pure.js.map +1 -1
  427. package/Materials/Textures/htmlElementTexture.d.ts +0 -2
  428. package/Materials/Textures/htmlElementTexture.js +0 -2
  429. package/Materials/Textures/htmlElementTexture.js.map +1 -1
  430. package/Materials/Textures/htmlElementTexture.pure.js +4 -0
  431. package/Materials/Textures/htmlElementTexture.pure.js.map +1 -1
  432. package/Materials/Textures/index.d.ts +1 -0
  433. package/Materials/Textures/index.js +1 -1
  434. package/Materials/Textures/index.js.map +1 -1
  435. package/Materials/Textures/multiRenderTarget.d.ts +0 -1
  436. package/Materials/Textures/multiRenderTarget.js +0 -1
  437. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  438. package/Materials/Textures/multiRenderTarget.pure.js +2 -0
  439. package/Materials/Textures/multiRenderTarget.pure.js.map +1 -1
  440. package/Materials/Textures/pure.d.ts +1 -0
  441. package/Materials/Textures/pure.js +1 -0
  442. package/Materials/Textures/pure.js.map +1 -1
  443. package/Materials/Textures/texture.pure.js +961 -923
  444. package/Materials/Textures/texture.pure.js.map +1 -1
  445. package/Materials/Textures/videoTexture.pure.d.ts +3 -0
  446. package/Materials/Textures/videoTexture.pure.js +450 -401
  447. package/Materials/Textures/videoTexture.pure.js.map +1 -1
  448. package/Materials/colorCurves.pure.js +510 -477
  449. package/Materials/colorCurves.pure.js.map +1 -1
  450. package/Materials/effect.pure.js +0 -7
  451. package/Materials/effect.pure.js.map +1 -1
  452. package/Materials/imageProcessing.js +12 -4
  453. package/Materials/imageProcessing.js.map +1 -1
  454. package/Materials/imageProcessingConfiguration.pure.js +647 -587
  455. package/Materials/imageProcessingConfiguration.pure.js.map +1 -1
  456. package/Materials/material.decalMapConfiguration.pure.d.ts +2 -2
  457. package/Materials/material.decalMapConfiguration.pure.js +149 -130
  458. package/Materials/material.decalMapConfiguration.pure.js.map +1 -1
  459. package/Materials/material.detailMapConfiguration.d.ts +3 -3
  460. package/Materials/material.detailMapConfiguration.js +213 -175
  461. package/Materials/material.detailMapConfiguration.js.map +1 -1
  462. package/Materials/material.pure.js +1815 -1721
  463. package/Materials/material.pure.js.map +1 -1
  464. package/Materials/materialPluginBase.pure.js +270 -249
  465. package/Materials/materialPluginBase.pure.js.map +1 -1
  466. package/Materials/materialPluginManager.pure.js +18 -8
  467. package/Materials/materialPluginManager.pure.js.map +1 -1
  468. package/Materials/materialStencilState.js +211 -200
  469. package/Materials/materialStencilState.js.map +1 -1
  470. package/Materials/meshDebugPluginMaterial.pure.d.ts +2 -2
  471. package/Materials/meshDebugPluginMaterial.pure.js +397 -275
  472. package/Materials/meshDebugPluginMaterial.pure.js.map +1 -1
  473. package/Materials/standardMaterial.pure.d.ts +32 -32
  474. package/Materials/standardMaterial.pure.js +1804 -1394
  475. package/Materials/standardMaterial.pure.js.map +1 -1
  476. package/Maths/math.color.pure.js +5 -5
  477. package/Maths/math.functions.js +38 -30
  478. package/Maths/math.functions.js.map +1 -1
  479. package/Maths/math.vector.pure.js +25 -25
  480. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +18 -8
  481. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  482. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +86 -1
  483. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +255 -104
  484. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  485. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.d.ts +39 -0
  486. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +322 -0
  487. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -0
  488. package/Meshes/GreasedLine/greasedLineMesh.pure.js +4 -4
  489. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +3 -3
  490. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +107 -94
  491. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
  492. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.pure.js +276 -263
  493. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.pure.js.map +1 -1
  494. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.pure.js +247 -232
  495. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.pure.js.map +1 -1
  496. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js +299 -284
  497. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js.map +1 -1
  498. package/Meshes/Node/Blocks/Set/aggregatorBlock.pure.js +196 -181
  499. package/Meshes/Node/Blocks/Set/aggregatorBlock.pure.js.map +1 -1
  500. package/Meshes/Node/Blocks/Set/latticeBlock.pure.js +198 -179
  501. package/Meshes/Node/Blocks/Set/latticeBlock.pure.js.map +1 -1
  502. package/Meshes/Node/Blocks/Set/setColorsBlock.pure.js +151 -138
  503. package/Meshes/Node/Blocks/Set/setColorsBlock.pure.js.map +1 -1
  504. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.pure.js +107 -94
  505. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.pure.js.map +1 -1
  506. package/Meshes/Node/Blocks/Set/setNormalsBlock.pure.js +138 -125
  507. package/Meshes/Node/Blocks/Set/setNormalsBlock.pure.js.map +1 -1
  508. package/Meshes/Node/Blocks/Set/setPositionsBlock.pure.js +213 -200
  509. package/Meshes/Node/Blocks/Set/setPositionsBlock.pure.js.map +1 -1
  510. package/Meshes/Node/Blocks/Set/setTangentsBlock.pure.js +138 -125
  511. package/Meshes/Node/Blocks/Set/setTangentsBlock.pure.js.map +1 -1
  512. package/Meshes/Node/Blocks/Set/setUVsBlock.pure.js +179 -164
  513. package/Meshes/Node/Blocks/Set/setUVsBlock.pure.js.map +1 -1
  514. package/Meshes/Node/Blocks/Sources/boxBlock.pure.js +183 -170
  515. package/Meshes/Node/Blocks/Sources/boxBlock.pure.js.map +1 -1
  516. package/Meshes/Node/Blocks/Sources/capsuleBlock.pure.js +125 -112
  517. package/Meshes/Node/Blocks/Sources/capsuleBlock.pure.js.map +1 -1
  518. package/Meshes/Node/Blocks/Sources/cylinderBlock.pure.js +153 -140
  519. package/Meshes/Node/Blocks/Sources/cylinderBlock.pure.js.map +1 -1
  520. package/Meshes/Node/Blocks/Sources/discBlock.pure.js +112 -99
  521. package/Meshes/Node/Blocks/Sources/discBlock.pure.js.map +1 -1
  522. package/Meshes/Node/Blocks/Sources/gridBlock.pure.js +133 -120
  523. package/Meshes/Node/Blocks/Sources/gridBlock.pure.js.map +1 -1
  524. package/Meshes/Node/Blocks/Sources/icoSphereBlock.pure.js +128 -115
  525. package/Meshes/Node/Blocks/Sources/icoSphereBlock.pure.js.map +1 -1
  526. package/Meshes/Node/Blocks/Sources/meshBlock.pure.js +116 -103
  527. package/Meshes/Node/Blocks/Sources/meshBlock.pure.js.map +1 -1
  528. package/Meshes/Node/Blocks/Sources/planeBlock.pure.js +160 -147
  529. package/Meshes/Node/Blocks/Sources/planeBlock.pure.js.map +1 -1
  530. package/Meshes/Node/Blocks/Sources/sphereBlock.pure.js +144 -131
  531. package/Meshes/Node/Blocks/Sources/sphereBlock.pure.js.map +1 -1
  532. package/Meshes/Node/Blocks/Sources/torusBlock.pure.js +112 -99
  533. package/Meshes/Node/Blocks/Sources/torusBlock.pure.js.map +1 -1
  534. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.pure.js +200 -185
  535. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.pure.js.map +1 -1
  536. package/Meshes/Node/Blocks/bevelBlock.pure.js +111 -98
  537. package/Meshes/Node/Blocks/bevelBlock.pure.js.map +1 -1
  538. package/Meshes/Node/Blocks/booleanGeometryBlock.pure.js +182 -165
  539. package/Meshes/Node/Blocks/booleanGeometryBlock.pure.js.map +1 -1
  540. package/Meshes/Node/Blocks/cleanGeometryBlock.pure.js +89 -76
  541. package/Meshes/Node/Blocks/cleanGeometryBlock.pure.js.map +1 -1
  542. package/Meshes/Node/Blocks/conditionBlock.pure.js +184 -169
  543. package/Meshes/Node/Blocks/conditionBlock.pure.js.map +1 -1
  544. package/Meshes/Node/Blocks/extrudeGeometryBlock.pure.js +270 -255
  545. package/Meshes/Node/Blocks/extrudeGeometryBlock.pure.js.map +1 -1
  546. package/Meshes/Node/Blocks/geometryCollectionBlock.pure.js +172 -159
  547. package/Meshes/Node/Blocks/geometryCollectionBlock.pure.js.map +1 -1
  548. package/Meshes/Node/Blocks/geometryCurveBlock.pure.js +230 -217
  549. package/Meshes/Node/Blocks/geometryCurveBlock.pure.js.map +1 -1
  550. package/Meshes/Node/Blocks/geometryEaseBlock.pure.js +256 -245
  551. package/Meshes/Node/Blocks/geometryEaseBlock.pure.js.map +1 -1
  552. package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js +206 -189
  553. package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js.map +1 -1
  554. package/Meshes/Node/Blocks/geometryTransformBlock.pure.js +166 -153
  555. package/Meshes/Node/Blocks/geometryTransformBlock.pure.js.map +1 -1
  556. package/Meshes/Node/Blocks/geometryTrigonometryBlock.pure.js +221 -208
  557. package/Meshes/Node/Blocks/geometryTrigonometryBlock.pure.js.map +1 -1
  558. package/Meshes/Node/Blocks/mappingBlock.pure.js +150 -137
  559. package/Meshes/Node/Blocks/mappingBlock.pure.js.map +1 -1
  560. package/Meshes/Node/Blocks/mathBlock.pure.js +269 -256
  561. package/Meshes/Node/Blocks/mathBlock.pure.js.map +1 -1
  562. package/Meshes/Node/Blocks/mergeGeometryBlock.pure.js +141 -128
  563. package/Meshes/Node/Blocks/mergeGeometryBlock.pure.js.map +1 -1
  564. package/Meshes/Node/Blocks/randomBlock.pure.js +161 -148
  565. package/Meshes/Node/Blocks/randomBlock.pure.js.map +1 -1
  566. package/Meshes/Node/Blocks/subdivideBlock.pure.js +102 -87
  567. package/Meshes/Node/Blocks/subdivideBlock.pure.js.map +1 -1
  568. package/Meshes/Node/nodeGeometry.js +560 -538
  569. package/Meshes/Node/nodeGeometry.js.map +1 -1
  570. package/Meshes/Node/nodeGeometryBlock.js +473 -458
  571. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  572. package/Meshes/abstractMesh.pure.js +2218 -2207
  573. package/Meshes/abstractMesh.pure.js.map +1 -1
  574. package/Meshes/geometry.js +30 -15
  575. package/Meshes/geometry.js.map +1 -1
  576. package/Meshes/mesh.pure.js +26 -14
  577. package/Meshes/mesh.pure.js.map +1 -1
  578. package/Meshes/mesh.vertexData.js +1665 -1655
  579. package/Meshes/mesh.vertexData.js.map +1 -1
  580. package/Meshes/transformNode.pure.js +1400 -1372
  581. package/Meshes/transformNode.pure.js.map +1 -1
  582. package/Misc/decorators.d.ts +34 -19
  583. package/Misc/decorators.functions.d.ts +33 -2
  584. package/Misc/decorators.functions.js +114 -35
  585. package/Misc/decorators.functions.js.map +1 -1
  586. package/Misc/decorators.js +96 -68
  587. package/Misc/decorators.js.map +1 -1
  588. package/Misc/decorators.serialization.js +47 -40
  589. package/Misc/decorators.serialization.js.map +1 -1
  590. package/Misc/decorators.serializationUtilities.d.ts +24 -0
  591. package/Misc/decorators.serializationUtilities.js +20 -0
  592. package/Misc/decorators.serializationUtilities.js.map +1 -0
  593. package/Misc/dumpTools.pure.js +43 -33
  594. package/Misc/dumpTools.pure.js.map +1 -1
  595. package/Misc/fileTools.pure.js +8 -0
  596. package/Misc/fileTools.pure.js.map +1 -1
  597. package/Misc/observable.pure.js +0 -7
  598. package/Misc/observable.pure.js.map +1 -1
  599. package/Misc/snapshotRenderingHelper.d.ts +4 -1
  600. package/Misc/snapshotRenderingHelper.js.map +1 -1
  601. package/Misc/symbolMetadataPolyfill.d.ts +11 -0
  602. package/Misc/symbolMetadataPolyfill.js +22 -0
  603. package/Misc/symbolMetadataPolyfill.js.map +1 -0
  604. package/Misc/tools.pure.js +2 -2
  605. package/Misc/tools.pure.js.map +1 -1
  606. package/Morph/morphTarget.js +382 -365
  607. package/Morph/morphTarget.js.map +1 -1
  608. package/Particles/Node/Blocks/Conditions/particleConditionBlock.pure.js +160 -145
  609. package/Particles/Node/Blocks/Conditions/particleConditionBlock.pure.js.map +1 -1
  610. package/Particles/Node/Blocks/Emitters/coneShapeBlock.pure.js +187 -174
  611. package/Particles/Node/Blocks/Emitters/coneShapeBlock.pure.js.map +1 -1
  612. package/Particles/Node/Blocks/Emitters/meshShapeBlock.pure.js +238 -219
  613. package/Particles/Node/Blocks/Emitters/meshShapeBlock.pure.js.map +1 -1
  614. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.pure.js +140 -115
  615. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.pure.js.map +1 -1
  616. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.pure.js +157 -144
  617. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.pure.js.map +1 -1
  618. package/Particles/Node/Blocks/Triggers/particleTriggerBlock.pure.js +133 -119
  619. package/Particles/Node/Blocks/Triggers/particleTriggerBlock.pure.js.map +1 -1
  620. package/Particles/Node/Blocks/Update/alignAngleBlock.pure.js +93 -80
  621. package/Particles/Node/Blocks/Update/alignAngleBlock.pure.js.map +1 -1
  622. package/Particles/Node/Blocks/particleDebugBlock.pure.js +117 -105
  623. package/Particles/Node/Blocks/particleDebugBlock.pure.js.map +1 -1
  624. package/Particles/Node/Blocks/particleFloatToIntBlock.pure.js +105 -92
  625. package/Particles/Node/Blocks/particleFloatToIntBlock.pure.js.map +1 -1
  626. package/Particles/Node/Blocks/particleGradientValueBlock.pure.js +82 -69
  627. package/Particles/Node/Blocks/particleGradientValueBlock.pure.js.map +1 -1
  628. package/Particles/Node/Blocks/particleLocalVariableBlock.pure.js +113 -101
  629. package/Particles/Node/Blocks/particleLocalVariableBlock.pure.js.map +1 -1
  630. package/Particles/Node/Blocks/particleMathBlock.pure.js +278 -265
  631. package/Particles/Node/Blocks/particleMathBlock.pure.js.map +1 -1
  632. package/Particles/Node/Blocks/particleNumberMathBlock.pure.js +155 -142
  633. package/Particles/Node/Blocks/particleNumberMathBlock.pure.js.map +1 -1
  634. package/Particles/Node/Blocks/particleRandomBlock.pure.js +156 -143
  635. package/Particles/Node/Blocks/particleRandomBlock.pure.js.map +1 -1
  636. package/Particles/Node/Blocks/particleTrigonometryBlock.pure.js +217 -204
  637. package/Particles/Node/Blocks/particleTrigonometryBlock.pure.js.map +1 -1
  638. package/Particles/Node/Blocks/particleVectorMathBlock.pure.js +106 -93
  639. package/Particles/Node/Blocks/particleVectorMathBlock.pure.js.map +1 -1
  640. package/Particles/Node/Blocks/systemBlock.pure.js +366 -330
  641. package/Particles/Node/Blocks/systemBlock.pure.js.map +1 -1
  642. package/Particles/Node/nodeParticleBlock.js +339 -324
  643. package/Particles/Node/nodeParticleBlock.js.map +1 -1
  644. package/Particles/Node/nodeParticleSystemSet.js +494 -473
  645. package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
  646. package/Particles/gpuParticleSystem.d.ts +0 -1
  647. package/Particles/gpuParticleSystem.js +0 -1
  648. package/Particles/gpuParticleSystem.js.map +1 -1
  649. package/Particles/gpuParticleSystem.pure.d.ts +4 -3
  650. package/Particles/gpuParticleSystem.pure.js +27 -16
  651. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  652. package/Particles/particleSystem.pure.js +57 -2
  653. package/Particles/particleSystem.pure.js.map +1 -1
  654. package/Particles/thinParticleSystem.d.ts +0 -1
  655. package/Particles/thinParticleSystem.js +0 -1
  656. package/Particles/thinParticleSystem.js.map +1 -1
  657. package/Particles/thinParticleSystem.pure.js +2 -0
  658. package/Particles/thinParticleSystem.pure.js.map +1 -1
  659. package/Particles/webgl2ParticleSystem.pure.js +2 -0
  660. package/Particles/webgl2ParticleSystem.pure.js.map +1 -1
  661. package/Physics/v1/physicsImpostor.pure.js +4 -4
  662. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js +675 -656
  663. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js.map +1 -1
  664. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.d.ts +0 -1
  665. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js +0 -1
  666. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js.map +1 -1
  667. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js +521 -486
  668. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js.map +1 -1
  669. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.d.ts +0 -1
  670. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +0 -1
  671. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
  672. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.pure.js +241 -220
  673. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.pure.js.map +1 -1
  674. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.pure.js +852 -835
  675. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.pure.js.map +1 -1
  676. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.pure.js +1135 -1073
  677. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.pure.js.map +1 -1
  678. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.pure.js +319 -303
  679. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.pure.js.map +1 -1
  680. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +212 -199
  681. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
  682. package/PostProcesses/blackAndWhitePostProcess.pure.js +67 -55
  683. package/PostProcesses/blackAndWhitePostProcess.pure.js.map +1 -1
  684. package/PostProcesses/bloomMergePostProcess.pure.js +74 -62
  685. package/PostProcesses/bloomMergePostProcess.pure.js.map +1 -1
  686. package/PostProcesses/blurPostProcess.pure.js +127 -115
  687. package/PostProcesses/blurPostProcess.pure.js.map +1 -1
  688. package/PostProcesses/chromaticAberrationPostProcess.pure.js +130 -118
  689. package/PostProcesses/chromaticAberrationPostProcess.pure.js.map +1 -1
  690. package/PostProcesses/circleOfConfusionPostProcess.pure.js +115 -104
  691. package/PostProcesses/circleOfConfusionPostProcess.pure.js.map +1 -1
  692. package/PostProcesses/colorCorrectionPostProcess.pure.js +55 -43
  693. package/PostProcesses/colorCorrectionPostProcess.pure.js.map +1 -1
  694. package/PostProcesses/convolutionPostProcess.pure.js +96 -84
  695. package/PostProcesses/convolutionPostProcess.pure.js.map +1 -1
  696. package/PostProcesses/extractHighlightsPostProcess.pure.js +68 -57
  697. package/PostProcesses/extractHighlightsPostProcess.pure.js.map +1 -1
  698. package/PostProcesses/filterPostProcess.pure.js +66 -54
  699. package/PostProcesses/filterPostProcess.pure.js.map +1 -1
  700. package/PostProcesses/fxaaPostProcess.pure.js.map +1 -1
  701. package/PostProcesses/grainPostProcess.pure.js +82 -70
  702. package/PostProcesses/grainPostProcess.pure.js.map +1 -1
  703. package/PostProcesses/imageProcessingPostProcess.js +334 -322
  704. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  705. package/PostProcesses/motionBlurPostProcess.pure.js +246 -235
  706. package/PostProcesses/motionBlurPostProcess.pure.js.map +1 -1
  707. package/PostProcesses/passPostProcess.pure.js +75 -63
  708. package/PostProcesses/passPostProcess.pure.js.map +1 -1
  709. package/PostProcesses/postProcess.pure.js +899 -835
  710. package/PostProcesses/postProcess.pure.js.map +1 -1
  711. package/PostProcesses/refractionPostProcess.pure.js +114 -87
  712. package/PostProcesses/refractionPostProcess.pure.js.map +1 -1
  713. package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js +108 -96
  714. package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js.map +1 -1
  715. package/PostProcesses/screenSpaceReflectionPostProcess.pure.js +241 -220
  716. package/PostProcesses/screenSpaceReflectionPostProcess.pure.js.map +1 -1
  717. package/PostProcesses/sharpenPostProcess.pure.js +86 -74
  718. package/PostProcesses/sharpenPostProcess.pure.js.map +1 -1
  719. package/PostProcesses/tonemapPostProcess.pure.js +82 -70
  720. package/PostProcesses/tonemapPostProcess.pure.js.map +1 -1
  721. package/PostProcesses/volumetricLightScatteringPostProcess.pure.js +500 -465
  722. package/PostProcesses/volumetricLightScatteringPostProcess.pure.js.map +1 -1
  723. package/PostProcesses/vrMultiviewToSingleviewPostProcess.d.ts +0 -1
  724. package/PostProcesses/vrMultiviewToSingleviewPostProcess.js +0 -1
  725. package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
  726. package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js +2 -0
  727. package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js.map +1 -1
  728. package/Probes/reflectionProbe.pure.js +238 -224
  729. package/Probes/reflectionProbe.pure.js.map +1 -1
  730. package/Rendering/GlobalIllumination/giRSMManager.pure.d.ts +1 -1
  731. package/Rendering/GlobalIllumination/giRSMManager.pure.js +138 -105
  732. package/Rendering/GlobalIllumination/giRSMManager.pure.js.map +1 -1
  733. package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.d.ts +1 -1
  734. package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js +155 -138
  735. package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js.map +1 -1
  736. package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +0 -2
  737. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +0 -2
  738. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  739. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +5 -0
  740. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
  741. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +0 -1
  742. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +0 -1
  743. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  744. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.d.ts +1 -0
  745. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +34 -0
  746. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
  747. package/Rendering/edgesRenderer.pure.js.map +1 -1
  748. package/Rendering/prePassRenderer.d.ts +0 -2
  749. package/Rendering/prePassRenderer.js +0 -2
  750. package/Rendering/prePassRenderer.js.map +1 -1
  751. package/Rendering/prePassRenderer.pure.js +2 -0
  752. package/Rendering/prePassRenderer.pure.js.map +1 -1
  753. package/Rendering/reflectiveShadowMap.pure.d.ts +1 -1
  754. package/Rendering/reflectiveShadowMap.pure.js +151 -130
  755. package/Rendering/reflectiveShadowMap.pure.js.map +1 -1
  756. package/Rendering/thinDepthPeelingRenderer.d.ts +0 -1
  757. package/Rendering/thinDepthPeelingRenderer.js +0 -1
  758. package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
  759. package/Shaders/ShadersInclude/gaussianSplatting.js +1 -0
  760. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  761. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +35 -5
  762. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  763. package/Shaders/gaussianSplatting.fragment.js +17 -1
  764. package/Shaders/gaussianSplatting.fragment.js.map +1 -1
  765. package/Shaders/gaussianSplatting.vertex.js +1 -1
  766. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  767. package/Shaders/gaussianSplattingDepth.vertex.js +1 -1
  768. package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
  769. package/Shaders/picking.fragment.js +39 -3
  770. package/Shaders/picking.fragment.js.map +1 -1
  771. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +3 -1
  772. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  773. package/ShadersWGSL/ShadersInclude/helperFunctions.js +2 -2
  774. package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
  775. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +39 -7
  776. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  777. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +4 -3
  778. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  779. package/ShadersWGSL/gaussianSplatting.fragment.js +14 -1
  780. package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
  781. package/ShadersWGSL/gaussianSplatting.vertex.js +2 -2
  782. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  783. package/ShadersWGSL/gaussianSplattingDepth.vertex.js +2 -2
  784. package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
  785. package/ShadersWGSL/lightingVolume.compute.js +2 -2
  786. package/ShadersWGSL/lightingVolume.compute.js.map +1 -1
  787. package/ShadersWGSL/picking.fragment.js +22 -1
  788. package/ShadersWGSL/picking.fragment.js.map +1 -1
  789. package/XR/features/Layers/WebXRCompositionLayer.d.ts +3 -2
  790. package/XR/features/Layers/WebXRCompositionLayer.js +2 -2
  791. package/XR/features/Layers/WebXRCompositionLayer.js.map +1 -1
  792. package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +59 -0
  793. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js +120 -0
  794. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -0
  795. package/XR/features/Layers/WebXRWebGPUProjectionLayer.d.ts +25 -0
  796. package/XR/features/Layers/WebXRWebGPUProjectionLayer.js +69 -0
  797. package/XR/features/Layers/WebXRWebGPUProjectionLayer.js.map +1 -0
  798. package/XR/features/WebXRLayers.pure.d.ts +8 -0
  799. package/XR/features/WebXRLayers.pure.js +43 -6
  800. package/XR/features/WebXRLayers.pure.js.map +1 -1
  801. package/XR/native/nativeXRRenderTarget.d.ts +2 -2
  802. package/XR/native/nativeXRRenderTarget.js +2 -2
  803. package/XR/native/nativeXRRenderTarget.js.map +1 -1
  804. package/XR/webXRExperienceHelper.js +10 -1
  805. package/XR/webXRExperienceHelper.js.map +1 -1
  806. package/XR/webXRGraphicsBinding.d.ts +90 -0
  807. package/XR/webXRGraphicsBinding.js +85 -0
  808. package/XR/webXRGraphicsBinding.js.map +1 -0
  809. package/XR/webXRLayerRenderTargetTexture.d.ts +24 -0
  810. package/XR/webXRLayerRenderTargetTexture.js +30 -0
  811. package/XR/webXRLayerRenderTargetTexture.js.map +1 -0
  812. package/XR/webXRManagedOutputCanvas.d.ts +14 -0
  813. package/XR/webXRManagedOutputCanvas.js +24 -5
  814. package/XR/webXRManagedOutputCanvas.js.map +1 -1
  815. package/XR/webXRRenderTargetTextureProvider.d.ts +25 -4
  816. package/XR/webXRRenderTargetTextureProvider.js +33 -35
  817. package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
  818. package/XR/webXRSessionManager.d.ts +11 -0
  819. package/XR/webXRSessionManager.js +37 -0
  820. package/XR/webXRSessionManager.js.map +1 -1
  821. package/XR/webXRTypes.d.ts +9 -6
  822. package/XR/webXRTypes.js.map +1 -1
  823. package/XR/webXRWebGLLayer.d.ts +2 -2
  824. package/XR/webXRWebGLLayer.js +2 -2
  825. package/XR/webXRWebGLLayer.js.map +1 -1
  826. package/XR/webXRWebGLRenderTargetTextureProvider.d.ts +12 -0
  827. package/XR/webXRWebGLRenderTargetTextureProvider.js +58 -0
  828. package/XR/webXRWebGLRenderTargetTextureProvider.js.map +1 -0
  829. package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +69 -0
  830. package/XR/webXRWebGPURenderTargetTextureProvider.js +148 -0
  831. package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -0
  832. package/index.d.ts +1 -0
  833. package/index.js +1 -0
  834. package/index.js.map +1 -1
  835. package/node.js +878 -845
  836. package/node.js.map +1 -1
  837. package/package.json +8 -14
  838. package/scene.pure.d.ts +12 -0
  839. package/scene.pure.js +36 -0
  840. package/scene.pure.js.map +1 -1
  841. package/tslib.es6.js +304 -150
@@ -1,5 +1,5 @@
1
1
  /** This file must only contain pure code and pure imports */
2
- import { __decorate } from "../tslib.es6.js";
2
+ import { __esDecorate, __runInitializers } from "../tslib.es6.js";
3
3
  import { serialize, serializeAsVector3 } from "../Misc/decorators.js";
4
4
  import { SmartArray } from "../Misc/smartArray.js";
5
5
  import { Observable } from "../Misc/observable.pure.js";
@@ -17,1212 +17,1259 @@ import { SerializationHelper } from "../Misc/decorators.serialization.js";
17
17
  * This is the base class of all the camera used in the application.
18
18
  * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras
19
19
  */
20
- export class Camera extends Node {
21
- /**
22
- * Define the current local position of the camera in the scene
23
- */
24
- get position() {
25
- return this._position;
26
- }
27
- set position(newPosition) {
28
- this._position = newPosition;
29
- }
30
- /**
31
- * The vector the camera should consider as up.
32
- * (default is Vector3(0, 1, 0) aka Vector3.Up())
33
- */
34
- set upVector(vec) {
35
- this._upVector = vec;
36
- }
37
- get upVector() {
38
- return this._upVector;
39
- }
40
- /**
41
- * The screen area in scene units squared
42
- */
43
- get screenArea() {
44
- let x;
45
- let y;
46
- if (this.mode === Camera.PERSPECTIVE_CAMERA) {
47
- if (this.fovMode === Camera.FOVMODE_VERTICAL_FIXED) {
48
- y = this.minZ * 2 * Math.tan(this.fov / 2);
49
- x = this.getEngine().getAspectRatio(this) * y;
50
- }
51
- else {
52
- x = this.minZ * 2 * Math.tan(this.fov / 2);
53
- y = x / this.getEngine().getAspectRatio(this);
20
+ let Camera = (() => {
21
+ var _a;
22
+ let _classSuper = Node;
23
+ let _instanceExtraInitializers = [];
24
+ let __position_decorators;
25
+ let __position_initializers = [];
26
+ let __position_extraInitializers = [];
27
+ let __upVector_decorators;
28
+ let __upVector_initializers = [];
29
+ let __upVector_extraInitializers = [];
30
+ let _get_orthoLeft_decorators;
31
+ let _get_orthoRight_decorators;
32
+ let _get_orthoBottom_decorators;
33
+ let _get_orthoTop_decorators;
34
+ let _fov_decorators;
35
+ let _fov_initializers = [];
36
+ let _fov_extraInitializers = [];
37
+ let _projectionPlaneTilt_decorators;
38
+ let _projectionPlaneTilt_initializers = [];
39
+ let _projectionPlaneTilt_extraInitializers = [];
40
+ let _minZ_decorators;
41
+ let _minZ_initializers = [];
42
+ let _minZ_extraInitializers = [];
43
+ let _maxZ_decorators;
44
+ let _maxZ_initializers = [];
45
+ let _maxZ_extraInitializers = [];
46
+ let _get_inertia_decorators;
47
+ let _get_mode_decorators;
48
+ let _layerMask_decorators;
49
+ let _layerMask_initializers = [];
50
+ let _layerMask_extraInitializers = [];
51
+ let _fovMode_decorators;
52
+ let _fovMode_initializers = [];
53
+ let _fovMode_extraInitializers = [];
54
+ let _cameraRigMode_decorators;
55
+ let _cameraRigMode_initializers = [];
56
+ let _cameraRigMode_extraInitializers = [];
57
+ let _interaxialDistance_decorators;
58
+ let _interaxialDistance_initializers = [];
59
+ let _interaxialDistance_extraInitializers = [];
60
+ let _isStereoscopicSideBySide_decorators;
61
+ let _isStereoscopicSideBySide_initializers = [];
62
+ let _isStereoscopicSideBySide_extraInitializers = [];
63
+ let _ignoreCameraMaxZ_decorators;
64
+ let _ignoreCameraMaxZ_initializers = [];
65
+ let _ignoreCameraMaxZ_extraInitializers = [];
66
+ return _a = class Camera extends _classSuper {
67
+ /**
68
+ * Define the current local position of the camera in the scene
69
+ */
70
+ get position() {
71
+ return this._position;
54
72
  }
55
- }
56
- else {
57
- const halfWidth = this.getEngine().getRenderWidth() / 2.0;
58
- const halfHeight = this.getEngine().getRenderHeight() / 2.0;
59
- x = (this.orthoRight ?? halfWidth) - (this.orthoLeft ?? -halfWidth);
60
- y = (this.orthoTop ?? halfHeight) - (this.orthoBottom ?? -halfHeight);
61
- }
62
- return x * y;
63
- }
64
- /**
65
- * Define the current limit on the left side for an orthographic camera
66
- * In scene unit
67
- */
68
- set orthoLeft(value) {
69
- this._orthoLeft = value;
70
- for (const rigCamera of this._rigCameras) {
71
- rigCamera.orthoLeft = value;
72
- }
73
- }
74
- get orthoLeft() {
75
- return this._orthoLeft;
76
- }
77
- /**
78
- * Define the current limit on the right side for an orthographic camera
79
- * In scene unit
80
- */
81
- set orthoRight(value) {
82
- this._orthoRight = value;
83
- for (const rigCamera of this._rigCameras) {
84
- rigCamera.orthoRight = value;
85
- }
86
- }
87
- get orthoRight() {
88
- return this._orthoRight;
89
- }
90
- /**
91
- * Define the current limit on the bottom side for an orthographic camera
92
- * In scene unit
93
- */
94
- set orthoBottom(value) {
95
- this._orthoBottom = value;
96
- for (const rigCamera of this._rigCameras) {
97
- rigCamera.orthoBottom = value;
98
- }
99
- }
100
- get orthoBottom() {
101
- return this._orthoBottom;
102
- }
103
- /**
104
- * Define the current limit on the top side for an orthographic camera
105
- * In scene unit
106
- */
107
- set orthoTop(value) {
108
- this._orthoTop = value;
109
- for (const rigCamera of this._rigCameras) {
110
- rigCamera.orthoTop = value;
111
- }
112
- }
113
- get orthoTop() {
114
- return this._orthoTop;
115
- }
116
- /**
117
- * Sets the camera's field of view in radians based on the focal length and sensor size.
118
- * @param value the focal length of the camera in mm.
119
- * @param sensorSize the sensor width size of the camera in mm. (default is 36mm, which is a full frame sensor)
120
- */
121
- setFocalLength(value, sensorSize = 36) {
122
- this.fov = 2 * Math.atan(sensorSize / (2 * value));
123
- }
124
- /**
125
- * Define the default inertia of the camera.
126
- * This helps giving a smooth feeling to the camera movement.
127
- */
128
- get inertia() {
129
- return this._baseInertia;
130
- }
131
- set inertia(value) {
132
- this._baseInertia = value;
133
- }
134
- /**
135
- * Define the mode of the camera (Camera.PERSPECTIVE_CAMERA or Camera.ORTHOGRAPHIC_CAMERA)
136
- */
137
- set mode(mode) {
138
- this._mode = mode;
139
- // Pass the mode down to the rig cameras
140
- for (const rigCamera of this._rigCameras) {
141
- rigCamera.mode = mode;
142
- }
143
- }
144
- get mode() {
145
- return this._mode;
146
- }
147
- /**
148
- * Gets a flag indicating that the camera has moved in some way since the last call to Camera.update()
149
- */
150
- get hasMoved() {
151
- return this._hasMoved;
152
- }
153
- /**
154
- * Instantiates a new camera object.
155
- * This should not be used directly but through the inherited cameras: ArcRotate, Free...
156
- * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras
157
- * @param name Defines the name of the camera in the scene
158
- * @param position Defines the position of the camera
159
- * @param scene Defines the scene the camera belongs too
160
- * @param setActiveOnSceneIfNoneActive Defines if the camera should be set as active after creation if no other camera have been defined in the scene
161
- */
162
- constructor(name, position, scene, setActiveOnSceneIfNoneActive = true) {
163
- RegisterAbstractEngineRenderPass();
164
- super(name, scene, false);
165
- /** @internal */
166
- this._position = Vector3.Zero();
167
- this._upVector = Vector3.Up();
168
- /**
169
- * Object containing oblique projection values (only used with ORTHOGRAPHIC_CAMERA)
170
- */
171
- this.oblique = null;
172
- this._orthoLeft = null;
173
- this._orthoRight = null;
174
- this._orthoBottom = null;
175
- this._orthoTop = null;
176
- /**
177
- * Field Of View is set in Radians. (default is 0.8)
178
- */
179
- this.fov = 0.8;
180
- /**
181
- * Projection plane tilt around the X axis (horizontal), set in Radians. (default is 0)
182
- * Can be used to make vertical lines in world space actually vertical on the screen.
183
- * See https://forum.babylonjs.com/t/add-vertical-shift-to-3ds-max-exporter-babylon-cameras/17480
184
- */
185
- this.projectionPlaneTilt = 0;
186
- /**
187
- * Define the minimum distance the camera can see from.
188
- * This is important to note that the depth buffer are not infinite and the closer it starts
189
- * the more your scene might encounter depth fighting issue.
190
- */
191
- this.minZ = 1;
73
+ set position(newPosition) {
74
+ this._position = newPosition;
75
+ }
76
+ /**
77
+ * The vector the camera should consider as up.
78
+ * (default is Vector3(0, 1, 0) aka Vector3.Up())
79
+ */
80
+ set upVector(vec) {
81
+ this._upVector = vec;
82
+ }
83
+ get upVector() {
84
+ return this._upVector;
85
+ }
86
+ /**
87
+ * The screen area in scene units squared
88
+ */
89
+ get screenArea() {
90
+ let x;
91
+ let y;
92
+ if (this.mode === _a.PERSPECTIVE_CAMERA) {
93
+ if (this.fovMode === _a.FOVMODE_VERTICAL_FIXED) {
94
+ y = this.minZ * 2 * Math.tan(this.fov / 2);
95
+ x = this.getEngine().getAspectRatio(this) * y;
96
+ }
97
+ else {
98
+ x = this.minZ * 2 * Math.tan(this.fov / 2);
99
+ y = x / this.getEngine().getAspectRatio(this);
100
+ }
101
+ }
102
+ else {
103
+ const halfWidth = this.getEngine().getRenderWidth() / 2.0;
104
+ const halfHeight = this.getEngine().getRenderHeight() / 2.0;
105
+ x = (this.orthoRight ?? halfWidth) - (this.orthoLeft ?? -halfWidth);
106
+ y = (this.orthoTop ?? halfHeight) - (this.orthoBottom ?? -halfHeight);
107
+ }
108
+ return x * y;
109
+ }
110
+ /**
111
+ * Define the current limit on the left side for an orthographic camera
112
+ * In scene unit
113
+ */
114
+ set orthoLeft(value) {
115
+ this._orthoLeft = value;
116
+ for (const rigCamera of this._rigCameras) {
117
+ rigCamera.orthoLeft = value;
118
+ }
119
+ }
120
+ get orthoLeft() {
121
+ return this._orthoLeft;
122
+ }
123
+ /**
124
+ * Define the current limit on the right side for an orthographic camera
125
+ * In scene unit
126
+ */
127
+ set orthoRight(value) {
128
+ this._orthoRight = value;
129
+ for (const rigCamera of this._rigCameras) {
130
+ rigCamera.orthoRight = value;
131
+ }
132
+ }
133
+ get orthoRight() {
134
+ return this._orthoRight;
135
+ }
136
+ /**
137
+ * Define the current limit on the bottom side for an orthographic camera
138
+ * In scene unit
139
+ */
140
+ set orthoBottom(value) {
141
+ this._orthoBottom = value;
142
+ for (const rigCamera of this._rigCameras) {
143
+ rigCamera.orthoBottom = value;
144
+ }
145
+ }
146
+ get orthoBottom() {
147
+ return this._orthoBottom;
148
+ }
149
+ /**
150
+ * Define the current limit on the top side for an orthographic camera
151
+ * In scene unit
152
+ */
153
+ set orthoTop(value) {
154
+ this._orthoTop = value;
155
+ for (const rigCamera of this._rigCameras) {
156
+ rigCamera.orthoTop = value;
157
+ }
158
+ }
159
+ get orthoTop() {
160
+ return this._orthoTop;
161
+ }
162
+ /**
163
+ * Sets the camera's field of view in radians based on the focal length and sensor size.
164
+ * @param value the focal length of the camera in mm.
165
+ * @param sensorSize the sensor width size of the camera in mm. (default is 36mm, which is a full frame sensor)
166
+ */
167
+ setFocalLength(value, sensorSize = 36) {
168
+ this.fov = 2 * Math.atan(sensorSize / (2 * value));
169
+ }
170
+ /**
171
+ * Define the default inertia of the camera.
172
+ * This helps giving a smooth feeling to the camera movement.
173
+ */
174
+ get inertia() {
175
+ return this._baseInertia;
176
+ }
177
+ set inertia(value) {
178
+ this._baseInertia = value;
179
+ }
180
+ /**
181
+ * Define the mode of the camera (Camera.PERSPECTIVE_CAMERA or Camera.ORTHOGRAPHIC_CAMERA)
182
+ */
183
+ set mode(mode) {
184
+ this._mode = mode;
185
+ // Pass the mode down to the rig cameras
186
+ for (const rigCamera of this._rigCameras) {
187
+ rigCamera.mode = mode;
188
+ }
189
+ }
190
+ get mode() {
191
+ return this._mode;
192
+ }
193
+ /**
194
+ * Gets a flag indicating that the camera has moved in some way since the last call to Camera.update()
195
+ */
196
+ get hasMoved() {
197
+ return this._hasMoved;
198
+ }
199
+ /**
200
+ * Instantiates a new camera object.
201
+ * This should not be used directly but through the inherited cameras: ArcRotate, Free...
202
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras
203
+ * @param name Defines the name of the camera in the scene
204
+ * @param position Defines the position of the camera
205
+ * @param scene Defines the scene the camera belongs too
206
+ * @param setActiveOnSceneIfNoneActive Defines if the camera should be set as active after creation if no other camera have been defined in the scene
207
+ */
208
+ constructor(name, position, scene, setActiveOnSceneIfNoneActive = true) {
209
+ RegisterAbstractEngineRenderPass();
210
+ super(name, scene, false);
211
+ /**
212
+ * Define the input manager associated with the camera.
213
+ */
214
+ this.inputs = __runInitializers(this, _instanceExtraInitializers);
215
+ /** @internal */
216
+ this._position = __runInitializers(this, __position_initializers, Vector3.Zero());
217
+ this._upVector = (__runInitializers(this, __position_extraInitializers), __runInitializers(this, __upVector_initializers, Vector3.Up()));
218
+ /**
219
+ * Object containing oblique projection values (only used with ORTHOGRAPHIC_CAMERA)
220
+ */
221
+ this.oblique = (__runInitializers(this, __upVector_extraInitializers), null);
222
+ this._orthoLeft = null;
223
+ this._orthoRight = null;
224
+ this._orthoBottom = null;
225
+ this._orthoTop = null;
226
+ /**
227
+ * Field Of View is set in Radians. (default is 0.8)
228
+ */
229
+ this.fov = __runInitializers(this, _fov_initializers, 0.8);
230
+ /**
231
+ * Projection plane tilt around the X axis (horizontal), set in Radians. (default is 0)
232
+ * Can be used to make vertical lines in world space actually vertical on the screen.
233
+ * See https://forum.babylonjs.com/t/add-vertical-shift-to-3ds-max-exporter-babylon-cameras/17480
234
+ */
235
+ this.projectionPlaneTilt = (__runInitializers(this, _fov_extraInitializers), __runInitializers(this, _projectionPlaneTilt_initializers, 0));
236
+ /**
237
+ * Define the minimum distance the camera can see from.
238
+ * This is important to note that the depth buffer are not infinite and the closer it starts
239
+ * the more your scene might encounter depth fighting issue.
240
+ */
241
+ this.minZ = (__runInitializers(this, _projectionPlaneTilt_extraInitializers), __runInitializers(this, _minZ_initializers, 1));
242
+ /**
243
+ * Define the maximum distance the camera can see to. (default is 10000)
244
+ * This is important to note that the depth buffer are not infinite and the further it end
245
+ * the more your scene might encounter depth fighting issue.
246
+ */
247
+ this.maxZ = (__runInitializers(this, _minZ_extraInitializers), __runInitializers(this, _maxZ_initializers, 10000.0));
248
+ this._baseInertia = (__runInitializers(this, _maxZ_extraInitializers), 0.9);
249
+ this._mode = _a.PERSPECTIVE_CAMERA;
250
+ /**
251
+ * Define whether the camera is intermediate.
252
+ * This is useful to not present the output directly to the screen in case of rig without post process for instance
253
+ */
254
+ this.isIntermediate = false;
255
+ /**
256
+ * Define the viewport of the camera.
257
+ * This correspond to the portion of the screen the camera will render to in normalized 0 to 1 unit.
258
+ */
259
+ this.viewport = new Viewport(0, 0, 1.0, 1.0);
260
+ /**
261
+ * Restricts the camera to viewing objects with the same layerMask.
262
+ * A camera with a layerMask of 1 will render mesh.layerMask & camera.layerMask!== 0
263
+ */
264
+ this.layerMask = __runInitializers(this, _layerMask_initializers, 0x0fffffff);
265
+ /**
266
+ * fovMode sets the camera frustum bounds to the viewport bounds. (default is FOVMODE_VERTICAL_FIXED)
267
+ */
268
+ this.fovMode = (__runInitializers(this, _layerMask_extraInitializers), __runInitializers(this, _fovMode_initializers, _a.FOVMODE_VERTICAL_FIXED));
269
+ /**
270
+ * Rig mode of the camera.
271
+ * This is useful to create the camera with two "eyes" instead of one to create VR or stereoscopic scenes.
272
+ * This is normally controlled byt the camera themselves as internal use.
273
+ */
274
+ this.cameraRigMode = (__runInitializers(this, _fovMode_extraInitializers), __runInitializers(this, _cameraRigMode_initializers, _a.RIG_MODE_NONE));
275
+ /**
276
+ * Defines the distance between both "eyes" in case of a RIG
277
+ */
278
+ this.interaxialDistance = (__runInitializers(this, _cameraRigMode_extraInitializers), __runInitializers(this, _interaxialDistance_initializers, void 0));
279
+ /**
280
+ * Defines if stereoscopic rendering is done side by side or over under.
281
+ */
282
+ this.isStereoscopicSideBySide = (__runInitializers(this, _interaxialDistance_extraInitializers), __runInitializers(this, _isStereoscopicSideBySide_initializers, void 0));
283
+ /**
284
+ * Ignores camera maxZ when computing the projection matrix (ie. use 0 instead of maxZ), meaning objects won't be culled by the far plane
285
+ */
286
+ this.ignoreCameraMaxZ = (__runInitializers(this, _isStereoscopicSideBySide_extraInitializers), __runInitializers(this, _ignoreCameraMaxZ_initializers, false));
287
+ /**
288
+ * Defines the list of custom render target which are rendered to and then used as the input to this camera's render. Eg. display another camera view on a TV in the main scene
289
+ * This is pretty helpful if you wish to make a camera render to a texture you could reuse somewhere
290
+ * else in the scene. (Eg. security camera)
291
+ *
292
+ * To change the final output target of the camera, camera.outputRenderTarget should be used instead (eg. webXR renders to a render target corresponding to an HMD)
293
+ */
294
+ this.customRenderTargets = (__runInitializers(this, _ignoreCameraMaxZ_extraInitializers), []);
295
+ /**
296
+ * When set, the camera will render to this render target instead of the default canvas
297
+ *
298
+ * If the desire is to use the output of a camera as a texture in the scene consider using camera.customRenderTargets instead
299
+ */
300
+ this.outputRenderTarget = null;
301
+ /**
302
+ * Observable triggered when the camera view matrix has changed.
303
+ * Beware of reentrance! Some methods like Camera.getViewMatrix and Camera.getWorldMatrix can trigger the onViewMatrixChangedObservable
304
+ * observable, so using them inside an observer will require additional logic to avoid a stack overflow error.
305
+ */
306
+ this.onViewMatrixChangedObservable = new Observable();
307
+ /**
308
+ * Observable triggered when the camera Projection matrix has changed.
309
+ */
310
+ this.onProjectionMatrixChangedObservable = new Observable();
311
+ /**
312
+ * Observable triggered when the inputs have been processed.
313
+ */
314
+ this.onAfterCheckInputsObservable = new Observable();
315
+ /**
316
+ * Observable triggered when reset has been called and applied to the camera.
317
+ */
318
+ this.onRestoreStateObservable = new Observable();
319
+ /**
320
+ * Is this camera a part of a rig system?
321
+ */
322
+ this.isRigCamera = false;
323
+ this._hasMoved = false;
324
+ /** @internal */
325
+ this._rigCameras = new Array();
326
+ /** @internal */
327
+ this._skipRendering = false;
328
+ /** @internal */
329
+ this._projectionMatrix = new Matrix();
330
+ /** @internal */
331
+ this._postProcesses = new Array();
332
+ /** @internal */
333
+ this._activeMeshes = new SmartArray(256);
334
+ this._globalPosition = Vector3.Zero();
335
+ /** @internal */
336
+ this._computedViewMatrix = Matrix.Identity();
337
+ this._doNotComputeProjectionMatrix = false;
338
+ this._transformMatrix = Matrix.Zero();
339
+ this._refreshFrustumPlanes = true;
340
+ this._absoluteRotation = Quaternion.Identity();
341
+ /** @internal */
342
+ this._isCamera = true;
343
+ /** @internal */
344
+ this._isLeftCamera = false;
345
+ /** @internal */
346
+ this._isRightCamera = false;
347
+ this.layerMask = this.getScene().defaultCameraLayerMask;
348
+ this.getScene().addCamera(this);
349
+ if (setActiveOnSceneIfNoneActive && !this.getScene().activeCamera) {
350
+ this.getScene().activeCamera = this;
351
+ }
352
+ this.position = position;
353
+ this.renderPassId = this.getScene().getEngine().createRenderPassId(`Camera ${name}`);
354
+ }
355
+ /**
356
+ * Store current camera state (fov, position, etc..)
357
+ * @returns the camera
358
+ */
359
+ storeState() {
360
+ this._stateStored = true;
361
+ this._storedFov = this.fov;
362
+ return this;
363
+ }
364
+ /**
365
+ * Returns true if a state has been stored by calling storeState method.
366
+ * @returns true if state has been stored.
367
+ */
368
+ hasStateStored() {
369
+ return !!this._stateStored;
370
+ }
371
+ /**
372
+ * Restores the camera state values if it has been stored. You must call storeState() first
373
+ * @returns true if restored and false otherwise
374
+ */
375
+ _restoreStateValues() {
376
+ if (!this._stateStored) {
377
+ return false;
378
+ }
379
+ this.fov = this._storedFov;
380
+ return true;
381
+ }
382
+ /**
383
+ * Restored camera state. You must call storeState() first.
384
+ * @returns true if restored and false otherwise
385
+ */
386
+ restoreState() {
387
+ if (this._restoreStateValues()) {
388
+ this.onRestoreStateObservable.notifyObservers(this);
389
+ return true;
390
+ }
391
+ return false;
392
+ }
393
+ /**
394
+ * Gets the class name of the camera.
395
+ * @returns the class name
396
+ */
397
+ getClassName() {
398
+ return "Camera";
399
+ }
400
+ /**
401
+ * Gets a string representation of the camera useful for debug purpose.
402
+ * @param fullDetails Defines that a more verbose level of logging is required
403
+ * @returns the string representation
404
+ */
405
+ toString(fullDetails) {
406
+ let ret = "Name: " + this.name;
407
+ ret += ", type: " + this.getClassName();
408
+ if (this.animations) {
409
+ for (let i = 0; i < this.animations.length; i++) {
410
+ ret += ", animation[0]: " + this.animations[i].toString(fullDetails);
411
+ }
412
+ }
413
+ return ret;
414
+ }
415
+ /**
416
+ * Automatically tilts the projection plane, using `projectionPlaneTilt`, to correct the perspective effect on vertical lines.
417
+ */
418
+ applyVerticalCorrection() {
419
+ const rot = this.absoluteRotation.toEulerAngles();
420
+ this.projectionPlaneTilt = this._scene.useRightHandedSystem ? -rot.x : rot.x;
421
+ }
422
+ /**
423
+ * Gets the current world space position of the camera.
424
+ */
425
+ get globalPosition() {
426
+ return this._globalPosition;
427
+ }
428
+ /**
429
+ * Gets the list of active meshes this frame (meshes no culled or excluded by lod s in the frame)
430
+ * @returns the active meshe list
431
+ */
432
+ getActiveMeshes() {
433
+ return this._activeMeshes;
434
+ }
435
+ /**
436
+ * Check whether a mesh is part of the current active mesh list of the camera
437
+ * @param mesh Defines the mesh to check
438
+ * @returns true if active, false otherwise
439
+ */
440
+ isActiveMesh(mesh) {
441
+ return this._activeMeshes.indexOf(mesh) !== -1;
442
+ }
443
+ /**
444
+ * Is this camera ready to be used/rendered
445
+ * @param completeCheck defines if a complete check (including post processes) has to be done (false by default)
446
+ * @returns true if the camera is ready
447
+ */
448
+ isReady(completeCheck = false) {
449
+ if (completeCheck) {
450
+ for (const pp of this._postProcesses) {
451
+ if (pp && !pp.isReady()) {
452
+ return false;
453
+ }
454
+ }
455
+ }
456
+ return super.isReady(completeCheck);
457
+ }
458
+ /** @internal */
459
+ _initCache() {
460
+ super._initCache();
461
+ this._cache.position = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
462
+ this._cache.upVector = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
463
+ this._cache.mode = undefined;
464
+ this._cache.minZ = undefined;
465
+ this._cache.maxZ = undefined;
466
+ this._cache.fov = undefined;
467
+ this._cache.fovMode = undefined;
468
+ this._cache.aspectRatio = undefined;
469
+ this._cache.orthoLeft = undefined;
470
+ this._cache.orthoRight = undefined;
471
+ this._cache.orthoBottom = undefined;
472
+ this._cache.orthoTop = undefined;
473
+ this._cache.obliqueAngle = undefined;
474
+ this._cache.obliqueLength = undefined;
475
+ this._cache.obliqueOffset = undefined;
476
+ this._cache.renderWidth = undefined;
477
+ this._cache.renderHeight = undefined;
478
+ }
479
+ /**
480
+ * @internal
481
+ */
482
+ _updateCache(ignoreParentClass) {
483
+ if (!ignoreParentClass) {
484
+ super._updateCache();
485
+ }
486
+ this._cache.position.copyFrom(this.position);
487
+ this._cache.upVector.copyFrom(this.upVector);
488
+ }
489
+ /** @internal */
490
+ _isSynchronized() {
491
+ return this._isSynchronizedViewMatrix() && this._isSynchronizedProjectionMatrix();
492
+ }
493
+ /** @internal */
494
+ _isSynchronizedViewMatrix() {
495
+ if (!super._isSynchronized()) {
496
+ return false;
497
+ }
498
+ return this._cache.position.equals(this.position) && this._cache.upVector.equals(this.upVector) && this.isSynchronizedWithParent();
499
+ }
500
+ /** @internal */
501
+ _isSynchronizedProjectionMatrix() {
502
+ const maxZ = this.ignoreCameraMaxZ ? 0 : this.maxZ;
503
+ let isSynchronized = this._cache.mode === this.mode && this._cache.minZ === this.minZ && this._cache.maxZ === maxZ;
504
+ if (!isSynchronized) {
505
+ return false;
506
+ }
507
+ const engine = this.getEngine();
508
+ if (this.mode === _a.PERSPECTIVE_CAMERA) {
509
+ isSynchronized =
510
+ this._cache.fov === this.fov &&
511
+ this._cache.fovMode === this.fovMode &&
512
+ this._cache.aspectRatio === engine.getAspectRatio(this) &&
513
+ this._cache.projectionPlaneTilt === this.projectionPlaneTilt;
514
+ }
515
+ else {
516
+ isSynchronized =
517
+ this._cache.orthoLeft === this.orthoLeft &&
518
+ this._cache.orthoRight === this.orthoRight &&
519
+ this._cache.orthoBottom === this.orthoBottom &&
520
+ this._cache.orthoTop === this.orthoTop &&
521
+ this._cache.renderWidth === engine.getRenderWidth() &&
522
+ this._cache.renderHeight === engine.getRenderHeight();
523
+ if (this.oblique) {
524
+ isSynchronized =
525
+ isSynchronized &&
526
+ this._cache.obliqueAngle === this.oblique.angle &&
527
+ this._cache.obliqueLength === this.oblique.length &&
528
+ this._cache.obliqueOffset === this.oblique.offset;
529
+ }
530
+ }
531
+ return isSynchronized;
532
+ }
533
+ /**
534
+ * Attach the input controls to a specific dom element to get the input from.
535
+ * This function is here because typescript removes the typing of the last function.
536
+ * @param _ignored defines an ignored parameter kept for backward compatibility.
537
+ * @param _noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
538
+ */
539
+ attachControl(_ignored, _noPreventDefault) { }
540
+ /**
541
+ * Detach the current controls from the specified dom element.
542
+ * This function is here because typescript removes the typing of the last function.
543
+ * @param _ignored defines an ignored parameter kept for backward compatibility.
544
+ */
545
+ detachControl(_ignored) { }
546
+ /**
547
+ * Update the camera state according to the different inputs gathered during the frame.
548
+ */
549
+ update() {
550
+ this._hasMoved = false;
551
+ this._checkInputs();
552
+ if (this.cameraRigMode !== _a.RIG_MODE_NONE) {
553
+ this._updateRigCameras();
554
+ }
555
+ // Attempt to update the camera's view and projection matrices.
556
+ // This call is being made because these matrices are no longer being updated
557
+ // as a part of the picking ray process (in addition to scene.render).
558
+ this.getViewMatrix();
559
+ this.getProjectionMatrix();
560
+ }
561
+ /** @internal */
562
+ _checkInputs() {
563
+ this.onAfterCheckInputsObservable.notifyObservers(this);
564
+ }
565
+ /** @internal */
566
+ get rigCameras() {
567
+ return this._rigCameras;
568
+ }
569
+ /**
570
+ * Gets the post process used by the rig cameras
571
+ */
572
+ get rigPostProcess() {
573
+ return this._rigPostProcess;
574
+ }
575
+ /**
576
+ * Internal, gets the first post process.
577
+ * @returns the first post process to be run on this camera.
578
+ */
579
+ _getFirstPostProcess() {
580
+ for (let ppIndex = 0; ppIndex < this._postProcesses.length; ppIndex++) {
581
+ if (this._postProcesses[ppIndex] !== null) {
582
+ return this._postProcesses[ppIndex];
583
+ }
584
+ }
585
+ return null;
586
+ }
587
+ _cascadePostProcessesToRigCams() {
588
+ // invalidate framebuffer
589
+ const firstPostProcess = this._getFirstPostProcess();
590
+ if (firstPostProcess) {
591
+ firstPostProcess.markTextureDirty();
592
+ }
593
+ // glue the rigPostProcess to the end of the user postprocesses & assign to each sub-camera
594
+ for (let i = 0, len = this._rigCameras.length; i < len; i++) {
595
+ const cam = this._rigCameras[i];
596
+ const rigPostProcess = cam._rigPostProcess;
597
+ // for VR rig, there does not have to be a post process
598
+ if (rigPostProcess) {
599
+ const isPass = rigPostProcess.getEffectName() === "pass";
600
+ if (isPass) {
601
+ // any rig which has a PassPostProcess for rig[0], cannot be isIntermediate when there are also user postProcesses
602
+ cam.isIntermediate = this._postProcesses.length === 0;
603
+ }
604
+ cam._postProcesses = this._postProcesses.slice(0).concat(rigPostProcess);
605
+ rigPostProcess.markTextureDirty();
606
+ }
607
+ else {
608
+ cam._postProcesses = this._postProcesses.slice(0);
609
+ }
610
+ }
611
+ }
612
+ /**
613
+ * Attach a post process to the camera.
614
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses#attach-postprocess
615
+ * @param postProcess The post process to attach to the camera
616
+ * @param insertAt The position of the post process in case several of them are in use in the scene
617
+ * @returns the position the post process has been inserted at
618
+ */
619
+ attachPostProcess(postProcess, insertAt = null) {
620
+ if (!postProcess.isReusable() && this._postProcesses.indexOf(postProcess) > -1) {
621
+ Logger.Error("You're trying to reuse a post process not defined as reusable.");
622
+ return 0;
623
+ }
624
+ if (insertAt == null || insertAt < 0) {
625
+ this._postProcesses.push(postProcess);
626
+ }
627
+ else if (this._postProcesses[insertAt] === null) {
628
+ this._postProcesses[insertAt] = postProcess;
629
+ }
630
+ else {
631
+ this._postProcesses.splice(insertAt, 0, postProcess);
632
+ }
633
+ this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated
634
+ // Update prePass
635
+ if (this._scene.prePassRenderer) {
636
+ this._scene.prePassRenderer.markAsDirty();
637
+ }
638
+ return this._postProcesses.indexOf(postProcess);
639
+ }
640
+ /**
641
+ * Detach a post process to the camera.
642
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses#attach-postprocess
643
+ * @param postProcess The post process to detach from the camera
644
+ */
645
+ detachPostProcess(postProcess) {
646
+ const idx = this._postProcesses.indexOf(postProcess);
647
+ if (idx !== -1) {
648
+ this._postProcesses[idx] = null;
649
+ }
650
+ // Update prePass
651
+ if (this._scene.prePassRenderer) {
652
+ this._scene.prePassRenderer.markAsDirty();
653
+ }
654
+ this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated
655
+ }
656
+ /**
657
+ * Gets the current world matrix of the camera
658
+ * @returns the world matrix
659
+ */
660
+ getWorldMatrix() {
661
+ if (this._isSynchronizedViewMatrix()) {
662
+ return this._worldMatrix;
663
+ }
664
+ // Getting the view matrix will also compute the world matrix.
665
+ this.getViewMatrix();
666
+ return this._worldMatrix;
667
+ }
668
+ /** @internal */
669
+ _getViewMatrix() {
670
+ return Matrix.Identity();
671
+ }
672
+ /**
673
+ * Gets the current view matrix of the camera.
674
+ * @param force forces the camera to recompute the matrix without looking at the cached state
675
+ * @returns the view matrix
676
+ */
677
+ getViewMatrix(force) {
678
+ if (!force && this._isSynchronizedViewMatrix()) {
679
+ return this._computedViewMatrix;
680
+ }
681
+ this._hasMoved = true;
682
+ this.updateCache();
683
+ this._computedViewMatrix = this._getViewMatrix();
684
+ this._currentRenderId = this.getScene().getRenderId();
685
+ this._childUpdateId++;
686
+ this._refreshFrustumPlanes = true;
687
+ if (this._cameraRigParams && this._cameraRigParams.vrPreViewMatrix) {
688
+ this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix, this._computedViewMatrix);
689
+ }
690
+ // Notify parent camera if rig camera is changed
691
+ if (this.parent && this.parent.onViewMatrixChangedObservable) {
692
+ this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent);
693
+ }
694
+ this.onViewMatrixChangedObservable.notifyObservers(this);
695
+ this._computedViewMatrix.invertToRef(this._worldMatrix);
696
+ this._worldMatrix.getTranslationToRef(this._globalPosition);
697
+ return this._computedViewMatrix;
698
+ }
699
+ /**
700
+ * Freeze the projection matrix.
701
+ * It will prevent the cache check of the camera projection compute and can speed up perf
702
+ * if no parameter of the camera are meant to change
703
+ * @param projection Defines manually a projection if necessary
704
+ */
705
+ freezeProjectionMatrix(projection) {
706
+ this._doNotComputeProjectionMatrix = true;
707
+ if (projection !== undefined) {
708
+ this._projectionMatrix = projection;
709
+ }
710
+ }
711
+ /**
712
+ * Unfreeze the projection matrix if it has previously been freezed by freezeProjectionMatrix.
713
+ */
714
+ unfreezeProjectionMatrix() {
715
+ this._doNotComputeProjectionMatrix = false;
716
+ }
717
+ /**
718
+ * Gets the current projection matrix of the camera.
719
+ * @param force forces the camera to recompute the matrix without looking at the cached state
720
+ * @returns the projection matrix
721
+ */
722
+ getProjectionMatrix(force) {
723
+ if (this._doNotComputeProjectionMatrix || (!force && this._isSynchronizedProjectionMatrix())) {
724
+ return this._projectionMatrix;
725
+ }
726
+ const maxZ = this.ignoreCameraMaxZ ? 0 : this.maxZ;
727
+ // Cache
728
+ this._cache.mode = this.mode;
729
+ this._cache.minZ = this.minZ;
730
+ this._cache.maxZ = maxZ;
731
+ // Matrix
732
+ this._refreshFrustumPlanes = true;
733
+ const engine = this.getEngine();
734
+ const scene = this.getScene();
735
+ const reverseDepth = engine.useReverseDepthBuffer;
736
+ if (this.mode === _a.PERSPECTIVE_CAMERA) {
737
+ this._cache.fov = this.fov;
738
+ this._cache.fovMode = this.fovMode;
739
+ this._cache.aspectRatio = engine.getAspectRatio(this);
740
+ this._cache.projectionPlaneTilt = this.projectionPlaneTilt;
741
+ if (this.minZ <= 0) {
742
+ this.minZ = 0.1;
743
+ }
744
+ let getProjectionMatrix;
745
+ if (scene.useRightHandedSystem) {
746
+ getProjectionMatrix = Matrix.PerspectiveFovRHToRef;
747
+ }
748
+ else {
749
+ getProjectionMatrix = Matrix.PerspectiveFovLHToRef;
750
+ }
751
+ getProjectionMatrix(this.fov, engine.getAspectRatio(this), reverseDepth ? maxZ : this.minZ, reverseDepth ? this.minZ : maxZ, this._projectionMatrix, this.fovMode === _a.FOVMODE_VERTICAL_FIXED, engine.isNDCHalfZRange, this.projectionPlaneTilt, reverseDepth);
752
+ }
753
+ else {
754
+ const halfWidth = engine.getRenderWidth() / 2.0;
755
+ const halfHeight = engine.getRenderHeight() / 2.0;
756
+ if (scene.useRightHandedSystem) {
757
+ if (this.oblique) {
758
+ Matrix.ObliqueOffCenterRHToRef(this.orthoLeft ?? -halfWidth, this.orthoRight ?? halfWidth, this.orthoBottom ?? -halfHeight, this.orthoTop ?? halfHeight, reverseDepth ? maxZ : this.minZ, reverseDepth ? this.minZ : maxZ, this.oblique.length, this.oblique.angle, this._computeObliqueDistance(this.oblique.offset), this._projectionMatrix, engine.isNDCHalfZRange);
759
+ }
760
+ else {
761
+ Matrix.OrthoOffCenterRHToRef(this.orthoLeft ?? -halfWidth, this.orthoRight ?? halfWidth, this.orthoBottom ?? -halfHeight, this.orthoTop ?? halfHeight, reverseDepth ? maxZ : this.minZ, reverseDepth ? this.minZ : maxZ, this._projectionMatrix, engine.isNDCHalfZRange);
762
+ }
763
+ }
764
+ else {
765
+ if (this.oblique) {
766
+ Matrix.ObliqueOffCenterLHToRef(this.orthoLeft ?? -halfWidth, this.orthoRight ?? halfWidth, this.orthoBottom ?? -halfHeight, this.orthoTop ?? halfHeight, reverseDepth ? maxZ : this.minZ, reverseDepth ? this.minZ : maxZ, this.oblique.length, this.oblique.angle, this._computeObliqueDistance(this.oblique.offset), this._projectionMatrix, engine.isNDCHalfZRange);
767
+ }
768
+ else {
769
+ Matrix.OrthoOffCenterLHToRef(this.orthoLeft ?? -halfWidth, this.orthoRight ?? halfWidth, this.orthoBottom ?? -halfHeight, this.orthoTop ?? halfHeight, reverseDepth ? maxZ : this.minZ, reverseDepth ? this.minZ : maxZ, this._projectionMatrix, engine.isNDCHalfZRange);
770
+ }
771
+ }
772
+ this._cache.orthoLeft = this.orthoLeft;
773
+ this._cache.orthoRight = this.orthoRight;
774
+ this._cache.orthoBottom = this.orthoBottom;
775
+ this._cache.orthoTop = this.orthoTop;
776
+ this._cache.obliqueAngle = this.oblique?.angle;
777
+ this._cache.obliqueLength = this.oblique?.length;
778
+ this._cache.obliqueOffset = this.oblique?.offset;
779
+ this._cache.renderWidth = engine.getRenderWidth();
780
+ this._cache.renderHeight = engine.getRenderHeight();
781
+ }
782
+ this.onProjectionMatrixChangedObservable.notifyObservers(this);
783
+ return this._projectionMatrix;
784
+ }
785
+ /**
786
+ * Gets the transformation matrix (ie. the multiplication of view by projection matrices)
787
+ * @returns a Matrix
788
+ */
789
+ getTransformationMatrix() {
790
+ this._computedViewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);
791
+ return this._transformMatrix;
792
+ }
793
+ _computeObliqueDistance(offset) {
794
+ const arcRotateCamera = this;
795
+ const targetCamera = this;
796
+ return (arcRotateCamera.radius || (targetCamera.target ? Vector3.Distance(this.position, targetCamera.target) : this.position.length())) + offset;
797
+ }
798
+ /** @internal */
799
+ _updateFrustumPlanes() {
800
+ if (!this._refreshFrustumPlanes) {
801
+ return;
802
+ }
803
+ this.getTransformationMatrix();
804
+ if (!this._frustumPlanes) {
805
+ this._frustumPlanes = Frustum.GetPlanes(this._transformMatrix);
806
+ }
807
+ else {
808
+ Frustum.GetPlanesToRef(this._transformMatrix, this._frustumPlanes);
809
+ }
810
+ this._refreshFrustumPlanes = false;
811
+ }
812
+ /**
813
+ * Checks if a cullable object (mesh...) is in the camera frustum
814
+ * This checks the bounding box center. See isCompletelyInFrustum for a full bounding check
815
+ * @param target The object to check
816
+ * @param checkRigCameras If the rig cameras should be checked (eg. with VR camera both eyes should be checked) (Default: false)
817
+ * @returns true if the object is in frustum otherwise false
818
+ */
819
+ isInFrustum(target, checkRigCameras = false) {
820
+ this._updateFrustumPlanes();
821
+ if (checkRigCameras && this.rigCameras.length > 0) {
822
+ let result = false;
823
+ for (const cam of this.rigCameras) {
824
+ cam._updateFrustumPlanes();
825
+ result = result || target.isInFrustum(cam._frustumPlanes);
826
+ }
827
+ return result;
828
+ }
829
+ else {
830
+ return target.isInFrustum(this._frustumPlanes);
831
+ }
832
+ }
833
+ /**
834
+ * Checks if a cullable object (mesh...) is in the camera frustum
835
+ * Unlike isInFrustum this checks the full bounding box
836
+ * @param target The object to check
837
+ * @returns true if the object is in frustum otherwise false
838
+ */
839
+ isCompletelyInFrustum(target) {
840
+ this._updateFrustumPlanes();
841
+ return target.isCompletelyInFrustum(this._frustumPlanes);
842
+ }
843
+ // eslint-disable-next-line jsdoc/require-returns-check
844
+ /**
845
+ * Gets a ray in the forward direction from the camera.
846
+ * @param length Defines the length of the ray to create
847
+ * @param transform Defines the transform to apply to the ray, by default the world matrix is used to create a world space ray
848
+ * @param origin Defines the start point of the ray which defaults to the camera position
849
+ * @returns the forward ray
850
+ */
851
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
852
+ getForwardRay(length = 100, transform, origin) {
853
+ throw _WarnImport("Ray");
854
+ }
855
+ // eslint-disable-next-line jsdoc/require-returns-check
856
+ /**
857
+ * Gets a ray in the forward direction from the camera.
858
+ * @param refRay the ray to (re)use when setting the values
859
+ * @param length Defines the length of the ray to create
860
+ * @param transform Defines the transform to apply to the ray, by default the world matrix is used to create a world space ray
861
+ * @param origin Defines the start point of the ray which defaults to the camera position
862
+ * @returns the forward ray
863
+ */
864
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
865
+ getForwardRayToRef(refRay, length = 100, transform, origin) {
866
+ throw _WarnImport("Ray");
867
+ }
868
+ /**
869
+ * Releases resources associated with this node.
870
+ * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
871
+ * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)
872
+ */
873
+ dispose(doNotRecurse, disposeMaterialAndTextures = false) {
874
+ // Observables
875
+ this.onViewMatrixChangedObservable.clear();
876
+ this.onProjectionMatrixChangedObservable.clear();
877
+ this.onAfterCheckInputsObservable.clear();
878
+ this.onRestoreStateObservable.clear();
879
+ // Inputs
880
+ if (this.inputs) {
881
+ this.inputs.clear();
882
+ }
883
+ // Animations
884
+ this.getScene().stopAnimation(this);
885
+ // Remove from scene
886
+ this.getScene().removeCamera(this);
887
+ while (this._rigCameras.length > 0) {
888
+ const camera = this._rigCameras.pop();
889
+ if (camera) {
890
+ camera.dispose();
891
+ }
892
+ }
893
+ if (this._parentContainer) {
894
+ const index = this._parentContainer.cameras.indexOf(this);
895
+ if (index > -1) {
896
+ this._parentContainer.cameras.splice(index, 1);
897
+ }
898
+ this._parentContainer = null;
899
+ }
900
+ // Postprocesses
901
+ if (this._rigPostProcess) {
902
+ this._rigPostProcess.dispose(this);
903
+ this._rigPostProcess = null;
904
+ this._postProcesses.length = 0;
905
+ }
906
+ else if (this.cameraRigMode !== _a.RIG_MODE_NONE) {
907
+ this._rigPostProcess = null;
908
+ this._postProcesses.length = 0;
909
+ }
910
+ else {
911
+ let i = this._postProcesses.length;
912
+ while (--i >= 0) {
913
+ const postProcess = this._postProcesses[i];
914
+ if (postProcess) {
915
+ postProcess.dispose(this);
916
+ }
917
+ }
918
+ }
919
+ // Render targets
920
+ let i = this.customRenderTargets.length;
921
+ while (--i >= 0) {
922
+ this.customRenderTargets[i].dispose();
923
+ }
924
+ this.customRenderTargets.length = 0;
925
+ // Active Meshes
926
+ this._activeMeshes.dispose();
927
+ this.getScene().getEngine().releaseRenderPassId(this.renderPassId);
928
+ super.dispose(doNotRecurse, disposeMaterialAndTextures);
929
+ }
930
+ /**
931
+ * Gets the left camera of a rig setup in case of Rigged Camera
932
+ */
933
+ get isLeftCamera() {
934
+ return this._isLeftCamera;
935
+ }
936
+ /**
937
+ * Gets the right camera of a rig setup in case of Rigged Camera
938
+ */
939
+ get isRightCamera() {
940
+ return this._isRightCamera;
941
+ }
942
+ /**
943
+ * Gets the left camera of a rig setup in case of Rigged Camera
944
+ */
945
+ get leftCamera() {
946
+ if (this._rigCameras.length < 1) {
947
+ return null;
948
+ }
949
+ return this._rigCameras[0];
950
+ }
951
+ /**
952
+ * Gets the right camera of a rig setup in case of Rigged Camera
953
+ */
954
+ get rightCamera() {
955
+ if (this._rigCameras.length < 2) {
956
+ return null;
957
+ }
958
+ return this._rigCameras[1];
959
+ }
960
+ /**
961
+ * Gets the left camera target of a rig setup in case of Rigged Camera
962
+ * @returns the target position
963
+ */
964
+ getLeftTarget() {
965
+ if (this._rigCameras.length < 1) {
966
+ return null;
967
+ }
968
+ return this._rigCameras[0].getTarget();
969
+ }
970
+ /**
971
+ * Gets the right camera target of a rig setup in case of Rigged Camera
972
+ * @returns the target position
973
+ */
974
+ getRightTarget() {
975
+ if (this._rigCameras.length < 2) {
976
+ return null;
977
+ }
978
+ return this._rigCameras[1].getTarget();
979
+ }
980
+ /**
981
+ * @internal
982
+ */
983
+ setCameraRigMode(mode, rigParams) {
984
+ if (this.cameraRigMode === mode) {
985
+ return;
986
+ }
987
+ while (this._rigCameras.length > 0) {
988
+ const camera = this._rigCameras.pop();
989
+ if (camera) {
990
+ camera.dispose();
991
+ }
992
+ }
993
+ this.cameraRigMode = mode;
994
+ this._cameraRigParams = {};
995
+ //we have to implement stereo camera calcultating left and right viewpoints from interaxialDistance and target,
996
+ //not from a given angle as it is now, but until that complete code rewriting provisional stereoHalfAngle value is introduced
997
+ this._cameraRigParams.interaxialDistance = rigParams.interaxialDistance || 0.0637;
998
+ this._cameraRigParams.stereoHalfAngle = (this._cameraRigParams.interaxialDistance / 0.0637) * (Math.PI / 180);
999
+ // create the rig cameras, unless none
1000
+ if (this.cameraRigMode !== _a.RIG_MODE_NONE) {
1001
+ const leftCamera = this.createRigCamera(this.name + "_L", 0);
1002
+ if (leftCamera) {
1003
+ leftCamera._isLeftCamera = true;
1004
+ }
1005
+ const rightCamera = this.createRigCamera(this.name + "_R", 1);
1006
+ if (rightCamera) {
1007
+ rightCamera._isRightCamera = true;
1008
+ }
1009
+ if (leftCamera && rightCamera) {
1010
+ this._rigCameras.push(leftCamera);
1011
+ this._rigCameras.push(rightCamera);
1012
+ }
1013
+ }
1014
+ this._setRigMode(rigParams);
1015
+ this._cascadePostProcessesToRigCams();
1016
+ this.update();
1017
+ }
1018
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1019
+ _setRigMode(rigParams) {
1020
+ // no-op
1021
+ }
1022
+ /** @internal */
1023
+ _getVRProjectionMatrix() {
1024
+ Matrix.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov, this._cameraRigParams.vrMetrics.aspectRatio, this.minZ, this.ignoreCameraMaxZ ? 0 : this.maxZ, this._cameraRigParams.vrWorkMatrix, true, this.getEngine().isNDCHalfZRange);
1025
+ this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix, this._projectionMatrix);
1026
+ return this._projectionMatrix;
1027
+ }
1028
+ /**
1029
+ * @internal
1030
+ */
1031
+ setCameraRigParameter(name, value) {
1032
+ if (!this._cameraRigParams) {
1033
+ this._cameraRigParams = {};
1034
+ }
1035
+ this._cameraRigParams[name] = value;
1036
+ //provisionnally:
1037
+ if (name === "interaxialDistance") {
1038
+ this._cameraRigParams.stereoHalfAngle = (value / 0.0637) * (Math.PI / 180);
1039
+ }
1040
+ }
1041
+ /**
1042
+ * needs to be overridden by children so sub has required properties to be copied
1043
+ * @internal
1044
+ */
1045
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1046
+ createRigCamera(name, cameraIndex) {
1047
+ return null;
1048
+ }
1049
+ /**
1050
+ * May need to be overridden by children
1051
+ * @internal
1052
+ */
1053
+ _updateRigCameras() {
1054
+ for (let i = 0; i < this._rigCameras.length; i++) {
1055
+ this._rigCameras[i].minZ = this.minZ;
1056
+ this._rigCameras[i].maxZ = this.ignoreCameraMaxZ ? 0 : this.maxZ;
1057
+ this._rigCameras[i].fov = this.fov;
1058
+ this._rigCameras[i].upVector.copyFrom(this.upVector);
1059
+ }
1060
+ // only update viewport when ANAGLYPH
1061
+ if (this.cameraRigMode === _a.RIG_MODE_STEREOSCOPIC_ANAGLYPH) {
1062
+ this._rigCameras[0].viewport = this._rigCameras[1].viewport = this.viewport;
1063
+ }
1064
+ }
1065
+ /** @internal */
1066
+ _setupInputs() { }
1067
+ /**
1068
+ * Serialiaze the camera setup to a json representation
1069
+ * @returns the JSON representation
1070
+ */
1071
+ serialize() {
1072
+ const serializationObject = SerializationHelper.Serialize(this);
1073
+ serializationObject.uniqueId = this.uniqueId;
1074
+ // Type
1075
+ serializationObject.type = this.getClassName();
1076
+ // Parent
1077
+ if (this.parent) {
1078
+ this.parent._serializeAsParent(serializationObject);
1079
+ }
1080
+ if (this.inputs) {
1081
+ this.inputs.serialize(serializationObject);
1082
+ }
1083
+ // Animations
1084
+ SerializationHelper.AppendSerializedAnimations(this, serializationObject);
1085
+ serializationObject.ranges = this.serializeAnimationRanges();
1086
+ serializationObject.isEnabled = this.isEnabled();
1087
+ return serializationObject;
1088
+ }
1089
+ /**
1090
+ * Clones the current camera.
1091
+ * @param name The cloned camera name
1092
+ * @param newParent The cloned camera's new parent (none by default)
1093
+ * @returns the cloned camera
1094
+ */
1095
+ clone(name, newParent = null) {
1096
+ const camera = SerializationHelper.Clone(_a.GetConstructorFromName(this.getClassName(), name, this.getScene(), this.interaxialDistance, this.isStereoscopicSideBySide), this);
1097
+ camera.name = name;
1098
+ camera.parent = newParent;
1099
+ this.onClonedObservable.notifyObservers(camera);
1100
+ return camera;
1101
+ }
1102
+ /**
1103
+ * Gets the direction of the camera relative to a given local axis.
1104
+ * @param localAxis Defines the reference axis to provide a relative direction.
1105
+ * @returns the direction
1106
+ */
1107
+ getDirection(localAxis) {
1108
+ const result = Vector3.Zero();
1109
+ this.getDirectionToRef(localAxis, result);
1110
+ return result;
1111
+ }
1112
+ /**
1113
+ * Returns the current camera absolute rotation
1114
+ */
1115
+ get absoluteRotation() {
1116
+ this.getWorldMatrix().decompose(undefined, this._absoluteRotation);
1117
+ return this._absoluteRotation;
1118
+ }
1119
+ /**
1120
+ * Gets the direction of the camera relative to a given local axis into a passed vector.
1121
+ * @param localAxis Defines the reference axis to provide a relative direction.
1122
+ * @param result Defines the vector to store the result in
1123
+ */
1124
+ getDirectionToRef(localAxis, result) {
1125
+ Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
1126
+ }
1127
+ /**
1128
+ * Gets a camera constructor for a given camera type
1129
+ * @param type The type of the camera to construct (should be equal to one of the camera class name)
1130
+ * @param name The name of the camera the result will be able to instantiate
1131
+ * @param scene The scene the result will construct the camera in
1132
+ * @param interaxial_distance In case of stereoscopic setup, the distance between both eyes
1133
+ * @param isStereoscopicSideBySide In case of stereoscopic setup, should the sereo be side b side
1134
+ * @returns a factory method to construct the camera
1135
+ */
1136
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1137
+ static GetConstructorFromName(type, name, scene, interaxial_distance = 0, isStereoscopicSideBySide = true) {
1138
+ const constructorFunc = Node.Construct(type, name, scene, {
1139
+ interaxial_distance: interaxial_distance,
1140
+ isStereoscopicSideBySide: isStereoscopicSideBySide,
1141
+ });
1142
+ if (constructorFunc) {
1143
+ return constructorFunc;
1144
+ }
1145
+ // Default to universal camera
1146
+ return () => _a._CreateDefaultParsedCamera(name, scene);
1147
+ }
1148
+ /**
1149
+ * Compute the world matrix of the camera.
1150
+ * @returns the camera world matrix
1151
+ */
1152
+ computeWorldMatrix() {
1153
+ return this.getWorldMatrix();
1154
+ }
1155
+ /** @internal */
1156
+ _calculateHandednessMultiplier() {
1157
+ let handednessMultiplier = this.getScene().useRightHandedSystem ? -1 : 1;
1158
+ if (this.parent && this.parent._getWorldMatrixDeterminant() < 0) {
1159
+ handednessMultiplier *= -1;
1160
+ }
1161
+ return handednessMultiplier;
1162
+ }
1163
+ },
1164
+ (() => {
1165
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1166
+ __position_decorators = [serializeAsVector3("position")];
1167
+ __upVector_decorators = [serializeAsVector3("upVector")];
1168
+ _get_orthoLeft_decorators = [serialize()];
1169
+ _get_orthoRight_decorators = [serialize()];
1170
+ _get_orthoBottom_decorators = [serialize()];
1171
+ _get_orthoTop_decorators = [serialize()];
1172
+ _fov_decorators = [serialize()];
1173
+ _projectionPlaneTilt_decorators = [serialize()];
1174
+ _minZ_decorators = [serialize()];
1175
+ _maxZ_decorators = [serialize()];
1176
+ _get_inertia_decorators = [serialize()];
1177
+ _get_mode_decorators = [serialize()];
1178
+ _layerMask_decorators = [serialize()];
1179
+ _fovMode_decorators = [serialize()];
1180
+ _cameraRigMode_decorators = [serialize()];
1181
+ _interaxialDistance_decorators = [serialize()];
1182
+ _isStereoscopicSideBySide_decorators = [serialize()];
1183
+ _ignoreCameraMaxZ_decorators = [serialize()];
1184
+ __esDecorate(_a, null, _get_orthoLeft_decorators, { kind: "getter", name: "orthoLeft", static: false, private: false, access: { has: obj => "orthoLeft" in obj, get: obj => obj.orthoLeft }, metadata: _metadata }, null, _instanceExtraInitializers);
1185
+ __esDecorate(_a, null, _get_orthoRight_decorators, { kind: "getter", name: "orthoRight", static: false, private: false, access: { has: obj => "orthoRight" in obj, get: obj => obj.orthoRight }, metadata: _metadata }, null, _instanceExtraInitializers);
1186
+ __esDecorate(_a, null, _get_orthoBottom_decorators, { kind: "getter", name: "orthoBottom", static: false, private: false, access: { has: obj => "orthoBottom" in obj, get: obj => obj.orthoBottom }, metadata: _metadata }, null, _instanceExtraInitializers);
1187
+ __esDecorate(_a, null, _get_orthoTop_decorators, { kind: "getter", name: "orthoTop", static: false, private: false, access: { has: obj => "orthoTop" in obj, get: obj => obj.orthoTop }, metadata: _metadata }, null, _instanceExtraInitializers);
1188
+ __esDecorate(_a, null, _get_inertia_decorators, { kind: "getter", name: "inertia", static: false, private: false, access: { has: obj => "inertia" in obj, get: obj => obj.inertia }, metadata: _metadata }, null, _instanceExtraInitializers);
1189
+ __esDecorate(_a, null, _get_mode_decorators, { kind: "getter", name: "mode", static: false, private: false, access: { has: obj => "mode" in obj, get: obj => obj.mode }, metadata: _metadata }, null, _instanceExtraInitializers);
1190
+ __esDecorate(null, null, __position_decorators, { kind: "field", name: "_position", static: false, private: false, access: { has: obj => "_position" in obj, get: obj => obj._position, set: (obj, value) => { obj._position = value; } }, metadata: _metadata }, __position_initializers, __position_extraInitializers);
1191
+ __esDecorate(null, null, __upVector_decorators, { kind: "field", name: "_upVector", static: false, private: false, access: { has: obj => "_upVector" in obj, get: obj => obj._upVector, set: (obj, value) => { obj._upVector = value; } }, metadata: _metadata }, __upVector_initializers, __upVector_extraInitializers);
1192
+ __esDecorate(null, null, _fov_decorators, { kind: "field", name: "fov", static: false, private: false, access: { has: obj => "fov" in obj, get: obj => obj.fov, set: (obj, value) => { obj.fov = value; } }, metadata: _metadata }, _fov_initializers, _fov_extraInitializers);
1193
+ __esDecorate(null, null, _projectionPlaneTilt_decorators, { kind: "field", name: "projectionPlaneTilt", static: false, private: false, access: { has: obj => "projectionPlaneTilt" in obj, get: obj => obj.projectionPlaneTilt, set: (obj, value) => { obj.projectionPlaneTilt = value; } }, metadata: _metadata }, _projectionPlaneTilt_initializers, _projectionPlaneTilt_extraInitializers);
1194
+ __esDecorate(null, null, _minZ_decorators, { kind: "field", name: "minZ", static: false, private: false, access: { has: obj => "minZ" in obj, get: obj => obj.minZ, set: (obj, value) => { obj.minZ = value; } }, metadata: _metadata }, _minZ_initializers, _minZ_extraInitializers);
1195
+ __esDecorate(null, null, _maxZ_decorators, { kind: "field", name: "maxZ", static: false, private: false, access: { has: obj => "maxZ" in obj, get: obj => obj.maxZ, set: (obj, value) => { obj.maxZ = value; } }, metadata: _metadata }, _maxZ_initializers, _maxZ_extraInitializers);
1196
+ __esDecorate(null, null, _layerMask_decorators, { kind: "field", name: "layerMask", static: false, private: false, access: { has: obj => "layerMask" in obj, get: obj => obj.layerMask, set: (obj, value) => { obj.layerMask = value; } }, metadata: _metadata }, _layerMask_initializers, _layerMask_extraInitializers);
1197
+ __esDecorate(null, null, _fovMode_decorators, { kind: "field", name: "fovMode", static: false, private: false, access: { has: obj => "fovMode" in obj, get: obj => obj.fovMode, set: (obj, value) => { obj.fovMode = value; } }, metadata: _metadata }, _fovMode_initializers, _fovMode_extraInitializers);
1198
+ __esDecorate(null, null, _cameraRigMode_decorators, { kind: "field", name: "cameraRigMode", static: false, private: false, access: { has: obj => "cameraRigMode" in obj, get: obj => obj.cameraRigMode, set: (obj, value) => { obj.cameraRigMode = value; } }, metadata: _metadata }, _cameraRigMode_initializers, _cameraRigMode_extraInitializers);
1199
+ __esDecorate(null, null, _interaxialDistance_decorators, { kind: "field", name: "interaxialDistance", static: false, private: false, access: { has: obj => "interaxialDistance" in obj, get: obj => obj.interaxialDistance, set: (obj, value) => { obj.interaxialDistance = value; } }, metadata: _metadata }, _interaxialDistance_initializers, _interaxialDistance_extraInitializers);
1200
+ __esDecorate(null, null, _isStereoscopicSideBySide_decorators, { kind: "field", name: "isStereoscopicSideBySide", static: false, private: false, access: { has: obj => "isStereoscopicSideBySide" in obj, get: obj => obj.isStereoscopicSideBySide, set: (obj, value) => { obj.isStereoscopicSideBySide = value; } }, metadata: _metadata }, _isStereoscopicSideBySide_initializers, _isStereoscopicSideBySide_extraInitializers);
1201
+ __esDecorate(null, null, _ignoreCameraMaxZ_decorators, { kind: "field", name: "ignoreCameraMaxZ", static: false, private: false, access: { has: obj => "ignoreCameraMaxZ" in obj, get: obj => obj.ignoreCameraMaxZ, set: (obj, value) => { obj.ignoreCameraMaxZ = value; } }, metadata: _metadata }, _ignoreCameraMaxZ_initializers, _ignoreCameraMaxZ_extraInitializers);
1202
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1203
+ })(),
192
1204
  /**
193
- * Define the maximum distance the camera can see to. (default is 10000)
194
- * This is important to note that the depth buffer are not infinite and the further it end
195
- * the more your scene might encounter depth fighting issue.
1205
+ * @internal
196
1206
  */
197
- this.maxZ = 10000.0;
198
- this._baseInertia = 0.9;
199
- this._mode = Camera.PERSPECTIVE_CAMERA;
1207
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1208
+ _a._CreateDefaultParsedCamera = (name, scene) => {
1209
+ throw _WarnImport("UniversalCamera");
1210
+ },
200
1211
  /**
201
- * Define whether the camera is intermediate.
202
- * This is useful to not present the output directly to the screen in case of rig without post process for instance
1212
+ * This is the default projection mode used by the cameras.
1213
+ * It helps recreating a feeling of perspective and better appreciate depth.
1214
+ * This is the best way to simulate real life cameras.
203
1215
  */
204
- this.isIntermediate = false;
1216
+ _a.PERSPECTIVE_CAMERA = 0,
205
1217
  /**
206
- * Define the viewport of the camera.
207
- * This correspond to the portion of the screen the camera will render to in normalized 0 to 1 unit.
1218
+ * This helps creating camera with an orthographic mode.
1219
+ * Orthographic is commonly used in engineering as a means to produce object specifications that communicate dimensions unambiguously, each line of 1 unit length (cm, meter..whatever) will appear to have the same length everywhere on the drawing. This allows the drafter to dimension only a subset of lines and let the reader know that other lines of that length on the drawing are also that length in reality. Every parallel line in the drawing is also parallel in the object.
208
1220
  */
209
- this.viewport = new Viewport(0, 0, 1.0, 1.0);
1221
+ _a.ORTHOGRAPHIC_CAMERA = 1,
210
1222
  /**
211
- * Restricts the camera to viewing objects with the same layerMask.
212
- * A camera with a layerMask of 1 will render mesh.layerMask & camera.layerMask!== 0
1223
+ * This is the default FOV mode for perspective cameras.
1224
+ * This setting aligns the upper and lower bounds of the viewport to the upper and lower bounds of the camera frustum.
213
1225
  */
214
- this.layerMask = 0x0fffffff;
1226
+ _a.FOVMODE_VERTICAL_FIXED = 0,
215
1227
  /**
216
- * fovMode sets the camera frustum bounds to the viewport bounds. (default is FOVMODE_VERTICAL_FIXED)
1228
+ * This setting aligns the left and right bounds of the viewport to the left and right bounds of the camera frustum.
217
1229
  */
218
- this.fovMode = Camera.FOVMODE_VERTICAL_FIXED;
1230
+ _a.FOVMODE_HORIZONTAL_FIXED = 1,
219
1231
  /**
220
- * Rig mode of the camera.
221
- * This is useful to create the camera with two "eyes" instead of one to create VR or stereoscopic scenes.
222
- * This is normally controlled byt the camera themselves as internal use.
1232
+ * This specifies there is no need for a camera rig.
1233
+ * Basically only one eye is rendered corresponding to the camera.
223
1234
  */
224
- this.cameraRigMode = Camera.RIG_MODE_NONE;
1235
+ _a.RIG_MODE_NONE = 0,
225
1236
  /**
226
- * Ignores camera maxZ when computing the projection matrix (ie. use 0 instead of maxZ), meaning objects won't be culled by the far plane
1237
+ * Simulates a camera Rig with one blue eye and one red eye.
1238
+ * This can be use with 3d blue and red glasses.
227
1239
  */
228
- this.ignoreCameraMaxZ = false;
1240
+ _a.RIG_MODE_STEREOSCOPIC_ANAGLYPH = 10,
229
1241
  /**
230
- * Defines the list of custom render target which are rendered to and then used as the input to this camera's render. Eg. display another camera view on a TV in the main scene
231
- * This is pretty helpful if you wish to make a camera render to a texture you could reuse somewhere
232
- * else in the scene. (Eg. security camera)
233
- *
234
- * To change the final output target of the camera, camera.outputRenderTarget should be used instead (eg. webXR renders to a render target corresponding to an HMD)
1242
+ * Defines that both eyes of the camera will be rendered side by side with a parallel target.
235
1243
  */
236
- this.customRenderTargets = [];
1244
+ _a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL = 11,
237
1245
  /**
238
- * When set, the camera will render to this render target instead of the default canvas
239
- *
240
- * If the desire is to use the output of a camera as a texture in the scene consider using camera.customRenderTargets instead
1246
+ * Defines that both eyes of the camera will be rendered side by side with a none parallel target.
241
1247
  */
242
- this.outputRenderTarget = null;
1248
+ _a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED = 12,
243
1249
  /**
244
- * Observable triggered when the camera view matrix has changed.
245
- * Beware of reentrance! Some methods like Camera.getViewMatrix and Camera.getWorldMatrix can trigger the onViewMatrixChangedObservable
246
- * observable, so using them inside an observer will require additional logic to avoid a stack overflow error.
1250
+ * Defines that both eyes of the camera will be rendered over under each other.
247
1251
  */
248
- this.onViewMatrixChangedObservable = new Observable();
1252
+ _a.RIG_MODE_STEREOSCOPIC_OVERUNDER = 13,
249
1253
  /**
250
- * Observable triggered when the camera Projection matrix has changed.
1254
+ * Defines that both eyes of the camera will be rendered on successive lines interlaced for passive 3d monitors.
251
1255
  */
252
- this.onProjectionMatrixChangedObservable = new Observable();
1256
+ _a.RIG_MODE_STEREOSCOPIC_INTERLACED = 14,
253
1257
  /**
254
- * Observable triggered when the inputs have been processed.
1258
+ * Defines that both eyes of the camera should be renderered in a VR mode (carbox).
255
1259
  */
256
- this.onAfterCheckInputsObservable = new Observable();
1260
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1261
+ _a.RIG_MODE_VR = 20,
257
1262
  /**
258
- * Observable triggered when reset has been called and applied to the camera.
1263
+ * Custom rig mode allowing rig cameras to be populated manually with any number of cameras
259
1264
  */
260
- this.onRestoreStateObservable = new Observable();
1265
+ _a.RIG_MODE_CUSTOM = 22,
261
1266
  /**
262
- * Is this camera a part of a rig system?
1267
+ * Defines if by default attaching controls should prevent the default javascript event to continue.
263
1268
  */
264
- this.isRigCamera = false;
265
- this._hasMoved = false;
266
- /** @internal */
267
- this._rigCameras = new Array();
268
- /** @internal */
269
- this._skipRendering = false;
270
- /** @internal */
271
- this._projectionMatrix = new Matrix();
272
- /** @internal */
273
- this._postProcesses = new Array();
274
- /** @internal */
275
- this._activeMeshes = new SmartArray(256);
276
- this._globalPosition = Vector3.Zero();
277
- /** @internal */
278
- this._computedViewMatrix = Matrix.Identity();
279
- this._doNotComputeProjectionMatrix = false;
280
- this._transformMatrix = Matrix.Zero();
281
- this._refreshFrustumPlanes = true;
282
- this._absoluteRotation = Quaternion.Identity();
283
- /** @internal */
284
- this._isCamera = true;
285
- /** @internal */
286
- this._isLeftCamera = false;
287
- /** @internal */
288
- this._isRightCamera = false;
289
- this.layerMask = this.getScene().defaultCameraLayerMask;
290
- this.getScene().addCamera(this);
291
- if (setActiveOnSceneIfNoneActive && !this.getScene().activeCamera) {
292
- this.getScene().activeCamera = this;
293
- }
294
- this.position = position;
295
- this.renderPassId = this.getScene().getEngine().createRenderPassId(`Camera ${name}`);
296
- }
297
- /**
298
- * Store current camera state (fov, position, etc..)
299
- * @returns the camera
300
- */
301
- storeState() {
302
- this._stateStored = true;
303
- this._storedFov = this.fov;
304
- return this;
305
- }
306
- /**
307
- * Returns true if a state has been stored by calling storeState method.
308
- * @returns true if state has been stored.
309
- */
310
- hasStateStored() {
311
- return !!this._stateStored;
312
- }
313
- /**
314
- * Restores the camera state values if it has been stored. You must call storeState() first
315
- * @returns true if restored and false otherwise
316
- */
317
- _restoreStateValues() {
318
- if (!this._stateStored) {
319
- return false;
320
- }
321
- this.fov = this._storedFov;
322
- return true;
323
- }
324
- /**
325
- * Restored camera state. You must call storeState() first.
326
- * @returns true if restored and false otherwise
327
- */
328
- restoreState() {
329
- if (this._restoreStateValues()) {
330
- this.onRestoreStateObservable.notifyObservers(this);
331
- return true;
332
- }
333
- return false;
334
- }
335
- /**
336
- * Gets the class name of the camera.
337
- * @returns the class name
338
- */
339
- getClassName() {
340
- return "Camera";
341
- }
342
- /**
343
- * Gets a string representation of the camera useful for debug purpose.
344
- * @param fullDetails Defines that a more verbose level of logging is required
345
- * @returns the string representation
346
- */
347
- toString(fullDetails) {
348
- let ret = "Name: " + this.name;
349
- ret += ", type: " + this.getClassName();
350
- if (this.animations) {
351
- for (let i = 0; i < this.animations.length; i++) {
352
- ret += ", animation[0]: " + this.animations[i].toString(fullDetails);
353
- }
354
- }
355
- return ret;
356
- }
357
- /**
358
- * Automatically tilts the projection plane, using `projectionPlaneTilt`, to correct the perspective effect on vertical lines.
359
- */
360
- applyVerticalCorrection() {
361
- const rot = this.absoluteRotation.toEulerAngles();
362
- this.projectionPlaneTilt = this._scene.useRightHandedSystem ? -rot.x : rot.x;
363
- }
364
- /**
365
- * Gets the current world space position of the camera.
366
- */
367
- get globalPosition() {
368
- return this._globalPosition;
369
- }
370
- /**
371
- * Gets the list of active meshes this frame (meshes no culled or excluded by lod s in the frame)
372
- * @returns the active meshe list
373
- */
374
- getActiveMeshes() {
375
- return this._activeMeshes;
376
- }
377
- /**
378
- * Check whether a mesh is part of the current active mesh list of the camera
379
- * @param mesh Defines the mesh to check
380
- * @returns true if active, false otherwise
381
- */
382
- isActiveMesh(mesh) {
383
- return this._activeMeshes.indexOf(mesh) !== -1;
384
- }
385
- /**
386
- * Is this camera ready to be used/rendered
387
- * @param completeCheck defines if a complete check (including post processes) has to be done (false by default)
388
- * @returns true if the camera is ready
389
- */
390
- isReady(completeCheck = false) {
391
- if (completeCheck) {
392
- for (const pp of this._postProcesses) {
393
- if (pp && !pp.isReady()) {
394
- return false;
395
- }
396
- }
397
- }
398
- return super.isReady(completeCheck);
399
- }
400
- /** @internal */
401
- _initCache() {
402
- super._initCache();
403
- this._cache.position = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
404
- this._cache.upVector = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
405
- this._cache.mode = undefined;
406
- this._cache.minZ = undefined;
407
- this._cache.maxZ = undefined;
408
- this._cache.fov = undefined;
409
- this._cache.fovMode = undefined;
410
- this._cache.aspectRatio = undefined;
411
- this._cache.orthoLeft = undefined;
412
- this._cache.orthoRight = undefined;
413
- this._cache.orthoBottom = undefined;
414
- this._cache.orthoTop = undefined;
415
- this._cache.obliqueAngle = undefined;
416
- this._cache.obliqueLength = undefined;
417
- this._cache.obliqueOffset = undefined;
418
- this._cache.renderWidth = undefined;
419
- this._cache.renderHeight = undefined;
420
- }
421
- /**
422
- * @internal
423
- */
424
- _updateCache(ignoreParentClass) {
425
- if (!ignoreParentClass) {
426
- super._updateCache();
427
- }
428
- this._cache.position.copyFrom(this.position);
429
- this._cache.upVector.copyFrom(this.upVector);
430
- }
431
- /** @internal */
432
- _isSynchronized() {
433
- return this._isSynchronizedViewMatrix() && this._isSynchronizedProjectionMatrix();
434
- }
435
- /** @internal */
436
- _isSynchronizedViewMatrix() {
437
- if (!super._isSynchronized()) {
438
- return false;
439
- }
440
- return this._cache.position.equals(this.position) && this._cache.upVector.equals(this.upVector) && this.isSynchronizedWithParent();
441
- }
442
- /** @internal */
443
- _isSynchronizedProjectionMatrix() {
444
- const maxZ = this.ignoreCameraMaxZ ? 0 : this.maxZ;
445
- let isSynchronized = this._cache.mode === this.mode && this._cache.minZ === this.minZ && this._cache.maxZ === maxZ;
446
- if (!isSynchronized) {
447
- return false;
448
- }
449
- const engine = this.getEngine();
450
- if (this.mode === Camera.PERSPECTIVE_CAMERA) {
451
- isSynchronized =
452
- this._cache.fov === this.fov &&
453
- this._cache.fovMode === this.fovMode &&
454
- this._cache.aspectRatio === engine.getAspectRatio(this) &&
455
- this._cache.projectionPlaneTilt === this.projectionPlaneTilt;
456
- }
457
- else {
458
- isSynchronized =
459
- this._cache.orthoLeft === this.orthoLeft &&
460
- this._cache.orthoRight === this.orthoRight &&
461
- this._cache.orthoBottom === this.orthoBottom &&
462
- this._cache.orthoTop === this.orthoTop &&
463
- this._cache.renderWidth === engine.getRenderWidth() &&
464
- this._cache.renderHeight === engine.getRenderHeight();
465
- if (this.oblique) {
466
- isSynchronized =
467
- isSynchronized &&
468
- this._cache.obliqueAngle === this.oblique.angle &&
469
- this._cache.obliqueLength === this.oblique.length &&
470
- this._cache.obliqueOffset === this.oblique.offset;
471
- }
472
- }
473
- return isSynchronized;
474
- }
475
- /**
476
- * Attach the input controls to a specific dom element to get the input from.
477
- * This function is here because typescript removes the typing of the last function.
478
- * @param _ignored defines an ignored parameter kept for backward compatibility.
479
- * @param _noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
480
- */
481
- attachControl(_ignored, _noPreventDefault) { }
482
- /**
483
- * Detach the current controls from the specified dom element.
484
- * This function is here because typescript removes the typing of the last function.
485
- * @param _ignored defines an ignored parameter kept for backward compatibility.
486
- */
487
- detachControl(_ignored) { }
488
- /**
489
- * Update the camera state according to the different inputs gathered during the frame.
490
- */
491
- update() {
492
- this._hasMoved = false;
493
- this._checkInputs();
494
- if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {
495
- this._updateRigCameras();
496
- }
497
- // Attempt to update the camera's view and projection matrices.
498
- // This call is being made because these matrices are no longer being updated
499
- // as a part of the picking ray process (in addition to scene.render).
500
- this.getViewMatrix();
501
- this.getProjectionMatrix();
502
- }
503
- /** @internal */
504
- _checkInputs() {
505
- this.onAfterCheckInputsObservable.notifyObservers(this);
506
- }
507
- /** @internal */
508
- get rigCameras() {
509
- return this._rigCameras;
510
- }
511
- /**
512
- * Gets the post process used by the rig cameras
513
- */
514
- get rigPostProcess() {
515
- return this._rigPostProcess;
516
- }
517
- /**
518
- * Internal, gets the first post process.
519
- * @returns the first post process to be run on this camera.
520
- */
521
- _getFirstPostProcess() {
522
- for (let ppIndex = 0; ppIndex < this._postProcesses.length; ppIndex++) {
523
- if (this._postProcesses[ppIndex] !== null) {
524
- return this._postProcesses[ppIndex];
525
- }
526
- }
527
- return null;
528
- }
529
- _cascadePostProcessesToRigCams() {
530
- // invalidate framebuffer
531
- const firstPostProcess = this._getFirstPostProcess();
532
- if (firstPostProcess) {
533
- firstPostProcess.markTextureDirty();
534
- }
535
- // glue the rigPostProcess to the end of the user postprocesses & assign to each sub-camera
536
- for (let i = 0, len = this._rigCameras.length; i < len; i++) {
537
- const cam = this._rigCameras[i];
538
- const rigPostProcess = cam._rigPostProcess;
539
- // for VR rig, there does not have to be a post process
540
- if (rigPostProcess) {
541
- const isPass = rigPostProcess.getEffectName() === "pass";
542
- if (isPass) {
543
- // any rig which has a PassPostProcess for rig[0], cannot be isIntermediate when there are also user postProcesses
544
- cam.isIntermediate = this._postProcesses.length === 0;
545
- }
546
- cam._postProcesses = this._postProcesses.slice(0).concat(rigPostProcess);
547
- rigPostProcess.markTextureDirty();
548
- }
549
- else {
550
- cam._postProcesses = this._postProcesses.slice(0);
551
- }
552
- }
553
- }
554
- /**
555
- * Attach a post process to the camera.
556
- * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses#attach-postprocess
557
- * @param postProcess The post process to attach to the camera
558
- * @param insertAt The position of the post process in case several of them are in use in the scene
559
- * @returns the position the post process has been inserted at
560
- */
561
- attachPostProcess(postProcess, insertAt = null) {
562
- if (!postProcess.isReusable() && this._postProcesses.indexOf(postProcess) > -1) {
563
- Logger.Error("You're trying to reuse a post process not defined as reusable.");
564
- return 0;
565
- }
566
- if (insertAt == null || insertAt < 0) {
567
- this._postProcesses.push(postProcess);
568
- }
569
- else if (this._postProcesses[insertAt] === null) {
570
- this._postProcesses[insertAt] = postProcess;
571
- }
572
- else {
573
- this._postProcesses.splice(insertAt, 0, postProcess);
574
- }
575
- this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated
576
- // Update prePass
577
- if (this._scene.prePassRenderer) {
578
- this._scene.prePassRenderer.markAsDirty();
579
- }
580
- return this._postProcesses.indexOf(postProcess);
581
- }
582
- /**
583
- * Detach a post process to the camera.
584
- * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses#attach-postprocess
585
- * @param postProcess The post process to detach from the camera
586
- */
587
- detachPostProcess(postProcess) {
588
- const idx = this._postProcesses.indexOf(postProcess);
589
- if (idx !== -1) {
590
- this._postProcesses[idx] = null;
591
- }
592
- // Update prePass
593
- if (this._scene.prePassRenderer) {
594
- this._scene.prePassRenderer.markAsDirty();
595
- }
596
- this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated
597
- }
598
- /**
599
- * Gets the current world matrix of the camera
600
- * @returns the world matrix
601
- */
602
- getWorldMatrix() {
603
- if (this._isSynchronizedViewMatrix()) {
604
- return this._worldMatrix;
605
- }
606
- // Getting the view matrix will also compute the world matrix.
607
- this.getViewMatrix();
608
- return this._worldMatrix;
609
- }
610
- /** @internal */
611
- _getViewMatrix() {
612
- return Matrix.Identity();
613
- }
614
- /**
615
- * Gets the current view matrix of the camera.
616
- * @param force forces the camera to recompute the matrix without looking at the cached state
617
- * @returns the view matrix
618
- */
619
- getViewMatrix(force) {
620
- if (!force && this._isSynchronizedViewMatrix()) {
621
- return this._computedViewMatrix;
622
- }
623
- this._hasMoved = true;
624
- this.updateCache();
625
- this._computedViewMatrix = this._getViewMatrix();
626
- this._currentRenderId = this.getScene().getRenderId();
627
- this._childUpdateId++;
628
- this._refreshFrustumPlanes = true;
629
- if (this._cameraRigParams && this._cameraRigParams.vrPreViewMatrix) {
630
- this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix, this._computedViewMatrix);
631
- }
632
- // Notify parent camera if rig camera is changed
633
- if (this.parent && this.parent.onViewMatrixChangedObservable) {
634
- this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent);
635
- }
636
- this.onViewMatrixChangedObservable.notifyObservers(this);
637
- this._computedViewMatrix.invertToRef(this._worldMatrix);
638
- this._worldMatrix.getTranslationToRef(this._globalPosition);
639
- return this._computedViewMatrix;
640
- }
641
- /**
642
- * Freeze the projection matrix.
643
- * It will prevent the cache check of the camera projection compute and can speed up perf
644
- * if no parameter of the camera are meant to change
645
- * @param projection Defines manually a projection if necessary
646
- */
647
- freezeProjectionMatrix(projection) {
648
- this._doNotComputeProjectionMatrix = true;
649
- if (projection !== undefined) {
650
- this._projectionMatrix = projection;
651
- }
652
- }
653
- /**
654
- * Unfreeze the projection matrix if it has previously been freezed by freezeProjectionMatrix.
655
- */
656
- unfreezeProjectionMatrix() {
657
- this._doNotComputeProjectionMatrix = false;
658
- }
659
- /**
660
- * Gets the current projection matrix of the camera.
661
- * @param force forces the camera to recompute the matrix without looking at the cached state
662
- * @returns the projection matrix
663
- */
664
- getProjectionMatrix(force) {
665
- if (this._doNotComputeProjectionMatrix || (!force && this._isSynchronizedProjectionMatrix())) {
666
- return this._projectionMatrix;
667
- }
668
- const maxZ = this.ignoreCameraMaxZ ? 0 : this.maxZ;
669
- // Cache
670
- this._cache.mode = this.mode;
671
- this._cache.minZ = this.minZ;
672
- this._cache.maxZ = maxZ;
673
- // Matrix
674
- this._refreshFrustumPlanes = true;
675
- const engine = this.getEngine();
676
- const scene = this.getScene();
677
- const reverseDepth = engine.useReverseDepthBuffer;
678
- if (this.mode === Camera.PERSPECTIVE_CAMERA) {
679
- this._cache.fov = this.fov;
680
- this._cache.fovMode = this.fovMode;
681
- this._cache.aspectRatio = engine.getAspectRatio(this);
682
- this._cache.projectionPlaneTilt = this.projectionPlaneTilt;
683
- if (this.minZ <= 0) {
684
- this.minZ = 0.1;
685
- }
686
- let getProjectionMatrix;
687
- if (scene.useRightHandedSystem) {
688
- getProjectionMatrix = Matrix.PerspectiveFovRHToRef;
689
- }
690
- else {
691
- getProjectionMatrix = Matrix.PerspectiveFovLHToRef;
692
- }
693
- getProjectionMatrix(this.fov, engine.getAspectRatio(this), reverseDepth ? maxZ : this.minZ, reverseDepth ? this.minZ : maxZ, this._projectionMatrix, this.fovMode === Camera.FOVMODE_VERTICAL_FIXED, engine.isNDCHalfZRange, this.projectionPlaneTilt, reverseDepth);
694
- }
695
- else {
696
- const halfWidth = engine.getRenderWidth() / 2.0;
697
- const halfHeight = engine.getRenderHeight() / 2.0;
698
- if (scene.useRightHandedSystem) {
699
- if (this.oblique) {
700
- Matrix.ObliqueOffCenterRHToRef(this.orthoLeft ?? -halfWidth, this.orthoRight ?? halfWidth, this.orthoBottom ?? -halfHeight, this.orthoTop ?? halfHeight, reverseDepth ? maxZ : this.minZ, reverseDepth ? this.minZ : maxZ, this.oblique.length, this.oblique.angle, this._computeObliqueDistance(this.oblique.offset), this._projectionMatrix, engine.isNDCHalfZRange);
701
- }
702
- else {
703
- Matrix.OrthoOffCenterRHToRef(this.orthoLeft ?? -halfWidth, this.orthoRight ?? halfWidth, this.orthoBottom ?? -halfHeight, this.orthoTop ?? halfHeight, reverseDepth ? maxZ : this.minZ, reverseDepth ? this.minZ : maxZ, this._projectionMatrix, engine.isNDCHalfZRange);
704
- }
705
- }
706
- else {
707
- if (this.oblique) {
708
- Matrix.ObliqueOffCenterLHToRef(this.orthoLeft ?? -halfWidth, this.orthoRight ?? halfWidth, this.orthoBottom ?? -halfHeight, this.orthoTop ?? halfHeight, reverseDepth ? maxZ : this.minZ, reverseDepth ? this.minZ : maxZ, this.oblique.length, this.oblique.angle, this._computeObliqueDistance(this.oblique.offset), this._projectionMatrix, engine.isNDCHalfZRange);
709
- }
710
- else {
711
- Matrix.OrthoOffCenterLHToRef(this.orthoLeft ?? -halfWidth, this.orthoRight ?? halfWidth, this.orthoBottom ?? -halfHeight, this.orthoTop ?? halfHeight, reverseDepth ? maxZ : this.minZ, reverseDepth ? this.minZ : maxZ, this._projectionMatrix, engine.isNDCHalfZRange);
712
- }
713
- }
714
- this._cache.orthoLeft = this.orthoLeft;
715
- this._cache.orthoRight = this.orthoRight;
716
- this._cache.orthoBottom = this.orthoBottom;
717
- this._cache.orthoTop = this.orthoTop;
718
- this._cache.obliqueAngle = this.oblique?.angle;
719
- this._cache.obliqueLength = this.oblique?.length;
720
- this._cache.obliqueOffset = this.oblique?.offset;
721
- this._cache.renderWidth = engine.getRenderWidth();
722
- this._cache.renderHeight = engine.getRenderHeight();
723
- }
724
- this.onProjectionMatrixChangedObservable.notifyObservers(this);
725
- return this._projectionMatrix;
726
- }
727
- /**
728
- * Gets the transformation matrix (ie. the multiplication of view by projection matrices)
729
- * @returns a Matrix
730
- */
731
- getTransformationMatrix() {
732
- this._computedViewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);
733
- return this._transformMatrix;
734
- }
735
- _computeObliqueDistance(offset) {
736
- const arcRotateCamera = this;
737
- const targetCamera = this;
738
- return (arcRotateCamera.radius || (targetCamera.target ? Vector3.Distance(this.position, targetCamera.target) : this.position.length())) + offset;
739
- }
740
- /** @internal */
741
- _updateFrustumPlanes() {
742
- if (!this._refreshFrustumPlanes) {
743
- return;
744
- }
745
- this.getTransformationMatrix();
746
- if (!this._frustumPlanes) {
747
- this._frustumPlanes = Frustum.GetPlanes(this._transformMatrix);
748
- }
749
- else {
750
- Frustum.GetPlanesToRef(this._transformMatrix, this._frustumPlanes);
751
- }
752
- this._refreshFrustumPlanes = false;
753
- }
754
- /**
755
- * Checks if a cullable object (mesh...) is in the camera frustum
756
- * This checks the bounding box center. See isCompletelyInFrustum for a full bounding check
757
- * @param target The object to check
758
- * @param checkRigCameras If the rig cameras should be checked (eg. with VR camera both eyes should be checked) (Default: false)
759
- * @returns true if the object is in frustum otherwise false
760
- */
761
- isInFrustum(target, checkRigCameras = false) {
762
- this._updateFrustumPlanes();
763
- if (checkRigCameras && this.rigCameras.length > 0) {
764
- let result = false;
765
- for (const cam of this.rigCameras) {
766
- cam._updateFrustumPlanes();
767
- result = result || target.isInFrustum(cam._frustumPlanes);
768
- }
769
- return result;
770
- }
771
- else {
772
- return target.isInFrustum(this._frustumPlanes);
773
- }
774
- }
775
- /**
776
- * Checks if a cullable object (mesh...) is in the camera frustum
777
- * Unlike isInFrustum this checks the full bounding box
778
- * @param target The object to check
779
- * @returns true if the object is in frustum otherwise false
780
- */
781
- isCompletelyInFrustum(target) {
782
- this._updateFrustumPlanes();
783
- return target.isCompletelyInFrustum(this._frustumPlanes);
784
- }
785
- // eslint-disable-next-line jsdoc/require-returns-check
786
- /**
787
- * Gets a ray in the forward direction from the camera.
788
- * @param length Defines the length of the ray to create
789
- * @param transform Defines the transform to apply to the ray, by default the world matrix is used to create a world space ray
790
- * @param origin Defines the start point of the ray which defaults to the camera position
791
- * @returns the forward ray
792
- */
793
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
794
- getForwardRay(length = 100, transform, origin) {
795
- throw _WarnImport("Ray");
796
- }
797
- // eslint-disable-next-line jsdoc/require-returns-check
798
- /**
799
- * Gets a ray in the forward direction from the camera.
800
- * @param refRay the ray to (re)use when setting the values
801
- * @param length Defines the length of the ray to create
802
- * @param transform Defines the transform to apply to the ray, by default the world matrix is used to create a world space ray
803
- * @param origin Defines the start point of the ray which defaults to the camera position
804
- * @returns the forward ray
805
- */
806
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
807
- getForwardRayToRef(refRay, length = 100, transform, origin) {
808
- throw _WarnImport("Ray");
809
- }
810
- /**
811
- * Releases resources associated with this node.
812
- * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
813
- * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)
814
- */
815
- dispose(doNotRecurse, disposeMaterialAndTextures = false) {
816
- // Observables
817
- this.onViewMatrixChangedObservable.clear();
818
- this.onProjectionMatrixChangedObservable.clear();
819
- this.onAfterCheckInputsObservable.clear();
820
- this.onRestoreStateObservable.clear();
821
- // Inputs
822
- if (this.inputs) {
823
- this.inputs.clear();
824
- }
825
- // Animations
826
- this.getScene().stopAnimation(this);
827
- // Remove from scene
828
- this.getScene().removeCamera(this);
829
- while (this._rigCameras.length > 0) {
830
- const camera = this._rigCameras.pop();
831
- if (camera) {
832
- camera.dispose();
833
- }
834
- }
835
- if (this._parentContainer) {
836
- const index = this._parentContainer.cameras.indexOf(this);
837
- if (index > -1) {
838
- this._parentContainer.cameras.splice(index, 1);
839
- }
840
- this._parentContainer = null;
841
- }
842
- // Postprocesses
843
- if (this._rigPostProcess) {
844
- this._rigPostProcess.dispose(this);
845
- this._rigPostProcess = null;
846
- this._postProcesses.length = 0;
847
- }
848
- else if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {
849
- this._rigPostProcess = null;
850
- this._postProcesses.length = 0;
851
- }
852
- else {
853
- let i = this._postProcesses.length;
854
- while (--i >= 0) {
855
- const postProcess = this._postProcesses[i];
856
- if (postProcess) {
857
- postProcess.dispose(this);
858
- }
859
- }
860
- }
861
- // Render targets
862
- let i = this.customRenderTargets.length;
863
- while (--i >= 0) {
864
- this.customRenderTargets[i].dispose();
865
- }
866
- this.customRenderTargets.length = 0;
867
- // Active Meshes
868
- this._activeMeshes.dispose();
869
- this.getScene().getEngine().releaseRenderPassId(this.renderPassId);
870
- super.dispose(doNotRecurse, disposeMaterialAndTextures);
871
- }
872
- /**
873
- * Gets the left camera of a rig setup in case of Rigged Camera
874
- */
875
- get isLeftCamera() {
876
- return this._isLeftCamera;
877
- }
878
- /**
879
- * Gets the right camera of a rig setup in case of Rigged Camera
880
- */
881
- get isRightCamera() {
882
- return this._isRightCamera;
883
- }
884
- /**
885
- * Gets the left camera of a rig setup in case of Rigged Camera
886
- */
887
- get leftCamera() {
888
- if (this._rigCameras.length < 1) {
889
- return null;
890
- }
891
- return this._rigCameras[0];
892
- }
893
- /**
894
- * Gets the right camera of a rig setup in case of Rigged Camera
895
- */
896
- get rightCamera() {
897
- if (this._rigCameras.length < 2) {
898
- return null;
899
- }
900
- return this._rigCameras[1];
901
- }
902
- /**
903
- * Gets the left camera target of a rig setup in case of Rigged Camera
904
- * @returns the target position
905
- */
906
- getLeftTarget() {
907
- if (this._rigCameras.length < 1) {
908
- return null;
909
- }
910
- return this._rigCameras[0].getTarget();
911
- }
912
- /**
913
- * Gets the right camera target of a rig setup in case of Rigged Camera
914
- * @returns the target position
915
- */
916
- getRightTarget() {
917
- if (this._rigCameras.length < 2) {
918
- return null;
919
- }
920
- return this._rigCameras[1].getTarget();
921
- }
922
- /**
923
- * @internal
924
- */
925
- setCameraRigMode(mode, rigParams) {
926
- if (this.cameraRigMode === mode) {
927
- return;
928
- }
929
- while (this._rigCameras.length > 0) {
930
- const camera = this._rigCameras.pop();
931
- if (camera) {
932
- camera.dispose();
933
- }
934
- }
935
- this.cameraRigMode = mode;
936
- this._cameraRigParams = {};
937
- //we have to implement stereo camera calcultating left and right viewpoints from interaxialDistance and target,
938
- //not from a given angle as it is now, but until that complete code rewriting provisional stereoHalfAngle value is introduced
939
- this._cameraRigParams.interaxialDistance = rigParams.interaxialDistance || 0.0637;
940
- this._cameraRigParams.stereoHalfAngle = (this._cameraRigParams.interaxialDistance / 0.0637) * (Math.PI / 180);
941
- // create the rig cameras, unless none
942
- if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {
943
- const leftCamera = this.createRigCamera(this.name + "_L", 0);
944
- if (leftCamera) {
945
- leftCamera._isLeftCamera = true;
946
- }
947
- const rightCamera = this.createRigCamera(this.name + "_R", 1);
948
- if (rightCamera) {
949
- rightCamera._isRightCamera = true;
950
- }
951
- if (leftCamera && rightCamera) {
952
- this._rigCameras.push(leftCamera);
953
- this._rigCameras.push(rightCamera);
954
- }
955
- }
956
- this._setRigMode(rigParams);
957
- this._cascadePostProcessesToRigCams();
958
- this.update();
959
- }
960
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
961
- _setRigMode(rigParams) {
962
- // no-op
963
- }
964
- /** @internal */
965
- _getVRProjectionMatrix() {
966
- Matrix.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov, this._cameraRigParams.vrMetrics.aspectRatio, this.minZ, this.ignoreCameraMaxZ ? 0 : this.maxZ, this._cameraRigParams.vrWorkMatrix, true, this.getEngine().isNDCHalfZRange);
967
- this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix, this._projectionMatrix);
968
- return this._projectionMatrix;
969
- }
970
- /**
971
- * @internal
972
- */
973
- setCameraRigParameter(name, value) {
974
- if (!this._cameraRigParams) {
975
- this._cameraRigParams = {};
976
- }
977
- this._cameraRigParams[name] = value;
978
- //provisionnally:
979
- if (name === "interaxialDistance") {
980
- this._cameraRigParams.stereoHalfAngle = (value / 0.0637) * (Math.PI / 180);
981
- }
982
- }
983
- /**
984
- * needs to be overridden by children so sub has required properties to be copied
985
- * @internal
986
- */
987
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
988
- createRigCamera(name, cameraIndex) {
989
- return null;
990
- }
991
- /**
992
- * May need to be overridden by children
993
- * @internal
994
- */
995
- _updateRigCameras() {
996
- for (let i = 0; i < this._rigCameras.length; i++) {
997
- this._rigCameras[i].minZ = this.minZ;
998
- this._rigCameras[i].maxZ = this.ignoreCameraMaxZ ? 0 : this.maxZ;
999
- this._rigCameras[i].fov = this.fov;
1000
- this._rigCameras[i].upVector.copyFrom(this.upVector);
1001
- }
1002
- // only update viewport when ANAGLYPH
1003
- if (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH) {
1004
- this._rigCameras[0].viewport = this._rigCameras[1].viewport = this.viewport;
1005
- }
1006
- }
1007
- /** @internal */
1008
- _setupInputs() { }
1009
- /**
1010
- * Serialiaze the camera setup to a json representation
1011
- * @returns the JSON representation
1012
- */
1013
- serialize() {
1014
- const serializationObject = SerializationHelper.Serialize(this);
1015
- serializationObject.uniqueId = this.uniqueId;
1016
- // Type
1017
- serializationObject.type = this.getClassName();
1018
- // Parent
1019
- if (this.parent) {
1020
- this.parent._serializeAsParent(serializationObject);
1021
- }
1022
- if (this.inputs) {
1023
- this.inputs.serialize(serializationObject);
1024
- }
1025
- // Animations
1026
- SerializationHelper.AppendSerializedAnimations(this, serializationObject);
1027
- serializationObject.ranges = this.serializeAnimationRanges();
1028
- serializationObject.isEnabled = this.isEnabled();
1029
- return serializationObject;
1030
- }
1031
- /**
1032
- * Clones the current camera.
1033
- * @param name The cloned camera name
1034
- * @param newParent The cloned camera's new parent (none by default)
1035
- * @returns the cloned camera
1036
- */
1037
- clone(name, newParent = null) {
1038
- const camera = SerializationHelper.Clone(Camera.GetConstructorFromName(this.getClassName(), name, this.getScene(), this.interaxialDistance, this.isStereoscopicSideBySide), this);
1039
- camera.name = name;
1040
- camera.parent = newParent;
1041
- this.onClonedObservable.notifyObservers(camera);
1042
- return camera;
1043
- }
1044
- /**
1045
- * Gets the direction of the camera relative to a given local axis.
1046
- * @param localAxis Defines the reference axis to provide a relative direction.
1047
- * @returns the direction
1048
- */
1049
- getDirection(localAxis) {
1050
- const result = Vector3.Zero();
1051
- this.getDirectionToRef(localAxis, result);
1052
- return result;
1053
- }
1054
- /**
1055
- * Returns the current camera absolute rotation
1056
- */
1057
- get absoluteRotation() {
1058
- this.getWorldMatrix().decompose(undefined, this._absoluteRotation);
1059
- return this._absoluteRotation;
1060
- }
1061
- /**
1062
- * Gets the direction of the camera relative to a given local axis into a passed vector.
1063
- * @param localAxis Defines the reference axis to provide a relative direction.
1064
- * @param result Defines the vector to store the result in
1065
- */
1066
- getDirectionToRef(localAxis, result) {
1067
- Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
1068
- }
1069
- /**
1070
- * Gets a camera constructor for a given camera type
1071
- * @param type The type of the camera to construct (should be equal to one of the camera class name)
1072
- * @param name The name of the camera the result will be able to instantiate
1073
- * @param scene The scene the result will construct the camera in
1074
- * @param interaxial_distance In case of stereoscopic setup, the distance between both eyes
1075
- * @param isStereoscopicSideBySide In case of stereoscopic setup, should the sereo be side b side
1076
- * @returns a factory method to construct the camera
1077
- */
1078
- // eslint-disable-next-line @typescript-eslint/naming-convention
1079
- static GetConstructorFromName(type, name, scene, interaxial_distance = 0, isStereoscopicSideBySide = true) {
1080
- const constructorFunc = Node.Construct(type, name, scene, {
1081
- interaxial_distance: interaxial_distance,
1082
- isStereoscopicSideBySide: isStereoscopicSideBySide,
1083
- });
1084
- if (constructorFunc) {
1085
- return constructorFunc;
1086
- }
1087
- // Default to universal camera
1088
- return () => Camera._CreateDefaultParsedCamera(name, scene);
1089
- }
1090
- /**
1091
- * Compute the world matrix of the camera.
1092
- * @returns the camera world matrix
1093
- */
1094
- computeWorldMatrix() {
1095
- return this.getWorldMatrix();
1096
- }
1097
- /** @internal */
1098
- _calculateHandednessMultiplier() {
1099
- let handednessMultiplier = this.getScene().useRightHandedSystem ? -1 : 1;
1100
- if (this.parent && this.parent._getWorldMatrixDeterminant() < 0) {
1101
- handednessMultiplier *= -1;
1102
- }
1103
- return handednessMultiplier;
1104
- }
1105
- }
1106
- /**
1107
- * @internal
1108
- */
1109
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1110
- Camera._CreateDefaultParsedCamera = (name, scene) => {
1111
- throw _WarnImport("UniversalCamera");
1112
- };
1113
- /**
1114
- * This is the default projection mode used by the cameras.
1115
- * It helps recreating a feeling of perspective and better appreciate depth.
1116
- * This is the best way to simulate real life cameras.
1117
- */
1118
- Camera.PERSPECTIVE_CAMERA = 0;
1119
- /**
1120
- * This helps creating camera with an orthographic mode.
1121
- * Orthographic is commonly used in engineering as a means to produce object specifications that communicate dimensions unambiguously, each line of 1 unit length (cm, meter..whatever) will appear to have the same length everywhere on the drawing. This allows the drafter to dimension only a subset of lines and let the reader know that other lines of that length on the drawing are also that length in reality. Every parallel line in the drawing is also parallel in the object.
1122
- */
1123
- Camera.ORTHOGRAPHIC_CAMERA = 1;
1124
- /**
1125
- * This is the default FOV mode for perspective cameras.
1126
- * This setting aligns the upper and lower bounds of the viewport to the upper and lower bounds of the camera frustum.
1127
- */
1128
- Camera.FOVMODE_VERTICAL_FIXED = 0;
1129
- /**
1130
- * This setting aligns the left and right bounds of the viewport to the left and right bounds of the camera frustum.
1131
- */
1132
- Camera.FOVMODE_HORIZONTAL_FIXED = 1;
1133
- /**
1134
- * This specifies there is no need for a camera rig.
1135
- * Basically only one eye is rendered corresponding to the camera.
1136
- */
1137
- Camera.RIG_MODE_NONE = 0;
1138
- /**
1139
- * Simulates a camera Rig with one blue eye and one red eye.
1140
- * This can be use with 3d blue and red glasses.
1141
- */
1142
- Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH = 10;
1143
- /**
1144
- * Defines that both eyes of the camera will be rendered side by side with a parallel target.
1145
- */
1146
- Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL = 11;
1147
- /**
1148
- * Defines that both eyes of the camera will be rendered side by side with a none parallel target.
1149
- */
1150
- Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED = 12;
1151
- /**
1152
- * Defines that both eyes of the camera will be rendered over under each other.
1153
- */
1154
- Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER = 13;
1155
- /**
1156
- * Defines that both eyes of the camera will be rendered on successive lines interlaced for passive 3d monitors.
1157
- */
1158
- Camera.RIG_MODE_STEREOSCOPIC_INTERLACED = 14;
1159
- /**
1160
- * Defines that both eyes of the camera should be renderered in a VR mode (carbox).
1161
- */
1162
- // eslint-disable-next-line @typescript-eslint/naming-convention
1163
- Camera.RIG_MODE_VR = 20;
1164
- /**
1165
- * Custom rig mode allowing rig cameras to be populated manually with any number of cameras
1166
- */
1167
- Camera.RIG_MODE_CUSTOM = 22;
1168
- /**
1169
- * Defines if by default attaching controls should prevent the default javascript event to continue.
1170
- */
1171
- Camera.ForceAttachControlToAlwaysPreventDefault = false;
1172
- __decorate([
1173
- serializeAsVector3("position")
1174
- ], Camera.prototype, "_position", void 0);
1175
- __decorate([
1176
- serializeAsVector3("upVector")
1177
- ], Camera.prototype, "_upVector", void 0);
1178
- __decorate([
1179
- serialize()
1180
- ], Camera.prototype, "orthoLeft", null);
1181
- __decorate([
1182
- serialize()
1183
- ], Camera.prototype, "orthoRight", null);
1184
- __decorate([
1185
- serialize()
1186
- ], Camera.prototype, "orthoBottom", null);
1187
- __decorate([
1188
- serialize()
1189
- ], Camera.prototype, "orthoTop", null);
1190
- __decorate([
1191
- serialize()
1192
- ], Camera.prototype, "fov", void 0);
1193
- __decorate([
1194
- serialize()
1195
- ], Camera.prototype, "projectionPlaneTilt", void 0);
1196
- __decorate([
1197
- serialize()
1198
- ], Camera.prototype, "minZ", void 0);
1199
- __decorate([
1200
- serialize()
1201
- ], Camera.prototype, "maxZ", void 0);
1202
- __decorate([
1203
- serialize()
1204
- ], Camera.prototype, "inertia", null);
1205
- __decorate([
1206
- serialize()
1207
- ], Camera.prototype, "mode", null);
1208
- __decorate([
1209
- serialize()
1210
- ], Camera.prototype, "layerMask", void 0);
1211
- __decorate([
1212
- serialize()
1213
- ], Camera.prototype, "fovMode", void 0);
1214
- __decorate([
1215
- serialize()
1216
- ], Camera.prototype, "cameraRigMode", void 0);
1217
- __decorate([
1218
- serialize()
1219
- ], Camera.prototype, "interaxialDistance", void 0);
1220
- __decorate([
1221
- serialize()
1222
- ], Camera.prototype, "isStereoscopicSideBySide", void 0);
1223
- __decorate([
1224
- serialize()
1225
- ], Camera.prototype, "ignoreCameraMaxZ", void 0);
1269
+ _a.ForceAttachControlToAlwaysPreventDefault = false,
1270
+ _a;
1271
+ })();
1272
+ export { Camera };
1226
1273
  /**
1227
1274
  * Parse a JSON and creates the camera from the parsed information
1228
1275
  * @param parsedCamera The JSON to parse