@babylonjs/core 5.23.0 → 5.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/Actions/abstractActionManager.d.ts +6 -6
  2. package/Actions/abstractActionManager.js +1 -1
  3. package/Actions/abstractActionManager.js.map +1 -1
  4. package/Actions/actionManager.d.ts +5 -5
  5. package/Actions/actionManager.js +5 -5
  6. package/Actions/actionManager.js.map +1 -1
  7. package/Animations/animationGroup.d.ts +3 -3
  8. package/Animations/animationGroup.js +3 -3
  9. package/Animations/animationGroup.js.map +1 -1
  10. package/Audio/audioSceneComponent.d.ts +1 -1
  11. package/Audio/audioSceneComponent.js.map +1 -1
  12. package/Behaviors/Cameras/autoRotationBehavior.d.ts +1 -1
  13. package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
  14. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  15. package/Behaviors/Cameras/bouncingBehavior.d.ts +1 -1
  16. package/Behaviors/Cameras/bouncingBehavior.js +1 -1
  17. package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
  18. package/Behaviors/Cameras/framingBehavior.d.ts +1 -1
  19. package/Behaviors/Cameras/framingBehavior.js +1 -1
  20. package/Behaviors/Cameras/framingBehavior.js.map +1 -1
  21. package/Bones/bone.d.ts +1 -1
  22. package/Bones/bone.js +1 -1
  23. package/Bones/bone.js.map +1 -1
  24. package/Bones/skeleton.d.ts +2 -2
  25. package/Bones/skeleton.js +2 -2
  26. package/Bones/skeleton.js.map +1 -1
  27. package/Cameras/arcRotateCamera.d.ts +1 -1
  28. package/Cameras/arcRotateCamera.js +1 -1
  29. package/Cameras/arcRotateCamera.js.map +1 -1
  30. package/Cameras/camera.d.ts +2 -2
  31. package/Cameras/camera.js +2 -2
  32. package/Cameras/camera.js.map +1 -1
  33. package/Cameras/freeCamera.d.ts +1 -1
  34. package/Cameras/freeCamera.js +1 -1
  35. package/Cameras/freeCamera.js.map +1 -1
  36. package/Cameras/gamepadCamera.d.ts +1 -1
  37. package/Cameras/gamepadCamera.js +1 -1
  38. package/Cameras/gamepadCamera.js.map +1 -1
  39. package/Cameras/targetCamera.d.ts +1 -1
  40. package/Cameras/targetCamera.js +1 -1
  41. package/Cameras/targetCamera.js.map +1 -1
  42. package/Cameras/touchCamera.d.ts +1 -1
  43. package/Cameras/touchCamera.js +1 -1
  44. package/Cameras/touchCamera.js.map +1 -1
  45. package/Cameras/universalCamera.d.ts +1 -1
  46. package/Cameras/universalCamera.js +1 -1
  47. package/Cameras/universalCamera.js.map +1 -1
  48. package/Cameras/virtualJoysticksCamera.d.ts +1 -1
  49. package/Cameras/virtualJoysticksCamera.js +1 -1
  50. package/Cameras/virtualJoysticksCamera.js.map +1 -1
  51. package/Culling/boundingBox.d.ts +2 -2
  52. package/Culling/boundingBox.js +2 -2
  53. package/Culling/boundingBox.js.map +1 -1
  54. package/Culling/ray.d.ts +1 -1
  55. package/Culling/ray.js +1 -1
  56. package/Culling/ray.js.map +1 -1
  57. package/Debug/debugLayer.d.ts +1 -1
  58. package/Debug/debugLayer.js +1 -1
  59. package/Debug/debugLayer.js.map +1 -1
  60. package/Engines/Extensions/engine.multiRender.js +8 -10
  61. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  62. package/Engines/Extensions/engine.query.d.ts +2 -2
  63. package/Engines/Extensions/engine.query.js.map +1 -1
  64. package/Engines/ICanvas.d.ts +11 -0
  65. package/Engines/ICanvas.js.map +1 -1
  66. package/Engines/WebGL/webGLPipelineContext.d.ts +29 -19
  67. package/Engines/WebGL/webGLPipelineContext.js +99 -311
  68. package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
  69. package/Engines/WebGL/webGLRenderTargetWrapper.js +1 -1
  70. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  71. package/Engines/engine.d.ts +2 -2
  72. package/Engines/engine.js +2 -2
  73. package/Engines/engine.js.map +1 -1
  74. package/Engines/nativeEngine.d.ts +2 -2
  75. package/Engines/nativeEngine.js +2 -2
  76. package/Engines/nativeEngine.js.map +1 -1
  77. package/Engines/renderTargetWrapper.d.ts +1 -0
  78. package/Engines/renderTargetWrapper.js +5 -2
  79. package/Engines/renderTargetWrapper.js.map +1 -1
  80. package/Engines/thinEngine.d.ts +6 -5
  81. package/Engines/thinEngine.js +11 -7
  82. package/Engines/thinEngine.js.map +1 -1
  83. package/Engines/webgpuEngine.js +4 -1
  84. package/Engines/webgpuEngine.js.map +1 -1
  85. package/Events/clipboardEvents.d.ts +1 -1
  86. package/Events/clipboardEvents.js +1 -1
  87. package/Events/clipboardEvents.js.map +1 -1
  88. package/Gamepads/Controllers/windowsMotionController.d.ts +1 -1
  89. package/Gamepads/Controllers/windowsMotionController.js +1 -1
  90. package/Gamepads/Controllers/windowsMotionController.js.map +1 -1
  91. package/Gizmos/boundingBoxGizmo.d.ts +4 -0
  92. package/Gizmos/boundingBoxGizmo.js +6 -0
  93. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  94. package/Layers/effectLayer.d.ts +3 -3
  95. package/Layers/effectLayer.js +1 -1
  96. package/Layers/effectLayer.js.map +1 -1
  97. package/Layers/glowLayer.d.ts +3 -3
  98. package/Layers/glowLayer.js +2 -2
  99. package/Layers/glowLayer.js.map +1 -1
  100. package/Layers/highlightLayer.d.ts +3 -3
  101. package/Layers/highlightLayer.js +2 -2
  102. package/Layers/highlightLayer.js.map +1 -1
  103. package/Lights/directionalLight.d.ts +2 -2
  104. package/Lights/directionalLight.js +2 -2
  105. package/Lights/directionalLight.js.map +1 -1
  106. package/Lights/hemisphericLight.d.ts +3 -3
  107. package/Lights/hemisphericLight.js +3 -3
  108. package/Lights/hemisphericLight.js.map +1 -1
  109. package/Lights/light.d.ts +2 -2
  110. package/Lights/light.js +2 -2
  111. package/Lights/light.js.map +1 -1
  112. package/Lights/lightConstants.d.ts +1 -1
  113. package/Lights/lightConstants.js +1 -1
  114. package/Lights/lightConstants.js.map +1 -1
  115. package/Loading/sceneLoader.d.ts +1 -1
  116. package/Loading/sceneLoader.js.map +1 -1
  117. package/Materials/Background/backgroundMaterial.js +1 -1
  118. package/Materials/Background/backgroundMaterial.js.map +1 -1
  119. package/Materials/Node/nodeMaterial.d.ts +1 -1
  120. package/Materials/Node/nodeMaterial.js +2 -2
  121. package/Materials/Node/nodeMaterial.js.map +1 -1
  122. package/Materials/PBR/pbrBaseMaterial.js +1 -1
  123. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  124. package/Materials/Textures/Filtering/hdrFiltering.d.ts +1 -1
  125. package/Materials/Textures/Filtering/hdrFiltering.js +1 -1
  126. package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
  127. package/Materials/Textures/Procedurals/customProceduralTexture.d.ts +2 -1
  128. package/Materials/Textures/Procedurals/customProceduralTexture.js +9 -3
  129. package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
  130. package/Materials/Textures/Procedurals/proceduralTexture.d.ts +9 -9
  131. package/Materials/Textures/Procedurals/proceduralTexture.js +9 -9
  132. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  133. package/Materials/Textures/colorGradingTexture.d.ts +1 -1
  134. package/Materials/Textures/colorGradingTexture.js +1 -1
  135. package/Materials/Textures/colorGradingTexture.js.map +1 -1
  136. package/Materials/Textures/cubeTexture.d.ts +2 -2
  137. package/Materials/Textures/cubeTexture.js +2 -2
  138. package/Materials/Textures/cubeTexture.js.map +1 -1
  139. package/Materials/Textures/rawCubeTexture.d.ts +1 -1
  140. package/Materials/Textures/rawCubeTexture.js +1 -1
  141. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  142. package/Materials/Textures/renderTargetTexture.d.ts +3 -5
  143. package/Materials/Textures/renderTargetTexture.js +19 -19
  144. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  145. package/Materials/colorCurves.d.ts +3 -3
  146. package/Materials/colorCurves.js +3 -3
  147. package/Materials/colorCurves.js.map +1 -1
  148. package/Materials/effect.d.ts +27 -27
  149. package/Materials/effect.js +22 -288
  150. package/Materials/effect.js.map +1 -1
  151. package/Materials/fresnelParameters.d.ts +1 -1
  152. package/Materials/fresnelParameters.js +1 -1
  153. package/Materials/fresnelParameters.js.map +1 -1
  154. package/Materials/imageProcessingConfiguration.d.ts +4 -4
  155. package/Materials/imageProcessingConfiguration.js +4 -4
  156. package/Materials/imageProcessingConfiguration.js.map +1 -1
  157. package/Materials/shaderMaterial.d.ts +25 -25
  158. package/Materials/shaderMaterial.js +25 -25
  159. package/Materials/shaderMaterial.js.map +1 -1
  160. package/Materials/standardMaterial.js +1 -1
  161. package/Materials/standardMaterial.js.map +1 -1
  162. package/Maths/index.d.ts +1 -0
  163. package/Maths/index.js +1 -0
  164. package/Maths/index.js.map +1 -1
  165. package/Maths/math.functions.d.ts +2 -2
  166. package/Maths/math.functions.js +2 -2
  167. package/Maths/math.functions.js.map +1 -1
  168. package/Maths/math.polar.d.ts +77 -0
  169. package/Maths/math.polar.js +114 -0
  170. package/Maths/math.polar.js.map +1 -0
  171. package/Maths/math.scalar.d.ts +2 -2
  172. package/Maths/math.scalar.js +2 -2
  173. package/Maths/math.scalar.js.map +1 -1
  174. package/Maths/math.vector.d.ts +13 -12
  175. package/Maths/math.vector.js +13 -12
  176. package/Maths/math.vector.js.map +1 -1
  177. package/Meshes/abstractMesh.d.ts +1 -1
  178. package/Meshes/abstractMesh.js +9 -4
  179. package/Meshes/abstractMesh.js.map +1 -1
  180. package/Meshes/geometry.d.ts +3 -3
  181. package/Meshes/geometry.js +3 -3
  182. package/Meshes/geometry.js.map +1 -1
  183. package/Meshes/instancedMesh.d.ts +1 -1
  184. package/Meshes/instancedMesh.js +1 -1
  185. package/Meshes/instancedMesh.js.map +1 -1
  186. package/Meshes/mesh.d.ts +3 -3
  187. package/Meshes/mesh.js +7 -3
  188. package/Meshes/mesh.js.map +1 -1
  189. package/Meshes/subMesh.d.ts +1 -1
  190. package/Meshes/subMesh.js +1 -1
  191. package/Meshes/subMesh.js.map +1 -1
  192. package/Meshes/thinInstanceMesh.d.ts +1 -1
  193. package/Meshes/thinInstanceMesh.js.map +1 -1
  194. package/Meshes/transformNode.js +3 -0
  195. package/Meshes/transformNode.js.map +1 -1
  196. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +2 -2
  197. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +2 -2
  198. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  199. package/Misc/HighDynamicRange/hdr.d.ts +3 -3
  200. package/Misc/HighDynamicRange/hdr.js +3 -3
  201. package/Misc/HighDynamicRange/hdr.js.map +1 -1
  202. package/Misc/HighDynamicRange/panoramaToCubemap.d.ts +1 -1
  203. package/Misc/HighDynamicRange/panoramaToCubemap.js +1 -1
  204. package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
  205. package/Misc/arrayTools.d.ts +13 -12
  206. package/Misc/arrayTools.js +70 -39
  207. package/Misc/arrayTools.js.map +1 -1
  208. package/Misc/assetsManager.d.ts +3 -3
  209. package/Misc/assetsManager.js +3 -3
  210. package/Misc/assetsManager.js.map +1 -1
  211. package/Misc/basis.js +1 -1
  212. package/Misc/basis.js.map +1 -1
  213. package/Misc/environmentTextureTools.d.ts +4 -4
  214. package/Misc/environmentTextureTools.js +5 -5
  215. package/Misc/environmentTextureTools.js.map +1 -1
  216. package/Misc/fileTools.d.ts +3 -3
  217. package/Misc/fileTools.js +19 -12
  218. package/Misc/fileTools.js.map +1 -1
  219. package/Misc/observable.d.ts +1 -1
  220. package/Misc/observable.js +1 -1
  221. package/Misc/observable.js.map +1 -1
  222. package/Misc/performanceMonitor.d.ts +3 -3
  223. package/Misc/performanceMonitor.js +3 -3
  224. package/Misc/performanceMonitor.js.map +1 -1
  225. package/Misc/rgbdTextureTools.d.ts +1 -1
  226. package/Misc/rgbdTextureTools.js +1 -1
  227. package/Misc/rgbdTextureTools.js.map +1 -1
  228. package/Misc/sceneOptimizer.d.ts +7 -7
  229. package/Misc/sceneOptimizer.js +7 -7
  230. package/Misc/sceneOptimizer.js.map +1 -1
  231. package/Misc/stringDictionary.d.ts +6 -6
  232. package/Misc/stringDictionary.js +6 -6
  233. package/Misc/stringDictionary.js.map +1 -1
  234. package/Misc/textureTools.d.ts +4 -4
  235. package/Misc/textureTools.js +4 -4
  236. package/Misc/textureTools.js.map +1 -1
  237. package/Misc/tools.d.ts +6 -6
  238. package/Misc/tools.js +6 -6
  239. package/Misc/tools.js.map +1 -1
  240. package/Misc/videoRecorder.d.ts +1 -1
  241. package/Misc/videoRecorder.js +1 -1
  242. package/Misc/videoRecorder.js.map +1 -1
  243. package/Particles/IParticleSystem.d.ts +1 -1
  244. package/Particles/IParticleSystem.js.map +1 -1
  245. package/Particles/gpuParticleSystem.d.ts +1 -1
  246. package/Particles/gpuParticleSystem.js +1 -1
  247. package/Particles/gpuParticleSystem.js.map +1 -1
  248. package/Particles/particleSystem.d.ts +1 -1
  249. package/Particles/particleSystem.js +1 -1
  250. package/Particles/particleSystem.js.map +1 -1
  251. package/Particles/solidParticleSystem.d.ts +4 -0
  252. package/Particles/solidParticleSystem.js +25 -3
  253. package/Particles/solidParticleSystem.js.map +1 -1
  254. package/Physics/Plugins/ammoJSPlugin.d.ts +1 -1
  255. package/Physics/Plugins/ammoJSPlugin.js +1 -1
  256. package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
  257. package/Physics/Plugins/oimoJSPlugin.js +1 -1
  258. package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
  259. package/Physics/physicsEngineComponent.d.ts +1 -1
  260. package/Physics/physicsEngineComponent.js +1 -1
  261. package/Physics/physicsEngineComponent.js.map +1 -1
  262. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  263. package/PostProcesses/blurPostProcess.d.ts +3 -3
  264. package/PostProcesses/blurPostProcess.js +3 -3
  265. package/PostProcesses/blurPostProcess.js.map +1 -1
  266. package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +3 -3
  267. package/PostProcesses/volumetricLightScatteringPostProcess.js +3 -3
  268. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  269. package/Rendering/depthPeelingRenderer.d.ts +1 -0
  270. package/Rendering/depthPeelingRenderer.js +32 -5
  271. package/Rendering/depthPeelingRenderer.js.map +1 -1
  272. package/Rendering/edgesRenderer.d.ts +2 -2
  273. package/Rendering/edgesRenderer.js +1 -1
  274. package/Rendering/edgesRenderer.js.map +1 -1
  275. package/Rendering/geometryBufferRenderer.d.ts +4 -2
  276. package/Rendering/geometryBufferRenderer.js +5 -3
  277. package/Rendering/geometryBufferRenderer.js.map +1 -1
  278. package/Rendering/geometryBufferRendererSceneComponent.d.ts +2 -1
  279. package/Rendering/geometryBufferRendererSceneComponent.js +3 -2
  280. package/Rendering/geometryBufferRendererSceneComponent.js.map +1 -1
  281. package/Rendering/prePassRenderer.d.ts +11 -3
  282. package/Rendering/prePassRenderer.js +18 -3
  283. package/Rendering/prePassRenderer.js.map +1 -1
  284. package/Rendering/subSurfaceConfiguration.d.ts +2 -2
  285. package/Rendering/subSurfaceConfiguration.js +2 -2
  286. package/Rendering/subSurfaceConfiguration.js.map +1 -1
  287. package/XR/features/WebXRControllerTeleportation.d.ts +4 -0
  288. package/XR/features/WebXRControllerTeleportation.js +24 -19
  289. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  290. package/XR/motionController/webXRAbstractMotionController.d.ts +2 -2
  291. package/XR/motionController/webXRAbstractMotionController.js +2 -2
  292. package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
  293. package/XR/motionController/webXRControllerComponent.d.ts +1 -1
  294. package/XR/motionController/webXRControllerComponent.js +1 -1
  295. package/XR/motionController/webXRControllerComponent.js.map +1 -1
  296. package/XR/motionController/webXRMotionControllerManager.d.ts +3 -3
  297. package/XR/motionController/webXRMotionControllerManager.js +3 -3
  298. package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
  299. package/node.d.ts +4 -4
  300. package/node.js +3 -3
  301. package/node.js.map +1 -1
  302. package/package.json +1 -1
  303. package/scene.d.ts +61 -61
  304. package/scene.js +58 -46
  305. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"engine.multiRender.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.multiRender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAElG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAgE3C,UAAU,CAAC,SAAS,CAAC,uBAAuB,GAAG;IAC3C,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;IAEpB,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,UAAU,CAAC,SAAS,CAAC,sCAAsC,GAAG;IAC1D,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;IAEpB,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF,UAAU,CAAC,SAAS,CAAC,kBAAkB,GAAG,UAAU,aAAwB;IACxE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;IAEpB,MAAM,MAAM,GAAG,EAAE,CAAC;IAElB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC3C,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE;YAClB,MAAM,CAAC,IAAI,CAAO,EAAG,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAC,CAAC;SAClD;aAAM;YACH,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;SACxB;KACJ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AoB,EAC9B,SAAS,CAAC,OAAO,CAAC,KAAK,EACvB,SAAS,CAAC,OAAO,CAAC,MAAM,EACxB,OAAO,CACV,CAAC;IAEF,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAEnC,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport type { IMultiRenderTargetOptions } from \"../../Materials/Textures/multiRenderTarget\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Constants } from \"../constants\";\r\nimport { ThinEngine } from \"../thinEngine\";\r\nimport type { RenderTargetWrapper } from \"../renderTargetWrapper\";\r\nimport type { WebGLRenderTargetWrapper } from \"../WebGL/webGLRenderTargetWrapper\";\r\nimport type { WebGLHardwareTexture } from \"../WebGL/webGLHardwareTexture\";\r\nimport type { TextureSize } from \"../../Materials/Textures/textureCreationOptions\";\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Unbind a list of render target textures from the webGL context\r\n * This is used only when drawBuffer extension or webGL2 are active\r\n * @param rtWrapper defines the render target wrapper to unbind\r\n * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated\r\n * @param onBeforeUnbind defines a function which will be called before the effective unbind\r\n */\r\n unBindMultiColorAttachmentFramebuffer(rtWrapper: RenderTargetWrapper, disableGenerateMipMaps: boolean, onBeforeUnbind?: () => void): void;\r\n\r\n /**\r\n * Create a multi render target texture\r\n * @see https://doc.babylonjs.com/features/webgl2#multiple-render-target\r\n * @param size defines the size of the texture\r\n * @param options defines the creation options\r\n * @param initializeBuffers if set to true, the engine will make an initializing call of drawBuffers\r\n * @returns a new render target wrapper ready to render textures\r\n */\r\n createMultipleRenderTarget(size: TextureSize, options: IMultiRenderTargetOptions, initializeBuffers?: boolean): RenderTargetWrapper;\r\n\r\n /**\r\n * Update the sample count for a given multiple render target texture\r\n * @see https://doc.babylonjs.com/features/webgl2#multisample-render-targets\r\n * @param rtWrapper defines the render target wrapper to update\r\n * @param samples defines the sample count to set\r\n * @param initializeBuffers if set to true, the engine will make an initializing call of drawBuffers\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n updateMultipleRenderTargetTextureSampleCount(rtWrapper: Nullable<RenderTargetWrapper>, samples: number, initializeBuffers?: boolean): number;\r\n\r\n /**\r\n * Select a subsets of attachments to draw to.\r\n * @param attachments gl attachments\r\n */\r\n bindAttachments(attachments: number[]): void;\r\n\r\n /**\r\n * Creates a layout object to draw/clear on specific textures in a MRT\r\n * @param textureStatus textureStatus[i] indicates if the i-th is active\r\n * @returns A layout to be fed to the engine, calling `bindAttachments`.\r\n */\r\n buildTextureLayout(textureStatus: boolean[]): number[];\r\n\r\n /**\r\n * Restores the webgl state to only draw on the main color attachment\r\n * when the frame buffer associated is the canvas frame buffer\r\n */\r\n restoreSingleAttachment(): void;\r\n\r\n /**\r\n * Restores the webgl state to only draw on the main color attachment\r\n * when the frame buffer associated is not the canvas frame buffer\r\n */\r\n restoreSingleAttachmentForRenderTarget(): void;\r\n }\r\n}\r\n\r\nThinEngine.prototype.restoreSingleAttachment = function (): void {\r\n const gl = this._gl;\r\n\r\n this.bindAttachments([gl.BACK]);\r\n};\r\n\r\nThinEngine.prototype.restoreSingleAttachmentForRenderTarget = function (): void {\r\n const gl = this._gl;\r\n\r\n this.bindAttachments([gl.COLOR_ATTACHMENT0]);\r\n};\r\n\r\nThinEngine.prototype.buildTextureLayout = function (textureStatus: boolean[]): number[] {\r\n const gl = this._gl;\r\n\r\n const result = [];\r\n\r\n for (let i = 0; i < textureStatus.length; i++) {\r\n if (textureStatus[i]) {\r\n result.push((<any>gl)[\"COLOR_ATTACHMENT\" + i]);\r\n } else {\r\n result.push(gl.NONE);\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\nThinEngine.prototype.bindAttachments = function (attachments: number[]): void {\r\n const gl = this._gl;\r\n\r\n gl.drawBuffers(attachments);\r\n};\r\n\r\nThinEngine.prototype.unBindMultiColorAttachmentFramebuffer = function (\r\n rtWrapper: WebGLRenderTargetWrapper,\r\n disableGenerateMipMaps: boolean = false,\r\n onBeforeUnbind?: () => void\r\n): void {\r\n this._currentRenderTarget = null;\r\n\r\n // If MSAA, we need to bitblt back to main texture\r\n const gl = this._gl;\r\n\r\n const attachments = rtWrapper._attachments!;\r\n const count = attachments.length;\r\n\r\n if (rtWrapper._MSAAFramebuffer) {\r\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, rtWrapper._MSAAFramebuffer);\r\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, rtWrapper._framebuffer);\r\n\r\n for (let i = 0; i < count; i++) {\r\n const texture = rtWrapper.textures![i];\r\n\r\n for (let j = 0; j < count; j++) {\r\n attachments[j] = gl.NONE;\r\n }\r\n\r\n attachments[i] = (<any>gl)[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n gl.readBuffer(attachments[i]);\r\n gl.drawBuffers(attachments);\r\n gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\r\n }\r\n\r\n for (let i = 0; i < count; i++) {\r\n attachments[i] = (<any>gl)[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n }\r\n\r\n gl.drawBuffers(attachments);\r\n }\r\n\r\n for (let i = 0; i < count; i++) {\r\n const texture = rtWrapper.textures![i];\r\n if (texture.generateMipMaps && !disableGenerateMipMaps && !texture.isCube) {\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n }\r\n }\r\n\r\n if (onBeforeUnbind) {\r\n if (rtWrapper._MSAAFramebuffer) {\r\n // Bind the correct framebuffer\r\n this._bindUnboundFramebuffer(rtWrapper._framebuffer);\r\n }\r\n onBeforeUnbind();\r\n }\r\n\r\n this._bindUnboundFramebuffer(null);\r\n};\r\n\r\nThinEngine.prototype.createMultipleRenderTarget = function (size: TextureSize, options: IMultiRenderTargetOptions, initializeBuffers: boolean = true): RenderTargetWrapper {\r\n let generateMipMaps = false;\r\n let generateDepthBuffer = true;\r\n let generateStencilBuffer = false;\r\n let generateDepthTexture = false;\r\n let depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH16;\r\n let textureCount = 1;\r\n\r\n const defaultType = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n const defaultSamplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n const defaultUseSRGBBuffer = false;\r\n\r\n let types = new Array<number>();\r\n let samplingModes = new Array<number>();\r\n let useSRGBBuffers = new Array<boolean>();\r\n\r\n const rtWrapper = this._createHardwareRenderTargetWrapper(true, false, size) as WebGLRenderTargetWrapper;\r\n\r\n if (options !== undefined) {\r\n generateMipMaps = options.generateMipMaps === undefined ? false : options.generateMipMaps;\r\n generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n generateStencilBuffer = options.generateStencilBuffer === undefined ? false : options.generateStencilBuffer;\r\n generateDepthTexture = options.generateDepthTexture === undefined ? false : options.generateDepthTexture;\r\n textureCount = options.textureCount || 1;\r\n\r\n if (options.types) {\r\n types = options.types;\r\n }\r\n if (options.samplingModes) {\r\n samplingModes = options.samplingModes;\r\n }\r\n if (options.useSRGBBuffers) {\r\n useSRGBBuffers = options.useSRGBBuffers;\r\n }\r\n if (\r\n this.webGLVersion > 1 &&\r\n (options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 ||\r\n options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 ||\r\n options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24 ||\r\n options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH32_FLOAT ||\r\n options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8)\r\n ) {\r\n depthTextureFormat = options.depthTextureFormat;\r\n }\r\n }\r\n const gl = this._gl;\r\n // Create the framebuffer\r\n const framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n\r\n const width = (<{ width: number; height: number }>size).width || <number>size;\r\n const height = (<{ width: number; height: number }>size).height || <number>size;\r\n\r\n const textures: InternalTexture[] = [];\r\n const attachments: number[] = [];\r\n\r\n const useStencilTexture =\r\n this.webGLVersion > 1 &&\r\n generateDepthTexture &&\r\n (options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 ||\r\n options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 ||\r\n options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8);\r\n const depthStencilBuffer = this._setupFramebufferDepthAttachments(!useStencilTexture && generateStencilBuffer, !generateDepthTexture && generateDepthBuffer, width, height);\r\n\r\n rtWrapper._framebuffer = framebuffer;\r\n rtWrapper._depthStencilBuffer = depthStencilBuffer;\r\n rtWrapper._generateDepthBuffer = !generateDepthTexture && generateDepthBuffer;\r\n rtWrapper._generateStencilBuffer = !useStencilTexture && generateStencilBuffer;\r\n rtWrapper._attachments = attachments;\r\n\r\n for (let i = 0; i < textureCount; i++) {\r\n let samplingMode = samplingModes[i] || defaultSamplingMode;\r\n let type = types[i] || defaultType;\r\n let useSRGBBuffer = useSRGBBuffers[i] || defaultUseSRGBBuffer;\r\n\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n } else if (type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {\r\n type = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n Logger.Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\r\n }\r\n\r\n useSRGBBuffer = useSRGBBuffer && this._caps.supportSRGBBuffers && (this.webGLVersion > 1 || this.isWebGPU);\r\n\r\n const texture = new InternalTexture(this, InternalTextureSource.MultiRenderTarget);\r\n const attachment = (<any>gl)[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n\r\n textures.push(texture);\r\n attachments.push(attachment);\r\n\r\n gl.activeTexture((<any>gl)[\"TEXTURE\" + i]);\r\n gl.bindTexture(gl.TEXTURE_2D, texture._hardwareTexture!.underlyingResource);\r\n\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n\r\n const internalSizedFormat = this._getRGBABufferInternalSizedFormat(type, Constants.TEXTUREFORMAT_RGBA, useSRGBBuffer);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalSizedFormat, width, height, 0, gl.RGBA, this._getWebGLTextureType(type), null);\r\n\r\n gl.framebufferTexture2D(gl.DRAW_FRAMEBUFFER, attachment, gl.TEXTURE_2D, texture._hardwareTexture!.underlyingResource, 0);\r\n\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n\r\n // Unbind\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.type = type;\r\n texture._useSRGBBuffer = useSRGBBuffer;\r\n\r\n this._internalTexturesCache.push(texture);\r\n }\r\n\r\n if (generateDepthTexture && this._caps.depthTextureExtension) {\r\n // Depth texture\r\n const depthTexture = new InternalTexture(this, InternalTextureSource.Depth);\r\n\r\n let depthTextureType = Constants.TEXTURETYPE_UNSIGNED_SHORT;\r\n let glDepthTextureInternalFormat = gl.DEPTH_COMPONENT16;\r\n let glDepthTextureFormat = gl.DEPTH_COMPONENT;\r\n let glDepthTextureType = gl.UNSIGNED_SHORT;\r\n let glDepthTextureAttachment = gl.DEPTH_ATTACHMENT;\r\n if (this.webGLVersion < 2) {\r\n glDepthTextureInternalFormat = gl.DEPTH_COMPONENT;\r\n } else {\r\n if (depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH32_FLOAT) {\r\n depthTextureType = Constants.TEXTURETYPE_FLOAT;\r\n glDepthTextureType = gl.FLOAT;\r\n glDepthTextureInternalFormat = gl.DEPTH_COMPONENT32F;\r\n } else if (depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8) {\r\n depthTextureType = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n glDepthTextureType = gl.FLOAT_32_UNSIGNED_INT_24_8_REV;\r\n glDepthTextureInternalFormat = gl.DEPTH32F_STENCIL8;\r\n glDepthTextureFormat = gl.DEPTH_STENCIL;\r\n glDepthTextureAttachment = gl.DEPTH_STENCIL_ATTACHMENT;\r\n } else if (depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24) {\r\n depthTextureType = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n glDepthTextureType = gl.UNSIGNED_INT;\r\n glDepthTextureInternalFormat = gl.DEPTH_COMPONENT24;\r\n glDepthTextureAttachment = gl.DEPTH_ATTACHMENT;\r\n } else if (depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 || depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8) {\r\n depthTextureType = Constants.TEXTURETYPE_UNSIGNED_INT_24_8;\r\n glDepthTextureType = gl.UNSIGNED_INT_24_8;\r\n glDepthTextureInternalFormat = gl.DEPTH24_STENCIL8;\r\n glDepthTextureFormat = gl.DEPTH_STENCIL;\r\n glDepthTextureAttachment = gl.DEPTH_STENCIL_ATTACHMENT;\r\n }\r\n }\r\n\r\n gl.activeTexture(gl.TEXTURE0);\r\n gl.bindTexture(gl.TEXTURE_2D, depthTexture._hardwareTexture!.underlyingResource);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, glDepthTextureInternalFormat, width, height, 0, glDepthTextureFormat, glDepthTextureType, null);\r\n\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, glDepthTextureAttachment, gl.TEXTURE_2D, depthTexture._hardwareTexture!.underlyingResource, 0);\r\n\r\n depthTexture.baseWidth = width;\r\n depthTexture.baseHeight = height;\r\n depthTexture.width = width;\r\n depthTexture.height = height;\r\n depthTexture.isReady = true;\r\n depthTexture.samples = 1;\r\n depthTexture.generateMipMaps = generateMipMaps;\r\n depthTexture.samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n depthTexture.format = depthTextureFormat;\r\n depthTexture.type = depthTextureType;\r\n\r\n textures.push(depthTexture);\r\n this._internalTexturesCache.push(depthTexture);\r\n }\r\n rtWrapper.setTextures(textures);\r\n if (initializeBuffers) {\r\n gl.drawBuffers(attachments);\r\n }\r\n\r\n this._bindUnboundFramebuffer(null);\r\n\r\n this.resetTextureCache();\r\n\r\n return rtWrapper;\r\n};\r\n\r\nThinEngine.prototype.updateMultipleRenderTargetTextureSampleCount = function (\r\n rtWrapper: Nullable<WebGLRenderTargetWrapper>,\r\n samples: number,\r\n initializeBuffers: boolean = true\r\n): number {\r\n if (this.webGLVersion < 2 || !rtWrapper || !rtWrapper.texture) {\r\n return 1;\r\n }\r\n\r\n if (rtWrapper.samples === samples) {\r\n return samples;\r\n }\r\n\r\n const count = rtWrapper._attachments!.length;\r\n\r\n if (count === 0) {\r\n return 1;\r\n }\r\n\r\n const gl = this._gl;\r\n\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n\r\n // Dispose previous render buffers\r\n if (rtWrapper._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(rtWrapper._depthStencilBuffer);\r\n rtWrapper._depthStencilBuffer = null;\r\n }\r\n\r\n if (rtWrapper._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(rtWrapper._MSAAFramebuffer);\r\n rtWrapper._MSAAFramebuffer = null;\r\n }\r\n\r\n for (let i = 0; i < count; i++) {\r\n const hardwareTexture = rtWrapper.textures![i]._hardwareTexture as Nullable<WebGLHardwareTexture>;\r\n if (hardwareTexture?._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(hardwareTexture._MSAARenderBuffer);\r\n hardwareTexture._MSAARenderBuffer = null;\r\n }\r\n }\r\n\r\n if (samples > 1 && gl.renderbufferStorageMultisample) {\r\n const framebuffer = gl.createFramebuffer();\r\n\r\n if (!framebuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n\r\n rtWrapper._MSAAFramebuffer = framebuffer;\r\n this._bindUnboundFramebuffer(framebuffer);\r\n\r\n const attachments = [];\r\n\r\n for (let i = 0; i < count; i++) {\r\n const texture = rtWrapper.textures![i];\r\n const hardwareTexture = texture._hardwareTexture as WebGLHardwareTexture;\r\n const attachment = (<any>gl)[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n\r\n const colorRenderbuffer = this._createRenderBuffer(\r\n texture.width,\r\n texture.height,\r\n samples,\r\n -1 /* not used */,\r\n this._getRGBAMultiSampleBufferFormat(texture.type),\r\n attachment\r\n );\r\n\r\n if (!colorRenderbuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n\r\n hardwareTexture._MSAARenderBuffer = colorRenderbuffer;\r\n texture.samples = samples;\r\n\r\n attachments.push(attachment);\r\n }\r\n if (initializeBuffers) {\r\n gl.drawBuffers(attachments);\r\n }\r\n } else {\r\n this._bindUnboundFramebuffer(rtWrapper._framebuffer);\r\n }\r\n\r\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(\r\n rtWrapper._generateStencilBuffer,\r\n rtWrapper._generateDepthBuffer,\r\n rtWrapper.texture.width,\r\n rtWrapper.texture.height,\r\n samples\r\n );\r\n\r\n this._bindUnboundFramebuffer(null);\r\n\r\n return samples;\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.multiRender.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.multiRender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAElG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAgE3C,UAAU,CAAC,SAAS,CAAC,uBAAuB,GAAG;IAC3C,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CA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D,UAAU,CACb;gBACH,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;YAE1J,IAAI,CAAC,iBAAiB,EAAE;gBACpB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;aACjE;YAED,eAAe,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;YACtD,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;YAE1B,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAChC;QACD,IAAI,iBAAiB,EAAE;YACnB,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;SAC/B;KACJ;SAAM;QACH,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;KACxD;IAED,IAAI,eAAe,EAAE;QACjB,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,iCAAiC,CAClE,SAAS,CAAC,sBAAsB,EAChC,SAAS,CAAC,oBAAoB,EAC9B,SAAS,CAAC,OAAO,CAAC,KAAK,EACvB,SAAS,CAAC,OAAO,CAAC,MAAM,EACxB,OAAO,CACV,CAAC;KACL;IAED,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAEnC,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport type { IMultiRenderTargetOptions } from \"../../Materials/Textures/multiRenderTarget\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Constants } from \"../constants\";\r\nimport { ThinEngine } from \"../thinEngine\";\r\nimport type { RenderTargetWrapper } from \"../renderTargetWrapper\";\r\nimport type { WebGLRenderTargetWrapper } from \"../WebGL/webGLRenderTargetWrapper\";\r\nimport type { WebGLHardwareTexture } from \"../WebGL/webGLHardwareTexture\";\r\nimport type { TextureSize } from \"../../Materials/Textures/textureCreationOptions\";\r\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Unbind a list of render target textures from the webGL context\r\n * This is used only when drawBuffer extension or webGL2 are active\r\n * @param rtWrapper defines the render target wrapper to unbind\r\n * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated\r\n * @param onBeforeUnbind defines a function which will be called before the effective unbind\r\n */\r\n unBindMultiColorAttachmentFramebuffer(rtWrapper: RenderTargetWrapper, disableGenerateMipMaps: boolean, onBeforeUnbind?: () => void): void;\r\n\r\n /**\r\n * Create a multi render target texture\r\n * @see https://doc.babylonjs.com/features/webgl2#multiple-render-target\r\n * @param size defines the size of the texture\r\n * @param options defines the creation options\r\n * @param initializeBuffers if set to true, the engine will make an initializing call of drawBuffers\r\n * @returns a new render target wrapper ready to render textures\r\n */\r\n createMultipleRenderTarget(size: TextureSize, options: IMultiRenderTargetOptions, initializeBuffers?: boolean): RenderTargetWrapper;\r\n\r\n /**\r\n * Update the sample count for a given multiple render target texture\r\n * @see https://doc.babylonjs.com/features/webgl2#multisample-render-targets\r\n * @param rtWrapper defines the render target wrapper to update\r\n * @param samples defines the sample count to set\r\n * @param initializeBuffers if set to true, the engine will make an initializing call of drawBuffers\r\n * @returns the effective sample count (could be 0 if multisample render targets are not supported)\r\n */\r\n updateMultipleRenderTargetTextureSampleCount(rtWrapper: Nullable<RenderTargetWrapper>, samples: number, initializeBuffers?: boolean): number;\r\n\r\n /**\r\n * Select a subsets of attachments to draw to.\r\n * @param attachments gl attachments\r\n */\r\n bindAttachments(attachments: number[]): void;\r\n\r\n /**\r\n * Creates a layout object to draw/clear on specific textures in a MRT\r\n * @param textureStatus textureStatus[i] indicates if the i-th is active\r\n * @returns A layout to be fed to the engine, calling `bindAttachments`.\r\n */\r\n buildTextureLayout(textureStatus: boolean[]): number[];\r\n\r\n /**\r\n * Restores the webgl state to only draw on the main color attachment\r\n * when the frame buffer associated is the canvas frame buffer\r\n */\r\n restoreSingleAttachment(): void;\r\n\r\n /**\r\n * Restores the webgl state to only draw on the main color attachment\r\n * when the frame buffer associated is not the canvas frame buffer\r\n */\r\n restoreSingleAttachmentForRenderTarget(): void;\r\n }\r\n}\r\n\r\nThinEngine.prototype.restoreSingleAttachment = function (): void {\r\n const gl = this._gl;\r\n\r\n this.bindAttachments([gl.BACK]);\r\n};\r\n\r\nThinEngine.prototype.restoreSingleAttachmentForRenderTarget = function (): void {\r\n const gl = this._gl;\r\n\r\n this.bindAttachments([gl.COLOR_ATTACHMENT0]);\r\n};\r\n\r\nThinEngine.prototype.buildTextureLayout = function (textureStatus: boolean[]): number[] {\r\n const gl = this._gl;\r\n\r\n const result = [];\r\n\r\n for (let i = 0; i < textureStatus.length; i++) {\r\n if (textureStatus[i]) {\r\n result.push((<any>gl)[\"COLOR_ATTACHMENT\" + i]);\r\n } else {\r\n result.push(gl.NONE);\r\n }\r\n }\r\n\r\n return result;\r\n};\r\n\r\nThinEngine.prototype.bindAttachments = function (attachments: number[]): void {\r\n const gl = this._gl;\r\n\r\n gl.drawBuffers(attachments);\r\n};\r\n\r\nThinEngine.prototype.unBindMultiColorAttachmentFramebuffer = function (\r\n rtWrapper: WebGLRenderTargetWrapper,\r\n disableGenerateMipMaps: boolean = false,\r\n onBeforeUnbind?: () => void\r\n): void {\r\n this._currentRenderTarget = null;\r\n\r\n // If MSAA, we need to bitblt back to main texture\r\n const gl = this._gl;\r\n\r\n const attachments = rtWrapper._attachments!;\r\n const count = attachments.length;\r\n\r\n if (rtWrapper._MSAAFramebuffer) {\r\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, rtWrapper._MSAAFramebuffer);\r\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, rtWrapper._framebuffer);\r\n\r\n for (let i = 0; i < count; i++) {\r\n const texture = rtWrapper.textures![i];\r\n\r\n for (let j = 0; j < count; j++) {\r\n attachments[j] = gl.NONE;\r\n }\r\n\r\n attachments[i] = (<any>gl)[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n gl.readBuffer(attachments[i]);\r\n gl.drawBuffers(attachments);\r\n gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\r\n }\r\n\r\n for (let i = 0; i < count; i++) {\r\n attachments[i] = (<any>gl)[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n }\r\n\r\n gl.drawBuffers(attachments);\r\n }\r\n\r\n for (let i = 0; i < count; i++) {\r\n const texture = rtWrapper.textures![i];\r\n if (texture.generateMipMaps && !disableGenerateMipMaps && !texture.isCube) {\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n }\r\n }\r\n\r\n if (onBeforeUnbind) {\r\n if (rtWrapper._MSAAFramebuffer) {\r\n // Bind the correct framebuffer\r\n this._bindUnboundFramebuffer(rtWrapper._framebuffer);\r\n }\r\n onBeforeUnbind();\r\n }\r\n\r\n this._bindUnboundFramebuffer(null);\r\n};\r\n\r\nThinEngine.prototype.createMultipleRenderTarget = function (size: TextureSize, options: IMultiRenderTargetOptions, initializeBuffers: boolean = true): RenderTargetWrapper {\r\n let generateMipMaps = false;\r\n let generateDepthBuffer = true;\r\n let generateStencilBuffer = false;\r\n let generateDepthTexture = false;\r\n let depthTextureFormat = Constants.TEXTUREFORMAT_DEPTH16;\r\n let textureCount = 1;\r\n\r\n const defaultType = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n const defaultSamplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n const defaultUseSRGBBuffer = false;\r\n\r\n let types = new Array<number>();\r\n let samplingModes = new Array<number>();\r\n let useSRGBBuffers = new Array<boolean>();\r\n\r\n const rtWrapper = this._createHardwareRenderTargetWrapper(true, false, size) as WebGLRenderTargetWrapper;\r\n\r\n if (options !== undefined) {\r\n generateMipMaps = options.generateMipMaps === undefined ? false : options.generateMipMaps;\r\n generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n generateStencilBuffer = options.generateStencilBuffer === undefined ? false : options.generateStencilBuffer;\r\n generateDepthTexture = options.generateDepthTexture === undefined ? false : options.generateDepthTexture;\r\n textureCount = options.textureCount || 1;\r\n\r\n if (options.types) {\r\n types = options.types;\r\n }\r\n if (options.samplingModes) {\r\n samplingModes = options.samplingModes;\r\n }\r\n if (options.useSRGBBuffers) {\r\n useSRGBBuffers = options.useSRGBBuffers;\r\n }\r\n if (\r\n this.webGLVersion > 1 &&\r\n (options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 ||\r\n options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 ||\r\n options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24 ||\r\n options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH32_FLOAT ||\r\n options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8)\r\n ) {\r\n depthTextureFormat = options.depthTextureFormat;\r\n }\r\n }\r\n const gl = this._gl;\r\n // Create the framebuffer\r\n const framebuffer = gl.createFramebuffer();\r\n this._bindUnboundFramebuffer(framebuffer);\r\n\r\n const width = (<{ width: number; height: number }>size).width || <number>size;\r\n const height = (<{ width: number; height: number }>size).height || <number>size;\r\n\r\n const textures: InternalTexture[] = [];\r\n const attachments: number[] = [];\r\n\r\n const useStencilTexture =\r\n this.webGLVersion > 1 &&\r\n generateDepthTexture &&\r\n (options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 ||\r\n options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 ||\r\n options.depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8);\r\n const depthStencilBuffer = this._setupFramebufferDepthAttachments(!useStencilTexture && generateStencilBuffer, !generateDepthTexture && generateDepthBuffer, width, height);\r\n\r\n rtWrapper._framebuffer = framebuffer;\r\n rtWrapper._depthStencilBuffer = depthStencilBuffer;\r\n rtWrapper._generateDepthBuffer = !generateDepthTexture && generateDepthBuffer;\r\n rtWrapper._generateStencilBuffer = !useStencilTexture && generateStencilBuffer;\r\n rtWrapper._attachments = attachments;\r\n\r\n for (let i = 0; i < textureCount; i++) {\r\n let samplingMode = samplingModes[i] || defaultSamplingMode;\r\n let type = types[i] || defaultType;\r\n let useSRGBBuffer = useSRGBBuffers[i] || defaultUseSRGBBuffer;\r\n\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n } else if (type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {\r\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n if (type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {\r\n type = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n Logger.Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\r\n }\r\n\r\n useSRGBBuffer = useSRGBBuffer && this._caps.supportSRGBBuffers && (this.webGLVersion > 1 || this.isWebGPU);\r\n\r\n const texture = new InternalTexture(this, InternalTextureSource.MultiRenderTarget);\r\n const attachment = (<any>gl)[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n\r\n textures.push(texture);\r\n attachments.push(attachment);\r\n\r\n gl.activeTexture((<any>gl)[\"TEXTURE\" + i]);\r\n gl.bindTexture(gl.TEXTURE_2D, texture._hardwareTexture!.underlyingResource);\r\n\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n\r\n const internalSizedFormat = this._getRGBABufferInternalSizedFormat(type, Constants.TEXTUREFORMAT_RGBA, useSRGBBuffer);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalSizedFormat, width, height, 0, gl.RGBA, this._getWebGLTextureType(type), null);\r\n\r\n gl.framebufferTexture2D(gl.DRAW_FRAMEBUFFER, attachment, gl.TEXTURE_2D, texture._hardwareTexture!.underlyingResource, 0);\r\n\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n\r\n // Unbind\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.isReady = true;\r\n texture.samples = 1;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.type = type;\r\n texture._useSRGBBuffer = useSRGBBuffer;\r\n\r\n this._internalTexturesCache.push(texture);\r\n }\r\n\r\n if (generateDepthTexture && this._caps.depthTextureExtension) {\r\n // Depth texture\r\n const depthTexture = new InternalTexture(this, InternalTextureSource.Depth);\r\n\r\n let depthTextureType = Constants.TEXTURETYPE_UNSIGNED_SHORT;\r\n let glDepthTextureInternalFormat = gl.DEPTH_COMPONENT16;\r\n let glDepthTextureFormat = gl.DEPTH_COMPONENT;\r\n let glDepthTextureType = gl.UNSIGNED_SHORT;\r\n let glDepthTextureAttachment = gl.DEPTH_ATTACHMENT;\r\n if (this.webGLVersion < 2) {\r\n glDepthTextureInternalFormat = gl.DEPTH_COMPONENT;\r\n } else {\r\n if (depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH32_FLOAT) {\r\n depthTextureType = Constants.TEXTURETYPE_FLOAT;\r\n glDepthTextureType = gl.FLOAT;\r\n glDepthTextureInternalFormat = gl.DEPTH_COMPONENT32F;\r\n } else if (depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8) {\r\n depthTextureType = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n glDepthTextureType = gl.FLOAT_32_UNSIGNED_INT_24_8_REV;\r\n glDepthTextureInternalFormat = gl.DEPTH32F_STENCIL8;\r\n glDepthTextureFormat = gl.DEPTH_STENCIL;\r\n glDepthTextureAttachment = gl.DEPTH_STENCIL_ATTACHMENT;\r\n } else if (depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24) {\r\n depthTextureType = Constants.TEXTURETYPE_UNSIGNED_INT;\r\n glDepthTextureType = gl.UNSIGNED_INT;\r\n glDepthTextureInternalFormat = gl.DEPTH_COMPONENT24;\r\n glDepthTextureAttachment = gl.DEPTH_ATTACHMENT;\r\n } else if (depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 || depthTextureFormat === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8) {\r\n depthTextureType = Constants.TEXTURETYPE_UNSIGNED_INT_24_8;\r\n glDepthTextureType = gl.UNSIGNED_INT_24_8;\r\n glDepthTextureInternalFormat = gl.DEPTH24_STENCIL8;\r\n glDepthTextureFormat = gl.DEPTH_STENCIL;\r\n glDepthTextureAttachment = gl.DEPTH_STENCIL_ATTACHMENT;\r\n }\r\n }\r\n\r\n gl.activeTexture(gl.TEXTURE0);\r\n gl.bindTexture(gl.TEXTURE_2D, depthTexture._hardwareTexture!.underlyingResource);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, glDepthTextureInternalFormat, width, height, 0, glDepthTextureFormat, glDepthTextureType, null);\r\n\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, glDepthTextureAttachment, gl.TEXTURE_2D, depthTexture._hardwareTexture!.underlyingResource, 0);\r\n\r\n depthTexture.baseWidth = width;\r\n depthTexture.baseHeight = height;\r\n depthTexture.width = width;\r\n depthTexture.height = height;\r\n depthTexture.isReady = true;\r\n depthTexture.samples = 1;\r\n depthTexture.generateMipMaps = generateMipMaps;\r\n depthTexture.samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n depthTexture.format = depthTextureFormat;\r\n depthTexture.type = depthTextureType;\r\n\r\n textures.push(depthTexture);\r\n this._internalTexturesCache.push(depthTexture);\r\n }\r\n rtWrapper.setTextures(textures);\r\n if (initializeBuffers) {\r\n gl.drawBuffers(attachments);\r\n }\r\n\r\n this._bindUnboundFramebuffer(null);\r\n\r\n this.resetTextureCache();\r\n\r\n return rtWrapper;\r\n};\r\n\r\nThinEngine.prototype.updateMultipleRenderTargetTextureSampleCount = function (\r\n rtWrapper: Nullable<WebGLRenderTargetWrapper>,\r\n samples: number,\r\n initializeBuffers: boolean = true\r\n): number {\r\n if (this.webGLVersion < 2 || !rtWrapper || !rtWrapper.texture) {\r\n return 1;\r\n }\r\n\r\n if (rtWrapper.samples === samples) {\r\n return samples;\r\n }\r\n\r\n const count = rtWrapper._attachments!.length;\r\n\r\n if (count === 0) {\r\n return 1;\r\n }\r\n\r\n const gl = this._gl;\r\n\r\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\r\n\r\n // Dispose previous render buffers\r\n const useDepthStencil = !!rtWrapper._depthStencilBuffer;\r\n if (useDepthStencil) {\r\n gl.deleteRenderbuffer(rtWrapper._depthStencilBuffer);\r\n rtWrapper._depthStencilBuffer = null;\r\n }\r\n\r\n if (rtWrapper._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(rtWrapper._MSAAFramebuffer);\r\n rtWrapper._MSAAFramebuffer = null;\r\n }\r\n\r\n if (samples > 1 && gl.renderbufferStorageMultisample) {\r\n const framebuffer = gl.createFramebuffer();\r\n\r\n if (!framebuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n\r\n rtWrapper._MSAAFramebuffer = framebuffer;\r\n this._bindUnboundFramebuffer(framebuffer);\r\n\r\n const attachments = [];\r\n\r\n for (let i = 0; i < count; i++) {\r\n const texture = rtWrapper.textures![i];\r\n const hardwareTexture = texture._hardwareTexture as WebGLHardwareTexture;\r\n const attachment = (<any>gl)[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n\r\n const colorRenderbuffer = hardwareTexture._MSAARenderBuffer\r\n ? this._updateRenderBuffer(\r\n hardwareTexture._MSAARenderBuffer,\r\n texture.width,\r\n texture.height,\r\n samples,\r\n -1 /* not used */,\r\n this._getRGBAMultiSampleBufferFormat(texture.type),\r\n attachment\r\n )\r\n : this._createRenderBuffer(texture.width, texture.height, samples, -1 /* not used */, this._getRGBAMultiSampleBufferFormat(texture.type), attachment);\r\n\r\n if (!colorRenderbuffer) {\r\n throw new Error(\"Unable to create multi sampled framebuffer\");\r\n }\r\n\r\n hardwareTexture._MSAARenderBuffer = colorRenderbuffer;\r\n texture.samples = samples;\r\n\r\n attachments.push(attachment);\r\n }\r\n if (initializeBuffers) {\r\n gl.drawBuffers(attachments);\r\n }\r\n } else {\r\n this._bindUnboundFramebuffer(rtWrapper._framebuffer);\r\n }\r\n\r\n if (useDepthStencil) {\r\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(\r\n rtWrapper._generateStencilBuffer,\r\n rtWrapper._generateDepthBuffer,\r\n rtWrapper.texture.width,\r\n rtWrapper.texture.height,\r\n samples\r\n );\r\n }\r\n\r\n this._bindUnboundFramebuffer(null);\r\n\r\n return samples;\r\n};\r\n"]}
