@anov/3d 0.0.176 → 0.0.184

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/anov3d.js +0 -2
  2. package/dist/anov3d.js.map +1 -1
  3. package/dist/applicationApi.js +38 -39
  4. package/dist/applicationApi.js.map +1 -1
  5. package/dist/module/camera/index.js +20 -17
  6. package/dist/module/camera/index.js.map +1 -1
  7. package/dist/module/entity/area/index.js +29 -0
  8. package/dist/module/entity/area/index.js.map +1 -0
  9. package/dist/module/{model/index.js → entity/area/style/area_01.js} +40 -79
  10. package/dist/module/entity/area/style/area_01.js.map +1 -0
  11. package/dist/module/entity/area/style/index.js +27 -0
  12. package/dist/module/entity/area/style/index.js.map +1 -0
  13. package/dist/module/entity/area/type.js.map +1 -0
  14. package/dist/module/entity/bar/index.js +29 -0
  15. package/dist/module/entity/bar/index.js.map +1 -0
  16. package/dist/{factory/unit/poi.js → module/entity/bar/style/bar_01.js} +36 -249
  17. package/dist/module/entity/bar/style/bar_01.js.map +1 -0
  18. package/dist/module/entity/bar/style/index.js +27 -0
  19. package/dist/module/entity/bar/style/index.js.map +1 -0
  20. package/dist/module/entity/bar/type.js +2 -0
  21. package/dist/module/entity/bar/type.js.map +1 -0
  22. package/dist/module/entity/index.js +5 -12
  23. package/dist/module/entity/index.js.map +1 -1
  24. package/dist/module/entity/model/index.js +9 -6
  25. package/dist/module/entity/model/index.js.map +1 -1
  26. package/dist/module/entity/model/load/loadFbx.js.map +1 -1
  27. package/dist/module/entity/model/load/loadGlb.js +7 -4
  28. package/dist/module/entity/model/load/loadGlb.js.map +1 -1
  29. package/dist/module/entity/poi/style/base.js.map +1 -1
  30. package/dist/module/entity/poi/type.js.map +1 -1
  31. package/dist/{factory/unit/districtLine.js → module/entity/realismTraffic/index.js} +91 -109
  32. package/dist/module/entity/realismTraffic/index.js.map +1 -0
  33. package/dist/module/entity/spline/style/index.js.map +1 -1
  34. package/dist/module/entity/spline/style/line_01.js +2 -2
  35. package/dist/module/entity/spline/style/line_01.js.map +1 -1
  36. package/dist/module/entity/spline/style/line_texture_01.js +6 -6
  37. package/dist/module/entity/spline/style/line_texture_01.js.map +1 -1
  38. package/dist/module/entity/spline/type.js.map +1 -1
  39. package/dist/module/entity/strategy.js +22 -0
  40. package/dist/module/entity/strategy.js.map +1 -1
  41. package/dist/module/entity/utils.js +17 -0
  42. package/dist/module/entity/utils.js.map +1 -1
  43. package/dist/module/environment/index.js +35 -113
  44. package/dist/module/environment/index.js.map +1 -1
  45. package/dist/module/scene/fileParse.js +232 -132
  46. package/dist/module/scene/fileParse.js.map +1 -1
  47. package/dist/module/scene/index.js +84 -137
  48. package/dist/module/scene/index.js.map +1 -1
  49. package/dist/{factory/globalControl.js → module/tool/index.js} +8 -16
  50. package/dist/module/tool/index.js.map +1 -0
  51. package/dist/sdkEntry.js +4 -9
  52. package/dist/sdkEntry.js.map +1 -1
  53. package/package.json +3 -3
  54. package/dist/factory/3d.js +0 -535
  55. package/dist/factory/3d.js.map +0 -1
  56. package/dist/factory/globalControl.js.map +0 -1
  57. package/dist/factory/globalData.js +0 -2
  58. package/dist/factory/globalData.js.map +0 -1
  59. package/dist/factory/regionData.js +0 -499
  60. package/dist/factory/regionData.js.map +0 -1
  61. package/dist/factory/type.js.map +0 -1
  62. package/dist/factory/unit/CameraPoi.js +0 -1047
  63. package/dist/factory/unit/CameraPoi.js.map +0 -1
  64. package/dist/factory/unit/areaBoundingBox.js +0 -28
  65. package/dist/factory/unit/areaBoundingBox.js.map +0 -1
  66. package/dist/factory/unit/circle.js +0 -225
  67. package/dist/factory/unit/circle.js.map +0 -1
  68. package/dist/factory/unit/cylinder.js +0 -269
  69. package/dist/factory/unit/cylinder.js.map +0 -1
  70. package/dist/factory/unit/districtLine.js.map +0 -1
  71. package/dist/factory/unit/glsl/heat/frag.glsl +0 -37
  72. package/dist/factory/unit/glsl/heat/frag.js +0 -4
  73. package/dist/factory/unit/glsl/heat/frag.js.map +0 -1
  74. package/dist/factory/unit/glsl/heat/ver.glsl +0 -15
  75. package/dist/factory/unit/glsl/heat/ver.js +0 -4
  76. package/dist/factory/unit/glsl/heat/ver.js.map +0 -1
  77. package/dist/factory/unit/glsl/highway/fragmentShader.js +0 -4
  78. package/dist/factory/unit/glsl/highway/fragmentShader.js.map +0 -1
  79. package/dist/factory/unit/glsl/highway/fragmentShader2.js +0 -4
  80. package/dist/factory/unit/glsl/highway/fragmentShader2.js.map +0 -1
  81. package/dist/factory/unit/glsl/highway/vertexShader.js +0 -4
  82. package/dist/factory/unit/glsl/highway/vertexShader.js.map +0 -1
  83. package/dist/factory/unit/glsl/point/fragment.glsl +0 -12
  84. package/dist/factory/unit/glsl/point/vertex.glsl +0 -7
  85. package/dist/factory/unit/glsl/wall/fragmentShader.glsl +0 -30
  86. package/dist/factory/unit/glsl/wall/vertexShader.glsl +0 -6
  87. package/dist/factory/unit/handle.js +0 -132
  88. package/dist/factory/unit/handle.js.map +0 -1
  89. package/dist/factory/unit/index.js +0 -264
  90. package/dist/factory/unit/index.js.map +0 -1
  91. package/dist/factory/unit/inspection/InspectionObject.js +0 -608
  92. package/dist/factory/unit/inspection/InspectionObject.js.map +0 -1
  93. package/dist/factory/unit/inspection/defaultFirstPerspectiveControls.js +0 -382
  94. package/dist/factory/unit/inspection/defaultFirstPerspectiveControls.js.map +0 -1
  95. package/dist/factory/unit/inspection/index.js +0 -379
  96. package/dist/factory/unit/inspection/index.js.map +0 -1
  97. package/dist/factory/unit/inspection/lineData.js +0 -44
  98. package/dist/factory/unit/inspection/lineData.js.map +0 -1
  99. package/dist/factory/unit/inspection/map.js +0 -67
  100. package/dist/factory/unit/inspection/map.js.map +0 -1
  101. package/dist/factory/unit/inspection/tubeGeometry.js +0 -152
  102. package/dist/factory/unit/inspection/tubeGeometry.js.map +0 -1
  103. package/dist/factory/unit/layer/rise.js +0 -142
  104. package/dist/factory/unit/layer/rise.js.map +0 -1
  105. package/dist/factory/unit/line.js +0 -96
  106. package/dist/factory/unit/line.js.map +0 -1
  107. package/dist/factory/unit/poi.js.map +0 -1
  108. package/dist/factory/unit/region.js +0 -72
  109. package/dist/factory/unit/region.js.map +0 -1
  110. package/dist/factory/unit/slice.js +0 -122
  111. package/dist/factory/unit/slice.js.map +0 -1
  112. package/dist/factory/unit/wall.js +0 -119
  113. package/dist/factory/unit/wall.js.map +0 -1
  114. package/dist/factory/utils/areaBoundingBox.js +0 -54
  115. package/dist/factory/utils/areaBoundingBox.js.map +0 -1
  116. package/dist/factory/utils/constant.js +0 -15
  117. package/dist/factory/utils/constant.js.map +0 -1
  118. package/dist/factory/utils/finirMaterial.js +0 -56
  119. package/dist/factory/utils/finirMaterial.js.map +0 -1
  120. package/dist/factory/utils/fontMesh.js +0 -49
  121. package/dist/factory/utils/fontMesh.js.map +0 -1
  122. package/dist/factory/utils/ground.js +0 -65
  123. package/dist/factory/utils/ground.js.map +0 -1
  124. package/dist/factory/utils/index.js +0 -24
  125. package/dist/factory/utils/index.js.map +0 -1
  126. package/dist/factory/utils/observe.js +0 -23
  127. package/dist/factory/utils/observe.js.map +0 -1
  128. package/dist/factory/utils/switchMaterial.js +0 -110
  129. package/dist/factory/utils/switchMaterial.js.map +0 -1
  130. package/dist/module/environment/time/index.js +0 -28
  131. package/dist/module/environment/time/index.js.map +0 -1
  132. package/dist/module/environment/weather/type.js +0 -28
  133. package/dist/module/environment/weather/type.js.map +0 -1
  134. package/dist/module/model/index.js.map +0 -1
  135. /package/dist/{factory → module/entity/area}/type.js +0 -0
