@anov/3d-ability 0.0.140 → 0.0.141
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.js +25 -24
- 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,24 +1,13 @@
|
|
|
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 { Group, Mesh, MeshStandardMaterial, PlaneGeometry, TextureLoader, use } from '@anov/3d-core';
|
|
18
7
|
// import { Rain_Panel, Snow_panle } from '../../utils/constant'
|
|
19
8
|
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
const textureLoader = new TextureLoader();
|
|
10
|
+
const _defaultOption = {
|
|
22
11
|
// texture1: textureLoader.load(Snow_panle),
|
|
23
12
|
// texture2rain: textureLoader.load(Rain_Panel),
|
|
24
13
|
size: 5.0,
|
|
@@ -29,20 +18,18 @@ var _defaultOption = {
|
|
|
29
18
|
rainSpeed: 3.0,
|
|
30
19
|
rainAngle: 0.0
|
|
31
20
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
height = option.height;
|
|
45
|
-
_this.setUniforms(_objectSpread(_objectSpread({}, _this.option), {}, {
|
|
21
|
+
class LineRainMesh extends Mesh {
|
|
22
|
+
constructor(option) {
|
|
23
|
+
super();
|
|
24
|
+
_defineProperty(this, "option", _defaultOption);
|
|
25
|
+
_defineProperty(this, "uniforms", {});
|
|
26
|
+
_defineProperty(this, "loaded", void 0);
|
|
27
|
+
const group = new Group();
|
|
28
|
+
const {
|
|
29
|
+
width,
|
|
30
|
+
height
|
|
31
|
+
} = option;
|
|
32
|
+
this.setUniforms(_objectSpread(_objectSpread({}, this.option), {}, {
|
|
46
33
|
iTime: 0
|
|
47
34
|
}));
|
|
48
35
|
|
|
@@ -121,98 +108,81 @@ var LineRainMesh = /*#__PURE__*/function (_Mesh) {
|
|
|
121
108
|
// const rain2d = new Mesh(rain2dGeometry, material2d)
|
|
122
109
|
// rain2d.renderOrder = 10
|
|
123
110
|
|
|
124
|
-
|
|
125
|
-
|
|
111
|
+
const rain2dGeometry = new PlaneGeometry(100, 100);
|
|
112
|
+
const material2d = new MeshStandardMaterial({
|
|
126
113
|
color: 0xff0000
|
|
127
114
|
});
|
|
128
|
-
|
|
115
|
+
const rain2d = new Mesh(rain2dGeometry, material2d);
|
|
129
116
|
group.add(rain2d);
|
|
130
|
-
|
|
131
|
-
return _this;
|
|
117
|
+
this.add(group);
|
|
132
118
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
camera = _use$useScene.camera;
|
|
202
|
-
var _this$uniforms = this.uniforms,
|
|
203
|
-
iTime = _this$uniforms.iTime,
|
|
204
|
-
cameraPos = _this$uniforms.cameraPos;
|
|
205
|
-
iTime.value += 0.1;
|
|
206
|
-
cameraPos.value = [camera.position.x, camera.position.y, camera.position.z];
|
|
207
|
-
}
|
|
208
|
-
}, {
|
|
209
|
-
key: "delete",
|
|
210
|
-
value: function _delete() {
|
|
211
|
-
this.remove();
|
|
212
|
-
this.removeFromParent();
|
|
213
|
-
}
|
|
214
|
-
}]);
|
|
215
|
-
return LineRainMesh;
|
|
216
|
-
}(Mesh);
|
|
119
|
+
setUniforms(option) {
|
|
120
|
+
Object.assign(this.option, option);
|
|
121
|
+
Object.keys(option).forEach(key => {
|
|
122
|
+
this.uniforms[key] = {
|
|
123
|
+
value: option[key]
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
setSize(size) {
|
|
128
|
+
this.setUniforms({
|
|
129
|
+
size
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
setSpeed(speed) {
|
|
133
|
+
this.setUniforms({
|
|
134
|
+
snowSpeed: speed
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
setRain(scale) {
|
|
138
|
+
this.setUniforms({
|
|
139
|
+
rainT1density: scale
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
setSnow(scale) {
|
|
143
|
+
this.setUniforms({
|
|
144
|
+
snowT1density: scale
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
setEffect(ops) {
|
|
148
|
+
const {
|
|
149
|
+
size,
|
|
150
|
+
snowT1density,
|
|
151
|
+
rainT1density,
|
|
152
|
+
snowSpeed
|
|
153
|
+
} = ops;
|
|
154
|
+
Object.keys(ops).forEach(key => {
|
|
155
|
+
switch (key) {
|
|
156
|
+
case 'size':
|
|
157
|
+
this.setSize(size);
|
|
158
|
+
break;
|
|
159
|
+
case 'snowT1density':
|
|
160
|
+
this.setSpeed(snowSpeed);
|
|
161
|
+
break;
|
|
162
|
+
case 'rainT1density':
|
|
163
|
+
this.setRain(rainT1density);
|
|
164
|
+
break;
|
|
165
|
+
case 'snowSpeed':
|
|
166
|
+
this.setSnow(snowT1density);
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
update() {
|
|
172
|
+
const {
|
|
173
|
+
camera
|
|
174
|
+
} = use.useScene();
|
|
175
|
+
const {
|
|
176
|
+
iTime,
|
|
177
|
+
cameraPos
|
|
178
|
+
} = this.uniforms;
|
|
179
|
+
iTime.value += 0.1;
|
|
180
|
+
cameraPos.value = [camera.position.x, camera.position.y, camera.position.z];
|
|
181
|
+
}
|
|
182
|
+
delete() {
|
|
183
|
+
this.remove();
|
|
184
|
+
this.removeFromParent();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
217
187
|
export default LineRainMesh;
|
|
218
188
|
//# sourceMappingURL=lineRain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Group","Mesh","MeshStandardMaterial","PlaneGeometry","TextureLoader","use","textureLoader","_defaultOption","size","snowT1density","rainT1density","snowSpeed","cameraPos","rainSpeed","rainAngle","LineRainMesh","
|
|
1
|
+
{"version":3,"names":["Group","Mesh","MeshStandardMaterial","PlaneGeometry","TextureLoader","use","textureLoader","_defaultOption","size","snowT1density","rainT1density","snowSpeed","cameraPos","rainSpeed","rainAngle","LineRainMesh","constructor","option","_defineProperty","group","width","height","setUniforms","_objectSpread","iTime","rain2dGeometry","material2d","color","rain2d","add","Object","assign","keys","forEach","key","uniforms","value","setSize","setSpeed","speed","setRain","scale","setSnow","setEffect","ops","update","camera","useScene","position","x","y","z","delete","remove","removeFromParent"],"sources":["../../../../../src/core/WeatherSystem/objects/rain/lineRain.ts"],"sourcesContent":["import { Group, Mesh, MeshStandardMaterial, PlaneGeometry, RepeatWrapping, ShaderMaterial, TextureLoader, use } from '@anov/3d-core'\nimport RainShader from '../../shaders/rain'\nimport type { IRainOption } from '../../utils/constant'\n// import { Rain_Panel, Snow_panle } from '../../utils/constant'\n\nconst textureLoader = new TextureLoader()\n\nconst _defaultOption: IRainOption = {\n // texture1: textureLoader.load(Snow_panle),\n // texture2rain: textureLoader.load(Rain_Panel),\n size: 5.0,\n snowT1density: 0.1,\n rainT1density: 0.1,\n snowSpeed: 1.0,\n cameraPos: [0, 500.0, 0],\n rainSpeed: 3.0,\n rainAngle: 0.0,\n}\n\nclass LineRainMesh extends Mesh {\n option: IRainOption = _defaultOption\n uniforms: any = {}\n loaded!: Promise<Boolean>\n\n constructor(option: { width: number; height: number; segment: number }) {\n super()\n\n const group = new Group()\n const { width, height } = option\n\n this.setUniforms({\n ...this.option,\n iTime: 0,\n })\n\n // const createPlane = (x: number, y: number, z: number, rotationX: number, rotationY: number, rotationZ: number) => {\n // const suiji = Math.random() * (width / 3)\n // const geometry = new PlaneGeometry(width + suiji, height + suiji)\n // const material = new ShaderMaterial({\n // uniforms: this.uniforms,\n // vertexShader: RainShader.vertexShaderFar,\n // fragmentShader: RainShader.fragmentShaderFar,\n // side: 2,\n // blending: 2,\n // transparent: true,\n // depthWrite: false,\n // depthTest: true,\n // })\n\n // const plane = new Mesh(geometry, material)\n // plane.renderOrder = 10\n // plane.position.set(x, y, z)\n // plane.rotation.set(rotationX, rotationY, rotationZ)\n // return plane\n // }\n\n // const createNearPlane = (x: number, y: number, z: number, rotationX: number, rotationY: number, rotationZ: number) => {\n // const suiji = Math.random() * (width / 1)\n // const geometry = new PlaneGeometry(width / 2 + suiji, height / 2 + suiji)\n // const material = new ShaderMaterial({\n // uniforms: this.uniforms,\n // vertexShader: RainShader.vertexShaderNear,\n // fragmentShader: RainShader.fragmentShaderNear,\n // side: 2,\n // blending: 2,\n // transparent: true,\n // depthWrite: true,\n // depthTest: true,\n // })\n\n // const plane = new Mesh(geometry, material)\n // plane.renderOrder = 10\n // plane.position.set(x, y, z)\n // plane.rotation.set(rotationX, rotationY, rotationZ)\n // return plane\n // }\n\n // const count = 6\n // const distance = 150\n // for (let j = -count; j <= count; j++) {\n // const plane = createPlane(0, 0, j * distance, 0, 0, 0)\n // group.add(plane)\n // }\n // for (let j = -count; j <= count; j++) {\n // const plane = createPlane(j * distance, 0, 0, 0, Math.PI / 2, 0)\n // group.add(plane)\n // }\n\n // for (let j = -15; j <= 15; j++) {\n // const plane = createNearPlane(0, 0, j * j * j * 1, 0, 0, 0)\n // group.add(plane)\n // }\n // for (let j = -15; j <= 15; j++) {\n // const plane = createNearPlane(j * j * j * 1, 0, 0, 0, Math.PI / 2, 0)\n // group.add(plane)\n // }\n\n // const material2d = new ShaderMaterial({\n // uniforms: this.uniforms,\n // vertexShader: RainShader.vertexShader2d,\n // fragmentShader: RainShader.fragmentShader2d,\n // side: 2,\n // transparent: true,\n // depthWrite: false,\n // })\n\n // const rain2dGeometry = new PlaneGeometry(100, 100)\n // const rain2d = new Mesh(rain2dGeometry, material2d)\n // rain2d.renderOrder = 10\n \nconst rain2dGeometry = new PlaneGeometry(100, 100)\nconst material2d = new MeshStandardMaterial({color:0xff0000})\nconst rain2d = new Mesh(rain2dGeometry, material2d)\n \n\n group.add(rain2d)\n this.add(group)\n }\n\n private setUniforms(option: IRainOption) {\n Object.assign(this.option, option)\n\n Object.keys(option).forEach((key: string) => {\n this.uniforms[key] = { value: option[key] }\n })\n }\n\n public setSize(size: number) {\n this.setUniforms({ size })\n }\n\n public setSpeed(speed: number) {\n this.setUniforms({ snowSpeed: speed })\n }\n\n public setRain(scale: number) {\n this.setUniforms({ rainT1density: scale })\n }\n\n public setSnow(scale: number) {\n this.setUniforms({ snowT1density: scale })\n }\n\n public setEffect(ops: IRainOption) {\n const { size, snowT1density, rainT1density, snowSpeed } = ops\n Object.keys(ops).forEach((key: string) => {\n switch (key) {\n case 'size':\n this.setSize(size!)\n break\n case 'snowT1density':\n this.setSpeed(snowSpeed!)\n break\n case 'rainT1density':\n this.setRain(rainT1density!)\n break\n case 'snowSpeed':\n this.setSnow(snowT1density!)\n break\n }\n })\n }\n\n public update() {\n const { camera } = use.useScene()\n const { iTime, cameraPos } = this.uniforms\n iTime.value += 0.1\n cameraPos.value = [camera.position.x, camera.position.y, camera.position.z]\n }\n\n delete() {\n this.remove()\n this.removeFromParent()\n }\n}\n\nexport default LineRainMesh"],"mappings":"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"}
|
|
@@ -1,24 +1,13 @@
|
|
|
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 { Group, Mesh, PlaneGeometry, RepeatWrapping, ShaderMaterial, TextureLoader, use } from '@anov/3d-core';
|
|
18
7
|
import RainShader from "../../shaders/rain";
|
|
19
8
|
import { Rain_Panel, Snow_panle } from "../../utils/constant";
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
const textureLoader = new TextureLoader();
|
|
10
|
+
const _defaultOption = {
|
|
22
11
|
texture1: textureLoader.load(Snow_panle),
|
|
23
12
|
texture2rain: textureLoader.load(Rain_Panel),
|
|
24
13
|
size: 5.0,
|
|
@@ -29,29 +18,27 @@ var _defaultOption = {
|
|
|
29
18
|
rainSpeed: 3.0,
|
|
30
19
|
rainAngle: 0.0
|
|
31
20
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (_this.option.texture2rain) _this.option.texture2rain.wrapS = _this.option.texture2rain.wrapT = RepeatWrapping;
|
|
47
|
-
_this.setUniforms(_objectSpread(_objectSpread({}, _this.option), {}, {
|
|
21
|
+
class RainMesh extends Mesh {
|
|
22
|
+
constructor(option) {
|
|
23
|
+
super();
|
|
24
|
+
_defineProperty(this, "option", _defaultOption);
|
|
25
|
+
_defineProperty(this, "uniforms", {});
|
|
26
|
+
_defineProperty(this, "loaded", void 0);
|
|
27
|
+
const group = new Group();
|
|
28
|
+
const {
|
|
29
|
+
width,
|
|
30
|
+
height
|
|
31
|
+
} = option;
|
|
32
|
+
if (this.option.texture1) this.option.texture1.wrapS = this.option.texture1.wrapT = RepeatWrapping;
|
|
33
|
+
if (this.option.texture2rain) this.option.texture2rain.wrapS = this.option.texture2rain.wrapT = RepeatWrapping;
|
|
34
|
+
this.setUniforms(_objectSpread(_objectSpread({}, this.option), {}, {
|
|
48
35
|
iTime: 0
|
|
49
36
|
}));
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
uniforms:
|
|
37
|
+
const createPlane = (x, y, z, rotationX, rotationY, rotationZ) => {
|
|
38
|
+
const suiji = Math.random() * (width / 3);
|
|
39
|
+
const geometry = new PlaneGeometry(width + suiji, height + suiji);
|
|
40
|
+
const material = new ShaderMaterial({
|
|
41
|
+
uniforms: this.uniforms,
|
|
55
42
|
vertexShader: RainShader.vertexShaderFar,
|
|
56
43
|
fragmentShader: RainShader.fragmentShaderFar,
|
|
57
44
|
side: 2,
|
|
@@ -60,17 +47,17 @@ var RainMesh = /*#__PURE__*/function (_Mesh) {
|
|
|
60
47
|
depthWrite: false,
|
|
61
48
|
depthTest: true
|
|
62
49
|
});
|
|
63
|
-
|
|
50
|
+
const plane = new Mesh(geometry, material);
|
|
64
51
|
plane.renderOrder = 10;
|
|
65
52
|
plane.position.set(x, y, z);
|
|
66
53
|
plane.rotation.set(rotationX, rotationY, rotationZ);
|
|
67
54
|
return plane;
|
|
68
55
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
uniforms:
|
|
56
|
+
const createNearPlane = (x, y, z, rotationX, rotationY, rotationZ) => {
|
|
57
|
+
const suiji = Math.random() * (width / 1);
|
|
58
|
+
const geometry = new PlaneGeometry(width / 2 + suiji, height / 2 + suiji);
|
|
59
|
+
const material = new ShaderMaterial({
|
|
60
|
+
uniforms: this.uniforms,
|
|
74
61
|
vertexShader: RainShader.vertexShaderNear,
|
|
75
62
|
fragmentShader: RainShader.fragmentShaderNear,
|
|
76
63
|
side: 2,
|
|
@@ -79,128 +66,111 @@ var RainMesh = /*#__PURE__*/function (_Mesh) {
|
|
|
79
66
|
depthWrite: true,
|
|
80
67
|
depthTest: true
|
|
81
68
|
});
|
|
82
|
-
|
|
69
|
+
const plane = new Mesh(geometry, material);
|
|
83
70
|
plane.renderOrder = 10;
|
|
84
71
|
plane.position.set(x, y, z);
|
|
85
72
|
plane.rotation.set(rotationX, rotationY, rotationZ);
|
|
86
73
|
return plane;
|
|
87
74
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
for (
|
|
91
|
-
|
|
75
|
+
const count = 6;
|
|
76
|
+
const distance = 150;
|
|
77
|
+
for (let j = -count; j <= count; j++) {
|
|
78
|
+
const plane = createPlane(0, 0, j * distance, 0, 0, 0);
|
|
92
79
|
group.add(plane);
|
|
93
80
|
}
|
|
94
|
-
for (
|
|
95
|
-
|
|
96
|
-
group.add(
|
|
81
|
+
for (let j = -count; j <= count; j++) {
|
|
82
|
+
const plane = createPlane(j * distance, 0, 0, 0, Math.PI / 2, 0);
|
|
83
|
+
group.add(plane);
|
|
97
84
|
}
|
|
98
|
-
for (
|
|
99
|
-
|
|
100
|
-
group.add(
|
|
85
|
+
for (let j = -15; j <= 15; j++) {
|
|
86
|
+
const plane = createNearPlane(0, 0, j * j * j * 1, 0, 0, 0);
|
|
87
|
+
group.add(plane);
|
|
101
88
|
}
|
|
102
|
-
for (
|
|
103
|
-
|
|
104
|
-
group.add(
|
|
89
|
+
for (let j = -15; j <= 15; j++) {
|
|
90
|
+
const plane = createNearPlane(j * j * j * 1, 0, 0, 0, Math.PI / 2, 0);
|
|
91
|
+
group.add(plane);
|
|
105
92
|
}
|
|
106
|
-
|
|
107
|
-
uniforms:
|
|
93
|
+
const material2d = new ShaderMaterial({
|
|
94
|
+
uniforms: this.uniforms,
|
|
108
95
|
vertexShader: RainShader.vertexShader2d,
|
|
109
96
|
fragmentShader: RainShader.fragmentShader2d,
|
|
110
97
|
side: 2,
|
|
111
98
|
transparent: true,
|
|
112
99
|
depthWrite: false
|
|
113
100
|
});
|
|
114
|
-
|
|
115
|
-
|
|
101
|
+
const rain2dGeometry = new PlaneGeometry(100, 100);
|
|
102
|
+
const rain2d = new Mesh(rain2dGeometry, material2d);
|
|
116
103
|
rain2d.renderOrder = 10;
|
|
117
104
|
group.add(rain2d);
|
|
118
|
-
|
|
119
|
-
return _this;
|
|
105
|
+
this.add(group);
|
|
120
106
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
camera = _use$useScene.camera;
|
|
190
|
-
var _this$uniforms = this.uniforms,
|
|
191
|
-
iTime = _this$uniforms.iTime,
|
|
192
|
-
cameraPos = _this$uniforms.cameraPos;
|
|
193
|
-
iTime.value += 0.1;
|
|
194
|
-
cameraPos.value = [camera.position.x, camera.position.y, camera.position.z];
|
|
195
|
-
}
|
|
196
|
-
}, {
|
|
197
|
-
key: "delete",
|
|
198
|
-
value: function _delete() {
|
|
199
|
-
this.remove();
|
|
200
|
-
this.removeFromParent();
|
|
201
|
-
}
|
|
202
|
-
}]);
|
|
203
|
-
return RainMesh;
|
|
204
|
-
}(Mesh);
|
|
107
|
+
setUniforms(option) {
|
|
108
|
+
Object.assign(this.option, option);
|
|
109
|
+
Object.keys(option).forEach(key => {
|
|
110
|
+
this.uniforms[key] = {
|
|
111
|
+
value: option[key]
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
setSize(size) {
|
|
116
|
+
this.setUniforms({
|
|
117
|
+
size
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
setSpeed(speed) {
|
|
121
|
+
this.setUniforms({
|
|
122
|
+
snowSpeed: speed
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
setRain(scale) {
|
|
126
|
+
this.setUniforms({
|
|
127
|
+
rainT1density: scale
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
setSnow(scale) {
|
|
131
|
+
this.setUniforms({
|
|
132
|
+
snowT1density: scale
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
setEffect(ops) {
|
|
136
|
+
const {
|
|
137
|
+
size,
|
|
138
|
+
snowT1density,
|
|
139
|
+
rainT1density,
|
|
140
|
+
snowSpeed
|
|
141
|
+
} = ops;
|
|
142
|
+
Object.keys(ops).forEach(key => {
|
|
143
|
+
switch (key) {
|
|
144
|
+
case 'size':
|
|
145
|
+
this.setSize(size);
|
|
146
|
+
break;
|
|
147
|
+
case 'snowT1density':
|
|
148
|
+
this.setSpeed(snowSpeed);
|
|
149
|
+
break;
|
|
150
|
+
case 'rainT1density':
|
|
151
|
+
this.setRain(rainT1density);
|
|
152
|
+
break;
|
|
153
|
+
case 'snowSpeed':
|
|
154
|
+
this.setSnow(snowT1density);
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
update() {
|
|
160
|
+
const {
|
|
161
|
+
camera
|
|
162
|
+
} = use.useScene();
|
|
163
|
+
const {
|
|
164
|
+
iTime,
|
|
165
|
+
cameraPos
|
|
166
|
+
} = this.uniforms;
|
|
167
|
+
iTime.value += 0.1;
|
|
168
|
+
cameraPos.value = [camera.position.x, camera.position.y, camera.position.z];
|
|
169
|
+
}
|
|
170
|
+
delete() {
|
|
171
|
+
this.remove();
|
|
172
|
+
this.removeFromParent();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
205
175
|
export default RainMesh;
|
|
206
176
|
//# sourceMappingURL=plane.js.map
|