@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,129 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/camelcase */
|
|
2
|
+
class BasicCalcTool {
|
|
3
|
+
static getLineCross(line1_p1, line1_p2, line2_p1, line2_p2) {
|
|
4
|
+
// step1 利用投影快速排斥
|
|
5
|
+
const ifL2R = Math.min(line2_p1.x, line2_p2.x) > Math.max(line1_p1.x, line1_p2.x);
|
|
6
|
+
const ifL2T = Math.min(line2_p1.y, line2_p2.y) > Math.max(line1_p1.y, line1_p2.y);
|
|
7
|
+
const ifL1R = Math.min(line1_p1.x, line1_p2.x) > Math.max(line2_p1.x, line2_p2.x);
|
|
8
|
+
const ifL1T = Math.min(line1_p1.y, line1_p2.y) > Math.max(line2_p1.y, line2_p2.y);
|
|
9
|
+
if (ifL2R || ifL2T || ifL1R || ifL1T)
|
|
10
|
+
return false;
|
|
11
|
+
// step2 投影快速排斥不成立 证明两个点分别在一条直线的两边
|
|
12
|
+
const crossMul = (v1, v2) => v1.x * v2.y - v1.y * v2.x;
|
|
13
|
+
// eslint-disable-next-line no-shadow
|
|
14
|
+
const checkCross = (line1_p1, line1_p2, line2_p1, line2_p2) => {
|
|
15
|
+
let v1 = { x: line1_p1.x - line2_p1.x, y: line2_p1.y - line1_p1.y };
|
|
16
|
+
let v2 = { x: line1_p2.x - line2_p1.x, y: line1_p2.y - line2_p1.y };
|
|
17
|
+
let v3 = { x: line2_p2.x - line2_p1.x, y: line2_p2.y - line2_p1.y };
|
|
18
|
+
const v = crossMul(v1, v3) * crossMul(v2, v3);
|
|
19
|
+
v1 = { x: line2_p1.x - line1_p1.x, y: line2_p1.y - line1_p1.y };
|
|
20
|
+
v2 = { x: line2_p2.x - line1_p1.x, y: line2_p2.y - line1_p1.y };
|
|
21
|
+
v3 = { x: line1_p2.x - line1_p1.x, y: line1_p2.y - line1_p1.y };
|
|
22
|
+
return !!((v <= 0 && crossMul(v1, v3) * crossMul(v2, v3) <= 0));
|
|
23
|
+
};
|
|
24
|
+
const ifCross = checkCross(line1_p1, line1_p2, line2_p1, line2_p2);
|
|
25
|
+
return ifCross;
|
|
26
|
+
}
|
|
27
|
+
// 拐角范围内的判定为 [2, 20] [340, 358] 平滑后的路径角度在此范围内, 未经平滑的路径返回 []
|
|
28
|
+
static calcTurning(linePoints, turningStandard = [2, 20]) {
|
|
29
|
+
const len = linePoints.length;
|
|
30
|
+
if (len < 2)
|
|
31
|
+
return [];
|
|
32
|
+
const crds = [];
|
|
33
|
+
const getAngle = (p1, p2) => {
|
|
34
|
+
const { x: x1, y: y1 } = p1;
|
|
35
|
+
const { x: x2, y: y2 } = p2;
|
|
36
|
+
const dot = x1 * x2 + y1 * y2;
|
|
37
|
+
const det = x1 * y2 - y1 * x2;
|
|
38
|
+
const angle = Math.atan2(det, dot) / Math.PI * 180;
|
|
39
|
+
return Math.round(angle + 360) % 360;
|
|
40
|
+
};
|
|
41
|
+
let isCrossing = false;
|
|
42
|
+
let curAngle = 0;
|
|
43
|
+
let curPoint = [0, 0];
|
|
44
|
+
let startTPoint = [0, 0];
|
|
45
|
+
let endTPoint = [0, 0];
|
|
46
|
+
let startIndex = 0;
|
|
47
|
+
let endIndex = 0;
|
|
48
|
+
// 经过平滑处理的线, 一个夹角90度可能由n个小夹角组成
|
|
49
|
+
for (let i = 1; i < len - 1; i++) {
|
|
50
|
+
const prev = linePoints[i - 1];
|
|
51
|
+
const cur = linePoints[i];
|
|
52
|
+
const next = linePoints[i + 1];
|
|
53
|
+
const angle = getAngle({
|
|
54
|
+
x: next[0] - cur[0],
|
|
55
|
+
y: next[1] - cur[1],
|
|
56
|
+
}, {
|
|
57
|
+
x: cur[0] - prev[0],
|
|
58
|
+
y: cur[1] - prev[1],
|
|
59
|
+
});
|
|
60
|
+
const isAngleWithinStand = (angle >= turningStandard[0] && angle <= turningStandard[1])
|
|
61
|
+
|| (angle >= (360 - turningStandard[1]) && angle <= (360 - turningStandard[0]));
|
|
62
|
+
if (!isCrossing && isAngleWithinStand) { // 首次进入夹角
|
|
63
|
+
isCrossing = true;
|
|
64
|
+
startTPoint = cur;
|
|
65
|
+
curAngle += angle;
|
|
66
|
+
startIndex = i;
|
|
67
|
+
}
|
|
68
|
+
else if (isCrossing && isAngleWithinStand) { // 夹角中并夹角依然在增大
|
|
69
|
+
curAngle += angle;
|
|
70
|
+
}
|
|
71
|
+
else if (isCrossing && !isAngleWithinStand) { // 夹角中并夹角停止增大趋势
|
|
72
|
+
curAngle += angle;
|
|
73
|
+
endIndex = i;
|
|
74
|
+
endTPoint = cur;
|
|
75
|
+
// curPoint 取 夹角范围内最靠近中心的点
|
|
76
|
+
curPoint = [
|
|
77
|
+
(startTPoint[0] + endTPoint[0]) / 2,
|
|
78
|
+
(startTPoint[1] + endTPoint[1]) / 2,
|
|
79
|
+
];
|
|
80
|
+
crds.push({
|
|
81
|
+
point: curPoint,
|
|
82
|
+
angle: curAngle % 360,
|
|
83
|
+
startTPoint,
|
|
84
|
+
endTPoint,
|
|
85
|
+
startIndex,
|
|
86
|
+
endIndex,
|
|
87
|
+
});
|
|
88
|
+
isCrossing = false;
|
|
89
|
+
}
|
|
90
|
+
else if (!isCrossing && !isAngleWithinStand) { // 直行中
|
|
91
|
+
startIndex = endIndex = 0;
|
|
92
|
+
curAngle = 0;
|
|
93
|
+
curPoint = [0, 0];
|
|
94
|
+
startTPoint = [0, 0];
|
|
95
|
+
endTPoint = [0, 0];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// 最后一个点依然在拐角内
|
|
99
|
+
if (isCrossing) {
|
|
100
|
+
endTPoint = linePoints[len - 1];
|
|
101
|
+
curPoint = [
|
|
102
|
+
(startTPoint[0] + endTPoint[0]) / 2,
|
|
103
|
+
(startTPoint[1] + endTPoint[1]) / 2,
|
|
104
|
+
];
|
|
105
|
+
crds.push({
|
|
106
|
+
point: curPoint,
|
|
107
|
+
angle: curAngle % 360,
|
|
108
|
+
startTPoint,
|
|
109
|
+
endTPoint,
|
|
110
|
+
startIndex,
|
|
111
|
+
endIndex,
|
|
112
|
+
});
|
|
113
|
+
isCrossing = false;
|
|
114
|
+
}
|
|
115
|
+
return crds;
|
|
116
|
+
}
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
118
|
+
static chunk(items, size) {
|
|
119
|
+
if (items.length <= 0 || size <= 0) {
|
|
120
|
+
return items;
|
|
121
|
+
}
|
|
122
|
+
const chunks = [];
|
|
123
|
+
for (let i = 0; i < items.length; i += size) {
|
|
124
|
+
chunks.push(items.slice(i, i + size));
|
|
125
|
+
}
|
|
126
|
+
return chunks;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export { BasicCalcTool };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { NS_THREE } from '../stage/externals';
|
|
2
|
+
import { Element } from '../element/element';
|
|
3
|
+
import { View } from '../view/view';
|
|
4
|
+
declare class BasicTools {
|
|
5
|
+
/**
|
|
6
|
+
* 销毁工具
|
|
7
|
+
* @param o 对象
|
|
8
|
+
* @param recursive 递归销毁
|
|
9
|
+
*/
|
|
10
|
+
static dispose(o: NS_THREE.Object3D, recursive?: boolean): void;
|
|
11
|
+
/**
|
|
12
|
+
* 鼠标碰撞工具函数
|
|
13
|
+
* @param objects 需要检测碰撞的 Element
|
|
14
|
+
* @param param1 鼠标点击坐标
|
|
15
|
+
* @param camera 使用的相机
|
|
16
|
+
* @param candidates 候选者, candidate 存在于 object 中
|
|
17
|
+
* @param maxWorldDistance 世界中点击时的距离
|
|
18
|
+
* @returns 碰撞对象
|
|
19
|
+
*/
|
|
20
|
+
static getMouseIntersection(objects: Element[], { x, y }: {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
}, camera: NS_THREE.Camera, candidates?: Element[], maxWorldDistance?: number): NS_THREE.Intersection | null;
|
|
24
|
+
/**
|
|
25
|
+
* 获取屏幕空间的点击碰撞
|
|
26
|
+
* @param objects 需要检查的对象
|
|
27
|
+
* @param param1 点击坐标
|
|
28
|
+
* @param param2 屏幕尺寸
|
|
29
|
+
* @param maxDistance 最大检测距离
|
|
30
|
+
* @param camera 相机
|
|
31
|
+
* @param candidates 候选对象, 可能在 object 内
|
|
32
|
+
* @param maxWorldDistance 最大世界空间坐标检测距离
|
|
33
|
+
* @param boundingBoxes 候选的碰撞盒, 可选
|
|
34
|
+
* @returns 碰撞到的对象
|
|
35
|
+
*/
|
|
36
|
+
static getMouseIntersectionOnScreen(objects: NS_THREE.Object3D[] | Element[], { x, y }: {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
}, { screenWidth, screenHeight }: {
|
|
40
|
+
screenWidth: number;
|
|
41
|
+
screenHeight: number;
|
|
42
|
+
}, maxDistance: number, camera: NS_THREE.Camera, candidates?: NS_THREE.Object3D[] | Element[], maxWorldDistance?: number, boundingBoxes?: Map<NS_THREE.Object3D | Element, [number, number]>): NS_THREE.Object3D | Element | null;
|
|
43
|
+
/**
|
|
44
|
+
* 转换俯视图屏幕坐标为三维坐标
|
|
45
|
+
* @param {x, y} 屏幕坐标
|
|
46
|
+
* @param view 视图
|
|
47
|
+
* @param camera 相机
|
|
48
|
+
*/
|
|
49
|
+
static getHorizontalPlaneCoordinate({ x, y }: {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
}, view: View, camera: NS_THREE.Camera | undefined): NS_THREE.Vector2 | null;
|
|
53
|
+
static getHorizontalPlaneCoordinate3({ x, y }: {
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
}, view: View, camera: NS_THREE.Camera | undefined): NS_THREE.Vector3 | null;
|
|
57
|
+
/**
|
|
58
|
+
* 将坐标投影到屏幕空间
|
|
59
|
+
* @param position 世界坐标
|
|
60
|
+
* @param view 视图
|
|
61
|
+
* @param camera 相机
|
|
62
|
+
* @returns 转换后的屏幕坐标
|
|
63
|
+
*/
|
|
64
|
+
static projectToScreenCoordinate(position: NS_THREE.Vector3, view: View, camera: NS_THREE.Camera | undefined): {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
} | null;
|
|
68
|
+
private static getMesh;
|
|
69
|
+
static debounce(fn: Function, delay: number): Function;
|
|
70
|
+
}
|
|
71
|
+
export { BasicTools };
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { Externals } from '../stage/externals';
|
|
2
|
+
import { Element } from '../element/element';
|
|
3
|
+
class BasicTools {
|
|
4
|
+
/**
|
|
5
|
+
* 销毁工具
|
|
6
|
+
* @param o 对象
|
|
7
|
+
* @param recursive 递归销毁
|
|
8
|
+
*/
|
|
9
|
+
static dispose(o, recursive) {
|
|
10
|
+
if (recursive && o.children && o.children.length) {
|
|
11
|
+
o.children.forEach((child) => {
|
|
12
|
+
BasicTools.dispose(child, recursive);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
if (o.isMesh) {
|
|
16
|
+
const m = o;
|
|
17
|
+
if (m.geometry)
|
|
18
|
+
m.geometry.dispose();
|
|
19
|
+
if (m.material) {
|
|
20
|
+
if (Array.isArray(m.material)) {
|
|
21
|
+
m.material.forEach((mat) => {
|
|
22
|
+
mat.dispose();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
m.material.dispose();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 鼠标碰撞工具函数
|
|
33
|
+
* @param objects 需要检测碰撞的 Element
|
|
34
|
+
* @param param1 鼠标点击坐标
|
|
35
|
+
* @param camera 使用的相机
|
|
36
|
+
* @param candidates 候选者, candidate 存在于 object 中
|
|
37
|
+
* @param maxWorldDistance 世界中点击时的距离
|
|
38
|
+
* @returns 碰撞对象
|
|
39
|
+
*/
|
|
40
|
+
static getMouseIntersection(objects, { x, y }, camera, candidates, maxWorldDistance = -1) {
|
|
41
|
+
const { THREE } = Externals.getInstance();
|
|
42
|
+
const maxWorldDistanceSquared = maxWorldDistance < 0 ? Number.MAX_SAFE_INTEGER : Math.pow(maxWorldDistance, 2);
|
|
43
|
+
const rayCaster = new THREE.Raycaster();
|
|
44
|
+
rayCaster.setFromCamera({ x, y }, camera);
|
|
45
|
+
const cameraPosition = camera.position.clone();
|
|
46
|
+
const filteredObjects = objects.filter((o) => o.visible
|
|
47
|
+
&& cameraPosition.distanceToSquared(o.getWorldPosition(new THREE.Vector3())) < maxWorldDistanceSquared);
|
|
48
|
+
const intersections = rayCaster.intersectObjects(filteredObjects, true).filter((i) => (!!i.face));
|
|
49
|
+
const candidateSet = new Set(candidates);
|
|
50
|
+
for (let i = 0; i < intersections.length; i++) {
|
|
51
|
+
let target = intersections[i].object;
|
|
52
|
+
const parentElements = [];
|
|
53
|
+
while (!(target instanceof Element) && target.parent)
|
|
54
|
+
target = target.parent;
|
|
55
|
+
while (target) {
|
|
56
|
+
if (target instanceof Element) {
|
|
57
|
+
parentElements.push(target);
|
|
58
|
+
}
|
|
59
|
+
if (!target.parent)
|
|
60
|
+
break;
|
|
61
|
+
target = target.parent;
|
|
62
|
+
}
|
|
63
|
+
for (let j = 0; j < parentElements.length; j++) {
|
|
64
|
+
if (parentElements[j] instanceof Element) {
|
|
65
|
+
if (candidates) {
|
|
66
|
+
if (candidateSet.has(parentElements[j])) {
|
|
67
|
+
const ret = intersections[i];
|
|
68
|
+
ret.object = parentElements[j];
|
|
69
|
+
return ret;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const ret = intersections[i];
|
|
74
|
+
ret.object = parentElements[j];
|
|
75
|
+
return ret;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 获取屏幕空间的点击碰撞
|
|
84
|
+
* @param objects 需要检查的对象
|
|
85
|
+
* @param param1 点击坐标
|
|
86
|
+
* @param param2 屏幕尺寸
|
|
87
|
+
* @param maxDistance 最大检测距离
|
|
88
|
+
* @param camera 相机
|
|
89
|
+
* @param candidates 候选对象, 可能在 object 内
|
|
90
|
+
* @param maxWorldDistance 最大世界空间坐标检测距离
|
|
91
|
+
* @param boundingBoxes 候选的碰撞盒, 可选
|
|
92
|
+
* @returns 碰撞到的对象
|
|
93
|
+
*/
|
|
94
|
+
static getMouseIntersectionOnScreen(objects, { x, y }, { screenWidth, screenHeight }, maxDistance, camera, candidates, maxWorldDistance = 13, boundingBoxes) {
|
|
95
|
+
const { THREE } = Externals.getInstance();
|
|
96
|
+
const intersections = [];
|
|
97
|
+
const screenPoint = new THREE.Vector2(x, y);
|
|
98
|
+
const frustum = new THREE.Frustum();
|
|
99
|
+
frustum.setFromProjectionMatrix(new THREE.Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse));
|
|
100
|
+
const cameraPos = camera.position.clone();
|
|
101
|
+
const maxWorldDistanceSquared = maxWorldDistance < 0 ? Number.MAX_SAFE_INTEGER : Math.pow(maxWorldDistance, 2);
|
|
102
|
+
objects.forEach((obj) => {
|
|
103
|
+
const v3 = obj.position.clone().project(camera);
|
|
104
|
+
const dist = new THREE.Vector2((v3.x + 1) / 2 * screenWidth, (1 - v3.y) / 2 * screenHeight).distanceTo(screenPoint);
|
|
105
|
+
const mesh = this.getMesh(obj);
|
|
106
|
+
if (!mesh)
|
|
107
|
+
return;
|
|
108
|
+
let hasBoundingBox = false;
|
|
109
|
+
let bboxCollision = false;
|
|
110
|
+
if (boundingBoxes) {
|
|
111
|
+
const value = boundingBoxes.get(obj);
|
|
112
|
+
if (value) {
|
|
113
|
+
hasBoundingBox = true;
|
|
114
|
+
const center = new THREE.Vector2((v3.x + 1) / 2 * screenWidth, (1 - v3.y) / 2 * screenHeight);
|
|
115
|
+
const leftX = center.x - value[0] / 2;
|
|
116
|
+
const rightX = center.x + value[0] / 2;
|
|
117
|
+
const topY = center.y - value[1] / 2;
|
|
118
|
+
const bottomY = center.y + value[1] / 2;
|
|
119
|
+
if (Math.abs(v3.z) <= 1
|
|
120
|
+
&& screenPoint.x <= rightX && screenPoint.x >= leftX
|
|
121
|
+
&& screenPoint.y >= topY && screenPoint.y <= bottomY) {
|
|
122
|
+
bboxCollision = true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if ((hasBoundingBox ? bboxCollision : dist <= maxDistance)
|
|
127
|
+
&& cameraPos.distanceToSquared(mesh.getWorldPosition(new THREE.Vector3())) < maxWorldDistanceSquared
|
|
128
|
+
&& frustum.intersectsObject(mesh)
|
|
129
|
+
&& mesh.visible
|
|
130
|
+
&& obj.visible) {
|
|
131
|
+
intersections.push({
|
|
132
|
+
e: obj,
|
|
133
|
+
d: dist,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
intersections.sort((a, b) => a.d - b.d);
|
|
138
|
+
const candidateSet = new Set(candidates);
|
|
139
|
+
for (let i = 0; i < intersections.length; i++) {
|
|
140
|
+
const target = intersections[i].e;
|
|
141
|
+
if (candidates) {
|
|
142
|
+
if (candidateSet.has(target))
|
|
143
|
+
return target;
|
|
144
|
+
}
|
|
145
|
+
else
|
|
146
|
+
return target;
|
|
147
|
+
}
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* 转换俯视图屏幕坐标为三维坐标
|
|
152
|
+
* @param {x, y} 屏幕坐标
|
|
153
|
+
* @param view 视图
|
|
154
|
+
* @param camera 相机
|
|
155
|
+
*/
|
|
156
|
+
static getHorizontalPlaneCoordinate({ x, y }, view, camera) {
|
|
157
|
+
if (!camera) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
const { THREE } = Externals.getInstance();
|
|
161
|
+
const { clientWidth, clientHeight } = view.renderer.domElement;
|
|
162
|
+
if (clientWidth <= 0 || clientHeight <= 0) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
const nx = x / clientWidth * 2 - 1;
|
|
166
|
+
const ny = 1 - y / clientHeight * 2;
|
|
167
|
+
const v = new THREE.Vector3(nx, ny, 0);
|
|
168
|
+
const coordinate3 = v.unproject(camera);
|
|
169
|
+
return new THREE.Vector2(coordinate3.x, coordinate3.y);
|
|
170
|
+
}
|
|
171
|
+
static getHorizontalPlaneCoordinate3({ x, y }, view, camera) {
|
|
172
|
+
if (!camera) {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
const { THREE } = Externals.getInstance();
|
|
176
|
+
const { clientWidth, clientHeight } = view.renderer.domElement;
|
|
177
|
+
if (clientWidth <= 0 || clientHeight <= 0) {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
const nx = x / clientWidth * 2 - 1;
|
|
181
|
+
const ny = 1 - y / clientHeight * 2;
|
|
182
|
+
const v = new THREE.Vector3(nx, ny, 0);
|
|
183
|
+
const coordinate3 = v.unproject(camera);
|
|
184
|
+
return coordinate3;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 将坐标投影到屏幕空间
|
|
188
|
+
* @param position 世界坐标
|
|
189
|
+
* @param view 视图
|
|
190
|
+
* @param camera 相机
|
|
191
|
+
* @returns 转换后的屏幕坐标
|
|
192
|
+
*/
|
|
193
|
+
static projectToScreenCoordinate(position, view, camera) {
|
|
194
|
+
if (!camera) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
const { clientWidth, clientHeight } = view.renderer.domElement;
|
|
198
|
+
if (clientWidth <= 0 || clientHeight <= 0) {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
const coordinate2 = position.clone().project(camera);
|
|
202
|
+
const x = (coordinate2.x + 1) * 0.5 * clientWidth;
|
|
203
|
+
const y = (1 - coordinate2.y) * 0.5 * clientHeight;
|
|
204
|
+
return { x, y };
|
|
205
|
+
}
|
|
206
|
+
static getMesh(obj) {
|
|
207
|
+
const { THREE } = Externals.getInstance();
|
|
208
|
+
const target = obj instanceof THREE.Mesh ? obj : null;
|
|
209
|
+
if (!target && obj.children.length) {
|
|
210
|
+
for (let i = 0; i < obj.children.length; i += 1) {
|
|
211
|
+
const t = this.getMesh(obj.children[i]);
|
|
212
|
+
if (t)
|
|
213
|
+
return t;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return target;
|
|
217
|
+
}
|
|
218
|
+
static debounce(fn, delay) {
|
|
219
|
+
let timer;
|
|
220
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
221
|
+
return function debounceFn(force, ...args) {
|
|
222
|
+
if (force) {
|
|
223
|
+
fn.bind(null, ...args);
|
|
224
|
+
}
|
|
225
|
+
if (timer) {
|
|
226
|
+
clearTimeout(timer);
|
|
227
|
+
timer = setTimeout(fn.bind(null, ...args), delay);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
timer = setTimeout(fn.bind(null, ...args), delay);
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
export { BasicTools };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bvh-tree
|
|
3
|
+
* A Bounding Volume Hierarchy data structure implementation.
|
|
4
|
+
* https://github.com/benraziel/bvh-tree
|
|
5
|
+
*
|
|
6
|
+
* 该文件是外部引入的类, 用于创建 FloorModel 的 BVH 树
|
|
7
|
+
*
|
|
8
|
+
* @author Ben Raziel
|
|
9
|
+
* @ignore
|
|
10
|
+
*/
|
|
11
|
+
import { NS_THREE } from '../stage/externals';
|
|
12
|
+
interface IntersectResult {
|
|
13
|
+
triangle?: NS_THREE.Vector3[];
|
|
14
|
+
triangleIndex?: number;
|
|
15
|
+
intersectionPoint: NS_THREE.Vector3;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A node in the [[BVHTree]] structure
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
declare class BVHNode {
|
|
22
|
+
extentsMin: NS_THREE.Vector3;
|
|
23
|
+
extentsMax: NS_THREE.Vector3;
|
|
24
|
+
startIndex: number;
|
|
25
|
+
endIndex: number;
|
|
26
|
+
level: number;
|
|
27
|
+
node0: BVHNode | null;
|
|
28
|
+
node1: BVHNode | null;
|
|
29
|
+
/**
|
|
30
|
+
* Constructor of BVHNode
|
|
31
|
+
* @param {Point} extentsMin the min coords of this node's bounding box ({x,y,z})
|
|
32
|
+
* @param {Point} extentsMax the max coords of this node's bounding box ({x,y,z})
|
|
33
|
+
* @param {number} startIndex an index in the bbox array, where the first element of this node is located
|
|
34
|
+
* @param {number} endIndex an index in the bbox array, where the last of this node is located,
|
|
35
|
+
* plus 1 (meaning that its non-inclusive).
|
|
36
|
+
* @param {number} the distance of this node from the root for the bvh tree. root node has level=0,
|
|
37
|
+
* its children have level=1 etc.
|
|
38
|
+
*/
|
|
39
|
+
constructor(extentsMin: NS_THREE.Vector3, extentsMax: NS_THREE.Vector3, startIndex: number, endIndex: number, level: number);
|
|
40
|
+
elementCount(): number;
|
|
41
|
+
centerX(): number;
|
|
42
|
+
centerY(): number;
|
|
43
|
+
centerZ(): number;
|
|
44
|
+
clearShapes(): void;
|
|
45
|
+
calcBoundingSphereRadius(extentsMin: NS_THREE.Vector3, extentsMax: NS_THREE.Vector3): number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* BVH树
|
|
49
|
+
*/
|
|
50
|
+
declare class BVHTree {
|
|
51
|
+
private static EPSILON;
|
|
52
|
+
private trianglesArray;
|
|
53
|
+
private maxTrianglesPerNode;
|
|
54
|
+
private bboxArray;
|
|
55
|
+
private bboxHelper;
|
|
56
|
+
private rootNode;
|
|
57
|
+
private nodesToSplit;
|
|
58
|
+
/**
|
|
59
|
+
* 创建BVH树对象
|
|
60
|
+
* @param {Vector3[][]} triangles 三角形数组,BVH树基于此构建
|
|
61
|
+
* @param {number} maxTrianglesPerNode 每个树结点包含的最多三角形数量
|
|
62
|
+
*/
|
|
63
|
+
constructor(triangles: NS_THREE.Vector3[][], maxTrianglesPerNode: number);
|
|
64
|
+
private vector3SetFromArray;
|
|
65
|
+
/**
|
|
66
|
+
* Returns a list of all the triangles in the BVH which interected a specific node.
|
|
67
|
+
* We use the BVH node structure to first cull out nodes which do not intereset the ray.
|
|
68
|
+
* For rays that did intersect, we test intersection of the ray with each triangle
|
|
69
|
+
* @param {Vector3} rayOrigin the origin position of the ray.
|
|
70
|
+
* @param {Vector3} rayDirection the direction vector of the ray.
|
|
71
|
+
* @param {boolean} backfaceCulling if 'true', only intersections with front-faces of the mesh will be performed.
|
|
72
|
+
* @return {{}[]} IntersectionResult an array of intersection result, one for each triangle which intersected the BVH,
|
|
73
|
+
* each item in the form of:
|
|
74
|
+
* {
|
|
75
|
+
* triangle: Vector3[];
|
|
76
|
+
* triangleIndex: number;
|
|
77
|
+
* intersectionPoint: Vector3;
|
|
78
|
+
* }
|
|
79
|
+
*/
|
|
80
|
+
intersectRay(rayOrigin: NS_THREE.Vector3, rayDirection: NS_THREE.Vector3, backfaceCulling?: boolean): IntersectResult[];
|
|
81
|
+
/**
|
|
82
|
+
* 获得与指定射线方向相交的最接近射线起点的相交结果
|
|
83
|
+
* @param rayOrigin 射线起点
|
|
84
|
+
* @param rayDirection 射线方向
|
|
85
|
+
* @param backfaceCulling 可选,是否忽略背面
|
|
86
|
+
*/
|
|
87
|
+
nearestIntersection(rayOrigin: NS_THREE.Vector3, rayDirection: NS_THREE.Vector3, backfaceCulling?: boolean): IntersectResult | null;
|
|
88
|
+
private calcBoundingBoxes;
|
|
89
|
+
private setBox;
|
|
90
|
+
private copyBox;
|
|
91
|
+
private calcExtents;
|
|
92
|
+
private splitNode;
|
|
93
|
+
private calcTValues;
|
|
94
|
+
private intersectNodeBox;
|
|
95
|
+
private intersectRayTriangle;
|
|
96
|
+
private static addTriangles;
|
|
97
|
+
/**
|
|
98
|
+
* 构建bvhtree
|
|
99
|
+
* @ignore
|
|
100
|
+
* @param {Object3D} threeObj 需要创建BVH树的Object3D根对象
|
|
101
|
+
* @returns {BVHTree}
|
|
102
|
+
*/
|
|
103
|
+
static createBVHTree(threeObj: NS_THREE.Object3D): BVHTree;
|
|
104
|
+
}
|
|
105
|
+
export { BVHTree, BVHNode, IntersectResult };
|