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