@fps-games/editor 0.2.1-beta.1 → 0.2.1-beta.3

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 (335) hide show
  1. package/dist/agent-bridge/capabilities/ui-regions.d.ts.map +1 -1
  2. package/dist/agent-bridge/capabilities/ui-regions.js +16 -0
  3. package/dist/agent-bridge/capabilities/ui-regions.js.map +1 -1
  4. package/dist/build-info.json +46 -46
  5. package/dist/internal/material-preview.d.ts +22 -0
  6. package/dist/internal/material-preview.d.ts.map +1 -0
  7. package/dist/internal/material-preview.js +186 -0
  8. package/dist/internal/material-preview.js.map +1 -0
  9. package/dist/internal/project-model-preview.d.ts +4 -0
  10. package/dist/internal/project-model-preview.d.ts.map +1 -0
  11. package/dist/internal/project-model-preview.js +359 -0
  12. package/dist/internal/project-model-preview.js.map +1 -0
  13. package/dist/local-editor-agent-context.d.ts +12 -1
  14. package/dist/local-editor-agent-context.d.ts.map +1 -1
  15. package/dist/local-editor-agent-context.js +47 -0
  16. package/dist/local-editor-agent-context.js.map +1 -1
  17. package/dist/local-editor-harness.d.ts +15 -2
  18. package/dist/local-editor-harness.d.ts.map +1 -1
  19. package/dist/local-editor-harness.js +326 -28
  20. package/dist/local-editor-harness.js.map +1 -1
  21. package/dist/local-editor-tools.d.ts +1 -0
  22. package/dist/local-editor-tools.d.ts.map +1 -1
  23. package/dist/local-editor-tools.js +3 -0
  24. package/dist/local-editor-tools.js.map +1 -1
  25. package/dist/playable-babylon-rendering.d.ts +8 -7
  26. package/dist/playable-babylon-rendering.d.ts.map +1 -1
  27. package/dist/playable-babylon-rendering.js +77 -32
  28. package/dist/playable-babylon-rendering.js.map +1 -1
  29. package/dist/playable-local-editor-host.d.ts +4 -0
  30. package/dist/playable-local-editor-host.d.ts.map +1 -1
  31. package/dist/playable-local-editor-host.js +27 -0
  32. package/dist/playable-local-editor-host.js.map +1 -1
  33. package/dist/playable-product-projection-preview.d.ts +2 -0
  34. package/dist/playable-product-projection-preview.d.ts.map +1 -1
  35. package/dist/playable-product-projection-preview.js +7 -4
  36. package/dist/playable-product-projection-preview.js.map +1 -1
  37. package/dist/playable-product-scene-capabilities.d.ts.map +1 -1
  38. package/dist/playable-product-scene-capabilities.js +9 -3
  39. package/dist/playable-product-scene-capabilities.js.map +1 -1
  40. package/dist/playable-sdk.d.ts +1 -1
  41. package/dist/playable-sdk.d.ts.map +1 -1
  42. package/dist/playable-sdk.js +1 -1
  43. package/dist/playable-sdk.js.map +1 -1
  44. package/dist/playable-standard-project.d.ts +0 -1
  45. package/dist/playable-standard-project.d.ts.map +1 -1
  46. package/dist/playable-standard-project.js +17 -5
  47. package/dist/playable-standard-project.js.map +1 -1
  48. package/node_modules/@fps-games/babylon-renderer/dist/environment/environment-texture-controller.d.ts +4 -2
  49. package/node_modules/@fps-games/babylon-renderer/dist/environment/environment-texture-controller.d.ts.map +1 -1
  50. package/node_modules/@fps-games/babylon-renderer/dist/environment/environment-texture-controller.js +301 -121
  51. package/node_modules/@fps-games/babylon-renderer/dist/environment/environment-texture-controller.js.map +1 -1
  52. package/node_modules/@fps-games/babylon-renderer/dist/environment/profile.js +5 -4
  53. package/node_modules/@fps-games/babylon-renderer/dist/environment/profile.js.map +1 -1
  54. package/node_modules/@fps-games/babylon-renderer/dist/environment/types.d.ts +4 -4
  55. package/node_modules/@fps-games/babylon-renderer/dist/environment/types.d.ts.map +1 -1
  56. package/node_modules/@fps-games/babylon-renderer/dist/environment/types.js +1 -1
  57. package/node_modules/@fps-games/babylon-renderer/dist/environment/types.js.map +1 -1
  58. package/node_modules/@fps-games/babylon-renderer/dist/game-world-plugin-lifecycle.d.ts +2 -0
  59. package/node_modules/@fps-games/babylon-renderer/dist/game-world-plugin-lifecycle.d.ts.map +1 -1
  60. package/node_modules/@fps-games/babylon-renderer/dist/game-world-plugin-lifecycle.js +12 -1
  61. package/node_modules/@fps-games/babylon-renderer/dist/game-world-plugin-lifecycle.js.map +1 -1
  62. package/node_modules/@fps-games/babylon-renderer/dist/plugin.d.ts +6 -3
  63. package/node_modules/@fps-games/babylon-renderer/dist/plugin.d.ts.map +1 -1
  64. package/node_modules/@fps-games/babylon-renderer/dist/plugin.js +100 -39
  65. package/node_modules/@fps-games/babylon-renderer/dist/plugin.js.map +1 -1
  66. package/node_modules/@fps-games/babylon-renderer/dist/reference.d.ts +1 -3
  67. package/node_modules/@fps-games/babylon-renderer/dist/reference.d.ts.map +1 -1
  68. package/node_modules/@fps-games/babylon-renderer/dist/reference.js.map +1 -1
  69. package/node_modules/@fps-games/babylon-renderer/package.json +11 -8
  70. package/node_modules/@fps-games/editor-babylon/dist/marker-overlay.js +24 -0
  71. package/node_modules/@fps-games/editor-babylon/dist/marker-overlay.js.map +1 -1
  72. package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts +10 -1
  73. package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts.map +1 -1
  74. package/node_modules/@fps-games/editor-babylon/dist/projection.js +96 -1
  75. package/node_modules/@fps-games/editor-babylon/dist/projection.js.map +1 -1
  76. package/node_modules/@fps-games/editor-babylon/dist/scene-view-spatial-overlay-controller.d.ts.map +1 -1
  77. package/node_modules/@fps-games/editor-babylon/dist/scene-view-spatial-overlay-controller.js +85 -22
  78. package/node_modules/@fps-games/editor-babylon/dist/scene-view-spatial-overlay-controller.js.map +1 -1
  79. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.d.ts +2 -0
  80. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.d.ts.map +1 -1
  81. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js +150 -4
  82. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js.map +1 -1
  83. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts +1 -0
  84. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts.map +1 -1
  85. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js +249 -15
  86. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js.map +1 -1
  87. package/node_modules/@fps-games/editor-babylon/dist/types.d.ts +1 -1
  88. package/node_modules/@fps-games/editor-babylon/dist/types.d.ts.map +1 -1
  89. package/node_modules/@fps-games/editor-babylon/dist/types.js.map +1 -1
  90. package/node_modules/@fps-games/editor-babylon/package.json +6 -6
  91. package/node_modules/@fps-games/editor-browser/dist/index.d.ts +5 -0
  92. package/node_modules/@fps-games/editor-browser/dist/index.d.ts.map +1 -1
  93. package/node_modules/@fps-games/editor-browser/dist/index.js +3 -0
  94. package/node_modules/@fps-games/editor-browser/dist/index.js.map +1 -1
  95. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.d.ts +35 -0
  96. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.d.ts.map +1 -0
  97. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.js +136 -0
  98. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.js.map +1 -0
  99. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.d.ts +46 -0
  100. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.d.ts.map +1 -0
  101. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.js +283 -0
  102. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.js.map +1 -0
  103. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.d.ts +12 -0
  104. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.d.ts.map +1 -0
  105. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.js +67 -0
  106. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.js.map +1 -0
  107. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.d.ts +6 -0
  108. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.d.ts.map +1 -0
  109. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.js +9 -0
  110. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.js.map +1 -0
  111. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.d.ts +7 -0
  112. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.d.ts.map +1 -0
  113. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.js +20 -0
  114. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.js.map +1 -0
  115. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.d.ts +9 -0
  116. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.d.ts.map +1 -0
  117. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.js +219 -0
  118. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.js.map +1 -0
  119. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.d.ts +14 -0
  120. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.d.ts.map +1 -0
  121. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.js +42 -0
  122. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.js.map +1 -0
  123. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.d.ts.map +1 -1
  124. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.js +2 -0
  125. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.js.map +1 -1
  126. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.d.ts +27 -0
  127. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.d.ts.map +1 -0
  128. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.js +288 -0
  129. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.js.map +1 -0
  130. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.d.ts +1 -1
  131. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.d.ts.map +1 -1
  132. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.js +29 -0
  133. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.js.map +1 -1
  134. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts +20 -1
  135. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts.map +1 -1
  136. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js +321 -60
  137. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js.map +1 -1
  138. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.d.ts +2 -1
  139. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.d.ts.map +1 -1
  140. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js +4 -2
  141. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js.map +1 -1
  142. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts +63 -3
  143. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts.map +1 -1
  144. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.js.map +1 -1
  145. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts +9 -0
  146. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts.map +1 -1
  147. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js +88 -16
  148. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js.map +1 -1
  149. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts +2 -1
  150. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts.map +1 -1
  151. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js +1463 -356
  152. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js.map +1 -1
  153. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.d.ts +13 -0
  154. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.d.ts.map +1 -0
  155. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.js +15 -0
  156. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.js.map +1 -0
  157. package/node_modules/@fps-games/editor-browser/package.json +7 -7
  158. package/node_modules/@fps-games/editor-core/dist/editor-tools.d.ts +1 -0
  159. package/node_modules/@fps-games/editor-core/dist/editor-tools.d.ts.map +1 -1
  160. package/node_modules/@fps-games/editor-core/dist/editor-tools.js +3 -1
  161. package/node_modules/@fps-games/editor-core/dist/editor-tools.js.map +1 -1
  162. package/node_modules/@fps-games/editor-core/dist/viewport-tools.d.ts +11 -2
  163. package/node_modules/@fps-games/editor-core/dist/viewport-tools.d.ts.map +1 -1
  164. package/node_modules/@fps-games/editor-core/dist/viewport-tools.js +12 -1
  165. package/node_modules/@fps-games/editor-core/dist/viewport-tools.js.map +1 -1
  166. package/node_modules/@fps-games/editor-core/package.json +6 -6
  167. package/node_modules/@fps-games/editor-forge-play/package.json +2 -2
  168. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/generated-module.d.ts.map +1 -1
  169. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/generated-module.js +10 -3
  170. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/generated-module.js.map +1 -1
  171. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/index.d.ts +2 -1
  172. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/index.d.ts.map +1 -1
  173. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/index.js +1 -1
  174. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/index.js.map +1 -1
  175. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.d.ts +1 -0
  176. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.d.ts.map +1 -1
  177. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.js +5 -0
  178. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.js.map +1 -1
  179. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.d.ts +1 -1
  180. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.d.ts.map +1 -1
  181. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.js +1 -1
  182. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.js.map +1 -1
  183. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/handler.d.ts.map +1 -1
  184. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/handler.js +15 -1
  185. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/handler.js.map +1 -1
  186. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/routes.d.ts.map +1 -1
  187. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/routes.js +3 -0
  188. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/routes.js.map +1 -1
  189. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/types.d.ts +6 -1
  190. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/types.d.ts.map +1 -1
  191. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/types.js.map +1 -1
  192. package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts +1 -0
  193. package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts.map +1 -1
  194. package/node_modules/@fps-games/editor-playable-sdk/dist/index.js +1 -0
  195. package/node_modules/@fps-games/editor-playable-sdk/dist/index.js.map +1 -1
  196. package/node_modules/@fps-games/editor-playable-sdk/dist/package-resolution/aliases.d.ts +1 -1
  197. package/node_modules/@fps-games/editor-playable-sdk/dist/package-resolution/aliases.d.ts.map +1 -1
  198. package/node_modules/@fps-games/editor-playable-sdk/dist/package-resolution/aliases.js +4 -0
  199. package/node_modules/@fps-games/editor-playable-sdk/dist/package-resolution/aliases.js.map +1 -1
  200. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.d.ts +4 -0
  201. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.d.ts.map +1 -1
  202. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.js +10 -1
  203. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.js.map +1 -1
  204. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.d.ts +4 -0
  205. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.d.ts.map +1 -0
  206. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.js +4 -0
  207. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.js.map +1 -0
  208. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.d.ts +4 -0
  209. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.d.ts.map +1 -0
  210. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.js +86 -0
  211. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.js.map +1 -0
  212. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.d.ts +9 -0
  213. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.d.ts.map +1 -0
  214. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.js +76 -0
  215. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.js.map +1 -0
  216. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.d.ts +34 -0
  217. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.d.ts.map +1 -0
  218. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.js +2 -0
  219. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.js.map +1 -0
  220. package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/panel.js +4 -4
  221. package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/panel.js.map +1 -1
  222. package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/types.d.ts +2 -1
  223. package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/types.d.ts.map +1 -1
  224. package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/types.js.map +1 -1
  225. package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/assets.js +1 -5
  226. package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/assets.js.map +1 -1
  227. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.d.ts +4 -0
  228. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.d.ts.map +1 -1
  229. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js +40 -0
  230. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js.map +1 -1
  231. package/node_modules/@fps-games/editor-playable-sdk/dist/upgrade-doctor/inspectors.js +53 -0
  232. package/node_modules/@fps-games/editor-playable-sdk/dist/upgrade-doctor/inspectors.js.map +1 -1
  233. package/node_modules/@fps-games/editor-playable-sdk/dist/upgrade-doctor/types.d.ts +2 -0
  234. package/node_modules/@fps-games/editor-playable-sdk/dist/upgrade-doctor/types.d.ts.map +1 -1
  235. package/node_modules/@fps-games/editor-playable-sdk/dist/upgrade-doctor/types.js.map +1 -1
  236. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts +1 -0
  237. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts.map +1 -1
  238. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js +1 -0
  239. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js.map +1 -1
  240. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.d.ts +1 -0
  241. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.d.ts.map +1 -1
  242. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js +94 -0
  243. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js.map +1 -1
  244. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.d.ts +14 -0
  245. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.d.ts.map +1 -0
  246. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.js +101 -0
  247. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.js.map +1 -0
  248. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.d.ts +23 -0
  249. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.d.ts.map +1 -0
  250. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.js +180 -0
  251. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.js.map +1 -0
  252. package/node_modules/@fps-games/editor-playable-sdk/package.json +6 -6
  253. package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts +23 -3
  254. package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts.map +1 -1
  255. package/node_modules/@fps-games/editor-protocol/dist/agent.js.map +1 -1
  256. package/node_modules/@fps-games/editor-protocol/package.json +2 -2
  257. package/node_modules/@fps-games/editor-tooling/package.json +3 -3
  258. package/node_modules/@fps-games/editor-ui/dist/editor-ui-theme.d.ts.map +1 -1
  259. package/node_modules/@fps-games/editor-ui/dist/editor-ui-theme.js +103 -10
  260. package/node_modules/@fps-games/editor-ui/dist/editor-ui-theme.js.map +1 -1
  261. package/node_modules/@fps-games/editor-ui/package.json +1 -1
  262. package/node_modules/@fps-games/playable-assets/dist/identity.d.ts +1 -0
  263. package/node_modules/@fps-games/playable-assets/dist/identity.d.ts.map +1 -1
  264. package/node_modules/@fps-games/playable-assets/dist/identity.js +1 -1
  265. package/node_modules/@fps-games/playable-assets/dist/identity.js.map +1 -1
  266. package/node_modules/@fps-games/playable-assets/dist/index.d.ts +1 -0
  267. package/node_modules/@fps-games/playable-assets/dist/index.d.ts.map +1 -1
  268. package/node_modules/@fps-games/playable-assets/dist/index.js +1 -0
  269. package/node_modules/@fps-games/playable-assets/dist/index.js.map +1 -1
  270. package/node_modules/@fps-games/playable-assets/dist/resource-resolver.d.ts +46 -0
  271. package/node_modules/@fps-games/playable-assets/dist/resource-resolver.d.ts.map +1 -0
  272. package/node_modules/@fps-games/playable-assets/dist/resource-resolver.js +109 -0
  273. package/node_modules/@fps-games/playable-assets/dist/resource-resolver.js.map +1 -0
  274. package/node_modules/@fps-games/playable-assets/package.json +1 -1
  275. package/node_modules/@fps-games/playable-contracts/package.json +1 -1
  276. package/node_modules/@fps-games/playable-rendering/package.json +2 -2
  277. package/node_modules/@fps-games/playable-runtime/dist/runtime.d.ts.map +1 -1
  278. package/node_modules/@fps-games/playable-runtime/dist/runtime.js +5 -0
  279. package/node_modules/@fps-games/playable-runtime/dist/runtime.js.map +1 -1
  280. package/node_modules/@fps-games/playable-runtime/dist/types.d.ts +2 -0
  281. package/node_modules/@fps-games/playable-runtime/dist/types.d.ts.map +1 -1
  282. package/node_modules/@fps-games/playable-runtime/dist/types.js.map +1 -1
  283. package/node_modules/@fps-games/playable-runtime/package.json +12 -12
  284. package/node_modules/@fps-games/playable-runtime-data/package.json +4 -4
  285. package/node_modules/@fps-games/playable-scene/package.json +2 -2
  286. package/node_modules/@fps-games/plugin-api/package.json +1 -1
  287. package/node_modules/@fps-games/plugin-assets/dist/reference.d.ts.map +1 -1
  288. package/node_modules/@fps-games/plugin-assets/dist/reference.js +11 -4
  289. package/node_modules/@fps-games/plugin-assets/dist/reference.js.map +1 -1
  290. package/node_modules/@fps-games/plugin-assets/dist/renderer.d.ts +8 -0
  291. package/node_modules/@fps-games/plugin-assets/dist/renderer.d.ts.map +1 -0
  292. package/node_modules/@fps-games/plugin-assets/dist/renderer.js +13 -0
  293. package/node_modules/@fps-games/plugin-assets/dist/renderer.js.map +1 -0
  294. package/node_modules/@fps-games/plugin-assets/dist/resources.d.ts +12 -0
  295. package/node_modules/@fps-games/plugin-assets/dist/resources.d.ts.map +1 -0
  296. package/node_modules/@fps-games/plugin-assets/dist/resources.js +8 -0
  297. package/node_modules/@fps-games/plugin-assets/dist/resources.js.map +1 -0
  298. package/node_modules/@fps-games/plugin-assets/dist/runtime.d.ts +2 -1
  299. package/node_modules/@fps-games/plugin-assets/dist/runtime.d.ts.map +1 -1
  300. package/node_modules/@fps-games/plugin-assets/dist/runtime.js +3 -0
  301. package/node_modules/@fps-games/plugin-assets/dist/runtime.js.map +1 -1
  302. package/node_modules/@fps-games/plugin-assets/dist/version.d.ts +1 -1
  303. package/node_modules/@fps-games/plugin-assets/dist/version.js +1 -1
  304. package/node_modules/@fps-games/plugin-assets/dist/version.js.map +1 -1
  305. package/node_modules/@fps-games/plugin-assets/package.json +32 -8
  306. package/node_modules/@fps-games/plugin-hierarchy/dist/version.d.ts +1 -1
  307. package/node_modules/@fps-games/plugin-hierarchy/dist/version.js +1 -1
  308. package/node_modules/@fps-games/plugin-hierarchy/dist/version.js.map +1 -1
  309. package/node_modules/@fps-games/plugin-hierarchy/package.json +5 -5
  310. package/node_modules/@fps-games/plugin-host/package.json +2 -2
  311. package/node_modules/@fps-games/plugin-markers/dist/version.d.ts +1 -1
  312. package/node_modules/@fps-games/plugin-markers/dist/version.js +1 -1
  313. package/node_modules/@fps-games/plugin-markers/dist/version.js.map +1 -1
  314. package/node_modules/@fps-games/plugin-markers/package.json +5 -5
  315. package/node_modules/@fps-games/plugin-materials/dist/version.d.ts +1 -1
  316. package/node_modules/@fps-games/plugin-materials/dist/version.js +1 -1
  317. package/node_modules/@fps-games/plugin-materials/dist/version.js.map +1 -1
  318. package/node_modules/@fps-games/plugin-materials/package.json +5 -5
  319. package/node_modules/@fps-games/plugin-rendering/dist/version.d.ts +1 -1
  320. package/node_modules/@fps-games/plugin-rendering/dist/version.js +1 -1
  321. package/node_modules/@fps-games/plugin-rendering/dist/version.js.map +1 -1
  322. package/node_modules/@fps-games/plugin-rendering/package.json +5 -5
  323. package/node_modules/@fps-games/plugin-scene/dist/version.d.ts +1 -1
  324. package/node_modules/@fps-games/plugin-scene/dist/version.js +1 -1
  325. package/node_modules/@fps-games/plugin-scene/dist/version.js.map +1 -1
  326. package/node_modules/@fps-games/plugin-scene/package.json +5 -5
  327. package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.d.ts +1 -1
  328. package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js +1 -1
  329. package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js.map +1 -1
  330. package/node_modules/@fps-games/plugin-shadow-map-experiment/package.json +5 -5
  331. package/node_modules/@fps-games/plugin-shadows/dist/version.d.ts +1 -1
  332. package/node_modules/@fps-games/plugin-shadows/dist/version.js +1 -1
  333. package/node_modules/@fps-games/plugin-shadows/dist/version.js.map +1 -1
  334. package/node_modules/@fps-games/plugin-shadows/package.json +7 -7
  335. package/package.json +24 -22
