@babylonjs/viewer 7.35.2-alpha → 7.35.2

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