@aibee/owlly 1.0.25

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 (500) hide show
  1. package/README.external.md +75 -0
  2. package/README.md +28 -0
  3. package/lib/src/external/lines/line-geometry.d.ts +9 -0
  4. package/lib/src/external/lines/line-geometry.js +52 -0
  5. package/lib/src/external/lines/line-geometry.js.map +1 -0
  6. package/lib/src/external/lines/line-material.d.ts +10 -0
  7. package/lib/src/external/lines/line-material.js +377 -0
  8. package/lib/src/external/lines/line-material.js.map +1 -0
  9. package/lib/src/external/lines/line-segments-2.d.ts +7 -0
  10. package/lib/src/external/lines/line-segments-2.js +144 -0
  11. package/lib/src/external/lines/line-segments-2.js.map +1 -0
  12. package/lib/src/external/lines/line-segments-geometry.d.ts +15 -0
  13. package/lib/src/external/lines/line-segments-geometry.js +141 -0
  14. package/lib/src/external/lines/line-segments-geometry.js.map +1 -0
  15. package/lib/src/external/loaders/gltf-loader.d.ts +77 -0
  16. package/lib/src/external/loaders/gltf-loader.js +2319 -0
  17. package/lib/src/external/loaders/gltf-loader.js.map +1 -0
  18. package/lib/src/external/orbit-controls.d.ts +44 -0
  19. package/lib/src/external/orbit-controls.js +746 -0
  20. package/lib/src/external/orbit-controls.js.map +1 -0
  21. package/lib/src/external/renderers/css-2d-renderer.d.ts +16 -0
  22. package/lib/src/external/renderers/css-2d-renderer.js +122 -0
  23. package/lib/src/external/renderers/css-2d-renderer.js.map +1 -0
  24. package/lib/src/external/renderers/css-3d-renderer.d.ts +18 -0
  25. package/lib/src/external/renderers/css-3d-renderer.js +139 -0
  26. package/lib/src/external/renderers/css-3d-renderer.js.map +1 -0
  27. package/lib/src/external/transform-controls.d.ts +106 -0
  28. package/lib/src/external/transform-controls.js +1113 -0
  29. package/lib/src/external/transform-controls.js.map +1 -0
  30. package/lib/src/external/util/buffer-geometry-utils.d.ts +45 -0
  31. package/lib/src/external/util/buffer-geometry-utils.js +569 -0
  32. package/lib/src/external/util/buffer-geometry-utils.js.map +1 -0
  33. package/lib/src/owlly/controller/aerial-element-controller.d.ts +65 -0
  34. package/lib/src/owlly/controller/aerial-element-controller.js +236 -0
  35. package/lib/src/owlly/controller/aerial-element-controller.js.map +1 -0
  36. package/lib/src/owlly/controller/basic-controller.d.ts +324 -0
  37. package/lib/src/owlly/controller/basic-controller.js +1239 -0
  38. package/lib/src/owlly/controller/basic-controller.js.map +1 -0
  39. package/lib/src/owlly/controller/camera-controller.d.ts +37 -0
  40. package/lib/src/owlly/controller/camera-controller.js +138 -0
  41. package/lib/src/owlly/controller/camera-controller.js.map +1 -0
  42. package/lib/src/owlly/controller/controller.d.ts +61 -0
  43. package/lib/src/owlly/controller/controller.js +24 -0
  44. package/lib/src/owlly/controller/controller.js.map +1 -0
  45. package/lib/src/owlly/controller/index.d.ts +2 -0
  46. package/lib/src/owlly/controller/index.js +14 -0
  47. package/lib/src/owlly/controller/index.js.map +1 -0
  48. package/lib/src/owlly/controller/mouse-indicator-controller.d.ts +34 -0
  49. package/lib/src/owlly/controller/mouse-indicator-controller.js +119 -0
  50. package/lib/src/owlly/controller/mouse-indicator-controller.js.map +1 -0
  51. package/lib/src/owlly/controller/orbit-control.d.ts +147 -0
  52. package/lib/src/owlly/controller/orbit-control.js +265 -0
  53. package/lib/src/owlly/controller/orbit-control.js.map +1 -0
  54. package/lib/src/owlly/controller/panorama-adjust-controller.d.ts +45 -0
  55. package/lib/src/owlly/controller/panorama-adjust-controller.js +158 -0
  56. package/lib/src/owlly/controller/panorama-adjust-controller.js.map +1 -0
  57. package/lib/src/owlly/controller/panorama-controller.d.ts +441 -0
  58. package/lib/src/owlly/controller/panorama-controller.js +1944 -0
  59. package/lib/src/owlly/controller/panorama-controller.js.map +1 -0
  60. package/lib/src/owlly/controller/panorama-transform-controller.d.ts +66 -0
  61. package/lib/src/owlly/controller/panorama-transform-controller.js +137 -0
  62. package/lib/src/owlly/controller/panorama-transform-controller.js.map +1 -0
  63. package/lib/src/owlly/controller/plane-controller.d.ts +43 -0
  64. package/lib/src/owlly/controller/plane-controller.js +174 -0
  65. package/lib/src/owlly/controller/plane-controller.js.map +1 -0
  66. package/lib/src/owlly/controller/texture-controller.d.ts +181 -0
  67. package/lib/src/owlly/controller/texture-controller.js +876 -0
  68. package/lib/src/owlly/controller/texture-controller.js.map +1 -0
  69. package/lib/src/owlly/controller/tile-panorama-controller.d.ts +308 -0
  70. package/lib/src/owlly/controller/tile-panorama-controller.js +1354 -0
  71. package/lib/src/owlly/controller/tile-panorama-controller.js.map +1 -0
  72. package/lib/src/owlly/controller/transform-controller.d.ts +106 -0
  73. package/lib/src/owlly/controller/transform-controller.js +546 -0
  74. package/lib/src/owlly/controller/transform-controller.js.map +1 -0
  75. package/lib/src/owlly/element/bottom-nav-element.d.ts +65 -0
  76. package/lib/src/owlly/element/bottom-nav-element.js +258 -0
  77. package/lib/src/owlly/element/bottom-nav-element.js.map +1 -0
  78. package/lib/src/owlly/element/camera.d.ts +82 -0
  79. package/lib/src/owlly/element/camera.js +284 -0
  80. package/lib/src/owlly/element/camera.js.map +1 -0
  81. package/lib/src/owlly/element/dom-2d-element.d.ts +35 -0
  82. package/lib/src/owlly/element/dom-2d-element.js +49 -0
  83. package/lib/src/owlly/element/dom-2d-element.js.map +1 -0
  84. package/lib/src/owlly/element/dom-3d-element.d.ts +27 -0
  85. package/lib/src/owlly/element/dom-3d-element.js +34 -0
  86. package/lib/src/owlly/element/dom-3d-element.js.map +1 -0
  87. package/lib/src/owlly/element/dom-label-2d.d.ts +116 -0
  88. package/lib/src/owlly/element/dom-label-2d.js +383 -0
  89. package/lib/src/owlly/element/dom-label-2d.js.map +1 -0
  90. package/lib/src/owlly/element/element.d.ts +53 -0
  91. package/lib/src/owlly/element/element.js +76 -0
  92. package/lib/src/owlly/element/element.js.map +1 -0
  93. package/lib/src/owlly/element/floor-model.d.ts +83 -0
  94. package/lib/src/owlly/element/floor-model.js +228 -0
  95. package/lib/src/owlly/element/floor-model.js.map +1 -0
  96. package/lib/src/owlly/element/gif-kit/Gif.d.ts +96 -0
  97. package/lib/src/owlly/element/gif-kit/Gif.js +433 -0
  98. package/lib/src/owlly/element/gif-kit/Gif.js.map +1 -0
  99. package/lib/src/owlly/element/gif-kit/GifColor.d.ts +21 -0
  100. package/lib/src/owlly/element/gif-kit/GifColor.js +38 -0
  101. package/lib/src/owlly/element/gif-kit/GifColor.js.map +1 -0
  102. package/lib/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
  103. package/lib/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.js +51 -0
  104. package/lib/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.js.map +1 -0
  105. package/lib/src/owlly/element/gif-kit/GifFrame.d.ts +31 -0
  106. package/lib/src/owlly/element/gif-kit/GifFrame.js +97 -0
  107. package/lib/src/owlly/element/gif-kit/GifFrame.js.map +1 -0
  108. package/lib/src/owlly/element/gif-kit/GifImage.d.ts +23 -0
  109. package/lib/src/owlly/element/gif-kit/GifImage.js +8 -0
  110. package/lib/src/owlly/element/gif-kit/GifImage.js.map +1 -0
  111. package/lib/src/owlly/element/gif-kit/GifParser.d.ts +17 -0
  112. package/lib/src/owlly/element/gif-kit/GifParser.js +197 -0
  113. package/lib/src/owlly/element/gif-kit/GifParser.js.map +1 -0
  114. package/lib/src/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
  115. package/lib/src/owlly/element/gif-kit/GifPresenter.js +44 -0
  116. package/lib/src/owlly/element/gif-kit/GifPresenter.js.map +1 -0
  117. package/lib/src/owlly/element/gif-kit/GifVersion.d.ts +10 -0
  118. package/lib/src/owlly/element/gif-kit/GifVersion.js +13 -0
  119. package/lib/src/owlly/element/gif-kit/GifVersion.js.map +1 -0
  120. package/lib/src/owlly/element/gltf-mesh-element.d.ts +31 -0
  121. package/lib/src/owlly/element/gltf-mesh-element.js +137 -0
  122. package/lib/src/owlly/element/gltf-mesh-element.js.map +1 -0
  123. package/lib/src/owlly/element/index.d.ts +20 -0
  124. package/lib/src/owlly/element/index.js +25 -0
  125. package/lib/src/owlly/element/index.js.map +1 -0
  126. package/lib/src/owlly/element/map-kit/area.d.ts +24 -0
  127. package/lib/src/owlly/element/map-kit/area.js +218 -0
  128. package/lib/src/owlly/element/map-kit/area.js.map +1 -0
  129. package/lib/src/owlly/element/map-kit/block-set.d.ts +39 -0
  130. package/lib/src/owlly/element/map-kit/block-set.js +91 -0
  131. package/lib/src/owlly/element/map-kit/block-set.js.map +1 -0
  132. package/lib/src/owlly/element/map-kit/block.d.ts +77 -0
  133. package/lib/src/owlly/element/map-kit/block.js +339 -0
  134. package/lib/src/owlly/element/map-kit/block.js.map +1 -0
  135. package/lib/src/owlly/element/map-kit/index.d.ts +4 -0
  136. package/lib/src/owlly/element/map-kit/index.js +7 -0
  137. package/lib/src/owlly/element/map-kit/index.js.map +1 -0
  138. package/lib/src/owlly/element/map-kit/shape.d.ts +131 -0
  139. package/lib/src/owlly/element/map-kit/shape.js +190 -0
  140. package/lib/src/owlly/element/map-kit/shape.js.map +1 -0
  141. package/lib/src/owlly/element/mesh-element.d.ts +22 -0
  142. package/lib/src/owlly/element/mesh-element.js +64 -0
  143. package/lib/src/owlly/element/mesh-element.js.map +1 -0
  144. package/lib/src/owlly/element/mesh-line-2d.d.ts +82 -0
  145. package/lib/src/owlly/element/mesh-line-2d.js +888 -0
  146. package/lib/src/owlly/element/mesh-line-2d.js.map +1 -0
  147. package/lib/src/owlly/element/meshline-o.d.ts +64 -0
  148. package/lib/src/owlly/element/meshline-o.js +679 -0
  149. package/lib/src/owlly/element/meshline-o.js.map +1 -0
  150. package/lib/src/owlly/element/panorama-group.d.ts +241 -0
  151. package/lib/src/owlly/element/panorama-group.js +967 -0
  152. package/lib/src/owlly/element/panorama-group.js.map +1 -0
  153. package/lib/src/owlly/element/panorama.d.ts +132 -0
  154. package/lib/src/owlly/element/panorama.js +813 -0
  155. package/lib/src/owlly/element/panorama.js.map +1 -0
  156. package/lib/src/owlly/element/path-group.d.ts +69 -0
  157. package/lib/src/owlly/element/path-group.js +172 -0
  158. package/lib/src/owlly/element/path-group.js.map +1 -0
  159. package/lib/src/owlly/element/path.d.ts +99 -0
  160. package/lib/src/owlly/element/path.js +532 -0
  161. package/lib/src/owlly/element/path.js.map +1 -0
  162. package/lib/src/owlly/element/placeable-2d.d.ts +158 -0
  163. package/lib/src/owlly/element/placeable-2d.js +471 -0
  164. package/lib/src/owlly/element/placeable-2d.js.map +1 -0
  165. package/lib/src/owlly/element/polygon-mesh.d.ts +107 -0
  166. package/lib/src/owlly/element/polygon-mesh.js +308 -0
  167. package/lib/src/owlly/element/polygon-mesh.js.map +1 -0
  168. package/lib/src/owlly/element/ring-element.d.ts +79 -0
  169. package/lib/src/owlly/element/ring-element.js +384 -0
  170. package/lib/src/owlly/element/ring-element.js.map +1 -0
  171. package/lib/src/owlly/element/sphere-mesh.d.ts +28 -0
  172. package/lib/src/owlly/element/sphere-mesh.js +70 -0
  173. package/lib/src/owlly/element/sphere-mesh.js.map +1 -0
  174. package/lib/src/owlly/element/svg-floor-model.d.ts +22 -0
  175. package/lib/src/owlly/element/svg-floor-model.js +185 -0
  176. package/lib/src/owlly/element/svg-floor-model.js.map +1 -0
  177. package/lib/src/owlly/element/svg-floors.d.ts +27 -0
  178. package/lib/src/owlly/element/svg-floors.js +110 -0
  179. package/lib/src/owlly/element/svg-floors.js.map +1 -0
  180. package/lib/src/owlly/element/tile-panorama-group.d.ts +335 -0
  181. package/lib/src/owlly/element/tile-panorama-group.js +1007 -0
  182. package/lib/src/owlly/element/tile-panorama-group.js.map +1 -0
  183. package/lib/src/owlly/element/tile-panorama.d.ts +161 -0
  184. package/lib/src/owlly/element/tile-panorama.js +511 -0
  185. package/lib/src/owlly/element/tile-panorama.js.map +1 -0
  186. package/lib/src/owlly/element/tile-plane.d.ts +105 -0
  187. package/lib/src/owlly/element/tile-plane.js +361 -0
  188. package/lib/src/owlly/element/tile-plane.js.map +1 -0
  189. package/lib/src/owlly/element/video-element.d.ts +33 -0
  190. package/lib/src/owlly/element/video-element.js +160 -0
  191. package/lib/src/owlly/element/video-element.js.map +1 -0
  192. package/lib/src/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
  193. package/lib/src/owlly/geometries/ExtrudeGeometry2.js +211 -0
  194. package/lib/src/owlly/geometries/ExtrudeGeometry2.js.map +1 -0
  195. package/lib/src/owlly/index.d.ts +13 -0
  196. package/lib/src/owlly/index.js +17 -0
  197. package/lib/src/owlly/index.js.map +1 -0
  198. package/lib/src/owlly/overlay/canvas-overlay.d.ts +96 -0
  199. package/lib/src/owlly/overlay/canvas-overlay.js +511 -0
  200. package/lib/src/owlly/overlay/canvas-overlay.js.map +1 -0
  201. package/lib/src/owlly/overlay/css-2d-overlay.d.ts +14 -0
  202. package/lib/src/owlly/overlay/css-2d-overlay.js +36 -0
  203. package/lib/src/owlly/overlay/css-2d-overlay.js.map +1 -0
  204. package/lib/src/owlly/overlay/css-3d-overlay.d.ts +16 -0
  205. package/lib/src/owlly/overlay/css-3d-overlay.js +37 -0
  206. package/lib/src/owlly/overlay/css-3d-overlay.js.map +1 -0
  207. package/lib/src/owlly/overlay/index.d.ts +6 -0
  208. package/lib/src/owlly/overlay/index.js +12 -0
  209. package/lib/src/owlly/overlay/index.js.map +1 -0
  210. package/lib/src/owlly/overlay/label-overlay.d.ts +62 -0
  211. package/lib/src/owlly/overlay/label-overlay.js +329 -0
  212. package/lib/src/owlly/overlay/label-overlay.js.map +1 -0
  213. package/lib/src/owlly/overlay/overlay.d.ts +14 -0
  214. package/lib/src/owlly/overlay/overlay.js +5 -0
  215. package/lib/src/owlly/overlay/overlay.js.map +1 -0
  216. package/lib/src/owlly/overlay/path-overlay.d.ts +39 -0
  217. package/lib/src/owlly/overlay/path-overlay.js +125 -0
  218. package/lib/src/owlly/overlay/path-overlay.js.map +1 -0
  219. package/lib/src/owlly/overlay/path-overlay2.d.ts +35 -0
  220. package/lib/src/owlly/overlay/path-overlay2.js +119 -0
  221. package/lib/src/owlly/overlay/path-overlay2.js.map +1 -0
  222. package/lib/src/owlly/overlay/poi-overlay-3d.d.ts +278 -0
  223. package/lib/src/owlly/overlay/poi-overlay-3d.js +1433 -0
  224. package/lib/src/owlly/overlay/poi-overlay-3d.js.map +1 -0
  225. package/lib/src/owlly/overlay/poi-overlay.d.ts +277 -0
  226. package/lib/src/owlly/overlay/poi-overlay.js +1412 -0
  227. package/lib/src/owlly/overlay/poi-overlay.js.map +1 -0
  228. package/lib/src/owlly/owlly-2d/index.d.ts +28 -0
  229. package/lib/src/owlly/owlly-2d/index.js +93 -0
  230. package/lib/src/owlly/owlly-2d/index.js.map +1 -0
  231. package/lib/src/owlly/screen/index.d.ts +1 -0
  232. package/lib/src/owlly/screen/index.js +2 -0
  233. package/lib/src/owlly/screen/index.js.map +1 -0
  234. package/lib/src/owlly/screen/screen.d.ts +73 -0
  235. package/lib/src/owlly/screen/screen.js +237 -0
  236. package/lib/src/owlly/screen/screen.js.map +1 -0
  237. package/lib/src/owlly/stage/__test__/stage.spec.d.ts +1 -0
  238. package/lib/src/owlly/stage/__test__/stage.spec.js +15 -0
  239. package/lib/src/owlly/stage/__test__/stage.spec.js.map +1 -0
  240. package/lib/src/owlly/stage/externals.d.ts +19 -0
  241. package/lib/src/owlly/stage/externals.js +25 -0
  242. package/lib/src/owlly/stage/externals.js.map +1 -0
  243. package/lib/src/owlly/stage/index.d.ts +4 -0
  244. package/lib/src/owlly/stage/index.js +7 -0
  245. package/lib/src/owlly/stage/index.js.map +1 -0
  246. package/lib/src/owlly/stage/owlly.d.ts +38 -0
  247. package/lib/src/owlly/stage/owlly.js +168 -0
  248. package/lib/src/owlly/stage/owlly.js.map +1 -0
  249. package/lib/src/owlly/stage/stage.d.ts +108 -0
  250. package/lib/src/owlly/stage/stage.js +235 -0
  251. package/lib/src/owlly/stage/stage.js.map +1 -0
  252. package/lib/src/owlly/utils/alignment-utils.d.ts +20 -0
  253. package/lib/src/owlly/utils/alignment-utils.js +64 -0
  254. package/lib/src/owlly/utils/alignment-utils.js.map +1 -0
  255. package/lib/src/owlly/utils/basic-calc.d.ts +18 -0
  256. package/lib/src/owlly/utils/basic-calc.js +130 -0
  257. package/lib/src/owlly/utils/basic-calc.js.map +1 -0
  258. package/lib/src/owlly/utils/basic-tools.d.ts +71 -0
  259. package/lib/src/owlly/utils/basic-tools.js +236 -0
  260. package/lib/src/owlly/utils/basic-tools.js.map +1 -0
  261. package/lib/src/owlly/utils/bvh-tree.d.ts +105 -0
  262. package/lib/src/owlly/utils/bvh-tree.js +540 -0
  263. package/lib/src/owlly/utils/bvh-tree.js.map +1 -0
  264. package/lib/src/owlly/utils/camera.d.ts +37 -0
  265. package/lib/src/owlly/utils/camera.js +51 -0
  266. package/lib/src/owlly/utils/camera.js.map +1 -0
  267. package/lib/src/owlly/utils/cube-texture-cache.d.ts +25 -0
  268. package/lib/src/owlly/utils/cube-texture-cache.js +144 -0
  269. package/lib/src/owlly/utils/cube-texture-cache.js.map +1 -0
  270. package/lib/src/owlly/utils/device-utils.d.ts +18 -0
  271. package/lib/src/owlly/utils/device-utils.js +42 -0
  272. package/lib/src/owlly/utils/device-utils.js.map +1 -0
  273. package/lib/src/owlly/utils/environment-utils.d.ts +37 -0
  274. package/lib/src/owlly/utils/environment-utils.js +74 -0
  275. package/lib/src/owlly/utils/environment-utils.js.map +1 -0
  276. package/lib/src/owlly/utils/event-hub.d.ts +50 -0
  277. package/lib/src/owlly/utils/event-hub.js +107 -0
  278. package/lib/src/owlly/utils/event-hub.js.map +1 -0
  279. package/lib/src/owlly/utils/events.d.ts +219 -0
  280. package/lib/src/owlly/utils/events.js +220 -0
  281. package/lib/src/owlly/utils/events.js.map +1 -0
  282. package/lib/src/owlly/utils/geometry-utils.d.ts +119 -0
  283. package/lib/src/owlly/utils/geometry-utils.js +623 -0
  284. package/lib/src/owlly/utils/geometry-utils.js.map +1 -0
  285. package/lib/src/owlly/utils/helper.d.ts +6 -0
  286. package/lib/src/owlly/utils/helper.js +25 -0
  287. package/lib/src/owlly/utils/helper.js.map +1 -0
  288. package/lib/src/owlly/utils/index.d.ts +14 -0
  289. package/lib/src/owlly/utils/index.js +18 -0
  290. package/lib/src/owlly/utils/index.js.map +1 -0
  291. package/lib/src/owlly/utils/lru-cache.d.ts +26 -0
  292. package/lib/src/owlly/utils/lru-cache.js +110 -0
  293. package/lib/src/owlly/utils/lru-cache.js.map +1 -0
  294. package/lib/src/owlly/utils/map-utils.d.ts +7 -0
  295. package/lib/src/owlly/utils/map-utils.js +53 -0
  296. package/lib/src/owlly/utils/map-utils.js.map +1 -0
  297. package/lib/src/owlly/utils/number-utils.d.ts +8 -0
  298. package/lib/src/owlly/utils/number-utils.js +73 -0
  299. package/lib/src/owlly/utils/number-utils.js.map +1 -0
  300. package/lib/src/owlly/utils/panorama-model-util.d.ts +46 -0
  301. package/lib/src/owlly/utils/panorama-model-util.js +246 -0
  302. package/lib/src/owlly/utils/panorama-model-util.js.map +1 -0
  303. package/lib/src/owlly/utils/path-utils.d.ts +80 -0
  304. package/lib/src/owlly/utils/path-utils.js +729 -0
  305. package/lib/src/owlly/utils/path-utils.js.map +1 -0
  306. package/lib/src/owlly/utils/svgutils.d.ts +138 -0
  307. package/lib/src/owlly/utils/svgutils.js +562 -0
  308. package/lib/src/owlly/utils/svgutils.js.map +1 -0
  309. package/lib/src/owlly/utils/texture-cache.d.ts +29 -0
  310. package/lib/src/owlly/utils/texture-cache.js +116 -0
  311. package/lib/src/owlly/utils/texture-cache.js.map +1 -0
  312. package/lib/src/owlly/utils/tile-util.d.ts +187 -0
  313. package/lib/src/owlly/utils/tile-util.js +457 -0
  314. package/lib/src/owlly/utils/tile-util.js.map +1 -0
  315. package/lib/src/owlly/utils/time-profiler.d.ts +21 -0
  316. package/lib/src/owlly/utils/time-profiler.js +49 -0
  317. package/lib/src/owlly/utils/time-profiler.js.map +1 -0
  318. package/lib/src/owlly/view/__test__/perspective-view.spec.d.ts +0 -0
  319. package/lib/src/owlly/view/__test__/perspective-view.spec.js +22 -0
  320. package/lib/src/owlly/view/__test__/perspective-view.spec.js.map +1 -0
  321. package/lib/src/owlly/view/camera-view.d.ts +35 -0
  322. package/lib/src/owlly/view/camera-view.js +102 -0
  323. package/lib/src/owlly/view/camera-view.js.map +1 -0
  324. package/lib/src/owlly/view/index.d.ts +3 -0
  325. package/lib/src/owlly/view/index.js +6 -0
  326. package/lib/src/owlly/view/index.js.map +1 -0
  327. package/lib/src/owlly/view/orthographic-view.d.ts +40 -0
  328. package/lib/src/owlly/view/orthographic-view.js +95 -0
  329. package/lib/src/owlly/view/orthographic-view.js.map +1 -0
  330. package/lib/src/owlly/view/perspective-view.d.ts +40 -0
  331. package/lib/src/owlly/view/perspective-view.js +96 -0
  332. package/lib/src/owlly/view/perspective-view.js.map +1 -0
  333. package/lib/src/owlly/view/svg-map-view.d.ts +46 -0
  334. package/lib/src/owlly/view/svg-map-view.js +145 -0
  335. package/lib/src/owlly/view/svg-map-view.js.map +1 -0
  336. package/lib/src/owlly/view/view.d.ts +146 -0
  337. package/lib/src/owlly/view/view.js +318 -0
  338. package/lib/src/owlly/view/view.js.map +1 -0
  339. package/lib/src/web/main.centroid.d.ts +0 -0
  340. package/lib/src/web/main.centroid.js +74 -0
  341. package/lib/src/web/main.centroid.js.map +1 -0
  342. package/lib/src/web/main.hyma.meshline2d.d.ts +1 -0
  343. package/lib/src/web/main.hyma.meshline2d.js +76 -0
  344. package/lib/src/web/main.hyma.meshline2d.js.map +1 -0
  345. package/lib/src/web/main.jyfang.sample.d.ts +0 -0
  346. package/lib/src/web/main.jyfang.sample.js +122 -0
  347. package/lib/src/web/main.jyfang.sample.js.map +1 -0
  348. package/lib/src/web/main.rpeng.extrude.d.ts +1 -0
  349. package/lib/src/web/main.rpeng.extrude.js +180 -0
  350. package/lib/src/web/main.rpeng.extrude.js.map +1 -0
  351. package/lib/src/web/main.rpeng.mes.plane.d.ts +1 -0
  352. package/lib/src/web/main.rpeng.mes.plane.js +135 -0
  353. package/lib/src/web/main.rpeng.mes.plane.js.map +1 -0
  354. package/lib/src/web/main.rpeng.sample.d.ts +0 -0
  355. package/lib/src/web/main.rpeng.sample.js +318 -0
  356. package/lib/src/web/main.rpeng.sample.js.map +1 -0
  357. package/lib/src/web/main.rpeng.vr.d.ts +1 -0
  358. package/lib/src/web/main.rpeng.vr.js +141 -0
  359. package/lib/src/web/main.rpeng.vr.js.map +1 -0
  360. package/lib/src/web/main.sample.d.ts +1 -0
  361. package/lib/src/web/main.sample.js +52 -0
  362. package/lib/src/web/main.sample.js.map +1 -0
  363. package/lib/src/web/quattree.hyma.d.ts +0 -0
  364. package/lib/src/web/quattree.hyma.js +150 -0
  365. package/lib/src/web/quattree.hyma.js.map +1 -0
  366. package/lib/src/web/sensor-vr-plugin.d.ts +0 -0
  367. package/lib/src/web/sensor-vr-plugin.js +166 -0
  368. package/lib/src/web/sensor-vr-plugin.js.map +1 -0
  369. package/package.json +142 -0
  370. package/src/@types/SceneUtils.d.ts +9 -0
  371. package/src/@types/chaikin-smooth.d.ts +5 -0
  372. package/src/@types/global.d.ts +3 -0
  373. package/src/@types/snapsvg.d.ts +11 -0
  374. package/src/@types/svgson.d.ts +30 -0
  375. package/src/assets/favicon.ico +0 -0
  376. package/src/external/lines/line-geometry.ts +70 -0
  377. package/src/external/lines/line-material.ts +453 -0
  378. package/src/external/lines/line-segments-2.ts +194 -0
  379. package/src/external/lines/line-segments-geometry.ts +197 -0
  380. package/src/external/loaders/gltf-loader.ts +3004 -0
  381. package/src/external/orbit-controls.ts +1070 -0
  382. package/src/external/renderers/css-2d-renderer.ts +185 -0
  383. package/src/external/renderers/css-3d-renderer.ts +245 -0
  384. package/src/external/transform-controls.ts +1532 -0
  385. package/src/external/util/buffer-geometry-utils.ts +783 -0
  386. package/src/owlly/controller/aerial-element-controller.ts +277 -0
  387. package/src/owlly/controller/basic-controller.ts +1509 -0
  388. package/src/owlly/controller/camera-controller.ts +155 -0
  389. package/src/owlly/controller/controller.ts +76 -0
  390. package/src/owlly/controller/index.ts +15 -0
  391. package/src/owlly/controller/mouse-indicator-controller.ts +157 -0
  392. package/src/owlly/controller/orbit-control.ts +310 -0
  393. package/src/owlly/controller/panorama-adjust-controller.ts +183 -0
  394. package/src/owlly/controller/panorama-controller.ts +2234 -0
  395. package/src/owlly/controller/panorama-transform-controller.ts +151 -0
  396. package/src/owlly/controller/plane-controller.ts +222 -0
  397. package/src/owlly/controller/texture-controller.ts +949 -0
  398. package/src/owlly/controller/tile-panorama-controller.ts +1633 -0
  399. package/src/owlly/controller/transform-controller.ts +684 -0
  400. package/src/owlly/element/bottom-nav-element.ts +352 -0
  401. package/src/owlly/element/camera.ts +389 -0
  402. package/src/owlly/element/dom-2d-element.ts +88 -0
  403. package/src/owlly/element/dom-3d-element.ts +87 -0
  404. package/src/owlly/element/dom-label-2d.ts +497 -0
  405. package/src/owlly/element/element.ts +117 -0
  406. package/src/owlly/element/floor-model.ts +290 -0
  407. package/src/owlly/element/gif-kit/Gif.ts +509 -0
  408. package/src/owlly/element/gif-kit/GifColor.ts +44 -0
  409. package/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.ts +56 -0
  410. package/src/owlly/element/gif-kit/GifFrame.ts +207 -0
  411. package/src/owlly/element/gif-kit/GifImage.ts +26 -0
  412. package/src/owlly/element/gif-kit/GifParser.ts +254 -0
  413. package/src/owlly/element/gif-kit/GifPresenter.ts +46 -0
  414. package/src/owlly/element/gif-kit/GifVersion.ts +12 -0
  415. package/src/owlly/element/gltf-mesh-element.ts +184 -0
  416. package/src/owlly/element/index.ts +25 -0
  417. package/src/owlly/element/map-kit/area.ts +232 -0
  418. package/src/owlly/element/map-kit/block-set.ts +102 -0
  419. package/src/owlly/element/map-kit/block.ts +417 -0
  420. package/src/owlly/element/map-kit/index.ts +6 -0
  421. package/src/owlly/element/map-kit/shape.ts +285 -0
  422. package/src/owlly/element/mesh-element.ts +94 -0
  423. package/src/owlly/element/mesh-line-2d.ts +1032 -0
  424. package/src/owlly/element/meshline-o.ts +802 -0
  425. package/src/owlly/element/panorama-group.ts +1250 -0
  426. package/src/owlly/element/panorama.ts +1044 -0
  427. package/src/owlly/element/path-group.ts +212 -0
  428. package/src/owlly/element/path.ts +727 -0
  429. package/src/owlly/element/placeable-2d.ts +627 -0
  430. package/src/owlly/element/polygon-mesh.ts +344 -0
  431. package/src/owlly/element/ring-element.ts +517 -0
  432. package/src/owlly/element/sphere-mesh.ts +96 -0
  433. package/src/owlly/element/svg-floor-model.ts +200 -0
  434. package/src/owlly/element/svg-floors.ts +121 -0
  435. package/src/owlly/element/tile-panorama-group.ts +1314 -0
  436. package/src/owlly/element/tile-panorama.ts +636 -0
  437. package/src/owlly/element/tile-plane.ts +430 -0
  438. package/src/owlly/element/video-element.ts +190 -0
  439. package/src/owlly/geometries/ExtrudeGeometry2.ts +255 -0
  440. package/src/owlly/index.ts +19 -0
  441. package/src/owlly/overlay/canvas-overlay.ts +642 -0
  442. package/src/owlly/overlay/css-2d-overlay.ts +48 -0
  443. package/src/owlly/overlay/css-3d-overlay.ts +50 -0
  444. package/src/owlly/overlay/index.ts +11 -0
  445. package/src/owlly/overlay/label-overlay.ts +419 -0
  446. package/src/owlly/overlay/overlay.ts +17 -0
  447. package/src/owlly/overlay/path-overlay.ts +170 -0
  448. package/src/owlly/overlay/path-overlay2.ts +149 -0
  449. package/src/owlly/overlay/poi-overlay-3d.ts +1759 -0
  450. package/src/owlly/overlay/poi-overlay.ts +1739 -0
  451. package/src/owlly/owlly-2d/index.ts +108 -0
  452. package/src/owlly/screen/index.ts +1 -0
  453. package/src/owlly/screen/screen.ts +323 -0
  454. package/src/owlly/stage/__test__/stage.spec.ts +15 -0
  455. package/src/owlly/stage/externals.ts +45 -0
  456. package/src/owlly/stage/index.ts +12 -0
  457. package/src/owlly/stage/owlly.ts +223 -0
  458. package/src/owlly/stage/stage.ts +274 -0
  459. package/src/owlly/utils/alignment-utils.ts +84 -0
  460. package/src/owlly/utils/basic-calc.ts +141 -0
  461. package/src/owlly/utils/basic-tools.ts +286 -0
  462. package/src/owlly/utils/bvh-tree.ts +695 -0
  463. package/src/owlly/utils/camera.ts +72 -0
  464. package/src/owlly/utils/cube-texture-cache.ts +155 -0
  465. package/src/owlly/utils/device-utils.ts +53 -0
  466. package/src/owlly/utils/environment-utils.ts +81 -0
  467. package/src/owlly/utils/event-hub.ts +120 -0
  468. package/src/owlly/utils/events.ts +266 -0
  469. package/src/owlly/utils/geometry-utils.ts +749 -0
  470. package/src/owlly/utils/helper.ts +33 -0
  471. package/src/owlly/utils/index.ts +17 -0
  472. package/src/owlly/utils/lru-cache.ts +126 -0
  473. package/src/owlly/utils/map-utils.ts +55 -0
  474. package/src/owlly/utils/number-utils.ts +75 -0
  475. package/src/owlly/utils/panorama-model-util.ts +255 -0
  476. package/src/owlly/utils/path-utils.ts +837 -0
  477. package/src/owlly/utils/svgutils.ts +732 -0
  478. package/src/owlly/utils/texture-cache.ts +132 -0
  479. package/src/owlly/utils/tile-util.ts +563 -0
  480. package/src/owlly/utils/time-profiler.ts +57 -0
  481. package/src/owlly/view/__test__/perspective-view.spec.ts +23 -0
  482. package/src/owlly/view/camera-view.ts +114 -0
  483. package/src/owlly/view/index.ts +5 -0
  484. package/src/owlly/view/orthographic-view.ts +124 -0
  485. package/src/owlly/view/perspective-view.ts +125 -0
  486. package/src/owlly/view/svg-map-view.ts +187 -0
  487. package/src/owlly/view/view.ts +409 -0
  488. package/src/public/js/jsmpeg.min.js +3129 -0
  489. package/src/web/index.html +52 -0
  490. package/src/web/main.centroid.ts +85 -0
  491. package/src/web/main.hyma.meshline2d.ts +84 -0
  492. package/src/web/main.jyfang.sample.ts +139 -0
  493. package/src/web/main.rpeng.extrude.ts +194 -0
  494. package/src/web/main.rpeng.mes.plane.ts +161 -0
  495. package/src/web/main.rpeng.sample.ts +345 -0
  496. package/src/web/main.rpeng.vr.ts +159 -0
  497. package/src/web/main.sample.ts +59 -0
  498. package/src/web/quattree.hyma.ts +163 -0
  499. package/src/web/sensor-vr-plugin.ts +201 -0
  500. package/src/web/testPixel.png +0 -0