@@ -1,608 +0,0 @@
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
- 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
- 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 _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; }
9
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
- 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); }
11
- import { AudioListener, AudioLoader, Clock, Color, EdgesGeometry, Euler, Group, LineBasicMaterial, LineCurve3, LineSegments, MathUtils, Matrix4, Mesh, MeshBasicMaterial, MirroredRepeatWrapping, ModelLoader, PlaneGeometry, PositionalAudio, Quaternion, RepeatWrapping, TextureLoader, Vector3, use, utils } from '@anov/3d-core';
12
- import { SpritePoi } from '@anov/3d-ability';
13
- import { Tween } from '@tweenjs/tween.js';
14
- import { createFinirMaterial } from "../../utils/finirMaterial";
15
- import { usePath } from "../../3d";
16
- import { MessageType, sendToMessage } from "../../../utils/messageFn";
17
- import { EMessageStatus } from "../../../messageStatus";
18
- import { SceneTag } from "../../utils/constant";
19
- import { isCheck, targetProgresspoints } from "./lineData";
20
- import TubeGeometryV2 from "./tubeGeometry";
21
- var modelLoader = new ModelLoader();
22
- var InspectionObject = /*#__PURE__*/function () {
23
- function InspectionObject(inspection) {
24
- _classCallCheck(this, InspectionObject);
25
- _defineProperty(this, "model", void 0);
26
- _defineProperty(this, "inspection", void 0);
27
- _defineProperty(this, "control", void 0);
28
- _defineProperty(this, "isLock", false);
29
- _defineProperty(this, "isAnimation", false);
30
- _defineProperty(this, "walkCurveMesh", void 0);
31
- _defineProperty(this, "tempPathMesh", void 0);
32
- _defineProperty(this, "css2d", void 0);
33
- _defineProperty(this, "temp", void 0);
34
- _defineProperty(this, "tempDemo", void 0);
35
- _defineProperty(this, "isStartUp", false);
36
- _defineProperty(this, "initialMinCameraQuaternion", void 0);
37
- _defineProperty(this, "contineCount", 0);
38
- _defineProperty(this, "compassInfo", {
39
- verticalSpeed: 0,
40
- horizontalSpeed: 10,
41
- height: 0
42
- });
43
- _defineProperty(this, "startRotate", function (targetQuaternion, mesh, cb) {
44
- var clock = new Clock();
45
- if (mesh.quaternion.equals(targetQuaternion)) return cb();
46
- var animation = use.useframe(function () {
47
- var delta = clock.getDelta();
48
- if (!mesh.quaternion.equals(targetQuaternion)) {
49
- var step = 1 * delta;
50
- mesh.quaternion.rotateTowards(targetQuaternion, step);
51
- } else {
52
- animation();
53
- cb();
54
- }
55
- });
56
- });
57
- this.inspection = inspection;
58
- var temp = new TextureLoader().load("".concat(usePath, "test07.png"));
59
- temp.wrapS = RepeatWrapping;
60
- temp.wrapT = MirroredRepeatWrapping;
61
- temp.repeat.set(1, 2);
62
- temp.rotation = Math.PI;
63
- this.temp = temp;
64
- }
65
- _createClass(InspectionObject, [{
66
- key: "loadModel",
67
- value: function () {
68
- var _loadModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
69
- var _this = this;
70
- var glb, div, img, span, poi, img2, poi2, fly1, fly2, fly3, fly4, planeGeometry, planeMaterial, plyMap, group;
71
- return _regeneratorRuntime().wrap(function _callee$(_context) {
72
- while (1) switch (_context.prev = _context.next) {
73
- case 0:
74
- _context.next = 2;
75
- return modelLoader.loadGLTF("".concat(usePath, "car.glb"), false, true, './draco/');
76
- case 2:
77
- _context.next = 4;
78
- return _context.sent;
79
- case 4:
80
- glb = _context.sent;
81
- div = document.createElement('div');
82
- div.style.position = 'relative';
83
- img = document.createElement('img');
84
- img.src = "".concat(usePath, "aerialVehicle02.png");
85
- span = document.createElement('span');
86
- span.innerText = '巡检无人机';
87
- span.style.fontFamily = 'YouSheBiaoTiHei3D';
88
- span.style.position = 'absolute';
89
- span.style.top = '8px';
90
- span.style.left = '45%';
91
- span.style.transform = 'translateX(-30%)';
92
- span.style.color = 'white';
93
- span.style.fontSize = '20px';
94
- span.style.fontWeight = 'bold';
95
- div.appendChild(img);
96
- div.appendChild(span);
97
- poi = new SpritePoi(div, {
98
- width: 100 * 2,
99
- height: 40 * 2
100
- });
101
- img2 = document.createElement('img');
102
- img2.src = "".concat(usePath, "aerialVehicle01.png");
103
- poi2 = new SpritePoi(img2, {
104
- width: 400 * 2,
105
- height: 160 * 2
106
- });
107
- poi.scale.set(80, 30, 1);
108
- poi2.scale.set(400, 160, 1);
109
- fly1 = glb.scene.getObjectByName('fly1');
110
- fly2 = glb.scene.getObjectByName('fly1_1');
111
- fly3 = glb.scene.getObjectByName('fly1_2');
112
- fly4 = glb.scene.getObjectByName('fly1_3');
113
- planeGeometry = new PlaneGeometry(50, 50);
114
- planeMaterial = new MeshBasicMaterial({
115
- map: new TextureLoader().load("".concat(usePath, "fly.png")),
116
- transparent: true
117
- });
118
- plyMap = new Mesh(planeGeometry, planeMaterial);
119
- plyMap.rotation.x = -Math.PI / 2;
120
- plyMap.position.copy(glb.scene.position);
121
- plyMap.layers.set(5);
122
- group = new Group();
123
- glb.scene.name = 'ply';
124
- group.add(glb.scene);
125
- group.add(poi);
126
- group.add(plyMap);
127
- group.add(this.inspection.minCamera);
128
- use.useframe(function () {
129
- poi.position.copy(glb.scene.position.clone().add(new Vector3(0, 10, 0)));
130
- poi2.position.copy(glb.scene.position.clone().add(new Vector3(0, 10, 0)));
131
- fly1.rotation.z += 1.3;
132
- fly2.rotation.z += 1.3;
133
- fly3.rotation.z += 1.3;
134
- fly4.rotation.z += 1.3;
135
- if (isCheck(_this.getSportsProgress) && !_this.isLock) {
136
- _this.stop();
137
- _this.checkAnimation(_this.getSportsProgress);
138
- _this.compassInfo.horizontalSpeed = 0;
139
- _this.compassInfo.verticalSpeed = 0;
140
- }
141
- });
142
- this.inspection.minCamera.position.copy(glb.scene.position);
143
- this.inspection.minCamera.position.z -= 18;
144
- this.inspection.minCamera.position.y += 4;
145
- this.inspection.minCamera.rotateY(Math.PI);
146
- this.initialMinCameraQuaternion = this.inspection.minCamera.quaternion.clone();
147
- this.model = group;
148
- poi2.visible = false;
149
- poi.addEventListener('click', function () {
150
- group.add(poi2);
151
- poi2.visible = true;
152
- poi.visible = false;
153
- });
154
- poi2.addEventListener('click', function () {
155
- group.add(poi2);
156
- poi.visible = true;
157
- poi2.visible = false;
158
- });
159
- glb.scene.scale.set(5, 5, 5);
160
- glb.scene.traverse(function (child) {
161
- child.layers.enable(5);
162
- });
163
- this.inspection.gobal.scene.add(this.model);
164
- this.loadPosAudio();
165
- this.breathinglamp(this.model);
166
- case 58:
167
- case "end":
168
- return _context.stop();
169
- }
170
- }, _callee, this);
171
- }));
172
- function loadModel() {
173
- return _loadModel.apply(this, arguments);
174
- }
175
- return loadModel;
176
- }()
177
- }, {
178
- key: "breathinglamp",
179
- value: function breathinglamp(model) {
180
- var target = model.getObjectByName('网格004_5');
181
- var startColor = new Color('#999');
182
- var endColor = new Color('#2df3ee');
183
- var clock = new Clock();
184
- var breathingSpeed = 1;
185
- use.useframe(function () {
186
- var elapsedTime = clock.getElapsedTime();
187
- var t = (Math.sin(elapsedTime * Math.PI * breathingSpeed) + 1) / 2;
188
- var currentColor = startColor.clone().lerp(endColor, t);
189
-
190
- // @ts-ignore
191
- target.material.color.set(currentColor);
192
- });
193
- }
194
- }, {
195
- key: "loadPosAudio",
196
- value: function loadPosAudio() {
197
- var _this2 = this;
198
- var handleMouseMove = function handleMouseMove() {
199
- var listener = new AudioListener();
200
- _this2.inspection.minCamera.add(listener);
201
- var posAudio = new PositionalAudio(listener);
202
- _this2.model.add(posAudio);
203
- var audioLoader = new AudioLoader();
204
- audioLoader.load("".concat(usePath, "demo.mp3"), function (audioBuffer) {
205
- posAudio.setBuffer(audioBuffer);
206
- posAudio.setVolume(0.8);
207
- posAudio.setRefDistance(200);
208
- posAudio.setLoop(true);
209
- });
210
- utils.emitter.on('play', function () {
211
- _this2.isStartUp && posAudio.play();
212
- });
213
- utils.emitter.on('stop', function () {
214
- posAudio.stop();
215
- });
216
- document.removeEventListener('mousemove', handleMouseMove);
217
- };
218
- document.addEventListener('mousemove', handleMouseMove);
219
- }
220
- }, {
221
- key: "startMove",
222
- value: function () {
223
- var _startMove = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(curve) {
224
- var _this3 = this;
225
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
226
- while (1) switch (_context2.prev = _context2.next) {
227
- case 0:
228
- if (this.model) {
229
- _context2.next = 3;
230
- break;
231
- }
232
- _context2.next = 3;
233
- return this.loadModel();
234
- case 3:
235
- this.control = utils.moveWithLine(this.model, curve, {
236
- speed: 10,
237
- groundCurve: this.inspection.groundCurve
238
- });
239
- this.model.position.copy(curve.getPointAt(0));
240
- setTimeout(function () {
241
- _this3.stop();
242
- _this3.model.position.y = _this3.model.position.y - 20;
243
- }, 20);
244
- this.sendCompassInfo();
245
- use.useframe(function () {
246
- _this3.inspection.groundMaterial.uniforms.u_time.value = _this3.getSportsProgress - 0.01;
247
- _this3.inspection.mapMaterial.uniforms.u_time.value = _this3.getSportsProgress - 0.01;
248
- if (_this3.getSportsProgress > 0 && _this3.getSportsProgress < 0.01) {
249
- _this3.inspection.mapAnchorObject.forEach(function (mapAnchor) {
250
- mapAnchor.material.uniforms.uColor.value.set(1, 1, 1, 1);
251
- });
252
- }
253
- sendToMessage(MessageType.Event, 'onInspectProgress', EMessageStatus.Success, undefined, {
254
- percentage: _this3.getSportsProgress * 1000
255
- });
256
- });
257
- case 8:
258
- case "end":
259
- return _context2.stop();
260
- }
261
- }, _callee2, this);
262
- }));
263
- function startMove(_x) {
264
- return _startMove.apply(this, arguments);
265
- }
266
- return startMove;
267
- }()
268
- /**
269
- * send compass info
270
- * not use useframe, because useframe will be lose some frame
271
- */
272
- }, {
273
- key: "sendCompassInfo",
274
- value: function sendCompassInfo() {
275
- var _this4 = this;
276
- setInterval(function () {
277
- var mesh = _this4.model;
278
- mesh.updateMatrixWorld(true);
279
- var worldQuaternion = new Quaternion();
280
- mesh.getWorldQuaternion(worldQuaternion);
281
- var worldEuler = new Euler().setFromQuaternion(worldQuaternion, 'YXZ');
282
- var rotationY = worldEuler.y;
283
- var rotationYInDegrees = Math.round(MathUtils.radToDeg(rotationY));
284
- sendToMessage(MessageType.Event, 'onCompassInfo', EMessageStatus.Success, undefined, {
285
- rotate: rotationYInDegrees >= 0 ? 180 - rotationYInDegrees : -180 + Math.abs(rotationYInDegrees),
286
- degree: rotationYInDegrees >= 0 ? 180 - rotationYInDegrees : -180 + Math.abs(rotationYInDegrees) + 360,
287
- distance: _this4.getSportsProgress * _this4.inspection.curve.getLength(),
288
- verticalSpeed: _this4.compassInfo.verticalSpeed,
289
- horizontalSpeed: _this4.compassInfo.horizontalSpeed * 3.6,
290
- height: _this4.model.position.y
291
- });
292
- }, 100);
293
- }
294
- }, {
295
- key: "getSportsProgress",
296
- get: function get() {
297
- if (!this.control) return 0;
298
- return this.control.getProgress();
299
- }
300
- }, {
301
- key: "subscription",
302
- value: function subscription() {
303
- return new Promise(function (resolve) {
304
- utils.emitter.on('continue', function (data) {
305
- resolve(data);
306
- });
307
- });
308
- }
309
- }, {
310
- key: "checkAnimation",
311
- value: function checkAnimation(progress) {
312
- var _this5 = this;
313
- this.isLock = true;
314
- this.isAnimation = true;
315
- this.inspection.defaultFirstPerspectiveControls.enabled = false;
316
- var key = Object.keys(targetProgresspoints).find(function (p) {
317
- var num = parseFloat(p);
318
- if (progress >= num && progress < num + 0.01) return true;
319
- });
320
- var targetMeshId = targetProgresspoints[key].lookAt;
321
- var targetMesh = null;
322
- if (targetMeshId === 'GY_GD_guandaofamen_5') targetMesh = this.inspection.gobal.pipeline.getObjectByName(targetMeshId);else targetMesh = this.inspection.gobal.realModl.getObjectByName(targetMeshId);
323
- if (!targetMesh) {
324
- this.contineMove();
325
- this.isAnimation = false;
326
- setTimeout(function () {
327
- _this5.isLock = false;
328
- }, 500);
329
- return;
330
- }
331
- var currentAnchor = this.inspection.anchorObject.get(targetProgresspoints[key].name);
332
- var currentMapAnchor = this.inspection.mapAnchorObject;
333
- currentAnchor.traverse(function (child) {
334
- if (child.name === 'cylinder') child.material = new MeshBasicMaterial({
335
- color: new Color('yellow')
336
- });else child.material = new MeshBasicMaterial({
337
- color: new Color('#facb2b')
338
- });
339
- });
340
- currentMapAnchor.forEach(function (mapAnchor, key) {
341
- var numberKey = Number(key);
342
-
343
- // @ts-ignore
344
- _this5.getSportsProgress > numberKey && mapAnchor.material.uniforms.uColor.value.set(1, 1, 0, 0.8);
345
-
346
- // @ts-ignore
347
- _this5.getSportsProgress < numberKey && mapAnchor.material.uniforms.uColor.value.set(1, 1, 1, 1);
348
- });
349
- setTimeout(function () {
350
- var rotationMatrix = new Matrix4();
351
- var targetQuaternion = new Quaternion();
352
- var startQuaternion = _this5.model.quaternion.clone();
353
- var startCameraQuaternion = _this5.inspection.minCamera.quaternion.clone();
354
- var targetMeshPosition = targetMesh.position.clone();
355
- targetMeshPosition.y = targetMeshPosition.y + (Number(key) === 0.048 || Number(key) === 0.682 || Number(key) === 0.400 ? 20 : 0);
356
- rotationMatrix.lookAt(targetMeshPosition, _this5.model.position, _this5.model.up);
357
- targetQuaternion.setFromRotationMatrix(rotationMatrix);
358
- var forwardTween = new Tween({
359
- t: 0
360
- }).to({
361
- t: 1
362
- }, 2000).onUpdate(function (obj) {
363
- _this5.model.quaternion.copy(startQuaternion).slerp(targetQuaternion, obj.t);
364
- _this5.inspection.minCamera.quaternion.copy(startCameraQuaternion).slerp(_this5.initialMinCameraQuaternion, obj.t);
365
- });
366
- var backwardTween = new Tween({
367
- t: 1
368
- }).to({
369
- t: 0
370
- }, 2000).onUpdate(function (obj) {
371
- _this5.model.quaternion.copy(startQuaternion).slerp(targetQuaternion, obj.t);
372
- });
373
- forwardTween.onComplete(function () {
374
- var finirMesh = null;
375
- sendToMessage(MessageType.Event, 'onReachTarget', EMessageStatus.Success, undefined, {
376
- target: targetProgresspoints[key].name
377
- });
378
- if (Number(key) === 0.048 || Number(key) === 0.682 || Number(key) === 0.400) _this5.inspection.minCamera.layers.set(2);
379
- if (Number(key) === 0.155 || Number(key) === 0.247) {
380
- _this5.inspection.minCamera.layers.enable(3);
381
- // @ts-ignore
382
- if (!targetMesh.finirMesh) {
383
- finirMesh = targetMesh.clone();
384
- var finirMaterialV2 = createFinirMaterial('#08A6E3', 4.3);
385
- finirMesh.traverse(function (child) {
386
- child.layers.set(3);
387
- if (child.type === 'Mesh') {
388
- // @ts-ignore
389
- child.material = finirMaterialV2;
390
-
391
- // @ts-ignore
392
- var lineSegments = new LineSegments(new EdgesGeometry(child.geometry), new LineBasicMaterial({
393
- color: '#08A6E3'
394
- }));
395
- lineSegments.layers.set(3);
396
- finirMesh.add(lineSegments);
397
- }
398
- });
399
-
400
- // @ts-ignore
401
- targetMesh.finirMesh = finirMesh;
402
- _this5.inspection.gobal.scene.add(finirMesh);
403
- } else {
404
- // @ts-ignore
405
- finirMesh = targetMesh.finirMesh;
406
- finirMesh.visible = true;
407
- }
408
- }
409
-
410
- // 异常点
411
- if (Number(key) === 0.155 || Number(key) === 0.247) {
412
- _this5.subscription().then(function (data) {
413
- if (data) {
414
- finirMesh.visible = false;
415
- backwardTween.start();
416
- utils.emitter.off('continue');
417
- }
418
- });
419
- } else {
420
- setTimeout(function () {
421
- if (Number(key) === 0.048 || Number(key) === 0.682 || Number(key) === 0.400) _this5.inspection.minCamera.layers.set(0);
422
-
423
- // if (Number(key) === 0.40)
424
- // finirMesh.visible = false
425
-
426
- backwardTween.start();
427
- }, 6000);
428
- }
429
- });
430
- setTimeout(function () {
431
- forwardTween.start();
432
- }, 1000);
433
- backwardTween.onComplete(function () {
434
- _this5.isAnimation = false;
435
- _this5.contineMove();
436
- _this5.compassInfo.verticalSpeed = 0;
437
- _this5.compassInfo.horizontalSpeed = 10;
438
- currentAnchor.traverse(function (child) {
439
- if (child.name === 'cylinder') child.material = new MeshBasicMaterial({
440
- color: new Color('#cdccca')
441
- });else child.material = new MeshBasicMaterial({
442
- color: new Color('#fff')
443
- });
444
- });
445
- setTimeout(function () {
446
- _this5.inspection.defaultFirstPerspectiveControls.enabled = true;
447
- _this5.isLock = false;
448
- }, 500);
449
- });
450
- }, 1000);
451
- }
452
- }, {
453
- key: "generateTempPath",
454
- value: function generateTempPath(currentPosition, targetPosition) {
455
- return new LineCurve3(currentPosition, targetPosition);
456
- }
457
- }, {
458
- key: "generateTempPathMesh",
459
- value: function generateTempPathMesh(curve) {
460
- var _this6 = this;
461
- // @ts-ignore
462
- var tube = new TubeGeometryV2(curve, 100, 5, 2, false);
463
- var tempPathMesh = new Mesh(tube, new MeshBasicMaterial({
464
- map: this.temp,
465
- transparent: true,
466
- depthTest: true
467
- }));
468
- this.inspection.gobal.scene.add(tempPathMesh);
469
- this.tempPathMesh = tempPathMesh;
470
- tempPathMesh.layers.enable(5);
471
- this.temp.repeat.set(curve.getLength() / 500, 2);
472
- this.tempDemo = use.useframe(function () {
473
- _this6.temp.offset.x -= -0.0009;
474
- if (_this6.inspection.gobal.tag === SceneTag['smart-inspection']) _this6.tempPathMesh.visible = true;else _this6.tempPathMesh.visible = false;
475
- });
476
- }
477
- }, {
478
- key: "cleanTempPathMesh",
479
- value: function cleanTempPathMesh() {
480
- if (this.tempPathMesh) {
481
- this.tempDemo();
482
- this.tempPathMesh.geometry.dispose();
483
- this.tempPathMesh.material.dispose();
484
- this.tempPathMesh.removeFromParent();
485
- }
486
- }
487
- }, {
488
- key: "takeOffAnimation",
489
- value: function takeOffAnimation() {
490
- var _this7 = this;
491
- var currentPosition = this.model.position;
492
- var upCurve = new LineCurve3(currentPosition, new Vector3(currentPosition.x, currentPosition.y + 20, currentPosition.z));
493
- var upControl = utils.moveWithLine(this.model, upCurve, {
494
- speed: 10,
495
- repeat: 1,
496
- lookat: false
497
- });
498
- this.compassInfo.horizontalSpeed = 0;
499
- this.compassInfo.verticalSpeed = 10;
500
- upControl.addEventListener('end', function () {
501
- _this7.control.continue();
502
- _this7.compassInfo.verticalSpeed = 0;
503
- _this7.compassInfo.horizontalSpeed = 10;
504
- });
505
- }
506
- }, {
507
- key: "gotoTarget",
508
- value: function gotoTarget(targetPosition, targetProgress) {
509
- var _this8 = this;
510
- if (this.isAnimation) return;
511
- this.isAnimation = true;
512
- this.control.stop();
513
- this.compassInfo.verticalSpeed = 0;
514
- this.compassInfo.horizontalSpeed = 0;
515
- var rotationMatrix = new Matrix4();
516
- var targetQuaternion = new Quaternion();
517
- rotationMatrix.lookAt(targetPosition, this.model.position, this.model.up);
518
- targetQuaternion.setFromRotationMatrix(rotationMatrix);
519
- this.startRotate(targetQuaternion, this.model, function () {
520
- var tempPathMeshtargetPosition = new Vector3(targetPosition.x, 1.1, targetPosition.z);
521
- _this8.generateTempPathMesh(_this8.generateTempPath(new Vector3(_this8.model.position.x, 1.1, _this8.model.position.z), tempPathMeshtargetPosition));
522
- var currentPosition = _this8.model.position;
523
- var upCurve = new LineCurve3(currentPosition, new Vector3(currentPosition.x, currentPosition.y + 50, currentPosition.z));
524
- var upControl = utils.moveWithLine(_this8.model, upCurve, {
525
- speed: 10,
526
- repeat: 1,
527
- lookat: targetPosition
528
- });
529
- _this8.compassInfo.verticalSpeed = 10;
530
- _this8.compassInfo.horizontalSpeed = 0;
531
-
532
- // up end
533
- upControl.addEventListener('end', function () {
534
- var tempCurve = _this8.generateTempPath(currentPosition, new Vector3(targetPosition.x, targetPosition.y + 50, targetPosition.z));
535
- var tempControl = utils.moveWithLine(_this8.model, tempCurve, {
536
- speed: 60,
537
- repeat: 1,
538
- lookat: false
539
- });
540
- _this8.compassInfo.verticalSpeed = 0;
541
- _this8.compassInfo.horizontalSpeed = 60;
542
-
543
- // temp end
544
- tempControl.addEventListener('end', function () {
545
- var lastPosition = _this8.model.position;
546
- var downCurve = new LineCurve3(lastPosition, new Vector3(lastPosition.x, lastPosition.y - 50, lastPosition.z));
547
- var downControl = utils.moveWithLine(_this8.model, downCurve, {
548
- speed: 10,
549
- repeat: 1,
550
- lookat: false
551
- });
552
- _this8.compassInfo.verticalSpeed = 10;
553
- _this8.compassInfo.horizontalSpeed = 0;
554
-
555
- // down end
556
- downControl.addEventListener('end', function () {
557
- var rotationMatrix2 = new Matrix4();
558
- var targetQuaternion2 = new Quaternion();
559
- var targetPosition2 = _this8.inspection.curve.getPointAt((targetProgress + 0.01) % 1);
560
- rotationMatrix2.lookAt(targetPosition2, _this8.model.position, _this8.model.up);
561
- targetQuaternion2.setFromRotationMatrix(rotationMatrix2);
562
- _this8.startRotate(targetQuaternion2, _this8.model, function () {
563
- setTimeout(function () {
564
- _this8.cleanTempPathMesh();
565
- _this8.isAnimation = false;
566
- _this8.control.setProgress(targetProgress);
567
- _this8.control.continue();
568
- _this8.compassInfo.verticalSpeed = 0;
569
- _this8.compassInfo.horizontalSpeed = 10;
570
- }, 500);
571
- });
572
- });
573
- });
574
- });
575
- });
576
- }
577
- }, {
578
- key: "setSpeed",
579
- value: function setSpeed(speed) {
580
- if (this.control) this.control.setSpeed(speed);
581
- }
582
- }, {
583
- key: "stop",
584
- value: function stop() {
585
- if (this.control) this.control.stop();
586
- }
587
- }, {
588
- key: "contineMove",
589
- value: function contineMove() {
590
- if (!this.control) throw new Error('control not init');
591
- if (this.contineCount === 0) this.takeOffAnimation();else this.control.continue();
592
- this.contineCount++;
593
- this.isStartUp = true;
594
- utils.emitter.emit('continue', true);
595
- if (this.inspection.minCamera === this.inspection.gobal.scene.camera) utils.emitter.emit('play');
596
- }
597
-
598
- /**
599
- * todo: now temporarily not implemented
600
- */
601
- }, {
602
- key: "dispose",
603
- value: function dispose() {}
604
- }]);
605
- return InspectionObject;
606
- }();
607
- export default InspectionObject;
608
- //# sourceMappingURL=InspectionObject.js.map