@roomle/web-sdk 2.68.0-alpha.4 → 2.68.0-alpha.6

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 (234) hide show
  1. package/lib/{TextGeometry-885c93d0.nomodule.js → TextGeometry-a2b49289.nomodule.js} +2 -2
  2. package/lib/{TextGeometry-885c93d0.nomodule.js.map → TextGeometry-a2b49289.nomodule.js.map} +1 -1
  3. package/lib/{TextGeometry-2f1b3194.js → TextGeometry-ef1bccc5.js} +2 -2
  4. package/lib/{TextGeometry-2f1b3194.js.map → TextGeometry-ef1bccc5.js.map} +1 -1
  5. package/lib/{banana-for-scale-3aea88e3.nomodule.js → banana-for-scale-5b1b4216.nomodule.js} +2 -2
  6. package/lib/{banana-for-scale-3aea88e3.nomodule.js.map → banana-for-scale-5b1b4216.nomodule.js.map} +1 -1
  7. package/lib/{banana-for-scale-4ea6891d.js → banana-for-scale-8dab20a4.js} +2 -2
  8. package/lib/{banana-for-scale-4ea6891d.js.map → banana-for-scale-8dab20a4.js.map} +1 -1
  9. package/lib/{budgeteer-measure-69d8c571.js → budgeteer-measure-545aed97.js} +2 -2
  10. package/lib/{budgeteer-measure-69d8c571.js.map → budgeteer-measure-545aed97.js.map} +1 -1
  11. package/lib/budgeteer-measure.nomodule.js +1 -1
  12. package/lib/{component-dimensioning-7c837a49.js → component-dimensioning-4db015d6.js} +2 -2
  13. package/lib/component-dimensioning-4db015d6.js.map +1 -0
  14. package/lib/{component-dimensioning-39bd223f.nomodule.js → component-dimensioning-ad0e5fdd.nomodule.js} +2 -2
  15. package/lib/component-dimensioning-ad0e5fdd.nomodule.js.map +1 -0
  16. package/lib/component-raycast-helper-a45b9dfa.js +2 -0
  17. package/lib/component-raycast-helper-a45b9dfa.js.map +1 -0
  18. package/lib/component-raycast-helper-f14761c4.nomodule.js +2 -0
  19. package/lib/component-raycast-helper-f14761c4.nomodule.js.map +1 -0
  20. package/lib/{configurator-faf33eba.nomodule.js → configurator-65da998a.nomodule.js} +2 -2
  21. package/lib/configurator-65da998a.nomodule.js.map +1 -0
  22. package/lib/{configurator-04686014.js → configurator-666e8c65.js} +2 -2
  23. package/lib/configurator-666e8c65.js.map +1 -0
  24. package/lib/configurator-main-76aa9a2b.js +2 -0
  25. package/lib/configurator-main-76aa9a2b.js.map +1 -0
  26. package/lib/configurator-main.nomodule.js +1 -1
  27. package/lib/{continuous-drawing-helper-936b58cd.js → continuous-drawing-helper-3a9d837e.js} +2 -2
  28. package/lib/continuous-drawing-helper-3a9d837e.js.map +1 -0
  29. package/lib/{continuous-drawing-helper-6dfed572.nomodule.js → continuous-drawing-helper-de0d24f3.nomodule.js} +2 -2
  30. package/lib/continuous-drawing-helper-de0d24f3.nomodule.js.map +1 -0
  31. package/lib/{default-light-setting-41fc1fb0.nomodule.js → default-light-setting-1793d4c0.nomodule.js} +2 -2
  32. package/lib/default-light-setting-1793d4c0.nomodule.js.map +1 -0
  33. package/lib/{default-light-setting-a195c619.js → default-light-setting-d8fe9af7.js} +2 -2
  34. package/lib/default-light-setting-d8fe9af7.js.map +1 -0
  35. package/lib/definitions/common-core/src/webgl/renderer/scene-renderer.d.ts +4 -0
  36. package/lib/definitions/common-core/src/webgl/roomle-webgl-renderer.d.ts +3 -2
  37. package/lib/definitions/common-core/src/webgl/scene-manager.d.ts +2 -2
  38. package/lib/definitions/configurator-core/src/webgl/configurator-scene-manager.d.ts +2 -2
  39. package/lib/definitions/glb-viewer-core/src/webgl/glb-viewer-scene-manager.d.ts +1 -1
  40. package/lib/definitions/material-viewer/src/webgl/material-viewer-scene-manager.d.ts +1 -1
  41. package/lib/definitions/planner-core/src/webgl/planner-scene-manager.d.ts +1 -1
  42. package/lib/{dimensioning-helper-952fc8e5.nomodule.js → dimensioning-helper-a4569c29.nomodule.js} +2 -2
  43. package/lib/{dimensioning-helper-952fc8e5.nomodule.js.map → dimensioning-helper-a4569c29.nomodule.js.map} +1 -1
  44. package/lib/{dimensioning-helper-34d18c8c.js → dimensioning-helper-f71dc242.js} +2 -2
  45. package/lib/{dimensioning-helper-34d18c8c.js.map → dimensioning-helper-f71dc242.js.map} +1 -1
  46. package/lib/glb-viewer-5d3baff6.js +2 -0
  47. package/lib/{glb-viewer-6c9fff72.js.map → glb-viewer-5d3baff6.js.map} +1 -1
  48. package/lib/glb-viewer-933e235f.nomodule.js +2 -0
  49. package/lib/{glb-viewer-08d3c062.nomodule.js.map → glb-viewer-933e235f.nomodule.js.map} +1 -1
  50. package/lib/glb-viewer-main-43deb727.js +2 -0
  51. package/lib/glb-viewer-main-43deb727.js.map +1 -0
  52. package/lib/glb-viewer-main.nomodule.js +1 -1
  53. package/lib/legacy/{TextGeometry-3d9fa5f8.legacy.js → TextGeometry-f4b53ba6.legacy.js} +2 -2
  54. package/lib/legacy/{TextGeometry-3d9fa5f8.legacy.js.map → TextGeometry-f4b53ba6.legacy.js.map} +1 -1
  55. package/lib/legacy/{banana-for-scale-f21a5440.legacy.js → banana-for-scale-01094302.legacy.js} +2 -2
  56. package/lib/legacy/{banana-for-scale-f21a5440.legacy.js.map → banana-for-scale-01094302.legacy.js.map} +1 -1
  57. package/lib/legacy/budgeteer-measure.legacy.js +1 -1
  58. package/lib/legacy/{component-dimensioning-5e164484.legacy.js → component-dimensioning-72857939.legacy.js} +2 -2
  59. package/lib/legacy/component-dimensioning-72857939.legacy.js.map +1 -0
  60. package/lib/legacy/component-raycast-helper-91921851.legacy.js +2 -0
  61. package/lib/legacy/component-raycast-helper-91921851.legacy.js.map +1 -0
  62. package/lib/legacy/{configurator-c5a042b0.legacy.js → configurator-5962e900.legacy.js} +2 -2
  63. package/lib/legacy/configurator-5962e900.legacy.js.map +1 -0
  64. package/lib/legacy/configurator-main.legacy.js +1 -1
  65. package/lib/legacy/{continuous-drawing-helper-876799b1.legacy.js → continuous-drawing-helper-71e8ea48.legacy.js} +2 -2
  66. package/lib/legacy/continuous-drawing-helper-71e8ea48.legacy.js.map +1 -0
  67. package/lib/legacy/{default-light-setting-f3894cdc.legacy.js → default-light-setting-eb0fe46a.legacy.js} +2 -2
  68. package/lib/legacy/default-light-setting-eb0fe46a.legacy.js.map +1 -0
  69. package/lib/legacy/{dimensioning-helper-430e5708.legacy.js → dimensioning-helper-f8f3ee69.legacy.js} +2 -2
  70. package/lib/legacy/{dimensioning-helper-430e5708.legacy.js.map → dimensioning-helper-f8f3ee69.legacy.js.map} +1 -1
  71. package/lib/legacy/glb-viewer-0341188a.legacy.js +2 -0
  72. package/lib/legacy/{glb-viewer-3d7edc5d.legacy.js.map → glb-viewer-0341188a.legacy.js.map} +1 -1
  73. package/lib/legacy/glb-viewer-main.legacy.js +1 -1
  74. package/lib/legacy/main-thread-to-worker-11930382.legacy.js +7 -0
  75. package/lib/legacy/{main-thread-to-worker-53273087.legacy.js.map → main-thread-to-worker-11930382.legacy.js.map} +1 -1
  76. package/lib/legacy/material-viewer-4498e854.legacy.js +2 -0
  77. package/lib/legacy/material-viewer-4498e854.legacy.js.map +1 -0
  78. package/lib/legacy/material-viewer-main.legacy.js +1 -1
  79. package/lib/legacy/planner-f91ae5b0.legacy.js +2 -0
  80. package/lib/legacy/{planner-be4f26ed.legacy.js.map → planner-f91ae5b0.legacy.js.map} +1 -1
  81. package/lib/legacy/planner-main.legacy.js +1 -1
  82. package/lib/legacy/query-params-helper-871c582e.legacy.js +2 -0
  83. package/lib/legacy/query-params-helper-871c582e.legacy.js.map +1 -0
  84. package/lib/legacy/roomle-configurator-f95108ad.legacy.js +2 -0
  85. package/lib/legacy/roomle-configurator-f95108ad.legacy.js.map +1 -0
  86. package/lib/legacy/roomle-dependency-injection-08bf80a8.legacy.js +9 -0
  87. package/lib/legacy/{roomle-dependency-injection-fe58841f.legacy.js.map → roomle-dependency-injection-08bf80a8.legacy.js.map} +1 -1
  88. package/lib/legacy/roomle-sdk.legacy.js +1 -1
  89. package/lib/legacy/scene-manager-767189c5.legacy.js +2 -0
  90. package/lib/legacy/{scene-manager-16f204d3.legacy.js.map → scene-manager-767189c5.legacy.js.map} +1 -1
  91. package/lib/legacy/{script-loader-76480382.legacy.js → script-loader-0733732f.legacy.js} +2 -2
  92. package/lib/legacy/script-loader-0733732f.legacy.js.map +1 -0
  93. package/lib/legacy/static/{ConfiguratorKernel-f3464cdc330bfd64.wasm → ConfiguratorKernel-6146a1f2d0216b3c.wasm} +0 -0
  94. package/lib/legacy/static/{ConfiguratorKernel-5f6876363be07e2e.wasm → ConfiguratorKernel-b9449c997624b26e.wasm} +0 -0
  95. package/lib/{static/ConfiguratorKernelJs-0dc21dba96f606b2.mem → legacy/static/ConfiguratorKernelJs-13323b5c84e330da.mem} +0 -0
  96. package/lib/legacy/static/{ConfiguratorKernelJs-34b685d92fd1da56.js → ConfiguratorKernelJs-e164ab2cc1598bef.js} +154 -154
  97. package/lib/{static/RoomleCore-23eb1d8d381c094a.wasm → legacy/static/RoomleCore-39b259a970187d31.wasm} +0 -0
  98. package/lib/legacy/static/{RoomleCore-8fe23a68f5cf6628.wasm → RoomleCore-7c251caef3cd4cd9.wasm} +0 -0
  99. package/lib/legacy/static/{RoomleCoreJs-42b2831d68c78a40.js → RoomleCoreJs-00eae758a0467510.js} +156 -156
  100. package/lib/{static/RoomleCoreJs-8378c324089217cc.mem → legacy/static/RoomleCoreJs-690a58d0604f7262.mem} +0 -0
  101. package/lib/legacy/static/{RoomleToolsCore-17f0198e734b8d85.wasm → RoomleToolsCore-3a24b1269cb9fec8.wasm} +0 -0
  102. package/lib/{static/RoomleToolsCore-7060963e14411785.wasm → legacy/static/RoomleToolsCore-e582ba7d33924270.wasm} +0 -0
  103. package/lib/legacy/{stats-helper-ddcce2d7.legacy.js → stats-helper-d367f5e7.legacy.js} +2 -2
  104. package/lib/legacy/stats-helper-d367f5e7.legacy.js.map +1 -0
  105. package/lib/legacy/{tools-core-cd8c437b.legacy.js → tools-core-5727d44a.legacy.js} +2 -2
  106. package/lib/legacy/tools-core-5727d44a.legacy.js.map +1 -0
  107. package/lib/main-thread-to-worker-307e6096.js +2 -0
  108. package/lib/{main-thread-to-worker-9f925ba4.js.map → main-thread-to-worker-307e6096.js.map} +1 -1
  109. package/lib/main-thread-to-worker-38d48e06.nomodule.js +2 -0
  110. package/lib/{main-thread-to-worker-a8fb30c0.nomodule.js.map → main-thread-to-worker-38d48e06.nomodule.js.map} +1 -1
  111. package/lib/material-viewer-2ed7b3bc.js +2 -0
  112. package/lib/material-viewer-2ed7b3bc.js.map +1 -0
  113. package/lib/material-viewer-de60ddd4.nomodule.js +2 -0
  114. package/lib/material-viewer-de60ddd4.nomodule.js.map +1 -0
  115. package/lib/material-viewer-main-1fbbe523.js +2 -0
  116. package/lib/material-viewer-main-1fbbe523.js.map +1 -0
  117. package/lib/material-viewer-main.nomodule.js +1 -1
  118. package/lib/{planner-3287e361.js → planner-4faac98d.js} +2 -2
  119. package/lib/{planner-3287e361.js.map → planner-4faac98d.js.map} +1 -1
  120. package/lib/planner-eabbeff8.nomodule.js +2 -0
  121. package/lib/{planner-45fa06a4.nomodule.js.map → planner-eabbeff8.nomodule.js.map} +1 -1
  122. package/lib/planner-main-245fcc70.js +2 -0
  123. package/lib/planner-main-245fcc70.js.map +1 -0
  124. package/lib/planner-main.nomodule.js +1 -1
  125. package/lib/query-params-helper-519cb51c.nomodule.js +2 -0
  126. package/lib/query-params-helper-519cb51c.nomodule.js.map +1 -0
  127. package/lib/query-params-helper-b54bbbb4.js +2 -0
  128. package/lib/query-params-helper-b54bbbb4.js.map +1 -0
  129. package/lib/roomle-configurator-75dbbdbd.nomodule.js +2 -0
  130. package/lib/roomle-configurator-75dbbdbd.nomodule.js.map +1 -0
  131. package/lib/roomle-configurator-d068c7b4.js +2 -0
  132. package/lib/roomle-configurator-d068c7b4.js.map +1 -0
  133. package/lib/roomle-dependency-injection-348f3aac.nomodule.js +9 -0
  134. package/lib/{roomle-dependency-injection-5b1f09d5.nomodule.js.map → roomle-dependency-injection-348f3aac.nomodule.js.map} +1 -1
  135. package/lib/roomle-dependency-injection-6cc5f1dd.js +9 -0
  136. package/lib/{roomle-dependency-injection-986d0a8f.js.map → roomle-dependency-injection-6cc5f1dd.js.map} +1 -1
  137. package/lib/{roomle-sdk-6ab052e4.js → roomle-sdk-b1e484f0.js} +2 -2
  138. package/lib/roomle-sdk-b1e484f0.js.map +1 -0
  139. package/lib/roomle-sdk.nomodule.js +1 -1
  140. package/lib/scene-manager-17273ebe.js +2 -0
  141. package/lib/{scene-manager-9231df1b.js.map → scene-manager-17273ebe.js.map} +1 -1
  142. package/lib/scene-manager-867ed8ea.nomodule.js +2 -0
  143. package/lib/{scene-manager-9b770743.nomodule.js.map → scene-manager-867ed8ea.nomodule.js.map} +1 -1
  144. package/lib/{script-loader-c2a01bb0.nomodule.js → script-loader-c03cdfaf.nomodule.js} +2 -2
  145. package/lib/script-loader-c03cdfaf.nomodule.js.map +1 -0
  146. package/lib/{script-loader-917e8941.js → script-loader-ea706d37.js} +2 -2
  147. package/lib/script-loader-ea706d37.js.map +1 -0
  148. package/lib/static/{ConfiguratorKernel-f3464cdc330bfd64.wasm → ConfiguratorKernel-6146a1f2d0216b3c.wasm} +0 -0
  149. package/lib/static/{ConfiguratorKernel-5f6876363be07e2e.wasm → ConfiguratorKernel-b9449c997624b26e.wasm} +0 -0
  150. package/lib/{legacy/static/ConfiguratorKernelJs-0dc21dba96f606b2.mem → static/ConfiguratorKernelJs-13323b5c84e330da.mem} +0 -0
  151. package/lib/static/{ConfiguratorKernelJs-34b685d92fd1da56.js → ConfiguratorKernelJs-e164ab2cc1598bef.js} +154 -154
  152. package/lib/{legacy/static/RoomleCore-23eb1d8d381c094a.wasm → static/RoomleCore-39b259a970187d31.wasm} +0 -0
  153. package/lib/static/{RoomleCore-8fe23a68f5cf6628.wasm → RoomleCore-7c251caef3cd4cd9.wasm} +0 -0
  154. package/lib/static/{RoomleCoreJs-42b2831d68c78a40.js → RoomleCoreJs-00eae758a0467510.js} +156 -156
  155. package/lib/{legacy/static/RoomleCoreJs-8378c324089217cc.mem → static/RoomleCoreJs-690a58d0604f7262.mem} +0 -0
  156. package/lib/static/{RoomleToolsCore-17f0198e734b8d85.wasm → RoomleToolsCore-3a24b1269cb9fec8.wasm} +0 -0
  157. package/lib/{legacy/static/RoomleToolsCore-7060963e14411785.wasm → static/RoomleToolsCore-e582ba7d33924270.wasm} +0 -0
  158. package/lib/{stats-helper-b0cc9d25.nomodule.js → stats-helper-e683766c.nomodule.js} +2 -2
  159. package/lib/stats-helper-e683766c.nomodule.js.map +1 -0
  160. package/lib/{stats-helper-0c4ac5d6.js → stats-helper-f6006275.js} +2 -2
  161. package/lib/stats-helper-f6006275.js.map +1 -0
  162. package/lib/{tools-core-aaf457c3.nomodule.js → tools-core-8b9e2021.nomodule.js} +2 -2
  163. package/lib/tools-core-8b9e2021.nomodule.js.map +1 -0
  164. package/lib/{tools-core-f5ba1e23.js → tools-core-9a2b9ecc.js} +2 -2
  165. package/lib/tools-core-9a2b9ecc.js.map +1 -0
  166. package/package.json +2 -2
  167. package/lib/component-dimensioning-39bd223f.nomodule.js.map +0 -1
  168. package/lib/component-dimensioning-7c837a49.js.map +0 -1
  169. package/lib/component-raycast-helper-980d3fcf.nomodule.js +0 -2
  170. package/lib/component-raycast-helper-980d3fcf.nomodule.js.map +0 -1
  171. package/lib/component-raycast-helper-b15ddcb0.js +0 -2
  172. package/lib/component-raycast-helper-b15ddcb0.js.map +0 -1
  173. package/lib/configurator-04686014.js.map +0 -1
  174. package/lib/configurator-faf33eba.nomodule.js.map +0 -1
  175. package/lib/configurator-main-0aad247f.js +0 -2
  176. package/lib/configurator-main-0aad247f.js.map +0 -1
  177. package/lib/continuous-drawing-helper-6dfed572.nomodule.js.map +0 -1
  178. package/lib/continuous-drawing-helper-936b58cd.js.map +0 -1
  179. package/lib/default-light-setting-41fc1fb0.nomodule.js.map +0 -1
  180. package/lib/default-light-setting-a195c619.js.map +0 -1
  181. package/lib/glb-viewer-08d3c062.nomodule.js +0 -2
  182. package/lib/glb-viewer-6c9fff72.js +0 -2
  183. package/lib/glb-viewer-main-48c8290c.js +0 -2
  184. package/lib/glb-viewer-main-48c8290c.js.map +0 -1
  185. package/lib/legacy/component-dimensioning-5e164484.legacy.js.map +0 -1
  186. package/lib/legacy/component-raycast-helper-949ee9f0.legacy.js +0 -2
  187. package/lib/legacy/component-raycast-helper-949ee9f0.legacy.js.map +0 -1
  188. package/lib/legacy/configurator-c5a042b0.legacy.js.map +0 -1
  189. package/lib/legacy/continuous-drawing-helper-876799b1.legacy.js.map +0 -1
  190. package/lib/legacy/default-light-setting-f3894cdc.legacy.js.map +0 -1
  191. package/lib/legacy/glb-viewer-3d7edc5d.legacy.js +0 -2
  192. package/lib/legacy/main-thread-to-worker-53273087.legacy.js +0 -7
  193. package/lib/legacy/material-viewer-00f18fc8.legacy.js +0 -2
  194. package/lib/legacy/material-viewer-00f18fc8.legacy.js.map +0 -1
  195. package/lib/legacy/planner-be4f26ed.legacy.js +0 -2
  196. package/lib/legacy/query-params-helper-8c00a872.legacy.js +0 -2
  197. package/lib/legacy/query-params-helper-8c00a872.legacy.js.map +0 -1
  198. package/lib/legacy/roomle-configurator-85aefa63.legacy.js +0 -2
  199. package/lib/legacy/roomle-configurator-85aefa63.legacy.js.map +0 -1
  200. package/lib/legacy/roomle-dependency-injection-fe58841f.legacy.js +0 -9
  201. package/lib/legacy/scene-manager-16f204d3.legacy.js +0 -2
  202. package/lib/legacy/script-loader-76480382.legacy.js.map +0 -1
  203. package/lib/legacy/stats-helper-ddcce2d7.legacy.js.map +0 -1
  204. package/lib/legacy/tools-core-cd8c437b.legacy.js.map +0 -1
  205. package/lib/main-thread-to-worker-9f925ba4.js +0 -7
  206. package/lib/main-thread-to-worker-a8fb30c0.nomodule.js +0 -8
  207. package/lib/material-viewer-2d5eaabc.nomodule.js +0 -2
  208. package/lib/material-viewer-2d5eaabc.nomodule.js.map +0 -1
  209. package/lib/material-viewer-87f5e98b.js +0 -2
  210. package/lib/material-viewer-87f5e98b.js.map +0 -1
  211. package/lib/material-viewer-main-f5f4b8d8.js +0 -2
  212. package/lib/material-viewer-main-f5f4b8d8.js.map +0 -1
  213. package/lib/planner-45fa06a4.nomodule.js +0 -2
  214. package/lib/planner-main-51881be4.js +0 -2
  215. package/lib/planner-main-51881be4.js.map +0 -1
  216. package/lib/query-params-helper-a271f9dc.js +0 -2
  217. package/lib/query-params-helper-a271f9dc.js.map +0 -1
  218. package/lib/query-params-helper-c231e1b8.nomodule.js +0 -2
  219. package/lib/query-params-helper-c231e1b8.nomodule.js.map +0 -1
  220. package/lib/roomle-configurator-38816c54.js +0 -2
  221. package/lib/roomle-configurator-38816c54.js.map +0 -1
  222. package/lib/roomle-configurator-5bfe9ed9.nomodule.js +0 -2
  223. package/lib/roomle-configurator-5bfe9ed9.nomodule.js.map +0 -1
  224. package/lib/roomle-dependency-injection-5b1f09d5.nomodule.js +0 -9
  225. package/lib/roomle-dependency-injection-986d0a8f.js +0 -9
  226. package/lib/roomle-sdk-6ab052e4.js.map +0 -1
  227. package/lib/scene-manager-9231df1b.js +0 -2
  228. package/lib/scene-manager-9b770743.nomodule.js +0 -2
  229. package/lib/script-loader-917e8941.js.map +0 -1
  230. package/lib/script-loader-c2a01bb0.nomodule.js.map +0 -1
  231. package/lib/stats-helper-0c4ac5d6.js.map +0 -1
  232. package/lib/stats-helper-b0cc9d25.nomodule.js.map +0 -1
  233. package/lib/tools-core-aaf457c3.nomodule.js.map +0 -1
  234. package/lib/tools-core-f5ba1e23.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{b as RoomleDependencyInjection,D as DependencyInjectionAssignment,R as RapiAccess,ax as GlobalCallback,ay as GlobalInitData,az as InitData}from"./roomle-dependency-injection-986d0a8f.js";import"./main-thread-to-worker-9f925ba4.js";class RoomleSdk{static getConfigurator(e,n){return n=this._setupDI("configurator",e,n),new Promise((e,t)=>import("./configurator-04686014.js").then(({Configurator:t})=>e(new t(n)),t))}static getPlanner(e,n){return n=this._setupDI("planner",e,n),new Promise((e,t)=>import("./planner-3287e361.js").then(({Planner:t})=>e(new t(n)),t))}static async getGlbViewer(e,n){return n=this._setupDI("glb-viewer",e,n),new Promise((e,t)=>import("./glb-viewer-6c9fff72.js").then(({GlbViewer:t})=>e(new t(n)),t))}static getMaterialViewer(e,n){return n=this._setupDI("configurator",e,n),new Promise((e,t)=>import("./material-viewer-87f5e98b.js").then(({MaterialViewer:t})=>e(new t(n)),t))}static getCoreTools(e,n){return n=this._setupDI("tools-core",e,n),new Promise((e,t)=>import("./tools-core-f5ba1e23.js").then(({ToolsCore:t})=>{const o=new t(n);o.boot(),e(o)},t))}static getRapiAccess(){return RoomleDependencyInjection.addToContainer([new DependencyInjectionAssignment("rapi-access",RapiAccess,0),new DependencyInjectionAssignment("global-callback",GlobalCallback,0)]),Promise.resolve(RoomleDependencyInjection.lookup("rapi-access"))}static get callbacks(){return RoomleDependencyInjection.addToContainer([new DependencyInjectionAssignment("global-callback",GlobalCallback,0)]),Promise.resolve(RoomleDependencyInjection.lookup("global-callback"))}static setGlobalInitData(e){e&&(RoomleDependencyInjection.addToContainer([new DependencyInjectionAssignment("global-init-data",GlobalInitData,0)]),RoomleDependencyInjection.lookup("global-init-data").setOverrides(e))}static getContext(e){return RoomleDependencyInjection.getContext(e)}static _setupDI(e,n,t){return n&&(RoomleDependencyInjection.addToContainer([new DependencyInjectionAssignment("init-data",InitData,1)]),t||(t=RoomleDependencyInjection.getContext(e)),RoomleDependencyInjection.lookup("init-data",t).setOverrides(n)),t}}export{RoomleSdk as default};
