@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,591 +1,417 @@
|
|
|
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
1
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
2
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
-
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); } }
|
|
7
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
-
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); }
|
|
9
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
10
|
-
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); }; }
|
|
11
|
-
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); }
|
|
12
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
13
|
-
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; } }
|
|
14
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
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; }
|
|
16
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" ==
|
|
17
|
-
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); }
|
|
18
6
|
import { AmbientLight, Box3, Color, Mesh, MeshBasicMaterial, Object3D, PlaneGeometry, Vector3, gsap, use } from '@anov/3d-core';
|
|
19
7
|
import { SurfaceMaterial } from "../../";
|
|
20
8
|
import { finirheightTransitionEffect, finirlowEffect, inject, injectToBaseWrite, injectToFinirMaterial, injectToFrameFade, injectToGround, injectToRealFade } from "./inject";
|
|
21
|
-
export
|
|
9
|
+
export let SwitchType = /*#__PURE__*/function (SwitchType) {
|
|
22
10
|
SwitchType["Real"] = "Real";
|
|
23
11
|
SwitchType["Fresnel"] = "Fresnel";
|
|
24
12
|
SwitchType["Frame"] = "Frame";
|
|
25
13
|
SwitchType["Pure"] = "Pure";
|
|
26
14
|
return SwitchType;
|
|
27
15
|
}({});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
const DEFAULT_CENTER = new Vector3();
|
|
17
|
+
const GROUND_Y_OFFSET = -0.1;
|
|
18
|
+
const SIZE_SCALE_FACTOR = 1.2;
|
|
19
|
+
const GROUND_MATCHING = ['Ground', 'Road', 'Yard'];
|
|
32
20
|
|
|
33
21
|
/**
|
|
34
22
|
* 材质切换系统
|
|
35
23
|
*/
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
_defineProperty(
|
|
44
|
-
_defineProperty(_assertThisInitialized(_this), "originalMaterial", new Map());
|
|
45
|
-
_defineProperty(_assertThisInitialized(_this), "uniforms", void 0);
|
|
46
|
-
_defineProperty(_assertThisInitialized(_this), "objects", new Map());
|
|
47
|
-
_defineProperty(_assertThisInitialized(_this), "objectsMap", {
|
|
24
|
+
export class MaterialSwitchSystem extends Object3D {
|
|
25
|
+
constructor(options) {
|
|
26
|
+
super();
|
|
27
|
+
_defineProperty(this, "type", SwitchType.Real);
|
|
28
|
+
_defineProperty(this, "originalMaterial", new Map());
|
|
29
|
+
_defineProperty(this, "uniforms", void 0);
|
|
30
|
+
_defineProperty(this, "objects", new Map());
|
|
31
|
+
_defineProperty(this, "objectsMap", {
|
|
48
32
|
Real: new Map(),
|
|
49
33
|
Frame: new Map(),
|
|
50
34
|
Pure: new Map(),
|
|
51
35
|
Fresnel: new Map()
|
|
52
36
|
});
|
|
53
|
-
_defineProperty(
|
|
54
|
-
_defineProperty(
|
|
55
|
-
_defineProperty(
|
|
56
|
-
_defineProperty(
|
|
57
|
-
_defineProperty(
|
|
58
|
-
_defineProperty(
|
|
59
|
-
_defineProperty(
|
|
60
|
-
matchSize:
|
|
61
|
-
|
|
37
|
+
_defineProperty(this, "frame", null);
|
|
38
|
+
_defineProperty(this, "gsap", null);
|
|
39
|
+
_defineProperty(this, "duration", void 0);
|
|
40
|
+
_defineProperty(this, "center", void 0);
|
|
41
|
+
_defineProperty(this, "isGenPlane", false);
|
|
42
|
+
_defineProperty(this, "rules", []);
|
|
43
|
+
_defineProperty(this, "matchingStrategy", {
|
|
44
|
+
matchSize: (rule, type) => this.handleSizeMatching(rule, type),
|
|
45
|
+
matchName: (rule, type) => this.handleNameMatching(rule, type)
|
|
46
|
+
});
|
|
47
|
+
const {
|
|
48
|
+
duration,
|
|
49
|
+
center = DEFAULT_CENTER,
|
|
50
|
+
isApi = false
|
|
51
|
+
} = options !== null && options !== void 0 ? options : {};
|
|
52
|
+
this.duration = duration;
|
|
53
|
+
this.center = center;
|
|
54
|
+
this.uniforms = this.initializeUniforms();
|
|
55
|
+
this.uniforms.isApi.value = isApi;
|
|
56
|
+
this.initializeBuiltInShader();
|
|
57
|
+
use.useframe(() => {
|
|
58
|
+
this.uniforms.time.value += 0.00018;
|
|
59
|
+
this.uniforms.height.value -= 1;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
initializeUniforms() {
|
|
63
|
+
return {
|
|
64
|
+
progress: {
|
|
65
|
+
value: 1.0
|
|
66
|
+
},
|
|
67
|
+
isFresnelFadeIn: {
|
|
68
|
+
value: false
|
|
69
|
+
},
|
|
70
|
+
isRealFadeIn: {
|
|
71
|
+
value: true
|
|
72
|
+
},
|
|
73
|
+
isPureFadeIn: {
|
|
74
|
+
value: false
|
|
62
75
|
},
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
isFrameFadeIn: {
|
|
77
|
+
value: false
|
|
78
|
+
},
|
|
79
|
+
maxSize: {
|
|
80
|
+
value: 0
|
|
81
|
+
},
|
|
82
|
+
center: {
|
|
83
|
+
value: this.center
|
|
84
|
+
},
|
|
85
|
+
time: {
|
|
86
|
+
value: 0
|
|
87
|
+
},
|
|
88
|
+
height: {
|
|
89
|
+
value: 0
|
|
90
|
+
},
|
|
91
|
+
isApi: {
|
|
92
|
+
value: false
|
|
65
93
|
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
initializeBuiltInShader() {
|
|
97
|
+
SurfaceMaterial.getMaterialAll();
|
|
98
|
+
}
|
|
99
|
+
hideAllObjects() {
|
|
100
|
+
Object.values(this.objectsMap).forEach(objectMap => {
|
|
101
|
+
objectMap.forEach(object => {
|
|
102
|
+
object.visible = false;
|
|
103
|
+
});
|
|
66
104
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
_ref$isApi = _ref.isApi,
|
|
72
|
-
isApi = _ref$isApi === void 0 ? false : _ref$isApi;
|
|
73
|
-
_this.duration = duration;
|
|
74
|
-
_this.center = center;
|
|
75
|
-
_this.uniforms = _this.initializeUniforms();
|
|
76
|
-
_this.uniforms.isApi.value = isApi;
|
|
77
|
-
_this.initializeBuiltInShader();
|
|
78
|
-
use.useframe(function () {
|
|
79
|
-
_this.uniforms.time.value += 0.00018;
|
|
80
|
-
_this.uniforms.height.value -= 1;
|
|
105
|
+
}
|
|
106
|
+
showObjectsByType(type) {
|
|
107
|
+
this.objectsMap[type].forEach(object => {
|
|
108
|
+
object.visible = true;
|
|
81
109
|
});
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
isRealFadeIn: {
|
|
95
|
-
value: true
|
|
96
|
-
},
|
|
97
|
-
isPureFadeIn: {
|
|
98
|
-
value: false
|
|
99
|
-
},
|
|
100
|
-
isFrameFadeIn: {
|
|
101
|
-
value: false
|
|
102
|
-
},
|
|
103
|
-
maxSize: {
|
|
104
|
-
value: 0
|
|
105
|
-
},
|
|
106
|
-
center: {
|
|
107
|
-
value: this.center
|
|
108
|
-
},
|
|
109
|
-
time: {
|
|
110
|
-
value: 0
|
|
111
|
-
},
|
|
112
|
-
height: {
|
|
113
|
-
value: 0
|
|
114
|
-
},
|
|
115
|
-
isApi: {
|
|
116
|
-
value: false
|
|
117
|
-
}
|
|
118
|
-
};
|
|
110
|
+
}
|
|
111
|
+
switchType(type, option) {
|
|
112
|
+
var _option$rules;
|
|
113
|
+
if (this.type === type) return;
|
|
114
|
+
const light = use.useScene().scene.getObjectByName('FresnelLight');
|
|
115
|
+
if (light) light.removeFromParent();
|
|
116
|
+
if (type !== SwitchType.Real) {
|
|
117
|
+
const _light = new AmbientLight(0xFFFFFF, 1.5);
|
|
118
|
+
_light.name = 'FresnelLight';
|
|
119
|
+
use.useScene().scene.add(_light);
|
|
120
|
+
if (type === SwitchType.Pure) _light.intensity = 0.5;
|
|
119
121
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
if ((option === null || option === void 0 || (_option$rules = option.rules) === null || _option$rules === void 0 ? void 0 : _option$rules.length) > 0) {
|
|
123
|
+
this.rules = option.rules;
|
|
124
|
+
} else {
|
|
125
|
+
this.rules = [{
|
|
126
|
+
type: 'matchName',
|
|
127
|
+
keys: ['Tall'],
|
|
128
|
+
material: 'MfresnelGlow'
|
|
129
|
+
}, {
|
|
130
|
+
type: 'matchName',
|
|
131
|
+
keys: ['Fence'],
|
|
132
|
+
material: 'Moriginal'
|
|
133
|
+
}, {
|
|
134
|
+
type: 'matchName',
|
|
135
|
+
keys: ['Low'],
|
|
136
|
+
material: 'MlowFinir'
|
|
137
|
+
}, {
|
|
138
|
+
type: 'matchName',
|
|
139
|
+
keys: ['Window'],
|
|
140
|
+
material: 'Fresnel_Transparent',
|
|
141
|
+
limit: SwitchType.Fresnel
|
|
142
|
+
}];
|
|
124
143
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
144
|
+
this.handleApiOption(option);
|
|
145
|
+
this.handleMatch(type);
|
|
146
|
+
this.cleanupAnimations();
|
|
147
|
+
this.prepareForSwitch(type);
|
|
148
|
+
this.startSwitchAnimation(type);
|
|
149
|
+
this.type = type;
|
|
150
|
+
}
|
|
151
|
+
handleApiOption(option) {
|
|
152
|
+
const {
|
|
153
|
+
mode = 'auto',
|
|
154
|
+
duration = 2,
|
|
155
|
+
center = [0, 0, 0],
|
|
156
|
+
genPlane = true
|
|
157
|
+
} = option !== null && option !== void 0 ? option : {};
|
|
158
|
+
if (mode === 'auto') this.duration = undefined;else this.duration = duration;
|
|
159
|
+
this.uniforms.center.value = new Vector3().fromArray(center);
|
|
160
|
+
this.isGenPlane = genPlane;
|
|
161
|
+
}
|
|
162
|
+
cleanupAnimations() {
|
|
163
|
+
var _this$frame, _this$gsap;
|
|
164
|
+
(_this$frame = this.frame) === null || _this$frame === void 0 || _this$frame.call(this);
|
|
165
|
+
(_this$gsap = this.gsap) === null || _this$gsap === void 0 || _this$gsap.kill();
|
|
166
|
+
}
|
|
167
|
+
prepareForSwitch(newType) {
|
|
168
|
+
this.hideAllObjects();
|
|
169
|
+
this.showObjectsByType(newType);
|
|
170
|
+
this.showObjectsByType(this.type);
|
|
171
|
+
const groundObject = this.objectsMap[newType].get('ground');
|
|
172
|
+
const lastGroundObject = this.objectsMap[this.type].get('ground');
|
|
173
|
+
if (groundObject) groundObject.visible = this.isGenPlane;
|
|
174
|
+
if (lastGroundObject) lastGroundObject.visible = lastGroundObject.userData.isVisible;
|
|
175
|
+
this.uniforms.progress.value = 0.0;
|
|
176
|
+
this.uniforms[`is${this.type}FadeIn`].value = false;
|
|
177
|
+
this.uniforms[`is${newType}FadeIn`].value = true;
|
|
178
|
+
}
|
|
179
|
+
startSwitchAnimation(newType) {
|
|
180
|
+
const lastType = this.type;
|
|
181
|
+
const onComplete = () => {
|
|
182
|
+
this.objectsMap[lastType].forEach(object => {
|
|
183
|
+
object.visible = false;
|
|
132
184
|
});
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
value: function showObjectsByType(type) {
|
|
137
|
-
this.objectsMap[type].forEach(function (object) {
|
|
138
|
-
object.visible = true;
|
|
185
|
+
this.dispatchEvent({
|
|
186
|
+
type: 'onStyleChanged',
|
|
187
|
+
style: newType
|
|
139
188
|
});
|
|
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
|
-
type: 'matchName',
|
|
171
|
-
keys: ['Window'],
|
|
172
|
-
material: 'Fresnel_Transparent',
|
|
173
|
-
limit: SwitchType.Fresnel
|
|
174
|
-
}];
|
|
175
|
-
}
|
|
176
|
-
this.handleApiOption(option);
|
|
177
|
-
this.handleMatch(type);
|
|
178
|
-
this.cleanupAnimations();
|
|
179
|
-
this.prepareForSwitch(type);
|
|
180
|
-
this.startSwitchAnimation(type);
|
|
181
|
-
this.type = type;
|
|
182
|
-
}
|
|
183
|
-
}, {
|
|
184
|
-
key: "handleApiOption",
|
|
185
|
-
value: function handleApiOption(option) {
|
|
186
|
-
var _ref2 = option !== null && option !== void 0 ? option : {},
|
|
187
|
-
_ref2$mode = _ref2.mode,
|
|
188
|
-
mode = _ref2$mode === void 0 ? 'auto' : _ref2$mode,
|
|
189
|
-
_ref2$duration = _ref2.duration,
|
|
190
|
-
duration = _ref2$duration === void 0 ? 2 : _ref2$duration,
|
|
191
|
-
_ref2$center = _ref2.center,
|
|
192
|
-
center = _ref2$center === void 0 ? [0, 0, 0] : _ref2$center,
|
|
193
|
-
_ref2$genPlane = _ref2.genPlane,
|
|
194
|
-
genPlane = _ref2$genPlane === void 0 ? true : _ref2$genPlane;
|
|
195
|
-
if (mode === 'auto') this.duration = undefined;else this.duration = duration;
|
|
196
|
-
this.uniforms.center.value = new Vector3().fromArray(center);
|
|
197
|
-
this.isGenPlane = genPlane;
|
|
198
|
-
}
|
|
199
|
-
}, {
|
|
200
|
-
key: "cleanupAnimations",
|
|
201
|
-
value: function cleanupAnimations() {
|
|
202
|
-
var _this$frame, _this$gsap;
|
|
203
|
-
(_this$frame = this.frame) === null || _this$frame === void 0 || _this$frame.call(this);
|
|
204
|
-
(_this$gsap = this.gsap) === null || _this$gsap === void 0 || _this$gsap.kill();
|
|
205
|
-
}
|
|
206
|
-
}, {
|
|
207
|
-
key: "prepareForSwitch",
|
|
208
|
-
value: function prepareForSwitch(newType) {
|
|
209
|
-
this.hideAllObjects();
|
|
210
|
-
this.showObjectsByType(newType);
|
|
211
|
-
this.showObjectsByType(this.type);
|
|
212
|
-
var groundObject = this.objectsMap[newType].get('ground');
|
|
213
|
-
var lastGroundObject = this.objectsMap[this.type].get('ground');
|
|
214
|
-
if (groundObject) groundObject.visible = this.isGenPlane;
|
|
215
|
-
if (lastGroundObject) lastGroundObject.visible = lastGroundObject.userData.isVisible;
|
|
216
|
-
this.uniforms.progress.value = 0.0;
|
|
217
|
-
this.uniforms["is".concat(this.type, "FadeIn")].value = false;
|
|
218
|
-
this.uniforms["is".concat(newType, "FadeIn")].value = true;
|
|
219
|
-
}
|
|
220
|
-
}, {
|
|
221
|
-
key: "startSwitchAnimation",
|
|
222
|
-
value: function startSwitchAnimation(newType) {
|
|
223
|
-
var _this2 = this;
|
|
224
|
-
var lastType = this.type;
|
|
225
|
-
var onComplete = function onComplete() {
|
|
226
|
-
_this2.objectsMap[lastType].forEach(function (object) {
|
|
227
|
-
object.visible = false;
|
|
228
|
-
});
|
|
229
|
-
_this2.dispatchEvent({
|
|
230
|
-
type: 'onStyleChanged',
|
|
231
|
-
style: newType
|
|
232
|
-
});
|
|
233
|
-
};
|
|
234
|
-
requestAnimationFrame(function () {
|
|
235
|
-
if (_this2.duration) _this2.animateWithGSAP(onComplete);else _this2.animateWithFrame(onComplete);
|
|
189
|
+
};
|
|
190
|
+
requestAnimationFrame(() => {
|
|
191
|
+
if (this.duration) this.animateWithGSAP(onComplete);else this.animateWithFrame(onComplete);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
animateWithGSAP(onComplete) {
|
|
195
|
+
this.gsap = gsap.to(this.uniforms.progress, {
|
|
196
|
+
value: 1.0,
|
|
197
|
+
duration: this.duration,
|
|
198
|
+
ease: 'linear',
|
|
199
|
+
onComplete
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
beginBySpeed(distance, onFinish) {
|
|
203
|
+
var _this = this;
|
|
204
|
+
return _asyncToGenerator(function* () {
|
|
205
|
+
if (distance === 0) distance = 0.01;
|
|
206
|
+
let currDistance = 0;
|
|
207
|
+
let speed = 0;
|
|
208
|
+
let acc = 0;
|
|
209
|
+
_this.frame = use.useframe(deltaTime => {
|
|
210
|
+
acc += distance * deltaTime;
|
|
211
|
+
speed += acc * deltaTime;
|
|
212
|
+
currDistance += speed * deltaTime;
|
|
213
|
+
_this.uniforms.progress.value = Math.min(1, currDistance / distance);
|
|
214
|
+
if (currDistance >= distance) {
|
|
215
|
+
var _this$frame2;
|
|
216
|
+
(_this$frame2 = _this.frame) === null || _this$frame2 === void 0 || _this$frame2.call(_this);
|
|
217
|
+
onFinish === null || onFinish === void 0 || onFinish();
|
|
218
|
+
}
|
|
236
219
|
});
|
|
220
|
+
})();
|
|
221
|
+
}
|
|
222
|
+
animateWithFrame(onComplete) {
|
|
223
|
+
this.beginBySpeed(this.getMaxSize(), onComplete);
|
|
224
|
+
}
|
|
225
|
+
addObject(object) {
|
|
226
|
+
this.switchType(SwitchType.Real);
|
|
227
|
+
const uuid = this.getObjectUuid(object);
|
|
228
|
+
this.objects.set(uuid, object);
|
|
229
|
+
this.handleNormalObject(object, uuid);
|
|
230
|
+
this.updateVisibility();
|
|
231
|
+
}
|
|
232
|
+
getObjectUuid(object) {
|
|
233
|
+
// @ts-ignore
|
|
234
|
+
return object.tag === 'entity' ? object.entityId : object.uuid;
|
|
235
|
+
}
|
|
236
|
+
handleGroundObject(type) {
|
|
237
|
+
if (this.objectsMap[type].has('ground')) {
|
|
238
|
+
this.updateGroundMesh(type);
|
|
239
|
+
} else {
|
|
240
|
+
const groundMesh = this.createGroundMesh();
|
|
241
|
+
injectToGround(groundMesh, type, this.uniforms);
|
|
242
|
+
this.objectsMap[type].set('ground', groundMesh);
|
|
243
|
+
this.add(groundMesh);
|
|
237
244
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
const groundObject = this.objectsMap[type].get('ground');
|
|
246
|
+
if (groundObject) this.isGenPlane ? groundObject.userData.isVisible = true : groundObject.userData.isVisible = false;
|
|
247
|
+
}
|
|
248
|
+
handleGroundMatching(type) {
|
|
249
|
+
if (type === SwitchType.Real) return;
|
|
250
|
+
let isMatch = false;
|
|
251
|
+
this.objectsMap[type].forEach(object => {
|
|
252
|
+
object.traverse(child => {
|
|
253
|
+
if (GROUND_MATCHING.some(matching => child.name.includes(matching))) {
|
|
254
|
+
if (this.isGenPlane) child.visible = false;else child.visible = true;
|
|
255
|
+
isMatch = true;
|
|
256
|
+
}
|
|
246
257
|
});
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
if (currDistance >= distance) {
|
|
267
|
-
var _this3$frame;
|
|
268
|
-
(_this3$frame = _this3.frame) === null || _this3$frame === void 0 || _this3$frame.call(_this3);
|
|
269
|
-
onFinish === null || onFinish === void 0 || onFinish();
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
case 5:
|
|
273
|
-
case "end":
|
|
274
|
-
return _context.stop();
|
|
275
|
-
}
|
|
276
|
-
}, _callee, this);
|
|
277
|
-
}));
|
|
278
|
-
function beginBySpeed(_x, _x2) {
|
|
279
|
-
return _beginBySpeed.apply(this, arguments);
|
|
280
|
-
}
|
|
281
|
-
return beginBySpeed;
|
|
282
|
-
}()
|
|
283
|
-
}, {
|
|
284
|
-
key: "animateWithFrame",
|
|
285
|
-
value: function animateWithFrame(onComplete) {
|
|
286
|
-
this.beginBySpeed(this.getMaxSize(), onComplete);
|
|
287
|
-
}
|
|
288
|
-
}, {
|
|
289
|
-
key: "addObject",
|
|
290
|
-
value: function addObject(object) {
|
|
291
|
-
this.switchType(SwitchType.Real);
|
|
292
|
-
var uuid = this.getObjectUuid(object);
|
|
293
|
-
this.objects.set(uuid, object);
|
|
294
|
-
this.handleNormalObject(object, uuid);
|
|
295
|
-
this.updateVisibility();
|
|
296
|
-
}
|
|
297
|
-
}, {
|
|
298
|
-
key: "getObjectUuid",
|
|
299
|
-
value: function getObjectUuid(object) {
|
|
300
|
-
// @ts-ignore
|
|
301
|
-
return object.tag === 'entity' ? object.entityId : object.uuid;
|
|
302
|
-
}
|
|
303
|
-
}, {
|
|
304
|
-
key: "handleGroundObject",
|
|
305
|
-
value: function handleGroundObject(type) {
|
|
306
|
-
if (this.objectsMap[type].has('ground')) {
|
|
307
|
-
this.updateGroundMesh(type);
|
|
258
|
+
});
|
|
259
|
+
if (isMatch) this.handleGroundObject(type);
|
|
260
|
+
}
|
|
261
|
+
getMaterialByName(name) {
|
|
262
|
+
return _asyncToGenerator(function* () {
|
|
263
|
+
const material = yield SurfaceMaterial.getMaterial(name);
|
|
264
|
+
return material;
|
|
265
|
+
})();
|
|
266
|
+
}
|
|
267
|
+
replaceMaterial(object, materialName, type, limit) {
|
|
268
|
+
var _this2 = this;
|
|
269
|
+
return _asyncToGenerator(function* () {
|
|
270
|
+
if (object.userData.isMatched) return;
|
|
271
|
+
if (materialName === 'MfresnelGlow') {
|
|
272
|
+
if (type === SwitchType.Fresnel) object.material = finirheightTransitionEffect(object.material, _this2.uniforms);
|
|
273
|
+
} else if (materialName === 'Moriginal' || !materialName) {
|
|
274
|
+
object.material = object.userData.originalMaterial;
|
|
275
|
+
} else if (materialName === 'MlowFinir') {
|
|
276
|
+
if (type === SwitchType.Fresnel) object.material = finirlowEffect(object.material, _this2.uniforms);
|
|
308
277
|
} else {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
this.add(groundMesh);
|
|
313
|
-
}
|
|
314
|
-
var groundObject = this.objectsMap[type].get('ground');
|
|
315
|
-
if (groundObject) this.isGenPlane ? groundObject.userData.isVisible = true : groundObject.userData.isVisible = false;
|
|
316
|
-
}
|
|
317
|
-
}, {
|
|
318
|
-
key: "handleGroundMatching",
|
|
319
|
-
value: function handleGroundMatching(type) {
|
|
320
|
-
var _this4 = this;
|
|
321
|
-
if (type === SwitchType.Real) return;
|
|
322
|
-
var isMatch = false;
|
|
323
|
-
this.objectsMap[type].forEach(function (object) {
|
|
324
|
-
object.traverse(function (child) {
|
|
325
|
-
if (GROUND_MATCHING.some(function (matching) {
|
|
326
|
-
return child.name.includes(matching);
|
|
327
|
-
})) {
|
|
328
|
-
if (_this4.isGenPlane) child.visible = false;else child.visible = true;
|
|
329
|
-
isMatch = true;
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
if (isMatch) this.handleGroundObject(type);
|
|
334
|
-
}
|
|
335
|
-
}, {
|
|
336
|
-
key: "getMaterialByName",
|
|
337
|
-
value: function () {
|
|
338
|
-
var _getMaterialByName = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(name) {
|
|
339
|
-
var material;
|
|
340
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
341
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
342
|
-
case 0:
|
|
343
|
-
_context2.next = 2;
|
|
344
|
-
return SurfaceMaterial.getMaterial(name);
|
|
345
|
-
case 2:
|
|
346
|
-
material = _context2.sent;
|
|
347
|
-
return _context2.abrupt("return", material);
|
|
348
|
-
case 4:
|
|
349
|
-
case "end":
|
|
350
|
-
return _context2.stop();
|
|
351
|
-
}
|
|
352
|
-
}, _callee2);
|
|
353
|
-
}));
|
|
354
|
-
function getMaterialByName(_x3) {
|
|
355
|
-
return _getMaterialByName.apply(this, arguments);
|
|
356
|
-
}
|
|
357
|
-
return getMaterialByName;
|
|
358
|
-
}()
|
|
359
|
-
}, {
|
|
360
|
-
key: "replaceMaterial",
|
|
361
|
-
value: function () {
|
|
362
|
-
var _replaceMaterial = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(object, materialName, type, limit) {
|
|
363
|
-
var material;
|
|
364
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
365
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
366
|
-
case 0:
|
|
367
|
-
if (!object.userData.isMatched) {
|
|
368
|
-
_context3.next = 2;
|
|
369
|
-
break;
|
|
370
|
-
}
|
|
371
|
-
return _context3.abrupt("return");
|
|
372
|
-
case 2:
|
|
373
|
-
if (!(materialName === 'MfresnelGlow')) {
|
|
374
|
-
_context3.next = 6;
|
|
375
|
-
break;
|
|
376
|
-
}
|
|
377
|
-
if (type === SwitchType.Fresnel) object.material = finirheightTransitionEffect(object.material, this.uniforms);
|
|
378
|
-
_context3.next = 20;
|
|
379
|
-
break;
|
|
380
|
-
case 6:
|
|
381
|
-
if (!(materialName === 'Moriginal' || !materialName)) {
|
|
382
|
-
_context3.next = 10;
|
|
383
|
-
break;
|
|
384
|
-
}
|
|
385
|
-
object.material = object.userData.originalMaterial;
|
|
386
|
-
_context3.next = 20;
|
|
387
|
-
break;
|
|
388
|
-
case 10:
|
|
389
|
-
if (!(materialName === 'MlowFinir')) {
|
|
390
|
-
_context3.next = 14;
|
|
391
|
-
break;
|
|
392
|
-
}
|
|
393
|
-
if (type === SwitchType.Fresnel) object.material = finirlowEffect(object.material, this.uniforms);
|
|
394
|
-
_context3.next = 20;
|
|
395
|
-
break;
|
|
396
|
-
case 14:
|
|
397
|
-
if (!(limit && limit !== type)) {
|
|
398
|
-
_context3.next = 16;
|
|
399
|
-
break;
|
|
400
|
-
}
|
|
401
|
-
return _context3.abrupt("return");
|
|
402
|
-
case 16:
|
|
403
|
-
_context3.next = 18;
|
|
404
|
-
return this.getMaterialByName(materialName);
|
|
405
|
-
case 18:
|
|
406
|
-
material = _context3.sent;
|
|
407
|
-
object.material = inject(material, type, this.uniforms);
|
|
408
|
-
case 20:
|
|
409
|
-
object.userData.isMatched = true;
|
|
410
|
-
case 21:
|
|
411
|
-
case "end":
|
|
412
|
-
return _context3.stop();
|
|
413
|
-
}
|
|
414
|
-
}, _callee3, this);
|
|
415
|
-
}));
|
|
416
|
-
function replaceMaterial(_x4, _x5, _x6, _x7) {
|
|
417
|
-
return _replaceMaterial.apply(this, arguments);
|
|
278
|
+
if (limit && limit !== type) return;
|
|
279
|
+
const material = yield _this2.getMaterialByName(materialName);
|
|
280
|
+
object.material = inject(material, type, _this2.uniforms);
|
|
418
281
|
}
|
|
419
|
-
|
|
420
|
-
}()
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
var _mesh$parent;
|
|
441
|
-
return mesh.name.includes(matching) || (mesh === null || mesh === void 0 || (_mesh$parent = mesh.parent) === null || _mesh$parent === void 0 ? void 0 : _mesh$parent.name.includes(matching));
|
|
442
|
-
})) _this5.replaceMaterial(mesh, material, type, rule.limit);
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
}, {
|
|
448
|
-
key: "handleSizeMatching",
|
|
449
|
-
value: function handleSizeMatching(rule, type) {}
|
|
450
|
-
}, {
|
|
451
|
-
key: "handleMatch",
|
|
452
|
-
value: function handleMatch(type) {
|
|
453
|
-
var _this6 = this;
|
|
454
|
-
this.handleGroundMatching(type);
|
|
455
|
-
if (type === SwitchType.Real) return;
|
|
456
|
-
this.objectsMap[type].forEach(function (object) {
|
|
457
|
-
object.traverse(function (child) {
|
|
458
|
-
if (child.type === 'Mesh') {
|
|
459
|
-
if (child.userData.isMatched) _this6.resetMaterial(child, type);
|
|
460
|
-
}
|
|
461
|
-
child.userData.isMatched = false;
|
|
462
|
-
});
|
|
463
|
-
});
|
|
464
|
-
if (this.rules.length > 0) {
|
|
465
|
-
this.rules.forEach(function (rule) {
|
|
466
|
-
_this6.matchingStrategy[rule.type](rule, type);
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}, {
|
|
471
|
-
key: "handleNormalObject",
|
|
472
|
-
value: function handleNormalObject(object, uuid) {
|
|
473
|
-
var realObject = object;
|
|
474
|
-
this.generateRealObject(realObject);
|
|
475
|
-
this.objectsMap.Real.set(uuid, realObject);
|
|
476
|
-
this.add(realObject);
|
|
477
|
-
var fresnelObject = object.clone();
|
|
478
|
-
this.generateFresnelObject(fresnelObject);
|
|
479
|
-
this.objectsMap.Fresnel.set(uuid, fresnelObject);
|
|
480
|
-
this.add(fresnelObject);
|
|
481
|
-
var pureObject = object.clone();
|
|
482
|
-
this.generatePureObject(pureObject);
|
|
483
|
-
this.objectsMap.Pure.set(uuid, pureObject);
|
|
484
|
-
this.add(pureObject);
|
|
485
|
-
var frameObject = object.clone();
|
|
486
|
-
this.generateFrameObject(frameObject);
|
|
487
|
-
this.objectsMap.Frame.set(uuid, frameObject);
|
|
488
|
-
this.add(frameObject);
|
|
489
|
-
this.uniforms.maxSize.value = this.getMaxSize();
|
|
490
|
-
}
|
|
491
|
-
}, {
|
|
492
|
-
key: "removeObject",
|
|
493
|
-
value: function removeObject(object) {
|
|
494
|
-
var uuid = this.getObjectUuid(object);
|
|
495
|
-
this.objects.delete(uuid);
|
|
496
|
-
Object.values(this.objectsMap).forEach(function (objectMap) {
|
|
497
|
-
var obj = objectMap.get(uuid);
|
|
498
|
-
if (obj) {
|
|
499
|
-
obj.removeFromParent();
|
|
500
|
-
objectMap.delete(uuid);
|
|
282
|
+
object.userData.isMatched = true;
|
|
283
|
+
})();
|
|
284
|
+
}
|
|
285
|
+
resetMaterial(object, type) {
|
|
286
|
+
this[`generate${type}Object`](object);
|
|
287
|
+
}
|
|
288
|
+
handleNameMatching(rule, type) {
|
|
289
|
+
const {
|
|
290
|
+
keys,
|
|
291
|
+
material = 'Moriginal'
|
|
292
|
+
} = rule;
|
|
293
|
+
let keysArray = [];
|
|
294
|
+
if (typeof keys === 'string') keysArray = [keys];else keysArray = keys;
|
|
295
|
+
this.objectsMap[type].forEach(object => {
|
|
296
|
+
object.traverse(child => {
|
|
297
|
+
if (child.type === 'Mesh') {
|
|
298
|
+
const mesh = child;
|
|
299
|
+
if (keysArray.some(matching => {
|
|
300
|
+
var _mesh$parent;
|
|
301
|
+
return mesh.name.includes(matching) || (mesh === null || mesh === void 0 || (_mesh$parent = mesh.parent) === null || _mesh$parent === void 0 ? void 0 : _mesh$parent.name.includes(matching));
|
|
302
|
+
})) this.replaceMaterial(mesh, material, type, rule.limit);
|
|
501
303
|
}
|
|
502
304
|
});
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
handleSizeMatching(rule, type) {}
|
|
308
|
+
handleMatch(type) {
|
|
309
|
+
this.handleGroundMatching(type);
|
|
310
|
+
if (type === SwitchType.Real) return;
|
|
311
|
+
this.objectsMap[type].forEach(object => {
|
|
312
|
+
object.traverse(child => {
|
|
313
|
+
if (child.type === 'Mesh') {
|
|
314
|
+
if (child.userData.isMatched) this.resetMaterial(child, type);
|
|
315
|
+
}
|
|
316
|
+
child.userData.isMatched = false;
|
|
514
317
|
});
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
}, {
|
|
521
|
-
key: "updateGroundMesh",
|
|
522
|
-
value: function updateGroundMesh(type) {
|
|
523
|
-
if (!this.objectsMap[type].has('ground')) return;
|
|
524
|
-
var box = this.box3;
|
|
525
|
-
var size = box.getSize(new Vector3());
|
|
526
|
-
var center = box.getCenter(new Vector3());
|
|
527
|
-
this.objectsMap[type].get('ground').geometry.dispose();
|
|
528
|
-
this.objectsMap[type].get('ground').geometry = new PlaneGeometry(size.x, size.z);
|
|
529
|
-
this.objectsMap[type].get('ground').position.set(center.x, GROUND_Y_OFFSET, center.z);
|
|
530
|
-
}
|
|
531
|
-
}, {
|
|
532
|
-
key: "box3",
|
|
533
|
-
get: function get() {
|
|
534
|
-
var box3 = new Box3();
|
|
535
|
-
this.objectsMap.Real.forEach(function (object) {
|
|
536
|
-
box3.expandByObject(object);
|
|
318
|
+
});
|
|
319
|
+
if (this.rules.length > 0) {
|
|
320
|
+
this.rules.forEach(rule => {
|
|
321
|
+
this.matchingStrategy[rule.type](rule, type);
|
|
537
322
|
});
|
|
538
|
-
return box3;
|
|
539
|
-
}
|
|
540
|
-
}, {
|
|
541
|
-
key: "getMaxSize",
|
|
542
|
-
value: function getMaxSize() {
|
|
543
|
-
var box3 = this.box3;
|
|
544
|
-
var vertices = this.getBoxVertices(box3);
|
|
545
|
-
var maxDistance = this.calculateMaxDistance(vertices);
|
|
546
|
-
return maxDistance * SIZE_SCALE_FACTOR;
|
|
547
|
-
}
|
|
548
|
-
}, {
|
|
549
|
-
key: "getBoxVertices",
|
|
550
|
-
value: function getBoxVertices(box3) {
|
|
551
|
-
return [new Vector3(box3.min.x, box3.min.y, box3.min.z), new Vector3(box3.min.x, box3.min.y, box3.max.z), new Vector3(box3.min.x, box3.max.y, box3.min.z), new Vector3(box3.min.x, box3.max.y, box3.max.z), new Vector3(box3.max.x, box3.min.y, box3.min.z), new Vector3(box3.max.x, box3.min.y, box3.max.z), new Vector3(box3.max.x, box3.max.y, box3.min.z), new Vector3(box3.max.x, box3.max.y, box3.max.z)];
|
|
552
323
|
}
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
324
|
+
}
|
|
325
|
+
handleNormalObject(object, uuid) {
|
|
326
|
+
const realObject = object;
|
|
327
|
+
this.generateRealObject(realObject);
|
|
328
|
+
this.objectsMap.Real.set(uuid, realObject);
|
|
329
|
+
this.add(realObject);
|
|
330
|
+
const fresnelObject = object.clone();
|
|
331
|
+
this.generateFresnelObject(fresnelObject);
|
|
332
|
+
this.objectsMap.Fresnel.set(uuid, fresnelObject);
|
|
333
|
+
this.add(fresnelObject);
|
|
334
|
+
const pureObject = object.clone();
|
|
335
|
+
this.generatePureObject(pureObject);
|
|
336
|
+
this.objectsMap.Pure.set(uuid, pureObject);
|
|
337
|
+
this.add(pureObject);
|
|
338
|
+
const frameObject = object.clone();
|
|
339
|
+
this.generateFrameObject(frameObject);
|
|
340
|
+
this.objectsMap.Frame.set(uuid, frameObject);
|
|
341
|
+
this.add(frameObject);
|
|
342
|
+
this.uniforms.maxSize.value = this.getMaxSize();
|
|
343
|
+
}
|
|
344
|
+
removeObject(object) {
|
|
345
|
+
const uuid = this.getObjectUuid(object);
|
|
346
|
+
this.objects.delete(uuid);
|
|
347
|
+
Object.values(this.objectsMap).forEach(objectMap => {
|
|
348
|
+
const obj = objectMap.get(uuid);
|
|
349
|
+
if (obj) {
|
|
350
|
+
obj.removeFromParent();
|
|
351
|
+
objectMap.delete(uuid);
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
this.uniforms.maxSize.value = this.getMaxSize();
|
|
355
|
+
}
|
|
356
|
+
createGroundMesh() {
|
|
357
|
+
const box = this.box3;
|
|
358
|
+
const size = box.getSize(new Vector3());
|
|
359
|
+
const center = box.getCenter(new Vector3());
|
|
360
|
+
const plane = new PlaneGeometry(size.x, size.z);
|
|
361
|
+
const material = new MeshBasicMaterial({
|
|
362
|
+
color: new Color('#fff')
|
|
363
|
+
});
|
|
364
|
+
const mesh = new Mesh(plane, material);
|
|
365
|
+
mesh.rotation.x = -Math.PI / 2;
|
|
366
|
+
mesh.position.set(center.x, GROUND_Y_OFFSET, center.z);
|
|
367
|
+
return mesh;
|
|
368
|
+
}
|
|
369
|
+
updateGroundMesh(type) {
|
|
370
|
+
if (!this.objectsMap[type].has('ground')) return;
|
|
371
|
+
const box = this.box3;
|
|
372
|
+
const size = box.getSize(new Vector3());
|
|
373
|
+
const center = box.getCenter(new Vector3());
|
|
374
|
+
this.objectsMap[type].get('ground').geometry.dispose();
|
|
375
|
+
this.objectsMap[type].get('ground').geometry = new PlaneGeometry(size.x, size.z);
|
|
376
|
+
this.objectsMap[type].get('ground').position.set(center.x, GROUND_Y_OFFSET, center.z);
|
|
377
|
+
}
|
|
378
|
+
get box3() {
|
|
379
|
+
const box3 = new Box3();
|
|
380
|
+
this.objectsMap.Real.forEach(object => {
|
|
381
|
+
box3.expandByObject(object);
|
|
382
|
+
});
|
|
383
|
+
return box3;
|
|
384
|
+
}
|
|
385
|
+
getMaxSize() {
|
|
386
|
+
const box3 = this.box3;
|
|
387
|
+
const vertices = this.getBoxVertices(box3);
|
|
388
|
+
const maxDistance = this.calculateMaxDistance(vertices);
|
|
389
|
+
return maxDistance * SIZE_SCALE_FACTOR;
|
|
390
|
+
}
|
|
391
|
+
getBoxVertices(box3) {
|
|
392
|
+
return [new Vector3(box3.min.x, box3.min.y, box3.min.z), new Vector3(box3.min.x, box3.min.y, box3.max.z), new Vector3(box3.min.x, box3.max.y, box3.min.z), new Vector3(box3.min.x, box3.max.y, box3.max.z), new Vector3(box3.max.x, box3.min.y, box3.min.z), new Vector3(box3.max.x, box3.min.y, box3.max.z), new Vector3(box3.max.x, box3.max.y, box3.min.z), new Vector3(box3.max.x, box3.max.y, box3.max.z)];
|
|
393
|
+
}
|
|
394
|
+
calculateMaxDistance(vertices) {
|
|
395
|
+
return vertices.reduce((max, vertex) => {
|
|
396
|
+
const distance = this.center.distanceTo(vertex);
|
|
397
|
+
return Math.max(max, distance);
|
|
398
|
+
}, 0);
|
|
399
|
+
}
|
|
400
|
+
generateFresnelObject(object) {
|
|
401
|
+
injectToFinirMaterial(object, this.uniforms);
|
|
402
|
+
}
|
|
403
|
+
generateRealObject(object) {
|
|
404
|
+
injectToRealFade(object, this.uniforms);
|
|
405
|
+
}
|
|
406
|
+
generatePureObject(object) {
|
|
407
|
+
injectToBaseWrite(object, this.uniforms);
|
|
408
|
+
}
|
|
409
|
+
generateFrameObject(object) {
|
|
410
|
+
injectToFrameFade(object, this.uniforms);
|
|
411
|
+
}
|
|
412
|
+
updateVisibility() {
|
|
413
|
+
this.hideAllObjects();
|
|
414
|
+
this.showObjectsByType(SwitchType.Real);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
591
417
|
//# sourceMappingURL=MaterialSwitchSystem.js.map
|