@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,23 +1,14 @@
|
|
|
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
1
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
2
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
-
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); } }
|
|
6
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
-
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); }
|
|
8
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
|
-
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); }; }
|
|
10
|
-
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); }
|
|
11
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
-
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; } }
|
|
13
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
3
|
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; }
|
|
15
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" ==
|
|
16
|
-
function _toPrimitive(t, r) { if ("object" !=
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
5
|
+
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); }
|
|
17
6
|
import { DirectionalLight, MathUtils, Object3D, Vector3, lib } from '@anov/3d-core';
|
|
18
7
|
import { getSunPosition } from "../utils/math";
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
const {
|
|
9
|
+
Sky
|
|
10
|
+
} = lib;
|
|
11
|
+
const effectController = {
|
|
21
12
|
turbidity: 10,
|
|
22
13
|
rayleigh: 3,
|
|
23
14
|
mieCoefficient: 0.005,
|
|
@@ -30,138 +21,116 @@ var effectController = {
|
|
|
30
21
|
/**
|
|
31
22
|
* 天空——时间系统
|
|
32
23
|
*/
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
24
|
+
export class SkySystem extends Object3D {
|
|
25
|
+
get size() {
|
|
26
|
+
return this.size;
|
|
27
|
+
}
|
|
28
|
+
set size(size) {
|
|
29
|
+
this._size = size;
|
|
30
|
+
this._sky.scale.setScalar(this._size);
|
|
31
|
+
}
|
|
32
|
+
get sunHeight() {
|
|
33
|
+
return this._sunHeight;
|
|
34
|
+
}
|
|
35
|
+
set sunHeight(height) {
|
|
36
|
+
this._sunHeight = height;
|
|
37
|
+
}
|
|
38
|
+
constructor(options) {
|
|
39
|
+
super();
|
|
40
|
+
_defineProperty(this, "_size", 450000);
|
|
41
|
+
_defineProperty(this, "_sky", void 0);
|
|
42
|
+
_defineProperty(this, "_effectController", effectController);
|
|
43
|
+
_defineProperty(this, "_latitude", 40);
|
|
44
|
+
_defineProperty(this, "_longitude", 116);
|
|
45
|
+
_defineProperty(this, "_sunHeight", 10000);
|
|
46
|
+
_defineProperty(this, "_sun", void 0);
|
|
47
|
+
this._effectController = _objectSpread(_objectSpread({}, effectController), options !== null && options !== void 0 ? options : {});
|
|
48
|
+
this.createSky();
|
|
49
|
+
this.createSun();
|
|
50
|
+
this.combination();
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
/**
|
|
55
54
|
* create sky
|
|
56
55
|
* @returns
|
|
57
56
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this._sunHeight = height;
|
|
74
|
-
}
|
|
75
|
-
}, {
|
|
76
|
-
key: "createSky",
|
|
77
|
-
value: function createSky() {
|
|
78
|
-
this._sky = new Sky();
|
|
79
|
-
this._sky.scale.setScalar(this._size);
|
|
80
|
-
var position = new Vector3();
|
|
81
|
-
var uniforms = this._sky.material.uniforms;
|
|
82
|
-
var phi = MathUtils.degToRad(90 - this._effectController.elevation);
|
|
83
|
-
var theta = MathUtils.degToRad(this._effectController.azimuth);
|
|
84
|
-
uniforms.turbidity.value = this._effectController.turbidity;
|
|
85
|
-
uniforms.rayleigh.value = this._effectController.rayleigh;
|
|
86
|
-
uniforms.mieCoefficient.value = this._effectController.mieCoefficient;
|
|
87
|
-
uniforms.mieDirectionalG.value = this._effectController.mieDirectionalG;
|
|
88
|
-
position.setFromSphericalCoords(1, phi, theta);
|
|
89
|
-
uniforms.sunPosition.value.copy(position);
|
|
90
|
-
return this._sky;
|
|
91
|
-
}
|
|
57
|
+
createSky() {
|
|
58
|
+
this._sky = new Sky();
|
|
59
|
+
this._sky.scale.setScalar(this._size);
|
|
60
|
+
const position = new Vector3();
|
|
61
|
+
const uniforms = this._sky.material.uniforms;
|
|
62
|
+
const phi = MathUtils.degToRad(90 - this._effectController.elevation);
|
|
63
|
+
const theta = MathUtils.degToRad(this._effectController.azimuth);
|
|
64
|
+
uniforms.turbidity.value = this._effectController.turbidity;
|
|
65
|
+
uniforms.rayleigh.value = this._effectController.rayleigh;
|
|
66
|
+
uniforms.mieCoefficient.value = this._effectController.mieCoefficient;
|
|
67
|
+
uniforms.mieDirectionalG.value = this._effectController.mieDirectionalG;
|
|
68
|
+
position.setFromSphericalCoords(1, phi, theta);
|
|
69
|
+
uniforms.sunPosition.value.copy(position);
|
|
70
|
+
return this._sky;
|
|
71
|
+
}
|
|
92
72
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
sunLight.castShadow = true;
|
|
103
|
-
this._sun = sunLight;
|
|
73
|
+
/**
|
|
74
|
+
* create sun
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
createSun() {
|
|
78
|
+
const sunLight = new DirectionalLight('white', 1);
|
|
79
|
+
sunLight.name = 'SYS_SUN';
|
|
80
|
+
sunLight.castShadow = true;
|
|
81
|
+
this._sun = sunLight;
|
|
104
82
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
83
|
+
// 添加帮助
|
|
84
|
+
// const helper = new DirectionalLightHelper(sunLight, 200)
|
|
85
|
+
// this.add(helper)
|
|
108
86
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.add(this._sun);
|
|
117
|
-
}
|
|
87
|
+
return sunLight;
|
|
88
|
+
}
|
|
89
|
+
combination() {
|
|
90
|
+
this.setTime(new Date());
|
|
91
|
+
this.add(this._sky);
|
|
92
|
+
this.add(this._sun);
|
|
93
|
+
}
|
|
118
94
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
value
|
|
126
|
-
|
|
127
|
-
uniforms.sunPosition.value.copy(position);
|
|
128
|
-
}
|
|
95
|
+
/**
|
|
96
|
+
* 设置天空中的太阳位置
|
|
97
|
+
* @param position
|
|
98
|
+
*/
|
|
99
|
+
setSunPositin(position) {
|
|
100
|
+
const uniforms = this._sky.material.uniforms;
|
|
101
|
+
uniforms.sunPosition.value.copy(position);
|
|
102
|
+
}
|
|
129
103
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
var uniforms = this._sky.material.uniforms;
|
|
104
|
+
/**
|
|
105
|
+
* 设置时间
|
|
106
|
+
* @param currentDate
|
|
107
|
+
*/
|
|
108
|
+
setTime(currentDate) {
|
|
109
|
+
// 根据时间、经纬度获取太阳的高度角(altitude)、方位角(azimuth)
|
|
110
|
+
const {
|
|
111
|
+
altitude,
|
|
112
|
+
azimuth
|
|
113
|
+
} = getSunPosition(currentDate, this._latitude, this._longitude);
|
|
114
|
+
const uniforms = this._sky.material.uniforms;
|
|
142
115
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
116
|
+
// 转换为 Three.js setFromSphericalCoords 参数
|
|
117
|
+
const phi = Math.PI / 2 - altitude; // SunCalc的高度角转换为Three.js的phi
|
|
118
|
+
const theta = azimuth + Math.PI; // SunCalc的方位角转换为Three.js的theta
|
|
119
|
+
const sunPosition = new Vector3().setFromSphericalCoords(1, phi, theta);
|
|
120
|
+
uniforms.sunPosition.value.copy(sunPosition);
|
|
148
121
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
122
|
+
// 缩放向量使光源足够远但不超出场景有效范围
|
|
123
|
+
const scaledPosition = sunPosition.clone().multiplyScalar(this._sunHeight);
|
|
124
|
+
this._sun.position.copy(scaledPosition);
|
|
152
125
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
}]);
|
|
165
|
-
return SkySystem;
|
|
166
|
-
}(Object3D);
|
|
126
|
+
// uniforms.sunPosition.value.copy(new Vector3().setFromSphericalCoords(this._sunHeight, MathUtils.degToRad(90 - MathUtils.radToDeg(altitude)), azimuth))
|
|
127
|
+
// const x = this._sunHeight * (Math.cos(altitude)) * (Math.cos(azimuth))
|
|
128
|
+
// const z = this._sunHeight * (Math.cos(altitude)) * (Math.sin(azimuth))
|
|
129
|
+
// const y = this._sunHeight * (Math.sin(altitude))
|
|
130
|
+
// this._sun.position.copy(new Vector3(x, y, z))
|
|
131
|
+
}
|
|
132
|
+
updateSky(camera) {
|
|
133
|
+
if (this._sky) this._sky.position.copy(camera.position);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
167
136
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DirectionalLight","MathUtils","Object3D","Vector3","lib","getSunPosition","Sky","effectController","turbidity","rayleigh","mieCoefficient","mieDirectionalG","elevation","azimuth","exposure","SkySystem","
|
|
1
|
+
{"version":3,"names":["DirectionalLight","MathUtils","Object3D","Vector3","lib","getSunPosition","Sky","effectController","turbidity","rayleigh","mieCoefficient","mieDirectionalG","elevation","azimuth","exposure","SkySystem","size","_size","_sky","scale","setScalar","sunHeight","_sunHeight","height","constructor","options","_defineProperty","_effectController","_objectSpread","createSky","createSun","combination","position","uniforms","material","phi","degToRad","theta","value","setFromSphericalCoords","sunPosition","copy","sunLight","name","castShadow","_sun","setTime","Date","add","setSunPositin","currentDate","altitude","_latitude","_longitude","Math","PI","scaledPosition","clone","multiplyScalar","updateSky","camera"],"sources":["../../../../src/core/WeatherSystem/sky/index.ts"],"sourcesContent":["import type { Light } from '@anov/3d-core'\nimport { AmbientLight, DirectionalLight, DirectionalLightHelper, MathUtils, Object3D, Vector3, lib } from '@anov/3d-core'\nimport { getSunPosition } from '../utils/math'\n\nconst { Sky } = lib\n\ntype SkySystemOption = {\n scalarCoefficient?: number\n turbidity?: number\n rayleigh?: number\n mieCoefficient?: number\n mieDirectionalG?: number\n elevation?: number\n azimuth?: number\n exposure?: number\n}\n\nconst effectController: SkySystemOption = {\n turbidity: 10,\n rayleigh: 3,\n mieCoefficient: 0.005,\n mieDirectionalG: 0.7,\n elevation: 2,\n azimuth: 180,\n exposure: 0.1,\n}\n\n/**\n * 天空——时间系统\n */\nexport class SkySystem extends Object3D {\n private _size = 450000\n private _sky: lib.Sky\n private _effectController: SkySystemOption = effectController\n private _latitude = 40\n private _longitude = 116\n private _sunHeight = 10000\n private _sun: Light\n\n public get size() {\n return this.size\n }\n\n public set size(size: number) {\n this._size = size\n this._sky.scale.setScalar(this._size)\n }\n\n public get sunHeight() {\n return this._sunHeight\n }\n\n public set sunHeight(height: number) {\n this._sunHeight = height\n }\n\n constructor(options?: SkySystemOption) {\n super()\n\n this._effectController = {\n ...effectController,\n ...options ?? {},\n }\n this.createSky()\n this.createSun()\n this.combination()\n }\n\n /**\n * create sky\n * @returns\n */\n private createSky() {\n this._sky = new Sky()\n this._sky.scale.setScalar(this._size)\n\n const position = new Vector3()\n const uniforms = (this._sky.material as any).uniforms\n const phi = MathUtils.degToRad(90 - this._effectController.elevation)\n const theta = MathUtils.degToRad(this._effectController.azimuth)\n\n uniforms.turbidity.value = this._effectController.turbidity\n uniforms.rayleigh.value = this._effectController.rayleigh\n uniforms.mieCoefficient.value = this._effectController.mieCoefficient\n uniforms.mieDirectionalG.value = this._effectController.mieDirectionalG\n\n position.setFromSphericalCoords(1, phi, theta)\n uniforms.sunPosition.value.copy(position)\n\n return this._sky\n }\n\n /**\n * create sun\n * @returns\n */\n private createSun() {\n const sunLight = new DirectionalLight('white', 1)\n sunLight.name = 'SYS_SUN'\n sunLight.castShadow = true\n this._sun = sunLight\n\n // 添加帮助\n // const helper = new DirectionalLightHelper(sunLight, 200)\n // this.add(helper)\n\n return sunLight\n }\n\n private combination() {\n this.setTime(new Date())\n this.add(this._sky)\n this.add(this._sun)\n }\n\n /**\n * 设置天空中的太阳位置\n * @param position\n */\n setSunPositin(position: Vector3) {\n const uniforms = (this._sky.material as any).uniforms\n uniforms.sunPosition.value.copy(position)\n }\n\n /**\n * 设置时间\n * @param currentDate\n */\n setTime(currentDate?: Date) {\n // 根据时间、经纬度获取太阳的高度角(altitude)、方位角(azimuth)\n const { altitude, azimuth } = getSunPosition(currentDate, this._latitude, this._longitude)\n const uniforms = (this._sky.material as any).uniforms\n\n // 转换为 Three.js setFromSphericalCoords 参数\n const phi = Math.PI / 2 - altitude // SunCalc的高度角转换为Three.js的phi\n const theta = azimuth + Math.PI // SunCalc的方位角转换为Three.js的theta\n const sunPosition = new Vector3().setFromSphericalCoords(1, phi, theta)\n uniforms.sunPosition.value.copy(sunPosition)\n\n // 缩放向量使光源足够远但不超出场景有效范围\n const scaledPosition = sunPosition.clone().multiplyScalar(this._sunHeight)\n this._sun.position.copy(scaledPosition)\n\n // uniforms.sunPosition.value.copy(new Vector3().setFromSphericalCoords(this._sunHeight, MathUtils.degToRad(90 - MathUtils.radToDeg(altitude)), azimuth))\n // const x = this._sunHeight * (Math.cos(altitude)) * (Math.cos(azimuth))\n // const z = this._sunHeight * (Math.cos(altitude)) * (Math.sin(azimuth))\n // const y = this._sunHeight * (Math.sin(altitude))\n // this._sun.position.copy(new Vector3(x, y, z))\n }\n\n public updateSky(camera) {\n if (this._sky)\n this._sky.position.copy(camera.position)\n }\n}"],"mappings":";;;;;AACA,SAAuBA,gBAAgB,EAA0BC,SAAS,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,GAAG,QAAQ,eAAe;AACzH,SAASC,cAAc;AAEvB,MAAM;EAAEC;AAAI,CAAC,GAAGF,GAAG;AAanB,MAAMG,gBAAiC,GAAG;EACxCC,SAAS,EAAE,EAAE;EACbC,QAAQ,EAAE,CAAC;EACXC,cAAc,EAAE,KAAK;EACrBC,eAAe,EAAE,GAAG;EACpBC,SAAS,EAAE,CAAC;EACZC,OAAO,EAAE,GAAG;EACZC,QAAQ,EAAE;AACZ,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,SAAS,SAASb,QAAQ,CAAC;EAStC,IAAWc,IAAIA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACA,IAAI;EAClB;EAEA,IAAWA,IAAIA,CAACA,IAAY,EAAE;IAC5B,IAAI,CAACC,KAAK,GAAGD,IAAI;IACjB,IAAI,CAACE,IAAI,CAACC,KAAK,CAACC,SAAS,CAAC,IAAI,CAACH,KAAK,CAAC;EACvC;EAEA,IA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