@babylonjs/viewer 7.26.0-alpha → 7.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (554) hide show
  1. package/configuration/configuration.d.ts +107 -0
  2. package/configuration/configuration.js +16 -0
  3. package/configuration/configuration.js.map +1 -0
  4. package/configuration/configurationCompatibility.d.ts +8 -0
  5. package/configuration/configurationCompatibility.js +66 -0
  6. package/configuration/configurationCompatibility.js.map +1 -0
  7. package/configuration/configurationContainer.d.ts +10 -0
  8. package/configuration/configurationContainer.js +10 -0
  9. package/configuration/configurationContainer.js.map +1 -0
  10. package/configuration/globals.d.ts +6 -0
  11. package/configuration/globals.js +18 -0
  12. package/configuration/globals.js.map +1 -0
  13. package/configuration/index.d.ts +2 -0
  14. package/configuration/index.js +4 -0
  15. package/configuration/index.js.map +1 -0
  16. package/configuration/interfaces/cameraConfiguration.d.ts +31 -0
  17. package/configuration/interfaces/cameraConfiguration.js +2 -0
  18. package/configuration/interfaces/cameraConfiguration.js.map +1 -0
  19. package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -0
  20. package/configuration/interfaces/colorGradingConfiguration.js +2 -0
  21. package/configuration/interfaces/colorGradingConfiguration.js.map +1 -0
  22. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -0
  23. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +2 -0
  24. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +1 -0
  25. package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -0
  26. package/configuration/interfaces/environmentMapConfiguration.js +2 -0
  27. package/configuration/interfaces/environmentMapConfiguration.js.map +1 -0
  28. package/configuration/interfaces/groundConfiguration.d.ts +24 -0
  29. package/configuration/interfaces/groundConfiguration.js +2 -0
  30. package/configuration/interfaces/groundConfiguration.js.map +1 -0
  31. package/configuration/interfaces/imageProcessingConfiguration.d.ts +45 -0
  32. package/configuration/interfaces/imageProcessingConfiguration.js +2 -0
  33. package/configuration/interfaces/imageProcessingConfiguration.js.map +1 -0
  34. package/configuration/interfaces/index.d.ts +15 -0
  35. package/configuration/interfaces/index.js +16 -0
  36. package/configuration/interfaces/index.js.map +1 -0
  37. package/configuration/interfaces/lightConfiguration.d.ts +60 -0
  38. package/configuration/interfaces/lightConfiguration.js +2 -0
  39. package/configuration/interfaces/lightConfiguration.js.map +1 -0
  40. package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -0
  41. package/configuration/interfaces/modelAnimationConfiguration.js +2 -0
  42. package/configuration/interfaces/modelAnimationConfiguration.js.map +1 -0
  43. package/configuration/interfaces/modelConfiguration.d.ts +65 -0
  44. package/configuration/interfaces/modelConfiguration.js +2 -0
  45. package/configuration/interfaces/modelConfiguration.js.map +1 -0
  46. package/configuration/interfaces/observersConfiguration.d.ts +5 -0
  47. package/configuration/interfaces/observersConfiguration.js +2 -0
  48. package/configuration/interfaces/observersConfiguration.js.map +1 -0
  49. package/configuration/interfaces/sceneConfiguration.d.ts +48 -0
  50. package/configuration/interfaces/sceneConfiguration.js +2 -0
  51. package/configuration/interfaces/sceneConfiguration.js.map +1 -0
  52. package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -0
  53. package/configuration/interfaces/sceneOptimizerConfiguration.js +2 -0
  54. package/configuration/interfaces/sceneOptimizerConfiguration.js.map +1 -0
  55. package/configuration/interfaces/skyboxConfiguration.d.ts +21 -0
  56. package/configuration/interfaces/skyboxConfiguration.js +2 -0
  57. package/configuration/interfaces/skyboxConfiguration.js.map +1 -0
  58. package/configuration/interfaces/templateConfiguration.d.ts +67 -0
  59. package/configuration/interfaces/templateConfiguration.js +2 -0
  60. package/configuration/interfaces/templateConfiguration.js.map +1 -0
  61. package/configuration/interfaces/vrConfiguration.d.ts +16 -0
  62. package/configuration/interfaces/vrConfiguration.js +2 -0
  63. package/configuration/interfaces/vrConfiguration.js.map +1 -0
  64. package/configuration/loader.d.ts +4 -0
  65. package/configuration/loader.js +17 -0
  66. package/configuration/loader.js.map +1 -0
  67. package/configuration/mappers.d.ts +43 -0
  68. package/configuration/mappers.js +192 -0
  69. package/configuration/mappers.js.map +1 -0
  70. package/configuration/renderOnlyLoader.d.ts +33 -0
  71. package/configuration/renderOnlyLoader.js +162 -0
  72. package/configuration/renderOnlyLoader.js.map +1 -0
  73. package/configuration/types/default.d.ts +6 -0
  74. package/configuration/types/default.js +121 -0
  75. package/configuration/types/default.js.map +1 -0
  76. package/configuration/types/environmentMap.d.ts +5 -0
  77. package/configuration/types/environmentMap.js +14 -0
  78. package/configuration/types/environmentMap.js.map +1 -0
  79. package/configuration/types/extended.d.ts +6 -0
  80. package/configuration/types/extended.js +317 -0
  81. package/configuration/types/extended.js.map +1 -0
  82. package/configuration/types/index.d.ts +14 -0
  83. package/configuration/types/index.js +51 -0
  84. package/configuration/types/index.js.map +1 -0
  85. package/configuration/types/minimal.d.ts +6 -0
  86. package/configuration/types/minimal.js +43 -0
  87. package/configuration/types/minimal.js.map +1 -0
  88. package/configuration/types/renderOnlyDefault.d.ts +30 -0
  89. package/configuration/types/renderOnlyDefault.js +31 -0
  90. package/configuration/types/renderOnlyDefault.js.map +1 -0
  91. package/configuration/types/shadowLight.d.ts +9 -0
  92. package/configuration/types/shadowLight.js +64 -0
  93. package/configuration/types/shadowLight.js.map +1 -0
  94. package/helper/index.d.ts +29 -0
  95. package/helper/index.js +66 -0
  96. package/helper/index.js.map +1 -0
  97. package/index.d.ts +30 -0
  98. package/index.js +46 -0
  99. package/index.js.map +1 -0
  100. package/initializer.d.ts +11 -0
  101. package/initializer.js +35 -0
  102. package/initializer.js.map +1 -0
  103. package/interfaces.d.ts +5 -0
  104. package/interfaces.js +7 -0
  105. package/interfaces.js.map +1 -0
  106. package/labs/environmentSerializer.d.ts +126 -0
  107. package/labs/environmentSerializer.js +191 -0
  108. package/labs/environmentSerializer.js.map +1 -0
  109. package/labs/texture.d.ts +183 -0
  110. package/labs/texture.js +350 -0
  111. package/labs/texture.js.map +1 -0
  112. package/labs/viewerLabs.d.ts +51 -0
  113. package/labs/viewerLabs.js +134 -0
  114. package/labs/viewerLabs.js.map +1 -0
  115. package/loader/modelLoader.d.ts +56 -0
  116. package/loader/modelLoader.js +199 -0
  117. package/loader/modelLoader.js.map +1 -0
  118. package/loader/plugins/applyMaterialConfig.d.ts +12 -0
  119. package/loader/plugins/applyMaterialConfig.js +16 -0
  120. package/loader/plugins/applyMaterialConfig.js.map +1 -0
  121. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -0
  122. package/loader/plugins/extendedMaterialLoaderPlugin.js +16 -0
  123. package/loader/plugins/extendedMaterialLoaderPlugin.js.map +1 -0
  124. package/loader/plugins/index.d.ts +19 -0
  125. package/loader/plugins/index.js +44 -0
  126. package/loader/plugins/index.js.map +1 -0
  127. package/loader/plugins/loaderPlugin.d.ts +24 -0
  128. package/loader/plugins/loaderPlugin.js +2 -0
  129. package/loader/plugins/loaderPlugin.js.map +1 -0
  130. package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -0
  131. package/loader/plugins/msftLodLoaderPlugin.js +21 -0
  132. package/loader/plugins/msftLodLoaderPlugin.js.map +1 -0
  133. package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -0
  134. package/loader/plugins/telemetryLoaderPlugin.js +36 -0
  135. package/loader/plugins/telemetryLoaderPlugin.js.map +1 -0
  136. package/managers/observablesManager.d.ts +66 -0
  137. package/managers/observablesManager.js +35 -0
  138. package/managers/observablesManager.js.map +1 -0
  139. package/managers/sceneManager.d.ts +245 -0
  140. package/managers/sceneManager.js +1375 -0
  141. package/managers/sceneManager.js.map +1 -0
  142. package/managers/telemetryManager.d.ts +78 -0
  143. package/managers/telemetryManager.js +117 -0
  144. package/managers/telemetryManager.js.map +1 -0
  145. package/model/modelAnimation.d.ts +215 -0
  146. package/model/modelAnimation.js +237 -0
  147. package/model/modelAnimation.js.map +1 -0
  148. package/model/viewerModel.d.ts +233 -0
  149. package/model/viewerModel.js +673 -0
  150. package/model/viewerModel.js.map +1 -0
  151. package/optimizer/custom/extended.d.ts +13 -0
  152. package/optimizer/custom/extended.js +101 -0
  153. package/optimizer/custom/extended.js.map +1 -0
  154. package/optimizer/custom/index.d.ts +9 -0
  155. package/optimizer/custom/index.js +26 -0
  156. package/optimizer/custom/index.js.map +1 -0
  157. package/package.json +27 -17
  158. package/readme.md +21 -35
  159. package/renderOnlyIndex.d.ts +11 -0
  160. package/renderOnlyIndex.js +18 -0
  161. package/renderOnlyIndex.js.map +1 -0
  162. package/templating/eventManager.d.ts +35 -0
  163. package/templating/eventManager.js +66 -0
  164. package/templating/eventManager.js.map +1 -0
  165. package/templating/plugins/hdButtonPlugin.d.ts +9 -0
  166. package/templating/plugins/hdButtonPlugin.js +21 -0
  167. package/templating/plugins/hdButtonPlugin.js.map +1 -0
  168. package/templating/plugins/printButton.d.ts +9 -0
  169. package/templating/plugins/printButton.js +40 -0
  170. package/templating/plugins/printButton.js.map +1 -0
  171. package/templating/templateManager.d.ts +197 -0
  172. package/templating/templateManager.js +561 -0
  173. package/templating/templateManager.js.map +1 -0
  174. package/templating/viewerTemplatePlugin.d.ts +21 -0
  175. package/templating/viewerTemplatePlugin.js +69 -0
  176. package/templating/viewerTemplatePlugin.js.map +1 -0
  177. package/viewer/defaultViewer.d.ts +130 -0
  178. package/viewer/defaultViewer.js +675 -0
  179. package/viewer/defaultViewer.js.map +1 -0
  180. package/viewer/renderOnlyViewer.d.ts +9 -0
  181. package/viewer/renderOnlyViewer.js +46 -0
  182. package/viewer/renderOnlyViewer.js.map +1 -0
  183. package/viewer/viewer.d.ts +258 -0
  184. package/viewer/viewer.js +783 -0
  185. package/viewer/viewer.js.map +1 -0
  186. package/viewer/viewerManager.d.ts +58 -0
  187. package/viewer/viewerManager.js +91 -0
  188. package/viewer/viewerManager.js.map +1 -0
  189. package/viewer/viewerWithTemplate.d.ts +9 -0
  190. package/viewer/viewerWithTemplate.js +20 -0
  191. package/viewer/viewerWithTemplate.js.map +1 -0
  192. package/dist/babylon-viewer.esm.js +0 -2
  193. package/dist/babylon-viewer.esm.js.map +0 -1
  194. package/dist/babylon-viewer.esm.min.js +0 -2
  195. package/dist/babylon-viewer.esm.min.js.map +0 -1
  196. package/dist/chunks/EXT_lights_image_based-BAAAren3.esm.min.js +0 -2
  197. package/dist/chunks/EXT_lights_image_based-BAAAren3.esm.min.js.map +0 -1
  198. package/dist/chunks/EXT_lights_image_based-CLRxjLYR.esm.js +0 -170
  199. package/dist/chunks/EXT_lights_image_based-CLRxjLYR.esm.js.map +0 -1
  200. package/dist/chunks/EXT_mesh_gpu_instancing-g_z4hICR.esm.min.js +0 -2
  201. package/dist/chunks/EXT_mesh_gpu_instancing-g_z4hICR.esm.min.js.map +0 -1
  202. package/dist/chunks/EXT_mesh_gpu_instancing-xdiHrPE-.esm.js +0 -86
  203. package/dist/chunks/EXT_mesh_gpu_instancing-xdiHrPE-.esm.js.map +0 -1
  204. package/dist/chunks/EXT_meshopt_compression-DtR1iauf.esm.js +0 -134
  205. package/dist/chunks/EXT_meshopt_compression-DtR1iauf.esm.js.map +0 -1
  206. package/dist/chunks/EXT_meshopt_compression-SJRA4qRp.esm.min.js +0 -2
  207. package/dist/chunks/EXT_meshopt_compression-SJRA4qRp.esm.min.js.map +0 -1
  208. package/dist/chunks/EXT_texture_avif-DyYYGGQy.esm.js +0 -44
  209. package/dist/chunks/EXT_texture_avif-DyYYGGQy.esm.js.map +0 -1
  210. package/dist/chunks/EXT_texture_avif-Qcsk_kvk.esm.min.js +0 -2
  211. package/dist/chunks/EXT_texture_avif-Qcsk_kvk.esm.min.js.map +0 -1
  212. package/dist/chunks/EXT_texture_webp-CLgPX9Kq.esm.min.js +0 -2
  213. package/dist/chunks/EXT_texture_webp-CLgPX9Kq.esm.min.js.map +0 -1
  214. package/dist/chunks/EXT_texture_webp-X7MNkN3t.esm.js +0 -43
  215. package/dist/chunks/EXT_texture_webp-X7MNkN3t.esm.js.map +0 -1
  216. package/dist/chunks/ExtrasAsMetadata-DDzM1udc.esm.min.js +0 -2
  217. package/dist/chunks/ExtrasAsMetadata-DDzM1udc.esm.min.js.map +0 -1
  218. package/dist/chunks/ExtrasAsMetadata-_A4ue-yg.esm.js +0 -64
  219. package/dist/chunks/ExtrasAsMetadata-_A4ue-yg.esm.js.map +0 -1
  220. package/dist/chunks/KHR_animation_pointer-C_uSLVMY.esm.min.js +0 -2
  221. package/dist/chunks/KHR_animation_pointer-C_uSLVMY.esm.min.js.map +0 -1
  222. package/dist/chunks/KHR_animation_pointer-DOLmQrF0.esm.js +0 -343
  223. package/dist/chunks/KHR_animation_pointer-DOLmQrF0.esm.js.map +0 -1
  224. package/dist/chunks/KHR_draco_mesh_compression-Dc2dj10X.esm.js +0 -610
  225. package/dist/chunks/KHR_draco_mesh_compression-Dc2dj10X.esm.js.map +0 -1
  226. package/dist/chunks/KHR_draco_mesh_compression-Qjbd-cV8.esm.min.js +0 -2
  227. package/dist/chunks/KHR_draco_mesh_compression-Qjbd-cV8.esm.min.js.map +0 -1
  228. package/dist/chunks/KHR_interactivity-BMxQ78NS.esm.js +0 -4033
  229. package/dist/chunks/KHR_interactivity-BMxQ78NS.esm.js.map +0 -1
  230. package/dist/chunks/KHR_interactivity-Dyhotcuc.esm.min.js +0 -2
  231. package/dist/chunks/KHR_interactivity-Dyhotcuc.esm.min.js.map +0 -1
  232. package/dist/chunks/KHR_lights_punctual-BQxBGi0_.esm.js +0 -1253
  233. package/dist/chunks/KHR_lights_punctual-BQxBGi0_.esm.js.map +0 -1
  234. package/dist/chunks/KHR_lights_punctual-CP6yK7gB.esm.min.js +0 -2
  235. package/dist/chunks/KHR_lights_punctual-CP6yK7gB.esm.min.js.map +0 -1
  236. package/dist/chunks/KHR_materials_anisotropy-B-brojEG.esm.js +0 -64
  237. package/dist/chunks/KHR_materials_anisotropy-B-brojEG.esm.js.map +0 -1
  238. package/dist/chunks/KHR_materials_anisotropy-C_kRwfha.esm.min.js +0 -2
  239. package/dist/chunks/KHR_materials_anisotropy-C_kRwfha.esm.min.js.map +0 -1
  240. package/dist/chunks/KHR_materials_clearcoat-CRp8HOuT.esm.min.js +0 -2
  241. package/dist/chunks/KHR_materials_clearcoat-CRp8HOuT.esm.min.js.map +0 -1
  242. package/dist/chunks/KHR_materials_clearcoat-Dtwqzkls.esm.js +0 -96
  243. package/dist/chunks/KHR_materials_clearcoat-Dtwqzkls.esm.js.map +0 -1
  244. package/dist/chunks/KHR_materials_diffuse_transmission-BrvDWQjW.esm.js +0 -97
  245. package/dist/chunks/KHR_materials_diffuse_transmission-BrvDWQjW.esm.js.map +0 -1
  246. package/dist/chunks/KHR_materials_diffuse_transmission-CNCBiTRi.esm.min.js +0 -2
  247. package/dist/chunks/KHR_materials_diffuse_transmission-CNCBiTRi.esm.min.js.map +0 -1
  248. package/dist/chunks/KHR_materials_dispersion-Bx9AztVQ.esm.js +0 -62
  249. package/dist/chunks/KHR_materials_dispersion-Bx9AztVQ.esm.js.map +0 -1
  250. package/dist/chunks/KHR_materials_dispersion-C0wotXxO.esm.min.js +0 -2
  251. package/dist/chunks/KHR_materials_dispersion-C0wotXxO.esm.min.js.map +0 -1
  252. package/dist/chunks/KHR_materials_emissive_strength-CsJjVgTW.esm.js +0 -55
  253. package/dist/chunks/KHR_materials_emissive_strength-CsJjVgTW.esm.js.map +0 -1
  254. package/dist/chunks/KHR_materials_emissive_strength-DQk1VN_2.esm.min.js +0 -2
  255. package/dist/chunks/KHR_materials_emissive_strength-DQk1VN_2.esm.min.js.map +0 -1
  256. package/dist/chunks/KHR_materials_ior-B-Bz-ZTi.esm.js +0 -64
  257. package/dist/chunks/KHR_materials_ior-B-Bz-ZTi.esm.js.map +0 -1
  258. package/dist/chunks/KHR_materials_ior-DcRJZA_s.esm.min.js +0 -2
  259. package/dist/chunks/KHR_materials_ior-DcRJZA_s.esm.min.js.map +0 -1
  260. package/dist/chunks/KHR_materials_iridescence-B9mn3E_m.esm.js +0 -72
  261. package/dist/chunks/KHR_materials_iridescence-B9mn3E_m.esm.js.map +0 -1
  262. package/dist/chunks/KHR_materials_iridescence-BVq13lbk.esm.min.js +0 -2
  263. package/dist/chunks/KHR_materials_iridescence-BVq13lbk.esm.min.js.map +0 -1
  264. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-D81096Xs.esm.min.js +0 -2
  265. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-D81096Xs.esm.min.js.map +0 -1
  266. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DbXQeIqw.esm.js +0 -81
  267. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DbXQeIqw.esm.js.map +0 -1
  268. package/dist/chunks/KHR_materials_sheen-CJALPuj4.esm.js +0 -85
  269. package/dist/chunks/KHR_materials_sheen-CJALPuj4.esm.js.map +0 -1
  270. package/dist/chunks/KHR_materials_sheen-D6gJV14Q.esm.min.js +0 -2
  271. package/dist/chunks/KHR_materials_sheen-D6gJV14Q.esm.min.js.map +0 -1
  272. package/dist/chunks/KHR_materials_specular-8J6t7IWW.esm.js +0 -75
  273. package/dist/chunks/KHR_materials_specular-8J6t7IWW.esm.js.map +0 -1
  274. package/dist/chunks/KHR_materials_specular-CLkfKuYs.esm.min.js +0 -2
  275. package/dist/chunks/KHR_materials_specular-CLkfKuYs.esm.min.js.map +0 -1
  276. package/dist/chunks/KHR_materials_transmission-CtmncfNu.esm.js +0 -307
  277. package/dist/chunks/KHR_materials_transmission-CtmncfNu.esm.js.map +0 -1
  278. package/dist/chunks/KHR_materials_transmission-Ds1e4Rgi.esm.min.js +0 -2
  279. package/dist/chunks/KHR_materials_transmission-Ds1e4Rgi.esm.min.js.map +0 -1
  280. package/dist/chunks/KHR_materials_unlit-CjwtrKka.esm.min.js +0 -2
  281. package/dist/chunks/KHR_materials_unlit-CjwtrKka.esm.min.js.map +0 -1
  282. package/dist/chunks/KHR_materials_unlit-D7RRssK9.esm.js +0 -74
  283. package/dist/chunks/KHR_materials_unlit-D7RRssK9.esm.js.map +0 -1
  284. package/dist/chunks/KHR_materials_variants-B16YKuMe.esm.min.js +0 -2
  285. package/dist/chunks/KHR_materials_variants-B16YKuMe.esm.min.js.map +0 -1
  286. package/dist/chunks/KHR_materials_variants-C6mz0mzG.esm.js +0 -238
  287. package/dist/chunks/KHR_materials_variants-C6mz0mzG.esm.js.map +0 -1
  288. package/dist/chunks/KHR_materials_volume-CocxcaC_.esm.min.js +0 -2
  289. package/dist/chunks/KHR_materials_volume-CocxcaC_.esm.min.js.map +0 -1
  290. package/dist/chunks/KHR_materials_volume-kX43-sr-.esm.js +0 -87
  291. package/dist/chunks/KHR_materials_volume-kX43-sr-.esm.js.map +0 -1
  292. package/dist/chunks/KHR_mesh_quantization-B2Y3kC9D.esm.js +0 -26
  293. package/dist/chunks/KHR_mesh_quantization-B2Y3kC9D.esm.js.map +0 -1
  294. package/dist/chunks/KHR_mesh_quantization-BfMxe7Z-.esm.min.js +0 -2
  295. package/dist/chunks/KHR_mesh_quantization-BfMxe7Z-.esm.min.js.map +0 -1
  296. package/dist/chunks/KHR_texture_basisu-DS4eOc5v.esm.js +0 -43
  297. package/dist/chunks/KHR_texture_basisu-DS4eOc5v.esm.js.map +0 -1
  298. package/dist/chunks/KHR_texture_basisu-ghZqGH67.esm.min.js +0 -2
  299. package/dist/chunks/KHR_texture_basisu-ghZqGH67.esm.min.js.map +0 -1
  300. package/dist/chunks/KHR_texture_transform-6nYo8mzH.esm.min.js +0 -2
  301. package/dist/chunks/KHR_texture_transform-6nYo8mzH.esm.min.js.map +0 -1
  302. package/dist/chunks/KHR_texture_transform-B-qDuvbI.esm.js +0 -63
  303. package/dist/chunks/KHR_texture_transform-B-qDuvbI.esm.js.map +0 -1
  304. package/dist/chunks/KHR_xmp_json_ld-CKv9gfXs.esm.min.js +0 -2
  305. package/dist/chunks/KHR_xmp_json_ld-CKv9gfXs.esm.min.js.map +0 -1
  306. package/dist/chunks/KHR_xmp_json_ld-CXjOnFmU.esm.js +0 -51
  307. package/dist/chunks/KHR_xmp_json_ld-CXjOnFmU.esm.js.map +0 -1
  308. package/dist/chunks/MSFT_audio_emitter-1StuTv-Z.esm.js +0 -2236
  309. package/dist/chunks/MSFT_audio_emitter-1StuTv-Z.esm.js.map +0 -1
  310. package/dist/chunks/MSFT_audio_emitter-BfKy7LEd.esm.min.js +0 -2
  311. package/dist/chunks/MSFT_audio_emitter-BfKy7LEd.esm.min.js.map +0 -1
  312. package/dist/chunks/MSFT_lod-DA4UA4La.esm.js +0 -337
  313. package/dist/chunks/MSFT_lod-DA4UA4La.esm.js.map +0 -1
  314. package/dist/chunks/MSFT_lod-wcOn3D2V.esm.min.js +0 -2
  315. package/dist/chunks/MSFT_lod-wcOn3D2V.esm.min.js.map +0 -1
  316. package/dist/chunks/MSFT_minecraftMesh-afhS3NlZ.esm.js +0 -46
  317. package/dist/chunks/MSFT_minecraftMesh-afhS3NlZ.esm.js.map +0 -1
  318. package/dist/chunks/MSFT_minecraftMesh-x417idfJ.esm.min.js +0 -2
  319. package/dist/chunks/MSFT_minecraftMesh-x417idfJ.esm.min.js.map +0 -1
  320. package/dist/chunks/MSFT_sRGBFactors-BjLfK8v1.esm.min.js +0 -2
  321. package/dist/chunks/MSFT_sRGBFactors-BjLfK8v1.esm.min.js.map +0 -1
  322. package/dist/chunks/MSFT_sRGBFactors-fA6kZabo.esm.js +0 -47
  323. package/dist/chunks/MSFT_sRGBFactors-fA6kZabo.esm.js.map +0 -1
  324. package/dist/chunks/assetContainer-BWyT-iC8.esm.min.js +0 -2
  325. package/dist/chunks/assetContainer-BWyT-iC8.esm.min.js.map +0 -1
  326. package/dist/chunks/assetContainer-C9nOA325.esm.js +0 -1598
  327. package/dist/chunks/assetContainer-C9nOA325.esm.js.map +0 -1
  328. package/dist/chunks/audioEngine-Bi_JHe07.esm.js +0 -305
  329. package/dist/chunks/audioEngine-Bi_JHe07.esm.js.map +0 -1
  330. package/dist/chunks/audioEngine-DyaETd2M.esm.min.js +0 -2
  331. package/dist/chunks/audioEngine-DyaETd2M.esm.min.js.map +0 -1
  332. package/dist/chunks/bakedVertexAnimation-Bw1dcogG.esm.min.js +0 -2
  333. package/dist/chunks/bakedVertexAnimation-Bw1dcogG.esm.min.js.map +0 -1
  334. package/dist/chunks/bakedVertexAnimation-D2t3QFFy.esm.js +0 -119
  335. package/dist/chunks/bakedVertexAnimation-D2t3QFFy.esm.js.map +0 -1
  336. package/dist/chunks/basisTextureLoader-DEikcMs0.esm.js +0 -600
  337. package/dist/chunks/basisTextureLoader-DEikcMs0.esm.js.map +0 -1
  338. package/dist/chunks/basisTextureLoader-DnU1aFLP.esm.min.js +0 -2
  339. package/dist/chunks/basisTextureLoader-DnU1aFLP.esm.min.js.map +0 -1
  340. package/dist/chunks/ddsTextureLoader-DBWTHVjj.esm.min.js +0 -2
  341. package/dist/chunks/ddsTextureLoader-DBWTHVjj.esm.min.js.map +0 -1
  342. package/dist/chunks/ddsTextureLoader-ilOloJ4p.esm.js +0 -87
  343. package/dist/chunks/ddsTextureLoader-ilOloJ4p.esm.js.map +0 -1
  344. package/dist/chunks/decalFragment-CMHxc7Hr.esm.min.js +0 -2
  345. package/dist/chunks/decalFragment-CMHxc7Hr.esm.min.js.map +0 -1
  346. package/dist/chunks/decalFragment-CzgxOzQf.esm.js +0 -18
  347. package/dist/chunks/decalFragment-CzgxOzQf.esm.js.map +0 -1
  348. package/dist/chunks/default.fragment-BOotE87x.esm.min.js +0 -2
  349. package/dist/chunks/default.fragment-BOotE87x.esm.min.js.map +0 -1
  350. package/dist/chunks/default.fragment-C8I2FMK1.esm.js +0 -515
  351. package/dist/chunks/default.fragment-C8I2FMK1.esm.js.map +0 -1
  352. package/dist/chunks/default.fragment-CMyZ0Um2.esm.js +0 -449
  353. package/dist/chunks/default.fragment-CMyZ0Um2.esm.js.map +0 -1
  354. package/dist/chunks/default.fragment-dyXo8ZoT.esm.min.js +0 -2
  355. package/dist/chunks/default.fragment-dyXo8ZoT.esm.min.js.map +0 -1
  356. package/dist/chunks/default.vertex-BgameJri.esm.js +0 -199
  357. package/dist/chunks/default.vertex-BgameJri.esm.js.map +0 -1
  358. package/dist/chunks/default.vertex-CI-1zFCv.esm.min.js +0 -2
  359. package/dist/chunks/default.vertex-CI-1zFCv.esm.min.js.map +0 -1
  360. package/dist/chunks/default.vertex-CtvM7XrD.esm.js +0 -180
  361. package/dist/chunks/default.vertex-CtvM7XrD.esm.js.map +0 -1
  362. package/dist/chunks/default.vertex-DVEypQOv.esm.min.js +0 -2
  363. package/dist/chunks/default.vertex-DVEypQOv.esm.min.js.map +0 -1
  364. package/dist/chunks/defaultUboDeclaration-2dituFIw.esm.js +0 -15
  365. package/dist/chunks/defaultUboDeclaration-2dituFIw.esm.js.map +0 -1
  366. package/dist/chunks/defaultUboDeclaration-BCFc39NJ.esm.js +0 -13
  367. package/dist/chunks/defaultUboDeclaration-BCFc39NJ.esm.js.map +0 -1
  368. package/dist/chunks/defaultUboDeclaration-Be_Tm0i8.esm.min.js +0 -2
  369. package/dist/chunks/defaultUboDeclaration-Be_Tm0i8.esm.min.js.map +0 -1
  370. package/dist/chunks/defaultUboDeclaration-CjpL7xej.esm.min.js +0 -2
  371. package/dist/chunks/defaultUboDeclaration-CjpL7xej.esm.min.js.map +0 -1
  372. package/dist/chunks/engine-2EdX14bK.esm.js +0 -1970
  373. package/dist/chunks/engine-2EdX14bK.esm.js.map +0 -1
  374. package/dist/chunks/engine-CTtwkexh.esm.min.js +0 -2
  375. package/dist/chunks/engine-CTtwkexh.esm.min.js.map +0 -1
  376. package/dist/chunks/engine.common-BrXEBOzm.esm.js +0 -1213
  377. package/dist/chunks/engine.common-BrXEBOzm.esm.js.map +0 -1
  378. package/dist/chunks/engine.common-Dn_GE8cx.esm.min.js +0 -2
  379. package/dist/chunks/engine.common-Dn_GE8cx.esm.min.js.map +0 -1
  380. package/dist/chunks/envTextureLoader-9mljxKnB.esm.min.js +0 -2
  381. package/dist/chunks/envTextureLoader-9mljxKnB.esm.min.js.map +0 -1
  382. package/dist/chunks/envTextureLoader-cuBGdyEX.esm.js +0 -63
  383. package/dist/chunks/envTextureLoader-cuBGdyEX.esm.js.map +0 -1
  384. package/dist/chunks/environmentTextureTools-2JiPh6sF.esm.min.js +0 -2
  385. package/dist/chunks/environmentTextureTools-2JiPh6sF.esm.min.js.map +0 -1
  386. package/dist/chunks/environmentTextureTools-CaOOVUg4.esm.js +0 -381
  387. package/dist/chunks/environmentTextureTools-CaOOVUg4.esm.js.map +0 -1
  388. package/dist/chunks/exrTextureLoader-C2yRfZW0.esm.min.js +0 -2
  389. package/dist/chunks/exrTextureLoader-C2yRfZW0.esm.min.js.map +0 -1
  390. package/dist/chunks/exrTextureLoader-DPvYdRIY.esm.js +0 -1682
  391. package/dist/chunks/exrTextureLoader-DPvYdRIY.esm.js.map +0 -1
  392. package/dist/chunks/fogFragment-CerDBxh8.esm.min.js +0 -2
  393. package/dist/chunks/fogFragment-CerDBxh8.esm.min.js.map +0 -1
  394. package/dist/chunks/fogFragment-SpVyZY46.esm.js +0 -102
  395. package/dist/chunks/fogFragment-SpVyZY46.esm.js.map +0 -1
  396. package/dist/chunks/fresnelFunction-Cfc0PCuM.esm.min.js +0 -2
  397. package/dist/chunks/fresnelFunction-Cfc0PCuM.esm.min.js.map +0 -1
  398. package/dist/chunks/fresnelFunction-DYc_QORg.esm.js +0 -12
  399. package/dist/chunks/fresnelFunction-DYc_QORg.esm.js.map +0 -1
  400. package/dist/chunks/glTFLoader-CX847JwZ.esm.min.js +0 -2
  401. package/dist/chunks/glTFLoader-CX847JwZ.esm.min.js.map +0 -1
  402. package/dist/chunks/glTFLoader-FnbdTR40.esm.js +0 -7552
  403. package/dist/chunks/glTFLoader-FnbdTR40.esm.js.map +0 -1
  404. package/dist/chunks/glTFLoaderAnimation-DLprnT2e.esm.js +0 -77
  405. package/dist/chunks/glTFLoaderAnimation-DLprnT2e.esm.js.map +0 -1
  406. package/dist/chunks/glTFLoaderAnimation-YVA5W-1q.esm.min.js +0 -2
  407. package/dist/chunks/glTFLoaderAnimation-YVA5W-1q.esm.min.js.map +0 -1
  408. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js +0 -2
  409. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js.map +0 -1
  410. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js +0 -67
  411. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js.map +0 -1
  412. package/dist/chunks/harmonicsFunctions-BglL8EAc.esm.min.js +0 -2
  413. package/dist/chunks/harmonicsFunctions-BglL8EAc.esm.min.js.map +0 -1
  414. package/dist/chunks/harmonicsFunctions-BjhkFrPF.esm.min.js +0 -2
  415. package/dist/chunks/harmonicsFunctions-BjhkFrPF.esm.min.js.map +0 -1
  416. package/dist/chunks/harmonicsFunctions-D0kGurRz.esm.js +0 -34
  417. package/dist/chunks/harmonicsFunctions-D0kGurRz.esm.js.map +0 -1
  418. package/dist/chunks/harmonicsFunctions-f0TDZMjd.esm.js +0 -35
  419. package/dist/chunks/harmonicsFunctions-f0TDZMjd.esm.js.map +0 -1
  420. package/dist/chunks/hdrTextureLoader-BYv589K1.esm.min.js +0 -2
  421. package/dist/chunks/hdrTextureLoader-BYv589K1.esm.min.js.map +0 -1
  422. package/dist/chunks/hdrTextureLoader-Cia6kLvR.esm.js +0 -252
  423. package/dist/chunks/hdrTextureLoader-Cia6kLvR.esm.js.map +0 -1
  424. package/dist/chunks/helperFunctions-B6L2NvuR.esm.min.js +0 -2
  425. package/dist/chunks/helperFunctions-B6L2NvuR.esm.min.js.map +0 -1
  426. package/dist/chunks/helperFunctions-CTmvPMOb.esm.js +0 -108
  427. package/dist/chunks/helperFunctions-CTmvPMOb.esm.js.map +0 -1
  428. package/dist/chunks/helperFunctions-Dx_bhcnf.esm.js +0 -80
  429. package/dist/chunks/helperFunctions-Dx_bhcnf.esm.js.map +0 -1
  430. package/dist/chunks/helperFunctions-lfyjwIAq.esm.min.js +0 -2
  431. package/dist/chunks/helperFunctions-lfyjwIAq.esm.min.js.map +0 -1
  432. package/dist/chunks/index-H9RbNFln.esm.js +0 -78669
  433. package/dist/chunks/index-H9RbNFln.esm.js.map +0 -1
  434. package/dist/chunks/index-NKQY07Ai.esm.min.js +0 -57
  435. package/dist/chunks/index-NKQY07Ai.esm.min.js.map +0 -1
  436. package/dist/chunks/ktxTextureLoader-C8P1HmKw.esm.min.js +0 -2
  437. package/dist/chunks/ktxTextureLoader-C8P1HmKw.esm.min.js.map +0 -1
  438. package/dist/chunks/ktxTextureLoader-CGZaZgF4.esm.js +0 -814
  439. package/dist/chunks/ktxTextureLoader-CGZaZgF4.esm.js.map +0 -1
  440. package/dist/chunks/logDepthDeclaration-BtAGVG3-.esm.min.js +0 -2
  441. package/dist/chunks/logDepthDeclaration-BtAGVG3-.esm.min.js.map +0 -1
  442. package/dist/chunks/logDepthDeclaration-BvAgEnZm.esm.min.js +0 -2
  443. package/dist/chunks/logDepthDeclaration-BvAgEnZm.esm.min.js.map +0 -1
  444. package/dist/chunks/logDepthDeclaration-DD208S_2.esm.js +0 -35
  445. package/dist/chunks/logDepthDeclaration-DD208S_2.esm.js.map +0 -1
  446. package/dist/chunks/logDepthDeclaration-T3brxHqo.esm.js +0 -20
  447. package/dist/chunks/logDepthDeclaration-T3brxHqo.esm.js.map +0 -1
  448. package/dist/chunks/logDepthVertex-0P4Fk3ej.esm.js +0 -77
  449. package/dist/chunks/logDepthVertex-0P4Fk3ej.esm.js.map +0 -1
  450. package/dist/chunks/logDepthVertex-Bo4jbfP3.esm.min.js +0 -2
  451. package/dist/chunks/logDepthVertex-Bo4jbfP3.esm.min.js.map +0 -1
  452. package/dist/chunks/logDepthVertex-DhlJdt6n.esm.min.js +0 -2
  453. package/dist/chunks/logDepthVertex-DhlJdt6n.esm.min.js.map +0 -1
  454. package/dist/chunks/logDepthVertex-bCxA8jHH.esm.js +0 -488
  455. package/dist/chunks/logDepthVertex-bCxA8jHH.esm.js.map +0 -1
  456. package/dist/chunks/mainUVVaryingDeclaration-CkGDoJLo.esm.js +0 -11
  457. package/dist/chunks/mainUVVaryingDeclaration-CkGDoJLo.esm.js.map +0 -1
  458. package/dist/chunks/mainUVVaryingDeclaration-DAb0JqU5.esm.min.js +0 -2
  459. package/dist/chunks/mainUVVaryingDeclaration-DAb0JqU5.esm.min.js.map +0 -1
  460. package/dist/chunks/meshUboDeclaration-BEpwR1Md.esm.min.js +0 -2
  461. package/dist/chunks/meshUboDeclaration-BEpwR1Md.esm.min.js.map +0 -1
  462. package/dist/chunks/meshUboDeclaration-wwoFcdXg.esm.js +0 -24
  463. package/dist/chunks/meshUboDeclaration-wwoFcdXg.esm.js.map +0 -1
  464. package/dist/chunks/objFileLoader-9VII_MH6.esm.min.js +0 -2
  465. package/dist/chunks/objFileLoader-9VII_MH6.esm.min.js.map +0 -1
  466. package/dist/chunks/objFileLoader-sy2KqRzD.esm.js +0 -1280
  467. package/dist/chunks/objFileLoader-sy2KqRzD.esm.js.map +0 -1
  468. package/dist/chunks/oitFragment-BKhyL_Ma.esm.min.js +0 -2
  469. package/dist/chunks/oitFragment-BKhyL_Ma.esm.min.js.map +0 -1
  470. package/dist/chunks/oitFragment-BqtunGU7.esm.min.js +0 -2
  471. package/dist/chunks/oitFragment-BqtunGU7.esm.min.js.map +0 -1
  472. package/dist/chunks/oitFragment-CGo4SX0U.esm.js +0 -1150
  473. package/dist/chunks/oitFragment-CGo4SX0U.esm.js.map +0 -1
  474. package/dist/chunks/oitFragment-akBosjiV.esm.js +0 -1210
  475. package/dist/chunks/oitFragment-akBosjiV.esm.js.map +0 -1
  476. package/dist/chunks/pass.fragment-CMK3Cirh.esm.js +0 -15
  477. package/dist/chunks/pass.fragment-CMK3Cirh.esm.js.map +0 -1
  478. package/dist/chunks/pass.fragment-NgBFYMH2.esm.min.js +0 -2
  479. package/dist/chunks/pass.fragment-NgBFYMH2.esm.min.js.map +0 -1
  480. package/dist/chunks/pbr.fragment-BxeirEXF.esm.min.js +0 -2
  481. package/dist/chunks/pbr.fragment-BxeirEXF.esm.min.js.map +0 -1
  482. package/dist/chunks/pbr.fragment-C9P-kot0.esm.min.js +0 -2
  483. package/dist/chunks/pbr.fragment-C9P-kot0.esm.min.js.map +0 -1
  484. package/dist/chunks/pbr.fragment-CmciAvUf.esm.js +0 -3219
  485. package/dist/chunks/pbr.fragment-CmciAvUf.esm.js.map +0 -1
  486. package/dist/chunks/pbr.fragment-DptkOGvm.esm.js +0 -3165
  487. package/dist/chunks/pbr.fragment-DptkOGvm.esm.js.map +0 -1
  488. package/dist/chunks/pbr.vertex-BGYxmiED.esm.min.js +0 -2
  489. package/dist/chunks/pbr.vertex-BGYxmiED.esm.min.js.map +0 -1
  490. package/dist/chunks/pbr.vertex-BKYxq0u4.esm.min.js +0 -2
  491. package/dist/chunks/pbr.vertex-BKYxq0u4.esm.min.js.map +0 -1
  492. package/dist/chunks/pbr.vertex-BW_cBtTy.esm.js +0 -210
  493. package/dist/chunks/pbr.vertex-BW_cBtTy.esm.js.map +0 -1
  494. package/dist/chunks/pbr.vertex-D5_YtZ3F.esm.js +0 -335
  495. package/dist/chunks/pbr.vertex-D5_YtZ3F.esm.js.map +0 -1
  496. package/dist/chunks/postprocess.vertex-BIHPwYtc.esm.min.js +0 -2
  497. package/dist/chunks/postprocess.vertex-BIHPwYtc.esm.min.js.map +0 -1
  498. package/dist/chunks/postprocess.vertex-DQbuHlSL.esm.js +0 -20
  499. package/dist/chunks/postprocess.vertex-DQbuHlSL.esm.js.map +0 -1
  500. package/dist/chunks/rawTexture-BBFBylYg.esm.js +0 -191
  501. package/dist/chunks/rawTexture-BBFBylYg.esm.js.map +0 -1
  502. package/dist/chunks/rawTexture-DtTw1SfK.esm.min.js +0 -2
  503. package/dist/chunks/rawTexture-DtTw1SfK.esm.min.js.map +0 -1
  504. package/dist/chunks/rgbdDecode.fragment-B8vtIeR2.esm.min.js +0 -2
  505. package/dist/chunks/rgbdDecode.fragment-B8vtIeR2.esm.min.js.map +0 -1
  506. package/dist/chunks/rgbdDecode.fragment-BAERNvTB.esm.js +0 -17
  507. package/dist/chunks/rgbdDecode.fragment-BAERNvTB.esm.js.map +0 -1
  508. package/dist/chunks/rgbdDecode.fragment-CUCNLBNb.esm.js +0 -17
  509. package/dist/chunks/rgbdDecode.fragment-CUCNLBNb.esm.js.map +0 -1
  510. package/dist/chunks/rgbdDecode.fragment-DE974oq3.esm.min.js +0 -2
  511. package/dist/chunks/rgbdDecode.fragment-DE974oq3.esm.min.js.map +0 -1
  512. package/dist/chunks/rgbdEncode.fragment-12Ga6DPf.esm.min.js +0 -2
  513. package/dist/chunks/rgbdEncode.fragment-12Ga6DPf.esm.min.js.map +0 -1
  514. package/dist/chunks/rgbdEncode.fragment-C_8FK6je.esm.min.js +0 -2
  515. package/dist/chunks/rgbdEncode.fragment-C_8FK6je.esm.min.js.map +0 -1
  516. package/dist/chunks/rgbdEncode.fragment-DLGZ9Ew-.esm.js +0 -17
  517. package/dist/chunks/rgbdEncode.fragment-DLGZ9Ew-.esm.js.map +0 -1
  518. package/dist/chunks/rgbdEncode.fragment-vtqqWXMx.esm.js +0 -17
  519. package/dist/chunks/rgbdEncode.fragment-vtqqWXMx.esm.js.map +0 -1
  520. package/dist/chunks/splatFileLoader-BvGLmrOU.esm.js +0 -3179
  521. package/dist/chunks/splatFileLoader-BvGLmrOU.esm.js.map +0 -1
  522. package/dist/chunks/splatFileLoader-Du-_lAWj.esm.min.js +0 -2
  523. package/dist/chunks/splatFileLoader-Du-_lAWj.esm.min.js.map +0 -1
  524. package/dist/chunks/standardMaterial-CTqOZPWo.esm.min.js +0 -2
  525. package/dist/chunks/standardMaterial-CTqOZPWo.esm.min.js.map +0 -1
  526. package/dist/chunks/standardMaterial-Nso7Fcun.esm.js +0 -1809
  527. package/dist/chunks/standardMaterial-Nso7Fcun.esm.js.map +0 -1
  528. package/dist/chunks/stlFileLoader-C0UsVNIc.esm.js +0 -237
  529. package/dist/chunks/stlFileLoader-C0UsVNIc.esm.js.map +0 -1
  530. package/dist/chunks/stlFileLoader-Du9QZoAm.esm.min.js +0 -2
  531. package/dist/chunks/stlFileLoader-Du9QZoAm.esm.min.js.map +0 -1
  532. package/dist/chunks/tgaTextureLoader-BNBS-X4Q.esm.min.js +0 -2
  533. package/dist/chunks/tgaTextureLoader-BNBS-X4Q.esm.min.js.map +0 -1
  534. package/dist/chunks/tgaTextureLoader-D46YCUQ_.esm.js +0 -349
  535. package/dist/chunks/tgaTextureLoader-D46YCUQ_.esm.js.map +0 -1
  536. package/dist/chunks/thinInstanceMesh-DCh8MOoj.esm.min.js +0 -2
  537. package/dist/chunks/thinInstanceMesh-DCh8MOoj.esm.min.js.map +0 -1
  538. package/dist/chunks/thinInstanceMesh-DzFmk7SW.esm.js +0 -314
  539. package/dist/chunks/thinInstanceMesh-DzFmk7SW.esm.js.map +0 -1
  540. package/dist/chunks/vertexColorMixing-Bt0lYFpZ.esm.min.js +0 -2
  541. package/dist/chunks/vertexColorMixing-Bt0lYFpZ.esm.min.js.map +0 -1
  542. package/dist/chunks/vertexColorMixing-Ds7u6owR.esm.js +0 -528
  543. package/dist/chunks/vertexColorMixing-Ds7u6owR.esm.js.map +0 -1
  544. package/dist/chunks/webgpuEngine--HWPU_ZX.esm.js +0 -11169
  545. package/dist/chunks/webgpuEngine--HWPU_ZX.esm.js.map +0 -1
  546. package/dist/chunks/webgpuEngine-BwnxF0Zq.esm.min.js +0 -2
  547. package/dist/chunks/webgpuEngine-BwnxF0Zq.esm.min.js.map +0 -1
  548. package/dist/chunks/workerPool-BUOov2K1.esm.js +0 -122
  549. package/dist/chunks/workerPool-BUOov2K1.esm.js.map +0 -1
  550. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js +0 -2
  551. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js.map +0 -1
  552. package/lib/index.d.ts +0 -281
  553. package/lib/index.js +0 -965
  554. package/lib/index.js.map +0 -1
