@babylonjs/viewer 7.25.0 → 7.25.1-alpha

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 (530) hide show
  1. package/dist/babylon-viewer.esm.js +2 -0
  2. package/dist/babylon-viewer.esm.js.map +1 -0
  3. package/dist/babylon-viewer.esm.min.js +2 -0
  4. package/dist/babylon-viewer.esm.min.js.map +1 -0
  5. package/dist/chunks/EXT_lights_image_based-DVT9d5PE.esm.min.js +2 -0
  6. package/dist/chunks/EXT_lights_image_based-DVT9d5PE.esm.min.js.map +1 -0
  7. package/dist/chunks/EXT_lights_image_based-XqDzs68T.esm.js +170 -0
  8. package/dist/chunks/EXT_lights_image_based-XqDzs68T.esm.js.map +1 -0
  9. package/dist/chunks/EXT_mesh_gpu_instancing-BDdwYyny.esm.min.js +2 -0
  10. package/dist/chunks/EXT_mesh_gpu_instancing-BDdwYyny.esm.min.js.map +1 -0
  11. package/dist/chunks/EXT_mesh_gpu_instancing-DhR2UOBn.esm.js +86 -0
  12. package/dist/chunks/EXT_mesh_gpu_instancing-DhR2UOBn.esm.js.map +1 -0
  13. package/dist/chunks/EXT_meshopt_compression-BqFzh0gY.esm.js +134 -0
  14. package/dist/chunks/EXT_meshopt_compression-BqFzh0gY.esm.js.map +1 -0
  15. package/dist/chunks/EXT_meshopt_compression-SfXDvdUM.esm.min.js +2 -0
  16. package/dist/chunks/EXT_meshopt_compression-SfXDvdUM.esm.min.js.map +1 -0
  17. package/dist/chunks/EXT_texture_avif-JBIGyeRc.esm.js +44 -0
  18. package/dist/chunks/EXT_texture_avif-JBIGyeRc.esm.js.map +1 -0
  19. package/dist/chunks/EXT_texture_avif-q1TkH_G9.esm.min.js +2 -0
  20. package/dist/chunks/EXT_texture_avif-q1TkH_G9.esm.min.js.map +1 -0
  21. package/dist/chunks/EXT_texture_webp-B1s3FiRS.esm.js +43 -0
  22. package/dist/chunks/EXT_texture_webp-B1s3FiRS.esm.js.map +1 -0
  23. package/dist/chunks/EXT_texture_webp-BCI9KAUl.esm.min.js +2 -0
  24. package/dist/chunks/EXT_texture_webp-BCI9KAUl.esm.min.js.map +1 -0
  25. package/dist/chunks/ExtrasAsMetadata-BOD2FG8I.esm.min.js +2 -0
  26. package/dist/chunks/ExtrasAsMetadata-BOD2FG8I.esm.min.js.map +1 -0
  27. package/dist/chunks/ExtrasAsMetadata-ByiJUaSt.esm.js +64 -0
  28. package/dist/chunks/ExtrasAsMetadata-ByiJUaSt.esm.js.map +1 -0
  29. package/dist/chunks/KHR_animation_pointer-CNYMXY_w.esm.js +343 -0
  30. package/dist/chunks/KHR_animation_pointer-CNYMXY_w.esm.js.map +1 -0
  31. package/dist/chunks/KHR_animation_pointer-CnLRV_yl.esm.min.js +2 -0
  32. package/dist/chunks/KHR_animation_pointer-CnLRV_yl.esm.min.js.map +1 -0
  33. package/dist/chunks/KHR_draco_mesh_compression-AZ2o_aLj.esm.min.js +2 -0
  34. package/dist/chunks/KHR_draco_mesh_compression-AZ2o_aLj.esm.min.js.map +1 -0
  35. package/dist/chunks/KHR_draco_mesh_compression-DFY2Ctvm.esm.js +610 -0
  36. package/dist/chunks/KHR_draco_mesh_compression-DFY2Ctvm.esm.js.map +1 -0
  37. package/dist/chunks/KHR_interactivity-3PDcMKr_.esm.js +4033 -0
  38. package/dist/chunks/KHR_interactivity-3PDcMKr_.esm.js.map +1 -0
  39. package/dist/chunks/KHR_interactivity-C-cfOaao.esm.min.js +2 -0
  40. package/dist/chunks/KHR_interactivity-C-cfOaao.esm.min.js.map +1 -0
  41. package/dist/chunks/KHR_lights_punctual-DdpvJMDV.esm.js +1253 -0
  42. package/dist/chunks/KHR_lights_punctual-DdpvJMDV.esm.js.map +1 -0
  43. package/dist/chunks/KHR_lights_punctual-fnDFOclN.esm.min.js +2 -0
  44. package/dist/chunks/KHR_lights_punctual-fnDFOclN.esm.min.js.map +1 -0
  45. package/dist/chunks/KHR_materials_anisotropy-Cb6X0k3m.esm.min.js +2 -0
  46. package/dist/chunks/KHR_materials_anisotropy-Cb6X0k3m.esm.min.js.map +1 -0
  47. package/dist/chunks/KHR_materials_anisotropy-gNrsYmJY.esm.js +64 -0
  48. package/dist/chunks/KHR_materials_anisotropy-gNrsYmJY.esm.js.map +1 -0
  49. package/dist/chunks/KHR_materials_clearcoat-U2HUz3WB.esm.js +96 -0
  50. package/dist/chunks/KHR_materials_clearcoat-U2HUz3WB.esm.js.map +1 -0
  51. package/dist/chunks/KHR_materials_clearcoat-joUz7tSd.esm.min.js +2 -0
  52. package/dist/chunks/KHR_materials_clearcoat-joUz7tSd.esm.min.js.map +1 -0
  53. package/dist/chunks/KHR_materials_diffuse_transmission-Cm1IFxmL.esm.min.js +2 -0
  54. package/dist/chunks/KHR_materials_diffuse_transmission-Cm1IFxmL.esm.min.js.map +1 -0
  55. package/dist/chunks/KHR_materials_diffuse_transmission-Cn5gk-q_.esm.js +97 -0
  56. package/dist/chunks/KHR_materials_diffuse_transmission-Cn5gk-q_.esm.js.map +1 -0
  57. package/dist/chunks/KHR_materials_dispersion-Cpc2ME1B.esm.js +62 -0
  58. package/dist/chunks/KHR_materials_dispersion-Cpc2ME1B.esm.js.map +1 -0
  59. package/dist/chunks/KHR_materials_dispersion-Cv7zIL7j.esm.min.js +2 -0
  60. package/dist/chunks/KHR_materials_dispersion-Cv7zIL7j.esm.min.js.map +1 -0
  61. package/dist/chunks/KHR_materials_emissive_strength-BYxJ1Qaz.esm.js +55 -0
  62. package/dist/chunks/KHR_materials_emissive_strength-BYxJ1Qaz.esm.js.map +1 -0
  63. package/dist/chunks/KHR_materials_emissive_strength-DBEC-Pfr.esm.min.js +2 -0
  64. package/dist/chunks/KHR_materials_emissive_strength-DBEC-Pfr.esm.min.js.map +1 -0
  65. package/dist/chunks/KHR_materials_ior-B4HgptNe.esm.min.js +2 -0
  66. package/dist/chunks/KHR_materials_ior-B4HgptNe.esm.min.js.map +1 -0
  67. package/dist/chunks/KHR_materials_ior-CDtowU9f.esm.js +64 -0
  68. package/dist/chunks/KHR_materials_ior-CDtowU9f.esm.js.map +1 -0
  69. package/dist/chunks/KHR_materials_iridescence-CgkruUTk.esm.min.js +2 -0
  70. package/dist/chunks/KHR_materials_iridescence-CgkruUTk.esm.min.js.map +1 -0
  71. package/dist/chunks/KHR_materials_iridescence-CqmvyPW8.esm.js +72 -0
  72. package/dist/chunks/KHR_materials_iridescence-CqmvyPW8.esm.js.map +1 -0
  73. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-BQV0asO5.esm.js +81 -0
  74. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-BQV0asO5.esm.js.map +1 -0
  75. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-Bv4SCrwb.esm.min.js +2 -0
  76. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-Bv4SCrwb.esm.min.js.map +1 -0
  77. package/dist/chunks/KHR_materials_sheen-BQM2Rjmq.esm.js +85 -0
  78. package/dist/chunks/KHR_materials_sheen-BQM2Rjmq.esm.js.map +1 -0
  79. package/dist/chunks/KHR_materials_sheen-DV5CnbK2.esm.min.js +2 -0
  80. package/dist/chunks/KHR_materials_sheen-DV5CnbK2.esm.min.js.map +1 -0
  81. package/dist/chunks/KHR_materials_specular-4xCkE2rV.esm.js +75 -0
  82. package/dist/chunks/KHR_materials_specular-4xCkE2rV.esm.js.map +1 -0
  83. package/dist/chunks/KHR_materials_specular-CoAFRAcm.esm.min.js +2 -0
  84. package/dist/chunks/KHR_materials_specular-CoAFRAcm.esm.min.js.map +1 -0
  85. package/dist/chunks/KHR_materials_transmission-DUGtSvRL.esm.js +307 -0
  86. package/dist/chunks/KHR_materials_transmission-DUGtSvRL.esm.js.map +1 -0
  87. package/dist/chunks/KHR_materials_transmission-dc1ndoxL.esm.min.js +2 -0
  88. package/dist/chunks/KHR_materials_transmission-dc1ndoxL.esm.min.js.map +1 -0
  89. package/dist/chunks/KHR_materials_unlit-BNXbHdvw.esm.js +74 -0
  90. package/dist/chunks/KHR_materials_unlit-BNXbHdvw.esm.js.map +1 -0
  91. package/dist/chunks/KHR_materials_unlit-D9MVjMTN.esm.min.js +2 -0
  92. package/dist/chunks/KHR_materials_unlit-D9MVjMTN.esm.min.js.map +1 -0
  93. package/dist/chunks/KHR_materials_variants-CBW9J72v.esm.min.js +2 -0
  94. package/dist/chunks/KHR_materials_variants-CBW9J72v.esm.min.js.map +1 -0
  95. package/dist/chunks/KHR_materials_variants-Dkur-XMA.esm.js +238 -0
  96. package/dist/chunks/KHR_materials_variants-Dkur-XMA.esm.js.map +1 -0
  97. package/dist/chunks/KHR_materials_volume-BSWwp0PI.esm.js +87 -0
  98. package/dist/chunks/KHR_materials_volume-BSWwp0PI.esm.js.map +1 -0
  99. package/dist/chunks/KHR_materials_volume-uEEN0xx9.esm.min.js +2 -0
  100. package/dist/chunks/KHR_materials_volume-uEEN0xx9.esm.min.js.map +1 -0
  101. package/dist/chunks/KHR_mesh_quantization--7YAD1i9.esm.js +26 -0
  102. package/dist/chunks/KHR_mesh_quantization--7YAD1i9.esm.js.map +1 -0
  103. package/dist/chunks/KHR_mesh_quantization-D48i0ooq.esm.min.js +2 -0
  104. package/dist/chunks/KHR_mesh_quantization-D48i0ooq.esm.min.js.map +1 -0
  105. package/dist/chunks/KHR_texture_basisu-CJHQOtEz.esm.min.js +2 -0
  106. package/dist/chunks/KHR_texture_basisu-CJHQOtEz.esm.min.js.map +1 -0
  107. package/dist/chunks/KHR_texture_basisu-CZJ-szw2.esm.js +43 -0
  108. package/dist/chunks/KHR_texture_basisu-CZJ-szw2.esm.js.map +1 -0
  109. package/dist/chunks/KHR_texture_transform-CCGZOtJG.esm.js +63 -0
  110. package/dist/chunks/KHR_texture_transform-CCGZOtJG.esm.js.map +1 -0
  111. package/dist/chunks/KHR_texture_transform-Cz_tYWj9.esm.min.js +2 -0
  112. package/dist/chunks/KHR_texture_transform-Cz_tYWj9.esm.min.js.map +1 -0
  113. package/dist/chunks/KHR_xmp_json_ld-BWhXh4yX.esm.min.js +2 -0
  114. package/dist/chunks/KHR_xmp_json_ld-BWhXh4yX.esm.min.js.map +1 -0
  115. package/dist/chunks/KHR_xmp_json_ld-D8vGUblu.esm.js +51 -0
  116. package/dist/chunks/KHR_xmp_json_ld-D8vGUblu.esm.js.map +1 -0
  117. package/dist/chunks/MSFT_audio_emitter-CABqee9Z.esm.min.js +2 -0
  118. package/dist/chunks/MSFT_audio_emitter-CABqee9Z.esm.min.js.map +1 -0
  119. package/dist/chunks/MSFT_audio_emitter-CupxtNMJ.esm.js +2236 -0
  120. package/dist/chunks/MSFT_audio_emitter-CupxtNMJ.esm.js.map +1 -0
  121. package/dist/chunks/MSFT_lod-BZ6xhN71.esm.min.js +2 -0
  122. package/dist/chunks/MSFT_lod-BZ6xhN71.esm.min.js.map +1 -0
  123. package/dist/chunks/MSFT_lod-D6-TVSnT.esm.js +337 -0
  124. package/dist/chunks/MSFT_lod-D6-TVSnT.esm.js.map +1 -0
  125. package/dist/chunks/MSFT_minecraftMesh-DXKcYd7c.esm.js +46 -0
  126. package/dist/chunks/MSFT_minecraftMesh-DXKcYd7c.esm.js.map +1 -0
  127. package/dist/chunks/MSFT_minecraftMesh-jQGuk0z2.esm.min.js +2 -0
  128. package/dist/chunks/MSFT_minecraftMesh-jQGuk0z2.esm.min.js.map +1 -0
  129. package/dist/chunks/MSFT_sRGBFactors-CMIEJuDa.esm.min.js +2 -0
  130. package/dist/chunks/MSFT_sRGBFactors-CMIEJuDa.esm.min.js.map +1 -0
  131. package/dist/chunks/MSFT_sRGBFactors-D1di9DYd.esm.js +47 -0
  132. package/dist/chunks/MSFT_sRGBFactors-D1di9DYd.esm.js.map +1 -0
  133. package/dist/chunks/assetContainer-B4RZAzKO.esm.min.js +2 -0
  134. package/dist/chunks/assetContainer-B4RZAzKO.esm.min.js.map +1 -0
  135. package/dist/chunks/assetContainer-B_DdybqS.esm.js +1598 -0
  136. package/dist/chunks/assetContainer-B_DdybqS.esm.js.map +1 -0
  137. package/dist/chunks/audioEngine-BNEDnVbO.esm.min.js +2 -0
  138. package/dist/chunks/audioEngine-BNEDnVbO.esm.min.js.map +1 -0
  139. package/dist/chunks/audioEngine-CICNJdfP.esm.js +305 -0
  140. package/dist/chunks/audioEngine-CICNJdfP.esm.js.map +1 -0
  141. package/dist/chunks/basisTextureLoader-B_8qIBcv.esm.js +600 -0
  142. package/dist/chunks/basisTextureLoader-B_8qIBcv.esm.js.map +1 -0
  143. package/dist/chunks/basisTextureLoader-qwPrmlI1.esm.min.js +2 -0
  144. package/dist/chunks/basisTextureLoader-qwPrmlI1.esm.min.js.map +1 -0
  145. package/dist/chunks/ddsTextureLoader-Caj9Cn2g.esm.min.js +2 -0
  146. package/dist/chunks/ddsTextureLoader-Caj9Cn2g.esm.min.js.map +1 -0
  147. package/dist/chunks/ddsTextureLoader-Dtde5Y_E.esm.js +87 -0
  148. package/dist/chunks/ddsTextureLoader-Dtde5Y_E.esm.js.map +1 -0
  149. package/dist/chunks/default.fragment-3-A6Ds5q.esm.js +456 -0
  150. package/dist/chunks/default.fragment-3-A6Ds5q.esm.js.map +1 -0
  151. package/dist/chunks/default.fragment-CK_5aPIO.esm.js +515 -0
  152. package/dist/chunks/default.fragment-CK_5aPIO.esm.js.map +1 -0
  153. package/dist/chunks/default.fragment-CW6M2CvG.esm.min.js +2 -0
  154. package/dist/chunks/default.fragment-CW6M2CvG.esm.min.js.map +1 -0
  155. package/dist/chunks/default.fragment-D8IeeUuR.esm.min.js +2 -0
  156. package/dist/chunks/default.fragment-D8IeeUuR.esm.min.js.map +1 -0
  157. package/dist/chunks/default.vertex-BnmEG9Z3.esm.js +178 -0
  158. package/dist/chunks/default.vertex-BnmEG9Z3.esm.js.map +1 -0
  159. package/dist/chunks/default.vertex-CByxmCU_.esm.min.js +2 -0
  160. package/dist/chunks/default.vertex-CByxmCU_.esm.min.js.map +1 -0
  161. package/dist/chunks/default.vertex-CKXtUMTv.esm.min.js +2 -0
  162. package/dist/chunks/default.vertex-CKXtUMTv.esm.min.js.map +1 -0
  163. package/dist/chunks/default.vertex-D5kQBg6V.esm.js +199 -0
  164. package/dist/chunks/default.vertex-D5kQBg6V.esm.js.map +1 -0
  165. package/dist/chunks/defaultUboDeclaration-AgU83OaK.esm.min.js +2 -0
  166. package/dist/chunks/defaultUboDeclaration-AgU83OaK.esm.min.js.map +1 -0
  167. package/dist/chunks/defaultUboDeclaration-BTsCVlsd.esm.min.js +2 -0
  168. package/dist/chunks/defaultUboDeclaration-BTsCVlsd.esm.min.js.map +1 -0
  169. package/dist/chunks/defaultUboDeclaration-bGo0gkae.esm.js +15 -0
  170. package/dist/chunks/defaultUboDeclaration-bGo0gkae.esm.js.map +1 -0
  171. package/dist/chunks/defaultUboDeclaration-pi1Tffi-.esm.js +13 -0
  172. package/dist/chunks/defaultUboDeclaration-pi1Tffi-.esm.js.map +1 -0
  173. package/dist/chunks/engine-DDK673Fr.esm.js +1613 -0
  174. package/dist/chunks/engine-DDK673Fr.esm.js.map +1 -0
  175. package/dist/chunks/engine-DdeN2F9N.esm.min.js +2 -0
  176. package/dist/chunks/engine-DdeN2F9N.esm.min.js.map +1 -0
  177. package/dist/chunks/envTextureLoader-B_We3UAe.esm.min.js +2 -0
  178. package/dist/chunks/envTextureLoader-B_We3UAe.esm.min.js.map +1 -0
  179. package/dist/chunks/envTextureLoader-DeYk_D-u.esm.js +63 -0
  180. package/dist/chunks/envTextureLoader-DeYk_D-u.esm.js.map +1 -0
  181. package/dist/chunks/environmentTextureTools-DT_BQR6L.esm.min.js +2 -0
  182. package/dist/chunks/environmentTextureTools-DT_BQR6L.esm.min.js.map +1 -0
  183. package/dist/chunks/environmentTextureTools-DZ4GOzAY.esm.js +381 -0
  184. package/dist/chunks/environmentTextureTools-DZ4GOzAY.esm.js.map +1 -0
  185. package/dist/chunks/exrTextureLoader-BPFaquLu.esm.min.js +2 -0
  186. package/dist/chunks/exrTextureLoader-BPFaquLu.esm.min.js.map +1 -0
  187. package/dist/chunks/exrTextureLoader-DFfYDSvx.esm.js +1682 -0
  188. package/dist/chunks/exrTextureLoader-DFfYDSvx.esm.js.map +1 -0
  189. package/dist/chunks/fogFragment-ChBeVMbL.esm.min.js +2 -0
  190. package/dist/chunks/fogFragment-ChBeVMbL.esm.min.js.map +1 -0
  191. package/dist/chunks/fogFragment-CnlQ05Rn.esm.js +102 -0
  192. package/dist/chunks/fogFragment-CnlQ05Rn.esm.js.map +1 -0
  193. package/dist/chunks/glTFLoader-CfuuZdCb.esm.js +7552 -0
  194. package/dist/chunks/glTFLoader-CfuuZdCb.esm.js.map +1 -0
  195. package/dist/chunks/glTFLoader-DOyVt9PU.esm.min.js +2 -0
  196. package/dist/chunks/glTFLoader-DOyVt9PU.esm.min.js.map +1 -0
  197. package/dist/chunks/glTFLoaderAnimation-28_L-pzh.esm.js +77 -0
  198. package/dist/chunks/glTFLoaderAnimation-28_L-pzh.esm.js.map +1 -0
  199. package/dist/chunks/glTFLoaderAnimation-Cueukaay.esm.min.js +2 -0
  200. package/dist/chunks/glTFLoaderAnimation-Cueukaay.esm.min.js.map +1 -0
  201. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js +2 -0
  202. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js.map +1 -0
  203. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js +67 -0
  204. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js.map +1 -0
  205. package/dist/chunks/harmonicsFunctions-5m2TqpP7.esm.js +34 -0
  206. package/dist/chunks/harmonicsFunctions-5m2TqpP7.esm.js.map +1 -0
  207. package/dist/chunks/harmonicsFunctions-CZvW5nS2.esm.min.js +2 -0
  208. package/dist/chunks/harmonicsFunctions-CZvW5nS2.esm.min.js.map +1 -0
  209. package/dist/chunks/harmonicsFunctions-FoyoVJjx.esm.js +35 -0
  210. package/dist/chunks/harmonicsFunctions-FoyoVJjx.esm.js.map +1 -0
  211. package/dist/chunks/harmonicsFunctions-LPFcAay5.esm.min.js +2 -0
  212. package/dist/chunks/harmonicsFunctions-LPFcAay5.esm.min.js.map +1 -0
  213. package/dist/chunks/hdrTextureLoader-BF58jeD4.esm.min.js +2 -0
  214. package/dist/chunks/hdrTextureLoader-BF58jeD4.esm.min.js.map +1 -0
  215. package/dist/chunks/hdrTextureLoader-CnAlxQ46.esm.js +252 -0
  216. package/dist/chunks/hdrTextureLoader-CnAlxQ46.esm.js.map +1 -0
  217. package/dist/chunks/helperFunctions-BHi3ZDnH.esm.js +80 -0
  218. package/dist/chunks/helperFunctions-BHi3ZDnH.esm.js.map +1 -0
  219. package/dist/chunks/helperFunctions-D9QX7d8q.esm.min.js +2 -0
  220. package/dist/chunks/helperFunctions-D9QX7d8q.esm.min.js.map +1 -0
  221. package/dist/chunks/helperFunctions-bapbKVVS.esm.js +108 -0
  222. package/dist/chunks/helperFunctions-bapbKVVS.esm.js.map +1 -0
  223. package/dist/chunks/helperFunctions-hh2B4qDl.esm.min.js +2 -0
  224. package/dist/chunks/helperFunctions-hh2B4qDl.esm.min.js.map +1 -0
  225. package/dist/chunks/index-4QQveomY.esm.js +79813 -0
  226. package/dist/chunks/index-4QQveomY.esm.js.map +1 -0
  227. package/dist/chunks/index-D5606AHu.esm.min.js +57 -0
  228. package/dist/chunks/index-D5606AHu.esm.min.js.map +1 -0
  229. package/dist/chunks/ktxTextureLoader-CxAMFjnh.esm.js +814 -0
  230. package/dist/chunks/ktxTextureLoader-CxAMFjnh.esm.js.map +1 -0
  231. package/dist/chunks/ktxTextureLoader-s0dUXnt8.esm.min.js +2 -0
  232. package/dist/chunks/ktxTextureLoader-s0dUXnt8.esm.min.js.map +1 -0
  233. package/dist/chunks/logDepthDeclaration-BcnqcXJe.esm.js +35 -0
  234. package/dist/chunks/logDepthDeclaration-BcnqcXJe.esm.js.map +1 -0
  235. package/dist/chunks/logDepthDeclaration-CvXtMvcM.esm.js +42 -0
  236. package/dist/chunks/logDepthDeclaration-CvXtMvcM.esm.js.map +1 -0
  237. package/dist/chunks/logDepthDeclaration-cPWsL3PG.esm.min.js +2 -0
  238. package/dist/chunks/logDepthDeclaration-cPWsL3PG.esm.min.js.map +1 -0
  239. package/dist/chunks/logDepthDeclaration-unowpoZK.esm.min.js +2 -0
  240. package/dist/chunks/logDepthDeclaration-unowpoZK.esm.min.js.map +1 -0
  241. package/dist/chunks/logDepthVertex-BrvDYbCP.esm.min.js +2 -0
  242. package/dist/chunks/logDepthVertex-BrvDYbCP.esm.min.js.map +1 -0
  243. package/dist/chunks/logDepthVertex-CUUB4BTI.esm.js +605 -0
  244. package/dist/chunks/logDepthVertex-CUUB4BTI.esm.js.map +1 -0
  245. package/dist/chunks/logDepthVertex-DaNvEIGn.esm.min.js +2 -0
  246. package/dist/chunks/logDepthVertex-DaNvEIGn.esm.min.js.map +1 -0
  247. package/dist/chunks/logDepthVertex-foN2jGvJ.esm.js +77 -0
  248. package/dist/chunks/logDepthVertex-foN2jGvJ.esm.js.map +1 -0
  249. package/dist/chunks/mainUVVaryingDeclaration-DHTqc_aH.esm.js +11 -0
  250. package/dist/chunks/mainUVVaryingDeclaration-DHTqc_aH.esm.js.map +1 -0
  251. package/dist/chunks/mainUVVaryingDeclaration-PFUWfv7o.esm.min.js +2 -0
  252. package/dist/chunks/mainUVVaryingDeclaration-PFUWfv7o.esm.min.js.map +1 -0
  253. package/dist/chunks/objFileLoader-B-uLP26U.esm.min.js +2 -0
  254. package/dist/chunks/objFileLoader-B-uLP26U.esm.min.js.map +1 -0
  255. package/dist/chunks/objFileLoader-Bl2Pzv0o.esm.js +1280 -0
  256. package/dist/chunks/objFileLoader-Bl2Pzv0o.esm.js.map +1 -0
  257. package/dist/chunks/oitFragment-CZShr04f.esm.min.js +2 -0
  258. package/dist/chunks/oitFragment-CZShr04f.esm.min.js.map +1 -0
  259. package/dist/chunks/oitFragment-D3c3Lp9a.esm.js +1210 -0
  260. package/dist/chunks/oitFragment-D3c3Lp9a.esm.js.map +1 -0
  261. package/dist/chunks/oitFragment-D6uOdl_0.esm.min.js +2 -0
  262. package/dist/chunks/oitFragment-D6uOdl_0.esm.min.js.map +1 -0
  263. package/dist/chunks/oitFragment-E27tpA6b.esm.js +1166 -0
  264. package/dist/chunks/oitFragment-E27tpA6b.esm.js.map +1 -0
  265. package/dist/chunks/pass.fragment-CGX8gTNY.esm.js +15 -0
  266. package/dist/chunks/pass.fragment-CGX8gTNY.esm.js.map +1 -0
  267. package/dist/chunks/pass.fragment-DKqeYsmS.esm.min.js +2 -0
  268. package/dist/chunks/pass.fragment-DKqeYsmS.esm.min.js.map +1 -0
  269. package/dist/chunks/pbr.fragment-5XRl6pKm.esm.min.js +2 -0
  270. package/dist/chunks/pbr.fragment-5XRl6pKm.esm.min.js.map +1 -0
  271. package/dist/chunks/pbr.fragment-Cfsv9tFG.esm.js +3172 -0
  272. package/dist/chunks/pbr.fragment-Cfsv9tFG.esm.js.map +1 -0
  273. package/dist/chunks/pbr.fragment-DGBodARG.esm.min.js +2 -0
  274. package/dist/chunks/pbr.fragment-DGBodARG.esm.min.js.map +1 -0
  275. package/dist/chunks/pbr.fragment-IMDXwBnG.esm.js +3228 -0
  276. package/dist/chunks/pbr.fragment-IMDXwBnG.esm.js.map +1 -0
  277. package/dist/chunks/pbr.vertex-B3JKAxfl.esm.min.js +2 -0
  278. package/dist/chunks/pbr.vertex-B3JKAxfl.esm.min.js.map +1 -0
  279. package/dist/chunks/pbr.vertex-CZIasM0q.esm.js +335 -0
  280. package/dist/chunks/pbr.vertex-CZIasM0q.esm.js.map +1 -0
  281. package/dist/chunks/pbr.vertex-CjU0MUM9.esm.min.js +2 -0
  282. package/dist/chunks/pbr.vertex-CjU0MUM9.esm.min.js.map +1 -0
  283. package/dist/chunks/pbr.vertex-h6JyEpaS.esm.js +208 -0
  284. package/dist/chunks/pbr.vertex-h6JyEpaS.esm.js.map +1 -0
  285. package/dist/chunks/postprocess.vertex-B0ei94Dw.esm.min.js +2 -0
  286. package/dist/chunks/postprocess.vertex-B0ei94Dw.esm.min.js.map +1 -0
  287. package/dist/chunks/postprocess.vertex-r5NscKzh.esm.js +20 -0
  288. package/dist/chunks/postprocess.vertex-r5NscKzh.esm.js.map +1 -0
  289. package/dist/chunks/rawTexture-Bmw0auoS.esm.min.js +2 -0
  290. package/dist/chunks/rawTexture-Bmw0auoS.esm.min.js.map +1 -0
  291. package/dist/chunks/rawTexture-CpYqstLv.esm.js +562 -0
  292. package/dist/chunks/rawTexture-CpYqstLv.esm.js.map +1 -0
  293. package/dist/chunks/rgbdDecode.fragment-BBOPxYJO.esm.min.js +2 -0
  294. package/dist/chunks/rgbdDecode.fragment-BBOPxYJO.esm.min.js.map +1 -0
  295. package/dist/chunks/rgbdDecode.fragment-C1mQs3ed.esm.js +17 -0
  296. package/dist/chunks/rgbdDecode.fragment-C1mQs3ed.esm.js.map +1 -0
  297. package/dist/chunks/rgbdDecode.fragment-CaqsSeIW.esm.min.js +2 -0
  298. package/dist/chunks/rgbdDecode.fragment-CaqsSeIW.esm.min.js.map +1 -0
  299. package/dist/chunks/rgbdDecode.fragment-MPQ7knvL.esm.js +17 -0
  300. package/dist/chunks/rgbdDecode.fragment-MPQ7knvL.esm.js.map +1 -0
  301. package/dist/chunks/rgbdEncode.fragment-6EdQiINi.esm.min.js +2 -0
  302. package/dist/chunks/rgbdEncode.fragment-6EdQiINi.esm.min.js.map +1 -0
  303. package/dist/chunks/rgbdEncode.fragment-C-msuzIz.esm.min.js +2 -0
  304. package/dist/chunks/rgbdEncode.fragment-C-msuzIz.esm.min.js.map +1 -0
  305. package/dist/chunks/rgbdEncode.fragment-Wd9cTDxy.esm.js +17 -0
  306. package/dist/chunks/rgbdEncode.fragment-Wd9cTDxy.esm.js.map +1 -0
  307. package/dist/chunks/rgbdEncode.fragment-X-RqQAkc.esm.js +17 -0
  308. package/dist/chunks/rgbdEncode.fragment-X-RqQAkc.esm.js.map +1 -0
  309. package/dist/chunks/splatFileLoader-DQ9jOQE9.esm.min.js +2 -0
  310. package/dist/chunks/splatFileLoader-DQ9jOQE9.esm.min.js.map +1 -0
  311. package/dist/chunks/splatFileLoader-hdSfXVdE.esm.js +3154 -0
  312. package/dist/chunks/splatFileLoader-hdSfXVdE.esm.js.map +1 -0
  313. package/dist/chunks/standardMaterial-Cq-J9fif.esm.min.js +2 -0
  314. package/dist/chunks/standardMaterial-Cq-J9fif.esm.min.js.map +1 -0
  315. package/dist/chunks/standardMaterial-GIGkmsd2.esm.js +1809 -0
  316. package/dist/chunks/standardMaterial-GIGkmsd2.esm.js.map +1 -0
  317. package/dist/chunks/stlFileLoader--AN8pgtb.esm.min.js +2 -0
  318. package/dist/chunks/stlFileLoader--AN8pgtb.esm.min.js.map +1 -0
  319. package/dist/chunks/stlFileLoader-BjJ0Yz5v.esm.js +237 -0
  320. package/dist/chunks/stlFileLoader-BjJ0Yz5v.esm.js.map +1 -0
  321. package/dist/chunks/tgaTextureLoader-B3gQ-Dwh.esm.min.js +2 -0
  322. package/dist/chunks/tgaTextureLoader-B3gQ-Dwh.esm.min.js.map +1 -0
  323. package/dist/chunks/tgaTextureLoader-BmEYbSF8.esm.js +349 -0
  324. package/dist/chunks/tgaTextureLoader-BmEYbSF8.esm.js.map +1 -0
  325. package/dist/chunks/thinInstanceMesh-DLE1cPa9.esm.js +314 -0
  326. package/dist/chunks/thinInstanceMesh-DLE1cPa9.esm.js.map +1 -0
  327. package/dist/chunks/thinInstanceMesh-DgJgeFTD.esm.min.js +2 -0
  328. package/dist/chunks/thinInstanceMesh-DgJgeFTD.esm.min.js.map +1 -0
  329. package/dist/chunks/vertexColorMixing-Dn7oXj03.esm.js +528 -0
  330. package/dist/chunks/vertexColorMixing-Dn7oXj03.esm.js.map +1 -0
  331. package/dist/chunks/vertexColorMixing-cD_XcjBD.esm.min.js +2 -0
  332. package/dist/chunks/vertexColorMixing-cD_XcjBD.esm.min.js.map +1 -0
  333. package/dist/chunks/workerPool-BUOov2K1.esm.js +122 -0
  334. package/dist/chunks/workerPool-BUOov2K1.esm.js.map +1 -0
  335. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js +2 -0
  336. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js.map +1 -0
  337. package/lib/index.d.ts +275 -0
  338. package/lib/index.js +942 -0
  339. package/lib/index.js.map +1 -0
  340. package/package.json +17 -27
  341. package/readme.md +35 -21
  342. package/configuration/configuration.d.ts +0 -107
  343. package/configuration/configuration.js +0 -16
  344. package/configuration/configuration.js.map +0 -1
  345. package/configuration/configurationCompatibility.d.ts +0 -8
  346. package/configuration/configurationCompatibility.js +0 -66
  347. package/configuration/configurationCompatibility.js.map +0 -1
  348. package/configuration/configurationContainer.d.ts +0 -10
  349. package/configuration/configurationContainer.js +0 -10
  350. package/configuration/configurationContainer.js.map +0 -1
  351. package/configuration/globals.d.ts +0 -6
  352. package/configuration/globals.js +0 -18
  353. package/configuration/globals.js.map +0 -1
  354. package/configuration/index.d.ts +0 -2
  355. package/configuration/index.js +0 -4
  356. package/configuration/index.js.map +0 -1
  357. package/configuration/interfaces/cameraConfiguration.d.ts +0 -31
  358. package/configuration/interfaces/cameraConfiguration.js +0 -2
  359. package/configuration/interfaces/cameraConfiguration.js.map +0 -1
  360. package/configuration/interfaces/colorGradingConfiguration.d.ts +0 -81
  361. package/configuration/interfaces/colorGradingConfiguration.js +0 -2
  362. package/configuration/interfaces/colorGradingConfiguration.js.map +0 -1
  363. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +0 -20
  364. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +0 -2
  365. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +0 -1
  366. package/configuration/interfaces/environmentMapConfiguration.d.ts +0 -22
  367. package/configuration/interfaces/environmentMapConfiguration.js +0 -2
  368. package/configuration/interfaces/environmentMapConfiguration.js.map +0 -1
  369. package/configuration/interfaces/groundConfiguration.d.ts +0 -24
  370. package/configuration/interfaces/groundConfiguration.js +0 -2
  371. package/configuration/interfaces/groundConfiguration.js.map +0 -1
  372. package/configuration/interfaces/imageProcessingConfiguration.d.ts +0 -45
  373. package/configuration/interfaces/imageProcessingConfiguration.js +0 -2
  374. package/configuration/interfaces/imageProcessingConfiguration.js.map +0 -1
  375. package/configuration/interfaces/index.d.ts +0 -15
  376. package/configuration/interfaces/index.js +0 -16
  377. package/configuration/interfaces/index.js.map +0 -1
  378. package/configuration/interfaces/lightConfiguration.d.ts +0 -60
  379. package/configuration/interfaces/lightConfiguration.js +0 -2
  380. package/configuration/interfaces/lightConfiguration.js.map +0 -1
  381. package/configuration/interfaces/modelAnimationConfiguration.d.ts +0 -26
  382. package/configuration/interfaces/modelAnimationConfiguration.js +0 -2
  383. package/configuration/interfaces/modelAnimationConfiguration.js.map +0 -1
  384. package/configuration/interfaces/modelConfiguration.d.ts +0 -65
  385. package/configuration/interfaces/modelConfiguration.js +0 -2
  386. package/configuration/interfaces/modelConfiguration.js.map +0 -1
  387. package/configuration/interfaces/observersConfiguration.d.ts +0 -5
  388. package/configuration/interfaces/observersConfiguration.js +0 -2
  389. package/configuration/interfaces/observersConfiguration.js.map +0 -1
  390. package/configuration/interfaces/sceneConfiguration.d.ts +0 -48
  391. package/configuration/interfaces/sceneConfiguration.js +0 -2
  392. package/configuration/interfaces/sceneConfiguration.js.map +0 -1
  393. package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +0 -23
  394. package/configuration/interfaces/sceneOptimizerConfiguration.js +0 -2
  395. package/configuration/interfaces/sceneOptimizerConfiguration.js.map +0 -1
  396. package/configuration/interfaces/skyboxConfiguration.d.ts +0 -21
  397. package/configuration/interfaces/skyboxConfiguration.js +0 -2
  398. package/configuration/interfaces/skyboxConfiguration.js.map +0 -1
  399. package/configuration/interfaces/templateConfiguration.d.ts +0 -67
  400. package/configuration/interfaces/templateConfiguration.js +0 -2
  401. package/configuration/interfaces/templateConfiguration.js.map +0 -1
  402. package/configuration/interfaces/vrConfiguration.d.ts +0 -16
  403. package/configuration/interfaces/vrConfiguration.js +0 -2
  404. package/configuration/interfaces/vrConfiguration.js.map +0 -1
  405. package/configuration/loader.d.ts +0 -4
  406. package/configuration/loader.js +0 -17
  407. package/configuration/loader.js.map +0 -1
  408. package/configuration/mappers.d.ts +0 -43
  409. package/configuration/mappers.js +0 -192
  410. package/configuration/mappers.js.map +0 -1
  411. package/configuration/renderOnlyLoader.d.ts +0 -33
  412. package/configuration/renderOnlyLoader.js +0 -162
  413. package/configuration/renderOnlyLoader.js.map +0 -1
  414. package/configuration/types/default.d.ts +0 -6
  415. package/configuration/types/default.js +0 -121
  416. package/configuration/types/default.js.map +0 -1
  417. package/configuration/types/environmentMap.d.ts +0 -5
  418. package/configuration/types/environmentMap.js +0 -14
  419. package/configuration/types/environmentMap.js.map +0 -1
  420. package/configuration/types/extended.d.ts +0 -6
  421. package/configuration/types/extended.js +0 -317
  422. package/configuration/types/extended.js.map +0 -1
  423. package/configuration/types/index.d.ts +0 -14
  424. package/configuration/types/index.js +0 -51
  425. package/configuration/types/index.js.map +0 -1
  426. package/configuration/types/minimal.d.ts +0 -6
  427. package/configuration/types/minimal.js +0 -43
  428. package/configuration/types/minimal.js.map +0 -1
  429. package/configuration/types/renderOnlyDefault.d.ts +0 -30
  430. package/configuration/types/renderOnlyDefault.js +0 -31
  431. package/configuration/types/renderOnlyDefault.js.map +0 -1
  432. package/configuration/types/shadowLight.d.ts +0 -9
  433. package/configuration/types/shadowLight.js +0 -64
  434. package/configuration/types/shadowLight.js.map +0 -1
  435. package/helper/index.d.ts +0 -29
  436. package/helper/index.js +0 -66
  437. package/helper/index.js.map +0 -1
  438. package/index.d.ts +0 -30
  439. package/index.js +0 -46
  440. package/index.js.map +0 -1
  441. package/initializer.d.ts +0 -11
  442. package/initializer.js +0 -35
  443. package/initializer.js.map +0 -1
  444. package/interfaces.d.ts +0 -5
  445. package/interfaces.js +0 -7
  446. package/interfaces.js.map +0 -1
  447. package/labs/environmentSerializer.d.ts +0 -126
  448. package/labs/environmentSerializer.js +0 -191
  449. package/labs/environmentSerializer.js.map +0 -1
  450. package/labs/texture.d.ts +0 -183
  451. package/labs/texture.js +0 -350
  452. package/labs/texture.js.map +0 -1
  453. package/labs/viewerLabs.d.ts +0 -51
  454. package/labs/viewerLabs.js +0 -134
  455. package/labs/viewerLabs.js.map +0 -1
  456. package/loader/modelLoader.d.ts +0 -56
  457. package/loader/modelLoader.js +0 -199
  458. package/loader/modelLoader.js.map +0 -1
  459. package/loader/plugins/applyMaterialConfig.d.ts +0 -12
  460. package/loader/plugins/applyMaterialConfig.js +0 -16
  461. package/loader/plugins/applyMaterialConfig.js.map +0 -1
  462. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +0 -9
  463. package/loader/plugins/extendedMaterialLoaderPlugin.js +0 -16
  464. package/loader/plugins/extendedMaterialLoaderPlugin.js.map +0 -1
  465. package/loader/plugins/index.d.ts +0 -19
  466. package/loader/plugins/index.js +0 -44
  467. package/loader/plugins/index.js.map +0 -1
  468. package/loader/plugins/loaderPlugin.d.ts +0 -24
  469. package/loader/plugins/loaderPlugin.js +0 -2
  470. package/loader/plugins/loaderPlugin.js.map +0 -1
  471. package/loader/plugins/msftLodLoaderPlugin.d.ts +0 -12
  472. package/loader/plugins/msftLodLoaderPlugin.js +0 -21
  473. package/loader/plugins/msftLodLoaderPlugin.js.map +0 -1
  474. package/loader/plugins/telemetryLoaderPlugin.d.ts +0 -12
  475. package/loader/plugins/telemetryLoaderPlugin.js +0 -36
  476. package/loader/plugins/telemetryLoaderPlugin.js.map +0 -1
  477. package/managers/observablesManager.d.ts +0 -66
  478. package/managers/observablesManager.js +0 -35
  479. package/managers/observablesManager.js.map +0 -1
  480. package/managers/sceneManager.d.ts +0 -245
  481. package/managers/sceneManager.js +0 -1375
  482. package/managers/sceneManager.js.map +0 -1
  483. package/managers/telemetryManager.d.ts +0 -78
  484. package/managers/telemetryManager.js +0 -117
  485. package/managers/telemetryManager.js.map +0 -1
  486. package/model/modelAnimation.d.ts +0 -215
  487. package/model/modelAnimation.js +0 -237
  488. package/model/modelAnimation.js.map +0 -1
  489. package/model/viewerModel.d.ts +0 -233
  490. package/model/viewerModel.js +0 -673
  491. package/model/viewerModel.js.map +0 -1
  492. package/optimizer/custom/extended.d.ts +0 -13
  493. package/optimizer/custom/extended.js +0 -101
  494. package/optimizer/custom/extended.js.map +0 -1
  495. package/optimizer/custom/index.d.ts +0 -9
  496. package/optimizer/custom/index.js +0 -26
  497. package/optimizer/custom/index.js.map +0 -1
  498. package/renderOnlyIndex.d.ts +0 -11
  499. package/renderOnlyIndex.js +0 -18
  500. package/renderOnlyIndex.js.map +0 -1
  501. package/templating/eventManager.d.ts +0 -35
  502. package/templating/eventManager.js +0 -66
  503. package/templating/eventManager.js.map +0 -1
  504. package/templating/plugins/hdButtonPlugin.d.ts +0 -9
  505. package/templating/plugins/hdButtonPlugin.js +0 -21
  506. package/templating/plugins/hdButtonPlugin.js.map +0 -1
  507. package/templating/plugins/printButton.d.ts +0 -9
  508. package/templating/plugins/printButton.js +0 -40
  509. package/templating/plugins/printButton.js.map +0 -1
  510. package/templating/templateManager.d.ts +0 -197
  511. package/templating/templateManager.js +0 -561
  512. package/templating/templateManager.js.map +0 -1
  513. package/templating/viewerTemplatePlugin.d.ts +0 -21
  514. package/templating/viewerTemplatePlugin.js +0 -69
  515. package/templating/viewerTemplatePlugin.js.map +0 -1
  516. package/viewer/defaultViewer.d.ts +0 -130
  517. package/viewer/defaultViewer.js +0 -675
  518. package/viewer/defaultViewer.js.map +0 -1
  519. package/viewer/renderOnlyViewer.d.ts +0 -9
  520. package/viewer/renderOnlyViewer.js +0 -46
  521. package/viewer/renderOnlyViewer.js.map +0 -1
  522. package/viewer/viewer.d.ts +0 -258
  523. package/viewer/viewer.js +0 -783
  524. package/viewer/viewer.js.map +0 -1
  525. package/viewer/viewerManager.d.ts +0 -58
  526. package/viewer/viewerManager.js +0 -91
  527. package/viewer/viewerManager.js.map +0 -1
  528. package/viewer/viewerWithTemplate.d.ts +0 -9
  529. package/viewer/viewerWithTemplate.js +0 -20
  530. package/viewer/viewerWithTemplate.js.map +0 -1