2
- //# sourceMappingURL=roomle-sdk-6ab052e4.js.map
1
+ import{b as RoomleDependencyInjection,D as DependencyInjectionAssignment,R as RapiAccess,av as GlobalCallback,aw as GlobalInitData,ax as InitData}from"./roomle-dependency-injection-6cc5f1dd.js";import"./main-thread-to-worker-307e6096.js";class RoomleSdk{static getConfigurator(e,n){return n=this._setupDI("configurator",e,n),new Promise((e,t)=>import("./configurator-666e8c65.js").then(({Configurator:t})=>e(new t(n)),t))}static getPlanner(e,n){return n=this._setupDI("planner",e,n),new Promise((e,t)=>import("./planner-4faac98d.js").then(({Planner:t})=>e(new t(n)),t))}static async getGlbViewer(e,n){return n=this._setupDI("glb-viewer",e,n),new Promise((e,t)=>import("./glb-viewer-5d3baff6.js").then(({GlbViewer:t})=>e(new t(n)),t))}static getMaterialViewer(e,n){return n=this._setupDI("configurator",e,n),new Promise((e,t)=>import("./material-viewer-2ed7b3bc.js").then(({MaterialViewer:t})=>e(new t(n)),t))}static getCoreTools(e,n){return n=this._setupDI("tools-core",e,n),new Promise((e,t)=>import("./tools-core-9a2b9ecc.js").then(({ToolsCore:t})=>{const o=new t(n);o.boot(),e(o)},t))}static getRapiAccess(){return RoomleDependencyInjection.addToContainer([new DependencyInjectionAssignment("rapi-access",RapiAccess,0),new DependencyInjectionAssignment("global-callback",GlobalCallback,0)]),Promise.resolve(RoomleDependencyInjection.lookup("rapi-access"))}static get callbacks(){return RoomleDependencyInjection.addToContainer([new DependencyInjectionAssignment("global-callback",GlobalCallback,0)]),Promise.resolve(RoomleDependencyInjection.lookup("global-callback"))}static setGlobalInitData(e){e&&(RoomleDependencyInjection.addToContainer([new DependencyInjectionAssignment("global-init-data",GlobalInitData,0)]),RoomleDependencyInjection.lookup("global-init-data").setOverrides(e))}static getContext(e){return RoomleDependencyInjection.getContext(e)}static _setupDI(e,n,t){return n&&(RoomleDependencyInjection.addToContainer([new DependencyInjectionAssignment("init-data",InitData,1)]),t||(t=RoomleDependencyInjection.getContext(e)),RoomleDependencyInjection.lookup("init-data",t).setOverrides(n)),t}}export{RoomleSdk as default};
2
+ //# sourceMappingURL=roomle-sdk-b1e484f0.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roomle-sdk-b1e484f0.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- System.register(["./roomle-dependency-injection-5b1f09d5.nomodule.js","./main-thread-to-worker-a8fb30c0.nomodule.js"],(function(e,t){var o,n,a,r,i,s;return{setters:[function(e){o=e.b,n=e.D,a=e.R,r=e.ax,i=e.ay,s=e.az},function(){}],execute:function(){e("default",class{static getConfigurator(e,o){return o=this._setupDI("configurator",e,o),new Promise((e,n)=>t.import("./configurator-faf33eba.nomodule.js").then(({Configurator:t})=>e(new t(o)),n))}static getPlanner(e,o){return o=this._setupDI("planner",e,o),new Promise((e,n)=>t.import("./planner-45fa06a4.nomodule.js").then(({Planner:t})=>e(new t(o)),n))}static async getGlbViewer(e,o){return o=this._setupDI("glb-viewer",e,o),new Promise((e,n)=>t.import("./glb-viewer-08d3c062.nomodule.js").then(({GlbViewer:t})=>e(new t(o)),n))}static getMaterialViewer(e,o){return o=this._setupDI("configurator",e,o),new Promise((e,n)=>t.import("./material-viewer-2d5eaabc.nomodule.js").then(({MaterialViewer:t})=>e(new t(o)),n))}static getCoreTools(e,o){return o=this._setupDI("tools-core",e,o),new Promise((e,n)=>t.import("./tools-core-aaf457c3.nomodule.js").then(({ToolsCore:t})=>{const n=new t(o);n.boot(),e(n)},n))}static getRapiAccess(){return o.addToContainer([new n("rapi-access",a,0),new n("global-callback",r,0)]),Promise.resolve(o.lookup("rapi-access"))}static get callbacks(){return o.addToContainer([new n("global-callback",r,0)]),Promise.resolve(o.lookup("global-callback"))}static setGlobalInitData(e){e&&(o.addToContainer([new n("global-init-data",i,0)]),o.lookup("global-init-data").setOverrides(e))}static getContext(e){return o.getContext(e)}static _setupDI(e,t,a){return t&&(o.addToContainer([new n("init-data",s,1)]),a||(a=o.getContext(e)),o.lookup("init-data",a).setOverrides(t)),a}})}}}));
1
+ System.register(["./roomle-dependency-injection-348f3aac.nomodule.js","./main-thread-to-worker-38d48e06.nomodule.js"],(function(e,t){var o,n,r,a,i,s;return{setters:[function(e){o=e.b,n=e.D,r=e.R,a=e.av,i=e.aw,s=e.ax},function(){}],execute:function(){e("default",class{static getConfigurator(e,o){return o=this._setupDI("configurator",e,o),new Promise((e,n)=>t.import("./configurator-65da998a.nomodule.js").then(({Configurator:t})=>e(new t(o)),n))}static getPlanner(e,o){return o=this._setupDI("planner",e,o),new Promise((e,n)=>t.import("./planner-eabbeff8.nomodule.js").then(({Planner:t})=>e(new t(o)),n))}static async getGlbViewer(e,o){return o=this._setupDI("glb-viewer",e,o),new Promise((e,n)=>t.import("./glb-viewer-933e235f.nomodule.js").then(({GlbViewer:t})=>e(new t(o)),n))}static getMaterialViewer(e,o){return o=this._setupDI("configurator",e,o),new Promise((e,n)=>t.import("./material-viewer-de60ddd4.nomodule.js").then(({MaterialViewer:t})=>e(new t(o)),n))}static getCoreTools(e,o){return o=this._setupDI("tools-core",e,o),new Promise((e,n)=>t.import("./tools-core-8b9e2021.nomodule.js").then(({ToolsCore:t})=>{const n=new t(o);n.boot(),e(n)},n))}static getRapiAccess(){return o.addToContainer([new n("rapi-access",r,0),new n("global-callback",a,0)]),Promise.resolve(o.lookup("rapi-access"))}static get callbacks(){return o.addToContainer([new n("global-callback",a,0)]),Promise.resolve(o.lookup("global-callback"))}static setGlobalInitData(e){e&&(o.addToContainer([new n("global-init-data",i,0)]),o.lookup("global-init-data").setOverrides(e))}static getContext(e){return o.getContext(e)}static _setupDI(e,t,r){return t&&(o.addToContainer([new n("init-data",s,1)]),r||(r=o.getContext(e)),o.lookup("init-data",r).setOverrides(t)),r}})}}}));
2
2
  //# sourceMappingURL=roomle-sdk.nomodule.js.map
