@anov/3d-ability 0.0.140 → 0.0.142
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/dist/business/Animation/motion/index.js +35 -56
- package/dist/business/Animation/motion/index.js.map +1 -1
- package/dist/business/Animation/type.js +2 -2
- package/dist/business/Area/Fence/FenceBase.js +146 -187
- package/dist/business/Area/Fence/FenceBase.js.map +1 -1
- package/dist/business/Area/Fence/fence_base_01.js +120 -112
- package/dist/business/Area/Fence/fence_base_01.js.map +1 -1
- package/dist/business/Area/Fence/fence_feeting_01.js +218 -130
- package/dist/business/Area/Fence/fence_feeting_01.js.map +1 -1
- package/dist/business/Area/Fence/fence_roll_01.js +140 -130
- package/dist/business/Area/Fence/fence_roll_01.js.map +1 -1
- package/dist/business/Area/FillArea/FillAreaBase.js +87 -126
- package/dist/business/Area/FillArea/FillAreaBase.js.map +1 -1
- package/dist/business/Area/FillArea/fillArea_face_01.js +72 -98
- package/dist/business/Area/FillArea/fillArea_face_01.js.map +1 -1
- package/dist/business/Area/FillArea/fillArea_line_01.js +66 -94
- package/dist/business/Area/FillArea/fillArea_line_01.js.map +1 -1
- package/dist/business/Area/index.js +267 -483
- package/dist/business/Area/index.js.map +1 -1
- package/dist/business/Area/tool.js +14 -26
- package/dist/business/Area/tool.js.map +1 -1
- package/dist/business/Base/ObjectLayer.js +21 -46
- package/dist/business/Base/ObjectLayer.js.map +1 -1
- package/dist/business/Batch/index.js +189 -234
- package/dist/business/Batch/index.js.map +1 -1
- package/dist/business/Box/index.js +52 -81
- package/dist/business/Box/index.js.map +1 -1
- package/dist/business/Cylinder/index.js +51 -79
- package/dist/business/Cylinder/index.js.map +1 -1
- package/dist/business/Flyline/bubble/CircleBubble.js +1 -9
- package/dist/business/Flyline/bubble/CircleBubble.js.map +1 -1
- package/dist/business/Flyline/bubble/index.js +7 -21
- package/dist/business/Flyline/bubble/index.js.map +1 -1
- package/dist/business/Flyline/index.js +96 -162
- package/dist/business/Flyline/index.js.map +1 -1
- package/dist/business/Flyline/line/ArcLine.js +208 -291
- package/dist/business/Flyline/line/ArcLine.js.map +1 -1
- package/dist/business/Flyline/line/index.js +8 -22
- package/dist/business/Flyline/line/index.js.map +1 -1
- package/dist/business/HeatMap/HeatMap.js +380 -467
- package/dist/business/HeatMap/HeatMap.js.map +1 -1
- package/dist/business/HeatMap/core.js +405 -525
- package/dist/business/HeatMap/core.js.map +1 -1
- package/dist/business/HeatMap/shader.js +69 -3
- package/dist/business/HeatMap/shader.js.map +1 -1
- package/dist/business/InfoPanel/index.js +201 -242
- package/dist/business/InfoPanel/index.js.map +1 -1
- package/dist/business/Line/index.js +55 -88
- package/dist/business/Line/index.js.map +1 -1
- package/dist/business/Mark/KeyframeAnimation.js +145 -176
- package/dist/business/Mark/KeyframeAnimation.js.map +1 -1
- package/dist/business/Mark/index.js +196 -294
- package/dist/business/Mark/index.js.map +1 -1
- package/dist/business/Mark/shader/tanhao.js +36 -3
- package/dist/business/Mark/shader/tanhao.js.map +1 -1
- package/dist/business/Mark/type.js +1 -1
- package/dist/business/MaterialSwitch/MaterialSwitchSystem.js +377 -551
- package/dist/business/MaterialSwitch/MaterialSwitchSystem.js.map +1 -1
- package/dist/business/MaterialSwitch/inject.js +92 -58
- package/dist/business/MaterialSwitch/inject.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/finalFade.js +74 -2
- package/dist/business/MaterialSwitch/shader/finalFade.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/ground.js +95 -16
- package/dist/business/MaterialSwitch/shader/ground.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/groundBase64.js +9 -3
- package/dist/business/MaterialSwitch/shader/groundBase64.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/realFade.js +48 -9
- package/dist/business/MaterialSwitch/shader/realFade.js.map +1 -1
- package/dist/business/Plane/index.js +51 -78
- package/dist/business/Plane/index.js.map +1 -1
- package/dist/business/Poi/index.d.ts +5 -0
- package/dist/business/Poi/index.js +256 -295
- package/dist/business/Poi/index.js.map +1 -1
- package/dist/business/Poi/link/Cylinder.js +56 -89
- package/dist/business/Poi/link/Cylinder.js.map +1 -1
- package/dist/business/Poi/link/Pyramid.js +104 -165
- package/dist/business/Poi/link/Pyramid.js.map +1 -1
- package/dist/business/Poi/link/index.d.ts +1 -1
- package/dist/business/Poi/link/index.js +54 -114
- package/dist/business/Poi/link/index.js.map +1 -1
- package/dist/business/Poi/panel/index.d.ts +124 -0
- package/dist/business/Poi/panel/index.js +474 -0
- package/dist/business/Poi/panel/index.js.map +1 -0
- package/dist/business/Poi/panel/interfaces.d.ts +67 -0
- package/dist/business/Poi/panel/interfaces.js +2 -0
- package/dist/business/Poi/panel/interfaces.js.map +1 -0
- package/dist/business/Poi/panel/utils.d.ts +72 -0
- package/dist/business/Poi/panel/utils.js +126 -0
- package/dist/business/Poi/panel/utils.js.map +1 -0
- package/dist/business/Poi/particle/DoubleCircle.js +71 -107
- package/dist/business/Poi/particle/DoubleCircle.js.map +1 -1
- package/dist/business/Poi/particle/DynamicCircle.js +75 -111
- package/dist/business/Poi/particle/DynamicCircle.js.map +1 -1
- package/dist/business/Poi/particle/SingleCircle.js +62 -98
- package/dist/business/Poi/particle/SingleCircle.js.map +1 -1
- package/dist/business/Poi/particle/index.js +49 -117
- package/dist/business/Poi/particle/index.js.map +1 -1
- package/dist/business/Poi/shader/circle.js +31 -3
- package/dist/business/Poi/shader/circle.js.map +1 -1
- package/dist/business/Poi/shader/cylinder.js +37 -3
- package/dist/business/Poi/shader/cylinder.js.map +1 -1
- package/dist/business/Poi/shader/doubleCircle.js +55 -3
- package/dist/business/Poi/shader/doubleCircle.js.map +1 -1
- package/dist/business/Poi/shader/dynamicCircle.js +67 -3
- package/dist/business/Poi/shader/dynamicCircle.js.map +1 -1
- package/dist/business/Poi/title/Border.js +7 -27
- package/dist/business/Poi/title/Border.js.map +1 -1
- package/dist/business/Poi/title/Ellipse.js +7 -27
- package/dist/business/Poi/title/Ellipse.js.map +1 -1
- package/dist/business/Poi/title/index.js +208 -292
- package/dist/business/Poi/title/index.js.map +1 -1
- package/dist/business/Poi/tools.js +22 -19
- package/dist/business/Poi/tools.js.map +1 -1
- package/dist/business/Poi/types.d.ts +3 -0
- package/dist/business/Poi/types.js.map +1 -1
- package/dist/business/Sphere/index.js +47 -72
- package/dist/business/Sphere/index.js.map +1 -1
- package/dist/business/Spline/index.js +190 -245
- package/dist/business/Spline/index.js.map +1 -1
- package/dist/business/SplitBuilding/index.js +327 -536
- package/dist/business/SplitBuilding/index.js.map +1 -1
- package/dist/business/SplitBuilding/type.js +2 -2
- package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js +218 -275
- package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js +132 -177
- package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js +51 -1
- package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js +6 -1
- package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js.map +1 -1
- package/dist/business/TrafficComponents/base.js +32 -55
- package/dist/business/TrafficComponents/base.js.map +1 -1
- package/dist/business/TrafficComponents/utils.d.ts +1 -1
- package/dist/business/TrafficComponents/utils.js +26 -25
- package/dist/business/TrafficComponents/utils.js.map +1 -1
- package/dist/business/Utils/Curve.js +40 -56
- package/dist/business/Utils/Curve.js.map +1 -1
- package/dist/business/Utils/constant.js +1 -1
- package/dist/business/Utils/constant.js.map +1 -1
- package/dist/business/Utils/defineProps.js +13 -14
- package/dist/business/Utils/defineProps.js.map +1 -1
- package/dist/business/Utils/round-curve.js +127 -153
- package/dist/business/Utils/round-curve.js.map +1 -1
- package/dist/business/VideoPanel/index.js +258 -319
- package/dist/business/VideoPanel/index.js.map +1 -1
- package/dist/business/Water/index.js +78 -108
- package/dist/business/Water/index.js.map +1 -1
- package/dist/business/Water/types.js +1 -1
- package/dist/business/Water/types.js.map +1 -1
- package/dist/core/Camera/PerspectiveCamera/CameraExpand.js +383 -449
- package/dist/core/Camera/PerspectiveCamera/CameraExpand.js.map +1 -1
- package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js +107 -142
- package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js.map +1 -1
- package/dist/core/Controls/FirstViewControl/index.js +84 -96
- package/dist/core/Controls/FirstViewControl/index.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/action/input.js +77 -98
- package/dist/core/Controls/ThirdViewControl/action/input.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/config/constants.js +1 -1
- package/dist/core/Controls/ThirdViewControl/config/constants.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/index.js +19 -28
- package/dist/core/Controls/ThirdViewControl/index.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/animation.js +126 -155
- package/dist/core/Controls/ThirdViewControl/player/animation.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/camera.js +47 -63
- package/dist/core/Controls/ThirdViewControl/player/camera.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/control.js +39 -49
- package/dist/core/Controls/ThirdViewControl/player/control.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player.js +66 -91
- package/dist/core/Controls/ThirdViewControl/player.js.map +1 -1
- package/dist/core/Controls/base.js +14 -30
- package/dist/core/Controls/base.js.map +1 -1
- package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js +92 -131
- package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js.map +1 -1
- package/dist/core/Debug/PerformanceInfo/Performance.js +22 -47
- package/dist/core/Debug/PerformanceInfo/Performance.js.map +1 -1
- package/dist/core/Light/PointLight/PointLightExt.js +4 -21
- package/dist/core/Light/PointLight/PointLightExt.js.map +1 -1
- package/dist/core/Material/FinirMaterial/FinirMaterial.js +37 -57
- package/dist/core/Material/FinirMaterial/FinirMaterial.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js +116 -153
- package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/shader/fragment.js +95 -1
- package/dist/core/Material/PristineGridMaterial/shader/fragment.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/shader/vertex.js +26 -1
- package/dist/core/Material/PristineGridMaterial/shader/vertex.js.map +1 -1
- package/dist/core/Material/SurfaceMaterial/index.js +76 -172
- package/dist/core/Material/SurfaceMaterial/index.js.map +1 -1
- package/dist/core/Material/decorators.js +6 -11
- package/dist/core/Material/decorators.js.map +1 -1
- package/dist/core/PostEffects/addACESFilmicToneMappingPass.js +16 -12
- package/dist/core/PostEffects/addACESFilmicToneMappingPass.js.map +1 -1
- package/dist/core/PostEffects/addBrightnessContrastPass.js +17 -13
- package/dist/core/PostEffects/addBrightnessContrastPass.js.map +1 -1
- package/dist/core/PostEffects/bloomPass.js +17 -10
- package/dist/core/PostEffects/bloomPass.js.map +1 -1
- package/dist/core/PostEffects/bloomSelect.js +60 -43
- package/dist/core/PostEffects/bloomSelect.js.map +1 -1
- package/dist/core/PostEffects/colorifyPass.js +17 -13
- package/dist/core/PostEffects/colorifyPass.js.map +1 -1
- package/dist/core/PostEffects/index.js +28 -22
- package/dist/core/PostEffects/index.js.map +1 -1
- package/dist/core/PostEffects/outlinePass.js +37 -50
- package/dist/core/PostEffects/outlinePass.js.map +1 -1
- package/dist/core/PostEffects/postprocessing.js +14 -12
- package/dist/core/PostEffects/postprocessing.js.map +1 -1
- package/dist/core/PostEffects/saoPass.js +15 -10
- package/dist/core/PostEffects/saoPass.js.map +1 -1
- package/dist/core/PostEffects/shader/colorify.js +22 -3
- package/dist/core/PostEffects/shader/colorify.js.map +1 -1
- package/dist/core/PostEffects/shader/gammaCorrectionShader.js +27 -3
- package/dist/core/PostEffects/shader/gammaCorrectionShader.js.map +1 -1
- package/dist/core/PostEffects/shader/mapping.js +66 -3
- package/dist/core/PostEffects/shader/mapping.js.map +1 -1
- package/dist/core/PostEffects/shader/thermalMaging.js +28 -3
- package/dist/core/PostEffects/shader/thermalMaging.js.map +1 -1
- package/dist/core/SceneEffect/grow/grow.js +85 -101
- package/dist/core/SceneEffect/grow/grow.js.map +1 -1
- package/dist/core/SceneEffect/grow/style_down.js +60 -77
- package/dist/core/SceneEffect/grow/style_down.js.map +1 -1
- package/dist/core/SceneEffect/grow/style_up.js +64 -81
- package/dist/core/SceneEffect/grow/style_up.js.map +1 -1
- package/dist/core/SceneEffect/grow/type.js +2 -2
- package/dist/core/SceneEffect/grow/type.js.map +1 -1
- package/dist/core/WeatherSystem/DynamicWeatherSystem.js +51 -76
- package/dist/core/WeatherSystem/DynamicWeatherSystem.js.map +1 -1
- package/dist/core/WeatherSystem/hdr/index.js +69 -105
- package/dist/core/WeatherSystem/hdr/index.js.map +1 -1
- package/dist/core/WeatherSystem/index.js +77 -124
- package/dist/core/WeatherSystem/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/fog/index.js +52 -80
- package/dist/core/WeatherSystem/objects/fog/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/index.js +72 -84
- package/dist/core/WeatherSystem/objects/rain/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/lineRain.js +88 -118
- package/dist/core/WeatherSystem/objects/rain/lineRain.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/plane.js +116 -146
- package/dist/core/WeatherSystem/objects/rain/plane.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/point.js +100 -148
- package/dist/core/WeatherSystem/objects/rain/point.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/cloud.js +71 -104
- package/dist/core/WeatherSystem/objects/sky/cloud.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/index.js +66 -84
- package/dist/core/WeatherSystem/objects/sky/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/outline.js +25 -45
- package/dist/core/WeatherSystem/objects/sky/outline.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/cloud.js +74 -3
- package/dist/core/WeatherSystem/shaders/cloud.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/fog.js +103 -3
- package/dist/core/WeatherSystem/shaders/fog.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/rain.js +206 -7
- package/dist/core/WeatherSystem/shaders/rain.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/sky.js +87 -3
- package/dist/core/WeatherSystem/shaders/sky.js.map +1 -1
- package/dist/core/WeatherSystem/sky/index.js +104 -135
- package/dist/core/WeatherSystem/sky/index.js.map +1 -1
- package/dist/core/WeatherSystem/utils/constant.js +44 -38
- package/dist/core/WeatherSystem/utils/constant.js.map +1 -1
- package/dist/core/WeatherSystem/utils/math.js +18 -25
- package/dist/core/WeatherSystem/utils/math.js.map +1 -1
- package/dist/core/WeatherSystem/utils/type.js +1 -1
- package/dist/core/WeatherSystem/utils/type.js.map +1 -1
- package/dist/core/WeatherSystem/weather/index.js +96 -141
- package/dist/core/WeatherSystem/weather/index.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,484 +1,418 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
6
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
7
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
9
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
10
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
12
1
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" ==
|
|
14
|
-
function _toPrimitive(t, r) { if ("object" !=
|
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
4
|
import { Box3, EventDispatcher, Group, MathUtils, Plane, Quaternion, TWEEN, Vector3, use, utils } from '@anov/3d-core';
|
|
16
5
|
import FollowControls from "./FollowOrbitControls";
|
|
17
6
|
/**
|
|
18
7
|
* CameraExpand, 主要提供了一些PerspectiveCamera的拓展能力
|
|
19
8
|
*/
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
_defineProperty(
|
|
28
|
-
_defineProperty(
|
|
29
|
-
_defineProperty(
|
|
30
|
-
_defineProperty(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
_this.camera = camera;
|
|
36
|
-
_this.controls = controls;
|
|
37
|
-
_this.sceneControl = sceneControl;
|
|
38
|
-
_this.bindEvent();
|
|
39
|
-
return _this;
|
|
9
|
+
export class PerspectiveCameraExpand extends EventDispatcher {
|
|
10
|
+
constructor(camera, controls, sceneControl) {
|
|
11
|
+
super();
|
|
12
|
+
_defineProperty(this, "_isTransitionPeriod", false);
|
|
13
|
+
_defineProperty(this, "camera", void 0);
|
|
14
|
+
_defineProperty(this, "controls", void 0);
|
|
15
|
+
_defineProperty(this, "sceneControl", void 0);
|
|
16
|
+
_defineProperty(this, "tween", void 0);
|
|
17
|
+
_defineProperty(this, "_isCameraChange", false);
|
|
18
|
+
_defineProperty(this, "followId", 0);
|
|
19
|
+
_defineProperty(this, "followCancelMap", new Map());
|
|
20
|
+
this.camera = camera;
|
|
21
|
+
this.controls = controls;
|
|
22
|
+
this.sceneControl = sceneControl;
|
|
23
|
+
this.bindEvent();
|
|
40
24
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
_this2._isCameraChange = false;
|
|
62
|
-
});
|
|
63
|
-
this.controls.addEventListener('change', function () {
|
|
64
|
-
_this2.dispatchEvent({
|
|
65
|
-
type: 'change',
|
|
66
|
-
position: _this2.camera.position,
|
|
67
|
-
target: _this2.controls.target
|
|
68
|
-
});
|
|
25
|
+
get isTransitionPeriod() {
|
|
26
|
+
return this._isTransitionPeriod;
|
|
27
|
+
}
|
|
28
|
+
get isCameraChange() {
|
|
29
|
+
return this._isCameraChange;
|
|
30
|
+
}
|
|
31
|
+
bindEvent() {
|
|
32
|
+
this.controls.addEventListener('start', () => {
|
|
33
|
+
utils.storeManagement.set('enableEvents', false);
|
|
34
|
+
this._isCameraChange = true;
|
|
35
|
+
});
|
|
36
|
+
this.controls.addEventListener('end', () => {
|
|
37
|
+
utils.storeManagement.set('enableEvents', true);
|
|
38
|
+
this._isCameraChange = false;
|
|
39
|
+
});
|
|
40
|
+
this.controls.addEventListener('change', () => {
|
|
41
|
+
this.dispatchEvent({
|
|
42
|
+
type: 'change',
|
|
43
|
+
position: this.camera.position,
|
|
44
|
+
target: this.controls.target
|
|
69
45
|
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* calculate last position from position box
|
|
74
|
-
* if distance is not defined, calculate distance from box size
|
|
75
|
-
* @param currentPos
|
|
76
|
-
* @param distanceCoefficient
|
|
77
|
-
* @param distance
|
|
78
|
-
* @returns
|
|
79
|
-
*/
|
|
80
|
-
}, {
|
|
81
|
-
key: "caclCurrentPos",
|
|
82
|
-
value: function caclCurrentPos(currentPos) {
|
|
83
|
-
var distanceCoefficient = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
84
|
-
var distance = arguments.length > 2 ? arguments[2] : undefined;
|
|
85
|
-
var box = new Box3();
|
|
86
|
-
box.setFromPoints(currentPos.map(function (item) {
|
|
87
|
-
return new Vector3(item[0], item[1], item[2]);
|
|
88
|
-
}));
|
|
89
|
-
var center = box.getCenter(new Vector3());
|
|
90
|
-
var size = box.getSize(new Vector3());
|
|
91
|
-
var halfDiagonal = size.length() * 0.5;
|
|
92
|
-
var maxDistance = halfDiagonal / Math.tan(this.camera.fov / 2 * Math.PI / 180);
|
|
93
|
-
var cameraToCenterDistance = maxDistance;
|
|
94
|
-
var directionVector = this.camera.position.clone().sub(this.controls.target).normalize();
|
|
95
|
-
var lastPosition = directionVector.multiplyScalar(distance !== null && distance !== void 0 ? distance : cameraToCenterDistance * distanceCoefficient).add(center);
|
|
96
|
-
var lastLookat = center;
|
|
97
|
-
return {
|
|
98
|
-
lastPosition: lastPosition,
|
|
99
|
-
lastLookat: lastLookat
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* caclSingleCoordinate, when use focus and target is single point
|
|
105
|
-
* @param prevTarget
|
|
106
|
-
* @param prevPosition
|
|
107
|
-
* @param lastTarget
|
|
108
|
-
* @returns
|
|
109
|
-
*/
|
|
110
|
-
}, {
|
|
111
|
-
key: "caclSingleCoordinate",
|
|
112
|
-
value: function caclSingleCoordinate(prevTarget, prevPosition, lastTarget, distance) {
|
|
113
|
-
var directionVector = prevPosition.clone().sub(prevTarget).normalize();
|
|
114
|
-
var lastPosition = directionVector.multiplyScalar(distance).add(lastTarget);
|
|
115
|
-
return lastPosition;
|
|
116
|
-
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
117
48
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
duration: (_ref = duration && duration * 1000) !== null && _ref !== void 0 ? _ref : 1000,
|
|
143
|
-
isTrigger: (_params$isTrigger = params.isTrigger) !== null && _params$isTrigger !== void 0 ? _params$isTrigger : true,
|
|
144
|
-
onUpdate: function onUpdate(_ref2) {
|
|
145
|
-
var position = _ref2.position,
|
|
146
|
-
lookat = _ref2.lookat;
|
|
147
|
-
_onUpdate && _onUpdate({
|
|
148
|
-
position: position,
|
|
149
|
-
target: lookat
|
|
150
|
-
});
|
|
151
|
-
},
|
|
152
|
-
onComplate: function onComplate() {
|
|
153
|
-
var _params$duration;
|
|
154
|
-
res({
|
|
155
|
-
position: _this3.camera.position.toArray(),
|
|
156
|
-
target: _this3.controls.target.toArray(),
|
|
157
|
-
duration: (_params$duration = params.duration) !== null && _params$duration !== void 0 ? _params$duration : 0,
|
|
158
|
-
userInput: true,
|
|
159
|
-
pitch: pitch !== null && pitch !== void 0 ? pitch : 40
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
};
|
|
49
|
+
/**
|
|
50
|
+
* calculate last position from position box
|
|
51
|
+
* if distance is not defined, calculate distance from box size
|
|
52
|
+
* @param currentPos
|
|
53
|
+
* @param distanceCoefficient
|
|
54
|
+
* @param distance
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
caclCurrentPos(currentPos, distanceCoefficient = 1, distance) {
|
|
58
|
+
const box = new Box3();
|
|
59
|
+
box.setFromPoints(currentPos.map(item => new Vector3(item[0], item[1], item[2])));
|
|
60
|
+
const center = box.getCenter(new Vector3());
|
|
61
|
+
const size = box.getSize(new Vector3());
|
|
62
|
+
const halfDiagonal = size.length() * 0.5;
|
|
63
|
+
const maxDistance = halfDiagonal / Math.tan(this.camera.fov / 2 * Math.PI / 180);
|
|
64
|
+
const cameraToCenterDistance = maxDistance;
|
|
65
|
+
const directionVector = this.camera.position.clone().sub(this.controls.target).normalize();
|
|
66
|
+
const lastPosition = directionVector.multiplyScalar(distance !== null && distance !== void 0 ? distance : cameraToCenterDistance * distanceCoefficient).add(center);
|
|
67
|
+
const lastLookat = center;
|
|
68
|
+
return {
|
|
69
|
+
lastPosition,
|
|
70
|
+
lastLookat
|
|
71
|
+
};
|
|
72
|
+
}
|
|
164
73
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
var _lastLookat = new Vector3().fromArray(_currentPos);
|
|
178
|
-
_this3.motion(_lastPosition, _lastLookat, pitch, yaw, moveOptions());
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
74
|
+
/**
|
|
75
|
+
* caclSingleCoordinate, when use focus and target is single point
|
|
76
|
+
* @param prevTarget
|
|
77
|
+
* @param prevPosition
|
|
78
|
+
* @param lastTarget
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
81
|
+
caclSingleCoordinate(prevTarget, prevPosition, lastTarget, distance) {
|
|
82
|
+
const directionVector = prevPosition.clone().sub(prevTarget).normalize();
|
|
83
|
+
const lastPosition = directionVector.multiplyScalar(distance).add(lastTarget);
|
|
84
|
+
return lastPosition;
|
|
85
|
+
}
|
|
182
86
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
duration
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
87
|
+
/**
|
|
88
|
+
* camera focus
|
|
89
|
+
* @param params
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
92
|
+
focus(params) {
|
|
93
|
+
return new Promise(res => {
|
|
94
|
+
const {
|
|
95
|
+
target: position,
|
|
96
|
+
pitch = 0,
|
|
97
|
+
yaw = 0,
|
|
98
|
+
distance = undefined,
|
|
99
|
+
duration,
|
|
100
|
+
onUpdate,
|
|
101
|
+
distanceCoefficient = 1
|
|
102
|
+
} = params;
|
|
103
|
+
const moveOptions = () => {
|
|
104
|
+
var _ref, _params$isTrigger;
|
|
105
|
+
return {
|
|
106
|
+
duration: (_ref = duration && duration * 1000) !== null && _ref !== void 0 ? _ref : 1000,
|
|
107
|
+
isTrigger: (_params$isTrigger = params.isTrigger) !== null && _params$isTrigger !== void 0 ? _params$isTrigger : true,
|
|
108
|
+
onUpdate: ({
|
|
109
|
+
position,
|
|
110
|
+
lookat
|
|
111
|
+
}) => {
|
|
112
|
+
onUpdate && onUpdate({
|
|
113
|
+
position,
|
|
206
114
|
target: lookat
|
|
207
115
|
});
|
|
208
116
|
},
|
|
209
|
-
onComplate:
|
|
210
|
-
var _params$
|
|
117
|
+
onComplate: () => {
|
|
118
|
+
var _params$duration;
|
|
211
119
|
res({
|
|
212
|
-
position:
|
|
213
|
-
target:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
120
|
+
position: this.camera.position.toArray(),
|
|
121
|
+
target: this.controls.target.toArray(),
|
|
122
|
+
duration: (_params$duration = params.duration) !== null && _params$duration !== void 0 ? _params$duration : 0,
|
|
123
|
+
userInput: true,
|
|
124
|
+
pitch: pitch !== null && pitch !== void 0 ? pitch : 40
|
|
217
125
|
});
|
|
218
126
|
}
|
|
219
|
-
}
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// if target is multiple points
|
|
131
|
+
if (Array.isArray(position[0])) {
|
|
132
|
+
const currentPos = position;
|
|
133
|
+
const {
|
|
134
|
+
lastPosition,
|
|
135
|
+
lastLookat
|
|
136
|
+
} = this.caclCurrentPos(currentPos, distanceCoefficient, distance);
|
|
137
|
+
this.motion(lastPosition, lastLookat, pitch, yaw, moveOptions());
|
|
138
|
+
}
|
|
139
|
+
// if target is single point
|
|
140
|
+
else {
|
|
141
|
+
const currentPos = position;
|
|
142
|
+
const lastPosition = this.caclSingleCoordinate(this.controls.target, this.camera.position, new Vector3().fromArray(currentPos), distance);
|
|
143
|
+
const lastLookat = new Vector3().fromArray(currentPos);
|
|
144
|
+
this.motion(lastPosition, lastLookat, pitch, yaw, moveOptions());
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* set camera, main set position and target
|
|
151
|
+
* @param params
|
|
152
|
+
* @returns
|
|
153
|
+
*/
|
|
154
|
+
set(params) {
|
|
155
|
+
const {
|
|
156
|
+
position,
|
|
157
|
+
target,
|
|
158
|
+
isTrigger,
|
|
159
|
+
duration
|
|
160
|
+
} = params;
|
|
161
|
+
return new Promise((res, _) => {
|
|
162
|
+
var _ref2;
|
|
163
|
+
this.motion(new Vector3(position[0], position[1], position[2]), new Vector3(target[0], target[1], target[2]), 0, 0, {
|
|
164
|
+
isTrigger: isTrigger !== null && isTrigger !== void 0 ? isTrigger : true,
|
|
165
|
+
duration: (_ref2 = duration && duration * 1000) !== null && _ref2 !== void 0 ? _ref2 : 1000,
|
|
166
|
+
onUpdate: ({
|
|
167
|
+
position,
|
|
168
|
+
lookat
|
|
169
|
+
}) => {
|
|
170
|
+
params.onUpdate && params.onUpdate({
|
|
171
|
+
position,
|
|
172
|
+
target: lookat
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
onComplate: () => {
|
|
176
|
+
var _params$duration2;
|
|
177
|
+
res({
|
|
178
|
+
position: this.camera.position.toArray(),
|
|
179
|
+
target: this.controls.target.toArray(),
|
|
180
|
+
isTrigger: true,
|
|
181
|
+
duration: (_params$duration2 = params.duration) !== null && _params$duration2 !== void 0 ? _params$duration2 : 0,
|
|
182
|
+
userInput: true
|
|
183
|
+
});
|
|
184
|
+
}
|
|
220
185
|
});
|
|
221
|
-
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
222
188
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
};
|
|
234
|
-
}
|
|
189
|
+
/**
|
|
190
|
+
* get camera position and target
|
|
191
|
+
* @returns
|
|
192
|
+
*/
|
|
193
|
+
get() {
|
|
194
|
+
return {
|
|
195
|
+
position: [this.camera.position.x, this.camera.position.y, this.camera.position.z],
|
|
196
|
+
target: [this.controls.target.x, this.controls.target.y, this.controls.target.z]
|
|
197
|
+
};
|
|
198
|
+
}
|
|
235
199
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
return -(MathUtils.radToDeg(plane.normal.angleTo(currentDirection)) - 90);
|
|
247
|
-
}
|
|
200
|
+
/**
|
|
201
|
+
* get current pitch
|
|
202
|
+
*/
|
|
203
|
+
get pitch() {
|
|
204
|
+
const targetPosition = this.controls.target;
|
|
205
|
+
const cameraPosition = this.camera.position;
|
|
206
|
+
const currentDirection = cameraPosition.clone().sub(targetPosition);
|
|
207
|
+
const plane = new Plane(new Vector3(0, 1, 0), 0);
|
|
208
|
+
return -(MathUtils.radToDeg(plane.normal.angleTo(currentDirection)) - 90);
|
|
209
|
+
}
|
|
248
210
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
return this.camera.rotationParent.y;
|
|
257
|
-
}
|
|
211
|
+
/**
|
|
212
|
+
* get current yaw
|
|
213
|
+
* @returns
|
|
214
|
+
*/
|
|
215
|
+
get yaw() {
|
|
216
|
+
return this.camera.rotationParent.y;
|
|
217
|
+
}
|
|
258
218
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
this.camera.position.copy(cameraPosition);
|
|
278
|
-
}
|
|
219
|
+
/**
|
|
220
|
+
* set pitch, similar to ue
|
|
221
|
+
* @param deg
|
|
222
|
+
*/
|
|
223
|
+
setPitch(deg) {
|
|
224
|
+
if (deg > 90) deg = 90;
|
|
225
|
+
if (deg < -90) deg = -90;
|
|
226
|
+
const direction = new Vector3(0, 0, 1);
|
|
227
|
+
const quaternion = new Quaternion();
|
|
228
|
+
const pitchQuat = new Quaternion();
|
|
229
|
+
pitchQuat.setFromAxisAngle(new Vector3(1, 0, 0), MathUtils.degToRad(-deg));
|
|
230
|
+
quaternion.multiply(pitchQuat);
|
|
231
|
+
direction.applyQuaternion(quaternion);
|
|
232
|
+
direction.normalize();
|
|
233
|
+
const distance = this.camera.position.distanceTo(this.controls.target);
|
|
234
|
+
const cameraPosition = this.controls.target.clone().add(direction.multiplyScalar(distance));
|
|
235
|
+
this.camera.position.copy(cameraPosition);
|
|
236
|
+
}
|
|
279
237
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
if (deg > 180) deg = 180;
|
|
288
|
-
if (deg < -180) deg = -180;
|
|
238
|
+
/**
|
|
239
|
+
* set yaw, similar to ue
|
|
240
|
+
* @param deg
|
|
241
|
+
*/
|
|
242
|
+
setYaw(deg) {
|
|
243
|
+
if (deg > 180) deg = 180;
|
|
244
|
+
if (deg < -180) deg = -180;
|
|
289
245
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
246
|
+
// @ts-ignore
|
|
247
|
+
this.camera.rotationParent.y = MathUtils.degToRad(deg);
|
|
248
|
+
}
|
|
293
249
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
position.addScaledVector(axisZ, distance);
|
|
316
|
-
position.applyQuaternion(quaternionX);
|
|
317
|
-
position.applyQuaternion(quaternionY);
|
|
318
|
-
return position;
|
|
319
|
-
}
|
|
250
|
+
/**
|
|
251
|
+
* cacl Position By Follow
|
|
252
|
+
* @param pitch
|
|
253
|
+
* @param yaw
|
|
254
|
+
* @param distance
|
|
255
|
+
* @returns
|
|
256
|
+
*/
|
|
257
|
+
caclPositionByFollow(pitch = 30, yaw = 0, distance = 60) {
|
|
258
|
+
const axisX = new Vector3(1, 0, 0);
|
|
259
|
+
const axisY = new Vector3(0, 1, 0);
|
|
260
|
+
const axisZ = new Vector3(0, 0, -1);
|
|
261
|
+
const position = new Vector3(0, 0, 0);
|
|
262
|
+
const anglePitch = MathUtils.degToRad(pitch);
|
|
263
|
+
const angleYaw = MathUtils.degToRad(yaw);
|
|
264
|
+
const quaternionX = new Quaternion().setFromAxisAngle(axisX, anglePitch);
|
|
265
|
+
const quaternionY = new Quaternion().setFromAxisAngle(axisY, angleYaw);
|
|
266
|
+
position.addScaledVector(axisZ, distance);
|
|
267
|
+
position.applyQuaternion(quaternionX);
|
|
268
|
+
position.applyQuaternion(quaternionY);
|
|
269
|
+
return position;
|
|
270
|
+
}
|
|
320
271
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
272
|
+
/**
|
|
273
|
+
* follow 3d object, not only use in camera
|
|
274
|
+
* @param target
|
|
275
|
+
* @param camera
|
|
276
|
+
* @param option
|
|
277
|
+
* @returns
|
|
278
|
+
*/
|
|
279
|
+
follow(target, camera, option) {
|
|
280
|
+
const followId = this.followId++;
|
|
281
|
+
const {
|
|
282
|
+
relativeRotation = false,
|
|
283
|
+
pitch = 30,
|
|
284
|
+
yaw = 0,
|
|
285
|
+
distance = 10
|
|
286
|
+
} = option || {};
|
|
287
|
+
const container = new Group();
|
|
288
|
+
container.rotation.copy(target.rotation);
|
|
289
|
+
container.scale.copy(target.scale);
|
|
290
|
+
const oldCameraParent = camera.parent;
|
|
291
|
+
let needUpdateRotation = true;
|
|
292
|
+
container.add(camera);
|
|
293
|
+
target.parent.add(container);
|
|
294
|
+
this.controls.enabled = false;
|
|
295
|
+
const followControls = new FollowControls(this.camera, this.sceneControl.renderer.domElement);
|
|
296
|
+
const curPosition = this.caclPositionByFollow(pitch, yaw, distance);
|
|
297
|
+
camera.position.copy(curPosition);
|
|
298
|
+
followControls.radius = camera.position.distanceTo(target.position);
|
|
299
|
+
followControls.addEventListener('start', () => {
|
|
300
|
+
relativeRotation && (needUpdateRotation = false);
|
|
301
|
+
});
|
|
302
|
+
this.controls.target.copy(target.position);
|
|
303
|
+
followControls.target = target.position;
|
|
304
|
+
const cancelMotion = use.useframe(() => {
|
|
305
|
+
container.position.copy(target.position);
|
|
344
306
|
container.scale.copy(target.scale);
|
|
345
|
-
|
|
346
|
-
var needUpdateRotation = true;
|
|
347
|
-
container.add(camera);
|
|
348
|
-
target.parent.add(container);
|
|
349
|
-
this.controls.enabled = false;
|
|
350
|
-
var followControls = new FollowControls(this.camera, this.sceneControl.renderer.domElement);
|
|
351
|
-
var curPosition = this.caclPositionByFollow(pitch, yaw, distance);
|
|
352
|
-
camera.position.copy(curPosition);
|
|
353
|
-
followControls.radius = camera.position.distanceTo(target.position);
|
|
354
|
-
followControls.addEventListener('start', function () {
|
|
355
|
-
relativeRotation && (needUpdateRotation = false);
|
|
356
|
-
});
|
|
307
|
+
needUpdateRotation && container.rotation.copy(target.rotation);
|
|
357
308
|
this.controls.target.copy(target.position);
|
|
358
309
|
followControls.target = target.position;
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
cancelMotion();
|
|
372
|
-
followControls.dispose();
|
|
373
|
-
};
|
|
374
|
-
this.followCancelMap.set(followId, cancel);
|
|
375
|
-
return followId;
|
|
376
|
-
}
|
|
310
|
+
followControls.update();
|
|
311
|
+
});
|
|
312
|
+
const cancel = () => {
|
|
313
|
+
this.controls.enabled = true;
|
|
314
|
+
oldCameraParent.add(camera);
|
|
315
|
+
target.parent.remove(container);
|
|
316
|
+
cancelMotion();
|
|
317
|
+
followControls.dispose();
|
|
318
|
+
};
|
|
319
|
+
this.followCancelMap.set(followId, cancel);
|
|
320
|
+
return followId;
|
|
321
|
+
}
|
|
377
322
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
cancel && cancel();
|
|
387
|
-
}
|
|
323
|
+
/**
|
|
324
|
+
* cancel follow
|
|
325
|
+
* @param followId
|
|
326
|
+
*/
|
|
327
|
+
cancelFollow(followId) {
|
|
328
|
+
const cancel = this.followCancelMap.get(followId);
|
|
329
|
+
cancel && cancel();
|
|
330
|
+
}
|
|
388
331
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
});
|
|
398
|
-
}
|
|
332
|
+
/**
|
|
333
|
+
* cancel all follow
|
|
334
|
+
*/
|
|
335
|
+
cancelAllFollow() {
|
|
336
|
+
this.followCancelMap.forEach(cancel => {
|
|
337
|
+
cancel();
|
|
338
|
+
});
|
|
339
|
+
}
|
|
399
340
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
if ((options === null || options === void 0 ? void 0 : options.duration) === 0) {
|
|
419
|
-
this.camera.position.copy(position);
|
|
420
|
-
this.controls.target.copy(target);
|
|
421
|
-
if (pitch) {
|
|
422
|
-
// @ts-ignore
|
|
423
|
-
this.camera.rotationParent.x = MathUtils.degToRad(pitch);
|
|
424
|
-
}
|
|
425
|
-
if (yaw) {
|
|
426
|
-
// @ts-ignore
|
|
427
|
-
this.camera.rotationParent.y = MathUtils.degToRad(yaw);
|
|
428
|
-
}
|
|
429
|
-
requestAnimationFrame(function () {
|
|
430
|
-
(options === null || options === void 0 ? void 0 : options.onComplate) && options.onComplate();
|
|
431
|
-
_this6.sceneControl.renderer.render(_this6.sceneControl.scene, _this6.sceneControl.camera);
|
|
432
|
-
});
|
|
433
|
-
return;
|
|
341
|
+
/**
|
|
342
|
+
* interpolation move camera
|
|
343
|
+
* @param position
|
|
344
|
+
* @param target
|
|
345
|
+
* @param pitch
|
|
346
|
+
* @param yaw
|
|
347
|
+
* @param options
|
|
348
|
+
* @returns
|
|
349
|
+
*/
|
|
350
|
+
motion(position, target, pitch = 0, yaw = 0, options) {
|
|
351
|
+
const currentPoition = this.camera.position.clone();
|
|
352
|
+
const currentPositionInterpolation = new Vector3();
|
|
353
|
+
if ((options === null || options === void 0 ? void 0 : options.duration) === 0) {
|
|
354
|
+
this.camera.position.copy(position);
|
|
355
|
+
this.controls.target.copy(target);
|
|
356
|
+
if (pitch) {
|
|
357
|
+
// @ts-ignore
|
|
358
|
+
this.camera.rotationParent.x = MathUtils.degToRad(pitch);
|
|
434
359
|
}
|
|
435
|
-
if (
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
// @ts-ignore
|
|
445
|
-
.to({
|
|
446
|
-
t: 1,
|
|
447
|
-
lookat: target,
|
|
448
|
-
p: MathUtils.degToRad(pitch),
|
|
449
|
-
y: MathUtils.degToRad(yaw)
|
|
450
|
-
}, (options === null || options === void 0 ? void 0 : options.duration) || 1000).onStart(function () {
|
|
451
|
-
(options === null || options === void 0 ? void 0 : options.onStart) && options.onStart();
|
|
452
|
-
_this6.controls.enabled = false;
|
|
453
|
-
_this6._isTransitionPeriod = true;
|
|
454
|
-
}).easing(TWEEN.Easing.Quadratic.InOut).onUpdate(function (_ref6) {
|
|
455
|
-
var t = _ref6.t,
|
|
456
|
-
lookat = _ref6.lookat,
|
|
457
|
-
p = _ref6.p;
|
|
458
|
-
_this6.controls.target.copy(lookat);
|
|
459
|
-
if (pitch)
|
|
460
|
-
// @ts-ignore
|
|
461
|
-
_this6.camera.rotationParent.x = p;
|
|
462
|
-
if (yaw)
|
|
463
|
-
// @ts-ignore
|
|
464
|
-
_this6.camera.rotationParent.y = p;
|
|
465
|
-
var currentPosition = currentPositionInterpolation.lerpVectors(currentPoition, position, t);
|
|
466
|
-
_this6.camera.position.copy(currentPosition);
|
|
467
|
-
(options === null || options === void 0 ? void 0 : options.onUpdate) && options.onUpdate({
|
|
468
|
-
position: currentPosition,
|
|
469
|
-
lookat: lookat
|
|
470
|
-
});
|
|
471
|
-
}).onComplete(function () {
|
|
472
|
-
requestAnimationFrame(function () {
|
|
473
|
-
(options === null || options === void 0 ? void 0 : options.onComplate) && options.onComplate();
|
|
474
|
-
});
|
|
475
|
-
_this6.controls.enabled = true;
|
|
476
|
-
setTimeout(function () {
|
|
477
|
-
_this6._isTransitionPeriod = false;
|
|
478
|
-
});
|
|
479
|
-
}).start();
|
|
360
|
+
if (yaw) {
|
|
361
|
+
// @ts-ignore
|
|
362
|
+
this.camera.rotationParent.y = MathUtils.degToRad(yaw);
|
|
363
|
+
}
|
|
364
|
+
requestAnimationFrame(() => {
|
|
365
|
+
(options === null || options === void 0 ? void 0 : options.onComplate) && options.onComplate();
|
|
366
|
+
this.sceneControl.renderer.render(this.sceneControl.scene, this.sceneControl.camera);
|
|
367
|
+
});
|
|
368
|
+
return;
|
|
480
369
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
370
|
+
if (this.tween) this.tween.stop();
|
|
371
|
+
this.tween = new TWEEN.Tween(
|
|
372
|
+
// @ts-ignore
|
|
373
|
+
{
|
|
374
|
+
t: 0,
|
|
375
|
+
lookat: this.controls.target.clone(),
|
|
376
|
+
p: this.camera.rotationParent.x,
|
|
377
|
+
yaw: this.camera.rotationParent.y
|
|
378
|
+
})
|
|
379
|
+
// @ts-ignore
|
|
380
|
+
.to({
|
|
381
|
+
t: 1,
|
|
382
|
+
lookat: target,
|
|
383
|
+
p: MathUtils.degToRad(pitch),
|
|
384
|
+
y: MathUtils.degToRad(yaw)
|
|
385
|
+
}, (options === null || options === void 0 ? void 0 : options.duration) || 1000).onStart(() => {
|
|
386
|
+
(options === null || options === void 0 ? void 0 : options.onStart) && options.onStart();
|
|
387
|
+
this.controls.enabled = false;
|
|
388
|
+
this._isTransitionPeriod = true;
|
|
389
|
+
}).easing(TWEEN.Easing.Quadratic.InOut).onUpdate(({
|
|
390
|
+
t,
|
|
391
|
+
lookat,
|
|
392
|
+
p
|
|
393
|
+
}) => {
|
|
394
|
+
this.controls.target.copy(lookat);
|
|
395
|
+
if (pitch)
|
|
396
|
+
// @ts-ignore
|
|
397
|
+
this.camera.rotationParent.x = p;
|
|
398
|
+
if (yaw)
|
|
399
|
+
// @ts-ignore
|
|
400
|
+
this.camera.rotationParent.y = p;
|
|
401
|
+
const currentPosition = currentPositionInterpolation.lerpVectors(currentPoition, position, t);
|
|
402
|
+
this.camera.position.copy(currentPosition);
|
|
403
|
+
(options === null || options === void 0 ? void 0 : options.onUpdate) && options.onUpdate({
|
|
404
|
+
position: currentPosition,
|
|
405
|
+
lookat
|
|
406
|
+
});
|
|
407
|
+
}).onComplete(() => {
|
|
408
|
+
requestAnimationFrame(() => {
|
|
409
|
+
(options === null || options === void 0 ? void 0 : options.onComplate) && options.onComplate();
|
|
410
|
+
});
|
|
411
|
+
this.controls.enabled = true;
|
|
412
|
+
setTimeout(() => {
|
|
413
|
+
this._isTransitionPeriod = false;
|
|
414
|
+
});
|
|
415
|
+
}).start();
|
|
416
|
+
}
|
|
417
|
+
}
|
|
484
418
|
//# sourceMappingURL=CameraExpand.js.map
|