@babylonjs/viewer 7.40.3 → 7.40.4-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 (619) hide show
  1. package/assets/photoStudio.env +0 -0
  2. package/dist/babylon-viewer.esm.js +2 -0
  3. package/dist/babylon-viewer.esm.js.map +1 -0
  4. package/dist/babylon-viewer.esm.min.js +2 -0
  5. package/dist/babylon-viewer.esm.min.js.map +1 -0
  6. package/dist/chunks/EXT_lights_ies-B7tVMCka.esm.min.js +2 -0
  7. package/dist/chunks/EXT_lights_ies-B7tVMCka.esm.min.js.map +1 -0
  8. package/dist/chunks/EXT_lights_ies-T0Tkc0j0.esm.js +84 -0
  9. package/dist/chunks/EXT_lights_ies-T0Tkc0j0.esm.js.map +1 -0
  10. package/dist/chunks/EXT_lights_image_based-CyoPcoDC.esm.min.js +2 -0
  11. package/dist/chunks/EXT_lights_image_based-CyoPcoDC.esm.min.js.map +1 -0
  12. package/dist/chunks/EXT_lights_image_based-TRLY00MY.esm.js +171 -0
  13. package/dist/chunks/EXT_lights_image_based-TRLY00MY.esm.js.map +1 -0
  14. package/dist/chunks/EXT_mesh_gpu_instancing-CNSWr-2o.esm.js +86 -0
  15. package/dist/chunks/EXT_mesh_gpu_instancing-CNSWr-2o.esm.js.map +1 -0
  16. package/dist/chunks/EXT_mesh_gpu_instancing-DvkytavO.esm.min.js +2 -0
  17. package/dist/chunks/EXT_mesh_gpu_instancing-DvkytavO.esm.min.js.map +1 -0
  18. package/dist/chunks/EXT_meshopt_compression-C5Jf55Kx.esm.min.js +2 -0
  19. package/dist/chunks/EXT_meshopt_compression-C5Jf55Kx.esm.min.js.map +1 -0
  20. package/dist/chunks/EXT_meshopt_compression-CWVLJCmT.esm.js +134 -0
  21. package/dist/chunks/EXT_meshopt_compression-CWVLJCmT.esm.js.map +1 -0
  22. package/dist/chunks/EXT_texture_avif-Bv2Pa-Lr.esm.js +44 -0
  23. package/dist/chunks/EXT_texture_avif-Bv2Pa-Lr.esm.js.map +1 -0
  24. package/dist/chunks/EXT_texture_avif-DZmsorD-.esm.min.js +2 -0
  25. package/dist/chunks/EXT_texture_avif-DZmsorD-.esm.min.js.map +1 -0
  26. package/dist/chunks/EXT_texture_webp-CBpWQrqC.esm.js +43 -0
  27. package/dist/chunks/EXT_texture_webp-CBpWQrqC.esm.js.map +1 -0
  28. package/dist/chunks/EXT_texture_webp-D6RSOJSe.esm.min.js +2 -0
  29. package/dist/chunks/EXT_texture_webp-D6RSOJSe.esm.min.js.map +1 -0
  30. package/dist/chunks/ExtrasAsMetadata-6ZohdbjJ.esm.js +64 -0
  31. package/dist/chunks/ExtrasAsMetadata-6ZohdbjJ.esm.js.map +1 -0
  32. package/dist/chunks/ExtrasAsMetadata-CrG2l0Kf.esm.min.js +2 -0
  33. package/dist/chunks/ExtrasAsMetadata-CrG2l0Kf.esm.min.js.map +1 -0
  34. package/dist/chunks/KHR_animation_pointer-Cvu5a-gj.esm.js +352 -0
  35. package/dist/chunks/KHR_animation_pointer-Cvu5a-gj.esm.js.map +1 -0
  36. package/dist/chunks/KHR_animation_pointer-Rk2uzfDp.esm.min.js +2 -0
  37. package/dist/chunks/KHR_animation_pointer-Rk2uzfDp.esm.min.js.map +1 -0
  38. package/dist/chunks/KHR_draco_mesh_compression-BrXprwd5.esm.js +610 -0
  39. package/dist/chunks/KHR_draco_mesh_compression-BrXprwd5.esm.js.map +1 -0
  40. package/dist/chunks/KHR_draco_mesh_compression-Iv3q50MG.esm.min.js +2 -0
  41. package/dist/chunks/KHR_draco_mesh_compression-Iv3q50MG.esm.min.js.map +1 -0
  42. package/dist/chunks/KHR_interactivity-B4iFgkk7.esm.min.js +2 -0
  43. package/dist/chunks/KHR_interactivity-B4iFgkk7.esm.min.js.map +1 -0
  44. package/dist/chunks/KHR_interactivity-Db4iHU65.esm.js +4033 -0
  45. package/dist/chunks/KHR_interactivity-Db4iHU65.esm.js.map +1 -0
  46. package/dist/chunks/KHR_lights_punctual-B7yNiRZy.esm.min.js +2 -0
  47. package/dist/chunks/KHR_lights_punctual-B7yNiRZy.esm.min.js.map +1 -0
  48. package/dist/chunks/KHR_lights_punctual-iZl19DTA.esm.js +581 -0
  49. package/dist/chunks/KHR_lights_punctual-iZl19DTA.esm.js.map +1 -0
  50. package/dist/chunks/KHR_materials_anisotropy-Bk9K0k0q.esm.js +65 -0
  51. package/dist/chunks/KHR_materials_anisotropy-Bk9K0k0q.esm.js.map +1 -0
  52. package/dist/chunks/KHR_materials_anisotropy-DlDnL4o4.esm.min.js +2 -0
  53. package/dist/chunks/KHR_materials_anisotropy-DlDnL4o4.esm.min.js.map +1 -0
  54. package/dist/chunks/KHR_materials_clearcoat-BrT4VgMS.esm.min.js +2 -0
  55. package/dist/chunks/KHR_materials_clearcoat-BrT4VgMS.esm.min.js.map +1 -0
  56. package/dist/chunks/KHR_materials_clearcoat-DXAyxIfA.esm.js +96 -0
  57. package/dist/chunks/KHR_materials_clearcoat-DXAyxIfA.esm.js.map +1 -0
  58. package/dist/chunks/KHR_materials_diffuse_transmission-CRqI4Umg.esm.js +97 -0
  59. package/dist/chunks/KHR_materials_diffuse_transmission-CRqI4Umg.esm.js.map +1 -0
  60. package/dist/chunks/KHR_materials_diffuse_transmission-jyVvmpFx.esm.min.js +2 -0
  61. package/dist/chunks/KHR_materials_diffuse_transmission-jyVvmpFx.esm.min.js.map +1 -0
  62. package/dist/chunks/KHR_materials_dispersion-BwXQSsRC.esm.min.js +2 -0
  63. package/dist/chunks/KHR_materials_dispersion-BwXQSsRC.esm.min.js.map +1 -0
  64. package/dist/chunks/KHR_materials_dispersion-DTMaHZal.esm.js +62 -0
  65. package/dist/chunks/KHR_materials_dispersion-DTMaHZal.esm.js.map +1 -0
  66. package/dist/chunks/KHR_materials_emissive_strength-BCWSR6Zg.esm.js +55 -0
  67. package/dist/chunks/KHR_materials_emissive_strength-BCWSR6Zg.esm.js.map +1 -0
  68. package/dist/chunks/KHR_materials_emissive_strength-dEqNWrU4.esm.min.js +2 -0
  69. package/dist/chunks/KHR_materials_emissive_strength-dEqNWrU4.esm.min.js.map +1 -0
  70. package/dist/chunks/KHR_materials_ior-DXmoDlX8.esm.min.js +2 -0
  71. package/dist/chunks/KHR_materials_ior-DXmoDlX8.esm.min.js.map +1 -0
  72. package/dist/chunks/KHR_materials_ior-NvWqR2ZR.esm.js +64 -0
  73. package/dist/chunks/KHR_materials_ior-NvWqR2ZR.esm.js.map +1 -0
  74. package/dist/chunks/KHR_materials_iridescence-2VKZo_Mv.esm.min.js +2 -0
  75. package/dist/chunks/KHR_materials_iridescence-2VKZo_Mv.esm.min.js.map +1 -0
  76. package/dist/chunks/KHR_materials_iridescence-B2wLtYQ4.esm.js +72 -0
  77. package/dist/chunks/KHR_materials_iridescence-B2wLtYQ4.esm.js.map +1 -0
  78. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DYK5fci0.esm.js +81 -0
  79. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DYK5fci0.esm.js.map +1 -0
  80. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-PlzNRHwZ.esm.min.js +2 -0
  81. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-PlzNRHwZ.esm.min.js.map +1 -0
  82. package/dist/chunks/KHR_materials_sheen-CvA19viC.esm.min.js +2 -0
  83. package/dist/chunks/KHR_materials_sheen-CvA19viC.esm.min.js.map +1 -0
  84. package/dist/chunks/KHR_materials_sheen-DY8Hlw2C.esm.js +85 -0
  85. package/dist/chunks/KHR_materials_sheen-DY8Hlw2C.esm.js.map +1 -0
  86. package/dist/chunks/KHR_materials_specular-DPankAYO.esm.js +75 -0
  87. package/dist/chunks/KHR_materials_specular-DPankAYO.esm.js.map +1 -0
  88. package/dist/chunks/KHR_materials_specular-SFjYTaHn.esm.min.js +2 -0
  89. package/dist/chunks/KHR_materials_specular-SFjYTaHn.esm.min.js.map +1 -0
  90. package/dist/chunks/KHR_materials_transmission-CBvCfGeN.esm.js +307 -0
  91. package/dist/chunks/KHR_materials_transmission-CBvCfGeN.esm.js.map +1 -0
  92. package/dist/chunks/KHR_materials_transmission-DeRHqgMd.esm.min.js +2 -0
  93. package/dist/chunks/KHR_materials_transmission-DeRHqgMd.esm.min.js.map +1 -0
  94. package/dist/chunks/KHR_materials_unlit-Dp-VzfY2.esm.min.js +2 -0
  95. package/dist/chunks/KHR_materials_unlit-Dp-VzfY2.esm.min.js.map +1 -0
  96. package/dist/chunks/KHR_materials_unlit-xG3eIsVn.esm.js +74 -0
  97. package/dist/chunks/KHR_materials_unlit-xG3eIsVn.esm.js.map +1 -0
  98. package/dist/chunks/KHR_materials_variants-DtTs7enl.esm.min.js +2 -0
  99. package/dist/chunks/KHR_materials_variants-DtTs7enl.esm.min.js.map +1 -0
  100. package/dist/chunks/KHR_materials_variants-POauQPs7.esm.js +262 -0
  101. package/dist/chunks/KHR_materials_variants-POauQPs7.esm.js.map +1 -0
  102. package/dist/chunks/KHR_materials_volume-BO1lvsUq.esm.min.js +2 -0
  103. package/dist/chunks/KHR_materials_volume-BO1lvsUq.esm.min.js.map +1 -0
  104. package/dist/chunks/KHR_materials_volume-BqCunks7.esm.js +87 -0
  105. package/dist/chunks/KHR_materials_volume-BqCunks7.esm.js.map +1 -0
  106. package/dist/chunks/KHR_mesh_quantization-3ON-a5Bz.esm.js +26 -0
  107. package/dist/chunks/KHR_mesh_quantization-3ON-a5Bz.esm.js.map +1 -0
  108. package/dist/chunks/KHR_mesh_quantization-C1uR5Lci.esm.min.js +2 -0
  109. package/dist/chunks/KHR_mesh_quantization-C1uR5Lci.esm.min.js.map +1 -0
  110. package/dist/chunks/KHR_node_hoverability-CZIi0X9e.esm.js +39 -0
  111. package/dist/chunks/KHR_node_hoverability-CZIi0X9e.esm.js.map +1 -0
  112. package/dist/chunks/KHR_node_hoverability-gPD0oS5c.esm.min.js +2 -0
  113. package/dist/chunks/KHR_node_hoverability-gPD0oS5c.esm.min.js.map +1 -0
  114. package/dist/chunks/KHR_node_visibility-B5fFI1TX.esm.js +46 -0
  115. package/dist/chunks/KHR_node_visibility-B5fFI1TX.esm.js.map +1 -0
  116. package/dist/chunks/KHR_node_visibility-DPw-0W4p.esm.min.js +2 -0
  117. package/dist/chunks/KHR_node_visibility-DPw-0W4p.esm.min.js.map +1 -0
  118. package/dist/chunks/KHR_texture_basisu-D6tStneN.esm.min.js +2 -0
  119. package/dist/chunks/KHR_texture_basisu-D6tStneN.esm.min.js.map +1 -0
  120. package/dist/chunks/KHR_texture_basisu-Did7TM-4.esm.js +43 -0
  121. package/dist/chunks/KHR_texture_basisu-Did7TM-4.esm.js.map +1 -0
  122. package/dist/chunks/KHR_texture_transform-Da5NeRUm.esm.js +63 -0
  123. package/dist/chunks/KHR_texture_transform-Da5NeRUm.esm.js.map +1 -0
  124. package/dist/chunks/KHR_texture_transform-jNMzm3zb.esm.min.js +2 -0
  125. package/dist/chunks/KHR_texture_transform-jNMzm3zb.esm.min.js.map +1 -0
  126. package/dist/chunks/KHR_xmp_json_ld-D514my_a.esm.js +51 -0
  127. package/dist/chunks/KHR_xmp_json_ld-D514my_a.esm.js.map +1 -0
  128. package/dist/chunks/KHR_xmp_json_ld-D5Gbko_w.esm.min.js +2 -0
  129. package/dist/chunks/KHR_xmp_json_ld-D5Gbko_w.esm.min.js.map +1 -0
  130. package/dist/chunks/MSFT_audio_emitter-CiB3yG6v.esm.js +2201 -0
  131. package/dist/chunks/MSFT_audio_emitter-CiB3yG6v.esm.js.map +1 -0
  132. package/dist/chunks/MSFT_audio_emitter-Cn-DCgMh.esm.min.js +2 -0
  133. package/dist/chunks/MSFT_audio_emitter-Cn-DCgMh.esm.min.js.map +1 -0
  134. package/dist/chunks/MSFT_lod-BDP9fUoB.esm.js +337 -0
  135. package/dist/chunks/MSFT_lod-BDP9fUoB.esm.js.map +1 -0
  136. package/dist/chunks/MSFT_lod-BEbIdncN.esm.min.js +2 -0
  137. package/dist/chunks/MSFT_lod-BEbIdncN.esm.min.js.map +1 -0
  138. package/dist/chunks/MSFT_minecraftMesh-jASzndfE.esm.min.js +2 -0
  139. package/dist/chunks/MSFT_minecraftMesh-jASzndfE.esm.min.js.map +1 -0
  140. package/dist/chunks/MSFT_minecraftMesh-mKnNUrKI.esm.js +46 -0
  141. package/dist/chunks/MSFT_minecraftMesh-mKnNUrKI.esm.js.map +1 -0
  142. package/dist/chunks/MSFT_sRGBFactors-B1Bk1U5N.esm.min.js +2 -0
  143. package/dist/chunks/MSFT_sRGBFactors-B1Bk1U5N.esm.min.js.map +1 -0
  144. package/dist/chunks/MSFT_sRGBFactors-IZnSmmDU.esm.js +47 -0
  145. package/dist/chunks/MSFT_sRGBFactors-IZnSmmDU.esm.js.map +1 -0
  146. package/dist/chunks/animationGroup-B1YyqoTa.esm.js +2482 -0
  147. package/dist/chunks/animationGroup-B1YyqoTa.esm.js.map +1 -0
  148. package/dist/chunks/animationGroup-C9C7qST_.esm.min.js +2 -0
  149. package/dist/chunks/animationGroup-C9C7qST_.esm.min.js.map +1 -0
  150. package/dist/chunks/assetContainer-BzlRl_4x.esm.js +1720 -0
  151. package/dist/chunks/assetContainer-BzlRl_4x.esm.js.map +1 -0
  152. package/dist/chunks/assetContainer-D7C3a-Xn.esm.min.js +2 -0
  153. package/dist/chunks/assetContainer-D7C3a-Xn.esm.min.js.map +1 -0
  154. package/dist/chunks/audioEngine-BZB34VjD.esm.js +305 -0
  155. package/dist/chunks/audioEngine-BZB34VjD.esm.js.map +1 -0
  156. package/dist/chunks/audioEngine-BoxJPZL7.esm.min.js +2 -0
  157. package/dist/chunks/audioEngine-BoxJPZL7.esm.min.js.map +1 -0
  158. package/dist/chunks/bakedVertexAnimation-BQki1eZ4.esm.min.js +2 -0
  159. package/dist/chunks/bakedVertexAnimation-BQki1eZ4.esm.min.js.map +1 -0
  160. package/dist/chunks/bakedVertexAnimation-DpSHNKcC.esm.js +114 -0
  161. package/dist/chunks/bakedVertexAnimation-DpSHNKcC.esm.js.map +1 -0
  162. package/dist/chunks/basisTextureLoader-C3RlzqZl.esm.min.js +2 -0
  163. package/dist/chunks/basisTextureLoader-C3RlzqZl.esm.min.js.map +1 -0
  164. package/dist/chunks/basisTextureLoader-D6uyehp2.esm.js +600 -0
  165. package/dist/chunks/basisTextureLoader-D6uyehp2.esm.js.map +1 -0
  166. package/dist/chunks/dds-C1QgDMMC.esm.min.js +2 -0
  167. package/dist/chunks/dds-C1QgDMMC.esm.min.js.map +1 -0
  168. package/dist/chunks/dds-zApWiwah.esm.js +540 -0
  169. package/dist/chunks/dds-zApWiwah.esm.js.map +1 -0
  170. package/dist/chunks/ddsTextureLoader-CSYQAUdw.esm.js +88 -0
  171. package/dist/chunks/ddsTextureLoader-CSYQAUdw.esm.js.map +1 -0
  172. package/dist/chunks/ddsTextureLoader-Dyl2CjaG.esm.min.js +2 -0
  173. package/dist/chunks/ddsTextureLoader-Dyl2CjaG.esm.min.js.map +1 -0
  174. package/dist/chunks/decalFragment-BbsT8PSx.esm.min.js +2 -0
  175. package/dist/chunks/decalFragment-BbsT8PSx.esm.min.js.map +1 -0
  176. package/dist/chunks/decalFragment-DqgT4NiX.esm.js +18 -0
  177. package/dist/chunks/decalFragment-DqgT4NiX.esm.js.map +1 -0
  178. package/dist/chunks/default.fragment-Bpw23SLq.esm.min.js +2 -0
  179. package/dist/chunks/default.fragment-Bpw23SLq.esm.min.js.map +1 -0
  180. package/dist/chunks/default.fragment-C8lcinV9.esm.js +446 -0
  181. package/dist/chunks/default.fragment-C8lcinV9.esm.js.map +1 -0
  182. package/dist/chunks/default.fragment-De3FJCJD.esm.js +515 -0
  183. package/dist/chunks/default.fragment-De3FJCJD.esm.js.map +1 -0
  184. package/dist/chunks/default.fragment-b__nAv93.esm.min.js +2 -0
  185. package/dist/chunks/default.fragment-b__nAv93.esm.min.js.map +1 -0
  186. package/dist/chunks/default.vertex-BnpZVKdz.esm.min.js +2 -0
  187. package/dist/chunks/default.vertex-BnpZVKdz.esm.min.js.map +1 -0
  188. package/dist/chunks/default.vertex-CD2qxrmB.esm.js +190 -0
  189. package/dist/chunks/default.vertex-CD2qxrmB.esm.js.map +1 -0
  190. package/dist/chunks/default.vertex-CN5WYROZ.esm.min.js +2 -0
  191. package/dist/chunks/default.vertex-CN5WYROZ.esm.min.js.map +1 -0
  192. package/dist/chunks/default.vertex-DRHq60qX.esm.js +211 -0
  193. package/dist/chunks/default.vertex-DRHq60qX.esm.js.map +1 -0
  194. package/dist/chunks/defaultUboDeclaration-C0gMCjYL.esm.min.js +2 -0
  195. package/dist/chunks/defaultUboDeclaration-C0gMCjYL.esm.min.js.map +1 -0
  196. package/dist/chunks/defaultUboDeclaration-CGRrluBg.esm.min.js +2 -0
  197. package/dist/chunks/defaultUboDeclaration-CGRrluBg.esm.min.js.map +1 -0
  198. package/dist/chunks/defaultUboDeclaration-DCybxQ0F.esm.js +13 -0
  199. package/dist/chunks/defaultUboDeclaration-DCybxQ0F.esm.js.map +1 -0
  200. package/dist/chunks/defaultUboDeclaration-xxIrKyXf.esm.js +15 -0
  201. package/dist/chunks/defaultUboDeclaration-xxIrKyXf.esm.js.map +1 -0
  202. package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js +11 -0
  203. package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js.map +1 -0
  204. package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js +2 -0
  205. package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js.map +1 -0
  206. package/dist/chunks/dumpTools-BOVGklo2.esm.min.js +2 -0
  207. package/dist/chunks/dumpTools-BOVGklo2.esm.min.js.map +1 -0
  208. package/dist/chunks/dumpTools-Dy-fD64p.esm.js +200 -0
  209. package/dist/chunks/dumpTools-Dy-fD64p.esm.js.map +1 -0
  210. package/dist/chunks/engine-CBGABL2W.esm.min.js +2 -0
  211. package/dist/chunks/engine-CBGABL2W.esm.min.js.map +1 -0
  212. package/dist/chunks/engine-D9Sn-BC6.esm.js +2213 -0
  213. package/dist/chunks/engine-D9Sn-BC6.esm.js.map +1 -0
  214. package/dist/chunks/engine.common-BM1GAef8.esm.js +1162 -0
  215. package/dist/chunks/engine.common-BM1GAef8.esm.js.map +1 -0
  216. package/dist/chunks/engine.common-xMH7x2b0.esm.min.js +2 -0
  217. package/dist/chunks/engine.common-xMH7x2b0.esm.min.js.map +1 -0
  218. package/dist/chunks/envTextureLoader-BRdNaVH2.esm.min.js +2 -0
  219. package/dist/chunks/envTextureLoader-BRdNaVH2.esm.min.js.map +1 -0
  220. package/dist/chunks/envTextureLoader-DT_xwrde.esm.js +64 -0
  221. package/dist/chunks/envTextureLoader-DT_xwrde.esm.js.map +1 -0
  222. package/dist/chunks/environmentTextureTools-BxWsgzT8.esm.min.js +2 -0
  223. package/dist/chunks/environmentTextureTools-BxWsgzT8.esm.min.js.map +1 -0
  224. package/dist/chunks/environmentTextureTools-DuNLB_SE.esm.js +382 -0
  225. package/dist/chunks/environmentTextureTools-DuNLB_SE.esm.js.map +1 -0
  226. package/dist/chunks/exrTextureLoader-BBL1-v_g.esm.min.js +2 -0
  227. package/dist/chunks/exrTextureLoader-BBL1-v_g.esm.min.js.map +1 -0
  228. package/dist/chunks/exrTextureLoader-CUiWw4Oh.esm.js +1683 -0
  229. package/dist/chunks/exrTextureLoader-CUiWw4Oh.esm.js.map +1 -0
  230. package/dist/chunks/fogFragment-BCz1GIrJ.esm.min.js +2 -0
  231. package/dist/chunks/fogFragment-BCz1GIrJ.esm.min.js.map +1 -0
  232. package/dist/chunks/fogFragment-BQLWFsYl.esm.min.js +2 -0
  233. package/dist/chunks/fogFragment-BQLWFsYl.esm.min.js.map +1 -0
  234. package/dist/chunks/fogFragment-DANl-YQk.esm.js +102 -0
  235. package/dist/chunks/fogFragment-DANl-YQk.esm.js.map +1 -0
  236. package/dist/chunks/fogFragment-DptoygQ5.esm.js +101 -0
  237. package/dist/chunks/fogFragment-DptoygQ5.esm.js.map +1 -0
  238. package/dist/chunks/fresnelFunction-3-z89NGn.esm.js +12 -0
  239. package/dist/chunks/fresnelFunction-3-z89NGn.esm.js.map +1 -0
  240. package/dist/chunks/fresnelFunction-CbnLfwWn.esm.min.js +2 -0
  241. package/dist/chunks/fresnelFunction-CbnLfwWn.esm.min.js.map +1 -0
  242. package/dist/chunks/glTFLoader-Qw5JObwf.esm.js +7658 -0
  243. package/dist/chunks/glTFLoader-Qw5JObwf.esm.js.map +1 -0
  244. package/dist/chunks/glTFLoader-iKlvKEG-.esm.min.js +2 -0
  245. package/dist/chunks/glTFLoader-iKlvKEG-.esm.min.js.map +1 -0
  246. package/dist/chunks/glTFLoaderAnimation-BCUZthxT.esm.js +77 -0
  247. package/dist/chunks/glTFLoaderAnimation-BCUZthxT.esm.js.map +1 -0
  248. package/dist/chunks/glTFLoaderAnimation-DnTkRibM.esm.min.js +2 -0
  249. package/dist/chunks/glTFLoaderAnimation-DnTkRibM.esm.min.js.map +1 -0
  250. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js +2 -0
  251. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js.map +1 -0
  252. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js +67 -0
  253. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js.map +1 -0
  254. package/dist/chunks/harmonicsFunctions-19PWyV81.esm.js +34 -0
  255. package/dist/chunks/harmonicsFunctions-19PWyV81.esm.js.map +1 -0
  256. package/dist/chunks/harmonicsFunctions-D4sp7bHN.esm.js +35 -0
  257. package/dist/chunks/harmonicsFunctions-D4sp7bHN.esm.js.map +1 -0
  258. package/dist/chunks/harmonicsFunctions-DSpaTpH7.esm.min.js +2 -0
  259. package/dist/chunks/harmonicsFunctions-DSpaTpH7.esm.min.js.map +1 -0
  260. package/dist/chunks/harmonicsFunctions-DvH68s1g.esm.min.js +2 -0
  261. package/dist/chunks/harmonicsFunctions-DvH68s1g.esm.min.js.map +1 -0
  262. package/dist/chunks/hdrTextureLoader-ChbZ5_1g.esm.min.js +2 -0
  263. package/dist/chunks/hdrTextureLoader-ChbZ5_1g.esm.min.js.map +1 -0
  264. package/dist/chunks/hdrTextureLoader-OJaopXAb.esm.js +253 -0
  265. package/dist/chunks/hdrTextureLoader-OJaopXAb.esm.js.map +1 -0
  266. package/dist/chunks/helperFunctions-CNCeKea7.esm.js +81 -0
  267. package/dist/chunks/helperFunctions-CNCeKea7.esm.js.map +1 -0
  268. package/dist/chunks/helperFunctions-Crs36Q3w.esm.js +109 -0
  269. package/dist/chunks/helperFunctions-Crs36Q3w.esm.js.map +1 -0
  270. package/dist/chunks/helperFunctions-DKz6om6i.esm.min.js +2 -0
  271. package/dist/chunks/helperFunctions-DKz6om6i.esm.min.js.map +1 -0
  272. package/dist/chunks/helperFunctions-bZhuioWn.esm.min.js +2 -0
  273. package/dist/chunks/helperFunctions-bZhuioWn.esm.min.js.map +1 -0
  274. package/dist/chunks/iesTextureLoader-BTOaWdIK.esm.js +189 -0
  275. package/dist/chunks/iesTextureLoader-BTOaWdIK.esm.js.map +1 -0
  276. package/dist/chunks/iesTextureLoader-CKnu1maC.esm.min.js +2 -0
  277. package/dist/chunks/iesTextureLoader-CKnu1maC.esm.min.js.map +1 -0
  278. package/dist/chunks/index-5L5wXyrx.esm.js +74870 -0
  279. package/dist/chunks/index-5L5wXyrx.esm.js.map +1 -0
  280. package/dist/chunks/index-B5KLkjYm.esm.min.js +57 -0
  281. package/dist/chunks/index-B5KLkjYm.esm.min.js.map +1 -0
  282. package/dist/chunks/ktxTextureLoader-CMfHt5rp.esm.js +814 -0
  283. package/dist/chunks/ktxTextureLoader-CMfHt5rp.esm.js.map +1 -0
  284. package/dist/chunks/ktxTextureLoader-DCyzShol.esm.min.js +2 -0
  285. package/dist/chunks/ktxTextureLoader-DCyzShol.esm.min.js.map +1 -0
  286. package/dist/chunks/logDepthDeclaration-8CuoGLY6.esm.js +35 -0
  287. package/dist/chunks/logDepthDeclaration-8CuoGLY6.esm.js.map +1 -0
  288. package/dist/chunks/logDepthDeclaration-BC68Ktb0.esm.js +11 -0
  289. package/dist/chunks/logDepthDeclaration-BC68Ktb0.esm.js.map +1 -0
  290. package/dist/chunks/logDepthDeclaration-CgPuLaM9.esm.min.js +2 -0
  291. package/dist/chunks/logDepthDeclaration-CgPuLaM9.esm.min.js.map +1 -0
  292. package/dist/chunks/logDepthDeclaration-iNYm9mSn.esm.min.js +2 -0
  293. package/dist/chunks/logDepthDeclaration-iNYm9mSn.esm.min.js.map +1 -0
  294. package/dist/chunks/logDepthVertex-BOepIJij.esm.js +77 -0
  295. package/dist/chunks/logDepthVertex-BOepIJij.esm.js.map +1 -0
  296. package/dist/chunks/logDepthVertex-Bno6ozc-.esm.min.js +2 -0
  297. package/dist/chunks/logDepthVertex-Bno6ozc-.esm.min.js.map +1 -0
  298. package/dist/chunks/logDepthVertex-CU3WBwOA.esm.js +81 -0
  299. package/dist/chunks/logDepthVertex-CU3WBwOA.esm.js.map +1 -0
  300. package/dist/chunks/logDepthVertex-DjeubcPn.esm.min.js +2 -0
  301. package/dist/chunks/logDepthVertex-DjeubcPn.esm.min.js.map +1 -0
  302. package/dist/chunks/mainUVVaryingDeclaration-C_Am-o4e.esm.js +11 -0
  303. package/dist/chunks/mainUVVaryingDeclaration-C_Am-o4e.esm.js.map +1 -0
  304. package/dist/chunks/mainUVVaryingDeclaration-CuSqEhkE.esm.min.js +2 -0
  305. package/dist/chunks/mainUVVaryingDeclaration-CuSqEhkE.esm.min.js.map +1 -0
  306. package/dist/chunks/mainUVVaryingDeclaration-DxqJq0-m.esm.js +11 -0
  307. package/dist/chunks/mainUVVaryingDeclaration-DxqJq0-m.esm.js.map +1 -0
  308. package/dist/chunks/mainUVVaryingDeclaration-oZF0xIut.esm.min.js +2 -0
  309. package/dist/chunks/mainUVVaryingDeclaration-oZF0xIut.esm.min.js.map +1 -0
  310. package/dist/chunks/mesh.vertexData.functions-B_pMCAzZ.esm.js +119 -0
  311. package/dist/chunks/mesh.vertexData.functions-B_pMCAzZ.esm.js.map +1 -0
  312. package/dist/chunks/mesh.vertexData.functions-Bo7e6Of9.esm.min.js +2 -0
  313. package/dist/chunks/mesh.vertexData.functions-Bo7e6Of9.esm.min.js.map +1 -0
  314. package/dist/chunks/meshUboDeclaration-BWuUYN5-.esm.js +26 -0
  315. package/dist/chunks/meshUboDeclaration-BWuUYN5-.esm.js.map +1 -0
  316. package/dist/chunks/meshUboDeclaration-D-9f-79D.esm.min.js +2 -0
  317. package/dist/chunks/meshUboDeclaration-D-9f-79D.esm.min.js.map +1 -0
  318. package/dist/chunks/objFileLoader-B3PzHlWB.esm.min.js +2 -0
  319. package/dist/chunks/objFileLoader-B3PzHlWB.esm.min.js.map +1 -0
  320. package/dist/chunks/objFileLoader-BjHr-pn1.esm.js +1338 -0
  321. package/dist/chunks/objFileLoader-BjHr-pn1.esm.js.map +1 -0
  322. package/dist/chunks/oitFragment-BypZDJVo.esm.min.js +2 -0
  323. package/dist/chunks/oitFragment-BypZDJVo.esm.min.js.map +1 -0
  324. package/dist/chunks/oitFragment-D3g8w3hO.esm.js +1078 -0
  325. package/dist/chunks/oitFragment-D3g8w3hO.esm.js.map +1 -0
  326. package/dist/chunks/oitFragment-Db3h4DV5.esm.min.js +2 -0
  327. package/dist/chunks/oitFragment-Db3h4DV5.esm.min.js.map +1 -0
  328. package/dist/chunks/oitFragment-tQJLudg5.esm.js +1240 -0
  329. package/dist/chunks/oitFragment-tQJLudg5.esm.js.map +1 -0
  330. package/dist/chunks/pass.fragment-C8CWeVkM.esm.js +15 -0
  331. package/dist/chunks/pass.fragment-C8CWeVkM.esm.js.map +1 -0
  332. package/dist/chunks/pass.fragment-CSK2ynPe.esm.js +15 -0
  333. package/dist/chunks/pass.fragment-CSK2ynPe.esm.js.map +1 -0
  334. package/dist/chunks/pass.fragment-CdgLWa1Q.esm.min.js +2 -0
  335. package/dist/chunks/pass.fragment-CdgLWa1Q.esm.min.js.map +1 -0
  336. package/dist/chunks/pass.fragment-ONNyQPrD.esm.min.js +2 -0
  337. package/dist/chunks/pass.fragment-ONNyQPrD.esm.min.js.map +1 -0
  338. package/dist/chunks/pbr.fragment-Be9mZgL7.esm.js +3269 -0
  339. package/dist/chunks/pbr.fragment-Be9mZgL7.esm.js.map +1 -0
  340. package/dist/chunks/pbr.fragment-C13t4f7Z.esm.min.js +2 -0
  341. package/dist/chunks/pbr.fragment-C13t4f7Z.esm.min.js.map +1 -0
  342. package/dist/chunks/pbr.fragment-CiAe6mgr.esm.js +3222 -0
  343. package/dist/chunks/pbr.fragment-CiAe6mgr.esm.js.map +1 -0
  344. package/dist/chunks/pbr.fragment-I66pqwoX.esm.min.js +2 -0
  345. package/dist/chunks/pbr.fragment-I66pqwoX.esm.min.js.map +1 -0
  346. package/dist/chunks/pbr.vertex-BlqPEcZe.esm.js +223 -0
  347. package/dist/chunks/pbr.vertex-BlqPEcZe.esm.js.map +1 -0
  348. package/dist/chunks/pbr.vertex-C1r_QFvZ.esm.min.js +2 -0
  349. package/dist/chunks/pbr.vertex-C1r_QFvZ.esm.min.js.map +1 -0
  350. package/dist/chunks/pbr.vertex-DE9NTHal.esm.min.js +2 -0
  351. package/dist/chunks/pbr.vertex-DE9NTHal.esm.min.js.map +1 -0
  352. package/dist/chunks/pbr.vertex-oQpu2zia.esm.js +348 -0
  353. package/dist/chunks/pbr.vertex-oQpu2zia.esm.js.map +1 -0
  354. package/dist/chunks/postprocess.vertex-D3XLqa14.esm.js +20 -0
  355. package/dist/chunks/postprocess.vertex-D3XLqa14.esm.js.map +1 -0
  356. package/dist/chunks/postprocess.vertex-IkQbrBQH.esm.min.js +2 -0
  357. package/dist/chunks/postprocess.vertex-IkQbrBQH.esm.min.js.map +1 -0
  358. package/dist/chunks/rawTexture-BVf9vm87.esm.js +191 -0
  359. package/dist/chunks/rawTexture-BVf9vm87.esm.js.map +1 -0
  360. package/dist/chunks/rawTexture-CNxyCiVq.esm.min.js +2 -0
  361. package/dist/chunks/rawTexture-CNxyCiVq.esm.min.js.map +1 -0
  362. package/dist/chunks/ray-BLVbie8S.esm.min.js +2 -0
  363. package/dist/chunks/ray-BLVbie8S.esm.min.js.map +1 -0
  364. package/dist/chunks/ray-C7H9vp-x.esm.js +946 -0
  365. package/dist/chunks/ray-C7H9vp-x.esm.js.map +1 -0
  366. package/dist/chunks/rgbdDecode.fragment-9dPOcBOA.esm.min.js +2 -0
  367. package/dist/chunks/rgbdDecode.fragment-9dPOcBOA.esm.min.js.map +1 -0
  368. package/dist/chunks/rgbdDecode.fragment-ApyH83v_.esm.js +13 -0
  369. package/dist/chunks/rgbdDecode.fragment-ApyH83v_.esm.js.map +1 -0
  370. package/dist/chunks/rgbdDecode.fragment-Bt75XOUV.esm.min.js +2 -0
  371. package/dist/chunks/rgbdDecode.fragment-Bt75XOUV.esm.min.js.map +1 -0
  372. package/dist/chunks/rgbdDecode.fragment-DDIJs9ID.esm.js +13 -0
  373. package/dist/chunks/rgbdDecode.fragment-DDIJs9ID.esm.js.map +1 -0
  374. package/dist/chunks/rgbdEncode.fragment-CSquf6K4.esm.js +13 -0
  375. package/dist/chunks/rgbdEncode.fragment-CSquf6K4.esm.js.map +1 -0
  376. package/dist/chunks/rgbdEncode.fragment-Cpudy2qT.esm.js +13 -0
  377. package/dist/chunks/rgbdEncode.fragment-Cpudy2qT.esm.js.map +1 -0
  378. package/dist/chunks/rgbdEncode.fragment-DZs59_tV.esm.min.js +2 -0
  379. package/dist/chunks/rgbdEncode.fragment-DZs59_tV.esm.min.js.map +1 -0
  380. package/dist/chunks/rgbdEncode.fragment-Djxd-azW.esm.min.js +2 -0
  381. package/dist/chunks/rgbdEncode.fragment-Djxd-azW.esm.min.js.map +1 -0
  382. package/dist/chunks/splatFileLoader-BkExyfY6.esm.js +3379 -0
  383. package/dist/chunks/splatFileLoader-BkExyfY6.esm.js.map +1 -0
  384. package/dist/chunks/splatFileLoader-DLc_wKu4.esm.min.js +2 -0
  385. package/dist/chunks/splatFileLoader-DLc_wKu4.esm.min.js.map +1 -0
  386. package/dist/chunks/spotLight-CFGRpcFc.esm.js +701 -0
  387. package/dist/chunks/spotLight-CFGRpcFc.esm.js.map +1 -0
  388. package/dist/chunks/spotLight-z5HIEQmM.esm.min.js +2 -0
  389. package/dist/chunks/spotLight-z5HIEQmM.esm.min.js.map +1 -0
  390. package/dist/chunks/standardMaterial-B5u9Vzil.esm.min.js +2 -0
  391. package/dist/chunks/standardMaterial-B5u9Vzil.esm.min.js.map +1 -0
  392. package/dist/chunks/standardMaterial-BJzDZ72T.esm.js +1806 -0
  393. package/dist/chunks/standardMaterial-BJzDZ72T.esm.js.map +1 -0
  394. package/dist/chunks/stlFileLoader-B3Y6u4L6.esm.min.js +2 -0
  395. package/dist/chunks/stlFileLoader-B3Y6u4L6.esm.min.js.map +1 -0
  396. package/dist/chunks/stlFileLoader-Bd1GgkYU.esm.js +238 -0
  397. package/dist/chunks/stlFileLoader-Bd1GgkYU.esm.js.map +1 -0
  398. package/dist/chunks/tgaTextureLoader-BD_A6gyw.esm.min.js +2 -0
  399. package/dist/chunks/tgaTextureLoader-BD_A6gyw.esm.min.js.map +1 -0
  400. package/dist/chunks/tgaTextureLoader-DnUiJRBO.esm.js +349 -0
  401. package/dist/chunks/tgaTextureLoader-DnUiJRBO.esm.js.map +1 -0
  402. package/dist/chunks/thinEngine-CRNAFHqA.esm.min.js +2 -0
  403. package/dist/chunks/thinEngine-CRNAFHqA.esm.min.js.map +1 -0
  404. package/dist/chunks/thinEngine-DGyFDxzW.esm.js +3853 -0
  405. package/dist/chunks/thinEngine-DGyFDxzW.esm.js.map +1 -0
  406. package/dist/chunks/thinInstanceMesh-B-f1KNB2.esm.min.js +2 -0
  407. package/dist/chunks/thinInstanceMesh-B-f1KNB2.esm.min.js.map +1 -0
  408. package/dist/chunks/thinInstanceMesh-D-cofgbF.esm.js +314 -0
  409. package/dist/chunks/thinInstanceMesh-D-cofgbF.esm.js.map +1 -0
  410. package/dist/chunks/vertexColorMixing-BUqoiJkS.esm.min.js +2 -0
  411. package/dist/chunks/vertexColorMixing-BUqoiJkS.esm.min.js.map +1 -0
  412. package/dist/chunks/vertexColorMixing-CBpXxGvM.esm.js +421 -0
  413. package/dist/chunks/vertexColorMixing-CBpXxGvM.esm.js.map +1 -0
  414. package/dist/chunks/vertexColorMixing-ChUhO7eS.esm.js +531 -0
  415. package/dist/chunks/vertexColorMixing-ChUhO7eS.esm.js.map +1 -0
  416. package/dist/chunks/vertexColorMixing-DbmkfWMo.esm.min.js +2 -0
  417. package/dist/chunks/vertexColorMixing-DbmkfWMo.esm.min.js.map +1 -0
  418. package/dist/chunks/webgpuEngine-DqprhQ4L.esm.js +11538 -0
  419. package/dist/chunks/webgpuEngine-DqprhQ4L.esm.js.map +1 -0
  420. package/dist/chunks/webgpuEngine-LpKjcEuV.esm.min.js +2 -0
  421. package/dist/chunks/webgpuEngine-LpKjcEuV.esm.min.js.map +1 -0
  422. package/dist/chunks/workerPool-BUOov2K1.esm.js +122 -0
  423. package/dist/chunks/workerPool-BUOov2K1.esm.js.map +1 -0
  424. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js +2 -0
  425. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js.map +1 -0
  426. package/lib/index.d.ts +591 -0
  427. package/lib/index.js +2165 -0
  428. package/lib/index.js.map +1 -0
  429. package/package.json +19 -28
  430. package/readme.md +28 -28
  431. package/configuration/configuration.d.ts +0 -107
  432. package/configuration/configuration.js +0 -16
  433. package/configuration/configuration.js.map +0 -1
  434. package/configuration/configurationCompatibility.d.ts +0 -8
  435. package/configuration/configurationCompatibility.js +0 -66
  436. package/configuration/configurationCompatibility.js.map +0 -1
  437. package/configuration/configurationContainer.d.ts +0 -10
  438. package/configuration/configurationContainer.js +0 -10
  439. package/configuration/configurationContainer.js.map +0 -1
  440. package/configuration/globals.d.ts +0 -6
  441. package/configuration/globals.js +0 -18
  442. package/configuration/globals.js.map +0 -1
  443. package/configuration/index.d.ts +0 -2
  444. package/configuration/index.js +0 -4
  445. package/configuration/index.js.map +0 -1
  446. package/configuration/interfaces/cameraConfiguration.d.ts +0 -31
  447. package/configuration/interfaces/cameraConfiguration.js +0 -2
  448. package/configuration/interfaces/cameraConfiguration.js.map +0 -1
  449. package/configuration/interfaces/colorGradingConfiguration.d.ts +0 -81
  450. package/configuration/interfaces/colorGradingConfiguration.js +0 -2
  451. package/configuration/interfaces/colorGradingConfiguration.js.map +0 -1
  452. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +0 -20
  453. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +0 -2
  454. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +0 -1
  455. package/configuration/interfaces/environmentMapConfiguration.d.ts +0 -22
  456. package/configuration/interfaces/environmentMapConfiguration.js +0 -2
  457. package/configuration/interfaces/environmentMapConfiguration.js.map +0 -1
  458. package/configuration/interfaces/groundConfiguration.d.ts +0 -24
  459. package/configuration/interfaces/groundConfiguration.js +0 -2
  460. package/configuration/interfaces/groundConfiguration.js.map +0 -1
  461. package/configuration/interfaces/imageProcessingConfiguration.d.ts +0 -45
  462. package/configuration/interfaces/imageProcessingConfiguration.js +0 -2
  463. package/configuration/interfaces/imageProcessingConfiguration.js.map +0 -1
  464. package/configuration/interfaces/index.d.ts +0 -15
  465. package/configuration/interfaces/index.js +0 -16
  466. package/configuration/interfaces/index.js.map +0 -1
  467. package/configuration/interfaces/lightConfiguration.d.ts +0 -60
  468. package/configuration/interfaces/lightConfiguration.js +0 -2
  469. package/configuration/interfaces/lightConfiguration.js.map +0 -1
  470. package/configuration/interfaces/modelAnimationConfiguration.d.ts +0 -26
  471. package/configuration/interfaces/modelAnimationConfiguration.js +0 -2
  472. package/configuration/interfaces/modelAnimationConfiguration.js.map +0 -1
  473. package/configuration/interfaces/modelConfiguration.d.ts +0 -65
  474. package/configuration/interfaces/modelConfiguration.js +0 -2
  475. package/configuration/interfaces/modelConfiguration.js.map +0 -1
  476. package/configuration/interfaces/observersConfiguration.d.ts +0 -5
  477. package/configuration/interfaces/observersConfiguration.js +0 -2
  478. package/configuration/interfaces/observersConfiguration.js.map +0 -1
  479. package/configuration/interfaces/sceneConfiguration.d.ts +0 -48
  480. package/configuration/interfaces/sceneConfiguration.js +0 -2
  481. package/configuration/interfaces/sceneConfiguration.js.map +0 -1
  482. package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +0 -23
  483. package/configuration/interfaces/sceneOptimizerConfiguration.js +0 -2
  484. package/configuration/interfaces/sceneOptimizerConfiguration.js.map +0 -1
  485. package/configuration/interfaces/skyboxConfiguration.d.ts +0 -21
  486. package/configuration/interfaces/skyboxConfiguration.js +0 -2
  487. package/configuration/interfaces/skyboxConfiguration.js.map +0 -1
  488. package/configuration/interfaces/templateConfiguration.d.ts +0 -67
  489. package/configuration/interfaces/templateConfiguration.js +0 -2
  490. package/configuration/interfaces/templateConfiguration.js.map +0 -1
  491. package/configuration/interfaces/vrConfiguration.d.ts +0 -16
  492. package/configuration/interfaces/vrConfiguration.js +0 -2
  493. package/configuration/interfaces/vrConfiguration.js.map +0 -1
  494. package/configuration/loader.d.ts +0 -4
  495. package/configuration/loader.js +0 -17
  496. package/configuration/loader.js.map +0 -1
  497. package/configuration/mappers.d.ts +0 -43
  498. package/configuration/mappers.js +0 -193
  499. package/configuration/mappers.js.map +0 -1
  500. package/configuration/renderOnlyLoader.d.ts +0 -33
  501. package/configuration/renderOnlyLoader.js +0 -162
  502. package/configuration/renderOnlyLoader.js.map +0 -1
  503. package/configuration/types/default.d.ts +0 -6
  504. package/configuration/types/default.js +0 -121
  505. package/configuration/types/default.js.map +0 -1
  506. package/configuration/types/environmentMap.d.ts +0 -5
  507. package/configuration/types/environmentMap.js +0 -14
  508. package/configuration/types/environmentMap.js.map +0 -1
  509. package/configuration/types/extended.d.ts +0 -6
  510. package/configuration/types/extended.js +0 -317
  511. package/configuration/types/extended.js.map +0 -1
  512. package/configuration/types/index.d.ts +0 -14
  513. package/configuration/types/index.js +0 -51
  514. package/configuration/types/index.js.map +0 -1
  515. package/configuration/types/minimal.d.ts +0 -6
  516. package/configuration/types/minimal.js +0 -43
  517. package/configuration/types/minimal.js.map +0 -1
  518. package/configuration/types/renderOnlyDefault.d.ts +0 -30
  519. package/configuration/types/renderOnlyDefault.js +0 -31
  520. package/configuration/types/renderOnlyDefault.js.map +0 -1
  521. package/configuration/types/shadowLight.d.ts +0 -9
  522. package/configuration/types/shadowLight.js +0 -64
  523. package/configuration/types/shadowLight.js.map +0 -1
  524. package/helper/index.d.ts +0 -29
  525. package/helper/index.js +0 -66
  526. package/helper/index.js.map +0 -1
  527. package/index.d.ts +0 -30
  528. package/index.js +0 -46
  529. package/index.js.map +0 -1
  530. package/initializer.d.ts +0 -11
  531. package/initializer.js +0 -35
  532. package/initializer.js.map +0 -1
  533. package/interfaces.d.ts +0 -5
  534. package/interfaces.js +0 -7
  535. package/interfaces.js.map +0 -1
  536. package/labs/environmentSerializer.d.ts +0 -126
  537. package/labs/environmentSerializer.js +0 -191
  538. package/labs/environmentSerializer.js.map +0 -1
  539. package/labs/texture.d.ts +0 -183
  540. package/labs/texture.js +0 -351
  541. package/labs/texture.js.map +0 -1
  542. package/labs/viewerLabs.d.ts +0 -51
  543. package/labs/viewerLabs.js +0 -134
  544. package/labs/viewerLabs.js.map +0 -1
  545. package/loader/modelLoader.d.ts +0 -56
  546. package/loader/modelLoader.js +0 -202
  547. package/loader/modelLoader.js.map +0 -1
  548. package/loader/plugins/applyMaterialConfig.d.ts +0 -12
  549. package/loader/plugins/applyMaterialConfig.js +0 -16
  550. package/loader/plugins/applyMaterialConfig.js.map +0 -1
  551. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +0 -9
  552. package/loader/plugins/extendedMaterialLoaderPlugin.js +0 -16
  553. package/loader/plugins/extendedMaterialLoaderPlugin.js.map +0 -1
  554. package/loader/plugins/index.d.ts +0 -19
  555. package/loader/plugins/index.js +0 -44
  556. package/loader/plugins/index.js.map +0 -1
  557. package/loader/plugins/loaderPlugin.d.ts +0 -24
  558. package/loader/plugins/loaderPlugin.js +0 -2
  559. package/loader/plugins/loaderPlugin.js.map +0 -1
  560. package/loader/plugins/msftLodLoaderPlugin.d.ts +0 -12
  561. package/loader/plugins/msftLodLoaderPlugin.js +0 -21
  562. package/loader/plugins/msftLodLoaderPlugin.js.map +0 -1
  563. package/loader/plugins/telemetryLoaderPlugin.d.ts +0 -12
  564. package/loader/plugins/telemetryLoaderPlugin.js +0 -36
  565. package/loader/plugins/telemetryLoaderPlugin.js.map +0 -1
  566. package/managers/observablesManager.d.ts +0 -66
  567. package/managers/observablesManager.js +0 -35
  568. package/managers/observablesManager.js.map +0 -1
  569. package/managers/sceneManager.d.ts +0 -245
  570. package/managers/sceneManager.js +0 -1375
  571. package/managers/sceneManager.js.map +0 -1
  572. package/managers/telemetryManager.d.ts +0 -78
  573. package/managers/telemetryManager.js +0 -117
  574. package/managers/telemetryManager.js.map +0 -1
  575. package/model/modelAnimation.d.ts +0 -215
  576. package/model/modelAnimation.js +0 -237
  577. package/model/modelAnimation.js.map +0 -1
  578. package/model/viewerModel.d.ts +0 -233
  579. package/model/viewerModel.js +0 -673
  580. package/model/viewerModel.js.map +0 -1
  581. package/optimizer/custom/extended.d.ts +0 -13
  582. package/optimizer/custom/extended.js +0 -101
  583. package/optimizer/custom/extended.js.map +0 -1
  584. package/optimizer/custom/index.d.ts +0 -9
  585. package/optimizer/custom/index.js +0 -26
  586. package/optimizer/custom/index.js.map +0 -1
  587. package/renderOnlyIndex.d.ts +0 -11
  588. package/renderOnlyIndex.js +0 -18
  589. package/renderOnlyIndex.js.map +0 -1
  590. package/templating/eventManager.d.ts +0 -35
  591. package/templating/eventManager.js +0 -66
  592. package/templating/eventManager.js.map +0 -1
  593. package/templating/plugins/hdButtonPlugin.d.ts +0 -9
  594. package/templating/plugins/hdButtonPlugin.js +0 -22
  595. package/templating/plugins/hdButtonPlugin.js.map +0 -1
  596. package/templating/plugins/printButton.d.ts +0 -9
  597. package/templating/plugins/printButton.js +0 -41
  598. package/templating/plugins/printButton.js.map +0 -1
  599. package/templating/templateManager.d.ts +0 -197
  600. package/templating/templateManager.js +0 -561
  601. package/templating/templateManager.js.map +0 -1
  602. package/templating/viewerTemplatePlugin.d.ts +0 -21
  603. package/templating/viewerTemplatePlugin.js +0 -69
  604. package/templating/viewerTemplatePlugin.js.map +0 -1
  605. package/viewer/defaultViewer.d.ts +0 -130
  606. package/viewer/defaultViewer.js +0 -672
  607. package/viewer/defaultViewer.js.map +0 -1
  608. package/viewer/renderOnlyViewer.d.ts +0 -9
  609. package/viewer/renderOnlyViewer.js +0 -46
  610. package/viewer/renderOnlyViewer.js.map +0 -1
  611. package/viewer/viewer.d.ts +0 -258
  612. package/viewer/viewer.js +0 -783
  613. package/viewer/viewer.js.map +0 -1
  614. package/viewer/viewerManager.d.ts +0 -58
  615. package/viewer/viewerManager.js +0 -91
  616. package/viewer/viewerManager.js.map +0 -1
  617. package/viewer/viewerWithTemplate.d.ts +0 -9
  618. package/viewer/viewerWithTemplate.js +0 -20
  619. package/viewer/viewerWithTemplate.js.map +0 -1