@@ -0,0 +1,2 @@
1
+ import{_ as __decorate,i as inject,E as EventDispatcher,t as toRadiant,G as position3VectorsAreEqual,H as position2VectorsAreEqual,J as compareBox3Size,p as getIdealDistance,r as toDegrees,M as MaterialCreator,K as createMaterial,N as addTexture,O as getGUI,Q as rotationQuaternionsAreEqual,S as getDelta,T as MIN_MOVE_DISTANCE,U as LightSourceDetector,V as EnvironmentMapDecodeMaterial,W as RoomleWebGLRenderer,X as standaloneConfiguratorQualityLevels,Y as ENV_HDR_256_FILE_NAME,n as dispose,j as DynamicLightSettingLoader,q as RoomleComponentFactoryInitializer}from"./roomle-dependency-injection-6cc5f1dd.js";import{a as Vector3,bA as debounce,N as PerspectiveCamera,V as Vector2,bC as areCameraParametersEqual,ae as Sphere,ad as Box3,ag as Euler,Q as Quaternion,aB as deepMerge,O as Object3D,z as Mesh,bE as Shape,bF as Path,bG as ShapeGeometry,m as TextureLoader,bH as Fog,C as Color,r as RepeatWrapping,w as DoubleSide,W as OrthographicCamera,U as MathUtils,aT as handleJsonResponse,S as SpotLight,A as AmbientLight,D as DirectionalLight,R as RectAreaLight,bI as IcosahedronGeometry,ao as ShaderMaterial,bc as PlaneGeometry,h as MeshBasicMaterial,bJ as CircleGeometry,u as LineBasicMaterial,B as BufferGeometry,E as LineSegments,bK as PMREMGenerator,an as Matrix3,au as NoBlending,ah as CubeTexture,a9 as Texture,al as Scene,aN as BoxGeometry,bL as Clock,bD as sanitizedCameraMode,bB as getColor,bw as WebGLRenderer,i as SRGBColorSpace,bl as PCFSoftShadowMap,bM as download}from"./main-thread-to-worker-307e6096.js";var TWEEN_FILE_NAME="static/Tween-d57ee5d181fce582.js";class CameraControl extends EventDispatcher{constructor(t,e,i){if(super(),this._tweenEnd=null,this._cameraStandingStill=!0,this._pitch=toRadiant(10),this._yaw=toRadiant(-30),this._distance=-1,this._locked=!1,this._inputListeners=[],this._lerpEnabled=!0,this._creator_=t,this._inputManager=e,this._initInputListener(),this._addInputListeners(),this._cameraPosition=new Vector3,this._targetPosition=new Vector3,i?this._cameraPosition.copy(i):this._cameraPosition=new Vector3(0,.5,3),this._initData.debug){const t=this.getDebugCameraPosition();t&&this._setCurrentCameraParameters(t)}let n=this._domHelper.getClientDimensions();this._width=n.x,this._height=n.y,this._dispatchCameraIdle=debounce(this._dispatchCameraIdle.bind(this),32)}getCamera(){return this._getCamera()}_addInputListeners(){this._inputListeners.forEach(t=>{this._inputManager.addEventListener(t.key,t.fun,this)})}_removeInputListeners(){this._inputListeners.forEach(t=>{this._inputManager.removeEventListener(t.key,t.fun)}),this._inputListeners=[]}cleanUp(){this._removeInputListeners()}animateCamera(t){let e=this._cameraPosition;if(!e||position3VectorsAreEqual(e,this.getCamera().position))return this._cameraStandingStill||(this._cameraStandingStill=!0,setTimeout(()=>this._dispatchCameraIdle(),16),this._initData.debug&&this.saveDebugCameraPosition()),!1;if(this._cameraStandingStill&&this.dispatchEvent(7,3),this._cameraStandingStill=!1,!this._lerpEnabled||this._tweenEnd||this._initData.e2e)this.getCamera().position.copy(e);else{let i=this.getCamera().position.clone();const n=Math.min(10*t,1);i.lerp(e,n),this.getCamera().position.copy(i)}return!0}getDebugCameraPosition(){return JSON.parse(localStorage.getItem("debug_camera_position"))}saveDebugCameraPosition(){localStorage.setItem("debug_camera_position",JSON.stringify(this.getCurrentCameraParameters()))}_dispatchCameraIdle(){this.dispatchEvent(8,3)}_tweenCameraParameter(t,e,i=!1){return this._initData.e2e?(this.dispatchEvent(0,3),this.dispatchEvent(1,3),this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._setCameraNear(),this._update(new Vector3(e.targetX,e.targetY,e.targetZ),i),this.dispatchEvent(2,3),Promise.resolve()):new Promise(n=>{if(e.yaw-t.yaw<=-Math.PI?t.yaw-=2*Math.PI:e.yaw-t.yaw>=Math.PI&&(t.yaw+=2*Math.PI),window.TWEEN){if(null!==this._tweenEnd&&this._tweenEnd.blockOtherTweens)return;this._tweenEnd=e,new TWEEN.Tween(t).to(e,400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{this.dispatchEvent(1,3),this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._setCameraNear(),this._update(new Vector3(t.targetX,t.targetY,t.targetZ),i)}).onComplete(()=>{this.dispatchEvent(2,3),this._dispatchCameraIdle(),this._tweenEnd=null,n()}).start(),this.dispatchEvent(0,3)}})}_setCameraNear(){const t=this.getCamera();if(t instanceof PerspectiveCamera){const e=Math.max(.1,this._distance/6);t.near=e}}getCurrentCameraParameters(){const t=this._targetPosition.clone();return{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:t.x,targetY:t.y,targetZ:t.z}}_setCurrentCameraParameters(t){this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._targetPosition.copy(new Vector3(t.targetX,t.targetY,t.targetZ))}_rotateHorizontal(t){this._yaw-=t,this._yaw<-Math.PI?this._yaw+=2*Math.PI:this._yaw>Math.PI&&(this._yaw-=2*Math.PI)}_rotateVertical(t){this._pitch+=t,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI)}saveState(t){if(t||!this._stateSaved){let t=this._yaw,e=this._pitch,i=this._distance,n=this._targetPosition.clone();if(this._stateSaved={yaw:t,pitch:e,distance:i,targetX:n.x,targetY:n.y,targetZ:n.z,blockOtherTweens:!0},this._getCamera().fov){let t=this._getCamera();this._stateSaved.fov=t.fov,this._stateSaved.near=t.near,this._stateSaved.far=t.far}return this._stateSaved}return null}resetToState(){if(this._stateSaved){this._stateSaved.blockOtherTweens=!1;let t=this._targetPosition.clone();this._tweenCameraParameter({yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:t.x,targetY:t.y,targetZ:t.z},this._stateSaved,!0)}this._stateSaved=null}setToState(t,e){this._tweenCameraParameter(t,e,!0)}hasSavedState(){return null!=this._stateSaved}lock(){this._locked=!0}unlock(){this._locked=!1}isLocked(){return this._locked}getTargetPosition(){return this._targetPosition}_saveYawAndPitch(){this._getCamera().userData.yaw=this._yaw,this._getCamera().userData.pitch=this._pitch}getInputPosition(t){const{x:e,y:i}=this._domHelper.getClientDimensions();return new Vector3(t.x/e*2-1,-t.y/i*2+1,.5)}addLightContainer(t){t.name="lights";const e=this._getCamera(),i=e.children.find(t=>"lights"===t.name);i&&e.remove(i),e.add(t)}checkNearFarDistance(t){if(!t)return;const e=this._cameraPosition.distanceTo(t),i=this._getCamera();i instanceof PerspectiveCamera&&e>i.far&&(i.far=e+1)}setBounds(t){this._boundingBox=t}}__decorate([inject],CameraControl.prototype,"_domHelper",void 0),__decorate([inject],CameraControl.prototype,"_initData",void 0);class ZoomChangeEvent{constructor(t,e){this.minZoom=!1,this.maxZoom=!1,this.minZoom=t,this.maxZoom=e}}const DISTANCE_FACTOR=2.725;class CameraControl3D extends CameraControl{constructor(t,e,i,n){super(t,e,i),this._bounds=new Vector3,this._scale=1,this._state=0,this._zoomSpeed=Math.pow(.95,3),this.minDistance=0,this.maxDistance=5,this.minPolarAngle=toRadiant(0),this.maxPolarAngle=toRadiant(85),this._objectRotation=0,this.minAzimuthAngle=Number.NEGATIVE_INFINITY,this.maxAzimuthAngle=Number.POSITIVE_INFINITY,this._zoomDistance=.1,this._userInteraction=!1,this._currentZoomHash="",this._maxZoomedIn=!1,this._maxZoomedOut=!1,this._panningEnabled=!1,this._targetPositionIsPanned=!1,n?this._camera=n:this._initCamera(),this._camera.fov=30,this._targetPosition||(this._targetPosition=new Vector3(0,0,0),this._targetPositionIsPanned=!1);const{cameraRestriction:s,zoomDistance:a,minVerticalCameraAngle:o,maxVerticalCameraAngle:r,minHorizontalCameraAngle:h,maxHorizontalCameraAngle:c}=this._initData;if(a&&(this._zoomDistance=a/100),void 0!==o&&(this.minPolarAngle=toRadiant(o<0?o:-1*o)),void 0!==r&&(this.maxPolarAngle=toRadiant(r)),void 0!==h&&(this.minAzimuthAngle=toRadiant(h<0?h:-1*h)),void 0!==c&&(this.maxAzimuthAngle=toRadiant(c)),void 0!==s){let t=Math.abs(toRadiant(s));this.minAzimuthAngle=-t,this.maxAzimuthAngle=t,this.maxPolarAngle=Math.min(t,toRadiant(85))}this._update()}_getCamera(){return this._camera||this._initCamera(),this._camera}getCamera(){return super.getCamera()}_initCamera(){this._camera=new PerspectiveCamera,this._camera.fov=30,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5)}setObjectRotation(t){this._objectRotation=t}getObjectRotation(){return this._objectRotation}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions();this._camera.aspect=t/e,this._camera.updateProjectionMatrix()}animateCamera(t){if(!super.animateCamera(t))return!1;let e=this._targetPosition;return!!e&&(this.getCamera().lookAt(e),!0)}_initInputListener(){this._inputListeners.push({key:3,fun:()=>{this._state=1}}),this._inputListeners.push({key:6,fun:t=>{var e,i;1!==this._state||this._locked||(this._userInteraction=!0,!(void 0!==(null===(e=t.event)||void 0===e?void 0:e.shiftKey)&&(null===(i=t.event)||void 0===i?void 0:i.shiftKey))&&this._panningEnabled&&this.disablePanning(),this._move(new Vector2(t.position.x,t.position.y),t.type))}}),this._inputListeners.push({key:11,fun:t=>{1===this._state||this._locked||(this._userInteraction=!0,this._pan(new Vector2(t.position.x,t.position.y),t.type))}}),this._inputListeners.push({key:4,fun:t=>{1===this._state&&this.dispatchEvent(2,t.type),this._state=0,this._orbitPosition=null,this._lerpEnabled=!0}}),this._inputListeners.push({key:7,fun:({event:t})=>{this._maxZoomedIn||(t&&(t.preventDefault(),t.stopPropagation()),this.zoomIn())}}),this._inputListeners.push({key:8,fun:({event:t})=>{this._maxZoomedOut||(t&&(t.preventDefault(),t.stopPropagation()),this.zoomOut())}})}_panTargetPosition(t){const e=t.clone().sub(this._orbitPosition),i=this._domHelper.element,n=this._targetPosition.project(this._camera),s=Math.max(2,4*(1-this._distance/this.maxDistance));n.x=n.x-e.x/i.clientHeight*s,n.y=n.y+e.y/i.clientHeight*s,this._targetPositionIsPanned=!0,this._targetPosition.copy(n.unproject(this._camera))}_pan(t,e){this._lerpEnabled=!1,this._orbitPosition||(this._orbitPosition=new Vector2(t.x,t.y),this.dispatchEvent(0,e)),this._panTargetPosition(t),position2VectorsAreEqual(this._orbitPosition,t)||this.dispatchEvent(1,e),this._orbitPosition.copy(t),this._update()}_move(t,e){this._orbitPosition||(this._orbitPosition=new Vector2(t.x,t.y),this.dispatchEvent(0,e));const i=t.clone().sub(this._orbitPosition),n=this._domHelper.element;this._panningEnabled?this._panTargetPosition(t):(this._rotateHorizontal(2*Math.PI*i.x/n.clientWidth*1),this._rotateVertical(2*Math.PI*i.y/n.clientHeight*1)),position2VectorsAreEqual(this._orbitPosition,t)||this.dispatchEvent(1,e),this._orbitPosition.copy(t),this._update()}checkBoundsAndPlaceCamera(t,e=!0){this._boundingBox&&compareBox3Size(t,this._boundingBox)<=0?this.setBounds(t):this.zoomToFitBounds(t,e)}zoomToFitBounds(t,e=!0){this.setBounds(t);const i=t.getSize(new Vector3);if(this._initData.debug||i.x+i.y+i.z===0)return;const n=this.getCurrentCameraParameters(),s=t.getCenter(new Vector3),a=this._setDistanceAndRangesBasedOnBounds(i);this._checkZoomDistance(t,a);const o={yaw:e?this._yaw:n.yaw,pitch:e?this._pitch:n.pitch,distance:a,targetX:s.x,targetY:s.y,targetZ:s.z};areCameraParametersEqual(n,o)||this._tweenCameraParameter(n,o,!1)}updateToBounds(t,e,i=!0,n){if(this.setBounds(t),this._initData.debug)return;const s=t.getCenter(new Vector3);n?(this._targetPosition=n.clone(),this._targetPositionIsPanned=!1):this._targetPositionIsPanned||(this._targetPosition=new Vector3(s.x,s.y,s.z));const a=this.getCurrentCameraParameters(),o=t.getSize(new Vector3);if(i){const i=this._setDistanceAndRangesBasedOnBounds(o);this._distance=i,this._checkZoomDistance(t,i),this._userInteraction?this._tweenCameraParameter(a,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},e):this._update()}else this._setDistanceAndRangesBasedOnBounds(o,!1);this._update()}_checkZoomDistance(t,e){const i=t.getBoundingSphere(new Sphere);e-i.radius<this._zoomDistance&&(console.warn("the initial camera position is closer than the zoomDistance param, zoomDistance is set to initial camera position."),this._zoomDistance=e-i.radius)}_setDistanceAndRangesBasedOnBounds(t,e=!0){const{offsetWidth:i,offsetHeight:n}=this._getOffset();this._bounds.copy(t);const{cameraSpacing:s}=this._initData;t.addScalar(s/100),this.minDistance=Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z);const a=Math.max(t.x,t.y),{x:o,y:r}=this._getMargin(i,n),h=getIdealDistance(t.x+o,t.y+r,t.z,this._camera.fov,i,n);return this._distance<h&&e&&(this._distance=h),this.maxDistance=h+a,this.maxDistance<2&&(this.maxDistance=2),this._camera.far=5*this.maxDistance,this._setCameraNear(),h}_getIdealDistance(){const{offsetWidth:t,offsetHeight:e}=this._getOffset(),{x:i,y:n}=this._getMargin(t,e);return getIdealDistance(this._bounds.x+i,this._bounds.y+n,this._bounds.z,this._camera.fov,t,e)}_getOffset(){const t=this._domHelper.getClientDimensions(),e=t.x,i=t.y;return{offsetWidth:this._camera.offset?e-e*this._camera.offset.left-e*(1-this._camera.offset.right):e,offsetHeight:this._camera.offset?i-i*this._camera.offset.bottom-i*(1-this._camera.offset.top):i}}_getMargin(t,e){let i=this._bounds.x/2,n=this._bounds.y/2;return t>1080&&(i+=this._bounds.x<.3?.2:0,i+=this._bounds.x*(t/1080-1)),e>1080&&(i+=this._bounds.y<.3?.2:0,n+=this._bounds.y*(e/1080-1)),{x:i,y:n}}reset(t,e,i,n,s=!0){const a=t.getSize(new Vector3);if(a){if(e)this._targetPosition.copy(e);else{const e=t.getCenter(new Vector3);this._targetPosition.copy(e)}const o=this.getCurrentCameraParameters();if(i||(i=-30),n||(n=10),i+=toDegrees(this._objectRotation),this._initData.debug)return this._distance=this._setDistanceAndRangesBasedOnBounds(a),this._update(this._targetPosition),void this._setDistanceAndRangesBasedOnBounds(a);const r=this._setDistanceAndRangesBasedOnBounds(a),h=toRadiant(n),c=toRadiant(i);let d=this._targetPosition.clone();s?this._tweenCameraParameter(o,{yaw:c,pitch:h,distance:r,targetX:d.x,targetY:d.y,targetZ:d.z},!0):(this._pitch=h,this._yaw=c,this._distance=r,this._update(this._targetPosition))}else console.warn("you cant reset without bounds!")}updateAndReset(t,e,i,n,s,a=!0){const o=new Vector3(-t.x/2,0,-t.z/2),r=new Vector3(t.x/2,t.y,t.z/2);if(this._boundingBox=new Box3(o,r),s&&t.addScalar(s),e?this._targetPosition.copy(e):(this._targetPosition=new Vector3(0,t.y/2,0),this._targetPositionIsPanned=!1),-1===this._distance){const e=this._setDistanceAndRangesBasedOnBounds(t);this._distance=Math.max(2,e)}const h=this.getCurrentCameraParameters();i||(i=-30),n||(n=10),i+=toDegrees(this._objectRotation),this._pitch=toRadiant(n),this._yaw=toRadiant(i),this._setDistanceAndRangesBasedOnBounds(t);let c=this._targetPosition.clone();a?this._tweenCameraParameter(h,{yaw:this._yaw,pitch:this._pitch,distance:this.maxDistance,targetX:c.x,targetY:c.y,targetZ:c.z},!0):this._update(this._targetPosition)}_update(t,e){this._initData.debug?this._pitch=Math.max(toRadiant(-89),Math.min(toRadiant(89),this._pitch)):(this._yaw=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this._yaw)),this._pitch=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._pitch))),this._saveYawAndPitch();const i=new Euler(-this._pitch,this._yaw,0,"ZYX"),n=(new Quaternion).setFromEuler(i),s=new Vector3(0,0,-1);s.applyQuaternion(n),this._distance*=this._scale,this._initData.debug||(this._distance=Math.min(this.maxDistance,this._distance)),t&&this._targetPosition.copy(t);const a=this._targetPosition.clone().sub(s.multiplyScalar(this._distance));if(this._initData.debug)this._cameraPosition.copy(a),this._zoomChanged(!1,!1);else if(e)this._cameraPosition.copy(a);else{const t=this._getCameraSphere(a);null!=this._boundingBox&&this._boundingBox.intersectsSphere(t)&&this._scale>=1?this._distance+=.1:null==this._boundingBox||this._boundingBox.intersectsSphere(t)?this._zoomChanged(!1,!0):(this._cameraPosition.copy(a),this._distance===this.maxDistance?this._zoomChanged(!0,!1):this._zoomChanged(!1,!1))}this._scale=1}_zoomChanged(t,e){let i=t+""+e;0===this._currentZoomHash.length||this._currentZoomHash!==i?(this.dispatchEvent(5,new ZoomChangeEvent(t,e)),this._currentZoomHash=i):t||e||this.dispatchEvent(5,new ZoomChangeEvent(t,e)),this._maxZoomedIn=e,this._maxZoomedOut=t}zoomTo(t){return this._tweenCameraParameter(this.getCurrentCameraParameters(),t,!0)}_getCameraSphere(t){const e=Math.max(this._bounds.x,this._bounds.y),i=Math.max(e/10,this._zoomDistance);return new Sphere(t,i)}zoomIn(t){this._lerpEnabled=!0,this._scale*=t?Math.pow(.95,t):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(3)}zoomOut(t){this._lerpEnabled=!0,this._scale/=t?Math.pow(.95,t):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(4)}clear(){this._userInteraction=!1,this._initData.debug||(this._distance=-1,this._targetPosition=new Vector3(0,0,0),this._targetPositionIsPanned=!1)}async moveCamera(t){const{x:e,y:i,z:n}=this._boundingBox.getCenter(new Vector3);t.targetX=t.targetX||e,t.targetY=t.targetY||i,t.targetZ=t.targetZ||n,t.distance=t.distance||this._getIdealDistance();const s=this.getCurrentCameraParameters(),a=deepMerge(JSON.parse(JSON.stringify(s)),t);return this._tweenCameraParameter(s,a,!0)}enablePanning(){this._lerpEnabled=!1,this._panningEnabled=!0}disablePanning(){this._lerpEnabled=!1,this._panningEnabled=!1}getKernelZoomFactor(){const t=this.maxDistance;return 1-this._distance/(t-2)+.2}}class Environment{constructor(t,e){this._scene=t,e&&(e.removeFromScene(),e.cleanUp())}updateCamera(t){}reload(){this.removeFromScene(),this.addToScene()}updateBounds(t,e){this._bounds=t}cleanUp(){this._scene=null}}class BakedShadowPlane{constructor(t){this._innerSize=1,this._outerSize=100,this._plane=new Object3D,this._plane.rotation.x=-Math.PI/2;const e=MaterialCreator.createMeshStandardMaterial({});this._innerPlaneMesh=new Mesh,this._innerPlaneMesh.layers.set(2),this._innerPlaneMesh.material=e,this._innerPlaneMesh.receiveShadow=!0,this._outerPlaneMesh=new Mesh,this._outerPlaneMesh.layers.set(2),this._outerPlaneMesh.material=e,this._outerPlaneMesh.receiveShadow=!0,this._plane.add(this._innerPlaneMesh),this._plane.add(this._outerPlaneMesh),this._innerSize=1,this._outerSize=t,this._updatePlane(this._innerSize,this._outerSize)}getRootNode(){return this._plane}getInnerPlane(){return this._innerPlaneMesh}getOuterPlane(){return this._outerPlaneMesh}updateSize(t){this._innerSize=t,this._updatePlane(this._innerSize,this._outerSize)}_updatePlane(t,e){const i=new Shape;i.moveTo(-t/2,-t/2),i.lineTo(-t/2,t/2),i.lineTo(t/2,t/2),i.lineTo(t/2,-t/2),i.lineTo(-t/2,-t/2);const n=new Shape;n.moveTo(-e/2,-e/2),n.lineTo(-e/2,e/2),n.lineTo(e/2,e/2),n.lineTo(e/2,-e/2),n.lineTo(-e/2,-e/2);const s=new Path;s.moveTo(-t/2,-t/2),s.lineTo(-t/2,t/2),s.lineTo(t/2,t/2),s.lineTo(t/2,-t/2),s.lineTo(-t/2,-t/2),n.holes.push(s);const a=new ShapeGeometry(i);this._innerPlaneMesh.geometry&&this._innerPlaneMesh.geometry.dispose(),this._innerPlaneMesh.geometry=a;const o=new ShapeGeometry(n);this._outerPlaneMesh.geometry&&this._outerPlaneMesh.geometry.dispose(),this._outerPlaneMesh.geometry=o;const r=a.attributes.uv.clone();a.setAttribute("uv2",r);const h=a.attributes.uv2.array;for(let t=0;t<h.length;++t)h[t]+=.5}}class FloorEnvironment extends Environment{constructor(t,e,i){super(t,e),this._longestSide=2,this._bakedShadowPlane=new BakedShadowPlane(100),this._fog=i||!1,this._textureLoader=new TextureLoader,this.addToScene()}needsBounds(){return!0}needsCamera(){return this._fog}needsRotation(){return!1}updateBounds(t){return super.updateBounds(t),this._longestSide=Math.max(t.x,t.z),this._update(),!0}updateCamera(t){this._cameraDistance=t.position.distanceTo(new Vector3(0,0,0)),this._update()}_update(){this._fog&&this._updateFog()}_updateFog(){let t=this._longestSide/2;this._scene.fog=new Fog(16185078,this._cameraDistance+t+3,this._cameraDistance+t+3+1),this._scene.background=new Color(16185078)}_updateFloor(){if(this._floorMaterial)this._bakedShadowPlane.getOuterPlane().material=this._floorMaterial,this._bakedShadowPlane.getInnerPlane().material=this._floorMaterial;else{let t=this._width/1e3,e=this._height/1e3;this._repeatable&&(this._floorTexture.wrapS=RepeatWrapping,this._floorTexture.wrapT=RepeatWrapping,this._floorTexture.repeat.set(100/t,100/e));let i=MaterialCreator.createMeshStandardMaterial({map:this._floorTexture,side:DoubleSide});this._bakedShadowPlane.getInnerPlane().material=i,this._bakedShadowPlane.getOuterPlane().material=i}}addToScene(){this._scene&&this._scene.add(this._bakedShadowPlane.getRootNode())}removeFromScene(){this._scene.remove(this._bakedShadowPlane.getRootNode())}setFloorMaterial(t,e,i,n){return this._width=e,this._height=i,this._repeatable=n,this._floorPromise=new Promise((e,i)=>{this._textureLoader.load(t,t=>{this._floorTexture=t,e()},null,i)}),new Promise((t,e)=>{this._floorPromise.then(()=>{this._updateFloor(),this._update(),t()},e)})}changeFloorMaterial(t,e){this._floorPromise=new Promise((i,n)=>{this._floorMaterial=createMaterial(t),this._rapiAccess.getTexturesOf(t).then(t=>{if(t.length>0){let s=[];t.forEach(t=>{s.push(addTexture(this._dataSyncer.requestAsset(t.image,!0),t,this._floorMaterial,e,1,1))}),Promise.all(s).then(()=>{setTimeout(()=>i(),0)},n)}else setTimeout(()=>i(),0)})});let i=[this._floorPromise];return new Promise((t,e)=>{Promise.all(i).then(()=>{this._updateFloor(),this._update(),t()},e)})}showGUI(){this._floorMaterial?this._addGUI():this._floorPromise&&this._floorPromise.then(()=>this._addGUI())}_addGUI(){let t=getGUI();if(!t)return;let e=t.addFolder("Floor");e.add(this._floorMaterial,"roughness").min(0).max(1).step(.01),e.add(this._floorMaterial,"reflectivity").min(0).max(1).step(.01),e.add(this._floorMaterial,"clearCoat").min(0).max(1).step(.01),e.add(this._floorMaterial,"clearCoatRoughness").min(0).max(1).step(.01),e.add(this._floorMaterial,"opacity").min(0).max(1).step(.01),e.add(this._floorMaterial,"metalness").min(0).max(1).step(.01),e.add(this._floorMaterial,"bumpScale").min(0).max(1).step(.01)}}__decorate([inject],FloorEnvironment.prototype,"_rapiAccess",void 0),__decorate([inject],FloorEnvironment.prototype,"_dataSyncer",void 0);class CameraControl2D extends CameraControl{constructor(t,e,i,n){super(t,e,i),this._scale=1,this._cameraZoom=1,this._state=0,this._size=5,this._lastPosition=new Vector2,this._zoomPosition=new Vector3,this._lastZoom=0,this._zoomSpeed=Math.pow(.95,2),n?(this._camera=n,this._cameraPosition=(new Vector3).copy(this._camera.position)):this._initCamera(i||new Vector3(0,10,0))}_getCamera(){return this._camera||this._initCamera(new Vector3(0,10,0)),this._camera}_initCamera(t){let{x:e,y:i}=this._domHelper.getClientDimensions(),n=e/i*this._size,s=this._size;this._camera=new OrthographicCamera(n/-2,n/2,s/2,s/-2,1,1e3),this._camera.position.copy(t),this._cameraPosition=t,this._camera.lookAt(new Vector3(0,0,0))}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions(),i=t/e*this._size,n=this._size;this._camera.left=i/-2,this._camera.right=i/2,this._camera.top=n/2,this._camera.bottom=n/-2,this._camera.updateProjectionMatrix()}_initInputListener(){this._inputListeners.push({key:3,fun:t=>{this._locked||(this._state=1,this._lastPosition.set(t.positionRelative.x,t.positionRelative.y),this.dispatchEvent(0))}}),this._inputListeners.push({key:6,fun:t=>{1!==this._state||this._locked||(this._move(new Vector2(t.positionRelative.x,t.positionRelative.y),t.type),this.dispatchEvent(1))}}),this._inputListeners.push({key:4,fun:t=>{1===this._state&&this.dispatchEvent(2),this._state=0}}),this._inputListeners.push({key:7,fun:t=>{t.event&&(t.event.stopPropagation(),t.event.preventDefault()),this.dispatchEvent(3),this._scale/=this._zoomSpeed,this._zoomTo(t.positionRelative),this._update()}}),this._inputListeners.push({key:8,fun:t=>{t.event&&(t.event.stopPropagation(),t.event.preventDefault()),this.dispatchEvent(4),this._scale*=this._zoomSpeed,this._zoomTo(t.positionRelative),this._update()}})}_zoomTo(t){if(Date.now()-this._lastZoom>200){let e=new Vector3(t.x,t.y,0);e.unproject(this._camera),this._zoomPosition.copy(e)}this._lastZoom=Date.now()}_move(t,e){let i=new Vector3,n=new Vector3(this._lastPosition.x,this._lastPosition.y,0),s=new Vector3(t.x,t.y,0);n.unproject(this._camera),s.unproject(this._camera),i.subVectors(s,n),this._cameraPosition.x-=i.x*(2===e?1.1:1),this._cameraPosition.z-=i.z*(2===e?1.1:1),this._lastPosition.copy(t)}zoomToFitBounds(t,e,i){if(compareBox3Size(t,this._boundingBox)<0&&!i)return void this.setBounds(t);this.setBounds(t);const n=t.getSize(new Vector3),s=t.getCenter(new Vector3),a=n.x/-2/this._camera.left,o=n.z/-2/this._camera.bottom,r=1/Math.max(a,o);(r<this._cameraZoom||e)&&(this._scale=r,this._cameraZoom=r,this._cameraPosition.x=s.x,this._cameraPosition.z=s.z)}_update(t){this._scale=Math.min(this._scale,5),this._scale=Math.max(this._scale,.1);let e=(new Vector3).subVectors(this._zoomPosition,this._cameraPosition).multiplyScalar((this._scale-this._cameraZoom)/this._scale);this._cameraPosition.x+=e.x,this._cameraPosition.z+=e.z,this._cameraZoom!==this._scale&&this.dispatchEvent(5,new ZoomChangeEvent(.1===this._scale,5===this._scale)),this._cameraZoom=this._scale,this._camera.updateProjectionMatrix()}animateCamera(t){if(!super.animateCamera(t)&&Math.abs(this._cameraZoom-this._camera.zoom)<=.01)return!1;const e=Math.min(10*t,1);return this._camera.zoom=MathUtils.lerp(this._camera.zoom,this._cameraZoom,e),!0}getKernelZoomFactor(){const t=1e3*(this._camera.right-this._camera.left);return this._domHelper.element.clientWidth/t*this._camera.zoom}}const KEYBOARD_ROTATION_ANGLE=Math.PI/4;class CameraControlFirstPerson extends CameraControl{constructor(t,e,i,n){super(t,e,i),this._state=0,this._rotationSpeed=1,this._keyMap=new Map,this.minPolarAngle=toRadiant(-60),this.maxPolarAngle=toRadiant(60),this._camera=n||new PerspectiveCamera,this._camera.fov=70,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5),i?this._camera.position.set(i.x,1.5,i.z):this._camera.position.set(0,1.5,0),this._cameraPosition=new Vector3,this._cameraPosition.copy(this._camera.position),this._cameraRotation=new Quaternion,this._pitch=0,this._yaw=0;let s=new Euler(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(s),window.addEventListener("gamepadconnected",this._gamepadConnected.bind(this)),window.addEventListener("gamepaddisconnected",this._gamepadDisconnected.bind(this))}_gamepadConnected(t){this.startButtonPressListener()}_gamepadDisconnected(t){window.cancelAnimationFrame(this._listenerLoopAnimationFrame)}startButtonPressListener(){this._listenerLoopAnimationFrame=window.requestAnimationFrame(()=>{this.buttonPressListener()})}buttonPressListener(){let t=navigator.getGamepads()[0];this._checkRightStick(t),this._checkLeftStick(t),this._checkButtons(t),this._processKeyMap(this._keyMap,.001),this.startButtonPressListener()}_checkRightStick(t){let e=t.axes[2],i=t.axes[3];Math.abs(e)>.2&&(this._rotateHorizontal(.01*KEYBOARD_ROTATION_ANGLE*e),this._update(),this.dispatchEvent(1)),Math.abs(i)>.2&&(this._rotateVertical(.01*KEYBOARD_ROTATION_ANGLE*i),this._update(),this.dispatchEvent(1))}_checkLeftStick(t){let e=t.axes[0],i=t.axes[1];Math.abs(i)>.2?i<0?this._keyMap.set(87,!0):this._keyMap.set(83,!0):t.buttons&&t.buttons[12]&&t.buttons[12].pressed?this._keyMap.set(87,!0):t.buttons&&t.buttons[13]&&t.buttons[13].pressed?this._keyMap.set(83,!0):(this._keyMap.set(87,!1),this._keyMap.set(83,!1)),Math.abs(e)>.2?e<0?this._keyMap.set(65,!0):this._keyMap.set(68,!0):(this._keyMap.set(65,!1),this._keyMap.set(68,!1))}_checkButtons(t){t.buttons&&t.buttons[6]&&t.buttons[6].pressed?this._keyMap.set(16,!0):this._keyMap.set(16,!1),t.buttons&&t.buttons[14]&&t.buttons[14].pressed?(this._keyMap.set(37,!0),this.dispatchEvent(1)):this._keyMap.set(37,!1),t.buttons&&t.buttons[15]&&t.buttons[15].pressed?(this._keyMap.set(39,!0),this.dispatchEvent(1)):this._keyMap.set(39,!1)}animateCamera(t){let e=this._cameraPosition,i=this._cameraRotation,n=this.getCamera(),s=position3VectorsAreEqual(e,n.position),a=rotationQuaternionsAreEqual(i,n.quaternion);if(!e||s&&a)return!1;let o=this.getCamera().position.clone(),r=Math.min(10*t,1);o.lerp(e,r),this.getCamera().position.copy(o);let h=this.getCamera().quaternion.clone(),c=Math.min(5*t,1);h.slerp(i,c),this.getCamera().setRotationFromQuaternion(h);let d=!1;return this._keyMap.forEach(t=>{t&&(d=!0)}),d&&this._processKeyMap(this._keyMap,t),!0}_getCamera(){return this._camera}_initInputListener(){window.addEventListener("keyup",this._onKeyChanged.bind(this),!1),window.addEventListener("keydown",this._onKeyChanged.bind(this),!1),this._inputListeners.push({key:3,fun:t=>{this._down(t)}}),this._inputListeners.push({key:6,fun:t=>{this._move(t)}}),this._inputListeners.push({key:4,fun:t=>{this._up(t)}})}_down(t){this._downPosition=t.position,this._position=t.position,this._state=1,2===t.type&&window.setTimeout(this._onLongDown.bind(this),350),2===t.type?this._rotationSpeed=.6:this._rotationSpeed=1}_move(t){this._position=t.position,1!==this._state||this._locked||this._orbit(new Vector2(t.position.x,t.position.y)),2!==this._state||this._locked||(this._orbit(new Vector2(t.position.x,t.position.y)),this._moveForward())}_up(t){1===this._state&&this.dispatchEvent(2),2===this._state&&this._keyMap.set(87,!1),this._state=0,this._orbitPosition=null}_onLongDown(){getDelta(this._downPosition,this._position)<MIN_MOVE_DISTANCE&&1===this._state&&(this._state=2,this._orbit(new Vector2(this._position.x,this._position.y)),this._moveForward())}_update(t){let e=new Euler(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(e)}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions();this._camera.aspect=t/e,this._camera.updateProjectionMatrix()}_onKeyChanged(t){this._keyMap.set(t.keyCode,"keydown"===t.type),this.dispatchEvent(6),this._processKeyMap(this._keyMap,.001)&&t.preventDefault()}_processKeyMap(t,e){e=Math.min(e,.1);let i=new Vector3(0,0,0),n=!1;return this._processUpDown(t,i,e),t.get(65)&&(i.x=-1*e),t.get(68)&&(i.x=1*e),t.get(37)&&(this._rotateHorizontal(-KEYBOARD_ROTATION_ANGLE*this._rotationSpeed*e),n=!0),t.get(39)&&(this._rotateHorizontal(KEYBOARD_ROTATION_ANGLE*this._rotationSpeed*e),n=!0),t.get(16)&&(i.x*=3,i.z*=3),!(0===i.x&&0===i.y&&0===i.z&&!n||(i.applyQuaternion(this.getCamera().quaternion),this._cameraPosition.add(new Vector3(i.x,0,i.z)),this._update(),0))}_processUpDown(t,e,i){(t.get(87)||t.get(38))&&(e.z=-1*i),(t.get(83)||t.get(40))&&(e.z=1*i)}_orbit(t){this._orbitPosition||(this._orbitPosition=new Vector2(t.x,t.y),this.dispatchEvent(0));let e=t.clone().sub(this._orbitPosition),i=this._domHelper.element instanceof Document?this._domHelper.element.body:this._domHelper.element;e.multiplyScalar(-1),this._rotateHorizontal(2*Math.PI*e.x/i.clientWidth*1),this._rotateVertical(2*Math.PI*e.y/i.clientHeight*1),position2VectorsAreEqual(this._orbitPosition,t)||this.dispatchEvent(1),this._orbitPosition.copy(t),this._update()}_moveForward(){this._keyMap.set(87,!0),this._processKeyMap(this._keyMap,.001)}_rotateVertical(t){let e=this._pitch+t;e>this.maxPolarAngle||e<this.minPolarAngle||(this._pitch=e,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI),this._saveYawAndPitch())}getKernelZoomFactor(){return this._camera.zoom}}class BackgroundEnvironment extends Environment{constructor(t,e,i,n,s){if(super(t,e),this._color=i,this._oldBackground=t.background,n&&s){this._canvas=n,this._style=document.createElement("style");let t='background-image: url("'+s+'"); background-size: cover;';this._style.innerText=".rml-scene-background {"+t+"}",this._canvas.appendChild(this._style)}}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._color&&(this._scene.background=this._color),this._canvas&&this._canvas.classList&&(this._scene.background=null,this._canvas.classList.add("rml-scene-background"))}removeFromScene(){this._oldBackground&&(this._scene.background=this._oldBackground),this._canvas&&this._canvas.classList.remove("rml-scene-background")}showGUI(){}}class DynamicEnvironmentSettingLoader{parse(t,e,i,n,s){let a=JSON.parse(n);return a.environment?this.load(t,e,i,a,s):null}load(t,e,i,n,s){let a,o=n.environment;if(!o)return console.warn("No environment set in scene settings"),Promise.resolve(null);switch(o.type){case"color":a=new Promise(e=>e(new BackgroundEnvironment(t,i,new Color(o.details.color))));break;case"image":a=new Promise(n=>n(new BackgroundEnvironment(t,i,null,e,o.details.imageUrl)));break;case"floor":a=new Promise(e=>{this._rapiAccess.getMaterial(o.details.material).then(n=>{let a=void 0===o.details.fog||o.details.fog,r=new FloorEnvironment(t,i,a);r.changeFloorMaterial(n,s).then(()=>{e(r)})})});break;default:console.warn("Could not load environment, return old environment"),a=new Promise(t=>t(i))}return a}}__decorate([inject],DynamicEnvironmentSettingLoader.prototype,"_rapiAccess",void 0);class LightSetting{constructor(t,e){this._scene=t,e&&e.removeFromScene()}needsBounds(){return!1}updateBounds(t){}getCameraContainer(){return this._cameraContainer||(this._cameraContainer=new Object3D),this._cameraContainer}}class DynamicLightSetting extends LightSetting{constructor(t,e){super(t,e),this._lights=[]}needsBounds(){return!0}updateBounds(t){if(this._cameraLight){const e=this._cameraLight,i=new Vector3;t.getSize(i);const n=1.5*Math.max(Math.max(i.x,i.y),i.z);this._boundingSize=n,e.shadow.camera.top=n/2,e.shadow.camera.bottom=-n/2,e.shadow.camera.left=-n/2,e.shadow.camera.right=n/2,e.shadow.camera.updateProjectionMatrix()}}loadFromJSON(t){return new Promise(e=>{this._lights=this._dynamicLightSettingLoader.parse(t),this.addToScene(),e()})}loadFromObject(t){return new Promise(e=>{(null==t?void 0:t.lights)||e(),this._lights=this._dynamicLightSettingLoader.load(t),this._lights.forEach((t,e)=>{t.userData.movesWithCamera&&(this._cameraLight=t,this._lights.splice(e,1))}),this.addToScene(),e()})}loadFromURL(t){return new Promise((e,i)=>{fetch(new Request(t,{method:"GET"})).then(handleJsonResponse).then(t=>this.loadFromObject(t).then(e,i))})}addToScene(){this._lights.forEach(t=>{this._scene.add(t)}),this._cameraLight&&this._scene.add(this._cameraLight)}update(t,e){if(!this._cameraLight)return;let i=new Vector3;t.getWorldDirection(i),i.multiplyScalar(-this._boundingSize);let n=e.clone().add(i);this._cameraLight.position.copy(n)}removeFromScene(){this._lights.forEach(t=>{this._scene.remove(t)}),this._cameraLight&&this._scene.remove(this._cameraLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let t=getGUI();this._cameraLight&&this._addToGUI(t,this._cameraLight),this._lights.forEach(e=>{this._addToGUI(t,e)})}_addToGUI(t,e){t&&(e instanceof SpotLight&&this._addSpotLightToGUI(t,e),e instanceof AmbientLight&&this._addAmbientLightToGUI(t,e),e instanceof DirectionalLight&&this._addDirectionalLightToGUI(t,e),e instanceof RectAreaLight&&this._addRectAreaLightToGUI(t,e))}_addRectAreaLightToGUI(t,e){let i=t.addFolder(e.name),n={name:e.name,color:"#"+e.color.getHexString(),intensity:e.intensity*(e.width*e.height)};i.add(e,"visible"),i.add(n,"intensity").min(10).max(400).step(10).onChange(t=>{e.intensity=t/(e.width*e.height)}),i.add(e,"castShadow"),i.addColor(n,"color").onChange(t=>{e.color=new Color(t)}),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new Vector3(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new Vector3(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new Vector3(0,0,0))})}_addSpotLightToGUI(t,e){let i=t.addFolder(e.name),n={name:e.name,color:"#"+e.color.getHexString(),angle:180*e.angle/Math.PI};i.add(e,"visible"),i.add(e,"intensity").min(0).max(5).step(.1),i.add(e,"penumbra").min(0).max(1).step(.1),i.addColor(n,"color").onChange(t=>{e.color=new Color(t)}),i.add(n,"angle").min(10).max(180).step(1).onChange(t=>{e.angle=t*Math.PI/180}),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new Vector3(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new Vector3(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new Vector3(0,0,0))})}_addAmbientLightToGUI(t,e){let i={name:e.name,color:"#"+e.color.getHexString()},n=t.addFolder(e.name);n.add(e,"visible"),n.add(e,"intensity").min(0).max(5).step(.1),n.addColor(i,"color").onChange(t=>{e.color=new Color(t)})}_addDirectionalLightToGUI(t,e){let i=t.addFolder(e.name),n={name:e.name,color:"#"+e.color.getHexString()};i.add(e,"visible"),i.add(e,"intensity").min(0).max(5).step(.1),i.addColor(n,"color").onChange(t=>{e.color=new Color(t)}),i.add(e,"castShadow"),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new Vector3(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new Vector3(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new Vector3(0,0,0))})}}__decorate([inject],DynamicLightSetting.prototype,"_dynamicLightSettingLoader",void 0);class GroundProjectedSkybox extends Mesh{constructor(t,e={}){const i=[t.isCubeTexture?"#define ENVMAP_TYPE_CUBE":""].join("\n")+"\n\n\t\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\t\tuniform float radius;\n\t\t\t\tuniform float height;\n\t\t\t\tuniform float angle;\n\n\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\tuniform samplerCube map;\n\n\t\t\t\t#else\n\n\t\t\t\t\tuniform sampler2D map;\n\n\t\t\t\t#endif\n\n\t\t\t\t// From: https://www.shadertoy.com/view/4tsBD7\n\t\t\t\tfloat diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) \n\t\t\t\t{\n\n\t\t\t\t\tfloat d = dot ( rd, n );\n\n\t\t\t\t\tif( d > 0.0 ) { return 1e6; }\n\n\t\t\t\t\tvec3 o = ro - c;\n\t\t\t\t\tfloat t = - dot( n, o ) / d;\n\t\t\t\t\tvec3 q = o + rd * t;\n\n\t\t\t\t\treturn ( dot( q, q ) < r * r ) ? t : 1e6;\n\n\t\t\t\t}\n\n\t\t\t\t// From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm\n\t\t\t\tfloat sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) {\n\n\t\t\t\t\tvec3 oc = ro - ce;\n\t\t\t\t\tfloat b = dot( oc, rd );\n\t\t\t\t\tfloat c = dot( oc, oc ) - ra * ra;\n\t\t\t\t\tfloat h = b * b - c;\n\n\t\t\t\t\tif( h < 0.0 ) { return -1.0; }\n\n\t\t\t\t\th = sqrt( h );\n\n\t\t\t\t\treturn - b + h;\n\n\t\t\t\t}\n\n\t\t\t\tvec3 project() {\n\n\t\t\t\t\tvec3 p = normalize( vWorldPosition );\n\t\t\t\t\tvec3 camPos = cameraPosition;\n\t\t\t\t\tcamPos.y -= height;\n\n\t\t\t\t\tfloat intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );\n\t\t\t\t\tif( intersection > 0.0 ) {\n\n\t\t\t\t\t\tvec3 h = vec3( 0.0, - height, 0.0 );\n\t\t\t\t\t\tfloat intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );\n\t\t\t\t\t\tp = ( camPos + min( intersection, intersection2 ) * p ) / radius;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tp = vec3( 0.0, 1.0, 0.0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn p;\n\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 projectedWorldPosition = project();\n\n\t\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\t\tvec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tvec3 direction = normalize( projectedWorldPosition );\n\t\t\t\t\t\tvec2 uv = equirectUv( direction );\n\t\t\t\t\t\tvec3 outcolor = texture2D( map, uv ).rgb;\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\tgl_FragColor = vec4( outcolor, 1.0 );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <colorspace_fragment>\n\n\t\t\t\t}\n\t\t\t\t",n={map:{value:t},height:{value:e.height||15},radius:{value:e.radius||100}};super(new IcosahedronGeometry(1,16),new ShaderMaterial({uniforms:n,fragmentShader:i,vertexShader:"\n\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );\n\t\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t}\n\t\t\t",side:DoubleSide}))}set radius(t){this.material.uniforms.radius.value=t}get radius(){return this.material.uniforms.radius.value}set height(t){this.material.uniforms.height.value=t}get height(){return this.material.uniforms.height.value}}class GroundProjectedEnvironment extends Environment{constructor(t,e,i){super(t,e),this.updateEnvironmentTexture(i)}updateEnvironmentTexture(t){t&&(this._environmentTexture=t,this._skybox=new GroundProjectedSkybox(this._environmentTexture),this._skybox.name="Ground projected skybox",this._skybox.scale.setScalar(100)),this.reload()}needsBounds(){return!1}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._skybox&&this._scene.add(this._skybox)}removeFromScene(){this._scene&&this._skybox&&this._scene.remove(this._skybox)}showGUI(t){let e=getGUI();if(!e)return;let i=e.addFolder("Ground Projected Environment");i.add(this._skybox,"height").min(10).max(100).step(.1).onChange(t),i.add(this._skybox,"radius").min(20).max(200).step(.1).onChange(t)}}class LightSourceDetectorDebug{constructor(t){this._lightSourceDetector=t}static createPlane(t,e){const i=new PlaneGeometry(2,1),n=null!=e?e:new MeshBasicMaterial({color:12632256,side:DoubleSide}),s=new Mesh(i,n);return s.position.z=-.1,t.add(s),s}createDebugScene(t,e){this._scene=t,this._createLightGraphInMap(this._lightSourceDetector.sampleUVs,this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph,e)}_createLightGraphInMap(t,e,i,n){let s=[],a=[];for(let t=0;t<this._lightSourceDetector.lightGraph.noOfNodes;++t)0===i.adjacent[t].length?s.push(e[t]):a.push(e[t]);const o=s.map(t=>t.uv),r=a.map(t=>t.uv),h=t.filter(t=>!o.includes(t)&&!r.includes(t));this._createSamplePointsInMap(h,.005,16711680),this._createSamplePointsInMap(o,.01,255),this._createSamplePointsInMap(r,.01,65280),this._createClusterLinesInMap(this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph.edges,128);const c=this._lightSourceDetector.lightSources.map(t=>t.uv);this._createSamplePointsInMap(c,.015,16776960);let d=this._lightSourceDetector.lightSources;void 0!==n&&n>=0&&n<d.length&&(d=d.slice(0,n)),this._createCirclesInMap(d,8421376)}_createSamplePointsInMap(t,e,i){const n=new CircleGeometry(e,8,4),s=new MeshBasicMaterial({color:i});t.forEach(t=>{var e;const i=new Mesh(n,s);i.position.copy(this._uvToMapPosition(t)),i.name="samplePoint",null===(e=this._scene)||void 0===e||e.add(i)})}_createCirclesInMap(t,e){const i=new MeshBasicMaterial({color:e,transparent:!0,opacity:.5});t.forEach(t=>{var e;const n=new CircleGeometry(t.size,8,4),s=new Mesh(n,i);s.position.copy(this._uvToMapPosition(t.uv)),s.name="samplePoint",null===(e=this._scene)||void 0===e||e.add(s)})}_createClusterLinesInMap(t,e,i){var n;const s=new LineBasicMaterial({color:i}),a=[];e.forEach(e=>{for(let i=1;i<e.length;i++){const n=t[e[0]].uv,s=t[e[i]].uv;if(a.push(this._uvToMapPosition(n)),Math.abs(n.x-s.x)>.5){const t=(n.y+s.y)/2,e=n.x<s.x?0:1;a.push(this._uvToMapPosition(new Vector2(e,t))),a.push(this._uvToMapPosition(new Vector2(1-e,t)))}a.push(this._uvToMapPosition(s))}});const o=(new BufferGeometry).setFromPoints(a),r=new LineSegments(o,s);r.name="clusterLine",null===(n=this._scene)||void 0===n||n.add(r)}_uvToMapPosition(t){return new Vector3(2*t.x-1,t.y-.5,0)}}class EnvironmentPmremGenertor extends PMREMGenerator{constructor(t){super(t),this._extendedEquirectMaterial=this._createEquirectMaterial()}fromEquirectangularTexture(t,e){var i,n;const s=null!==(i=null==e?void 0:e.rotation)&&void 0!==i?i:0,a=null!==(n=null==e?void 0:e.intensity)&&void 0!==n?n:1;return this._extendedEquirectMaterial.uniforms.intensity.value=a,this._extendedEquirectMaterial.uniforms.rotationMatrix.value.set(Math.cos(s),0,-Math.sin(s),0,1,0,Math.sin(s),0,Math.cos(s)),super.fromEquirectangular(t)}_createEquirectMaterial(){const t=new ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},intensity:{value:1},rotationMatrix:{value:new Matrix3}},vertexShader:equilateralVertexShader,fragmentShader:equilateralFragmentShader,blending:NoBlending,depthTest:!1,depthWrite:!1});return this._equirectMaterial=t,t}}const equilateralVertexShader="\nprecision mediump float;\nprecision mediump int;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nuniform mat3 rotationMatrix;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection( vec2 uv, float face ) {\n uv = 2.0 * uv - 1.0;\n vec3 direction = vec3( uv, 1.0 );\n if ( face == 0.0 ) {\n direction = direction.zyx; // ( 1, v, u ) pos x\n } else if ( face == 1.0 ) {\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n } else if ( face == 2.0 ) {\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n } else if ( face == 3.0 ) {\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n } else if ( face == 4.0 ) {\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n } else if ( face == 5.0 ) {\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n }\n return direction;\n}\n\nvoid main() {\n vOutputDirection = rotationMatrix * getDirection(uv, faceIndex);\n gl_Position = vec4(position, 1.0);\n}\n",equilateralFragmentShader="\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform float intensity;\n\n#include <common>\n\nvoid main() { \n vec3 outputDirection = normalize(vOutputDirection);\n vec2 uv = equirectUv(outputDirection);\n gl_FragColor = vec4(texture2D(envMap, uv).rgb * intensity, 1.0);\n}\n";class EnvironmentSceneGenerator{}class EnvironmentDefinition{get lightSources(){return this._lightSources}set rotation(t){this._rotation!==t&&(this._rotation=t,this.needsUpdate=!0)}set intensity(t){this._intensity!==t&&(this._intensity=t,this.needsUpdate=!0)}set maxNoOfLightSources(t){this._maxNoOfLightSources!==t&&(this._maxNoOfLightSources=t,this.needsUpdate=!0)}get maxNoOfLightSources(){return this._maxNoOfLightSources}constructor(t,e){var i,n;this.needsUpdate=!0,this._lightSources=[],t instanceof EnvironmentSceneGenerator?this.environmentSceneGenerator=t:t instanceof CubeTexture?this.cubeTexture=t:t instanceof Texture&&(this.equirectangularTexture=t),(null==e?void 0:e.textureData)&&(this.textureData=null==e?void 0:e.textureData),this._rotation=null!==(i=null==e?void 0:e.rotation)&&void 0!==i?i:0,this._intensity=null!==(n=null==e?void 0:e.intensity)&&void 0!==n?n:1,void 0!==(null==e?void 0:e.maxNoOfLightSources)&&(this._maxNoOfLightSources=e.maxNoOfLightSources),this._parameters=e,this._environment=t}clone(){return new EnvironmentDefinition(this._environment,this._parameters)}createNewEnvironment(t){const e=this._createPmremTexture(t),i=this._detectLightSources(t,e);return this._lightSources=i.lightSources,null!=e?e:null}_getTextureOffset(){const t=this._rotation/(2*Math.PI)%1;return new Vector2(t,0)}_createPmremTexture(t){const e=new EnvironmentPmremGenertor(t);let i;if(this.equirectangularTexture)this.equirectangularTexture.offset.copy(this._getTextureOffset()),i=e.fromEquirectangularTexture(this.equirectangularTexture,{rotation:this._rotation,intensity:this._intensity});else if(this.cubeTexture)i=e.fromCubemap(this.cubeTexture);else if(this.environmentSceneGenerator){const t=this.environmentSceneGenerator.generateScene(this._intensity,this._rotation);i=e.fromScene(t,.04)}return this._debugScene=void 0,this.needsUpdate=!1,null==i?void 0:i.texture}_detectLightSources(t,e){const i=new LightSourceDetector;return this.equirectangularTexture&&0===this.rotation?i.detectLightSources(t,this.equirectangularTexture,this.textureData):e&&i.detectLightSources(t,e),i}createDebugScene(t,e,i){const n=null!=i?i:-1;if(this._debugScene&&n===this._debugScene.userData.maximumNumberOfLightSources)return this._debugScene;this._debugScene=new Scene;const s=new EnvironmentMapDecodeMaterial(!0,!1);s.setSourceTexture(e.environment),LightSourceDetectorDebug.createPlane(this._debugScene,s);const a=this._detectLightSources(t,e.environment);return new LightSourceDetectorDebug(a).createDebugScene(this._debugScene,n),this._debugScene.userData.maximumNumberOfLightSources=n,this._debugScene}}class DefaultEnvironmentSceneGenerator extends EnvironmentSceneGenerator{constructor(t={}){super(),this._parameters={},this._parameters=t}generateScene(t,e){const i=new DefaultEnvironmentScene({...this._parameters,lightIntensity:t*(this._parameters.lightIntensity||1),topLightIntensity:t*(this._parameters.topLightIntensity||1),sidLightIntensity:t*(this._parameters.sidLightIntensity||1)});return i.rotation.y=e,i}}class DefaultEnvironmentScene extends Scene{constructor(t={}){var e;super(),this._type=null!==(e=null==t?void 0:t.type)&&void 0!==e?e:"all_around",this._topLightIntensity=(null==t?void 0:t.topLightIntensity)||(null==t?void 0:t.lightIntensity)||1,this._sideLightIntensity=(null==t?void 0:t.sidLightIntensity)||(null==t?void 0:t.lightIntensity)||1,this._sideReflectorIntensity=(null==t?void 0:t.sidLightIntensity)||(null==t?void 0:t.lightIntensity)||1,this._ambientLightIntensity=(null==t?void 0:t.ambientLightIntensity)||.25,this._colorVariation=(null==t?void 0:t.colorVariation)||.5,this._lightGeometry=new BoxGeometry,this._lightGeometry.deleteAttribute("uv"),this.generateScene(this)}generateScene(t){switch(this._type){default:case"all_around":this._createAllAroundSceneLight(t);break;case"front":this._createFrontSceneLight(t)}}dispose(){const t=new Set;this.traverse(e=>{e.isMesh&&(t.add(e.geometry),t.add(e.material))});for(const e of t)e.dispose()}_createAllAroundSceneLight(t){const e=new AmbientLight(16777215);e.intensity=this._ambientLightIntensity,this.add(e),this._createTopLight(t,6,1);for(let e=0;e<6;e++){const i=e*Math.PI*2/6,n=Math.sin(i),s=Math.cos(i);e%2==0?this._createReflector(t,new Vector2(n,s),3,1,1):this._createSideLight(t,new Vector2(n,s),(e-1)/2,15,1.1,.33,1)}}_createFrontSceneLight(t){const e=new AmbientLight(16777215);e.intensity=this._ambientLightIntensity,this.add(e),this._createTopLight(t,5,.5);for(let e=0;e<6;e++){const i=e*Math.PI*2/6,n=Math.sin(i),s=Math.cos(i);if(0===e){this._createReflector(t,new Vector2(n,s),3,.8,.4);for(let i=0;i<2;i++){const n=(e-.3+.6*i)*Math.PI*2/6,s=Math.sin(n),a=Math.cos(n);this._createSideLight(t,new Vector2(s,a),(e-1)/2,24,1.2,1,.8)}}else this._createReflector(t,new Vector2(n,s),5,.8,1)}}_createAreaLightMaterial(t,e,i){const n=new MeshBasicMaterial;return n.color.set(t,null!=e?e:t,null!=i?i:t),n}_createTopLight(t,e,i){const n=new Mesh(this._lightGeometry,this._createAreaLightMaterial(e*this._topLightIntensity));n.position.set(0,20,0),n.scale.set(5*i,.1,5*i),t.add(n)}_createSideLight(t,e,i,n,s,a,o){for(let r=0;r<3;r++){const h=n*this._sideLightIntensity,c=new Mesh(this._lightGeometry,this._createAreaLightMaterial((r+i)%3==0?h:h*(1-this._colorVariation),(r+i)%3==1?h:h*(1-this._colorVariation),(r+i)%3==2?h:h*(1-this._colorVariation))),d=(1===r?-e.y:2===r?e.y:0)/Math.sqrt(2),_=0===r?0:1,l=(1===r?e.x:2===r?-e.x:0)/Math.sqrt(2);c.position.set(e.x*o*15+1.1*d*s,15*a+1.1*_*s,e.y*o*15+1.1*l*s),c.rotation.set(0,Math.atan2(e.x,e.y),0),c.scale.setScalar(s),t.add(c)}}_createReflector(t,e,i,n,s){const a=new Mesh(this._lightGeometry,this._createAreaLightMaterial(i*this._sideReflectorIntensity));a.position.set(15*e.x,5*s,15*e.y),a.rotation.set(0,Math.atan2(e.x,e.y),0),a.scale.set(10*n,12*n*s,10*n),t.add(a)}}class SceneManager{onBeforeRender(){}constructor(t,e,i,n){this._depthWriteMaterial=new MeshBasicMaterial({colorWrite:!1}),this._maxAnisotropy=1,this._clock=new Clock,this._delta=0,this._renderListener=null,this._stopRendering=!1,this._forceRender=!1,this._lastChange=Date.now(),this._running=!1,this._perspectiveOffsetCamera=null,this._orthographicOffsetCamera=null,this._onAfterRender=()=>{},this._creator_=t,this._canvasID=i,this.createCameraControl(sanitizedCameraMode(n),e),this._setupScene(e,!1),this._lifeCycleManager.addEventListener(this)}addEventListener(t){throw new Error("Method not implemented.")}removeEventListener(t){throw new Error("Method not implemented.")}_changeCameraControl(t){this._cameraControl&&this._cameraControl.cleanUp(),t instanceof CameraControlFirstPerson&&(this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener)),this._cameraControl instanceof CameraControlFirstPerson&&(this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this)),this._cameraControl=t,this.cameraControlChanged()}cameraControlChanged(){}_addCameraControlListener(){this._cameraControl.addEventListener(0,()=>{var t;null===(t=this._roomleRenderer)||void 0===t||t.movingCameraStarts(),this._requestRender()},this),this._cameraControl.addEventListener(1,this._requestRender,this),this._cameraControl.addEventListener(2,()=>{var t;null===(t=this._roomleRenderer)||void 0===t||t.movingCameraStops(),this._requestRender()},this),this._cameraControl.addEventListener(6,this._requestRender,this)}_renderEverything(){var t;this._roomleRenderer&&(this._forceRender=!0,null===(t=this._roomleRenderer)||void 0===t||t.forceShadowUpdates(!1)),this._requestRender()}_renderWithoutShadowsAndAO(){this._roomleRenderer&&(this._forceRender=!0),this._requestRender()}_requestRender(){if(!this._renderer||this._stopRendering)return;const t=()=>{var e,i;this._delta=this._clock.getDelta(),this._animateCamera(),this._cameraControl.getCamera().layers.mask=65535,this._renderLoopFunction&&(this._renderLoopFunction(),this._renderLoopFunction=null),this.onBeforeRender(),this._roomleRenderer?(null===(e=this._statsHelper)||void 0===e||e.updateRenderInfo(this._roomleRenderer.renderer.info),this._roomleRenderer.render(this._scene,this._cameraControl.getCamera()),this._forceRender=!1,this._shouldRenderUi()&&this._renderUi()):(null===(i=this._statsHelper)||void 0===i||i.updateRenderInfo(this._renderer.info),this._renderer.render(this._scene,this._cameraControl.getCamera())),this._onAfterRender(),window.TWEEN&&TWEEN.update(),this._lastChange+3e3<Date.now()||this._stopRendering?this._running=!1:(this._running=!0,requestAnimationFrame(t))};this._lastChange=Date.now(),this._running||this._stopRendering||(this._running=!0,requestAnimationFrame(t))}_shouldRenderUi(){return this._pluginSystem&&this._pluginSystem.needsUiScene()}_renderUi(){const t=this._scene.background?this._scene.background.clone():null;this._scene.overrideMaterial=this._depthWriteMaterial,this._scene.background=null,this._renderer.render(this._scene,this._cameraControl.getCamera()),this._scene.overrideMaterial=null;const e=this._renderer.autoClear;this._renderer.autoClear=!1,this._renderer.clearDepth(),this._renderer.render(this._uiScene,this._cameraControl.getCamera()),this._renderer.autoClear=e,this._scene.background=t}_animateCamera(){this._cameraControl&&(this._cameraControl.animateCamera(this._delta)||!this.shouldClearShadowsAndAO()||this._forceRender)&&this._lightSetting instanceof DynamicLightSetting&&this._cameraControl.getCamera()instanceof PerspectiveCamera&&this._lightSetting.update(this._cameraControl.getCamera(),this._cameraControl.getTargetPosition()),this._environment&&this._environment.needsCamera()&&this._cameraControl instanceof CameraControl3D&&this._environment.updateCamera(this._cameraControl.getCamera())}shouldClearShadowsAndAO(){return!1}_setupScene(t,e){var i;const{x:n,y:s}=this._domHelper.getClientDimensions();this._scene=new Scene,this._uiScene=new Scene,(e=e||!1)||(this._scene.background=getColor(this._initData.colors.DEFAULT_BACKGROUND)),this._renderer=new WebGLRenderer({antialias:!this._initData.e2e,alpha:!0});const a=this._initData.autoQuality?Math.min(window.devicePixelRatio,1.5):window.devicePixelRatio;this._renderer.setPixelRatio(a),this._renderer.setSize(n,s),this._renderer.outputColorSpace=SRGBColorSpace,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=PCFSoftShadowMap,this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._initData.e2e||(this._roomleRenderer=new RoomleWebGLRenderer(this._renderer,n,s),this._roomleRenderer.setQualityMap(standaloneConfiguratorQualityLevels),this._roomleRenderer.setAutoQuality(this._initData.autoQuality),this._roomleRenderer.setShadingType(this._initData.shading),null===(i=this._roomleRenderer)||void 0===i||i.setSize(n,s)),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),this._hdrEnvironmentLoader.registerEnvironmentChangedCallback(t=>{this._setEnvMap(t)}),this._initData.legacyLight?this.loadEnvMap("static/legacy_env-d5810ec5057d4716.exr"):this._initData.sceneLight?this._setDefaultEnvironmentScene():this.loadEnvMap(this._initData.envMapUrl),this._requestRender(),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this._pluginSystem.init(this._scene,this._uiScene,this._cameraControl.getCamera().position),this._addCameraControlListener(),this.sceneChanged()}async loadEnvMap(t){await this._hdrEnvironmentLoader.loadUrl(this._renderer,t)}_setDefaultEnvironmentScene(){const t=this._initData.sceneLight;this._scene.userData.environmentDefinition=new EnvironmentDefinition(new DefaultEnvironmentSceneGenerator({type:t}),{rotation:this._initData.envMapRotation,intensity:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!0,this._requestRender()}_setEnvMap(t){const{url:e,environmentMap:i}=t;this._scene.environment=i,this._scene.userData.environmentDefinition=new EnvironmentDefinition(i,{rotation:this._initData.envMapRotation,intensity:this._initData.legacyLight?.9:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!this._initData.legacyLight,this._environment instanceof GroundProjectedEnvironment&&this._environment.updateEnvironmentTexture(i),e===ENV_HDR_256_FILE_NAME&&window.requestIdleCallback(this.loadEnvMap.bind(this,"static/default_1k-2aa6d42244d30fb1.exr")),this._requestRender()}_tabVisible(){this.updateCamera(!1)}_releaseKeystrokeStates(){const t=["Shift","Meta","Control","Escape"];for(const e of t){const t=new KeyboardEvent("keyup",{key:e});this._onKeyUp(t)}}updateCamera(t=!0){var e;const{x:i,y:n}=this._domHelper.getClientDimensions();null===(e=this._roomleRenderer)||void 0===e||e.setSize(i,n),this._cameraControl.updateCamera(),this._renderEverything()}_onWindowResize(){const t=this._getInputManager();t&&t.updateSize(),this.updateCamera(),this._requestRender()}_isPartOfScene(t){return"Object3D"===t.type||"Mesh"===t.type||"GLB"===t.type||"GLTF"===t.type||"Group"===t.type}cleanUp(){this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener),this._cameraControl&&this._cameraControl.cleanUp(),this._stopRendering=!0}clearScene(){let t=[];this._scene.children.forEach(e=>{this._isPartOfScene(e)&&t.push(e)}),t.forEach(t=>{dispose(t),this._scene.remove(t)}),this._renderer.renderLists.dispose()}enableHD(t){this._renderer.capabilities.maxTextures>8&&t&&this.loadDynamicLightSetting(t),this._requestRender()}_loadGLTF(t,e,i,n,s,a,o){return new Promise((r,h)=>{this._staticItemLoader.loadGLTF(t,e,i,n,s,a,null,o).then(t=>{this._setCamera("GLTF",t.scene),r(t.scene)},h)})}_loadGLB(t,e,i,n,s,a,o,r){return new Promise((h,c)=>{this._staticItemLoader.loadGLB(t,e,i,n,s,a,o,r).then(t=>{this._setCamera("GLB",t.scene),h(t.scene)},c)})}_setCamera(t,e){if(!e)return void console.warn("could not set camera for gltf",e);const i=new Box3;i.setFromObject(e),"GLB"===t?this._cameraControl instanceof CameraControl3D&&this._cameraControl.updateToBounds(i,!1):"GLTF"===t&&(this._cameraControl instanceof CameraControl3D&&this._cameraControl.updateAndReset(i.getSize(new Vector3),i.getCenter(new Vector3),-15,70,5,!1),this._cameraControl instanceof CameraControl2D&&this._cameraControl.zoomToFitBounds(i,!0)),this.updateCamera()}showGUI(){if(this._initData.disableDebugGUI)return;const t=document.createElement("style");t.innerText=".dg.main{position:absolute;z-index:999;top:0;left:0;}",document.head.appendChild(t);let e=getGUI(!1);e&&(this._domHelper.element.appendChild(e.domElement),this._guiLoaded())}_guiLoaded(){let t=getGUI();if(!t)return;const e=t.addFolder("Scene Parameter"),i={intensity:this._initData.envMapIntensity,rotation:this._initData.envMapRotation};e.add(i,"intensity",0,4,.01).name("env map intensity").onChange(t=>{this.changeEnvironmentMapIntensity(t),this._requestRender()}),e.add(i,"rotation",0,2*Math.PI,.01).name("env map rotation").onChange(t=>{this._scene.userData.environmentDefinition.rotation=t,this._requestRender()}),this._lightSetting&&this._lightSetting.showGUI(),this._roomleRenderer&&this._roomleRenderer.showGUI(()=>this._requestRender()),this._environment&&this._environment.showGUI(()=>this._requestRender()),this._addGUIListener(t)}_addGUIListener(t){let e=t.__folders;Object.keys(e).forEach(t=>{let i=e[t];i.__folders&&Object.keys(i.__folders).forEach(t=>{let e=i.__folders[t];this._addGUIListener(e)}),i.__controllers&&i.__controllers.forEach(t=>{t.onFinishChange(()=>{this._guiParamChanged()})})})}_guiParamChanged(){this._renderEverything()}showStats(){import("./stats-helper-f6006275.js").then(t=>this._statsHelper=new t.default)}_onKeyDown(t){}_onKeyUp(t){}pause(){this._getInputManager().removeEvents(this._renderer.domElement),window.removeEventListener("resize",this,!1),window.removeEventListener("keydown",this,!1),window.removeEventListener("keyup",this,!1),document.removeEventListener("visibilitychange",this)}resume(){this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this.updateCamera()}destroy(){this.pause(),this.cleanUp()}handleEvent(t){switch(t.type){case"resize":this._onWindowResize();break;case"keydown":if(t.target&&(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement))break;this._onKeyDown(t);break;case"keyup":if(t.target&&(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement))break;this._onKeyUp(t);break;case"visibilitychange":this._tabVisible(),this._releaseKeystrokeStates()}}async loadSceneSettings(t){let e,i;return e=t.environment?new Promise(e=>{(new DynamicEnvironmentSettingLoader).load(this._scene,this._renderer.domElement,this._environment,t,this._maxAnisotropy).then(t=>{this._setEnvironment(t),e()})}):Promise.resolve(),t.lights?(this._lightSetting=new DynamicLightSetting(this._scene,this._lightSetting),i=this._lightSetting.loadFromObject(t)):i=Promise.resolve(),new Promise((t,n)=>{Promise.all([e,i]).then(()=>{this._renderEverything(),t()},n)})}setBackgroundColor(t){this._setEnvironment(new BackgroundEnvironment(this._scene,this._environment,new Color(t)))}setBackgroundImage(t){this._setEnvironment(new BackgroundEnvironment(this._scene,this._environment,null,this._renderer.domElement,t))}_setEnvironment(t){this._environment=t,this._renderEverything()}async loadDynamicLightSetting(t){this._lightSetting=new DynamicLightSetting(this._scene,this._lightSetting);let e=!1;if(t.url)await this._lightSetting.loadFromURL(t.url),e=!0;else if(t.json)await this._lightSetting.loadFromJSON(t.json),e=!0;else if(t.object)await this._lightSetting.loadFromObject(t.object),e=!0;else if(t.ls){const i=DynamicLightSettingLoader.createDynamicLightSettingSource(null,t.ls);await this._lightSetting.loadFromURL(i.url),e=!0}if(!e)throw new Error("No dynamic light setting source set");this._requestRender()}getScene(){return this._scene}updateScene(){var t;this._updateBounds(this.getBounds()),null===(t=this._roomleRenderer)||void 0===t||t.forceShadowUpdates(!0),this._renderEverything()}_updateBounds(t,e=!1){var i;t&&(this.updateEnvironment(t,e),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(t),null===(i=this._roomleRenderer)||void 0===i||i.updateBounds(t),this._requestRender(),this._pluginSystem.updateBounds(t))}setCameraOffset(t){const e=this._cameraControl.getCamera(),i=e||e;(null==i?void 0:i.offset)?(i.offset=t,this._renderEverything()):console.warn("Cannot set offset, current camera does not support it")}getCameraOffset(){const t=this._cameraControl.getCamera(),e=t||t;return(null==e?void 0:e.offset)?JSON.parse(JSON.stringify(e.offset)):{left:0,top:0,right:1,bottom:1}}getOrthographicOffsetCamera(){if(!this._orthographicOffsetCamera){const t=this.getCameraOffset(),e=this._domHelper.getClientDimensions(),i=5;let n=e.x/e.y*i,s=i;const a=RoomleComponentFactoryInitializer();this._orthographicOffsetCamera=a.createOrthographicCamera(n/-2,n/2,s/2,s/-2,1,1e3,t),this._orthographicOffsetCamera.position.set(0,10,0),this._orthographicOffsetCamera.lookAt(new Vector3(0,0,0))}return this._orthographicOffsetCamera}getPerspectiveOffsetCamera(){if(!this._perspectiveOffsetCamera){const t=this.getCameraOffset(),e=this._domHelper.getClientDimensions(),i=e.x,n=e.y,s=RoomleComponentFactoryInitializer();this._perspectiveOffsetCamera=s.createPerspectiveCamera(30,i/n,.1,20,t)}return this._perspectiveOffsetCamera}updateEnvironment(t,e=!1){var i;if(t&&this._environment&&this._environment.needsBounds()){const i=t.getSize(new Vector3);(i.x+i.y+i.z!==0||e)&&this._environment.updateBounds(t.getSize(new Vector3),e)}null===(i=this._roomleRenderer)||void 0===i||i.updateEnvironment(t,e)}_onCameraIdle(){return!0}_onCameraMove(){return!0}exportImageFromCamera(t){this._onAfterRender=()=>{const e=this._renderer.domElement.toDataURL("image/jpeg",1),{left:i,right:n,top:s,bottom:a}=this.getCameraOffset(),o=n-i,r=s-a;if(1===o&&1===r)return download(t,e),void(this._onAfterRender=()=>{});const h=new Image;h.src=e,h.onload=()=>{const{naturalWidth:e,naturalHeight:n}=h,a=document.createElement("canvas");a.width=e*o,a.height=n*r;const c=a.getContext("2d"),d=e*i*-1,_=n*(1-s)*-1;c.drawImage(h,d,_),c.save(),download(t,a.toDataURL("image/jpeg",1)),this._onAfterRender=()=>{}}},this._requestRender()}changeEnvironmentMapIntensity(t){this._scene.userData.environmentDefinition.intensity=t}lockCamera(){this._cameraControl.lock()}unlockCamera(){this._cameraControl.unlock()}setEnvironmentMap(t,e,i,n){void 0!==t&&this._hdrEnvironmentLoader.loadUrl(this._renderer,t),void 0!==e&&(this._scene.userData.environmentDefinition.intensity=e),void 0!==i&&(this._scene.userData.environmentDefinition.rotation=i),void 0!==n&&(this._scene.userData.environmentDefinition.maxNoOfLightSources=n,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}}__decorate([inject],SceneManager.prototype,"_domHelper",void 0),__decorate([inject],SceneManager.prototype,"_scriptLoader",void 0),__decorate([inject],SceneManager.prototype,"_lifeCycleManager",void 0),__decorate([inject],SceneManager.prototype,"_staticItemLoader",void 0),__decorate([inject],SceneManager.prototype,"_hdrEnvironmentLoader",void 0),__decorate([inject],SceneManager.prototype,"_initData",void 0),__decorate([inject],SceneManager.prototype,"_pluginSystem",void 0),__decorate([inject],SceneManager.prototype,"_imageRenderer",void 0);export{BackgroundEnvironment as B,CameraControl3D as C,DISTANCE_FACTOR as D,FloorEnvironment as F,LightSetting as L,SceneManager as S,TWEEN_FILE_NAME as T,CameraControl as a,CameraControl2D as b,CameraControlFirstPerson as c};
2
+ //# sourceMappingURL=scene-manager-17273ebe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scene-manager-9231df1b.js","sources":["../../packages/common-core/public/textures/env/default_1k.exr","../../packages/three-build/src/Tween.js","../../node_modules/three/examples/jsm/objects/GroundProjectedSkybox.js","../../packages/common-core/public/textures/env/legacy_env.exr"],"sourcesContent":["export default \"static/default_1k-2aa6d42244d30fb1.exr\"","export default \"static/Tween-d57ee5d181fce582.js\"","import { Mesh, IcosahedronGeometry, ShaderMaterial, DoubleSide } from 'three';\n\n/**\n * Ground projected env map adapted from @react-three/drei.\n * https://github.com/pmndrs/drei/blob/master/src/core/Environment.tsx\n */\nclass GroundProjectedSkybox extends Mesh {\n\n\tconstructor( texture, options = {} ) {\n\n\t\tconst isCubeMap = texture.isCubeTexture;\n\n\t\tconst defines = [\n\t\t\tisCubeMap ? '#define ENVMAP_TYPE_CUBE' : ''\n\t\t];\n\n\t\tconst vertexShader = /* glsl */ `\n\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );\n\t\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t}\n\t\t\t`;\n\t\tconst fragmentShader = defines.join( '\\n' ) + /* glsl */ `\n\n\t\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\t\tuniform float radius;\n\t\t\t\tuniform float height;\n\t\t\t\tuniform float angle;\n\n\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\tuniform samplerCube map;\n\n\t\t\t\t#else\n\n\t\t\t\t\tuniform sampler2D map;\n\n\t\t\t\t#endif\n\n\t\t\t\t// From: https://www.shadertoy.com/view/4tsBD7\n\t\t\t\tfloat diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) \n\t\t\t\t{\n\n\t\t\t\t\tfloat d = dot ( rd, n );\n\n\t\t\t\t\tif( d > 0.0 ) { return 1e6; }\n\n\t\t\t\t\tvec3 o = ro - c;\n\t\t\t\t\tfloat t = - dot( n, o ) / d;\n\t\t\t\t\tvec3 q = o + rd * t;\n\n\t\t\t\t\treturn ( dot( q, q ) < r * r ) ? t : 1e6;\n\n\t\t\t\t}\n\n\t\t\t\t// From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm\n\t\t\t\tfloat sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) {\n\n\t\t\t\t\tvec3 oc = ro - ce;\n\t\t\t\t\tfloat b = dot( oc, rd );\n\t\t\t\t\tfloat c = dot( oc, oc ) - ra * ra;\n\t\t\t\t\tfloat h = b * b - c;\n\n\t\t\t\t\tif( h < 0.0 ) { return -1.0; }\n\n\t\t\t\t\th = sqrt( h );\n\n\t\t\t\t\treturn - b + h;\n\n\t\t\t\t}\n\n\t\t\t\tvec3 project() {\n\n\t\t\t\t\tvec3 p = normalize( vWorldPosition );\n\t\t\t\t\tvec3 camPos = cameraPosition;\n\t\t\t\t\tcamPos.y -= height;\n\n\t\t\t\t\tfloat intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );\n\t\t\t\t\tif( intersection > 0.0 ) {\n\n\t\t\t\t\t\tvec3 h = vec3( 0.0, - height, 0.0 );\n\t\t\t\t\t\tfloat intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );\n\t\t\t\t\t\tp = ( camPos + min( intersection, intersection2 ) * p ) / radius;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tp = vec3( 0.0, 1.0, 0.0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn p;\n\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 projectedWorldPosition = project();\n\n\t\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\t\tvec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tvec3 direction = normalize( projectedWorldPosition );\n\t\t\t\t\t\tvec2 uv = equirectUv( direction );\n\t\t\t\t\t\tvec3 outcolor = texture2D( map, uv ).rgb;\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\tgl_FragColor = vec4( outcolor, 1.0 );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <colorspace_fragment>\n\n\t\t\t\t}\n\t\t\t\t`;\n\n\t\tconst uniforms = {\n\t\t\tmap: { value: texture },\n\t\t\theight: { value: options.height || 15 },\n\t\t\tradius: { value: options.radius || 100 },\n\t\t};\n\n\t\tconst geometry = new IcosahedronGeometry( 1, 16 );\n\t\tconst material = new ShaderMaterial( {\n\t\t\tuniforms,\n\t\t\tfragmentShader,\n\t\t\tvertexShader,\n\t\t\tside: DoubleSide,\n\t\t} );\n\n\t\tsuper( geometry, material );\n\n\t}\n\n\tset radius( radius ) {\n\n\t\tthis.material.uniforms.radius.value = radius;\n\n\t}\n\n\tget radius() {\n\n\t\treturn this.material.uniforms.radius.value;\n\n\t}\n\n\tset height( height ) {\n\n\t\tthis.material.uniforms.height.value = height;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.material.uniforms.height.value;\n\n\t}\n\n}\n\nexport { GroundProjectedSkybox };\n","export default \"static/legacy_env-d5810ec5057d4716.exr\""],"names":["TWEEN_FILE_NAME","GroundProjectedSkybox","Mesh","[object Object]","texture","options","fragmentShader","isCubeTexture","join","uniforms","map","value","height","radius","super","IcosahedronGeometry","ShaderMaterial","vertexShader","side","DoubleSide","this","material"],"mappings":"igDAAA,ICAeA,gBAAA,oslCCMf,MAAMC,8BAA8BC,KAEnCC,YAAaC,EAASC,EAAU,IAE/B,MAkBMC,EAhBU,CAFEF,EAAQG,cAGb,2BAA6B,IAeXC,KAAM,MAAoB,6yEAmGnDC,EAAW,CAChBC,IAAK,CAAEC,MAAOP,GACdQ,OAAQ,CAAED,MAAON,EAAQO,QAAU,IACnCC,OAAQ,CAAEF,MAAON,EAAQQ,QAAU,MAWpCC,MARiB,IAAIC,oBAAqB,EAAG,IAC5B,IAAIC,eAAgB,CACpCP,SAAAA,EACAH,eAAAA,EACAW,aAzH+B,4RA0H/BC,KAAMC,cAORN,WAAYA,GAEXO,KAAKC,SAASZ,SAASI,OAAOF,MAAQE,EAIvCA,aAEC,OAAOO,KAAKC,SAASZ,SAASI,OAAOF,MAItCC,WAAYA,GAEXQ,KAAKC,SAASZ,SAASG,OAAOD,MAAQC,EAIvCA,aAEC,OAAOQ,KAAKC,SAASZ,SAASG,OAAOD,wqgBCrKxB,u+CHAA"}
1
+ {"version":3,"file":"scene-manager-17273ebe.js","sources":["../../packages/common-core/public/textures/env/default_1k.exr","../../packages/three-build/src/Tween.js","../../node_modules/three/examples/jsm/objects/GroundProjectedSkybox.js","../../packages/common-core/public/textures/env/legacy_env.exr"],"sourcesContent":["export default \"static/default_1k-2aa6d42244d30fb1.exr\"","export default \"static/Tween-d57ee5d181fce582.js\"","import { Mesh, IcosahedronGeometry, ShaderMaterial, DoubleSide } from 'three';\n\n/**\n * Ground projected env map adapted from @react-three/drei.\n * https://github.com/pmndrs/drei/blob/master/src/core/Environment.tsx\n */\nclass GroundProjectedSkybox extends Mesh {\n\n\tconstructor( texture, options = {} ) {\n\n\t\tconst isCubeMap = texture.isCubeTexture;\n\n\t\tconst defines = [\n\t\t\tisCubeMap ? '#define ENVMAP_TYPE_CUBE' : ''\n\t\t];\n\n\t\tconst vertexShader = /* glsl */ `\n\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );\n\t\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t}\n\t\t\t`;\n\t\tconst fragmentShader = defines.join( '\\n' ) + /* glsl */ `\n\n\t\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\t\tuniform float radius;\n\t\t\t\tuniform float height;\n\t\t\t\tuniform float angle;\n\n\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\tuniform samplerCube map;\n\n\t\t\t\t#else\n\n\t\t\t\t\tuniform sampler2D map;\n\n\t\t\t\t#endif\n\n\t\t\t\t// From: https://www.shadertoy.com/view/4tsBD7\n\t\t\t\tfloat diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) \n\t\t\t\t{\n\n\t\t\t\t\tfloat d = dot ( rd, n );\n\n\t\t\t\t\tif( d > 0.0 ) { return 1e6; }\n\n\t\t\t\t\tvec3 o = ro - c;\n\t\t\t\t\tfloat t = - dot( n, o ) / d;\n\t\t\t\t\tvec3 q = o + rd * t;\n\n\t\t\t\t\treturn ( dot( q, q ) < r * r ) ? t : 1e6;\n\n\t\t\t\t}\n\n\t\t\t\t// From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm\n\t\t\t\tfloat sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) {\n\n\t\t\t\t\tvec3 oc = ro - ce;\n\t\t\t\t\tfloat b = dot( oc, rd );\n\t\t\t\t\tfloat c = dot( oc, oc ) - ra * ra;\n\t\t\t\t\tfloat h = b * b - c;\n\n\t\t\t\t\tif( h < 0.0 ) { return -1.0; }\n\n\t\t\t\t\th = sqrt( h );\n\n\t\t\t\t\treturn - b + h;\n\n\t\t\t\t}\n\n\t\t\t\tvec3 project() {\n\n\t\t\t\t\tvec3 p = normalize( vWorldPosition );\n\t\t\t\t\tvec3 camPos = cameraPosition;\n\t\t\t\t\tcamPos.y -= height;\n\n\t\t\t\t\tfloat intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );\n\t\t\t\t\tif( intersection > 0.0 ) {\n\n\t\t\t\t\t\tvec3 h = vec3( 0.0, - height, 0.0 );\n\t\t\t\t\t\tfloat intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );\n\t\t\t\t\t\tp = ( camPos + min( intersection, intersection2 ) * p ) / radius;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tp = vec3( 0.0, 1.0, 0.0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn p;\n\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 projectedWorldPosition = project();\n\n\t\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\t\tvec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tvec3 direction = normalize( projectedWorldPosition );\n\t\t\t\t\t\tvec2 uv = equirectUv( direction );\n\t\t\t\t\t\tvec3 outcolor = texture2D( map, uv ).rgb;\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\tgl_FragColor = vec4( outcolor, 1.0 );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <colorspace_fragment>\n\n\t\t\t\t}\n\t\t\t\t`;\n\n\t\tconst uniforms = {\n\t\t\tmap: { value: texture },\n\t\t\theight: { value: options.height || 15 },\n\t\t\tradius: { value: options.radius || 100 },\n\t\t};\n\n\t\tconst geometry = new IcosahedronGeometry( 1, 16 );\n\t\tconst material = new ShaderMaterial( {\n\t\t\tuniforms,\n\t\t\tfragmentShader,\n\t\t\tvertexShader,\n\t\t\tside: DoubleSide,\n\t\t} );\n\n\t\tsuper( geometry, material );\n\n\t}\n\n\tset radius( radius ) {\n\n\t\tthis.material.uniforms.radius.value = radius;\n\n\t}\n\n\tget radius() {\n\n\t\treturn this.material.uniforms.radius.value;\n\n\t}\n\n\tset height( height ) {\n\n\t\tthis.material.uniforms.height.value = height;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.material.uniforms.height.value;\n\n\t}\n\n}\n\nexport { GroundProjectedSkybox };\n","export default \"static/legacy_env-d5810ec5057d4716.exr\""],"names":["TWEEN_FILE_NAME","GroundProjectedSkybox","Mesh","[object Object]","texture","options","fragmentShader","isCubeTexture","join","uniforms","map","value","height","radius","super","IcosahedronGeometry","ShaderMaterial","vertexShader","side","DoubleSide","this","material"],"mappings":"i/CAAA,ICAeA,gBAAA,y+lCCMf,MAAMC,8BAA8BC,KAEnCC,YAAaC,EAASC,EAAU,IAE/B,MAkBMC,EAhBU,CAFEF,EAAQG,cAGb,2BAA6B,IAeXC,KAAM,MAAoB,6yEAmGnDC,EAAW,CAChBC,IAAK,CAAEC,MAAOP,GACdQ,OAAQ,CAAED,MAAON,EAAQO,QAAU,IACnCC,OAAQ,CAAEF,MAAON,EAAQQ,QAAU,MAWpCC,MARiB,IAAIC,oBAAqB,EAAG,IAC5B,IAAIC,eAAgB,CACpCP,SAAAA,EACAH,eAAAA,EACAW,aAzH+B,4RA0H/BC,KAAMC,cAORN,WAAYA,GAEXO,KAAKC,SAASZ,SAASI,OAAOF,MAAQE,EAIvCA,aAEC,OAAOO,KAAKC,SAASZ,SAASI,OAAOF,MAItCC,WAAYA,GAEXQ,KAAKC,SAASZ,SAASG,OAAOD,MAAQC,EAIvCA,aAEC,OAAOQ,KAAKC,SAASZ,SAASG,OAAOD,kpgBCrKxB,u+CHAA"}
@@ -0,0 +1,2 @@
1
+ System.register(["./roomle-dependency-injection-348f3aac.nomodule.js","./main-thread-to-worker-38d48e06.nomodule.js"],(function(t,e){var i,s,n,a,o,r,h,c,_,d,l,m,u,p,g,v,y,f,w,C,P,x,b,S,M,L,E,D,I,k,z,T,R,A,O,B,F,U,G,H,q,N,j,Z,W,V,K,Y,X,J,Q,$,tt,et,it,st,nt,at,ot,rt,ht,ct,_t,dt,lt,mt,ut,pt,gt,vt,yt,ft,wt;return{setters:[function(t){i=t._,s=t.i,n=t.E,a=t.t,o=t.G,r=t.H,h=t.J,c=t.p,_=t.r,d=t.M,l=t.K,m=t.N,u=t.O,p=t.Q,g=t.S,v=t.T,y=t.U,f=t.V,w=t.W,C=t.X,P=t.Y,x=t.n,b=t.j,S=t.q},function(t){M=t.a,L=t.bA,E=t.N,D=t.V,I=t.bC,k=t.ae,z=t.ad,T=t.ag,R=t.Q,A=t.aB,O=t.O,B=t.z,F=t.bE,U=t.bF,G=t.bG,H=t.m,q=t.bH,N=t.C,j=t.r,Z=t.w,W=t.W,V=t.U,K=t.aT,Y=t.S,X=t.A,J=t.D,Q=t.R,$=t.bI,tt=t.ao,et=t.bc,it=t.h,st=t.bJ,nt=t.u,at=t.B,ot=t.E,rt=t.bK,ht=t.an,ct=t.au,_t=t.ah,dt=t.a9,lt=t.al,mt=t.aN,ut=t.bL,pt=t.bD,gt=t.bB,vt=t.bw,yt=t.i,ft=t.bl,wt=t.bM}],execute:function(){t("T","static/Tween-d57ee5d181fce582.js");class Ct extends n{constructor(t,e,i){if(super(),this._tweenEnd=null,this._cameraStandingStill=!0,this._pitch=a(10),this._yaw=a(-30),this._distance=-1,this._locked=!1,this._inputListeners=[],this._lerpEnabled=!0,this._creator_=t,this._inputManager=e,this._initInputListener(),this._addInputListeners(),this._cameraPosition=new M,this._targetPosition=new M,i?this._cameraPosition.copy(i):this._cameraPosition=new M(0,.5,3),this._initData.debug){const t=this.getDebugCameraPosition();t&&this._setCurrentCameraParameters(t)}let s=this._domHelper.getClientDimensions();this._width=s.x,this._height=s.y,this._dispatchCameraIdle=L(this._dispatchCameraIdle.bind(this),32)}getCamera(){return this._getCamera()}_addInputListeners(){this._inputListeners.forEach(t=>{this._inputManager.addEventListener(t.key,t.fun,this)})}_removeInputListeners(){this._inputListeners.forEach(t=>{this._inputManager.removeEventListener(t.key,t.fun)}),this._inputListeners=[]}cleanUp(){this._removeInputListeners()}animateCamera(t){let e=this._cameraPosition;if(!e||o(e,this.getCamera().position))return this._cameraStandingStill||(this._cameraStandingStill=!0,setTimeout(()=>this._dispatchCameraIdle(),16),this._initData.debug&&this.saveDebugCameraPosition()),!1;if(this._cameraStandingStill&&this.dispatchEvent(7,3),this._cameraStandingStill=!1,!this._lerpEnabled||this._tweenEnd||this._initData.e2e)this.getCamera().position.copy(e);else{let i=this.getCamera().position.clone();const s=Math.min(10*t,1);i.lerp(e,s),this.getCamera().position.copy(i)}return!0}getDebugCameraPosition(){return JSON.parse(localStorage.getItem("debug_camera_position"))}saveDebugCameraPosition(){localStorage.setItem("debug_camera_position",JSON.stringify(this.getCurrentCameraParameters()))}_dispatchCameraIdle(){this.dispatchEvent(8,3)}_tweenCameraParameter(t,e,i=!1){return this._initData.e2e?(this.dispatchEvent(0,3),this.dispatchEvent(1,3),this._yaw=e.yaw,this._pitch=e.pitch,this._distance=e.distance,this._setCameraNear(),this._update(new M(e.targetX,e.targetY,e.targetZ),i),this.dispatchEvent(2,3),Promise.resolve()):new Promise(s=>{if(e.yaw-t.yaw<=-Math.PI?t.yaw-=2*Math.PI:e.yaw-t.yaw>=Math.PI&&(t.yaw+=2*Math.PI),window.TWEEN){if(null!==this._tweenEnd&&this._tweenEnd.blockOtherTweens)return;this._tweenEnd=e,new TWEEN.Tween(t).to(e,400).easing(TWEEN.Easing.Sinusoidal.In).onUpdate(()=>{this.dispatchEvent(1,3),this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._setCameraNear(),this._update(new M(t.targetX,t.targetY,t.targetZ),i)}).onComplete(()=>{this.dispatchEvent(2,3),this._dispatchCameraIdle(),this._tweenEnd=null,s()}).start(),this.dispatchEvent(0,3)}})}_setCameraNear(){const t=this.getCamera();if(t instanceof E){const e=Math.max(.1,this._distance/6);t.near=e}}getCurrentCameraParameters(){const t=this._targetPosition.clone();return{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:t.x,targetY:t.y,targetZ:t.z}}_setCurrentCameraParameters(t){this._yaw=t.yaw,this._pitch=t.pitch,this._distance=t.distance,this._targetPosition.copy(new M(t.targetX,t.targetY,t.targetZ))}_rotateHorizontal(t){this._yaw-=t,this._yaw<-Math.PI?this._yaw+=2*Math.PI:this._yaw>Math.PI&&(this._yaw-=2*Math.PI)}_rotateVertical(t){this._pitch+=t,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI)}saveState(t){if(t||!this._stateSaved){let t=this._yaw,e=this._pitch,i=this._distance,s=this._targetPosition.clone();if(this._stateSaved={yaw:t,pitch:e,distance:i,targetX:s.x,targetY:s.y,targetZ:s.z,blockOtherTweens:!0},this._getCamera().fov){let t=this._getCamera();this._stateSaved.fov=t.fov,this._stateSaved.near=t.near,this._stateSaved.far=t.far}return this._stateSaved}return null}resetToState(){if(this._stateSaved){this._stateSaved.blockOtherTweens=!1;let t=this._targetPosition.clone();this._tweenCameraParameter({yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:t.x,targetY:t.y,targetZ:t.z},this._stateSaved,!0)}this._stateSaved=null}setToState(t,e){this._tweenCameraParameter(t,e,!0)}hasSavedState(){return null!=this._stateSaved}lock(){this._locked=!0}unlock(){this._locked=!1}isLocked(){return this._locked}getTargetPosition(){return this._targetPosition}_saveYawAndPitch(){this._getCamera().userData.yaw=this._yaw,this._getCamera().userData.pitch=this._pitch}getInputPosition(t){const{x:e,y:i}=this._domHelper.getClientDimensions();return new M(t.x/e*2-1,-t.y/i*2+1,.5)}addLightContainer(t){t.name="lights";const e=this._getCamera(),i=e.children.find(t=>"lights"===t.name);i&&e.remove(i),e.add(t)}checkNearFarDistance(t){if(!t)return;const e=this._cameraPosition.distanceTo(t),i=this._getCamera();i instanceof E&&e>i.far&&(i.far=e+1)}setBounds(t){this._boundingBox=t}}t("a",Ct),i([s],Ct.prototype,"_domHelper",void 0),i([s],Ct.prototype,"_initData",void 0);class Pt{constructor(t,e){this.minZoom=!1,this.maxZoom=!1,this.minZoom=t,this.maxZoom=e}}t("D",2.725);class xt extends Ct{constructor(t,e,i,s){super(t,e,i),this._bounds=new M,this._scale=1,this._state=0,this._zoomSpeed=Math.pow(.95,3),this.minDistance=0,this.maxDistance=5,this.minPolarAngle=a(0),this.maxPolarAngle=a(85),this._objectRotation=0,this.minAzimuthAngle=Number.NEGATIVE_INFINITY,this.maxAzimuthAngle=Number.POSITIVE_INFINITY,this._zoomDistance=.1,this._userInteraction=!1,this._currentZoomHash="",this._maxZoomedIn=!1,this._maxZoomedOut=!1,this._panningEnabled=!1,this._targetPositionIsPanned=!1,s?this._camera=s:this._initCamera(),this._camera.fov=30,this._targetPosition||(this._targetPosition=new M(0,0,0),this._targetPositionIsPanned=!1);const{cameraRestriction:n,zoomDistance:o,minVerticalCameraAngle:r,maxVerticalCameraAngle:h,minHorizontalCameraAngle:c,maxHorizontalCameraAngle:_}=this._initData;if(o&&(this._zoomDistance=o/100),void 0!==r&&(this.minPolarAngle=a(r<0?r:-1*r)),void 0!==h&&(this.maxPolarAngle=a(h)),void 0!==c&&(this.minAzimuthAngle=a(c<0?c:-1*c)),void 0!==_&&(this.maxAzimuthAngle=a(_)),void 0!==n){let t=Math.abs(a(n));this.minAzimuthAngle=-t,this.maxAzimuthAngle=t,this.maxPolarAngle=Math.min(t,a(85))}this._update()}_getCamera(){return this._camera||this._initCamera(),this._camera}getCamera(){return super.getCamera()}_initCamera(){this._camera=new E,this._camera.fov=30,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5)}setObjectRotation(t){this._objectRotation=t}getObjectRotation(){return this._objectRotation}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions();this._camera.aspect=t/e,this._camera.updateProjectionMatrix()}animateCamera(t){if(!super.animateCamera(t))return!1;let e=this._targetPosition;return!!e&&(this.getCamera().lookAt(e),!0)}_initInputListener(){this._inputListeners.push({key:3,fun:()=>{this._state=1}}),this._inputListeners.push({key:6,fun:t=>{var e,i;1!==this._state||this._locked||(this._userInteraction=!0,!(void 0!==(null===(e=t.event)||void 0===e?void 0:e.shiftKey)&&(null===(i=t.event)||void 0===i?void 0:i.shiftKey))&&this._panningEnabled&&this.disablePanning(),this._move(new D(t.position.x,t.position.y),t.type))}}),this._inputListeners.push({key:11,fun:t=>{1===this._state||this._locked||(this._userInteraction=!0,this._pan(new D(t.position.x,t.position.y),t.type))}}),this._inputListeners.push({key:4,fun:t=>{1===this._state&&this.dispatchEvent(2,t.type),this._state=0,this._orbitPosition=null,this._lerpEnabled=!0}}),this._inputListeners.push({key:7,fun:({event:t})=>{this._maxZoomedIn||(t&&(t.preventDefault(),t.stopPropagation()),this.zoomIn())}}),this._inputListeners.push({key:8,fun:({event:t})=>{this._maxZoomedOut||(t&&(t.preventDefault(),t.stopPropagation()),this.zoomOut())}})}_panTargetPosition(t){const e=t.clone().sub(this._orbitPosition),i=this._domHelper.element,s=this._targetPosition.project(this._camera),n=Math.max(2,4*(1-this._distance/this.maxDistance));s.x=s.x-e.x/i.clientHeight*n,s.y=s.y+e.y/i.clientHeight*n,this._targetPositionIsPanned=!0,this._targetPosition.copy(s.unproject(this._camera))}_pan(t,e){this._lerpEnabled=!1,this._orbitPosition||(this._orbitPosition=new D(t.x,t.y),this.dispatchEvent(0,e)),this._panTargetPosition(t),r(this._orbitPosition,t)||this.dispatchEvent(1,e),this._orbitPosition.copy(t),this._update()}_move(t,e){this._orbitPosition||(this._orbitPosition=new D(t.x,t.y),this.dispatchEvent(0,e));const i=t.clone().sub(this._orbitPosition),s=this._domHelper.element;this._panningEnabled?this._panTargetPosition(t):(this._rotateHorizontal(2*Math.PI*i.x/s.clientWidth*1),this._rotateVertical(2*Math.PI*i.y/s.clientHeight*1)),r(this._orbitPosition,t)||this.dispatchEvent(1,e),this._orbitPosition.copy(t),this._update()}checkBoundsAndPlaceCamera(t,e=!0){this._boundingBox&&h(t,this._boundingBox)<=0?this.setBounds(t):this.zoomToFitBounds(t,e)}zoomToFitBounds(t,e=!0){this.setBounds(t);const i=t.getSize(new M);if(this._initData.debug||i.x+i.y+i.z===0)return;const s=this.getCurrentCameraParameters(),n=t.getCenter(new M),a=this._setDistanceAndRangesBasedOnBounds(i);this._checkZoomDistance(t,a);const o={yaw:e?this._yaw:s.yaw,pitch:e?this._pitch:s.pitch,distance:a,targetX:n.x,targetY:n.y,targetZ:n.z};I(s,o)||this._tweenCameraParameter(s,o,!1)}updateToBounds(t,e,i=!0,s){if(this.setBounds(t),this._initData.debug)return;const n=t.getCenter(new M);s?(this._targetPosition=s.clone(),this._targetPositionIsPanned=!1):this._targetPositionIsPanned||(this._targetPosition=new M(n.x,n.y,n.z));const a=this.getCurrentCameraParameters(),o=t.getSize(new M);if(i){const i=this._setDistanceAndRangesBasedOnBounds(o);this._distance=i,this._checkZoomDistance(t,i),this._userInteraction?this._tweenCameraParameter(a,{yaw:this._yaw,pitch:this._pitch,distance:this._distance,targetX:this._targetPosition.x,targetY:this._targetPosition.y,targetZ:this._targetPosition.z},e):this._update()}else this._setDistanceAndRangesBasedOnBounds(o,!1);this._update()}_checkZoomDistance(t,e){const i=t.getBoundingSphere(new k);e-i.radius<this._zoomDistance&&(console.warn("the initial camera position is closer than the zoomDistance param, zoomDistance is set to initial camera position."),this._zoomDistance=e-i.radius)}_setDistanceAndRangesBasedOnBounds(t,e=!0){const{offsetWidth:i,offsetHeight:s}=this._getOffset();this._bounds.copy(t);const{cameraSpacing:n}=this._initData;t.addScalar(n/100),this.minDistance=Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z);const a=Math.max(t.x,t.y),{x:o,y:r}=this._getMargin(i,s),h=c(t.x+o,t.y+r,t.z,this._camera.fov,i,s);return this._distance<h&&e&&(this._distance=h),this.maxDistance=h+a,this.maxDistance<2&&(this.maxDistance=2),this._camera.far=5*this.maxDistance,this._setCameraNear(),h}_getIdealDistance(){const{offsetWidth:t,offsetHeight:e}=this._getOffset(),{x:i,y:s}=this._getMargin(t,e);return c(this._bounds.x+i,this._bounds.y+s,this._bounds.z,this._camera.fov,t,e)}_getOffset(){const t=this._domHelper.getClientDimensions(),e=t.x,i=t.y;return{offsetWidth:this._camera.offset?e-e*this._camera.offset.left-e*(1-this._camera.offset.right):e,offsetHeight:this._camera.offset?i-i*this._camera.offset.bottom-i*(1-this._camera.offset.top):i}}_getMargin(t,e){let i=this._bounds.x/2,s=this._bounds.y/2;return t>1080&&(i+=this._bounds.x<.3?.2:0,i+=this._bounds.x*(t/1080-1)),e>1080&&(i+=this._bounds.y<.3?.2:0,s+=this._bounds.y*(e/1080-1)),{x:i,y:s}}reset(t,e,i,s,n=!0){const o=t.getSize(new M);if(o){if(e)this._targetPosition.copy(e);else{const e=t.getCenter(new M);this._targetPosition.copy(e)}const r=this.getCurrentCameraParameters();if(i||(i=-30),s||(s=10),i+=_(this._objectRotation),this._initData.debug)return this._distance=this._setDistanceAndRangesBasedOnBounds(o),this._update(this._targetPosition),void this._setDistanceAndRangesBasedOnBounds(o);const h=this._setDistanceAndRangesBasedOnBounds(o),c=a(s),d=a(i);let l=this._targetPosition.clone();n?this._tweenCameraParameter(r,{yaw:d,pitch:c,distance:h,targetX:l.x,targetY:l.y,targetZ:l.z},!0):(this._pitch=c,this._yaw=d,this._distance=h,this._update(this._targetPosition))}else console.warn("you cant reset without bounds!")}updateAndReset(t,e,i,s,n,o=!0){const r=new M(-t.x/2,0,-t.z/2),h=new M(t.x/2,t.y,t.z/2);if(this._boundingBox=new z(r,h),n&&t.addScalar(n),e?this._targetPosition.copy(e):(this._targetPosition=new M(0,t.y/2,0),this._targetPositionIsPanned=!1),-1===this._distance){const e=this._setDistanceAndRangesBasedOnBounds(t);this._distance=Math.max(2,e)}const c=this.getCurrentCameraParameters();i||(i=-30),s||(s=10),i+=_(this._objectRotation),this._pitch=a(s),this._yaw=a(i),this._setDistanceAndRangesBasedOnBounds(t);let d=this._targetPosition.clone();o?this._tweenCameraParameter(c,{yaw:this._yaw,pitch:this._pitch,distance:this.maxDistance,targetX:d.x,targetY:d.y,targetZ:d.z},!0):this._update(this._targetPosition)}_update(t,e){this._initData.debug?this._pitch=Math.max(a(-89),Math.min(a(89),this._pitch)):(this._yaw=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this._yaw)),this._pitch=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._pitch))),this._saveYawAndPitch();const i=new T(-this._pitch,this._yaw,0,"ZYX"),s=(new R).setFromEuler(i),n=new M(0,0,-1);n.applyQuaternion(s),this._distance*=this._scale,this._initData.debug||(this._distance=Math.min(this.maxDistance,this._distance)),t&&this._targetPosition.copy(t);const o=this._targetPosition.clone().sub(n.multiplyScalar(this._distance));if(this._initData.debug)this._cameraPosition.copy(o),this._zoomChanged(!1,!1);else if(e)this._cameraPosition.copy(o);else{const t=this._getCameraSphere(o);null!=this._boundingBox&&this._boundingBox.intersectsSphere(t)&&this._scale>=1?this._distance+=.1:null==this._boundingBox||this._boundingBox.intersectsSphere(t)?this._zoomChanged(!1,!0):(this._cameraPosition.copy(o),this._distance===this.maxDistance?this._zoomChanged(!0,!1):this._zoomChanged(!1,!1))}this._scale=1}_zoomChanged(t,e){let i=t+""+e;0===this._currentZoomHash.length||this._currentZoomHash!==i?(this.dispatchEvent(5,new Pt(t,e)),this._currentZoomHash=i):t||e||this.dispatchEvent(5,new Pt(t,e)),this._maxZoomedIn=e,this._maxZoomedOut=t}zoomTo(t){return this._tweenCameraParameter(this.getCurrentCameraParameters(),t,!0)}_getCameraSphere(t){const e=Math.max(this._bounds.x,this._bounds.y),i=Math.max(e/10,this._zoomDistance);return new k(t,i)}zoomIn(t){this._lerpEnabled=!0,this._scale*=t?Math.pow(.95,t):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(3)}zoomOut(t){this._lerpEnabled=!0,this._scale/=t?Math.pow(.95,t):this._zoomSpeed,this._setCameraNear(),this._update(),this.dispatchEvent(4)}clear(){this._userInteraction=!1,this._initData.debug||(this._distance=-1,this._targetPosition=new M(0,0,0),this._targetPositionIsPanned=!1)}async moveCamera(t){const{x:e,y:i,z:s}=this._boundingBox.getCenter(new M);t.targetX=t.targetX||e,t.targetY=t.targetY||i,t.targetZ=t.targetZ||s,t.distance=t.distance||this._getIdealDistance();const n=this.getCurrentCameraParameters(),a=A(JSON.parse(JSON.stringify(n)),t);return this._tweenCameraParameter(n,a,!0)}enablePanning(){this._lerpEnabled=!1,this._panningEnabled=!0}disablePanning(){this._lerpEnabled=!1,this._panningEnabled=!1}getKernelZoomFactor(){const t=this.maxDistance;return 1-this._distance/(t-2)+.2}}t("C",xt);class bt{constructor(t,e){this._scene=t,e&&(e.removeFromScene(),e.cleanUp())}updateCamera(t){}reload(){this.removeFromScene(),this.addToScene()}updateBounds(t,e){this._bounds=t}cleanUp(){this._scene=null}}class St{constructor(t){this._innerSize=1,this._outerSize=100,this._plane=new O,this._plane.rotation.x=-Math.PI/2;const e=d.createMeshStandardMaterial({});this._innerPlaneMesh=new B,this._innerPlaneMesh.layers.set(2),this._innerPlaneMesh.material=e,this._innerPlaneMesh.receiveShadow=!0,this._outerPlaneMesh=new B,this._outerPlaneMesh.layers.set(2),this._outerPlaneMesh.material=e,this._outerPlaneMesh.receiveShadow=!0,this._plane.add(this._innerPlaneMesh),this._plane.add(this._outerPlaneMesh),this._innerSize=1,this._outerSize=t,this._updatePlane(this._innerSize,this._outerSize)}getRootNode(){return this._plane}getInnerPlane(){return this._innerPlaneMesh}getOuterPlane(){return this._outerPlaneMesh}updateSize(t){this._innerSize=t,this._updatePlane(this._innerSize,this._outerSize)}_updatePlane(t,e){const i=new F;i.moveTo(-t/2,-t/2),i.lineTo(-t/2,t/2),i.lineTo(t/2,t/2),i.lineTo(t/2,-t/2),i.lineTo(-t/2,-t/2);const s=new F;s.moveTo(-e/2,-e/2),s.lineTo(-e/2,e/2),s.lineTo(e/2,e/2),s.lineTo(e/2,-e/2),s.lineTo(-e/2,-e/2);const n=new U;n.moveTo(-t/2,-t/2),n.lineTo(-t/2,t/2),n.lineTo(t/2,t/2),n.lineTo(t/2,-t/2),n.lineTo(-t/2,-t/2),s.holes.push(n);const a=new G(i);this._innerPlaneMesh.geometry&&this._innerPlaneMesh.geometry.dispose(),this._innerPlaneMesh.geometry=a;const o=new G(s);this._outerPlaneMesh.geometry&&this._outerPlaneMesh.geometry.dispose(),this._outerPlaneMesh.geometry=o;const r=a.attributes.uv.clone();a.setAttribute("uv2",r);const h=a.attributes.uv2.array;for(let t=0;t<h.length;++t)h[t]+=.5}}class Mt extends bt{constructor(t,e,i){super(t,e),this._longestSide=2,this._bakedShadowPlane=new St(100),this._fog=i||!1,this._textureLoader=new H,this.addToScene()}needsBounds(){return!0}needsCamera(){return this._fog}needsRotation(){return!1}updateBounds(t){return super.updateBounds(t),this._longestSide=Math.max(t.x,t.z),this._update(),!0}updateCamera(t){this._cameraDistance=t.position.distanceTo(new M(0,0,0)),this._update()}_update(){this._fog&&this._updateFog()}_updateFog(){let t=this._longestSide/2;this._scene.fog=new q(16185078,this._cameraDistance+t+3,this._cameraDistance+t+3+1),this._scene.background=new N(16185078)}_updateFloor(){if(this._floorMaterial)this._bakedShadowPlane.getOuterPlane().material=this._floorMaterial,this._bakedShadowPlane.getInnerPlane().material=this._floorMaterial;else{let t=this._width/1e3,e=this._height/1e3;this._repeatable&&(this._floorTexture.wrapS=j,this._floorTexture.wrapT=j,this._floorTexture.repeat.set(100/t,100/e));let i=d.createMeshStandardMaterial({map:this._floorTexture,side:Z});this._bakedShadowPlane.getInnerPlane().material=i,this._bakedShadowPlane.getOuterPlane().material=i}}addToScene(){this._scene&&this._scene.add(this._bakedShadowPlane.getRootNode())}removeFromScene(){this._scene.remove(this._bakedShadowPlane.getRootNode())}setFloorMaterial(t,e,i,s){return this._width=e,this._height=i,this._repeatable=s,this._floorPromise=new Promise((e,i)=>{this._textureLoader.load(t,t=>{this._floorTexture=t,e()},null,i)}),new Promise((t,e)=>{this._floorPromise.then(()=>{this._updateFloor(),this._update(),t()},e)})}changeFloorMaterial(t,e){this._floorPromise=new Promise((i,s)=>{this._floorMaterial=l(t),this._rapiAccess.getTexturesOf(t).then(t=>{if(t.length>0){let n=[];t.forEach(t=>{n.push(m(this._dataSyncer.requestAsset(t.image,!0),t,this._floorMaterial,e,1,1))}),Promise.all(n).then(()=>{setTimeout(()=>i(),0)},s)}else setTimeout(()=>i(),0)})});let i=[this._floorPromise];return new Promise((t,e)=>{Promise.all(i).then(()=>{this._updateFloor(),this._update(),t()},e)})}showGUI(){this._floorMaterial?this._addGUI():this._floorPromise&&this._floorPromise.then(()=>this._addGUI())}_addGUI(){let t=u();if(!t)return;let e=t.addFolder("Floor");e.add(this._floorMaterial,"roughness").min(0).max(1).step(.01),e.add(this._floorMaterial,"reflectivity").min(0).max(1).step(.01),e.add(this._floorMaterial,"clearCoat").min(0).max(1).step(.01),e.add(this._floorMaterial,"clearCoatRoughness").min(0).max(1).step(.01),e.add(this._floorMaterial,"opacity").min(0).max(1).step(.01),e.add(this._floorMaterial,"metalness").min(0).max(1).step(.01),e.add(this._floorMaterial,"bumpScale").min(0).max(1).step(.01)}}t("F",Mt),i([s],Mt.prototype,"_rapiAccess",void 0),i([s],Mt.prototype,"_dataSyncer",void 0);class Lt extends Ct{constructor(t,e,i,s){super(t,e,i),this._scale=1,this._cameraZoom=1,this._state=0,this._size=5,this._lastPosition=new D,this._zoomPosition=new M,this._lastZoom=0,this._zoomSpeed=Math.pow(.95,2),s?(this._camera=s,this._cameraPosition=(new M).copy(this._camera.position)):this._initCamera(i||new M(0,10,0))}_getCamera(){return this._camera||this._initCamera(new M(0,10,0)),this._camera}_initCamera(t){let{x:e,y:i}=this._domHelper.getClientDimensions(),s=e/i*this._size,n=this._size;this._camera=new W(s/-2,s/2,n/2,n/-2,1,1e3),this._camera.position.copy(t),this._cameraPosition=t,this._camera.lookAt(new M(0,0,0))}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions(),i=t/e*this._size,s=this._size;this._camera.left=i/-2,this._camera.right=i/2,this._camera.top=s/2,this._camera.bottom=s/-2,this._camera.updateProjectionMatrix()}_initInputListener(){this._inputListeners.push({key:3,fun:t=>{this._locked||(this._state=1,this._lastPosition.set(t.positionRelative.x,t.positionRelative.y),this.dispatchEvent(0))}}),this._inputListeners.push({key:6,fun:t=>{1!==this._state||this._locked||(this._move(new D(t.positionRelative.x,t.positionRelative.y),t.type),this.dispatchEvent(1))}}),this._inputListeners.push({key:4,fun:t=>{1===this._state&&this.dispatchEvent(2),this._state=0}}),this._inputListeners.push({key:7,fun:t=>{t.event&&(t.event.stopPropagation(),t.event.preventDefault()),this.dispatchEvent(3),this._scale/=this._zoomSpeed,this._zoomTo(t.positionRelative),this._update()}}),this._inputListeners.push({key:8,fun:t=>{t.event&&(t.event.stopPropagation(),t.event.preventDefault()),this.dispatchEvent(4),this._scale*=this._zoomSpeed,this._zoomTo(t.positionRelative),this._update()}})}_zoomTo(t){if(Date.now()-this._lastZoom>200){let e=new M(t.x,t.y,0);e.unproject(this._camera),this._zoomPosition.copy(e)}this._lastZoom=Date.now()}_move(t,e){let i=new M,s=new M(this._lastPosition.x,this._lastPosition.y,0),n=new M(t.x,t.y,0);s.unproject(this._camera),n.unproject(this._camera),i.subVectors(n,s),this._cameraPosition.x-=i.x*(2===e?1.1:1),this._cameraPosition.z-=i.z*(2===e?1.1:1),this._lastPosition.copy(t)}zoomToFitBounds(t,e,i){if(h(t,this._boundingBox)<0&&!i)return void this.setBounds(t);this.setBounds(t);const s=t.getSize(new M),n=t.getCenter(new M),a=s.x/-2/this._camera.left,o=s.z/-2/this._camera.bottom,r=1/Math.max(a,o);(r<this._cameraZoom||e)&&(this._scale=r,this._cameraZoom=r,this._cameraPosition.x=n.x,this._cameraPosition.z=n.z)}_update(t){this._scale=Math.min(this._scale,5),this._scale=Math.max(this._scale,.1);let e=(new M).subVectors(this._zoomPosition,this._cameraPosition).multiplyScalar((this._scale-this._cameraZoom)/this._scale);this._cameraPosition.x+=e.x,this._cameraPosition.z+=e.z,this._cameraZoom!==this._scale&&this.dispatchEvent(5,new Pt(.1===this._scale,5===this._scale)),this._cameraZoom=this._scale,this._camera.updateProjectionMatrix()}animateCamera(t){if(!super.animateCamera(t)&&Math.abs(this._cameraZoom-this._camera.zoom)<=.01)return!1;const e=Math.min(10*t,1);return this._camera.zoom=V.lerp(this._camera.zoom,this._cameraZoom,e),!0}getKernelZoomFactor(){const t=1e3*(this._camera.right-this._camera.left);return this._domHelper.element.clientWidth/t*this._camera.zoom}}t("b",Lt);const Et=Math.PI/4;class Dt extends Ct{constructor(t,e,i,s){super(t,e,i),this._state=0,this._rotationSpeed=1,this._keyMap=new Map,this.minPolarAngle=a(-60),this.maxPolarAngle=a(60),this._camera=s||new E,this._camera.fov=70,this._camera.aspect=this._width/this._height,this._camera.near=.1,this._camera.far=100,this._camera.updateProjectionMatrix(),this._camera.layers.set(3),this._camera.layers.enable(1),this._camera.layers.enable(2),this._camera.layers.enable(6),this._camera.layers.enable(5),i?this._camera.position.set(i.x,1.5,i.z):this._camera.position.set(0,1.5,0),this._cameraPosition=new M,this._cameraPosition.copy(this._camera.position),this._cameraRotation=new R,this._pitch=0,this._yaw=0;let n=new T(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(n),window.addEventListener("gamepadconnected",this._gamepadConnected.bind(this)),window.addEventListener("gamepaddisconnected",this._gamepadDisconnected.bind(this))}_gamepadConnected(t){this.startButtonPressListener()}_gamepadDisconnected(t){window.cancelAnimationFrame(this._listenerLoopAnimationFrame)}startButtonPressListener(){this._listenerLoopAnimationFrame=window.requestAnimationFrame(()=>{this.buttonPressListener()})}buttonPressListener(){let t=navigator.getGamepads()[0];this._checkRightStick(t),this._checkLeftStick(t),this._checkButtons(t),this._processKeyMap(this._keyMap,.001),this.startButtonPressListener()}_checkRightStick(t){let e=t.axes[2],i=t.axes[3];Math.abs(e)>.2&&(this._rotateHorizontal(.01*Et*e),this._update(),this.dispatchEvent(1)),Math.abs(i)>.2&&(this._rotateVertical(.01*Et*i),this._update(),this.dispatchEvent(1))}_checkLeftStick(t){let e=t.axes[0],i=t.axes[1];Math.abs(i)>.2?i<0?this._keyMap.set(87,!0):this._keyMap.set(83,!0):t.buttons&&t.buttons[12]&&t.buttons[12].pressed?this._keyMap.set(87,!0):t.buttons&&t.buttons[13]&&t.buttons[13].pressed?this._keyMap.set(83,!0):(this._keyMap.set(87,!1),this._keyMap.set(83,!1)),Math.abs(e)>.2?e<0?this._keyMap.set(65,!0):this._keyMap.set(68,!0):(this._keyMap.set(65,!1),this._keyMap.set(68,!1))}_checkButtons(t){t.buttons&&t.buttons[6]&&t.buttons[6].pressed?this._keyMap.set(16,!0):this._keyMap.set(16,!1),t.buttons&&t.buttons[14]&&t.buttons[14].pressed?(this._keyMap.set(37,!0),this.dispatchEvent(1)):this._keyMap.set(37,!1),t.buttons&&t.buttons[15]&&t.buttons[15].pressed?(this._keyMap.set(39,!0),this.dispatchEvent(1)):this._keyMap.set(39,!1)}animateCamera(t){let e=this._cameraPosition,i=this._cameraRotation,s=this.getCamera(),n=o(e,s.position),a=p(i,s.quaternion);if(!e||n&&a)return!1;let r=this.getCamera().position.clone(),h=Math.min(10*t,1);r.lerp(e,h),this.getCamera().position.copy(r);let c=this.getCamera().quaternion.clone(),_=Math.min(5*t,1);c.slerp(i,_),this.getCamera().setRotationFromQuaternion(c);let d=!1;return this._keyMap.forEach(t=>{t&&(d=!0)}),d&&this._processKeyMap(this._keyMap,t),!0}_getCamera(){return this._camera}_initInputListener(){window.addEventListener("keyup",this._onKeyChanged.bind(this),!1),window.addEventListener("keydown",this._onKeyChanged.bind(this),!1),this._inputListeners.push({key:3,fun:t=>{this._down(t)}}),this._inputListeners.push({key:6,fun:t=>{this._move(t)}}),this._inputListeners.push({key:4,fun:t=>{this._up(t)}})}_down(t){this._downPosition=t.position,this._position=t.position,this._state=1,2===t.type&&window.setTimeout(this._onLongDown.bind(this),350),2===t.type?this._rotationSpeed=.6:this._rotationSpeed=1}_move(t){this._position=t.position,1!==this._state||this._locked||this._orbit(new D(t.position.x,t.position.y)),2!==this._state||this._locked||(this._orbit(new D(t.position.x,t.position.y)),this._moveForward())}_up(t){1===this._state&&this.dispatchEvent(2),2===this._state&&this._keyMap.set(87,!1),this._state=0,this._orbitPosition=null}_onLongDown(){g(this._downPosition,this._position)<v&&1===this._state&&(this._state=2,this._orbit(new D(this._position.x,this._position.y)),this._moveForward())}_update(t){let e=new T(-this._pitch,this._yaw,0,"ZYX");this._cameraRotation.setFromEuler(e)}updateCamera(){let{x:t,y:e}=this._domHelper.getClientDimensions();this._camera.aspect=t/e,this._camera.updateProjectionMatrix()}_onKeyChanged(t){this._keyMap.set(t.keyCode,"keydown"===t.type),this.dispatchEvent(6),this._processKeyMap(this._keyMap,.001)&&t.preventDefault()}_processKeyMap(t,e){e=Math.min(e,.1);let i=new M(0,0,0),s=!1;return this._processUpDown(t,i,e),t.get(65)&&(i.x=-1*e),t.get(68)&&(i.x=1*e),t.get(37)&&(this._rotateHorizontal(-Et*this._rotationSpeed*e),s=!0),t.get(39)&&(this._rotateHorizontal(Et*this._rotationSpeed*e),s=!0),t.get(16)&&(i.x*=3,i.z*=3),!(0===i.x&&0===i.y&&0===i.z&&!s||(i.applyQuaternion(this.getCamera().quaternion),this._cameraPosition.add(new M(i.x,0,i.z)),this._update(),0))}_processUpDown(t,e,i){(t.get(87)||t.get(38))&&(e.z=-1*i),(t.get(83)||t.get(40))&&(e.z=1*i)}_orbit(t){this._orbitPosition||(this._orbitPosition=new D(t.x,t.y),this.dispatchEvent(0));let e=t.clone().sub(this._orbitPosition),i=this._domHelper.element instanceof Document?this._domHelper.element.body:this._domHelper.element;e.multiplyScalar(-1),this._rotateHorizontal(2*Math.PI*e.x/i.clientWidth*1),this._rotateVertical(2*Math.PI*e.y/i.clientHeight*1),r(this._orbitPosition,t)||this.dispatchEvent(1),this._orbitPosition.copy(t),this._update()}_moveForward(){this._keyMap.set(87,!0),this._processKeyMap(this._keyMap,.001)}_rotateVertical(t){let e=this._pitch+t;e>this.maxPolarAngle||e<this.minPolarAngle||(this._pitch=e,this._pitch<-Math.PI?this._pitch+=2*Math.PI:this._pitch>Math.PI&&(this._pitch-=2*Math.PI),this._saveYawAndPitch())}getKernelZoomFactor(){return this._camera.zoom}}t("c",Dt);class It extends bt{constructor(t,e,i,s,n){if(super(t,e),this._color=i,this._oldBackground=t.background,s&&n){this._canvas=s,this._style=document.createElement("style");let t='background-image: url("'+n+'"); background-size: cover;';this._style.innerText=".rml-scene-background {"+t+"}",this._canvas.appendChild(this._style)}}needsBounds(){return!0}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._color&&(this._scene.background=this._color),this._canvas&&this._canvas.classList&&(this._scene.background=null,this._canvas.classList.add("rml-scene-background"))}removeFromScene(){this._oldBackground&&(this._scene.background=this._oldBackground),this._canvas&&this._canvas.classList.remove("rml-scene-background")}showGUI(){}}t("B",It);class kt{parse(t,e,i,s,n){let a=JSON.parse(s);return a.environment?this.load(t,e,i,a,n):null}load(t,e,i,s,n){let a,o=s.environment;if(!o)return console.warn("No environment set in scene settings"),Promise.resolve(null);switch(o.type){case"color":a=new Promise(e=>e(new It(t,i,new N(o.details.color))));break;case"image":a=new Promise(s=>s(new It(t,i,null,e,o.details.imageUrl)));break;case"floor":a=new Promise(e=>{this._rapiAccess.getMaterial(o.details.material).then(s=>{let a=void 0===o.details.fog||o.details.fog,r=new Mt(t,i,a);r.changeFloorMaterial(s,n).then(()=>{e(r)})})});break;default:console.warn("Could not load environment, return old environment"),a=new Promise(t=>t(i))}return a}}i([s],kt.prototype,"_rapiAccess",void 0);class zt{constructor(t,e){this._scene=t,e&&e.removeFromScene()}needsBounds(){return!1}updateBounds(t){}getCameraContainer(){return this._cameraContainer||(this._cameraContainer=new O),this._cameraContainer}}t("L",zt);class Tt extends zt{constructor(t,e){super(t,e),this._lights=[]}needsBounds(){return!0}updateBounds(t){if(this._cameraLight){const e=this._cameraLight,i=new M;t.getSize(i);const s=1.5*Math.max(Math.max(i.x,i.y),i.z);this._boundingSize=s,e.shadow.camera.top=s/2,e.shadow.camera.bottom=-s/2,e.shadow.camera.left=-s/2,e.shadow.camera.right=s/2,e.shadow.camera.updateProjectionMatrix()}}loadFromJSON(t){return new Promise(e=>{this._lights=this._dynamicLightSettingLoader.parse(t),this.addToScene(),e()})}loadFromObject(t){return new Promise(e=>{(null==t?void 0:t.lights)||e(),this._lights=this._dynamicLightSettingLoader.load(t),this._lights.forEach((t,e)=>{t.userData.movesWithCamera&&(this._cameraLight=t,this._lights.splice(e,1))}),this.addToScene(),e()})}loadFromURL(t){return new Promise((e,i)=>{fetch(new Request(t,{method:"GET"})).then(K).then(t=>this.loadFromObject(t).then(e,i))})}addToScene(){this._lights.forEach(t=>{this._scene.add(t)}),this._cameraLight&&this._scene.add(this._cameraLight)}update(t,e){if(!this._cameraLight)return;let i=new M;t.getWorldDirection(i),i.multiplyScalar(-this._boundingSize);let s=e.clone().add(i);this._cameraLight.position.copy(s)}removeFromScene(){this._lights.forEach(t=>{this._scene.remove(t)}),this._cameraLight&&this._scene.remove(this._cameraLight)}reload(){this.removeFromScene(),this.addToScene()}showGUI(){let t=u();this._cameraLight&&this._addToGUI(t,this._cameraLight),this._lights.forEach(e=>{this._addToGUI(t,e)})}_addToGUI(t,e){t&&(e instanceof Y&&this._addSpotLightToGUI(t,e),e instanceof X&&this._addAmbientLightToGUI(t,e),e instanceof J&&this._addDirectionalLightToGUI(t,e),e instanceof Q&&this._addRectAreaLightToGUI(t,e))}_addRectAreaLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString(),intensity:e.intensity*(e.width*e.height)};i.add(e,"visible"),i.add(s,"intensity").min(10).max(400).step(10).onChange(t=>{e.intensity=t/(e.width*e.height)}),i.add(e,"castShadow"),i.addColor(s,"color").onChange(t=>{e.color=new N(t)}),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new M(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new M(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new M(0,0,0))})}_addSpotLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString(),angle:180*e.angle/Math.PI};i.add(e,"visible"),i.add(e,"intensity").min(0).max(5).step(.1),i.add(e,"penumbra").min(0).max(1).step(.1),i.addColor(s,"color").onChange(t=>{e.color=new N(t)}),i.add(s,"angle").min(10).max(180).step(1).onChange(t=>{e.angle=t*Math.PI/180}),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new M(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new M(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new M(0,0,0))})}_addAmbientLightToGUI(t,e){let i={name:e.name,color:"#"+e.color.getHexString()},s=t.addFolder(e.name);s.add(e,"visible"),s.add(e,"intensity").min(0).max(5).step(.1),s.addColor(i,"color").onChange(t=>{e.color=new N(t)})}_addDirectionalLightToGUI(t,e){let i=t.addFolder(e.name),s={name:e.name,color:"#"+e.color.getHexString()};i.add(e,"visible"),i.add(e,"intensity").min(0).max(5).step(.1),i.addColor(s,"color").onChange(t=>{e.color=new N(t)}),i.add(e,"castShadow"),i.add(e.position,"x").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new M(0,0,0))}),i.add(e.position,"y").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new M(0,0,0))}),i.add(e.position,"z").min(-10).max(10).step(.1).onChange(()=>{e.lookAt(new M(0,0,0))})}}i([s],Tt.prototype,"_dynamicLightSettingLoader",void 0);class Rt extends B{constructor(t,e={}){const i=[t.isCubeTexture?"#define ENVMAP_TYPE_CUBE":""].join("\n")+"\n\n\t\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\t\tuniform float radius;\n\t\t\t\tuniform float height;\n\t\t\t\tuniform float angle;\n\n\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\tuniform samplerCube map;\n\n\t\t\t\t#else\n\n\t\t\t\t\tuniform sampler2D map;\n\n\t\t\t\t#endif\n\n\t\t\t\t// From: https://www.shadertoy.com/view/4tsBD7\n\t\t\t\tfloat diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) \n\t\t\t\t{\n\n\t\t\t\t\tfloat d = dot ( rd, n );\n\n\t\t\t\t\tif( d > 0.0 ) { return 1e6; }\n\n\t\t\t\t\tvec3 o = ro - c;\n\t\t\t\t\tfloat t = - dot( n, o ) / d;\n\t\t\t\t\tvec3 q = o + rd * t;\n\n\t\t\t\t\treturn ( dot( q, q ) < r * r ) ? t : 1e6;\n\n\t\t\t\t}\n\n\t\t\t\t// From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm\n\t\t\t\tfloat sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) {\n\n\t\t\t\t\tvec3 oc = ro - ce;\n\t\t\t\t\tfloat b = dot( oc, rd );\n\t\t\t\t\tfloat c = dot( oc, oc ) - ra * ra;\n\t\t\t\t\tfloat h = b * b - c;\n\n\t\t\t\t\tif( h < 0.0 ) { return -1.0; }\n\n\t\t\t\t\th = sqrt( h );\n\n\t\t\t\t\treturn - b + h;\n\n\t\t\t\t}\n\n\t\t\t\tvec3 project() {\n\n\t\t\t\t\tvec3 p = normalize( vWorldPosition );\n\t\t\t\t\tvec3 camPos = cameraPosition;\n\t\t\t\t\tcamPos.y -= height;\n\n\t\t\t\t\tfloat intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );\n\t\t\t\t\tif( intersection > 0.0 ) {\n\n\t\t\t\t\t\tvec3 h = vec3( 0.0, - height, 0.0 );\n\t\t\t\t\t\tfloat intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );\n\t\t\t\t\t\tp = ( camPos + min( intersection, intersection2 ) * p ) / radius;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tp = vec3( 0.0, 1.0, 0.0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn p;\n\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 projectedWorldPosition = project();\n\n\t\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\t\tvec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tvec3 direction = normalize( projectedWorldPosition );\n\t\t\t\t\t\tvec2 uv = equirectUv( direction );\n\t\t\t\t\t\tvec3 outcolor = texture2D( map, uv ).rgb;\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\tgl_FragColor = vec4( outcolor, 1.0 );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <colorspace_fragment>\n\n\t\t\t\t}\n\t\t\t\t",s={map:{value:t},height:{value:e.height||15},radius:{value:e.radius||100}};super(new $(1,16),new tt({uniforms:s,fragmentShader:i,vertexShader:"\n\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );\n\t\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t}\n\t\t\t",side:Z}))}set radius(t){this.material.uniforms.radius.value=t}get radius(){return this.material.uniforms.radius.value}set height(t){this.material.uniforms.height.value=t}get height(){return this.material.uniforms.height.value}}class At extends bt{constructor(t,e,i){super(t,e),this.updateEnvironmentTexture(i)}updateEnvironmentTexture(t){t&&(this._environmentTexture=t,this._skybox=new Rt(this._environmentTexture),this._skybox.name="Ground projected skybox",this._skybox.scale.setScalar(100)),this.reload()}needsBounds(){return!1}needsCamera(){return!1}needsRotation(){return!1}addToScene(){this._scene&&this._skybox&&this._scene.add(this._skybox)}removeFromScene(){this._scene&&this._skybox&&this._scene.remove(this._skybox)}showGUI(t){let e=u();if(!e)return;let i=e.addFolder("Ground Projected Environment");i.add(this._skybox,"height").min(10).max(100).step(.1).onChange(t),i.add(this._skybox,"radius").min(20).max(200).step(.1).onChange(t)}}class Ot{constructor(t){this._lightSourceDetector=t}static createPlane(t,e){const i=new et(2,1),s=null!=e?e:new it({color:12632256,side:Z}),n=new B(i,s);return n.position.z=-.1,t.add(n),n}createDebugScene(t,e){this._scene=t,this._createLightGraphInMap(this._lightSourceDetector.sampleUVs,this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph,e)}_createLightGraphInMap(t,e,i,s){let n=[],a=[];for(let t=0;t<this._lightSourceDetector.lightGraph.noOfNodes;++t)0===i.adjacent[t].length?n.push(e[t]):a.push(e[t]);const o=n.map(t=>t.uv),r=a.map(t=>t.uv),h=t.filter(t=>!o.includes(t)&&!r.includes(t));this._createSamplePointsInMap(h,.005,16711680),this._createSamplePointsInMap(o,.01,255),this._createSamplePointsInMap(r,.01,65280),this._createClusterLinesInMap(this._lightSourceDetector.lightSamples,this._lightSourceDetector.lightGraph.edges,128);const c=this._lightSourceDetector.lightSources.map(t=>t.uv);this._createSamplePointsInMap(c,.015,16776960);let _=this._lightSourceDetector.lightSources;void 0!==s&&s>=0&&s<_.length&&(_=_.slice(0,s)),this._createCirclesInMap(_,8421376)}_createSamplePointsInMap(t,e,i){const s=new st(e,8,4),n=new it({color:i});t.forEach(t=>{var e;const i=new B(s,n);i.position.copy(this._uvToMapPosition(t)),i.name="samplePoint",null===(e=this._scene)||void 0===e||e.add(i)})}_createCirclesInMap(t,e){const i=new it({color:e,transparent:!0,opacity:.5});t.forEach(t=>{var e;const s=new st(t.size,8,4),n=new B(s,i);n.position.copy(this._uvToMapPosition(t.uv)),n.name="samplePoint",null===(e=this._scene)||void 0===e||e.add(n)})}_createClusterLinesInMap(t,e,i){var s;const n=new nt({color:i}),a=[];e.forEach(e=>{for(let i=1;i<e.length;i++){const s=t[e[0]].uv,n=t[e[i]].uv;if(a.push(this._uvToMapPosition(s)),Math.abs(s.x-n.x)>.5){const t=(s.y+n.y)/2,e=s.x<n.x?0:1;a.push(this._uvToMapPosition(new D(e,t))),a.push(this._uvToMapPosition(new D(1-e,t)))}a.push(this._uvToMapPosition(n))}});const o=(new at).setFromPoints(a),r=new ot(o,n);r.name="clusterLine",null===(s=this._scene)||void 0===s||s.add(r)}_uvToMapPosition(t){return new M(2*t.x-1,t.y-.5,0)}}class Bt extends rt{constructor(t){super(t),this._extendedEquirectMaterial=this._createEquirectMaterial()}fromEquirectangularTexture(t,e){var i,s;const n=null!==(i=null==e?void 0:e.rotation)&&void 0!==i?i:0,a=null!==(s=null==e?void 0:e.intensity)&&void 0!==s?s:1;return this._extendedEquirectMaterial.uniforms.intensity.value=a,this._extendedEquirectMaterial.uniforms.rotationMatrix.value.set(Math.cos(n),0,-Math.sin(n),0,1,0,Math.sin(n),0,Math.cos(n)),super.fromEquirectangular(t)}_createEquirectMaterial(){const t=new tt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},intensity:{value:1},rotationMatrix:{value:new ht}},vertexShader:Ft,fragmentShader:Ut,blending:ct,depthTest:!1,depthWrite:!1});return this._equirectMaterial=t,t}}const Ft="\nprecision mediump float;\nprecision mediump int;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nuniform mat3 rotationMatrix;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection( vec2 uv, float face ) {\n uv = 2.0 * uv - 1.0;\n vec3 direction = vec3( uv, 1.0 );\n if ( face == 0.0 ) {\n direction = direction.zyx; // ( 1, v, u ) pos x\n } else if ( face == 1.0 ) {\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n } else if ( face == 2.0 ) {\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n } else if ( face == 3.0 ) {\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n } else if ( face == 4.0 ) {\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n } else if ( face == 5.0 ) {\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n }\n return direction;\n}\n\nvoid main() {\n vOutputDirection = rotationMatrix * getDirection(uv, faceIndex);\n gl_Position = vec4(position, 1.0);\n}\n",Ut="\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform float intensity;\n\n#include <common>\n\nvoid main() { \n vec3 outputDirection = normalize(vOutputDirection);\n vec2 uv = equirectUv(outputDirection);\n gl_FragColor = vec4(texture2D(envMap, uv).rgb * intensity, 1.0);\n}\n";class Gt{}class Ht{get lightSources(){return this._lightSources}set rotation(t){this._rotation!==t&&(this._rotation=t,this.needsUpdate=!0)}set intensity(t){this._intensity!==t&&(this._intensity=t,this.needsUpdate=!0)}set maxNoOfLightSources(t){this._maxNoOfLightSources!==t&&(this._maxNoOfLightSources=t,this.needsUpdate=!0)}get maxNoOfLightSources(){return this._maxNoOfLightSources}constructor(t,e){var i,s;this.needsUpdate=!0,this._lightSources=[],t instanceof Gt?this.environmentSceneGenerator=t:t instanceof _t?this.cubeTexture=t:t instanceof dt&&(this.equirectangularTexture=t),(null==e?void 0:e.textureData)&&(this.textureData=null==e?void 0:e.textureData),this._rotation=null!==(i=null==e?void 0:e.rotation)&&void 0!==i?i:0,this._intensity=null!==(s=null==e?void 0:e.intensity)&&void 0!==s?s:1,void 0!==(null==e?void 0:e.maxNoOfLightSources)&&(this._maxNoOfLightSources=e.maxNoOfLightSources),this._parameters=e,this._environment=t}clone(){return new Ht(this._environment,this._parameters)}createNewEnvironment(t){const e=this._createPmremTexture(t),i=this._detectLightSources(t,e);return this._lightSources=i.lightSources,null!=e?e:null}_getTextureOffset(){const t=this._rotation/(2*Math.PI)%1;return new D(t,0)}_createPmremTexture(t){const e=new Bt(t);let i;if(this.equirectangularTexture)this.equirectangularTexture.offset.copy(this._getTextureOffset()),i=e.fromEquirectangularTexture(this.equirectangularTexture,{rotation:this._rotation,intensity:this._intensity});else if(this.cubeTexture)i=e.fromCubemap(this.cubeTexture);else if(this.environmentSceneGenerator){const t=this.environmentSceneGenerator.generateScene(this._intensity,this._rotation);i=e.fromScene(t,.04)}return this._debugScene=void 0,this.needsUpdate=!1,null==i?void 0:i.texture}_detectLightSources(t,e){const i=new y;return this.equirectangularTexture&&0===this.rotation?i.detectLightSources(t,this.equirectangularTexture,this.textureData):e&&i.detectLightSources(t,e),i}createDebugScene(t,e,i){const s=null!=i?i:-1;if(this._debugScene&&s===this._debugScene.userData.maximumNumberOfLightSources)return this._debugScene;this._debugScene=new lt;const n=new f(!0,!1);n.setSourceTexture(e.environment),Ot.createPlane(this._debugScene,n);const a=this._detectLightSources(t,e.environment);return new Ot(a).createDebugScene(this._debugScene,s),this._debugScene.userData.maximumNumberOfLightSources=s,this._debugScene}}class qt extends Gt{constructor(t={}){super(),this._parameters={},this._parameters=t}generateScene(t,e){const i=new Nt({...this._parameters,lightIntensity:t*(this._parameters.lightIntensity||1),topLightIntensity:t*(this._parameters.topLightIntensity||1),sidLightIntensity:t*(this._parameters.sidLightIntensity||1)});return i.rotation.y=e,i}}class Nt extends lt{constructor(t={}){var e;super(),this._type=null!==(e=null==t?void 0:t.type)&&void 0!==e?e:"all_around",this._topLightIntensity=(null==t?void 0:t.topLightIntensity)||(null==t?void 0:t.lightIntensity)||1,this._sideLightIntensity=(null==t?void 0:t.sidLightIntensity)||(null==t?void 0:t.lightIntensity)||1,this._sideReflectorIntensity=(null==t?void 0:t.sidLightIntensity)||(null==t?void 0:t.lightIntensity)||1,this._ambientLightIntensity=(null==t?void 0:t.ambientLightIntensity)||.25,this._colorVariation=(null==t?void 0:t.colorVariation)||.5,this._lightGeometry=new mt,this._lightGeometry.deleteAttribute("uv"),this.generateScene(this)}generateScene(t){switch(this._type){default:case"all_around":this._createAllAroundSceneLight(t);break;case"front":this._createFrontSceneLight(t)}}dispose(){const t=new Set;this.traverse(e=>{e.isMesh&&(t.add(e.geometry),t.add(e.material))});for(const e of t)e.dispose()}_createAllAroundSceneLight(t){const e=new X(16777215);e.intensity=this._ambientLightIntensity,this.add(e),this._createTopLight(t,6,1);for(let e=0;e<6;e++){const i=e*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);e%2==0?this._createReflector(t,new D(s,n),3,1,1):this._createSideLight(t,new D(s,n),(e-1)/2,15,1.1,.33,1)}}_createFrontSceneLight(t){const e=new X(16777215);e.intensity=this._ambientLightIntensity,this.add(e),this._createTopLight(t,5,.5);for(let e=0;e<6;e++){const i=e*Math.PI*2/6,s=Math.sin(i),n=Math.cos(i);if(0===e){this._createReflector(t,new D(s,n),3,.8,.4);for(let i=0;i<2;i++){const s=(e-.3+.6*i)*Math.PI*2/6,n=Math.sin(s),a=Math.cos(s);this._createSideLight(t,new D(n,a),(e-1)/2,24,1.2,1,.8)}}else this._createReflector(t,new D(s,n),5,.8,1)}}_createAreaLightMaterial(t,e,i){const s=new it;return s.color.set(t,null!=e?e:t,null!=i?i:t),s}_createTopLight(t,e,i){const s=new B(this._lightGeometry,this._createAreaLightMaterial(e*this._topLightIntensity));s.position.set(0,20,0),s.scale.set(5*i,.1,5*i),t.add(s)}_createSideLight(t,e,i,s,n,a,o){for(let r=0;r<3;r++){const h=s*this._sideLightIntensity,c=new B(this._lightGeometry,this._createAreaLightMaterial((r+i)%3==0?h:h*(1-this._colorVariation),(r+i)%3==1?h:h*(1-this._colorVariation),(r+i)%3==2?h:h*(1-this._colorVariation))),_=(1===r?-e.y:2===r?e.y:0)/Math.sqrt(2),d=0===r?0:1,l=(1===r?e.x:2===r?-e.x:0)/Math.sqrt(2);c.position.set(e.x*o*15+1.1*_*n,15*a+1.1*d*n,e.y*o*15+1.1*l*n),c.rotation.set(0,Math.atan2(e.x,e.y),0),c.scale.setScalar(n),t.add(c)}}_createReflector(t,e,i,s,n){const a=new B(this._lightGeometry,this._createAreaLightMaterial(i*this._sideReflectorIntensity));a.position.set(15*e.x,5*n,15*e.y),a.rotation.set(0,Math.atan2(e.x,e.y),0),a.scale.set(10*s,12*s*n,10*s),t.add(a)}}class jt{onBeforeRender(){}constructor(t,e,i,s){this._depthWriteMaterial=new it({colorWrite:!1}),this._maxAnisotropy=1,this._clock=new ut,this._delta=0,this._renderListener=null,this._stopRendering=!1,this._forceRender=!1,this._lastChange=Date.now(),this._running=!1,this._perspectiveOffsetCamera=null,this._orthographicOffsetCamera=null,this._onAfterRender=()=>{},this._creator_=t,this._canvasID=i,this.createCameraControl(pt(s),e),this._setupScene(e,!1),this._lifeCycleManager.addEventListener(this)}addEventListener(t){throw new Error("Method not implemented.")}removeEventListener(t){throw new Error("Method not implemented.")}_changeCameraControl(t){this._cameraControl&&this._cameraControl.cleanUp(),t instanceof Dt&&(this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener)),this._cameraControl instanceof Dt&&(this._getInputManager().addEventListener(7,this._renderListener,this),this._getInputManager().addEventListener(8,this._renderListener,this)),this._cameraControl=t,this.cameraControlChanged()}cameraControlChanged(){}_addCameraControlListener(){this._cameraControl.addEventListener(0,()=>{var t;null===(t=this._roomleRenderer)||void 0===t||t.movingCameraStarts(),this._requestRender()},this),this._cameraControl.addEventListener(1,this._requestRender,this),this._cameraControl.addEventListener(2,()=>{var t;null===(t=this._roomleRenderer)||void 0===t||t.movingCameraStops(),this._requestRender()},this),this._cameraControl.addEventListener(6,this._requestRender,this)}_renderEverything(){var t;this._roomleRenderer&&(this._forceRender=!0,null===(t=this._roomleRenderer)||void 0===t||t.forceShadowUpdates(!1)),this._requestRender()}_renderWithoutShadowsAndAO(){this._roomleRenderer&&(this._forceRender=!0),this._requestRender()}_requestRender(){if(!this._renderer||this._stopRendering)return;const t=()=>{var e,i;this._delta=this._clock.getDelta(),this._animateCamera(),this._cameraControl.getCamera().layers.mask=65535,this._renderLoopFunction&&(this._renderLoopFunction(),this._renderLoopFunction=null),this.onBeforeRender(),this._roomleRenderer?(null===(e=this._statsHelper)||void 0===e||e.updateRenderInfo(this._roomleRenderer.renderer.info),this._roomleRenderer.render(this._scene,this._cameraControl.getCamera()),this._forceRender=!1,this._shouldRenderUi()&&this._renderUi()):(null===(i=this._statsHelper)||void 0===i||i.updateRenderInfo(this._renderer.info),this._renderer.render(this._scene,this._cameraControl.getCamera())),this._onAfterRender(),window.TWEEN&&TWEEN.update(),this._lastChange+3e3<Date.now()||this._stopRendering?this._running=!1:(this._running=!0,requestAnimationFrame(t))};this._lastChange=Date.now(),this._running||this._stopRendering||(this._running=!0,requestAnimationFrame(t))}_shouldRenderUi(){return this._pluginSystem&&this._pluginSystem.needsUiScene()}_renderUi(){const t=this._scene.background?this._scene.background.clone():null;this._scene.overrideMaterial=this._depthWriteMaterial,this._scene.background=null,this._renderer.render(this._scene,this._cameraControl.getCamera()),this._scene.overrideMaterial=null;const e=this._renderer.autoClear;this._renderer.autoClear=!1,this._renderer.clearDepth(),this._renderer.render(this._uiScene,this._cameraControl.getCamera()),this._renderer.autoClear=e,this._scene.background=t}_animateCamera(){this._cameraControl&&(this._cameraControl.animateCamera(this._delta)||!this.shouldClearShadowsAndAO()||this._forceRender)&&this._lightSetting instanceof Tt&&this._cameraControl.getCamera()instanceof E&&this._lightSetting.update(this._cameraControl.getCamera(),this._cameraControl.getTargetPosition()),this._environment&&this._environment.needsCamera()&&this._cameraControl instanceof xt&&this._environment.updateCamera(this._cameraControl.getCamera())}shouldClearShadowsAndAO(){return!1}_setupScene(t,e){var i;const{x:s,y:n}=this._domHelper.getClientDimensions();this._scene=new lt,this._uiScene=new lt,(e=e||!1)||(this._scene.background=gt(this._initData.colors.DEFAULT_BACKGROUND)),this._renderer=new vt({antialias:!this._initData.e2e,alpha:!0});const a=this._initData.autoQuality?Math.min(window.devicePixelRatio,1.5):window.devicePixelRatio;this._renderer.setPixelRatio(a),this._renderer.setSize(s,n),this._renderer.outputColorSpace=yt,this._renderer.autoClear=!1,this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=ft,this._maxAnisotropy=this._renderer.capabilities.getMaxAnisotropy(),this._initData.e2e||(this._roomleRenderer=new w(this._renderer,s,n),this._roomleRenderer.setQualityMap(C),this._roomleRenderer.setAutoQuality(this._initData.autoQuality),this._roomleRenderer.setShadingType(this._initData.shading),null===(i=this._roomleRenderer)||void 0===i||i.setSize(s,n)),this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),this._hdrEnvironmentLoader.registerEnvironmentChangedCallback(t=>{this._setEnvMap(t)}),this._initData.legacyLight?this.loadEnvMap("static/legacy_env-d5810ec5057d4716.exr"):this._initData.sceneLight?this._setDefaultEnvironmentScene():this.loadEnvMap(this._initData.envMapUrl),this._requestRender(),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this._pluginSystem.init(this._scene,this._uiScene,this._cameraControl.getCamera().position),this._addCameraControlListener(),this.sceneChanged()}async loadEnvMap(t){await this._hdrEnvironmentLoader.loadUrl(this._renderer,t)}_setDefaultEnvironmentScene(){const t=this._initData.sceneLight;this._scene.userData.environmentDefinition=new Ht(new qt({type:t}),{rotation:this._initData.envMapRotation,intensity:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!0,this._requestRender()}_setEnvMap(t){const{url:e,environmentMap:i}=t;this._scene.environment=i,this._scene.userData.environmentDefinition=new Ht(i,{rotation:this._initData.envMapRotation,intensity:this._initData.legacyLight?.9:this._initData.envMapIntensity,maxNoOfLightSources:this._initData.maxLightSources}),this._scene.userData.shadowFromEnvironment=!this._initData.legacyLight,this._environment instanceof At&&this._environment.updateEnvironmentTexture(i),e===P&&window.requestIdleCallback(this.loadEnvMap.bind(this,"static/default_1k-2aa6d42244d30fb1.exr")),this._requestRender()}_tabVisible(){this.updateCamera(!1)}_releaseKeystrokeStates(){const t=["Shift","Meta","Control","Escape"];for(const e of t){const t=new KeyboardEvent("keyup",{key:e});this._onKeyUp(t)}}updateCamera(t=!0){var e;const{x:i,y:s}=this._domHelper.getClientDimensions();null===(e=this._roomleRenderer)||void 0===e||e.setSize(i,s),this._cameraControl.updateCamera(),this._renderEverything()}_onWindowResize(){const t=this._getInputManager();t&&t.updateSize(),this.updateCamera(),this._requestRender()}_isPartOfScene(t){return"Object3D"===t.type||"Mesh"===t.type||"GLB"===t.type||"GLTF"===t.type||"Group"===t.type}cleanUp(){this._getInputManager().removeEventListener(7,this._renderListener),this._getInputManager().removeEventListener(8,this._renderListener),this._cameraControl&&this._cameraControl.cleanUp(),this._stopRendering=!0}clearScene(){let t=[];this._scene.children.forEach(e=>{this._isPartOfScene(e)&&t.push(e)}),t.forEach(t=>{x(t),this._scene.remove(t)}),this._renderer.renderLists.dispose()}enableHD(t){this._renderer.capabilities.maxTextures>8&&t&&this.loadDynamicLightSetting(t),this._requestRender()}_loadGLTF(t,e,i,s,n,a,o){return new Promise((r,h)=>{this._staticItemLoader.loadGLTF(t,e,i,s,n,a,null,o).then(t=>{this._setCamera("GLTF",t.scene),r(t.scene)},h)})}_loadGLB(t,e,i,s,n,a,o,r){return new Promise((h,c)=>{this._staticItemLoader.loadGLB(t,e,i,s,n,a,o,r).then(t=>{this._setCamera("GLB",t.scene),h(t.scene)},c)})}_setCamera(t,e){if(!e)return void console.warn("could not set camera for gltf",e);const i=new z;i.setFromObject(e),"GLB"===t?this._cameraControl instanceof xt&&this._cameraControl.updateToBounds(i,!1):"GLTF"===t&&(this._cameraControl instanceof xt&&this._cameraControl.updateAndReset(i.getSize(new M),i.getCenter(new M),-15,70,5,!1),this._cameraControl instanceof Lt&&this._cameraControl.zoomToFitBounds(i,!0)),this.updateCamera()}showGUI(){if(this._initData.disableDebugGUI)return;const t=document.createElement("style");t.innerText=".dg.main{position:absolute;z-index:999;top:0;left:0;}",document.head.appendChild(t);let e=u(!1);e&&(this._domHelper.element.appendChild(e.domElement),this._guiLoaded())}_guiLoaded(){let t=u();if(!t)return;const e=t.addFolder("Scene Parameter"),i={intensity:this._initData.envMapIntensity,rotation:this._initData.envMapRotation};e.add(i,"intensity",0,4,.01).name("env map intensity").onChange(t=>{this.changeEnvironmentMapIntensity(t),this._requestRender()}),e.add(i,"rotation",0,2*Math.PI,.01).name("env map rotation").onChange(t=>{this._scene.userData.environmentDefinition.rotation=t,this._requestRender()}),this._lightSetting&&this._lightSetting.showGUI(),this._roomleRenderer&&this._roomleRenderer.showGUI(()=>this._requestRender()),this._environment&&this._environment.showGUI(()=>this._requestRender()),this._addGUIListener(t)}_addGUIListener(t){let e=t.__folders;Object.keys(e).forEach(t=>{let i=e[t];i.__folders&&Object.keys(i.__folders).forEach(t=>{let e=i.__folders[t];this._addGUIListener(e)}),i.__controllers&&i.__controllers.forEach(t=>{t.onFinishChange(()=>{this._guiParamChanged()})})})}_guiParamChanged(){this._renderEverything()}showStats(){e.import("./stats-helper-e683766c.nomodule.js").then(t=>this._statsHelper=new t.default)}_onKeyDown(t){}_onKeyUp(t){}pause(){this._getInputManager().removeEvents(this._renderer.domElement),window.removeEventListener("resize",this,!1),window.removeEventListener("keydown",this,!1),window.removeEventListener("keyup",this,!1),document.removeEventListener("visibilitychange",this)}resume(){this._renderer.domElement.classList.add(this._canvasID),this._domHelper.element.appendChild(this._renderer.domElement),this._getInputManager().addEvents(this._renderer.domElement),window.addEventListener("resize",this,!1),window.addEventListener("keydown",this,!1),window.addEventListener("keyup",this,!1),document.addEventListener("visibilitychange",this),this.updateCamera()}destroy(){this.pause(),this.cleanUp()}handleEvent(t){switch(t.type){case"resize":this._onWindowResize();break;case"keydown":if(t.target&&(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement))break;this._onKeyDown(t);break;case"keyup":if(t.target&&(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement))break;this._onKeyUp(t);break;case"visibilitychange":this._tabVisible(),this._releaseKeystrokeStates()}}async loadSceneSettings(t){let e,i;return e=t.environment?new Promise(e=>{(new kt).load(this._scene,this._renderer.domElement,this._environment,t,this._maxAnisotropy).then(t=>{this._setEnvironment(t),e()})}):Promise.resolve(),t.lights?(this._lightSetting=new Tt(this._scene,this._lightSetting),i=this._lightSetting.loadFromObject(t)):i=Promise.resolve(),new Promise((t,s)=>{Promise.all([e,i]).then(()=>{this._renderEverything(),t()},s)})}setBackgroundColor(t){this._setEnvironment(new It(this._scene,this._environment,new N(t)))}setBackgroundImage(t){this._setEnvironment(new It(this._scene,this._environment,null,this._renderer.domElement,t))}_setEnvironment(t){this._environment=t,this._renderEverything()}async loadDynamicLightSetting(t){this._lightSetting=new Tt(this._scene,this._lightSetting);let e=!1;if(t.url)await this._lightSetting.loadFromURL(t.url),e=!0;else if(t.json)await this._lightSetting.loadFromJSON(t.json),e=!0;else if(t.object)await this._lightSetting.loadFromObject(t.object),e=!0;else if(t.ls){const i=b.createDynamicLightSettingSource(null,t.ls);await this._lightSetting.loadFromURL(i.url),e=!0}if(!e)throw new Error("No dynamic light setting source set");this._requestRender()}getScene(){return this._scene}updateScene(){var t;this._updateBounds(this.getBounds()),null===(t=this._roomleRenderer)||void 0===t||t.forceShadowUpdates(!0),this._renderEverything()}_updateBounds(t,e=!1){var i;t&&(this.updateEnvironment(t,e),this._lightSetting&&this._lightSetting.needsBounds()&&this._lightSetting.updateBounds(t),null===(i=this._roomleRenderer)||void 0===i||i.updateBounds(t),this._requestRender(),this._pluginSystem.updateBounds(t))}setCameraOffset(t){const e=this._cameraControl.getCamera(),i=e||e;(null==i?void 0:i.offset)?(i.offset=t,this._renderEverything()):console.warn("Cannot set offset, current camera does not support it")}getCameraOffset(){const t=this._cameraControl.getCamera(),e=t||t;return(null==e?void 0:e.offset)?JSON.parse(JSON.stringify(e.offset)):{left:0,top:0,right:1,bottom:1}}getOrthographicOffsetCamera(){if(!this._orthographicOffsetCamera){const t=this.getCameraOffset(),e=this._domHelper.getClientDimensions(),i=5;let s=e.x/e.y*i,n=i;const a=S();this._orthographicOffsetCamera=a.createOrthographicCamera(s/-2,s/2,n/2,n/-2,1,1e3,t),this._orthographicOffsetCamera.position.set(0,10,0),this._orthographicOffsetCamera.lookAt(new M(0,0,0))}return this._orthographicOffsetCamera}getPerspectiveOffsetCamera(){if(!this._perspectiveOffsetCamera){const t=this.getCameraOffset(),e=this._domHelper.getClientDimensions(),i=e.x,s=e.y,n=S();this._perspectiveOffsetCamera=n.createPerspectiveCamera(30,i/s,.1,20,t)}return this._perspectiveOffsetCamera}updateEnvironment(t,e=!1){var i;if(t&&this._environment&&this._environment.needsBounds()){const i=t.getSize(new M);(i.x+i.y+i.z!==0||e)&&this._environment.updateBounds(t.getSize(new M),e)}null===(i=this._roomleRenderer)||void 0===i||i.updateEnvironment(t,e)}_onCameraIdle(){return!0}_onCameraMove(){return!0}exportImageFromCamera(t){this._onAfterRender=()=>{const e=this._renderer.domElement.toDataURL("image/jpeg",1),{left:i,right:s,top:n,bottom:a}=this.getCameraOffset(),o=s-i,r=n-a;if(1===o&&1===r)return wt(t,e),void(this._onAfterRender=()=>{});const h=new Image;h.src=e,h.onload=()=>{const{naturalWidth:e,naturalHeight:s}=h,a=document.createElement("canvas");a.width=e*o,a.height=s*r;const c=a.getContext("2d"),_=e*i*-1,d=s*(1-n)*-1;c.drawImage(h,_,d),c.save(),wt(t,a.toDataURL("image/jpeg",1)),this._onAfterRender=()=>{}}},this._requestRender()}changeEnvironmentMapIntensity(t){this._scene.userData.environmentDefinition.intensity=t}lockCamera(){this._cameraControl.lock()}unlockCamera(){this._cameraControl.unlock()}setEnvironmentMap(t,e,i,s){void 0!==t&&this._hdrEnvironmentLoader.loadUrl(this._renderer,t),void 0!==e&&(this._scene.userData.environmentDefinition.intensity=e),void 0!==i&&(this._scene.userData.environmentDefinition.rotation=i),void 0!==s&&(this._scene.userData.environmentDefinition.maxNoOfLightSources=s,this._roomleRenderer.forceShadowUpdates(!1)),this._requestRender()}}t("S",jt),i([s],jt.prototype,"_domHelper",void 0),i([s],jt.prototype,"_scriptLoader",void 0),i([s],jt.prototype,"_lifeCycleManager",void 0),i([s],jt.prototype,"_staticItemLoader",void 0),i([s],jt.prototype,"_hdrEnvironmentLoader",void 0),i([s],jt.prototype,"_initData",void 0),i([s],jt.prototype,"_pluginSystem",void 0),i([s],jt.prototype,"_imageRenderer",void 0)}}}));
2
+ //# sourceMappingURL=scene-manager-867ed8ea.nomodule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scene-manager-9b770743.nomodule.js","sources":["../../packages/three-build/src/Tween.js","../../node_modules/three/examples/jsm/objects/GroundProjectedSkybox.js","../../packages/common-core/public/textures/env/legacy_env.exr","../../packages/common-core/public/textures/env/default_1k.exr"],"sourcesContent":["export default \"static/Tween-d57ee5d181fce582.js\"","import { Mesh, IcosahedronGeometry, ShaderMaterial, DoubleSide } from 'three';\n\n/**\n * Ground projected env map adapted from @react-three/drei.\n * https://github.com/pmndrs/drei/blob/master/src/core/Environment.tsx\n */\nclass GroundProjectedSkybox extends Mesh {\n\n\tconstructor( texture, options = {} ) {\n\n\t\tconst isCubeMap = texture.isCubeTexture;\n\n\t\tconst defines = [\n\t\t\tisCubeMap ? '#define ENVMAP_TYPE_CUBE' : ''\n\t\t];\n\n\t\tconst vertexShader = /* glsl */ `\n\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );\n\t\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t}\n\t\t\t`;\n\t\tconst fragmentShader = defines.join( '\\n' ) + /* glsl */ `\n\n\t\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\t\tuniform float radius;\n\t\t\t\tuniform float height;\n\t\t\t\tuniform float angle;\n\n\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\tuniform samplerCube map;\n\n\t\t\t\t#else\n\n\t\t\t\t\tuniform sampler2D map;\n\n\t\t\t\t#endif\n\n\t\t\t\t// From: https://www.shadertoy.com/view/4tsBD7\n\t\t\t\tfloat diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) \n\t\t\t\t{\n\n\t\t\t\t\tfloat d = dot ( rd, n );\n\n\t\t\t\t\tif( d > 0.0 ) { return 1e6; }\n\n\t\t\t\t\tvec3 o = ro - c;\n\t\t\t\t\tfloat t = - dot( n, o ) / d;\n\t\t\t\t\tvec3 q = o + rd * t;\n\n\t\t\t\t\treturn ( dot( q, q ) < r * r ) ? t : 1e6;\n\n\t\t\t\t}\n\n\t\t\t\t// From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm\n\t\t\t\tfloat sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) {\n\n\t\t\t\t\tvec3 oc = ro - ce;\n\t\t\t\t\tfloat b = dot( oc, rd );\n\t\t\t\t\tfloat c = dot( oc, oc ) - ra * ra;\n\t\t\t\t\tfloat h = b * b - c;\n\n\t\t\t\t\tif( h < 0.0 ) { return -1.0; }\n\n\t\t\t\t\th = sqrt( h );\n\n\t\t\t\t\treturn - b + h;\n\n\t\t\t\t}\n\n\t\t\t\tvec3 project() {\n\n\t\t\t\t\tvec3 p = normalize( vWorldPosition );\n\t\t\t\t\tvec3 camPos = cameraPosition;\n\t\t\t\t\tcamPos.y -= height;\n\n\t\t\t\t\tfloat intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );\n\t\t\t\t\tif( intersection > 0.0 ) {\n\n\t\t\t\t\t\tvec3 h = vec3( 0.0, - height, 0.0 );\n\t\t\t\t\t\tfloat intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );\n\t\t\t\t\t\tp = ( camPos + min( intersection, intersection2 ) * p ) / radius;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tp = vec3( 0.0, 1.0, 0.0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn p;\n\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 projectedWorldPosition = project();\n\n\t\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\t\tvec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tvec3 direction = normalize( projectedWorldPosition );\n\t\t\t\t\t\tvec2 uv = equirectUv( direction );\n\t\t\t\t\t\tvec3 outcolor = texture2D( map, uv ).rgb;\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\tgl_FragColor = vec4( outcolor, 1.0 );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <colorspace_fragment>\n\n\t\t\t\t}\n\t\t\t\t`;\n\n\t\tconst uniforms = {\n\t\t\tmap: { value: texture },\n\t\t\theight: { value: options.height || 15 },\n\t\t\tradius: { value: options.radius || 100 },\n\t\t};\n\n\t\tconst geometry = new IcosahedronGeometry( 1, 16 );\n\t\tconst material = new ShaderMaterial( {\n\t\t\tuniforms,\n\t\t\tfragmentShader,\n\t\t\tvertexShader,\n\t\t\tside: DoubleSide,\n\t\t} );\n\n\t\tsuper( geometry, material );\n\n\t}\n\n\tset radius( radius ) {\n\n\t\tthis.material.uniforms.radius.value = radius;\n\n\t}\n\n\tget radius() {\n\n\t\treturn this.material.uniforms.radius.value;\n\n\t}\n\n\tset height( height ) {\n\n\t\tthis.material.uniforms.height.value = height;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.material.uniforms.height.value;\n\n\t}\n\n}\n\nexport { GroundProjectedSkybox };\n","export default \"static/legacy_env-d5810ec5057d4716.exr\"","export default \"static/default_1k-2aa6d42244d30fb1.exr\""],"names":["exports","GroundProjectedSkybox","Mesh","[object Object]","texture","options","fragmentShader","isCubeTexture","join","uniforms","map","value","height","radius","super","IcosahedronGeometry","ShaderMaterial","vertexShader","side","DoubleSide","this","material"],"mappings":"81BAAeA,EAAA,IAAA,q/hCCMf,MAAMC,WAA8BC,EAEnCC,YAAaC,EAASC,EAAU,IAE/B,MAkBMC,EAhBU,CAFEF,EAAQG,cAGb,2BAA6B,IAeXC,KAAM,MAAoB,6yEAmGnDC,EAAW,CAChBC,IAAK,CAAEC,MAAOP,GACdQ,OAAQ,CAAED,MAAON,EAAQO,QAAU,IACnCC,OAAQ,CAAEF,MAAON,EAAQQ,QAAU,MAWpCC,MARiB,IAAIC,GAAqB,EAAG,IAC5B,IAAIC,GAAgB,CACpCP,SAAAA,EACAH,eAAAA,EACAW,aAzH+B,4RA0H/BC,KAAMC,KAORN,WAAYA,GAEXO,KAAKC,SAASZ,SAASI,OAAOF,MAAQE,EAIvCA,aAEC,OAAOO,KAAKC,SAASZ,SAASI,OAAOF,MAItCC,WAAYA,GAEXQ,KAAKC,SAASZ,SAASG,OAAOD,MAAQC,EAIvCA,aAEC,OAAOQ,KAAKC,SAASZ,SAASG,OAAOD,qqeCrKxB,u3CCAA"}
1
+ {"version":3,"file":"scene-manager-867ed8ea.nomodule.js","sources":["../../packages/three-build/src/Tween.js","../../node_modules/three/examples/jsm/objects/GroundProjectedSkybox.js","../../packages/common-core/public/textures/env/legacy_env.exr","../../packages/common-core/public/textures/env/default_1k.exr"],"sourcesContent":["export default \"static/Tween-d57ee5d181fce582.js\"","import { Mesh, IcosahedronGeometry, ShaderMaterial, DoubleSide } from 'three';\n\n/**\n * Ground projected env map adapted from @react-three/drei.\n * https://github.com/pmndrs/drei/blob/master/src/core/Environment.tsx\n */\nclass GroundProjectedSkybox extends Mesh {\n\n\tconstructor( texture, options = {} ) {\n\n\t\tconst isCubeMap = texture.isCubeTexture;\n\n\t\tconst defines = [\n\t\t\tisCubeMap ? '#define ENVMAP_TYPE_CUBE' : ''\n\t\t];\n\n\t\tconst vertexShader = /* glsl */ `\n\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );\n\t\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t}\n\t\t\t`;\n\t\tconst fragmentShader = defines.join( '\\n' ) + /* glsl */ `\n\n\t\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\t\tuniform float radius;\n\t\t\t\tuniform float height;\n\t\t\t\tuniform float angle;\n\n\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\tuniform samplerCube map;\n\n\t\t\t\t#else\n\n\t\t\t\t\tuniform sampler2D map;\n\n\t\t\t\t#endif\n\n\t\t\t\t// From: https://www.shadertoy.com/view/4tsBD7\n\t\t\t\tfloat diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) \n\t\t\t\t{\n\n\t\t\t\t\tfloat d = dot ( rd, n );\n\n\t\t\t\t\tif( d > 0.0 ) { return 1e6; }\n\n\t\t\t\t\tvec3 o = ro - c;\n\t\t\t\t\tfloat t = - dot( n, o ) / d;\n\t\t\t\t\tvec3 q = o + rd * t;\n\n\t\t\t\t\treturn ( dot( q, q ) < r * r ) ? t : 1e6;\n\n\t\t\t\t}\n\n\t\t\t\t// From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm\n\t\t\t\tfloat sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) {\n\n\t\t\t\t\tvec3 oc = ro - ce;\n\t\t\t\t\tfloat b = dot( oc, rd );\n\t\t\t\t\tfloat c = dot( oc, oc ) - ra * ra;\n\t\t\t\t\tfloat h = b * b - c;\n\n\t\t\t\t\tif( h < 0.0 ) { return -1.0; }\n\n\t\t\t\t\th = sqrt( h );\n\n\t\t\t\t\treturn - b + h;\n\n\t\t\t\t}\n\n\t\t\t\tvec3 project() {\n\n\t\t\t\t\tvec3 p = normalize( vWorldPosition );\n\t\t\t\t\tvec3 camPos = cameraPosition;\n\t\t\t\t\tcamPos.y -= height;\n\n\t\t\t\t\tfloat intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );\n\t\t\t\t\tif( intersection > 0.0 ) {\n\n\t\t\t\t\t\tvec3 h = vec3( 0.0, - height, 0.0 );\n\t\t\t\t\t\tfloat intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );\n\t\t\t\t\t\tp = ( camPos + min( intersection, intersection2 ) * p ) / radius;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tp = vec3( 0.0, 1.0, 0.0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn p;\n\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 projectedWorldPosition = project();\n\n\t\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\t\tvec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tvec3 direction = normalize( projectedWorldPosition );\n\t\t\t\t\t\tvec2 uv = equirectUv( direction );\n\t\t\t\t\t\tvec3 outcolor = texture2D( map, uv ).rgb;\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\tgl_FragColor = vec4( outcolor, 1.0 );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <colorspace_fragment>\n\n\t\t\t\t}\n\t\t\t\t`;\n\n\t\tconst uniforms = {\n\t\t\tmap: { value: texture },\n\t\t\theight: { value: options.height || 15 },\n\t\t\tradius: { value: options.radius || 100 },\n\t\t};\n\n\t\tconst geometry = new IcosahedronGeometry( 1, 16 );\n\t\tconst material = new ShaderMaterial( {\n\t\t\tuniforms,\n\t\t\tfragmentShader,\n\t\t\tvertexShader,\n\t\t\tside: DoubleSide,\n\t\t} );\n\n\t\tsuper( geometry, material );\n\n\t}\n\n\tset radius( radius ) {\n\n\t\tthis.material.uniforms.radius.value = radius;\n\n\t}\n\n\tget radius() {\n\n\t\treturn this.material.uniforms.radius.value;\n\n\t}\n\n\tset height( height ) {\n\n\t\tthis.material.uniforms.height.value = height;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.material.uniforms.height.value;\n\n\t}\n\n}\n\nexport { GroundProjectedSkybox };\n","export default \"static/legacy_env-d5810ec5057d4716.exr\"","export default \"static/default_1k-2aa6d42244d30fb1.exr\""],"names":["exports","GroundProjectedSkybox","Mesh","[object Object]","texture","options","fragmentShader","isCubeTexture","join","uniforms","map","value","height","radius","super","IcosahedronGeometry","ShaderMaterial","vertexShader","side","DoubleSide","this","material"],"mappings":"q1BAAeA,EAAA,IAAA,mxiCCMf,MAAMC,WAA8BC,EAEnCC,YAAaC,EAASC,EAAU,IAE/B,MAkBMC,EAhBU,CAFEF,EAAQG,cAGb,2BAA6B,IAeXC,KAAM,MAAoB,6yEAmGnDC,EAAW,CAChBC,IAAK,CAAEC,MAAOP,GACdQ,OAAQ,CAAED,MAAON,EAAQO,QAAU,IACnCC,OAAQ,CAAEF,MAAON,EAAQQ,QAAU,MAWpCC,MARiB,IAAIC,EAAqB,EAAG,IAC5B,IAAIC,GAAgB,CACpCP,SAAAA,EACAH,eAAAA,EACAW,aAzH+B,4RA0H/BC,KAAMC,KAORN,WAAYA,GAEXO,KAAKC,SAASZ,SAASI,OAAOF,MAAQE,EAIvCA,aAEC,OAAOO,KAAKC,SAASZ,SAASI,OAAOF,MAItCC,WAAYA,GAEXQ,KAAKC,SAASZ,SAASG,OAAOD,MAAQC,EAIvCA,aAEC,OAAOQ,KAAKC,SAASZ,SAASG,OAAOD,0peCrKxB,u3CCAA"}
@@ -1,2 +1,2 @@
1
- System.register(["./query-params-helper-c231e1b8.nomodule.js","./roomle-dependency-injection-5b1f09d5.nomodule.js","./main-thread-to-worker-a8fb30c0.nomodule.js"],(function(e){var t,o,n,i,_,s,r;return{setters:[function(e){t=e.g},function(e){o=e.b,n=e.B,i=e.I,_=e._,s=e.i},function(e){r=e.g}],execute:function(){e("M",class{constructor(e){this._context=e||o.getContext(this.getContextName()),n.start("loadingTime")}_setupCommonGlobals(){window.__RML__DEBUG__||(window.__RML__DEBUG__={}),window.__RML__ENV__||(window.__RML__ENV__={},window.__RML__ENV__.assetPath||(window.__RML__ENV__.assetPath=""))}_setupCommonDependencies(){o.setup(i);const e=t();this.lookup("global-init-data").setOverrides(e),this.lookup("init-data",this._context).setOverrides(e)}_cleanUpCommonGlobals(){window.__RML__DEBUG__&&(window.__RML__DEBUG__.Kernel&&window.__RML__DEBUG__.Kernel.clearAll&&window.__RML__DEBUG__.Kernel.clearAll(),delete window.__RML__DEBUG__),delete window.__RML__ENV__;for(const e in window.THREE)if(window.hasOwnProperty(e))try{delete window.THREE[e]}catch(e){console.error(e)}window.THREE=void 0}_cleanUpCommonDependencies(){}boot(e){this._setupCommonGlobals(),this._setupCommonDependencies(),this.setupGlobals(e),this.setupDependencies(),this.bootFinished()}lookup(e,t){return window.__RML__DI__.lookup(e,t)}teardown(){this.cleanUpDependencies(),this._cleanUpCommonDependencies(),this.cleanUpGlobals(),this._cleanUpCommonGlobals(),window.__RML__DI__&&delete window.__RML__DI__}pause(){this.lookup("life-cycle-manager",this._context).pause(),window.TWEEN&&TWEEN.removeAll()}resume(e){e&&this.lookup("dom-helper",this._context).setDomElement(e),this.lookup("life-cycle-manager",this._context).resume()}destroy(){this.pause(),this.lookup("life-cycle-manager",this._context).destroy(),o.cleanUp(this._context)}getRapiAccess(){return this.lookup("rapi-access",this._context)}});let l={},c={};class a{constructor(e){this._creator_=e}fetch(e,t){return this._singlePromiseFactory.create(5,e,(o,i)=>{!function(e,t,o,i){if(-1===e.indexOf("http")&&(e=r()+e),l[e])return o();if(t.id&&c[t.id])return i(new Error('There is already a script with ID "'+t.id+'"'));n.start("load_"+t.id.replace(/-/g,"_"));const _=document.createElement("script");_.async=!1,_.src=e,_.id=t.id,_.onload=()=>{l[e]=!0,c[t.id]=!0,Object.defineProperty(o,"name",{value:"resolve-"+t.id}),o()},_.onerror=e=>{i(e)},document.body.appendChild(_)}(e,t,o,i)})}loadScripts(e){const t=[];return e.forEach(e=>{let o=this.fetch(e.name,{id:e.id});t.push(o)}),Promise.all(t)}cleanUp(){for(let e in c)if(c.hasOwnProperty(e)){const t=document.getElementById(e);t&&t.parentElement.removeChild(t)}l={},c={}}}e("S",a),_([s],a.prototype,"_singlePromiseFactory",void 0)}}}));
2
- //# sourceMappingURL=script-loader-c2a01bb0.nomodule.js.map
1
+ System.register(["./query-params-helper-519cb51c.nomodule.js","./roomle-dependency-injection-348f3aac.nomodule.js","./main-thread-to-worker-38d48e06.nomodule.js"],(function(e){var t,o,n,i,_,s,r;return{setters:[function(e){t=e.g},function(e){o=e.b,n=e.B,i=e.I,_=e._,s=e.i},function(e){r=e.g}],execute:function(){e("M",class{constructor(e){this._context=e||o.getContext(this.getContextName()),n.start("loadingTime")}_setupCommonGlobals(){window.__RML__DEBUG__||(window.__RML__DEBUG__={}),window.__RML__ENV__||(window.__RML__ENV__={},window.__RML__ENV__.assetPath||(window.__RML__ENV__.assetPath=""))}_setupCommonDependencies(){o.setup(i);const e=t();this.lookup("global-init-data").setOverrides(e),this.lookup("init-data",this._context).setOverrides(e)}_cleanUpCommonGlobals(){window.__RML__DEBUG__&&(window.__RML__DEBUG__.Kernel&&window.__RML__DEBUG__.Kernel.clearAll&&window.__RML__DEBUG__.Kernel.clearAll(),delete window.__RML__DEBUG__),delete window.__RML__ENV__;for(const e in window.THREE)if(window.hasOwnProperty(e))try{delete window.THREE[e]}catch(e){console.error(e)}window.THREE=void 0}_cleanUpCommonDependencies(){}boot(e){this._setupCommonGlobals(),this._setupCommonDependencies(),this.setupGlobals(e),this.setupDependencies(),this.bootFinished()}lookup(e,t){return window.__RML__DI__.lookup(e,t)}teardown(){this.cleanUpDependencies(),this._cleanUpCommonDependencies(),this.cleanUpGlobals(),this._cleanUpCommonGlobals(),window.__RML__DI__&&delete window.__RML__DI__}pause(){this.lookup("life-cycle-manager",this._context).pause(),window.TWEEN&&TWEEN.removeAll()}resume(e){e&&this.lookup("dom-helper",this._context).setDomElement(e),this.lookup("life-cycle-manager",this._context).resume()}destroy(){this.pause(),this.lookup("life-cycle-manager",this._context).destroy(),o.cleanUp(this._context)}getRapiAccess(){return this.lookup("rapi-access",this._context)}});let l={},c={};class a{constructor(e){this._creator_=e}fetch(e,t){return this._singlePromiseFactory.create(5,e,(o,i)=>{!function(e,t,o,i){if(-1===e.indexOf("http")&&(e=r()+e),l[e])return o();if(t.id&&c[t.id])return i(new Error('There is already a script with ID "'+t.id+'"'));n.start("load_"+t.id.replace(/-/g,"_"));const _=document.createElement("script");_.async=!1,_.src=e,_.id=t.id,_.onload=()=>{l[e]=!0,c[t.id]=!0,Object.defineProperty(o,"name",{value:"resolve-"+t.id}),o()},_.onerror=e=>{i(e)},document.body.appendChild(_)}(e,t,o,i)})}loadScripts(e){const t=[];return e.forEach(e=>{let o=this.fetch(e.name,{id:e.id});t.push(o)}),Promise.all(t)}cleanUp(){for(let e in c)if(c.hasOwnProperty(e)){const t=document.getElementById(e);t&&t.parentElement.removeChild(t)}l={},c={}}}e("S",a),_([s],a.prototype,"_singlePromiseFactory",void 0)}}}));
2
+ //# sourceMappingURL=script-loader-c03cdfaf.nomodule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script-loader-c03cdfaf.nomodule.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{g as getAllParameters}from"./query-params-helper-a271f9dc.js";import{b as RoomleDependencyInjection,B as Benchmark,I as INJECTABLES,_ as __decorate,i as inject}from"./roomle-dependency-injection-986d0a8f.js";import{g as getAssetPath}from"./main-thread-to-worker-9f925ba4.js";class Main{constructor(e){this._context=e||RoomleDependencyInjection.getContext(this.getContextName()),Benchmark.start("loadingTime")}_setupCommonGlobals(){window.__RML__DEBUG__||(window.__RML__DEBUG__={}),window.__RML__ENV__||(window.__RML__ENV__={},window.__RML__ENV__.assetPath||(window.__RML__ENV__.assetPath=""))}_setupCommonDependencies(){RoomleDependencyInjection.setup(INJECTABLES);const e=getAllParameters();this.lookup("global-init-data").setOverrides(e),this.lookup("init-data",this._context).setOverrides(e)}_cleanUpCommonGlobals(){window.__RML__DEBUG__&&(window.__RML__DEBUG__.Kernel&&window.__RML__DEBUG__.Kernel.clearAll&&window.__RML__DEBUG__.Kernel.clearAll(),delete window.__RML__DEBUG__),delete window.__RML__ENV__;for(const e in window.THREE)if(window.hasOwnProperty(e))try{delete window.THREE[e]}catch(e){console.error(e)}window.THREE=void 0}_cleanUpCommonDependencies(){}boot(e){this._setupCommonGlobals(),this._setupCommonDependencies(),this.setupGlobals(e),this.setupDependencies(),this.bootFinished()}lookup(e,t){return window.__RML__DI__.lookup(e,t)}teardown(){this.cleanUpDependencies(),this._cleanUpCommonDependencies(),this.cleanUpGlobals(),this._cleanUpCommonGlobals(),window.__RML__DI__&&delete window.__RML__DI__}pause(){this.lookup("life-cycle-manager",this._context).pause(),window.TWEEN&&TWEEN.removeAll()}resume(e){e&&this.lookup("dom-helper",this._context).setDomElement(e),this.lookup("life-cycle-manager",this._context).resume()}destroy(){this.pause(),this.lookup("life-cycle-manager",this._context).destroy(),RoomleDependencyInjection.cleanUp(this._context)}getRapiAccess(){return this.lookup("rapi-access",this._context)}}let _scriptCache={},_idCache={};class ScriptLoader{constructor(e){this._creator_=e}fetch(e,t){return this._singlePromiseFactory.create(5,e,(o,n)=>{!function(e,t,o,n){if(-1===e.indexOf("http")&&(e=getAssetPath()+e),_scriptCache[e])return o();if(t.id&&_idCache[t.id])return n(new Error('There is already a script with ID "'+t.id+'"'));Benchmark.start("load_"+t.id.replace(/-/g,"_"));const i=document.createElement("script");i.async=!1,i.src=e,i.id=t.id,i.onload=()=>{_scriptCache[e]=!0,_idCache[t.id]=!0,Object.defineProperty(o,"name",{value:"resolve-"+t.id}),o()},i.onerror=e=>{n(e)},document.body.appendChild(i)}(e,t,o,n)})}loadScripts(e){const t=[];return e.forEach(e=>{let o=this.fetch(e.name,{id:e.id});t.push(o)}),Promise.all(t)}cleanUp(){for(let e in _idCache)if(_idCache.hasOwnProperty(e)){const t=document.getElementById(e);t&&t.parentElement.removeChild(t)}_scriptCache={},_idCache={}}}__decorate([inject],ScriptLoader.prototype,"_singlePromiseFactory",void 0);export{Main as M,ScriptLoader as S};
2
- //# sourceMappingURL=script-loader-917e8941.js.map
1
+ import{g as getAllParameters}from"./query-params-helper-b54bbbb4.js";import{b as RoomleDependencyInjection,B as Benchmark,I as INJECTABLES,_ as __decorate,i as inject}from"./roomle-dependency-injection-6cc5f1dd.js";import{g as getAssetPath}from"./main-thread-to-worker-307e6096.js";class Main{constructor(e){this._context=e||RoomleDependencyInjection.getContext(this.getContextName()),Benchmark.start("loadingTime")}_setupCommonGlobals(){window.__RML__DEBUG__||(window.__RML__DEBUG__={}),window.__RML__ENV__||(window.__RML__ENV__={},window.__RML__ENV__.assetPath||(window.__RML__ENV__.assetPath=""))}_setupCommonDependencies(){RoomleDependencyInjection.setup(INJECTABLES);const e=getAllParameters();this.lookup("global-init-data").setOverrides(e),this.lookup("init-data",this._context).setOverrides(e)}_cleanUpCommonGlobals(){window.__RML__DEBUG__&&(window.__RML__DEBUG__.Kernel&&window.__RML__DEBUG__.Kernel.clearAll&&window.__RML__DEBUG__.Kernel.clearAll(),delete window.__RML__DEBUG__),delete window.__RML__ENV__;for(const e in window.THREE)if(window.hasOwnProperty(e))try{delete window.THREE[e]}catch(e){console.error(e)}window.THREE=void 0}_cleanUpCommonDependencies(){}boot(e){this._setupCommonGlobals(),this._setupCommonDependencies(),this.setupGlobals(e),this.setupDependencies(),this.bootFinished()}lookup(e,t){return window.__RML__DI__.lookup(e,t)}teardown(){this.cleanUpDependencies(),this._cleanUpCommonDependencies(),this.cleanUpGlobals(),this._cleanUpCommonGlobals(),window.__RML__DI__&&delete window.__RML__DI__}pause(){this.lookup("life-cycle-manager",this._context).pause(),window.TWEEN&&TWEEN.removeAll()}resume(e){e&&this.lookup("dom-helper",this._context).setDomElement(e),this.lookup("life-cycle-manager",this._context).resume()}destroy(){this.pause(),this.lookup("life-cycle-manager",this._context).destroy(),RoomleDependencyInjection.cleanUp(this._context)}getRapiAccess(){return this.lookup("rapi-access",this._context)}}let _scriptCache={},_idCache={};class ScriptLoader{constructor(e){this._creator_=e}fetch(e,t){return this._singlePromiseFactory.create(5,e,(o,n)=>{!function(e,t,o,n){if(-1===e.indexOf("http")&&(e=getAssetPath()+e),_scriptCache[e])return o();if(t.id&&_idCache[t.id])return n(new Error('There is already a script with ID "'+t.id+'"'));Benchmark.start("load_"+t.id.replace(/-/g,"_"));const i=document.createElement("script");i.async=!1,i.src=e,i.id=t.id,i.onload=()=>{_scriptCache[e]=!0,_idCache[t.id]=!0,Object.defineProperty(o,"name",{value:"resolve-"+t.id}),o()},i.onerror=e=>{n(e)},document.body.appendChild(i)}(e,t,o,n)})}loadScripts(e){const t=[];return e.forEach(e=>{let o=this.fetch(e.name,{id:e.id});t.push(o)}),Promise.all(t)}cleanUp(){for(let e in _idCache)if(_idCache.hasOwnProperty(e)){const t=document.getElementById(e);t&&t.parentElement.removeChild(t)}_scriptCache={},_idCache={}}}__decorate([inject],ScriptLoader.prototype,"_singlePromiseFactory",void 0);export{Main as M,ScriptLoader as S};
2
+ //# sourceMappingURL=script-loader-ea706d37.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script-loader-ea706d37.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}