@aibee/owlly 1.0.25
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/README.external.md +75 -0
- package/README.md +28 -0
- package/lib/src/external/lines/line-geometry.d.ts +9 -0
- package/lib/src/external/lines/line-geometry.js +52 -0
- package/lib/src/external/lines/line-geometry.js.map +1 -0
- package/lib/src/external/lines/line-material.d.ts +10 -0
- package/lib/src/external/lines/line-material.js +377 -0
- package/lib/src/external/lines/line-material.js.map +1 -0
- package/lib/src/external/lines/line-segments-2.d.ts +7 -0
- package/lib/src/external/lines/line-segments-2.js +144 -0
- package/lib/src/external/lines/line-segments-2.js.map +1 -0
- package/lib/src/external/lines/line-segments-geometry.d.ts +15 -0
- package/lib/src/external/lines/line-segments-geometry.js +141 -0
- package/lib/src/external/lines/line-segments-geometry.js.map +1 -0
- package/lib/src/external/loaders/gltf-loader.d.ts +77 -0
- package/lib/src/external/loaders/gltf-loader.js +2319 -0
- package/lib/src/external/loaders/gltf-loader.js.map +1 -0
- package/lib/src/external/orbit-controls.d.ts +44 -0
- package/lib/src/external/orbit-controls.js +746 -0
- package/lib/src/external/orbit-controls.js.map +1 -0
- package/lib/src/external/renderers/css-2d-renderer.d.ts +16 -0
- package/lib/src/external/renderers/css-2d-renderer.js +122 -0
- package/lib/src/external/renderers/css-2d-renderer.js.map +1 -0
- package/lib/src/external/renderers/css-3d-renderer.d.ts +18 -0
- package/lib/src/external/renderers/css-3d-renderer.js +139 -0
- package/lib/src/external/renderers/css-3d-renderer.js.map +1 -0
- package/lib/src/external/transform-controls.d.ts +106 -0
- package/lib/src/external/transform-controls.js +1113 -0
- package/lib/src/external/transform-controls.js.map +1 -0
- package/lib/src/external/util/buffer-geometry-utils.d.ts +45 -0
- package/lib/src/external/util/buffer-geometry-utils.js +569 -0
- package/lib/src/external/util/buffer-geometry-utils.js.map +1 -0
- package/lib/src/owlly/controller/aerial-element-controller.d.ts +65 -0
- package/lib/src/owlly/controller/aerial-element-controller.js +236 -0
- package/lib/src/owlly/controller/aerial-element-controller.js.map +1 -0
- package/lib/src/owlly/controller/basic-controller.d.ts +324 -0
- package/lib/src/owlly/controller/basic-controller.js +1239 -0
- package/lib/src/owlly/controller/basic-controller.js.map +1 -0
- package/lib/src/owlly/controller/camera-controller.d.ts +37 -0
- package/lib/src/owlly/controller/camera-controller.js +138 -0
- package/lib/src/owlly/controller/camera-controller.js.map +1 -0
- package/lib/src/owlly/controller/controller.d.ts +61 -0
- package/lib/src/owlly/controller/controller.js +24 -0
- package/lib/src/owlly/controller/controller.js.map +1 -0
- package/lib/src/owlly/controller/index.d.ts +2 -0
- package/lib/src/owlly/controller/index.js +14 -0
- package/lib/src/owlly/controller/index.js.map +1 -0
- package/lib/src/owlly/controller/mouse-indicator-controller.d.ts +34 -0
- package/lib/src/owlly/controller/mouse-indicator-controller.js +119 -0
- package/lib/src/owlly/controller/mouse-indicator-controller.js.map +1 -0
- package/lib/src/owlly/controller/orbit-control.d.ts +147 -0
- package/lib/src/owlly/controller/orbit-control.js +265 -0
- package/lib/src/owlly/controller/orbit-control.js.map +1 -0
- package/lib/src/owlly/controller/panorama-adjust-controller.d.ts +45 -0
- package/lib/src/owlly/controller/panorama-adjust-controller.js +158 -0
- package/lib/src/owlly/controller/panorama-adjust-controller.js.map +1 -0
- package/lib/src/owlly/controller/panorama-controller.d.ts +441 -0
- package/lib/src/owlly/controller/panorama-controller.js +1944 -0
- package/lib/src/owlly/controller/panorama-controller.js.map +1 -0
- package/lib/src/owlly/controller/panorama-transform-controller.d.ts +66 -0
- package/lib/src/owlly/controller/panorama-transform-controller.js +137 -0
- package/lib/src/owlly/controller/panorama-transform-controller.js.map +1 -0
- package/lib/src/owlly/controller/plane-controller.d.ts +43 -0
- package/lib/src/owlly/controller/plane-controller.js +174 -0
- package/lib/src/owlly/controller/plane-controller.js.map +1 -0
- package/lib/src/owlly/controller/texture-controller.d.ts +181 -0
- package/lib/src/owlly/controller/texture-controller.js +876 -0
- package/lib/src/owlly/controller/texture-controller.js.map +1 -0
- package/lib/src/owlly/controller/tile-panorama-controller.d.ts +308 -0
- package/lib/src/owlly/controller/tile-panorama-controller.js +1354 -0
- package/lib/src/owlly/controller/tile-panorama-controller.js.map +1 -0
- package/lib/src/owlly/controller/transform-controller.d.ts +106 -0
- package/lib/src/owlly/controller/transform-controller.js +546 -0
- package/lib/src/owlly/controller/transform-controller.js.map +1 -0
- package/lib/src/owlly/element/bottom-nav-element.d.ts +65 -0
- package/lib/src/owlly/element/bottom-nav-element.js +258 -0
- package/lib/src/owlly/element/bottom-nav-element.js.map +1 -0
- package/lib/src/owlly/element/camera.d.ts +82 -0
- package/lib/src/owlly/element/camera.js +284 -0
- package/lib/src/owlly/element/camera.js.map +1 -0
- package/lib/src/owlly/element/dom-2d-element.d.ts +35 -0
- package/lib/src/owlly/element/dom-2d-element.js +49 -0
- package/lib/src/owlly/element/dom-2d-element.js.map +1 -0
- package/lib/src/owlly/element/dom-3d-element.d.ts +27 -0
- package/lib/src/owlly/element/dom-3d-element.js +34 -0
- package/lib/src/owlly/element/dom-3d-element.js.map +1 -0
- package/lib/src/owlly/element/dom-label-2d.d.ts +116 -0
- package/lib/src/owlly/element/dom-label-2d.js +383 -0
- package/lib/src/owlly/element/dom-label-2d.js.map +1 -0
- package/lib/src/owlly/element/element.d.ts +53 -0
- package/lib/src/owlly/element/element.js +76 -0
- package/lib/src/owlly/element/element.js.map +1 -0
- package/lib/src/owlly/element/floor-model.d.ts +83 -0
- package/lib/src/owlly/element/floor-model.js +228 -0
- package/lib/src/owlly/element/floor-model.js.map +1 -0
- package/lib/src/owlly/element/gif-kit/Gif.d.ts +96 -0
- package/lib/src/owlly/element/gif-kit/Gif.js +433 -0
- package/lib/src/owlly/element/gif-kit/Gif.js.map +1 -0
- package/lib/src/owlly/element/gif-kit/GifColor.d.ts +21 -0
- package/lib/src/owlly/element/gif-kit/GifColor.js +38 -0
- package/lib/src/owlly/element/gif-kit/GifColor.js.map +1 -0
- package/lib/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
- package/lib/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.js +51 -0
- package/lib/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.js.map +1 -0
- package/lib/src/owlly/element/gif-kit/GifFrame.d.ts +31 -0
- package/lib/src/owlly/element/gif-kit/GifFrame.js +97 -0
- package/lib/src/owlly/element/gif-kit/GifFrame.js.map +1 -0
- package/lib/src/owlly/element/gif-kit/GifImage.d.ts +23 -0
- package/lib/src/owlly/element/gif-kit/GifImage.js +8 -0
- package/lib/src/owlly/element/gif-kit/GifImage.js.map +1 -0
- package/lib/src/owlly/element/gif-kit/GifParser.d.ts +17 -0
- package/lib/src/owlly/element/gif-kit/GifParser.js +197 -0
- package/lib/src/owlly/element/gif-kit/GifParser.js.map +1 -0
- package/lib/src/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
- package/lib/src/owlly/element/gif-kit/GifPresenter.js +44 -0
- package/lib/src/owlly/element/gif-kit/GifPresenter.js.map +1 -0
- package/lib/src/owlly/element/gif-kit/GifVersion.d.ts +10 -0
- package/lib/src/owlly/element/gif-kit/GifVersion.js +13 -0
- package/lib/src/owlly/element/gif-kit/GifVersion.js.map +1 -0
- package/lib/src/owlly/element/gltf-mesh-element.d.ts +31 -0
- package/lib/src/owlly/element/gltf-mesh-element.js +137 -0
- package/lib/src/owlly/element/gltf-mesh-element.js.map +1 -0
- package/lib/src/owlly/element/index.d.ts +20 -0
- package/lib/src/owlly/element/index.js +25 -0
- package/lib/src/owlly/element/index.js.map +1 -0
- package/lib/src/owlly/element/map-kit/area.d.ts +24 -0
- package/lib/src/owlly/element/map-kit/area.js +218 -0
- package/lib/src/owlly/element/map-kit/area.js.map +1 -0
- package/lib/src/owlly/element/map-kit/block-set.d.ts +39 -0
- package/lib/src/owlly/element/map-kit/block-set.js +91 -0
- package/lib/src/owlly/element/map-kit/block-set.js.map +1 -0
- package/lib/src/owlly/element/map-kit/block.d.ts +77 -0
- package/lib/src/owlly/element/map-kit/block.js +339 -0
- package/lib/src/owlly/element/map-kit/block.js.map +1 -0
- package/lib/src/owlly/element/map-kit/index.d.ts +4 -0
- package/lib/src/owlly/element/map-kit/index.js +7 -0
- package/lib/src/owlly/element/map-kit/index.js.map +1 -0
- package/lib/src/owlly/element/map-kit/shape.d.ts +131 -0
- package/lib/src/owlly/element/map-kit/shape.js +190 -0
- package/lib/src/owlly/element/map-kit/shape.js.map +1 -0
- package/lib/src/owlly/element/mesh-element.d.ts +22 -0
- package/lib/src/owlly/element/mesh-element.js +64 -0
- package/lib/src/owlly/element/mesh-element.js.map +1 -0
- package/lib/src/owlly/element/mesh-line-2d.d.ts +82 -0
- package/lib/src/owlly/element/mesh-line-2d.js +888 -0
- package/lib/src/owlly/element/mesh-line-2d.js.map +1 -0
- package/lib/src/owlly/element/meshline-o.d.ts +64 -0
- package/lib/src/owlly/element/meshline-o.js +679 -0
- package/lib/src/owlly/element/meshline-o.js.map +1 -0
- package/lib/src/owlly/element/panorama-group.d.ts +241 -0
- package/lib/src/owlly/element/panorama-group.js +967 -0
- package/lib/src/owlly/element/panorama-group.js.map +1 -0
- package/lib/src/owlly/element/panorama.d.ts +132 -0
- package/lib/src/owlly/element/panorama.js +813 -0
- package/lib/src/owlly/element/panorama.js.map +1 -0
- package/lib/src/owlly/element/path-group.d.ts +69 -0
- package/lib/src/owlly/element/path-group.js +172 -0
- package/lib/src/owlly/element/path-group.js.map +1 -0
- package/lib/src/owlly/element/path.d.ts +99 -0
- package/lib/src/owlly/element/path.js +532 -0
- package/lib/src/owlly/element/path.js.map +1 -0
- package/lib/src/owlly/element/placeable-2d.d.ts +158 -0
- package/lib/src/owlly/element/placeable-2d.js +471 -0
- package/lib/src/owlly/element/placeable-2d.js.map +1 -0
- package/lib/src/owlly/element/polygon-mesh.d.ts +107 -0
- package/lib/src/owlly/element/polygon-mesh.js +308 -0
- package/lib/src/owlly/element/polygon-mesh.js.map +1 -0
- package/lib/src/owlly/element/ring-element.d.ts +79 -0
- package/lib/src/owlly/element/ring-element.js +384 -0
- package/lib/src/owlly/element/ring-element.js.map +1 -0
- package/lib/src/owlly/element/sphere-mesh.d.ts +28 -0
- package/lib/src/owlly/element/sphere-mesh.js +70 -0
- package/lib/src/owlly/element/sphere-mesh.js.map +1 -0
- package/lib/src/owlly/element/svg-floor-model.d.ts +22 -0
- package/lib/src/owlly/element/svg-floor-model.js +185 -0
- package/lib/src/owlly/element/svg-floor-model.js.map +1 -0
- package/lib/src/owlly/element/svg-floors.d.ts +27 -0
- package/lib/src/owlly/element/svg-floors.js +110 -0
- package/lib/src/owlly/element/svg-floors.js.map +1 -0
- package/lib/src/owlly/element/tile-panorama-group.d.ts +335 -0
- package/lib/src/owlly/element/tile-panorama-group.js +1007 -0
- package/lib/src/owlly/element/tile-panorama-group.js.map +1 -0
- package/lib/src/owlly/element/tile-panorama.d.ts +161 -0
- package/lib/src/owlly/element/tile-panorama.js +511 -0
- package/lib/src/owlly/element/tile-panorama.js.map +1 -0
- package/lib/src/owlly/element/tile-plane.d.ts +105 -0
- package/lib/src/owlly/element/tile-plane.js +361 -0
- package/lib/src/owlly/element/tile-plane.js.map +1 -0
- package/lib/src/owlly/element/video-element.d.ts +33 -0
- package/lib/src/owlly/element/video-element.js +160 -0
- package/lib/src/owlly/element/video-element.js.map +1 -0
- package/lib/src/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
- package/lib/src/owlly/geometries/ExtrudeGeometry2.js +211 -0
- package/lib/src/owlly/geometries/ExtrudeGeometry2.js.map +1 -0
- package/lib/src/owlly/index.d.ts +13 -0
- package/lib/src/owlly/index.js +17 -0
- package/lib/src/owlly/index.js.map +1 -0
- package/lib/src/owlly/overlay/canvas-overlay.d.ts +96 -0
- package/lib/src/owlly/overlay/canvas-overlay.js +511 -0
- package/lib/src/owlly/overlay/canvas-overlay.js.map +1 -0
- package/lib/src/owlly/overlay/css-2d-overlay.d.ts +14 -0
- package/lib/src/owlly/overlay/css-2d-overlay.js +36 -0
- package/lib/src/owlly/overlay/css-2d-overlay.js.map +1 -0
- package/lib/src/owlly/overlay/css-3d-overlay.d.ts +16 -0
- package/lib/src/owlly/overlay/css-3d-overlay.js +37 -0
- package/lib/src/owlly/overlay/css-3d-overlay.js.map +1 -0
- package/lib/src/owlly/overlay/index.d.ts +6 -0
- package/lib/src/owlly/overlay/index.js +12 -0
- package/lib/src/owlly/overlay/index.js.map +1 -0
- package/lib/src/owlly/overlay/label-overlay.d.ts +62 -0
- package/lib/src/owlly/overlay/label-overlay.js +329 -0
- package/lib/src/owlly/overlay/label-overlay.js.map +1 -0
- package/lib/src/owlly/overlay/overlay.d.ts +14 -0
- package/lib/src/owlly/overlay/overlay.js +5 -0
- package/lib/src/owlly/overlay/overlay.js.map +1 -0
- package/lib/src/owlly/overlay/path-overlay.d.ts +39 -0
- package/lib/src/owlly/overlay/path-overlay.js +125 -0
- package/lib/src/owlly/overlay/path-overlay.js.map +1 -0
- package/lib/src/owlly/overlay/path-overlay2.d.ts +35 -0
- package/lib/src/owlly/overlay/path-overlay2.js +119 -0
- package/lib/src/owlly/overlay/path-overlay2.js.map +1 -0
- package/lib/src/owlly/overlay/poi-overlay-3d.d.ts +278 -0
- package/lib/src/owlly/overlay/poi-overlay-3d.js +1433 -0
- package/lib/src/owlly/overlay/poi-overlay-3d.js.map +1 -0
- package/lib/src/owlly/overlay/poi-overlay.d.ts +277 -0
- package/lib/src/owlly/overlay/poi-overlay.js +1412 -0
- package/lib/src/owlly/overlay/poi-overlay.js.map +1 -0
- package/lib/src/owlly/owlly-2d/index.d.ts +28 -0
- package/lib/src/owlly/owlly-2d/index.js +93 -0
- package/lib/src/owlly/owlly-2d/index.js.map +1 -0
- package/lib/src/owlly/screen/index.d.ts +1 -0
- package/lib/src/owlly/screen/index.js +2 -0
- package/lib/src/owlly/screen/index.js.map +1 -0
- package/lib/src/owlly/screen/screen.d.ts +73 -0
- package/lib/src/owlly/screen/screen.js +237 -0
- package/lib/src/owlly/screen/screen.js.map +1 -0
- package/lib/src/owlly/stage/__test__/stage.spec.d.ts +1 -0
- package/lib/src/owlly/stage/__test__/stage.spec.js +15 -0
- package/lib/src/owlly/stage/__test__/stage.spec.js.map +1 -0
- package/lib/src/owlly/stage/externals.d.ts +19 -0
- package/lib/src/owlly/stage/externals.js +25 -0
- package/lib/src/owlly/stage/externals.js.map +1 -0
- package/lib/src/owlly/stage/index.d.ts +4 -0
- package/lib/src/owlly/stage/index.js +7 -0
- package/lib/src/owlly/stage/index.js.map +1 -0
- package/lib/src/owlly/stage/owlly.d.ts +38 -0
- package/lib/src/owlly/stage/owlly.js +168 -0
- package/lib/src/owlly/stage/owlly.js.map +1 -0
- package/lib/src/owlly/stage/stage.d.ts +108 -0
- package/lib/src/owlly/stage/stage.js +235 -0
- package/lib/src/owlly/stage/stage.js.map +1 -0
- package/lib/src/owlly/utils/alignment-utils.d.ts +20 -0
- package/lib/src/owlly/utils/alignment-utils.js +64 -0
- package/lib/src/owlly/utils/alignment-utils.js.map +1 -0
- package/lib/src/owlly/utils/basic-calc.d.ts +18 -0
- package/lib/src/owlly/utils/basic-calc.js +130 -0
- package/lib/src/owlly/utils/basic-calc.js.map +1 -0
- package/lib/src/owlly/utils/basic-tools.d.ts +71 -0
- package/lib/src/owlly/utils/basic-tools.js +236 -0
- package/lib/src/owlly/utils/basic-tools.js.map +1 -0
- package/lib/src/owlly/utils/bvh-tree.d.ts +105 -0
- package/lib/src/owlly/utils/bvh-tree.js +540 -0
- package/lib/src/owlly/utils/bvh-tree.js.map +1 -0
- package/lib/src/owlly/utils/camera.d.ts +37 -0
- package/lib/src/owlly/utils/camera.js +51 -0
- package/lib/src/owlly/utils/camera.js.map +1 -0
- package/lib/src/owlly/utils/cube-texture-cache.d.ts +25 -0
- package/lib/src/owlly/utils/cube-texture-cache.js +144 -0
- package/lib/src/owlly/utils/cube-texture-cache.js.map +1 -0
- package/lib/src/owlly/utils/device-utils.d.ts +18 -0
- package/lib/src/owlly/utils/device-utils.js +42 -0
- package/lib/src/owlly/utils/device-utils.js.map +1 -0
- package/lib/src/owlly/utils/environment-utils.d.ts +37 -0
- package/lib/src/owlly/utils/environment-utils.js +74 -0
- package/lib/src/owlly/utils/environment-utils.js.map +1 -0
- package/lib/src/owlly/utils/event-hub.d.ts +50 -0
- package/lib/src/owlly/utils/event-hub.js +107 -0
- package/lib/src/owlly/utils/event-hub.js.map +1 -0
- package/lib/src/owlly/utils/events.d.ts +219 -0
- package/lib/src/owlly/utils/events.js +220 -0
- package/lib/src/owlly/utils/events.js.map +1 -0
- package/lib/src/owlly/utils/geometry-utils.d.ts +119 -0
- package/lib/src/owlly/utils/geometry-utils.js +623 -0
- package/lib/src/owlly/utils/geometry-utils.js.map +1 -0
- package/lib/src/owlly/utils/helper.d.ts +6 -0
- package/lib/src/owlly/utils/helper.js +25 -0
- package/lib/src/owlly/utils/helper.js.map +1 -0
- package/lib/src/owlly/utils/index.d.ts +14 -0
- package/lib/src/owlly/utils/index.js +18 -0
- package/lib/src/owlly/utils/index.js.map +1 -0
- package/lib/src/owlly/utils/lru-cache.d.ts +26 -0
- package/lib/src/owlly/utils/lru-cache.js +110 -0
- package/lib/src/owlly/utils/lru-cache.js.map +1 -0
- package/lib/src/owlly/utils/map-utils.d.ts +7 -0
- package/lib/src/owlly/utils/map-utils.js +53 -0
- package/lib/src/owlly/utils/map-utils.js.map +1 -0
- package/lib/src/owlly/utils/number-utils.d.ts +8 -0
- package/lib/src/owlly/utils/number-utils.js +73 -0
- package/lib/src/owlly/utils/number-utils.js.map +1 -0
- package/lib/src/owlly/utils/panorama-model-util.d.ts +46 -0
- package/lib/src/owlly/utils/panorama-model-util.js +246 -0
- package/lib/src/owlly/utils/panorama-model-util.js.map +1 -0
- package/lib/src/owlly/utils/path-utils.d.ts +80 -0
- package/lib/src/owlly/utils/path-utils.js +729 -0
- package/lib/src/owlly/utils/path-utils.js.map +1 -0
- package/lib/src/owlly/utils/svgutils.d.ts +138 -0
- package/lib/src/owlly/utils/svgutils.js +562 -0
- package/lib/src/owlly/utils/svgutils.js.map +1 -0
- package/lib/src/owlly/utils/texture-cache.d.ts +29 -0
- package/lib/src/owlly/utils/texture-cache.js +116 -0
- package/lib/src/owlly/utils/texture-cache.js.map +1 -0
- package/lib/src/owlly/utils/tile-util.d.ts +187 -0
- package/lib/src/owlly/utils/tile-util.js +457 -0
- package/lib/src/owlly/utils/tile-util.js.map +1 -0
- package/lib/src/owlly/utils/time-profiler.d.ts +21 -0
- package/lib/src/owlly/utils/time-profiler.js +49 -0
- package/lib/src/owlly/utils/time-profiler.js.map +1 -0
- package/lib/src/owlly/view/__test__/perspective-view.spec.d.ts +0 -0
- package/lib/src/owlly/view/__test__/perspective-view.spec.js +22 -0
- package/lib/src/owlly/view/__test__/perspective-view.spec.js.map +1 -0
- package/lib/src/owlly/view/camera-view.d.ts +35 -0
- package/lib/src/owlly/view/camera-view.js +102 -0
- package/lib/src/owlly/view/camera-view.js.map +1 -0
- package/lib/src/owlly/view/index.d.ts +3 -0
- package/lib/src/owlly/view/index.js +6 -0
- package/lib/src/owlly/view/index.js.map +1 -0
- package/lib/src/owlly/view/orthographic-view.d.ts +40 -0
- package/lib/src/owlly/view/orthographic-view.js +95 -0
- package/lib/src/owlly/view/orthographic-view.js.map +1 -0
- package/lib/src/owlly/view/perspective-view.d.ts +40 -0
- package/lib/src/owlly/view/perspective-view.js +96 -0
- package/lib/src/owlly/view/perspective-view.js.map +1 -0
- package/lib/src/owlly/view/svg-map-view.d.ts +46 -0
- package/lib/src/owlly/view/svg-map-view.js +145 -0
- package/lib/src/owlly/view/svg-map-view.js.map +1 -0
- package/lib/src/owlly/view/view.d.ts +146 -0
- package/lib/src/owlly/view/view.js +318 -0
- package/lib/src/owlly/view/view.js.map +1 -0
- package/lib/src/web/main.centroid.d.ts +0 -0
- package/lib/src/web/main.centroid.js +74 -0
- package/lib/src/web/main.centroid.js.map +1 -0
- package/lib/src/web/main.hyma.meshline2d.d.ts +1 -0
- package/lib/src/web/main.hyma.meshline2d.js +76 -0
- package/lib/src/web/main.hyma.meshline2d.js.map +1 -0
- package/lib/src/web/main.jyfang.sample.d.ts +0 -0
- package/lib/src/web/main.jyfang.sample.js +122 -0
- package/lib/src/web/main.jyfang.sample.js.map +1 -0
- package/lib/src/web/main.rpeng.extrude.d.ts +1 -0
- package/lib/src/web/main.rpeng.extrude.js +180 -0
- package/lib/src/web/main.rpeng.extrude.js.map +1 -0
- package/lib/src/web/main.rpeng.mes.plane.d.ts +1 -0
- package/lib/src/web/main.rpeng.mes.plane.js +135 -0
- package/lib/src/web/main.rpeng.mes.plane.js.map +1 -0
- package/lib/src/web/main.rpeng.sample.d.ts +0 -0
- package/lib/src/web/main.rpeng.sample.js +318 -0
- package/lib/src/web/main.rpeng.sample.js.map +1 -0
- package/lib/src/web/main.rpeng.vr.d.ts +1 -0
- package/lib/src/web/main.rpeng.vr.js +141 -0
- package/lib/src/web/main.rpeng.vr.js.map +1 -0
- package/lib/src/web/main.sample.d.ts +1 -0
- package/lib/src/web/main.sample.js +52 -0
- package/lib/src/web/main.sample.js.map +1 -0
- package/lib/src/web/quattree.hyma.d.ts +0 -0
- package/lib/src/web/quattree.hyma.js +150 -0
- package/lib/src/web/quattree.hyma.js.map +1 -0
- package/lib/src/web/sensor-vr-plugin.d.ts +0 -0
- package/lib/src/web/sensor-vr-plugin.js +166 -0
- package/lib/src/web/sensor-vr-plugin.js.map +1 -0
- package/package.json +142 -0
- package/src/@types/SceneUtils.d.ts +9 -0
- package/src/@types/chaikin-smooth.d.ts +5 -0
- package/src/@types/global.d.ts +3 -0
- package/src/@types/snapsvg.d.ts +11 -0
- package/src/@types/svgson.d.ts +30 -0
- package/src/assets/favicon.ico +0 -0
- package/src/external/lines/line-geometry.ts +70 -0
- package/src/external/lines/line-material.ts +453 -0
- package/src/external/lines/line-segments-2.ts +194 -0
- package/src/external/lines/line-segments-geometry.ts +197 -0
- package/src/external/loaders/gltf-loader.ts +3004 -0
- package/src/external/orbit-controls.ts +1070 -0
- package/src/external/renderers/css-2d-renderer.ts +185 -0
- package/src/external/renderers/css-3d-renderer.ts +245 -0
- package/src/external/transform-controls.ts +1532 -0
- package/src/external/util/buffer-geometry-utils.ts +783 -0
- package/src/owlly/controller/aerial-element-controller.ts +277 -0
- package/src/owlly/controller/basic-controller.ts +1509 -0
- package/src/owlly/controller/camera-controller.ts +155 -0
- package/src/owlly/controller/controller.ts +76 -0
- package/src/owlly/controller/index.ts +15 -0
- package/src/owlly/controller/mouse-indicator-controller.ts +157 -0
- package/src/owlly/controller/orbit-control.ts +310 -0
- package/src/owlly/controller/panorama-adjust-controller.ts +183 -0
- package/src/owlly/controller/panorama-controller.ts +2234 -0
- package/src/owlly/controller/panorama-transform-controller.ts +151 -0
- package/src/owlly/controller/plane-controller.ts +222 -0
- package/src/owlly/controller/texture-controller.ts +949 -0
- package/src/owlly/controller/tile-panorama-controller.ts +1633 -0
- package/src/owlly/controller/transform-controller.ts +684 -0
- package/src/owlly/element/bottom-nav-element.ts +352 -0
- package/src/owlly/element/camera.ts +389 -0
- package/src/owlly/element/dom-2d-element.ts +88 -0
- package/src/owlly/element/dom-3d-element.ts +87 -0
- package/src/owlly/element/dom-label-2d.ts +497 -0
- package/src/owlly/element/element.ts +117 -0
- package/src/owlly/element/floor-model.ts +290 -0
- package/src/owlly/element/gif-kit/Gif.ts +509 -0
- package/src/owlly/element/gif-kit/GifColor.ts +44 -0
- package/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.ts +56 -0
- package/src/owlly/element/gif-kit/GifFrame.ts +207 -0
- package/src/owlly/element/gif-kit/GifImage.ts +26 -0
- package/src/owlly/element/gif-kit/GifParser.ts +254 -0
- package/src/owlly/element/gif-kit/GifPresenter.ts +46 -0
- package/src/owlly/element/gif-kit/GifVersion.ts +12 -0
- package/src/owlly/element/gltf-mesh-element.ts +184 -0
- package/src/owlly/element/index.ts +25 -0
- package/src/owlly/element/map-kit/area.ts +232 -0
- package/src/owlly/element/map-kit/block-set.ts +102 -0
- package/src/owlly/element/map-kit/block.ts +417 -0
- package/src/owlly/element/map-kit/index.ts +6 -0
- package/src/owlly/element/map-kit/shape.ts +285 -0
- package/src/owlly/element/mesh-element.ts +94 -0
- package/src/owlly/element/mesh-line-2d.ts +1032 -0
- package/src/owlly/element/meshline-o.ts +802 -0
- package/src/owlly/element/panorama-group.ts +1250 -0
- package/src/owlly/element/panorama.ts +1044 -0
- package/src/owlly/element/path-group.ts +212 -0
- package/src/owlly/element/path.ts +727 -0
- package/src/owlly/element/placeable-2d.ts +627 -0
- package/src/owlly/element/polygon-mesh.ts +344 -0
- package/src/owlly/element/ring-element.ts +517 -0
- package/src/owlly/element/sphere-mesh.ts +96 -0
- package/src/owlly/element/svg-floor-model.ts +200 -0
- package/src/owlly/element/svg-floors.ts +121 -0
- package/src/owlly/element/tile-panorama-group.ts +1314 -0
- package/src/owlly/element/tile-panorama.ts +636 -0
- package/src/owlly/element/tile-plane.ts +430 -0
- package/src/owlly/element/video-element.ts +190 -0
- package/src/owlly/geometries/ExtrudeGeometry2.ts +255 -0
- package/src/owlly/index.ts +19 -0
- package/src/owlly/overlay/canvas-overlay.ts +642 -0
- package/src/owlly/overlay/css-2d-overlay.ts +48 -0
- package/src/owlly/overlay/css-3d-overlay.ts +50 -0
- package/src/owlly/overlay/index.ts +11 -0
- package/src/owlly/overlay/label-overlay.ts +419 -0
- package/src/owlly/overlay/overlay.ts +17 -0
- package/src/owlly/overlay/path-overlay.ts +170 -0
- package/src/owlly/overlay/path-overlay2.ts +149 -0
- package/src/owlly/overlay/poi-overlay-3d.ts +1759 -0
- package/src/owlly/overlay/poi-overlay.ts +1739 -0
- package/src/owlly/owlly-2d/index.ts +108 -0
- package/src/owlly/screen/index.ts +1 -0
- package/src/owlly/screen/screen.ts +323 -0
- package/src/owlly/stage/__test__/stage.spec.ts +15 -0
- package/src/owlly/stage/externals.ts +45 -0
- package/src/owlly/stage/index.ts +12 -0
- package/src/owlly/stage/owlly.ts +223 -0
- package/src/owlly/stage/stage.ts +274 -0
- package/src/owlly/utils/alignment-utils.ts +84 -0
- package/src/owlly/utils/basic-calc.ts +141 -0
- package/src/owlly/utils/basic-tools.ts +286 -0
- package/src/owlly/utils/bvh-tree.ts +695 -0
- package/src/owlly/utils/camera.ts +72 -0
- package/src/owlly/utils/cube-texture-cache.ts +155 -0
- package/src/owlly/utils/device-utils.ts +53 -0
- package/src/owlly/utils/environment-utils.ts +81 -0
- package/src/owlly/utils/event-hub.ts +120 -0
- package/src/owlly/utils/events.ts +266 -0
- package/src/owlly/utils/geometry-utils.ts +749 -0
- package/src/owlly/utils/helper.ts +33 -0
- package/src/owlly/utils/index.ts +17 -0
- package/src/owlly/utils/lru-cache.ts +126 -0
- package/src/owlly/utils/map-utils.ts +55 -0
- package/src/owlly/utils/number-utils.ts +75 -0
- package/src/owlly/utils/panorama-model-util.ts +255 -0
- package/src/owlly/utils/path-utils.ts +837 -0
- package/src/owlly/utils/svgutils.ts +732 -0
- package/src/owlly/utils/texture-cache.ts +132 -0
- package/src/owlly/utils/tile-util.ts +563 -0
- package/src/owlly/utils/time-profiler.ts +57 -0
- package/src/owlly/view/__test__/perspective-view.spec.ts +23 -0
- package/src/owlly/view/camera-view.ts +114 -0
- package/src/owlly/view/index.ts +5 -0
- package/src/owlly/view/orthographic-view.ts +124 -0
- package/src/owlly/view/perspective-view.ts +125 -0
- package/src/owlly/view/svg-map-view.ts +187 -0
- package/src/owlly/view/view.ts +409 -0
- package/src/public/js/jsmpeg.min.js +3129 -0
- package/src/web/index.html +52 -0
- package/src/web/main.centroid.ts +85 -0
- package/src/web/main.hyma.meshline2d.ts +84 -0
- package/src/web/main.jyfang.sample.ts +139 -0
- package/src/web/main.rpeng.extrude.ts +194 -0
- package/src/web/main.rpeng.mes.plane.ts +161 -0
- package/src/web/main.rpeng.sample.ts +345 -0
- package/src/web/main.rpeng.vr.ts +159 -0
- package/src/web/main.sample.ts +59 -0
- package/src/web/quattree.hyma.ts +163 -0
- package/src/web/sensor-vr-plugin.ts +201 -0
- package/src/web/testPixel.png +0 -0
|
@@ -0,0 +1,1532 @@
|
|
|
1
|
+
/* eslint-disable max-len, no-continue, @typescript-eslint/no-explicit-any, no-underscore-dangle, func-names, @typescript-eslint/no-this-alias, no-console */
|
|
2
|
+
import { Externals, NS_THREE } from '../owlly/stage/externals';
|
|
3
|
+
|
|
4
|
+
class TransformControlsGizmo extends NS_THREE.Object3D {
|
|
5
|
+
isTransformControlsGizmo = true;
|
|
6
|
+
|
|
7
|
+
// common members -----
|
|
8
|
+
|
|
9
|
+
camera: NS_THREE.Camera;
|
|
10
|
+
|
|
11
|
+
object: NS_THREE.Object3D;
|
|
12
|
+
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
|
|
15
|
+
axis: string | null;
|
|
16
|
+
|
|
17
|
+
mode: string;
|
|
18
|
+
|
|
19
|
+
translationSnap: number | null;
|
|
20
|
+
|
|
21
|
+
rotationSnap: number | null;
|
|
22
|
+
|
|
23
|
+
scaleSnap: number | null;
|
|
24
|
+
|
|
25
|
+
space: string;
|
|
26
|
+
|
|
27
|
+
size: number;
|
|
28
|
+
|
|
29
|
+
showX: boolean;
|
|
30
|
+
|
|
31
|
+
showY: boolean;
|
|
32
|
+
|
|
33
|
+
showZ: boolean;
|
|
34
|
+
|
|
35
|
+
worldPosition: NS_THREE.Vector3;
|
|
36
|
+
|
|
37
|
+
worldPositionStart: NS_THREE.Vector3;
|
|
38
|
+
|
|
39
|
+
worldQuaternion: NS_THREE.Quaternion;
|
|
40
|
+
|
|
41
|
+
worldQuaternionStart: NS_THREE.Quaternion;
|
|
42
|
+
|
|
43
|
+
cameraPosition: NS_THREE.Vector3;
|
|
44
|
+
|
|
45
|
+
cameraQuaternion: NS_THREE.Quaternion;
|
|
46
|
+
|
|
47
|
+
pointStart: NS_THREE.Vector3;
|
|
48
|
+
|
|
49
|
+
pointEnd: NS_THREE.Vector3;
|
|
50
|
+
|
|
51
|
+
rotationAxis: NS_THREE.Vector3;
|
|
52
|
+
|
|
53
|
+
rotationAngle: number;
|
|
54
|
+
|
|
55
|
+
eye: NS_THREE.Vector3;
|
|
56
|
+
|
|
57
|
+
// -----
|
|
58
|
+
|
|
59
|
+
helper: any;
|
|
60
|
+
|
|
61
|
+
picker: any;
|
|
62
|
+
|
|
63
|
+
dragging: any;
|
|
64
|
+
|
|
65
|
+
gizmo: any;
|
|
66
|
+
|
|
67
|
+
constructor() {
|
|
68
|
+
super();
|
|
69
|
+
this.type = 'TransformControlsGizmo';
|
|
70
|
+
|
|
71
|
+
const { THREE } = Externals.getInstance();
|
|
72
|
+
|
|
73
|
+
// shared materials
|
|
74
|
+
|
|
75
|
+
const gizmoMaterial = new THREE.MeshBasicMaterial({
|
|
76
|
+
depthTest: false,
|
|
77
|
+
depthWrite: false,
|
|
78
|
+
transparent: true,
|
|
79
|
+
side: THREE.DoubleSide,
|
|
80
|
+
fog: false,
|
|
81
|
+
toneMapped: false,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const gizmoLineMaterial = new THREE.LineBasicMaterial({
|
|
85
|
+
depthTest: false,
|
|
86
|
+
depthWrite: false,
|
|
87
|
+
transparent: true,
|
|
88
|
+
linewidth: 1,
|
|
89
|
+
fog: false,
|
|
90
|
+
toneMapped: false,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Make unique material for each axis/color
|
|
94
|
+
|
|
95
|
+
const matInvisible = gizmoMaterial.clone();
|
|
96
|
+
matInvisible.opacity = 0.15;
|
|
97
|
+
|
|
98
|
+
const matHelper = gizmoMaterial.clone();
|
|
99
|
+
matHelper.opacity = 0.33;
|
|
100
|
+
|
|
101
|
+
const matRed = gizmoMaterial.clone();
|
|
102
|
+
matRed.color.set(0xff0000);
|
|
103
|
+
|
|
104
|
+
const matGreen = gizmoMaterial.clone();
|
|
105
|
+
matGreen.color.set(0x00ff00);
|
|
106
|
+
|
|
107
|
+
const matBlue = gizmoMaterial.clone();
|
|
108
|
+
matBlue.color.set(0x0000ff);
|
|
109
|
+
|
|
110
|
+
const matWhiteTransparent = gizmoMaterial.clone();
|
|
111
|
+
matWhiteTransparent.opacity = 0.25;
|
|
112
|
+
|
|
113
|
+
const matYellowTransparent = matWhiteTransparent.clone();
|
|
114
|
+
matYellowTransparent.color.set(0xffff00);
|
|
115
|
+
|
|
116
|
+
const matCyanTransparent = matWhiteTransparent.clone();
|
|
117
|
+
matCyanTransparent.color.set(0x00ffff);
|
|
118
|
+
|
|
119
|
+
const matMagentaTransparent = matWhiteTransparent.clone();
|
|
120
|
+
matMagentaTransparent.color.set(0xff00ff);
|
|
121
|
+
|
|
122
|
+
const matYellow = gizmoMaterial.clone();
|
|
123
|
+
matYellow.color.set(0xffff00);
|
|
124
|
+
|
|
125
|
+
const matLineRed = gizmoLineMaterial.clone();
|
|
126
|
+
(matLineRed.color as NS_THREE.Color).set(0xff0000);
|
|
127
|
+
|
|
128
|
+
const matLineGreen = gizmoLineMaterial.clone();
|
|
129
|
+
(matLineGreen.color as NS_THREE.Color).set(0x00ff00);
|
|
130
|
+
|
|
131
|
+
const matLineBlue = gizmoLineMaterial.clone();
|
|
132
|
+
(matLineBlue.color as NS_THREE.Color).set(0x0000ff);
|
|
133
|
+
|
|
134
|
+
const matLineCyan = gizmoLineMaterial.clone();
|
|
135
|
+
(matLineCyan.color as NS_THREE.Color).set(0x00ffff);
|
|
136
|
+
|
|
137
|
+
const matLineMagenta = gizmoLineMaterial.clone();
|
|
138
|
+
(matLineMagenta.color as NS_THREE.Color).set(0xff00ff);
|
|
139
|
+
|
|
140
|
+
const matLineYellow = gizmoLineMaterial.clone();
|
|
141
|
+
(matLineYellow.color as NS_THREE.Color).set(0xffff00);
|
|
142
|
+
|
|
143
|
+
const matLineGray = gizmoLineMaterial.clone();
|
|
144
|
+
(matLineGray.color as NS_THREE.Color).set(0x787878);
|
|
145
|
+
|
|
146
|
+
const matLineYellowTransparent = matLineYellow.clone();
|
|
147
|
+
matLineYellowTransparent.opacity = 0.25;
|
|
148
|
+
|
|
149
|
+
// reusable geometry
|
|
150
|
+
|
|
151
|
+
const arrowGeometry = new THREE.CylinderGeometry(0, 0.05, 0.2, 12, 1, false);
|
|
152
|
+
|
|
153
|
+
const scaleHandleGeometry = new THREE.BoxGeometry(0.125, 0.125, 0.125);
|
|
154
|
+
|
|
155
|
+
const lineGeometry = new THREE.BufferGeometry();
|
|
156
|
+
lineGeometry.setAttribute('position', new THREE.Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3));
|
|
157
|
+
|
|
158
|
+
const CircleGeometry = function (radius: number, arc: number): NS_THREE.BufferGeometry {
|
|
159
|
+
const geometry = new THREE.BufferGeometry();
|
|
160
|
+
const vertices = [];
|
|
161
|
+
|
|
162
|
+
for (let i = 0; i <= 64 * arc; ++i) {
|
|
163
|
+
vertices.push(0, Math.cos(i / 32 * Math.PI) * radius, Math.sin(i / 32 * Math.PI) * radius);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3));
|
|
167
|
+
|
|
168
|
+
return geometry;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// Special geometry for transform helper. If scaled with position vector it spans from [0,0,0] to position
|
|
172
|
+
|
|
173
|
+
const TranslateHelperGeometry = function (): NS_THREE.BufferGeometry {
|
|
174
|
+
const geometry = new THREE.BufferGeometry();
|
|
175
|
+
|
|
176
|
+
geometry.setAttribute('position', new THREE.Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3));
|
|
177
|
+
|
|
178
|
+
return geometry;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// Gizmo definitions - custom hierarchy definitions for setupGizmo() function
|
|
182
|
+
|
|
183
|
+
const gizmoTranslate = {
|
|
184
|
+
X: [
|
|
185
|
+
[new THREE.Mesh(arrowGeometry, matRed), [1, 0, 0], [0, 0, -Math.PI / 2], null, 'fwd'],
|
|
186
|
+
[new THREE.Mesh(arrowGeometry, matRed), [1, 0, 0], [0, 0, Math.PI / 2], null, 'bwd'],
|
|
187
|
+
[new THREE.Line(lineGeometry, matLineRed)],
|
|
188
|
+
],
|
|
189
|
+
Y: [
|
|
190
|
+
[new THREE.Mesh(arrowGeometry, matGreen), [0, 1, 0], null, null, 'fwd'],
|
|
191
|
+
[new THREE.Mesh(arrowGeometry, matGreen), [0, 1, 0], [Math.PI, 0, 0], null, 'bwd'],
|
|
192
|
+
[new THREE.Line(lineGeometry, matLineGreen), null, [0, 0, Math.PI / 2]],
|
|
193
|
+
],
|
|
194
|
+
Z: [
|
|
195
|
+
[new THREE.Mesh(arrowGeometry, matBlue), [0, 0, 1], [Math.PI / 2, 0, 0], null, 'fwd'],
|
|
196
|
+
[new THREE.Mesh(arrowGeometry, matBlue), [0, 0, 1], [-Math.PI / 2, 0, 0], null, 'bwd'],
|
|
197
|
+
[new THREE.Line(lineGeometry, matLineBlue), null, [0, -Math.PI / 2, 0]],
|
|
198
|
+
],
|
|
199
|
+
XYZ: [
|
|
200
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.1, 0), matWhiteTransparent.clone()), [0, 0, 0], [0, 0, 0]],
|
|
201
|
+
],
|
|
202
|
+
XY: [
|
|
203
|
+
[new THREE.Mesh(new THREE.PlaneGeometry(0.295, 0.295), matYellowTransparent.clone()), [0.15, 0.15, 0]],
|
|
204
|
+
[new THREE.Line(lineGeometry, matLineYellow), [0.18, 0.3, 0], null, [0.125, 1, 1]],
|
|
205
|
+
[new THREE.Line(lineGeometry, matLineYellow), [0.3, 0.18, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]],
|
|
206
|
+
],
|
|
207
|
+
YZ: [
|
|
208
|
+
[new THREE.Mesh(new THREE.PlaneGeometry(0.295, 0.295), matCyanTransparent.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]],
|
|
209
|
+
[new THREE.Line(lineGeometry, matLineCyan), [0, 0.18, 0.3], [0, 0, Math.PI / 2], [0.125, 1, 1]],
|
|
210
|
+
[new THREE.Line(lineGeometry, matLineCyan), [0, 0.3, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]],
|
|
211
|
+
],
|
|
212
|
+
XZ: [
|
|
213
|
+
[new THREE.Mesh(new THREE.PlaneGeometry(0.295, 0.295), matMagentaTransparent.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]],
|
|
214
|
+
[new THREE.Line(lineGeometry, matLineMagenta), [0.18, 0, 0.3], null, [0.125, 1, 1]],
|
|
215
|
+
[new THREE.Line(lineGeometry, matLineMagenta), [0.3, 0, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]],
|
|
216
|
+
],
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const pickerTranslate = {
|
|
220
|
+
X: [
|
|
221
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0.6, 0, 0], [0, 0, -Math.PI / 2]],
|
|
222
|
+
],
|
|
223
|
+
Y: [
|
|
224
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0, 0.6, 0]],
|
|
225
|
+
],
|
|
226
|
+
Z: [
|
|
227
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0, 0, 0.6], [Math.PI / 2, 0, 0]],
|
|
228
|
+
],
|
|
229
|
+
XYZ: [
|
|
230
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.2, 0), matInvisible)],
|
|
231
|
+
],
|
|
232
|
+
XY: [
|
|
233
|
+
[new THREE.Mesh(new THREE.PlaneGeometry(0.4, 0.4), matInvisible), [0.2, 0.2, 0]],
|
|
234
|
+
],
|
|
235
|
+
YZ: [
|
|
236
|
+
[new THREE.Mesh(new THREE.PlaneGeometry(0.4, 0.4), matInvisible), [0, 0.2, 0.2], [0, Math.PI / 2, 0]],
|
|
237
|
+
],
|
|
238
|
+
XZ: [
|
|
239
|
+
[new THREE.Mesh(new THREE.PlaneGeometry(0.4, 0.4), matInvisible), [0.2, 0, 0.2], [-Math.PI / 2, 0, 0]],
|
|
240
|
+
],
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const helperTranslate = {
|
|
244
|
+
START: [
|
|
245
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.01, 2), matHelper), null, null, null, 'helper'],
|
|
246
|
+
],
|
|
247
|
+
END: [
|
|
248
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.01, 2), matHelper), null, null, null, 'helper'],
|
|
249
|
+
],
|
|
250
|
+
DELTA: [
|
|
251
|
+
[new THREE.Line(TranslateHelperGeometry(), matHelper), null, null, null, 'helper'],
|
|
252
|
+
],
|
|
253
|
+
X: [
|
|
254
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], 'helper'],
|
|
255
|
+
],
|
|
256
|
+
Y: [
|
|
257
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], 'helper'],
|
|
258
|
+
],
|
|
259
|
+
Z: [
|
|
260
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], 'helper'],
|
|
261
|
+
],
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
const gizmoRotate = {
|
|
265
|
+
X: [
|
|
266
|
+
[new THREE.Line(CircleGeometry(1, 0.5), matLineRed)],
|
|
267
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.04, 0), matRed), [0, 0, 0.99], null, [1, 3, 1]],
|
|
268
|
+
],
|
|
269
|
+
Y: [
|
|
270
|
+
[new THREE.Line(CircleGeometry(1, 0.5), matLineGreen), null, [0, 0, -Math.PI / 2]],
|
|
271
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.04, 0), matGreen), [0, 0, 0.99], null, [3, 1, 1]],
|
|
272
|
+
],
|
|
273
|
+
Z: [
|
|
274
|
+
[new THREE.Line(CircleGeometry(1, 0.5), matLineBlue), null, [0, Math.PI / 2, 0]],
|
|
275
|
+
[new THREE.Mesh(new THREE.OctahedronGeometry(0.04, 0), matBlue), [0.99, 0, 0], null, [1, 3, 1]],
|
|
276
|
+
],
|
|
277
|
+
E: [
|
|
278
|
+
[new THREE.Line(CircleGeometry(1.25, 1), matLineYellowTransparent), null, [0, Math.PI / 2, 0]],
|
|
279
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent), [1.17, 0, 0], [0, 0, -Math.PI / 2], [1, 1, 0.001]],
|
|
280
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent), [-1.17, 0, 0], [0, 0, Math.PI / 2], [1, 1, 0.001]],
|
|
281
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent), [0, -1.17, 0], [Math.PI, 0, 0], [1, 1, 0.001]],
|
|
282
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent), [0, 1.17, 0], [0, 0, 0], [1, 1, 0.001]],
|
|
283
|
+
],
|
|
284
|
+
XYZE: [
|
|
285
|
+
[new THREE.Line(CircleGeometry(1, 1), matLineGray), null, [0, Math.PI / 2, 0]],
|
|
286
|
+
],
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
const helperRotate = {
|
|
290
|
+
AXIS: [
|
|
291
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], 'helper'],
|
|
292
|
+
],
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const pickerRotate = {
|
|
296
|
+
X: [
|
|
297
|
+
[new THREE.Mesh(new THREE.TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]],
|
|
298
|
+
],
|
|
299
|
+
Y: [
|
|
300
|
+
[new THREE.Mesh(new THREE.TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [Math.PI / 2, 0, 0]],
|
|
301
|
+
],
|
|
302
|
+
Z: [
|
|
303
|
+
[new THREE.Mesh(new THREE.TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [0, 0, -Math.PI / 2]],
|
|
304
|
+
],
|
|
305
|
+
E: [
|
|
306
|
+
[new THREE.Mesh(new THREE.TorusGeometry(1.25, 0.1, 2, 24), matInvisible)],
|
|
307
|
+
],
|
|
308
|
+
XYZE: [
|
|
309
|
+
[new THREE.Mesh(new THREE.SphereGeometry(0.7, 10, 8), matInvisible)],
|
|
310
|
+
],
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
const gizmoScale = {
|
|
314
|
+
X: [
|
|
315
|
+
[new THREE.Mesh(scaleHandleGeometry, matRed), [0.8, 0, 0], [0, 0, -Math.PI / 2]],
|
|
316
|
+
[new THREE.Line(lineGeometry, matLineRed), null, null, [0.8, 1, 1]],
|
|
317
|
+
],
|
|
318
|
+
Y: [
|
|
319
|
+
[new THREE.Mesh(scaleHandleGeometry, matGreen), [0, 0.8, 0]],
|
|
320
|
+
[new THREE.Line(lineGeometry, matLineGreen), null, [0, 0, Math.PI / 2], [0.8, 1, 1]],
|
|
321
|
+
],
|
|
322
|
+
Z: [
|
|
323
|
+
[new THREE.Mesh(scaleHandleGeometry, matBlue), [0, 0, 0.8], [Math.PI / 2, 0, 0]],
|
|
324
|
+
[new THREE.Line(lineGeometry, matLineBlue), null, [0, -Math.PI / 2, 0], [0.8, 1, 1]],
|
|
325
|
+
],
|
|
326
|
+
XY: [
|
|
327
|
+
[new THREE.Mesh(scaleHandleGeometry, matYellowTransparent), [0.85, 0.85, 0], null, [2, 2, 0.2]],
|
|
328
|
+
[new THREE.Line(lineGeometry, matLineYellow), [0.855, 0.98, 0], null, [0.125, 1, 1]],
|
|
329
|
+
[new THREE.Line(lineGeometry, matLineYellow), [0.98, 0.855, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]],
|
|
330
|
+
],
|
|
331
|
+
YZ: [
|
|
332
|
+
[new THREE.Mesh(scaleHandleGeometry, matCyanTransparent), [0, 0.85, 0.85], null, [0.2, 2, 2]],
|
|
333
|
+
[new THREE.Line(lineGeometry, matLineCyan), [0, 0.855, 0.98], [0, 0, Math.PI / 2], [0.125, 1, 1]],
|
|
334
|
+
[new THREE.Line(lineGeometry, matLineCyan), [0, 0.98, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]],
|
|
335
|
+
],
|
|
336
|
+
XZ: [
|
|
337
|
+
[new THREE.Mesh(scaleHandleGeometry, matMagentaTransparent), [0.85, 0, 0.85], null, [2, 0.2, 2]],
|
|
338
|
+
[new THREE.Line(lineGeometry, matLineMagenta), [0.855, 0, 0.98], null, [0.125, 1, 1]],
|
|
339
|
+
[new THREE.Line(lineGeometry, matLineMagenta), [0.98, 0, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]],
|
|
340
|
+
],
|
|
341
|
+
XYZX: [
|
|
342
|
+
[new THREE.Mesh(new THREE.BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [1.1, 0, 0]],
|
|
343
|
+
],
|
|
344
|
+
XYZY: [
|
|
345
|
+
[new THREE.Mesh(new THREE.BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [0, 1.1, 0]],
|
|
346
|
+
],
|
|
347
|
+
XYZZ: [
|
|
348
|
+
[new THREE.Mesh(new THREE.BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [0, 0, 1.1]],
|
|
349
|
+
],
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
const pickerScale = {
|
|
353
|
+
X: [
|
|
354
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
355
|
+
],
|
|
356
|
+
Y: [
|
|
357
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0, 0.5, 0]],
|
|
358
|
+
],
|
|
359
|
+
Z: [
|
|
360
|
+
[new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
|
|
361
|
+
],
|
|
362
|
+
XY: [
|
|
363
|
+
[new THREE.Mesh(scaleHandleGeometry, matInvisible), [0.85, 0.85, 0], null, [3, 3, 0.2]],
|
|
364
|
+
],
|
|
365
|
+
YZ: [
|
|
366
|
+
[new THREE.Mesh(scaleHandleGeometry, matInvisible), [0, 0.85, 0.85], null, [0.2, 3, 3]],
|
|
367
|
+
],
|
|
368
|
+
XZ: [
|
|
369
|
+
[new THREE.Mesh(scaleHandleGeometry, matInvisible), [0.85, 0, 0.85], null, [3, 0.2, 3]],
|
|
370
|
+
],
|
|
371
|
+
XYZX: [
|
|
372
|
+
[new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.2, 0.2), matInvisible), [1.1, 0, 0]],
|
|
373
|
+
],
|
|
374
|
+
XYZY: [
|
|
375
|
+
[new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.2, 0.2), matInvisible), [0, 1.1, 0]],
|
|
376
|
+
],
|
|
377
|
+
XYZZ: [
|
|
378
|
+
[new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.2, 0.2), matInvisible), [0, 0, 1.1]],
|
|
379
|
+
],
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
const helperScale = {
|
|
383
|
+
X: [
|
|
384
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], 'helper'],
|
|
385
|
+
],
|
|
386
|
+
Y: [
|
|
387
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], 'helper'],
|
|
388
|
+
],
|
|
389
|
+
Z: [
|
|
390
|
+
[new THREE.Line(lineGeometry, matHelper.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], 'helper'],
|
|
391
|
+
],
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
// Creates an Object3D with gizmos described in custom hierarchy definition.
|
|
395
|
+
|
|
396
|
+
const setupGizmo = function (gizmoMap: any): NS_THREE.Object3D {
|
|
397
|
+
const gizmo = new THREE.Object3D();
|
|
398
|
+
|
|
399
|
+
/* eslint-disable guard-for-in, no-restricted-syntax */
|
|
400
|
+
for (const name in gizmoMap) {
|
|
401
|
+
for (let i = gizmoMap[name].length; i--;) {
|
|
402
|
+
const object = gizmoMap[name][i][0].clone();
|
|
403
|
+
const position = gizmoMap[name][i][1];
|
|
404
|
+
const rotation = gizmoMap[name][i][2];
|
|
405
|
+
const scale = gizmoMap[name][i][3];
|
|
406
|
+
const tag = gizmoMap[name][i][4];
|
|
407
|
+
|
|
408
|
+
// name and tag properties are essential for picking and updating logic.
|
|
409
|
+
object.name = name;
|
|
410
|
+
object.tag = tag;
|
|
411
|
+
|
|
412
|
+
if (position) {
|
|
413
|
+
object.position.set(position[0], position[1], position[2]);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if (rotation) {
|
|
417
|
+
object.rotation.set(rotation[0], rotation[1], rotation[2]);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
if (scale) {
|
|
421
|
+
object.scale.set(scale[0], scale[1], scale[2]);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
object.updateMatrix();
|
|
425
|
+
|
|
426
|
+
const tempGeometry = object.geometry.clone();
|
|
427
|
+
tempGeometry.applyMatrix4(object.matrix);
|
|
428
|
+
object.geometry = tempGeometry;
|
|
429
|
+
object.renderOrder = Infinity;
|
|
430
|
+
|
|
431
|
+
object.position.set(0, 0, 0);
|
|
432
|
+
object.rotation.set(0, 0, 0);
|
|
433
|
+
object.scale.set(1, 1, 1);
|
|
434
|
+
|
|
435
|
+
gizmo.add(object);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
return gizmo;
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
// Reusable utility variables
|
|
443
|
+
|
|
444
|
+
const tempVector = new THREE.Vector3(0, 0, 0);
|
|
445
|
+
const tempEuler = new THREE.Euler();
|
|
446
|
+
const alignVector = new THREE.Vector3(0, 1, 0);
|
|
447
|
+
const zeroVector = new THREE.Vector3(0, 0, 0);
|
|
448
|
+
const lookAtMatrix = new THREE.Matrix4();
|
|
449
|
+
const tempQuaternion = new THREE.Quaternion();
|
|
450
|
+
const tempQuaternion2 = new THREE.Quaternion();
|
|
451
|
+
const identityQuaternion = new THREE.Quaternion();
|
|
452
|
+
|
|
453
|
+
const unitX = new THREE.Vector3(1, 0, 0);
|
|
454
|
+
const unitY = new THREE.Vector3(0, 1, 0);
|
|
455
|
+
const unitZ = new THREE.Vector3(0, 0, 1);
|
|
456
|
+
|
|
457
|
+
// Gizmo creation
|
|
458
|
+
|
|
459
|
+
this.gizmo = {};
|
|
460
|
+
this.picker = {};
|
|
461
|
+
this.helper = {};
|
|
462
|
+
|
|
463
|
+
this.add(this.gizmo.translate = setupGizmo(gizmoTranslate));
|
|
464
|
+
this.add(this.gizmo.rotate = setupGizmo(gizmoRotate));
|
|
465
|
+
this.add(this.gizmo.scale = setupGizmo(gizmoScale));
|
|
466
|
+
this.add(this.picker.translate = setupGizmo(pickerTranslate));
|
|
467
|
+
this.add(this.picker.rotate = setupGizmo(pickerRotate));
|
|
468
|
+
this.add(this.picker.scale = setupGizmo(pickerScale));
|
|
469
|
+
this.add(this.helper.translate = setupGizmo(helperTranslate));
|
|
470
|
+
this.add(this.helper.rotate = setupGizmo(helperRotate));
|
|
471
|
+
this.add(this.helper.scale = setupGizmo(helperScale));
|
|
472
|
+
|
|
473
|
+
// Pickers should be hidden always
|
|
474
|
+
|
|
475
|
+
this.picker.translate.visible = false;
|
|
476
|
+
this.picker.rotate.visible = false;
|
|
477
|
+
this.picker.scale.visible = false;
|
|
478
|
+
|
|
479
|
+
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
480
|
+
|
|
481
|
+
this.updateMatrixWorld = function (): void {
|
|
482
|
+
let { space } = this;
|
|
483
|
+
|
|
484
|
+
if (this.mode === 'scale') space = 'local'; // scale always oriented to local rotation
|
|
485
|
+
|
|
486
|
+
const quaternion = space === 'local' ? this.worldQuaternion : identityQuaternion;
|
|
487
|
+
|
|
488
|
+
// Show only gizmos for current transform mode
|
|
489
|
+
|
|
490
|
+
this.gizmo.translate.visible = this.mode === 'translate';
|
|
491
|
+
this.gizmo.rotate.visible = this.mode === 'rotate';
|
|
492
|
+
this.gizmo.scale.visible = this.mode === 'scale';
|
|
493
|
+
|
|
494
|
+
this.helper.translate.visible = this.mode === 'translate';
|
|
495
|
+
this.helper.rotate.visible = this.mode === 'rotate';
|
|
496
|
+
this.helper.scale.visible = this.mode === 'scale';
|
|
497
|
+
|
|
498
|
+
let handles: any[] = [];
|
|
499
|
+
handles = handles.concat(this.picker[this.mode].children);
|
|
500
|
+
handles = handles.concat(this.gizmo[this.mode].children);
|
|
501
|
+
handles = handles.concat(this.helper[this.mode].children);
|
|
502
|
+
|
|
503
|
+
for (let i = 0; i < handles.length; i++) {
|
|
504
|
+
const handle = handles[i];
|
|
505
|
+
|
|
506
|
+
// hide aligned to camera
|
|
507
|
+
|
|
508
|
+
handle.visible = true;
|
|
509
|
+
handle.rotation.set(0, 0, 0);
|
|
510
|
+
handle.position.copy(this.worldPosition);
|
|
511
|
+
|
|
512
|
+
let factor;
|
|
513
|
+
|
|
514
|
+
if ((this.camera as NS_THREE.OrthographicCamera).isOrthographicCamera) {
|
|
515
|
+
const camera = (this.camera as NS_THREE.OrthographicCamera);
|
|
516
|
+
factor = (camera.top - camera.bottom) / camera.zoom;
|
|
517
|
+
} else {
|
|
518
|
+
const camera = (this.camera as NS_THREE.PerspectiveCamera);
|
|
519
|
+
factor = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * camera.fov / 360) / camera.zoom, 7);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
handle.scale.set(1, 1, 1).multiplyScalar(factor * this.size / 7);
|
|
523
|
+
|
|
524
|
+
// TODO: simplify helpers and consider decoupling from gizmo
|
|
525
|
+
|
|
526
|
+
if (handle.tag === 'helper') {
|
|
527
|
+
handle.visible = false;
|
|
528
|
+
|
|
529
|
+
if (handle.name === 'AXIS') {
|
|
530
|
+
handle.position.copy(this.worldPositionStart);
|
|
531
|
+
handle.visible = !!this.axis;
|
|
532
|
+
|
|
533
|
+
if (this.axis === 'X') {
|
|
534
|
+
tempQuaternion.setFromEuler(tempEuler.set(0, 0, 0));
|
|
535
|
+
handle.quaternion.copy(quaternion).multiply(tempQuaternion);
|
|
536
|
+
|
|
537
|
+
if (Math.abs(alignVector.copy(unitX).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {
|
|
538
|
+
handle.visible = false;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
if (this.axis === 'Y') {
|
|
543
|
+
tempQuaternion.setFromEuler(tempEuler.set(0, 0, Math.PI / 2));
|
|
544
|
+
handle.quaternion.copy(quaternion).multiply(tempQuaternion);
|
|
545
|
+
|
|
546
|
+
if (Math.abs(alignVector.copy(unitY).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {
|
|
547
|
+
handle.visible = false;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
if (this.axis === 'Z') {
|
|
552
|
+
tempQuaternion.setFromEuler(tempEuler.set(0, Math.PI / 2, 0));
|
|
553
|
+
handle.quaternion.copy(quaternion).multiply(tempQuaternion);
|
|
554
|
+
|
|
555
|
+
if (Math.abs(alignVector.copy(unitZ).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {
|
|
556
|
+
handle.visible = false;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
if (this.axis === 'XYZE') {
|
|
561
|
+
tempQuaternion.setFromEuler(tempEuler.set(0, Math.PI / 2, 0));
|
|
562
|
+
alignVector.copy(this.rotationAxis);
|
|
563
|
+
handle.quaternion.setFromRotationMatrix(lookAtMatrix.lookAt(zeroVector, alignVector, unitY));
|
|
564
|
+
handle.quaternion.multiply(tempQuaternion);
|
|
565
|
+
handle.visible = this.dragging;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if (this.axis === 'E') {
|
|
569
|
+
handle.visible = false;
|
|
570
|
+
}
|
|
571
|
+
} else if (handle.name === 'START') {
|
|
572
|
+
handle.position.copy(this.worldPositionStart);
|
|
573
|
+
handle.visible = this.dragging;
|
|
574
|
+
} else if (handle.name === 'END') {
|
|
575
|
+
handle.position.copy(this.worldPosition);
|
|
576
|
+
handle.visible = this.dragging;
|
|
577
|
+
} else if (handle.name === 'DELTA') {
|
|
578
|
+
handle.position.copy(this.worldPositionStart);
|
|
579
|
+
handle.quaternion.copy(this.worldQuaternionStart);
|
|
580
|
+
tempVector.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1);
|
|
581
|
+
tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert());
|
|
582
|
+
handle.scale.copy(tempVector);
|
|
583
|
+
handle.visible = this.dragging;
|
|
584
|
+
} else {
|
|
585
|
+
handle.quaternion.copy(quaternion);
|
|
586
|
+
|
|
587
|
+
if (this.dragging) {
|
|
588
|
+
handle.position.copy(this.worldPositionStart);
|
|
589
|
+
} else {
|
|
590
|
+
handle.position.copy(this.worldPosition);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
if (this.axis) {
|
|
594
|
+
handle.visible = this.axis.search(handle.name) !== -1;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// If updating helper, skip rest of the loop
|
|
599
|
+
continue;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// Align handles to current local or world rotation
|
|
603
|
+
|
|
604
|
+
handle.quaternion.copy(quaternion);
|
|
605
|
+
|
|
606
|
+
if (this.mode === 'translate' || this.mode === 'scale') {
|
|
607
|
+
// Hide translate and scale axis facing the camera
|
|
608
|
+
|
|
609
|
+
const AXIS_HIDE_TRESHOLD = 0.99;
|
|
610
|
+
const PLANE_HIDE_TRESHOLD = 0.2;
|
|
611
|
+
const AXIS_FLIP_TRESHOLD = 0.0;
|
|
612
|
+
|
|
613
|
+
if (handle.name === 'X' || handle.name === 'XYZX') {
|
|
614
|
+
if (Math.abs(alignVector.copy(unitX).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {
|
|
615
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
616
|
+
handle.visible = false;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
if (handle.name === 'Y' || handle.name === 'XYZY') {
|
|
621
|
+
if (Math.abs(alignVector.copy(unitY).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {
|
|
622
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
623
|
+
handle.visible = false;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
if (handle.name === 'Z' || handle.name === 'XYZZ') {
|
|
628
|
+
if (Math.abs(alignVector.copy(unitZ).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {
|
|
629
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
630
|
+
handle.visible = false;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
if (handle.name === 'XY') {
|
|
635
|
+
if (Math.abs(alignVector.copy(unitZ).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {
|
|
636
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
637
|
+
handle.visible = false;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
if (handle.name === 'YZ') {
|
|
642
|
+
if (Math.abs(alignVector.copy(unitX).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {
|
|
643
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
644
|
+
handle.visible = false;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
if (handle.name === 'XZ') {
|
|
649
|
+
if (Math.abs(alignVector.copy(unitY).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {
|
|
650
|
+
handle.scale.set(1e-10, 1e-10, 1e-10);
|
|
651
|
+
handle.visible = false;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
// Flip translate and scale axis ocluded behind another axis
|
|
656
|
+
|
|
657
|
+
if (handle.name.search('X') !== -1) {
|
|
658
|
+
if (alignVector.copy(unitX).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {
|
|
659
|
+
if (handle.tag === 'fwd') {
|
|
660
|
+
handle.visible = false;
|
|
661
|
+
} else {
|
|
662
|
+
handle.scale.x *= -1;
|
|
663
|
+
}
|
|
664
|
+
} else if (handle.tag === 'bwd') {
|
|
665
|
+
handle.visible = false;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
if (handle.name.search('Y') !== -1) {
|
|
670
|
+
if (alignVector.copy(unitY).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {
|
|
671
|
+
if (handle.tag === 'fwd') {
|
|
672
|
+
handle.visible = false;
|
|
673
|
+
} else {
|
|
674
|
+
handle.scale.y *= -1;
|
|
675
|
+
}
|
|
676
|
+
} else if (handle.tag === 'bwd') {
|
|
677
|
+
handle.visible = false;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
if (handle.name.search('Z') !== -1) {
|
|
682
|
+
if (alignVector.copy(unitZ).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {
|
|
683
|
+
if (handle.tag === 'fwd') {
|
|
684
|
+
handle.visible = false;
|
|
685
|
+
} else {
|
|
686
|
+
handle.scale.z *= -1;
|
|
687
|
+
}
|
|
688
|
+
} else if (handle.tag === 'bwd') {
|
|
689
|
+
handle.visible = false;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
} else if (this.mode === 'rotate') {
|
|
693
|
+
// Align handles to current local or world rotation
|
|
694
|
+
|
|
695
|
+
tempQuaternion2.copy(quaternion);
|
|
696
|
+
alignVector.copy(this.eye).applyQuaternion(tempQuaternion.copy(quaternion).invert());
|
|
697
|
+
|
|
698
|
+
if (handle.name.search('E') !== -1) {
|
|
699
|
+
handle.quaternion.setFromRotationMatrix(lookAtMatrix.lookAt(this.eye, zeroVector, unitY));
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
if (handle.name === 'X') {
|
|
703
|
+
tempQuaternion.setFromAxisAngle(unitX, Math.atan2(-alignVector.y, alignVector.z));
|
|
704
|
+
tempQuaternion.multiplyQuaternions(tempQuaternion2, tempQuaternion);
|
|
705
|
+
handle.quaternion.copy(tempQuaternion);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
if (handle.name === 'Y') {
|
|
709
|
+
tempQuaternion.setFromAxisAngle(unitY, Math.atan2(alignVector.x, alignVector.z));
|
|
710
|
+
tempQuaternion.multiplyQuaternions(tempQuaternion2, tempQuaternion);
|
|
711
|
+
handle.quaternion.copy(tempQuaternion);
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
if (handle.name === 'Z') {
|
|
715
|
+
tempQuaternion.setFromAxisAngle(unitZ, Math.atan2(alignVector.y, alignVector.x));
|
|
716
|
+
tempQuaternion.multiplyQuaternions(tempQuaternion2, tempQuaternion);
|
|
717
|
+
handle.quaternion.copy(tempQuaternion);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
// Hide disabled axes
|
|
722
|
+
handle.visible = handle.visible && (handle.name.indexOf('X') === -1 || this.showX);
|
|
723
|
+
handle.visible = handle.visible && (handle.name.indexOf('Y') === -1 || this.showY);
|
|
724
|
+
handle.visible = handle.visible && (handle.name.indexOf('Z') === -1 || this.showZ);
|
|
725
|
+
handle.visible = handle.visible && (handle.name.indexOf('E') === -1 || (this.showX && this.showY && this.showZ));
|
|
726
|
+
|
|
727
|
+
// highlight selected axis
|
|
728
|
+
|
|
729
|
+
handle.material._opacity = handle.material._opacity || handle.material.opacity;
|
|
730
|
+
handle.material._color = handle.material._color || handle.material.color.clone();
|
|
731
|
+
|
|
732
|
+
handle.material.color.copy(handle.material._color);
|
|
733
|
+
handle.material.opacity = handle.material._opacity;
|
|
734
|
+
|
|
735
|
+
if (!this.enabled) {
|
|
736
|
+
handle.material.opacity *= 0.5;
|
|
737
|
+
handle.material.color.lerp(new THREE.Color(1, 1, 1), 0.5);
|
|
738
|
+
} else if (this.axis) {
|
|
739
|
+
if (handle.name === this.axis) {
|
|
740
|
+
handle.material.opacity = 1.0;
|
|
741
|
+
handle.material.color.lerp(new THREE.Color(1, 1, 1), 0.5);
|
|
742
|
+
} else if (this.axis.split('').some((a) => handle.name === a)) {
|
|
743
|
+
handle.material.opacity = 1.0;
|
|
744
|
+
handle.material.color.lerp(new THREE.Color(1, 1, 1), 0.5);
|
|
745
|
+
} else {
|
|
746
|
+
handle.material.opacity *= 0.25;
|
|
747
|
+
handle.material.color.lerp(new THREE.Color(1, 1, 1), 0.5);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
THREE.Object3D.prototype.updateMatrixWorld.call(this);
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
class TransformControlsPlane extends NS_THREE.Mesh {
|
|
758
|
+
isTransformControlsPlane = true;
|
|
759
|
+
|
|
760
|
+
// common members -----
|
|
761
|
+
|
|
762
|
+
camera: NS_THREE.Camera;
|
|
763
|
+
|
|
764
|
+
object: NS_THREE.Object3D;
|
|
765
|
+
|
|
766
|
+
enabled: boolean;
|
|
767
|
+
|
|
768
|
+
axis: string | null;
|
|
769
|
+
|
|
770
|
+
mode: string;
|
|
771
|
+
|
|
772
|
+
translationSnap: number | null;
|
|
773
|
+
|
|
774
|
+
rotationSnap: number | null;
|
|
775
|
+
|
|
776
|
+
scaleSnap: number | null;
|
|
777
|
+
|
|
778
|
+
space: string;
|
|
779
|
+
|
|
780
|
+
size: number;
|
|
781
|
+
|
|
782
|
+
showX: boolean;
|
|
783
|
+
|
|
784
|
+
showY: boolean;
|
|
785
|
+
|
|
786
|
+
showZ: boolean;
|
|
787
|
+
|
|
788
|
+
worldPosition: NS_THREE.Vector3;
|
|
789
|
+
|
|
790
|
+
worldPositionStart: NS_THREE.Vector3;
|
|
791
|
+
|
|
792
|
+
worldQuaternion: NS_THREE.Quaternion;
|
|
793
|
+
|
|
794
|
+
worldQuaternionStart: NS_THREE.Quaternion;
|
|
795
|
+
|
|
796
|
+
cameraPosition: NS_THREE.Vector3;
|
|
797
|
+
|
|
798
|
+
cameraQuaternion: NS_THREE.Quaternion;
|
|
799
|
+
|
|
800
|
+
pointStart: NS_THREE.Vector3;
|
|
801
|
+
|
|
802
|
+
pointEnd: NS_THREE.Vector3;
|
|
803
|
+
|
|
804
|
+
rotationAxis: NS_THREE.Vector3;
|
|
805
|
+
|
|
806
|
+
rotationAngle: number;
|
|
807
|
+
|
|
808
|
+
eye: NS_THREE.Vector3;
|
|
809
|
+
|
|
810
|
+
constructor() {
|
|
811
|
+
super(
|
|
812
|
+
new (Externals.getInstance().THREE).PlaneGeometry(100000, 100000, 2, 2),
|
|
813
|
+
new (Externals.getInstance().THREE).MeshBasicMaterial({
|
|
814
|
+
visible: false, wireframe: true, side: (Externals.getInstance().THREE).DoubleSide, transparent: true, opacity: 0.1, toneMapped: false,
|
|
815
|
+
}),
|
|
816
|
+
);
|
|
817
|
+
|
|
818
|
+
const { THREE } = Externals.getInstance();
|
|
819
|
+
|
|
820
|
+
const unitX = new THREE.Vector3(1, 0, 0);
|
|
821
|
+
const unitY = new THREE.Vector3(0, 1, 0);
|
|
822
|
+
const unitZ = new THREE.Vector3(0, 0, 1);
|
|
823
|
+
|
|
824
|
+
const tempVector = new THREE.Vector3();
|
|
825
|
+
const dirVector = new THREE.Vector3();
|
|
826
|
+
const alignVector = new THREE.Vector3();
|
|
827
|
+
const tempMatrix = new THREE.Matrix4();
|
|
828
|
+
const identityQuaternion = new THREE.Quaternion();
|
|
829
|
+
|
|
830
|
+
this.updateMatrixWorld = function (): void {
|
|
831
|
+
let { space } = this;
|
|
832
|
+
|
|
833
|
+
this.position.copy(this.worldPosition);
|
|
834
|
+
|
|
835
|
+
if (this.mode === 'scale') space = 'local'; // scale always oriented to local rotation
|
|
836
|
+
|
|
837
|
+
unitX.set(1, 0, 0).applyQuaternion(space === 'local' ? this.worldQuaternion : identityQuaternion);
|
|
838
|
+
unitY.set(0, 1, 0).applyQuaternion(space === 'local' ? this.worldQuaternion : identityQuaternion);
|
|
839
|
+
unitZ.set(0, 0, 1).applyQuaternion(space === 'local' ? this.worldQuaternion : identityQuaternion);
|
|
840
|
+
|
|
841
|
+
// Align the plane for current transform mode, axis and space.
|
|
842
|
+
|
|
843
|
+
alignVector.copy(unitY);
|
|
844
|
+
|
|
845
|
+
switch (this.mode) {
|
|
846
|
+
case 'translate':
|
|
847
|
+
case 'scale':
|
|
848
|
+
switch (this.axis) {
|
|
849
|
+
case 'X':
|
|
850
|
+
alignVector.copy(this.eye).cross(unitX);
|
|
851
|
+
dirVector.copy(unitX).cross(alignVector);
|
|
852
|
+
break;
|
|
853
|
+
case 'Y':
|
|
854
|
+
alignVector.copy(this.eye).cross(unitY);
|
|
855
|
+
dirVector.copy(unitY).cross(alignVector);
|
|
856
|
+
break;
|
|
857
|
+
case 'Z':
|
|
858
|
+
alignVector.copy(this.eye).cross(unitZ);
|
|
859
|
+
dirVector.copy(unitZ).cross(alignVector);
|
|
860
|
+
break;
|
|
861
|
+
case 'XY':
|
|
862
|
+
dirVector.copy(unitZ);
|
|
863
|
+
break;
|
|
864
|
+
case 'YZ':
|
|
865
|
+
dirVector.copy(unitX);
|
|
866
|
+
break;
|
|
867
|
+
case 'XZ':
|
|
868
|
+
alignVector.copy(unitZ);
|
|
869
|
+
dirVector.copy(unitY);
|
|
870
|
+
break;
|
|
871
|
+
case 'XYZ':
|
|
872
|
+
case 'E':
|
|
873
|
+
dirVector.set(0, 0, 0);
|
|
874
|
+
break;
|
|
875
|
+
default:
|
|
876
|
+
break;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
break;
|
|
880
|
+
case 'rotate':
|
|
881
|
+
default:
|
|
882
|
+
// special case for rotate
|
|
883
|
+
dirVector.set(0, 0, 0);
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
if (dirVector.length() === 0) {
|
|
887
|
+
// If in rotate mode, make the plane parallel to camera
|
|
888
|
+
this.quaternion.copy(this.cameraQuaternion);
|
|
889
|
+
} else {
|
|
890
|
+
tempMatrix.lookAt(tempVector.set(0, 0, 0), dirVector, alignVector);
|
|
891
|
+
|
|
892
|
+
this.quaternion.setFromRotationMatrix(tempMatrix);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
THREE.Object3D.prototype.updateMatrixWorld.call(this);
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
class TransformControls extends NS_THREE.Object3D {
|
|
901
|
+
camera: NS_THREE.Camera;
|
|
902
|
+
|
|
903
|
+
object: NS_THREE.Object3D | undefined;
|
|
904
|
+
|
|
905
|
+
enabled: boolean;
|
|
906
|
+
|
|
907
|
+
axis: string | null;
|
|
908
|
+
|
|
909
|
+
mode: string;
|
|
910
|
+
|
|
911
|
+
translationSnap: number | null;
|
|
912
|
+
|
|
913
|
+
rotationSnap: number | null;
|
|
914
|
+
|
|
915
|
+
scaleSnap: number | null;
|
|
916
|
+
|
|
917
|
+
space: string;
|
|
918
|
+
|
|
919
|
+
size: number;
|
|
920
|
+
|
|
921
|
+
showX: boolean;
|
|
922
|
+
|
|
923
|
+
showY: boolean;
|
|
924
|
+
|
|
925
|
+
showZ: boolean;
|
|
926
|
+
|
|
927
|
+
worldPosition: NS_THREE.Vector3;
|
|
928
|
+
|
|
929
|
+
worldPositionStart: NS_THREE.Vector3;
|
|
930
|
+
|
|
931
|
+
worldQuaternion: NS_THREE.Quaternion;
|
|
932
|
+
|
|
933
|
+
worldQuaternionStart: NS_THREE.Quaternion;
|
|
934
|
+
|
|
935
|
+
cameraPosition: NS_THREE.Vector3;
|
|
936
|
+
|
|
937
|
+
cameraQuaternion: NS_THREE.Quaternion;
|
|
938
|
+
|
|
939
|
+
pointStart: NS_THREE.Vector3;
|
|
940
|
+
|
|
941
|
+
pointEnd: NS_THREE.Vector3;
|
|
942
|
+
|
|
943
|
+
rotationAxis: NS_THREE.Vector3;
|
|
944
|
+
|
|
945
|
+
rotationAngle: number;
|
|
946
|
+
|
|
947
|
+
eye: NS_THREE.Vector3;
|
|
948
|
+
|
|
949
|
+
domElement: any;
|
|
950
|
+
|
|
951
|
+
attach: (object: NS_THREE.Object3D) => this;
|
|
952
|
+
|
|
953
|
+
detach: Function;
|
|
954
|
+
|
|
955
|
+
dispose: Function;
|
|
956
|
+
|
|
957
|
+
pointerDown: Function;
|
|
958
|
+
|
|
959
|
+
pointerMove: Function;
|
|
960
|
+
|
|
961
|
+
pointerUp: Function;
|
|
962
|
+
|
|
963
|
+
pointerHover: Function;
|
|
964
|
+
|
|
965
|
+
getMode: Function;
|
|
966
|
+
|
|
967
|
+
setMode: Function;
|
|
968
|
+
|
|
969
|
+
setTranslationSnap: Function;
|
|
970
|
+
|
|
971
|
+
setScaleSnap: Function;
|
|
972
|
+
|
|
973
|
+
setRotationSnap: Function;
|
|
974
|
+
|
|
975
|
+
setSize: Function;
|
|
976
|
+
|
|
977
|
+
setSpace: Function;
|
|
978
|
+
|
|
979
|
+
update: Function;
|
|
980
|
+
|
|
981
|
+
dragging: boolean;
|
|
982
|
+
|
|
983
|
+
constructor(camera: NS_THREE.Camera, domElement: any) {
|
|
984
|
+
super();
|
|
985
|
+
if (domElement === undefined) {
|
|
986
|
+
console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.');
|
|
987
|
+
domElement = document; // eslint-disable-line no-param-reassign
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
this.visible = false;
|
|
991
|
+
this.domElement = domElement;
|
|
992
|
+
|
|
993
|
+
const _gizmo = new TransformControlsGizmo();
|
|
994
|
+
this.add(_gizmo);
|
|
995
|
+
|
|
996
|
+
const _plane = new TransformControlsPlane();
|
|
997
|
+
this.add(_plane);
|
|
998
|
+
|
|
999
|
+
const scope = this;
|
|
1000
|
+
|
|
1001
|
+
const changeEvent = { type: 'change' };
|
|
1002
|
+
const mouseDownEvent: any = { type: 'mouseDown' };
|
|
1003
|
+
const mouseUpEvent = { type: 'mouseUp', mode: scope.mode };
|
|
1004
|
+
const objectChangeEvent = { type: 'objectChange' };
|
|
1005
|
+
|
|
1006
|
+
// Defined getter, setter and store for a property
|
|
1007
|
+
function defineProperty(propName: string, defaultValue: any): void {
|
|
1008
|
+
let propValue = defaultValue;
|
|
1009
|
+
|
|
1010
|
+
Object.defineProperty(scope, propName, {
|
|
1011
|
+
|
|
1012
|
+
get() {
|
|
1013
|
+
return propValue !== undefined ? propValue : defaultValue;
|
|
1014
|
+
},
|
|
1015
|
+
|
|
1016
|
+
set(value) {
|
|
1017
|
+
if (propValue !== value) {
|
|
1018
|
+
propValue = value;
|
|
1019
|
+
(_plane as any)[propName] = value;
|
|
1020
|
+
(_gizmo as any)[propName] = value;
|
|
1021
|
+
|
|
1022
|
+
scope.dispatchEvent({ type: `${propName}-changed`, value });
|
|
1023
|
+
scope.dispatchEvent(changeEvent);
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
(scope as any)[propName] = defaultValue;
|
|
1030
|
+
(_plane as any)[propName] = defaultValue;
|
|
1031
|
+
(_gizmo as any)[propName] = defaultValue;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
const { THREE } = Externals.getInstance();
|
|
1035
|
+
|
|
1036
|
+
// Define properties with getters/setter
|
|
1037
|
+
// Setting the defined property will automatically trigger change event
|
|
1038
|
+
// Defined properties are passed down to gizmo and plane
|
|
1039
|
+
|
|
1040
|
+
defineProperty('camera', camera);
|
|
1041
|
+
defineProperty('object', undefined);
|
|
1042
|
+
defineProperty('enabled', true);
|
|
1043
|
+
defineProperty('axis', null);
|
|
1044
|
+
defineProperty('mode', 'translate');
|
|
1045
|
+
defineProperty('translationSnap', null);
|
|
1046
|
+
defineProperty('rotationSnap', null);
|
|
1047
|
+
defineProperty('scaleSnap', null);
|
|
1048
|
+
defineProperty('space', 'world');
|
|
1049
|
+
defineProperty('size', 1);
|
|
1050
|
+
defineProperty('dragging', false);
|
|
1051
|
+
defineProperty('showX', true);
|
|
1052
|
+
defineProperty('showY', true);
|
|
1053
|
+
defineProperty('showZ', true);
|
|
1054
|
+
|
|
1055
|
+
// Reusable utility variables
|
|
1056
|
+
|
|
1057
|
+
function intersectObjectWithRay(object: any, raycaster: any, includeInvisible?: any): any {
|
|
1058
|
+
const allIntersections = raycaster.intersectObject(object, true);
|
|
1059
|
+
|
|
1060
|
+
for (let i = 0; i < allIntersections.length; i++) {
|
|
1061
|
+
if (allIntersections[i].object.visible || includeInvisible) {
|
|
1062
|
+
return allIntersections[i];
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
return false;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
const raycaster = new THREE.Raycaster();
|
|
1070
|
+
|
|
1071
|
+
const _tempVector = new THREE.Vector3();
|
|
1072
|
+
const _tempVector2 = new THREE.Vector3();
|
|
1073
|
+
const _tempQuaternion = new THREE.Quaternion();
|
|
1074
|
+
const _unit = {
|
|
1075
|
+
X: new THREE.Vector3(1, 0, 0),
|
|
1076
|
+
Y: new THREE.Vector3(0, 1, 0),
|
|
1077
|
+
Z: new THREE.Vector3(0, 0, 1),
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
const pointStart = new THREE.Vector3();
|
|
1081
|
+
const pointEnd = new THREE.Vector3();
|
|
1082
|
+
const offset = new THREE.Vector3();
|
|
1083
|
+
const rotationAxis = new THREE.Vector3();
|
|
1084
|
+
const startNorm = new THREE.Vector3();
|
|
1085
|
+
const endNorm = new THREE.Vector3();
|
|
1086
|
+
let rotationAngle = 0;
|
|
1087
|
+
|
|
1088
|
+
const cameraPosition = new THREE.Vector3();
|
|
1089
|
+
const cameraQuaternion = new THREE.Quaternion();
|
|
1090
|
+
const cameraScale = new THREE.Vector3();
|
|
1091
|
+
|
|
1092
|
+
const parentPosition = new THREE.Vector3();
|
|
1093
|
+
const parentQuaternion = new THREE.Quaternion();
|
|
1094
|
+
const parentQuaternionInv = new THREE.Quaternion();
|
|
1095
|
+
const parentScale = new THREE.Vector3();
|
|
1096
|
+
|
|
1097
|
+
const worldPositionStart = new THREE.Vector3();
|
|
1098
|
+
const worldQuaternionStart = new THREE.Quaternion();
|
|
1099
|
+
const worldScaleStart = new THREE.Vector3();
|
|
1100
|
+
|
|
1101
|
+
const worldPosition = new THREE.Vector3();
|
|
1102
|
+
const worldQuaternion = new THREE.Quaternion();
|
|
1103
|
+
const worldQuaternionInv = new THREE.Quaternion();
|
|
1104
|
+
const worldScale = new THREE.Vector3();
|
|
1105
|
+
|
|
1106
|
+
const eye = new THREE.Vector3();
|
|
1107
|
+
|
|
1108
|
+
const positionStart = new THREE.Vector3();
|
|
1109
|
+
const quaternionStart = new THREE.Quaternion();
|
|
1110
|
+
const scaleStart = new THREE.Vector3();
|
|
1111
|
+
|
|
1112
|
+
// TODO: remove properties unused in plane and gizmo
|
|
1113
|
+
|
|
1114
|
+
defineProperty('worldPosition', worldPosition);
|
|
1115
|
+
defineProperty('worldPositionStart', worldPositionStart);
|
|
1116
|
+
defineProperty('worldQuaternion', worldQuaternion);
|
|
1117
|
+
defineProperty('worldQuaternionStart', worldQuaternionStart);
|
|
1118
|
+
defineProperty('cameraPosition', cameraPosition);
|
|
1119
|
+
defineProperty('cameraQuaternion', cameraQuaternion);
|
|
1120
|
+
defineProperty('pointStart', pointStart);
|
|
1121
|
+
defineProperty('pointEnd', pointEnd);
|
|
1122
|
+
defineProperty('rotationAxis', rotationAxis);
|
|
1123
|
+
defineProperty('rotationAngle', rotationAngle);
|
|
1124
|
+
defineProperty('eye', eye);
|
|
1125
|
+
|
|
1126
|
+
// normalize mouse / touch pointer and remap {x,y} to view space.
|
|
1127
|
+
|
|
1128
|
+
function getPointer(event: any): any {
|
|
1129
|
+
if (scope.domElement.ownerDocument.pointerLockElement) {
|
|
1130
|
+
return {
|
|
1131
|
+
x: 0,
|
|
1132
|
+
y: 0,
|
|
1133
|
+
button: event.button,
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
const pointer = event.changedTouches ? event.changedTouches[0] : event;
|
|
1138
|
+
|
|
1139
|
+
const rect = domElement.getBoundingClientRect();
|
|
1140
|
+
|
|
1141
|
+
return {
|
|
1142
|
+
x: (pointer.clientX - rect.left) / rect.width * 2 - 1,
|
|
1143
|
+
y: -(pointer.clientY - rect.top) / rect.height * 2 + 1,
|
|
1144
|
+
button: event.button,
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
// mouse / touch event handlers
|
|
1149
|
+
|
|
1150
|
+
function onPointerHover(event: any): any {
|
|
1151
|
+
if (!scope.enabled) return;
|
|
1152
|
+
|
|
1153
|
+
switch (event.pointerType) {
|
|
1154
|
+
case 'mouse':
|
|
1155
|
+
case 'pen':
|
|
1156
|
+
scope.pointerHover(getPointer(event));
|
|
1157
|
+
break;
|
|
1158
|
+
default: break;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
function onPointerMove(event: any): any {
|
|
1163
|
+
if (!scope.enabled) return;
|
|
1164
|
+
|
|
1165
|
+
scope.pointerMove(getPointer(event));
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
function onPointerDown(event: any): any {
|
|
1169
|
+
if (!scope.enabled) return;
|
|
1170
|
+
|
|
1171
|
+
scope.domElement.style.touchAction = 'none'; // disable touch scroll
|
|
1172
|
+
scope.domElement.ownerDocument.addEventListener('pointermove', onPointerMove);
|
|
1173
|
+
|
|
1174
|
+
scope.pointerHover(getPointer(event));
|
|
1175
|
+
scope.pointerDown(getPointer(event));
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
function onPointerUp(event: any): any {
|
|
1179
|
+
if (!scope.enabled) return;
|
|
1180
|
+
|
|
1181
|
+
scope.domElement.style.touchAction = '';
|
|
1182
|
+
scope.domElement.ownerDocument.removeEventListener('pointermove', onPointerMove);
|
|
1183
|
+
|
|
1184
|
+
scope.pointerUp(getPointer(event));
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
domElement.addEventListener('pointerdown', onPointerDown);
|
|
1188
|
+
domElement.addEventListener('pointermove', onPointerHover);
|
|
1189
|
+
scope.domElement.ownerDocument.addEventListener('pointerup', onPointerUp);
|
|
1190
|
+
|
|
1191
|
+
this.dispose = function (): any {
|
|
1192
|
+
domElement.removeEventListener('pointerdown', onPointerDown);
|
|
1193
|
+
domElement.removeEventListener('pointermove', onPointerHover);
|
|
1194
|
+
scope.domElement.ownerDocument.removeEventListener('pointermove', onPointerMove);
|
|
1195
|
+
scope.domElement.ownerDocument.removeEventListener('pointerup', onPointerUp);
|
|
1196
|
+
|
|
1197
|
+
this.traverse((child) => {
|
|
1198
|
+
if ((child as NS_THREE.Mesh).geometry) (child as NS_THREE.Mesh).geometry.dispose();
|
|
1199
|
+
if ((child as NS_THREE.Mesh).material) ((child as NS_THREE.Mesh).material as NS_THREE.Material).dispose();
|
|
1200
|
+
});
|
|
1201
|
+
scope.domElement = null;
|
|
1202
|
+
};
|
|
1203
|
+
|
|
1204
|
+
// Set current object
|
|
1205
|
+
this.attach = function (object): any {
|
|
1206
|
+
this.object = object;
|
|
1207
|
+
this.visible = true;
|
|
1208
|
+
|
|
1209
|
+
return this;
|
|
1210
|
+
};
|
|
1211
|
+
|
|
1212
|
+
// Detatch from object
|
|
1213
|
+
this.detach = function (): any {
|
|
1214
|
+
this.object = undefined;
|
|
1215
|
+
this.visible = false;
|
|
1216
|
+
this.axis = null;
|
|
1217
|
+
|
|
1218
|
+
return this;
|
|
1219
|
+
};
|
|
1220
|
+
|
|
1221
|
+
// updateMatrixWorld updates key transformation variables
|
|
1222
|
+
this.updateMatrixWorld = function (): any {
|
|
1223
|
+
if (this.object !== undefined) {
|
|
1224
|
+
this.object.updateMatrixWorld();
|
|
1225
|
+
|
|
1226
|
+
if (this.object.parent === null) {
|
|
1227
|
+
console.error('TransformControls: The attached 3D object must be a part of the scene graph.');
|
|
1228
|
+
} else {
|
|
1229
|
+
this.object.parent.matrixWorld.decompose(parentPosition, parentQuaternion, parentScale);
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
this.object.matrixWorld.decompose(worldPosition, worldQuaternion, worldScale);
|
|
1233
|
+
|
|
1234
|
+
parentQuaternionInv.copy(parentQuaternion).invert();
|
|
1235
|
+
worldQuaternionInv.copy(worldQuaternion).invert();
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
this.camera.updateMatrixWorld();
|
|
1239
|
+
this.camera.matrixWorld.decompose(cameraPosition, cameraQuaternion, cameraScale);
|
|
1240
|
+
|
|
1241
|
+
eye.copy(cameraPosition).sub(worldPosition).normalize();
|
|
1242
|
+
|
|
1243
|
+
THREE.Object3D.prototype.updateMatrixWorld.call(this);
|
|
1244
|
+
};
|
|
1245
|
+
|
|
1246
|
+
this.pointerHover = function (pointer: any): any {
|
|
1247
|
+
if (this.object === undefined || this.dragging === true) return;
|
|
1248
|
+
|
|
1249
|
+
raycaster.setFromCamera(pointer, this.camera);
|
|
1250
|
+
|
|
1251
|
+
const intersect = intersectObjectWithRay(_gizmo.picker[this.mode], raycaster);
|
|
1252
|
+
|
|
1253
|
+
if (intersect) {
|
|
1254
|
+
this.axis = intersect.object.name;
|
|
1255
|
+
} else {
|
|
1256
|
+
this.axis = null;
|
|
1257
|
+
}
|
|
1258
|
+
};
|
|
1259
|
+
|
|
1260
|
+
this.pointerDown = function (pointer: any): any {
|
|
1261
|
+
if (this.object === undefined || this.dragging === true || pointer.button !== 0) return;
|
|
1262
|
+
|
|
1263
|
+
if (this.axis !== null) {
|
|
1264
|
+
raycaster.setFromCamera(pointer, this.camera);
|
|
1265
|
+
|
|
1266
|
+
const planeIntersect = intersectObjectWithRay(_plane, raycaster, true);
|
|
1267
|
+
|
|
1268
|
+
if (planeIntersect) {
|
|
1269
|
+
let { space } = this;
|
|
1270
|
+
|
|
1271
|
+
if (this.mode === 'scale') {
|
|
1272
|
+
space = 'local';
|
|
1273
|
+
} else if (this.axis === 'E' || this.axis === 'XYZE' || this.axis === 'XYZ') {
|
|
1274
|
+
space = 'world';
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
if (space === 'local' && this.mode === 'rotate') {
|
|
1278
|
+
const snap = this.rotationSnap;
|
|
1279
|
+
|
|
1280
|
+
if (this.axis === 'X' && snap) this.object.rotation.x = Math.round(this.object.rotation.x / snap) * snap;
|
|
1281
|
+
if (this.axis === 'Y' && snap) this.object.rotation.y = Math.round(this.object.rotation.y / snap) * snap;
|
|
1282
|
+
if (this.axis === 'Z' && snap) this.object.rotation.z = Math.round(this.object.rotation.z / snap) * snap;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
this.object.updateMatrixWorld();
|
|
1286
|
+
this.object.parent!.updateMatrixWorld();
|
|
1287
|
+
|
|
1288
|
+
positionStart.copy(this.object.position);
|
|
1289
|
+
quaternionStart.copy(this.object.quaternion);
|
|
1290
|
+
scaleStart.copy(this.object.scale);
|
|
1291
|
+
|
|
1292
|
+
this.object.matrixWorld.decompose(worldPositionStart, worldQuaternionStart, worldScaleStart);
|
|
1293
|
+
|
|
1294
|
+
pointStart.copy(planeIntersect.point).sub(worldPositionStart);
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
this.dragging = true;
|
|
1298
|
+
mouseDownEvent.mode = this.mode;
|
|
1299
|
+
this.dispatchEvent(mouseDownEvent);
|
|
1300
|
+
}
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1303
|
+
this.pointerMove = function (pointer: any): any {
|
|
1304
|
+
const { axis } = this;
|
|
1305
|
+
const { mode } = this;
|
|
1306
|
+
const { object } = this;
|
|
1307
|
+
let { space } = this;
|
|
1308
|
+
|
|
1309
|
+
if (mode === 'scale') {
|
|
1310
|
+
space = 'local';
|
|
1311
|
+
} else if (axis === 'E' || axis === 'XYZE' || axis === 'XYZ') {
|
|
1312
|
+
space = 'world';
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
if (object === undefined || axis === null || this.dragging === false || pointer.button !== -1) return;
|
|
1316
|
+
|
|
1317
|
+
raycaster.setFromCamera(pointer, this.camera);
|
|
1318
|
+
|
|
1319
|
+
const planeIntersect = intersectObjectWithRay(_plane, raycaster, true);
|
|
1320
|
+
|
|
1321
|
+
if (!planeIntersect) return;
|
|
1322
|
+
|
|
1323
|
+
pointEnd.copy(planeIntersect.point).sub(worldPositionStart);
|
|
1324
|
+
|
|
1325
|
+
if (mode === 'translate') {
|
|
1326
|
+
// Apply translate
|
|
1327
|
+
|
|
1328
|
+
offset.copy(pointEnd).sub(pointStart);
|
|
1329
|
+
|
|
1330
|
+
if (space === 'local' && axis !== 'XYZ') {
|
|
1331
|
+
offset.applyQuaternion(worldQuaternionInv);
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
if (axis.indexOf('X') === -1) offset.x = 0;
|
|
1335
|
+
if (axis.indexOf('Y') === -1) offset.y = 0;
|
|
1336
|
+
if (axis.indexOf('Z') === -1) offset.z = 0;
|
|
1337
|
+
|
|
1338
|
+
if (space === 'local' && axis !== 'XYZ') {
|
|
1339
|
+
offset.applyQuaternion(quaternionStart).divide(parentScale);
|
|
1340
|
+
} else {
|
|
1341
|
+
offset.applyQuaternion(parentQuaternionInv).divide(parentScale);
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
object.position.copy(offset).add(positionStart);
|
|
1345
|
+
|
|
1346
|
+
// Apply translation snap
|
|
1347
|
+
|
|
1348
|
+
if (this.translationSnap) {
|
|
1349
|
+
if (space === 'local') {
|
|
1350
|
+
object.position.applyQuaternion(_tempQuaternion.copy(quaternionStart).invert());
|
|
1351
|
+
|
|
1352
|
+
if (axis.search('X') !== -1) {
|
|
1353
|
+
object.position.x = Math.round(object.position.x / this.translationSnap) * this.translationSnap;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
if (axis.search('Y') !== -1) {
|
|
1357
|
+
object.position.y = Math.round(object.position.y / this.translationSnap) * this.translationSnap;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
if (axis.search('Z') !== -1) {
|
|
1361
|
+
object.position.z = Math.round(object.position.z / this.translationSnap) * this.translationSnap;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
object.position.applyQuaternion(quaternionStart);
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
if (space === 'world') {
|
|
1368
|
+
if (object.parent) {
|
|
1369
|
+
object.position.add(_tempVector.setFromMatrixPosition(object.parent.matrixWorld));
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
if (axis.search('X') !== -1) {
|
|
1373
|
+
object.position.x = Math.round(object.position.x / this.translationSnap) * this.translationSnap;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
if (axis.search('Y') !== -1) {
|
|
1377
|
+
object.position.y = Math.round(object.position.y / this.translationSnap) * this.translationSnap;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
if (axis.search('Z') !== -1) {
|
|
1381
|
+
object.position.z = Math.round(object.position.z / this.translationSnap) * this.translationSnap;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
if (object.parent) {
|
|
1385
|
+
object.position.sub(_tempVector.setFromMatrixPosition(object.parent.matrixWorld));
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
} else if (mode === 'scale') {
|
|
1390
|
+
if (axis.search('XYZ') !== -1) {
|
|
1391
|
+
let d = pointEnd.length() / pointStart.length();
|
|
1392
|
+
|
|
1393
|
+
if (pointEnd.dot(pointStart) < 0) d *= -1;
|
|
1394
|
+
|
|
1395
|
+
_tempVector2.set(d, d, d);
|
|
1396
|
+
} else {
|
|
1397
|
+
_tempVector.copy(pointStart);
|
|
1398
|
+
_tempVector2.copy(pointEnd);
|
|
1399
|
+
|
|
1400
|
+
_tempVector.applyQuaternion(worldQuaternionInv);
|
|
1401
|
+
_tempVector2.applyQuaternion(worldQuaternionInv);
|
|
1402
|
+
|
|
1403
|
+
_tempVector2.divide(_tempVector);
|
|
1404
|
+
|
|
1405
|
+
if (axis.search('X') === -1) {
|
|
1406
|
+
_tempVector2.x = 1;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
if (axis.search('Y') === -1) {
|
|
1410
|
+
_tempVector2.y = 1;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
if (axis.search('Z') === -1) {
|
|
1414
|
+
_tempVector2.z = 1;
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
// Apply scale
|
|
1419
|
+
|
|
1420
|
+
object.scale.copy(scaleStart).multiply(_tempVector2);
|
|
1421
|
+
|
|
1422
|
+
if (this.scaleSnap) {
|
|
1423
|
+
if (axis.search('X') !== -1) {
|
|
1424
|
+
object.scale.x = Math.round(object.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
if (axis.search('Y') !== -1) {
|
|
1428
|
+
object.scale.y = Math.round(object.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
if (axis.search('Z') !== -1) {
|
|
1432
|
+
object.scale.z = Math.round(object.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
} else if (mode === 'rotate') {
|
|
1436
|
+
offset.copy(pointEnd).sub(pointStart);
|
|
1437
|
+
|
|
1438
|
+
const ROTATION_SPEED = 20 / worldPosition.distanceTo(_tempVector.setFromMatrixPosition(this.camera.matrixWorld));
|
|
1439
|
+
|
|
1440
|
+
if (axis === 'E') {
|
|
1441
|
+
rotationAxis.copy(eye);
|
|
1442
|
+
rotationAngle = pointEnd.angleTo(pointStart);
|
|
1443
|
+
|
|
1444
|
+
startNorm.copy(pointStart).normalize();
|
|
1445
|
+
endNorm.copy(pointEnd).normalize();
|
|
1446
|
+
|
|
1447
|
+
rotationAngle *= (endNorm.cross(startNorm).dot(eye) < 0 ? 1 : -1);
|
|
1448
|
+
} else if (axis === 'XYZE') {
|
|
1449
|
+
rotationAxis.copy(offset).cross(eye).normalize();
|
|
1450
|
+
rotationAngle = offset.dot(_tempVector.copy(rotationAxis).cross(this.eye)) * ROTATION_SPEED;
|
|
1451
|
+
} else if (axis === 'X' || axis === 'Y' || axis === 'Z') {
|
|
1452
|
+
rotationAxis.copy(_unit[axis]);
|
|
1453
|
+
|
|
1454
|
+
_tempVector.copy(_unit[axis]);
|
|
1455
|
+
|
|
1456
|
+
if (space === 'local') {
|
|
1457
|
+
_tempVector.applyQuaternion(worldQuaternion);
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
rotationAngle = offset.dot(_tempVector.cross(eye).normalize()) * ROTATION_SPEED;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
// Apply rotation snap
|
|
1464
|
+
|
|
1465
|
+
if (this.rotationSnap) rotationAngle = Math.round(rotationAngle / this.rotationSnap) * this.rotationSnap;
|
|
1466
|
+
|
|
1467
|
+
this.rotationAngle = rotationAngle;
|
|
1468
|
+
|
|
1469
|
+
// Apply rotate
|
|
1470
|
+
if (space === 'local' && axis !== 'E' && axis !== 'XYZE') {
|
|
1471
|
+
object.quaternion.copy(quaternionStart);
|
|
1472
|
+
object.quaternion.multiply(_tempQuaternion.setFromAxisAngle(rotationAxis, rotationAngle)).normalize();
|
|
1473
|
+
} else {
|
|
1474
|
+
rotationAxis.applyQuaternion(parentQuaternionInv);
|
|
1475
|
+
object.quaternion.copy(_tempQuaternion.setFromAxisAngle(rotationAxis, rotationAngle));
|
|
1476
|
+
object.quaternion.multiply(quaternionStart).normalize();
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
this.dispatchEvent(changeEvent);
|
|
1481
|
+
this.dispatchEvent(objectChangeEvent);
|
|
1482
|
+
};
|
|
1483
|
+
|
|
1484
|
+
this.pointerUp = function (pointer: any): any {
|
|
1485
|
+
if (pointer.button !== 0) return;
|
|
1486
|
+
|
|
1487
|
+
if (this.dragging && (this.axis !== null)) {
|
|
1488
|
+
mouseUpEvent.mode = this.mode;
|
|
1489
|
+
this.dispatchEvent(mouseUpEvent);
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
this.dragging = false;
|
|
1493
|
+
this.axis = null;
|
|
1494
|
+
};
|
|
1495
|
+
|
|
1496
|
+
// TODO: deprecate
|
|
1497
|
+
|
|
1498
|
+
this.getMode = function (): any {
|
|
1499
|
+
return scope.mode;
|
|
1500
|
+
};
|
|
1501
|
+
|
|
1502
|
+
this.setMode = function (mode: any): any {
|
|
1503
|
+
scope.mode = mode;
|
|
1504
|
+
};
|
|
1505
|
+
|
|
1506
|
+
this.setTranslationSnap = function (translationSnap: any): any {
|
|
1507
|
+
scope.translationSnap = translationSnap;
|
|
1508
|
+
};
|
|
1509
|
+
|
|
1510
|
+
this.setScaleSnap = function (scaleSnap: any): any {
|
|
1511
|
+
scope.scaleSnap = scaleSnap;
|
|
1512
|
+
};
|
|
1513
|
+
|
|
1514
|
+
this.setRotationSnap = function (rotationSnap: any): any {
|
|
1515
|
+
scope.rotationSnap = rotationSnap;
|
|
1516
|
+
};
|
|
1517
|
+
|
|
1518
|
+
this.setSize = function (size: any): any {
|
|
1519
|
+
scope.size = size;
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1522
|
+
this.setSpace = function (space: any): any {
|
|
1523
|
+
scope.space = space;
|
|
1524
|
+
};
|
|
1525
|
+
|
|
1526
|
+
this.update = function (): any {
|
|
1527
|
+
console.warn('THREE.TransformControls: update function has no more functionality and therefore has been deprecated.');
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
export { TransformControls, TransformControlsGizmo, TransformControlsPlane };
|