@anov/3d-ability 0.0.139 → 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,143 +1,153 @@
|
|
|
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 _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
-
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); }
|
|
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
1
|
import { ShaderMaterial, use } from '@anov/3d-core';
|
|
15
2
|
import { createRoundedClosedWallMesh } from "../../Utils/round-curve";
|
|
16
3
|
import { hexToRGBA, parseRGBA } from "../tool";
|
|
17
4
|
import FenceBase from "./FenceBase";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return _this;
|
|
5
|
+
class Fence_Roll_01 extends FenceBase {
|
|
6
|
+
constructor(option, areaInstance) {
|
|
7
|
+
super(option, areaInstance);
|
|
8
|
+
this.create();
|
|
9
|
+
}
|
|
10
|
+
create() {
|
|
11
|
+
this._mesh = this.createFenceMesh(this._points, this._corner, this._close, this._height, this._color, this._alpha);
|
|
12
|
+
this._mesh && this.add(this._mesh);
|
|
27
13
|
}
|
|
28
|
-
_createClass(Fence_Roll_01, [{
|
|
29
|
-
key: "create",
|
|
30
|
-
value: function create() {
|
|
31
|
-
this._mesh = this.createFenceMesh(this._points, this._corner, this._close, this._height, this._color, this._alpha);
|
|
32
|
-
this._mesh && this.add(this._mesh);
|
|
33
|
-
}
|
|
34
14
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var close = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
41
|
-
var height = arguments.length > 3 ? arguments[3] : undefined;
|
|
42
|
-
var color = arguments.length > 4 ? arguments[4] : undefined;
|
|
43
|
-
var alpha = arguments.length > 5 ? arguments[5] : undefined;
|
|
44
|
-
if (!points) return;
|
|
45
|
-
// 创建围栏使用的材质,调用createFenceMaterial方法生成ShaderMaterial类型的材质
|
|
46
|
-
var material = this.createFenceMaterial(height, color, alpha);
|
|
15
|
+
// 创建围栏网格对象
|
|
16
|
+
createFenceMesh(points, radius = 0, close = true, height, color, alpha) {
|
|
17
|
+
if (!points) return;
|
|
18
|
+
// 创建围栏使用的材质,调用createFenceMaterial方法生成ShaderMaterial类型的材质
|
|
19
|
+
const material = this.createFenceMaterial(height, color, alpha);
|
|
47
20
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
21
|
+
// 使用createRoundLineWallMesh函数创建围栏的网格物体,传入点数组、半径、高度、是否闭合等参数以及创建好的材质
|
|
22
|
+
const mesh = createRoundedClosedWallMesh(points, {
|
|
23
|
+
radius,
|
|
24
|
+
height,
|
|
25
|
+
close
|
|
26
|
+
}, material);
|
|
27
|
+
// const mesh = createRoundLineWallMesh(
|
|
28
|
+
// points,
|
|
29
|
+
// {
|
|
30
|
+
// radius,
|
|
31
|
+
// height,
|
|
32
|
+
// close,
|
|
33
|
+
// },
|
|
34
|
+
// material,
|
|
35
|
+
// )
|
|
36
|
+
use.useframe(() => {
|
|
37
|
+
// mesh.children.forEach((item, index) => {
|
|
38
|
+
// const uniforms = ((item as Mesh).material as ShaderMaterial).uniforms
|
|
39
|
+
// uniforms.iTime.value += 0.01
|
|
40
|
+
// })
|
|
68
41
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
42
|
+
const uniforms = mesh.material.uniforms;
|
|
43
|
+
uniforms.iTime.value += 0.002;
|
|
44
|
+
});
|
|
72
45
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
46
|
+
// // 创建围栏使用的材质,调用createFenceMaterial方法生成ShaderMaterial类型的材质
|
|
47
|
+
// const material = this.createFenceMaterial(height, color, alpha)
|
|
48
|
+
// // 使用createRoundLineWallMesh函数创建围栏的网格物体,传入点数组、半径、高度、是否闭合等参数以及创建好的材质
|
|
49
|
+
// const mesh = createRoundLineWallMesh(
|
|
50
|
+
// points,
|
|
51
|
+
// {
|
|
52
|
+
// radius,
|
|
53
|
+
// height,
|
|
54
|
+
// close,
|
|
55
|
+
// },
|
|
56
|
+
// material,
|
|
57
|
+
// )
|
|
58
|
+
// use.useframe(() => {
|
|
59
|
+
// mesh.children.forEach((item, index) => {
|
|
60
|
+
// const uniforms = ((item as Mesh).material as ShaderMaterial).uniforms
|
|
61
|
+
// uniforms.iTime.value += 0.002
|
|
62
|
+
// })
|
|
63
|
+
// })
|
|
64
|
+
return mesh;
|
|
65
|
+
}
|
|
93
66
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
value: colorTemp
|
|
113
|
-
},
|
|
114
|
-
// 材质颜色2,用于渐变
|
|
115
|
-
_alpha: {
|
|
116
|
-
value: alpha
|
|
117
|
-
},
|
|
118
|
-
_height: {
|
|
119
|
-
value: height
|
|
120
|
-
},
|
|
121
|
-
iTime: {
|
|
122
|
-
value: 0.0
|
|
123
|
-
}
|
|
67
|
+
// 创建围栏材质
|
|
68
|
+
createFenceMaterial(height, color, alpha) {
|
|
69
|
+
const {
|
|
70
|
+
r,
|
|
71
|
+
g,
|
|
72
|
+
b
|
|
73
|
+
} = parseRGBA(hexToRGBA(color));
|
|
74
|
+
const colorTemp = {
|
|
75
|
+
r: Number((Number(r) / 255).toFixed(4)),
|
|
76
|
+
g: Number((Number(g) / 255).toFixed(4)),
|
|
77
|
+
b: Number((Number(b) / 255).toFixed(4))
|
|
78
|
+
};
|
|
79
|
+
// 创建一个ShaderMaterial实例,用于自定义围栏的渲染效果
|
|
80
|
+
const material = new ShaderMaterial({
|
|
81
|
+
uniforms: {
|
|
82
|
+
// 材质颜色
|
|
83
|
+
color1: {
|
|
84
|
+
value: colorTemp
|
|
124
85
|
},
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
86
|
+
// 材质颜色2,用于渐变
|
|
87
|
+
_alpha: {
|
|
88
|
+
value: alpha
|
|
89
|
+
},
|
|
90
|
+
_height: {
|
|
91
|
+
value: height
|
|
92
|
+
},
|
|
93
|
+
iTime: {
|
|
94
|
+
value: 0.0
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
// 顶点着色器
|
|
98
|
+
vertexShader: `
|
|
99
|
+
#include <common>
|
|
100
|
+
#include <logdepthbuf_pars_vertex>
|
|
101
|
+
varying vec3 vNormal; // 用于传递法线方向
|
|
102
|
+
varying vec2 vUv;
|
|
103
|
+
varying vec3 vWorldPosition;
|
|
104
|
+
void main() {
|
|
105
|
+
#include <begin_vertex>
|
|
106
|
+
#include <project_vertex>
|
|
107
|
+
#include <logdepthbuf_vertex>
|
|
108
|
+
// gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
109
|
+
vUv = uv;
|
|
110
|
+
vNormal = normalize(mat3(modelMatrix) * normal); // 使用模型矩阵旋转法线
|
|
111
|
+
vec4 modelPosition = modelMatrix * vec4(position, 1.0);
|
|
112
|
+
vWorldPosition = modelPosition.xyz;
|
|
113
|
+
gl_Position = projectionMatrix * viewMatrix * modelPosition;
|
|
114
|
+
}
|
|
115
|
+
`,
|
|
116
|
+
// 片元着色器
|
|
117
|
+
fragmentShader: `
|
|
118
|
+
#include <common>
|
|
119
|
+
#include <logdepthbuf_pars_fragment>
|
|
120
|
+
varying vec3 vNormal; //
|
|
121
|
+
varying vec2 vUv;
|
|
122
|
+
varying vec3 vWorldPosition;
|
|
123
|
+
// uniform float button;
|
|
124
|
+
uniform float _height;
|
|
125
|
+
uniform float iTime;
|
|
126
|
+
uniform float _alpha;
|
|
127
|
+
uniform vec3 color1;
|
|
128
|
+
|
|
129
|
+
void main() {
|
|
130
|
+
#include <logdepthbuf_fragment>
|
|
131
|
+
// float height = 50.;
|
|
132
|
+
float button = 0.;
|
|
133
|
+
vec3 myWp=(vWorldPosition-button)/_height;
|
|
134
|
+
vec3 myWp_s=(vWorldPosition-button)*3./_height;
|
|
135
|
+
float Grandient= pow(1.-clamp(myWp.y,0.,1.),1.5);
|
|
136
|
+
float Grandient_s= pow(1.-fract(myWp_s.y-iTime),0.4);
|
|
137
|
+
gl_FragColor = vec4(color1,Grandient*Grandient_s*(0.8+sin(iTime*5.0)*0.3) ) *_alpha *step(button,myWp.y);
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
`,
|
|
141
|
+
// 设置材质为透明
|
|
142
|
+
transparent: true,
|
|
143
|
+
// 设置材质双面渲染,确保从正反两面都能正确显示
|
|
144
|
+
side: 2,
|
|
145
|
+
// 关闭深度测试
|
|
146
|
+
depthTest: true,
|
|
147
|
+
depthWrite: false
|
|
148
|
+
});
|
|
149
|
+
return material;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
142
152
|
export default Fence_Roll_01;
|
|
143
153
|
//# sourceMappingURL=fence_roll_01.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ShaderMaterial","use","createRoundedClosedWallMesh","hexToRGBA","parseRGBA","FenceBase","Fence_Roll_01","
|
|
1
|
+
{"version":3,"names":["ShaderMaterial","use","createRoundedClosedWallMesh","hexToRGBA","parseRGBA","FenceBase","Fence_Roll_01","constructor","option","areaInstance","create","_mesh","createFenceMesh","_points","_corner","_close","_height","_color","_alpha","add","points","radius","close","height","color","alpha","material","createFenceMaterial","mesh","useframe","uniforms","iTime","value","r","g","b","colorTemp","Number","toFixed","color1","vertexShader","fragmentShader","transparent","side","depthTest","depthWrite"],"sources":["../../../../src/business/Area/Fence/fence_roll_01.ts"],"sourcesContent":["import type { Mesh, Object3D, Vector3 } from '@anov/3d-core'\nimport { Color, ShaderMaterial, use } from '@anov/3d-core'\nimport { createRoundLineWallMesh, createRoundedClosedWallMesh } from '../../Utils/round-curve'\nimport type { FenceOption } from '../type'\nimport { hexToRGBA, parseRGBA } from '../tool'\nimport FenceBase from './FenceBase'\n\nclass Fence_Roll_01 extends FenceBase {\n constructor(option: FenceOption, areaInstance: Object3D) {\n super(option, areaInstance)\n this.create()\n }\n\n create() {\n this._mesh = this.createFenceMesh(\n this._points,\n this._corner,\n this._close,\n this._height,\n this._color,\n this._alpha,\n )\n this._mesh && this.add(this._mesh)\n }\n\n // 创建围栏网格对象\n createFenceMesh(points: Vector3[], radius = 0, close = true, height: number, color: string, alpha: number) {\n if (!points)\n return\n // 创建围栏使用的材质,调用createFenceMaterial方法生成ShaderMaterial类型的材质\n const material = this.createFenceMaterial(height, color, alpha)\n\n // 使用createRoundLineWallMesh函数创建围栏的网格物体,传入点数组、半径、高度、是否闭合等参数以及创建好的材质\n const mesh = createRoundedClosedWallMesh(\n points,\n {\n radius,\n height,\n close,\n },\n material,\n )\n // const mesh = createRoundLineWallMesh(\n // points,\n // {\n // radius,\n // height,\n // close,\n // },\n // material,\n // )\n use.useframe(() => {\n // mesh.children.forEach((item, index) => {\n // const uniforms = ((item as Mesh).material as ShaderMaterial).uniforms\n // uniforms.iTime.value += 0.01\n // })\n\n const uniforms = ((mesh as Mesh).material as ShaderMaterial).uniforms\n uniforms.iTime.value += 0.002\n })\n\n // // 创建围栏使用的材质,调用createFenceMaterial方法生成ShaderMaterial类型的材质\n // const material = this.createFenceMaterial(height, color, alpha)\n // // 使用createRoundLineWallMesh函数创建围栏的网格物体,传入点数组、半径、高度、是否闭合等参数以及创建好的材质\n // const mesh = createRoundLineWallMesh(\n // points,\n // {\n // radius,\n // height,\n // close,\n // },\n // material,\n // )\n // use.useframe(() => {\n // mesh.children.forEach((item, index) => {\n // const uniforms = ((item as Mesh).material as ShaderMaterial).uniforms\n // uniforms.iTime.value += 0.002\n // })\n // })\n return mesh\n }\n\n // 创建围栏材质\n createFenceMaterial(height: number, color: string, alpha: number): ShaderMaterial {\n const { r, g, b } = parseRGBA(hexToRGBA(color))\n const colorTemp = { r: Number((Number(r) / 255).toFixed(4)), g: Number((Number(g) / 255).toFixed(4)), b: Number((Number(b) / 255).toFixed(4)) }\n // 创建一个ShaderMaterial实例,用于自定义围栏的渲染效果\n const material = new ShaderMaterial({\n uniforms: {\n // 材质颜色\n color1: {\n value: colorTemp,\n }, // 材质颜色2,用于渐变\n _alpha: { value: alpha },\n _height: { value: height },\n iTime: { value: 0.0 },\n },\n // 顶点着色器\n vertexShader: `\n #include <common>\n #include <logdepthbuf_pars_vertex>\n varying vec3 vNormal; // 用于传递法线方向\n varying vec2 vUv;\n varying vec3 vWorldPosition;\n void main() {\n \t#include <begin_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n // gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n vUv = uv;\n vNormal = normalize(mat3(modelMatrix) * normal); // 使用模型矩阵旋转法线\n vec4 modelPosition = modelMatrix * vec4(position, 1.0);\n vWorldPosition = modelPosition.xyz;\n gl_Position = projectionMatrix * viewMatrix * modelPosition;\n }\n `,\n // 片元着色器\n fragmentShader: `\n #include <common>\n #include <logdepthbuf_pars_fragment>\n varying vec3 vNormal; //\n varying vec2 vUv;\n varying vec3 vWorldPosition;\n // uniform float button;\n uniform float _height;\n uniform float iTime;\n uniform float _alpha;\n uniform vec3 color1;\n \n void main() {\n #include <logdepthbuf_fragment>\n // float height = 50.;\n float button = 0.;\n vec3 myWp=(vWorldPosition-button)/_height; \n vec3 myWp_s=(vWorldPosition-button)*3./_height; \n float Grandient= pow(1.-clamp(myWp.y,0.,1.),1.5); \n float Grandient_s= pow(1.-fract(myWp_s.y-iTime),0.4); \n gl_FragColor = vec4(color1,Grandient*Grandient_s*(0.8+sin(iTime*5.0)*0.3) ) *_alpha *step(button,myWp.y);\n \n }\n `,\n // 设置材质为透明\n transparent: true,\n // 设置材质双面渲染,确保从正反两面都能正确显示\n side: 2,\n // 关闭深度测试\n depthTest: true,\n depthWrite: false,\n })\n return material\n }\n}\n\nexport default Fence_Roll_01\n"],"mappings":"AACA,SAAgBA,cAAc,EAAEC,GAAG,QAAQ,eAAe;AAC1D,SAAkCC,2BAA2B;AAE7D,SAASC,SAAS,EAAEC,SAAS;AAC7B,OAAOC,SAAS;AAEhB,MAAMC,aAAa,SAASD,SAAS,CAAC;EACpCE,WAAWA,CAACC,MAAmB,EAAEC,YAAsB,EAAE;IACvD,KAAK,CAACD,MAAM,EAAEC,YAAY,CAAC;IAC3B,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;EAEAA,MAAMA,CAAA,EAAG;IACP,IAAI,CAACC,KAAK,GAAG,IAAI,CAACC,eAAe,CAC/B,IAAI,CAACC,OAAO,EACZ,IAAI,CAACC,OAAO,EACZ,IAAI,CAACC,MAAM,EACX,IAAI,CAACC,OAAO,EACZ,IAAI,CAACC,MAAM,EACX,IAAI,CAACC,MACP,CAAC;IACD,IAAI,CAACP,KAAK,IAAI,IAAI,CAACQ,GAAG,CAAC,IAAI,CAACR,KAAK,CAAC;EACpC;;EAEA;EACAC,eAAeA,CAACQ,MA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AAC;IAAE,CAAC;IAC/I;IACA,MAAMZ,QAAQ,GAAG,IAAI1B,cAAc,CAAC;MAClC8B,QAAQ,EAAE;QACR;QACAS,MAAM,EAAE;UACNP,KAAK,EAAEI;QACT,CAAC;QAAE;QACHlB,MAAM,EAAE;UAAEc,KAAK,EAAEP;QAAM,CAAC;QACxBT,OAAO,EAAE;UAAEgB,KAAK,EAAET;QAAO,CAAC;QAC1BQ,KAAK,EAAE;UAAEC,KAAK,EAAE;QAAI;MACtB,CAAC;MACD;MACAQ,YAAY,EAAG;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;MACD;MACAC,cAAc,EAAG;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;MACD;MACAC,WAAW,EAAE,IAAI;MACjB;MACAC,IAAI,EAAE,CAAC;MACP;MACAC,SAAS,EAAE,IAAI;MACfC,UAAU,EAAE;IACd,CAAC,CAAC;IACF,OAAOnB,QAAQ;EACjB;AACF;AAEA,eAAepB,aAAa"}
|
|
@@ -1,138 +1,99 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
6
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
7
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
9
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
10
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
12
1
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" ==
|
|
14
|
-
function _toPrimitive(t, r) { if ("object" !=
|
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
4
|
import { Color } from '@anov/3d-core';
|
|
16
5
|
import ObjectLayer from "../../Base/ObjectLayer";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
_defineProperty(
|
|
25
|
-
_defineProperty(
|
|
26
|
-
_defineProperty(
|
|
27
|
-
_defineProperty(
|
|
28
|
-
_defineProperty(
|
|
29
|
-
_defineProperty(
|
|
30
|
-
|
|
31
|
-
_defineProperty(_assertThisInitialized(_this), "_option", void 0);
|
|
32
|
-
_defineProperty(_assertThisInitialized(_this), "_listeners", new Set());
|
|
33
|
-
_defineProperty(_assertThisInitialized(_this), "_areaInstance", void 0);
|
|
34
|
-
_this._option = option;
|
|
6
|
+
class FillAreaBase extends ObjectLayer {
|
|
7
|
+
constructor(option, areaInstance) {
|
|
8
|
+
super();
|
|
9
|
+
_defineProperty(this, "_mesh", void 0);
|
|
10
|
+
_defineProperty(this, "_alpha", void 0);
|
|
11
|
+
_defineProperty(this, "_color", void 0);
|
|
12
|
+
_defineProperty(this, "_corner", void 0);
|
|
13
|
+
_defineProperty(this, "_close", void 0);
|
|
14
|
+
_defineProperty(this, "_points", void 0);
|
|
15
|
+
_defineProperty(this, "_uri", void 0);
|
|
16
|
+
_defineProperty(this, "_option", void 0);
|
|
17
|
+
_defineProperty(this, "_listeners", new Set());
|
|
18
|
+
_defineProperty(this, "_areaInstance", void 0);
|
|
19
|
+
this._option = option;
|
|
35
20
|
// 属性赋值
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
this._initParams(option);
|
|
22
|
+
this._areaInstance = areaInstance;
|
|
38
23
|
// 属性赋值
|
|
39
24
|
// this.setValues(_.mergeWith({}, defaultOption, option))
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this._uri = value;
|
|
56
|
-
// eslint-disable-next-line max-statements-per-line
|
|
57
|
-
this._listeners.forEach(function (cb) {
|
|
58
|
-
cb.call(_this2._areaInstance);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
25
|
+
}
|
|
26
|
+
get mesh() {
|
|
27
|
+
return this._mesh;
|
|
28
|
+
}
|
|
29
|
+
get uri() {
|
|
30
|
+
return this._uri;
|
|
31
|
+
}
|
|
32
|
+
set uri(value) {
|
|
33
|
+
if (this._uri === value) return;
|
|
34
|
+
this._uri = value;
|
|
35
|
+
// eslint-disable-next-line max-statements-per-line
|
|
36
|
+
this._listeners.forEach(cb => {
|
|
37
|
+
cb.call(this._areaInstance);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
61
40
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (this._mesh) this._mesh.material.opacity = newValue;
|
|
72
|
-
}
|
|
41
|
+
// Getter and Setter for alpha property
|
|
42
|
+
get alpha() {
|
|
43
|
+
return this._alpha;
|
|
44
|
+
}
|
|
45
|
+
set alpha(newValue) {
|
|
46
|
+
if (this._alpha === newValue) return;
|
|
47
|
+
this._alpha = newValue;
|
|
48
|
+
if (this._mesh) this._mesh.material.opacity = newValue;
|
|
49
|
+
}
|
|
73
50
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this._corner = option.corner;
|
|
110
|
-
this._points = option.points;
|
|
111
|
-
this._uri = option.uri;
|
|
112
|
-
}
|
|
113
|
-
}, {
|
|
114
|
-
key: "delete",
|
|
115
|
-
value: function _delete() {
|
|
116
|
-
this._mesh.remove();
|
|
117
|
-
this._mesh.removeFromParent();
|
|
118
|
-
}
|
|
51
|
+
// Getter and Setter for color property
|
|
52
|
+
get color() {
|
|
53
|
+
return this._color;
|
|
54
|
+
}
|
|
55
|
+
set color(newValue) {
|
|
56
|
+
if (this._color === newValue) return;
|
|
57
|
+
this._color = newValue;
|
|
58
|
+
if (this._mesh) this._mesh.material.color = new Color(newValue);
|
|
59
|
+
}
|
|
60
|
+
get corner() {
|
|
61
|
+
return this._corner;
|
|
62
|
+
}
|
|
63
|
+
set corner(newValue) {
|
|
64
|
+
if (this._corner === newValue) return;
|
|
65
|
+
this._corner = newValue;
|
|
66
|
+
}
|
|
67
|
+
get close() {
|
|
68
|
+
return this._close;
|
|
69
|
+
}
|
|
70
|
+
set close(newValue) {
|
|
71
|
+
if (this._close === newValue) return;
|
|
72
|
+
this._close = newValue;
|
|
73
|
+
}
|
|
74
|
+
_initParams(option) {
|
|
75
|
+
this._alpha = option.alpha;
|
|
76
|
+
this._color = option.color;
|
|
77
|
+
this._close = option.close;
|
|
78
|
+
this._corner = option.corner;
|
|
79
|
+
this._points = option.points;
|
|
80
|
+
this._uri = option.uri;
|
|
81
|
+
}
|
|
82
|
+
delete() {
|
|
83
|
+
this._mesh.remove();
|
|
84
|
+
this._mesh.removeFromParent();
|
|
85
|
+
}
|
|
119
86
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this._listeners.clear();
|
|
126
|
-
}
|
|
87
|
+
// 销毁
|
|
88
|
+
dispose() {
|
|
89
|
+
this.delete();
|
|
90
|
+
this._listeners.clear();
|
|
91
|
+
}
|
|
127
92
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
}]);
|
|
135
|
-
return FillAreaBase;
|
|
136
|
-
}(ObjectLayer);
|
|
93
|
+
// 注册监听
|
|
94
|
+
addReloadListener(callback) {
|
|
95
|
+
this._listeners.add(callback);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
137
98
|
export default FillAreaBase;
|
|
138
99
|
//# sourceMappingURL=FillAreaBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Color","ObjectLayer","FillAreaBase","
|
|
1
|
+
{"version":3,"names":["Color","ObjectLayer","FillAreaBase","constructor","option","areaInstance","_defineProperty","Set","_option","_initParams","_areaInstance","mesh","_mesh","uri","_uri","value","_listeners","forEach","cb","call","alpha","_alpha","newValue","material","opacity","color","_color","corner","_corner","close","_close","_points","points","delete","remove","removeFromParent","dispose","clear","addReloadListener","callback","add"],"sources":["../../../../src/business/Area/FillArea/FillAreaBase.ts"],"sourcesContent":["import type { Line2, Mesh, MeshBasicMaterial, Object3D, Vector3 } from '@anov/3d-core'\nimport { Color } from '@anov/3d-core'\n\nimport _ from 'lodash'\nimport ObjectLayer from '../../Base/ObjectLayer'\nimport type { FillAreaOption } from '../type'\n\nclass FillAreaBase extends ObjectLayer {\n public _mesh!: Mesh | Line2\n public _alpha: number\n public _color: string\n public _corner: number\n public _close: boolean\n public _points!: Vector3[]\n public _uri: string\n public _option: FillAreaOption\n public _listeners = new Set()\n\n private _areaInstance: Object3D\n\n constructor(option: FillAreaOption, areaInstance: Object3D) {\n super()\n this._option = option\n // 属性赋值\n this._initParams(option)\n this._areaInstance = areaInstance\n // 属性赋值\n // this.setValues(_.mergeWith({}, defaultOption, option))\n }\n\n public get mesh() {\n return this._mesh\n }\n\n public get uri() {\n return this._uri\n }\n\n public set uri(value: string) {\n if (this._uri === value)\n return\n this._uri = value\n // eslint-disable-next-line max-statements-per-line\n this._listeners.forEach((cb: Function) => { cb.call(this._areaInstance) })\n }\n\n // Getter and Setter for alpha property\n get alpha(): number {\n return this._alpha\n }\n\n set alpha(newValue: number) {\n if (this._alpha === newValue)\n return\n\n this._alpha = newValue\n if (this._mesh)\n (this._mesh.material as MeshBasicMaterial).opacity = newValue\n }\n\n // Getter and Setter for color property\n get color(): string {\n return this._color\n }\n\n set color(newValue: string) {\n if (this._color === newValue)\n return\n\n this._color = newValue\n if (this._mesh)\n (this._mesh.material as MeshBasicMaterial).color = new Color(newValue)\n }\n\n get corner(): number {\n return this._corner\n }\n\n set corner(newValue: number) {\n if (this._corner === newValue)\n return\n\n this._corner = newValue\n }\n\n get close(): boolean {\n return this._close\n }\n\n set close(newValue: boolean) {\n if (this._close === newValue)\n return\n\n this._close = newValue\n }\n\n _initParams(option: FillAreaOption) {\n this._alpha = option.alpha\n this._color = option.color\n this._close = option.close\n this._corner = option.corner\n this._points = option.points as unknown as Vector3[]\n this._uri = option.uri\n }\n\n public delete() {\n this._mesh.remove()\n this._mesh.removeFromParent()\n }\n\n // 销毁\n public dispose() {\n this.delete()\n this._listeners.clear()\n }\n\n // 注册监听\n public addReloadListener(callback: Function) {\n this._listeners.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