@@ -0,0 +1,1613 @@
1
+ import { P as PrecisionDate, T as ThinEngine, C as Constants, A as AbstractEngine, I as IsWindowObjectExist, a as IsDocumentAvailable, E as EngineStore, b as PerfCounter, W as WebGLHardwareTexture, c as InternalTexture, L as Logger, d as WebGLDataBuffer } from './index-4QQveomY.esm.js';
2
+ import './audioEngine-CICNJdfP.esm.js';
3
+
4
+ /**
5
+ * Performance monitor tracks rolling average frame-time and frame-time variance over a user defined sliding-window
6
+ */
7
+ class PerformanceMonitor {
8
+ /**
9
+ * constructor
10
+ * @param frameSampleSize The number of samples required to saturate the sliding window
11
+ */
12
+ constructor(frameSampleSize = 30) {
13
+ this._enabled = true;
14
+ this._rollingFrameTime = new RollingAverage(frameSampleSize);
15
+ }
16
+ /**
17
+ * Samples current frame
18
+ * @param timeMs A timestamp in milliseconds of the current frame to compare with other frames
19
+ */
20
+ sampleFrame(timeMs = PrecisionDate.Now) {
21
+ if (!this._enabled) {
22
+ return;
23
+ }
24
+ if (this._lastFrameTimeMs != null) {
25
+ const dt = timeMs - this._lastFrameTimeMs;
26
+ this._rollingFrameTime.add(dt);
27
+ }
28
+ this._lastFrameTimeMs = timeMs;
29
+ }
30
+ /**
31
+ * Returns the average frame time in milliseconds over the sliding window (or the subset of frames sampled so far)
32
+ */
33
+ get averageFrameTime() {
34
+ return this._rollingFrameTime.average;
35
+ }
36
+ /**
37
+ * Returns the variance frame time in milliseconds over the sliding window (or the subset of frames sampled so far)
38
+ */
39
+ get averageFrameTimeVariance() {
40
+ return this._rollingFrameTime.variance;
41
+ }
42
+ /**
43
+ * Returns the frame time of the most recent frame
44
+ */
45
+ get instantaneousFrameTime() {
46
+ return this._rollingFrameTime.history(0);
47
+ }
48
+ /**
49
+ * Returns the average framerate in frames per second over the sliding window (or the subset of frames sampled so far)
50
+ */
51
+ get averageFPS() {
52
+ return 1000.0 / this._rollingFrameTime.average;
53
+ }
54
+ /**
55
+ * Returns the average framerate in frames per second using the most recent frame time
56
+ */
57
+ get instantaneousFPS() {
58
+ const history = this._rollingFrameTime.history(0);
59
+ if (history === 0) {
60
+ return 0;
61
+ }
62
+ return 1000.0 / history;
63
+ }
64
+ /**
65
+ * Returns true if enough samples have been taken to completely fill the sliding window
66
+ */
67
+ get isSaturated() {
68
+ return this._rollingFrameTime.isSaturated();
69
+ }
70
+ /**
71
+ * Enables contributions to the sliding window sample set
72
+ */
73
+ enable() {
74
+ this._enabled = true;
75
+ }
76
+ /**
77
+ * Disables contributions to the sliding window sample set
78
+ * Samples will not be interpolated over the disabled period
79
+ */
80
+ disable() {
81
+ this._enabled = false;
82
+ //clear last sample to avoid interpolating over the disabled period when next enabled
83
+ this._lastFrameTimeMs = null;
84
+ }
85
+ /**
86
+ * Returns true if sampling is enabled
87
+ */
88
+ get isEnabled() {
89
+ return this._enabled;
90
+ }
91
+ /**
92
+ * Resets performance monitor
93
+ */
94
+ reset() {
95
+ //clear last sample to avoid interpolating over the disabled period when next enabled
96
+ this._lastFrameTimeMs = null;
97
+ //wipe record
98
+ this._rollingFrameTime.reset();
99
+ }
100
+ }
101
+ /**
102
+ * RollingAverage
103
+ *
104
+ * Utility to efficiently compute the rolling average and variance over a sliding window of samples
105
+ */
106
+ class RollingAverage {
107
+ /**
108
+ * constructor
109
+ * @param length The number of samples required to saturate the sliding window
110
+ */
111
+ constructor(length) {
112
+ this._samples = new Array(length);
113
+ this.reset();
114
+ }
115
+ /**
116
+ * Adds a sample to the sample set
117
+ * @param v The sample value
118
+ */
119
+ add(v) {
120
+ //http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
121
+ let delta;
122
+ //we need to check if we've already wrapped round
123
+ if (this.isSaturated()) {
124
+ //remove bottom of stack from mean
125
+ const bottomValue = this._samples[this._pos];
126
+ delta = bottomValue - this.average;
127
+ this.average -= delta / (this._sampleCount - 1);
128
+ this._m2 -= delta * (bottomValue - this.average);
129
+ }
130
+ else {
131
+ this._sampleCount++;
132
+ }
133
+ //add new value to mean
134
+ delta = v - this.average;
135
+ this.average += delta / this._sampleCount;
136
+ this._m2 += delta * (v - this.average);
137
+ //set the new variance
138
+ this.variance = this._m2 / (this._sampleCount - 1);
139
+ this._samples[this._pos] = v;
140
+ this._pos++;
141
+ this._pos %= this._samples.length; //positive wrap around
142
+ }
143
+ /**
144
+ * Returns previously added values or null if outside of history or outside the sliding window domain
145
+ * @param i Index in history. For example, pass 0 for the most recent value and 1 for the value before that
146
+ * @returns Value previously recorded with add() or null if outside of range
147
+ */
148
+ history(i) {
149
+ if (i >= this._sampleCount || i >= this._samples.length) {
150
+ return 0;
151
+ }
152
+ const i0 = this._wrapPosition(this._pos - 1.0);
153
+ return this._samples[this._wrapPosition(i0 - i)];
154
+ }
155
+ /**
156
+ * Returns true if enough samples have been taken to completely fill the sliding window
157
+ * @returns true if sample-set saturated
158
+ */
159
+ isSaturated() {
160
+ return this._sampleCount >= this._samples.length;
161
+ }
162
+ /**
163
+ * Resets the rolling average (equivalent to 0 samples taken so far)
164
+ */
165
+ reset() {
166
+ this.average = 0;
167
+ this.variance = 0;
168
+ this._sampleCount = 0;
169
+ this._pos = 0;
170
+ this._m2 = 0;
171
+ }
172
+ /**
173
+ * Wraps a value around the sample range boundaries
174
+ * @param i Position in sample range, for example if the sample length is 5, and i is -3, then 2 will be returned.
175
+ * @returns Wrapped position in sample range
176
+ */
177
+ _wrapPosition(i) {
178
+ const max = this._samples.length;
179
+ return ((i % max) + max) % max;
180
+ }
181
+ }
182
+
183
+ ThinEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange = false) {
184
+ if (this._alphaMode === mode) {
185
+ if (!noDepthWriteChange) {
186
+ // Make sure we still have the correct depth mask according to the alpha mode (a transparent material could have forced writting to the depth buffer, for instance)
187
+ const depthMask = mode === Constants.ALPHA_DISABLE;
188
+ if (this.depthCullingState.depthMask !== depthMask) {
189
+ this.depthCullingState.depthMask = depthMask;
190
+ }
191
+ }
192
+ return;
193
+ }
194
+ switch (mode) {
195
+ case Constants.ALPHA_DISABLE:
196
+ this._alphaState.alphaBlend = false;
197
+ break;
198
+ case Constants.ALPHA_PREMULTIPLIED:
199
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);
200
+ this._alphaState.alphaBlend = true;
201
+ break;
202
+ case Constants.ALPHA_PREMULTIPLIED_PORTERDUFF:
203
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
204
+ this._alphaState.alphaBlend = true;
205
+ break;
206
+ case Constants.ALPHA_COMBINE:
207
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);
208
+ this._alphaState.alphaBlend = true;
209
+ break;
210
+ case Constants.ALPHA_ONEONE:
211
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE);
212
+ this._alphaState.alphaBlend = true;
213
+ break;
214
+ case Constants.ALPHA_ADD:
215
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE);
216
+ this._alphaState.alphaBlend = true;
217
+ break;
218
+ case Constants.ALPHA_SUBTRACT:
219
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);
220
+ this._alphaState.alphaBlend = true;
221
+ break;
222
+ case Constants.ALPHA_MULTIPLY:
223
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE);
224
+ this._alphaState.alphaBlend = true;
225
+ break;
226
+ case Constants.ALPHA_MAXIMIZED:
227
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);
228
+ this._alphaState.alphaBlend = true;
229
+ break;
230
+ case Constants.ALPHA_INTERPOLATE:
231
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR, this._gl.ONE_MINUS_CONSTANT_COLOR, this._gl.CONSTANT_ALPHA, this._gl.ONE_MINUS_CONSTANT_ALPHA);
232
+ this._alphaState.alphaBlend = true;
233
+ break;
234
+ case Constants.ALPHA_SCREENMODE:
235
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
236
+ this._alphaState.alphaBlend = true;
237
+ break;
238
+ case Constants.ALPHA_ONEONE_ONEONE:
239
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ONE);
240
+ this._alphaState.alphaBlend = true;
241
+ break;
242
+ case Constants.ALPHA_ALPHATOCOLOR:
243
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ZERO);
244
+ this._alphaState.alphaBlend = true;
245
+ break;
246
+ case Constants.ALPHA_REVERSEONEMINUS:
247
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE_MINUS_DST_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA);
248
+ this._alphaState.alphaBlend = true;
249
+ break;
250
+ case Constants.ALPHA_SRC_DSTONEMINUSSRCALPHA:
251
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
252
+ this._alphaState.alphaBlend = true;
253
+ break;
254
+ case Constants.ALPHA_ONEONE_ONEZERO:
255
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ZERO);
256
+ this._alphaState.alphaBlend = true;
257
+ break;
258
+ case Constants.ALPHA_EXCLUSION:
259
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ZERO, this._gl.ONE);
260
+ this._alphaState.alphaBlend = true;
261
+ break;
262
+ case Constants.ALPHA_LAYER_ACCUMULATE:
263
+ // Same as ALPHA_COMBINE but accumulates (1 - alpha) values in the alpha channel for a later readout in order independant transparency
264
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
265
+ this._alphaState.alphaBlend = true;
266
+ break;
267
+ }
268
+ if (!noDepthWriteChange) {
269
+ this.depthCullingState.depthMask = mode === Constants.ALPHA_DISABLE;
270
+ }
271
+ this._alphaMode = mode;
272
+ };
273
+
274
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
275
+ ThinEngine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset = 0) {
276
+ // Force cache update
277
+ this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null;
278
+ this.bindIndexBuffer(indexBuffer);
279
+ let view;
280
+ if (indexBuffer.is32Bits) {
281
+ // anything else than Uint32Array needs to be converted to Uint32Array
282
+ view = indices instanceof Uint32Array ? indices : new Uint32Array(indices);
283
+ }
284
+ else {
285
+ // anything else than Uint16Array needs to be converted to Uint16Array
286
+ view = indices instanceof Uint16Array ? indices : new Uint16Array(indices);
287
+ }
288
+ this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, view, this._gl.DYNAMIC_DRAW);
289
+ this._resetIndexBufferBinding();
290
+ };
291
+ ThinEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, data, byteOffset, byteLength) {
292
+ this.bindArrayBuffer(vertexBuffer);
293
+ if (byteOffset === undefined) {
294
+ byteOffset = 0;
295
+ }
296
+ const dataLength = data.byteLength || data.length;
297
+ if (byteLength === undefined || (byteLength >= dataLength && byteOffset === 0)) {
298
+ if (data instanceof Array) {
299
+ this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, new Float32Array(data));
300
+ }
301
+ else {
302
+ this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, data);
303
+ }
304
+ }
305
+ else {
306
+ if (data instanceof Array) {
307
+ this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(data).subarray(byteOffset, byteOffset + byteLength));
308
+ }
309
+ else {
310
+ if (data instanceof ArrayBuffer) {
311
+ data = new Uint8Array(data, byteOffset, byteLength);
312
+ }
313
+ else {
314
+ data = new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);
315
+ }
316
+ this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);
317
+ }
318
+ }
319
+ this._resetVertexBufferBinding();
320
+ };
321
+
322
+ AbstractEngine.prototype.displayLoadingUI = function () {
323
+ if (!IsWindowObjectExist()) {
324
+ return;
325
+ }
326
+ const loadingScreen = this.loadingScreen;
327
+ if (loadingScreen) {
328
+ loadingScreen.displayLoadingUI();
329
+ }
330
+ };
331
+ AbstractEngine.prototype.hideLoadingUI = function () {
332
+ if (!IsWindowObjectExist()) {
333
+ return;
334
+ }
335
+ const loadingScreen = this._loadingScreen;
336
+ if (loadingScreen) {
337
+ loadingScreen.hideLoadingUI();
338
+ }
339
+ };
340
+ Object.defineProperty(AbstractEngine.prototype, "loadingScreen", {
341
+ get: function () {
342
+ if (!this._loadingScreen && this._renderingCanvas) {
343
+ this._loadingScreen = AbstractEngine.DefaultLoadingScreenFactory(this._renderingCanvas);
344
+ }
345
+ return this._loadingScreen;
346
+ },
347
+ set: function (value) {
348
+ this._loadingScreen = value;
349
+ },
350
+ enumerable: true,
351
+ configurable: true,
352
+ });
353
+ Object.defineProperty(AbstractEngine.prototype, "loadingUIText", {
354
+ set: function (value) {
355
+ this.loadingScreen.loadingUIText = value;
356
+ },
357
+ enumerable: true,
358
+ configurable: true,
359
+ });
360
+ Object.defineProperty(AbstractEngine.prototype, "loadingUIBackgroundColor", {
361
+ set: function (value) {
362
+ this.loadingScreen.loadingUIBackgroundColor = value;
363
+ },
364
+ enumerable: true,
365
+ configurable: true,
366
+ });
367
+
368
+ AbstractEngine.prototype.getInputElement = function () {
369
+ return this._renderingCanvas;
370
+ };
371
+ AbstractEngine.prototype.getRenderingCanvasClientRect = function () {
372
+ if (!this._renderingCanvas) {
373
+ return null;
374
+ }
375
+ return this._renderingCanvas.getBoundingClientRect();
376
+ };
377
+ AbstractEngine.prototype.getInputElementClientRect = function () {
378
+ if (!this._renderingCanvas) {
379
+ return null;
380
+ }
381
+ return this.getInputElement().getBoundingClientRect();
382
+ };
383
+ AbstractEngine.prototype.getAspectRatio = function (viewportOwner, useScreen = false) {
384
+ const viewport = viewportOwner.viewport;
385
+ return (this.getRenderWidth(useScreen) * viewport.width) / (this.getRenderHeight(useScreen) * viewport.height);
386
+ };
387
+ AbstractEngine.prototype.getScreenAspectRatio = function () {
388
+ return this.getRenderWidth(true) / this.getRenderHeight(true);
389
+ };
390
+ AbstractEngine.prototype._verifyPointerLock = function () {
391
+ this._onPointerLockChange?.();
392
+ };
393
+
394
+ AbstractEngine.prototype.setAlphaEquation = function (equation) {
395
+ if (this._alphaEquation === equation) {
396
+ return;
397
+ }
398
+ switch (equation) {
399
+ case Constants.ALPHA_EQUATION_ADD:
400
+ this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_ADD, Constants.GL_ALPHA_EQUATION_ADD);
401
+ break;
402
+ case Constants.ALPHA_EQUATION_SUBSTRACT:
403
+ this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_SUBTRACT, Constants.GL_ALPHA_EQUATION_SUBTRACT);
404
+ break;
405
+ case Constants.ALPHA_EQUATION_REVERSE_SUBTRACT:
406
+ this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_REVERSE_SUBTRACT, Constants.GL_ALPHA_EQUATION_REVERSE_SUBTRACT);
407
+ break;
408
+ case Constants.ALPHA_EQUATION_MAX:
409
+ this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_MAX, Constants.GL_ALPHA_EQUATION_MAX);
410
+ break;
411
+ case Constants.ALPHA_EQUATION_MIN:
412
+ this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_MIN, Constants.GL_ALPHA_EQUATION_MIN);
413
+ break;
414
+ case Constants.ALPHA_EQUATION_DARKEN:
415
+ this._alphaState.setAlphaEquationParameters(Constants.GL_ALPHA_EQUATION_MIN, Constants.GL_ALPHA_EQUATION_ADD);
416
+ break;
417
+ }
418
+ this._alphaEquation = equation;
419
+ };
420
+
421
+ AbstractEngine.prototype.getInputElement = function () {
422
+ return this._renderingCanvas;
423
+ };
424
+ AbstractEngine.prototype.getDepthFunction = function () {
425
+ return this._depthCullingState.depthFunc;
426
+ };
427
+ AbstractEngine.prototype.setDepthFunction = function (depthFunc) {
428
+ this._depthCullingState.depthFunc = depthFunc;
429
+ };
430
+ AbstractEngine.prototype.setDepthFunctionToGreater = function () {
431
+ this.setDepthFunction(Constants.GREATER);
432
+ };
433
+ AbstractEngine.prototype.setDepthFunctionToGreaterOrEqual = function () {
434
+ this.setDepthFunction(Constants.GEQUAL);
435
+ };
436
+ AbstractEngine.prototype.setDepthFunctionToLess = function () {
437
+ this.setDepthFunction(Constants.LESS);
438
+ };
439
+ AbstractEngine.prototype.setDepthFunctionToLessOrEqual = function () {
440
+ this.setDepthFunction(Constants.LEQUAL);
441
+ };
442
+ AbstractEngine.prototype.getDepthWrite = function () {
443
+ return this._depthCullingState.depthMask;
444
+ };
445
+ AbstractEngine.prototype.setDepthWrite = function (enable) {
446
+ this._depthCullingState.depthMask = enable;
447
+ };
448
+ AbstractEngine.prototype.getStencilBuffer = function () {
449
+ return this._stencilState.stencilTest;
450
+ };
451
+ AbstractEngine.prototype.setStencilBuffer = function (enable) {
452
+ this._stencilState.stencilTest = enable;
453
+ };
454
+ AbstractEngine.prototype.getStencilMask = function () {
455
+ return this._stencilState.stencilMask;
456
+ };
457
+ AbstractEngine.prototype.setStencilMask = function (mask) {
458
+ this._stencilState.stencilMask = mask;
459
+ };
460
+ AbstractEngine.prototype.getStencilFunction = function () {
461
+ return this._stencilState.stencilFunc;
462
+ };
463
+ AbstractEngine.prototype.getStencilFunctionReference = function () {
464
+ return this._stencilState.stencilFuncRef;
465
+ };
466
+ AbstractEngine.prototype.getStencilFunctionMask = function () {
467
+ return this._stencilState.stencilFuncMask;
468
+ };
469
+ AbstractEngine.prototype.setStencilFunction = function (stencilFunc) {
470
+ this._stencilState.stencilFunc = stencilFunc;
471
+ };
472
+ AbstractEngine.prototype.setStencilFunctionReference = function (reference) {
473
+ this._stencilState.stencilFuncRef = reference;
474
+ };
475
+ AbstractEngine.prototype.setStencilFunctionMask = function (mask) {
476
+ this._stencilState.stencilFuncMask = mask;
477
+ };
478
+ AbstractEngine.prototype.getStencilOperationFail = function () {
479
+ return this._stencilState.stencilOpStencilFail;
480
+ };
481
+ AbstractEngine.prototype.getStencilOperationDepthFail = function () {
482
+ return this._stencilState.stencilOpDepthFail;
483
+ };
484
+ AbstractEngine.prototype.getStencilOperationPass = function () {
485
+ return this._stencilState.stencilOpStencilDepthPass;
486
+ };
487
+ AbstractEngine.prototype.setStencilOperationFail = function (operation) {
488
+ this._stencilState.stencilOpStencilFail = operation;
489
+ };
490
+ AbstractEngine.prototype.setStencilOperationDepthFail = function (operation) {
491
+ this._stencilState.stencilOpDepthFail = operation;
492
+ };
493
+ AbstractEngine.prototype.setStencilOperationPass = function (operation) {
494
+ this._stencilState.stencilOpStencilDepthPass = operation;
495
+ };
496
+ AbstractEngine.prototype.cacheStencilState = function () {
497
+ this._cachedStencilBuffer = this.getStencilBuffer();
498
+ this._cachedStencilFunction = this.getStencilFunction();
499
+ this._cachedStencilMask = this.getStencilMask();
500
+ this._cachedStencilOperationPass = this.getStencilOperationPass();
501
+ this._cachedStencilOperationFail = this.getStencilOperationFail();
502
+ this._cachedStencilOperationDepthFail = this.getStencilOperationDepthFail();
503
+ this._cachedStencilReference = this.getStencilFunctionReference();
504
+ };
505
+ AbstractEngine.prototype.restoreStencilState = function () {
506
+ this.setStencilFunction(this._cachedStencilFunction);
507
+ this.setStencilMask(this._cachedStencilMask);
508
+ this.setStencilBuffer(this._cachedStencilBuffer);
509
+ this.setStencilOperationPass(this._cachedStencilOperationPass);
510
+ this.setStencilOperationFail(this._cachedStencilOperationFail);
511
+ this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail);
512
+ this.setStencilFunctionReference(this._cachedStencilReference);
513
+ };
514
+ AbstractEngine.prototype.setAlphaConstants = function (r, g, b, a) {
515
+ this._alphaState.setAlphaBlendConstants(r, g, b, a);
516
+ };
517
+ AbstractEngine.prototype.getAlphaMode = function () {
518
+ return this._alphaMode;
519
+ };
520
+ AbstractEngine.prototype.getAlphaEquation = function () {
521
+ return this._alphaEquation;
522
+ };
523
+
524
+ AbstractEngine.prototype.getRenderPassNames = function () {
525
+ return this._renderPassNames;
526
+ };
527
+ AbstractEngine.prototype.getCurrentRenderPassName = function () {
528
+ return this._renderPassNames[this.currentRenderPassId];
529
+ };
530
+ AbstractEngine.prototype.createRenderPassId = function (name) {
531
+ // Note: render pass id == 0 is always for the main render pass
532
+ const id = ++AbstractEngine._RenderPassIdCounter;
533
+ this._renderPassNames[id] = name ?? "NONAME";
534
+ return id;
535
+ };
536
+ AbstractEngine.prototype.releaseRenderPassId = function (id) {
537
+ this._renderPassNames[id] = undefined;
538
+ for (let s = 0; s < this.scenes.length; ++s) {
539
+ const scene = this.scenes[s];
540
+ for (let m = 0; m < scene.meshes.length; ++m) {
541
+ const mesh = scene.meshes[m];
542
+ if (mesh.subMeshes) {
543
+ for (let b = 0; b < mesh.subMeshes.length; ++b) {
544
+ const subMesh = mesh.subMeshes[b];
545
+ subMesh._removeDrawWrapper(id);
546
+ }
547
+ }
548
+ }
549
+ }
550
+ };
551
+
552
+ /** @internal */
553
+ function _DisableTouchAction(canvas) {
554
+ if (!canvas || !canvas.setAttribute) {
555
+ return;
556
+ }
557
+ canvas.setAttribute("touch-action", "none");
558
+ canvas.style.touchAction = "none";
559
+ canvas.style.webkitTapHighlightColor = "transparent";
560
+ }
561
+ /** @internal */
562
+ function _CommonInit(commonEngine, canvas, creationOptions) {
563
+ commonEngine._onCanvasFocus = () => {
564
+ commonEngine.onCanvasFocusObservable.notifyObservers(commonEngine);
565
+ };
566
+ commonEngine._onCanvasBlur = () => {
567
+ commonEngine.onCanvasBlurObservable.notifyObservers(commonEngine);
568
+ };
569
+ commonEngine._onCanvasContextMenu = (evt) => {
570
+ if (commonEngine.disableContextMenu) {
571
+ evt.preventDefault();
572
+ }
573
+ };
574
+ canvas.addEventListener("focus", commonEngine._onCanvasFocus);
575
+ canvas.addEventListener("blur", commonEngine._onCanvasBlur);
576
+ canvas.addEventListener("contextmenu", commonEngine._onCanvasContextMenu);
577
+ commonEngine._onBlur = () => {
578
+ if (commonEngine.disablePerformanceMonitorInBackground) {
579
+ commonEngine.performanceMonitor.disable();
580
+ }
581
+ commonEngine._windowIsBackground = true;
582
+ };
583
+ commonEngine._onFocus = () => {
584
+ if (commonEngine.disablePerformanceMonitorInBackground) {
585
+ commonEngine.performanceMonitor.enable();
586
+ }
587
+ commonEngine._windowIsBackground = false;
588
+ };
589
+ commonEngine._onCanvasPointerOut = (ev) => {
590
+ // Check that the element at the point of the pointer out isn't the canvas and if it isn't, notify observers
591
+ // Note: This is a workaround for a bug with Safari
592
+ if (document.elementFromPoint(ev.clientX, ev.clientY) !== canvas) {
593
+ commonEngine.onCanvasPointerOutObservable.notifyObservers(ev);
594
+ }
595
+ };
596
+ const hostWindow = commonEngine.getHostWindow(); // it calls IsWindowObjectExist()
597
+ if (hostWindow && typeof hostWindow.addEventListener === "function") {
598
+ hostWindow.addEventListener("blur", commonEngine._onBlur);
599
+ hostWindow.addEventListener("focus", commonEngine._onFocus);
600
+ }
601
+ canvas.addEventListener("pointerout", commonEngine._onCanvasPointerOut);
602
+ if (!creationOptions.doNotHandleTouchAction) {
603
+ _DisableTouchAction(canvas);
604
+ }
605
+ // Create Audio Engine if needed.
606
+ if (!AbstractEngine.audioEngine && creationOptions.audioEngine && AbstractEngine.AudioEngineFactory) {
607
+ AbstractEngine.audioEngine = AbstractEngine.AudioEngineFactory(commonEngine.getRenderingCanvas(), commonEngine.getAudioContext(), commonEngine.getAudioDestination());
608
+ }
609
+ if (IsDocumentAvailable()) {
610
+ // Fullscreen
611
+ commonEngine._onFullscreenChange = () => {
612
+ commonEngine.isFullscreen = !!document.fullscreenElement;
613
+ // Pointer lock
614
+ if (commonEngine.isFullscreen && commonEngine._pointerLockRequested && canvas) {
615
+ RequestPointerlock(canvas);
616
+ }
617
+ };
618
+ document.addEventListener("fullscreenchange", commonEngine._onFullscreenChange, false);
619
+ document.addEventListener("webkitfullscreenchange", commonEngine._onFullscreenChange, false);
620
+ // Pointer lock
621
+ commonEngine._onPointerLockChange = () => {
622
+ commonEngine.isPointerLock = document.pointerLockElement === canvas;
623
+ };
624
+ document.addEventListener("pointerlockchange", commonEngine._onPointerLockChange, false);
625
+ document.addEventListener("webkitpointerlockchange", commonEngine._onPointerLockChange, false);
626
+ }
627
+ commonEngine.enableOfflineSupport = AbstractEngine.OfflineProviderFactory !== undefined;
628
+ commonEngine._deterministicLockstep = !!creationOptions.deterministicLockstep;
629
+ commonEngine._lockstepMaxSteps = creationOptions.lockstepMaxSteps || 0;
630
+ commonEngine._timeStep = creationOptions.timeStep || 1 / 60;
631
+ }
632
+ /** @internal */
633
+ function _CommonDispose(commonEngine, canvas) {
634
+ // Release audio engine
635
+ if (EngineStore.Instances.length === 1 && AbstractEngine.audioEngine) {
636
+ AbstractEngine.audioEngine.dispose();
637
+ AbstractEngine.audioEngine = null;
638
+ }
639
+ // Events
640
+ const hostWindow = commonEngine.getHostWindow(); // it calls IsWindowObjectExist()
641
+ if (hostWindow && typeof hostWindow.removeEventListener === "function") {
642
+ hostWindow.removeEventListener("blur", commonEngine._onBlur);
643
+ hostWindow.removeEventListener("focus", commonEngine._onFocus);
644
+ }
645
+ if (canvas) {
646
+ canvas.removeEventListener("focus", commonEngine._onCanvasFocus);
647
+ canvas.removeEventListener("blur", commonEngine._onCanvasBlur);
648
+ canvas.removeEventListener("pointerout", commonEngine._onCanvasPointerOut);
649
+ canvas.removeEventListener("contextmenu", commonEngine._onCanvasContextMenu);
650
+ }
651
+ if (IsDocumentAvailable()) {
652
+ document.removeEventListener("fullscreenchange", commonEngine._onFullscreenChange);
653
+ document.removeEventListener("mozfullscreenchange", commonEngine._onFullscreenChange);
654
+ document.removeEventListener("webkitfullscreenchange", commonEngine._onFullscreenChange);
655
+ document.removeEventListener("msfullscreenchange", commonEngine._onFullscreenChange);
656
+ document.removeEventListener("pointerlockchange", commonEngine._onPointerLockChange);
657
+ document.removeEventListener("mspointerlockchange", commonEngine._onPointerLockChange);
658
+ document.removeEventListener("mozpointerlockchange", commonEngine._onPointerLockChange);
659
+ document.removeEventListener("webkitpointerlockchange", commonEngine._onPointerLockChange);
660
+ }
661
+ }
662
+ /**
663
+ * Get Font size information
664
+ * @param font font name
665
+ * @returns an object containing ascent, height and descent
666
+ */
667
+ function GetFontOffset(font) {
668
+ const text = document.createElement("span");
669
+ text.textContent = "Hg";
670
+ text.style.font = font;
671
+ const block = document.createElement("div");
672
+ block.style.display = "inline-block";
673
+ block.style.width = "1px";
674
+ block.style.height = "0px";
675
+ block.style.verticalAlign = "bottom";
676
+ const div = document.createElement("div");
677
+ div.style.whiteSpace = "nowrap";
678
+ div.appendChild(text);
679
+ div.appendChild(block);
680
+ document.body.appendChild(div);
681
+ let fontAscent = 0;
682
+ let fontHeight = 0;
683
+ try {
684
+ fontHeight = block.getBoundingClientRect().top - text.getBoundingClientRect().top;
685
+ block.style.verticalAlign = "baseline";
686
+ fontAscent = block.getBoundingClientRect().top - text.getBoundingClientRect().top;
687
+ }
688
+ finally {
689
+ document.body.removeChild(div);
690
+ }
691
+ return { ascent: fontAscent, height: fontHeight, descent: fontHeight - fontAscent };
692
+ }
693
+ /** @internal */
694
+ function CreateImageBitmapFromSource(engine, imageSource, options) {
695
+ const promise = new Promise((resolve, reject) => {
696
+ const image = new Image();
697
+ image.onload = () => {
698
+ image.decode().then(() => {
699
+ engine.createImageBitmap(image, options).then((imageBitmap) => {
700
+ resolve(imageBitmap);
701
+ });
702
+ });
703
+ };
704
+ image.onerror = () => {
705
+ reject(`Error loading image ${image.src}`);
706
+ };
707
+ image.src = imageSource;
708
+ });
709
+ return promise;
710
+ }
711
+ /** @internal */
712
+ function ResizeImageBitmap(engine, image, bufferWidth, bufferHeight) {
713
+ const canvas = engine.createCanvas(bufferWidth, bufferHeight);
714
+ const context = canvas.getContext("2d");
715
+ if (!context) {
716
+ throw new Error("Unable to get 2d context for resizeImageBitmap");
717
+ }
718
+ context.drawImage(image, 0, 0);
719
+ // Create VertexData from map data
720
+ // Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949
721
+ const buffer = context.getImageData(0, 0, bufferWidth, bufferHeight).data;
722
+ return buffer;
723
+ }
724
+ /**
725
+ * Ask the browser to promote the current element to fullscreen rendering mode
726
+ * @param element defines the DOM element to promote
727
+ */
728
+ function RequestFullscreen(element) {
729
+ const requestFunction = element.requestFullscreen || element.webkitRequestFullscreen;
730
+ if (!requestFunction) {
731
+ return;
732
+ }
733
+ requestFunction.call(element);
734
+ }
735
+ /**
736
+ * Asks the browser to exit fullscreen mode
737
+ */
738
+ function ExitFullscreen() {
739
+ const anyDoc = document;
740
+ if (document.exitFullscreen) {
741
+ document.exitFullscreen();
742
+ }
743
+ else if (anyDoc.webkitCancelFullScreen) {
744
+ anyDoc.webkitCancelFullScreen();
745
+ }
746
+ }
747
+ /**
748
+ * Ask the browser to promote the current element to pointerlock mode
749
+ * @param element defines the DOM element to promote
750
+ */
751
+ function RequestPointerlock(element) {
752
+ if (element.requestPointerLock) {
753
+ // In some browsers, requestPointerLock returns a promise.
754
+ // Handle possible rejections to avoid an unhandled top-level exception.
755
+ const promise = element.requestPointerLock();
756
+ if (promise instanceof Promise)
757
+ promise
758
+ .then(() => {
759
+ element.focus();
760
+ })
761
+ .catch(() => { });
762
+ else
763
+ element.focus();
764
+ }
765
+ }
766
+ /**
767
+ * Asks the browser to exit pointerlock mode
768
+ */
769
+ function ExitPointerlock() {
770
+ if (document.exitPointerLock) {
771
+ document.exitPointerLock();
772
+ }
773
+ }
774
+
775
+ /**
776
+ * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio
777
+ */
778
+ class Engine extends ThinEngine {
779
+ /**
780
+ * Returns the current npm package of the sdk
781
+ */
782
+ // Not mixed with Version for tooling purpose.
783
+ static get NpmPackage() {
784
+ return AbstractEngine.NpmPackage;
785
+ }
786
+ /**
787
+ * Returns the current version of the framework
788
+ */
789
+ static get Version() {
790
+ return AbstractEngine.Version;
791
+ }
792
+ /** Gets the list of created engines */
793
+ static get Instances() {
794
+ return EngineStore.Instances;
795
+ }
796
+ /**
797
+ * Gets the latest created engine
798
+ */
799
+ static get LastCreatedEngine() {
800
+ return EngineStore.LastCreatedEngine;
801
+ }
802
+ /**
803
+ * Gets the latest created scene
804
+ */
805
+ static get LastCreatedScene() {
806
+ return EngineStore.LastCreatedScene;
807
+ }
808
+ /** @internal */
809
+ // eslint-disable-next-line jsdoc/require-returns-check
810
+ /**
811
+ * Method called to create the default loading screen.
812
+ * This can be overridden in your own app.
813
+ * @param canvas The rendering canvas element
814
+ * @returns The loading screen
815
+ */
816
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
817
+ static DefaultLoadingScreenFactory(canvas) {
818
+ return AbstractEngine.DefaultLoadingScreenFactory(canvas);
819
+ }
820
+ get _supportsHardwareTextureRescaling() {
821
+ return !!Engine._RescalePostProcessFactory;
822
+ }
823
+ _measureFps() {
824
+ this._performanceMonitor.sampleFrame();
825
+ this._fps = this._performanceMonitor.averageFPS;
826
+ this._deltaTime = this._performanceMonitor.instantaneousFrameTime || 0;
827
+ }
828
+ /**
829
+ * Gets the performance monitor attached to this engine
830
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#engineinstrumentation
831
+ */
832
+ get performanceMonitor() {
833
+ return this._performanceMonitor;
834
+ }
835
+ // Events
836
+ /**
837
+ * Creates a new engine
838
+ * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which already used the WebGL context
839
+ * @param antialias defines enable antialiasing (default: false)
840
+ * @param options defines further options to be sent to the getContext() function
841
+ * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)
842
+ */
843
+ constructor(canvasOrContext, antialias, options, adaptToDeviceRatio = false) {
844
+ super(canvasOrContext, antialias, options, adaptToDeviceRatio);
845
+ // Members
846
+ /**
847
+ * If set, will be used to request the next animation frame for the render loop
848
+ */
849
+ this.customAnimationFrameRequester = null;
850
+ this._performanceMonitor = new PerformanceMonitor();
851
+ this._drawCalls = new PerfCounter();
852
+ if (!canvasOrContext) {
853
+ return;
854
+ }
855
+ this._features.supportRenderPasses = true;
856
+ options = this._creationOptions;
857
+ if (canvasOrContext.getContext) {
858
+ const canvas = canvasOrContext;
859
+ this._sharedInit(canvas);
860
+ }
861
+ }
862
+ _initGLContext() {
863
+ super._initGLContext();
864
+ this._rescalePostProcess = null;
865
+ }
866
+ /**
867
+ * Shared initialization across engines types.
868
+ * @param canvas The canvas associated with this instance of the engine.
869
+ */
870
+ _sharedInit(canvas) {
871
+ super._sharedInit(canvas);
872
+ _CommonInit(this, canvas, this._creationOptions);
873
+ }
874
+ /**
875
+ * Resize an image and returns the image data as an uint8array
876
+ * @param image image to resize
877
+ * @param bufferWidth destination buffer width
878
+ * @param bufferHeight destination buffer height
879
+ * @returns an uint8array containing RGBA values of bufferWidth * bufferHeight size
880
+ */
881
+ resizeImageBitmap(image, bufferWidth, bufferHeight) {
882
+ return ResizeImageBitmap(this, image, bufferWidth, bufferHeight);
883
+ }
884
+ /**
885
+ * Engine abstraction for loading and creating an image bitmap from a given source string.
886
+ * @param imageSource source to load the image from.
887
+ * @param options An object that sets options for the image's extraction.
888
+ * @returns ImageBitmap
889
+ */
890
+ _createImageBitmapFromSource(imageSource, options) {
891
+ return CreateImageBitmapFromSource(this, imageSource, options);
892
+ }
893
+ /**
894
+ * Toggle full screen mode
895
+ * @param requestPointerLock defines if a pointer lock should be requested from the user
896
+ */
897
+ switchFullscreen(requestPointerLock) {
898
+ if (this.isFullscreen) {
899
+ this.exitFullscreen();
900
+ }
901
+ else {
902
+ this.enterFullscreen(requestPointerLock);
903
+ }
904
+ }
905
+ /**
906
+ * Enters full screen mode
907
+ * @param requestPointerLock defines if a pointer lock should be requested from the user
908
+ */
909
+ enterFullscreen(requestPointerLock) {
910
+ if (!this.isFullscreen) {
911
+ this._pointerLockRequested = requestPointerLock;
912
+ if (this._renderingCanvas) {
913
+ RequestFullscreen(this._renderingCanvas);
914
+ }
915
+ }
916
+ }
917
+ /**
918
+ * Exits full screen mode
919
+ */
920
+ exitFullscreen() {
921
+ if (this.isFullscreen) {
922
+ ExitFullscreen();
923
+ }
924
+ }
925
+ /** States */
926
+ /**
927
+ * Sets a boolean indicating if the dithering state is enabled or disabled
928
+ * @param value defines the dithering state
929
+ */
930
+ setDitheringState(value) {
931
+ if (value) {
932
+ this._gl.enable(this._gl.DITHER);
933
+ }
934
+ else {
935
+ this._gl.disable(this._gl.DITHER);
936
+ }
937
+ }
938
+ /**
939
+ * Sets a boolean indicating if the rasterizer state is enabled or disabled
940
+ * @param value defines the rasterizer state
941
+ */
942
+ setRasterizerState(value) {
943
+ if (value) {
944
+ this._gl.disable(this._gl.RASTERIZER_DISCARD);
945
+ }
946
+ else {
947
+ this._gl.enable(this._gl.RASTERIZER_DISCARD);
948
+ }
949
+ }
950
+ /**
951
+ * Directly set the WebGL Viewport
952
+ * @param x defines the x coordinate of the viewport (in screen space)
953
+ * @param y defines the y coordinate of the viewport (in screen space)
954
+ * @param width defines the width of the viewport (in screen space)
955
+ * @param height defines the height of the viewport (in screen space)
956
+ * @returns the current viewport Object (if any) that is being replaced by this call. You can restore this viewport later on to go back to the original state
957
+ */
958
+ setDirectViewport(x, y, width, height) {
959
+ const currentViewport = this._cachedViewport;
960
+ this._cachedViewport = null;
961
+ this._viewport(x, y, width, height);
962
+ return currentViewport;
963
+ }
964
+ /**
965
+ * Executes a scissor clear (ie. a clear on a specific portion of the screen)
966
+ * @param x defines the x-coordinate of the bottom left corner of the clear rectangle
967
+ * @param y defines the y-coordinate of the corner of the clear rectangle
968
+ * @param width defines the width of the clear rectangle
969
+ * @param height defines the height of the clear rectangle
970
+ * @param clearColor defines the clear color
971
+ */
972
+ scissorClear(x, y, width, height, clearColor) {
973
+ this.enableScissor(x, y, width, height);
974
+ this.clear(clearColor, true, true, true);
975
+ this.disableScissor();
976
+ }
977
+ /**
978
+ * Enable scissor test on a specific rectangle (ie. render will only be executed on a specific portion of the screen)
979
+ * @param x defines the x-coordinate of the bottom left corner of the clear rectangle
980
+ * @param y defines the y-coordinate of the corner of the clear rectangle
981
+ * @param width defines the width of the clear rectangle
982
+ * @param height defines the height of the clear rectangle
983
+ */
984
+ enableScissor(x, y, width, height) {
985
+ const gl = this._gl;
986
+ // Change state
987
+ gl.enable(gl.SCISSOR_TEST);
988
+ gl.scissor(x, y, width, height);
989
+ }
990
+ /**
991
+ * Disable previously set scissor test rectangle
992
+ */
993
+ disableScissor() {
994
+ const gl = this._gl;
995
+ gl.disable(gl.SCISSOR_TEST);
996
+ }
997
+ /**
998
+ * @internal
999
+ */
1000
+ _loadFileAsync(url, offlineProvider, useArrayBuffer) {
1001
+ return new Promise((resolve, reject) => {
1002
+ this._loadFile(url, (data) => {
1003
+ resolve(data);
1004
+ }, undefined, offlineProvider, useArrayBuffer, (request, exception) => {
1005
+ reject(exception);
1006
+ });
1007
+ });
1008
+ }
1009
+ /**
1010
+ * Gets the source code of the vertex shader associated with a specific webGL program
1011
+ * @param program defines the program to use
1012
+ * @returns a string containing the source code of the vertex shader associated with the program
1013
+ */
1014
+ getVertexShaderSource(program) {
1015
+ const shaders = this._gl.getAttachedShaders(program);
1016
+ if (!shaders) {
1017
+ return null;
1018
+ }
1019
+ return this._gl.getShaderSource(shaders[0]);
1020
+ }
1021
+ /**
1022
+ * Gets the source code of the fragment shader associated with a specific webGL program
1023
+ * @param program defines the program to use
1024
+ * @returns a string containing the source code of the fragment shader associated with the program
1025
+ */
1026
+ getFragmentShaderSource(program) {
1027
+ const shaders = this._gl.getAttachedShaders(program);
1028
+ if (!shaders) {
1029
+ return null;
1030
+ }
1031
+ return this._gl.getShaderSource(shaders[1]);
1032
+ }
1033
+ /**
1034
+ * sets the object from which width and height will be taken from when getting render width and height
1035
+ * Will fallback to the gl object
1036
+ * @param dimensions the framebuffer width and height that will be used.
1037
+ */
1038
+ set framebufferDimensionsObject(dimensions) {
1039
+ this._framebufferDimensionsObject = dimensions;
1040
+ if (this._framebufferDimensionsObject) {
1041
+ this.onResizeObservable.notifyObservers(this);
1042
+ }
1043
+ }
1044
+ _rebuildBuffers() {
1045
+ // Index / Vertex
1046
+ for (const scene of this.scenes) {
1047
+ scene.resetCachedMaterial();
1048
+ scene._rebuildGeometries();
1049
+ }
1050
+ for (const scene of this._virtualScenes) {
1051
+ scene.resetCachedMaterial();
1052
+ scene._rebuildGeometries();
1053
+ }
1054
+ super._rebuildBuffers();
1055
+ }
1056
+ /**
1057
+ * Get Font size information
1058
+ * @param font font name
1059
+ * @returns an object containing ascent, height and descent
1060
+ */
1061
+ getFontOffset(font) {
1062
+ return GetFontOffset(font);
1063
+ }
1064
+ _cancelFrame() {
1065
+ if (this.customAnimationFrameRequester) {
1066
+ if (this._frameHandler !== 0) {
1067
+ this._frameHandler = 0;
1068
+ const { cancelAnimationFrame } = this.customAnimationFrameRequester;
1069
+ if (cancelAnimationFrame) {
1070
+ cancelAnimationFrame(this.customAnimationFrameRequester.requestID);
1071
+ }
1072
+ }
1073
+ }
1074
+ else {
1075
+ super._cancelFrame();
1076
+ }
1077
+ }
1078
+ _renderLoop() {
1079
+ // Reset the frame handler before rendering a frame to determine if a new frame has been queued.
1080
+ this._frameHandler = 0;
1081
+ if (!this._contextWasLost) {
1082
+ let shouldRender = true;
1083
+ if (this.isDisposed || (!this.renderEvenInBackground && this._windowIsBackground)) {
1084
+ shouldRender = false;
1085
+ }
1086
+ if (shouldRender) {
1087
+ // Start new frame
1088
+ this.beginFrame();
1089
+ // Child canvases
1090
+ if (!this._renderViews()) {
1091
+ // Main frame
1092
+ this._renderFrame();
1093
+ }
1094
+ // Present
1095
+ this.endFrame();
1096
+ }
1097
+ }
1098
+ // The first condition prevents queuing another frame if we no longer have active render loops (e.g., if
1099
+ // `stopRenderLoop` is called mid frame). The second condition prevents queuing another frame if one has
1100
+ // already been queued (e.g., if `stopRenderLoop` and `runRenderLoop` is called mid frame).
1101
+ if (this._activeRenderLoops.length > 0 && this._frameHandler === 0) {
1102
+ if (this.customAnimationFrameRequester) {
1103
+ this.customAnimationFrameRequester.requestID = this._queueNewFrame(this.customAnimationFrameRequester.renderFunction || this._boundRenderFunction, this.customAnimationFrameRequester);
1104
+ this._frameHandler = this.customAnimationFrameRequester.requestID;
1105
+ }
1106
+ else {
1107
+ this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());
1108
+ }
1109
+ }
1110
+ }
1111
+ /**
1112
+ * Enters Pointerlock mode
1113
+ */
1114
+ enterPointerlock() {
1115
+ if (this._renderingCanvas) {
1116
+ RequestPointerlock(this._renderingCanvas);
1117
+ }
1118
+ }
1119
+ /**
1120
+ * Exits Pointerlock mode
1121
+ */
1122
+ exitPointerlock() {
1123
+ ExitPointerlock();
1124
+ }
1125
+ /**
1126
+ * Begin a new frame
1127
+ */
1128
+ beginFrame() {
1129
+ this._measureFps();
1130
+ super.beginFrame();
1131
+ }
1132
+ _deletePipelineContext(pipelineContext) {
1133
+ const webGLPipelineContext = pipelineContext;
1134
+ if (webGLPipelineContext && webGLPipelineContext.program) {
1135
+ if (webGLPipelineContext.transformFeedback) {
1136
+ this.deleteTransformFeedback(webGLPipelineContext.transformFeedback);
1137
+ webGLPipelineContext.transformFeedback = null;
1138
+ }
1139
+ }
1140
+ super._deletePipelineContext(pipelineContext);
1141
+ }
1142
+ createShaderProgram(pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings = null) {
1143
+ context = context || this._gl;
1144
+ this.onBeforeShaderCompilationObservable.notifyObservers(this);
1145
+ const program = super.createShaderProgram(pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings);
1146
+ this.onAfterShaderCompilationObservable.notifyObservers(this);
1147
+ return program;
1148
+ }
1149
+ _createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings = null) {
1150
+ const shaderProgram = context.createProgram();
1151
+ pipelineContext.program = shaderProgram;
1152
+ if (!shaderProgram) {
1153
+ throw new Error("Unable to create program");
1154
+ }
1155
+ context.attachShader(shaderProgram, vertexShader);
1156
+ context.attachShader(shaderProgram, fragmentShader);
1157
+ if (this.webGLVersion > 1 && transformFeedbackVaryings) {
1158
+ const transformFeedback = this.createTransformFeedback();
1159
+ this.bindTransformFeedback(transformFeedback);
1160
+ this.setTranformFeedbackVaryings(shaderProgram, transformFeedbackVaryings);
1161
+ pipelineContext.transformFeedback = transformFeedback;
1162
+ }
1163
+ context.linkProgram(shaderProgram);
1164
+ if (this.webGLVersion > 1 && transformFeedbackVaryings) {
1165
+ this.bindTransformFeedback(null);
1166
+ }
1167
+ pipelineContext.context = context;
1168
+ pipelineContext.vertexShader = vertexShader;
1169
+ pipelineContext.fragmentShader = fragmentShader;
1170
+ if (!pipelineContext.isParallelCompiled) {
1171
+ this._finalizePipelineContext(pipelineContext);
1172
+ }
1173
+ return shaderProgram;
1174
+ }
1175
+ /**
1176
+ * @internal
1177
+ */
1178
+ _releaseTexture(texture) {
1179
+ super._releaseTexture(texture);
1180
+ }
1181
+ /**
1182
+ * @internal
1183
+ */
1184
+ _releaseRenderTargetWrapper(rtWrapper) {
1185
+ super._releaseRenderTargetWrapper(rtWrapper);
1186
+ // Set output texture of post process to null if the framebuffer has been released/disposed
1187
+ this.scenes.forEach((scene) => {
1188
+ scene.postProcesses.forEach((postProcess) => {
1189
+ if (postProcess._outputTexture === rtWrapper) {
1190
+ postProcess._outputTexture = null;
1191
+ }
1192
+ });
1193
+ scene.cameras.forEach((camera) => {
1194
+ camera._postProcesses.forEach((postProcess) => {
1195
+ if (postProcess) {
1196
+ if (postProcess._outputTexture === rtWrapper) {
1197
+ postProcess._outputTexture = null;
1198
+ }
1199
+ }
1200
+ });
1201
+ });
1202
+ });
1203
+ }
1204
+ /**
1205
+ * @internal
1206
+ * Rescales a texture
1207
+ * @param source input texture
1208
+ * @param destination destination texture
1209
+ * @param scene scene to use to render the resize
1210
+ * @param internalFormat format to use when resizing
1211
+ * @param onComplete callback to be called when resize has completed
1212
+ */
1213
+ _rescaleTexture(source, destination, scene, internalFormat, onComplete) {
1214
+ this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR);
1215
+ this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR);
1216
+ this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE);
1217
+ this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE);
1218
+ const rtt = this.createRenderTargetTexture({
1219
+ width: destination.width,
1220
+ height: destination.height,
1221
+ }, {
1222
+ generateMipMaps: false,
1223
+ type: Constants.TEXTURETYPE_UNSIGNED_INT,
1224
+ samplingMode: Constants.TEXTURE_BILINEAR_SAMPLINGMODE,
1225
+ generateDepthBuffer: false,
1226
+ generateStencilBuffer: false,
1227
+ });
1228
+ if (!this._rescalePostProcess && Engine._RescalePostProcessFactory) {
1229
+ this._rescalePostProcess = Engine._RescalePostProcessFactory(this);
1230
+ }
1231
+ if (this._rescalePostProcess) {
1232
+ this._rescalePostProcess.externalTextureSamplerBinding = true;
1233
+ const onCompiled = () => {
1234
+ this._rescalePostProcess.onApply = function (effect) {
1235
+ effect._bindTexture("textureSampler", source);
1236
+ };
1237
+ let hostingScene = scene;
1238
+ if (!hostingScene) {
1239
+ hostingScene = this.scenes[this.scenes.length - 1];
1240
+ }
1241
+ hostingScene.postProcessManager.directRender([this._rescalePostProcess], rtt, true);
1242
+ this._bindTextureDirectly(this._gl.TEXTURE_2D, destination, true);
1243
+ this._gl.copyTexImage2D(this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);
1244
+ this.unBindFramebuffer(rtt);
1245
+ rtt.dispose();
1246
+ if (onComplete) {
1247
+ onComplete();
1248
+ }
1249
+ };
1250
+ const effect = this._rescalePostProcess.getEffect();
1251
+ if (effect) {
1252
+ effect.executeWhenCompiled(onCompiled);
1253
+ }
1254
+ else {
1255
+ this._rescalePostProcess.onEffectCreatedObservable.addOnce((effect) => {
1256
+ effect.executeWhenCompiled(onCompiled);
1257
+ });
1258
+ }
1259
+ }
1260
+ }
1261
+ /**
1262
+ * Wraps an external web gl texture in a Babylon texture.
1263
+ * @param texture defines the external texture
1264
+ * @param hasMipMaps defines whether the external texture has mip maps (default: false)
1265
+ * @param samplingMode defines the sampling mode for the external texture (default: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE)
1266
+ * @param width defines the width for the external texture (default: 0)
1267
+ * @param height defines the height for the external texture (default: 0)
1268
+ * @returns the babylon internal texture
1269
+ */
1270
+ wrapWebGLTexture(texture, hasMipMaps = false, samplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE, width = 0, height = 0) {
1271
+ const hardwareTexture = new WebGLHardwareTexture(texture, this._gl);
1272
+ const internalTexture = new InternalTexture(this, 0 /* InternalTextureSource.Unknown */, true);
1273
+ internalTexture._hardwareTexture = hardwareTexture;
1274
+ internalTexture.baseWidth = width;
1275
+ internalTexture.baseHeight = height;
1276
+ internalTexture.width = width;
1277
+ internalTexture.height = height;
1278
+ internalTexture.isReady = true;
1279
+ internalTexture.useMipMaps = hasMipMaps;
1280
+ this.updateTextureSamplingMode(samplingMode, internalTexture);
1281
+ return internalTexture;
1282
+ }
1283
+ /**
1284
+ * @internal
1285
+ */
1286
+ _uploadImageToTexture(texture, image, faceIndex = 0, lod = 0) {
1287
+ const gl = this._gl;
1288
+ const textureType = this._getWebGLTextureType(texture.type);
1289
+ const format = this._getInternalFormat(texture.format);
1290
+ const internalFormat = this._getRGBABufferInternalSizedFormat(texture.type, format);
1291
+ const bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;
1292
+ this._bindTextureDirectly(bindTarget, texture, true);
1293
+ this._unpackFlipY(texture.invertY);
1294
+ let target = gl.TEXTURE_2D;
1295
+ if (texture.isCube) {
1296
+ target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;
1297
+ }
1298
+ gl.texImage2D(target, lod, internalFormat, format, textureType, image);
1299
+ this._bindTextureDirectly(bindTarget, null, true);
1300
+ }
1301
+ /**
1302
+ * Updates a depth texture Comparison Mode and Function.
1303
+ * If the comparison Function is equal to 0, the mode will be set to none.
1304
+ * Otherwise, this only works in webgl 2 and requires a shadow sampler in the shader.
1305
+ * @param texture The texture to set the comparison function for
1306
+ * @param comparisonFunction The comparison function to set, 0 if no comparison required
1307
+ */
1308
+ updateTextureComparisonFunction(texture, comparisonFunction) {
1309
+ if (this.webGLVersion === 1) {
1310
+ Logger.Error("WebGL 1 does not support texture comparison.");
1311
+ return;
1312
+ }
1313
+ const gl = this._gl;
1314
+ if (texture.isCube) {
1315
+ this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);
1316
+ if (comparisonFunction === 0) {
1317
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, Constants.LEQUAL);
1318
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.NONE);
1319
+ }
1320
+ else {
1321
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);
1322
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);
1323
+ }
1324
+ this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
1325
+ }
1326
+ else {
1327
+ this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);
1328
+ if (comparisonFunction === 0) {
1329
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, Constants.LEQUAL);
1330
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.NONE);
1331
+ }
1332
+ else {
1333
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);
1334
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);
1335
+ }
1336
+ this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
1337
+ }
1338
+ texture._comparisonFunction = comparisonFunction;
1339
+ }
1340
+ /**
1341
+ * Creates a webGL buffer to use with instantiation
1342
+ * @param capacity defines the size of the buffer
1343
+ * @returns the webGL buffer
1344
+ */
1345
+ createInstancesBuffer(capacity) {
1346
+ const buffer = this._gl.createBuffer();
1347
+ if (!buffer) {
1348
+ throw new Error("Unable to create instance buffer");
1349
+ }
1350
+ const result = new WebGLDataBuffer(buffer);
1351
+ result.capacity = capacity;
1352
+ this.bindArrayBuffer(result);
1353
+ this._gl.bufferData(this._gl.ARRAY_BUFFER, capacity, this._gl.DYNAMIC_DRAW);
1354
+ result.references = 1;
1355
+ return result;
1356
+ }
1357
+ /**
1358
+ * Delete a webGL buffer used with instantiation
1359
+ * @param buffer defines the webGL buffer to delete
1360
+ */
1361
+ deleteInstancesBuffer(buffer) {
1362
+ this._gl.deleteBuffer(buffer);
1363
+ }
1364
+ _clientWaitAsync(sync, flags = 0, intervalms = 10) {
1365
+ const gl = this._gl;
1366
+ return new Promise((resolve, reject) => {
1367
+ const check = () => {
1368
+ const res = gl.clientWaitSync(sync, flags, 0);
1369
+ if (res == gl.WAIT_FAILED) {
1370
+ reject();
1371
+ return;
1372
+ }
1373
+ if (res == gl.TIMEOUT_EXPIRED) {
1374
+ setTimeout(check, intervalms);
1375
+ return;
1376
+ }
1377
+ resolve();
1378
+ };
1379
+ check();
1380
+ });
1381
+ }
1382
+ /**
1383
+ * @internal
1384
+ */
1385
+ _readPixelsAsync(x, y, w, h, format, type, outputBuffer) {
1386
+ if (this._webGLVersion < 2) {
1387
+ throw new Error("_readPixelsAsync only work on WebGL2+");
1388
+ }
1389
+ const gl = this._gl;
1390
+ const buf = gl.createBuffer();
1391
+ gl.bindBuffer(gl.PIXEL_PACK_BUFFER, buf);
1392
+ gl.bufferData(gl.PIXEL_PACK_BUFFER, outputBuffer.byteLength, gl.STREAM_READ);
1393
+ gl.readPixels(x, y, w, h, format, type, 0);
1394
+ gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
1395
+ const sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
1396
+ if (!sync) {
1397
+ return null;
1398
+ }
1399
+ gl.flush();
1400
+ return this._clientWaitAsync(sync, 0, 10).then(() => {
1401
+ gl.deleteSync(sync);
1402
+ gl.bindBuffer(gl.PIXEL_PACK_BUFFER, buf);
1403
+ gl.getBufferSubData(gl.PIXEL_PACK_BUFFER, 0, outputBuffer);
1404
+ gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
1405
+ gl.deleteBuffer(buf);
1406
+ return outputBuffer;
1407
+ });
1408
+ }
1409
+ dispose() {
1410
+ this.hideLoadingUI();
1411
+ // Rescale PP
1412
+ if (this._rescalePostProcess) {
1413
+ this._rescalePostProcess.dispose();
1414
+ }
1415
+ _CommonDispose(this, this._renderingCanvas);
1416
+ super.dispose();
1417
+ }
1418
+ }
1419
+ // Const statics
1420
+ /** Defines that alpha blending is disabled */
1421
+ Engine.ALPHA_DISABLE = Constants.ALPHA_DISABLE;
1422
+ /** Defines that alpha blending to SRC ALPHA * SRC + DEST */
1423
+ Engine.ALPHA_ADD = Constants.ALPHA_ADD;
1424
+ /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */
1425
+ Engine.ALPHA_COMBINE = Constants.ALPHA_COMBINE;
1426
+ /** Defines that alpha blending to DEST - SRC * DEST */
1427
+ Engine.ALPHA_SUBTRACT = Constants.ALPHA_SUBTRACT;
1428
+ /** Defines that alpha blending to SRC * DEST */
1429
+ Engine.ALPHA_MULTIPLY = Constants.ALPHA_MULTIPLY;
1430
+ /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */
1431
+ Engine.ALPHA_MAXIMIZED = Constants.ALPHA_MAXIMIZED;
1432
+ /** Defines that alpha blending to SRC + DEST */
1433
+ Engine.ALPHA_ONEONE = Constants.ALPHA_ONEONE;
1434
+ /** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */
1435
+ Engine.ALPHA_PREMULTIPLIED = Constants.ALPHA_PREMULTIPLIED;
1436
+ /**
1437
+ * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST
1438
+ * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA
1439
+ */
1440
+ Engine.ALPHA_PREMULTIPLIED_PORTERDUFF = Constants.ALPHA_PREMULTIPLIED_PORTERDUFF;
1441
+ /** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */
1442
+ Engine.ALPHA_INTERPOLATE = Constants.ALPHA_INTERPOLATE;
1443
+ /**
1444
+ * Defines that alpha blending to SRC + (1 - SRC) * DEST
1445
+ * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA
1446
+ */
1447
+ Engine.ALPHA_SCREENMODE = Constants.ALPHA_SCREENMODE;
1448
+ /** Defines that the resource is not delayed*/
1449
+ Engine.DELAYLOADSTATE_NONE = Constants.DELAYLOADSTATE_NONE;
1450
+ /** Defines that the resource was successfully delay loaded */
1451
+ Engine.DELAYLOADSTATE_LOADED = Constants.DELAYLOADSTATE_LOADED;
1452
+ /** Defines that the resource is currently delay loading */
1453
+ Engine.DELAYLOADSTATE_LOADING = Constants.DELAYLOADSTATE_LOADING;
1454
+ /** Defines that the resource is delayed and has not started loading */
1455
+ Engine.DELAYLOADSTATE_NOTLOADED = Constants.DELAYLOADSTATE_NOTLOADED;
1456
+ // Depht or Stencil test Constants.
1457
+ /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */
1458
+ Engine.NEVER = Constants.NEVER;
1459
+ /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */
1460
+ Engine.ALWAYS = Constants.ALWAYS;
1461
+ /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */
1462
+ Engine.LESS = Constants.LESS;
1463
+ /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */
1464
+ Engine.EQUAL = Constants.EQUAL;
1465
+ /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */
1466
+ Engine.LEQUAL = Constants.LEQUAL;
1467
+ /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */
1468
+ Engine.GREATER = Constants.GREATER;
1469
+ /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */
1470
+ Engine.GEQUAL = Constants.GEQUAL;
1471
+ /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */
1472
+ Engine.NOTEQUAL = Constants.NOTEQUAL;
1473
+ // Stencil Actions Constants.
1474
+ /** Passed to stencilOperation to specify that stencil value must be kept */
1475
+ Engine.KEEP = Constants.KEEP;
1476
+ /** Passed to stencilOperation to specify that stencil value must be replaced */
1477
+ Engine.REPLACE = Constants.REPLACE;
1478
+ /** Passed to stencilOperation to specify that stencil value must be incremented */
1479
+ Engine.INCR = Constants.INCR;
1480
+ /** Passed to stencilOperation to specify that stencil value must be decremented */
1481
+ Engine.DECR = Constants.DECR;
1482
+ /** Passed to stencilOperation to specify that stencil value must be inverted */
1483
+ Engine.INVERT = Constants.INVERT;
1484
+ /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */
1485
+ Engine.INCR_WRAP = Constants.INCR_WRAP;
1486
+ /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */
1487
+ Engine.DECR_WRAP = Constants.DECR_WRAP;
1488
+ /** Texture is not repeating outside of 0..1 UVs */
1489
+ Engine.TEXTURE_CLAMP_ADDRESSMODE = Constants.TEXTURE_CLAMP_ADDRESSMODE;
1490
+ /** Texture is repeating outside of 0..1 UVs */
1491
+ Engine.TEXTURE_WRAP_ADDRESSMODE = Constants.TEXTURE_WRAP_ADDRESSMODE;
1492
+ /** Texture is repeating and mirrored */
1493
+ Engine.TEXTURE_MIRROR_ADDRESSMODE = Constants.TEXTURE_MIRROR_ADDRESSMODE;
1494
+ /** ALPHA */
1495
+ Engine.TEXTUREFORMAT_ALPHA = Constants.TEXTUREFORMAT_ALPHA;
1496
+ /** LUMINANCE */
1497
+ Engine.TEXTUREFORMAT_LUMINANCE = Constants.TEXTUREFORMAT_LUMINANCE;
1498
+ /** LUMINANCE_ALPHA */
1499
+ Engine.TEXTUREFORMAT_LUMINANCE_ALPHA = Constants.TEXTUREFORMAT_LUMINANCE_ALPHA;
1500
+ /** RGB */
1501
+ Engine.TEXTUREFORMAT_RGB = Constants.TEXTUREFORMAT_RGB;
1502
+ /** RGBA */
1503
+ Engine.TEXTUREFORMAT_RGBA = Constants.TEXTUREFORMAT_RGBA;
1504
+ /** RED */
1505
+ Engine.TEXTUREFORMAT_RED = Constants.TEXTUREFORMAT_RED;
1506
+ /** RED (2nd reference) */
1507
+ Engine.TEXTUREFORMAT_R = Constants.TEXTUREFORMAT_R;
1508
+ /** RG */
1509
+ Engine.TEXTUREFORMAT_RG = Constants.TEXTUREFORMAT_RG;
1510
+ /** RED_INTEGER */
1511
+ Engine.TEXTUREFORMAT_RED_INTEGER = Constants.TEXTUREFORMAT_RED_INTEGER;
1512
+ /** RED_INTEGER (2nd reference) */
1513
+ Engine.TEXTUREFORMAT_R_INTEGER = Constants.TEXTUREFORMAT_R_INTEGER;
1514
+ /** RG_INTEGER */
1515
+ Engine.TEXTUREFORMAT_RG_INTEGER = Constants.TEXTUREFORMAT_RG_INTEGER;
1516
+ /** RGB_INTEGER */
1517
+ Engine.TEXTUREFORMAT_RGB_INTEGER = Constants.TEXTUREFORMAT_RGB_INTEGER;
1518
+ /** RGBA_INTEGER */
1519
+ Engine.TEXTUREFORMAT_RGBA_INTEGER = Constants.TEXTUREFORMAT_RGBA_INTEGER;
1520
+ /** UNSIGNED_BYTE */
1521
+ Engine.TEXTURETYPE_UNSIGNED_BYTE = Constants.TEXTURETYPE_UNSIGNED_BYTE;
1522
+ /** UNSIGNED_BYTE (2nd reference) */
1523
+ Engine.TEXTURETYPE_UNSIGNED_INT = Constants.TEXTURETYPE_UNSIGNED_INT;
1524
+ /** FLOAT */
1525
+ Engine.TEXTURETYPE_FLOAT = Constants.TEXTURETYPE_FLOAT;
1526
+ /** HALF_FLOAT */
1527
+ Engine.TEXTURETYPE_HALF_FLOAT = Constants.TEXTURETYPE_HALF_FLOAT;
1528
+ /** BYTE */
1529
+ Engine.TEXTURETYPE_BYTE = Constants.TEXTURETYPE_BYTE;
1530
+ /** SHORT */
1531
+ Engine.TEXTURETYPE_SHORT = Constants.TEXTURETYPE_SHORT;
1532
+ /** UNSIGNED_SHORT */
1533
+ Engine.TEXTURETYPE_UNSIGNED_SHORT = Constants.TEXTURETYPE_UNSIGNED_SHORT;
1534
+ /** INT */
1535
+ Engine.TEXTURETYPE_INT = Constants.TEXTURETYPE_INT;
1536
+ /** UNSIGNED_INT */
1537
+ Engine.TEXTURETYPE_UNSIGNED_INTEGER = Constants.TEXTURETYPE_UNSIGNED_INTEGER;
1538
+ /** UNSIGNED_SHORT_4_4_4_4 */
1539
+ Engine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = Constants.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4;
1540
+ /** UNSIGNED_SHORT_5_5_5_1 */
1541
+ Engine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = Constants.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1;
1542
+ /** UNSIGNED_SHORT_5_6_5 */
1543
+ Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = Constants.TEXTURETYPE_UNSIGNED_SHORT_5_6_5;
1544
+ /** UNSIGNED_INT_2_10_10_10_REV */
1545
+ Engine.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = Constants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV;
1546
+ /** UNSIGNED_INT_24_8 */
1547
+ Engine.TEXTURETYPE_UNSIGNED_INT_24_8 = Constants.TEXTURETYPE_UNSIGNED_INT_24_8;
1548
+ /** UNSIGNED_INT_10F_11F_11F_REV */
1549
+ Engine.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = Constants.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV;
1550
+ /** UNSIGNED_INT_5_9_9_9_REV */
1551
+ Engine.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = Constants.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV;
1552
+ /** FLOAT_32_UNSIGNED_INT_24_8_REV */
1553
+ Engine.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = Constants.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV;
1554
+ /** nearest is mag = nearest and min = nearest and mip = none */
1555
+ Engine.TEXTURE_NEAREST_SAMPLINGMODE = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
1556
+ /** Bilinear is mag = linear and min = linear and mip = nearest */
1557
+ Engine.TEXTURE_BILINEAR_SAMPLINGMODE = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;
1558
+ /** Trilinear is mag = linear and min = linear and mip = linear */
1559
+ Engine.TEXTURE_TRILINEAR_SAMPLINGMODE = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;
1560
+ /** nearest is mag = nearest and min = nearest and mip = linear */
1561
+ Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR = Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR;
1562
+ /** Bilinear is mag = linear and min = linear and mip = nearest */
1563
+ Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST = Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST;
1564
+ /** Trilinear is mag = linear and min = linear and mip = linear */
1565
+ Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR = Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR;
1566
+ /** mag = nearest and min = nearest and mip = nearest */
1567
+ Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST = Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST;
1568
+ /** mag = nearest and min = linear and mip = nearest */
1569
+ Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST = Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST;
1570
+ /** mag = nearest and min = linear and mip = linear */
1571
+ Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR = Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR;
1572
+ /** mag = nearest and min = linear and mip = none */
1573
+ Engine.TEXTURE_NEAREST_LINEAR = Constants.TEXTURE_NEAREST_LINEAR;
1574
+ /** mag = nearest and min = nearest and mip = none */
1575
+ Engine.TEXTURE_NEAREST_NEAREST = Constants.TEXTURE_NEAREST_NEAREST;
1576
+ /** mag = linear and min = nearest and mip = nearest */
1577
+ Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST = Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST;
1578
+ /** mag = linear and min = nearest and mip = linear */
1579
+ Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR = Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR;
1580
+ /** mag = linear and min = linear and mip = none */
1581
+ Engine.TEXTURE_LINEAR_LINEAR = Constants.TEXTURE_LINEAR_LINEAR;
1582
+ /** mag = linear and min = nearest and mip = none */
1583
+ Engine.TEXTURE_LINEAR_NEAREST = Constants.TEXTURE_LINEAR_NEAREST;
1584
+ /** Explicit coordinates mode */
1585
+ Engine.TEXTURE_EXPLICIT_MODE = Constants.TEXTURE_EXPLICIT_MODE;
1586
+ /** Spherical coordinates mode */
1587
+ Engine.TEXTURE_SPHERICAL_MODE = Constants.TEXTURE_SPHERICAL_MODE;
1588
+ /** Planar coordinates mode */
1589
+ Engine.TEXTURE_PLANAR_MODE = Constants.TEXTURE_PLANAR_MODE;
1590
+ /** Cubic coordinates mode */
1591
+ Engine.TEXTURE_CUBIC_MODE = Constants.TEXTURE_CUBIC_MODE;
1592
+ /** Projection coordinates mode */
1593
+ Engine.TEXTURE_PROJECTION_MODE = Constants.TEXTURE_PROJECTION_MODE;
1594
+ /** Skybox coordinates mode */
1595
+ Engine.TEXTURE_SKYBOX_MODE = Constants.TEXTURE_SKYBOX_MODE;
1596
+ /** Inverse Cubic coordinates mode */
1597
+ Engine.TEXTURE_INVCUBIC_MODE = Constants.TEXTURE_INVCUBIC_MODE;
1598
+ /** Equirectangular coordinates mode */
1599
+ Engine.TEXTURE_EQUIRECTANGULAR_MODE = Constants.TEXTURE_EQUIRECTANGULAR_MODE;
1600
+ /** Equirectangular Fixed coordinates mode */
1601
+ Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MODE;
1602
+ /** Equirectangular Fixed Mirrored coordinates mode */
1603
+ Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;
1604
+ // Texture rescaling mode
1605
+ /** Defines that texture rescaling will use a floor to find the closer power of 2 size */
1606
+ Engine.SCALEMODE_FLOOR = Constants.SCALEMODE_FLOOR;
1607
+ /** Defines that texture rescaling will look for the nearest power of 2 size */
1608
+ Engine.SCALEMODE_NEAREST = Constants.SCALEMODE_NEAREST;
1609
+ /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */
1610
+ Engine.SCALEMODE_CEILING = Constants.SCALEMODE_CEILING;
1611
+
1612
+ export { Engine };
1613
+ //# sourceMappingURL=engine-DDK673Fr.esm.js.map