@aibee/owlly 1.0.25 → 1.0.29
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.
- package/lib/external/lines/line-geometry.d.ts +9 -0
- package/lib/external/lines/line-geometry.js +51 -0
- package/lib/external/lines/line-material.d.ts +10 -0
- package/lib/external/lines/line-material.js +376 -0
- package/lib/external/lines/line-segments-2.d.ts +7 -0
- package/lib/external/lines/line-segments-2.js +143 -0
- package/lib/external/lines/line-segments-geometry.d.ts +15 -0
- package/lib/external/lines/line-segments-geometry.js +140 -0
- package/lib/external/loaders/gltf-loader.d.ts +77 -0
- package/lib/external/loaders/gltf-loader.js +2318 -0
- package/lib/external/orbit-controls.d.ts +44 -0
- package/lib/external/orbit-controls.js +745 -0
- package/lib/external/renderers/css-2d-renderer.d.ts +16 -0
- package/lib/external/renderers/css-2d-renderer.js +121 -0
- package/lib/external/renderers/css-3d-renderer.d.ts +18 -0
- package/lib/external/renderers/css-3d-renderer.js +138 -0
- package/lib/external/transform-controls.d.ts +106 -0
- package/lib/external/transform-controls.js +1112 -0
- package/lib/owlly/controller/aerial-element-controller.d.ts +65 -0
- package/lib/owlly/controller/aerial-element-controller.js +235 -0
- package/lib/owlly/controller/basic-controller.d.ts +324 -0
- package/lib/owlly/controller/basic-controller.js +1238 -0
- package/lib/owlly/controller/camera-controller.d.ts +37 -0
- package/lib/owlly/controller/camera-controller.js +137 -0
- package/lib/owlly/controller/controller.d.ts +61 -0
- package/lib/owlly/controller/controller.js +23 -0
- package/lib/owlly/controller/index.d.ts +2 -0
- package/lib/owlly/controller/index.js +13 -0
- package/lib/owlly/controller/mouse-indicator-controller.d.ts +34 -0
- package/lib/owlly/controller/mouse-indicator-controller.js +118 -0
- package/lib/owlly/controller/orbit-control.d.ts +147 -0
- package/lib/owlly/controller/orbit-control.js +264 -0
- package/lib/owlly/controller/panorama-adjust-controller.d.ts +45 -0
- package/lib/owlly/controller/panorama-adjust-controller.js +157 -0
- package/lib/owlly/controller/panorama-controller.d.ts +441 -0
- package/lib/owlly/controller/panorama-controller.js +1943 -0
- package/lib/owlly/controller/panorama-transform-controller.d.ts +66 -0
- package/lib/owlly/controller/panorama-transform-controller.js +136 -0
- package/lib/owlly/controller/plane-controller.d.ts +43 -0
- package/lib/owlly/controller/plane-controller.js +173 -0
- package/lib/owlly/controller/texture-controller.d.ts +181 -0
- package/lib/owlly/controller/texture-controller.js +875 -0
- package/lib/owlly/controller/tile-panorama-controller.d.ts +308 -0
- package/lib/owlly/controller/tile-panorama-controller.js +1353 -0
- package/lib/owlly/controller/transform-controller.d.ts +106 -0
- package/lib/owlly/controller/transform-controller.js +545 -0
- package/lib/owlly/element/bottom-nav-element.d.ts +65 -0
- package/lib/owlly/element/bottom-nav-element.js +257 -0
- package/lib/owlly/element/camera.d.ts +82 -0
- package/lib/owlly/element/camera.js +283 -0
- package/lib/owlly/element/dom-2d-element.d.ts +35 -0
- package/lib/owlly/element/dom-2d-element.js +48 -0
- package/lib/owlly/element/dom-3d-element.d.ts +27 -0
- package/lib/owlly/element/dom-3d-element.js +33 -0
- package/lib/owlly/element/dom-label-2d.d.ts +116 -0
- package/lib/owlly/element/dom-label-2d.js +382 -0
- package/lib/owlly/element/element.d.ts +53 -0
- package/lib/owlly/element/element.js +75 -0
- package/lib/owlly/element/floor-model.d.ts +83 -0
- package/lib/owlly/element/floor-model.js +227 -0
- package/lib/owlly/element/gif-kit/Gif.d.ts +96 -0
- package/lib/owlly/element/gif-kit/Gif.js +432 -0
- package/lib/owlly/element/gif-kit/GifColor.d.ts +21 -0
- package/lib/owlly/element/gif-kit/GifColor.js +37 -0
- package/lib/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
- package/lib/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.js +50 -0
- package/lib/owlly/element/gif-kit/GifFrame.d.ts +31 -0
- package/lib/owlly/element/gif-kit/GifFrame.js +96 -0
- package/lib/owlly/element/gif-kit/GifImage.d.ts +23 -0
- package/lib/owlly/element/gif-kit/GifImage.js +7 -0
- package/lib/owlly/element/gif-kit/GifParser.d.ts +17 -0
- package/lib/owlly/element/gif-kit/GifParser.js +196 -0
- package/lib/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
- package/lib/owlly/element/gif-kit/GifPresenter.js +43 -0
- package/lib/owlly/element/gif-kit/GifVersion.d.ts +10 -0
- package/lib/owlly/element/gif-kit/GifVersion.js +12 -0
- package/lib/owlly/element/gltf-mesh-element.d.ts +31 -0
- package/lib/owlly/element/gltf-mesh-element.js +136 -0
- package/lib/owlly/element/index.d.ts +20 -0
- package/lib/owlly/element/index.js +24 -0
- package/lib/owlly/element/map-kit/shape.d.ts +131 -0
- package/lib/owlly/element/map-kit/shape.js +189 -0
- package/lib/owlly/element/mesh-element.d.ts +22 -0
- package/lib/owlly/element/mesh-element.js +63 -0
- package/lib/owlly/element/mesh-line-2d.d.ts +82 -0
- package/lib/owlly/element/mesh-line-2d.js +887 -0
- package/lib/owlly/element/meshline-o.d.ts +64 -0
- package/lib/owlly/element/meshline-o.js +678 -0
- package/lib/owlly/element/panorama-group.d.ts +241 -0
- package/lib/owlly/element/panorama-group.js +966 -0
- package/lib/owlly/element/panorama.d.ts +132 -0
- package/lib/owlly/element/panorama.js +812 -0
- package/lib/owlly/element/path-group.d.ts +69 -0
- package/lib/owlly/element/path-group.js +171 -0
- package/lib/owlly/element/path.d.ts +99 -0
- package/lib/owlly/element/path.js +531 -0
- package/lib/owlly/element/placeable-2d.d.ts +158 -0
- package/lib/owlly/element/placeable-2d.js +470 -0
- package/lib/owlly/element/polygon-mesh.d.ts +107 -0
- package/lib/owlly/element/polygon-mesh.js +307 -0
- package/lib/owlly/element/ring-element.d.ts +79 -0
- package/lib/owlly/element/ring-element.js +383 -0
- package/lib/owlly/element/sphere-mesh.d.ts +28 -0
- package/lib/owlly/element/sphere-mesh.js +69 -0
- package/lib/owlly/element/svg-floor-model.d.ts +22 -0
- package/lib/owlly/element/svg-floor-model.js +184 -0
- package/lib/owlly/element/svg-floors.d.ts +27 -0
- package/lib/owlly/element/svg-floors.js +109 -0
- package/lib/owlly/element/tile-panorama-group.d.ts +335 -0
- package/lib/owlly/element/tile-panorama-group.js +1006 -0
- package/lib/owlly/element/tile-panorama.d.ts +161 -0
- package/lib/owlly/element/tile-panorama.js +509 -0
- package/lib/owlly/element/tile-plane.d.ts +105 -0
- package/lib/owlly/element/tile-plane.js +360 -0
- package/lib/owlly/element/video-element.d.ts +33 -0
- package/lib/owlly/element/video-element.js +159 -0
- package/lib/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
- package/lib/owlly/geometries/ExtrudeGeometry2.js +210 -0
- package/lib/owlly/index.d.ts +13 -0
- package/lib/owlly/index.js +16 -0
- package/lib/owlly/overlay/canvas-overlay.d.ts +96 -0
- package/lib/owlly/overlay/canvas-overlay.js +510 -0
- package/lib/owlly/overlay/css-2d-overlay.d.ts +14 -0
- package/lib/owlly/overlay/css-2d-overlay.js +35 -0
- package/lib/owlly/overlay/css-3d-overlay.d.ts +16 -0
- package/lib/owlly/overlay/css-3d-overlay.js +36 -0
- package/lib/owlly/overlay/index.d.ts +6 -0
- package/lib/owlly/overlay/index.js +11 -0
- package/lib/owlly/overlay/label-overlay.d.ts +62 -0
- package/lib/owlly/overlay/label-overlay.js +328 -0
- package/lib/owlly/overlay/overlay.d.ts +14 -0
- package/lib/owlly/overlay/overlay.js +4 -0
- package/lib/owlly/overlay/path-overlay.d.ts +39 -0
- package/lib/owlly/overlay/path-overlay.js +124 -0
- package/lib/owlly/overlay/path-overlay2.d.ts +35 -0
- package/lib/owlly/overlay/path-overlay2.js +118 -0
- package/lib/owlly/overlay/poi-overlay-3d.d.ts +278 -0
- package/lib/owlly/overlay/poi-overlay-3d.js +1432 -0
- package/lib/owlly/overlay/poi-overlay.d.ts +277 -0
- package/lib/owlly/overlay/poi-overlay.js +1411 -0
- package/lib/owlly/owlly-2d/index.d.ts +28 -0
- package/lib/owlly/owlly-2d/index.js +92 -0
- package/lib/owlly/screen/index.d.ts +1 -0
- package/lib/owlly/screen/index.js +1 -0
- package/lib/owlly/screen/screen.d.ts +73 -0
- package/lib/owlly/screen/screen.js +236 -0
- package/lib/owlly/stage/externals.d.ts +19 -0
- package/lib/owlly/stage/externals.js +24 -0
- package/lib/owlly/stage/index.d.ts +4 -0
- package/lib/owlly/stage/index.js +6 -0
- package/lib/owlly/stage/owlly.d.ts +38 -0
- package/lib/owlly/stage/owlly.js +168 -0
- package/lib/owlly/stage/stage.d.ts +108 -0
- package/lib/owlly/stage/stage.js +234 -0
- package/lib/owlly/utils/alignment-utils.d.ts +20 -0
- package/lib/owlly/utils/alignment-utils.js +63 -0
- package/lib/owlly/utils/basic-calc.d.ts +18 -0
- package/lib/owlly/utils/basic-calc.js +129 -0
- package/lib/owlly/utils/basic-tools.d.ts +71 -0
- package/lib/owlly/utils/basic-tools.js +235 -0
- package/lib/owlly/utils/bvh-tree.d.ts +105 -0
- package/lib/owlly/utils/bvh-tree.js +539 -0
- package/lib/owlly/utils/camera.d.ts +37 -0
- package/lib/owlly/utils/camera.js +50 -0
- package/lib/owlly/utils/cube-texture-cache.d.ts +25 -0
- package/lib/owlly/utils/cube-texture-cache.js +143 -0
- package/lib/owlly/utils/device-utils.d.ts +18 -0
- package/lib/owlly/utils/device-utils.js +41 -0
- package/lib/owlly/utils/environment-utils.d.ts +37 -0
- package/lib/owlly/utils/environment-utils.js +73 -0
- package/lib/owlly/utils/event-hub.d.ts +50 -0
- package/lib/owlly/utils/event-hub.js +106 -0
- package/lib/owlly/utils/events.d.ts +219 -0
- package/lib/owlly/utils/events.js +219 -0
- package/lib/owlly/utils/geometry-utils.d.ts +119 -0
- package/lib/owlly/utils/geometry-utils.js +622 -0
- package/lib/owlly/utils/helper.d.ts +6 -0
- package/lib/owlly/utils/helper.js +24 -0
- package/lib/owlly/utils/index.d.ts +14 -0
- package/lib/owlly/utils/index.js +17 -0
- package/lib/owlly/utils/lru-cache.d.ts +26 -0
- package/lib/owlly/utils/lru-cache.js +109 -0
- package/lib/owlly/utils/map-utils.d.ts +7 -0
- package/lib/owlly/utils/map-utils.js +52 -0
- package/lib/owlly/utils/number-utils.d.ts +8 -0
- package/lib/owlly/utils/number-utils.js +72 -0
- package/lib/owlly/utils/panorama-model-util.d.ts +46 -0
- package/lib/owlly/utils/panorama-model-util.js +245 -0
- package/lib/owlly/utils/path-utils.d.ts +80 -0
- package/lib/owlly/utils/path-utils.js +728 -0
- package/lib/owlly/utils/svgutils.d.ts +138 -0
- package/lib/owlly/utils/svgutils.js +561 -0
- package/lib/owlly/utils/texture-cache.d.ts +29 -0
- package/lib/owlly/utils/texture-cache.js +115 -0
- package/lib/owlly/utils/tile-util.d.ts +187 -0
- package/lib/owlly/utils/tile-util.js +456 -0
- package/lib/owlly/utils/time-profiler.d.ts +21 -0
- package/lib/owlly/utils/time-profiler.js +48 -0
- package/lib/owlly/view/camera-view.d.ts +35 -0
- package/lib/owlly/view/camera-view.js +101 -0
- package/lib/owlly/view/index.d.ts +3 -0
- package/lib/owlly/view/index.js +5 -0
- package/lib/owlly/view/orthographic-view.d.ts +40 -0
- package/lib/owlly/view/orthographic-view.js +94 -0
- package/lib/owlly/view/perspective-view.d.ts +40 -0
- package/lib/owlly/view/perspective-view.js +95 -0
- package/lib/owlly/view/svg-map-view.d.ts +46 -0
- package/lib/owlly/view/svg-map-view.js +144 -0
- package/lib/owlly/view/view.d.ts +146 -0
- package/lib/owlly/view/view.js +317 -0
- package/lib/prod/owlly.esm.js +93462 -0
- package/lib/prod/owlly.esm.js.map +1 -0
- package/lib/prod/owlly.esm.min.js +54 -0
- package/lib/prod/owlly.iife.js +93560 -0
- package/lib/prod/owlly.iife.js.map +1 -0
- package/lib/prod/owlly.iife.min.js +69 -0
- package/lib/prod/owlly.miniapp.js +73845 -0
- package/lib/prod/owlly.miniapp.js.map +1 -0
- package/lib/prod/owlly.miniapp.min.js +63 -0
- package/lib/prod/src/external/lines/line-geometry.d.ts +9 -0
- package/lib/prod/src/external/lines/line-material.d.ts +10 -0
- package/lib/prod/src/external/lines/line-segments-2.d.ts +7 -0
- package/lib/prod/src/external/lines/line-segments-geometry.d.ts +15 -0
- package/lib/prod/src/external/loaders/gltf-loader.d.ts +77 -0
- package/lib/prod/src/external/orbit-controls.d.ts +44 -0
- package/lib/prod/src/external/renderers/css-2d-renderer.d.ts +16 -0
- package/lib/prod/src/external/renderers/css-3d-renderer.d.ts +18 -0
- package/lib/prod/src/external/transform-controls.d.ts +106 -0
- package/lib/prod/src/external/util/buffer-geometry-utils.d.ts +45 -0
- package/lib/prod/src/owlly/controller/aerial-element-controller.d.ts +65 -0
- package/lib/prod/src/owlly/controller/basic-controller.d.ts +324 -0
- package/lib/prod/src/owlly/controller/camera-controller.d.ts +37 -0
- package/lib/prod/src/owlly/controller/controller.d.ts +61 -0
- package/lib/prod/src/owlly/controller/index.d.ts +2 -0
- package/lib/prod/src/owlly/controller/mouse-indicator-controller.d.ts +34 -0
- package/lib/prod/src/owlly/controller/orbit-control.d.ts +147 -0
- package/lib/prod/src/owlly/controller/panorama-adjust-controller.d.ts +45 -0
- package/lib/prod/src/owlly/controller/panorama-controller.d.ts +441 -0
- package/lib/prod/src/owlly/controller/panorama-transform-controller.d.ts +66 -0
- package/lib/prod/src/owlly/controller/plane-controller.d.ts +43 -0
- package/lib/prod/src/owlly/controller/texture-controller.d.ts +183 -0
- package/lib/prod/src/owlly/controller/tile-panorama-controller.d.ts +308 -0
- package/lib/prod/src/owlly/controller/transform-controller.d.ts +106 -0
- package/lib/prod/src/owlly/element/bottom-nav-element.d.ts +65 -0
- package/lib/prod/src/owlly/element/camera.d.ts +82 -0
- package/lib/prod/src/owlly/element/dom-2d-element.d.ts +35 -0
- package/lib/prod/src/owlly/element/dom-3d-element.d.ts +27 -0
- package/lib/prod/src/owlly/element/dom-label-2d.d.ts +116 -0
- package/lib/prod/src/owlly/element/element.d.ts +53 -0
- package/lib/prod/src/owlly/element/floor-model.d.ts +83 -0
- package/lib/prod/src/owlly/element/gif-kit/Gif.d.ts +96 -0
- package/lib/prod/src/owlly/element/gif-kit/GifColor.d.ts +21 -0
- package/lib/prod/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
- package/lib/prod/src/owlly/element/gif-kit/GifFrame.d.ts +31 -0
- package/lib/prod/src/owlly/element/gif-kit/GifImage.d.ts +23 -0
- package/lib/prod/src/owlly/element/gif-kit/GifParser.d.ts +17 -0
- package/lib/prod/src/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
- package/lib/prod/src/owlly/element/gif-kit/GifVersion.d.ts +10 -0
- package/lib/prod/src/owlly/element/gltf-mesh-element.d.ts +31 -0
- package/lib/prod/src/owlly/element/index.d.ts +6 -0
- package/lib/prod/src/owlly/element/map-kit/area.d.ts +24 -0
- package/lib/prod/src/owlly/element/map-kit/block-set.d.ts +39 -0
- package/lib/prod/src/owlly/element/map-kit/block.d.ts +77 -0
- package/lib/prod/src/owlly/element/map-kit/index.d.ts +3 -0
- package/lib/prod/src/owlly/element/map-kit/shape.d.ts +131 -0
- package/lib/prod/src/owlly/element/mesh-element.d.ts +22 -0
- package/lib/prod/src/owlly/element/mesh-line-2d.d.ts +82 -0
- package/lib/prod/src/owlly/element/meshline-o.d.ts +64 -0
- package/lib/prod/src/owlly/element/panorama-group.d.ts +241 -0
- package/lib/prod/src/owlly/element/panorama.d.ts +132 -0
- package/lib/prod/src/owlly/element/path-group.d.ts +69 -0
- package/lib/prod/src/owlly/element/path.d.ts +99 -0
- package/lib/prod/src/owlly/element/placeable-2d.d.ts +158 -0
- package/lib/prod/src/owlly/element/polygon-mesh.d.ts +107 -0
- package/lib/prod/src/owlly/element/ring-element.d.ts +79 -0
- package/lib/prod/src/owlly/element/sphere-mesh.d.ts +28 -0
- package/lib/prod/src/owlly/element/svg-floor-model.d.ts +22 -0
- package/lib/prod/src/owlly/element/svg-floors.d.ts +27 -0
- package/lib/prod/src/owlly/element/tile-panorama-group.d.ts +335 -0
- package/lib/prod/src/owlly/element/tile-panorama.d.ts +162 -0
- package/lib/prod/src/owlly/element/tile-plane.d.ts +114 -0
- package/lib/prod/src/owlly/element/video-element.d.ts +33 -0
- package/lib/prod/src/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
- package/lib/prod/src/owlly/index.d.ts +13 -0
- package/lib/prod/src/owlly/overlay/canvas-overlay.d.ts +96 -0
- package/lib/prod/src/owlly/overlay/css-2d-overlay.d.ts +14 -0
- package/lib/prod/src/owlly/overlay/css-3d-overlay.d.ts +16 -0
- package/lib/prod/src/owlly/overlay/index.d.ts +5 -0
- package/lib/prod/src/owlly/overlay/label-overlay.d.ts +62 -0
- package/lib/prod/src/owlly/overlay/overlay.d.ts +14 -0
- package/lib/prod/src/owlly/overlay/path-overlay.d.ts +39 -0
- package/lib/prod/src/owlly/overlay/path-overlay2.d.ts +35 -0
- package/lib/prod/src/owlly/overlay/poi-overlay-3d.d.ts +278 -0
- package/lib/prod/src/owlly/overlay/poi-overlay.d.ts +277 -0
- package/lib/prod/src/owlly/owlly-2d/index.d.ts +28 -0
- package/lib/prod/src/owlly/screen/index.d.ts +1 -0
- package/lib/prod/src/owlly/screen/screen.d.ts +73 -0
- package/lib/prod/src/owlly/stage/__test__/stage.spec.d.ts +1 -0
- package/lib/prod/src/owlly/stage/externals.d.ts +19 -0
- package/lib/prod/src/owlly/stage/index.d.ts +3 -0
- package/lib/prod/src/owlly/stage/owlly.d.ts +38 -0
- package/lib/prod/src/owlly/stage/stage.d.ts +108 -0
- package/lib/prod/src/owlly/utils/alignment-utils.d.ts +20 -0
- package/lib/prod/src/owlly/utils/basic-calc.d.ts +18 -0
- package/lib/prod/src/owlly/utils/basic-tools.d.ts +71 -0
- package/lib/prod/src/owlly/utils/bvh-tree.d.ts +105 -0
- package/lib/prod/src/owlly/utils/camera.d.ts +37 -0
- package/lib/prod/src/owlly/utils/cube-texture-cache.d.ts +25 -0
- package/lib/prod/src/owlly/utils/device-utils.d.ts +18 -0
- package/lib/prod/src/owlly/utils/environment-utils.d.ts +37 -0
- package/lib/prod/src/owlly/utils/event-hub.d.ts +50 -0
- package/lib/prod/src/owlly/utils/events.d.ts +219 -0
- package/lib/prod/src/owlly/utils/geometry-utils.d.ts +119 -0
- package/lib/prod/src/owlly/utils/helper.d.ts +6 -0
- package/lib/prod/src/owlly/utils/index.d.ts +13 -0
- package/lib/prod/src/owlly/utils/lru-cache.d.ts +26 -0
- package/lib/prod/src/owlly/utils/map-utils.d.ts +7 -0
- package/lib/prod/src/owlly/utils/number-utils.d.ts +8 -0
- package/lib/prod/src/owlly/utils/panorama-model-util.d.ts +46 -0
- package/lib/prod/src/owlly/utils/path-utils.d.ts +80 -0
- package/lib/prod/src/owlly/utils/svgutils.d.ts +138 -0
- package/lib/prod/src/owlly/utils/texture-cache.d.ts +29 -0
- package/lib/prod/src/owlly/utils/tile-util.d.ts +187 -0
- package/lib/prod/src/owlly/utils/time-profiler.d.ts +21 -0
- package/lib/prod/src/owlly/view/__test__/perspective-view.spec.d.ts +0 -0
- package/lib/prod/src/owlly/view/camera-view.d.ts +35 -0
- package/lib/prod/src/owlly/view/index.d.ts +3 -0
- package/lib/prod/src/owlly/view/orthographic-view.d.ts +40 -0
- package/lib/prod/src/owlly/view/perspective-view.d.ts +40 -0
- package/lib/prod/src/owlly/view/svg-map-view.d.ts +46 -0
- package/lib/prod/src/owlly/view/view.d.ts +146 -0
- package/lib/src/owlly/controller/texture-controller.d.ts +3 -1
- package/lib/src/owlly/controller/texture-controller.js +16 -1
- package/lib/src/owlly/controller/texture-controller.js.map +1 -1
- package/lib/src/owlly/controller/tile-panorama-controller.js +4 -0
- package/lib/src/owlly/controller/tile-panorama-controller.js.map +1 -1
- package/lib/src/owlly/element/tile-panorama.d.ts +1 -0
- package/lib/src/owlly/element/tile-panorama.js +16 -3
- package/lib/src/owlly/element/tile-panorama.js.map +1 -1
- package/lib/src/owlly/element/tile-plane.d.ts +9 -0
- package/lib/src/owlly/element/tile-plane.js +27 -0
- package/lib/src/owlly/element/tile-plane.js.map +1 -1
- package/lib/src/owlly/overlay/poi-overlay-3d.js.map +1 -1
- package/lib/src/owlly/overlay/poi-overlay.js.map +1 -1
- package/lib/src/owlly/stage/owlly.js +7 -1
- package/lib/src/owlly/stage/owlly.js.map +1 -1
- package/lib/src/owlly/stage/stage.js +2 -0
- package/lib/src/owlly/stage/stage.js.map +1 -1
- package/lib/src/web/main.rpeng.mes.plane.js.map +1 -1
- package/package.json +16 -7
- package/src/owlly/controller/texture-controller.ts +18 -1
- package/src/owlly/controller/tile-panorama-controller.ts +3 -1
- package/src/owlly/element/tile-panorama.ts +14 -0
- package/src/owlly/element/tile-plane.ts +26 -0
- package/src/owlly/overlay/poi-overlay-3d.ts +0 -4
- package/src/owlly/overlay/poi-overlay.ts +0 -4
- package/src/owlly/stage/owlly.ts +6 -1
- package/src/owlly/stage/stage.ts +2 -0
- package/src/web/main.rpeng.mes.plane.ts +0 -6
|
@@ -0,0 +1,812 @@
|
|
|
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 };
|