@@ -0,0 +1,813 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Externals } from '../stage/externals';
11
+ import { Element, ElementFrameContext } from './element';
12
+ import { EventHub } from '../utils/event-hub';
13
+ import { Events, OwllyEvents } from '../utils/events';
14
+ import { TextureCache } from '../utils/texture-cache';
15
+ import { DeviceUtils } from '../utils/device-utils';
16
+ import { CubeTextureCache } from '../utils/cube-texture-cache';
17
+ /**
18
+ * 全景图对象
19
+ * @noInheritDoc
20
+ */
21
+ class Panorama extends Element {
22
+ /**
23
+ * @param textureURLs 低清立方体贴图六张图的URL数组(本地相对路径或网络URL均可),按右左上下前后的顺序
24
+ * @param highTextureURLs 高清立方体贴图六张图的URL数组(本地相对路径或网络URL均可),按右左上下前后的顺序
25
+ * @param useLowTextureURLsOnly 可选,设置后则(如果没有提供瓦片贴图)只使用低清立方体贴图
26
+ * @param tiledTextureURLRoot 可选,瓦片贴图URL的前缀部分,若没有则用highTextureURLs和lowTextureURLs作为贴图源
27
+ */
28
+ constructor(pid, seqID, textureURLs, faceGridsSize, neighborPanoramaIDs = [], highTextureURLs, useLowTextureURLsOnly, tiledTextureURLRoot, position, quaternion, legacyMode = false) {
29
+ super();
30
+ const { THREE } = Externals.getInstance();
31
+ this.pid = pid;
32
+ this.seqID = seqID;
33
+ this.highTextureURLs = highTextureURLs || [];
34
+ this.textureURLs = textureURLs;
35
+ this.useLowTextureURLsOnly = !!useLowTextureURLsOnly;
36
+ this.tiledTextureURLRoot = tiledTextureURLRoot;
37
+ this.neighborPanoramaIDs = neighborPanoramaIDs;
38
+ this.viewConfigurations = new Map();
39
+ this.panoViews = new Set();
40
+ this.initialized = false;
41
+ this.needsUpdate = false;
42
+ this.legacyMode = legacyMode;
43
+ const boxGeometry = new THREE.BoxBufferGeometry(2, 2, 2);
44
+ this.wireFrame = new THREE.LineSegments(new THREE.EdgesGeometry(boxGeometry), new THREE.LineBasicMaterial({ color: 0xff0000 }));
45
+ this.wireFrame.material.visible = false;
46
+ this.wireFrame.renderOrder = 100;
47
+ this.add(this.wireFrame);
48
+ const sphereGeometry = new THREE.SphereBufferGeometry(1, 60, 40);
49
+ sphereGeometry.scale(1, -1, 1);
50
+ sphereGeometry.rotateY(-90 * Math.PI / 180.0);
51
+ this.sphereMesh = new THREE.Mesh(sphereGeometry);
52
+ this.sphereMesh.visible = false;
53
+ this.sphereMesh.renderOrder = 150;
54
+ this.add(this.sphereMesh);
55
+ this.isPlayingVideo = false;
56
+ this.videoCanvas = null;
57
+ this.videoContentType = 'mp4';
58
+ if (this.legacyMode) {
59
+ // do nothing now
60
+ const vertexShader = `
61
+ varying vec3 v_position;
62
+ void main(){
63
+ v_position = position;
64
+ v_position.y = v_position.y * -1.0;
65
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
66
+ }`;
67
+ const fragmentShader = `
68
+ uniform samplerCube tCube;
69
+ varying vec3 v_position;
70
+ void main(){
71
+ gl_FragColor = textureCube(tCube, v_position);
72
+ }`;
73
+ const uniforms = {
74
+ tCube: {
75
+ type: 't',
76
+ value: null,
77
+ },
78
+ };
79
+ this.uniforms = uniforms;
80
+ this.material = new THREE.ShaderMaterial({
81
+ fragmentShader,
82
+ vertexShader,
83
+ uniforms,
84
+ depthTest: false,
85
+ side: THREE.BackSide,
86
+ });
87
+ this.skyBox = new THREE.Mesh(new THREE.SphereBufferGeometry(2, 32, 32));
88
+ // this.skyBox.visible = false;// /!!!#TiledCube#
89
+ // 设置天空盒不被视锥裁剪,这样天空盒资源就能直接加载到GPU里面
90
+ this.skyBox.frustumCulled = false;
91
+ this.skyBox.material = this.material;
92
+ this.skyBox.renderOrder = 100;
93
+ this.add(this.skyBox);
94
+ this.updateTexture();
95
+ }
96
+ else {
97
+ const faceVertexShader = `
98
+ varying vec2 vUv;
99
+ void main(){
100
+ vUv = uv;
101
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
102
+ }`;
103
+ const faceFragmentShader = `
104
+ uniform sampler2D tFaceTexture;
105
+ uniform vec2 uvScalar;
106
+ uniform vec2 uvOffset;
107
+ uniform vec4 blendColor;
108
+ varying vec2 vUv;
109
+ void main(){
110
+ vec2 UV = vUv * uvScalar + uvOffset;
111
+ vec4 texColor = texture2D(tFaceTexture, vec2(UV.s, 1.0 - UV.t));
112
+ gl_FragColor = (1.0 - blendColor.a) * texColor + blendColor.a * blendColor;
113
+ // gl_FragColor = vec4(vUv, 0.0, 1.0);
114
+ }`;
115
+ [this.faceGridRows, this.faceGridCols] = faceGridsSize;
116
+ const gridWidth = 2 / faceGridsSize[1];
117
+ const gridHeight = 2 / faceGridsSize[0];
118
+ this.faceGridsStates = [];
119
+ this.faceGridTextureCacheKeys = [];
120
+ this.panoViews = new Set();
121
+ this.faceGridsMaterials = [];
122
+ this.faceGridsUniformses = [];
123
+ this.skyBoxFaceGrids = [];
124
+ this.gridCenters = [];
125
+ for (let iFace = 0; iFace < 6; iFace++) {
126
+ const gridsStates = [];
127
+ const gridTextureCacheKeys = [];
128
+ const gridsUniforms = [];
129
+ const gridsMaterials = [];
130
+ const gridsMeshes = [];
131
+ const gridCenterRows = [];
132
+ for (let iRow = 0; iRow < faceGridsSize[0]; iRow++) {
133
+ const gridCenterRowCols = [];
134
+ for (let iCol = 0; iCol < faceGridsSize[1]; iCol++) {
135
+ const gridIndex = iRow * faceGridsSize[1] + iCol;
136
+ gridsStates[gridIndex] = 0;
137
+ gridTextureCacheKeys[gridIndex] = '';
138
+ gridsUniforms[gridIndex] = {
139
+ tFaceTexture: {
140
+ type: 't',
141
+ value: null,
142
+ },
143
+ uvScalar: {
144
+ type: 'v2',
145
+ value: new THREE.Vector2(1, 1),
146
+ },
147
+ uvOffset: {
148
+ type: 'v2',
149
+ value: new THREE.Vector2(0, 0),
150
+ },
151
+ blendColor: {
152
+ type: 'v4',
153
+ value: new THREE.Vector4(0, 0, 0, 0),
154
+ },
155
+ };
156
+ gridsMaterials[gridIndex] = new THREE.ShaderMaterial({
157
+ fragmentShader: faceFragmentShader,
158
+ vertexShader: faceVertexShader,
159
+ uniforms: gridsUniforms[gridIndex],
160
+ depthTest: false,
161
+ side: THREE.BackSide,
162
+ });
163
+ const skyBoxFaceGeometry = new THREE.PlaneBufferGeometry(gridWidth, gridHeight);
164
+ const skyBoxFaceMesh = new THREE.Mesh(skyBoxFaceGeometry, gridsMaterials[gridIndex]);
165
+ gridsMeshes[gridIndex] = skyBoxFaceMesh;
166
+ skyBoxFaceMesh.visible = true;
167
+ // 设置天空盒不被视锥裁剪,这样天空盒资源就能直接加载到GPU里面
168
+ skyBoxFaceMesh.frustumCulled = false;
169
+ skyBoxFaceMesh.material = gridsMaterials[gridIndex];
170
+ skyBoxFaceMesh.renderOrder = 100;
171
+ this.add(skyBoxFaceMesh);
172
+ gridCenterRowCols[iCol] = new THREE.Vector4(0, 0, 0, 1);
173
+ }
174
+ gridCenterRows[iRow] = gridCenterRowCols;
175
+ }
176
+ this.faceGridsStates[iFace] = gridsStates;
177
+ this.faceGridTextureCacheKeys[iFace] = gridTextureCacheKeys;
178
+ this.faceGridsUniformses[iFace] = gridsUniforms;
179
+ this.faceGridsMaterials[iFace] = gridsMaterials;
180
+ this.skyBoxFaceGrids[iFace] = gridsMeshes;
181
+ this.gridCenters[iFace] = gridCenterRows;
182
+ }
183
+ const T2 = new THREE.Matrix4();
184
+ const R1 = new THREE.Matrix4();
185
+ for (let iRow = 0; iRow < faceGridsSize[0]; iRow++) {
186
+ for (let iCol = 0; iCol < faceGridsSize[1]; iCol++) {
187
+ const gridIndex = iRow * faceGridsSize[1] + iCol;
188
+ for (let iFace = 0; iFace < 6; iFace++) {
189
+ T2.makeTranslation(gridWidth / 2 - 1 + gridWidth * iCol, gridHeight / 2 - 1 + gridHeight * iRow, 0);
190
+ this.skyBoxFaceGrids[iFace][gridIndex].applyMatrix4(T2);
191
+ this.gridCenters[iFace][iRow][iCol].applyMatrix4(T2);
192
+ }
193
+ }
194
+ }
195
+ for (let iRow = 0; iRow < faceGridsSize[0]; iRow++) {
196
+ for (let iCol = 0; iCol < faceGridsSize[1]; iCol++) {
197
+ const gridIndex = iRow * faceGridsSize[1] + iCol;
198
+ T2.makeTranslation(1, 0, 0);
199
+ R1.makeRotationY(Math.PI / 2);
200
+ this.skyBoxFaceGrids[0][gridIndex].applyMatrix4(R1); // /???
201
+ this.skyBoxFaceGrids[0][gridIndex].applyMatrix4(T2);
202
+ // this.skyBoxFaceGrids[0][gridIndex].translateX(1.0).rotateY(Math.PI / 2);// R
203
+ this.gridCenters[0][iRow][iCol].applyMatrix4(R1).applyMatrix4(T2);
204
+ T2.makeTranslation(-1, 0, 0);
205
+ R1.makeRotationY(-Math.PI / 2);
206
+ this.skyBoxFaceGrids[1][gridIndex].applyMatrix4(R1); // /???
207
+ this.skyBoxFaceGrids[1][gridIndex].applyMatrix4(T2);
208
+ // this.skyBoxFaceGrids[1][gridIndex].translateX(-1.0).rotateY(-Math.PI / 2);// L
209
+ this.gridCenters[1][iRow][iCol].applyMatrix4(R1).applyMatrix4(T2);
210
+ T2.makeTranslation(0, -1, 0);
211
+ R1.makeRotationX(Math.PI / 2);
212
+ this.skyBoxFaceGrids[2][gridIndex].applyMatrix4(R1); // /???
213
+ this.skyBoxFaceGrids[2][gridIndex].applyMatrix4(T2);
214
+ // this.skyBoxFaceGrids[2][gridIndex].translateY(-1.0).rotateX(Math.PI / 2);// T
215
+ this.gridCenters[2][iRow][iCol].applyMatrix4(R1).applyMatrix4(T2);
216
+ T2.makeTranslation(0, 1, 0);
217
+ R1.makeRotationX(-Math.PI / 2);
218
+ this.skyBoxFaceGrids[3][gridIndex].applyMatrix4(R1); // /???
219
+ this.skyBoxFaceGrids[3][gridIndex].applyMatrix4(T2);
220
+ // this.skyBoxFaceGrids[3][gridIndex].translateY(1.0).rotateX(-Math.PI / 2);// D
221
+ this.gridCenters[3][iRow][iCol].applyMatrix4(R1).applyMatrix4(T2);
222
+ T2.makeTranslation(0, 0, 1);
223
+ R1.makeTranslation(0, 0, 0);
224
+ this.skyBoxFaceGrids[4][gridIndex].applyMatrix4(R1); // /???
225
+ this.skyBoxFaceGrids[4][gridIndex].applyMatrix4(T2);
226
+ // this.skyBoxFaceGrids[4][gridIndex].translateZ(1.0);// F
227
+ this.gridCenters[4][iRow][iCol].applyMatrix4(R1).applyMatrix4(T2);
228
+ T2.makeTranslation(0, 0, -1);
229
+ R1.makeRotationY(Math.PI);
230
+ this.skyBoxFaceGrids[5][gridIndex].applyMatrix4(R1); // /???
231
+ this.skyBoxFaceGrids[5][gridIndex].applyMatrix4(T2);
232
+ // this.skyBoxFaceGrids[5][gridIndex].translateZ(-1.0).rotateY(Math.PI);// B
233
+ this.gridCenters[5][iRow][iCol].applyMatrix4(R1).applyMatrix4(T2);
234
+ }
235
+ }
236
+ }
237
+ if (position) {
238
+ this.position.copy(position);
239
+ }
240
+ if (quaternion) {
241
+ this.quaternion.copy(quaternion);
242
+ }
243
+ this.baseQuaternion = new THREE.Quaternion().copy(this.quaternion);
244
+ this.additionalQuaternion = new THREE.Quaternion();
245
+ /* eslint-disable no-underscore-dangle */
246
+ const onQuaternionChangeCallback = this.quaternion._onChangeCallback;
247
+ this.quaternion._onChange(() => {
248
+ onQuaternionChangeCallback();
249
+ const targetQuaternion = new THREE.Quaternion().multiplyQuaternions(this.baseQuaternion, this.additionalQuaternion);
250
+ if (targetQuaternion.equals(this.quaternion))
251
+ return;
252
+ this.baseQuaternion = this.quaternion.clone();
253
+ const { x, y, z, w, } = new THREE.Quaternion().multiplyQuaternions(this.baseQuaternion, this.additionalQuaternion);
254
+ this.quaternion.set(x, y, z, w);
255
+ this.needsUpdate = true;
256
+ });
257
+ const onRotationChangeCallback = this.rotation._onChangeCallback;
258
+ this.rotation._onChange(() => {
259
+ onRotationChangeCallback();
260
+ const reverse = this.additionalQuaternion.clone().invert();
261
+ this.baseQuaternion = this.quaternion.clone().multiply(reverse);
262
+ });
263
+ this.eventListeners = {
264
+ onPanoramaSelected: (panorama) => {
265
+ this.isSelected = panorama === this;
266
+ if (!this.isSelected)
267
+ return;
268
+ this.emit(Events.PANORAMA_SELECTED, this.pid);
269
+ },
270
+ onEnded: () => { },
271
+ };
272
+ EventHub.on(OwllyEvents.ELEMENT_SELECTED, this.eventListeners.onPanoramaSelected);
273
+ }
274
+ /**
275
+ * 为全景图对象设置立方体贴图
276
+ * @param cubeTexture 立方体贴图对象
277
+ */
278
+ setTexture(cubeTexture) {
279
+ this.uniforms.tCube.value = cubeTexture;
280
+ this.needsUpdate = true;
281
+ if (!this.panoramaLoaded) {
282
+ this.emit(Events.DID_LOAD_PANORAMA, this.pid);
283
+ }
284
+ this.panoramaLoaded = true;
285
+ }
286
+ /**
287
+ * 暂停视频播放
288
+ */
289
+ pauseVideo() {
290
+ if (this.videoContentType === 'ts') {
291
+ if (this.mpegVideoPlayer)
292
+ this.mpegVideoPlayer.pause();
293
+ }
294
+ else {
295
+ const videoElementID = `pano_vid_${this.pid}`;
296
+ this.video = this.video || document.getElementById(videoElementID);
297
+ if (!this.video) {
298
+ return;
299
+ }
300
+ this.video.pause();
301
+ }
302
+ }
303
+ /**
304
+ * 恢复视频播放
305
+ */
306
+ resumeVideo() {
307
+ return __awaiter(this, void 0, void 0, function* () {
308
+ if (this.videoContentType === 'ts') {
309
+ if (this.mpegVideoPlayer)
310
+ this.mpegVideoPlayer.play();
311
+ }
312
+ else {
313
+ const videoElementID = `pano_vid_${this.pid}`;
314
+ this.video = this.video || document.getElementById(videoElementID);
315
+ if (!this.video) {
316
+ return;
317
+ }
318
+ yield this.video.play();
319
+ }
320
+ });
321
+ }
322
+ /**
323
+ * 停止视频播放,并释放视频相关资源
324
+ */
325
+ stopVideo() {
326
+ this.sphereMesh.visible = false;
327
+ if (this.videoContentType === 'ts') {
328
+ if (this.mpegVideoPlayer) {
329
+ this.mpegVideoPlayer.stop();
330
+ this.mpegVideoPlayer.destroy();
331
+ this.mpegVideoPlayer = null;
332
+ }
333
+ const canvasTexture = this.sphereMesh.material.map;
334
+ if (canvasTexture)
335
+ canvasTexture.dispose();
336
+ this.sphereMesh.material.dispose();
337
+ this.videoCanvas = null;
338
+ }
339
+ else {
340
+ const videoElementID = `pano_vid_${this.pid}`;
341
+ this.video = this.video || document.getElementById(videoElementID);
342
+ const videoTexture = this.sphereMesh.material.map;
343
+ if (videoTexture) {
344
+ videoTexture.dispose();
345
+ }
346
+ this.sphereMesh.material.dispose();
347
+ if (this.video) {
348
+ this.video.pause();
349
+ this.video.removeAttribute('src');
350
+ this.video.load();
351
+ this.video = null;
352
+ }
353
+ }
354
+ if (this.eventListeners.onEnded)
355
+ this.eventListeners.onEnded();
356
+ this.isPlayingVideo = false;
357
+ this.needsUpdate = true;
358
+ }
359
+ /**
360
+ * 开始视频播放
361
+ * @param videoURL 视频地址
362
+ * @param loop 是否循环播放
363
+ * @param callbacks 回调函数集合,可选
364
+ */
365
+ playVideo(videoURL, loop, callbacks, contentType = 'mp4', canvasSize = [2048, 2048]) {
366
+ const { onReadyToPlay, onEnded, onPrepareToPlay } = callbacks || {};
367
+ this.videoContentType = contentType;
368
+ const { THREE } = Externals.getInstance();
369
+ this.eventListeners.onEnded = onEnded || (() => { });
370
+ if (this.videoContentType === 'ts') {
371
+ if (!JSMpeg || !JSMpeg.Player)
372
+ throw new Error('JSMpeg is needed. Please get JSMpeg from https://github.com/phoboslab/jsmpeg');
373
+ if (!this.videoCanvas) {
374
+ this.videoCanvas = document.createElement('canvas');
375
+ [this.videoCanvas.width, this.videoCanvas.height] = canvasSize;
376
+ }
377
+ this.mpegVideoPlayer = new JSMpeg.Player(videoURL, {
378
+ canvas: this.videoCanvas,
379
+ loop,
380
+ autoplay: false,
381
+ disableGl: false,
382
+ onSourceEstablished: () => {
383
+ this.needsUpdate = true;
384
+ if (onPrepareToPlay)
385
+ onPrepareToPlay();
386
+ },
387
+ onPlay: () => {
388
+ this.sphereMesh.visible = true;
389
+ this.needsUpdate = true;
390
+ if (onReadyToPlay)
391
+ onReadyToPlay();
392
+ this.isPlayingVideo = true;
393
+ },
394
+ onPause: () => { },
395
+ onStalled: () => { },
396
+ onEnded: () => {
397
+ this.stopVideo();
398
+ },
399
+ chunkSize: 8 * 1024 * 1024,
400
+ videoBufferSize: 8 * 512 * 1024,
401
+ decodeFirstFrame: false,
402
+ preserveDrawingBuffer: false,
403
+ });
404
+ const texture = new THREE.CanvasTexture(this.videoCanvas);
405
+ texture.needsUpdate = true;
406
+ if (DeviceUtils.DetectIOS())
407
+ texture.flipY = false;
408
+ this.sphereMesh.material = new THREE.MeshBasicMaterial({
409
+ map: texture,
410
+ // side: DoubleSide,
411
+ transparent: false,
412
+ depthTest: false,
413
+ depthWrite: false,
414
+ });
415
+ this.mpegVideoPlayer.source.established = false;
416
+ this.mpegVideoPlayer.source.loadedSize = 0;
417
+ this.mpegVideoPlayer.demuxer.startTime = 0;
418
+ this.mpegVideoPlayer.demuxer.currentTime = 0;
419
+ this.mpegVideoPlayer.demuxer.bits = null;
420
+ this.mpegVideoPlayer.demuxer.leftoverBytes = null;
421
+ this.mpegVideoPlayer.audioOut.resetEnqueuedTime();
422
+ this.mpegVideoPlayer.audioOut.unlock();
423
+ this.mpegVideoPlayer.seek(0);
424
+ this.mpegVideoPlayer.play();
425
+ }
426
+ else {
427
+ const videoElementID = `pano_vid_${this.pid}`;
428
+ this.video = document.getElementById(videoElementID);
429
+ if (!this.video) {
430
+ this.video = document.createElement('video');
431
+ this.video.id = videoElementID;
432
+ this.video.setAttribute('webkit-playsinline', 'true');
433
+ this.video.setAttribute('x5-playsinline', 'true');
434
+ this.video.setAttribute('playsinline', 'true');
435
+ this.video.setAttribute('crossorigin', 'anonymous');
436
+ // console.info('#Video# video', video);
437
+ }
438
+ this.video.src = videoURL;
439
+ this.video.loop = !!loop;
440
+ this.video.addEventListener('playing', () => {
441
+ // console.info('#Video# playing', ev);
442
+ this.sphereMesh.visible = true;
443
+ this.needsUpdate = true;
444
+ if (onReadyToPlay) {
445
+ onReadyToPlay(this.video);
446
+ }
447
+ this.isPlayingVideo = true;
448
+ });
449
+ this.video.addEventListener('ended', () => {
450
+ this.stopVideo();
451
+ });
452
+ this.video.addEventListener('play', () => {
453
+ // console.info('#Video# play', ev);
454
+ this.needsUpdate = true;
455
+ if (onPrepareToPlay) {
456
+ onPrepareToPlay(this.video);
457
+ }
458
+ });
459
+ this.video.play();
460
+ const texture = new THREE.VideoTexture(this.video);
461
+ texture.needsUpdate = true;
462
+ this.sphereMesh.material = new THREE.MeshBasicMaterial({
463
+ map: texture,
464
+ // side: DoubleSide,
465
+ transparent: false,
466
+ depthTest: false,
467
+ depthWrite: false,
468
+ });
469
+ return this.video;
470
+ }
471
+ return null;
472
+ }
473
+ getIntersectedTiles(camera) {
474
+ if (!camera) {
475
+ return {
476
+ hdTiles: [],
477
+ ldTiles: [],
478
+ };
479
+ }
480
+ const { THREE } = Externals.getInstance();
481
+ this.updateMatrixWorld();
482
+ camera.updateMatrixWorld();
483
+ const cameraPosition = camera.position.clone();
484
+ const gridCenters = this.gridCenters.map((face) => {
485
+ const newFace = face.map((row) => {
486
+ const newRow = row.map((v) => {
487
+ const v4 = v.clone().applyMatrix4(this.matrixWorld);
488
+ return new THREE.Vector3(v4.x, v4.y, v4.z).sub(cameraPosition).normalize();
489
+ });
490
+ return newRow;
491
+ });
492
+ return newFace;
493
+ });
494
+ const lookDirection = new THREE.Vector3(0, 0, -1).applyQuaternion(camera.quaternion);
495
+ const retHDTiles = [];
496
+ const retLDTiles = [];
497
+ const cos45 = Math.SQRT1_2;
498
+ for (let iFace = 0; iFace < 6; iFace++) {
499
+ for (let iRow = 0; iRow < this.faceGridRows; iRow++) {
500
+ for (let iCol = 0; iCol < this.faceGridCols; iCol++) {
501
+ const dot = gridCenters[iFace][iRow][iCol].dot(lookDirection);
502
+ if (dot >= cos45) {
503
+ retHDTiles.push([iFace, iRow, iCol, dot]);
504
+ // } else if (dot >= 0) {
505
+ // retLDTiles.push([iFace, iRow, iCol, dot]);
506
+ }
507
+ else {
508
+ retLDTiles.push([iFace, iRow, iCol, dot]); // TODO(dqiu): 优化此处
509
+ }
510
+ }
511
+ }
512
+ }
513
+ if (this.isPlayingVideo) {
514
+ return {
515
+ hdTiles: [],
516
+ ldTiles: retLDTiles,
517
+ };
518
+ }
519
+ return {
520
+ hdTiles: retHDTiles,
521
+ ldTiles: retLDTiles,
522
+ };
523
+ }
524
+ // /**
525
+ // * 为天空盒设置六个面的贴图
526
+ // * @param textures 天空盒六个面的贴图数组,按右左上下前后顺序
527
+ // */
528
+ // private setFaceTextures(textures: Texture[]): void {
529
+ // for (let i = 0; i < 6; i++) {
530
+ // this.faceUniformses[i].tFaceTexture.value = textures[i];
531
+ // }
532
+ // this.needsUpdate = true;
533
+ // }
534
+ setFaceTexture(faceRowColDot, texture, uniformValues, cacheKey) {
535
+ const { THREE } = Externals.getInstance();
536
+ const faceIndex = faceRowColDot[0];
537
+ const gridRow = faceRowColDot[1];
538
+ const gridCol = faceRowColDot[2];
539
+ // const dot = faceRowColDot[3];
540
+ const gridIndex = gridRow * this.faceGridCols + gridCol;
541
+ this.faceGridsUniformses[faceIndex][gridIndex].tFaceTexture.value = texture;
542
+ // const divCols = 1 / this.faceGridCols;
543
+ // const divRows = 1 / this.faceGridRows;
544
+ const { uvScalar, uvOffset, blendColor } = uniformValues || {};
545
+ this.faceGridsUniformses[faceIndex][gridIndex].uvScalar.value = uvScalar || new THREE.Vector2(1, 1);
546
+ this.faceGridsUniformses[faceIndex][gridIndex].uvOffset.value = uvOffset || new THREE.Vector2(0, 0);
547
+ this.faceGridsUniformses[faceIndex][gridIndex].blendColor.value = blendColor || new THREE.Vector4(0, 0, 0, 0);
548
+ // this.faceGridsUniformses[faceIndex][gridIndex].blendColor.value = new Vector4(dot, 0, 1 - dot, 0.5);// /!!!For Debug
549
+ // console.info(`#TiledCube# setFaceTexture (face, row, col)=(${faceIndex}, ${gridRow}, ${gridCol}):`, texture);
550
+ if (cacheKey) {
551
+ this.faceGridTextureCacheKeys[faceIndex][gridIndex] = cacheKey;
552
+ }
553
+ this.needsUpdate = true;
554
+ }
555
+ // /**
556
+ // * 异步加载立方体贴图
557
+ // * @param textureURLs 新的立方体贴图六面图像URL(如果需要更新的话)
558
+ // */
559
+ updateTexture(textureURLs) {
560
+ return __awaiter(this, void 0, void 0, function* () {
561
+ if (this.legacyMode) {
562
+ if (textureURLs) {
563
+ this.textureURLs = textureURLs;
564
+ }
565
+ const cubeTexture = yield CubeTextureCache.sharedInstance.loadCubeTexture(this.textureURLs);
566
+ this.setTexture(cubeTexture);
567
+ }
568
+ else {
569
+ for (let f = 0; f < 6; f++) {
570
+ for (let g = this.faceGridCols * this.faceGridRows - 1; g >= 0; g--) {
571
+ this.faceGridsStates[f][g] = 0;
572
+ }
573
+ }
574
+ if (textureURLs) {
575
+ this.highTextureURLs = textureURLs;
576
+ this.textureURLs = textureURLs;
577
+ }
578
+ }
579
+ this.needsUpdate = true;
580
+ });
581
+ }
582
+ /**
583
+ * @param hdFaceGrids [][faceIndex, row, col]
584
+ */
585
+ updateHDGridTextures(hdFaceGrids) {
586
+ return __awaiter(this, void 0, void 0, function* () {
587
+ if (this.useLowTextureURLsOnly) {
588
+ return [];
589
+ }
590
+ const { THREE } = Externals.getInstance();
591
+ if (this.tiledTextureURLRoot) {
592
+ // console.log('#TiledCube# updateHDGridTextures with tiles');
593
+ const faceName = ['r', 'l', 't', 'd', 'f', 'b'];
594
+ // const hdTextureURLs = hdFaceGrids.map((value: number[]) => this.highTextureURLs[value[0]]);
595
+ const hdTextureURLs = hdFaceGrids.map((value) => `${this.tiledTextureURLRoot}${this.seqID}_${faceName[value[0]]}_${value[1]}-${value[2]}`);
596
+ // console.info(`#TextureLeak# Panorama.updateHDGridTextures #${this.pid} Before hdFaceTexturesCache.preloadTextures()#1 ${hdFaceGrids.length} tiles, HD.totalCost=${TextureCache.hdFaceTexturesCache.getTotalCost()}`);
597
+ const hdTextures = yield TextureCache.hdFaceTexturesCache.preloadTextures(hdTextureURLs, hdFaceGrids.length);
598
+ // console.info(`#TextureLeak# Panorama.updateHDGridTextures #${this.pid} After hdFaceTexturesCache.preloadTextures()#1 ${hdFaceGrids.length} tiles, HD.totalCost=${TextureCache.hdFaceTexturesCache.getTotalCost()}`);
599
+ for (let i = hdFaceGrids.length - 1; i >= 0; i--) {
600
+ this.setFaceTexture(hdFaceGrids[i], hdTextures[i], undefined, hdTextureURLs[i]);
601
+ }
602
+ return hdTextures;
603
+ }
604
+ if (!this.highTextureURLs.length) {
605
+ return [];
606
+ }
607
+ const hdTextureURLs = hdFaceGrids.map((value) => `${this.highTextureURLs[value[0]]}`);
608
+ // console.log(`#TiledCube# hdTextureURLs[0]=${hdTextureURLs[0]}`);
609
+ // console.info(`#TextureLeak# Panorama.updateHDGridTextures #${this.pid} Before hdFaceTexturesCache.preloadTextures()#2 ${hdFaceGrids.length} tiles, HD.totalCost=${TextureCache.hdFaceTexturesCache.getTotalCost()}`);
610
+ const hdTextures = yield TextureCache.hdFaceTexturesCache.preloadTextures(hdTextureURLs, hdFaceGrids.length);
611
+ // console.info(`#TextureLeak# Panorama.updateHDGridTextures #${this.pid} After hdFaceTexturesCache.preloadTextures()#2 ${hdFaceGrids.length} tiles, HD.totalCost=${TextureCache.hdFaceTexturesCache.getTotalCost()}`);
612
+ const uvScalar = new THREE.Vector2(1.0 / this.faceGridCols, 1.0 / this.faceGridRows);
613
+ for (let i = hdFaceGrids.length - 1; i >= 0; i--) {
614
+ const uvOffset = new THREE.Vector2(uvScalar.x * hdFaceGrids[i][2], uvScalar.y * hdFaceGrids[i][1]);
615
+ this.setFaceTexture(hdFaceGrids[i], hdTextures[i], {
616
+ uvScalar,
617
+ uvOffset,
618
+ }, hdTextureURLs[i]);
619
+ }
620
+ return hdTextures;
621
+ });
622
+ }
623
+ updateLDGridTextures(ldFaceGrids) {
624
+ return __awaiter(this, void 0, void 0, function* () {
625
+ const { THREE } = Externals.getInstance();
626
+ // const ldTextureURLs = ldFaceGrids.map((value: number[]) => this.highTextureURLs[value[0]]);
627
+ const ldTextureURLs = ldFaceGrids.map((value) => `${this.textureURLs[value[0]]}`);
628
+ // console.info(`#TextureLeak# Panorama.updateLDGridTextures #${this.pid} Before ldFaceTexturesCache.preloadTextures()#1 ${ldFaceGrids.length} tiles, LD.totalCost=${TextureCache.ldFaceTexturesCache.getTotalCost()}`);
629
+ const ldTextures = yield TextureCache.ldFaceTexturesCache.preloadTextures(ldTextureURLs, ldFaceGrids.length);
630
+ // console.info(`#TextureLeak# Panorama.updateLDGridTextures #${this.pid} After ldFaceTexturesCache.preloadTextures()#1 ${ldFaceGrids.length} tiles, LD.totalCost=${TextureCache.ldFaceTexturesCache.getTotalCost()}`);
631
+ const uvScalar = new THREE.Vector2(1.0 / this.faceGridCols, 1.0 / this.faceGridRows);
632
+ for (let i = ldFaceGrids.length - 1; i >= 0; i--) {
633
+ const uvOffset = new THREE.Vector2(uvScalar.x * ldFaceGrids[i][2], uvScalar.y * ldFaceGrids[i][1]);
634
+ this.setFaceTexture(ldFaceGrids[i], ldTextures[i], {
635
+ uvScalar,
636
+ uvOffset,
637
+ }, ldTextureURLs[i]);
638
+ }
639
+ return ldTextures;
640
+ });
641
+ }
642
+ /**
643
+ * 异步加载天空盒贴图,优先从cache中获取
644
+ * @param textureURLs 新的天空盒贴图六面图像URL(如果需要更新的话)
645
+ */
646
+ updateFaceGridsTextures(hdFaceGrids, ldFaceGrids) {
647
+ return __awaiter(this, void 0, void 0, function* () {
648
+ if (!this.panoramaLoaded) {
649
+ this.emit(Events.WILL_LOAD_PANORAMA, this.pid);
650
+ }
651
+ const newHDFaceGrids = [];
652
+ hdFaceGrids.forEach((grid) => {
653
+ if (this.faceGridsStates[grid[0]][this.faceGridCols * grid[1] + grid[2]] !== 2) {
654
+ newHDFaceGrids.push(grid);
655
+ }
656
+ });
657
+ yield this.updateLDGridTextures(newHDFaceGrids);
658
+ const newLDFaceGrids = [];
659
+ ldFaceGrids.forEach((grid) => {
660
+ if (this.faceGridsStates[grid[0]][this.faceGridCols * grid[1] + grid[2]] !== 1) {
661
+ newLDFaceGrids.push(grid);
662
+ }
663
+ });
664
+ yield this.updateLDGridTextures(newLDFaceGrids);
665
+ // console.info('#TiledCube# LD faces updated:', ldFaceGrids);
666
+ for (let f = 0; f < 6; f++) {
667
+ for (let g = this.faceGridRows * this.faceGridCols - 1; g >= 0; g--) {
668
+ this.faceGridsStates[f][g] = 0;
669
+ }
670
+ }
671
+ hdFaceGrids.forEach((grid) => {
672
+ this.faceGridsStates[grid[0]][this.faceGridCols * grid[1] + grid[2]] = 2;
673
+ });
674
+ ldFaceGrids.forEach((grid) => {
675
+ this.faceGridsStates[grid[0]][this.faceGridCols * grid[1] + grid[2]] = 1;
676
+ });
677
+ this.updateHDGridTextures(newHDFaceGrids);
678
+ if (!this.panoramaLoaded) {
679
+ this.emit(Events.DID_LOAD_PANORAMA, this.pid);
680
+ }
681
+ this.panoramaLoaded = true;
682
+ });
683
+ }
684
+ // /**
685
+ // * 若立方体贴图还未加载过,则加载,否则无操作
686
+ // */
687
+ // public async loadTextureIfNecessary(): Promise<CubeTexture> {
688
+ // if (!this.uniforms.tCube.value) {
689
+ // return this.updateTexture();
690
+ // }
691
+ // return this.uniforms.tCube.value;
692
+ // }
693
+ // /**
694
+ // * 设置线框的显示隐藏
695
+ // * @param visible 是否显示线框,同时隐藏立方体贴图
696
+ // */
697
+ // public setFrameVisible(visible: boolean): void {
698
+ // this.wireFrame.visible = visible;
699
+ // this.skyBox.visible = !visible;
700
+ // this.needsUpdate = true;
701
+ // }
702
+ /**
703
+ * 设置是否只使用低分辨率贴图
704
+ * @param useLowTexturesOnly 是否只使用低分辨率贴图
705
+ */
706
+ setUseLowTexturesOnly(useLowTexturesOnly) {
707
+ this.useLowTextureURLsOnly = useLowTexturesOnly;
708
+ }
709
+ isUseLowTexturesOnly() {
710
+ return this.useLowTextureURLsOnly;
711
+ }
712
+ dispose() {
713
+ super.dispose();
714
+ // 销毁材质资源
715
+ // if (this.material) {
716
+ // this.material.dispose();
717
+ // }
718
+ // // 销毁天空盒实体资源
719
+ // if (this.skyBox.geometry) {
720
+ // this.skyBox.geometry.dispose();
721
+ // }
722
+ if (this.faceGridsMaterials) {
723
+ this.faceGridsMaterials.forEach((materials) => {
724
+ materials.forEach((material) => {
725
+ material.dispose();
726
+ });
727
+ });
728
+ }
729
+ if (this.skyBoxFaceGrids) {
730
+ this.skyBoxFaceGrids.forEach((meshes) => {
731
+ meshes.forEach((mesh) => {
732
+ if (mesh.geometry) {
733
+ mesh.geometry.dispose();
734
+ }
735
+ });
736
+ });
737
+ }
738
+ this.stopVideo();
739
+ if (this.eventListeners.onEnded)
740
+ this.eventListeners.onEnded = null;
741
+ if (this.sphereMesh && this.sphereMesh.material) {
742
+ this.sphereMesh.material.dispose();
743
+ }
744
+ this.initialized = false;
745
+ EventHub.off(OwllyEvents.ELEMENT_SELECTED, this.eventListeners.onPanoramaSelected);
746
+ }
747
+ /**
748
+ * @ignore
749
+ */
750
+ update() {
751
+ const frameContext = new ElementFrameContext(this);
752
+ if (!this.initialized) {
753
+ this.initialized = true;
754
+ frameContext.needUpdate = true;
755
+ }
756
+ else if (this.needsUpdate || this.isPlayingVideo) {
757
+ frameContext.needUpdate = true;
758
+ if (this.isPlayingVideo && this.videoCanvas && this.sphereMesh.material.map) {
759
+ this.sphereMesh.material.map.needsUpdate = true;
760
+ }
761
+ this.needsUpdate = false;
762
+ }
763
+ if (this.initialized && !this.parent) {
764
+ frameContext.shouldPlaceElement = true;
765
+ }
766
+ return frameContext;
767
+ }
768
+ /**
769
+ * 使用欧拉角模式设置矫正
770
+ * @param roll 横滚角, 坐标轴为x
771
+ * @param pitch 俯仰角, 坐标轴为y
772
+ * @param yaw 偏航角, 坐标轴为z
773
+ */
774
+ setAdditionalRotationInEuler(roll, pitch, yaw) {
775
+ const { THREE } = Externals.getInstance();
776
+ this.additionalQuaternion.setFromEuler(new THREE.Euler(roll, pitch, yaw));
777
+ const { x, y, z, w, } = this.baseQuaternion.clone().multiply(this.additionalQuaternion);
778
+ this.quaternion.set(x, y, z, w);
779
+ this.needsUpdate = true;
780
+ return this.additionalQuaternion.clone();
781
+ }
782
+ /**
783
+ * 使用四元数模式设置矫正
784
+ * @param x 四元数的x值
785
+ * @param y 四元数的y值
786
+ * @param z 四元数的y值
787
+ * @param w 四元数的w值
788
+ */
789
+ setAdditionalRotationInQuaternion(x, y, z, w) {
790
+ const { THREE } = Externals.getInstance();
791
+ this.additionalQuaternion.set(x, y, z, w);
792
+ const { x: tx, y: ty, z: tz, w: tw, } = this.baseQuaternion.clone().multiply(this.additionalQuaternion);
793
+ this.quaternion.set(tx, ty, tz, tw);
794
+ this.needsUpdate = true;
795
+ return new THREE.Euler().setFromQuaternion(this.additionalQuaternion);
796
+ }
797
+ /**
798
+ * 配置全景图在不同view中的显示状态
799
+ * @param configuration 全景图配置
800
+ */
801
+ addViewConfiguration(configuration) {
802
+ const prevConfig = this.viewConfigurations.get(configuration.targetView);
803
+ const conf = Object.assign(Object.assign({}, prevConfig), configuration);
804
+ this.viewConfigurations.set(configuration.targetView, conf);
805
+ this.needsUpdate = true;
806
+ // /!!!#Async#
807
+ // if (applyImmediately === true) {
808
+ // this.renderingViewChanged(configuration.targetView);
809
+ // }
810
+ }
811
+ }
812
+ export { Panorama };
813
+ //# sourceMappingURL=panorama.js.map