@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.
Files changed (266) hide show
  1. package/dist/business/Animation/motion/index.js +35 -56
  2. package/dist/business/Animation/motion/index.js.map +1 -1
  3. package/dist/business/Animation/type.js +2 -2
  4. package/dist/business/Area/Fence/FenceBase.js +146 -187
  5. package/dist/business/Area/Fence/FenceBase.js.map +1 -1
  6. package/dist/business/Area/Fence/fence_base_01.js +120 -112
  7. package/dist/business/Area/Fence/fence_base_01.js.map +1 -1
  8. package/dist/business/Area/Fence/fence_feeting_01.js +218 -130
  9. package/dist/business/Area/Fence/fence_feeting_01.js.map +1 -1
  10. package/dist/business/Area/Fence/fence_roll_01.js +140 -130
  11. package/dist/business/Area/Fence/fence_roll_01.js.map +1 -1
  12. package/dist/business/Area/FillArea/FillAreaBase.js +87 -126
  13. package/dist/business/Area/FillArea/FillAreaBase.js.map +1 -1
  14. package/dist/business/Area/FillArea/fillArea_face_01.js +72 -98
  15. package/dist/business/Area/FillArea/fillArea_face_01.js.map +1 -1
  16. package/dist/business/Area/FillArea/fillArea_line_01.js +66 -94
  17. package/dist/business/Area/FillArea/fillArea_line_01.js.map +1 -1
  18. package/dist/business/Area/index.js +267 -483
  19. package/dist/business/Area/index.js.map +1 -1
  20. package/dist/business/Area/tool.js +14 -26
  21. package/dist/business/Area/tool.js.map +1 -1
  22. package/dist/business/Base/ObjectLayer.js +21 -46
  23. package/dist/business/Base/ObjectLayer.js.map +1 -1
  24. package/dist/business/Batch/index.js +189 -234
  25. package/dist/business/Batch/index.js.map +1 -1
  26. package/dist/business/Box/index.js +52 -81
  27. package/dist/business/Box/index.js.map +1 -1
  28. package/dist/business/Cylinder/index.js +51 -79
  29. package/dist/business/Cylinder/index.js.map +1 -1
  30. package/dist/business/Flyline/bubble/CircleBubble.js +1 -9
  31. package/dist/business/Flyline/bubble/CircleBubble.js.map +1 -1
  32. package/dist/business/Flyline/bubble/index.js +7 -21
  33. package/dist/business/Flyline/bubble/index.js.map +1 -1
  34. package/dist/business/Flyline/index.js +96 -162
  35. package/dist/business/Flyline/index.js.map +1 -1
  36. package/dist/business/Flyline/line/ArcLine.js +208 -291
  37. package/dist/business/Flyline/line/ArcLine.js.map +1 -1
  38. package/dist/business/Flyline/line/index.js +8 -22
  39. package/dist/business/Flyline/line/index.js.map +1 -1
  40. package/dist/business/HeatMap/HeatMap.js +380 -467
  41. package/dist/business/HeatMap/HeatMap.js.map +1 -1
  42. package/dist/business/HeatMap/core.js +405 -525
  43. package/dist/business/HeatMap/core.js.map +1 -1
  44. package/dist/business/HeatMap/shader.js +69 -3
  45. package/dist/business/HeatMap/shader.js.map +1 -1
  46. package/dist/business/InfoPanel/index.js +201 -242
  47. package/dist/business/InfoPanel/index.js.map +1 -1
  48. package/dist/business/Line/index.js +55 -88
  49. package/dist/business/Line/index.js.map +1 -1
  50. package/dist/business/Mark/KeyframeAnimation.js +145 -176
  51. package/dist/business/Mark/KeyframeAnimation.js.map +1 -1
  52. package/dist/business/Mark/index.js +196 -294
  53. package/dist/business/Mark/index.js.map +1 -1
  54. package/dist/business/Mark/shader/tanhao.js +36 -3
  55. package/dist/business/Mark/shader/tanhao.js.map +1 -1
  56. package/dist/business/Mark/type.js +1 -1
  57. package/dist/business/MaterialSwitch/MaterialSwitchSystem.js +377 -551
  58. package/dist/business/MaterialSwitch/MaterialSwitchSystem.js.map +1 -1
  59. package/dist/business/MaterialSwitch/inject.js +92 -58
  60. package/dist/business/MaterialSwitch/inject.js.map +1 -1
  61. package/dist/business/MaterialSwitch/shader/finalFade.js +74 -2
  62. package/dist/business/MaterialSwitch/shader/finalFade.js.map +1 -1
  63. package/dist/business/MaterialSwitch/shader/ground.js +95 -16
  64. package/dist/business/MaterialSwitch/shader/ground.js.map +1 -1
  65. package/dist/business/MaterialSwitch/shader/groundBase64.js +9 -3
  66. package/dist/business/MaterialSwitch/shader/groundBase64.js.map +1 -1
  67. package/dist/business/MaterialSwitch/shader/realFade.js +48 -9
  68. package/dist/business/MaterialSwitch/shader/realFade.js.map +1 -1
  69. package/dist/business/Plane/index.js +51 -78
  70. package/dist/business/Plane/index.js.map +1 -1
  71. package/dist/business/Poi/index.d.ts +5 -0
  72. package/dist/business/Poi/index.js +256 -295
  73. package/dist/business/Poi/index.js.map +1 -1
  74. package/dist/business/Poi/link/Cylinder.js +56 -89
  75. package/dist/business/Poi/link/Cylinder.js.map +1 -1
  76. package/dist/business/Poi/link/Pyramid.js +104 -165
  77. package/dist/business/Poi/link/Pyramid.js.map +1 -1
  78. package/dist/business/Poi/link/index.d.ts +1 -1
  79. package/dist/business/Poi/link/index.js +54 -114
  80. package/dist/business/Poi/link/index.js.map +1 -1
  81. package/dist/business/Poi/panel/index.d.ts +124 -0
  82. package/dist/business/Poi/panel/index.js +474 -0
  83. package/dist/business/Poi/panel/index.js.map +1 -0
  84. package/dist/business/Poi/panel/interfaces.d.ts +67 -0
  85. package/dist/business/Poi/panel/interfaces.js +2 -0
  86. package/dist/business/Poi/panel/interfaces.js.map +1 -0
  87. package/dist/business/Poi/panel/utils.d.ts +72 -0
  88. package/dist/business/Poi/panel/utils.js +126 -0
  89. package/dist/business/Poi/panel/utils.js.map +1 -0
  90. package/dist/business/Poi/particle/DoubleCircle.js +71 -107
  91. package/dist/business/Poi/particle/DoubleCircle.js.map +1 -1
  92. package/dist/business/Poi/particle/DynamicCircle.js +75 -111
  93. package/dist/business/Poi/particle/DynamicCircle.js.map +1 -1
  94. package/dist/business/Poi/particle/SingleCircle.js +62 -98
  95. package/dist/business/Poi/particle/SingleCircle.js.map +1 -1
  96. package/dist/business/Poi/particle/index.js +49 -117
  97. package/dist/business/Poi/particle/index.js.map +1 -1
  98. package/dist/business/Poi/shader/circle.js +31 -3
  99. package/dist/business/Poi/shader/circle.js.map +1 -1
  100. package/dist/business/Poi/shader/cylinder.js +37 -3
  101. package/dist/business/Poi/shader/cylinder.js.map +1 -1
  102. package/dist/business/Poi/shader/doubleCircle.js +55 -3
  103. package/dist/business/Poi/shader/doubleCircle.js.map +1 -1
  104. package/dist/business/Poi/shader/dynamicCircle.js +67 -3
  105. package/dist/business/Poi/shader/dynamicCircle.js.map +1 -1
  106. package/dist/business/Poi/title/Border.js +7 -27
  107. package/dist/business/Poi/title/Border.js.map +1 -1
  108. package/dist/business/Poi/title/Ellipse.js +7 -27
  109. package/dist/business/Poi/title/Ellipse.js.map +1 -1
  110. package/dist/business/Poi/title/index.js +208 -292
  111. package/dist/business/Poi/title/index.js.map +1 -1
  112. package/dist/business/Poi/tools.js +22 -19
  113. package/dist/business/Poi/tools.js.map +1 -1
  114. package/dist/business/Poi/types.d.ts +3 -0
  115. package/dist/business/Poi/types.js.map +1 -1
  116. package/dist/business/Sphere/index.js +47 -72
  117. package/dist/business/Sphere/index.js.map +1 -1
  118. package/dist/business/Spline/index.js +190 -245
  119. package/dist/business/Spline/index.js.map +1 -1
  120. package/dist/business/SplitBuilding/index.js +327 -536
  121. package/dist/business/SplitBuilding/index.js.map +1 -1
  122. package/dist/business/SplitBuilding/type.js +2 -2
  123. package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js +218 -275
  124. package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js.map +1 -1
  125. package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js +132 -177
  126. package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js.map +1 -1
  127. package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js +51 -1
  128. package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js.map +1 -1
  129. package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js +6 -1
  130. package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js.map +1 -1
  131. package/dist/business/TrafficComponents/base.js +32 -55
  132. package/dist/business/TrafficComponents/base.js.map +1 -1
  133. package/dist/business/TrafficComponents/utils.d.ts +1 -1
  134. package/dist/business/TrafficComponents/utils.js +26 -25
  135. package/dist/business/TrafficComponents/utils.js.map +1 -1
  136. package/dist/business/Utils/Curve.js +40 -56
  137. package/dist/business/Utils/Curve.js.map +1 -1
  138. package/dist/business/Utils/constant.js +1 -1
  139. package/dist/business/Utils/constant.js.map +1 -1
  140. package/dist/business/Utils/defineProps.js +13 -14
  141. package/dist/business/Utils/defineProps.js.map +1 -1
  142. package/dist/business/Utils/round-curve.js +127 -153
  143. package/dist/business/Utils/round-curve.js.map +1 -1
  144. package/dist/business/VideoPanel/index.js +258 -319
  145. package/dist/business/VideoPanel/index.js.map +1 -1
  146. package/dist/business/Water/index.js +78 -108
  147. package/dist/business/Water/index.js.map +1 -1
  148. package/dist/business/Water/types.js +1 -1
  149. package/dist/business/Water/types.js.map +1 -1
  150. package/dist/core/Camera/PerspectiveCamera/CameraExpand.js +383 -449
  151. package/dist/core/Camera/PerspectiveCamera/CameraExpand.js.map +1 -1
  152. package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js +107 -142
  153. package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js.map +1 -1
  154. package/dist/core/Controls/FirstViewControl/index.js +84 -96
  155. package/dist/core/Controls/FirstViewControl/index.js.map +1 -1
  156. package/dist/core/Controls/ThirdViewControl/action/input.js +77 -98
  157. package/dist/core/Controls/ThirdViewControl/action/input.js.map +1 -1
  158. package/dist/core/Controls/ThirdViewControl/config/constants.js +1 -1
  159. package/dist/core/Controls/ThirdViewControl/config/constants.js.map +1 -1
  160. package/dist/core/Controls/ThirdViewControl/index.js +19 -28
  161. package/dist/core/Controls/ThirdViewControl/index.js.map +1 -1
  162. package/dist/core/Controls/ThirdViewControl/player/animation.js +126 -155
  163. package/dist/core/Controls/ThirdViewControl/player/animation.js.map +1 -1
  164. package/dist/core/Controls/ThirdViewControl/player/camera.js +47 -63
  165. package/dist/core/Controls/ThirdViewControl/player/camera.js.map +1 -1
  166. package/dist/core/Controls/ThirdViewControl/player/control.js +39 -49
  167. package/dist/core/Controls/ThirdViewControl/player/control.js.map +1 -1
  168. package/dist/core/Controls/ThirdViewControl/player.js +66 -91
  169. package/dist/core/Controls/ThirdViewControl/player.js.map +1 -1
  170. package/dist/core/Controls/base.js +14 -30
  171. package/dist/core/Controls/base.js.map +1 -1
  172. package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js +92 -131
  173. package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js.map +1 -1
  174. package/dist/core/Debug/PerformanceInfo/Performance.js +22 -47
  175. package/dist/core/Debug/PerformanceInfo/Performance.js.map +1 -1
  176. package/dist/core/Light/PointLight/PointLightExt.js +4 -21
  177. package/dist/core/Light/PointLight/PointLightExt.js.map +1 -1
  178. package/dist/core/Material/FinirMaterial/FinirMaterial.js +37 -57
  179. package/dist/core/Material/FinirMaterial/FinirMaterial.js.map +1 -1
  180. package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js +116 -153
  181. package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js.map +1 -1
  182. package/dist/core/Material/PristineGridMaterial/shader/fragment.js +95 -1
  183. package/dist/core/Material/PristineGridMaterial/shader/fragment.js.map +1 -1
  184. package/dist/core/Material/PristineGridMaterial/shader/vertex.js +26 -1
  185. package/dist/core/Material/PristineGridMaterial/shader/vertex.js.map +1 -1
  186. package/dist/core/Material/SurfaceMaterial/index.js +76 -172
  187. package/dist/core/Material/SurfaceMaterial/index.js.map +1 -1
  188. package/dist/core/Material/decorators.js +6 -11
  189. package/dist/core/Material/decorators.js.map +1 -1
  190. package/dist/core/PostEffects/addACESFilmicToneMappingPass.js +16 -12
  191. package/dist/core/PostEffects/addACESFilmicToneMappingPass.js.map +1 -1
  192. package/dist/core/PostEffects/addBrightnessContrastPass.js +17 -13
  193. package/dist/core/PostEffects/addBrightnessContrastPass.js.map +1 -1
  194. package/dist/core/PostEffects/bloomPass.js +17 -10
  195. package/dist/core/PostEffects/bloomPass.js.map +1 -1
  196. package/dist/core/PostEffects/bloomSelect.js +60 -43
  197. package/dist/core/PostEffects/bloomSelect.js.map +1 -1
  198. package/dist/core/PostEffects/colorifyPass.js +17 -13
  199. package/dist/core/PostEffects/colorifyPass.js.map +1 -1
  200. package/dist/core/PostEffects/index.js +28 -22
  201. package/dist/core/PostEffects/index.js.map +1 -1
  202. package/dist/core/PostEffects/outlinePass.js +37 -50
  203. package/dist/core/PostEffects/outlinePass.js.map +1 -1
  204. package/dist/core/PostEffects/postprocessing.js +14 -12
  205. package/dist/core/PostEffects/postprocessing.js.map +1 -1
  206. package/dist/core/PostEffects/saoPass.js +15 -10
  207. package/dist/core/PostEffects/saoPass.js.map +1 -1
  208. package/dist/core/PostEffects/shader/colorify.js +22 -3
  209. package/dist/core/PostEffects/shader/colorify.js.map +1 -1
  210. package/dist/core/PostEffects/shader/gammaCorrectionShader.js +27 -3
  211. package/dist/core/PostEffects/shader/gammaCorrectionShader.js.map +1 -1
  212. package/dist/core/PostEffects/shader/mapping.js +66 -3
  213. package/dist/core/PostEffects/shader/mapping.js.map +1 -1
  214. package/dist/core/PostEffects/shader/thermalMaging.js +28 -3
  215. package/dist/core/PostEffects/shader/thermalMaging.js.map +1 -1
  216. package/dist/core/SceneEffect/grow/grow.js +85 -101
  217. package/dist/core/SceneEffect/grow/grow.js.map +1 -1
  218. package/dist/core/SceneEffect/grow/style_down.js +60 -77
  219. package/dist/core/SceneEffect/grow/style_down.js.map +1 -1
  220. package/dist/core/SceneEffect/grow/style_up.js +64 -81
  221. package/dist/core/SceneEffect/grow/style_up.js.map +1 -1
  222. package/dist/core/SceneEffect/grow/type.js +2 -2
  223. package/dist/core/SceneEffect/grow/type.js.map +1 -1
  224. package/dist/core/WeatherSystem/DynamicWeatherSystem.js +51 -76
  225. package/dist/core/WeatherSystem/DynamicWeatherSystem.js.map +1 -1
  226. package/dist/core/WeatherSystem/hdr/index.js +69 -105
  227. package/dist/core/WeatherSystem/hdr/index.js.map +1 -1
  228. package/dist/core/WeatherSystem/index.js +77 -124
  229. package/dist/core/WeatherSystem/index.js.map +1 -1
  230. package/dist/core/WeatherSystem/objects/fog/index.js +52 -80
  231. package/dist/core/WeatherSystem/objects/fog/index.js.map +1 -1
  232. package/dist/core/WeatherSystem/objects/rain/index.js +72 -84
  233. package/dist/core/WeatherSystem/objects/rain/index.js.map +1 -1
  234. package/dist/core/WeatherSystem/objects/rain/lineRain.js +88 -118
  235. package/dist/core/WeatherSystem/objects/rain/lineRain.js.map +1 -1
  236. package/dist/core/WeatherSystem/objects/rain/plane.js +116 -146
  237. package/dist/core/WeatherSystem/objects/rain/plane.js.map +1 -1
  238. package/dist/core/WeatherSystem/objects/rain/point.js +100 -148
  239. package/dist/core/WeatherSystem/objects/rain/point.js.map +1 -1
  240. package/dist/core/WeatherSystem/objects/sky/cloud.js +71 -104
  241. package/dist/core/WeatherSystem/objects/sky/cloud.js.map +1 -1
  242. package/dist/core/WeatherSystem/objects/sky/index.js +66 -84
  243. package/dist/core/WeatherSystem/objects/sky/index.js.map +1 -1
  244. package/dist/core/WeatherSystem/objects/sky/outline.js +25 -45
  245. package/dist/core/WeatherSystem/objects/sky/outline.js.map +1 -1
  246. package/dist/core/WeatherSystem/shaders/cloud.js +74 -3
  247. package/dist/core/WeatherSystem/shaders/cloud.js.map +1 -1
  248. package/dist/core/WeatherSystem/shaders/fog.js +103 -3
  249. package/dist/core/WeatherSystem/shaders/fog.js.map +1 -1
  250. package/dist/core/WeatherSystem/shaders/rain.js +206 -7
  251. package/dist/core/WeatherSystem/shaders/rain.js.map +1 -1
  252. package/dist/core/WeatherSystem/shaders/sky.js +87 -3
  253. package/dist/core/WeatherSystem/shaders/sky.js.map +1 -1
  254. package/dist/core/WeatherSystem/sky/index.js +104 -135
  255. package/dist/core/WeatherSystem/sky/index.js.map +1 -1
  256. package/dist/core/WeatherSystem/utils/constant.js +44 -38
  257. package/dist/core/WeatherSystem/utils/constant.js.map +1 -1
  258. package/dist/core/WeatherSystem/utils/math.js +18 -25
  259. package/dist/core/WeatherSystem/utils/math.js.map +1 -1
  260. package/dist/core/WeatherSystem/utils/type.js +1 -1
  261. package/dist/core/WeatherSystem/utils/type.js.map +1 -1
  262. package/dist/core/WeatherSystem/weather/index.js +96 -141
  263. package/dist/core/WeatherSystem/weather/index.js.map +1 -1
  264. package/dist/utils/index.js +1 -1
  265. package/dist/utils/index.js.map +1 -1
  266. 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" == _typeof(i) ? i : String(i); }