@@ -25,13 +25,13 @@ declare module "../../Engines/engine" {
25
25
  interface Engine {
26
26
  /**
27
27
  * Create a new webGL query (you must be sure that queries are supported by checking getCaps() function)
28
- * @return the new query
28
+ * @returns the new query
29
29
  */
30
30
  createQuery(): OcclusionQuery;
31
31
  /**
32
32
  * Delete and release a webGL query
33
33
  * @param query defines the query to delete
34
- * @return the current engine
34
+ * @returns the current engine
35
35
  */
36
36
  deleteQuery(query: OcclusionQuery): Engine;
37
37
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"engine.query.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,cAAc;AACd,gEAAgE;AAChE,MAAM,OAAO,qBAAqB;IAAlC;QACI,cAAc;QACP,kCAA6B,GAAG,CAAC,CAAC;QAEzC,cAAc;QACP,+BAA0B,GAAG,KAAK,CAAC;QAE1C,cAAc;QACP,eAAU,GAAG,KAAK,CAAC;QAE1B,cAAc;QACP,wBAAmB,GAAG,CAAC,CAAC,CAAC;QAEhC,cAAc;QACP,kBAAa,GAAG,YAAY,CAAC,mBAAmB,CAAC;QAExD,cAA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AAmD;gBACnD,WAAW,CAAC,UAAU,GAAG,WAAW,CAAC,aAAa,KAAK,YAAY,CAAC,yBAAyB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC;aAClI;iBAAM;gBACH,OAAO,WAAW,CAAC,aAAa,KAAK,YAAY,CAAC,yBAAyB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC;aAChH;SACJ;KACJ;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC9B,IAAI,KAAK,CAAC,sBAAsB,EAAE;QAC9B,MAAM,4BAA4B,GAAG,KAAK,CAAC,sBAAsB,EAAE,CAAC;QAEpE,IAAI,IAAI,CAAC,eAAe,KAAK,IAAI,EAAE;YAC/B,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;SAC/C;QAED,IAAI,MAAM,CAAC,mBAAmB,CAAC,WAAW,CAAC,2BAA2B,EAAE,IAAI,CAAC,eAAe,CAAC,EAAE;YAC3F,4BAA4B,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC;YAC9D,MAAM,CAAC,iBAAiB,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;YAClE,IAAI,CAAC,qBAAqB,CAAC,0BAA0B,GAAG,IAAI,CAAC;SAChE;KACJ;IAED,OAAO,WAAW,CAAC,UAAU,CAAC;AAClC,CAAC,CAAC","sourcesContent":["import type { Nullable, int } from \"../../types\";\r\nimport { Engine } from \"../../Engines/engine\";\r\nimport { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { _TimeToken } from \"../../Instrumentation/timeToken\";\r\nimport { PerfCounter } from \"../../Misc/perfCounter\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\n\r\n/** @hidden */\r\nexport type OcclusionQuery = WebGLQuery | number;\r\n\r\n/** @hidden */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _OcclusionDataStorage {\r\n /** @hidden */\r\n public occlusionInternalRetryCounter = 0;\r\n\r\n /** @hidden */\r\n public isOcclusionQueryInProgress = false;\r\n\r\n /** @hidden */\r\n public isOccluded = false;\r\n\r\n /** @hidden */\r\n public occlusionRetryCount = -1;\r\n\r\n /** @hidden */\r\n public occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;\r\n\r\n /** @hidden */\r\n public occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;\r\n\r\n /** @hidden */\r\n public forceRenderingWhenOccluded = false;\r\n}\r\n\r\ndeclare module \"../../Engines/engine\" {\r\n export interface Engine {\r\n /**\r\n * Create a new webGL query (you must be sure that queries are supported by checking getCaps() function)\r\n * @return the new query\r\n */\r\n createQuery(): OcclusionQuery;\r\n\r\n /**\r\n * Delete and release a webGL query\r\n * @param query defines the query to delete\r\n * @return the current engine\r\n */\r\n deleteQuery(query: OcclusionQuery): Engine;\r\n\r\n /**\r\n * Check if a given query has resolved and got its value\r\n * @param query defines the query to check\r\n * @returns true if the query got its value\r\n */\r\n isQueryResultAvailable(query: OcclusionQuery): boolean;\r\n\r\n /**\r\n * Gets the value of a given query\r\n * @param query defines the query to check\r\n * @returns the value of the query\r\n */\r\n getQueryResult(query: OcclusionQuery): number;\r\n\r\n /**\r\n * Initiates an occlusion query\r\n * @param algorithmType defines the algorithm to use\r\n * @param query defines the query to use\r\n * @returns the current engine\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n beginOcclusionQuery(algorithmType: number, query: OcclusionQuery): boolean;\r\n\r\n /**\r\n * Ends an occlusion query\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n * @param algorithmType defines the algorithm to use\r\n * @returns the current engine\r\n */\r\n endOcclusionQuery(algorithmType: number): Engine;\r\n\r\n /**\r\n * Starts a time query (used to measure time spent by the GPU on a specific frame)\r\n * Please note that only one query can be issued at a time\r\n * @returns a time token used to track the time span\r\n */\r\n startTimeQuery(): Nullable<_TimeToken>;\r\n\r\n /**\r\n * Ends a time query\r\n * @param token defines the token used to measure the time span\r\n * @returns the time spent (in ns)\r\n */\r\n endTimeQuery(token: _TimeToken): int;\r\n\r\n /**\r\n * Get the performance counter associated with the frame time computation\r\n * @returns the perf counter\r\n */\r\n getGPUFrameTimeCounter(): PerfCounter;\r\n\r\n /**\r\n * Enable or disable the GPU frame time capture\r\n * @param value True to enable, false to disable\r\n */\r\n captureGPUFrameTime(value: boolean): void;\r\n\r\n /** @hidden */\r\n _currentNonTimestampToken: Nullable<_TimeToken>;\r\n /** @hidden */\r\n _captureGPUFrameTime: boolean;\r\n /** @hidden */\r\n _gpuFrameTimeToken: Nullable<_TimeToken>;\r\n /** @hidden */\r\n _gpuFrameTime: PerfCounter;\r\n /** @hidden */\r\n _onBeginFrameObserver: Nullable<Observer<Engine>>;\r\n /** @hidden */\r\n _onEndFrameObserver: Nullable<Observer<Engine>>;\r\n\r\n /** @hidden */\r\n _createTimeQuery(): WebGLQuery;\r\n\r\n /** @hidden */\r\n _deleteTimeQuery(query: WebGLQuery): void;\r\n\r\n /** @hidden */\r\n _getGlAlgorithmType(algorithmType: number): number;\r\n\r\n /** @hidden */\r\n _getTimeQueryResult(query: WebGLQuery): any;\r\n\r\n /** @hidden */\r\n _getTimeQueryAvailability(query: WebGLQuery): any;\r\n }\r\n}\r\n\r\nEngine.prototype.createQuery = function (): OcclusionQuery {\r\n const query = this._gl.createQuery();\r\n if (!query) {\r\n throw new Error(\"Unable to create Occlusion Query\");\r\n }\r\n return query;\r\n};\r\n\r\nEngine.prototype.deleteQuery = function (query: OcclusionQuery): Engine {\r\n this._gl.deleteQuery(query);\r\n\r\n return this;\r\n};\r\n\r\nEngine.prototype.isQueryResultAvailable = function (query: OcclusionQuery): boolean {\r\n return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT_AVAILABLE) as boolean;\r\n};\r\n\r\nEngine.prototype.getQueryResult = function (query: OcclusionQuery): number {\r\n return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT) as number;\r\n};\r\n\r\nEngine.prototype.beginOcclusionQuery = function (algorithmType: number, query: OcclusionQuery): boolean {\r\n const glAlgorithm = this._getGlAlgorithmType(algorithmType);\r\n this._gl.beginQuery(glAlgorithm, query);\r\n\r\n return true;\r\n};\r\n\r\nEngine.prototype.endOcclusionQuery = function (algorithmType: number): Engine {\r\n const glAlgorithm = this._getGlAlgorithmType(algorithmType);\r\n this._gl.endQuery(glAlgorithm);\r\n\r\n return this;\r\n};\r\n\r\nEngine.prototype._createTimeQuery = function (): WebGLQuery {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.createQueryEXT) {\r\n return timerQuery.createQueryEXT();\r\n }\r\n\r\n return this.createQuery();\r\n};\r\n\r\nEngine.prototype._deleteTimeQuery = function (query: WebGLQuery): void {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.deleteQueryEXT) {\r\n timerQuery.deleteQueryEXT(query);\r\n return;\r\n }\r\n\r\n this.deleteQuery(query);\r\n};\r\n\r\nEngine.prototype._getTimeQueryResult = function (query: WebGLQuery): any {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.getQueryObjectEXT) {\r\n return timerQuery.getQueryObjectEXT(query, timerQuery.QUERY_RESULT_EXT);\r\n }\r\n return this.getQueryResult(query);\r\n};\r\n\r\nEngine.prototype._getTimeQueryAvailability = function (query: WebGLQuery): any {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.getQueryObjectEXT) {\r\n return timerQuery.getQueryObjectEXT(query, timerQuery.QUERY_RESULT_AVAILABLE_EXT);\r\n }\r\n return this.isQueryResultAvailable(query);\r\n};\r\n\r\nEngine.prototype.startTimeQuery = function (): Nullable<_TimeToken> {\r\n const caps = this.getCaps();\r\n const timerQuery = caps.timerQuery;\r\n if (!timerQuery) {\r\n return null;\r\n }\r\n\r\n const token = new _TimeToken();\r\n this._gl.getParameter(timerQuery.GPU_DISJOINT_EXT);\r\n if (caps.canUseTimestampForTimerQuery) {\r\n token._startTimeQuery = this._createTimeQuery();\r\n\r\n timerQuery.queryCounterEXT(token._startTimeQuery, timerQuery.TIMESTAMP_EXT);\r\n } else {\r\n if (this._currentNonTimestampToken) {\r\n return this._currentNonTimestampToken;\r\n }\r\n\r\n token._timeElapsedQuery = this._createTimeQuery();\r\n if (timerQuery.beginQueryEXT) {\r\n timerQuery.beginQueryEXT(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);\r\n } else {\r\n this._gl.beginQuery(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);\r\n }\r\n\r\n this._currentNonTimestampToken = token;\r\n }\r\n return token;\r\n};\r\n\r\nEngine.prototype.endTimeQuery = function (token: _TimeToken): int {\r\n const caps = this.getCaps();\r\n const timerQuery = caps.timerQuery;\r\n if (!timerQuery || !token) {\r\n return -1;\r\n }\r\n\r\n if (caps.canUseTimestampForTimerQuery) {\r\n if (!token._startTimeQuery) {\r\n return -1;\r\n }\r\n if (!token._endTimeQuery) {\r\n token._endTimeQuery = this._createTimeQuery();\r\n timerQuery.queryCounterEXT(token._endTimeQuery, timerQuery.TIMESTAMP_EXT);\r\n }\r\n } else if (!token._timeElapsedQueryEnded) {\r\n if (!token._timeElapsedQuery) {\r\n return -1;\r\n }\r\n if (timerQuery.endQueryEXT) {\r\n timerQuery.endQueryEXT(timerQuery.TIME_ELAPSED_EXT);\r\n } else {\r\n this._gl.endQuery(timerQuery.TIME_ELAPSED_EXT);\r\n this._currentNonTimestampToken = null;\r\n }\r\n token._timeElapsedQueryEnded = true;\r\n }\r\n\r\n const disjoint = this._gl.getParameter(timerQuery.GPU_DISJOINT_EXT);\r\n let available: boolean = false;\r\n if (token._endTimeQuery) {\r\n available = this._getTimeQueryAvailability(token._endTimeQuery);\r\n } else if (token._timeElapsedQuery) {\r\n available = this._getTimeQueryAvailability(token._timeElapsedQuery);\r\n }\r\n\r\n if (available && !disjoint) {\r\n let result = 0;\r\n if (caps.canUseTimestampForTimerQuery) {\r\n if (!token._startTimeQuery || !token._endTimeQuery) {\r\n return -1;\r\n }\r\n const timeStart = this._getTimeQueryResult(token._startTimeQuery);\r\n const timeEnd = this._getTimeQueryResult(token._endTimeQuery);\r\n\r\n result = timeEnd - timeStart;\r\n this._deleteTimeQuery(token._startTimeQuery);\r\n this._deleteTimeQuery(token._endTimeQuery);\r\n token._startTimeQuery = null;\r\n token._endTimeQuery = null;\r\n } else {\r\n if (!token._timeElapsedQuery) {\r\n return -1;\r\n }\r\n\r\n result = this._getTimeQueryResult(token._timeElapsedQuery);\r\n this._deleteTimeQuery(token._timeElapsedQuery);\r\n token._timeElapsedQuery = null;\r\n token._timeElapsedQueryEnded = false;\r\n }\r\n return result;\r\n }\r\n\r\n return -1;\r\n};\r\n\r\nEngine.prototype._captureGPUFrameTime = false;\r\nEngine.prototype._gpuFrameTime = new PerfCounter();\r\n\r\nEngine.prototype.getGPUFrameTimeCounter = function () {\r\n return this._gpuFrameTime;\r\n};\r\n\r\nEngine.prototype.captureGPUFrameTime = function (value: boolean) {\r\n if (value === this._captureGPUFrameTime) {\r\n return;\r\n }\r\n\r\n this._captureGPUFrameTime = value;\r\n\r\n if (value) {\r\n this._onBeginFrameObserver = this.onBeginFrameObservable.add(() => {\r\n if (!this._gpuFrameTimeToken) {\r\n this._gpuFrameTimeToken = this.startTimeQuery();\r\n }\r\n });\r\n\r\n this._onEndFrameObserver = this.onEndFrameObservable.add(() => {\r\n if (!this._gpuFrameTimeToken) {\r\n return;\r\n }\r\n const time = this.endTimeQuery(this._gpuFrameTimeToken);\r\n\r\n if (time > -1) {\r\n this._gpuFrameTimeToken = null;\r\n this._gpuFrameTime.fetchNewFrame();\r\n this._gpuFrameTime.addCount(time, true);\r\n }\r\n });\r\n } else {\r\n this.onBeginFrameObservable.remove(this._onBeginFrameObserver);\r\n this._onBeginFrameObserver = null;\r\n this.onEndFrameObservable.remove(this._onEndFrameObserver);\r\n this._onEndFrameObserver = null;\r\n }\r\n};\r\n\r\nEngine.prototype._getGlAlgorithmType = function (algorithmType: number): number {\r\n return algorithmType === AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE : this._gl.ANY_SAMPLES_PASSED;\r\n};\r\n\r\ndeclare module \"../../Meshes/abstractMesh\" {\r\n export interface AbstractMesh {\r\n /**\r\n * Backing filed\r\n * @hidden\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n __occlusionDataStorage: _OcclusionDataStorage;\r\n\r\n /**\r\n * Access property\r\n * @hidden\r\n */\r\n _occlusionDataStorage: _OcclusionDataStorage;\r\n\r\n /**\r\n * This number indicates the number of allowed retries before stop the occlusion query, this is useful if the occlusion query is taking long time before to the query result is retrieved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decides to show or hide the object.\r\n * The default value is -1 which means don't break the query and wait till the result\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n occlusionRetryCount: number;\r\n\r\n /**\r\n * This property is responsible for starting the occlusion query within the Mesh or not, this property is also used to determine what should happen when the occlusionRetryCount is reached. It has supports 3 values:\r\n * * OCCLUSION_TYPE_NONE (Default Value): this option means no occlusion query within the Mesh.\r\n * * OCCLUSION_TYPE_OPTIMISTIC: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken show the mesh.\r\n * * OCCLUSION_TYPE_STRICT: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken restore the last state of the mesh occlusion if the mesh was visible then show the mesh if was hidden then hide don't show.\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n occlusionType: number;\r\n\r\n /**\r\n * This property determines the type of occlusion query algorithm to run in WebGl, you can use:\r\n * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE which is mapped to GL_ANY_SAMPLES_PASSED.\r\n * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE (Default Value) which is mapped to GL_ANY_SAMPLES_PASSED_CONSERVATIVE which is a false positive algorithm that is faster than GL_ANY_SAMPLES_PASSED but less accurate.\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n occlusionQueryAlgorithmType: number;\r\n\r\n /**\r\n * Gets or sets whether the mesh is occluded or not, it is used also to set the initial state of the mesh to be occluded or not\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n isOccluded: boolean;\r\n\r\n /**\r\n * Flag to check the progress status of the query\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n isOcclusionQueryInProgress: boolean;\r\n\r\n /**\r\n * Flag to force rendering the mesh even if occluded\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n forceRenderingWhenOccluded: boolean;\r\n }\r\n}\r\nObject.defineProperty(AbstractMesh.prototype, \"isOcclusionQueryInProgress\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.isOcclusionQueryInProgress;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = value;\r\n },\r\n enumerable: false,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"_occlusionDataStorage\", {\r\n get: function (this: AbstractMesh) {\r\n if (!this.__occlusionDataStorage) {\r\n this.__occlusionDataStorage = new _OcclusionDataStorage();\r\n }\r\n return this.__occlusionDataStorage;\r\n },\r\n enumerable: false,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"isOccluded\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.isOccluded;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.isOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionQueryAlgorithmType\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionQueryAlgorithmType;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionQueryAlgorithmType = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionType\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionType;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionType = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionRetryCount\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionRetryCount;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionRetryCount = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"forceRenderingWhenOccluded\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.forceRenderingWhenOccluded;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.forceRenderingWhenOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n// We also need to update AbstractMesh as there is a portion of the code there\r\nAbstractMesh.prototype._checkOcclusionQuery = function () {\r\n const dataStorage = this._occlusionDataStorage;\r\n\r\n if (dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n const engine = this.getEngine();\r\n\r\n if (!engine.getCaps().supportOcclusionQuery) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n if (!engine.isQueryResultAvailable) {\r\n // Occlusion query where not referenced\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n if (this.isOcclusionQueryInProgress && this._occlusionQuery) {\r\n const isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);\r\n if (isOcclusionQueryAvailable) {\r\n const occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);\r\n\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n dataStorage.isOccluded = occlusionQueryResult > 0 ? false : true;\r\n } else {\r\n dataStorage.occlusionInternalRetryCounter++;\r\n\r\n if (dataStorage.occlusionRetryCount !== -1 && dataStorage.occlusionInternalRetryCounter > dataStorage.occlusionRetryCount) {\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n\r\n // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)\r\n // if strict continue the last state of the object.\r\n dataStorage.isOccluded = dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n } else {\r\n return dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n }\r\n }\r\n }\r\n\r\n const scene = this.getScene();\r\n if (scene.getBoundingBoxRenderer) {\r\n const occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();\r\n\r\n if (this._occlusionQuery === null) {\r\n this._occlusionQuery = engine.createQuery();\r\n }\r\n\r\n if (engine.beginOcclusionQuery(dataStorage.occlusionQueryAlgorithmType, this._occlusionQuery)) {\r\n occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);\r\n engine.endOcclusionQuery(dataStorage.occlusionQueryAlgorithmType);\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = true;\r\n }\r\n }\r\n\r\n return dataStorage.isOccluded;\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.query.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,O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C,CAAC;YAClE,IAAI,CAAC,qBAAqB,CAAC,0BAA0B,GAAG,IAAI,CAAC;SAChE;KACJ;IAED,OAAO,WAAW,CAAC,UAAU,CAAC;AAClC,CAAC,CAAC","sourcesContent":["import type { Nullable, int } from \"../../types\";\r\nimport { Engine } from \"../../Engines/engine\";\r\nimport { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { _TimeToken } from \"../../Instrumentation/timeToken\";\r\nimport { PerfCounter } from \"../../Misc/perfCounter\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\n\r\n/** @hidden */\r\nexport type OcclusionQuery = WebGLQuery | number;\r\n\r\n/** @hidden */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class _OcclusionDataStorage {\r\n /** @hidden */\r\n public occlusionInternalRetryCounter = 0;\r\n\r\n /** @hidden */\r\n public isOcclusionQueryInProgress = false;\r\n\r\n /** @hidden */\r\n public isOccluded = false;\r\n\r\n /** @hidden */\r\n public occlusionRetryCount = -1;\r\n\r\n /** @hidden */\r\n public occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;\r\n\r\n /** @hidden */\r\n public occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;\r\n\r\n /** @hidden */\r\n public forceRenderingWhenOccluded = false;\r\n}\r\n\r\ndeclare module \"../../Engines/engine\" {\r\n export interface Engine {\r\n /**\r\n * Create a new webGL query (you must be sure that queries are supported by checking getCaps() function)\r\n * @returns the new query\r\n */\r\n createQuery(): OcclusionQuery;\r\n\r\n /**\r\n * Delete and release a webGL query\r\n * @param query defines the query to delete\r\n * @returns the current engine\r\n */\r\n deleteQuery(query: OcclusionQuery): Engine;\r\n\r\n /**\r\n * Check if a given query has resolved and got its value\r\n * @param query defines the query to check\r\n * @returns true if the query got its value\r\n */\r\n isQueryResultAvailable(query: OcclusionQuery): boolean;\r\n\r\n /**\r\n * Gets the value of a given query\r\n * @param query defines the query to check\r\n * @returns the value of the query\r\n */\r\n getQueryResult(query: OcclusionQuery): number;\r\n\r\n /**\r\n * Initiates an occlusion query\r\n * @param algorithmType defines the algorithm to use\r\n * @param query defines the query to use\r\n * @returns the current engine\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n beginOcclusionQuery(algorithmType: number, query: OcclusionQuery): boolean;\r\n\r\n /**\r\n * Ends an occlusion query\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n * @param algorithmType defines the algorithm to use\r\n * @returns the current engine\r\n */\r\n endOcclusionQuery(algorithmType: number): Engine;\r\n\r\n /**\r\n * Starts a time query (used to measure time spent by the GPU on a specific frame)\r\n * Please note that only one query can be issued at a time\r\n * @returns a time token used to track the time span\r\n */\r\n startTimeQuery(): Nullable<_TimeToken>;\r\n\r\n /**\r\n * Ends a time query\r\n * @param token defines the token used to measure the time span\r\n * @returns the time spent (in ns)\r\n */\r\n endTimeQuery(token: _TimeToken): int;\r\n\r\n /**\r\n * Get the performance counter associated with the frame time computation\r\n * @returns the perf counter\r\n */\r\n getGPUFrameTimeCounter(): PerfCounter;\r\n\r\n /**\r\n * Enable or disable the GPU frame time capture\r\n * @param value True to enable, false to disable\r\n */\r\n captureGPUFrameTime(value: boolean): void;\r\n\r\n /** @hidden */\r\n _currentNonTimestampToken: Nullable<_TimeToken>;\r\n /** @hidden */\r\n _captureGPUFrameTime: boolean;\r\n /** @hidden */\r\n _gpuFrameTimeToken: Nullable<_TimeToken>;\r\n /** @hidden */\r\n _gpuFrameTime: PerfCounter;\r\n /** @hidden */\r\n _onBeginFrameObserver: Nullable<Observer<Engine>>;\r\n /** @hidden */\r\n _onEndFrameObserver: Nullable<Observer<Engine>>;\r\n\r\n /** @hidden */\r\n _createTimeQuery(): WebGLQuery;\r\n\r\n /** @hidden */\r\n _deleteTimeQuery(query: WebGLQuery): void;\r\n\r\n /** @hidden */\r\n _getGlAlgorithmType(algorithmType: number): number;\r\n\r\n /** @hidden */\r\n _getTimeQueryResult(query: WebGLQuery): any;\r\n\r\n /** @hidden */\r\n _getTimeQueryAvailability(query: WebGLQuery): any;\r\n }\r\n}\r\n\r\nEngine.prototype.createQuery = function (): OcclusionQuery {\r\n const query = this._gl.createQuery();\r\n if (!query) {\r\n throw new Error(\"Unable to create Occlusion Query\");\r\n }\r\n return query;\r\n};\r\n\r\nEngine.prototype.deleteQuery = function (query: OcclusionQuery): Engine {\r\n this._gl.deleteQuery(query);\r\n\r\n return this;\r\n};\r\n\r\nEngine.prototype.isQueryResultAvailable = function (query: OcclusionQuery): boolean {\r\n return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT_AVAILABLE) as boolean;\r\n};\r\n\r\nEngine.prototype.getQueryResult = function (query: OcclusionQuery): number {\r\n return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT) as number;\r\n};\r\n\r\nEngine.prototype.beginOcclusionQuery = function (algorithmType: number, query: OcclusionQuery): boolean {\r\n const glAlgorithm = this._getGlAlgorithmType(algorithmType);\r\n this._gl.beginQuery(glAlgorithm, query);\r\n\r\n return true;\r\n};\r\n\r\nEngine.prototype.endOcclusionQuery = function (algorithmType: number): Engine {\r\n const glAlgorithm = this._getGlAlgorithmType(algorithmType);\r\n this._gl.endQuery(glAlgorithm);\r\n\r\n return this;\r\n};\r\n\r\nEngine.prototype._createTimeQuery = function (): WebGLQuery {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.createQueryEXT) {\r\n return timerQuery.createQueryEXT();\r\n }\r\n\r\n return this.createQuery();\r\n};\r\n\r\nEngine.prototype._deleteTimeQuery = function (query: WebGLQuery): void {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.deleteQueryEXT) {\r\n timerQuery.deleteQueryEXT(query);\r\n return;\r\n }\r\n\r\n this.deleteQuery(query);\r\n};\r\n\r\nEngine.prototype._getTimeQueryResult = function (query: WebGLQuery): any {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.getQueryObjectEXT) {\r\n return timerQuery.getQueryObjectEXT(query, timerQuery.QUERY_RESULT_EXT);\r\n }\r\n return this.getQueryResult(query);\r\n};\r\n\r\nEngine.prototype._getTimeQueryAvailability = function (query: WebGLQuery): any {\r\n const timerQuery = <EXT_disjoint_timer_query>this.getCaps().timerQuery;\r\n\r\n if (timerQuery.getQueryObjectEXT) {\r\n return timerQuery.getQueryObjectEXT(query, timerQuery.QUERY_RESULT_AVAILABLE_EXT);\r\n }\r\n return this.isQueryResultAvailable(query);\r\n};\r\n\r\nEngine.prototype.startTimeQuery = function (): Nullable<_TimeToken> {\r\n const caps = this.getCaps();\r\n const timerQuery = caps.timerQuery;\r\n if (!timerQuery) {\r\n return null;\r\n }\r\n\r\n const token = new _TimeToken();\r\n this._gl.getParameter(timerQuery.GPU_DISJOINT_EXT);\r\n if (caps.canUseTimestampForTimerQuery) {\r\n token._startTimeQuery = this._createTimeQuery();\r\n\r\n timerQuery.queryCounterEXT(token._startTimeQuery, timerQuery.TIMESTAMP_EXT);\r\n } else {\r\n if (this._currentNonTimestampToken) {\r\n return this._currentNonTimestampToken;\r\n }\r\n\r\n token._timeElapsedQuery = this._createTimeQuery();\r\n if (timerQuery.beginQueryEXT) {\r\n timerQuery.beginQueryEXT(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);\r\n } else {\r\n this._gl.beginQuery(timerQuery.TIME_ELAPSED_EXT, token._timeElapsedQuery);\r\n }\r\n\r\n this._currentNonTimestampToken = token;\r\n }\r\n return token;\r\n};\r\n\r\nEngine.prototype.endTimeQuery = function (token: _TimeToken): int {\r\n const caps = this.getCaps();\r\n const timerQuery = caps.timerQuery;\r\n if (!timerQuery || !token) {\r\n return -1;\r\n }\r\n\r\n if (caps.canUseTimestampForTimerQuery) {\r\n if (!token._startTimeQuery) {\r\n return -1;\r\n }\r\n if (!token._endTimeQuery) {\r\n token._endTimeQuery = this._createTimeQuery();\r\n timerQuery.queryCounterEXT(token._endTimeQuery, timerQuery.TIMESTAMP_EXT);\r\n }\r\n } else if (!token._timeElapsedQueryEnded) {\r\n if (!token._timeElapsedQuery) {\r\n return -1;\r\n }\r\n if (timerQuery.endQueryEXT) {\r\n timerQuery.endQueryEXT(timerQuery.TIME_ELAPSED_EXT);\r\n } else {\r\n this._gl.endQuery(timerQuery.TIME_ELAPSED_EXT);\r\n this._currentNonTimestampToken = null;\r\n }\r\n token._timeElapsedQueryEnded = true;\r\n }\r\n\r\n const disjoint = this._gl.getParameter(timerQuery.GPU_DISJOINT_EXT);\r\n let available: boolean = false;\r\n if (token._endTimeQuery) {\r\n available = this._getTimeQueryAvailability(token._endTimeQuery);\r\n } else if (token._timeElapsedQuery) {\r\n available = this._getTimeQueryAvailability(token._timeElapsedQuery);\r\n }\r\n\r\n if (available && !disjoint) {\r\n let result = 0;\r\n if (caps.canUseTimestampForTimerQuery) {\r\n if (!token._startTimeQuery || !token._endTimeQuery) {\r\n return -1;\r\n }\r\n const timeStart = this._getTimeQueryResult(token._startTimeQuery);\r\n const timeEnd = this._getTimeQueryResult(token._endTimeQuery);\r\n\r\n result = timeEnd - timeStart;\r\n this._deleteTimeQuery(token._startTimeQuery);\r\n this._deleteTimeQuery(token._endTimeQuery);\r\n token._startTimeQuery = null;\r\n token._endTimeQuery = null;\r\n } else {\r\n if (!token._timeElapsedQuery) {\r\n return -1;\r\n }\r\n\r\n result = this._getTimeQueryResult(token._timeElapsedQuery);\r\n this._deleteTimeQuery(token._timeElapsedQuery);\r\n token._timeElapsedQuery = null;\r\n token._timeElapsedQueryEnded = false;\r\n }\r\n return result;\r\n }\r\n\r\n return -1;\r\n};\r\n\r\nEngine.prototype._captureGPUFrameTime = false;\r\nEngine.prototype._gpuFrameTime = new PerfCounter();\r\n\r\nEngine.prototype.getGPUFrameTimeCounter = function () {\r\n return this._gpuFrameTime;\r\n};\r\n\r\nEngine.prototype.captureGPUFrameTime = function (value: boolean) {\r\n if (value === this._captureGPUFrameTime) {\r\n return;\r\n }\r\n\r\n this._captureGPUFrameTime = value;\r\n\r\n if (value) {\r\n this._onBeginFrameObserver = this.onBeginFrameObservable.add(() => {\r\n if (!this._gpuFrameTimeToken) {\r\n this._gpuFrameTimeToken = this.startTimeQuery();\r\n }\r\n });\r\n\r\n this._onEndFrameObserver = this.onEndFrameObservable.add(() => {\r\n if (!this._gpuFrameTimeToken) {\r\n return;\r\n }\r\n const time = this.endTimeQuery(this._gpuFrameTimeToken);\r\n\r\n if (time > -1) {\r\n this._gpuFrameTimeToken = null;\r\n this._gpuFrameTime.fetchNewFrame();\r\n this._gpuFrameTime.addCount(time, true);\r\n }\r\n });\r\n } else {\r\n this.onBeginFrameObservable.remove(this._onBeginFrameObserver);\r\n this._onBeginFrameObserver = null;\r\n this.onEndFrameObservable.remove(this._onEndFrameObserver);\r\n this._onEndFrameObserver = null;\r\n }\r\n};\r\n\r\nEngine.prototype._getGlAlgorithmType = function (algorithmType: number): number {\r\n return algorithmType === AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE ? this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE : this._gl.ANY_SAMPLES_PASSED;\r\n};\r\n\r\ndeclare module \"../../Meshes/abstractMesh\" {\r\n export interface AbstractMesh {\r\n /**\r\n * Backing filed\r\n * @hidden\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n __occlusionDataStorage: _OcclusionDataStorage;\r\n\r\n /**\r\n * Access property\r\n * @hidden\r\n */\r\n _occlusionDataStorage: _OcclusionDataStorage;\r\n\r\n /**\r\n * This number indicates the number of allowed retries before stop the occlusion query, this is useful if the occlusion query is taking long time before to the query result is retrieved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decides to show or hide the object.\r\n * The default value is -1 which means don't break the query and wait till the result\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n occlusionRetryCount: number;\r\n\r\n /**\r\n * This property is responsible for starting the occlusion query within the Mesh or not, this property is also used to determine what should happen when the occlusionRetryCount is reached. It has supports 3 values:\r\n * * OCCLUSION_TYPE_NONE (Default Value): this option means no occlusion query within the Mesh.\r\n * * OCCLUSION_TYPE_OPTIMISTIC: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken show the mesh.\r\n * * OCCLUSION_TYPE_STRICT: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken restore the last state of the mesh occlusion if the mesh was visible then show the mesh if was hidden then hide don't show.\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n occlusionType: number;\r\n\r\n /**\r\n * This property determines the type of occlusion query algorithm to run in WebGl, you can use:\r\n * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE which is mapped to GL_ANY_SAMPLES_PASSED.\r\n * * AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE (Default Value) which is mapped to GL_ANY_SAMPLES_PASSED_CONSERVATIVE which is a false positive algorithm that is faster than GL_ANY_SAMPLES_PASSED but less accurate.\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n occlusionQueryAlgorithmType: number;\r\n\r\n /**\r\n * Gets or sets whether the mesh is occluded or not, it is used also to set the initial state of the mesh to be occluded or not\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n isOccluded: boolean;\r\n\r\n /**\r\n * Flag to check the progress status of the query\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n isOcclusionQueryInProgress: boolean;\r\n\r\n /**\r\n * Flag to force rendering the mesh even if occluded\r\n * @see https://doc.babylonjs.com/features/occlusionquery\r\n */\r\n forceRenderingWhenOccluded: boolean;\r\n }\r\n}\r\nObject.defineProperty(AbstractMesh.prototype, \"isOcclusionQueryInProgress\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.isOcclusionQueryInProgress;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = value;\r\n },\r\n enumerable: false,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"_occlusionDataStorage\", {\r\n get: function (this: AbstractMesh) {\r\n if (!this.__occlusionDataStorage) {\r\n this.__occlusionDataStorage = new _OcclusionDataStorage();\r\n }\r\n return this.__occlusionDataStorage;\r\n },\r\n enumerable: false,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"isOccluded\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.isOccluded;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.isOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionQueryAlgorithmType\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionQueryAlgorithmType;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionQueryAlgorithmType = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionType\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionType;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionType = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"occlusionRetryCount\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.occlusionRetryCount;\r\n },\r\n set: function (this: AbstractMesh, value: number) {\r\n this._occlusionDataStorage.occlusionRetryCount = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nObject.defineProperty(AbstractMesh.prototype, \"forceRenderingWhenOccluded\", {\r\n get: function (this: AbstractMesh) {\r\n return this._occlusionDataStorage.forceRenderingWhenOccluded;\r\n },\r\n set: function (this: AbstractMesh, value: boolean) {\r\n this._occlusionDataStorage.forceRenderingWhenOccluded = value;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n// We also need to update AbstractMesh as there is a portion of the code there\r\nAbstractMesh.prototype._checkOcclusionQuery = function () {\r\n const dataStorage = this._occlusionDataStorage;\r\n\r\n if (dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n const engine = this.getEngine();\r\n\r\n if (!engine.getCaps().supportOcclusionQuery) {\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n if (!engine.isQueryResultAvailable) {\r\n // Occlusion query where not referenced\r\n dataStorage.isOccluded = false;\r\n return false;\r\n }\r\n\r\n if (this.isOcclusionQueryInProgress && this._occlusionQuery) {\r\n const isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);\r\n if (isOcclusionQueryAvailable) {\r\n const occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);\r\n\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n dataStorage.isOccluded = occlusionQueryResult > 0 ? false : true;\r\n } else {\r\n dataStorage.occlusionInternalRetryCounter++;\r\n\r\n if (dataStorage.occlusionRetryCount !== -1 && dataStorage.occlusionInternalRetryCounter > dataStorage.occlusionRetryCount) {\r\n dataStorage.isOcclusionQueryInProgress = false;\r\n dataStorage.occlusionInternalRetryCounter = 0;\r\n\r\n // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)\r\n // if strict continue the last state of the object.\r\n dataStorage.isOccluded = dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n } else {\r\n return dataStorage.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;\r\n }\r\n }\r\n }\r\n\r\n const scene = this.getScene();\r\n if (scene.getBoundingBoxRenderer) {\r\n const occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();\r\n\r\n if (this._occlusionQuery === null) {\r\n this._occlusionQuery = engine.createQuery();\r\n }\r\n\r\n if (engine.beginOcclusionQuery(dataStorage.occlusionQueryAlgorithmType, this._occlusionQuery)) {\r\n occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);\r\n engine.endOcclusionQuery(dataStorage.occlusionQueryAlgorithmType);\r\n this._occlusionDataStorage.isOcclusionQueryInProgress = true;\r\n }\r\n }\r\n\r\n return dataStorage.isOccluded;\r\n};\r\n"]}
@@ -338,6 +338,17 @@ export interface ICanvasRenderingContext {
338
338
  * @returns ICanvasGradient A linear ICanvasGradient initialized with the specified line.
339
339
  */
340
340
  createLinearGradient(x0: number, y0: number, x1: number, y1: number): ICanvasGradient;
341
+ /**
342
+ * Creates a linear gradient along the line given by the coordinates represented by the parameters.
343
+ * @param x0 The x-axis coordinate of the start circle.
344
+ * @param y0 The y-axis coordinate of the start circle.
345
+ * @param r0 The radius of the start circle. Must be non-negative and finite.
346
+ * @param x1 The x-axis coordinate of the end point.
347
+ * @param y1 The y-axis coordinate of the end point.
348
+ * @param r1 The radius of the end circle. Must be non-negative and finite.
349
+ * @returns ICanvasGradient A linear ICanvasGradient initialized with the two specified circles.
350
+ */
351
+ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): ICanvasGradient;
341
352
  /**
342
353
  * Resets the current transform to matrix composed with a, b, c, d, e, f.
343
354
  * @param a Horizontal scaling. A value of 1 results in no scaling.
@@ -1 +1 @@
1
- {"version":3,"file":"ICanvas.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Engines/ICanvas.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * Class used to abstract a canvas\r\n */\r\nexport interface ICanvas {\r\n /**\r\n * Canvas width.\r\n */\r\n width: number;\r\n\r\n /**\r\n * Canvas height.\r\n */\r\n height: number;\r\n\r\n /**\r\n * returns a drawing context on the canvas.\r\n * @param contextType context identifier.\r\n * @param contextAttributes context attributes.\r\n * @returns ICanvasRenderingContext object.\r\n */\r\n getContext(contextType: string, contextAttributes?: any): ICanvasRenderingContext;\r\n\r\n /**\r\n * returns a data URI containing a representation of the image in the format specified by the type parameter.\r\n * @param mime the image format.\r\n * @returns string containing the requested data URI.\r\n */\r\n toDataURL(mime: string): string;\r\n}\r\n\r\n/**\r\n * Class used to abstract am image to use with the canvas and its context\r\n */\r\nexport interface IImage {\r\n /**\r\n * onload callback.\r\n */\r\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;\r\n\r\n /**\r\n * Error callback.\r\n */\r\n onerror: ((this: GlobalEventHandlers, ev: Event) => any) | null;\r\n\r\n /**\r\n * Image source.\r\n */\r\n src: string;\r\n\r\n /**\r\n * Image width.\r\n */\r\n readonly width: number;\r\n\r\n /**\r\n * Image height.\r\n */\r\n readonly height: number;\r\n\r\n /**\r\n * The original height of the image resource before sizing.\r\n */\r\n readonly naturalHeight: number;\r\n\r\n /**\r\n * The original width of the image resource before sizing.\r\n */\r\n readonly naturalWidth: number;\r\n\r\n /**\r\n * provides support for CORS, defining how the element handles crossorigin requests,\r\n * thereby enabling the configuration of the CORS requests for the element's fetched data.\r\n */\r\n crossOrigin: string | null;\r\n\r\n /**\r\n * provides support for referrer policy on xhr load request,\r\n * it is used to control the request header.\r\n */\r\n referrerPolicy: string;\r\n}\r\n\r\n/**\r\n * Class used to abstract a canvas gradient\r\n */\r\nexport interface ICanvasGradient {\r\n /**\r\n * adds a new color stop, defined by an offset and a color, to a given canvas gradient.\r\n * @param offset A number between 0 and 1, inclusive, representing the position of the color stop. 0 represents the start of the gradient and 1 represents the end.\r\n * @param color value representing the color of the stop.\r\n */\r\n addColorStop(offset: number, color: string): void;\r\n}\r\n\r\n/**\r\n * Class used to abstract a text measurement\r\n */\r\nexport interface ITextMetrics {\r\n /**\r\n * Text width.\r\n */\r\n readonly width: number;\r\n /**\r\n * distance (in pixels) parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign\r\n * property to the left side of the bounding rectangle of the given text\r\n */\r\n readonly actualBoundingBoxLeft: number;\r\n /**\r\n * distance (in pixels) parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign\r\n * property to the right side of the bounding rectangle of the given text\r\n */\r\n readonly actualBoundingBoxRight: number;\r\n}\r\n\r\n/**\r\n * Class used to abstract canvas rendering\r\n */\r\nexport interface ICanvasRenderingContext {\r\n /**\r\n * Defines the type of corners where two lines meet. Possible values: round, bevel, miter (default).\r\n */\r\n lineJoin: string;\r\n\r\n /**\r\n * Miter limit ratio. Default 10.\r\n */\r\n miterLimit: number;\r\n\r\n /**\r\n * Font setting. Default value 10px sans-serif.\r\n */\r\n font: string;\r\n\r\n /**\r\n * Color or style to use for the lines around shapes. Default #000 (black).\r\n */\r\n strokeStyle: string;\r\n\r\n /**\r\n * Color or style to use inside shapes. Default #000 (black).\r\n */\r\n fillStyle: string | ICanvasGradient;\r\n\r\n /**\r\n * Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).\r\n */\r\n globalAlpha: number;\r\n\r\n /**\r\n * Color of the shadow. Default: fully-transparent black.\r\n */\r\n shadowColor: string;\r\n\r\n /**\r\n * Specifies the blurring effect. Default: 0.\r\n */\r\n shadowBlur: number;\r\n\r\n /**\r\n * Horizontal distance the shadow will be offset. Default: 0.\r\n */\r\n shadowOffsetX: number;\r\n\r\n /**\r\n * Vertical distance the shadow will be offset. Default: 0.\r\n */\r\n shadowOffsetY: number;\r\n\r\n /**\r\n * Width of lines. Default 1.0.\r\n */\r\n lineWidth: number;\r\n\r\n /**\r\n * canvas is a read-only reference to ICanvas.\r\n */\r\n readonly canvas: ICanvas;\r\n\r\n /**\r\n * Sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black, erasing any previously drawn content.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n clearRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Saves the current drawing style state using a stack so you can revert any change you make to it using restore().\r\n */\r\n save(): void;\r\n\r\n /**\r\n * Restores the drawing style state to the last element on the 'state stack' saved by save().\r\n */\r\n restore(): void;\r\n\r\n /**\r\n * Draws a filled rectangle at (x, y) position whose size is determined by width and height.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n fillRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Adds a scaling transformation to the canvas units by x horizontally and by y vertically.\r\n * @param x Scaling factor in the horizontal direction. A negative value flips pixels across the vertical axis. A value of 1 results in no horizontal scaling.\r\n * @param y Scaling factor in the vertical direction. A negative value flips pixels across the horizontal axis. A value of 1 results in no vertical scaling.\r\n */\r\n scale(x: number, y: number): void;\r\n\r\n /**\r\n * Adds a rotation to the transformation matrix. The angle argument represents a clockwise rotation angle and is expressed in radians.\r\n * @param angle The rotation angle, clockwise in radians. You can use degree * Math.PI / 180 to calculate a radian from a degree.\r\n */\r\n rotate(angle: number): void;\r\n\r\n /**\r\n * Adds a translation transformation by moving the canvas and its origin x horizontally and y vertically on the grid.\r\n * @param x Distance to move in the horizontal direction. Positive values are to the right, and negative to the left.\r\n * @param y Distance to move in the vertical direction. Positive values are down, and negative are up.\r\n */\r\n translate(x: number, y: number): void;\r\n\r\n /**\r\n * Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n strokeRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Creates a path for a rectangle at position (x, y) with a size that is determined by width and height.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n rect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Creates a clipping path from the current sub-paths. Everything drawn after clip() is called appears inside the clipping path only.\r\n */\r\n clip(): void;\r\n\r\n /**\r\n * Paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided, only the pixels from that rectangle are painted.\r\n * @param imageData An ImageData object containing the array of pixel values.\r\n * @param dx Horizontal position (x coordinate) at which to place the image data in the destination canvas.\r\n * @param dy Vertical position (y coordinate) at which to place the image data in the destination canvas.\r\n */\r\n putImageData(imageData: ImageData, dx: number, dy: number): void;\r\n\r\n /**\r\n * Adds a circular arc to the current path.\r\n * @param x The horizontal coordinate of the arc's center.\r\n * @param y The vertical coordinate of the arc's center.\r\n * @param radius The arc's radius. Must be positive.\r\n * @param startAngle The angle at which the arc starts in radians, measured from the positive x-axis.\r\n * @param endAngle The angle at which the arc ends in radians, measured from the positive x-axis.\r\n * @param anticlockwise An optional Boolean. If true, draws the arc counter-clockwise between the start and end angles. The default is false (clockwise).\r\n */\r\n arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\r\n\r\n /**\r\n * Starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path.\r\n */\r\n beginPath(): void;\r\n\r\n /**\r\n * Causes the point of the pen to move back to the start of the current sub-path. It tries to draw a straight line from the current point to the start.\r\n * If the shape has already been closed or has only one point, this function does nothing.\r\n */\r\n closePath(): void;\r\n\r\n /**\r\n * Moves the starting point of a new sub-path to the (x, y) coordinates.\r\n * @param x The x-axis (horizontal) coordinate of the point.\r\n * @param y The y-axis (vertical) coordinate of the point.\r\n */\r\n moveTo(x: number, y: number): void;\r\n\r\n /**\r\n * Connects the last point in the current sub-path to the specified (x, y) coordinates with a straight line.\r\n * @param x The x-axis coordinate of the line's end point.\r\n * @param y The y-axis coordinate of the line's end point.\r\n */\r\n lineTo(x: number, y: number): void;\r\n\r\n /**\r\n * Adds a quadratic Bézier curve to the current path.\r\n * @param cpx The x-axis coordinate of the control point.\r\n * @param cpy The y-axis coordinate of the control point.\r\n * @param x The x-axis coordinate of the end point.\r\n * @param y The y-axis coordinate of the end point.\r\n */\r\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;\r\n\r\n /**\r\n * Returns a TextMetrics object.\r\n * @param text The text String to measure.\r\n * @returns ITextMetrics A ITextMetrics object.\r\n */\r\n measureText(text: string): ITextMetrics;\r\n\r\n /**\r\n * Strokes the current sub-paths with the current stroke style.\r\n */\r\n stroke(): void;\r\n\r\n /**\r\n * Fills the current sub-paths with the current fill style.\r\n */\r\n fill(): void;\r\n\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param sx The x-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.\r\n * @param sy The y-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.\r\n * @param sWidth The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.\r\n * @param sHeight The height of the sub-rectangle of the source image to draw into the destination context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dWidth The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.\r\n * @param dHeight The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.\r\n */\r\n\r\n drawImage(image: any, sx: number, sy: number, sWidth: number, sHeight: number, dx: number, dy: number, dWidth: number, dHeight: number): void;\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dWidth The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.\r\n * @param dHeight The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.\r\n */\r\n drawImage(image: any, dx: number, dy: number, dWidth: number, dHeight: number): void;\r\n\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n */\r\n drawImage(image: any, dx: number, dy: number): void;\r\n\r\n /**\r\n * Returns an ImageData object representing the underlying pixel data for the area of the canvas denoted by the rectangle which starts at (sx, sy) and has an sw width and sh height.\r\n * @param sx The x-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.\r\n * @param sy The y-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.\r\n * @param sw The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left.\r\n * @param sh The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up.\r\n * @returns ImageData An ImageData object containing the image data for the rectangle of the canvas specified.\r\n */\r\n getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;\r\n\r\n /**\r\n * Sets the current line dash pattern.\r\n * @param segments An Array of numbers that specify distances to alternately draw a line and a gap (in coordinate space units).\r\n */\r\n setLineDash(segments: Array<number>): void;\r\n\r\n /**\r\n * Draws (fills) a given text at the given (x, y) position.\r\n * @param text A String specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction.\r\n * @param x The x-axis coordinate of the point at which to begin drawing the text, in pixels.\r\n * @param y The y-axis coordinate of the baseline on which to begin drawing the text, in pixels.\r\n * @param maxWidth The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text.\r\n */\r\n fillText(text: string, x: number, y: number, maxWidth?: number): void;\r\n\r\n /**\r\n * Draws (strokes) a given text at the given (x, y) position.\r\n * @param text A String specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction.\r\n * @param x The x-axis coordinate of the point at which to begin drawing the text, in pixels.\r\n * @param y The y-axis coordinate of the baseline on which to begin drawing the text, in pixels.\r\n * @param maxWidth The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text.\r\n */\r\n strokeText(text: string, x: number, y: number, maxWidth?: number): void;\r\n\r\n /**\r\n * Creates a linear gradient along the line given by the coordinates represented by the parameters.\r\n * @param x0 The x-axis coordinate of the start point.\r\n * @param y0 The y-axis coordinate of the start point.\r\n * @param x1 The x-axis coordinate of the end point.\r\n * @param y1 The y-axis coordinate of the end point.\r\n * @returns ICanvasGradient A linear ICanvasGradient initialized with the specified line.\r\n */\r\n createLinearGradient(x0: number, y0: number, x1: number, y1: number): ICanvasGradient;\r\n\r\n /**\r\n * Resets the current transform to matrix composed with a, b, c, d, e, f.\r\n * @param a Horizontal scaling. A value of 1 results in no scaling.\r\n * @param b Vertical skewing.\r\n * @param c Horizontal skewing.\r\n * @param d Vertical scaling. A value of 1 results in no scaling.\r\n * @param e Horizontal translation (moving).\r\n * @param f Vertical translation (moving).\r\n */\r\n setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"ICanvas.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Engines/ICanvas.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * Class used to abstract a canvas\r\n */\r\nexport interface ICanvas {\r\n /**\r\n * Canvas width.\r\n */\r\n width: number;\r\n\r\n /**\r\n * Canvas height.\r\n */\r\n height: number;\r\n\r\n /**\r\n * returns a drawing context on the canvas.\r\n * @param contextType context identifier.\r\n * @param contextAttributes context attributes.\r\n * @returns ICanvasRenderingContext object.\r\n */\r\n getContext(contextType: string, contextAttributes?: any): ICanvasRenderingContext;\r\n\r\n /**\r\n * returns a data URI containing a representation of the image in the format specified by the type parameter.\r\n * @param mime the image format.\r\n * @returns string containing the requested data URI.\r\n */\r\n toDataURL(mime: string): string;\r\n}\r\n\r\n/**\r\n * Class used to abstract am image to use with the canvas and its context\r\n */\r\nexport interface IImage {\r\n /**\r\n * onload callback.\r\n */\r\n onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;\r\n\r\n /**\r\n * Error callback.\r\n */\r\n onerror: ((this: GlobalEventHandlers, ev: Event) => any) | null;\r\n\r\n /**\r\n * Image source.\r\n */\r\n src: string;\r\n\r\n /**\r\n * Image width.\r\n */\r\n readonly width: number;\r\n\r\n /**\r\n * Image height.\r\n */\r\n readonly height: number;\r\n\r\n /**\r\n * The original height of the image resource before sizing.\r\n */\r\n readonly naturalHeight: number;\r\n\r\n /**\r\n * The original width of the image resource before sizing.\r\n */\r\n readonly naturalWidth: number;\r\n\r\n /**\r\n * provides support for CORS, defining how the element handles crossorigin requests,\r\n * thereby enabling the configuration of the CORS requests for the element's fetched data.\r\n */\r\n crossOrigin: string | null;\r\n\r\n /**\r\n * provides support for referrer policy on xhr load request,\r\n * it is used to control the request header.\r\n */\r\n referrerPolicy: string;\r\n}\r\n\r\n/**\r\n * Class used to abstract a canvas gradient\r\n */\r\nexport interface ICanvasGradient {\r\n /**\r\n * adds a new color stop, defined by an offset and a color, to a given canvas gradient.\r\n * @param offset A number between 0 and 1, inclusive, representing the position of the color stop. 0 represents the start of the gradient and 1 represents the end.\r\n * @param color value representing the color of the stop.\r\n */\r\n addColorStop(offset: number, color: string): void;\r\n}\r\n\r\n/**\r\n * Class used to abstract a text measurement\r\n */\r\nexport interface ITextMetrics {\r\n /**\r\n * Text width.\r\n */\r\n readonly width: number;\r\n /**\r\n * distance (in pixels) parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign\r\n * property to the left side of the bounding rectangle of the given text\r\n */\r\n readonly actualBoundingBoxLeft: number;\r\n /**\r\n * distance (in pixels) parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign\r\n * property to the right side of the bounding rectangle of the given text\r\n */\r\n readonly actualBoundingBoxRight: number;\r\n}\r\n\r\n/**\r\n * Class used to abstract canvas rendering\r\n */\r\nexport interface ICanvasRenderingContext {\r\n /**\r\n * Defines the type of corners where two lines meet. Possible values: round, bevel, miter (default).\r\n */\r\n lineJoin: string;\r\n\r\n /**\r\n * Miter limit ratio. Default 10.\r\n */\r\n miterLimit: number;\r\n\r\n /**\r\n * Font setting. Default value 10px sans-serif.\r\n */\r\n font: string;\r\n\r\n /**\r\n * Color or style to use for the lines around shapes. Default #000 (black).\r\n */\r\n strokeStyle: string;\r\n\r\n /**\r\n * Color or style to use inside shapes. Default #000 (black).\r\n */\r\n fillStyle: string | ICanvasGradient;\r\n\r\n /**\r\n * Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).\r\n */\r\n globalAlpha: number;\r\n\r\n /**\r\n * Color of the shadow. Default: fully-transparent black.\r\n */\r\n shadowColor: string;\r\n\r\n /**\r\n * Specifies the blurring effect. Default: 0.\r\n */\r\n shadowBlur: number;\r\n\r\n /**\r\n * Horizontal distance the shadow will be offset. Default: 0.\r\n */\r\n shadowOffsetX: number;\r\n\r\n /**\r\n * Vertical distance the shadow will be offset. Default: 0.\r\n */\r\n shadowOffsetY: number;\r\n\r\n /**\r\n * Width of lines. Default 1.0.\r\n */\r\n lineWidth: number;\r\n\r\n /**\r\n * canvas is a read-only reference to ICanvas.\r\n */\r\n readonly canvas: ICanvas;\r\n\r\n /**\r\n * Sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black, erasing any previously drawn content.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n clearRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Saves the current drawing style state using a stack so you can revert any change you make to it using restore().\r\n */\r\n save(): void;\r\n\r\n /**\r\n * Restores the drawing style state to the last element on the 'state stack' saved by save().\r\n */\r\n restore(): void;\r\n\r\n /**\r\n * Draws a filled rectangle at (x, y) position whose size is determined by width and height.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n fillRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Adds a scaling transformation to the canvas units by x horizontally and by y vertically.\r\n * @param x Scaling factor in the horizontal direction. A negative value flips pixels across the vertical axis. A value of 1 results in no horizontal scaling.\r\n * @param y Scaling factor in the vertical direction. A negative value flips pixels across the horizontal axis. A value of 1 results in no vertical scaling.\r\n */\r\n scale(x: number, y: number): void;\r\n\r\n /**\r\n * Adds a rotation to the transformation matrix. The angle argument represents a clockwise rotation angle and is expressed in radians.\r\n * @param angle The rotation angle, clockwise in radians. You can use degree * Math.PI / 180 to calculate a radian from a degree.\r\n */\r\n rotate(angle: number): void;\r\n\r\n /**\r\n * Adds a translation transformation by moving the canvas and its origin x horizontally and y vertically on the grid.\r\n * @param x Distance to move in the horizontal direction. Positive values are to the right, and negative to the left.\r\n * @param y Distance to move in the vertical direction. Positive values are down, and negative are up.\r\n */\r\n translate(x: number, y: number): void;\r\n\r\n /**\r\n * Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n strokeRect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Creates a path for a rectangle at position (x, y) with a size that is determined by width and height.\r\n * @param x The x-axis coordinate of the rectangle's starting point.\r\n * @param y The y-axis coordinate of the rectangle's starting point.\r\n * @param width The rectangle's width. Positive values are to the right, and negative to the left.\r\n * @param height The rectangle's height. Positive values are down, and negative are up.\r\n */\r\n rect(x: number, y: number, width: number, height: number): void;\r\n\r\n /**\r\n * Creates a clipping path from the current sub-paths. Everything drawn after clip() is called appears inside the clipping path only.\r\n */\r\n clip(): void;\r\n\r\n /**\r\n * Paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided, only the pixels from that rectangle are painted.\r\n * @param imageData An ImageData object containing the array of pixel values.\r\n * @param dx Horizontal position (x coordinate) at which to place the image data in the destination canvas.\r\n * @param dy Vertical position (y coordinate) at which to place the image data in the destination canvas.\r\n */\r\n putImageData(imageData: ImageData, dx: number, dy: number): void;\r\n\r\n /**\r\n * Adds a circular arc to the current path.\r\n * @param x The horizontal coordinate of the arc's center.\r\n * @param y The vertical coordinate of the arc's center.\r\n * @param radius The arc's radius. Must be positive.\r\n * @param startAngle The angle at which the arc starts in radians, measured from the positive x-axis.\r\n * @param endAngle The angle at which the arc ends in radians, measured from the positive x-axis.\r\n * @param anticlockwise An optional Boolean. If true, draws the arc counter-clockwise between the start and end angles. The default is false (clockwise).\r\n */\r\n arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\r\n\r\n /**\r\n * Starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path.\r\n */\r\n beginPath(): void;\r\n\r\n /**\r\n * Causes the point of the pen to move back to the start of the current sub-path. It tries to draw a straight line from the current point to the start.\r\n * If the shape has already been closed or has only one point, this function does nothing.\r\n */\r\n closePath(): void;\r\n\r\n /**\r\n * Moves the starting point of a new sub-path to the (x, y) coordinates.\r\n * @param x The x-axis (horizontal) coordinate of the point.\r\n * @param y The y-axis (vertical) coordinate of the point.\r\n */\r\n moveTo(x: number, y: number): void;\r\n\r\n /**\r\n * Connects the last point in the current sub-path to the specified (x, y) coordinates with a straight line.\r\n * @param x The x-axis coordinate of the line's end point.\r\n * @param y The y-axis coordinate of the line's end point.\r\n */\r\n lineTo(x: number, y: number): void;\r\n\r\n /**\r\n * Adds a quadratic Bézier curve to the current path.\r\n * @param cpx The x-axis coordinate of the control point.\r\n * @param cpy The y-axis coordinate of the control point.\r\n * @param x The x-axis coordinate of the end point.\r\n * @param y The y-axis coordinate of the end point.\r\n */\r\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;\r\n\r\n /**\r\n * Returns a TextMetrics object.\r\n * @param text The text String to measure.\r\n * @returns ITextMetrics A ITextMetrics object.\r\n */\r\n measureText(text: string): ITextMetrics;\r\n\r\n /**\r\n * Strokes the current sub-paths with the current stroke style.\r\n */\r\n stroke(): void;\r\n\r\n /**\r\n * Fills the current sub-paths with the current fill style.\r\n */\r\n fill(): void;\r\n\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param sx The x-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.\r\n * @param sy The y-axis coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.\r\n * @param sWidth The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.\r\n * @param sHeight The height of the sub-rectangle of the source image to draw into the destination context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dWidth The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.\r\n * @param dHeight The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.\r\n */\r\n\r\n drawImage(image: any, sx: number, sy: number, sWidth: number, sHeight: number, dx: number, dy: number, dWidth: number, dHeight: number): void;\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dWidth The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.\r\n * @param dHeight The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.\r\n */\r\n drawImage(image: any, dx: number, dy: number, dWidth: number, dHeight: number): void;\r\n\r\n /**\r\n * Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in its use.\r\n * @param image An element to draw into the context.\r\n * @param dx The x-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n * @param dy The y-axis coordinate in the destination canvas at which to place the top-left corner of the source image.\r\n */\r\n drawImage(image: any, dx: number, dy: number): void;\r\n\r\n /**\r\n * Returns an ImageData object representing the underlying pixel data for the area of the canvas denoted by the rectangle which starts at (sx, sy) and has an sw width and sh height.\r\n * @param sx The x-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.\r\n * @param sy The y-axis coordinate of the top-left corner of the rectangle from which the ImageData will be extracted.\r\n * @param sw The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left.\r\n * @param sh The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up.\r\n * @returns ImageData An ImageData object containing the image data for the rectangle of the canvas specified.\r\n */\r\n getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;\r\n\r\n /**\r\n * Sets the current line dash pattern.\r\n * @param segments An Array of numbers that specify distances to alternately draw a line and a gap (in coordinate space units).\r\n */\r\n setLineDash(segments: Array<number>): void;\r\n\r\n /**\r\n * Draws (fills) a given text at the given (x, y) position.\r\n * @param text A String specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction.\r\n * @param x The x-axis coordinate of the point at which to begin drawing the text, in pixels.\r\n * @param y The y-axis coordinate of the baseline on which to begin drawing the text, in pixels.\r\n * @param maxWidth The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text.\r\n */\r\n fillText(text: string, x: number, y: number, maxWidth?: number): void;\r\n\r\n /**\r\n * Draws (strokes) a given text at the given (x, y) position.\r\n * @param text A String specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction.\r\n * @param x The x-axis coordinate of the point at which to begin drawing the text, in pixels.\r\n * @param y The y-axis coordinate of the baseline on which to begin drawing the text, in pixels.\r\n * @param maxWidth The maximum number of pixels wide the text may be once rendered. If not specified, there is no limit to the width of the text.\r\n */\r\n strokeText(text: string, x: number, y: number, maxWidth?: number): void;\r\n\r\n /**\r\n * Creates a linear gradient along the line given by the coordinates represented by the parameters.\r\n * @param x0 The x-axis coordinate of the start point.\r\n * @param y0 The y-axis coordinate of the start point.\r\n * @param x1 The x-axis coordinate of the end point.\r\n * @param y1 The y-axis coordinate of the end point.\r\n * @returns ICanvasGradient A linear ICanvasGradient initialized with the specified line.\r\n */\r\n createLinearGradient(x0: number, y0: number, x1: number, y1: number): ICanvasGradient;\r\n\r\n /**\r\n * Creates a linear gradient along the line given by the coordinates represented by the parameters.\r\n * @param x0 The x-axis coordinate of the start circle.\r\n * @param y0 The y-axis coordinate of the start circle.\r\n * @param r0 The radius of the start circle. Must be non-negative and finite.\r\n * @param x1 The x-axis coordinate of the end point.\r\n * @param y1 The y-axis coordinate of the end point.\r\n * @param r1 The radius of the end circle. Must be non-negative and finite.\r\n * @returns ICanvasGradient A linear ICanvasGradient initialized with the two specified circles.\r\n */\r\n createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): ICanvasGradient;\r\n\r\n /**\r\n * Resets the current transform to matrix composed with a, b, c, d, e, f.\r\n * @param a Horizontal scaling. A value of 1 results in no scaling.\r\n * @param b Vertical skewing.\r\n * @param c Horizontal skewing.\r\n * @param d Vertical scaling. A value of 1 results in no scaling.\r\n * @param e Horizontal translation (moving).\r\n * @param f Vertical translation (moving).\r\n */\r\n setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;\r\n}\r\n"]}