@@ -0,0 +1,2213 @@
1
+ import { C as Constants, I as InternalTexture, L as Logger, a as IsExponentOfTwo, b as allocateAndCopyTypedBuffer, G as GetExponentOfTwo, H as HasStencilAspect, S as SphericalPolynomial, B as BaseTexture, A as AbstractEngine, E as EngineStore, P as PerfCounter, _ as _retryWithInterval } from './index-5L5wXyrx.esm.js';
2
+ import { T as ThinEngine, W as WebGLDataBuffer, a as WebGLHardwareTexture } from './thinEngine-DGyFDxzW.esm.js';
3
+ import { R as RenderTargetWrapper, P as PerformanceMonitor, _ as _CommonInit, a as ResizeImageBitmap, C as CreateImageBitmapFromSource, b as RequestFullscreen, E as ExitFullscreen, G as GetFontOffset, c as RequestPointerlock, d as ExitPointerlock, e as _CommonDispose } from './engine.common-BM1GAef8.esm.js';
4
+ import './audioEngine-BZB34VjD.esm.js';
5
+ import './drawWrapper.functions-CKg3_9x4.esm.js';
6
+
7
+ ThinEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange = false) {
8
+ if (this._alphaMode === mode) {
9
+ if (!noDepthWriteChange) {
10
+ // 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)
11
+ const depthMask = mode === Constants.ALPHA_DISABLE;
12
+ if (this.depthCullingState.depthMask !== depthMask) {
13
+ this.depthCullingState.depthMask = depthMask;
14
+ }
15
+ }
16
+ return;
17
+ }
18
+ switch (mode) {
19
+ case Constants.ALPHA_DISABLE:
20
+ this._alphaState.alphaBlend = false;
21
+ break;
22
+ case Constants.ALPHA_PREMULTIPLIED:
23
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);
24
+ this._alphaState.alphaBlend = true;
25
+ break;
26
+ case Constants.ALPHA_PREMULTIPLIED_PORTERDUFF:
27
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
28
+ this._alphaState.alphaBlend = true;
29
+ break;
30
+ case Constants.ALPHA_COMBINE:
31
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);
32
+ this._alphaState.alphaBlend = true;
33
+ break;
34
+ case Constants.ALPHA_ONEONE:
35
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE);
36
+ this._alphaState.alphaBlend = true;
37
+ break;
38
+ case Constants.ALPHA_ADD:
39
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE);
40
+ this._alphaState.alphaBlend = true;
41
+ break;
42
+ case Constants.ALPHA_SUBTRACT:
43
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);
44
+ this._alphaState.alphaBlend = true;
45
+ break;
46
+ case Constants.ALPHA_MULTIPLY:
47
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE);
48
+ this._alphaState.alphaBlend = true;
49
+ break;
50
+ case Constants.ALPHA_MAXIMIZED:
51
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);
52
+ this._alphaState.alphaBlend = true;
53
+ break;
54
+ case Constants.ALPHA_INTERPOLATE:
55
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR, this._gl.ONE_MINUS_CONSTANT_COLOR, this._gl.CONSTANT_ALPHA, this._gl.ONE_MINUS_CONSTANT_ALPHA);
56
+ this._alphaState.alphaBlend = true;
57
+ break;
58
+ case Constants.ALPHA_SCREENMODE:
59
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
60
+ this._alphaState.alphaBlend = true;
61
+ break;
62
+ case Constants.ALPHA_ONEONE_ONEONE:
63
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ONE);
64
+ this._alphaState.alphaBlend = true;
65
+ break;
66
+ case Constants.ALPHA_ALPHATOCOLOR:
67
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ZERO);
68
+ this._alphaState.alphaBlend = true;
69
+ break;
70
+ case Constants.ALPHA_REVERSEONEMINUS:
71
+ 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);
72
+ this._alphaState.alphaBlend = true;
73
+ break;
74
+ case Constants.ALPHA_SRC_DSTONEMINUSSRCALPHA:
75
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
76
+ this._alphaState.alphaBlend = true;
77
+ break;
78
+ case Constants.ALPHA_ONEONE_ONEZERO:
79
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ZERO);
80
+ this._alphaState.alphaBlend = true;
81
+ break;
82
+ case Constants.ALPHA_EXCLUSION:
83
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ZERO, this._gl.ONE);
84
+ this._alphaState.alphaBlend = true;
85
+ break;
86
+ case Constants.ALPHA_LAYER_ACCUMULATE:
87
+ // Same as ALPHA_COMBINE but accumulates (1 - alpha) values in the alpha channel for a later readout in order independant transparency
88
+ this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
89
+ this._alphaState.alphaBlend = true;
90
+ break;
91
+ }
92
+ if (!noDepthWriteChange) {
93
+ this.depthCullingState.depthMask = mode === Constants.ALPHA_DISABLE;
94
+ }
95
+ this._alphaMode = mode;
96
+ };
97
+
98
+ ThinEngine.prototype.updateRawTexture = function (texture, data, format, invertY, compression = null, type = Constants.TEXTURETYPE_UNSIGNED_BYTE, useSRGBBuffer = false) {
99
+ if (!texture) {
100
+ return;
101
+ }
102
+ // Babylon's internalSizedFomat but gl's texImage2D internalFormat
103
+ const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type, format, useSRGBBuffer);
104
+ // Babylon's internalFormat but gl's texImage2D format
105
+ const internalFormat = this._getInternalFormat(format);
106
+ const textureType = this._getWebGLTextureType(type);
107
+ this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);
108
+ this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);
109
+ if (!this._doNotHandleContextLost) {
110
+ texture._bufferView = data;
111
+ texture.format = format;
112
+ texture.type = type;
113
+ texture.invertY = invertY;
114
+ texture._compression = compression;
115
+ }
116
+ if (texture.width % 4 !== 0) {
117
+ this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);
118
+ }
119
+ if (compression && data) {
120
+ this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[compression], texture.width, texture.height, 0, data);
121
+ }
122
+ else {
123
+ this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);
124
+ }
125
+ if (texture.generateMipMaps) {
126
+ this._gl.generateMipmap(this._gl.TEXTURE_2D);
127
+ }
128
+ this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
129
+ // this.resetTextureCache();
130
+ texture.isReady = true;
131
+ };
132
+ ThinEngine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression = null, type = Constants.TEXTURETYPE_UNSIGNED_BYTE,
133
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
134
+ creationFlags = 0, useSRGBBuffer = false) {
135
+ const texture = new InternalTexture(this, 3 /* InternalTextureSource.Raw */);
136
+ texture.baseWidth = width;
137
+ texture.baseHeight = height;
138
+ texture.width = width;
139
+ texture.height = height;
140
+ texture.format = format;
141
+ texture.generateMipMaps = generateMipMaps;
142
+ texture.samplingMode = samplingMode;
143
+ texture.invertY = invertY;
144
+ texture._compression = compression;
145
+ texture.type = type;
146
+ texture._useSRGBBuffer = this._getUseSRGBBuffer(useSRGBBuffer, !generateMipMaps);
147
+ if (!this._doNotHandleContextLost) {
148
+ texture._bufferView = data;
149
+ }
150
+ this.updateRawTexture(texture, data, format, invertY, compression, type, texture._useSRGBBuffer);
151
+ this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);
152
+ // Filters
153
+ const filters = this._getSamplingParameters(samplingMode, generateMipMaps);
154
+ this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag);
155
+ this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);
156
+ if (generateMipMaps) {
157
+ this._gl.generateMipmap(this._gl.TEXTURE_2D);
158
+ }
159
+ this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
160
+ this._internalTexturesCache.push(texture);
161
+ return texture;
162
+ };
163
+ ThinEngine.prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression = null) {
164
+ const gl = this._gl;
165
+ const texture = new InternalTexture(this, 8 /* InternalTextureSource.CubeRaw */);
166
+ texture.isCube = true;
167
+ texture.format = format;
168
+ texture.type = type;
169
+ if (!this._doNotHandleContextLost) {
170
+ texture._bufferViewArray = data;
171
+ }
172
+ const textureType = this._getWebGLTextureType(type);
173
+ let internalFormat = this._getInternalFormat(format);
174
+ if (internalFormat === gl.RGB) {
175
+ internalFormat = gl.RGBA;
176
+ }
177
+ // Mipmap generation needs a sized internal format that is both color-renderable and texture-filterable
178
+ if (textureType === gl.FLOAT && !this._caps.textureFloatLinearFiltering) {
179
+ generateMipMaps = false;
180
+ samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
181
+ Logger.Warn("Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.");
182
+ }
183
+ else if (textureType === this._gl.HALF_FLOAT_OES && !this._caps.textureHalfFloatLinearFiltering) {
184
+ generateMipMaps = false;
185
+ samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
186
+ Logger.Warn("Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.");
187
+ }
188
+ else if (textureType === gl.FLOAT && !this._caps.textureFloatRender) {
189
+ generateMipMaps = false;
190
+ Logger.Warn("Render to float textures is not supported. Mipmap generation forced to false.");
191
+ }
192
+ else if (textureType === gl.HALF_FLOAT && !this._caps.colorBufferFloat) {
193
+ generateMipMaps = false;
194
+ Logger.Warn("Render to half float textures is not supported. Mipmap generation forced to false.");
195
+ }
196
+ const width = size;
197
+ const height = width;
198
+ texture.width = width;
199
+ texture.height = height;
200
+ texture.invertY = invertY;
201
+ texture._compression = compression;
202
+ // Double check on POT to generate Mips.
203
+ const isPot = !this.needPOTTextures || (IsExponentOfTwo(texture.width) && IsExponentOfTwo(texture.height));
204
+ if (!isPot) {
205
+ generateMipMaps = false;
206
+ }
207
+ // Upload data if needed. The texture won't be ready until then.
208
+ if (data) {
209
+ this.updateRawCubeTexture(texture, data, format, type, invertY, compression);
210
+ }
211
+ else {
212
+ const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);
213
+ const level = 0;
214
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
215
+ for (let faceIndex = 0; faceIndex < 6; faceIndex++) {
216
+ if (compression) {
217
+ gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, this.getCaps().s3tc[compression], texture.width, texture.height, 0, undefined);
218
+ }
219
+ else {
220
+ gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, null);
221
+ }
222
+ }
223
+ this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
224
+ }
225
+ this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);
226
+ // Filters
227
+ if (data && generateMipMaps) {
228
+ this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);
229
+ }
230
+ const filters = this._getSamplingParameters(samplingMode, generateMipMaps);
231
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);
232
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);
233
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
234
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
235
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
236
+ texture.generateMipMaps = generateMipMaps;
237
+ texture.samplingMode = samplingMode;
238
+ texture.isReady = true;
239
+ return texture;
240
+ };
241
+ ThinEngine.prototype.updateRawCubeTexture = function (texture, data, format, type, invertY, compression = null, level = 0) {
242
+ texture._bufferViewArray = data;
243
+ texture.format = format;
244
+ texture.type = type;
245
+ texture.invertY = invertY;
246
+ texture._compression = compression;
247
+ const gl = this._gl;
248
+ const textureType = this._getWebGLTextureType(type);
249
+ let internalFormat = this._getInternalFormat(format);
250
+ const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);
251
+ let needConversion = false;
252
+ if (internalFormat === gl.RGB) {
253
+ internalFormat = gl.RGBA;
254
+ needConversion = true;
255
+ }
256
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
257
+ this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);
258
+ if (texture.width % 4 !== 0) {
259
+ gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);
260
+ }
261
+ // Data are known to be in +X +Y +Z -X -Y -Z
262
+ for (let faceIndex = 0; faceIndex < 6; faceIndex++) {
263
+ let faceData = data[faceIndex];
264
+ if (compression) {
265
+ gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, this.getCaps().s3tc[compression], texture.width, texture.height, 0, faceData);
266
+ }
267
+ else {
268
+ if (needConversion) {
269
+ faceData = _convertRGBtoRGBATextureData(faceData, texture.width, texture.height, type);
270
+ }
271
+ gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, faceData);
272
+ }
273
+ }
274
+ const isPot = !this.needPOTTextures || (IsExponentOfTwo(texture.width) && IsExponentOfTwo(texture.height));
275
+ if (isPot && texture.generateMipMaps && level === 0) {
276
+ this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);
277
+ }
278
+ this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
279
+ // this.resetTextureCache();
280
+ texture.isReady = true;
281
+ };
282
+ ThinEngine.prototype.createRawCubeTextureFromUrl = function (url, scene, size, format, type, noMipmap, callback, mipmapGenerator, onLoad = null, onError = null, samplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE, invertY = false) {
283
+ const gl = this._gl;
284
+ const texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode, null);
285
+ scene?.addPendingData(texture);
286
+ texture.url = url;
287
+ texture.isReady = false;
288
+ this._internalTexturesCache.push(texture);
289
+ const onerror = (request, exception) => {
290
+ scene?.removePendingData(texture);
291
+ if (onError && request) {
292
+ onError(request.status + " " + request.statusText, exception);
293
+ }
294
+ };
295
+ const internalCallback = (data) => {
296
+ const width = texture.width;
297
+ const faceDataArrays = callback(data);
298
+ if (!faceDataArrays) {
299
+ return;
300
+ }
301
+ if (mipmapGenerator) {
302
+ const textureType = this._getWebGLTextureType(type);
303
+ let internalFormat = this._getInternalFormat(format);
304
+ const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);
305
+ let needConversion = false;
306
+ if (internalFormat === gl.RGB) {
307
+ internalFormat = gl.RGBA;
308
+ needConversion = true;
309
+ }
310
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
311
+ this._unpackFlipY(false);
312
+ const mipData = mipmapGenerator(faceDataArrays);
313
+ for (let level = 0; level < mipData.length; level++) {
314
+ const mipSize = width >> level;
315
+ for (let faceIndex = 0; faceIndex < 6; faceIndex++) {
316
+ let mipFaceData = mipData[level][faceIndex];
317
+ if (needConversion) {
318
+ mipFaceData = _convertRGBtoRGBATextureData(mipFaceData, mipSize, mipSize, type);
319
+ }
320
+ gl.texImage2D(faceIndex, level, internalSizedFomat, mipSize, mipSize, 0, internalFormat, textureType, mipFaceData);
321
+ }
322
+ }
323
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
324
+ }
325
+ else {
326
+ this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);
327
+ }
328
+ texture.isReady = true;
329
+ // this.resetTextureCache();
330
+ scene?.removePendingData(texture);
331
+ texture.onLoadedObservable.notifyObservers(texture);
332
+ texture.onLoadedObservable.clear();
333
+ if (onLoad) {
334
+ onLoad();
335
+ }
336
+ };
337
+ this._loadFile(url, (data) => {
338
+ internalCallback(data);
339
+ }, undefined, scene?.offlineProvider, true, onerror);
340
+ return texture;
341
+ };
342
+ /**
343
+ * @internal
344
+ */
345
+ // eslint-disable-next-line @typescript-eslint/naming-convention
346
+ function _convertRGBtoRGBATextureData(rgbData, width, height, textureType) {
347
+ // Create new RGBA data container.
348
+ let rgbaData;
349
+ let val1 = 1;
350
+ if (textureType === Constants.TEXTURETYPE_FLOAT) {
351
+ rgbaData = new Float32Array(width * height * 4);
352
+ }
353
+ else if (textureType === Constants.TEXTURETYPE_HALF_FLOAT) {
354
+ rgbaData = new Uint16Array(width * height * 4);
355
+ val1 = 15360; // 15360 is the encoding of 1 in half float
356
+ }
357
+ else if (textureType === Constants.TEXTURETYPE_UNSIGNED_INTEGER) {
358
+ rgbaData = new Uint32Array(width * height * 4);
359
+ }
360
+ else {
361
+ rgbaData = new Uint8Array(width * height * 4);
362
+ }
363
+ // Convert each pixel.
364
+ for (let x = 0; x < width; x++) {
365
+ for (let y = 0; y < height; y++) {
366
+ const index = (y * width + x) * 3;
367
+ const newIndex = (y * width + x) * 4;
368
+ // Map Old Value to new value.
369
+ rgbaData[newIndex + 0] = rgbData[index + 0];
370
+ rgbaData[newIndex + 1] = rgbData[index + 1];
371
+ rgbaData[newIndex + 2] = rgbData[index + 2];
372
+ // Add fully opaque alpha channel.
373
+ rgbaData[newIndex + 3] = val1;
374
+ }
375
+ }
376
+ return rgbaData;
377
+ }
378
+ /**
379
+ * Create a function for createRawTexture3D/createRawTexture2DArray
380
+ * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY
381
+ * @internal
382
+ */
383
+ // eslint-disable-next-line @typescript-eslint/naming-convention
384
+ function _makeCreateRawTextureFunction(is3D) {
385
+ return function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression = null, textureType = Constants.TEXTURETYPE_UNSIGNED_BYTE) {
386
+ const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;
387
+ const source = is3D ? 10 /* InternalTextureSource.Raw3D */ : 11 /* InternalTextureSource.Raw2DArray */;
388
+ const texture = new InternalTexture(this, source);
389
+ texture.baseWidth = width;
390
+ texture.baseHeight = height;
391
+ texture.baseDepth = depth;
392
+ texture.width = width;
393
+ texture.height = height;
394
+ texture.depth = depth;
395
+ texture.format = format;
396
+ texture.type = textureType;
397
+ texture.generateMipMaps = generateMipMaps;
398
+ texture.samplingMode = samplingMode;
399
+ if (is3D) {
400
+ texture.is3D = true;
401
+ }
402
+ else {
403
+ texture.is2DArray = true;
404
+ }
405
+ if (!this._doNotHandleContextLost) {
406
+ texture._bufferView = data;
407
+ }
408
+ if (is3D) {
409
+ this.updateRawTexture3D(texture, data, format, invertY, compression, textureType);
410
+ }
411
+ else {
412
+ this.updateRawTexture2DArray(texture, data, format, invertY, compression, textureType);
413
+ }
414
+ this._bindTextureDirectly(target, texture, true);
415
+ // Filters
416
+ const filters = this._getSamplingParameters(samplingMode, generateMipMaps);
417
+ this._gl.texParameteri(target, this._gl.TEXTURE_MAG_FILTER, filters.mag);
418
+ this._gl.texParameteri(target, this._gl.TEXTURE_MIN_FILTER, filters.min);
419
+ if (generateMipMaps) {
420
+ this._gl.generateMipmap(target);
421
+ }
422
+ this._bindTextureDirectly(target, null);
423
+ this._internalTexturesCache.push(texture);
424
+ return texture;
425
+ };
426
+ }
427
+ ThinEngine.prototype.createRawTexture2DArray = _makeCreateRawTextureFunction(false);
428
+ ThinEngine.prototype.createRawTexture3D = _makeCreateRawTextureFunction(true);
429
+ /**
430
+ * Create a function for updateRawTexture3D/updateRawTexture2DArray
431
+ * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY
432
+ * @internal
433
+ */
434
+ // eslint-disable-next-line @typescript-eslint/naming-convention
435
+ function _makeUpdateRawTextureFunction(is3D) {
436
+ return function (texture, data, format, invertY, compression = null, textureType = Constants.TEXTURETYPE_UNSIGNED_BYTE) {
437
+ const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;
438
+ const internalType = this._getWebGLTextureType(textureType);
439
+ const internalFormat = this._getInternalFormat(format);
440
+ const internalSizedFomat = this._getRGBABufferInternalSizedFormat(textureType, format);
441
+ this._bindTextureDirectly(target, texture, true);
442
+ this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);
443
+ if (!this._doNotHandleContextLost) {
444
+ texture._bufferView = data;
445
+ texture.format = format;
446
+ texture.invertY = invertY;
447
+ texture._compression = compression;
448
+ }
449
+ if (texture.width % 4 !== 0) {
450
+ this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);
451
+ }
452
+ if (compression && data) {
453
+ this._gl.compressedTexImage3D(target, 0, this.getCaps().s3tc[compression], texture.width, texture.height, texture.depth, 0, data);
454
+ }
455
+ else {
456
+ this._gl.texImage3D(target, 0, internalSizedFomat, texture.width, texture.height, texture.depth, 0, internalFormat, internalType, data);
457
+ }
458
+ if (texture.generateMipMaps) {
459
+ this._gl.generateMipmap(target);
460
+ }
461
+ this._bindTextureDirectly(target, null);
462
+ // this.resetTextureCache();
463
+ texture.isReady = true;
464
+ };
465
+ }
466
+ ThinEngine.prototype.updateRawTexture2DArray = _makeUpdateRawTextureFunction(false);
467
+ ThinEngine.prototype.updateRawTexture3D = _makeUpdateRawTextureFunction(true);
468
+
469
+ ThinEngine.prototype._readTexturePixelsSync = function (texture, width, height, faceIndex = -1, level = 0, buffer = null, flushRenderer = true, noDataConversion = false, x = 0, y = 0) {
470
+ const gl = this._gl;
471
+ if (!gl) {
472
+ throw new Error("Engine does not have gl rendering context.");
473
+ }
474
+ if (!this._dummyFramebuffer) {
475
+ const dummy = gl.createFramebuffer();
476
+ if (!dummy) {
477
+ throw new Error("Unable to create dummy framebuffer");
478
+ }
479
+ this._dummyFramebuffer = dummy;
480
+ }
481
+ gl.bindFramebuffer(gl.FRAMEBUFFER, this._dummyFramebuffer);
482
+ if (faceIndex > -1) {
483
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._hardwareTexture?.underlyingResource, level);
484
+ }
485
+ else {
486
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._hardwareTexture?.underlyingResource, level);
487
+ }
488
+ let readType = texture.type !== undefined ? this._getWebGLTextureType(texture.type) : gl.UNSIGNED_BYTE;
489
+ if (!noDataConversion) {
490
+ switch (readType) {
491
+ case gl.UNSIGNED_BYTE:
492
+ if (!buffer) {
493
+ buffer = new Uint8Array(4 * width * height);
494
+ }
495
+ readType = gl.UNSIGNED_BYTE;
496
+ break;
497
+ default:
498
+ if (!buffer) {
499
+ buffer = new Float32Array(4 * width * height);
500
+ }
501
+ readType = gl.FLOAT;
502
+ break;
503
+ }
504
+ }
505
+ else if (!buffer) {
506
+ buffer = allocateAndCopyTypedBuffer(texture.type, 4 * width * height);
507
+ }
508
+ if (flushRenderer) {
509
+ this.flushFramebuffer();
510
+ }
511
+ gl.readPixels(x, y, width, height, gl.RGBA, readType, buffer);
512
+ gl.bindFramebuffer(gl.FRAMEBUFFER, this._currentFramebuffer);
513
+ return buffer;
514
+ };
515
+ ThinEngine.prototype._readTexturePixels = function (texture, width, height, faceIndex = -1, level = 0, buffer = null, flushRenderer = true, noDataConversion = false, x = 0, y = 0) {
516
+ return Promise.resolve(this._readTexturePixelsSync(texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion, x, y));
517
+ };
518
+
519
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
520
+ ThinEngine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset = 0) {
521
+ // Force cache update
522
+ this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null;
523
+ this.bindIndexBuffer(indexBuffer);
524
+ let view;
525
+ if (indexBuffer.is32Bits) {
526
+ // anything else than Uint32Array needs to be converted to Uint32Array
527
+ view = indices instanceof Uint32Array ? indices : new Uint32Array(indices);
528
+ }
529
+ else {
530
+ // anything else than Uint16Array needs to be converted to Uint16Array
531
+ view = indices instanceof Uint16Array ? indices : new Uint16Array(indices);
532
+ }
533
+ this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, view, this._gl.DYNAMIC_DRAW);
534
+ this._resetIndexBufferBinding();
535
+ };
536
+ ThinEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, data, byteOffset, byteLength) {
537
+ this.bindArrayBuffer(vertexBuffer);
538
+ if (byteOffset === undefined) {
539
+ byteOffset = 0;
540
+ }
541
+ const dataLength = data.byteLength || data.length;
542
+ if (byteLength === undefined || (byteLength >= dataLength && byteOffset === 0)) {
543
+ if (data instanceof Array) {
544
+ this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, new Float32Array(data));
545
+ }
546
+ else {
547
+ this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, data);
548
+ }
549
+ }
550
+ else {
551
+ if (data instanceof Array) {
552
+ this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(data).subarray(byteOffset, byteOffset + byteLength));
553
+ }
554
+ else {
555
+ if (data instanceof ArrayBuffer) {
556
+ data = new Uint8Array(data, byteOffset, byteLength);
557
+ }
558
+ else {
559
+ data = new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);
560
+ }
561
+ this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);
562
+ }
563
+ }
564
+ this._resetVertexBufferBinding();
565
+ };
566
+
567
+ ThinEngine.prototype._createDepthStencilCubeTexture = function (size, options) {
568
+ const internalTexture = new InternalTexture(this, 12 /* InternalTextureSource.DepthStencil */);
569
+ internalTexture.isCube = true;
570
+ if (this.webGLVersion === 1) {
571
+ Logger.Error("Depth cube texture is not supported by WebGL 1.");
572
+ return internalTexture;
573
+ }
574
+ const internalOptions = {
575
+ bilinearFiltering: false,
576
+ comparisonFunction: 0,
577
+ generateStencil: false,
578
+ ...options,
579
+ };
580
+ const gl = this._gl;
581
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, internalTexture, true);
582
+ this._setupDepthStencilTexture(internalTexture, size, internalOptions.bilinearFiltering, internalOptions.comparisonFunction);
583
+ // Create the depth/stencil buffer
584
+ for (let face = 0; face < 6; face++) {
585
+ if (internalOptions.generateStencil) {
586
+ gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.DEPTH24_STENCIL8, size, size, 0, gl.DEPTH_STENCIL, gl.UNSIGNED_INT_24_8, null);
587
+ }
588
+ else {
589
+ gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.DEPTH_COMPONENT24, size, size, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null);
590
+ }
591
+ }
592
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
593
+ this._internalTexturesCache.push(internalTexture);
594
+ return internalTexture;
595
+ };
596
+ ThinEngine.prototype._setCubeMapTextureParams = function (texture, loadMipmap, maxLevel) {
597
+ const gl = this._gl;
598
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
599
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, loadMipmap ? gl.LINEAR_MIPMAP_LINEAR : gl.LINEAR);
600
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
601
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
602
+ texture.samplingMode = loadMipmap ? Constants.TEXTURE_TRILINEAR_SAMPLINGMODE : Constants.TEXTURE_LINEAR_LINEAR;
603
+ if (loadMipmap && this.getCaps().textureMaxLevel && maxLevel !== undefined && maxLevel > 0) {
604
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAX_LEVEL, maxLevel);
605
+ texture._maxLodLevel = maxLevel;
606
+ }
607
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
608
+ };
609
+ ThinEngine.prototype.createCubeTexture = function (rootUrl, scene, files, noMipmap, onLoad = null, onError = null, format, forcedExtension = null, createPolynomials = false, lodScale = 0, lodOffset = 0, fallback = null, loaderOptions, useSRGBBuffer = false, buffer = null) {
610
+ const gl = this._gl;
611
+ return this.createCubeTextureBase(rootUrl, scene, files, !!noMipmap, onLoad, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset, fallback, (texture) => this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true), (texture, imgs) => {
612
+ const width = this.needPOTTextures ? GetExponentOfTwo(imgs[0].width, this._caps.maxCubemapTextureSize) : imgs[0].width;
613
+ const height = width;
614
+ const faces = [
615
+ gl.TEXTURE_CUBE_MAP_POSITIVE_X,
616
+ gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
617
+ gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
618
+ gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
619
+ gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
620
+ gl.TEXTURE_CUBE_MAP_NEGATIVE_Z,
621
+ ];
622
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
623
+ this._unpackFlipY(false);
624
+ const internalFormat = format ? this._getInternalFormat(format, texture._useSRGBBuffer) : texture._useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : gl.RGBA;
625
+ let texelFormat = format ? this._getInternalFormat(format) : gl.RGBA;
626
+ if (texture._useSRGBBuffer && this.webGLVersion === 1) {
627
+ texelFormat = internalFormat;
628
+ }
629
+ for (let index = 0; index < faces.length; index++) {
630
+ if (imgs[index].width !== width || imgs[index].height !== height) {
631
+ this._prepareWorkingCanvas();
632
+ if (!this._workingCanvas || !this._workingContext) {
633
+ Logger.Warn("Cannot create canvas to resize texture.");
634
+ return;
635
+ }
636
+ this._workingCanvas.width = width;
637
+ this._workingCanvas.height = height;
638
+ this._workingContext.drawImage(imgs[index], 0, 0, imgs[index].width, imgs[index].height, 0, 0, width, height);
639
+ gl.texImage2D(faces[index], 0, internalFormat, texelFormat, gl.UNSIGNED_BYTE, this._workingCanvas);
640
+ }
641
+ else {
642
+ gl.texImage2D(faces[index], 0, internalFormat, texelFormat, gl.UNSIGNED_BYTE, imgs[index]);
643
+ }
644
+ }
645
+ if (!noMipmap) {
646
+ gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
647
+ }
648
+ this._setCubeMapTextureParams(texture, !noMipmap);
649
+ texture.width = width;
650
+ texture.height = height;
651
+ texture.isReady = true;
652
+ if (format) {
653
+ texture.format = format;
654
+ }
655
+ texture.onLoadedObservable.notifyObservers(texture);
656
+ texture.onLoadedObservable.clear();
657
+ if (onLoad) {
658
+ onLoad();
659
+ }
660
+ }, !!useSRGBBuffer, buffer);
661
+ };
662
+ ThinEngine.prototype.generateMipMapsForCubemap = function (texture, unbind = true) {
663
+ if (texture.generateMipMaps) {
664
+ const gl = this._gl;
665
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
666
+ gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
667
+ if (unbind) {
668
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
669
+ }
670
+ }
671
+ };
672
+
673
+ /** @internal */
674
+ class WebGLRenderTargetWrapper extends RenderTargetWrapper {
675
+ setDepthStencilTexture(texture, disposeExisting = true) {
676
+ super.setDepthStencilTexture(texture, disposeExisting);
677
+ if (!texture) {
678
+ return;
679
+ }
680
+ const engine = this._engine;
681
+ const gl = this._context;
682
+ const hardwareTexture = texture._hardwareTexture;
683
+ if (hardwareTexture && texture._autoMSAAManagement && this._MSAAFramebuffer) {
684
+ const currentFB = engine._currentFramebuffer;
685
+ engine._bindUnboundFramebuffer(this._MSAAFramebuffer);
686
+ gl.framebufferRenderbuffer(gl.FRAMEBUFFER, HasStencilAspect(texture.format) ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, hardwareTexture.getMSAARenderBuffer());
687
+ engine._bindUnboundFramebuffer(currentFB);
688
+ }
689
+ }
690
+ constructor(isMulti, isCube, size, engine, context) {
691
+ super(isMulti, isCube, size, engine);
692
+ /**
693
+ * @internal
694
+ */
695
+ this._framebuffer = null;
696
+ /**
697
+ * @internal
698
+ */
699
+ this._depthStencilBuffer = null;
700
+ // eslint-disable-next-line @typescript-eslint/naming-convention
701
+ /**
702
+ * @internal
703
+ */
704
+ // eslint-disable-next-line @typescript-eslint/naming-convention
705
+ this._MSAAFramebuffer = null;
706
+ // Multiview
707
+ /**
708
+ * @internal
709
+ */
710
+ this._colorTextureArray = null;
711
+ /**
712
+ * @internal
713
+ */
714
+ this._depthStencilTextureArray = null;
715
+ /**
716
+ * @internal
717
+ */
718
+ this._disposeOnlyFramebuffers = false;
719
+ /**
720
+ * @internal
721
+ */
722
+ this._currentLOD = 0;
723
+ this._context = context;
724
+ }
725
+ _cloneRenderTargetWrapper() {
726
+ let rtw = null;
727
+ if (this._colorTextureArray && this._depthStencilTextureArray) {
728
+ rtw = this._engine.createMultiviewRenderTargetTexture(this.width, this.height);
729
+ rtw.texture.isReady = true;
730
+ }
731
+ else {
732
+ rtw = super._cloneRenderTargetWrapper();
733
+ }
734
+ return rtw;
735
+ }
736
+ _swapRenderTargetWrapper(target) {
737
+ super._swapRenderTargetWrapper(target);
738
+ target._framebuffer = this._framebuffer;
739
+ target._depthStencilBuffer = this._depthStencilBuffer;
740
+ target._MSAAFramebuffer = this._MSAAFramebuffer;
741
+ target._colorTextureArray = this._colorTextureArray;
742
+ target._depthStencilTextureArray = this._depthStencilTextureArray;
743
+ this._framebuffer = this._depthStencilBuffer = this._MSAAFramebuffer = this._colorTextureArray = this._depthStencilTextureArray = null;
744
+ }
745
+ /**
746
+ * Creates the depth/stencil texture
747
+ * @param comparisonFunction Comparison function to use for the texture
748
+ * @param bilinearFiltering true if bilinear filtering should be used when sampling the texture
749
+ * @param generateStencil true if the stencil aspect should also be created
750
+ * @param samples sample count to use when creating the texture
751
+ * @param format format of the depth texture
752
+ * @param label defines the label to use for the texture (for debugging purpose only)
753
+ * @returns the depth/stencil created texture
754
+ */
755
+ createDepthStencilTexture(comparisonFunction = 0, bilinearFiltering = true, generateStencil = false, samples = 1, format = Constants.TEXTUREFORMAT_DEPTH32_FLOAT, label) {
756
+ if (this._depthStencilBuffer) {
757
+ const engine = this._engine;
758
+ // Dispose previous depth/stencil render buffers and clear the corresponding attachment.
759
+ // Next time this framebuffer is bound, the new depth/stencil texture will be attached.
760
+ const currentFrameBuffer = engine._currentFramebuffer;
761
+ const gl = this._context;
762
+ engine._bindUnboundFramebuffer(this._framebuffer);
763
+ gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);
764
+ gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null);
765
+ gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);
766
+ engine._bindUnboundFramebuffer(currentFrameBuffer);
767
+ gl.deleteRenderbuffer(this._depthStencilBuffer);
768
+ this._depthStencilBuffer = null;
769
+ }
770
+ return super.createDepthStencilTexture(comparisonFunction, bilinearFiltering, generateStencil, samples, format, label);
771
+ }
772
+ /**
773
+ * Shares the depth buffer of this render target with another render target.
774
+ * @param renderTarget Destination renderTarget
775
+ */
776
+ shareDepth(renderTarget) {
777
+ super.shareDepth(renderTarget);
778
+ const gl = this._context;
779
+ const depthbuffer = this._depthStencilBuffer;
780
+ const framebuffer = renderTarget._MSAAFramebuffer || renderTarget._framebuffer;
781
+ const engine = this._engine;
782
+ if (renderTarget._depthStencilBuffer && renderTarget._depthStencilBuffer !== depthbuffer) {
783
+ gl.deleteRenderbuffer(renderTarget._depthStencilBuffer);
784
+ }
785
+ renderTarget._depthStencilBuffer = depthbuffer;
786
+ const attachment = renderTarget._generateStencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
787
+ engine._bindUnboundFramebuffer(framebuffer);
788
+ gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, depthbuffer);
789
+ engine._bindUnboundFramebuffer(null);
790
+ }
791
+ /**
792
+ * Binds a texture to this render target on a specific attachment
793
+ * @param texture The texture to bind to the framebuffer
794
+ * @param attachmentIndex Index of the attachment
795
+ * @param faceIndexOrLayer The face or layer of the texture to render to in case of cube texture or array texture
796
+ * @param lodLevel defines the lod level to bind to the frame buffer
797
+ */
798
+ _bindTextureRenderTarget(texture, attachmentIndex = 0, faceIndexOrLayer, lodLevel = 0) {
799
+ const hardwareTexture = texture._hardwareTexture;
800
+ if (!hardwareTexture) {
801
+ return;
802
+ }
803
+ const framebuffer = this._framebuffer;
804
+ const engine = this._engine;
805
+ const currentFB = engine._currentFramebuffer;
806
+ engine._bindUnboundFramebuffer(framebuffer);
807
+ let attachment;
808
+ if (engine.webGLVersion > 1) {
809
+ const gl = this._context;
810
+ attachment = gl["COLOR_ATTACHMENT" + attachmentIndex];
811
+ if (texture.is2DArray || texture.is3D) {
812
+ faceIndexOrLayer = faceIndexOrLayer ?? this.layerIndices?.[attachmentIndex] ?? 0;
813
+ gl.framebufferTextureLayer(gl.FRAMEBUFFER, attachment, hardwareTexture.underlyingResource, lodLevel, faceIndexOrLayer);
814
+ }
815
+ else if (texture.isCube) {
816
+ // if face index is not specified, try to query it from faceIndices
817
+ // default is face 0
818
+ faceIndexOrLayer = faceIndexOrLayer ?? this.faceIndices?.[attachmentIndex] ?? 0;
819
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer, hardwareTexture.underlyingResource, lodLevel);
820
+ }
821
+ else {
822
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, hardwareTexture.underlyingResource, lodLevel);
823
+ }
824
+ }
825
+ else {
826
+ // Default behavior (WebGL)
827
+ const gl = this._context;
828
+ attachment = gl["COLOR_ATTACHMENT" + attachmentIndex + "_WEBGL"];
829
+ const target = faceIndexOrLayer !== undefined ? gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer : gl.TEXTURE_2D;
830
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, target, hardwareTexture.underlyingResource, lodLevel);
831
+ }
832
+ if (texture._autoMSAAManagement && this._MSAAFramebuffer) {
833
+ const gl = this._context;
834
+ engine._bindUnboundFramebuffer(this._MSAAFramebuffer);
835
+ gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, hardwareTexture.getMSAARenderBuffer());
836
+ }
837
+ engine._bindUnboundFramebuffer(currentFB);
838
+ }
839
+ /**
840
+ * Set a texture in the textures array
841
+ * @param texture the texture to set
842
+ * @param index the index in the textures array to set
843
+ * @param disposePrevious If this function should dispose the previous texture
844
+ */
845
+ setTexture(texture, index = 0, disposePrevious = true) {
846
+ super.setTexture(texture, index, disposePrevious);
847
+ this._bindTextureRenderTarget(texture, index);
848
+ }
849
+ /**
850
+ * Sets the layer and face indices of every render target texture
851
+ * @param layers The layer of the texture to be set (make negative to not modify)
852
+ * @param faces The face of the texture to be set (make negative to not modify)
853
+ */
854
+ setLayerAndFaceIndices(layers, faces) {
855
+ super.setLayerAndFaceIndices(layers, faces);
856
+ if (!this.textures || !this.layerIndices || !this.faceIndices) {
857
+ return;
858
+ }
859
+ // the length of this._attachments is the right one as it does not count the depth texture, in case we generated it
860
+ const textureCount = this._attachments?.length ?? this.textures.length;
861
+ for (let index = 0; index < textureCount; index++) {
862
+ const texture = this.textures[index];
863
+ if (!texture) {
864
+ // The target type was probably -1 at creation time and setTexture has not been called yet for this index
865
+ continue;
866
+ }
867
+ if (texture.is2DArray || texture.is3D) {
868
+ this._bindTextureRenderTarget(texture, index, this.layerIndices[index]);
869
+ }
870
+ else if (texture.isCube) {
871
+ this._bindTextureRenderTarget(texture, index, this.faceIndices[index]);
872
+ }
873
+ else {
874
+ this._bindTextureRenderTarget(texture, index);
875
+ }
876
+ }
877
+ }
878
+ /**
879
+ * Set the face and layer indices of a texture in the textures array
880
+ * @param index The index of the texture in the textures array to modify
881
+ * @param layer The layer of the texture to be set
882
+ * @param face The face of the texture to be set
883
+ */
884
+ setLayerAndFaceIndex(index = 0, layer, face) {
885
+ super.setLayerAndFaceIndex(index, layer, face);
886
+ if (!this.textures || !this.layerIndices || !this.faceIndices) {
887
+ return;
888
+ }
889
+ const texture = this.textures[index];
890
+ if (texture.is2DArray || texture.is3D) {
891
+ this._bindTextureRenderTarget(this.textures[index], index, this.layerIndices[index]);
892
+ }
893
+ else if (texture.isCube) {
894
+ this._bindTextureRenderTarget(this.textures[index], index, this.faceIndices[index]);
895
+ }
896
+ }
897
+ resolveMSAATextures() {
898
+ const engine = this._engine;
899
+ const currentFramebuffer = engine._currentFramebuffer;
900
+ engine._bindUnboundFramebuffer(this._MSAAFramebuffer);
901
+ super.resolveMSAATextures();
902
+ engine._bindUnboundFramebuffer(currentFramebuffer);
903
+ }
904
+ dispose(disposeOnlyFramebuffers = this._disposeOnlyFramebuffers) {
905
+ const gl = this._context;
906
+ if (!disposeOnlyFramebuffers) {
907
+ if (this._colorTextureArray) {
908
+ this._context.deleteTexture(this._colorTextureArray);
909
+ this._colorTextureArray = null;
910
+ }
911
+ if (this._depthStencilTextureArray) {
912
+ this._context.deleteTexture(this._depthStencilTextureArray);
913
+ this._depthStencilTextureArray = null;
914
+ }
915
+ }
916
+ if (this._framebuffer) {
917
+ gl.deleteFramebuffer(this._framebuffer);
918
+ this._framebuffer = null;
919
+ }
920
+ if (this._depthStencilBuffer) {
921
+ gl.deleteRenderbuffer(this._depthStencilBuffer);
922
+ this._depthStencilBuffer = null;
923
+ }
924
+ if (this._MSAAFramebuffer) {
925
+ gl.deleteFramebuffer(this._MSAAFramebuffer);
926
+ this._MSAAFramebuffer = null;
927
+ }
928
+ super.dispose(disposeOnlyFramebuffers);
929
+ }
930
+ }
931
+
932
+ ThinEngine.prototype._createHardwareRenderTargetWrapper = function (isMulti, isCube, size) {
933
+ const rtWrapper = new WebGLRenderTargetWrapper(isMulti, isCube, size, this, this._gl);
934
+ this._renderTargetWrapperCache.push(rtWrapper);
935
+ return rtWrapper;
936
+ };
937
+ ThinEngine.prototype.createRenderTargetTexture = function (size, options) {
938
+ const rtWrapper = this._createHardwareRenderTargetWrapper(false, false, size);
939
+ let generateDepthBuffer = true;
940
+ let generateStencilBuffer = false;
941
+ let noColorAttachment = false;
942
+ let colorAttachment = undefined;
943
+ let samples = 1;
944
+ let label = undefined;
945
+ if (options !== undefined && typeof options === "object") {
946
+ generateDepthBuffer = options.generateDepthBuffer ?? true;
947
+ generateStencilBuffer = !!options.generateStencilBuffer;
948
+ noColorAttachment = !!options.noColorAttachment;
949
+ colorAttachment = options.colorAttachment;
950
+ samples = options.samples ?? 1;
951
+ label = options.label;
952
+ }
953
+ const texture = colorAttachment || (noColorAttachment ? null : this._createInternalTexture(size, options, true, 5 /* InternalTextureSource.RenderTarget */));
954
+ const width = size.width || size;
955
+ const height = size.height || size;
956
+ const currentFrameBuffer = this._currentFramebuffer;
957
+ const gl = this._gl;
958
+ // Create the framebuffer
959
+ const framebuffer = gl.createFramebuffer();
960
+ this._bindUnboundFramebuffer(framebuffer);
961
+ rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height);
962
+ // No need to rebind on every frame
963
+ if (texture && !texture.is2DArray && !texture.is3D) {
964
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._hardwareTexture.underlyingResource, 0);
965
+ }
966
+ this._bindUnboundFramebuffer(currentFrameBuffer);
967
+ rtWrapper.label = label ?? "RenderTargetWrapper";
968
+ rtWrapper._framebuffer = framebuffer;
969
+ rtWrapper._generateDepthBuffer = generateDepthBuffer;
970
+ rtWrapper._generateStencilBuffer = generateStencilBuffer;
971
+ rtWrapper.setTextures(texture);
972
+ if (!colorAttachment) {
973
+ this.updateRenderTargetTextureSampleCount(rtWrapper, samples);
974
+ }
975
+ else {
976
+ rtWrapper._samples = colorAttachment.samples;
977
+ if (colorAttachment.samples > 1) {
978
+ const msaaRenderBuffer = colorAttachment._hardwareTexture.getMSAARenderBuffer(0);
979
+ rtWrapper._MSAAFramebuffer = gl.createFramebuffer();
980
+ this._bindUnboundFramebuffer(rtWrapper._MSAAFramebuffer);
981
+ gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, msaaRenderBuffer);
982
+ this._bindUnboundFramebuffer(null);
983
+ }
984
+ }
985
+ return rtWrapper;
986
+ };
987
+ ThinEngine.prototype._createDepthStencilTexture = function (size, options, rtWrapper) {
988
+ const gl = this._gl;
989
+ const layers = size.layers || 0;
990
+ const depth = size.depth || 0;
991
+ let target = gl.TEXTURE_2D;
992
+ if (layers !== 0) {
993
+ target = gl.TEXTURE_2D_ARRAY;
994
+ }
995
+ else if (depth !== 0) {
996
+ target = gl.TEXTURE_3D;
997
+ }
998
+ const internalTexture = new InternalTexture(this, 12 /* InternalTextureSource.DepthStencil */);
999
+ internalTexture.label = options.label;
1000
+ if (!this._caps.depthTextureExtension) {
1001
+ Logger.Error("Depth texture is not supported by your browser or hardware.");
1002
+ return internalTexture;
1003
+ }
1004
+ const internalOptions = {
1005
+ bilinearFiltering: false,
1006
+ comparisonFunction: 0,
1007
+ generateStencil: false,
1008
+ ...options,
1009
+ };
1010
+ this._bindTextureDirectly(target, internalTexture, true);
1011
+ this._setupDepthStencilTexture(internalTexture, size, internalOptions.comparisonFunction === 0 ? false : internalOptions.bilinearFiltering, internalOptions.comparisonFunction, internalOptions.samples);
1012
+ if (internalOptions.depthTextureFormat !== undefined) {
1013
+ if (internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH16 &&
1014
+ internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH24 &&
1015
+ internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 &&
1016
+ internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 &&
1017
+ internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH32_FLOAT &&
1018
+ internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8) {
1019
+ Logger.Error(`Depth texture ${internalOptions.depthTextureFormat} format is not supported.`);
1020
+ return internalTexture;
1021
+ }
1022
+ internalTexture.format = internalOptions.depthTextureFormat;
1023
+ }
1024
+ else {
1025
+ internalTexture.format = internalOptions.generateStencil ? Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 : Constants.TEXTUREFORMAT_DEPTH24;
1026
+ }
1027
+ const hasStencil = internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 ||
1028
+ internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 ||
1029
+ internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8;
1030
+ const type = this._getWebGLTextureTypeFromDepthTextureFormat(internalTexture.format);
1031
+ const format = hasStencil ? gl.DEPTH_STENCIL : gl.DEPTH_COMPONENT;
1032
+ const internalFormat = this._getInternalFormatFromDepthTextureFormat(internalTexture.format, true, hasStencil);
1033
+ if (internalTexture.is2DArray) {
1034
+ gl.texImage3D(target, 0, internalFormat, internalTexture.width, internalTexture.height, layers, 0, format, type, null);
1035
+ }
1036
+ else if (internalTexture.is3D) {
1037
+ gl.texImage3D(target, 0, internalFormat, internalTexture.width, internalTexture.height, depth, 0, format, type, null);
1038
+ }
1039
+ else {
1040
+ gl.texImage2D(target, 0, internalFormat, internalTexture.width, internalTexture.height, 0, format, type, null);
1041
+ }
1042
+ this._bindTextureDirectly(target, null);
1043
+ this._internalTexturesCache.push(internalTexture);
1044
+ if (rtWrapper._depthStencilBuffer) {
1045
+ gl.deleteRenderbuffer(rtWrapper._depthStencilBuffer);
1046
+ rtWrapper._depthStencilBuffer = null;
1047
+ }
1048
+ this._bindUnboundFramebuffer(rtWrapper._MSAAFramebuffer ?? rtWrapper._framebuffer);
1049
+ rtWrapper._generateStencilBuffer = hasStencil;
1050
+ rtWrapper._depthStencilTextureWithStencil = hasStencil;
1051
+ rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(rtWrapper._generateStencilBuffer, rtWrapper._generateDepthBuffer, rtWrapper.width, rtWrapper.height, rtWrapper.samples, internalTexture.format);
1052
+ this._bindUnboundFramebuffer(null);
1053
+ return internalTexture;
1054
+ };
1055
+ ThinEngine.prototype.updateRenderTargetTextureSampleCount = function (rtWrapper, samples) {
1056
+ if (this.webGLVersion < 2 || !rtWrapper) {
1057
+ return 1;
1058
+ }
1059
+ if (rtWrapper.samples === samples) {
1060
+ return samples;
1061
+ }
1062
+ const gl = this._gl;
1063
+ samples = Math.min(samples, this.getCaps().maxMSAASamples);
1064
+ // Dispose previous render buffers
1065
+ if (rtWrapper._depthStencilBuffer) {
1066
+ gl.deleteRenderbuffer(rtWrapper._depthStencilBuffer);
1067
+ rtWrapper._depthStencilBuffer = null;
1068
+ }
1069
+ if (rtWrapper._MSAAFramebuffer) {
1070
+ gl.deleteFramebuffer(rtWrapper._MSAAFramebuffer);
1071
+ rtWrapper._MSAAFramebuffer = null;
1072
+ }
1073
+ const hardwareTexture = rtWrapper.texture?._hardwareTexture;
1074
+ hardwareTexture?.releaseMSAARenderBuffers();
1075
+ if (rtWrapper.texture && samples > 1 && typeof gl.renderbufferStorageMultisample === "function") {
1076
+ const framebuffer = gl.createFramebuffer();
1077
+ if (!framebuffer) {
1078
+ throw new Error("Unable to create multi sampled framebuffer");
1079
+ }
1080
+ rtWrapper._MSAAFramebuffer = framebuffer;
1081
+ this._bindUnboundFramebuffer(rtWrapper._MSAAFramebuffer);
1082
+ const colorRenderbuffer = this._createRenderBuffer(rtWrapper.texture.width, rtWrapper.texture.height, samples, -1 /* not used */, this._getRGBABufferInternalSizedFormat(rtWrapper.texture.type, rtWrapper.texture.format, rtWrapper.texture._useSRGBBuffer), gl.COLOR_ATTACHMENT0, false);
1083
+ if (!colorRenderbuffer) {
1084
+ throw new Error("Unable to create multi sampled framebuffer");
1085
+ }
1086
+ hardwareTexture?.addMSAARenderBuffer(colorRenderbuffer);
1087
+ }
1088
+ this._bindUnboundFramebuffer(rtWrapper._MSAAFramebuffer ?? rtWrapper._framebuffer);
1089
+ if (rtWrapper.texture) {
1090
+ rtWrapper.texture.samples = samples;
1091
+ }
1092
+ rtWrapper._samples = samples;
1093
+ const depthFormat = rtWrapper._depthStencilTexture ? rtWrapper._depthStencilTexture.format : undefined;
1094
+ rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(rtWrapper._generateStencilBuffer, rtWrapper._generateDepthBuffer, rtWrapper.width, rtWrapper.height, samples, depthFormat);
1095
+ this._bindUnboundFramebuffer(null);
1096
+ return samples;
1097
+ };
1098
+ ThinEngine.prototype._setupDepthStencilTexture = function (internalTexture, size, bilinearFiltering, comparisonFunction, samples = 1) {
1099
+ const width = size.width ?? size;
1100
+ const height = size.height ?? size;
1101
+ const layers = size.layers || 0;
1102
+ const depth = size.depth || 0;
1103
+ internalTexture.baseWidth = width;
1104
+ internalTexture.baseHeight = height;
1105
+ internalTexture.width = width;
1106
+ internalTexture.height = height;
1107
+ internalTexture.is2DArray = layers > 0;
1108
+ internalTexture.depth = layers || depth;
1109
+ internalTexture.isReady = true;
1110
+ internalTexture.samples = samples;
1111
+ internalTexture.generateMipMaps = false;
1112
+ internalTexture.samplingMode = bilinearFiltering ? Constants.TEXTURE_BILINEAR_SAMPLINGMODE : Constants.TEXTURE_NEAREST_SAMPLINGMODE;
1113
+ internalTexture.type = Constants.TEXTURETYPE_UNSIGNED_BYTE;
1114
+ internalTexture._comparisonFunction = comparisonFunction;
1115
+ const gl = this._gl;
1116
+ const target = this._getTextureTarget(internalTexture);
1117
+ const samplingParameters = this._getSamplingParameters(internalTexture.samplingMode, false);
1118
+ gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, samplingParameters.mag);
1119
+ gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, samplingParameters.min);
1120
+ gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
1121
+ gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
1122
+ // TEXTURE_COMPARE_FUNC/MODE are only availble in WebGL2.
1123
+ if (this.webGLVersion > 1) {
1124
+ if (comparisonFunction === 0) {
1125
+ gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, Constants.LEQUAL);
1126
+ gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.NONE);
1127
+ }
1128
+ else {
1129
+ gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);
1130
+ gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);
1131
+ }
1132
+ }
1133
+ };
1134
+
1135
+ ThinEngine.prototype.setDepthStencilTexture = function (channel, uniform, texture, name) {
1136
+ if (channel === undefined) {
1137
+ return;
1138
+ }
1139
+ if (uniform) {
1140
+ this._boundUniforms[channel] = uniform;
1141
+ }
1142
+ if (!texture || !texture.depthStencilTexture) {
1143
+ this._setTexture(channel, null, undefined, undefined, name);
1144
+ }
1145
+ else {
1146
+ this._setTexture(channel, texture, false, true, name);
1147
+ }
1148
+ };
1149
+
1150
+ ThinEngine.prototype.createRenderTargetCubeTexture = function (size, options) {
1151
+ const rtWrapper = this._createHardwareRenderTargetWrapper(false, true, size);
1152
+ const fullOptions = {
1153
+ generateMipMaps: true,
1154
+ generateDepthBuffer: true,
1155
+ generateStencilBuffer: false,
1156
+ type: Constants.TEXTURETYPE_UNSIGNED_BYTE,
1157
+ samplingMode: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,
1158
+ format: Constants.TEXTUREFORMAT_RGBA,
1159
+ ...options,
1160
+ };
1161
+ fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && fullOptions.generateStencilBuffer;
1162
+ if (fullOptions.type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {
1163
+ // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE
1164
+ fullOptions.samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
1165
+ }
1166
+ else if (fullOptions.type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {
1167
+ // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE
1168
+ fullOptions.samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
1169
+ }
1170
+ const gl = this._gl;
1171
+ const texture = new InternalTexture(this, 5 /* InternalTextureSource.RenderTarget */);
1172
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
1173
+ const filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps);
1174
+ if (fullOptions.type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {
1175
+ fullOptions.type = Constants.TEXTURETYPE_UNSIGNED_BYTE;
1176
+ Logger.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type");
1177
+ }
1178
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);
1179
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);
1180
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
1181
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
1182
+ for (let face = 0; face < 6; face++) {
1183
+ gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), size, size, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);
1184
+ }
1185
+ // Create the framebuffer
1186
+ const framebuffer = gl.createFramebuffer();
1187
+ this._bindUnboundFramebuffer(framebuffer);
1188
+ rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer, fullOptions.generateDepthBuffer, size, size);
1189
+ // MipMaps
1190
+ if (fullOptions.generateMipMaps) {
1191
+ gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
1192
+ }
1193
+ // Unbind
1194
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
1195
+ this._bindUnboundFramebuffer(null);
1196
+ rtWrapper._framebuffer = framebuffer;
1197
+ rtWrapper._generateDepthBuffer = fullOptions.generateDepthBuffer;
1198
+ rtWrapper._generateStencilBuffer = fullOptions.generateStencilBuffer;
1199
+ texture.width = size;
1200
+ texture.height = size;
1201
+ texture.isReady = true;
1202
+ texture.isCube = true;
1203
+ texture.samples = 1;
1204
+ texture.generateMipMaps = fullOptions.generateMipMaps;
1205
+ texture.samplingMode = fullOptions.samplingMode;
1206
+ texture.type = fullOptions.type;
1207
+ texture.format = fullOptions.format;
1208
+ this._internalTexturesCache.push(texture);
1209
+ rtWrapper.setTextures(texture);
1210
+ return rtWrapper;
1211
+ };
1212
+
1213
+ ThinEngine.prototype.createPrefilteredCubeTexture = function (rootUrl, scene, lodScale, lodOffset, onLoad = null, onError = null, format, forcedExtension = null, createPolynomials = true) {
1214
+ const callback = async (loadData) => {
1215
+ if (!loadData) {
1216
+ if (onLoad) {
1217
+ onLoad(null);
1218
+ }
1219
+ return;
1220
+ }
1221
+ const texture = loadData.texture;
1222
+ if (!createPolynomials) {
1223
+ texture._sphericalPolynomial = new SphericalPolynomial();
1224
+ }
1225
+ else if (loadData.info.sphericalPolynomial) {
1226
+ texture._sphericalPolynomial = loadData.info.sphericalPolynomial;
1227
+ }
1228
+ texture._source = 9 /* InternalTextureSource.CubePrefiltered */;
1229
+ if (this.getCaps().textureLOD) {
1230
+ // Do not add extra process if texture lod is supported.
1231
+ if (onLoad) {
1232
+ onLoad(texture);
1233
+ }
1234
+ return;
1235
+ }
1236
+ const mipSlices = 3;
1237
+ const gl = this._gl;
1238
+ const width = loadData.width;
1239
+ if (!width) {
1240
+ return;
1241
+ }
1242
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1243
+ const { DDSTools } = await import('./dds-zApWiwah.esm.js');
1244
+ const textures = [];
1245
+ for (let i = 0; i < mipSlices; i++) {
1246
+ //compute LOD from even spacing in smoothness (matching shader calculation)
1247
+ const smoothness = i / (mipSlices - 1);
1248
+ const roughness = 1 - smoothness;
1249
+ const minLODIndex = lodOffset; // roughness = 0
1250
+ const maxLODIndex = Math.log2(width) * lodScale + lodOffset; // roughness = 1
1251
+ const lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;
1252
+ const mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));
1253
+ const glTextureFromLod = new InternalTexture(this, 2 /* InternalTextureSource.Temp */);
1254
+ glTextureFromLod.type = texture.type;
1255
+ glTextureFromLod.format = texture.format;
1256
+ glTextureFromLod.width = Math.pow(2, Math.max(Math.log2(width) - mipmapIndex, 0));
1257
+ glTextureFromLod.height = glTextureFromLod.width;
1258
+ glTextureFromLod.isCube = true;
1259
+ glTextureFromLod._cachedWrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;
1260
+ glTextureFromLod._cachedWrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;
1261
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, glTextureFromLod, true);
1262
+ glTextureFromLod.samplingMode = Constants.TEXTURE_LINEAR_LINEAR;
1263
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
1264
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
1265
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
1266
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
1267
+ if (loadData.isDDS) {
1268
+ const info = loadData.info;
1269
+ const data = loadData.data;
1270
+ this._unpackFlipY(info.isCompressed);
1271
+ DDSTools.UploadDDSLevels(this, glTextureFromLod, data, info, true, 6, mipmapIndex);
1272
+ }
1273
+ else {
1274
+ Logger.Warn("DDS is the only prefiltered cube map supported so far.");
1275
+ }
1276
+ this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
1277
+ // Wrap in a base texture for easy binding.
1278
+ const lodTexture = new BaseTexture(scene);
1279
+ lodTexture._isCube = true;
1280
+ lodTexture._texture = glTextureFromLod;
1281
+ glTextureFromLod.isReady = true;
1282
+ textures.push(lodTexture);
1283
+ }
1284
+ texture._lodTextureHigh = textures[2];
1285
+ texture._lodTextureMid = textures[1];
1286
+ texture._lodTextureLow = textures[0];
1287
+ if (onLoad) {
1288
+ onLoad(texture);
1289
+ }
1290
+ };
1291
+ return this.createCubeTexture(rootUrl, scene, null, false, callback, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset);
1292
+ };
1293
+
1294
+ ThinEngine.prototype.createUniformBuffer = function (elements, _label) {
1295
+ const ubo = this._gl.createBuffer();
1296
+ if (!ubo) {
1297
+ throw new Error("Unable to create uniform buffer");
1298
+ }
1299
+ const result = new WebGLDataBuffer(ubo);
1300
+ this.bindUniformBuffer(result);
1301
+ if (elements instanceof Float32Array) {
1302
+ this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.STATIC_DRAW);
1303
+ }
1304
+ else {
1305
+ this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.STATIC_DRAW);
1306
+ }
1307
+ this.bindUniformBuffer(null);
1308
+ result.references = 1;
1309
+ return result;
1310
+ };
1311
+ ThinEngine.prototype.createDynamicUniformBuffer = function (elements, _label) {
1312
+ const ubo = this._gl.createBuffer();
1313
+ if (!ubo) {
1314
+ throw new Error("Unable to create dynamic uniform buffer");
1315
+ }
1316
+ const result = new WebGLDataBuffer(ubo);
1317
+ this.bindUniformBuffer(result);
1318
+ if (elements instanceof Float32Array) {
1319
+ this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.DYNAMIC_DRAW);
1320
+ }
1321
+ else {
1322
+ this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.DYNAMIC_DRAW);
1323
+ }
1324
+ this.bindUniformBuffer(null);
1325
+ result.references = 1;
1326
+ return result;
1327
+ };
1328
+ ThinEngine.prototype.updateUniformBuffer = function (uniformBuffer, elements, offset, count) {
1329
+ this.bindUniformBuffer(uniformBuffer);
1330
+ if (offset === undefined) {
1331
+ offset = 0;
1332
+ }
1333
+ if (count === undefined) {
1334
+ if (elements instanceof Float32Array) {
1335
+ this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, elements);
1336
+ }
1337
+ else {
1338
+ this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, new Float32Array(elements));
1339
+ }
1340
+ }
1341
+ else {
1342
+ if (elements instanceof Float32Array) {
1343
+ this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, elements.subarray(offset, offset + count));
1344
+ }
1345
+ else {
1346
+ this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, new Float32Array(elements).subarray(offset, offset + count));
1347
+ }
1348
+ }
1349
+ this.bindUniformBuffer(null);
1350
+ };
1351
+ ThinEngine.prototype.bindUniformBuffer = function (buffer) {
1352
+ this._gl.bindBuffer(this._gl.UNIFORM_BUFFER, buffer ? buffer.underlyingResource : null);
1353
+ };
1354
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1355
+ ThinEngine.prototype.bindUniformBufferBase = function (buffer, location, name) {
1356
+ this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER, location, buffer ? buffer.underlyingResource : null);
1357
+ };
1358
+ ThinEngine.prototype.bindUniformBlock = function (pipelineContext, blockName, index) {
1359
+ const program = pipelineContext.program;
1360
+ const uniformLocation = this._gl.getUniformBlockIndex(program, blockName);
1361
+ if (uniformLocation !== 0xffffffff) {
1362
+ this._gl.uniformBlockBinding(program, uniformLocation, index);
1363
+ }
1364
+ };
1365
+
1366
+ /**
1367
+ * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio
1368
+ */
1369
+ class Engine extends ThinEngine {
1370
+ /**
1371
+ * Returns the current npm package of the sdk
1372
+ */
1373
+ // Not mixed with Version for tooling purpose.
1374
+ static get NpmPackage() {
1375
+ return AbstractEngine.NpmPackage;
1376
+ }
1377
+ /**
1378
+ * Returns the current version of the framework
1379
+ */
1380
+ static get Version() {
1381
+ return AbstractEngine.Version;
1382
+ }
1383
+ /** Gets the list of created engines */
1384
+ static get Instances() {
1385
+ return EngineStore.Instances;
1386
+ }
1387
+ /**
1388
+ * Gets the latest created engine
1389
+ */
1390
+ static get LastCreatedEngine() {
1391
+ return EngineStore.LastCreatedEngine;
1392
+ }
1393
+ /**
1394
+ * Gets the latest created scene
1395
+ */
1396
+ static get LastCreatedScene() {
1397
+ return EngineStore.LastCreatedScene;
1398
+ }
1399
+ /** @internal */
1400
+ // eslint-disable-next-line jsdoc/require-returns-check
1401
+ /**
1402
+ * Method called to create the default loading screen.
1403
+ * This can be overridden in your own app.
1404
+ * @param canvas The rendering canvas element
1405
+ * @returns The loading screen
1406
+ */
1407
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1408
+ static DefaultLoadingScreenFactory(canvas) {
1409
+ return AbstractEngine.DefaultLoadingScreenFactory(canvas);
1410
+ }
1411
+ get _supportsHardwareTextureRescaling() {
1412
+ return !!Engine._RescalePostProcessFactory;
1413
+ }
1414
+ _measureFps() {
1415
+ this._performanceMonitor.sampleFrame();
1416
+ this._fps = this._performanceMonitor.averageFPS;
1417
+ this._deltaTime = this._performanceMonitor.instantaneousFrameTime || 0;
1418
+ }
1419
+ /**
1420
+ * Gets the performance monitor attached to this engine
1421
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#engineinstrumentation
1422
+ */
1423
+ get performanceMonitor() {
1424
+ return this._performanceMonitor;
1425
+ }
1426
+ // Events
1427
+ /**
1428
+ * Creates a new engine
1429
+ * @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
1430
+ * @param antialias defines enable antialiasing (default: false)
1431
+ * @param options defines further options to be sent to the getContext() function
1432
+ * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)
1433
+ */
1434
+ constructor(canvasOrContext, antialias, options, adaptToDeviceRatio = false) {
1435
+ super(canvasOrContext, antialias, options, adaptToDeviceRatio);
1436
+ // Members
1437
+ /**
1438
+ * If set, will be used to request the next animation frame for the render loop
1439
+ */
1440
+ this.customAnimationFrameRequester = null;
1441
+ this._performanceMonitor = new PerformanceMonitor();
1442
+ this._drawCalls = new PerfCounter();
1443
+ if (!canvasOrContext) {
1444
+ return;
1445
+ }
1446
+ this._features.supportRenderPasses = true;
1447
+ options = this._creationOptions;
1448
+ }
1449
+ _initGLContext() {
1450
+ super._initGLContext();
1451
+ this._rescalePostProcess = null;
1452
+ }
1453
+ /**
1454
+ * Shared initialization across engines types.
1455
+ * @param canvas The canvas associated with this instance of the engine.
1456
+ */
1457
+ _sharedInit(canvas) {
1458
+ super._sharedInit(canvas);
1459
+ _CommonInit(this, canvas, this._creationOptions);
1460
+ }
1461
+ /**
1462
+ * Resize an image and returns the image data as an uint8array
1463
+ * @param image image to resize
1464
+ * @param bufferWidth destination buffer width
1465
+ * @param bufferHeight destination buffer height
1466
+ * @returns an uint8array containing RGBA values of bufferWidth * bufferHeight size
1467
+ */
1468
+ resizeImageBitmap(image, bufferWidth, bufferHeight) {
1469
+ return ResizeImageBitmap(this, image, bufferWidth, bufferHeight);
1470
+ }
1471
+ /**
1472
+ * Engine abstraction for loading and creating an image bitmap from a given source string.
1473
+ * @param imageSource source to load the image from.
1474
+ * @param options An object that sets options for the image's extraction.
1475
+ * @returns ImageBitmap
1476
+ */
1477
+ _createImageBitmapFromSource(imageSource, options) {
1478
+ return CreateImageBitmapFromSource(this, imageSource, options);
1479
+ }
1480
+ /**
1481
+ * Toggle full screen mode
1482
+ * @param requestPointerLock defines if a pointer lock should be requested from the user
1483
+ */
1484
+ switchFullscreen(requestPointerLock) {
1485
+ if (this.isFullscreen) {
1486
+ this.exitFullscreen();
1487
+ }
1488
+ else {
1489
+ this.enterFullscreen(requestPointerLock);
1490
+ }
1491
+ }
1492
+ /**
1493
+ * Enters full screen mode
1494
+ * @param requestPointerLock defines if a pointer lock should be requested from the user
1495
+ */
1496
+ enterFullscreen(requestPointerLock) {
1497
+ if (!this.isFullscreen) {
1498
+ this._pointerLockRequested = requestPointerLock;
1499
+ if (this._renderingCanvas) {
1500
+ RequestFullscreen(this._renderingCanvas);
1501
+ }
1502
+ }
1503
+ }
1504
+ /**
1505
+ * Exits full screen mode
1506
+ */
1507
+ exitFullscreen() {
1508
+ if (this.isFullscreen) {
1509
+ ExitFullscreen();
1510
+ }
1511
+ }
1512
+ /** States */
1513
+ /**
1514
+ * Sets a boolean indicating if the dithering state is enabled or disabled
1515
+ * @param value defines the dithering state
1516
+ */
1517
+ setDitheringState(value) {
1518
+ if (value) {
1519
+ this._gl.enable(this._gl.DITHER);
1520
+ }
1521
+ else {
1522
+ this._gl.disable(this._gl.DITHER);
1523
+ }
1524
+ }
1525
+ /**
1526
+ * Sets a boolean indicating if the rasterizer state is enabled or disabled
1527
+ * @param value defines the rasterizer state
1528
+ */
1529
+ setRasterizerState(value) {
1530
+ if (value) {
1531
+ this._gl.disable(this._gl.RASTERIZER_DISCARD);
1532
+ }
1533
+ else {
1534
+ this._gl.enable(this._gl.RASTERIZER_DISCARD);
1535
+ }
1536
+ }
1537
+ /**
1538
+ * Directly set the WebGL Viewport
1539
+ * @param x defines the x coordinate of the viewport (in screen space)
1540
+ * @param y defines the y coordinate of the viewport (in screen space)
1541
+ * @param width defines the width of the viewport (in screen space)
1542
+ * @param height defines the height of the viewport (in screen space)
1543
+ * @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
1544
+ */
1545
+ setDirectViewport(x, y, width, height) {
1546
+ const currentViewport = this._cachedViewport;
1547
+ this._cachedViewport = null;
1548
+ this._viewport(x, y, width, height);
1549
+ return currentViewport;
1550
+ }
1551
+ /**
1552
+ * Executes a scissor clear (ie. a clear on a specific portion of the screen)
1553
+ * @param x defines the x-coordinate of the bottom left corner of the clear rectangle
1554
+ * @param y defines the y-coordinate of the corner of the clear rectangle
1555
+ * @param width defines the width of the clear rectangle
1556
+ * @param height defines the height of the clear rectangle
1557
+ * @param clearColor defines the clear color
1558
+ */
1559
+ scissorClear(x, y, width, height, clearColor) {
1560
+ this.enableScissor(x, y, width, height);
1561
+ this.clear(clearColor, true, true, true);
1562
+ this.disableScissor();
1563
+ }
1564
+ /**
1565
+ * Enable scissor test on a specific rectangle (ie. render will only be executed on a specific portion of the screen)
1566
+ * @param x defines the x-coordinate of the bottom left corner of the clear rectangle
1567
+ * @param y defines the y-coordinate of the corner of the clear rectangle
1568
+ * @param width defines the width of the clear rectangle
1569
+ * @param height defines the height of the clear rectangle
1570
+ */
1571
+ enableScissor(x, y, width, height) {
1572
+ const gl = this._gl;
1573
+ // Change state
1574
+ gl.enable(gl.SCISSOR_TEST);
1575
+ gl.scissor(x, y, width, height);
1576
+ }
1577
+ /**
1578
+ * Disable previously set scissor test rectangle
1579
+ */
1580
+ disableScissor() {
1581
+ const gl = this._gl;
1582
+ gl.disable(gl.SCISSOR_TEST);
1583
+ }
1584
+ /**
1585
+ * @internal
1586
+ */
1587
+ _loadFileAsync(url, offlineProvider, useArrayBuffer) {
1588
+ return new Promise((resolve, reject) => {
1589
+ this._loadFile(url, (data) => {
1590
+ resolve(data);
1591
+ }, undefined, offlineProvider, useArrayBuffer, (request, exception) => {
1592
+ reject(exception);
1593
+ });
1594
+ });
1595
+ }
1596
+ /**
1597
+ * Gets the source code of the vertex shader associated with a specific webGL program
1598
+ * @param program defines the program to use
1599
+ * @returns a string containing the source code of the vertex shader associated with the program
1600
+ */
1601
+ getVertexShaderSource(program) {
1602
+ const shaders = this._gl.getAttachedShaders(program);
1603
+ if (!shaders) {
1604
+ return null;
1605
+ }
1606
+ return this._gl.getShaderSource(shaders[0]);
1607
+ }
1608
+ /**
1609
+ * Gets the source code of the fragment shader associated with a specific webGL program
1610
+ * @param program defines the program to use
1611
+ * @returns a string containing the source code of the fragment shader associated with the program
1612
+ */
1613
+ getFragmentShaderSource(program) {
1614
+ const shaders = this._gl.getAttachedShaders(program);
1615
+ if (!shaders) {
1616
+ return null;
1617
+ }
1618
+ return this._gl.getShaderSource(shaders[1]);
1619
+ }
1620
+ /**
1621
+ * sets the object from which width and height will be taken from when getting render width and height
1622
+ * Will fallback to the gl object
1623
+ * @param dimensions the framebuffer width and height that will be used.
1624
+ */
1625
+ set framebufferDimensionsObject(dimensions) {
1626
+ this._framebufferDimensionsObject = dimensions;
1627
+ if (this._framebufferDimensionsObject) {
1628
+ this.onResizeObservable.notifyObservers(this);
1629
+ }
1630
+ }
1631
+ _rebuildBuffers() {
1632
+ // Index / Vertex
1633
+ for (const scene of this.scenes) {
1634
+ scene.resetCachedMaterial();
1635
+ scene._rebuildGeometries();
1636
+ }
1637
+ for (const scene of this._virtualScenes) {
1638
+ scene.resetCachedMaterial();
1639
+ scene._rebuildGeometries();
1640
+ }
1641
+ super._rebuildBuffers();
1642
+ }
1643
+ /**
1644
+ * Get Font size information
1645
+ * @param font font name
1646
+ * @returns an object containing ascent, height and descent
1647
+ */
1648
+ getFontOffset(font) {
1649
+ return GetFontOffset(font);
1650
+ }
1651
+ _cancelFrame() {
1652
+ if (this.customAnimationFrameRequester) {
1653
+ if (this._frameHandler !== 0) {
1654
+ this._frameHandler = 0;
1655
+ const { cancelAnimationFrame } = this.customAnimationFrameRequester;
1656
+ if (cancelAnimationFrame) {
1657
+ cancelAnimationFrame(this.customAnimationFrameRequester.requestID);
1658
+ }
1659
+ }
1660
+ }
1661
+ else {
1662
+ super._cancelFrame();
1663
+ }
1664
+ }
1665
+ _renderLoop() {
1666
+ // Reset the frame handler before rendering a frame to determine if a new frame has been queued.
1667
+ this._frameHandler = 0;
1668
+ if (!this._contextWasLost) {
1669
+ let shouldRender = true;
1670
+ if (this.isDisposed || (!this.renderEvenInBackground && this._windowIsBackground)) {
1671
+ shouldRender = false;
1672
+ }
1673
+ if (shouldRender) {
1674
+ // Start new frame
1675
+ this.beginFrame();
1676
+ // Child canvases
1677
+ if (!this._renderViews()) {
1678
+ // Main frame
1679
+ this._renderFrame();
1680
+ }
1681
+ // Present
1682
+ this.endFrame();
1683
+ }
1684
+ }
1685
+ // The first condition prevents queuing another frame if we no longer have active render loops (e.g., if
1686
+ // `stopRenderLoop` is called mid frame). The second condition prevents queuing another frame if one has
1687
+ // already been queued (e.g., if `stopRenderLoop` and `runRenderLoop` is called mid frame).
1688
+ if (this._activeRenderLoops.length > 0 && this._frameHandler === 0) {
1689
+ if (this.customAnimationFrameRequester) {
1690
+ this.customAnimationFrameRequester.requestID = this._queueNewFrame(this.customAnimationFrameRequester.renderFunction || this._boundRenderFunction, this.customAnimationFrameRequester);
1691
+ this._frameHandler = this.customAnimationFrameRequester.requestID;
1692
+ }
1693
+ else {
1694
+ this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());
1695
+ }
1696
+ }
1697
+ }
1698
+ /**
1699
+ * Enters Pointerlock mode
1700
+ */
1701
+ enterPointerlock() {
1702
+ if (this._renderingCanvas) {
1703
+ RequestPointerlock(this._renderingCanvas);
1704
+ }
1705
+ }
1706
+ /**
1707
+ * Exits Pointerlock mode
1708
+ */
1709
+ exitPointerlock() {
1710
+ ExitPointerlock();
1711
+ }
1712
+ /**
1713
+ * Begin a new frame
1714
+ */
1715
+ beginFrame() {
1716
+ this._measureFps();
1717
+ super.beginFrame();
1718
+ }
1719
+ _deletePipelineContext(pipelineContext) {
1720
+ const webGLPipelineContext = pipelineContext;
1721
+ if (webGLPipelineContext && webGLPipelineContext.program) {
1722
+ if (webGLPipelineContext.transformFeedback) {
1723
+ this.deleteTransformFeedback(webGLPipelineContext.transformFeedback);
1724
+ webGLPipelineContext.transformFeedback = null;
1725
+ }
1726
+ }
1727
+ super._deletePipelineContext(pipelineContext);
1728
+ }
1729
+ createShaderProgram(pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings = null) {
1730
+ context = context || this._gl;
1731
+ this.onBeforeShaderCompilationObservable.notifyObservers(this);
1732
+ const program = super.createShaderProgram(pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings);
1733
+ this.onAfterShaderCompilationObservable.notifyObservers(this);
1734
+ return program;
1735
+ }
1736
+ _createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings = null) {
1737
+ const shaderProgram = context.createProgram();
1738
+ pipelineContext.program = shaderProgram;
1739
+ if (!shaderProgram) {
1740
+ throw new Error("Unable to create program");
1741
+ }
1742
+ context.attachShader(shaderProgram, vertexShader);
1743
+ context.attachShader(shaderProgram, fragmentShader);
1744
+ if (this.webGLVersion > 1 && transformFeedbackVaryings) {
1745
+ const transformFeedback = this.createTransformFeedback();
1746
+ this.bindTransformFeedback(transformFeedback);
1747
+ this.setTranformFeedbackVaryings(shaderProgram, transformFeedbackVaryings);
1748
+ pipelineContext.transformFeedback = transformFeedback;
1749
+ }
1750
+ context.linkProgram(shaderProgram);
1751
+ if (this.webGLVersion > 1 && transformFeedbackVaryings) {
1752
+ this.bindTransformFeedback(null);
1753
+ }
1754
+ pipelineContext.context = context;
1755
+ pipelineContext.vertexShader = vertexShader;
1756
+ pipelineContext.fragmentShader = fragmentShader;
1757
+ if (!pipelineContext.isParallelCompiled) {
1758
+ this._finalizePipelineContext(pipelineContext);
1759
+ }
1760
+ return shaderProgram;
1761
+ }
1762
+ /**
1763
+ * @internal
1764
+ */
1765
+ _releaseTexture(texture) {
1766
+ super._releaseTexture(texture);
1767
+ }
1768
+ /**
1769
+ * @internal
1770
+ */
1771
+ _releaseRenderTargetWrapper(rtWrapper) {
1772
+ super._releaseRenderTargetWrapper(rtWrapper);
1773
+ // Set output texture of post process to null if the framebuffer has been released/disposed
1774
+ this.scenes.forEach((scene) => {
1775
+ scene.postProcesses.forEach((postProcess) => {
1776
+ if (postProcess._outputTexture === rtWrapper) {
1777
+ postProcess._outputTexture = null;
1778
+ }
1779
+ });
1780
+ scene.cameras.forEach((camera) => {
1781
+ camera._postProcesses.forEach((postProcess) => {
1782
+ if (postProcess) {
1783
+ if (postProcess._outputTexture === rtWrapper) {
1784
+ postProcess._outputTexture = null;
1785
+ }
1786
+ }
1787
+ });
1788
+ });
1789
+ });
1790
+ }
1791
+ /**
1792
+ * @internal
1793
+ * Rescales a texture
1794
+ * @param source input texture
1795
+ * @param destination destination texture
1796
+ * @param scene scene to use to render the resize
1797
+ * @param internalFormat format to use when resizing
1798
+ * @param onComplete callback to be called when resize has completed
1799
+ */
1800
+ _rescaleTexture(source, destination, scene, internalFormat, onComplete) {
1801
+ this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR);
1802
+ this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR);
1803
+ this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE);
1804
+ this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE);
1805
+ const rtt = this.createRenderTargetTexture({
1806
+ width: destination.width,
1807
+ height: destination.height,
1808
+ }, {
1809
+ generateMipMaps: false,
1810
+ type: Constants.TEXTURETYPE_UNSIGNED_INT,
1811
+ samplingMode: Constants.TEXTURE_BILINEAR_SAMPLINGMODE,
1812
+ generateDepthBuffer: false,
1813
+ generateStencilBuffer: false,
1814
+ });
1815
+ if (!this._rescalePostProcess && Engine._RescalePostProcessFactory) {
1816
+ this._rescalePostProcess = Engine._RescalePostProcessFactory(this);
1817
+ }
1818
+ if (this._rescalePostProcess) {
1819
+ this._rescalePostProcess.externalTextureSamplerBinding = true;
1820
+ const onCompiled = () => {
1821
+ this._rescalePostProcess.onApply = function (effect) {
1822
+ effect._bindTexture("textureSampler", source);
1823
+ };
1824
+ let hostingScene = scene;
1825
+ if (!hostingScene) {
1826
+ hostingScene = this.scenes[this.scenes.length - 1];
1827
+ }
1828
+ hostingScene.postProcessManager.directRender([this._rescalePostProcess], rtt, true);
1829
+ this._bindTextureDirectly(this._gl.TEXTURE_2D, destination, true);
1830
+ this._gl.copyTexImage2D(this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);
1831
+ this.unBindFramebuffer(rtt);
1832
+ rtt.dispose();
1833
+ if (onComplete) {
1834
+ onComplete();
1835
+ }
1836
+ };
1837
+ const effect = this._rescalePostProcess.getEffect();
1838
+ if (effect) {
1839
+ effect.executeWhenCompiled(onCompiled);
1840
+ }
1841
+ else {
1842
+ this._rescalePostProcess.onEffectCreatedObservable.addOnce((effect) => {
1843
+ effect.executeWhenCompiled(onCompiled);
1844
+ });
1845
+ }
1846
+ }
1847
+ }
1848
+ /**
1849
+ * Wraps an external web gl texture in a Babylon texture.
1850
+ * @param texture defines the external texture
1851
+ * @param hasMipMaps defines whether the external texture has mip maps (default: false)
1852
+ * @param samplingMode defines the sampling mode for the external texture (default: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE)
1853
+ * @param width defines the width for the external texture (default: 0)
1854
+ * @param height defines the height for the external texture (default: 0)
1855
+ * @returns the babylon internal texture
1856
+ */
1857
+ wrapWebGLTexture(texture, hasMipMaps = false, samplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE, width = 0, height = 0) {
1858
+ const hardwareTexture = new WebGLHardwareTexture(texture, this._gl);
1859
+ const internalTexture = new InternalTexture(this, 0 /* InternalTextureSource.Unknown */, true);
1860
+ internalTexture._hardwareTexture = hardwareTexture;
1861
+ internalTexture.baseWidth = width;
1862
+ internalTexture.baseHeight = height;
1863
+ internalTexture.width = width;
1864
+ internalTexture.height = height;
1865
+ internalTexture.isReady = true;
1866
+ internalTexture.useMipMaps = hasMipMaps;
1867
+ this.updateTextureSamplingMode(samplingMode, internalTexture);
1868
+ return internalTexture;
1869
+ }
1870
+ /**
1871
+ * @internal
1872
+ */
1873
+ _uploadImageToTexture(texture, image, faceIndex = 0, lod = 0) {
1874
+ const gl = this._gl;
1875
+ const textureType = this._getWebGLTextureType(texture.type);
1876
+ const format = this._getInternalFormat(texture.format);
1877
+ const internalFormat = this._getRGBABufferInternalSizedFormat(texture.type, format);
1878
+ const bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;
1879
+ this._bindTextureDirectly(bindTarget, texture, true);
1880
+ this._unpackFlipY(texture.invertY);
1881
+ let target = gl.TEXTURE_2D;
1882
+ if (texture.isCube) {
1883
+ target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;
1884
+ }
1885
+ gl.texImage2D(target, lod, internalFormat, format, textureType, image);
1886
+ this._bindTextureDirectly(bindTarget, null, true);
1887
+ }
1888
+ /**
1889
+ * Updates a depth texture Comparison Mode and Function.
1890
+ * If the comparison Function is equal to 0, the mode will be set to none.
1891
+ * Otherwise, this only works in webgl 2 and requires a shadow sampler in the shader.
1892
+ * @param texture The texture to set the comparison function for
1893
+ * @param comparisonFunction The comparison function to set, 0 if no comparison required
1894
+ */
1895
+ updateTextureComparisonFunction(texture, comparisonFunction) {
1896
+ if (this.webGLVersion === 1) {
1897
+ Logger.Error("WebGL 1 does not support texture comparison.");
1898
+ return;
1899
+ }
1900
+ const gl = this._gl;
1901
+ if (texture.isCube) {
1902
+ this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);
1903
+ if (comparisonFunction === 0) {
1904
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, Constants.LEQUAL);
1905
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.NONE);
1906
+ }
1907
+ else {
1908
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);
1909
+ gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);
1910
+ }
1911
+ this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
1912
+ }
1913
+ else {
1914
+ this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);
1915
+ if (comparisonFunction === 0) {
1916
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, Constants.LEQUAL);
1917
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.NONE);
1918
+ }
1919
+ else {
1920
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);
1921
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);
1922
+ }
1923
+ this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
1924
+ }
1925
+ texture._comparisonFunction = comparisonFunction;
1926
+ }
1927
+ /**
1928
+ * Creates a webGL buffer to use with instantiation
1929
+ * @param capacity defines the size of the buffer
1930
+ * @returns the webGL buffer
1931
+ */
1932
+ createInstancesBuffer(capacity) {
1933
+ const buffer = this._gl.createBuffer();
1934
+ if (!buffer) {
1935
+ throw new Error("Unable to create instance buffer");
1936
+ }
1937
+ const result = new WebGLDataBuffer(buffer);
1938
+ result.capacity = capacity;
1939
+ this.bindArrayBuffer(result);
1940
+ this._gl.bufferData(this._gl.ARRAY_BUFFER, capacity, this._gl.DYNAMIC_DRAW);
1941
+ result.references = 1;
1942
+ return result;
1943
+ }
1944
+ /**
1945
+ * Delete a webGL buffer used with instantiation
1946
+ * @param buffer defines the webGL buffer to delete
1947
+ */
1948
+ deleteInstancesBuffer(buffer) {
1949
+ this._gl.deleteBuffer(buffer);
1950
+ }
1951
+ _clientWaitAsync(sync, flags = 0, intervalms = 10) {
1952
+ const gl = this._gl;
1953
+ return new Promise((resolve, reject) => {
1954
+ _retryWithInterval(() => {
1955
+ const res = gl.clientWaitSync(sync, flags, 0);
1956
+ if (res == gl.WAIT_FAILED) {
1957
+ throw new Error("clientWaitSync failed");
1958
+ }
1959
+ if (res == gl.TIMEOUT_EXPIRED) {
1960
+ return false;
1961
+ }
1962
+ return true;
1963
+ }, resolve, reject, intervalms);
1964
+ });
1965
+ }
1966
+ /**
1967
+ * @internal
1968
+ */
1969
+ _readPixelsAsync(x, y, w, h, format, type, outputBuffer) {
1970
+ if (this._webGLVersion < 2) {
1971
+ throw new Error("_readPixelsAsync only work on WebGL2+");
1972
+ }
1973
+ const gl = this._gl;
1974
+ const buf = gl.createBuffer();
1975
+ gl.bindBuffer(gl.PIXEL_PACK_BUFFER, buf);
1976
+ gl.bufferData(gl.PIXEL_PACK_BUFFER, outputBuffer.byteLength, gl.STREAM_READ);
1977
+ gl.readPixels(x, y, w, h, format, type, 0);
1978
+ gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
1979
+ const sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
1980
+ if (!sync) {
1981
+ return null;
1982
+ }
1983
+ gl.flush();
1984
+ return this._clientWaitAsync(sync, 0, 10).then(() => {
1985
+ gl.deleteSync(sync);
1986
+ gl.bindBuffer(gl.PIXEL_PACK_BUFFER, buf);
1987
+ gl.getBufferSubData(gl.PIXEL_PACK_BUFFER, 0, outputBuffer);
1988
+ gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
1989
+ gl.deleteBuffer(buf);
1990
+ return outputBuffer;
1991
+ });
1992
+ }
1993
+ dispose() {
1994
+ this.hideLoadingUI();
1995
+ // Rescale PP
1996
+ if (this._rescalePostProcess) {
1997
+ this._rescalePostProcess.dispose();
1998
+ }
1999
+ _CommonDispose(this, this._renderingCanvas);
2000
+ super.dispose();
2001
+ }
2002
+ }
2003
+ // Const statics
2004
+ /** Defines that alpha blending is disabled */
2005
+ Engine.ALPHA_DISABLE = Constants.ALPHA_DISABLE;
2006
+ /** Defines that alpha blending to SRC ALPHA * SRC + DEST */
2007
+ Engine.ALPHA_ADD = Constants.ALPHA_ADD;
2008
+ /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */
2009
+ Engine.ALPHA_COMBINE = Constants.ALPHA_COMBINE;
2010
+ /** Defines that alpha blending to DEST - SRC * DEST */
2011
+ Engine.ALPHA_SUBTRACT = Constants.ALPHA_SUBTRACT;
2012
+ /** Defines that alpha blending to SRC * DEST */
2013
+ Engine.ALPHA_MULTIPLY = Constants.ALPHA_MULTIPLY;
2014
+ /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */
2015
+ Engine.ALPHA_MAXIMIZED = Constants.ALPHA_MAXIMIZED;
2016
+ /** Defines that alpha blending to SRC + DEST */
2017
+ Engine.ALPHA_ONEONE = Constants.ALPHA_ONEONE;
2018
+ /** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */
2019
+ Engine.ALPHA_PREMULTIPLIED = Constants.ALPHA_PREMULTIPLIED;
2020
+ /**
2021
+ * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST
2022
+ * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA
2023
+ */
2024
+ Engine.ALPHA_PREMULTIPLIED_PORTERDUFF = Constants.ALPHA_PREMULTIPLIED_PORTERDUFF;
2025
+ /** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */
2026
+ Engine.ALPHA_INTERPOLATE = Constants.ALPHA_INTERPOLATE;
2027
+ /**
2028
+ * Defines that alpha blending to SRC + (1 - SRC) * DEST
2029
+ * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA
2030
+ */
2031
+ Engine.ALPHA_SCREENMODE = Constants.ALPHA_SCREENMODE;
2032
+ /** Defines that the resource is not delayed*/
2033
+ Engine.DELAYLOADSTATE_NONE = Constants.DELAYLOADSTATE_NONE;
2034
+ /** Defines that the resource was successfully delay loaded */
2035
+ Engine.DELAYLOADSTATE_LOADED = Constants.DELAYLOADSTATE_LOADED;
2036
+ /** Defines that the resource is currently delay loading */
2037
+ Engine.DELAYLOADSTATE_LOADING = Constants.DELAYLOADSTATE_LOADING;
2038
+ /** Defines that the resource is delayed and has not started loading */
2039
+ Engine.DELAYLOADSTATE_NOTLOADED = Constants.DELAYLOADSTATE_NOTLOADED;
2040
+ // Depht or Stencil test Constants.
2041
+ /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */
2042
+ Engine.NEVER = Constants.NEVER;
2043
+ /** 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 */
2044
+ Engine.ALWAYS = Constants.ALWAYS;
2045
+ /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */
2046
+ Engine.LESS = Constants.LESS;
2047
+ /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */
2048
+ Engine.EQUAL = Constants.EQUAL;
2049
+ /** 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 */
2050
+ Engine.LEQUAL = Constants.LEQUAL;
2051
+ /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */
2052
+ Engine.GREATER = Constants.GREATER;
2053
+ /** 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 */
2054
+ Engine.GEQUAL = Constants.GEQUAL;
2055
+ /** 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 */
2056
+ Engine.NOTEQUAL = Constants.NOTEQUAL;
2057
+ // Stencil Actions Constants.
2058
+ /** Passed to stencilOperation to specify that stencil value must be kept */
2059
+ Engine.KEEP = Constants.KEEP;
2060
+ /** Passed to stencilOperation to specify that stencil value must be replaced */
2061
+ Engine.REPLACE = Constants.REPLACE;
2062
+ /** Passed to stencilOperation to specify that stencil value must be incremented */
2063
+ Engine.INCR = Constants.INCR;
2064
+ /** Passed to stencilOperation to specify that stencil value must be decremented */
2065
+ Engine.DECR = Constants.DECR;
2066
+ /** Passed to stencilOperation to specify that stencil value must be inverted */
2067
+ Engine.INVERT = Constants.INVERT;
2068
+ /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */
2069
+ Engine.INCR_WRAP = Constants.INCR_WRAP;
2070
+ /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */
2071
+ Engine.DECR_WRAP = Constants.DECR_WRAP;
2072
+ /** Texture is not repeating outside of 0..1 UVs */
2073
+ Engine.TEXTURE_CLAMP_ADDRESSMODE = Constants.TEXTURE_CLAMP_ADDRESSMODE;
2074
+ /** Texture is repeating outside of 0..1 UVs */
2075
+ Engine.TEXTURE_WRAP_ADDRESSMODE = Constants.TEXTURE_WRAP_ADDRESSMODE;
2076
+ /** Texture is repeating and mirrored */
2077
+ Engine.TEXTURE_MIRROR_ADDRESSMODE = Constants.TEXTURE_MIRROR_ADDRESSMODE;
2078
+ /** ALPHA */
2079
+ Engine.TEXTUREFORMAT_ALPHA = Constants.TEXTUREFORMAT_ALPHA;
2080
+ /** LUMINANCE */
2081
+ Engine.TEXTUREFORMAT_LUMINANCE = Constants.TEXTUREFORMAT_LUMINANCE;
2082
+ /** LUMINANCE_ALPHA */
2083
+ Engine.TEXTUREFORMAT_LUMINANCE_ALPHA = Constants.TEXTUREFORMAT_LUMINANCE_ALPHA;
2084
+ /** RGB */
2085
+ Engine.TEXTUREFORMAT_RGB = Constants.TEXTUREFORMAT_RGB;
2086
+ /** RGBA */
2087
+ Engine.TEXTUREFORMAT_RGBA = Constants.TEXTUREFORMAT_RGBA;
2088
+ /** RED */
2089
+ Engine.TEXTUREFORMAT_RED = Constants.TEXTUREFORMAT_RED;
2090
+ /** RED (2nd reference) */
2091
+ Engine.TEXTUREFORMAT_R = Constants.TEXTUREFORMAT_R;
2092
+ /** RED unsigned short normed to [0, 1] **/
2093
+ Engine.TEXTUREFORMAT_R16_UNORM = Constants.TEXTUREFORMAT_R16_UNORM;
2094
+ /** RG unsigned short normed to [0, 1] **/
2095
+ Engine.TEXTUREFORMAT_RG16_UNORM = Constants.TEXTUREFORMAT_RG16_UNORM;
2096
+ /** RGB unsigned short normed to [0, 1] **/
2097
+ Engine.TEXTUREFORMAT_RGB16_UNORM = Constants.TEXTUREFORMAT_RGB16_UNORM;
2098
+ /** RGBA unsigned short normed to [0, 1] **/
2099
+ Engine.TEXTUREFORMAT_RGBA16_UNORM = Constants.TEXTUREFORMAT_RGBA16_UNORM;
2100
+ /** RED signed short normed to [-1, 1] **/
2101
+ Engine.TEXTUREFORMAT_R16_SNORM = Constants.TEXTUREFORMAT_R16_SNORM;
2102
+ /** RG signed short normed to [-1, 1] **/
2103
+ Engine.TEXTUREFORMAT_RG16_SNORM = Constants.TEXTUREFORMAT_RG16_SNORM;
2104
+ /** RGB signed short normed to [-1, 1] **/
2105
+ Engine.TEXTUREFORMAT_RGB16_SNORM = Constants.TEXTUREFORMAT_RGB16_SNORM;
2106
+ /** RGBA signed short normed to [-1, 1] **/
2107
+ Engine.TEXTUREFORMAT_RGBA16_SNORM = Constants.TEXTUREFORMAT_RGBA16_SNORM;
2108
+ /** RG */
2109
+ Engine.TEXTUREFORMAT_RG = Constants.TEXTUREFORMAT_RG;
2110
+ /** RED_INTEGER */
2111
+ Engine.TEXTUREFORMAT_RED_INTEGER = Constants.TEXTUREFORMAT_RED_INTEGER;
2112
+ /** RED_INTEGER (2nd reference) */
2113
+ Engine.TEXTUREFORMAT_R_INTEGER = Constants.TEXTUREFORMAT_R_INTEGER;
2114
+ /** RG_INTEGER */
2115
+ Engine.TEXTUREFORMAT_RG_INTEGER = Constants.TEXTUREFORMAT_RG_INTEGER;
2116
+ /** RGB_INTEGER */
2117
+ Engine.TEXTUREFORMAT_RGB_INTEGER = Constants.TEXTUREFORMAT_RGB_INTEGER;
2118
+ /** RGBA_INTEGER */
2119
+ Engine.TEXTUREFORMAT_RGBA_INTEGER = Constants.TEXTUREFORMAT_RGBA_INTEGER;
2120
+ /** UNSIGNED_BYTE */
2121
+ Engine.TEXTURETYPE_UNSIGNED_BYTE = Constants.TEXTURETYPE_UNSIGNED_BYTE;
2122
+ /** @deprecated use more explicit TEXTURETYPE_UNSIGNED_BYTE instead. Use TEXTURETYPE_UNSIGNED_INTEGER for 32bits values.*/
2123
+ Engine.TEXTURETYPE_UNSIGNED_INT = Constants.TEXTURETYPE_UNSIGNED_INT;
2124
+ /** FLOAT */
2125
+ Engine.TEXTURETYPE_FLOAT = Constants.TEXTURETYPE_FLOAT;
2126
+ /** HALF_FLOAT */
2127
+ Engine.TEXTURETYPE_HALF_FLOAT = Constants.TEXTURETYPE_HALF_FLOAT;
2128
+ /** BYTE */
2129
+ Engine.TEXTURETYPE_BYTE = Constants.TEXTURETYPE_BYTE;
2130
+ /** SHORT */
2131
+ Engine.TEXTURETYPE_SHORT = Constants.TEXTURETYPE_SHORT;
2132
+ /** UNSIGNED_SHORT */
2133
+ Engine.TEXTURETYPE_UNSIGNED_SHORT = Constants.TEXTURETYPE_UNSIGNED_SHORT;
2134
+ /** INT */
2135
+ Engine.TEXTURETYPE_INT = Constants.TEXTURETYPE_INT;
2136
+ /** UNSIGNED_INT */
2137
+ Engine.TEXTURETYPE_UNSIGNED_INTEGER = Constants.TEXTURETYPE_UNSIGNED_INTEGER;
2138
+ /** UNSIGNED_SHORT_4_4_4_4 */
2139
+ Engine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = Constants.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4;
2140
+ /** UNSIGNED_SHORT_5_5_5_1 */
2141
+ Engine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = Constants.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1;
2142
+ /** UNSIGNED_SHORT_5_6_5 */
2143
+ Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = Constants.TEXTURETYPE_UNSIGNED_SHORT_5_6_5;
2144
+ /** UNSIGNED_INT_2_10_10_10_REV */
2145
+ Engine.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = Constants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV;
2146
+ /** UNSIGNED_INT_24_8 */
2147
+ Engine.TEXTURETYPE_UNSIGNED_INT_24_8 = Constants.TEXTURETYPE_UNSIGNED_INT_24_8;
2148
+ /** UNSIGNED_INT_10F_11F_11F_REV */
2149
+ Engine.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = Constants.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV;
2150
+ /** UNSIGNED_INT_5_9_9_9_REV */
2151
+ Engine.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = Constants.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV;
2152
+ /** FLOAT_32_UNSIGNED_INT_24_8_REV */
2153
+ Engine.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = Constants.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV;
2154
+ /** nearest is mag = nearest and min = nearest and mip = none */
2155
+ Engine.TEXTURE_NEAREST_SAMPLINGMODE = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
2156
+ /** Bilinear is mag = linear and min = linear and mip = nearest */
2157
+ Engine.TEXTURE_BILINEAR_SAMPLINGMODE = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;
2158
+ /** Trilinear is mag = linear and min = linear and mip = linear */
2159
+ Engine.TEXTURE_TRILINEAR_SAMPLINGMODE = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;
2160
+ /** nearest is mag = nearest and min = nearest and mip = linear */
2161
+ Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR = Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR;
2162
+ /** Bilinear is mag = linear and min = linear and mip = nearest */
2163
+ Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST = Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST;
2164
+ /** Trilinear is mag = linear and min = linear and mip = linear */
2165
+ Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR = Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR;
2166
+ /** mag = nearest and min = nearest and mip = nearest */
2167
+ Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST = Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST;
2168
+ /** mag = nearest and min = linear and mip = nearest */
2169
+ Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST = Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST;
2170
+ /** mag = nearest and min = linear and mip = linear */
2171
+ Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR = Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR;
2172
+ /** mag = nearest and min = linear and mip = none */
2173
+ Engine.TEXTURE_NEAREST_LINEAR = Constants.TEXTURE_NEAREST_LINEAR;
2174
+ /** mag = nearest and min = nearest and mip = none */
2175
+ Engine.TEXTURE_NEAREST_NEAREST = Constants.TEXTURE_NEAREST_NEAREST;
2176
+ /** mag = linear and min = nearest and mip = nearest */
2177
+ Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST = Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST;
2178
+ /** mag = linear and min = nearest and mip = linear */
2179
+ Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR = Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR;
2180
+ /** mag = linear and min = linear and mip = none */
2181
+ Engine.TEXTURE_LINEAR_LINEAR = Constants.TEXTURE_LINEAR_LINEAR;
2182
+ /** mag = linear and min = nearest and mip = none */
2183
+ Engine.TEXTURE_LINEAR_NEAREST = Constants.TEXTURE_LINEAR_NEAREST;
2184
+ /** Explicit coordinates mode */
2185
+ Engine.TEXTURE_EXPLICIT_MODE = Constants.TEXTURE_EXPLICIT_MODE;
2186
+ /** Spherical coordinates mode */
2187
+ Engine.TEXTURE_SPHERICAL_MODE = Constants.TEXTURE_SPHERICAL_MODE;
2188
+ /** Planar coordinates mode */
2189
+ Engine.TEXTURE_PLANAR_MODE = Constants.TEXTURE_PLANAR_MODE;
2190
+ /** Cubic coordinates mode */
2191
+ Engine.TEXTURE_CUBIC_MODE = Constants.TEXTURE_CUBIC_MODE;
2192
+ /** Projection coordinates mode */
2193
+ Engine.TEXTURE_PROJECTION_MODE = Constants.TEXTURE_PROJECTION_MODE;
2194
+ /** Skybox coordinates mode */
2195
+ Engine.TEXTURE_SKYBOX_MODE = Constants.TEXTURE_SKYBOX_MODE;
2196
+ /** Inverse Cubic coordinates mode */
2197
+ Engine.TEXTURE_INVCUBIC_MODE = Constants.TEXTURE_INVCUBIC_MODE;
2198
+ /** Equirectangular coordinates mode */
2199
+ Engine.TEXTURE_EQUIRECTANGULAR_MODE = Constants.TEXTURE_EQUIRECTANGULAR_MODE;
2200
+ /** Equirectangular Fixed coordinates mode */
2201
+ Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MODE;
2202
+ /** Equirectangular Fixed Mirrored coordinates mode */
2203
+ Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;
2204
+ // Texture rescaling mode
2205
+ /** Defines that texture rescaling will use a floor to find the closer power of 2 size */
2206
+ Engine.SCALEMODE_FLOOR = Constants.SCALEMODE_FLOOR;
2207
+ /** Defines that texture rescaling will look for the nearest power of 2 size */
2208
+ Engine.SCALEMODE_NEAREST = Constants.SCALEMODE_NEAREST;
2209
+ /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */
2210
+ Engine.SCALEMODE_CEILING = Constants.SCALEMODE_CEILING;
2211
+
2212
+ export { Engine };
2213
+ //# sourceMappingURL=engine-D9Sn-BC6.esm.js.map