@@ -1,79 +1,150 @@
1
1
  import { CubeTexture } from '@babylonjs/core/Materials/Textures/cubeTexture.js';
2
+ import { _ENVTextureLoader } from '@babylonjs/core/Materials/Textures/Loaders/envTextureLoader.js';
3
+ import { registerTextureLoader } from '@babylonjs/core/Materials/Textures/Loaders/textureLoaderManager.js';
2
4
  import {} from './types.js';
3
5
  import { normalizeBabylonEnvironmentTextureProfile } from './profile.js';
4
- export function createBabylonEnvironmentTextureController(scene, initialProfile, options = {}) {
5
- return new BabylonEnvironmentTextureControllerImpl(scene, initialProfile ?? null, options.createTexture ?? createDefaultEnvironmentTexture);
6
+ // Register the framework default during module initialization so single-file
7
+ // bundlers cannot remove Babylon's dynamic .env loader discovery. Applications
8
+ // remain free to register their own .env loader after importing the renderer.
9
+ registerTextureLoader('.env', async () => new _ENVTextureLoader());
10
+ export function readBabylonEnvironmentTextureControllerCleanup(error) {
11
+ if (!error || (typeof error !== 'object' && typeof error !== 'function'))
12
+ return null;
13
+ const cleanup = error
14
+ .babylonEnvironmentTextureControllerCleanup;
15
+ return typeof cleanup === 'function'
16
+ ? cleanup
17
+ : null;
18
+ }
19
+ export function createBabylonEnvironmentTextureController(scene, options = {}) {
20
+ return new BabylonEnvironmentTextureControllerImpl(scene, options.createTexture ?? createDefaultEnvironmentTexture);
6
21
  }
7
22
  class BabylonEnvironmentTextureControllerImpl {
8
- constructor(scene, initialProfile, createTexture) {
23
+ constructor(scene, createTexture) {
9
24
  this.scene = scene;
10
25
  this.createTexture = createTexture;
11
26
  this.profile = null;
12
27
  this.texture = null;
13
- this.textureUrl = '';
14
- this.setProfile(initialProfile);
15
- }
16
- setProfile(profile) {
17
- if (!profile) {
18
- this.clearEnvironmentTexture();
19
- this.profile = null;
20
- return;
21
- }
22
- const nextProfile = normalizeBabylonEnvironmentTextureProfile(profile);
23
- if (!nextProfile.textureUrl) {
24
- this.clearEnvironmentTexture();
25
- this.profile = nextProfile;
26
- this.scene.environmentIntensity = nextProfile.intensity;
27
- return;
28
- }
29
- if (!this.texture || this.textureUrl !== nextProfile.textureUrl) {
30
- const previousTexture = this.texture;
31
- const nextTexture = this.createEnvironmentTexture(nextProfile.textureUrl);
32
- this.texture = nextTexture;
33
- this.textureUrl = nextProfile.textureUrl;
34
- this.scene.environmentTexture = nextTexture;
35
- previousTexture?.dispose();
36
- }
37
- this.profile = nextProfile;
38
- this.scene.environmentIntensity = nextProfile.intensity;
39
- if (this.texture) {
40
- this.texture.level = nextProfile.intensity;
41
- this.texture.rotationY = nextProfile.rotationY;
42
- if (this.scene.environmentTexture !== this.texture) {
43
- this.scene.environmentTexture = this.texture;
28
+ this.resource = null;
29
+ this.generation = 0;
30
+ this.pendingAbort = null;
31
+ this.retainedCleanupTextures = new Set();
32
+ this.pendingSceneClearTexture = null;
33
+ this.disposeRequested = false;
34
+ this.disposed = false;
35
+ this.retryCleanup = () => {
36
+ const cleanupErrors = [];
37
+ const pendingSceneTexture = this.pendingSceneClearTexture;
38
+ if (pendingSceneTexture) {
39
+ try {
40
+ if (this.scene.environmentTexture === pendingSceneTexture) {
41
+ this.scene.environmentTexture = null;
42
+ }
43
+ this.pendingSceneClearTexture = null;
44
+ }
45
+ catch (error) {
46
+ cleanupErrors.push(sanitizeCause(error));
47
+ }
44
48
  }
45
- }
49
+ for (const texture of [...this.retainedCleanupTextures]) {
50
+ try {
51
+ texture.dispose();
52
+ this.retainedCleanupTextures.delete(texture);
53
+ }
54
+ catch (error) {
55
+ cleanupErrors.push(sanitizeCause(error));
56
+ }
57
+ }
58
+ return Object.freeze(cleanupErrors);
59
+ };
46
60
  }
47
- async setProfileAsync(profile, signal) {
61
+ async applyProfile(profile, signal) {
62
+ this.assertNotDisposed();
48
63
  if (signal?.aborted)
49
64
  throw createEnvironmentTextureAbortError();
50
- if (!profile) {
51
- this.setProfile(profile);
52
- return;
53
- }
54
- const nextProfile = normalizeBabylonEnvironmentTextureProfile(profile);
55
- if (!nextProfile.textureUrl || (this.texture && this.textureUrl === nextProfile.textureUrl)) {
56
- this.setProfile(nextProfile);
57
- return;
58
- }
59
- const nextTexture = await this.createEnvironmentTextureAsync(nextProfile.textureUrl, signal);
60
- if (signal?.aborted) {
61
- throwCandidateTextureFailure(nextTexture, createEnvironmentTextureAbortError());
65
+ const retainedCleanupErrors = this.retryCleanup();
66
+ if (retainedCleanupErrors.length > 0) {
67
+ throw createEnvironmentTextureCleanupFailure(retainedCleanupErrors, this.retryCleanup);
62
68
  }
69
+ const generation = ++this.generation;
70
+ this.pendingAbort?.abort();
71
+ const candidateAbort = new AbortController();
72
+ this.pendingAbort = candidateAbort;
73
+ const removeSignalListener = forwardAbort(signal, candidateAbort);
74
+ const isCurrent = () => !this.disposed && this.generation === generation && !candidateAbort.signal.aborted;
63
75
  try {
64
- nextTexture.level = nextProfile.intensity;
65
- nextTexture.rotationY = nextProfile.rotationY;
76
+ const nextProfile = profile ? normalizeBabylonEnvironmentTextureProfile(profile) : null;
77
+ if (!nextProfile?.texture) {
78
+ if (!isCurrent())
79
+ throw createEnvironmentTextureAbortError();
80
+ const previousTexture = this.texture;
81
+ const previousSceneTexture = this.scene.environmentTexture;
82
+ const sceneWithIntensity = this.scene;
83
+ const previousIntensity = sceneWithIntensity.environmentIntensity;
84
+ try {
85
+ if (previousTexture && previousSceneTexture === previousTexture) {
86
+ this.scene.environmentTexture = null;
87
+ }
88
+ if (nextProfile)
89
+ sceneWithIntensity.environmentIntensity = nextProfile.intensity;
90
+ }
91
+ catch (error) {
92
+ restoreSceneState(this.scene, previousSceneTexture, previousIntensity);
93
+ throw createSafeEnvironmentTextureError('babylon.environment-texture.profile-failed', 'Failed to apply Babylon environment texture profile.', error);
94
+ }
95
+ this.texture = null;
96
+ this.resource = null;
97
+ this.profile = nextProfile;
98
+ const cleanupError = this.disposeTextureOrRetain(previousTexture);
99
+ if (cleanupError) {
100
+ throw createEnvironmentTextureCleanupFailure([cleanupError], this.retryCleanup);
101
+ }
102
+ return;
103
+ }
104
+ if (this.texture && sameResource(this.resource, nextProfile.texture)) {
105
+ if (!isCurrent())
106
+ throw createEnvironmentTextureAbortError();
107
+ this.applyCommittedTextureProfile(this.texture, nextProfile);
108
+ this.profile = nextProfile;
109
+ this.resource = nextProfile.texture;
110
+ return;
111
+ }
112
+ const candidate = await this.createEnvironmentTextureAsync(nextProfile.texture, candidateAbort.signal);
113
+ if (!isCurrent())
114
+ this.throwCandidateTextureFailure(candidate, createEnvironmentTextureAbortError());
115
+ try {
116
+ applyCandidateTextureProperties(candidate, nextProfile);
117
+ }
118
+ catch (error) {
119
+ this.throwCandidateTextureFailure(candidate, createSafeEnvironmentTextureError('babylon.environment-texture.profile-failed', 'Failed to apply Babylon environment texture profile.', error));
120
+ }
121
+ if (!isCurrent())
122
+ this.throwCandidateTextureFailure(candidate, createEnvironmentTextureAbortError());
123
+ const previousTexture = this.texture;
124
+ const previousSceneTexture = this.scene.environmentTexture;
125
+ const sceneWithIntensity = this.scene;
126
+ const previousIntensity = sceneWithIntensity.environmentIntensity;
127
+ try {
128
+ this.scene.environmentTexture = candidate;
129
+ sceneWithIntensity.environmentIntensity = nextProfile.intensity;
130
+ }
131
+ catch (error) {
132
+ restoreSceneState(this.scene, previousSceneTexture, previousIntensity);
133
+ this.throwCandidateTextureFailure(candidate, createSafeEnvironmentTextureError('babylon.environment-texture.profile-failed', 'Failed to apply Babylon environment texture profile.', error));
134
+ }
135
+ this.texture = candidate;
136
+ this.resource = nextProfile.texture;
137
+ this.profile = nextProfile;
138
+ const cleanupError = this.disposeTextureOrRetain(previousTexture);
139
+ if (cleanupError) {
140
+ throw createEnvironmentTextureCleanupFailure([cleanupError], this.retryCleanup);
141
+ }
66
142
  }
67
- catch (cause) {
68
- throwCandidateTextureFailure(nextTexture, cause);
143
+ finally {
144
+ removeSignalListener();
145
+ if (this.pendingAbort === candidateAbort)
146
+ this.pendingAbort = null;
69
147
  }
70
- const previousTexture = this.texture;
71
- this.texture = nextTexture;
72
- this.textureUrl = nextProfile.textureUrl;
73
- this.profile = nextProfile;
74
- this.scene.environmentTexture = nextTexture;
75
- this.scene.environmentIntensity = nextProfile.intensity;
76
- previousTexture?.dispose();
77
148
  }
78
149
  getProfile() {
79
150
  return this.profile ? { ...this.profile } : null;
@@ -82,107 +153,216 @@ class BabylonEnvironmentTextureControllerImpl {
82
153
  return this.texture;
83
154
  }
84
155
  dispose() {
85
- this.clearEnvironmentTexture();
86
- this.profile = null;
87
- }
88
- clearEnvironmentTexture() {
89
- if (this.texture && this.scene.environmentTexture === this.texture) {
90
- this.scene.environmentTexture = null;
156
+ if (this.disposed)
157
+ return;
158
+ if (!this.disposeRequested) {
159
+ this.disposeRequested = true;
160
+ this.generation += 1;
161
+ this.pendingAbort?.abort();
162
+ this.pendingAbort = null;
163
+ const texture = this.texture;
164
+ if (texture) {
165
+ this.retainedCleanupTextures.add(texture);
166
+ if (this.scene.environmentTexture === texture) {
167
+ this.pendingSceneClearTexture = texture;
168
+ }
169
+ }
170
+ this.texture = null;
171
+ this.resource = null;
172
+ this.profile = null;
91
173
  }
92
- this.texture?.dispose();
93
- this.texture = null;
94
- this.textureUrl = '';
174
+ const cleanupErrors = this.retryCleanup();
175
+ if (cleanupErrors.length > 0) {
176
+ throw createEnvironmentTextureCleanupFailure(cleanupErrors, this.retryCleanup);
177
+ }
178
+ this.disposed = true;
95
179
  }
96
- createEnvironmentTexture(textureUrl) {
180
+ applyCommittedTextureProfile(texture, profile) {
181
+ const textureWithRotation = texture;
182
+ const sceneWithIntensity = this.scene;
183
+ const previousLevel = texture.level;
184
+ const previousRotation = textureWithRotation.rotationY;
185
+ const previousSceneTexture = this.scene.environmentTexture;
186
+ const previousIntensity = sceneWithIntensity.environmentIntensity;
97
187
  try {
98
- const texture = this.createTexture(textureUrl, this.scene);
99
- return texture;
188
+ applyCandidateTextureProperties(texture, profile);
189
+ if (previousSceneTexture !== texture)
190
+ this.scene.environmentTexture = texture;
191
+ sceneWithIntensity.environmentIntensity = profile.intensity;
100
192
  }
101
- catch (cause) {
102
- throw Object.assign(new Error(`Failed to create Babylon environment texture: ${textureUrl}`), { cause });
193
+ catch (error) {
194
+ restoreTextureProperties(texture, previousLevel, previousRotation);
195
+ restoreSceneState(this.scene, previousSceneTexture, previousIntensity);
196
+ throw createSafeEnvironmentTextureError('babylon.environment-texture.profile-failed', 'Failed to apply Babylon environment texture profile.', error);
103
197
  }
104
198
  }
105
- async createEnvironmentTextureAsync(textureUrl, signal) {
199
+ createEnvironmentTextureAsync(resource, signal) {
106
200
  return new Promise((resolve, reject) => {
201
+ if (signal.aborted) {
202
+ reject(createEnvironmentTextureAbortError());
203
+ return;
204
+ }
107
205
  let settled = false;
108
206
  let texture = null;
109
207
  let loaded = false;
110
- let pendingError = null;
111
- const removeAbortListener = () => signal?.removeEventListener('abort', abort);
112
- const fail = (message, exception) => {
208
+ let pendingFailure = null;
209
+ const settleFailure = (failure) => {
113
210
  if (settled)
114
211
  return;
115
212
  if (!texture) {
116
- pendingError = { message, exception };
213
+ pendingFailure = failure;
117
214
  return;
118
215
  }
119
216
  settled = true;
120
- removeAbortListener();
121
- let cleanupError;
122
- try {
123
- texture.dispose();
124
- }
125
- catch (error) {
126
- cleanupError = error;
127
- }
128
- reject(Object.assign(new Error(message || `Failed to load Babylon environment texture: ${textureUrl}`), { cause: exception, ...(cleanupError === undefined ? {} : { cleanupError }) }));
217
+ signal.removeEventListener('abort', abort);
218
+ const cleanupError = this.disposeTextureOrRetain(texture);
219
+ reject(withCleanupError(failure, cleanupError, this.retryCleanup));
129
220
  };
130
221
  const complete = () => {
131
- if (settled)
132
- return;
133
- loaded = true;
134
- if (!texture)
222
+ if (settled || !texture) {
223
+ loaded = true;
135
224
  return;
225
+ }
136
226
  settled = true;
137
- removeAbortListener();
227
+ signal.removeEventListener('abort', abort);
138
228
  resolve(texture);
139
229
  };
140
- const abort = () => fail('Babylon environment texture load aborted.', createEnvironmentTextureAbortError());
141
- signal?.addEventListener('abort', abort, { once: true });
230
+ const abort = () => settleFailure(createEnvironmentTextureAbortError());
231
+ const fail = (_message, exception) => {
232
+ settleFailure(createSafeEnvironmentTextureError('babylon.environment-texture.load-failed', 'Failed to load Babylon environment texture.', exception));
233
+ };
234
+ signal.addEventListener('abort', abort, { once: true });
142
235
  try {
143
- texture = this.createTexture(textureUrl, this.scene, {
144
- onLoad: complete,
145
- onError: fail,
146
- });
236
+ texture = this.createTexture(resource, this.scene, { onLoad: complete, onError: fail });
147
237
  }
148
- catch (cause) {
238
+ catch (error) {
149
239
  settled = true;
150
- removeAbortListener();
151
- reject(Object.assign(new Error(`Failed to create Babylon environment texture: ${textureUrl}`), { cause }));
240
+ signal.removeEventListener('abort', abort);
241
+ reject(createSafeEnvironmentTextureError('babylon.environment-texture.create-failed', 'Failed to create Babylon environment texture.', error));
152
242
  return;
153
243
  }
154
- const synchronousError = pendingError;
155
- if (synchronousError) {
156
- fail(synchronousError.message, synchronousError.exception);
157
- }
158
- else if (loaded || texture.isReady()) {
244
+ if (pendingFailure)
245
+ settleFailure(pendingFailure);
246
+ else if (loaded || texture.isReady())
159
247
  complete();
160
- }
161
248
  });
162
249
  }
250
+ assertNotDisposed() {
251
+ if (this.disposed || this.disposeRequested) {
252
+ throw new Error('Babylon environment texture controller is disposed.');
253
+ }
254
+ }
255
+ disposeTextureOrRetain(texture) {
256
+ if (!texture)
257
+ return null;
258
+ this.retainedCleanupTextures.add(texture);
259
+ try {
260
+ texture.dispose();
261
+ this.retainedCleanupTextures.delete(texture);
262
+ return null;
263
+ }
264
+ catch (error) {
265
+ return sanitizeCause(error);
266
+ }
267
+ }
268
+ throwCandidateTextureFailure(texture, failure) {
269
+ const cleanupError = this.disposeTextureOrRetain(texture);
270
+ throw withCleanupError(failure, cleanupError, this.retryCleanup);
271
+ }
272
+ }
273
+ function applyCandidateTextureProperties(texture, profile) {
274
+ texture.level = profile.intensity;
275
+ texture.rotationY = profile.rotationY;
276
+ }
277
+ function restoreTextureProperties(texture, level, rotationY) {
278
+ try {
279
+ texture.level = level;
280
+ }
281
+ catch {
282
+ // Best-effort rollback keeps the original operation error as the public diagnostic.
283
+ }
284
+ try {
285
+ texture.rotationY = rotationY;
286
+ }
287
+ catch {
288
+ // Best-effort rollback keeps the original operation error as the public diagnostic.
289
+ }
290
+ }
291
+ function restoreSceneState(scene, environmentTexture, environmentIntensity) {
292
+ try {
293
+ scene.environmentTexture = environmentTexture;
294
+ }
295
+ catch {
296
+ // Best-effort rollback keeps the original operation error as the public diagnostic.
297
+ }
298
+ try {
299
+ scene.environmentIntensity = environmentIntensity;
300
+ }
301
+ catch {
302
+ // Best-effort rollback keeps the original operation error as the public diagnostic.
303
+ }
304
+ }
305
+ function forwardAbort(signal, controller) {
306
+ if (!signal)
307
+ return () => undefined;
308
+ const onAbort = () => controller.abort();
309
+ signal.addEventListener('abort', onAbort, { once: true });
310
+ if (signal.aborted)
311
+ controller.abort();
312
+ return () => signal.removeEventListener('abort', onAbort);
313
+ }
314
+ function sameResource(left, right) {
315
+ return left?.assetId === right.assetId
316
+ && left?.url === right.url
317
+ && left?.format === right.format;
163
318
  }
164
319
  function createEnvironmentTextureAbortError() {
165
- return Object.assign(new Error('Babylon environment texture load aborted.'), { name: 'AbortError' });
320
+ return Object.assign(new Error('Babylon environment texture update aborted.'), { name: 'AbortError' });
321
+ }
322
+ function createSafeEnvironmentTextureError(code, message, cause) {
323
+ const error = Object.assign(new Error(message), { code });
324
+ if (cause !== undefined) {
325
+ Object.assign(error, { cause: sanitizeCause(cause) });
326
+ }
327
+ return error;
328
+ }
329
+ function sanitizeCause(cause) {
330
+ const message = cause instanceof Error ? cause.message : String(cause ?? 'Unknown error');
331
+ return new Error(message.replace(/(?:data|blob):[^\s)]+/giu, '[redacted-resource-url]'));
332
+ }
333
+ function withCleanupError(failure, cleanupError, retryCleanup) {
334
+ const result = failure instanceof Error ? failure : new Error('Babylon environment texture operation failed.');
335
+ if (cleanupError) {
336
+ attachEnvironmentTextureCleanup(result, [cleanupError], retryCleanup);
337
+ }
338
+ return result;
339
+ }
340
+ function createEnvironmentTextureCleanupFailure(cleanupErrors, retryCleanup) {
341
+ return attachEnvironmentTextureCleanup(Object.assign(new Error('Failed to dispose Babylon environment texture resources.'), { code: 'babylon.environment-texture.dispose-failed' }), cleanupErrors, retryCleanup);
166
342
  }
167
- function throwCandidateTextureFailure(texture, failure) {
168
- let cleanupError;
343
+ function attachEnvironmentTextureCleanup(failure, cleanupErrors, retryCleanup) {
344
+ const safeErrors = Object.freeze(cleanupErrors.map(sanitizeCause));
345
+ const metadata = {
346
+ cleanupError: safeErrors[0],
347
+ cleanupErrors: safeErrors,
348
+ babylonEnvironmentTextureControllerCleanup: retryCleanup,
349
+ retryCleanup,
350
+ };
169
351
  try {
170
- texture.dispose();
352
+ Object.assign(failure, metadata);
353
+ if (readBabylonEnvironmentTextureControllerCleanup(failure) === retryCleanup)
354
+ return failure;
171
355
  }
172
- catch (error) {
173
- cleanupError = error;
356
+ catch {
357
+ // Wrap non-extensible primary failures so the owning cleanup remains reachable.
174
358
  }
175
- const result = failure && typeof failure === 'object'
176
- ? failure
177
- : Object.assign(new Error(String(failure)), { cause: failure });
178
- if (cleanupError !== undefined)
179
- Object.assign(result, { cleanupError });
180
- throw result;
359
+ return Object.assign(new Error(failure.message), { cause: failure, ...metadata });
181
360
  }
182
- function createDefaultEnvironmentTexture(textureUrl, scene, callbacks = {}) {
183
- return new CubeTexture(textureUrl, scene, {
361
+ function createDefaultEnvironmentTexture(resource, scene, callbacks = {}) {
362
+ return new CubeTexture(resource.url, scene, {
184
363
  prefiltered: true,
185
364
  createPolynomials: true,
365
+ forcedExtension: resource.format,
186
366
  onLoad: callbacks.onLoad,
187
367
  onError: callbacks.onError,
188
368
  });
@@ -1 +1 @@
1
- {"version":3,"file":"environment-texture-controller.js","sourceRoot":"","sources":["../../src/environment/environment-texture-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAEhF,OAAO,EAKN,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,yCAAyC,EAAE,MAAM,cAAc,CAAC;AAEzE,MAAM,UAAU,yCAAyC,CACvD,KAAY,EACZ,cAAwD,EACxD,UAAsD,EAAE;IAExD,OAAO,IAAI,uCAAuC,CAChD,KAAK,EACL,cAAc,IAAI,IAAI,EACtB,OAAO,CAAC,aAAa,IAAI,+BAA+B,CACzD,CAAC;AACJ,CAAC;AAED,MAAM,uCAAuC;IAK3C,YACmB,KAAY,EAC7B,cAAuD,EACtC,aAA+C;QAF/C,UAAK,GAAL,KAAK,CAAO;QAEZ,kBAAa,GAAb,aAAa,CAAkC;QAP1D,YAAO,GAA4C,IAAI,CAAC;QACxD,YAAO,GAAuB,IAAI,CAAC;QACnC,eAAU,GAAG,EAAE,CAAC;QAOtB,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAClC,CAAC;IAED,UAAU,CAAC,OAA4D;QACrE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,OAAO;QACT,CAAC;QAED,MAAM,WAAW,GAAG,yCAAyC,CAAC,OAAO,CA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OAAO,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAClE,IAAI,YAAY,KAAK,SAAS;QAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;IACxE,MAAM,MAAM,CAAC;AACf,CAAC;AAED,SAAS,+BAA+B,CACtC,UAAkB,EAClB,KAAY,EACZ,YAA6D,EAAE;IAE/D,OAAO,IAAI,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE;QACxC,WAAW,EAAE,IAAI;QACjB,iBAAiB,EAAE,IAAI;QACvB,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,OAAO,EAAE,SAAS,CAAC,OAAO;KAC3B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { CubeTexture } from '@babylonjs/core/Materials/Textures/cubeTexture.js';\nimport type { Scene } from '@babylonjs/core/scene.js';\nimport {\n type BabylonEnvironmentTextureController,\n type BabylonEnvironmentTextureControllerOptions,\n type BabylonEnvironmentTextureFactory,\n type BabylonEnvironmentTextureProfile,\n} from './types.js';\nimport { normalizeBabylonEnvironmentTextureProfile } from './profile.js';\n\nexport function createBabylonEnvironmentTextureController(\n scene: Scene,\n initialProfile?: BabylonEnvironmentTextureProfile | null,\n options: BabylonEnvironmentTextureControllerOptions = {},\n): BabylonEnvironmentTextureController {\n return new BabylonEnvironmentTextureControllerImpl(\n scene,\n initialProfile ?? null,\n options.createTexture ?? createDefaultEnvironmentTexture,\n );\n}\n\nclass BabylonEnvironmentTextureControllerImpl implements BabylonEnvironmentTextureController {\n private profile: BabylonEnvironmentTextureProfile | null = null;\n private texture: CubeTexture | null = null;\n private textureUrl = '';\n\n constructor(\n private readonly scene: Scene,\n initialProfile: BabylonEnvironmentTextureProfile | null,\n private readonly createTexture: BabylonEnvironmentTextureFactory,\n ) {\n this.setProfile(initialProfile);\n }\n\n setProfile(profile: BabylonEnvironmentTextureProfile | null | undefined): void {\n if (!profile) {\n this.clearEnvironmentTexture();\n this.profile = null;\n return;\n }\n\n const nextProfile = normalizeBabylonEnvironmentTextureProfile(profile);\n if (!nextProfile.textureUrl) {\n this.clearEnvironmentTexture();\n this.profile = nextProfile;\n (this.scene as unknown as { environmentIntensity?: number }).environmentIntensity = nextProfile.intensity;\n return;\n }\n\n if (!this.texture || this.textureUrl !== nextProfile.textureUrl) {\n const previousTexture = this.texture;\n const nextTexture = this.createEnvironmentTexture(nextProfile.textureUrl);\n this.texture = nextTexture;\n this.textureUrl = nextProfile.textureUrl;\n this.scene.environmentTexture = nextTexture;\n previousTexture?.dispose();\n }\n\n this.profile = nextProfile;\n (this.scene as unknown as { environmentIntensity?: number }).environmentIntensity = nextProfile.intensity;\n if (this.texture) {\n this.texture.level = nextProfile.intensity;\n (this.texture as unknown as { rotationY?: number }).rotationY = nextProfile.rotationY;\n if (this.scene.environmentTexture !== this.texture) {\n this.scene.environmentTexture = this.texture;\n }\n }\n }\n\n async setProfileAsync(\n profile: BabylonEnvironmentTextureProfile | null | undefined,\n signal?: AbortSignal,\n ): Promise<void> {\n if (signal?.aborted) throw createEnvironmentTextureAbortError();\n if (!profile) {\n this.setProfile(profile);\n return;\n }\n const nextProfile = normalizeBabylonEnvironmentTextureProfile(profile);\n if (!nextProfile.textureUrl || (this.texture && this.textureUrl === nextProfile.textureUrl)) {\n this.setProfile(nextProfile);\n return;\n }\n\n const nextTexture = await this.createEnvironmentTextureAsync(nextProfile.textureUrl, signal);\n if (signal?.aborted) {\n throwCandidateTextureFailure(nextTexture, createEnvironmentTextureAbortError());\n }\n try {\n nextTexture.level = nextProfile.intensity;\n (nextTexture as unknown as { rotationY?: number }).rotationY = nextProfile.rotationY;\n } catch (cause) {\n throwCandidateTextureFailure(nextTexture, cause);\n }\n const previousTexture = this.texture;\n this.texture = nextTexture;\n this.textureUrl = nextProfile.textureUrl;\n this.profile = nextProfile;\n this.scene.environmentTexture = nextTexture;\n (this.scene as unknown as { environmentIntensity?: number }).environmentIntensity = nextProfile.intensity;\n previousTexture?.dispose();\n }\n\n getProfile(): BabylonEnvironmentTextureProfile | null {\n return this.profile ? { ...this.profile } : null;\n }\n\n getTexture(): CubeTexture | null {\n return this.texture;\n }\n\n dispose(): void {\n this.clearEnvironmentTexture();\n this.profile = null;\n }\n\n private clearEnvironmentTexture(): void {\n if (this.texture && this.scene.environmentTexture === this.texture) {\n this.scene.environmentTexture = null;\n }\n this.texture?.dispose();\n this.texture = null;\n this.textureUrl = '';\n }\n\n private createEnvironmentTexture(textureUrl: string): CubeTexture {\n try {\n const texture = this.createTexture(textureUrl, this.scene);\n return texture;\n } catch (cause) {\n throw Object.assign(\n new Error(`Failed to create Babylon environment texture: ${textureUrl}`),\n { cause },\n );\n }\n }\n\n private async createEnvironmentTextureAsync(\n textureUrl: string,\n signal?: AbortSignal,\n ): Promise<CubeTexture> {\n return new Promise<CubeTexture>((resolve, reject) => {\n let settled = false;\n let texture: CubeTexture | null = null;\n let loaded = false;\n let pendingError: { message?: string; exception?: unknown } | null = null;\n const removeAbortListener = (): void => signal?.removeEventListener('abort', abort);\n const fail = (message?: string, exception?: unknown): void => {\n if (settled) return;\n if (!texture) {\n pendingError = { message, exception };\n return;\n }\n settled = true;\n removeAbortListener();\n let cleanupError: unknown;\n try { texture.dispose(); } catch (error) { cleanupError = error; }\n reject(Object.assign(\n new Error(message || `Failed to load Babylon environment texture: ${textureUrl}`),\n { cause: exception, ...(cleanupError === undefined ? {} : { cleanupError }) },\n ));\n };\n const complete = (): void => {\n if (settled) return;\n loaded = true;\n if (!texture) return;\n settled = true;\n removeAbortListener();\n resolve(texture);\n };\n const abort = (): void => fail('Babylon environment texture load aborted.', createEnvironmentTextureAbortError());\n signal?.addEventListener('abort', abort, { once: true });\n try {\n texture = this.createTexture(textureUrl, this.scene, {\n onLoad: complete,\n onError: fail,\n });\n } catch (cause) {\n settled = true;\n removeAbortListener();\n reject(Object.assign(\n new Error(`Failed to create Babylon environment texture: ${textureUrl}`),\n { cause },\n ));\n return;\n }\n const synchronousError = pendingError as { message?: string; exception?: unknown } | null;\n if (synchronousError) {\n fail(synchronousError.message, synchronousError.exception);\n } else if (loaded || texture.isReady()) {\n complete();\n }\n });\n }\n}\n\nfunction createEnvironmentTextureAbortError(): Error {\n return Object.assign(new Error('Babylon environment texture load aborted.'), { name: 'AbortError' });\n}\n\nfunction throwCandidateTextureFailure(texture: CubeTexture, failure: unknown): never {\n let cleanupError: unknown;\n try { texture.dispose(); } catch (error) { cleanupError = error; }\n const result = failure && typeof failure === 'object'\n ? failure\n : Object.assign(new Error(String(failure)), { cause: failure });\n if (cleanupError !== undefined) Object.assign(result, { cleanupError });\n throw result;\n}\n\nfunction createDefaultEnvironmentTexture(\n textureUrl: string,\n scene: Scene,\n callbacks: Parameters<BabylonEnvironmentTextureFactory>[2] = {},\n): CubeTexture {\n return new CubeTexture(textureUrl, scene, {\n prefiltered: true,\n createPolynomials: true,\n onLoad: callbacks.onLoad,\n onError: callbacks.onError,\n });\n}\n"]}
1
+ {"version":3,"file":"environment-texture-controller.js","sourceRoot":"","sources":["../../src/environment/environment-texture-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gEAAgE,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAE,MAAM,oEAAoE,CAAC;AAG3G,OAAO,EAMN,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,yCAAyC,EAAE,MAAM,cAAc,CAAC;AAEzE,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,qBAAqB,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI,iBAAiB,EAAE,CAAC,CAAC;AAInE,MAAM,UAAU,8CAA8C,CAC5D,KAAc;IAEd,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IAC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ACF,IAAI,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjC,IAAI,8CAA8C,CAAC,OAAO,CAAC,KAAK,YAAY;YAAE,OAAO,OAAO,CAAC;IAC/F,CAAC;IAAC,MAAM,CAAC;QACP,gFAAgF;IAClF,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC;AACpF,CAAC;AAED,SAAS,+BAA+B,CACtC,QAAuC,EACvC,KAAY,EACZ,YAAoD,EAAE;IAEtD,OAAO,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE;QAC1C,WAAW,EAAE,IAAI;QACjB,iBAAiB,EAAE,IAAI;QACvB,eAAe,EAAE,QAAQ,CAAC,MAAM;QAChC,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,OAAO,EAAE,SAAS,CAAC,OAAO;KAC3B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { CubeTexture } from '@babylonjs/core/Materials/Textures/cubeTexture.js';\nimport { _ENVTextureLoader } from '@babylonjs/core/Materials/Textures/Loaders/envTextureLoader.js';\nimport { registerTextureLoader } from '@babylonjs/core/Materials/Textures/Loaders/textureLoaderManager.js';\nimport type { Scene } from '@babylonjs/core/scene.js';\nimport type { PlayableResolvedAssetResource } from '@fps-games/playable-assets';\nimport {\n type BabylonEnvironmentTextureController,\n type BabylonEnvironmentTextureControllerOptions,\n type BabylonEnvironmentTextureFactory,\n type BabylonEnvironmentTextureLoadCallbacks,\n type BabylonEnvironmentTextureProfile,\n} from './types.js';\nimport { normalizeBabylonEnvironmentTextureProfile } from './profile.js';\n\n// Register the framework default during module initialization so single-file\n// bundlers cannot remove Babylon's dynamic .env loader discovery. Applications\n// remain free to register their own .env loader after importing the renderer.\nregisterTextureLoader('.env', async () => new _ENVTextureLoader());\n\nexport type BabylonEnvironmentTextureControllerCleanup = () => readonly unknown[];\n\nexport function readBabylonEnvironmentTextureControllerCleanup(\n error: unknown,\n): BabylonEnvironmentTextureControllerCleanup | null {\n if (!error || (typeof error !== 'object' && typeof error !== 'function')) return null;\n const cleanup = (error as { babylonEnvironmentTextureControllerCleanup?: unknown })\n .babylonEnvironmentTextureControllerCleanup;\n return typeof cleanup === 'function'\n ? cleanup as BabylonEnvironmentTextureControllerCleanup\n : null;\n}\n\nexport function createBabylonEnvironmentTextureController(\n scene: Scene,\n options: BabylonEnvironmentTextureControllerOptions = {},\n): BabylonEnvironmentTextureController {\n return new BabylonEnvironmentTextureControllerImpl(\n scene,\n options.createTexture ?? createDefaultEnvironmentTexture,\n );\n}\n\nclass BabylonEnvironmentTextureControllerImpl implements BabylonEnvironmentTextureController {\n private profile: BabylonEnvironmentTextureProfile | null = null;\n private texture: CubeTexture | null = null;\n private resource: PlayableResolvedAssetResource | null = null;\n private generation = 0;\n private pendingAbort: AbortController | null = null;\n private readonly retainedCleanupTextures = new Set<CubeTexture>();\n private pendingSceneClearTexture: CubeTexture | null = null;\n private disposeRequested = false;\n private disposed = false;\n private readonly retryCleanup: BabylonEnvironmentTextureControllerCleanup = () => {\n const cleanupErrors: unknown[] = [];\n const pendingSceneTexture = this.pendingSceneClearTexture;\n if (pendingSceneTexture) {\n try {\n if (this.scene.environmentTexture === pendingSceneTexture) {\n this.scene.environmentTexture = null;\n }\n this.pendingSceneClearTexture = null;\n } catch (error) {\n cleanupErrors.push(sanitizeCause(error));\n }\n }\n for (const texture of [...this.retainedCleanupTextures]) {\n try {\n texture.dispose();\n this.retainedCleanupTextures.delete(texture);\n } catch (error) {\n cleanupErrors.push(sanitizeCause(error));\n }\n }\n return Object.freeze(cleanupErrors);\n };\n\n constructor(\n private readonly scene: Scene,\n private readonly createTexture: BabylonEnvironmentTextureFactory,\n ) {}\n\n async applyProfile(\n profile: BabylonEnvironmentTextureProfile | null,\n signal?: AbortSignal,\n ): Promise<void> {\n this.assertNotDisposed();\n if (signal?.aborted) throw createEnvironmentTextureAbortError();\n const retainedCleanupErrors = this.retryCleanup();\n if (retainedCleanupErrors.length > 0) {\n throw createEnvironmentTextureCleanupFailure(retainedCleanupErrors, this.retryCleanup);\n }\n\n const generation = ++this.generation;\n this.pendingAbort?.abort();\n const candidateAbort = new AbortController();\n this.pendingAbort = candidateAbort;\n const removeSignalListener = forwardAbort(signal, candidateAbort);\n const isCurrent = (): boolean => !this.disposed && this.generation === generation && !candidateAbort.signal.aborted;\n\n try {\n const nextProfile = profile ? normalizeBabylonEnvironmentTextureProfile(profile) : null;\n if (!nextProfile?.texture) {\n if (!isCurrent()) throw createEnvironmentTextureAbortError();\n const previousTexture = this.texture;\n const previousSceneTexture = this.scene.environmentTexture;\n const sceneWithIntensity = this.scene as unknown as { environmentIntensity?: number };\n const previousIntensity = sceneWithIntensity.environmentIntensity;\n try {\n if (previousTexture && previousSceneTexture === previousTexture) {\n this.scene.environmentTexture = null;\n }\n if (nextProfile) sceneWithIntensity.environmentIntensity = nextProfile.intensity;\n } catch (error) {\n restoreSceneState(this.scene, previousSceneTexture, previousIntensity);\n throw createSafeEnvironmentTextureError(\n 'babylon.environment-texture.profile-failed',\n 'Failed to apply Babylon environment texture profile.',\n error,\n );\n }\n this.texture = null;\n this.resource = null;\n this.profile = nextProfile;\n const cleanupError = this.disposeTextureOrRetain(previousTexture);\n if (cleanupError) {\n throw createEnvironmentTextureCleanupFailure([cleanupError], this.retryCleanup);\n }\n return;\n }\n\n if (this.texture && sameResource(this.resource, nextProfile.texture)) {\n if (!isCurrent()) throw createEnvironmentTextureAbortError();\n this.applyCommittedTextureProfile(this.texture, nextProfile);\n this.profile = nextProfile;\n this.resource = nextProfile.texture;\n return;\n }\n\n const candidate = await this.createEnvironmentTextureAsync(nextProfile.texture, candidateAbort.signal);\n if (!isCurrent()) this.throwCandidateTextureFailure(candidate, createEnvironmentTextureAbortError());\n try {\n applyCandidateTextureProperties(candidate, nextProfile);\n } catch (error) {\n this.throwCandidateTextureFailure(candidate, createSafeEnvironmentTextureError('babylon.environment-texture.profile-failed', 'Failed to apply Babylon environment texture profile.', error));\n }\n if (!isCurrent()) this.throwCandidateTextureFailure(candidate, createEnvironmentTextureAbortError());\n\n const previousTexture = this.texture;\n const previousSceneTexture = this.scene.environmentTexture;\n const sceneWithIntensity = this.scene as unknown as { environmentIntensity?: number };\n const previousIntensity = sceneWithIntensity.environmentIntensity;\n try {\n this.scene.environmentTexture = candidate;\n sceneWithIntensity.environmentIntensity = nextProfile.intensity;\n } catch (error) {\n restoreSceneState(this.scene, previousSceneTexture, previousIntensity);\n this.throwCandidateTextureFailure(candidate, createSafeEnvironmentTextureError(\n 'babylon.environment-texture.profile-failed',\n 'Failed to apply Babylon environment texture profile.',\n error,\n ));\n }\n this.texture = candidate;\n this.resource = nextProfile.texture;\n this.profile = nextProfile;\n const cleanupError = this.disposeTextureOrRetain(previousTexture);\n if (cleanupError) {\n throw createEnvironmentTextureCleanupFailure([cleanupError], this.retryCleanup);\n }\n } finally {\n removeSignalListener();\n if (this.pendingAbort === candidateAbort) this.pendingAbort = null;\n }\n }\n\n getProfile(): BabylonEnvironmentTextureProfile | null {\n return this.profile ? { ...this.profile } : null;\n }\n\n getTexture(): CubeTexture | null {\n return this.texture;\n }\n\n dispose(): void {\n if (this.disposed) return;\n if (!this.disposeRequested) {\n this.disposeRequested = true;\n this.generation += 1;\n this.pendingAbort?.abort();\n this.pendingAbort = null;\n const texture = this.texture;\n if (texture) {\n this.retainedCleanupTextures.add(texture);\n if (this.scene.environmentTexture === texture) {\n this.pendingSceneClearTexture = texture;\n }\n }\n this.texture = null;\n this.resource = null;\n this.profile = null;\n }\n const cleanupErrors = this.retryCleanup();\n if (cleanupErrors.length > 0) {\n throw createEnvironmentTextureCleanupFailure(cleanupErrors, this.retryCleanup);\n }\n this.disposed = true;\n }\n\n private applyCommittedTextureProfile(texture: CubeTexture, profile: BabylonEnvironmentTextureProfile): void {\n const textureWithRotation = texture as unknown as { rotationY?: number };\n const sceneWithIntensity = this.scene as unknown as { environmentIntensity?: number };\n const previousLevel = texture.level;\n const previousRotation = textureWithRotation.rotationY;\n const previousSceneTexture = this.scene.environmentTexture;\n const previousIntensity = sceneWithIntensity.environmentIntensity;\n try {\n applyCandidateTextureProperties(texture, profile);\n if (previousSceneTexture !== texture) this.scene.environmentTexture = texture;\n sceneWithIntensity.environmentIntensity = profile.intensity;\n } catch (error) {\n restoreTextureProperties(texture, previousLevel, previousRotation);\n restoreSceneState(this.scene, previousSceneTexture, previousIntensity);\n throw createSafeEnvironmentTextureError(\n 'babylon.environment-texture.profile-failed',\n 'Failed to apply Babylon environment texture profile.',\n error,\n );\n }\n }\n\n private createEnvironmentTextureAsync(\n resource: PlayableResolvedAssetResource,\n signal: AbortSignal,\n ): Promise<CubeTexture> {\n return new Promise<CubeTexture>((resolve, reject) => {\n if (signal.aborted) {\n reject(createEnvironmentTextureAbortError());\n return;\n }\n let settled = false;\n let texture: CubeTexture | null = null;\n let loaded = false;\n let pendingFailure: unknown = null;\n\n const settleFailure = (failure: unknown): void => {\n if (settled) return;\n if (!texture) {\n pendingFailure = failure;\n return;\n }\n settled = true;\n signal.removeEventListener('abort', abort);\n const cleanupError = this.disposeTextureOrRetain(texture);\n reject(withCleanupError(failure, cleanupError, this.retryCleanup));\n };\n const complete = (): void => {\n if (settled || !texture) {\n loaded = true;\n return;\n }\n settled = true;\n signal.removeEventListener('abort', abort);\n resolve(texture);\n };\n const abort = (): void => settleFailure(createEnvironmentTextureAbortError());\n const fail = (_message?: string, exception?: unknown): void => {\n settleFailure(createSafeEnvironmentTextureError(\n 'babylon.environment-texture.load-failed',\n 'Failed to load Babylon environment texture.',\n exception,\n ));\n };\n\n signal.addEventListener('abort', abort, { once: true });\n try {\n texture = this.createTexture(resource, this.scene, { onLoad: complete, onError: fail });\n } catch (error) {\n settled = true;\n signal.removeEventListener('abort', abort);\n reject(createSafeEnvironmentTextureError(\n 'babylon.environment-texture.create-failed',\n 'Failed to create Babylon environment texture.',\n error,\n ));\n return;\n }\n\n if (pendingFailure) settleFailure(pendingFailure);\n else if (loaded || texture.isReady()) complete();\n });\n }\n\n private assertNotDisposed(): void {\n if (this.disposed || this.disposeRequested) {\n throw new Error('Babylon environment texture controller is disposed.');\n }\n }\n\n private disposeTextureOrRetain(texture: CubeTexture | null): Error | null {\n if (!texture) return null;\n this.retainedCleanupTextures.add(texture);\n try {\n texture.dispose();\n this.retainedCleanupTextures.delete(texture);\n return null;\n } catch (error) {\n return sanitizeCause(error);\n }\n }\n\n private throwCandidateTextureFailure(texture: CubeTexture, failure: unknown): never {\n const cleanupError = this.disposeTextureOrRetain(texture);\n throw withCleanupError(failure, cleanupError, this.retryCleanup);\n }\n}\n\nfunction applyCandidateTextureProperties(\n texture: CubeTexture,\n profile: BabylonEnvironmentTextureProfile,\n): void {\n texture.level = profile.intensity;\n (texture as unknown as { rotationY?: number }).rotationY = profile.rotationY;\n}\n\nfunction restoreTextureProperties(\n texture: CubeTexture,\n level: number,\n rotationY: number | undefined,\n): void {\n try {\n texture.level = level;\n } catch {\n // Best-effort rollback keeps the original operation error as the public diagnostic.\n }\n try {\n (texture as unknown as { rotationY?: number }).rotationY = rotationY;\n } catch {\n // Best-effort rollback keeps the original operation error as the public diagnostic.\n }\n}\n\nfunction restoreSceneState(\n scene: Scene,\n environmentTexture: Scene['environmentTexture'],\n environmentIntensity: number | undefined,\n): void {\n try {\n scene.environmentTexture = environmentTexture;\n } catch {\n // Best-effort rollback keeps the original operation error as the public diagnostic.\n }\n try {\n (scene as unknown as { environmentIntensity?: number }).environmentIntensity = environmentIntensity;\n } catch {\n // Best-effort rollback keeps the original operation error as the public diagnostic.\n }\n}\n\nfunction forwardAbort(signal: AbortSignal | undefined, controller: AbortController): () => void {\n if (!signal) return () => undefined;\n const onAbort = (): void => controller.abort();\n signal.addEventListener('abort', onAbort, { once: true });\n if (signal.aborted) controller.abort();\n return () => signal.removeEventListener('abort', onAbort);\n}\n\nfunction sameResource(\n left: PlayableResolvedAssetResource | null,\n right: PlayableResolvedAssetResource,\n): boolean {\n return left?.assetId === right.assetId\n && left?.url === right.url\n && left?.format === right.format;\n}\n\nfunction createEnvironmentTextureAbortError(): Error {\n return Object.assign(new Error('Babylon environment texture update aborted.'), { name: 'AbortError' });\n}\n\nfunction createSafeEnvironmentTextureError(code: string, message: string, cause: unknown): Error {\n const error = Object.assign(new Error(message), { code });\n if (cause !== undefined) {\n Object.assign(error, { cause: sanitizeCause(cause) });\n }\n return error;\n}\n\nfunction sanitizeCause(cause: unknown): Error {\n const message = cause instanceof Error ? cause.message : String(cause ?? 'Unknown error');\n return new Error(message.replace(/(?:data|blob):[^\\s)]+/giu, '[redacted-resource-url]'));\n}\n\nfunction withCleanupError(\n failure: unknown,\n cleanupError: Error | null,\n retryCleanup: BabylonEnvironmentTextureControllerCleanup,\n): Error {\n const result = failure instanceof Error ? failure : new Error('Babylon environment texture operation failed.');\n if (cleanupError) {\n attachEnvironmentTextureCleanup(result, [cleanupError], retryCleanup);\n }\n return result;\n}\n\nfunction createEnvironmentTextureCleanupFailure(\n cleanupErrors: readonly unknown[],\n retryCleanup: BabylonEnvironmentTextureControllerCleanup,\n): Error {\n return attachEnvironmentTextureCleanup(\n Object.assign(\n new Error('Failed to dispose Babylon environment texture resources.'),\n { code: 'babylon.environment-texture.dispose-failed' },\n ),\n cleanupErrors,\n retryCleanup,\n );\n}\n\nfunction attachEnvironmentTextureCleanup(\n failure: Error,\n cleanupErrors: readonly unknown[],\n retryCleanup: BabylonEnvironmentTextureControllerCleanup,\n): Error {\n const safeErrors = Object.freeze(cleanupErrors.map(sanitizeCause));\n const metadata = {\n cleanupError: safeErrors[0],\n cleanupErrors: safeErrors,\n babylonEnvironmentTextureControllerCleanup: retryCleanup,\n retryCleanup,\n };\n try {\n Object.assign(failure, metadata);\n if (readBabylonEnvironmentTextureControllerCleanup(failure) === retryCleanup) return failure;\n } catch {\n // Wrap non-extensible primary failures so the owning cleanup remains reachable.\n }\n return Object.assign(new Error(failure.message), { cause: failure, ...metadata });\n}\n\nfunction createDefaultEnvironmentTexture(\n resource: PlayableResolvedAssetResource,\n scene: Scene,\n callbacks: BabylonEnvironmentTextureLoadCallbacks = {},\n): CubeTexture {\n return new CubeTexture(resource.url, scene, {\n prefiltered: true,\n createPolynomials: true,\n forcedExtension: resource.format,\n onLoad: callbacks.onLoad,\n onError: callbacks.onError,\n });\n}\n"]}
@@ -3,7 +3,7 @@ export function normalizeBabylonEnvironmentTextureProfile(value) {
3
3
  const source = readRecord(value);
4
4
  const fallback = DEFAULT_BABYLON_ENVIRONMENT_TEXTURE_PROFILE;
5
5
  return {
6
- textureUrl: readStringOrNull(source.textureUrl),
6
+ texture: readResourceOrNull(source.texture),
7
7
  intensity: readNonNegativeNumber(source.intensity, fallback.intensity),
8
8
  rotationY: readFiniteNumber(source.rotationY, fallback.rotationY),
9
9
  };
@@ -13,9 +13,10 @@ function readRecord(value) {
13
13
  ? value
14
14
  : {};
15
15
  }
16
- function readStringOrNull(value) {
17
- const text = typeof value === 'string' ? value.trim() : '';
18
- return text || null;
16
+ function readResourceOrNull(value) {
17
+ if (!value || typeof value !== 'object' || Array.isArray(value))
18
+ return null;
19
+ return value;
19
20
  }
20
21
  function readFiniteNumber(value, fallback) {
21
22
  return typeof value === 'number' && Number.isFinite(value) ? value : fallback;
@@ -1 +1 @@
1
- {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/environment/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2CAA2C,GAE5C,MAAM,YAAY,CAAC;AAEpB,MAAM,UAAU,yCAAyC,CACvD,KAAc;IAEd,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,2CAA2C,CAAC;IAC7D,OAAO;QACL,UAAU,EAAE,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC;QAC/C,SAAS,EAAE,qBAAqB,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC;QACtE,SAAS,EAAE,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC;KAClE,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAChE,CAAC,CAAC,KAAgC;QAClC,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,OAAO,IAAI,IAAI,IAAI,CAAC;AACtB,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc,EAAE,QAAgB;IACxD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChF,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAc,EAAE,QAAgB;IAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import {\n DEFAULT_BABYLON_ENVIRONMENT_TEXTURE_PROFILE,\n type BabylonEnvironmentTextureProfile,\n} from './types.js';\n\nexport function normalizeBabylonEnvironmentTextureProfile(\n value: unknown,\n): BabylonEnvironmentTextureProfile {\n const source = readRecord(value);\n const fallback = DEFAULT_BABYLON_ENVIRONMENT_TEXTURE_PROFILE;\n return {\n textureUrl: readStringOrNull(source.textureUrl),\n intensity: readNonNegativeNumber(source.intensity, fallback.intensity),\n rotationY: readFiniteNumber(source.rotationY, fallback.rotationY),\n };\n}\n\nfunction readRecord(value: unknown): Record<string, unknown> {\n return value && typeof value === 'object' && !Array.isArray(value)\n ? value as Record<string, unknown>\n : {};\n}\n\nfunction readStringOrNull(value: unknown): string | null {\n const text = typeof value === 'string' ? value.trim() : '';\n return text || null;\n}\n\nfunction readFiniteNumber(value: unknown, fallback: number): number {\n return typeof value === 'number' && Number.isFinite(value) ? value : fallback;\n}\n\nfunction readNonNegativeNumber(value: unknown, fallback: number): number {\n return Math.max(0, readFiniteNumber(value, fallback));\n}\n"]}
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/environment/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2CAA2C,GAE5C,MAAM,YAAY,CAAC;AAEpB,MAAM,UAAU,yCAAyC,CACvD,KAAc;IAEd,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,2CAA2C,CAAC;IAC7D,OAAO;QACL,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC;QAC3C,SAAS,EAAE,qBAAqB,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC;QACtE,SAAS,EAAE,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC;KAClE,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAChE,CAAC,CAAC,KAAgC;QAClC,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAc;IACxC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7E,OAAO,KAAoD,CAAC;AAC9D,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc,EAAE,QAAgB;IACxD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChF,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAc,EAAE,QAAgB;IAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import {\n DEFAULT_BABYLON_ENVIRONMENT_TEXTURE_PROFILE,\n type BabylonEnvironmentTextureProfile,\n} from './types.js';\n\nexport function normalizeBabylonEnvironmentTextureProfile(\n value: unknown,\n): BabylonEnvironmentTextureProfile {\n const source = readRecord(value);\n const fallback = DEFAULT_BABYLON_ENVIRONMENT_TEXTURE_PROFILE;\n return {\n texture: readResourceOrNull(source.texture),\n intensity: readNonNegativeNumber(source.intensity, fallback.intensity),\n rotationY: readFiniteNumber(source.rotationY, fallback.rotationY),\n };\n}\n\nfunction readRecord(value: unknown): Record<string, unknown> {\n return value && typeof value === 'object' && !Array.isArray(value)\n ? value as Record<string, unknown>\n : {};\n}\n\nfunction readResourceOrNull(value: unknown): BabylonEnvironmentTextureProfile['texture'] {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return null;\n return value as BabylonEnvironmentTextureProfile['texture'];\n}\n\nfunction readFiniteNumber(value: unknown, fallback: number): number {\n return typeof value === 'number' && Number.isFinite(value) ? value : fallback;\n}\n\nfunction readNonNegativeNumber(value: unknown, fallback: number): number {\n return Math.max(0, readFiniteNumber(value, fallback));\n}\n"]}