@aibee/owlly 1.0.26 → 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,1353 @@
|
|
|
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 TWEEN from '@tweenjs/tween.js';
|
|
11
|
+
import { Externals } from '../stage/externals';
|
|
12
|
+
import { Controller, Events, FloorModel, } from '..';
|
|
13
|
+
import { TextureController, TextureEventEnum } from './texture-controller';
|
|
14
|
+
import { TileUtil } from '../utils/tile-util';
|
|
15
|
+
import { TilePanoramaGroup } from '../element/tile-panorama-group';
|
|
16
|
+
import { CubeTextureCache } from '../utils/cube-texture-cache';
|
|
17
|
+
import { TextureCache } from '../utils/texture-cache';
|
|
18
|
+
import { PanoramaModelUtil } from '../utils/panorama-model-util';
|
|
19
|
+
import { OwllyEvents } from '../utils/events';
|
|
20
|
+
class TilePanoramaController extends Controller {
|
|
21
|
+
/**
|
|
22
|
+
* 构造
|
|
23
|
+
* @param view 视图
|
|
24
|
+
* @param panoramaGroup 全景组
|
|
25
|
+
* @param basicController 基础控制器
|
|
26
|
+
* @param showModel 是否显示模型
|
|
27
|
+
*/
|
|
28
|
+
constructor(view, panoramaGroup, basicController, showModel) {
|
|
29
|
+
super();
|
|
30
|
+
this.levels = [1, 1.5, 3];
|
|
31
|
+
/** 最大等级控制 */
|
|
32
|
+
this.levelMax = 2;
|
|
33
|
+
const { THREE } = Externals.getInstance();
|
|
34
|
+
this.planeMap = new Map();
|
|
35
|
+
this.showModel = showModel === undefined || showModel;
|
|
36
|
+
this.levelMap = new Map();
|
|
37
|
+
this.isAnimating = false;
|
|
38
|
+
this.touches = {
|
|
39
|
+
s: [new THREE.Vector2(), new THREE.Vector2()],
|
|
40
|
+
c: [new THREE.Vector2(), new THREE.Vector2()],
|
|
41
|
+
state: 'idle',
|
|
42
|
+
dist: 0,
|
|
43
|
+
fov: 60,
|
|
44
|
+
};
|
|
45
|
+
if (panoramaGroup) {
|
|
46
|
+
if (panoramaGroup instanceof TilePanoramaGroup) {
|
|
47
|
+
this.panoramaGroups = [panoramaGroup];
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.panoramaGroups = panoramaGroup;
|
|
51
|
+
}
|
|
52
|
+
if (this.panoramaGroups.length > 0) {
|
|
53
|
+
this.curPanoramaGroup = this.panoramaGroups[0];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (basicController) {
|
|
57
|
+
this.basicController = basicController;
|
|
58
|
+
}
|
|
59
|
+
this.pid2GroupMap = new Map();
|
|
60
|
+
this.eventListeners = {
|
|
61
|
+
onTextureUpdate: (updates, deletes) => {
|
|
62
|
+
this.updatePanoramaTextureInfos(updates, deletes);
|
|
63
|
+
},
|
|
64
|
+
onMouseDown: (e) => { this.onMouseDown(e); },
|
|
65
|
+
onMouseMove: (e) => { this.onMouseMove(e); },
|
|
66
|
+
onMouseUp: (e) => { this.onMouseUp(e); },
|
|
67
|
+
onMouseWheel: (e) => { this.onMouseWheel(e); },
|
|
68
|
+
onTouchStart: (e) => { this.onTouchStart(e); },
|
|
69
|
+
onTouchMove: (e) => { this.onTouchMove(e); },
|
|
70
|
+
onTouchEnd: (e) => { this.onTouchEnd(e); },
|
|
71
|
+
};
|
|
72
|
+
if (view) {
|
|
73
|
+
this.bindView(view);
|
|
74
|
+
}
|
|
75
|
+
this.raycaster = new THREE.Raycaster();
|
|
76
|
+
this.onScreenDetectRadius = 1000;
|
|
77
|
+
this.moveOnClick = true;
|
|
78
|
+
this.handlePanoramaUpdate = TileUtil.throttle((tview) => { this.updatePlaneInCamera(tview); }, 100);
|
|
79
|
+
this.handlePanoramaLevel = TileUtil.throttle(() => { this.updateLevel(); }, 200);
|
|
80
|
+
TextureController.instance.on(TextureEventEnum.TEXTURE_UPDATE, this.eventListeners.onTextureUpdate);
|
|
81
|
+
const modelVisible = (undefined === showModel ? this.showModel : showModel === true);
|
|
82
|
+
this.panoramaGroups.forEach((panoGroup) => {
|
|
83
|
+
const modelMesh = TilePanoramaController.getModelMesh(panoGroup);
|
|
84
|
+
this.setModelAppearance(panoGroup.modelElement, modelVisible, undefined, modelMesh);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 设置是否激活可用
|
|
89
|
+
* @param enabled 是否激活
|
|
90
|
+
*/
|
|
91
|
+
setEnabled(enabled) {
|
|
92
|
+
if (enabled === this.enabled)
|
|
93
|
+
return;
|
|
94
|
+
this.enabled = enabled;
|
|
95
|
+
if (enabled) {
|
|
96
|
+
this.registerEvents();
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.unregisterEvents();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
registerEvents() {
|
|
103
|
+
if (!this.view)
|
|
104
|
+
return;
|
|
105
|
+
this.view.on(OwllyEvents.MOUSE_DOWN, this.eventListeners.onMouseDown);
|
|
106
|
+
this.view.on(OwllyEvents.MOUSE_MOVE, this.eventListeners.onMouseMove);
|
|
107
|
+
this.view.on(OwllyEvents.MOUSE_UP, this.eventListeners.onMouseUp);
|
|
108
|
+
this.view.on(OwllyEvents.MOUSE_WHEEL, this.eventListeners.onMouseWheel);
|
|
109
|
+
this.view.on(OwllyEvents.TOUCH_START, this.eventListeners.onTouchStart);
|
|
110
|
+
this.view.on(OwllyEvents.TOUCH_MOVE, this.eventListeners.onTouchMove);
|
|
111
|
+
this.view.on(OwllyEvents.TOUCH_END, this.eventListeners.onTouchEnd);
|
|
112
|
+
}
|
|
113
|
+
unregisterEvents() {
|
|
114
|
+
if (!this.view)
|
|
115
|
+
return;
|
|
116
|
+
this.view.off(OwllyEvents.MOUSE_DOWN, this.eventListeners.onMouseDown);
|
|
117
|
+
this.view.off(OwllyEvents.MOUSE_MOVE, this.eventListeners.onMouseMove);
|
|
118
|
+
this.view.off(OwllyEvents.MOUSE_UP, this.eventListeners.onMouseUp);
|
|
119
|
+
this.view.off(OwllyEvents.MOUSE_WHEEL, this.eventListeners.onMouseWheel);
|
|
120
|
+
this.view.off(OwllyEvents.TOUCH_START, this.eventListeners.onTouchStart);
|
|
121
|
+
this.view.off(OwllyEvents.TOUCH_MOVE, this.eventListeners.onTouchMove);
|
|
122
|
+
this.view.off(OwllyEvents.TOUCH_END, this.eventListeners.onTouchEnd);
|
|
123
|
+
}
|
|
124
|
+
onMouseDown(event) {
|
|
125
|
+
const { THREE } = Externals.getInstance();
|
|
126
|
+
// this.mouseMovement = new THREE.Vector2(event.movementX, event.movementY).length();
|
|
127
|
+
this.touches.s[0] = new THREE.Vector2(event.clientX, event.clientY);
|
|
128
|
+
this.touches.state = 'down';
|
|
129
|
+
}
|
|
130
|
+
onMouseMove(event) {
|
|
131
|
+
// this.mouseMovement += new THREE.Vector2(event.movementX, event.movementY).length();
|
|
132
|
+
const { THREE } = Externals.getInstance();
|
|
133
|
+
this.touches.c[0] = new THREE.Vector2(event.clientX, event.clientY);
|
|
134
|
+
if (this.touches.state === 'down' && this.touches.c[0].distanceToSquared(this.touches.s[0]) > 100) {
|
|
135
|
+
this.touches.state = 'move';
|
|
136
|
+
}
|
|
137
|
+
if (this.raycaster && this.captureMove) {
|
|
138
|
+
const { clientWidth, clientHeight } = this.view.container;
|
|
139
|
+
const { left: rectX, top: rectY } = this.view.container.getBoundingClientRect();
|
|
140
|
+
const x = event.clientX - rectX;
|
|
141
|
+
const y = event.clientY - rectY;
|
|
142
|
+
this.raycaster.setFromCamera({ x, y }, this.view.camera);
|
|
143
|
+
if (this.curPanoramaGroup) {
|
|
144
|
+
let toPID;
|
|
145
|
+
if (this.onScreenDetectRadius > 0 && this.view.camera) {
|
|
146
|
+
toPID = this.curPanoramaGroup.intersectIndicatorsOnScreen(new THREE.Vector2(x, y), this.onScreenDetectRadius, { screenWidth: clientWidth, screenHeight: clientHeight }, this.view.camera);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
toPID = this.curPanoramaGroup.intersectIndicators(this.raycaster.ray.origin, this.raycaster.ray.direction);
|
|
150
|
+
}
|
|
151
|
+
if (toPID > -1) {
|
|
152
|
+
this.emit(Events.PANORAMA_HOVER, toPID, this.curPanoramaGroup.getIndicatorPosition(toPID));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (this.touches.state === 'move') {
|
|
157
|
+
this.onMouseDrag();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
onMouseUp(event) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
const { THREE } = Externals.getInstance();
|
|
163
|
+
if (this.touches.state === 'down') {
|
|
164
|
+
const { clientWidth, clientHeight } = this.view.container;
|
|
165
|
+
const { left: rectX, top: rectY } = this.view.container.getBoundingClientRect();
|
|
166
|
+
const x = event.clientX - rectX;
|
|
167
|
+
const y = event.clientY - rectY;
|
|
168
|
+
if (this.raycaster) {
|
|
169
|
+
this.raycaster.setFromCamera({ x, y }, this.view.camera);
|
|
170
|
+
if (this.onScreenDetectRadius && this.curPanoramaGroup) {
|
|
171
|
+
let toPID;
|
|
172
|
+
if (this.view.camera) {
|
|
173
|
+
toPID = this.curPanoramaGroup.intersectIndicatorsOnScreen(new THREE.Vector2(x, y), this.onScreenDetectRadius, { screenWidth: clientWidth, screenHeight: clientHeight }, this.view.camera);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
toPID = this.curPanoramaGroup.intersectIndicators(this.raycaster.ray.origin, this.raycaster.ray.direction);
|
|
177
|
+
}
|
|
178
|
+
if (toPID !== -1) {
|
|
179
|
+
this.emit(Events.CLICK_PANORAMA, toPID, event);
|
|
180
|
+
// this.moveToPanorama(toPID, { interval: 2000, toDirection: new THREE.Vector3(-0.8, 0.6, 0.0) });
|
|
181
|
+
if (event.button === 0 && this.moveOnClick && this.curPanoramaGroup.currentPanoramaID !== toPID) {
|
|
182
|
+
yield this.moveToPanorama(toPID, { interval: 1000, fadeInOut: false });
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
this.touches.state = 'idle';
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
onMouseWheel(event) {
|
|
192
|
+
event.preventDefault();
|
|
193
|
+
this.handlePanoramaLevel();
|
|
194
|
+
// this.handleMouseWheel(e);
|
|
195
|
+
}
|
|
196
|
+
onTouchStart(event) {
|
|
197
|
+
// e.preventDefault();
|
|
198
|
+
const { THREE } = Externals.getInstance();
|
|
199
|
+
const l = event.touches.length;
|
|
200
|
+
const tl = event.targetTouches.length;
|
|
201
|
+
for (let i = 0; i < Math.min(l, 2); i++) {
|
|
202
|
+
const t = event.touches[i];
|
|
203
|
+
this.touches.s[i] = new THREE.Vector2(t.clientX, t.clientY);
|
|
204
|
+
}
|
|
205
|
+
this.touches.state = 'down';
|
|
206
|
+
if (tl > 1 && this.view.camera instanceof THREE.PerspectiveCamera) {
|
|
207
|
+
this.touches.state = 'zoom';
|
|
208
|
+
this.touches.dist = this.touches.s[0].distanceTo(this.touches.s[1]);
|
|
209
|
+
this.touches.fov = this.view.camera.fov;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
onTouchMove(event) {
|
|
213
|
+
const { THREE } = Externals.getInstance();
|
|
214
|
+
if (!this.view.camera || !(this.view.camera instanceof THREE.PerspectiveCamera))
|
|
215
|
+
return;
|
|
216
|
+
if (this.touches.state === 'idle')
|
|
217
|
+
return;
|
|
218
|
+
event.preventDefault();
|
|
219
|
+
event.stopPropagation();
|
|
220
|
+
const l = event.touches.length;
|
|
221
|
+
for (let i = 0; i < Math.min(l, 2); i++) {
|
|
222
|
+
const t = event.touches[i];
|
|
223
|
+
this.touches.c[i] = new THREE.Vector2(t.clientX, t.clientY);
|
|
224
|
+
}
|
|
225
|
+
if (this.touches.state === 'down' && this.touches.c[0].distanceToSquared(this.touches.s[0]) > 100) {
|
|
226
|
+
this.touches.state = 'move';
|
|
227
|
+
}
|
|
228
|
+
else if (this.touches.state === 'zoom') {
|
|
229
|
+
this.handlePanoramaLevel();
|
|
230
|
+
}
|
|
231
|
+
if (this.touches.state === 'move') {
|
|
232
|
+
this.onMouseDrag();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
onTouchEnd(event) {
|
|
236
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
237
|
+
if (this.touches.state === 'idle')
|
|
238
|
+
return;
|
|
239
|
+
const { THREE } = Externals.getInstance();
|
|
240
|
+
if (this.touches.state === 'down' && this.view.renderer) {
|
|
241
|
+
const touchPoint = new THREE.Vector2(this.touches.s[0].x, this.touches.s[0].y);
|
|
242
|
+
const { clientWidth, clientHeight } = this.view.container;
|
|
243
|
+
const { left: rectX, top: rectY } = this.view.container.getBoundingClientRect();
|
|
244
|
+
const x = touchPoint.x - rectX;
|
|
245
|
+
const y = touchPoint.y - rectY;
|
|
246
|
+
this.raycaster.setFromCamera({ x, y }, this.view.camera);
|
|
247
|
+
if (this.curPanoramaGroup) {
|
|
248
|
+
let toPID;
|
|
249
|
+
if (this.onScreenDetectRadius > 0 && this.view.camera) {
|
|
250
|
+
toPID = this.curPanoramaGroup.intersectIndicatorsOnScreen(new THREE.Vector2(x, y), this.onScreenDetectRadius, { screenWidth: clientWidth, screenHeight: clientHeight }, this.view.camera);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
toPID = this.curPanoramaGroup.intersectIndicators(this.raycaster.ray.origin, this.raycaster.ray.direction);
|
|
254
|
+
}
|
|
255
|
+
if (toPID !== -1) {
|
|
256
|
+
this.emit(Events.CLICK_PANORAMA, toPID, event);
|
|
257
|
+
if (this.moveOnClick && this.curPanoramaGroup.currentPanoramaID !== toPID) {
|
|
258
|
+
yield this.moveToPanorama(toPID, { interval: 1000, showModel: true, fadeInOut: false });
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
this.touches.state = 'idle';
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
setLevels(levels) {
|
|
267
|
+
this.levels = levels;
|
|
268
|
+
}
|
|
269
|
+
updateLevel() {
|
|
270
|
+
if (!this.curPanorama) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const { THREE } = Externals.getInstance();
|
|
274
|
+
const view = this.view;
|
|
275
|
+
if (view.camera) {
|
|
276
|
+
const { levels, levelMax } = this;
|
|
277
|
+
const { y } = new THREE.Vector3().setFromMatrixScale(view.camera.projectionMatrix);
|
|
278
|
+
let level = 0;
|
|
279
|
+
let change = false;
|
|
280
|
+
for (let i = 0; i < levels.length; i++) {
|
|
281
|
+
if (y < levels[i]) {
|
|
282
|
+
level = i;
|
|
283
|
+
change = true;
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (!change) {
|
|
288
|
+
level = levels.length;
|
|
289
|
+
}
|
|
290
|
+
if (level > levelMax) {
|
|
291
|
+
level = levelMax;
|
|
292
|
+
}
|
|
293
|
+
const pLevelMax = this.curPanorama.levelMax;
|
|
294
|
+
if (level > pLevelMax) {
|
|
295
|
+
level = pLevelMax;
|
|
296
|
+
}
|
|
297
|
+
// console.log('level', level, 'y', y);
|
|
298
|
+
this.curPanorama.updateLevel(level);
|
|
299
|
+
this.planeNeedUpdate = true;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* 更新最大等级
|
|
304
|
+
* @param levelMax 最大等级
|
|
305
|
+
*/
|
|
306
|
+
updateLevelMax(levelMax) {
|
|
307
|
+
if (levelMax === this.levelMax)
|
|
308
|
+
return;
|
|
309
|
+
this.levelMax = levelMax;
|
|
310
|
+
for (let i = 0; i < this.panoramaGroups.length; i++) {
|
|
311
|
+
const panoramaGroup = this.panoramaGroups[i];
|
|
312
|
+
// eslint-disable-next-line no-await-in-loop
|
|
313
|
+
panoramaGroup.updateLevelMax(levelMax);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
onMouseDrag() {
|
|
317
|
+
this.planeNeedUpdate = true;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* 绑定视图
|
|
321
|
+
* @param view
|
|
322
|
+
*/
|
|
323
|
+
bindView(view) {
|
|
324
|
+
this.view = view;
|
|
325
|
+
this.container = view.container;
|
|
326
|
+
this.setEnabled(true);
|
|
327
|
+
}
|
|
328
|
+
// public async bindPanorama(panorama: TilePanorama): Promise<void> {
|
|
329
|
+
// this.initialized = false;
|
|
330
|
+
// this.emit(Events.WILL_LOAD_PANORAMA, panorama.pid);
|
|
331
|
+
// const lastPanorama = this.curPanorama;
|
|
332
|
+
// this.curPanorama = panorama;
|
|
333
|
+
// await this.initTextures(panorama);
|
|
334
|
+
// this.updateLevel();
|
|
335
|
+
// this.initialized = true;
|
|
336
|
+
// this.planeNeedUpdate = true;
|
|
337
|
+
// this.emit(Events.DID_LOAD_PANORAMA, panorama.pid);
|
|
338
|
+
// this.diposeInfos(lastPanorama);
|
|
339
|
+
// }
|
|
340
|
+
// public async initTextures(panorama: TilePanorama): Promise<void> {
|
|
341
|
+
// const textureUrls = panorama.textureURLs;
|
|
342
|
+
// const needInits = [] as TileTextureInfo[];
|
|
343
|
+
// panorama.tilePlanes.forEach((plane, index) => {
|
|
344
|
+
// const rootUrl = textureUrls[index];
|
|
345
|
+
// const info = new TileTextureInfo(plane.pfid, 0, 0, 0, rootUrl);
|
|
346
|
+
// info.frize = true;
|
|
347
|
+
// needInits.push(info);
|
|
348
|
+
// });
|
|
349
|
+
// await TextureController.instance.initTextures(needInits);
|
|
350
|
+
// }
|
|
351
|
+
/**
|
|
352
|
+
* 从全景点看
|
|
353
|
+
* @param pid 全景点id
|
|
354
|
+
* @param lookDirection 看的方向 v3
|
|
355
|
+
* @param showModel 是否显示模型
|
|
356
|
+
* @param preInitPanoramasStrategy 初始化全景策略
|
|
357
|
+
*/
|
|
358
|
+
lookFromPanorama(pid, lookDirection, showModel, preInitPanoramasStrategy) {
|
|
359
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
360
|
+
const pano = yield this.showPanorama(pid, { lookDirection, showModel, preInitPanoramasStrategy });
|
|
361
|
+
if (pano) {
|
|
362
|
+
this.emit(Events.MOVE_TO_PANORAMA, pid, pano ? pano.position : null, this.panoramaGroupChanged);
|
|
363
|
+
}
|
|
364
|
+
this.panoramaGroupChanged = false;
|
|
365
|
+
// const pano = await this.showPanorama(pid, { lookDirection, showModel, preInitPanoramasStrategy });
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* 仅显示指定全景图,但不操作摄像机
|
|
370
|
+
* @param pid 全景点PID
|
|
371
|
+
* @parama showModel 可选,是否一开始就显示模型
|
|
372
|
+
* @param preInitPanoramasStrategy 可选,预创建全景对象的顺序策略,详见[PanoramaGroup]的【initializePanoramasIfNecessary]方法说明
|
|
373
|
+
*/
|
|
374
|
+
showPanorama(pid, options) {
|
|
375
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
376
|
+
const { lookDirection, target, showModel, preInitPanoramasStrategy, } = options || {};
|
|
377
|
+
// const lastPanorama = this.curPanorama;
|
|
378
|
+
const { pano, panoramaGroup } = this.getPanoramaOfPID(pid);
|
|
379
|
+
if (panoramaGroup) {
|
|
380
|
+
if (this.curPanoramaGroup !== panoramaGroup)
|
|
381
|
+
this.panoramaGroupChanged = true;
|
|
382
|
+
this.curPanoramaGroup = panoramaGroup;
|
|
383
|
+
if (panoramaGroup.modelElement) {
|
|
384
|
+
this.setModelAppearance(panoramaGroup.modelElement, false, undefined);
|
|
385
|
+
}
|
|
386
|
+
if (preInitPanoramasStrategy) {
|
|
387
|
+
panoramaGroup.initializePanoramasIfNecessary(preInitPanoramasStrategy);
|
|
388
|
+
}
|
|
389
|
+
panoramaGroup.panoramaIDsAround(pid);
|
|
390
|
+
panoramaGroup.presentPanoramaIndicatorsAround(pid, this.view);
|
|
391
|
+
if (pano) {
|
|
392
|
+
if (lookDirection) {
|
|
393
|
+
this.setCameraLookAt(pano.position, lookDirection);
|
|
394
|
+
}
|
|
395
|
+
else if (target) {
|
|
396
|
+
this.setCameraLookAt(pano.position, target.clone().sub(pano.position));
|
|
397
|
+
}
|
|
398
|
+
// pano.updateLevel(0);
|
|
399
|
+
this.emit(Events.WILL_LOAD_PANORAMA, pano.pid);
|
|
400
|
+
if (this.curPanorama) {
|
|
401
|
+
this.panoramaUnmount(this.curPanorama);
|
|
402
|
+
}
|
|
403
|
+
this.curPanorama = pano;
|
|
404
|
+
this.panoramaMount(this.curPanorama);
|
|
405
|
+
const res = yield panoramaGroup.presentPanoramaAround(pid, this.view);
|
|
406
|
+
if (!res) {
|
|
407
|
+
return undefined;
|
|
408
|
+
}
|
|
409
|
+
this.updateLevel();
|
|
410
|
+
if (undefined === showModel || showModel === true) {
|
|
411
|
+
const material = this.getModelMaterial();
|
|
412
|
+
const uniforms = material.uniforms;
|
|
413
|
+
uniforms.pano0Matrix.value = pano.matrix;
|
|
414
|
+
uniforms.pano0Position.value = pano.position;
|
|
415
|
+
uniforms.pano1Matrix.value = pano.matrix;
|
|
416
|
+
uniforms.pano1Position.value = pano.position;
|
|
417
|
+
uniforms.weight0.value = 1.0;
|
|
418
|
+
uniforms.weight1.value = 0.0;
|
|
419
|
+
const texture = TextureController.instance.getCubeTextureByPid(pano.pid);
|
|
420
|
+
[uniforms.pano0Map.value, uniforms.pano1Map.value] = [texture, texture];
|
|
421
|
+
this.setModelAppearance(panoramaGroup.modelElement, true, material);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return pano;
|
|
425
|
+
}
|
|
426
|
+
return undefined;
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* 设置摄像机按指定视线方向看向目标位置
|
|
431
|
+
* @param target 目标位置
|
|
432
|
+
* @param sightDirection 可选,视线方向,不设置则默认以摄像机当前方向
|
|
433
|
+
*/
|
|
434
|
+
setCameraLookAt(target, sightDirection) {
|
|
435
|
+
let direction;
|
|
436
|
+
const { THREE } = Externals.getInstance();
|
|
437
|
+
if (sightDirection) {
|
|
438
|
+
direction = sightDirection.clone().normalize();
|
|
439
|
+
}
|
|
440
|
+
else if (this.view.camera) {
|
|
441
|
+
direction = this.view.camera.getWorldDirection(new THREE.Vector3(0, 0, -1));
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
direction = new THREE.Vector3(1, 0, 0);
|
|
445
|
+
}
|
|
446
|
+
const p0 = direction
|
|
447
|
+
.multiplyScalar(TilePanoramaController.DirectionVectorScalar)
|
|
448
|
+
.add(target);
|
|
449
|
+
this.setCameraPose(p0, target);
|
|
450
|
+
}
|
|
451
|
+
getPanoramaOfPID(pid) {
|
|
452
|
+
const panoGroup = this.pid2GroupMap.get(pid);
|
|
453
|
+
if (panoGroup) {
|
|
454
|
+
const pano = panoGroup.getPanoramaByPID(pid);
|
|
455
|
+
return { pano, panoramaGroup: panoGroup };
|
|
456
|
+
}
|
|
457
|
+
for (let i = 0; i < this.panoramaGroups.length; i++) {
|
|
458
|
+
const panoramaGroup = this.panoramaGroups[i];
|
|
459
|
+
// eslint-disable-next-line no-await-in-loop
|
|
460
|
+
const pano = panoramaGroup.getPanoramaByPID(pid);
|
|
461
|
+
if (pano) {
|
|
462
|
+
this.pid2GroupMap.set(pid, panoramaGroup);
|
|
463
|
+
return { pano, panoramaGroup };
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return {};
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* @ignore
|
|
470
|
+
* @param capture
|
|
471
|
+
*/
|
|
472
|
+
setCaptureMove(capture) {
|
|
473
|
+
this.captureMove = capture;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* 移动到指定的全景点处
|
|
477
|
+
* @param toPID 目标全景点ID
|
|
478
|
+
* @param interval 可选,过渡所用时长
|
|
479
|
+
* @param easing 可选,插值函数
|
|
480
|
+
* @param fadeInOut 可选,是否使用淡出淡入变换
|
|
481
|
+
* @param toDirection 可选,到达目的点时要转到的视线方向,
|
|
482
|
+
* 若不设置则默认以从起始点到目的点的连线为最终视线方向
|
|
483
|
+
* @param lookAtTarget 可选,到达目的点时视线看向的位置,优先于toDirection
|
|
484
|
+
* @param fov 可选,视场角度数
|
|
485
|
+
*/
|
|
486
|
+
moveToPanorama(toPID, params) {
|
|
487
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
488
|
+
const p = params || {};
|
|
489
|
+
return this.moveInPath([toPID], {
|
|
490
|
+
queueIfBusy: false,
|
|
491
|
+
lookAtTargets: p.lookAtTarget,
|
|
492
|
+
toDirections: p.toDirection,
|
|
493
|
+
intervals: p.interval,
|
|
494
|
+
fovs: p.fov,
|
|
495
|
+
fadeInOuts: p.fadeInOut,
|
|
496
|
+
easings: p.easing,
|
|
497
|
+
freeRotation: !p.lookAtTarget,
|
|
498
|
+
showModel: p.showModel,
|
|
499
|
+
});
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* 移动到指定的全景点处
|
|
504
|
+
* 此方法与[[moveToPanorama]]的不同点在于通过Promise机制实现同步阻塞,
|
|
505
|
+
* 在前一个Translation未完成时发起的Translation会自动被阻塞到前一个完成时再执行
|
|
506
|
+
* @param toPID 目标全景点ID
|
|
507
|
+
* @param interval 可选,过渡所用时长
|
|
508
|
+
* @param easing 可选,插值函数
|
|
509
|
+
* @param fadeInOut 可选,是否使用淡出淡入变换
|
|
510
|
+
* @param toDirection 可选,到达目的点时要转到的视线方向,
|
|
511
|
+
* 若不设置则默认以从起始点到目的点的连线为最终视线方向
|
|
512
|
+
* @param lookAtTarget 可选,到达目的点时视线看向的位置,优先于toDirection
|
|
513
|
+
* @param fov 可选,视场角度数
|
|
514
|
+
*/
|
|
515
|
+
moveToPanoramaSync(toPID, params) {
|
|
516
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
517
|
+
const p = params || {};
|
|
518
|
+
return this.moveInPath([toPID], {
|
|
519
|
+
queueIfBusy: true,
|
|
520
|
+
lookAtTargets: p.lookAtTarget,
|
|
521
|
+
toDirections: p.toDirection,
|
|
522
|
+
intervals: p.interval,
|
|
523
|
+
fovs: p.fov,
|
|
524
|
+
fadeInOuts: p.fadeInOut,
|
|
525
|
+
easings: p.easing,
|
|
526
|
+
freeRotation: !p.lookAtTarget,
|
|
527
|
+
showModel: p.showModel,
|
|
528
|
+
});
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
static getModelMesh(panoGroup) {
|
|
532
|
+
if (panoGroup && panoGroup.modelElement) { // TODO: Multiple children mesh?
|
|
533
|
+
return PanoramaModelUtil.getModelMeshInElement(panoGroup.modelElement);
|
|
534
|
+
}
|
|
535
|
+
return undefined;
|
|
536
|
+
}
|
|
537
|
+
getModelMaterial() {
|
|
538
|
+
if (this.modelMaterial) {
|
|
539
|
+
return this.modelMaterial;
|
|
540
|
+
}
|
|
541
|
+
const { THREE } = Externals.getInstance();
|
|
542
|
+
const uniforms = PanoramaModelUtil.createModelUniforms();
|
|
543
|
+
this.modelMaterial = new THREE.ShaderMaterial({
|
|
544
|
+
side: THREE.DoubleSide,
|
|
545
|
+
vertexShader: PanoramaModelUtil.getModelVS(),
|
|
546
|
+
fragmentShader: PanoramaModelUtil.getModelFS(),
|
|
547
|
+
uniforms,
|
|
548
|
+
name: 'modelMaterial',
|
|
549
|
+
});
|
|
550
|
+
return this.modelMaterial;
|
|
551
|
+
}
|
|
552
|
+
preloadCubeTexturesOfPIDs(pids, waitForReadyCount, recycleIntermediateTextures) {
|
|
553
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
554
|
+
const panos = pids.map((pid) => this.getPanoramaOfPID(pid));
|
|
555
|
+
const textureURLsArray = panos.map(({ pano }) => {
|
|
556
|
+
if (pano) {
|
|
557
|
+
return pano.textureURLs;
|
|
558
|
+
}
|
|
559
|
+
return undefined;
|
|
560
|
+
});
|
|
561
|
+
return CubeTextureCache.sharedInstance.preloadCubeTextures(textureURLsArray, waitForReadyCount, recycleIntermediateTextures);
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
getInstantTranslationMaterial() {
|
|
565
|
+
if (this.instantTranslationMaterial) {
|
|
566
|
+
return this.instantTranslationMaterial;
|
|
567
|
+
}
|
|
568
|
+
const { THREE } = Externals.getInstance();
|
|
569
|
+
const uniforms = PanoramaModelUtil.createInstantTranslationUniforms();
|
|
570
|
+
this.instantTranslationMaterial = new THREE.ShaderMaterial({
|
|
571
|
+
side: THREE.DoubleSide,
|
|
572
|
+
vertexShader: PanoramaModelUtil.getInstantTranslationVS(),
|
|
573
|
+
fragmentShader: PanoramaModelUtil.getModelFS(),
|
|
574
|
+
uniforms,
|
|
575
|
+
name: 'instantTranslationMaterial',
|
|
576
|
+
});
|
|
577
|
+
return this.instantTranslationMaterial;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* @ignore
|
|
581
|
+
* @param visible
|
|
582
|
+
*/
|
|
583
|
+
setModelAppearance(modelElement, visible, meshMaterial, modelMesh) {
|
|
584
|
+
if (modelElement) {
|
|
585
|
+
modelElement.visible = visible;
|
|
586
|
+
if (modelElement instanceof FloorModel) {
|
|
587
|
+
// (modelElement as FloorModel).addViewConfiguration({
|
|
588
|
+
// targetView: this.view,
|
|
589
|
+
// visible,
|
|
590
|
+
// meshMaterial,
|
|
591
|
+
// });
|
|
592
|
+
if (meshMaterial) {
|
|
593
|
+
modelElement.addMeshMaterial(meshMaterial);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
let mesh = modelMesh;
|
|
598
|
+
if (!mesh) {
|
|
599
|
+
mesh = PanoramaModelUtil.getModelMeshInElement(modelElement);
|
|
600
|
+
}
|
|
601
|
+
if (mesh && meshMaterial) {
|
|
602
|
+
mesh.material = meshMaterial;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
moveInPath(path, params) {
|
|
608
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
609
|
+
if (path.length === 0)
|
|
610
|
+
return;
|
|
611
|
+
const { THREE } = Externals.getInstance();
|
|
612
|
+
const pathPositions = [];
|
|
613
|
+
const inPathPanos = path.map((pid) => this.getPanoramaOfPID(pid));
|
|
614
|
+
inPathPanos.forEach((item) => {
|
|
615
|
+
if (item.pano) {
|
|
616
|
+
pathPositions.push(item.pano.position.clone());
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
const { toDirections, lookAtTargets, intervals, fovs, easings, fadeInOuts, queueIfBusy, showModel, freeRotation, rotateDelays, } = params || {};
|
|
620
|
+
const modelVisible = (showModel === undefined ? this.showModel : showModel === true);
|
|
621
|
+
let material;
|
|
622
|
+
let uniforms;
|
|
623
|
+
let previousMaterial;
|
|
624
|
+
let fromPID = -1;
|
|
625
|
+
let toPID;
|
|
626
|
+
let fadeInOut = false;
|
|
627
|
+
const preloadTextureCount = CubeTextureCache.sharedInstance.getCapacity();
|
|
628
|
+
let from;
|
|
629
|
+
let to;
|
|
630
|
+
let modelElement;
|
|
631
|
+
const trivialProgressTransform = (progress) => progress;
|
|
632
|
+
const fadeInOutProgressTransform = (progress) => {
|
|
633
|
+
if (progress < 0.25)
|
|
634
|
+
return 0;
|
|
635
|
+
if (progress > 0.75)
|
|
636
|
+
return 1;
|
|
637
|
+
return 2 * (progress - 0.25);
|
|
638
|
+
};
|
|
639
|
+
let progressTransforms;
|
|
640
|
+
if (Array.isArray(fadeInOuts)) {
|
|
641
|
+
progressTransforms = fadeInOuts.map((b) => (b ? fadeInOutProgressTransform : trivialProgressTransform));
|
|
642
|
+
}
|
|
643
|
+
else if (fadeInOuts === true) {
|
|
644
|
+
progressTransforms = fadeInOutProgressTransform;
|
|
645
|
+
}
|
|
646
|
+
yield this.moveCameraInPath(pathPositions, {
|
|
647
|
+
queueIfBusy,
|
|
648
|
+
toDirections,
|
|
649
|
+
lookAtTargets,
|
|
650
|
+
intervals,
|
|
651
|
+
fovs,
|
|
652
|
+
easings,
|
|
653
|
+
progressTransforms,
|
|
654
|
+
freeRotation,
|
|
655
|
+
rotateDelays,
|
|
656
|
+
beforeAllMoves: () => __awaiter(this, void 0, void 0, function* () {
|
|
657
|
+
fromPID = this.curPanoramaGroup ? this.curPanoramaGroup.currentPanoramaID : -1;
|
|
658
|
+
material = this.getModelMaterial();
|
|
659
|
+
uniforms = material.uniforms;
|
|
660
|
+
if (path.length > 1)
|
|
661
|
+
this.emit(Events.PATH_MOVEMENT_START, path);
|
|
662
|
+
}),
|
|
663
|
+
onOneMoveStart: (index, target0, eye0, target1, eye1, error) => __awaiter(this, void 0, void 0, function* () {
|
|
664
|
+
toPID = path[index];
|
|
665
|
+
from = this.getPanoramaOfPID(fromPID);
|
|
666
|
+
to = this.getPanoramaOfPID(toPID);
|
|
667
|
+
if (!from.pano || !to.pano || !from.panoramaGroup || !to.panoramaGroup)
|
|
668
|
+
return false;
|
|
669
|
+
from.modelMesh = TilePanoramaController.getModelMesh(from.panoramaGroup);
|
|
670
|
+
to.modelMesh = TilePanoramaController.getModelMesh(to.panoramaGroup);
|
|
671
|
+
const preloadPIDs = [fromPID];
|
|
672
|
+
const preloadPIDsSet = new Set();
|
|
673
|
+
preloadPIDsSet.add(fromPID);
|
|
674
|
+
for (let i = index; preloadPIDs.length < preloadTextureCount && i < path.length; i += 1) {
|
|
675
|
+
if (!preloadPIDsSet.has(path[i])) {
|
|
676
|
+
preloadPIDsSet.add(path[i]);
|
|
677
|
+
preloadPIDs.push(path[i]);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
this.emit(Events.WILL_MOVE_TO_PANORAMA, toPID, to.pano ? to.pano.position : null);
|
|
681
|
+
const res = yield from.panoramaGroup.presentPanoramaAround(to.pano.pid, this.view);
|
|
682
|
+
if (!res) {
|
|
683
|
+
error.loadedError = true;
|
|
684
|
+
return false;
|
|
685
|
+
}
|
|
686
|
+
this.emit(Events.DID_LOAD_PANORAMA, to.pano.pid);
|
|
687
|
+
if (fromPID === toPID)
|
|
688
|
+
return false;
|
|
689
|
+
if (Array.isArray(fadeInOuts)) {
|
|
690
|
+
if (fadeInOuts.length > index) {
|
|
691
|
+
fadeInOut = fadeInOuts[index];
|
|
692
|
+
}
|
|
693
|
+
else if (fadeInOuts.length > 0) {
|
|
694
|
+
fadeInOut = fadeInOuts[fadeInOuts.length - 1];
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
else if (fadeInOuts) {
|
|
698
|
+
fadeInOut = fadeInOuts;
|
|
699
|
+
}
|
|
700
|
+
const translateBetweenGroups = (from.panoramaGroup !== to.panoramaGroup);
|
|
701
|
+
if (translateBetweenGroups) {
|
|
702
|
+
material = this.getInstantTranslationMaterial();
|
|
703
|
+
uniforms = material.uniforms;
|
|
704
|
+
}
|
|
705
|
+
else {
|
|
706
|
+
material = this.getModelMaterial();
|
|
707
|
+
uniforms = material.uniforms;
|
|
708
|
+
}
|
|
709
|
+
if (!translateBetweenGroups && !modelVisible) {
|
|
710
|
+
const distance = to.pano.position.distanceTo(from.pano.position);
|
|
711
|
+
const boxGeometry = new THREE.BoxGeometry(5, (from.pano.position.z + 0.93) * 2, distance * 4);
|
|
712
|
+
modelElement = new THREE.Mesh(boxGeometry, material);
|
|
713
|
+
modelElement.position.copy(from.pano.position);
|
|
714
|
+
modelElement.up.set(0, 0, 1);
|
|
715
|
+
modelElement.lookAt(to.pano.position);
|
|
716
|
+
to.panoramaGroup.add(modelElement);
|
|
717
|
+
}
|
|
718
|
+
[to].forEach(({ panoramaGroup, modelMesh }) => {
|
|
719
|
+
if (modelMesh && panoramaGroup) {
|
|
720
|
+
previousMaterial = modelMesh.material;
|
|
721
|
+
if (from.panoramaGroup === to.panoramaGroup) {
|
|
722
|
+
this.setModelAppearance(panoramaGroup.modelElement, modelVisible, material, modelMesh);
|
|
723
|
+
}
|
|
724
|
+
else {
|
|
725
|
+
this.setModelAppearance(panoramaGroup.modelElement, false, material, modelMesh);
|
|
726
|
+
}
|
|
727
|
+
panoramaGroup.setBoundBoxAppearance(material);
|
|
728
|
+
panoramaGroup.addGroupViewConfiguration({
|
|
729
|
+
targetView: this.view,
|
|
730
|
+
showBoundBox: true,
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
if (translateBetweenGroups) {
|
|
735
|
+
// Inv(L0) * L1
|
|
736
|
+
let up = new THREE.Vector3(0, 1, 0);
|
|
737
|
+
if (this.view.camera) {
|
|
738
|
+
up = this.view.camera.up;
|
|
739
|
+
}
|
|
740
|
+
const invLookAt0 = new THREE.Matrix4().lookAt(eye0, target0, up);
|
|
741
|
+
const invLookAt1 = new THREE.Matrix4().lookAt(eye1, target1, up);
|
|
742
|
+
uniforms.matrixT.value = invLookAt0.multiply(new THREE.Matrix4().copy(invLookAt1).invert());
|
|
743
|
+
}
|
|
744
|
+
uniforms.pano0Matrix.value = from.pano.matrix;
|
|
745
|
+
uniforms.pano0Position.value = from.pano.position;
|
|
746
|
+
uniforms.pano1Matrix.value = to.pano.matrix;
|
|
747
|
+
uniforms.pano1Position.value = to.pano.position;
|
|
748
|
+
uniforms.weight0.value = 1.0;
|
|
749
|
+
uniforms.weight1.value = 0.0;
|
|
750
|
+
const fromCubeText = TextureController.instance.getCubeTextureByPid(from.pano.pid);
|
|
751
|
+
const toCubeText = TextureController.instance.getCubeTextureByPid(to.pano.pid);
|
|
752
|
+
uniforms.pano0Map.value = fromCubeText;
|
|
753
|
+
uniforms.pano1Map.value = toCubeText;
|
|
754
|
+
this.panoramaUnmount(from.pano);
|
|
755
|
+
return translateBetweenGroups;
|
|
756
|
+
}),
|
|
757
|
+
onOneMoveUpdate: (index, progress) => {
|
|
758
|
+
if (fromPID === toPID)
|
|
759
|
+
return;
|
|
760
|
+
const translateBetweenGroups = (from.panoramaGroup !== to.panoramaGroup);
|
|
761
|
+
if (translateBetweenGroups) {
|
|
762
|
+
if (progress < 0.5) {
|
|
763
|
+
uniforms.weight0.value = 1.0 - progress * 2;
|
|
764
|
+
uniforms.weight1.value = 0.0;
|
|
765
|
+
}
|
|
766
|
+
else {
|
|
767
|
+
uniforms.weight1.value = progress * 2 - 1.0;
|
|
768
|
+
uniforms.weight0.value = 0.0;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
else if (fadeInOut) {
|
|
772
|
+
if (progress < 0.25) {
|
|
773
|
+
uniforms.weight0.value = 1.0 - progress * 4;
|
|
774
|
+
uniforms.weight1.value = 0.0;
|
|
775
|
+
}
|
|
776
|
+
else if (progress > 0.75) {
|
|
777
|
+
uniforms.weight1.value = progress * 4 - 3.0;
|
|
778
|
+
uniforms.weight0.value = 0.0;
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
uniforms.weight1.value = 0.0;
|
|
782
|
+
uniforms.weight0.value = 0.0;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
else {
|
|
786
|
+
uniforms.weight0.value = 1.0 - progress;
|
|
787
|
+
uniforms.weight1.value = progress;
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
onOneMoveComplete: (index) => __awaiter(this, void 0, void 0, function* () {
|
|
791
|
+
if (from.modelMesh && from.panoramaGroup && from.panoramaGroup !== to.panoramaGroup) {
|
|
792
|
+
if (!modelVisible) {
|
|
793
|
+
this.setModelAppearance(from.panoramaGroup.modelElement, false, previousMaterial, from.modelMesh);
|
|
794
|
+
}
|
|
795
|
+
from.panoramaGroup.addGroupViewConfiguration({
|
|
796
|
+
targetView: this.view,
|
|
797
|
+
showBoundBox: false,
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
to.panoramaGroup.remove(modelElement);
|
|
801
|
+
if (to.pano) {
|
|
802
|
+
this.curPanorama = to.pano;
|
|
803
|
+
this.panoramaMount(this.curPanorama);
|
|
804
|
+
this.updateCurPanoramTextureInfo();
|
|
805
|
+
this.updateLevel();
|
|
806
|
+
}
|
|
807
|
+
this.emit(Events.MOVE_TO_PANORAMA, toPID, to.pano ? to.pano.position : null, from.panoramaGroup !== to.panoramaGroup);
|
|
808
|
+
this.panoramaGroupChanged = false;
|
|
809
|
+
if (index < path.length - 1) {
|
|
810
|
+
fromPID = path[index];
|
|
811
|
+
}
|
|
812
|
+
}),
|
|
813
|
+
afterAllMoves: () => __awaiter(this, void 0, void 0, function* () {
|
|
814
|
+
to.panoramaGroup.presentPanoramaIndicatorsAround(toPID, this.view);
|
|
815
|
+
if (fromPID !== toPID && to && from) {
|
|
816
|
+
if (to.modelMesh && to.panoramaGroup) {
|
|
817
|
+
if (!modelVisible) {
|
|
818
|
+
this.setModelAppearance(to.panoramaGroup.modelElement, false, previousMaterial, to.modelMesh);
|
|
819
|
+
}
|
|
820
|
+
to.panoramaGroup.addGroupViewConfiguration({
|
|
821
|
+
targetView: this.view,
|
|
822
|
+
showBoundBox: false,
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
if (to.panoramaGroup) {
|
|
826
|
+
this.curPanoramaGroup = to.panoramaGroup;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
if (path.length > 1)
|
|
830
|
+
this.emit(Events.PATH_MOVEMENT_COMPLETED, path);
|
|
831
|
+
}),
|
|
832
|
+
});
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* 根据路径移动相机
|
|
837
|
+
* @param pathPoints 摄像机运动的路径上每一段目的点的Vector3坐标数组
|
|
838
|
+
* @param queueIfBusy 可选,指示当当前有动画在进行中时,是把此次动作排队还是直接放弃
|
|
839
|
+
* @param intervals 可选,若为数组则依次是每一段路径所花费的时间间隔,若是一个数则全都用该时间间隔
|
|
840
|
+
* @param fovs 可选,若为数组则依次是每一段路径结束时的视场角,若是一个数则全都用该视场角
|
|
841
|
+
* @param toDirections 可选,若为数组则依次是每一段路径结束点的视线方向,若是单一Vector3对象则全用此视线方向
|
|
842
|
+
* @param lookAtTargets 可选,若为数组则依次是每一段路径所看向的位置,若是单一Vector3对象则始终看向此位置
|
|
843
|
+
* toDirections与lookAtTargets最多只能有一个,如果同时传入了则只以lookAtTargets为准
|
|
844
|
+
* @param easings 可选,若为数组则依次是每一段路径的动画插值函数,
|
|
845
|
+
* 若是单一{(k: number): number}对象则全用此插值函数
|
|
846
|
+
* @param rotateDelays 可选,旋转时的延迟时间
|
|
847
|
+
* @param progressTransforms 可选,转换progress的映射函数,从0~1之间的小数映射到另一个0~1之间的小数
|
|
848
|
+
* @param beforeAllMoves 整个路径移动即将开始前的回调
|
|
849
|
+
* @param onOneMoveStart 每段路径移动开始时的回调
|
|
850
|
+
* @param onOneMoveUpdate 每段路径移动进行中的进度回调
|
|
851
|
+
* @param onOneMoveComplete 每段路径移动结束时的回调
|
|
852
|
+
* @param afterAllMoves 整个路径移动结束时的回调
|
|
853
|
+
* @returns
|
|
854
|
+
*/
|
|
855
|
+
moveCameraInPath(pathPoints, params) {
|
|
856
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
857
|
+
if (!pathPoints || pathPoints.length === 0)
|
|
858
|
+
return;
|
|
859
|
+
const { THREE } = Externals.getInstance();
|
|
860
|
+
const { queueIfBusy = false } = params || {};
|
|
861
|
+
if (!queueIfBusy) {
|
|
862
|
+
if (this.isAnimating)
|
|
863
|
+
return;
|
|
864
|
+
this.isAnimating = true;
|
|
865
|
+
}
|
|
866
|
+
while (this.translatePromise) {
|
|
867
|
+
// eslint-disable-next-line no-await-in-loop
|
|
868
|
+
yield this.translatePromise;
|
|
869
|
+
}
|
|
870
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
871
|
+
const translatePromise = new Promise((resolve0) => __awaiter(this, void 0, void 0, function* () {
|
|
872
|
+
const { beforeAllMoves, onOneMoveStart, onOneMoveUpdate, onOneMoveComplete, afterAllMoves, } = params || {};
|
|
873
|
+
let iPath = 0;
|
|
874
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
875
|
+
const createTask = () => new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
876
|
+
if (!this.view.camera || this.cancelAnimation) {
|
|
877
|
+
reject();
|
|
878
|
+
this.cancelAnimation = false;
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
const { toDirections, lookAtTargets, intervals, fovs, easings, progressTransforms, freeRotation, rotateDelays, } = params || {};
|
|
882
|
+
const fromPosition = this.basicController.getCameraTarget();
|
|
883
|
+
const toPosition = pathPoints[iPath];
|
|
884
|
+
const diff = toPosition.clone().sub(fromPosition);
|
|
885
|
+
let toDirection = toPosition.clone();
|
|
886
|
+
// let directionFrom = toPosition;
|
|
887
|
+
if (Array.isArray(lookAtTargets)) {
|
|
888
|
+
if (lookAtTargets.length > iPath) {
|
|
889
|
+
toDirection = lookAtTargets[iPath].clone();
|
|
890
|
+
}
|
|
891
|
+
else if (lookAtTargets.length > 0) {
|
|
892
|
+
toDirection = lookAtTargets[lookAtTargets.length - 1].clone();
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
else if (lookAtTargets instanceof THREE.Vector3) {
|
|
896
|
+
toDirection = lookAtTargets.clone();
|
|
897
|
+
} // else {
|
|
898
|
+
// directionFrom = fromPosition;
|
|
899
|
+
// }
|
|
900
|
+
let rotateDelay = 0;
|
|
901
|
+
if (rotateDelays) {
|
|
902
|
+
if (Array.isArray(rotateDelays)) {
|
|
903
|
+
if (rotateDelays.length > iPath) {
|
|
904
|
+
rotateDelay = rotateDelays[iPath];
|
|
905
|
+
}
|
|
906
|
+
else if (rotateDelays.length > 0) {
|
|
907
|
+
rotateDelay = rotateDelays[rotateDelays.length - 1];
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
else {
|
|
911
|
+
rotateDelay = rotateDelays || 0;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
if (lookAtTargets || !toDirections) {
|
|
915
|
+
if (toDirection.distanceToSquared(toPosition) < 0.000001) {
|
|
916
|
+
toDirection = this.basicController.getCameraTarget().sub(this.view.camera.position);
|
|
917
|
+
}
|
|
918
|
+
else {
|
|
919
|
+
toDirection.sub(toPosition);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
else if (Array.isArray(toDirections)) {
|
|
923
|
+
if (toDirections.length > iPath) {
|
|
924
|
+
toDirection = toDirections[iPath];
|
|
925
|
+
}
|
|
926
|
+
else if (toDirections.length > 0) {
|
|
927
|
+
toDirection = toDirections[toDirections.length - 1];
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
else if (toDirections instanceof THREE.Vector3) {
|
|
931
|
+
toDirection = toDirections;
|
|
932
|
+
}
|
|
933
|
+
toDirection.normalize();
|
|
934
|
+
const fromDirection = this.basicController.getCameraTarget().sub(this.view.camera.position).normalize();
|
|
935
|
+
const quat = new THREE.Quaternion().setFromUnitVectors(this.view.camera.up, new THREE.Vector3(0, 1, 0));
|
|
936
|
+
const quatInverse = quat.clone().invert();
|
|
937
|
+
fromDirection.applyQuaternion(quat);
|
|
938
|
+
toDirection.applyQuaternion(quat);
|
|
939
|
+
const fromSpherical = new THREE.Spherical().setFromVector3(fromDirection);
|
|
940
|
+
const toSpherical = new THREE.Spherical().setFromVector3(toDirection);
|
|
941
|
+
const thetaDiff = fromSpherical.theta - toSpherical.theta;
|
|
942
|
+
fromDirection.applyQuaternion(quatInverse);
|
|
943
|
+
toDirection.applyQuaternion(quatInverse);
|
|
944
|
+
let toFOV = 60;
|
|
945
|
+
let fromFOV = 60;
|
|
946
|
+
if (this.view.camera instanceof THREE.PerspectiveCamera) {
|
|
947
|
+
const camera = this.view.camera;
|
|
948
|
+
fromFOV = camera.fov;
|
|
949
|
+
toFOV = camera.fov;
|
|
950
|
+
if (Array.isArray(fovs)) {
|
|
951
|
+
if (fovs.length > iPath) {
|
|
952
|
+
toFOV = fovs[iPath];
|
|
953
|
+
}
|
|
954
|
+
else if (fovs.length > 0) {
|
|
955
|
+
toFOV = fovs[fovs.length - 1];
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
else if (fovs) {
|
|
959
|
+
toFOV = fovs;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
let interval = 1000;
|
|
963
|
+
if (Array.isArray(intervals)) {
|
|
964
|
+
if (intervals.length > iPath) {
|
|
965
|
+
interval = intervals[iPath];
|
|
966
|
+
}
|
|
967
|
+
else if (intervals.length > 0) {
|
|
968
|
+
interval = intervals[intervals.length - 1];
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
else if (intervals) {
|
|
972
|
+
interval = intervals;
|
|
973
|
+
}
|
|
974
|
+
let easing = TWEEN.Easing.Linear.None;
|
|
975
|
+
if (Array.isArray(easings)) {
|
|
976
|
+
if (easings.length > iPath) {
|
|
977
|
+
easing = easings[iPath];
|
|
978
|
+
}
|
|
979
|
+
else if (easings.length > 0) {
|
|
980
|
+
easing = easings[easings.length - 1];
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
else if (typeof easings === 'function') {
|
|
984
|
+
easing = easings;
|
|
985
|
+
}
|
|
986
|
+
else if (iPath === 0) {
|
|
987
|
+
easing = TWEEN.Easing.Quadratic.Out;
|
|
988
|
+
if ((iPath === pathPoints.length - 1))
|
|
989
|
+
easing = TWEEN.Easing.Quadratic.InOut;
|
|
990
|
+
}
|
|
991
|
+
else if (iPath === pathPoints.length - 1) {
|
|
992
|
+
easing = TWEEN.Easing.Quadratic.In;
|
|
993
|
+
}
|
|
994
|
+
let progressTransform;
|
|
995
|
+
if (Array.isArray(progressTransforms)) {
|
|
996
|
+
if (progressTransforms.length > iPath) {
|
|
997
|
+
progressTransform = progressTransforms[iPath];
|
|
998
|
+
}
|
|
999
|
+
else if (progressTransforms.length > 0) {
|
|
1000
|
+
progressTransform = progressTransforms[progressTransforms.length - 1];
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
else if (progressTransforms) {
|
|
1004
|
+
progressTransform = progressTransforms;
|
|
1005
|
+
}
|
|
1006
|
+
const target1 = toPosition;
|
|
1007
|
+
const eye1 = toDirection.clone()
|
|
1008
|
+
.multiplyScalar(TilePanoramaController.DirectionVectorScalar)
|
|
1009
|
+
.add(target1);
|
|
1010
|
+
const target0 = fromPosition;
|
|
1011
|
+
const eye0 = fromDirection.clone()
|
|
1012
|
+
.multiplyScalar(TilePanoramaController.DirectionVectorScalar)
|
|
1013
|
+
.add(target0);
|
|
1014
|
+
let skipPositionTranslate = false;
|
|
1015
|
+
if (onOneMoveStart) {
|
|
1016
|
+
const errorInfo = { loadedError: false };
|
|
1017
|
+
skipPositionTranslate = yield onOneMoveStart(iPath, target0, eye0, target1, eye1, errorInfo);
|
|
1018
|
+
if (errorInfo.loadedError) {
|
|
1019
|
+
this.cancelAnimation = true;
|
|
1020
|
+
resolve();
|
|
1021
|
+
return;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
const fromTheta = fromSpherical.theta;
|
|
1025
|
+
const toTheta = Math.abs(thetaDiff) > Math.PI
|
|
1026
|
+
? toSpherical.theta + Math.sign(thetaDiff) * Math.PI * 2 : toSpherical.theta;
|
|
1027
|
+
const fromPhi = fromSpherical.phi;
|
|
1028
|
+
const toPhi = toSpherical.phi;
|
|
1029
|
+
new TWEEN.Tween({ timer: 0 })
|
|
1030
|
+
.to({
|
|
1031
|
+
timer: interval,
|
|
1032
|
+
}, interval)
|
|
1033
|
+
.easing(easing)
|
|
1034
|
+
.onStart(() => {
|
|
1035
|
+
let eye = skipPositionTranslate ? eye1 : eye0;
|
|
1036
|
+
const target = skipPositionTranslate ? target1 : target0;
|
|
1037
|
+
if (freeRotation) {
|
|
1038
|
+
this.basicController.update();
|
|
1039
|
+
const orbitControlTarget = this.basicController.getCameraTarget();
|
|
1040
|
+
const cameraPosition = this.basicController.getCameraPosition();
|
|
1041
|
+
const originDiff = orbitControlTarget.sub(cameraPosition).normalize();
|
|
1042
|
+
eye = originDiff.multiplyScalar(TilePanoramaController.DirectionVectorScalar).add(target);
|
|
1043
|
+
}
|
|
1044
|
+
this.setCameraPose(eye, target);
|
|
1045
|
+
this.renderThisFrame();
|
|
1046
|
+
})
|
|
1047
|
+
.onUpdate(({ timer }) => {
|
|
1048
|
+
const progress = timer / interval;
|
|
1049
|
+
let rotateProgress = (timer - rotateDelay) / (interval - rotateDelay);
|
|
1050
|
+
rotateProgress = easing(Math.max(Math.min(rotateProgress, 1), 0));
|
|
1051
|
+
const theta = fromTheta + (toTheta - fromTheta) * rotateProgress;
|
|
1052
|
+
const phi = fromPhi + (toPhi - fromPhi) * rotateProgress;
|
|
1053
|
+
const transformedProgress = progressTransform ? progressTransform(progress) : progress;
|
|
1054
|
+
// const progress = progress0;
|
|
1055
|
+
if (!skipPositionTranslate) {
|
|
1056
|
+
// if (freeRotation) lookAt = this.orbitControl.target.clone();
|
|
1057
|
+
const spherical = new THREE.Spherical(1, phi, Math.abs(theta) > Math.PI ? theta - Math.sign(theta) * Math.PI * 2 : theta);
|
|
1058
|
+
spherical.makeSafe();
|
|
1059
|
+
const direction = new THREE.Vector3().setFromSpherical(spherical).applyQuaternion(quatInverse);
|
|
1060
|
+
// console.log(`#PanoCtrl# onUpdate: direction=(${direction.x}, ${direction.y}, ${direction.z})`);
|
|
1061
|
+
const lookAt = fromPosition.clone().addScaledVector(diff, transformedProgress);
|
|
1062
|
+
this.basicController.update();
|
|
1063
|
+
const orbitControlTarget = this.basicController.getCameraTarget();
|
|
1064
|
+
const cameraPosition = this.basicController.getCameraPosition();
|
|
1065
|
+
const originDiff = orbitControlTarget.sub(cameraPosition).normalize();
|
|
1066
|
+
const fromNormalized = fromDirection.clone().normalize();
|
|
1067
|
+
const dist = originDiff.distanceToSquared(fromNormalized);
|
|
1068
|
+
const cameraPos = (freeRotation && dist > 0.0001 ? originDiff : direction)
|
|
1069
|
+
.multiplyScalar(TilePanoramaController.DirectionVectorScalar)
|
|
1070
|
+
.add(lookAt);
|
|
1071
|
+
this.setCameraPose(cameraPos, lookAt);
|
|
1072
|
+
}
|
|
1073
|
+
const currentFOV = fromFOV + transformedProgress * (toFOV - fromFOV);
|
|
1074
|
+
this.setFOV(currentFOV);
|
|
1075
|
+
if (onOneMoveUpdate) {
|
|
1076
|
+
onOneMoveUpdate(iPath, progress, transformedProgress);
|
|
1077
|
+
}
|
|
1078
|
+
this.renderThisFrame();
|
|
1079
|
+
})
|
|
1080
|
+
.onComplete(() => __awaiter(this, void 0, void 0, function* () {
|
|
1081
|
+
if (!skipPositionTranslate) {
|
|
1082
|
+
const toLookAt = toPosition;
|
|
1083
|
+
this.basicController.update();
|
|
1084
|
+
const orbitControlTarget = this.basicController.getCameraTarget();
|
|
1085
|
+
const cameraPosition = this.basicController.getCameraPosition();
|
|
1086
|
+
const originDiff = orbitControlTarget.sub(cameraPosition).normalize();
|
|
1087
|
+
const cameraPos = (freeRotation ? originDiff : toDirection).clone()
|
|
1088
|
+
.multiplyScalar(TilePanoramaController.DirectionVectorScalar)
|
|
1089
|
+
.add(toLookAt);
|
|
1090
|
+
this.setCameraPose(cameraPos, toLookAt);
|
|
1091
|
+
}
|
|
1092
|
+
this.renderThisFrame();
|
|
1093
|
+
if (onOneMoveComplete) {
|
|
1094
|
+
yield onOneMoveComplete(iPath);
|
|
1095
|
+
}
|
|
1096
|
+
resolve();
|
|
1097
|
+
}))
|
|
1098
|
+
.start();
|
|
1099
|
+
}));
|
|
1100
|
+
if (beforeAllMoves) {
|
|
1101
|
+
yield beforeAllMoves();
|
|
1102
|
+
}
|
|
1103
|
+
while (iPath < pathPoints.length) {
|
|
1104
|
+
if (this.cancelAnimation)
|
|
1105
|
+
break;
|
|
1106
|
+
const task = createTask();
|
|
1107
|
+
// eslint-disable-next-line no-await-in-loop
|
|
1108
|
+
yield task;
|
|
1109
|
+
iPath += 1;
|
|
1110
|
+
}
|
|
1111
|
+
if (!this.cancelAnimation) {
|
|
1112
|
+
if (afterAllMoves) {
|
|
1113
|
+
yield afterAllMoves();
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
this.cancelAnimation = false;
|
|
1117
|
+
this.translatePromise = undefined;
|
|
1118
|
+
if (!queueIfBusy) {
|
|
1119
|
+
this.isAnimating = false;
|
|
1120
|
+
}
|
|
1121
|
+
resolve0();
|
|
1122
|
+
}));
|
|
1123
|
+
this.translatePromise = translatePromise;
|
|
1124
|
+
// eslint-disable-next-line consistent-return
|
|
1125
|
+
yield translatePromise;
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* 设置FOV, 不可以超过setFOVRange所设置的范围.
|
|
1130
|
+
* @param fov 垂直方向视场角
|
|
1131
|
+
*/
|
|
1132
|
+
setFOV(fov) {
|
|
1133
|
+
if (!this.basicController)
|
|
1134
|
+
return;
|
|
1135
|
+
this.basicController.setFov(fov);
|
|
1136
|
+
this.renderFrame = true;
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* 设置FOV范围, 默认为[60, 90]
|
|
1140
|
+
* @param min 垂直方向视场角最小值
|
|
1141
|
+
* @param max 垂直方向视场角最大值
|
|
1142
|
+
*/
|
|
1143
|
+
setFOVRange(min, max) {
|
|
1144
|
+
if (!this.basicController)
|
|
1145
|
+
return;
|
|
1146
|
+
this.basicController.setFovRange(min, max);
|
|
1147
|
+
this.renderFrame = true;
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* 设置摄像机观察方向和位置
|
|
1151
|
+
* @param position 摄像机所在位置
|
|
1152
|
+
* @param lookAt 观察目标点,同时也是[[OrbitControls]]的旋转中心
|
|
1153
|
+
*/
|
|
1154
|
+
setCameraPose(position, lookAt, useLookAt = true) {
|
|
1155
|
+
this.basicController.setCameraPosition(position, false);
|
|
1156
|
+
if (useLookAt) {
|
|
1157
|
+
this.basicController.setCameraLookAt(lookAt);
|
|
1158
|
+
}
|
|
1159
|
+
this.renderThisFrame();
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* 渲染帧
|
|
1163
|
+
*/
|
|
1164
|
+
renderThisFrame() {
|
|
1165
|
+
if (!this.renderFrame) {
|
|
1166
|
+
this.renderFrame = true;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* 删除平面
|
|
1171
|
+
* @param pid
|
|
1172
|
+
*/
|
|
1173
|
+
deletePlane(pid) {
|
|
1174
|
+
this.planeMap.delete(pid);
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* 更新全景纹理信息
|
|
1178
|
+
* @param updates
|
|
1179
|
+
* @param deletes
|
|
1180
|
+
*/
|
|
1181
|
+
updatePanoramaTextureInfos(updates, deletes) {
|
|
1182
|
+
const waitPfids = new Map();
|
|
1183
|
+
// console.log('contorller', 'updates', updates.length, 'deletes', deletes.length);
|
|
1184
|
+
for (let i = 0; i < updates.length; i++) {
|
|
1185
|
+
const pfid = updates[i].pfid;
|
|
1186
|
+
if (!waitPfids.has(pfid)) {
|
|
1187
|
+
waitPfids.set(pfid, new Map());
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
for (let i = 0; i < deletes.length; i++) {
|
|
1191
|
+
const pfid = deletes[i].pfid;
|
|
1192
|
+
if (!waitPfids.has(pfid)) {
|
|
1193
|
+
waitPfids.set(pfid, new Map());
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
// const textureInfos = TextureController.instance.getTextureInfos();
|
|
1197
|
+
this.updateCurPanoramTextureInfo(waitPfids);
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* 更新当前全景纹理信息
|
|
1201
|
+
* @param waitPfids
|
|
1202
|
+
*/
|
|
1203
|
+
updateCurPanoramTextureInfo(waitPfids) {
|
|
1204
|
+
const { curPanorama } = this;
|
|
1205
|
+
if (curPanorama) {
|
|
1206
|
+
const { textures, textureMap } = TextureController.instance;
|
|
1207
|
+
const { tilePlanes } = curPanorama;
|
|
1208
|
+
let tWaitPfids;
|
|
1209
|
+
if (!waitPfids) {
|
|
1210
|
+
tWaitPfids = new Map();
|
|
1211
|
+
tilePlanes.forEach((plane) => {
|
|
1212
|
+
tWaitPfids.set(plane.pfid, new Map());
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
else {
|
|
1216
|
+
tWaitPfids = waitPfids;
|
|
1217
|
+
}
|
|
1218
|
+
textureMap.forEach((info, id) => {
|
|
1219
|
+
const { pfid } = info;
|
|
1220
|
+
const map = tWaitPfids.get(pfid);
|
|
1221
|
+
if (map) {
|
|
1222
|
+
map.set(id, info);
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
tilePlanes.forEach((plane) => {
|
|
1226
|
+
const { pfid } = plane;
|
|
1227
|
+
const map = tWaitPfids.get(pfid);
|
|
1228
|
+
if (map) {
|
|
1229
|
+
plane.updateTextures(textures, map);
|
|
1230
|
+
}
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* 删除全景点的纹理信息
|
|
1236
|
+
* @param panorama
|
|
1237
|
+
*/
|
|
1238
|
+
deleteTextureInfos(panorama) {
|
|
1239
|
+
panorama.tilePlanes.forEach((plane) => {
|
|
1240
|
+
const { textureMap } = plane;
|
|
1241
|
+
textureMap.forEach((info) => {
|
|
1242
|
+
TextureController.instance.deleteTexture(info);
|
|
1243
|
+
});
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* 清理全景点纹理信息
|
|
1248
|
+
* @param panorama
|
|
1249
|
+
*/
|
|
1250
|
+
disposeTextureInfos(panorama) {
|
|
1251
|
+
if (panorama) {
|
|
1252
|
+
panorama.tilePlanes.forEach((plane) => {
|
|
1253
|
+
const textureMap = plane.textureMap;
|
|
1254
|
+
TextureController.instance.deteteTextureMap(textureMap, true);
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
updateTexture() {
|
|
1259
|
+
return TextureController.instance.update();
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* 更新平面再相机中的信息
|
|
1263
|
+
* @param view
|
|
1264
|
+
* @returns
|
|
1265
|
+
*/
|
|
1266
|
+
updatePlaneInCamera(view) {
|
|
1267
|
+
if (!this.curPanorama)
|
|
1268
|
+
return;
|
|
1269
|
+
const updates = [];
|
|
1270
|
+
this.curPanorama.tilePlanes.forEach((plane) => {
|
|
1271
|
+
const toUpdates = plane.udpateInCamera(view);
|
|
1272
|
+
updates.push(...toUpdates);
|
|
1273
|
+
});
|
|
1274
|
+
for (let i = 0; i < updates.length; i++) {
|
|
1275
|
+
const info = updates[i];
|
|
1276
|
+
if (info.isInCamera) {
|
|
1277
|
+
TextureController.instance.addTexture(info);
|
|
1278
|
+
}
|
|
1279
|
+
else {
|
|
1280
|
+
TextureController.instance.deleteTexture(info);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
panoramaeUpdate(view) {
|
|
1285
|
+
return this.handlePanoramaUpdate(view);
|
|
1286
|
+
}
|
|
1287
|
+
update() {
|
|
1288
|
+
let isUpdate = false;
|
|
1289
|
+
// if (!this.initialized) {
|
|
1290
|
+
// return isUpdate;
|
|
1291
|
+
// }
|
|
1292
|
+
const textureUpdate = this.updateTexture();
|
|
1293
|
+
if (textureUpdate || this.planeNeedUpdate || this.renderFrame) {
|
|
1294
|
+
isUpdate = true;
|
|
1295
|
+
this.renderFrame = false;
|
|
1296
|
+
}
|
|
1297
|
+
if (this.planeNeedUpdate) {
|
|
1298
|
+
if (this.view) {
|
|
1299
|
+
this.panoramaeUpdate(this.view);
|
|
1300
|
+
}
|
|
1301
|
+
this.planeNeedUpdate = false;
|
|
1302
|
+
}
|
|
1303
|
+
return isUpdate;
|
|
1304
|
+
}
|
|
1305
|
+
// /**
|
|
1306
|
+
// * 跟下视图变化
|
|
1307
|
+
// * @param view
|
|
1308
|
+
// */
|
|
1309
|
+
// public renderingViewChanged(view: View): void {
|
|
1310
|
+
// if (this.planeNeedUpdate) {
|
|
1311
|
+
// this.panoramaeUpdate(view);
|
|
1312
|
+
// this.planeNeedUpdate = false;
|
|
1313
|
+
// }
|
|
1314
|
+
// }
|
|
1315
|
+
/**
|
|
1316
|
+
* 全景点挂载
|
|
1317
|
+
* @param pano
|
|
1318
|
+
*/
|
|
1319
|
+
panoramaMount(pano) {
|
|
1320
|
+
pano.mount();
|
|
1321
|
+
this.emit(Events.DID_LOAD_PANORAMA, pano.pid);
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* 全景点卸载
|
|
1325
|
+
* @param pano
|
|
1326
|
+
*/
|
|
1327
|
+
panoramaUnmount(pano) {
|
|
1328
|
+
pano.unMount();
|
|
1329
|
+
TextureController.instance.deleteTexturesByPid(pano.pid, true);
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* 清理
|
|
1333
|
+
*/
|
|
1334
|
+
dispose() {
|
|
1335
|
+
this.planeMap.clear();
|
|
1336
|
+
this.setEnabled(false);
|
|
1337
|
+
TextureController.instance.off(TextureEventEnum.TEXTURE_UPDATE, this.eventListeners.onTextureUpdate);
|
|
1338
|
+
if (this.curPanorama) {
|
|
1339
|
+
this.panoramaUnmount(this.curPanorama);
|
|
1340
|
+
}
|
|
1341
|
+
if (this.modelMaterial) {
|
|
1342
|
+
this.modelMaterial.dispose();
|
|
1343
|
+
}
|
|
1344
|
+
if (this.instantTranslationMaterial) {
|
|
1345
|
+
this.instantTranslationMaterial.dispose();
|
|
1346
|
+
}
|
|
1347
|
+
TextureCache.disposeAll();
|
|
1348
|
+
CubeTextureCache.disposeAll();
|
|
1349
|
+
super.dispose();
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
TilePanoramaController.DirectionVectorScalar = -0.0001;
|
|
1353
|
+
export { TilePanoramaController };
|