14
- 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); }
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 var PerspectiveCameraExpand = /*#__PURE__*/function (_EventDispatcher) {
21
- _inherits(PerspectiveCameraExpand, _EventDispatcher);
22
- var _super = _createSuper(PerspectiveCameraExpand);
23
- function PerspectiveCameraExpand(camera, controls, sceneControl) {
24
- var _this;
25
- _classCallCheck(this, PerspectiveCameraExpand);
26
- _this = _super.call(this);
27
- _defineProperty(_assertThisInitialized(_this), "_isTransitionPeriod", false);
28
- _defineProperty(_assertThisInitialized(_this), "camera", void 0);
29
- _defineProperty(_assertThisInitialized(_this), "controls", void 0);
30
- _defineProperty(_assertThisInitialized(_this), "sceneControl", void 0);
31
- _defineProperty(_assertThisInitialized(_this), "tween", void 0);
32
- _defineProperty(_assertThisInitialized(_this), "_isCameraChange", false);
33
- _defineProperty(_assertThisInitialized(_this), "followId", 0);
34
- _defineProperty(_assertThisInitialized(_this), "followCancelMap", new Map());
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
- _createClass(PerspectiveCameraExpand, [{
42
- key: "isTransitionPeriod",
43
- get: function get() {
44
- return this._isTransitionPeriod;
45
- }
46
- }, {
47
- key: "isCameraChange",
48
- get: function get() {
49
- return this._isCameraChange;
50
- }
51
- }, {
52
- key: "bindEvent",
53
- value: function bindEvent() {
54
- var _this2 = this;
55
- this.controls.addEventListener('start', function () {
56
- utils.storeManagement.set('enableEvents', false);
57
- _this2._isCameraChange = true;
58
- });
59
- this.controls.addEventListener('end', function () {
60
- utils.storeManagement.set('enableEvents', true);
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
- * camera focus
120
- * @param params
121
- * @returns
122
- */
123
- }, {
124
- key: "focus",
125
- value: function focus(params) {
126
- var _this3 = this;
127
- return new Promise(function (res) {
128
- var position = params.target,
129
- _params$pitch = params.pitch,
130
- pitch = _params$pitch === void 0 ? 0 : _params$pitch,
131
- _params$yaw = params.yaw,
132
- yaw = _params$yaw === void 0 ? 0 : _params$yaw,
133
- _params$distance = params.distance,
134
- distance = _params$distance === void 0 ? undefined : _params$distance,
135
- duration = params.duration,
136
- _onUpdate = params.onUpdate,
137
- _params$distanceCoeff = params.distanceCoefficient,
138
- distanceCoefficient = _params$distanceCoeff === void 0 ? 1 : _params$distanceCoeff;
139
- var moveOptions = function moveOptions() {
140
- var _ref, _params$isTrigger;
141
- return {
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
- // if target is multiple points
166
- if (Array.isArray(position[0])) {
167
- var currentPos = position;
168
- var _this3$caclCurrentPos = _this3.caclCurrentPos(currentPos, distanceCoefficient, distance),
169
- lastPosition = _this3$caclCurrentPos.lastPosition,
170
- lastLookat = _this3$caclCurrentPos.lastLookat;
171
- _this3.motion(lastPosition, lastLookat, pitch, yaw, moveOptions());
172
- }
173
- // if target is single point
174
- else {
175
- var _currentPos = position;
176
- var _lastPosition = _this3.caclSingleCoordinate(_this3.controls.target, _this3.camera.position, new Vector3().fromArray(_currentPos), distance);
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
- * set camera main set position and target
185
- * @param params
186
- * @returns
187
- */
188
- }, {
189
- key: "set",
190
- value: function set(params) {
191
- var _this4 = this;
192
- var position = params.position,
193
- target = params.target,
194
- isTrigger = params.isTrigger,
195
- duration = params.duration;
196
- return new Promise(function (res, _) {
197
- var _ref3;
198
- _this4.motion(new Vector3(position[0], position[1], position[2]), new Vector3(target[0], target[1], target[2]), 0, 0, {
199
- isTrigger: isTrigger !== null && isTrigger !== void 0 ? isTrigger : true,
200
- duration: (_ref3 = duration && duration * 1000) !== null && _ref3 !== void 0 ? _ref3 : 1000,
201
- onUpdate: function onUpdate(_ref4) {
202
- var position = _ref4.position,
203
- lookat = _ref4.lookat;
204
- params.onUpdate && params.onUpdate({
205
- position: position,
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: function onComplate() {
210
- var _params$duration2;
117
+ onComplate: () => {
118
+ var _params$duration;
211
119
  res({
212
- position: _this4.camera.position.toArray(),
213
- target: _this4.controls.target.toArray(),
214
- isTrigger: true,
215
- duration: (_params$duration2 = params.duration) !== null && _params$duration2 !== void 0 ? _params$duration2 : 0,
216
- userInput: true
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
- * get camera position and target
225
- * @returns
226
- */
227
- }, {
228
- key: "get",
229
- value: function get() {
230
- return {
231
- position: [this.camera.position.x, this.camera.position.y, this.camera.position.z],
232
- target: [this.controls.target.x, this.controls.target.y, this.controls.target.z]
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
- * get current pitch
238
- */
239
- }, {
240
- key: "pitch",
241
- get: function get() {
242
- var targetPosition = this.controls.target;
243
- var cameraPosition = this.camera.position;
244
- var currentDirection = cameraPosition.clone().sub(targetPosition);
245
- var plane = new Plane(new Vector3(0, 1, 0), 0);
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
- * get current yaw
251
- * @returns
252
- */
253
- }, {
254
- key: "yaw",
255
- get: function get() {
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
- * set pitch, similar to ue
261
- * @param deg
262
- */
263
- }, {
264
- key: "setPitch",
265
- value: function setPitch(deg) {
266
- if (deg > 90) deg = 90;
267
- if (deg < -90) deg = -90;
268
- var direction = new Vector3(0, 0, 1);
269
- var quaternion = new Quaternion();
270
- var pitchQuat = new Quaternion();
271
- pitchQuat.setFromAxisAngle(new Vector3(1, 0, 0), MathUtils.degToRad(-deg));
272
- quaternion.multiply(pitchQuat);
273
- direction.applyQuaternion(quaternion);
274
- direction.normalize();
275
- var distance = this.camera.position.distanceTo(this.controls.target);
276
- var cameraPosition = this.controls.target.clone().add(direction.multiplyScalar(distance));
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
- * set yaw, similar to ue
282
- * @param deg
283
- */
284
- }, {
285
- key: "setYaw",
286
- value: function setYaw(deg) {
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
- // @ts-ignore
291
- this.camera.rotationParent.y = MathUtils.degToRad(deg);
292
- }
246
+ // @ts-ignore
247
+ this.camera.rotationParent.y = MathUtils.degToRad(deg);
248
+ }
293
249
 
294
- /**
295
- * cacl Position By Follow
296
- * @param pitch
297
- * @param yaw
298
- * @param distance
299
- * @returns
300
- */
301
- }, {
302
- key: "caclPositionByFollow",
303
- value: function caclPositionByFollow() {
304
- var pitch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 30;
305
- var yaw = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
306
- var distance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 60;
307
- var axisX = new Vector3(1, 0, 0);
308
- var axisY = new Vector3(0, 1, 0);
309
- var axisZ = new Vector3(0, 0, -1);
310
- var position = new Vector3(0, 0, 0);
311
- var anglePitch = MathUtils.degToRad(pitch);
312
- var angleYaw = MathUtils.degToRad(yaw);
313
- var quaternionX = new Quaternion().setFromAxisAngle(axisX, anglePitch);
314
- var quaternionY = new Quaternion().setFromAxisAngle(axisY, angleYaw);
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
- * follow 3d object, not only use in camera
323
- * @param target
324
- * @param camera
325
- * @param option
326
- * @returns
327
- */
328
- }, {
329
- key: "follow",
330
- value: function follow(target, camera, option) {
331
- var _this5 = this;
332
- var followId = this.followId++;
333
- var _ref5 = option || {},
334
- _ref5$relativeRotatio = _ref5.relativeRotation,
335
- relativeRotation = _ref5$relativeRotatio === void 0 ? false : _ref5$relativeRotatio,
336
- _ref5$pitch = _ref5.pitch,
337
- pitch = _ref5$pitch === void 0 ? 30 : _ref5$pitch,
338
- _ref5$yaw = _ref5.yaw,
339
- yaw = _ref5$yaw === void 0 ? 0 : _ref5$yaw,
340
- _ref5$distance = _ref5.distance,
341
- distance = _ref5$distance === void 0 ? 10 : _ref5$distance;
342
- var container = new Group();
343
- container.rotation.copy(target.rotation);
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
- var oldCameraParent = camera.parent;
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
- var cancelMotion = use.useframe(function () {
360
- container.position.copy(target.position);
361
- container.scale.copy(target.scale);
362
- needUpdateRotation && container.rotation.copy(target.rotation);
363
- _this5.controls.target.copy(target.position);
364
- followControls.target = target.position;
365
- followControls.update();
366
- });
367
- var cancel = function cancel() {
368
- _this5.controls.enabled = true;
369
- oldCameraParent.add(camera);
370
- target.parent.remove(container);
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
- * cancel follow
380
- * @param followId
381
- */
382
- }, {
383
- key: "cancelFollow",
384
- value: function cancelFollow(followId) {
385
- var cancel = this.followCancelMap.get(followId);
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
- * cancel all follow
391
- */
392
- }, {
393
- key: "cancelAllFollow",
394
- value: function cancelAllFollow() {
395
- this.followCancelMap.forEach(function (cancel) {
396
- cancel();
397
- });
398
- }
332
+ /**
333
+ * cancel all follow
334
+ */
335
+ cancelAllFollow() {
336
+ this.followCancelMap.forEach(cancel => {
337
+ cancel();
338
+ });
339
+ }
399
340
 
400
- /**
401
- * interpolation move camera
402
- * @param position
403
- * @param target
404
- * @param pitch
405
- * @param yaw
406
- * @param options
407
- * @returns
408
- */
409
- }, {
410
- key: "motion",
411
- value: function motion(position, target) {
412
- var _this6 = this;
413
- var pitch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
414
- var yaw = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
415
- var options = arguments.length > 4 ? arguments[4] : undefined;
416
- var currentPoition = this.camera.position.clone();
417
- var currentPositionInterpolation = new Vector3();
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 (this.tween) this.tween.stop();
436
- this.tween = new TWEEN.Tween(
437
- // @ts-ignore
438
- {
439
- t: 0,
440
- lookat: this.controls.target.clone(),
441
- p: this.camera.rotationParent.x,
442
- yaw: this.camera.rotationParent.y
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
- return PerspectiveCameraExpand;
483
- }(EventDispatcher);
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