@aibee/owlly 1.0.26 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/external/lines/line-geometry.d.ts +9 -0
- package/lib/external/lines/line-geometry.js +51 -0
- package/lib/external/lines/line-material.d.ts +10 -0
- package/lib/external/lines/line-material.js +376 -0
- package/lib/external/lines/line-segments-2.d.ts +7 -0
- package/lib/external/lines/line-segments-2.js +143 -0
- package/lib/external/lines/line-segments-geometry.d.ts +15 -0
- package/lib/external/lines/line-segments-geometry.js +140 -0
- package/lib/external/loaders/gltf-loader.d.ts +77 -0
- package/lib/external/loaders/gltf-loader.js +2318 -0
- package/lib/external/orbit-controls.d.ts +44 -0
- package/lib/external/orbit-controls.js +745 -0
- package/lib/external/renderers/css-2d-renderer.d.ts +16 -0
- package/lib/external/renderers/css-2d-renderer.js +121 -0
- package/lib/external/renderers/css-3d-renderer.d.ts +18 -0
- package/lib/external/renderers/css-3d-renderer.js +138 -0
- package/lib/external/transform-controls.d.ts +106 -0
- package/lib/external/transform-controls.js +1112 -0
- package/lib/owlly/controller/aerial-element-controller.d.ts +65 -0
- package/lib/owlly/controller/aerial-element-controller.js +235 -0
- package/lib/owlly/controller/basic-controller.d.ts +324 -0
- package/lib/owlly/controller/basic-controller.js +1238 -0
- package/lib/owlly/controller/camera-controller.d.ts +37 -0
- package/lib/owlly/controller/camera-controller.js +137 -0
- package/lib/owlly/controller/controller.d.ts +61 -0
- package/lib/owlly/controller/controller.js +23 -0
- package/lib/owlly/controller/index.d.ts +2 -0
- package/lib/owlly/controller/index.js +13 -0
- package/lib/owlly/controller/mouse-indicator-controller.d.ts +34 -0
- package/lib/owlly/controller/mouse-indicator-controller.js +118 -0
- package/lib/owlly/controller/orbit-control.d.ts +147 -0
- package/lib/owlly/controller/orbit-control.js +264 -0
- package/lib/owlly/controller/panorama-adjust-controller.d.ts +45 -0
- package/lib/owlly/controller/panorama-adjust-controller.js +157 -0
- package/lib/owlly/controller/panorama-controller.d.ts +441 -0
- package/lib/owlly/controller/panorama-controller.js +1943 -0
- package/lib/owlly/controller/panorama-transform-controller.d.ts +66 -0
- package/lib/owlly/controller/panorama-transform-controller.js +136 -0
- package/lib/owlly/controller/plane-controller.d.ts +43 -0
- package/lib/owlly/controller/plane-controller.js +173 -0
- package/lib/owlly/controller/texture-controller.d.ts +181 -0
- package/lib/owlly/controller/texture-controller.js +875 -0
- package/lib/owlly/controller/tile-panorama-controller.d.ts +308 -0
- package/lib/owlly/controller/tile-panorama-controller.js +1353 -0
- package/lib/owlly/controller/transform-controller.d.ts +106 -0
- package/lib/owlly/controller/transform-controller.js +545 -0
- package/lib/owlly/element/bottom-nav-element.d.ts +65 -0
- package/lib/owlly/element/bottom-nav-element.js +257 -0
- package/lib/owlly/element/camera.d.ts +82 -0
- package/lib/owlly/element/camera.js +283 -0
- package/lib/owlly/element/dom-2d-element.d.ts +35 -0
- package/lib/owlly/element/dom-2d-element.js +48 -0
- package/lib/owlly/element/dom-3d-element.d.ts +27 -0
- package/lib/owlly/element/dom-3d-element.js +33 -0
- package/lib/owlly/element/dom-label-2d.d.ts +116 -0
- package/lib/owlly/element/dom-label-2d.js +382 -0
- package/lib/owlly/element/element.d.ts +53 -0
- package/lib/owlly/element/element.js +75 -0
- package/lib/owlly/element/floor-model.d.ts +83 -0
- package/lib/owlly/element/floor-model.js +227 -0
- package/lib/owlly/element/gif-kit/Gif.d.ts +96 -0
- package/lib/owlly/element/gif-kit/Gif.js +432 -0
- package/lib/owlly/element/gif-kit/GifColor.d.ts +21 -0
- package/lib/owlly/element/gif-kit/GifColor.js +37 -0
- package/lib/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
- package/lib/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.js +50 -0
- package/lib/owlly/element/gif-kit/GifFrame.d.ts +31 -0
- package/lib/owlly/element/gif-kit/GifFrame.js +96 -0
- package/lib/owlly/element/gif-kit/GifImage.d.ts +23 -0
- package/lib/owlly/element/gif-kit/GifImage.js +7 -0
- package/lib/owlly/element/gif-kit/GifParser.d.ts +17 -0
- package/lib/owlly/element/gif-kit/GifParser.js +196 -0
- package/lib/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
- package/lib/owlly/element/gif-kit/GifPresenter.js +43 -0
- package/lib/owlly/element/gif-kit/GifVersion.d.ts +10 -0
- package/lib/owlly/element/gif-kit/GifVersion.js +12 -0
- package/lib/owlly/element/gltf-mesh-element.d.ts +31 -0
- package/lib/owlly/element/gltf-mesh-element.js +136 -0
- package/lib/owlly/element/index.d.ts +20 -0
- package/lib/owlly/element/index.js +24 -0
- package/lib/owlly/element/map-kit/shape.d.ts +131 -0
- package/lib/owlly/element/map-kit/shape.js +189 -0
- package/lib/owlly/element/mesh-element.d.ts +22 -0
- package/lib/owlly/element/mesh-element.js +63 -0
- package/lib/owlly/element/mesh-line-2d.d.ts +82 -0
- package/lib/owlly/element/mesh-line-2d.js +887 -0
- package/lib/owlly/element/meshline-o.d.ts +64 -0
- package/lib/owlly/element/meshline-o.js +678 -0
- package/lib/owlly/element/panorama-group.d.ts +241 -0
- package/lib/owlly/element/panorama-group.js +966 -0
- package/lib/owlly/element/panorama.d.ts +132 -0
- package/lib/owlly/element/panorama.js +812 -0
- package/lib/owlly/element/path-group.d.ts +69 -0
- package/lib/owlly/element/path-group.js +171 -0
- package/lib/owlly/element/path.d.ts +99 -0
- package/lib/owlly/element/path.js +531 -0
- package/lib/owlly/element/placeable-2d.d.ts +158 -0
- package/lib/owlly/element/placeable-2d.js +470 -0
- package/lib/owlly/element/polygon-mesh.d.ts +107 -0
- package/lib/owlly/element/polygon-mesh.js +307 -0
- package/lib/owlly/element/ring-element.d.ts +79 -0
- package/lib/owlly/element/ring-element.js +383 -0
- package/lib/owlly/element/sphere-mesh.d.ts +28 -0
- package/lib/owlly/element/sphere-mesh.js +69 -0
- package/lib/owlly/element/svg-floor-model.d.ts +22 -0
- package/lib/owlly/element/svg-floor-model.js +184 -0
- package/lib/owlly/element/svg-floors.d.ts +27 -0
- package/lib/owlly/element/svg-floors.js +109 -0
- package/lib/owlly/element/tile-panorama-group.d.ts +335 -0
- package/lib/owlly/element/tile-panorama-group.js +1006 -0
- package/lib/owlly/element/tile-panorama.d.ts +161 -0
- package/lib/owlly/element/tile-panorama.js +509 -0
- package/lib/owlly/element/tile-plane.d.ts +105 -0
- package/lib/owlly/element/tile-plane.js +360 -0
- package/lib/owlly/element/video-element.d.ts +33 -0
- package/lib/owlly/element/video-element.js +159 -0
- package/lib/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
- package/lib/owlly/geometries/ExtrudeGeometry2.js +210 -0
- package/lib/owlly/index.d.ts +13 -0
- package/lib/owlly/index.js +16 -0
- package/lib/owlly/overlay/canvas-overlay.d.ts +96 -0
- package/lib/owlly/overlay/canvas-overlay.js +510 -0
- package/lib/owlly/overlay/css-2d-overlay.d.ts +14 -0
- package/lib/owlly/overlay/css-2d-overlay.js +35 -0
- package/lib/owlly/overlay/css-3d-overlay.d.ts +16 -0
- package/lib/owlly/overlay/css-3d-overlay.js +36 -0
- package/lib/owlly/overlay/index.d.ts +6 -0
- package/lib/owlly/overlay/index.js +11 -0
- package/lib/owlly/overlay/label-overlay.d.ts +62 -0
- package/lib/owlly/overlay/label-overlay.js +328 -0
- package/lib/owlly/overlay/overlay.d.ts +14 -0
- package/lib/owlly/overlay/overlay.js +4 -0
- package/lib/owlly/overlay/path-overlay.d.ts +39 -0
- package/lib/owlly/overlay/path-overlay.js +124 -0
- package/lib/owlly/overlay/path-overlay2.d.ts +35 -0
- package/lib/owlly/overlay/path-overlay2.js +118 -0
- package/lib/owlly/overlay/poi-overlay-3d.d.ts +278 -0
- package/lib/owlly/overlay/poi-overlay-3d.js +1432 -0
- package/lib/owlly/overlay/poi-overlay.d.ts +277 -0
- package/lib/owlly/overlay/poi-overlay.js +1411 -0
- package/lib/owlly/owlly-2d/index.d.ts +28 -0
- package/lib/owlly/owlly-2d/index.js +92 -0
- package/lib/owlly/screen/index.d.ts +1 -0
- package/lib/owlly/screen/index.js +1 -0
- package/lib/owlly/screen/screen.d.ts +73 -0
- package/lib/owlly/screen/screen.js +236 -0
- package/lib/owlly/stage/externals.d.ts +19 -0
- package/lib/owlly/stage/externals.js +24 -0
- package/lib/owlly/stage/index.d.ts +4 -0
- package/lib/owlly/stage/index.js +6 -0
- package/lib/owlly/stage/owlly.d.ts +38 -0
- package/lib/owlly/stage/owlly.js +168 -0
- package/lib/owlly/stage/stage.d.ts +108 -0
- package/lib/owlly/stage/stage.js +234 -0
- package/lib/owlly/utils/alignment-utils.d.ts +20 -0
- package/lib/owlly/utils/alignment-utils.js +63 -0
- package/lib/owlly/utils/basic-calc.d.ts +18 -0
- package/lib/owlly/utils/basic-calc.js +129 -0
- package/lib/owlly/utils/basic-tools.d.ts +71 -0
- package/lib/owlly/utils/basic-tools.js +235 -0
- package/lib/owlly/utils/bvh-tree.d.ts +105 -0
- package/lib/owlly/utils/bvh-tree.js +539 -0
- package/lib/owlly/utils/camera.d.ts +37 -0
- package/lib/owlly/utils/camera.js +50 -0
- package/lib/owlly/utils/cube-texture-cache.d.ts +25 -0
- package/lib/owlly/utils/cube-texture-cache.js +143 -0
- package/lib/owlly/utils/device-utils.d.ts +18 -0
- package/lib/owlly/utils/device-utils.js +41 -0
- package/lib/owlly/utils/environment-utils.d.ts +37 -0
- package/lib/owlly/utils/environment-utils.js +73 -0
- package/lib/owlly/utils/event-hub.d.ts +50 -0
- package/lib/owlly/utils/event-hub.js +106 -0
- package/lib/owlly/utils/events.d.ts +219 -0
- package/lib/owlly/utils/events.js +219 -0
- package/lib/owlly/utils/geometry-utils.d.ts +119 -0
- package/lib/owlly/utils/geometry-utils.js +622 -0
- package/lib/owlly/utils/helper.d.ts +6 -0
- package/lib/owlly/utils/helper.js +24 -0
- package/lib/owlly/utils/index.d.ts +14 -0
- package/lib/owlly/utils/index.js +17 -0
- package/lib/owlly/utils/lru-cache.d.ts +26 -0
- package/lib/owlly/utils/lru-cache.js +109 -0
- package/lib/owlly/utils/map-utils.d.ts +7 -0
- package/lib/owlly/utils/map-utils.js +52 -0
- package/lib/owlly/utils/number-utils.d.ts +8 -0
- package/lib/owlly/utils/number-utils.js +72 -0
- package/lib/owlly/utils/panorama-model-util.d.ts +46 -0
- package/lib/owlly/utils/panorama-model-util.js +245 -0
- package/lib/owlly/utils/path-utils.d.ts +80 -0
- package/lib/owlly/utils/path-utils.js +728 -0
- package/lib/owlly/utils/svgutils.d.ts +138 -0
- package/lib/owlly/utils/svgutils.js +561 -0
- package/lib/owlly/utils/texture-cache.d.ts +29 -0
- package/lib/owlly/utils/texture-cache.js +115 -0
- package/lib/owlly/utils/tile-util.d.ts +187 -0
- package/lib/owlly/utils/tile-util.js +456 -0
- package/lib/owlly/utils/time-profiler.d.ts +21 -0
- package/lib/owlly/utils/time-profiler.js +48 -0
- package/lib/owlly/view/camera-view.d.ts +35 -0
- package/lib/owlly/view/camera-view.js +101 -0
- package/lib/owlly/view/index.d.ts +3 -0
- package/lib/owlly/view/index.js +5 -0
- package/lib/owlly/view/orthographic-view.d.ts +40 -0
- package/lib/owlly/view/orthographic-view.js +94 -0
- package/lib/owlly/view/perspective-view.d.ts +40 -0
- package/lib/owlly/view/perspective-view.js +95 -0
- package/lib/owlly/view/svg-map-view.d.ts +46 -0
- package/lib/owlly/view/svg-map-view.js +144 -0
- package/lib/owlly/view/view.d.ts +146 -0
- package/lib/owlly/view/view.js +317 -0
- package/lib/prod/owlly.esm.js +93462 -0
- package/lib/prod/owlly.esm.js.map +1 -0
- package/lib/prod/owlly.esm.min.js +54 -0
- package/lib/prod/owlly.iife.js +93560 -0
- package/lib/prod/owlly.iife.js.map +1 -0
- package/lib/prod/owlly.iife.min.js +69 -0
- package/lib/prod/owlly.miniapp.js +73845 -0
- package/lib/prod/owlly.miniapp.js.map +1 -0
- package/lib/prod/owlly.miniapp.min.js +63 -0
- package/lib/prod/src/external/lines/line-geometry.d.ts +9 -0
- package/lib/prod/src/external/lines/line-material.d.ts +10 -0
- package/lib/prod/src/external/lines/line-segments-2.d.ts +7 -0
- package/lib/prod/src/external/lines/line-segments-geometry.d.ts +15 -0
- package/lib/prod/src/external/loaders/gltf-loader.d.ts +77 -0
- package/lib/prod/src/external/orbit-controls.d.ts +44 -0
- package/lib/prod/src/external/renderers/css-2d-renderer.d.ts +16 -0
- package/lib/prod/src/external/renderers/css-3d-renderer.d.ts +18 -0
- package/lib/prod/src/external/transform-controls.d.ts +106 -0
- package/lib/prod/src/external/util/buffer-geometry-utils.d.ts +45 -0
- package/lib/prod/src/owlly/controller/aerial-element-controller.d.ts +65 -0
- package/lib/prod/src/owlly/controller/basic-controller.d.ts +324 -0
- package/lib/prod/src/owlly/controller/camera-controller.d.ts +37 -0
- package/lib/prod/src/owlly/controller/controller.d.ts +61 -0
- package/lib/prod/src/owlly/controller/index.d.ts +2 -0
- package/lib/prod/src/owlly/controller/mouse-indicator-controller.d.ts +34 -0
- package/lib/prod/src/owlly/controller/orbit-control.d.ts +147 -0
- package/lib/prod/src/owlly/controller/panorama-adjust-controller.d.ts +45 -0
- package/lib/prod/src/owlly/controller/panorama-controller.d.ts +441 -0
- package/lib/prod/src/owlly/controller/panorama-transform-controller.d.ts +66 -0
- package/lib/prod/src/owlly/controller/plane-controller.d.ts +43 -0
- package/lib/prod/src/owlly/controller/texture-controller.d.ts +183 -0
- package/lib/prod/src/owlly/controller/tile-panorama-controller.d.ts +308 -0
- package/lib/prod/src/owlly/controller/transform-controller.d.ts +106 -0
- package/lib/prod/src/owlly/element/bottom-nav-element.d.ts +65 -0
- package/lib/prod/src/owlly/element/camera.d.ts +82 -0
- package/lib/prod/src/owlly/element/dom-2d-element.d.ts +35 -0
- package/lib/prod/src/owlly/element/dom-3d-element.d.ts +27 -0
- package/lib/prod/src/owlly/element/dom-label-2d.d.ts +116 -0
- package/lib/prod/src/owlly/element/element.d.ts +53 -0
- package/lib/prod/src/owlly/element/floor-model.d.ts +83 -0
- package/lib/prod/src/owlly/element/gif-kit/Gif.d.ts +96 -0
- package/lib/prod/src/owlly/element/gif-kit/GifColor.d.ts +21 -0
- package/lib/prod/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
- package/lib/prod/src/owlly/element/gif-kit/GifFrame.d.ts +31 -0
- package/lib/prod/src/owlly/element/gif-kit/GifImage.d.ts +23 -0
- package/lib/prod/src/owlly/element/gif-kit/GifParser.d.ts +17 -0
- package/lib/prod/src/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
- package/lib/prod/src/owlly/element/gif-kit/GifVersion.d.ts +10 -0
- package/lib/prod/src/owlly/element/gltf-mesh-element.d.ts +31 -0
- package/lib/prod/src/owlly/element/index.d.ts +6 -0
- package/lib/prod/src/owlly/element/map-kit/area.d.ts +24 -0
- package/lib/prod/src/owlly/element/map-kit/block-set.d.ts +39 -0
- package/lib/prod/src/owlly/element/map-kit/block.d.ts +77 -0
- package/lib/prod/src/owlly/element/map-kit/index.d.ts +3 -0
- package/lib/prod/src/owlly/element/map-kit/shape.d.ts +131 -0
- package/lib/prod/src/owlly/element/mesh-element.d.ts +22 -0
- package/lib/prod/src/owlly/element/mesh-line-2d.d.ts +82 -0
- package/lib/prod/src/owlly/element/meshline-o.d.ts +64 -0
- package/lib/prod/src/owlly/element/panorama-group.d.ts +241 -0
- package/lib/prod/src/owlly/element/panorama.d.ts +132 -0
- package/lib/prod/src/owlly/element/path-group.d.ts +69 -0
- package/lib/prod/src/owlly/element/path.d.ts +99 -0
- package/lib/prod/src/owlly/element/placeable-2d.d.ts +158 -0
- package/lib/prod/src/owlly/element/polygon-mesh.d.ts +107 -0
- package/lib/prod/src/owlly/element/ring-element.d.ts +79 -0
- package/lib/prod/src/owlly/element/sphere-mesh.d.ts +28 -0
- package/lib/prod/src/owlly/element/svg-floor-model.d.ts +22 -0
- package/lib/prod/src/owlly/element/svg-floors.d.ts +27 -0
- package/lib/prod/src/owlly/element/tile-panorama-group.d.ts +335 -0
- package/lib/prod/src/owlly/element/tile-panorama.d.ts +162 -0
- package/lib/prod/src/owlly/element/tile-plane.d.ts +114 -0
- package/lib/prod/src/owlly/element/video-element.d.ts +33 -0
- package/lib/prod/src/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
- package/lib/prod/src/owlly/index.d.ts +13 -0
- package/lib/prod/src/owlly/overlay/canvas-overlay.d.ts +96 -0
- package/lib/prod/src/owlly/overlay/css-2d-overlay.d.ts +14 -0
- package/lib/prod/src/owlly/overlay/css-3d-overlay.d.ts +16 -0
- package/lib/prod/src/owlly/overlay/index.d.ts +5 -0
- package/lib/prod/src/owlly/overlay/label-overlay.d.ts +62 -0
- package/lib/prod/src/owlly/overlay/overlay.d.ts +14 -0
- package/lib/prod/src/owlly/overlay/path-overlay.d.ts +39 -0
- package/lib/prod/src/owlly/overlay/path-overlay2.d.ts +35 -0
- package/lib/prod/src/owlly/overlay/poi-overlay-3d.d.ts +278 -0
- package/lib/prod/src/owlly/overlay/poi-overlay.d.ts +277 -0
- package/lib/prod/src/owlly/owlly-2d/index.d.ts +28 -0
- package/lib/prod/src/owlly/screen/index.d.ts +1 -0
- package/lib/prod/src/owlly/screen/screen.d.ts +73 -0
- package/lib/prod/src/owlly/stage/__test__/stage.spec.d.ts +1 -0
- package/lib/prod/src/owlly/stage/externals.d.ts +19 -0
- package/lib/prod/src/owlly/stage/index.d.ts +3 -0
- package/lib/prod/src/owlly/stage/owlly.d.ts +38 -0
- package/lib/prod/src/owlly/stage/stage.d.ts +108 -0
- package/lib/prod/src/owlly/utils/alignment-utils.d.ts +20 -0
- package/lib/prod/src/owlly/utils/basic-calc.d.ts +18 -0
- package/lib/prod/src/owlly/utils/basic-tools.d.ts +71 -0
- package/lib/prod/src/owlly/utils/bvh-tree.d.ts +105 -0
- package/lib/prod/src/owlly/utils/camera.d.ts +37 -0
- package/lib/prod/src/owlly/utils/cube-texture-cache.d.ts +25 -0
- package/lib/prod/src/owlly/utils/device-utils.d.ts +18 -0
- package/lib/prod/src/owlly/utils/environment-utils.d.ts +37 -0
- package/lib/prod/src/owlly/utils/event-hub.d.ts +50 -0
- package/lib/prod/src/owlly/utils/events.d.ts +219 -0
- package/lib/prod/src/owlly/utils/geometry-utils.d.ts +119 -0
- package/lib/prod/src/owlly/utils/helper.d.ts +6 -0
- package/lib/prod/src/owlly/utils/index.d.ts +13 -0
- package/lib/prod/src/owlly/utils/lru-cache.d.ts +26 -0
- package/lib/prod/src/owlly/utils/map-utils.d.ts +7 -0
- package/lib/prod/src/owlly/utils/number-utils.d.ts +8 -0
- package/lib/prod/src/owlly/utils/panorama-model-util.d.ts +46 -0
- package/lib/prod/src/owlly/utils/path-utils.d.ts +80 -0
- package/lib/prod/src/owlly/utils/svgutils.d.ts +138 -0
- package/lib/prod/src/owlly/utils/texture-cache.d.ts +29 -0
- package/lib/prod/src/owlly/utils/tile-util.d.ts +187 -0
- package/lib/prod/src/owlly/utils/time-profiler.d.ts +21 -0
- package/lib/prod/src/owlly/view/__test__/perspective-view.spec.d.ts +0 -0
- package/lib/prod/src/owlly/view/camera-view.d.ts +35 -0
- package/lib/prod/src/owlly/view/index.d.ts +3 -0
- package/lib/prod/src/owlly/view/orthographic-view.d.ts +40 -0
- package/lib/prod/src/owlly/view/perspective-view.d.ts +40 -0
- package/lib/prod/src/owlly/view/svg-map-view.d.ts +46 -0
- package/lib/prod/src/owlly/view/view.d.ts +146 -0
- package/lib/src/owlly/controller/texture-controller.d.ts +3 -1
- package/lib/src/owlly/controller/texture-controller.js +16 -1
- package/lib/src/owlly/controller/texture-controller.js.map +1 -1
- package/lib/src/owlly/controller/tile-panorama-controller.js +4 -0
- package/lib/src/owlly/controller/tile-panorama-controller.js.map +1 -1
- package/lib/src/owlly/element/tile-panorama.d.ts +1 -0
- package/lib/src/owlly/element/tile-panorama.js +16 -3
- package/lib/src/owlly/element/tile-panorama.js.map +1 -1
- package/lib/src/owlly/element/tile-plane.d.ts +9 -0
- package/lib/src/owlly/element/tile-plane.js +27 -0
- package/lib/src/owlly/element/tile-plane.js.map +1 -1
- package/lib/src/owlly/overlay/poi-overlay-3d.js.map +1 -1
- package/lib/src/owlly/overlay/poi-overlay.js.map +1 -1
- package/lib/src/owlly/stage/owlly.js +7 -1
- package/lib/src/owlly/stage/owlly.js.map +1 -1
- package/lib/src/owlly/stage/stage.js +2 -0
- package/lib/src/owlly/stage/stage.js.map +1 -1
- package/lib/src/web/main.rpeng.mes.plane.js.map +1 -1
- package/package.json +16 -7
- package/src/owlly/controller/texture-controller.ts +18 -1
- package/src/owlly/controller/tile-panorama-controller.ts +3 -1
- package/src/owlly/element/tile-panorama.ts +14 -0
- package/src/owlly/element/tile-plane.ts +26 -0
- package/src/owlly/overlay/poi-overlay-3d.ts +0 -4
- package/src/owlly/overlay/poi-overlay.ts +0 -4
- package/src/owlly/stage/owlly.ts +6 -1
- package/src/owlly/stage/stage.ts +2 -0
- package/src/web/main.rpeng.mes.plane.ts +0 -6
|
@@ -0,0 +1,539 @@
|
|
|
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 { Externals } from '../stage/externals';
|
|
12
|
+
/**
|
|
13
|
+
* A node in the [[BVHTree]] structure
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
class BVHNode {
|
|
17
|
+
/**
|
|
18
|
+
* Constructor of BVHNode
|
|
19
|
+
* @param {Point} extentsMin the min coords of this node's bounding box ({x,y,z})
|
|
20
|
+
* @param {Point} extentsMax the max coords of this node's bounding box ({x,y,z})
|
|
21
|
+
* @param {number} startIndex an index in the bbox array, where the first element of this node is located
|
|
22
|
+
* @param {number} endIndex an index in the bbox array, where the last of this node is located,
|
|
23
|
+
* plus 1 (meaning that its non-inclusive).
|
|
24
|
+
* @param {number} the distance of this node from the root for the bvh tree. root node has level=0,
|
|
25
|
+
* its children have level=1 etc.
|
|
26
|
+
*/
|
|
27
|
+
constructor(extentsMin, extentsMax, startIndex, endIndex, level) {
|
|
28
|
+
this.extentsMin = extentsMin;
|
|
29
|
+
this.extentsMax = extentsMax;
|
|
30
|
+
this.startIndex = startIndex;
|
|
31
|
+
this.endIndex = endIndex;
|
|
32
|
+
this.level = level;
|
|
33
|
+
this.node0 = null;
|
|
34
|
+
this.node1 = null;
|
|
35
|
+
}
|
|
36
|
+
elementCount() {
|
|
37
|
+
return this.endIndex - this.startIndex;
|
|
38
|
+
}
|
|
39
|
+
centerX() {
|
|
40
|
+
return (this.extentsMin.x + this.extentsMax.x) * 0.5;
|
|
41
|
+
}
|
|
42
|
+
centerY() {
|
|
43
|
+
return (this.extentsMin.y + this.extentsMax.y) * 0.5;
|
|
44
|
+
}
|
|
45
|
+
centerZ() {
|
|
46
|
+
return (this.extentsMin.z + this.extentsMax.z) * 0.5;
|
|
47
|
+
}
|
|
48
|
+
clearShapes() {
|
|
49
|
+
this.startIndex = -1;
|
|
50
|
+
this.endIndex = -1;
|
|
51
|
+
}
|
|
52
|
+
calcBoundingSphereRadius(extentsMin, extentsMax) {
|
|
53
|
+
const centerX = (extentsMin.x + extentsMax.x) * 0.5;
|
|
54
|
+
const centerY = (extentsMin.y + extentsMax.y) * 0.5;
|
|
55
|
+
const centerZ = (extentsMin.z + extentsMax.z) * 0.5;
|
|
56
|
+
const extentsMinDistSqr = (centerX - extentsMin.x) * (centerX - extentsMin.x)
|
|
57
|
+
+ (centerY - extentsMin.y) * (centerY - extentsMin.y)
|
|
58
|
+
+ (centerZ - extentsMin.z) * (centerZ - extentsMin.z);
|
|
59
|
+
const extentsMaxDistSqr = (centerX - extentsMax.x) * (centerX - extentsMax.x)
|
|
60
|
+
+ (centerY - extentsMax.y) * (centerY - extentsMax.y)
|
|
61
|
+
+ (centerZ - extentsMax.z) * (centerZ - extentsMax.z);
|
|
62
|
+
return Math.sqrt(Math.max(extentsMinDistSqr, extentsMaxDistSqr));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* BVH树
|
|
67
|
+
*/
|
|
68
|
+
class BVHTree {
|
|
69
|
+
/**
|
|
70
|
+
* 创建BVH树对象
|
|
71
|
+
* @param {Vector3[][]} triangles 三角形数组,BVH树基于此构建
|
|
72
|
+
* @param {number} maxTrianglesPerNode 每个树结点包含的最多三角形数量
|
|
73
|
+
*/
|
|
74
|
+
constructor(triangles, maxTrianglesPerNode) {
|
|
75
|
+
const trianglesArray = [];
|
|
76
|
+
trianglesArray.length = triangles.length * 9;
|
|
77
|
+
for (let i = 0; i < triangles.length; i += 1) {
|
|
78
|
+
const p0 = triangles[i][0];
|
|
79
|
+
const p1 = triangles[i][1];
|
|
80
|
+
const p2 = triangles[i][2];
|
|
81
|
+
trianglesArray[i * 9] = p0.x;
|
|
82
|
+
trianglesArray[i * 9 + 1] = p0.y;
|
|
83
|
+
trianglesArray[i * 9 + 2] = p0.z;
|
|
84
|
+
trianglesArray[i * 9 + 3] = p1.x;
|
|
85
|
+
trianglesArray[i * 9 + 4] = p1.y;
|
|
86
|
+
trianglesArray[i * 9 + 5] = p1.z;
|
|
87
|
+
trianglesArray[i * 9 + 6] = p2.x;
|
|
88
|
+
trianglesArray[i * 9 + 7] = p2.y;
|
|
89
|
+
trianglesArray[i * 9 + 8] = p2.z;
|
|
90
|
+
}
|
|
91
|
+
this.trianglesArray = trianglesArray;
|
|
92
|
+
this.maxTrianglesPerNode = maxTrianglesPerNode || 10;
|
|
93
|
+
this.bboxArray = this.calcBoundingBoxes(trianglesArray);
|
|
94
|
+
// clone a helper array
|
|
95
|
+
this.bboxHelper = new Float32Array(this.bboxArray.length);
|
|
96
|
+
this.bboxHelper.set(this.bboxArray);
|
|
97
|
+
// create the root node, add all the triangles to it
|
|
98
|
+
const triangleCount = trianglesArray.length / 9;
|
|
99
|
+
const extents = this.calcExtents(0, triangleCount, BVHTree.EPSILON);
|
|
100
|
+
this.rootNode = new BVHNode(extents[0], extents[1], 0, triangleCount, 0);
|
|
101
|
+
this.nodesToSplit = [this.rootNode];
|
|
102
|
+
while (this.nodesToSplit.length > 0) {
|
|
103
|
+
const node = this.nodesToSplit.pop();
|
|
104
|
+
if (node) {
|
|
105
|
+
this.splitNode(node);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
vector3SetFromArray(v, array, firstElementPos) {
|
|
110
|
+
v.set(array[firstElementPos], array[firstElementPos + 1], array[firstElementPos + 2]);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Returns a list of all the triangles in the BVH which interected a specific node.
|
|
114
|
+
* We use the BVH node structure to first cull out nodes which do not intereset the ray.
|
|
115
|
+
* For rays that did intersect, we test intersection of the ray with each triangle
|
|
116
|
+
* @param {Vector3} rayOrigin the origin position of the ray.
|
|
117
|
+
* @param {Vector3} rayDirection the direction vector of the ray.
|
|
118
|
+
* @param {boolean} backfaceCulling if 'true', only intersections with front-faces of the mesh will be performed.
|
|
119
|
+
* @return {{}[]} IntersectionResult an array of intersection result, one for each triangle which intersected the BVH,
|
|
120
|
+
* each item in the form of:
|
|
121
|
+
* {
|
|
122
|
+
* triangle: Vector3[];
|
|
123
|
+
* triangleIndex: number;
|
|
124
|
+
* intersectionPoint: Vector3;
|
|
125
|
+
* }
|
|
126
|
+
*/
|
|
127
|
+
intersectRay(rayOrigin, rayDirection, backfaceCulling) {
|
|
128
|
+
const nodesToIntersect = [this.rootNode];
|
|
129
|
+
const trianglesInIntersectingNodes = []; // a list of nodes that intersect the ray (according to their bounding box)
|
|
130
|
+
const intersectingTriangles = [];
|
|
131
|
+
let i;
|
|
132
|
+
const { THREE } = Externals.getInstance();
|
|
133
|
+
const invRayDirection = new THREE.Vector3(1.0 / rayDirection.x, 1.0 / rayDirection.y, 1.0 / rayDirection.z);
|
|
134
|
+
// go over the BVH tree, and extract the list of triangles that lie in nodes that intersect the ray.
|
|
135
|
+
// note: these triangles may not intersect the ray themselves
|
|
136
|
+
while (nodesToIntersect.length > 0) {
|
|
137
|
+
const node = nodesToIntersect.pop();
|
|
138
|
+
if (node) {
|
|
139
|
+
if (this.intersectNodeBox(rayOrigin, invRayDirection, node)) {
|
|
140
|
+
if (node.node0) {
|
|
141
|
+
nodesToIntersect.push(node.node0);
|
|
142
|
+
}
|
|
143
|
+
if (node.node1) {
|
|
144
|
+
nodesToIntersect.push(node.node1);
|
|
145
|
+
}
|
|
146
|
+
for (i = node.startIndex; i < node.endIndex; i += 1) {
|
|
147
|
+
trianglesInIntersectingNodes.push(this.bboxArray[i * 7]);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// go over the list of candidate triangles, and check each of them using ray triangle intersection
|
|
153
|
+
const a = new THREE.Vector3();
|
|
154
|
+
const b = new THREE.Vector3();
|
|
155
|
+
const c = new THREE.Vector3();
|
|
156
|
+
const rayOriginVec3 = new THREE.Vector3(rayOrigin.x, rayOrigin.y, rayOrigin.z);
|
|
157
|
+
const rayDirectionVec3 = new THREE.Vector3(rayDirection.x, rayDirection.y, rayDirection.z);
|
|
158
|
+
for (i = 0; i < trianglesInIntersectingNodes.length; i += 1) {
|
|
159
|
+
const triIndex = trianglesInIntersectingNodes[i];
|
|
160
|
+
this.vector3SetFromArray(a, this.trianglesArray, triIndex * 9);
|
|
161
|
+
this.vector3SetFromArray(b, this.trianglesArray, triIndex * 9 + 3);
|
|
162
|
+
this.vector3SetFromArray(c, this.trianglesArray, triIndex * 9 + 6);
|
|
163
|
+
const intersectionPoint = this.intersectRayTriangle(a, b, c, rayOriginVec3, rayDirectionVec3, backfaceCulling || false);
|
|
164
|
+
if (intersectionPoint) {
|
|
165
|
+
intersectingTriangles.push({
|
|
166
|
+
triangle: [a.clone(), b.clone(), c.clone()],
|
|
167
|
+
triangleIndex: triIndex,
|
|
168
|
+
intersectionPoint,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return intersectingTriangles;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* 获得与指定射线方向相交的最接近射线起点的相交结果
|
|
176
|
+
* @param rayOrigin 射线起点
|
|
177
|
+
* @param rayDirection 射线方向
|
|
178
|
+
* @param backfaceCulling 可选,是否忽略背面
|
|
179
|
+
*/
|
|
180
|
+
nearestIntersection(rayOrigin, rayDirection, backfaceCulling) {
|
|
181
|
+
const direction = rayDirection.clone().normalize();
|
|
182
|
+
const results = this.intersectRay(rayOrigin, direction, backfaceCulling);
|
|
183
|
+
if (results.length === 0)
|
|
184
|
+
return null;
|
|
185
|
+
let ret = null;
|
|
186
|
+
let minDist = Number.MAX_VALUE;
|
|
187
|
+
for (let i = 0; i < results.length; i += 1) {
|
|
188
|
+
const item = results[i];
|
|
189
|
+
const dist = item.intersectionPoint.clone().sub(rayOrigin).dot(direction);
|
|
190
|
+
if (dist >= 0.0 && dist < minDist) {
|
|
191
|
+
ret = item;
|
|
192
|
+
minDist = dist;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return ret;
|
|
196
|
+
}
|
|
197
|
+
calcBoundingBoxes(trianglesArray) {
|
|
198
|
+
let p0x;
|
|
199
|
+
let p0y;
|
|
200
|
+
let p0z;
|
|
201
|
+
let p1x;
|
|
202
|
+
let p1y;
|
|
203
|
+
let p1z;
|
|
204
|
+
let p2x;
|
|
205
|
+
let p2y;
|
|
206
|
+
let p2z;
|
|
207
|
+
let minX;
|
|
208
|
+
let minY;
|
|
209
|
+
let minZ;
|
|
210
|
+
let maxX;
|
|
211
|
+
let maxY;
|
|
212
|
+
let maxZ;
|
|
213
|
+
const triangleCount = trianglesArray.length / 9;
|
|
214
|
+
const bboxArray = new Float32Array(triangleCount * 7);
|
|
215
|
+
for (let i = 0; i < triangleCount; i += 1) {
|
|
216
|
+
p0x = trianglesArray[i * 9];
|
|
217
|
+
p0y = trianglesArray[i * 9 + 1];
|
|
218
|
+
p0z = trianglesArray[i * 9 + 2];
|
|
219
|
+
p1x = trianglesArray[i * 9 + 3];
|
|
220
|
+
p1y = trianglesArray[i * 9 + 4];
|
|
221
|
+
p1z = trianglesArray[i * 9 + 5];
|
|
222
|
+
p2x = trianglesArray[i * 9 + 6];
|
|
223
|
+
p2y = trianglesArray[i * 9 + 7];
|
|
224
|
+
p2z = trianglesArray[i * 9 + 8];
|
|
225
|
+
minX = Math.min(Math.min(p0x, p1x), p2x);
|
|
226
|
+
minY = Math.min(Math.min(p0y, p1y), p2y);
|
|
227
|
+
minZ = Math.min(Math.min(p0z, p1z), p2z);
|
|
228
|
+
maxX = Math.max(Math.max(p0x, p1x), p2x);
|
|
229
|
+
maxY = Math.max(Math.max(p0y, p1y), p2y);
|
|
230
|
+
maxZ = Math.max(Math.max(p0z, p1z), p2z);
|
|
231
|
+
this.setBox(bboxArray, i, i, minX, minY, minZ, maxX, maxY, maxZ);
|
|
232
|
+
}
|
|
233
|
+
return bboxArray;
|
|
234
|
+
}
|
|
235
|
+
setBox(bboxArray, pos, triangleId, minX, minY, minZ, maxX, maxY, maxZ) {
|
|
236
|
+
bboxArray[pos * 7] = triangleId;
|
|
237
|
+
bboxArray[pos * 7 + 1] = minX;
|
|
238
|
+
bboxArray[pos * 7 + 2] = minY;
|
|
239
|
+
bboxArray[pos * 7 + 3] = minZ;
|
|
240
|
+
bboxArray[pos * 7 + 4] = maxX;
|
|
241
|
+
bboxArray[pos * 7 + 5] = maxY;
|
|
242
|
+
bboxArray[pos * 7 + 6] = maxZ;
|
|
243
|
+
}
|
|
244
|
+
copyBox(sourceArray, sourcePos, destArray, destPos) {
|
|
245
|
+
destArray[destPos * 7] = sourceArray[sourcePos * 7];
|
|
246
|
+
destArray[destPos * 7 + 1] = sourceArray[sourcePos * 7 + 1];
|
|
247
|
+
destArray[destPos * 7 + 2] = sourceArray[sourcePos * 7 + 2];
|
|
248
|
+
destArray[destPos * 7 + 3] = sourceArray[sourcePos * 7 + 3];
|
|
249
|
+
destArray[destPos * 7 + 4] = sourceArray[sourcePos * 7 + 4];
|
|
250
|
+
destArray[destPos * 7 + 5] = sourceArray[sourcePos * 7 + 5];
|
|
251
|
+
destArray[destPos * 7 + 6] = sourceArray[sourcePos * 7 + 6];
|
|
252
|
+
}
|
|
253
|
+
// private getBox(bboxArray: Float32Array, pos: number,
|
|
254
|
+
// outputBox: {triangleId: number;
|
|
255
|
+
// minX: number; minY: number; minZ: number;
|
|
256
|
+
// maxX: number; maxY: number; maxZ: number;
|
|
257
|
+
// }): void {
|
|
258
|
+
// outputBox.triangleId = bboxArray[pos * 7];
|
|
259
|
+
// outputBox.minX = bboxArray[pos * 7 + 1];
|
|
260
|
+
// outputBox.minY = bboxArray[pos * 7 + 2];
|
|
261
|
+
// outputBox.minZ = bboxArray[pos * 7 + 3];
|
|
262
|
+
// outputBox.maxX = bboxArray[pos * 7 + 4];
|
|
263
|
+
// outputBox.maxY = bboxArray[pos * 7 + 5];
|
|
264
|
+
// outputBox.maxZ = bboxArray[pos * 7 + 6];
|
|
265
|
+
// }
|
|
266
|
+
calcExtents(startIndex, endIndex, _expandBy) {
|
|
267
|
+
const expandBy = _expandBy || 0.0;
|
|
268
|
+
const { THREE } = Externals.getInstance();
|
|
269
|
+
if (startIndex >= endIndex) {
|
|
270
|
+
return [new THREE.Vector3(0, 0, 0), new THREE.Vector3(0, 0, 0)];
|
|
271
|
+
}
|
|
272
|
+
let minX = Number.MAX_VALUE;
|
|
273
|
+
let minY = Number.MAX_VALUE;
|
|
274
|
+
let minZ = Number.MAX_VALUE;
|
|
275
|
+
let maxX = -Number.MAX_VALUE;
|
|
276
|
+
let maxY = -Number.MAX_VALUE;
|
|
277
|
+
let maxZ = -Number.MAX_VALUE;
|
|
278
|
+
for (let i = startIndex; i < endIndex; i += 1) {
|
|
279
|
+
minX = Math.min(this.bboxArray[i * 7 + 1], minX);
|
|
280
|
+
minY = Math.min(this.bboxArray[i * 7 + 2], minY);
|
|
281
|
+
minZ = Math.min(this.bboxArray[i * 7 + 3], minZ);
|
|
282
|
+
maxX = Math.max(this.bboxArray[i * 7 + 4], maxX);
|
|
283
|
+
maxY = Math.max(this.bboxArray[i * 7 + 5], maxY);
|
|
284
|
+
maxZ = Math.max(this.bboxArray[i * 7 + 6], maxZ);
|
|
285
|
+
}
|
|
286
|
+
return [
|
|
287
|
+
new THREE.Vector3(minX - expandBy, minY - expandBy, minZ - expandBy),
|
|
288
|
+
new THREE.Vector3(maxX + expandBy, maxY + expandBy, maxZ + expandBy),
|
|
289
|
+
];
|
|
290
|
+
}
|
|
291
|
+
splitNode(node) {
|
|
292
|
+
if ((node.elementCount() <= this.maxTrianglesPerNode) || (node.elementCount() === 0)) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const { startIndex, endIndex } = node;
|
|
296
|
+
const leftNode = [new Array(), new Array(), new Array()];
|
|
297
|
+
const rightNode = [new Array(), new Array(), new Array()];
|
|
298
|
+
const extentCenters = [node.centerX(), node.centerY(), node.centerZ()];
|
|
299
|
+
const extentsLength = [
|
|
300
|
+
node.extentsMax.x - node.extentsMin.x,
|
|
301
|
+
node.extentsMax.y - node.extentsMin.y,
|
|
302
|
+
node.extentsMax.z - node.extentsMin.z,
|
|
303
|
+
];
|
|
304
|
+
const objectCenter = [];
|
|
305
|
+
objectCenter.length = 3;
|
|
306
|
+
for (let i = startIndex; i < endIndex; i += 1) {
|
|
307
|
+
objectCenter[0] = (this.bboxArray[i * 7 + 1] + this.bboxArray[i * 7 + 4]) * 0.5; // center = (min + max) / 2
|
|
308
|
+
objectCenter[1] = (this.bboxArray[i * 7 + 2] + this.bboxArray[i * 7 + 5]) * 0.5; // center = (min + max) / 2
|
|
309
|
+
objectCenter[2] = (this.bboxArray[i * 7 + 3] + this.bboxArray[i * 7 + 6]) * 0.5; // center = (min + max) / 2
|
|
310
|
+
for (let j = 0; j < 3; j += 1) {
|
|
311
|
+
if (objectCenter[j] < extentCenters[j]) {
|
|
312
|
+
leftNode[j].push(i);
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
rightNode[j].push(i);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
// check if we couldn't split the node by any of the axes (x, y or z). halt here,
|
|
320
|
+
// dont try to split any more (cause it will always fail, and we'll enter an infinite loop
|
|
321
|
+
const splitFailed = [];
|
|
322
|
+
splitFailed.length = 3;
|
|
323
|
+
splitFailed[0] = (leftNode[0].length === 0) || (rightNode[0].length === 0);
|
|
324
|
+
splitFailed[1] = (leftNode[1].length === 0) || (rightNode[1].length === 0);
|
|
325
|
+
splitFailed[2] = (leftNode[2].length === 0) || (rightNode[2].length === 0);
|
|
326
|
+
if (splitFailed[0] && splitFailed[1] && splitFailed[2]) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
// choose the longest split axis. if we can't split by it, choose next best one.
|
|
330
|
+
const splitOrder = [0, 1, 2];
|
|
331
|
+
splitOrder.sort((axis0, axis1) => (extentsLength[axis1] - extentsLength[axis0]));
|
|
332
|
+
let leftElements;
|
|
333
|
+
let rightElements;
|
|
334
|
+
for (let j = 0; j < 3; j += 1) {
|
|
335
|
+
const candidateIndex = splitOrder[j];
|
|
336
|
+
if (!splitFailed[candidateIndex]) {
|
|
337
|
+
leftElements = leftNode[candidateIndex];
|
|
338
|
+
rightElements = rightNode[candidateIndex];
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
// sort the elements in range (startIndex, endIndex) according to which node they should be at
|
|
343
|
+
const node0Start = startIndex;
|
|
344
|
+
const node0End = node0Start + (leftElements !== undefined ? leftElements.length : 0);
|
|
345
|
+
const node1Start = node0End;
|
|
346
|
+
const node1End = endIndex;
|
|
347
|
+
let currElement;
|
|
348
|
+
let helperPos = node.startIndex;
|
|
349
|
+
let concatenatedElements = [];
|
|
350
|
+
if (leftElements) {
|
|
351
|
+
concatenatedElements = leftElements;
|
|
352
|
+
}
|
|
353
|
+
if (rightElements) {
|
|
354
|
+
concatenatedElements = concatenatedElements.concat(rightElements);
|
|
355
|
+
}
|
|
356
|
+
for (let i = 0; i < concatenatedElements.length; i += 1) {
|
|
357
|
+
currElement = concatenatedElements[i];
|
|
358
|
+
this.copyBox(this.bboxArray, currElement, this.bboxHelper, helperPos);
|
|
359
|
+
helperPos += 1;
|
|
360
|
+
}
|
|
361
|
+
// copy results back to main array
|
|
362
|
+
const subArr = this.bboxHelper.subarray(node.startIndex * 7, node.endIndex * 7);
|
|
363
|
+
this.bboxArray.set(subArr, node.startIndex * 7);
|
|
364
|
+
// create 2 new nodes for the node we just split, and add links to them from the parent node
|
|
365
|
+
const node0Extents = this.calcExtents(node0Start, node0End, BVHTree.EPSILON);
|
|
366
|
+
const node1Extents = this.calcExtents(node1Start, node1End, BVHTree.EPSILON);
|
|
367
|
+
const node0 = new BVHNode(node0Extents[0], node0Extents[1], node0Start, node0End, node.level + 1);
|
|
368
|
+
const node1 = new BVHNode(node1Extents[0], node1Extents[1], node1Start, node1End, node.level + 1);
|
|
369
|
+
node.node0 = node0;
|
|
370
|
+
node.node1 = node1;
|
|
371
|
+
node.clearShapes();
|
|
372
|
+
// add new nodes to the split queue
|
|
373
|
+
this.nodesToSplit.push(node0);
|
|
374
|
+
this.nodesToSplit.push(node1);
|
|
375
|
+
}
|
|
376
|
+
calcTValues(minVal, maxVal, rayOriginCoord, invdir) {
|
|
377
|
+
const res = { min: 0, max: 0 };
|
|
378
|
+
if (invdir >= 0) {
|
|
379
|
+
res.min = (minVal - rayOriginCoord) * invdir;
|
|
380
|
+
res.max = (maxVal - rayOriginCoord) * invdir;
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
res.min = (maxVal - rayOriginCoord) * invdir;
|
|
384
|
+
res.max = (minVal - rayOriginCoord) * invdir;
|
|
385
|
+
}
|
|
386
|
+
return res;
|
|
387
|
+
}
|
|
388
|
+
intersectNodeBox(rayOrigin, invRayDirection, node) {
|
|
389
|
+
const t = this.calcTValues(node.extentsMin.x, node.extentsMax.x, rayOrigin.x, invRayDirection.x);
|
|
390
|
+
const ty = this.calcTValues(node.extentsMin.y, node.extentsMax.y, rayOrigin.y, invRayDirection.y);
|
|
391
|
+
if ((t.min > ty.max) || (ty.min > t.max)) {
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
// These lines also handle the case where tmin or tmax is NaN
|
|
395
|
+
// (result of 0 * Infinity). x !== x returns true if x is NaN
|
|
396
|
+
if (ty.min > t.min || Number.isNaN(t.min)) {
|
|
397
|
+
t.min = ty.min;
|
|
398
|
+
}
|
|
399
|
+
if (ty.max < t.max || Number.isNaN(t.max)) {
|
|
400
|
+
t.max = ty.max;
|
|
401
|
+
}
|
|
402
|
+
const tz = this.calcTValues(node.extentsMin.z, node.extentsMax.z, rayOrigin.z, invRayDirection.z);
|
|
403
|
+
if ((t.min > tz.max) || (tz.min > t.max)) {
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
if (tz.min > t.min || Number.isNaN(t.min)) {
|
|
407
|
+
t.min = tz.min;
|
|
408
|
+
}
|
|
409
|
+
if (tz.max < t.max || Number.isNaN(t.max)) {
|
|
410
|
+
t.max = tz.max;
|
|
411
|
+
}
|
|
412
|
+
// return point closest to the ray (positive side)
|
|
413
|
+
if (t.max < 0) {
|
|
414
|
+
return false;
|
|
415
|
+
}
|
|
416
|
+
return true;
|
|
417
|
+
}
|
|
418
|
+
intersectRayTriangle(a, b, c, rayOrigin, rayDirection, backfaceCulling) {
|
|
419
|
+
const { THREE } = Externals.getInstance();
|
|
420
|
+
// Compute the offset origin, edges, and normal.
|
|
421
|
+
const diff = new THREE.Vector3();
|
|
422
|
+
const edge1 = new THREE.Vector3();
|
|
423
|
+
const edge2 = new THREE.Vector3();
|
|
424
|
+
const normal = new THREE.Vector3();
|
|
425
|
+
// from http://www.geometrictools.com/LibMathematics/Intersection/Wm5IntrRay3Triangle3.cpp
|
|
426
|
+
edge1.subVectors(b, a);
|
|
427
|
+
edge2.subVectors(c, a);
|
|
428
|
+
normal.crossVectors(edge1, edge2);
|
|
429
|
+
// Solve Q + t*D = b1*E1 + bL*E2 (Q = kDiff, D = ray direction,
|
|
430
|
+
// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by
|
|
431
|
+
// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))
|
|
432
|
+
// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))
|
|
433
|
+
// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)
|
|
434
|
+
let DdN = rayDirection.dot(normal);
|
|
435
|
+
let sign;
|
|
436
|
+
if (DdN > 0) {
|
|
437
|
+
if (backfaceCulling) {
|
|
438
|
+
return null;
|
|
439
|
+
}
|
|
440
|
+
sign = 1;
|
|
441
|
+
}
|
|
442
|
+
else if (DdN < 0) {
|
|
443
|
+
sign = -1;
|
|
444
|
+
DdN = -DdN;
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
diff.subVectors(rayOrigin, a);
|
|
450
|
+
const DdQxE2 = sign * rayDirection.dot(edge2.crossVectors(diff, edge2));
|
|
451
|
+
// b1 < 0, no intersection
|
|
452
|
+
if (DdQxE2 < 0) {
|
|
453
|
+
return null;
|
|
454
|
+
}
|
|
455
|
+
const DdE1xQ = sign * rayDirection.dot(edge1.cross(diff));
|
|
456
|
+
// b2 < 0, no intersection
|
|
457
|
+
if (DdE1xQ < 0) {
|
|
458
|
+
return null;
|
|
459
|
+
}
|
|
460
|
+
// b1+b2 > 1, no intersection
|
|
461
|
+
if (DdQxE2 + DdE1xQ > DdN) {
|
|
462
|
+
return null;
|
|
463
|
+
}
|
|
464
|
+
// Line intersects triangle, check if ray does.
|
|
465
|
+
const QdN = -sign * diff.dot(normal);
|
|
466
|
+
// t < 0, no intersection
|
|
467
|
+
if (QdN < 0) {
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
// Ray intersects triangle.
|
|
471
|
+
const t = QdN / DdN;
|
|
472
|
+
const result = new THREE.Vector3();
|
|
473
|
+
return result.copy(rayDirection).multiplyScalar(t).add(rayOrigin);
|
|
474
|
+
}
|
|
475
|
+
static addTriangles(triangles, threeObj) {
|
|
476
|
+
// threeObj.children.forEach((child: Object3D) => {
|
|
477
|
+
// // console.info('#BVHTree# addTriangles child:', child);
|
|
478
|
+
// this.addTriangles(triangles, child);
|
|
479
|
+
// });
|
|
480
|
+
const { THREE } = Externals.getInstance();
|
|
481
|
+
if (!(threeObj instanceof THREE.Mesh)) {
|
|
482
|
+
// console.log('#BVHTree# addTriangles returns');
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
const threeMesh = threeObj;
|
|
486
|
+
const geometry = threeMesh.geometry;
|
|
487
|
+
// 获得顶点数组
|
|
488
|
+
const vertexArr = geometry.attributes.position.array;
|
|
489
|
+
// console.info('#BVHTree# vertexArray:', vertexArr);
|
|
490
|
+
// 获得索引数组
|
|
491
|
+
const indexArr = geometry.index ? geometry.index.array : null;
|
|
492
|
+
let triangleCount = 0;
|
|
493
|
+
if (indexArr) {
|
|
494
|
+
// 如果索引数组存在,利用索引数组和顶点数组构建bvhtree
|
|
495
|
+
triangleCount = indexArr.length / 3;
|
|
496
|
+
// console.log(`#BVHTree# addTriangles #0 triangleCount=${triangleCount}`);
|
|
497
|
+
// triangles.length = triangleCount;
|
|
498
|
+
for (let i = 0; i < triangleCount; i += 1) {
|
|
499
|
+
triangles.push([
|
|
500
|
+
new THREE.Vector3(vertexArr[3 * indexArr[3 * i]], vertexArr[3 * indexArr[3 * i] + 1], vertexArr[3 * indexArr[3 * i] + 2]),
|
|
501
|
+
new THREE.Vector3(vertexArr[3 * indexArr[3 * i + 1]], vertexArr[3 * indexArr[3 * i + 1] + 1], vertexArr[3 * indexArr[3 * i + 1] + 2]),
|
|
502
|
+
new THREE.Vector3(vertexArr[3 * indexArr[3 * i + 2]], vertexArr[3 * indexArr[3 * i + 2] + 1], vertexArr[3 * indexArr[3 * i + 2] + 2]),
|
|
503
|
+
]);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
// 如果索引数组不存在,通过顶点数组构建bvhtree
|
|
508
|
+
triangleCount = vertexArr.length / 9;
|
|
509
|
+
// console.log(`#BVHTree# addTriangles #1 triangleCount=${triangleCount}`);
|
|
510
|
+
// triangles.length = triangleCount;
|
|
511
|
+
for (let i = 0; i < triangleCount; i += 1) {
|
|
512
|
+
triangles.push([
|
|
513
|
+
new THREE.Vector3(vertexArr[i * 9], vertexArr[i * 9 + 1], vertexArr[i * 9 + 2]),
|
|
514
|
+
new THREE.Vector3(vertexArr[i * 9 + 3], vertexArr[i * 9 + 4], vertexArr[i * 9 + 5]),
|
|
515
|
+
new THREE.Vector3(vertexArr[i * 9 + 6], vertexArr[i * 9 + 7], vertexArr[i * 9 + 8]),
|
|
516
|
+
]);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* 构建bvhtree
|
|
522
|
+
* @ignore
|
|
523
|
+
* @param {Object3D} threeObj 需要创建BVH树的Object3D根对象
|
|
524
|
+
* @returns {BVHTree}
|
|
525
|
+
*/
|
|
526
|
+
static createBVHTree(threeObj) {
|
|
527
|
+
// threeObj.updateWorldMatrix(false, true);
|
|
528
|
+
const triangles = [];
|
|
529
|
+
// this.addTriangles(triangles, threeObj);
|
|
530
|
+
threeObj.traverse((obj) => {
|
|
531
|
+
this.addTriangles(triangles, obj);
|
|
532
|
+
});
|
|
533
|
+
// console.info('#BVHTree# triangles:', triangles);
|
|
534
|
+
const bvh = new BVHTree(triangles, 7);
|
|
535
|
+
return bvh;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
BVHTree.EPSILON = 1e-6;
|
|
539
|
+
export { BVHTree, BVHNode };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { NS_THREE } from '../stage/externals';
|
|
2
|
+
import { Camera as CameraElement } from '../element/camera';
|
|
3
|
+
/**
|
|
4
|
+
* 相机相关的工具, 提供各类相机的工具函数
|
|
5
|
+
*/
|
|
6
|
+
declare class Camera {
|
|
7
|
+
/**
|
|
8
|
+
* 根据 Spherical Coordinate 确定 lookAt 坐标
|
|
9
|
+
* @param param0 相机坐标
|
|
10
|
+
* @param yaw 相机当前 yaw
|
|
11
|
+
* @param pitch 相机当前 pitch
|
|
12
|
+
* @returns 看向的方向与俯瞰时与 X 轴的夹角
|
|
13
|
+
*/
|
|
14
|
+
static getCameraLookAtPositionByYawPitch({ x, y, z }: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
z: number;
|
|
18
|
+
}, yaw: number, pitch: number): {
|
|
19
|
+
position: NS_THREE.Vector3;
|
|
20
|
+
degree: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* 根据 yaw pitch 设置相机的朝向
|
|
24
|
+
* @param camera 相机元素
|
|
25
|
+
*/
|
|
26
|
+
static setCameraLookAtByYawPitch(camera: CameraElement): void;
|
|
27
|
+
/**
|
|
28
|
+
* 根据相机朝向获取 yaw pitch
|
|
29
|
+
* @param v 方向向量
|
|
30
|
+
* @returns yaw 与 pitch
|
|
31
|
+
*/
|
|
32
|
+
static getYawPitchFromCameraLookVector(v: NS_THREE.Vector3): {
|
|
33
|
+
yaw: number;
|
|
34
|
+
pitch: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export { Camera };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Externals } from '../stage/externals';
|
|
2
|
+
/**
|
|
3
|
+
* 相机相关的工具, 提供各类相机的工具函数
|
|
4
|
+
*/
|
|
5
|
+
class Camera {
|
|
6
|
+
/**
|
|
7
|
+
* 根据 Spherical Coordinate 确定 lookAt 坐标
|
|
8
|
+
* @param param0 相机坐标
|
|
9
|
+
* @param yaw 相机当前 yaw
|
|
10
|
+
* @param pitch 相机当前 pitch
|
|
11
|
+
* @returns 看向的方向与俯瞰时与 X 轴的夹角
|
|
12
|
+
*/
|
|
13
|
+
static getCameraLookAtPositionByYawPitch({ x, y, z }, yaw, pitch) {
|
|
14
|
+
/**
|
|
15
|
+
* up = (0, 0, 1)
|
|
16
|
+
* ( pitch, yaw) => (x, y, z)
|
|
17
|
+
* ( 0, 0) => (1, 0, 0)
|
|
18
|
+
* ( pi/2, 0) => (0, 0, 1)
|
|
19
|
+
* ( 0, pi/2) => (1, 0, 0)
|
|
20
|
+
*/
|
|
21
|
+
const xyLen = Math.cos(pitch / 180 * Math.PI);
|
|
22
|
+
const dx = xyLen * Math.sin(-yaw / 180 * Math.PI);
|
|
23
|
+
const dy = xyLen * Math.cos(yaw / 180 * Math.PI);
|
|
24
|
+
const dz = Math.sin(pitch / 180 * Math.PI);
|
|
25
|
+
const { THREE } = Externals.getInstance();
|
|
26
|
+
return {
|
|
27
|
+
position: new THREE.Vector3(x + dx, y + dy, z + dz),
|
|
28
|
+
degree: yaw,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 根据 yaw pitch 设置相机的朝向
|
|
33
|
+
* @param camera 相机元素
|
|
34
|
+
*/
|
|
35
|
+
static setCameraLookAtByYawPitch(camera) {
|
|
36
|
+
const { position } = Camera.getCameraLookAtPositionByYawPitch(camera.position.clone(), camera.getYaw(), camera.getPitch());
|
|
37
|
+
camera.lookAt(position, 0, 0, false);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 根据相机朝向获取 yaw pitch
|
|
41
|
+
* @param v 方向向量
|
|
42
|
+
* @returns yaw 与 pitch
|
|
43
|
+
*/
|
|
44
|
+
static getYawPitchFromCameraLookVector(v) {
|
|
45
|
+
const pitch = Math.asin(v.z) / Math.PI * 180;
|
|
46
|
+
const yaw = -Math.atan2(v.x, v.y) / Math.PI * 180;
|
|
47
|
+
return { yaw, pitch };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export { Camera };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NS_THREE } from '../stage/externals';
|
|
2
|
+
declare class CubeTextureCache {
|
|
3
|
+
private cubeTextureCache;
|
|
4
|
+
private workingTasks;
|
|
5
|
+
static sharedInstance: CubeTextureCache;
|
|
6
|
+
static disposeAll(): void;
|
|
7
|
+
dispose(): void;
|
|
8
|
+
constructor(capacity: number);
|
|
9
|
+
/**
|
|
10
|
+
* @ignore
|
|
11
|
+
* 获取立方体贴图,先从缓存中获取,若未命中则异步加载立方体贴图
|
|
12
|
+
* @param cubeTextureURLs 立方体贴图六个面的图像URL数组
|
|
13
|
+
*/
|
|
14
|
+
loadCubeTexture(cubeTextureURLs: string[], cacheAnyway?: boolean, recycleIntermediateTextures?: boolean): Promise<NS_THREE.CubeTexture>;
|
|
15
|
+
/**
|
|
16
|
+
* 获取一组立方体贴图,若没命中则异步加载
|
|
17
|
+
* @param textureURLsArray 需要获取的立方体贴图URL数组,其每个元素是一个6元素的数组,表示一个立方体贴图的六个面
|
|
18
|
+
* @param waitForReadyCount 指定函数必须在textureURLsArray中的前多少个立方体贴图获取到以后才能返回
|
|
19
|
+
* 比如在即将显示一个全景点时,指定必须等指定全景点的立方体贴图获取到后才能返回,而其周围全景点可以同时预加载但不用等
|
|
20
|
+
*/
|
|
21
|
+
preloadCubeTextures(textureURLsArray: (string[] | undefined)[], waitForReadyCount: number, recycleIntermediateTextures?: boolean[]): Promise<NS_THREE.CubeTexture[]>;
|
|
22
|
+
recycleCubeTexture(cubeTextureURLs: string[]): void;
|
|
23
|
+
getCapacity(): number;
|
|
24
|
+
}
|
|
25
|
+
export { CubeTextureCache };
|