@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,875 @@
|
|
|
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
|
+
/* eslint-disable no-continue */
|
|
11
|
+
/* eslint-disable no-await-in-loop */
|
|
12
|
+
import { Externals } from '../stage/externals';
|
|
13
|
+
import { Controller } from '..';
|
|
14
|
+
import { getTextPixel, TEXT_SEGMENT, TileUtil, TEXT_MAX, USE_CANVAS, USE_TEXTURE_BLACK, CubeFaceConfig, } from '../utils/tile-util';
|
|
15
|
+
class TextureEventEnum {
|
|
16
|
+
}
|
|
17
|
+
TextureEventEnum.TEXTURE_UPDATE = 'texture.update';
|
|
18
|
+
// const SHOW_CANVAS = false;
|
|
19
|
+
const DELETE_TIME = 30 * 60;
|
|
20
|
+
class TextureController extends Controller {
|
|
21
|
+
// public initMap: Map<string, TileTextureInfo>;
|
|
22
|
+
// public isTest: boolean;
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
// console.log('texture-contorller', 'constructor');
|
|
26
|
+
this.textures = [];
|
|
27
|
+
this.textureInfoIds = [];
|
|
28
|
+
this.addingMap = new Map();
|
|
29
|
+
this.deletingMap = new Map();
|
|
30
|
+
// this.initMap = new Map<string, TileTextureInfo>();
|
|
31
|
+
this.loadingMap = new Map();
|
|
32
|
+
this.loadedMap = new Map();
|
|
33
|
+
this.loadedImageDataMap = new Map();
|
|
34
|
+
this.textureMap = new Map();
|
|
35
|
+
this.loadedImageDataMap2 = new Map();
|
|
36
|
+
this.context2ds = [];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 获取2d context
|
|
40
|
+
*/
|
|
41
|
+
get ctx() {
|
|
42
|
+
if (!this._ctx) {
|
|
43
|
+
const ctx = this.getNewContext2d(getTextPixel());
|
|
44
|
+
if (ctx) {
|
|
45
|
+
this._ctx = ctx;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return this._ctx;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 获取固定大小的context2d
|
|
52
|
+
* @param size
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
getNewContext2d(size) {
|
|
56
|
+
// console.log('texture-contorller', 'getNewContext2d');
|
|
57
|
+
const canvas = document.createElement('canvas');
|
|
58
|
+
canvas.width = size;
|
|
59
|
+
canvas.height = size;
|
|
60
|
+
// if (SHOW_CANVAS) {
|
|
61
|
+
// const cantainer = document.getElementById('container');
|
|
62
|
+
// if (cantainer) {
|
|
63
|
+
// cantainer.appendChild(canvas);
|
|
64
|
+
// }
|
|
65
|
+
// }
|
|
66
|
+
const ctx = canvas.getContext('2d');
|
|
67
|
+
return ctx;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 获取context2d
|
|
71
|
+
* @param index
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
getContext2d(index) {
|
|
75
|
+
// console.log('texture-contorller', 'getContext2d');
|
|
76
|
+
let ctx = this.context2ds[index];
|
|
77
|
+
if (!ctx) {
|
|
78
|
+
const newCtx = this.getNewContext2d(getTextPixel() * TEXT_SEGMENT);
|
|
79
|
+
if (newCtx) {
|
|
80
|
+
ctx = this.context2ds[index] = newCtx;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return ctx;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 绑定视图
|
|
87
|
+
* @param view 视图
|
|
88
|
+
*/
|
|
89
|
+
bindView(view) {
|
|
90
|
+
this.view = view;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 添加纹理信息
|
|
94
|
+
* @param info 纹理信息
|
|
95
|
+
*/
|
|
96
|
+
addTexture(info) {
|
|
97
|
+
const id = info.id;
|
|
98
|
+
// console.log('addTexture', id);
|
|
99
|
+
if (this.textureMap.has(id)) {
|
|
100
|
+
if (this.deletingMap.has(id)) {
|
|
101
|
+
this.deletingMap.delete(id);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else if (this.loadingMap.has(id)) {
|
|
105
|
+
this.loadingMap.set(id, info);
|
|
106
|
+
}
|
|
107
|
+
else if (this.loadedMap.has(id)) {
|
|
108
|
+
this.loadedMap.set(id, info);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.addingMap.set(id, info);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* 根据pid获取已加载纹理的一个立方体纹理
|
|
116
|
+
* @ignore
|
|
117
|
+
* @param pid
|
|
118
|
+
* @returns
|
|
119
|
+
*/
|
|
120
|
+
getCubeTextureByPid(pid) {
|
|
121
|
+
const ref = [];
|
|
122
|
+
const { loadedImageDataMap, loadedImageDataMap2 } = this;
|
|
123
|
+
CubeFaceConfig.forEach((config) => {
|
|
124
|
+
const id = TileUtil.getTileInfoId(pid + (config.face + 1) / 10, 0, 0);
|
|
125
|
+
if (USE_CANVAS) {
|
|
126
|
+
const img = loadedImageDataMap2.get(id);
|
|
127
|
+
if (img) {
|
|
128
|
+
ref.push(img);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
const imgData = loadedImageDataMap.get(id);
|
|
133
|
+
if (imgData) {
|
|
134
|
+
ref.push(imgData);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
const { THREE } = Externals.getInstance();
|
|
139
|
+
if (ref.length === 6) {
|
|
140
|
+
const cubeText = new THREE.CubeTexture(ref);
|
|
141
|
+
cubeText.needsUpdate = true;
|
|
142
|
+
return cubeText;
|
|
143
|
+
}
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* 初始化纹理信息
|
|
148
|
+
* @ignore
|
|
149
|
+
* @param infos
|
|
150
|
+
* @returns 0为初始化失败,1为初始化成功
|
|
151
|
+
*/
|
|
152
|
+
initTextures(infos) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
// console.log('texture-contorller', 'initTexture');
|
|
155
|
+
const initMap = new Map();
|
|
156
|
+
for (let i = 0; i < infos.length; i++) {
|
|
157
|
+
const info = infos[i];
|
|
158
|
+
const id = info.id;
|
|
159
|
+
if (!this.addingMap.has(id)) {
|
|
160
|
+
if (this.deletingMap.has(id)) {
|
|
161
|
+
initMap.set(id, info);
|
|
162
|
+
this.deletingMap.delete(id);
|
|
163
|
+
}
|
|
164
|
+
else if (!this.textureMap.has(id)) {
|
|
165
|
+
// this.addingMap.set(id, info);
|
|
166
|
+
initMap.set(id, info);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
initMap.set(id, info);
|
|
171
|
+
this.addingMap.delete(id);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
let res = 1;
|
|
175
|
+
if (initMap.size) {
|
|
176
|
+
res = yield this.initTexturesAsync(initMap);
|
|
177
|
+
}
|
|
178
|
+
if (res) {
|
|
179
|
+
// console.log('texture-contorller', 'initTexture', 1);
|
|
180
|
+
while (initMap.size) {
|
|
181
|
+
const updates = [];
|
|
182
|
+
const deletes = [];
|
|
183
|
+
// console.log('texture-contorller', 'initTexture', 2);
|
|
184
|
+
const isUpdate = this.updateTextures(updates, deletes, initMap);
|
|
185
|
+
// console.log('texture-contorller', 'initTexture', updates, deletes, isUpdate, 3);
|
|
186
|
+
if (isUpdate) {
|
|
187
|
+
this.emit(TextureEventEnum.TEXTURE_UPDATE, updates, deletes);
|
|
188
|
+
}
|
|
189
|
+
// console.log('texture-contorller', 'initTexture', 4);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return res;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* 删除纹理map
|
|
197
|
+
* @param map 要删除的信息图
|
|
198
|
+
* @param deleteFrize 是否删除冻结信息
|
|
199
|
+
*/
|
|
200
|
+
deteteTextureMap(map, deleteFrize) {
|
|
201
|
+
// console.log('texture-contorller', 'deleteTexture');
|
|
202
|
+
map.forEach((info) => {
|
|
203
|
+
this.deleteTexture(info, deleteFrize);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* 删除纹理
|
|
208
|
+
* @param info 纹理信息
|
|
209
|
+
* @param deleteFrize 是否删除冻结信息
|
|
210
|
+
*/
|
|
211
|
+
deleteTexture(info, deleteFrize) {
|
|
212
|
+
// console.log('texture-contorller', 'deleteTexture');
|
|
213
|
+
const id = info.id;
|
|
214
|
+
if (!this.deletingMap.has(id)) {
|
|
215
|
+
if (this.addingMap.has(id)) {
|
|
216
|
+
this.addingMap.delete(id);
|
|
217
|
+
}
|
|
218
|
+
else if (this.loadingMap.has(id)) {
|
|
219
|
+
this.loadingMap.delete(id);
|
|
220
|
+
}
|
|
221
|
+
else if (this.loadedMap.has(id)) {
|
|
222
|
+
this.loadedMap.delete(id);
|
|
223
|
+
this.loadedImageDataMap.delete(id);
|
|
224
|
+
}
|
|
225
|
+
else if (this.textureMap.has(id)) {
|
|
226
|
+
info.time = 0;
|
|
227
|
+
if (deleteFrize || !info.frize) {
|
|
228
|
+
this.deletingMap.set(id, info);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* 获取纹理信息列表
|
|
235
|
+
* @returns
|
|
236
|
+
*/
|
|
237
|
+
getTextureInfos() {
|
|
238
|
+
// console.log('texture-contorller', 'getTextureInfos');
|
|
239
|
+
const ts = [];
|
|
240
|
+
for (let i = 0; i < this.textures.length; i++) {
|
|
241
|
+
const infoIds = this.textureInfoIds[i];
|
|
242
|
+
for (let j = 0; j < infoIds.length; j++) {
|
|
243
|
+
if (infoIds[j]) {
|
|
244
|
+
const info = this.textureMap.get(infoIds[j]);
|
|
245
|
+
if (info) {
|
|
246
|
+
ts.push(info);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return ts;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* 异步加载纹理
|
|
255
|
+
*/
|
|
256
|
+
loadTexturesAsync() {
|
|
257
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
258
|
+
// console.log('texture-contorller', 'loadTexturesAsync');
|
|
259
|
+
if (!this.loading) {
|
|
260
|
+
const { addingMap, loadingMap, loadedMap, loadedImageDataMap, loadedImageDataMap2, } = this;
|
|
261
|
+
const addings = Array.from(addingMap);
|
|
262
|
+
addings.sort((adding1, adding2) => adding1[1].centerDis - adding2[1].centerDis);
|
|
263
|
+
while (addings[0]) {
|
|
264
|
+
const adding = addings.shift();
|
|
265
|
+
if (!adding)
|
|
266
|
+
continue;
|
|
267
|
+
const infoKey = adding[0];
|
|
268
|
+
if (!infoKey)
|
|
269
|
+
continue;
|
|
270
|
+
if (adding) {
|
|
271
|
+
const info = addingMap.get(infoKey);
|
|
272
|
+
if (info) {
|
|
273
|
+
addingMap.delete(infoKey);
|
|
274
|
+
loadingMap.set(infoKey, info);
|
|
275
|
+
const imgInfo = TileUtil.getImageInfo(info);
|
|
276
|
+
if (USE_CANVAS) {
|
|
277
|
+
// eslint-disable-next-line no-await-in-loop
|
|
278
|
+
const image = yield this.loadImgAsync2(imgInfo.url);
|
|
279
|
+
if (loadingMap.has(infoKey)) {
|
|
280
|
+
loadingMap.delete(infoKey);
|
|
281
|
+
loadedMap.set(infoKey, info);
|
|
282
|
+
loadedImageDataMap2.set(infoKey, image);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
// eslint-disable-next-line no-await-in-loop
|
|
287
|
+
const imgData = yield this.loadImgAsync(imgInfo.url);
|
|
288
|
+
if (imgData) {
|
|
289
|
+
if (loadingMap.has(infoKey)) {
|
|
290
|
+
loadingMap.delete(infoKey);
|
|
291
|
+
loadedMap.set(infoKey, info);
|
|
292
|
+
loadedImageDataMap.set(infoKey, imgData);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
this.loading = false;
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* 异步初始化纹理
|
|
305
|
+
* @param infoMap 纹理信息图
|
|
306
|
+
* @returns 0为初始化失败,1为初始化成功
|
|
307
|
+
*/
|
|
308
|
+
initTexturesAsync(infoMap) {
|
|
309
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
310
|
+
return new Promise((resolve) => {
|
|
311
|
+
const { loadedImageDataMap, loadedImageDataMap2 } = this;
|
|
312
|
+
const keys = Array.from(infoMap.keys());
|
|
313
|
+
const count = keys.length;
|
|
314
|
+
if (count < 1) {
|
|
315
|
+
resolve();
|
|
316
|
+
}
|
|
317
|
+
let index = 0;
|
|
318
|
+
const success = () => {
|
|
319
|
+
index++;
|
|
320
|
+
if (index >= count) {
|
|
321
|
+
resolve(1);
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
const error = () => {
|
|
325
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
326
|
+
resolve(0);
|
|
327
|
+
};
|
|
328
|
+
for (let i = 0; i < count; i++) {
|
|
329
|
+
const infoKey = keys[i];
|
|
330
|
+
const info = infoMap.get(infoKey);
|
|
331
|
+
if (info) {
|
|
332
|
+
const imgInfo = TileUtil.getImageInfo(info);
|
|
333
|
+
const url = imgInfo.url;
|
|
334
|
+
if (USE_CANVAS) {
|
|
335
|
+
this.loadImgAsync2(url).then((img) => {
|
|
336
|
+
loadedImageDataMap2.set(infoKey, img);
|
|
337
|
+
success();
|
|
338
|
+
}).catch(error);
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
this.loadImgAsync(url).then((imgData) => {
|
|
342
|
+
loadedImageDataMap.set(infoKey, imgData);
|
|
343
|
+
success();
|
|
344
|
+
}).catch(error);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* 根据pid删除纹理
|
|
353
|
+
* @param pid
|
|
354
|
+
* @param deleteFrize
|
|
355
|
+
*/
|
|
356
|
+
deleteTexturesByPid(pid, deleteFrize) {
|
|
357
|
+
const idStart = `${pid}.`;
|
|
358
|
+
const { textureInfoIds, textureMap, addingMap, deletingMap, loadedImageDataMap, loadedMap, loadingMap, } = this;
|
|
359
|
+
// console.log('delete pid', pid);
|
|
360
|
+
// console.log('delete before', Array.from(textureMap.keys()));
|
|
361
|
+
textureMap.forEach((info, id) => {
|
|
362
|
+
if (id.startsWith(idStart)) {
|
|
363
|
+
if (deleteFrize || !info.frize) {
|
|
364
|
+
const { x, y } = TileUtil.getXY(info.textureIndex, 100);
|
|
365
|
+
delete textureInfoIds[y][x];
|
|
366
|
+
textureMap.delete(id);
|
|
367
|
+
if (loadedImageDataMap.has(id)) {
|
|
368
|
+
this.loadedImageDataMap.delete(id);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
// console.log('delete after', Array.from(textureMap.keys()));
|
|
374
|
+
addingMap.forEach((info, id) => {
|
|
375
|
+
if (id.startsWith(idStart)) {
|
|
376
|
+
if (deleteFrize || !info.frize) {
|
|
377
|
+
addingMap.delete(id);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
// console.log('addingmap', Array.from(addingMap.keys()));
|
|
382
|
+
deletingMap.forEach((info, id) => {
|
|
383
|
+
if (id.startsWith(idStart)) {
|
|
384
|
+
if (deleteFrize || !info.frize) {
|
|
385
|
+
deletingMap.delete(id);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
// console.log('deletingMap', Array.from(deletingMap.keys()));
|
|
390
|
+
loadedMap.forEach((info, id) => {
|
|
391
|
+
if (id.startsWith(idStart)) {
|
|
392
|
+
if (deleteFrize || !info.frize) {
|
|
393
|
+
loadedMap.delete(id);
|
|
394
|
+
loadedImageDataMap.delete(id);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
// console.log('loadedMap', Array.from(loadedMap.keys()));
|
|
399
|
+
loadingMap.forEach((info, id) => {
|
|
400
|
+
if (id.startsWith(idStart)) {
|
|
401
|
+
if (deleteFrize || !info.frize) {
|
|
402
|
+
loadingMap.delete(id);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
// console.log('loadingMap', Array.from(loadingMap.keys()));
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* 更新纹理信息
|
|
410
|
+
* @param updates 更新列表,外部传入
|
|
411
|
+
* @param deletes 删除列表,外部传入
|
|
412
|
+
* @param initMap 初始化加载图
|
|
413
|
+
* @returns
|
|
414
|
+
*/
|
|
415
|
+
updateTextures(updates, deletes, initMap) {
|
|
416
|
+
// console.log('texture-contorller', 'updateTextures');
|
|
417
|
+
// 判定是否有更新的texture,更新到一张纹理并通知当前纹理对象内容。
|
|
418
|
+
const { loadedMap, deletingMap, textureInfoIds, textures, loadedImageDataMap, loadedImageDataMap2, } = this;
|
|
419
|
+
const loadMap = initMap || loadedMap;
|
|
420
|
+
const { maxIndex, create } = this.testEmptyMaxCount(textureInfoIds, deletingMap, loadMap);
|
|
421
|
+
if (maxIndex === -1) {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
// console.log('updateTextures', Array.from(loadedMap.keys()));
|
|
425
|
+
if (create) {
|
|
426
|
+
if (USE_CANVAS) {
|
|
427
|
+
textures[maxIndex] = this.createCanvasTexture(maxIndex);
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
textures[maxIndex] = this.createMergeTexture();
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
deletingMap.forEach((info, id) => {
|
|
434
|
+
const { x, y } = TileUtil.getXY(info.textureIndex, 100);
|
|
435
|
+
if (y === maxIndex) {
|
|
436
|
+
this.textureMap.delete(id);
|
|
437
|
+
delete textureInfoIds[y][x];
|
|
438
|
+
deletes.push(info);
|
|
439
|
+
if (USE_CANVAS) {
|
|
440
|
+
loadedImageDataMap2.delete(id);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
deletes.forEach((info) => {
|
|
445
|
+
deletingMap.delete(info.id);
|
|
446
|
+
});
|
|
447
|
+
let tList = textureInfoIds[maxIndex];
|
|
448
|
+
if (!tList) {
|
|
449
|
+
tList = textureInfoIds[maxIndex] = [];
|
|
450
|
+
}
|
|
451
|
+
const count = TEXT_SEGMENT * TEXT_SEGMENT;
|
|
452
|
+
const loadedList = Array.from(loadMap);
|
|
453
|
+
loadedList.sort((a, b) => a[1].centerDis - b[1].centerDis);
|
|
454
|
+
let textureChangeCount = 0;
|
|
455
|
+
for (let i = 0; i < count; i++) {
|
|
456
|
+
if (!loadedList[0]) {
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
const t = tList[i];
|
|
460
|
+
if (!t) {
|
|
461
|
+
if (textureChangeCount >= TileUtil.updateTextureMax && !initMap) {
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
const [tId, tInfo] = loadedList.shift();
|
|
465
|
+
loadMap.delete(tId);
|
|
466
|
+
tInfo.textureIndex = maxIndex * 100 + i;
|
|
467
|
+
tList[i] = tId;
|
|
468
|
+
this.textureMap.set(tId, tInfo);
|
|
469
|
+
updates.push(tInfo);
|
|
470
|
+
if (USE_CANVAS) {
|
|
471
|
+
const image = loadedImageDataMap2.get(tId);
|
|
472
|
+
const ctx = this.getContext2d(maxIndex);
|
|
473
|
+
this.updateCanvasTexture(textures[maxIndex], ctx, image, i);
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
const imageData = loadedImageDataMap.get(tId);
|
|
477
|
+
this.updateMergeTexture(textures[maxIndex], imageData, i);
|
|
478
|
+
if (!tInfo.frize) {
|
|
479
|
+
loadedImageDataMap.delete(tId);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
// if (maxIndex === 0) {
|
|
483
|
+
// this.drawingImage(textures[maxIndex]);
|
|
484
|
+
// }
|
|
485
|
+
textureChangeCount++;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return updates.length > 0 || deletes.length > 0;
|
|
489
|
+
}
|
|
490
|
+
// public drawingImage(texture: NS_THREE.DataTexture): void {
|
|
491
|
+
// const context2d = (window as any).context2d;
|
|
492
|
+
// if (context2d) {
|
|
493
|
+
// const image = new ImageData(2048, 2048);
|
|
494
|
+
// image.data.set(texture.image.data);
|
|
495
|
+
// context2d.putImageData(image, 0, 0);
|
|
496
|
+
// // context2d.createPattern(texture, 'no-repeat');
|
|
497
|
+
// }
|
|
498
|
+
// }
|
|
499
|
+
/**
|
|
500
|
+
* 测试空节点最大数量
|
|
501
|
+
* @param infos
|
|
502
|
+
* @param deletings
|
|
503
|
+
* @param loadedMap
|
|
504
|
+
* @returns
|
|
505
|
+
*/
|
|
506
|
+
testEmptyMaxCount(infos, deletings, loadedMap) {
|
|
507
|
+
// console.log('texture-contorller', 'testEmptyMaxCount');
|
|
508
|
+
if (!deletings.size && !loadedMap.size) {
|
|
509
|
+
return {
|
|
510
|
+
maxIndex: -1, maxCount: 0, create: false,
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
const index = [];
|
|
514
|
+
const infosCount = infos.length;
|
|
515
|
+
for (let i = 0; i < infosCount; i++) {
|
|
516
|
+
index[i] = 0;
|
|
517
|
+
}
|
|
518
|
+
// const willDelete = [] as TileTextureInfo[][];
|
|
519
|
+
const deleteIndex = Array.from(index);
|
|
520
|
+
if (deletings) {
|
|
521
|
+
deletings.forEach((info) => {
|
|
522
|
+
if (info.time > DELETE_TIME) { // 到达删除时间的info加入删除计数
|
|
523
|
+
const { y } = TileUtil.getXY(info.textureIndex, 100);
|
|
524
|
+
deleteIndex[y]++;
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
const count = TEXT_SEGMENT * TEXT_SEGMENT;
|
|
529
|
+
for (let i = 0; i < infosCount; i++) {
|
|
530
|
+
const info = infos[i];
|
|
531
|
+
for (let j = 0; j < count; j++) {
|
|
532
|
+
if (info[j]) {
|
|
533
|
+
index[i]++;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
const t = index.map((value, i) => count - value + (deleteIndex[i] || 0));
|
|
538
|
+
const loadedSize = loadedMap.size;
|
|
539
|
+
let maxCount = 0;
|
|
540
|
+
let maxIndex = 0;
|
|
541
|
+
for (let i = 0; i < t.length; i++) {
|
|
542
|
+
const tc = t[i];
|
|
543
|
+
const dc = deleteIndex[i];
|
|
544
|
+
if (loadedSize) {
|
|
545
|
+
if (maxCount >= TileUtil.updateTextureMax || maxCount >= loadedSize) {
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
if (tc > maxCount) {
|
|
549
|
+
maxCount = tc;
|
|
550
|
+
maxIndex = i;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
else if (dc > maxCount) {
|
|
554
|
+
maxCount = dc;
|
|
555
|
+
maxIndex = i;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
let create = false;
|
|
559
|
+
if (maxCount === 0) {
|
|
560
|
+
maxIndex = infos.length;
|
|
561
|
+
if (maxIndex >= TEXT_MAX) {
|
|
562
|
+
// 如果超过纹理上限, 则按时间删除时间大小排序
|
|
563
|
+
let willDeleteInfo;
|
|
564
|
+
deletings.forEach((info) => {
|
|
565
|
+
if (!willDeleteInfo || willDeleteInfo.time > info.time) {
|
|
566
|
+
willDeleteInfo = info;
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
if (willDeleteInfo) {
|
|
570
|
+
maxIndex = TileUtil.getXY(willDeleteInfo.textureIndex, 100).y;
|
|
571
|
+
maxCount = 1;
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
// 没有适合删除的
|
|
575
|
+
maxIndex = -1;
|
|
576
|
+
maxCount = 0;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
else if (loadedSize === 0) {
|
|
580
|
+
maxIndex = -1;
|
|
581
|
+
maxCount = 0;
|
|
582
|
+
create = false;
|
|
583
|
+
}
|
|
584
|
+
else {
|
|
585
|
+
maxCount = count;
|
|
586
|
+
create = true;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
return { maxIndex, maxCount, create };
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* 创建合并纹理
|
|
593
|
+
* @returns
|
|
594
|
+
*/
|
|
595
|
+
createMergeTexture() {
|
|
596
|
+
// console.log('texture-contorller', 'createMergeTexture');
|
|
597
|
+
const { THREE } = Externals.getInstance();
|
|
598
|
+
const TEXT_PIXEL = getTextPixel();
|
|
599
|
+
const buffer = new Uint8Array(TEXT_PIXEL * TEXT_PIXEL * TEXT_SEGMENT * TEXT_SEGMENT * 4);
|
|
600
|
+
const texture = new THREE.DataTexture(buffer, TEXT_PIXEL * TEXT_SEGMENT, TEXT_PIXEL * TEXT_SEGMENT);
|
|
601
|
+
if (USE_TEXTURE_BLACK) {
|
|
602
|
+
const count = buffer.length;
|
|
603
|
+
for (let i = 0; i < count; i += 4) {
|
|
604
|
+
buffer[i + 3] = 1;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
return texture;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* 创建canvas纹理
|
|
611
|
+
* @param index 下标
|
|
612
|
+
* @returns
|
|
613
|
+
*/
|
|
614
|
+
createCanvasTexture(index) {
|
|
615
|
+
// console.log('texture-contorller', 'createCanvasTexture');
|
|
616
|
+
const { THREE } = Externals.getInstance();
|
|
617
|
+
const ctx = this.getContext2d(index);
|
|
618
|
+
if (USE_TEXTURE_BLACK) {
|
|
619
|
+
ctx.canvas.style.backgroundColor = '#000';
|
|
620
|
+
}
|
|
621
|
+
const texture = new THREE.Texture(ctx.canvas);
|
|
622
|
+
return texture;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* 更新canvas纹理
|
|
626
|
+
* @param mergeTexture
|
|
627
|
+
* @param ctx
|
|
628
|
+
* @param image
|
|
629
|
+
* @param index
|
|
630
|
+
*/
|
|
631
|
+
updateCanvasTexture(mergeTexture, ctx, image, index) {
|
|
632
|
+
// console.log('texture-contorller', 'updateCanvasTexture');
|
|
633
|
+
const { x, y } = TileUtil.getXY(index, TEXT_SEGMENT);
|
|
634
|
+
const TEXT_PIXEL = getTextPixel();
|
|
635
|
+
ctx.drawImage(image, x * TEXT_PIXEL, (TEXT_SEGMENT - 1 - y) * TEXT_PIXEL);
|
|
636
|
+
mergeTexture.needsUpdate = true;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* 更新合并纹理
|
|
640
|
+
* @param mergeTexture 合并纹理
|
|
641
|
+
* @param imaData 图片数据
|
|
642
|
+
* @param index 下标
|
|
643
|
+
*/
|
|
644
|
+
updateMergeTexture(mergeTexture, imaData, index) {
|
|
645
|
+
// console.log('texture-contorller', 'updateMergeTexture');
|
|
646
|
+
const buffer = mergeTexture.image.data;
|
|
647
|
+
const tBuffer = imaData.data;
|
|
648
|
+
const { x, y } = TileUtil.getXY(index, TEXT_SEGMENT);
|
|
649
|
+
const TEXT_PIXEL = getTextPixel();
|
|
650
|
+
const length = TEXT_SEGMENT * TEXT_PIXEL * 4;
|
|
651
|
+
const tLength = TEXT_PIXEL * 4;
|
|
652
|
+
const base = y * length * TEXT_PIXEL + x * tLength;
|
|
653
|
+
for (let i = 0; i < TEXT_PIXEL; i++) {
|
|
654
|
+
for (let j = 0; j < TEXT_PIXEL; j++) {
|
|
655
|
+
const bi = base + i * length + j * 4;
|
|
656
|
+
const tbi = i * tLength + j * 4;
|
|
657
|
+
buffer[bi] = tBuffer[tbi];
|
|
658
|
+
buffer[bi + 1] = tBuffer[tbi + 1];
|
|
659
|
+
buffer[bi + 2] = tBuffer[tbi + 2];
|
|
660
|
+
buffer[bi + 3] = tBuffer[tbi + 3];
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
mergeTexture.needsUpdate = true;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* 将texture2 index2位置的纹理合并到textur1 index1的位置上
|
|
667
|
+
* @param mergeTexture1 纹理1
|
|
668
|
+
* @param index1 下标1
|
|
669
|
+
* @param mergeTexture2 纹理2
|
|
670
|
+
* @param index2 下标2
|
|
671
|
+
*/
|
|
672
|
+
updateMergeTexture2(mergeTexture1, index1, mergeTexture2, index2) {
|
|
673
|
+
// console.log('texture-contorller', 'updateMergeTexture2');
|
|
674
|
+
const buffer1 = mergeTexture1.image.data;
|
|
675
|
+
const buffer2 = mergeTexture2.image.data;
|
|
676
|
+
const { x: x1, y: y1 } = TileUtil.getXY(index1, TEXT_SEGMENT);
|
|
677
|
+
const { x: x2, y: y2 } = TileUtil.getXY(index2, TEXT_SEGMENT);
|
|
678
|
+
const TEXT_PIXEL = getTextPixel();
|
|
679
|
+
const length = TEXT_SEGMENT * TEXT_PIXEL * 4;
|
|
680
|
+
const tLength = TEXT_PIXEL * 4;
|
|
681
|
+
const base1 = y1 * length * TEXT_PIXEL + x1 * tLength;
|
|
682
|
+
const base2 = y2 * length * TEXT_PIXEL + x2 * tLength;
|
|
683
|
+
for (let i = 0; i < TEXT_PIXEL; i++) {
|
|
684
|
+
for (let j = 0; j < TEXT_PIXEL; j++) {
|
|
685
|
+
const b1 = base1 + i * length + j * 4;
|
|
686
|
+
const b2 = base2 + i * length + j * 4;
|
|
687
|
+
buffer1[b1] = buffer2[b2];
|
|
688
|
+
buffer1[b1 + 1] = buffer2[b2 + 1];
|
|
689
|
+
buffer1[b1 + 2] = buffer2[b2 + 2];
|
|
690
|
+
buffer1[b1 + 3] = buffer2[b2 + 3];
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
mergeTexture1.needsUpdate = true;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* 异步加载图片
|
|
697
|
+
* @param url 图片url
|
|
698
|
+
* @returns 图片纹理信息
|
|
699
|
+
*/
|
|
700
|
+
loadImgAsync(url) {
|
|
701
|
+
// console.log('texture-contorller', 'loadImgAsync2');
|
|
702
|
+
const img = new Image();
|
|
703
|
+
img.setAttribute('crossOrigin', 'anonymous');
|
|
704
|
+
const { ctx } = this;
|
|
705
|
+
return new Promise(((resolve, reject) => {
|
|
706
|
+
img.onload = () => {
|
|
707
|
+
ctx.drawImage(img, 0, 0);
|
|
708
|
+
const TEXT_PIXEL = getTextPixel();
|
|
709
|
+
// console.time(`${url}get`);
|
|
710
|
+
const imgData = ctx.getImageData(0, 0, TEXT_PIXEL, TEXT_PIXEL);
|
|
711
|
+
// console.timeEnd(`${url}get`);
|
|
712
|
+
resolve(imgData);
|
|
713
|
+
};
|
|
714
|
+
img.onerror = () => {
|
|
715
|
+
reject();
|
|
716
|
+
};
|
|
717
|
+
img.src = url;
|
|
718
|
+
}));
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* 异步加载图片2
|
|
722
|
+
* @param url 图片url
|
|
723
|
+
* @returns 图片元素
|
|
724
|
+
*/
|
|
725
|
+
loadImgAsync2(url) {
|
|
726
|
+
// console.log('texture-contorller', 'loadImgAsync2');
|
|
727
|
+
const img = new Image();
|
|
728
|
+
img.setAttribute('crossOrigin', 'anonymous');
|
|
729
|
+
return new Promise((resolve, reject) => {
|
|
730
|
+
img.onload = () => {
|
|
731
|
+
resolve(img);
|
|
732
|
+
};
|
|
733
|
+
img.onerror = () => {
|
|
734
|
+
reject();
|
|
735
|
+
};
|
|
736
|
+
img.src = url;
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* 更新删除的纹理
|
|
741
|
+
*/
|
|
742
|
+
updateDeletingTextures() {
|
|
743
|
+
// console.log('texture-contorller', 'updateDeletingTextures');
|
|
744
|
+
const { deletingMap } = this;
|
|
745
|
+
deletingMap.forEach((info) => {
|
|
746
|
+
info.time++;
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* 格式化纹理
|
|
751
|
+
* @param updates
|
|
752
|
+
* @returns
|
|
753
|
+
*/
|
|
754
|
+
formatTextures(updates) {
|
|
755
|
+
// console.log('texture-contorller', 'formatTextures');
|
|
756
|
+
const { textureInfoIds, textureMap, textures, loadedImageDataMap2, } = this;
|
|
757
|
+
const count = TEXT_SEGMENT * TEXT_SEGMENT;
|
|
758
|
+
const infoCount = textureInfoIds.length;
|
|
759
|
+
let i = 0;
|
|
760
|
+
let j = infoCount - 1;
|
|
761
|
+
let ii = 0;
|
|
762
|
+
let jj = count;
|
|
763
|
+
let tId;
|
|
764
|
+
let changeTextureIndex = -1;
|
|
765
|
+
let willBreak = false;
|
|
766
|
+
while (i < j) {
|
|
767
|
+
if (tId) {
|
|
768
|
+
if (willBreak) {
|
|
769
|
+
break;
|
|
770
|
+
}
|
|
771
|
+
const iId = textureInfoIds[i][ii];
|
|
772
|
+
if (!iId) {
|
|
773
|
+
textureInfoIds[i][ii] = tId;
|
|
774
|
+
delete textureInfoIds[j][jj];
|
|
775
|
+
const info = textureMap.get(tId);
|
|
776
|
+
if (info) {
|
|
777
|
+
updates.push(info);
|
|
778
|
+
info.textureIndex = i * 100 + ii;
|
|
779
|
+
if (USE_CANVAS) {
|
|
780
|
+
const img = loadedImageDataMap2.get(info.id);
|
|
781
|
+
if (img) {
|
|
782
|
+
this.updateCanvasTexture(textures[i], this.getContext2d(i), img, ii);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
else {
|
|
786
|
+
this.updateMergeTexture2(textures[i], ii, textures[j], jj);
|
|
787
|
+
}
|
|
788
|
+
if (changeTextureIndex === -1) {
|
|
789
|
+
changeTextureIndex = i;
|
|
790
|
+
}
|
|
791
|
+
else if (changeTextureIndex !== i) {
|
|
792
|
+
// 一次更新一个纹理
|
|
793
|
+
willBreak = true;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
tId = undefined;
|
|
797
|
+
}
|
|
798
|
+
ii++;
|
|
799
|
+
if (ii >= count) {
|
|
800
|
+
i++;
|
|
801
|
+
ii = 0;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
else {
|
|
805
|
+
jj--;
|
|
806
|
+
if (jj < 0) {
|
|
807
|
+
j--;
|
|
808
|
+
jj = count;
|
|
809
|
+
}
|
|
810
|
+
tId = textureInfoIds[j][jj];
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
if (j < infoCount - 1) {
|
|
814
|
+
// 删除多余纹理
|
|
815
|
+
textureInfoIds.splice(j + 1, infoCount - 1 - j);
|
|
816
|
+
const deleteTextures = textures.splice(j + 1, infoCount - 1 - j);
|
|
817
|
+
if (USE_CANVAS) {
|
|
818
|
+
// const ctxs = this.context2ds.splice(j + 1, infoCount - 1 - j);
|
|
819
|
+
// ctxs.forEach((ctx) => {
|
|
820
|
+
// const canvas = ctx.canvas;
|
|
821
|
+
// // if (SHOW_CANVAS) {
|
|
822
|
+
// // if (canvas.parentElement) {
|
|
823
|
+
// // canvas.parentElement.removeChild(canvas);
|
|
824
|
+
// // }
|
|
825
|
+
// // }
|
|
826
|
+
// });
|
|
827
|
+
deleteTextures.forEach((texture) => {
|
|
828
|
+
texture.dispose();
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
// TODO(rpeng) 手动dispose
|
|
832
|
+
// const deleteTextures = textures.splice(j + 1, infoCount - 1 - j);
|
|
833
|
+
// deleteTextures.forEach((texture) => {
|
|
834
|
+
// texture.dispose();
|
|
835
|
+
// });
|
|
836
|
+
}
|
|
837
|
+
return updates.length !== 0;
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* 更新
|
|
841
|
+
* @ignore
|
|
842
|
+
* @returns
|
|
843
|
+
*/
|
|
844
|
+
update() {
|
|
845
|
+
// console.log('texture-contorller', 'update');
|
|
846
|
+
this.loadTexturesAsync();
|
|
847
|
+
this.updateDeletingTextures();
|
|
848
|
+
const updates = [];
|
|
849
|
+
const deletes = [];
|
|
850
|
+
let isUpdate = this.updateTextures(updates, deletes);
|
|
851
|
+
if (!isUpdate) {
|
|
852
|
+
// 如果没有纹理更新,进行纹理重组计算
|
|
853
|
+
isUpdate = this.formatTextures(updates);
|
|
854
|
+
}
|
|
855
|
+
// if (updates.length || deletes.length) {
|
|
856
|
+
// // //console.log('texture', 'updates.length', updates.length, 'deletes.length', deletes.length);
|
|
857
|
+
// }
|
|
858
|
+
if (isUpdate) {
|
|
859
|
+
// console.log('updates', updates.map((info) => info.id));
|
|
860
|
+
// console.log('deletes', deletes.map((info) => info.id));
|
|
861
|
+
this.emit(TextureEventEnum.TEXTURE_UPDATE, updates, deletes);
|
|
862
|
+
}
|
|
863
|
+
return isUpdate;
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* 单例获取
|
|
867
|
+
*/
|
|
868
|
+
static get instance() {
|
|
869
|
+
if (!this.__instance) {
|
|
870
|
+
this.__instance = new TextureController();
|
|
871
|
+
}
|
|
872
|
+
return this.__instance;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
export { TextureController, TextureEventEnum };
|