@@ -1,1970 +0,0 @@
1
- import { T as ThinEngine, C as Constants, I as InternalTexture, L as Logger, a as IsExponentOfTwo, G as GetExponentOfTwo, A as AbstractEngine, E as EngineStore, P as PerfCounter, W as WebGLHardwareTexture, b as WebGLDataBuffer } from './index-H9RbNFln.esm.js';
2
- 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-BrXEBOzm.esm.js';
3
- import './audioEngine-Bi_JHe07.esm.js';
4
-
5
- ThinEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange = false) {
6
- if (this._alphaMode === mode) {
7
- if (!noDepthWriteChange) {
8
- // 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)
9
- const depthMask = mode === Constants.ALPHA_DISABLE;
10
- if (this.depthCullingState.depthMask !== depthMask) {
11
- this.depthCullingState.depthMask = depthMask;
12
- }
13
- }
14
- return;
15
- }
16
- switch (mode) {
17
- case Constants.ALPHA_DISABLE:
18
- this._alphaState.alphaBlend = false;
19
- break;
20
- case Constants.ALPHA_PREMULTIPLIED:
21
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);
22
- this._alphaState.alphaBlend = true;
23
- break;
24
- case Constants.ALPHA_PREMULTIPLIED_PORTERDUFF:
25
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
26
- this._alphaState.alphaBlend = true;
27
- break;
28
- case Constants.ALPHA_COMBINE:
29
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);
30
- this._alphaState.alphaBlend = true;
31
- break;
32
- case Constants.ALPHA_ONEONE:
33
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE);
34
- this._alphaState.alphaBlend = true;
35
- break;
36
- case Constants.ALPHA_ADD:
37
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE);
38
- this._alphaState.alphaBlend = true;
39
- break;
40
- case Constants.ALPHA_SUBTRACT:
41
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);
42
- this._alphaState.alphaBlend = true;
43
- break;
44
- case Constants.ALPHA_MULTIPLY:
45
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE);
46
- this._alphaState.alphaBlend = true;
47
- break;
48
- case Constants.ALPHA_MAXIMIZED:
49
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);
50
- this._alphaState.alphaBlend = true;
51
- break;
52
- case Constants.ALPHA_INTERPOLATE:
53
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR, this._gl.ONE_MINUS_CONSTANT_COLOR, this._gl.CONSTANT_ALPHA, this._gl.ONE_MINUS_CONSTANT_ALPHA);
54
- this._alphaState.alphaBlend = true;
55
- break;
56
- case Constants.ALPHA_SCREENMODE:
57
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
58
- this._alphaState.alphaBlend = true;
59
- break;
60
- case Constants.ALPHA_ONEONE_ONEONE:
61
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ONE);
62
- this._alphaState.alphaBlend = true;
63
- break;
64
- case Constants.ALPHA_ALPHATOCOLOR:
65
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ZERO);
66
- this._alphaState.alphaBlend = true;
67
- break;
68
- case Constants.ALPHA_REVERSEONEMINUS:
69
- 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);
70
- this._alphaState.alphaBlend = true;
71
- break;
72
- case Constants.ALPHA_SRC_DSTONEMINUSSRCALPHA:
73
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
74
- this._alphaState.alphaBlend = true;
75
- break;
76
- case Constants.ALPHA_ONEONE_ONEZERO:
77
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ZERO);
78
- this._alphaState.alphaBlend = true;
79
- break;
80
- case Constants.ALPHA_EXCLUSION:
81
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ZERO, this._gl.ONE);
82
- this._alphaState.alphaBlend = true;
83
- break;
84
- case Constants.ALPHA_LAYER_ACCUMULATE:
85
- // Same as ALPHA_COMBINE but accumulates (1 - alpha) values in the alpha channel for a later readout in order independant transparency
86
- this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
87
- this._alphaState.alphaBlend = true;
88
- break;
89
- }
90
- if (!noDepthWriteChange) {
91
- this.depthCullingState.depthMask = mode === Constants.ALPHA_DISABLE;
92
- }
93
- this._alphaMode = mode;
94
- };
95
-
96
- ThinEngine.prototype.updateRawTexture = function (texture, data, format, invertY, compression = null, type = Constants.TEXTURETYPE_UNSIGNED_INT, useSRGBBuffer = false) {
97
- if (!texture) {
98
- return;
99
- }
100
- // Babylon's internalSizedFomat but gl's texImage2D internalFormat
101
- const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type, format, useSRGBBuffer);
102
- // Babylon's internalFormat but gl's texImage2D format
103
- const internalFormat = this._getInternalFormat(format);
104
- const textureType = this._getWebGLTextureType(type);
105
- this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);
106
- this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);
107
- if (!this._doNotHandleContextLost) {
108
- texture._bufferView = data;
109
- texture.format = format;
110
- texture.type = type;
111
- texture.invertY = invertY;
112
- texture._compression = compression;
113
- }
114
- if (texture.width % 4 !== 0) {
115
- this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);
116
- }
117
- if (compression && data) {
118
- this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[compression], texture.width, texture.height, 0, data);
119
- }
120
- else {
121
- this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);
122
- }
123
- if (texture.generateMipMaps) {
124
- this._gl.generateMipmap(this._gl.TEXTURE_2D);
125
- }
126
- this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
127
- // this.resetTextureCache();
128
- texture.isReady = true;
129
- };
130
- ThinEngine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression = null, type = Constants.TEXTURETYPE_UNSIGNED_INT,
131
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
132
- creationFlags = 0, useSRGBBuffer = false) {
133
- const texture = new InternalTexture(this, 3 /* InternalTextureSource.Raw */);
134
- texture.baseWidth = width;
135
- texture.baseHeight = height;
136
- texture.width = width;
137
- texture.height = height;
138
- texture.format = format;
139
- texture.generateMipMaps = generateMipMaps;
140
- texture.samplingMode = samplingMode;
141
- texture.invertY = invertY;
142
- texture._compression = compression;
143
- texture.type = type;
144
- texture._useSRGBBuffer = this._getUseSRGBBuffer(useSRGBBuffer, !generateMipMaps);
145
- if (!this._doNotHandleContextLost) {
146
- texture._bufferView = data;
147
- }
148
- this.updateRawTexture(texture, data, format, invertY, compression, type, texture._useSRGBBuffer);
149
- this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);
150
- // Filters
151
- const filters = this._getSamplingParameters(samplingMode, generateMipMaps);
152
- this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag);
153
- this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);
154
- if (generateMipMaps) {
155
- this._gl.generateMipmap(this._gl.TEXTURE_2D);
156
- }
157
- this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
158
- this._internalTexturesCache.push(texture);
159
- return texture;
160
- };
161
- ThinEngine.prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression = null) {
162
- const gl = this._gl;
163
- const texture = new InternalTexture(this, 8 /* InternalTextureSource.CubeRaw */);
164
- texture.isCube = true;
165
- texture.format = format;
166
- texture.type = type;
167
- if (!this._doNotHandleContextLost) {
168
- texture._bufferViewArray = data;
169
- }
170
- const textureType = this._getWebGLTextureType(type);
171
- let internalFormat = this._getInternalFormat(format);
172
- if (internalFormat === gl.RGB) {
173
- internalFormat = gl.RGBA;
174
- }
175
- // Mipmap generation needs a sized internal format that is both color-renderable and texture-filterable
176
- if (textureType === gl.FLOAT && !this._caps.textureFloatLinearFiltering) {
177
- generateMipMaps = false;
178
- samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
179
- Logger.Warn("Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.");
180
- }
181
- else if (textureType === this._gl.HALF_FLOAT_OES && !this._caps.textureHalfFloatLinearFiltering) {
182
- generateMipMaps = false;
183
- samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
184
- Logger.Warn("Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.");
185
- }
186
- else if (textureType === gl.FLOAT && !this._caps.textureFloatRender) {
187
- generateMipMaps = false;
188
- Logger.Warn("Render to float textures is not supported. Mipmap generation forced to false.");
189
- }
190
- else if (textureType === gl.HALF_FLOAT && !this._caps.colorBufferFloat) {
191
- generateMipMaps = false;
192
- Logger.Warn("Render to half float textures is not supported. Mipmap generation forced to false.");
193
- }
194
- const width = size;
195
- const height = width;
196
- texture.width = width;
197
- texture.height = height;
198
- texture.invertY = invertY;
199
- texture._compression = compression;
200
- // Double check on POT to generate Mips.
201
- const isPot = !this.needPOTTextures || (IsExponentOfTwo(texture.width) && IsExponentOfTwo(texture.height));
202
- if (!isPot) {
203
- generateMipMaps = false;
204
- }
205
- // Upload data if needed. The texture won't be ready until then.
206
- if (data) {
207
- this.updateRawCubeTexture(texture, data, format, type, invertY, compression);
208
- }
209
- else {
210
- const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);
211
- const level = 0;
212
- this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
213
- for (let faceIndex = 0; faceIndex < 6; faceIndex++) {
214
- if (compression) {
215
- gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, this.getCaps().s3tc[compression], texture.width, texture.height, 0, undefined);
216
- }
217
- else {
218
- gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, null);
219
- }
220
- }
221
- this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
222
- }
223
- this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);
224
- // Filters
225
- if (data && generateMipMaps) {
226
- this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);
227
- }
228
- const filters = this._getSamplingParameters(samplingMode, generateMipMaps);
229
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);
230
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);
231
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
232
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
233
- this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
234
- texture.generateMipMaps = generateMipMaps;
235
- texture.samplingMode = samplingMode;
236
- texture.isReady = true;
237
- return texture;
238
- };
239
- ThinEngine.prototype.updateRawCubeTexture = function (texture, data, format, type, invertY, compression = null, level = 0) {
240
- texture._bufferViewArray = data;
241
- texture.format = format;
242
- texture.type = type;
243
- texture.invertY = invertY;
244
- texture._compression = compression;
245
- const gl = this._gl;
246
- const textureType = this._getWebGLTextureType(type);
247
- let internalFormat = this._getInternalFormat(format);
248
- const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);
249
- let needConversion = false;
250
- if (internalFormat === gl.RGB) {
251
- internalFormat = gl.RGBA;
252
- needConversion = true;
253
- }
254
- this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
255
- this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);
256
- if (texture.width % 4 !== 0) {
257
- gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);
258
- }
259
- // Data are known to be in +X +Y +Z -X -Y -Z
260
- for (let faceIndex = 0; faceIndex < 6; faceIndex++) {
261
- let faceData = data[faceIndex];
262
- if (compression) {
263
- gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, this.getCaps().s3tc[compression], texture.width, texture.height, 0, faceData);
264
- }
265
- else {
266
- if (needConversion) {
267
- faceData = _convertRGBtoRGBATextureData(faceData, texture.width, texture.height, type);
268
- }
269
- gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, faceData);
270
- }
271
- }
272
- const isPot = !this.needPOTTextures || (IsExponentOfTwo(texture.width) && IsExponentOfTwo(texture.height));
273
- if (isPot && texture.generateMipMaps && level === 0) {
274
- this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);
275
- }
276
- this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
277
- // this.resetTextureCache();
278
- texture.isReady = true;
279
- };
280
- ThinEngine.prototype.createRawCubeTextureFromUrl = function (url, scene, size, format, type, noMipmap, callback, mipmapGenerator, onLoad = null, onError = null, samplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE, invertY = false) {
281
- const gl = this._gl;
282
- const texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode, null);
283
- scene?.addPendingData(texture);
284
- texture.url = url;
285
- texture.isReady = false;
286
- this._internalTexturesCache.push(texture);
287
- const onerror = (request, exception) => {
288
- scene?.removePendingData(texture);
289
- if (onError && request) {
290
- onError(request.status + " " + request.statusText, exception);
291
- }
292
- };
293
- const internalCallback = (data) => {
294
- const width = texture.width;
295
- const faceDataArrays = callback(data);
296
- if (!faceDataArrays) {
297
- return;
298
- }
299
- if (mipmapGenerator) {
300
- const textureType = this._getWebGLTextureType(type);
301
- let internalFormat = this._getInternalFormat(format);
302
- const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);
303
- let needConversion = false;
304
- if (internalFormat === gl.RGB) {
305
- internalFormat = gl.RGBA;
306
- needConversion = true;
307
- }
308
- this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
309
- this._unpackFlipY(false);
310
- const mipData = mipmapGenerator(faceDataArrays);
311
- for (let level = 0; level < mipData.length; level++) {
312
- const mipSize = width >> level;
313
- for (let faceIndex = 0; faceIndex < 6; faceIndex++) {
314
- let mipFaceData = mipData[level][faceIndex];
315
- if (needConversion) {
316
- mipFaceData = _convertRGBtoRGBATextureData(mipFaceData, mipSize, mipSize, type);
317
- }
318
- gl.texImage2D(faceIndex, level, internalSizedFomat, mipSize, mipSize, 0, internalFormat, textureType, mipFaceData);
319
- }
320
- }
321
- this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
322
- }
323
- else {
324
- this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);
325
- }
326
- texture.isReady = true;
327
- // this.resetTextureCache();
328
- scene?.removePendingData(texture);
329
- texture.onLoadedObservable.notifyObservers(texture);
330
- texture.onLoadedObservable.clear();
331
- if (onLoad) {
332
- onLoad();
333
- }
334
- };
335
- this._loadFile(url, (data) => {
336
- internalCallback(data);
337
- }, undefined, scene?.offlineProvider, true, onerror);
338
- return texture;
339
- };
340
- /**
341
- * @internal
342
- */
343
- // eslint-disable-next-line @typescript-eslint/naming-convention
344
- function _convertRGBtoRGBATextureData(rgbData, width, height, textureType) {
345
- // Create new RGBA data container.
346
- let rgbaData;
347
- let val1 = 1;
348
- if (textureType === Constants.TEXTURETYPE_FLOAT) {
349
- rgbaData = new Float32Array(width * height * 4);
350
- }
351
- else if (textureType === Constants.TEXTURETYPE_HALF_FLOAT) {
352
- rgbaData = new Uint16Array(width * height * 4);
353
- val1 = 15360; // 15360 is the encoding of 1 in half float
354
- }
355
- else if (textureType === Constants.TEXTURETYPE_UNSIGNED_INTEGER) {
356
- rgbaData = new Uint32Array(width * height * 4);
357
- }
358
- else {
359
- rgbaData = new Uint8Array(width * height * 4);
360
- }
361
- // Convert each pixel.
362
- for (let x = 0; x < width; x++) {
363
- for (let y = 0; y < height; y++) {
364
- const index = (y * width + x) * 3;
365
- const newIndex = (y * width + x) * 4;
366
- // Map Old Value to new value.
367
- rgbaData[newIndex + 0] = rgbData[index + 0];
368
- rgbaData[newIndex + 1] = rgbData[index + 1];
369
- rgbaData[newIndex + 2] = rgbData[index + 2];
370
- // Add fully opaque alpha channel.
371
- rgbaData[newIndex + 3] = val1;
372
- }
373
- }
374
- return rgbaData;
375
- }
376
- /**
377
- * Create a function for createRawTexture3D/createRawTexture2DArray
378
- * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY
379
- * @internal
380
- */
381
- // eslint-disable-next-line @typescript-eslint/naming-convention
382
- function _makeCreateRawTextureFunction(is3D) {
383
- return function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression = null, textureType = Constants.TEXTURETYPE_UNSIGNED_INT) {
384
- const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;
385
- const source = is3D ? 10 /* InternalTextureSource.Raw3D */ : 11 /* InternalTextureSource.Raw2DArray */;
386
- const texture = new InternalTexture(this, source);
387
- texture.baseWidth = width;
388
- texture.baseHeight = height;
389
- texture.baseDepth = depth;
390
- texture.width = width;
391
- texture.height = height;
392
- texture.depth = depth;
393
- texture.format = format;
394
- texture.type = textureType;
395
- texture.generateMipMaps = generateMipMaps;
396
- texture.samplingMode = samplingMode;
397
- if (is3D) {
398
- texture.is3D = true;
399
- }
400
- else {
401
- texture.is2DArray = true;
402
- }
403
- if (!this._doNotHandleContextLost) {
404
- texture._bufferView = data;
405
- }
406
- if (is3D) {
407
- this.updateRawTexture3D(texture, data, format, invertY, compression, textureType);
408
- }
409
- else {
410
- this.updateRawTexture2DArray(texture, data, format, invertY, compression, textureType);
411
- }
412
- this._bindTextureDirectly(target, texture, true);
413
- // Filters
414
- const filters = this._getSamplingParameters(samplingMode, generateMipMaps);
415
- this._gl.texParameteri(target, this._gl.TEXTURE_MAG_FILTER, filters.mag);
416
- this._gl.texParameteri(target, this._gl.TEXTURE_MIN_FILTER, filters.min);
417
- if (generateMipMaps) {
418
- this._gl.generateMipmap(target);
419
- }
420
- this._bindTextureDirectly(target, null);
421
- this._internalTexturesCache.push(texture);
422
- return texture;
423
- };
424
- }
425
- ThinEngine.prototype.createRawTexture2DArray = _makeCreateRawTextureFunction(false);
426
- ThinEngine.prototype.createRawTexture3D = _makeCreateRawTextureFunction(true);
427
- /**
428
- * Create a function for updateRawTexture3D/updateRawTexture2DArray
429
- * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY
430
- * @internal
431
- */
432
- // eslint-disable-next-line @typescript-eslint/naming-convention
433
- function _makeUpdateRawTextureFunction(is3D) {
434
- return function (texture, data, format, invertY, compression = null, textureType = Constants.TEXTURETYPE_UNSIGNED_INT) {
435
- const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;
436
- const internalType = this._getWebGLTextureType(textureType);
437
- const internalFormat = this._getInternalFormat(format);
438
- const internalSizedFomat = this._getRGBABufferInternalSizedFormat(textureType, format);
439
- this._bindTextureDirectly(target, texture, true);
440
- this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);
441
- if (!this._doNotHandleContextLost) {
442
- texture._bufferView = data;
443
- texture.format = format;
444
- texture.invertY = invertY;
445
- texture._compression = compression;
446
- }
447
- if (texture.width % 4 !== 0) {
448
- this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);
449
- }
450
- if (compression && data) {
451
- this._gl.compressedTexImage3D(target, 0, this.getCaps().s3tc[compression], texture.width, texture.height, texture.depth, 0, data);
452
- }
453
- else {
454
- this._gl.texImage3D(target, 0, internalSizedFomat, texture.width, texture.height, texture.depth, 0, internalFormat, internalType, data);
455
- }
456
- if (texture.generateMipMaps) {
457
- this._gl.generateMipmap(target);
458
- }
459
- this._bindTextureDirectly(target, null);
460
- // this.resetTextureCache();
461
- texture.isReady = true;
462
- };
463
- }
464
- ThinEngine.prototype.updateRawTexture2DArray = _makeUpdateRawTextureFunction(false);
465
- ThinEngine.prototype.updateRawTexture3D = _makeUpdateRawTextureFunction(true);
466
-
467
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
468
- ThinEngine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset = 0) {
469
- // Force cache update
470
- this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null;
471
- this.bindIndexBuffer(indexBuffer);
472
- let view;
473
- if (indexBuffer.is32Bits) {
474
- // anything else than Uint32Array needs to be converted to Uint32Array
475
- view = indices instanceof Uint32Array ? indices : new Uint32Array(indices);
476
- }
477
- else {
478
- // anything else than Uint16Array needs to be converted to Uint16Array
479
- view = indices instanceof Uint16Array ? indices : new Uint16Array(indices);
480
- }
481
- this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, view, this._gl.DYNAMIC_DRAW);
482
- this._resetIndexBufferBinding();
483
- };
484
- ThinEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, data, byteOffset, byteLength) {
485
- this.bindArrayBuffer(vertexBuffer);
486
- if (byteOffset === undefined) {
487
- byteOffset = 0;
488
- }
489
- const dataLength = data.byteLength || data.length;
490
- if (byteLength === undefined || (byteLength >= dataLength && byteOffset === 0)) {
491
- if (data instanceof Array) {
492
- this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, new Float32Array(data));
493
- }
494
- else {
495
- this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, data);
496
- }
497
- }
498
- else {
499
- if (data instanceof Array) {
500
- this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(data).subarray(byteOffset, byteOffset + byteLength));
501
- }
502
- else {
503
- if (data instanceof ArrayBuffer) {
504
- data = new Uint8Array(data, byteOffset, byteLength);
505
- }
506
- else {
507
- data = new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);
508
- }
509
- this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);
510
- }
511
- }
512
- this._resetVertexBufferBinding();
513
- };
514
-
515
- ThinEngine.prototype._createDepthStencilCubeTexture = function (size, options) {
516
- const internalTexture = new InternalTexture(this, 12 /* InternalTextureSource.DepthStencil */);
517
- internalTexture.isCube = true;
518
- if (this.webGLVersion === 1) {
519
- Logger.Error("Depth cube texture is not supported by WebGL 1.");
520
- return internalTexture;
521
- }
522
- const internalOptions = {
523
- bilinearFiltering: false,
524
- comparisonFunction: 0,
525
- generateStencil: false,
526
- ...options,
527
- };
528
- const gl = this._gl;
529
- this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, internalTexture, true);
530
- this._setupDepthStencilTexture(internalTexture, size, internalOptions.bilinearFiltering, internalOptions.comparisonFunction);
531
- // Create the depth/stencil buffer
532
- for (let face = 0; face < 6; face++) {
533
- if (internalOptions.generateStencil) {
534
- 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);
535
- }
536
- else {
537
- gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.DEPTH_COMPONENT24, size, size, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null);
538
- }
539
- }
540
- this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
541
- this._internalTexturesCache.push(internalTexture);
542
- return internalTexture;
543
- };
544
- ThinEngine.prototype._setCubeMapTextureParams = function (texture, loadMipmap, maxLevel) {
545
- const gl = this._gl;
546
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
547
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, loadMipmap ? gl.LINEAR_MIPMAP_LINEAR : gl.LINEAR);
548
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
549
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
550
- texture.samplingMode = loadMipmap ? Constants.TEXTURE_TRILINEAR_SAMPLINGMODE : Constants.TEXTURE_LINEAR_LINEAR;
551
- if (loadMipmap && this.getCaps().textureMaxLevel && maxLevel !== undefined && maxLevel > 0) {
552
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAX_LEVEL, maxLevel);
553
- texture._maxLodLevel = maxLevel;
554
- }
555
- this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
556
- };
557
- 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) {
558
- const gl = this._gl;
559
- 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) => {
560
- const width = this.needPOTTextures ? GetExponentOfTwo(imgs[0].width, this._caps.maxCubemapTextureSize) : imgs[0].width;
561
- const height = width;
562
- const faces = [
563
- gl.TEXTURE_CUBE_MAP_POSITIVE_X,
564
- gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
565
- gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
566
- gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
567
- gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
568
- gl.TEXTURE_CUBE_MAP_NEGATIVE_Z,
569
- ];
570
- this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
571
- this._unpackFlipY(false);
572
- const internalFormat = format ? this._getInternalFormat(format, texture._useSRGBBuffer) : texture._useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : gl.RGBA;
573
- let texelFormat = format ? this._getInternalFormat(format) : gl.RGBA;
574
- if (texture._useSRGBBuffer && this.webGLVersion === 1) {
575
- texelFormat = internalFormat;
576
- }
577
- for (let index = 0; index < faces.length; index++) {
578
- if (imgs[index].width !== width || imgs[index].height !== height) {
579
- this._prepareWorkingCanvas();
580
- if (!this._workingCanvas || !this._workingContext) {
581
- Logger.Warn("Cannot create canvas to resize texture.");
582
- return;
583
- }
584
- this._workingCanvas.width = width;
585
- this._workingCanvas.height = height;
586
- this._workingContext.drawImage(imgs[index], 0, 0, imgs[index].width, imgs[index].height, 0, 0, width, height);
587
- gl.texImage2D(faces[index], 0, internalFormat, texelFormat, gl.UNSIGNED_BYTE, this._workingCanvas);
588
- }
589
- else {
590
- gl.texImage2D(faces[index], 0, internalFormat, texelFormat, gl.UNSIGNED_BYTE, imgs[index]);
591
- }
592
- }
593
- if (!noMipmap) {
594
- gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
595
- }
596
- this._setCubeMapTextureParams(texture, !noMipmap);
597
- texture.width = width;
598
- texture.height = height;
599
- texture.isReady = true;
600
- if (format) {
601
- texture.format = format;
602
- }
603
- texture.onLoadedObservable.notifyObservers(texture);
604
- texture.onLoadedObservable.clear();
605
- if (onLoad) {
606
- onLoad();
607
- }
608
- }, !!useSRGBBuffer, buffer);
609
- };
610
- ThinEngine.prototype.generateMipMapsForCubemap = function (texture, unbind = true) {
611
- if (texture.generateMipMaps) {
612
- const gl = this._gl;
613
- this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
614
- gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
615
- if (unbind) {
616
- this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
617
- }
618
- }
619
- };
620
-
621
- /** @internal */
622
- class WebGLRenderTargetWrapper extends RenderTargetWrapper {
623
- constructor(isMulti, isCube, size, engine, context) {
624
- super(isMulti, isCube, size, engine);
625
- /**
626
- * @internal
627
- */
628
- this._framebuffer = null;
629
- /**
630
- * @internal
631
- */
632
- this._depthStencilBuffer = null;
633
- // eslint-disable-next-line @typescript-eslint/naming-convention
634
- /**
635
- * @internal
636
- */
637
- // eslint-disable-next-line @typescript-eslint/naming-convention
638
- this._MSAAFramebuffer = null;
639
- // Multiview
640
- /**
641
- * @internal
642
- */
643
- this._colorTextureArray = null;
644
- /**
645
- * @internal
646
- */
647
- this._depthStencilTextureArray = null;
648
- /**
649
- * @internal
650
- */
651
- this._disposeOnlyFramebuffers = false;
652
- /**
653
- * @internal
654
- */
655
- this._currentLOD = 0;
656
- this._context = context;
657
- }
658
- _cloneRenderTargetWrapper() {
659
- let rtw = null;
660
- if (this._colorTextureArray && this._depthStencilTextureArray) {
661
- rtw = this._engine.createMultiviewRenderTargetTexture(this.width, this.height);
662
- rtw.texture.isReady = true;
663
- }
664
- else {
665
- rtw = super._cloneRenderTargetWrapper();
666
- }
667
- return rtw;
668
- }
669
- _swapRenderTargetWrapper(target) {
670
- super._swapRenderTargetWrapper(target);
671
- target._framebuffer = this._framebuffer;
672
- target._depthStencilBuffer = this._depthStencilBuffer;
673
- target._MSAAFramebuffer = this._MSAAFramebuffer;
674
- target._colorTextureArray = this._colorTextureArray;
675
- target._depthStencilTextureArray = this._depthStencilTextureArray;
676
- this._framebuffer = this._depthStencilBuffer = this._MSAAFramebuffer = this._colorTextureArray = this._depthStencilTextureArray = null;
677
- }
678
- /**
679
- * Creates the depth/stencil texture
680
- * @param comparisonFunction Comparison function to use for the texture
681
- * @param bilinearFiltering true if bilinear filtering should be used when sampling the texture
682
- * @param generateStencil true if the stencil aspect should also be created
683
- * @param samples sample count to use when creating the texture
684
- * @param format format of the depth texture
685
- * @param label defines the label to use for the texture (for debugging purpose only)
686
- * @returns the depth/stencil created texture
687
- */
688
- createDepthStencilTexture(comparisonFunction = 0, bilinearFiltering = true, generateStencil = false, samples = 1, format = Constants.TEXTUREFORMAT_DEPTH32_FLOAT, label) {
689
- if (this._depthStencilBuffer) {
690
- const engine = this._engine;
691
- // Dispose previous depth/stencil render buffers and clear the corresponding attachment.
692
- // Next time this framebuffer is bound, the new depth/stencil texture will be attached.
693
- const currentFrameBuffer = engine._currentFramebuffer;
694
- const gl = this._context;
695
- engine._bindUnboundFramebuffer(this._framebuffer);
696
- gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);
697
- gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null);
698
- gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);
699
- engine._bindUnboundFramebuffer(currentFrameBuffer);
700
- gl.deleteRenderbuffer(this._depthStencilBuffer);
701
- this._depthStencilBuffer = null;
702
- }
703
- return super.createDepthStencilTexture(comparisonFunction, bilinearFiltering, generateStencil, samples, format, label);
704
- }
705
- /**
706
- * Shares the depth buffer of this render target with another render target.
707
- * @param renderTarget Destination renderTarget
708
- */
709
- shareDepth(renderTarget) {
710
- super.shareDepth(renderTarget);
711
- const gl = this._context;
712
- const depthbuffer = this._depthStencilBuffer;
713
- const framebuffer = renderTarget._MSAAFramebuffer || renderTarget._framebuffer;
714
- const engine = this._engine;
715
- if (renderTarget._depthStencilBuffer && renderTarget._depthStencilBuffer !== depthbuffer) {
716
- gl.deleteRenderbuffer(renderTarget._depthStencilBuffer);
717
- }
718
- renderTarget._depthStencilBuffer = depthbuffer;
719
- const attachment = renderTarget._generateStencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
720
- engine._bindUnboundFramebuffer(framebuffer);
721
- gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, depthbuffer);
722
- engine._bindUnboundFramebuffer(null);
723
- }
724
- /**
725
- * Binds a texture to this render target on a specific attachment
726
- * @param texture The texture to bind to the framebuffer
727
- * @param attachmentIndex Index of the attachment
728
- * @param faceIndexOrLayer The face or layer of the texture to render to in case of cube texture or array texture
729
- * @param lodLevel defines the lod level to bind to the frame buffer
730
- */
731
- _bindTextureRenderTarget(texture, attachmentIndex = 0, faceIndexOrLayer, lodLevel = 0) {
732
- if (!texture._hardwareTexture) {
733
- return;
734
- }
735
- const framebuffer = this._framebuffer;
736
- const engine = this._engine;
737
- const currentFB = engine._currentFramebuffer;
738
- engine._bindUnboundFramebuffer(framebuffer);
739
- if (engine.webGLVersion > 1) {
740
- const gl = this._context;
741
- const attachment = gl["COLOR_ATTACHMENT" + attachmentIndex];
742
- if (texture.is2DArray || texture.is3D) {
743
- faceIndexOrLayer = faceIndexOrLayer ?? this.layerIndices?.[attachmentIndex] ?? 0;
744
- gl.framebufferTextureLayer(gl.FRAMEBUFFER, attachment, texture._hardwareTexture.underlyingResource, lodLevel, faceIndexOrLayer);
745
- }
746
- else if (texture.isCube) {
747
- // if face index is not specified, try to query it from faceIndices
748
- // default is face 0
749
- faceIndexOrLayer = faceIndexOrLayer ?? this.faceIndices?.[attachmentIndex] ?? 0;
750
- gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer, texture._hardwareTexture.underlyingResource, lodLevel);
751
- }
752
- else {
753
- gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, texture._hardwareTexture.underlyingResource, lodLevel);
754
- }
755
- }
756
- else {
757
- // Default behavior (WebGL)
758
- const gl = this._context;
759
- const attachment = gl["COLOR_ATTACHMENT" + attachmentIndex + "_WEBGL"];
760
- const target = faceIndexOrLayer !== undefined ? gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer : gl.TEXTURE_2D;
761
- gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, target, texture._hardwareTexture.underlyingResource, lodLevel);
762
- }
763
- engine._bindUnboundFramebuffer(currentFB);
764
- }
765
- /**
766
- * Set a texture in the textures array
767
- * @param texture the texture to set
768
- * @param index the index in the textures array to set
769
- * @param disposePrevious If this function should dispose the previous texture
770
- */
771
- setTexture(texture, index = 0, disposePrevious = true) {
772
- super.setTexture(texture, index, disposePrevious);
773
- this._bindTextureRenderTarget(texture, index);
774
- }
775
- /**
776
- * Sets the layer and face indices of every render target texture
777
- * @param layers The layer of the texture to be set (make negative to not modify)
778
- * @param faces The face of the texture to be set (make negative to not modify)
779
- */
780
- setLayerAndFaceIndices(layers, faces) {
781
- super.setLayerAndFaceIndices(layers, faces);
782
- if (!this.textures || !this.layerIndices || !this.faceIndices) {
783
- return;
784
- }
785
- // the length of this._attachments is the right one as it does not count the depth texture, in case we generated it
786
- const textureCount = this._attachments?.length ?? this.textures.length;
787
- for (let index = 0; index < textureCount; index++) {
788
- const texture = this.textures[index];
789
- if (!texture) {
790
- // The target type was probably -1 at creation time and setTexture has not been called yet for this index
791
- continue;
792
- }
793
- if (texture.is2DArray || texture.is3D) {
794
- this._bindTextureRenderTarget(texture, index, this.layerIndices[index]);
795
- }
796
- else if (texture.isCube) {
797
- this._bindTextureRenderTarget(texture, index, this.faceIndices[index]);
798
- }
799
- else {
800
- this._bindTextureRenderTarget(texture, index);
801
- }
802
- }
803
- }
804
- /**
805
- * Set the face and layer indices of a texture in the textures array
806
- * @param index The index of the texture in the textures array to modify
807
- * @param layer The layer of the texture to be set
808
- * @param face The face of the texture to be set
809
- */
810
- setLayerAndFaceIndex(index = 0, layer, face) {
811
- super.setLayerAndFaceIndex(index, layer, face);
812
- if (!this.textures || !this.layerIndices || !this.faceIndices) {
813
- return;
814
- }
815
- const texture = this.textures[index];
816
- if (texture.is2DArray || texture.is3D) {
817
- this._bindTextureRenderTarget(this.textures[index], index, this.layerIndices[index]);
818
- }
819
- else if (texture.isCube) {
820
- this._bindTextureRenderTarget(this.textures[index], index, this.faceIndices[index]);
821
- }
822
- }
823
- dispose(disposeOnlyFramebuffers = this._disposeOnlyFramebuffers) {
824
- const gl = this._context;
825
- if (!disposeOnlyFramebuffers) {
826
- if (this._colorTextureArray) {
827
- this._context.deleteTexture(this._colorTextureArray);
828
- this._colorTextureArray = null;
829
- }
830
- if (this._depthStencilTextureArray) {
831
- this._context.deleteTexture(this._depthStencilTextureArray);
832
- this._depthStencilTextureArray = null;
833
- }
834
- }
835
- if (this._framebuffer) {
836
- gl.deleteFramebuffer(this._framebuffer);
837
- this._framebuffer = null;
838
- }
839
- if (this._depthStencilBuffer) {
840
- gl.deleteRenderbuffer(this._depthStencilBuffer);
841
- this._depthStencilBuffer = null;
842
- }
843
- if (this._MSAAFramebuffer) {
844
- gl.deleteFramebuffer(this._MSAAFramebuffer);
845
- this._MSAAFramebuffer = null;
846
- }
847
- super.dispose(disposeOnlyFramebuffers);
848
- }
849
- }
850
-
851
- ThinEngine.prototype._createHardwareRenderTargetWrapper = function (isMulti, isCube, size) {
852
- const rtWrapper = new WebGLRenderTargetWrapper(isMulti, isCube, size, this, this._gl);
853
- this._renderTargetWrapperCache.push(rtWrapper);
854
- return rtWrapper;
855
- };
856
- ThinEngine.prototype.createRenderTargetTexture = function (size, options) {
857
- const rtWrapper = this._createHardwareRenderTargetWrapper(false, false, size);
858
- let generateDepthBuffer = true;
859
- let generateStencilBuffer = false;
860
- let noColorAttachment = false;
861
- let colorAttachment = undefined;
862
- let samples = 1;
863
- let label = undefined;
864
- if (options !== undefined && typeof options === "object") {
865
- generateDepthBuffer = options.generateDepthBuffer ?? true;
866
- generateStencilBuffer = !!options.generateStencilBuffer;
867
- noColorAttachment = !!options.noColorAttachment;
868
- colorAttachment = options.colorAttachment;
869
- samples = options.samples ?? 1;
870
- label = options.label;
871
- }
872
- const texture = colorAttachment || (noColorAttachment ? null : this._createInternalTexture(size, options, true, 5 /* InternalTextureSource.RenderTarget */));
873
- const width = size.width || size;
874
- const height = size.height || size;
875
- const currentFrameBuffer = this._currentFramebuffer;
876
- const gl = this._gl;
877
- // Create the framebuffer
878
- const framebuffer = gl.createFramebuffer();
879
- this._bindUnboundFramebuffer(framebuffer);
880
- rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height);
881
- // No need to rebind on every frame
882
- if (texture && !texture.is2DArray && !texture.is3D) {
883
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._hardwareTexture.underlyingResource, 0);
884
- }
885
- this._bindUnboundFramebuffer(currentFrameBuffer);
886
- rtWrapper.label = label ?? "RenderTargetWrapper";
887
- rtWrapper._framebuffer = framebuffer;
888
- rtWrapper._generateDepthBuffer = generateDepthBuffer;
889
- rtWrapper._generateStencilBuffer = generateStencilBuffer;
890
- rtWrapper.setTextures(texture);
891
- this.updateRenderTargetTextureSampleCount(rtWrapper, samples);
892
- return rtWrapper;
893
- };
894
- ThinEngine.prototype._createDepthStencilTexture = function (size, options, rtWrapper) {
895
- const gl = this._gl;
896
- const layers = size.layers || 0;
897
- const depth = size.depth || 0;
898
- let target = gl.TEXTURE_2D;
899
- if (layers !== 0) {
900
- target = gl.TEXTURE_2D_ARRAY;
901
- }
902
- else if (depth !== 0) {
903
- target = gl.TEXTURE_3D;
904
- }
905
- const internalTexture = new InternalTexture(this, 12 /* InternalTextureSource.DepthStencil */);
906
- internalTexture.label = options.label;
907
- if (!this._caps.depthTextureExtension) {
908
- Logger.Error("Depth texture is not supported by your browser or hardware.");
909
- return internalTexture;
910
- }
911
- const internalOptions = {
912
- bilinearFiltering: false,
913
- comparisonFunction: 0,
914
- generateStencil: false,
915
- ...options,
916
- };
917
- this._bindTextureDirectly(target, internalTexture, true);
918
- this._setupDepthStencilTexture(internalTexture, size, internalOptions.comparisonFunction === 0 ? false : internalOptions.bilinearFiltering, internalOptions.comparisonFunction, internalOptions.samples);
919
- if (internalOptions.depthTextureFormat !== undefined) {
920
- if (internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH16 &&
921
- internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH24 &&
922
- internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 &&
923
- internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 &&
924
- internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH32_FLOAT &&
925
- internalOptions.depthTextureFormat !== Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8) {
926
- Logger.Error(`Depth texture ${internalOptions.depthTextureFormat} format is not supported.`);
927
- return internalTexture;
928
- }
929
- internalTexture.format = internalOptions.depthTextureFormat;
930
- }
931
- else {
932
- internalTexture.format = internalOptions.generateStencil ? Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 : Constants.TEXTUREFORMAT_DEPTH24;
933
- }
934
- const hasStencil = internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 ||
935
- internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8 ||
936
- internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8;
937
- let type = gl.UNSIGNED_INT;
938
- if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH16) {
939
- type = gl.UNSIGNED_SHORT;
940
- }
941
- else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 || internalTexture.format === Constants.TEXTUREFORMAT_DEPTH24_STENCIL8) {
942
- type = gl.UNSIGNED_INT_24_8;
943
- }
944
- else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32_FLOAT) {
945
- type = gl.FLOAT;
946
- }
947
- else if (internalTexture.format === Constants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8) {
948
- type = gl.FLOAT_32_UNSIGNED_INT_24_8_REV;
949
- }
950
- const format = hasStencil ? gl.DEPTH_STENCIL : gl.DEPTH_COMPONENT;
951
- const internalFormat = this._getInternalFormatFromDepthTextureFormat(internalTexture.format, true, hasStencil);
952
- if (internalTexture.is2DArray) {
953
- gl.texImage3D(target, 0, internalFormat, internalTexture.width, internalTexture.height, layers, 0, format, type, null);
954
- }
955
- else if (internalTexture.is3D) {
956
- gl.texImage3D(target, 0, internalFormat, internalTexture.width, internalTexture.height, depth, 0, format, type, null);
957
- }
958
- else {
959
- gl.texImage2D(target, 0, internalFormat, internalTexture.width, internalTexture.height, 0, format, type, null);
960
- }
961
- this._bindTextureDirectly(target, null);
962
- this._internalTexturesCache.push(internalTexture);
963
- if (rtWrapper._depthStencilBuffer) {
964
- gl.deleteRenderbuffer(rtWrapper._depthStencilBuffer);
965
- rtWrapper._depthStencilBuffer = null;
966
- }
967
- this._bindUnboundFramebuffer(rtWrapper._MSAAFramebuffer ?? rtWrapper._framebuffer);
968
- rtWrapper._generateStencilBuffer = hasStencil;
969
- rtWrapper._depthStencilTextureWithStencil = hasStencil;
970
- rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(rtWrapper._generateStencilBuffer, rtWrapper._generateDepthBuffer, rtWrapper.width, rtWrapper.height, rtWrapper.samples, internalTexture.format);
971
- this._bindUnboundFramebuffer(null);
972
- return internalTexture;
973
- };
974
- ThinEngine.prototype.updateRenderTargetTextureSampleCount = function (rtWrapper, samples) {
975
- if (this.webGLVersion < 2 || !rtWrapper) {
976
- return 1;
977
- }
978
- if (rtWrapper.samples === samples) {
979
- return samples;
980
- }
981
- const gl = this._gl;
982
- samples = Math.min(samples, this.getCaps().maxMSAASamples);
983
- // Dispose previous render buffers
984
- if (rtWrapper._depthStencilBuffer) {
985
- gl.deleteRenderbuffer(rtWrapper._depthStencilBuffer);
986
- rtWrapper._depthStencilBuffer = null;
987
- }
988
- if (rtWrapper._MSAAFramebuffer) {
989
- gl.deleteFramebuffer(rtWrapper._MSAAFramebuffer);
990
- rtWrapper._MSAAFramebuffer = null;
991
- }
992
- const hardwareTexture = rtWrapper.texture?._hardwareTexture;
993
- hardwareTexture?.releaseMSAARenderBuffers();
994
- const framebuffer = gl.createFramebuffer();
995
- if (!framebuffer) {
996
- throw new Error("Unable to create multi sampled framebuffer");
997
- }
998
- rtWrapper._MSAAFramebuffer = framebuffer;
999
- if (rtWrapper.texture && samples > 1 && typeof gl.renderbufferStorageMultisample === "function") {
1000
- this._bindUnboundFramebuffer(rtWrapper._MSAAFramebuffer);
1001
- 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);
1002
- if (!colorRenderbuffer) {
1003
- throw new Error("Unable to create multi sampled framebuffer");
1004
- }
1005
- hardwareTexture?.addMSAARenderBuffer(colorRenderbuffer);
1006
- }
1007
- this._bindUnboundFramebuffer(rtWrapper._MSAAFramebuffer ?? rtWrapper._framebuffer);
1008
- if (rtWrapper.texture) {
1009
- rtWrapper.texture.samples = samples;
1010
- }
1011
- rtWrapper._samples = samples;
1012
- const depthFormat = rtWrapper._depthStencilTexture ? rtWrapper._depthStencilTexture.format : undefined;
1013
- rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(rtWrapper._generateStencilBuffer, rtWrapper._generateDepthBuffer, rtWrapper.width, rtWrapper.height, samples, depthFormat);
1014
- this._bindUnboundFramebuffer(null);
1015
- return samples;
1016
- };
1017
- ThinEngine.prototype._setupDepthStencilTexture = function (internalTexture, size, bilinearFiltering, comparisonFunction, samples = 1) {
1018
- const width = size.width || size;
1019
- const height = size.height || size;
1020
- const layers = size.layers || 0;
1021
- const depth = size.depth || 0;
1022
- internalTexture.baseWidth = width;
1023
- internalTexture.baseHeight = height;
1024
- internalTexture.width = width;
1025
- internalTexture.height = height;
1026
- internalTexture.is2DArray = layers > 0;
1027
- internalTexture.depth = layers || depth;
1028
- internalTexture.isReady = true;
1029
- internalTexture.samples = samples;
1030
- internalTexture.generateMipMaps = false;
1031
- internalTexture.samplingMode = bilinearFiltering ? Constants.TEXTURE_BILINEAR_SAMPLINGMODE : Constants.TEXTURE_NEAREST_SAMPLINGMODE;
1032
- internalTexture.type = Constants.TEXTURETYPE_UNSIGNED_INT;
1033
- internalTexture._comparisonFunction = comparisonFunction;
1034
- const gl = this._gl;
1035
- const target = this._getTextureTarget(internalTexture);
1036
- const samplingParameters = this._getSamplingParameters(internalTexture.samplingMode, false);
1037
- gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, samplingParameters.mag);
1038
- gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, samplingParameters.min);
1039
- gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
1040
- gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
1041
- // TEXTURE_COMPARE_FUNC/MODE are only availble in WebGL2.
1042
- if (this.webGLVersion > 1) {
1043
- if (comparisonFunction === 0) {
1044
- gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, Constants.LEQUAL);
1045
- gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.NONE);
1046
- }
1047
- else {
1048
- gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);
1049
- gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);
1050
- }
1051
- }
1052
- };
1053
-
1054
- ThinEngine.prototype.setDepthStencilTexture = function (channel, uniform, texture, name) {
1055
- if (channel === undefined) {
1056
- return;
1057
- }
1058
- if (uniform) {
1059
- this._boundUniforms[channel] = uniform;
1060
- }
1061
- if (!texture || !texture.depthStencilTexture) {
1062
- this._setTexture(channel, null, undefined, undefined, name);
1063
- }
1064
- else {
1065
- this._setTexture(channel, texture, false, true, name);
1066
- }
1067
- };
1068
-
1069
- ThinEngine.prototype.createRenderTargetCubeTexture = function (size, options) {
1070
- const rtWrapper = this._createHardwareRenderTargetWrapper(false, true, size);
1071
- const fullOptions = {
1072
- generateMipMaps: true,
1073
- generateDepthBuffer: true,
1074
- generateStencilBuffer: false,
1075
- type: Constants.TEXTURETYPE_UNSIGNED_INT,
1076
- samplingMode: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,
1077
- format: Constants.TEXTUREFORMAT_RGBA,
1078
- ...options,
1079
- };
1080
- fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && fullOptions.generateStencilBuffer;
1081
- if (fullOptions.type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloatLinearFiltering) {
1082
- // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE
1083
- fullOptions.samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
1084
- }
1085
- else if (fullOptions.type === Constants.TEXTURETYPE_HALF_FLOAT && !this._caps.textureHalfFloatLinearFiltering) {
1086
- // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE
1087
- fullOptions.samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
1088
- }
1089
- const gl = this._gl;
1090
- const texture = new InternalTexture(this, 5 /* InternalTextureSource.RenderTarget */);
1091
- this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
1092
- const filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps);
1093
- if (fullOptions.type === Constants.TEXTURETYPE_FLOAT && !this._caps.textureFloat) {
1094
- fullOptions.type = Constants.TEXTURETYPE_UNSIGNED_INT;
1095
- Logger.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type");
1096
- }
1097
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);
1098
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);
1099
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
1100
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
1101
- for (let face = 0; face < 6; face++) {
1102
- 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);
1103
- }
1104
- // Create the framebuffer
1105
- const framebuffer = gl.createFramebuffer();
1106
- this._bindUnboundFramebuffer(framebuffer);
1107
- rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer, fullOptions.generateDepthBuffer, size, size);
1108
- // MipMaps
1109
- if (fullOptions.generateMipMaps) {
1110
- gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
1111
- }
1112
- // Unbind
1113
- this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);
1114
- this._bindUnboundFramebuffer(null);
1115
- rtWrapper._framebuffer = framebuffer;
1116
- rtWrapper._generateDepthBuffer = fullOptions.generateDepthBuffer;
1117
- rtWrapper._generateStencilBuffer = fullOptions.generateStencilBuffer;
1118
- texture.width = size;
1119
- texture.height = size;
1120
- texture.isReady = true;
1121
- texture.isCube = true;
1122
- texture.samples = 1;
1123
- texture.generateMipMaps = fullOptions.generateMipMaps;
1124
- texture.samplingMode = fullOptions.samplingMode;
1125
- texture.type = fullOptions.type;
1126
- texture.format = fullOptions.format;
1127
- this._internalTexturesCache.push(texture);
1128
- rtWrapper.setTextures(texture);
1129
- return rtWrapper;
1130
- };
1131
-
1132
- /**
1133
- * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio
1134
- */
1135
- class Engine extends ThinEngine {
1136
- /**
1137
- * Returns the current npm package of the sdk
1138
- */
1139
- // Not mixed with Version for tooling purpose.
1140
- static get NpmPackage() {
1141
- return AbstractEngine.NpmPackage;
1142
- }
1143
- /**
1144
- * Returns the current version of the framework
1145
- */
1146
- static get Version() {
1147
- return AbstractEngine.Version;
1148
- }
1149
- /** Gets the list of created engines */
1150
- static get Instances() {
1151
- return EngineStore.Instances;
1152
- }
1153
- /**
1154
- * Gets the latest created engine
1155
- */
1156
- static get LastCreatedEngine() {
1157
- return EngineStore.LastCreatedEngine;
1158
- }
1159
- /**
1160
- * Gets the latest created scene
1161
- */
1162
- static get LastCreatedScene() {
1163
- return EngineStore.LastCreatedScene;
1164
- }
1165
- /** @internal */
1166
- // eslint-disable-next-line jsdoc/require-returns-check
1167
- /**
1168
- * Method called to create the default loading screen.
1169
- * This can be overridden in your own app.
1170
- * @param canvas The rendering canvas element
1171
- * @returns The loading screen
1172
- */
1173
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1174
- static DefaultLoadingScreenFactory(canvas) {
1175
- return AbstractEngine.DefaultLoadingScreenFactory(canvas);
1176
- }
1177
- get _supportsHardwareTextureRescaling() {
1178
- return !!Engine._RescalePostProcessFactory;
1179
- }
1180
- _measureFps() {
1181
- this._performanceMonitor.sampleFrame();
1182
- this._fps = this._performanceMonitor.averageFPS;
1183
- this._deltaTime = this._performanceMonitor.instantaneousFrameTime || 0;
1184
- }
1185
- /**
1186
- * Gets the performance monitor attached to this engine
1187
- * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#engineinstrumentation
1188
- */
1189
- get performanceMonitor() {
1190
- return this._performanceMonitor;
1191
- }
1192
- // Events
1193
- /**
1194
- * Creates a new engine
1195
- * @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
1196
- * @param antialias defines enable antialiasing (default: false)
1197
- * @param options defines further options to be sent to the getContext() function
1198
- * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)
1199
- */
1200
- constructor(canvasOrContext, antialias, options, adaptToDeviceRatio = false) {
1201
- super(canvasOrContext, antialias, options, adaptToDeviceRatio);
1202
- // Members
1203
- /**
1204
- * If set, will be used to request the next animation frame for the render loop
1205
- */
1206
- this.customAnimationFrameRequester = null;
1207
- this._performanceMonitor = new PerformanceMonitor();
1208
- this._drawCalls = new PerfCounter();
1209
- if (!canvasOrContext) {
1210
- return;
1211
- }
1212
- this._features.supportRenderPasses = true;
1213
- options = this._creationOptions;
1214
- if (canvasOrContext.getContext) {
1215
- const canvas = canvasOrContext;
1216
- this._sharedInit(canvas);
1217
- }
1218
- }
1219
- _initGLContext() {
1220
- super._initGLContext();
1221
- this._rescalePostProcess = null;
1222
- }
1223
- /**
1224
- * Shared initialization across engines types.
1225
- * @param canvas The canvas associated with this instance of the engine.
1226
- */
1227
- _sharedInit(canvas) {
1228
- super._sharedInit(canvas);
1229
- _CommonInit(this, canvas, this._creationOptions);
1230
- }
1231
- /**
1232
- * Resize an image and returns the image data as an uint8array
1233
- * @param image image to resize
1234
- * @param bufferWidth destination buffer width
1235
- * @param bufferHeight destination buffer height
1236
- * @returns an uint8array containing RGBA values of bufferWidth * bufferHeight size
1237
- */
1238
- resizeImageBitmap(image, bufferWidth, bufferHeight) {
1239
- return ResizeImageBitmap(this, image, bufferWidth, bufferHeight);
1240
- }
1241
- /**
1242
- * Engine abstraction for loading and creating an image bitmap from a given source string.
1243
- * @param imageSource source to load the image from.
1244
- * @param options An object that sets options for the image's extraction.
1245
- * @returns ImageBitmap
1246
- */
1247
- _createImageBitmapFromSource(imageSource, options) {
1248
- return CreateImageBitmapFromSource(this, imageSource, options);
1249
- }
1250
- /**
1251
- * Toggle full screen mode
1252
- * @param requestPointerLock defines if a pointer lock should be requested from the user
1253
- */
1254
- switchFullscreen(requestPointerLock) {
1255
- if (this.isFullscreen) {
1256
- this.exitFullscreen();
1257
- }
1258
- else {
1259
- this.enterFullscreen(requestPointerLock);
1260
- }
1261
- }
1262
- /**
1263
- * Enters full screen mode
1264
- * @param requestPointerLock defines if a pointer lock should be requested from the user
1265
- */
1266
- enterFullscreen(requestPointerLock) {
1267
- if (!this.isFullscreen) {
1268
- this._pointerLockRequested = requestPointerLock;
1269
- if (this._renderingCanvas) {
1270
- RequestFullscreen(this._renderingCanvas);
1271
- }
1272
- }
1273
- }
1274
- /**
1275
- * Exits full screen mode
1276
- */
1277
- exitFullscreen() {
1278
- if (this.isFullscreen) {
1279
- ExitFullscreen();
1280
- }
1281
- }
1282
- /** States */
1283
- /**
1284
- * Sets a boolean indicating if the dithering state is enabled or disabled
1285
- * @param value defines the dithering state
1286
- */
1287
- setDitheringState(value) {
1288
- if (value) {
1289
- this._gl.enable(this._gl.DITHER);
1290
- }
1291
- else {
1292
- this._gl.disable(this._gl.DITHER);
1293
- }
1294
- }
1295
- /**
1296
- * Sets a boolean indicating if the rasterizer state is enabled or disabled
1297
- * @param value defines the rasterizer state
1298
- */
1299
- setRasterizerState(value) {
1300
- if (value) {
1301
- this._gl.disable(this._gl.RASTERIZER_DISCARD);
1302
- }
1303
- else {
1304
- this._gl.enable(this._gl.RASTERIZER_DISCARD);
1305
- }
1306
- }
1307
- /**
1308
- * Directly set the WebGL Viewport
1309
- * @param x defines the x coordinate of the viewport (in screen space)
1310
- * @param y defines the y coordinate of the viewport (in screen space)
1311
- * @param width defines the width of the viewport (in screen space)
1312
- * @param height defines the height of the viewport (in screen space)
1313
- * @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
1314
- */
1315
- setDirectViewport(x, y, width, height) {
1316
- const currentViewport = this._cachedViewport;
1317
- this._cachedViewport = null;
1318
- this._viewport(x, y, width, height);
1319
- return currentViewport;
1320
- }
1321
- /**
1322
- * Executes a scissor clear (ie. a clear on a specific portion of the screen)
1323
- * @param x defines the x-coordinate of the bottom left corner of the clear rectangle
1324
- * @param y defines the y-coordinate of the corner of the clear rectangle
1325
- * @param width defines the width of the clear rectangle
1326
- * @param height defines the height of the clear rectangle
1327
- * @param clearColor defines the clear color
1328
- */
1329
- scissorClear(x, y, width, height, clearColor) {
1330
- this.enableScissor(x, y, width, height);
1331
- this.clear(clearColor, true, true, true);
1332
- this.disableScissor();
1333
- }
1334
- /**
1335
- * Enable scissor test on a specific rectangle (ie. render will only be executed on a specific portion of the screen)
1336
- * @param x defines the x-coordinate of the bottom left corner of the clear rectangle
1337
- * @param y defines the y-coordinate of the corner of the clear rectangle
1338
- * @param width defines the width of the clear rectangle
1339
- * @param height defines the height of the clear rectangle
1340
- */
1341
- enableScissor(x, y, width, height) {
1342
- const gl = this._gl;
1343
- // Change state
1344
- gl.enable(gl.SCISSOR_TEST);
1345
- gl.scissor(x, y, width, height);
1346
- }
1347
- /**
1348
- * Disable previously set scissor test rectangle
1349
- */
1350
- disableScissor() {
1351
- const gl = this._gl;
1352
- gl.disable(gl.SCISSOR_TEST);
1353
- }
1354
- /**
1355
- * @internal
1356
- */
1357
- _loadFileAsync(url, offlineProvider, useArrayBuffer) {
1358
- return new Promise((resolve, reject) => {
1359
- this._loadFile(url, (data) => {
1360
- resolve(data);
1361
- }, undefined, offlineProvider, useArrayBuffer, (request, exception) => {
1362
- reject(exception);
1363
- });
1364
- });
1365
- }
1366
- /**
1367
- * Gets the source code of the vertex shader associated with a specific webGL program
1368
- * @param program defines the program to use
1369
- * @returns a string containing the source code of the vertex shader associated with the program
1370
- */
1371
- getVertexShaderSource(program) {
1372
- const shaders = this._gl.getAttachedShaders(program);
1373
- if (!shaders) {
1374
- return null;
1375
- }
1376
- return this._gl.getShaderSource(shaders[0]);
1377
- }
1378
- /**
1379
- * Gets the source code of the fragment shader associated with a specific webGL program
1380
- * @param program defines the program to use
1381
- * @returns a string containing the source code of the fragment shader associated with the program
1382
- */
1383
- getFragmentShaderSource(program) {
1384
- const shaders = this._gl.getAttachedShaders(program);
1385
- if (!shaders) {
1386
- return null;
1387
- }
1388
- return this._gl.getShaderSource(shaders[1]);
1389
- }
1390
- /**
1391
- * sets the object from which width and height will be taken from when getting render width and height
1392
- * Will fallback to the gl object
1393
- * @param dimensions the framebuffer width and height that will be used.
1394
- */
1395
- set framebufferDimensionsObject(dimensions) {
1396
- this._framebufferDimensionsObject = dimensions;
1397
- if (this._framebufferDimensionsObject) {
1398
- this.onResizeObservable.notifyObservers(this);
1399
- }
1400
- }
1401
- _rebuildBuffers() {
1402
- // Index / Vertex
1403
- for (const scene of this.scenes) {
1404
- scene.resetCachedMaterial();
1405
- scene._rebuildGeometries();
1406
- }
1407
- for (const scene of this._virtualScenes) {
1408
- scene.resetCachedMaterial();
1409
- scene._rebuildGeometries();
1410
- }
1411
- super._rebuildBuffers();
1412
- }
1413
- /**
1414
- * Get Font size information
1415
- * @param font font name
1416
- * @returns an object containing ascent, height and descent
1417
- */
1418
- getFontOffset(font) {
1419
- return GetFontOffset(font);
1420
- }
1421
- _cancelFrame() {
1422
- if (this.customAnimationFrameRequester) {
1423
- if (this._frameHandler !== 0) {
1424
- this._frameHandler = 0;
1425
- const { cancelAnimationFrame } = this.customAnimationFrameRequester;
1426
- if (cancelAnimationFrame) {
1427
- cancelAnimationFrame(this.customAnimationFrameRequester.requestID);
1428
- }
1429
- }
1430
- }
1431
- else {
1432
- super._cancelFrame();
1433
- }
1434
- }
1435
- _renderLoop() {
1436
- // Reset the frame handler before rendering a frame to determine if a new frame has been queued.
1437
- this._frameHandler = 0;
1438
- if (!this._contextWasLost) {
1439
- let shouldRender = true;
1440
- if (this.isDisposed || (!this.renderEvenInBackground && this._windowIsBackground)) {
1441
- shouldRender = false;
1442
- }
1443
- if (shouldRender) {
1444
- // Start new frame
1445
- this.beginFrame();
1446
- // Child canvases
1447
- if (!this._renderViews()) {
1448
- // Main frame
1449
- this._renderFrame();
1450
- }
1451
- // Present
1452
- this.endFrame();
1453
- }
1454
- }
1455
- // The first condition prevents queuing another frame if we no longer have active render loops (e.g., if
1456
- // `stopRenderLoop` is called mid frame). The second condition prevents queuing another frame if one has
1457
- // already been queued (e.g., if `stopRenderLoop` and `runRenderLoop` is called mid frame).
1458
- if (this._activeRenderLoops.length > 0 && this._frameHandler === 0) {
1459
- if (this.customAnimationFrameRequester) {
1460
- this.customAnimationFrameRequester.requestID = this._queueNewFrame(this.customAnimationFrameRequester.renderFunction || this._boundRenderFunction, this.customAnimationFrameRequester);
1461
- this._frameHandler = this.customAnimationFrameRequester.requestID;
1462
- }
1463
- else {
1464
- this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());
1465
- }
1466
- }
1467
- }
1468
- /**
1469
- * Enters Pointerlock mode
1470
- */
1471
- enterPointerlock() {
1472
- if (this._renderingCanvas) {
1473
- RequestPointerlock(this._renderingCanvas);
1474
- }
1475
- }
1476
- /**
1477
- * Exits Pointerlock mode
1478
- */
1479
- exitPointerlock() {
1480
- ExitPointerlock();
1481
- }
1482
- /**
1483
- * Begin a new frame
1484
- */
1485
- beginFrame() {
1486
- this._measureFps();
1487
- super.beginFrame();
1488
- }
1489
- _deletePipelineContext(pipelineContext) {
1490
- const webGLPipelineContext = pipelineContext;
1491
- if (webGLPipelineContext && webGLPipelineContext.program) {
1492
- if (webGLPipelineContext.transformFeedback) {
1493
- this.deleteTransformFeedback(webGLPipelineContext.transformFeedback);
1494
- webGLPipelineContext.transformFeedback = null;
1495
- }
1496
- }
1497
- super._deletePipelineContext(pipelineContext);
1498
- }
1499
- createShaderProgram(pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings = null) {
1500
- context = context || this._gl;
1501
- this.onBeforeShaderCompilationObservable.notifyObservers(this);
1502
- const program = super.createShaderProgram(pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings);
1503
- this.onAfterShaderCompilationObservable.notifyObservers(this);
1504
- return program;
1505
- }
1506
- _createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings = null) {
1507
- const shaderProgram = context.createProgram();
1508
- pipelineContext.program = shaderProgram;
1509
- if (!shaderProgram) {
1510
- throw new Error("Unable to create program");
1511
- }
1512
- context.attachShader(shaderProgram, vertexShader);
1513
- context.attachShader(shaderProgram, fragmentShader);
1514
- if (this.webGLVersion > 1 && transformFeedbackVaryings) {
1515
- const transformFeedback = this.createTransformFeedback();
1516
- this.bindTransformFeedback(transformFeedback);
1517
- this.setTranformFeedbackVaryings(shaderProgram, transformFeedbackVaryings);
1518
- pipelineContext.transformFeedback = transformFeedback;
1519
- }
1520
- context.linkProgram(shaderProgram);
1521
- if (this.webGLVersion > 1 && transformFeedbackVaryings) {
1522
- this.bindTransformFeedback(null);
1523
- }
1524
- pipelineContext.context = context;
1525
- pipelineContext.vertexShader = vertexShader;
1526
- pipelineContext.fragmentShader = fragmentShader;
1527
- if (!pipelineContext.isParallelCompiled) {
1528
- this._finalizePipelineContext(pipelineContext);
1529
- }
1530
- return shaderProgram;
1531
- }
1532
- /**
1533
- * @internal
1534
- */
1535
- _releaseTexture(texture) {
1536
- super._releaseTexture(texture);
1537
- }
1538
- /**
1539
- * @internal
1540
- */
1541
- _releaseRenderTargetWrapper(rtWrapper) {
1542
- super._releaseRenderTargetWrapper(rtWrapper);
1543
- // Set output texture of post process to null if the framebuffer has been released/disposed
1544
- this.scenes.forEach((scene) => {
1545
- scene.postProcesses.forEach((postProcess) => {
1546
- if (postProcess._outputTexture === rtWrapper) {
1547
- postProcess._outputTexture = null;
1548
- }
1549
- });
1550
- scene.cameras.forEach((camera) => {
1551
- camera._postProcesses.forEach((postProcess) => {
1552
- if (postProcess) {
1553
- if (postProcess._outputTexture === rtWrapper) {
1554
- postProcess._outputTexture = null;
1555
- }
1556
- }
1557
- });
1558
- });
1559
- });
1560
- }
1561
- /**
1562
- * @internal
1563
- * Rescales a texture
1564
- * @param source input texture
1565
- * @param destination destination texture
1566
- * @param scene scene to use to render the resize
1567
- * @param internalFormat format to use when resizing
1568
- * @param onComplete callback to be called when resize has completed
1569
- */
1570
- _rescaleTexture(source, destination, scene, internalFormat, onComplete) {
1571
- this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR);
1572
- this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR);
1573
- this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE);
1574
- this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE);
1575
- const rtt = this.createRenderTargetTexture({
1576
- width: destination.width,
1577
- height: destination.height,
1578
- }, {
1579
- generateMipMaps: false,
1580
- type: Constants.TEXTURETYPE_UNSIGNED_INT,
1581
- samplingMode: Constants.TEXTURE_BILINEAR_SAMPLINGMODE,
1582
- generateDepthBuffer: false,
1583
- generateStencilBuffer: false,
1584
- });
1585
- if (!this._rescalePostProcess && Engine._RescalePostProcessFactory) {
1586
- this._rescalePostProcess = Engine._RescalePostProcessFactory(this);
1587
- }
1588
- if (this._rescalePostProcess) {
1589
- this._rescalePostProcess.externalTextureSamplerBinding = true;
1590
- const onCompiled = () => {
1591
- this._rescalePostProcess.onApply = function (effect) {
1592
- effect._bindTexture("textureSampler", source);
1593
- };
1594
- let hostingScene = scene;
1595
- if (!hostingScene) {
1596
- hostingScene = this.scenes[this.scenes.length - 1];
1597
- }
1598
- hostingScene.postProcessManager.directRender([this._rescalePostProcess], rtt, true);
1599
- this._bindTextureDirectly(this._gl.TEXTURE_2D, destination, true);
1600
- this._gl.copyTexImage2D(this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);
1601
- this.unBindFramebuffer(rtt);
1602
- rtt.dispose();
1603
- if (onComplete) {
1604
- onComplete();
1605
- }
1606
- };
1607
- const effect = this._rescalePostProcess.getEffect();
1608
- if (effect) {
1609
- effect.executeWhenCompiled(onCompiled);
1610
- }
1611
- else {
1612
- this._rescalePostProcess.onEffectCreatedObservable.addOnce((effect) => {
1613
- effect.executeWhenCompiled(onCompiled);
1614
- });
1615
- }
1616
- }
1617
- }
1618
- /**
1619
- * Wraps an external web gl texture in a Babylon texture.
1620
- * @param texture defines the external texture
1621
- * @param hasMipMaps defines whether the external texture has mip maps (default: false)
1622
- * @param samplingMode defines the sampling mode for the external texture (default: Constants.TEXTURE_TRILINEAR_SAMPLINGMODE)
1623
- * @param width defines the width for the external texture (default: 0)
1624
- * @param height defines the height for the external texture (default: 0)
1625
- * @returns the babylon internal texture
1626
- */
1627
- wrapWebGLTexture(texture, hasMipMaps = false, samplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE, width = 0, height = 0) {
1628
- const hardwareTexture = new WebGLHardwareTexture(texture, this._gl);
1629
- const internalTexture = new InternalTexture(this, 0 /* InternalTextureSource.Unknown */, true);
1630
- internalTexture._hardwareTexture = hardwareTexture;
1631
- internalTexture.baseWidth = width;
1632
- internalTexture.baseHeight = height;
1633
- internalTexture.width = width;
1634
- internalTexture.height = height;
1635
- internalTexture.isReady = true;
1636
- internalTexture.useMipMaps = hasMipMaps;
1637
- this.updateTextureSamplingMode(samplingMode, internalTexture);
1638
- return internalTexture;
1639
- }
1640
- /**
1641
- * @internal
1642
- */
1643
- _uploadImageToTexture(texture, image, faceIndex = 0, lod = 0) {
1644
- const gl = this._gl;
1645
- const textureType = this._getWebGLTextureType(texture.type);
1646
- const format = this._getInternalFormat(texture.format);
1647
- const internalFormat = this._getRGBABufferInternalSizedFormat(texture.type, format);
1648
- const bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;
1649
- this._bindTextureDirectly(bindTarget, texture, true);
1650
- this._unpackFlipY(texture.invertY);
1651
- let target = gl.TEXTURE_2D;
1652
- if (texture.isCube) {
1653
- target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;
1654
- }
1655
- gl.texImage2D(target, lod, internalFormat, format, textureType, image);
1656
- this._bindTextureDirectly(bindTarget, null, true);
1657
- }
1658
- /**
1659
- * Updates a depth texture Comparison Mode and Function.
1660
- * If the comparison Function is equal to 0, the mode will be set to none.
1661
- * Otherwise, this only works in webgl 2 and requires a shadow sampler in the shader.
1662
- * @param texture The texture to set the comparison function for
1663
- * @param comparisonFunction The comparison function to set, 0 if no comparison required
1664
- */
1665
- updateTextureComparisonFunction(texture, comparisonFunction) {
1666
- if (this.webGLVersion === 1) {
1667
- Logger.Error("WebGL 1 does not support texture comparison.");
1668
- return;
1669
- }
1670
- const gl = this._gl;
1671
- if (texture.isCube) {
1672
- this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);
1673
- if (comparisonFunction === 0) {
1674
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, Constants.LEQUAL);
1675
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.NONE);
1676
- }
1677
- else {
1678
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);
1679
- gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);
1680
- }
1681
- this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
1682
- }
1683
- else {
1684
- this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);
1685
- if (comparisonFunction === 0) {
1686
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, Constants.LEQUAL);
1687
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.NONE);
1688
- }
1689
- else {
1690
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);
1691
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);
1692
- }
1693
- this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
1694
- }
1695
- texture._comparisonFunction = comparisonFunction;
1696
- }
1697
- /**
1698
- * Creates a webGL buffer to use with instantiation
1699
- * @param capacity defines the size of the buffer
1700
- * @returns the webGL buffer
1701
- */
1702
- createInstancesBuffer(capacity) {
1703
- const buffer = this._gl.createBuffer();
1704
- if (!buffer) {
1705
- throw new Error("Unable to create instance buffer");
1706
- }
1707
- const result = new WebGLDataBuffer(buffer);
1708
- result.capacity = capacity;
1709
- this.bindArrayBuffer(result);
1710
- this._gl.bufferData(this._gl.ARRAY_BUFFER, capacity, this._gl.DYNAMIC_DRAW);
1711
- result.references = 1;
1712
- return result;
1713
- }
1714
- /**
1715
- * Delete a webGL buffer used with instantiation
1716
- * @param buffer defines the webGL buffer to delete
1717
- */
1718
- deleteInstancesBuffer(buffer) {
1719
- this._gl.deleteBuffer(buffer);
1720
- }
1721
- _clientWaitAsync(sync, flags = 0, intervalms = 10) {
1722
- const gl = this._gl;
1723
- return new Promise((resolve, reject) => {
1724
- const check = () => {
1725
- const res = gl.clientWaitSync(sync, flags, 0);
1726
- if (res == gl.WAIT_FAILED) {
1727
- reject();
1728
- return;
1729
- }
1730
- if (res == gl.TIMEOUT_EXPIRED) {
1731
- setTimeout(check, intervalms);
1732
- return;
1733
- }
1734
- resolve();
1735
- };
1736
- check();
1737
- });
1738
- }
1739
- /**
1740
- * @internal
1741
- */
1742
- _readPixelsAsync(x, y, w, h, format, type, outputBuffer) {
1743
- if (this._webGLVersion < 2) {
1744
- throw new Error("_readPixelsAsync only work on WebGL2+");
1745
- }
1746
- const gl = this._gl;
1747
- const buf = gl.createBuffer();
1748
- gl.bindBuffer(gl.PIXEL_PACK_BUFFER, buf);
1749
- gl.bufferData(gl.PIXEL_PACK_BUFFER, outputBuffer.byteLength, gl.STREAM_READ);
1750
- gl.readPixels(x, y, w, h, format, type, 0);
1751
- gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
1752
- const sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
1753
- if (!sync) {
1754
- return null;
1755
- }
1756
- gl.flush();
1757
- return this._clientWaitAsync(sync, 0, 10).then(() => {
1758
- gl.deleteSync(sync);
1759
- gl.bindBuffer(gl.PIXEL_PACK_BUFFER, buf);
1760
- gl.getBufferSubData(gl.PIXEL_PACK_BUFFER, 0, outputBuffer);
1761
- gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
1762
- gl.deleteBuffer(buf);
1763
- return outputBuffer;
1764
- });
1765
- }
1766
- dispose() {
1767
- this.hideLoadingUI();
1768
- // Rescale PP
1769
- if (this._rescalePostProcess) {
1770
- this._rescalePostProcess.dispose();
1771
- }
1772
- _CommonDispose(this, this._renderingCanvas);
1773
- super.dispose();
1774
- }
1775
- }
1776
- // Const statics
1777
- /** Defines that alpha blending is disabled */
1778
- Engine.ALPHA_DISABLE = Constants.ALPHA_DISABLE;
1779
- /** Defines that alpha blending to SRC ALPHA * SRC + DEST */
1780
- Engine.ALPHA_ADD = Constants.ALPHA_ADD;
1781
- /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */
1782
- Engine.ALPHA_COMBINE = Constants.ALPHA_COMBINE;
1783
- /** Defines that alpha blending to DEST - SRC * DEST */
1784
- Engine.ALPHA_SUBTRACT = Constants.ALPHA_SUBTRACT;
1785
- /** Defines that alpha blending to SRC * DEST */
1786
- Engine.ALPHA_MULTIPLY = Constants.ALPHA_MULTIPLY;
1787
- /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */
1788
- Engine.ALPHA_MAXIMIZED = Constants.ALPHA_MAXIMIZED;
1789
- /** Defines that alpha blending to SRC + DEST */
1790
- Engine.ALPHA_ONEONE = Constants.ALPHA_ONEONE;
1791
- /** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */
1792
- Engine.ALPHA_PREMULTIPLIED = Constants.ALPHA_PREMULTIPLIED;
1793
- /**
1794
- * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST
1795
- * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA
1796
- */
1797
- Engine.ALPHA_PREMULTIPLIED_PORTERDUFF = Constants.ALPHA_PREMULTIPLIED_PORTERDUFF;
1798
- /** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */
1799
- Engine.ALPHA_INTERPOLATE = Constants.ALPHA_INTERPOLATE;
1800
- /**
1801
- * Defines that alpha blending to SRC + (1 - SRC) * DEST
1802
- * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA
1803
- */
1804
- Engine.ALPHA_SCREENMODE = Constants.ALPHA_SCREENMODE;
1805
- /** Defines that the resource is not delayed*/
1806
- Engine.DELAYLOADSTATE_NONE = Constants.DELAYLOADSTATE_NONE;
1807
- /** Defines that the resource was successfully delay loaded */
1808
- Engine.DELAYLOADSTATE_LOADED = Constants.DELAYLOADSTATE_LOADED;
1809
- /** Defines that the resource is currently delay loading */
1810
- Engine.DELAYLOADSTATE_LOADING = Constants.DELAYLOADSTATE_LOADING;
1811
- /** Defines that the resource is delayed and has not started loading */
1812
- Engine.DELAYLOADSTATE_NOTLOADED = Constants.DELAYLOADSTATE_NOTLOADED;
1813
- // Depht or Stencil test Constants.
1814
- /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */
1815
- Engine.NEVER = Constants.NEVER;
1816
- /** 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 */
1817
- Engine.ALWAYS = Constants.ALWAYS;
1818
- /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */
1819
- Engine.LESS = Constants.LESS;
1820
- /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */
1821
- Engine.EQUAL = Constants.EQUAL;
1822
- /** 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 */
1823
- Engine.LEQUAL = Constants.LEQUAL;
1824
- /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */
1825
- Engine.GREATER = Constants.GREATER;
1826
- /** 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 */
1827
- Engine.GEQUAL = Constants.GEQUAL;
1828
- /** 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 */
1829
- Engine.NOTEQUAL = Constants.NOTEQUAL;
1830
- // Stencil Actions Constants.
1831
- /** Passed to stencilOperation to specify that stencil value must be kept */
1832
- Engine.KEEP = Constants.KEEP;
1833
- /** Passed to stencilOperation to specify that stencil value must be replaced */
1834
- Engine.REPLACE = Constants.REPLACE;
1835
- /** Passed to stencilOperation to specify that stencil value must be incremented */
1836
- Engine.INCR = Constants.INCR;
1837
- /** Passed to stencilOperation to specify that stencil value must be decremented */
1838
- Engine.DECR = Constants.DECR;
1839
- /** Passed to stencilOperation to specify that stencil value must be inverted */
1840
- Engine.INVERT = Constants.INVERT;
1841
- /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */
1842
- Engine.INCR_WRAP = Constants.INCR_WRAP;
1843
- /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */
1844
- Engine.DECR_WRAP = Constants.DECR_WRAP;
1845
- /** Texture is not repeating outside of 0..1 UVs */
1846
- Engine.TEXTURE_CLAMP_ADDRESSMODE = Constants.TEXTURE_CLAMP_ADDRESSMODE;
1847
- /** Texture is repeating outside of 0..1 UVs */
1848
- Engine.TEXTURE_WRAP_ADDRESSMODE = Constants.TEXTURE_WRAP_ADDRESSMODE;
1849
- /** Texture is repeating and mirrored */
1850
- Engine.TEXTURE_MIRROR_ADDRESSMODE = Constants.TEXTURE_MIRROR_ADDRESSMODE;
1851
- /** ALPHA */
1852
- Engine.TEXTUREFORMAT_ALPHA = Constants.TEXTUREFORMAT_ALPHA;
1853
- /** LUMINANCE */
1854
- Engine.TEXTUREFORMAT_LUMINANCE = Constants.TEXTUREFORMAT_LUMINANCE;
1855
- /** LUMINANCE_ALPHA */
1856
- Engine.TEXTUREFORMAT_LUMINANCE_ALPHA = Constants.TEXTUREFORMAT_LUMINANCE_ALPHA;
1857
- /** RGB */
1858
- Engine.TEXTUREFORMAT_RGB = Constants.TEXTUREFORMAT_RGB;
1859
- /** RGBA */
1860
- Engine.TEXTUREFORMAT_RGBA = Constants.TEXTUREFORMAT_RGBA;
1861
- /** RED */
1862
- Engine.TEXTUREFORMAT_RED = Constants.TEXTUREFORMAT_RED;
1863
- /** RED (2nd reference) */
1864
- Engine.TEXTUREFORMAT_R = Constants.TEXTUREFORMAT_R;
1865
- /** RG */
1866
- Engine.TEXTUREFORMAT_RG = Constants.TEXTUREFORMAT_RG;
1867
- /** RED_INTEGER */
1868
- Engine.TEXTUREFORMAT_RED_INTEGER = Constants.TEXTUREFORMAT_RED_INTEGER;
1869
- /** RED_INTEGER (2nd reference) */
1870
- Engine.TEXTUREFORMAT_R_INTEGER = Constants.TEXTUREFORMAT_R_INTEGER;
1871
- /** RG_INTEGER */
1872
- Engine.TEXTUREFORMAT_RG_INTEGER = Constants.TEXTUREFORMAT_RG_INTEGER;
1873
- /** RGB_INTEGER */
1874
- Engine.TEXTUREFORMAT_RGB_INTEGER = Constants.TEXTUREFORMAT_RGB_INTEGER;
1875
- /** RGBA_INTEGER */
1876
- Engine.TEXTUREFORMAT_RGBA_INTEGER = Constants.TEXTUREFORMAT_RGBA_INTEGER;
1877
- /** UNSIGNED_BYTE */
1878
- Engine.TEXTURETYPE_UNSIGNED_BYTE = Constants.TEXTURETYPE_UNSIGNED_BYTE;
1879
- /** UNSIGNED_BYTE (2nd reference) */
1880
- Engine.TEXTURETYPE_UNSIGNED_INT = Constants.TEXTURETYPE_UNSIGNED_INT;
1881
- /** FLOAT */
1882
- Engine.TEXTURETYPE_FLOAT = Constants.TEXTURETYPE_FLOAT;
1883
- /** HALF_FLOAT */
1884
- Engine.TEXTURETYPE_HALF_FLOAT = Constants.TEXTURETYPE_HALF_FLOAT;
1885
- /** BYTE */
1886
- Engine.TEXTURETYPE_BYTE = Constants.TEXTURETYPE_BYTE;
1887
- /** SHORT */
1888
- Engine.TEXTURETYPE_SHORT = Constants.TEXTURETYPE_SHORT;
1889
- /** UNSIGNED_SHORT */
1890
- Engine.TEXTURETYPE_UNSIGNED_SHORT = Constants.TEXTURETYPE_UNSIGNED_SHORT;
1891
- /** INT */
1892
- Engine.TEXTURETYPE_INT = Constants.TEXTURETYPE_INT;
1893
- /** UNSIGNED_INT */
1894
- Engine.TEXTURETYPE_UNSIGNED_INTEGER = Constants.TEXTURETYPE_UNSIGNED_INTEGER;
1895
- /** UNSIGNED_SHORT_4_4_4_4 */
1896
- Engine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = Constants.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4;
1897
- /** UNSIGNED_SHORT_5_5_5_1 */
1898
- Engine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = Constants.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1;
1899
- /** UNSIGNED_SHORT_5_6_5 */
1900
- Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = Constants.TEXTURETYPE_UNSIGNED_SHORT_5_6_5;
1901
- /** UNSIGNED_INT_2_10_10_10_REV */
1902
- Engine.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = Constants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV;
1903
- /** UNSIGNED_INT_24_8 */
1904
- Engine.TEXTURETYPE_UNSIGNED_INT_24_8 = Constants.TEXTURETYPE_UNSIGNED_INT_24_8;
1905
- /** UNSIGNED_INT_10F_11F_11F_REV */
1906
- Engine.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = Constants.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV;
1907
- /** UNSIGNED_INT_5_9_9_9_REV */
1908
- Engine.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = Constants.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV;
1909
- /** FLOAT_32_UNSIGNED_INT_24_8_REV */
1910
- Engine.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = Constants.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV;
1911
- /** nearest is mag = nearest and min = nearest and mip = none */
1912
- Engine.TEXTURE_NEAREST_SAMPLINGMODE = Constants.TEXTURE_NEAREST_SAMPLINGMODE;
1913
- /** Bilinear is mag = linear and min = linear and mip = nearest */
1914
- Engine.TEXTURE_BILINEAR_SAMPLINGMODE = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;
1915
- /** Trilinear is mag = linear and min = linear and mip = linear */
1916
- Engine.TEXTURE_TRILINEAR_SAMPLINGMODE = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;
1917
- /** nearest is mag = nearest and min = nearest and mip = linear */
1918
- Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR = Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR;
1919
- /** Bilinear is mag = linear and min = linear and mip = nearest */
1920
- Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST = Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST;
1921
- /** Trilinear is mag = linear and min = linear and mip = linear */
1922
- Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR = Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR;
1923
- /** mag = nearest and min = nearest and mip = nearest */
1924
- Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST = Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST;
1925
- /** mag = nearest and min = linear and mip = nearest */
1926
- Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST = Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST;
1927
- /** mag = nearest and min = linear and mip = linear */
1928
- Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR = Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR;
1929
- /** mag = nearest and min = linear and mip = none */
1930
- Engine.TEXTURE_NEAREST_LINEAR = Constants.TEXTURE_NEAREST_LINEAR;
1931
- /** mag = nearest and min = nearest and mip = none */
1932
- Engine.TEXTURE_NEAREST_NEAREST = Constants.TEXTURE_NEAREST_NEAREST;
1933
- /** mag = linear and min = nearest and mip = nearest */
1934
- Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST = Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST;
1935
- /** mag = linear and min = nearest and mip = linear */
1936
- Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR = Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR;
1937
- /** mag = linear and min = linear and mip = none */
1938
- Engine.TEXTURE_LINEAR_LINEAR = Constants.TEXTURE_LINEAR_LINEAR;
1939
- /** mag = linear and min = nearest and mip = none */
1940
- Engine.TEXTURE_LINEAR_NEAREST = Constants.TEXTURE_LINEAR_NEAREST;
1941
- /** Explicit coordinates mode */
1942
- Engine.TEXTURE_EXPLICIT_MODE = Constants.TEXTURE_EXPLICIT_MODE;
1943
- /** Spherical coordinates mode */
1944
- Engine.TEXTURE_SPHERICAL_MODE = Constants.TEXTURE_SPHERICAL_MODE;
1945
- /** Planar coordinates mode */
1946
- Engine.TEXTURE_PLANAR_MODE = Constants.TEXTURE_PLANAR_MODE;
1947
- /** Cubic coordinates mode */
1948
- Engine.TEXTURE_CUBIC_MODE = Constants.TEXTURE_CUBIC_MODE;
1949
- /** Projection coordinates mode */
1950
- Engine.TEXTURE_PROJECTION_MODE = Constants.TEXTURE_PROJECTION_MODE;
1951
- /** Skybox coordinates mode */
1952
- Engine.TEXTURE_SKYBOX_MODE = Constants.TEXTURE_SKYBOX_MODE;
1953
- /** Inverse Cubic coordinates mode */
1954
- Engine.TEXTURE_INVCUBIC_MODE = Constants.TEXTURE_INVCUBIC_MODE;
1955
- /** Equirectangular coordinates mode */
1956
- Engine.TEXTURE_EQUIRECTANGULAR_MODE = Constants.TEXTURE_EQUIRECTANGULAR_MODE;
1957
- /** Equirectangular Fixed coordinates mode */
1958
- Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MODE;
1959
- /** Equirectangular Fixed Mirrored coordinates mode */
1960
- Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;
1961
- // Texture rescaling mode
1962
- /** Defines that texture rescaling will use a floor to find the closer power of 2 size */
1963
- Engine.SCALEMODE_FLOOR = Constants.SCALEMODE_FLOOR;
1964
- /** Defines that texture rescaling will look for the nearest power of 2 size */
1965
- Engine.SCALEMODE_NEAREST = Constants.SCALEMODE_NEAREST;
1966
- /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */
1967
- Engine.SCALEMODE_CEILING = Constants.SCALEMODE_CEILING;
1968
-
1969
- export { Engine };
1970
- //# sourceMappingURL=engine-2EdX14bK.esm.js.map