@realsee/dnalogel 0.1.1 → 0.1.5

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 (201) hide show
  1. package/components/ARVideoFigure/ARVideoFigureMesh.js +56 -32
  2. package/components/ARVideoFigure/ARVideoFigureScene.js +30 -19
  3. package/components/ARVideoFigure/ImgBgTransparent.js +22 -6
  4. package/components/ARVideoFigure/ImgBgTransparentMesh.js +40 -30
  5. package/components/ARVideoFigure/fragmentShader.js +2 -0
  6. package/components/ARVideoFigure/index.js +22 -6
  7. package/components/ARVideoFigure/vertexShader.js +2 -0
  8. package/components/GlassFilters/index.js +25 -1
  9. package/components/ModelView/ModelViewController.js +39 -29
  10. package/components/ModelView/index.js +4 -2
  11. package/components/PBRView/index.js +15 -1
  12. package/components/PaintBrush/index.js +15 -1
  13. package/components/PanoTag/index.js +2 -0
  14. package/data/1aGKl9JmrlXMXx8d.js +2 -0
  15. package/data/54djM0oR6ky3Ey8e.d.ts +55 -0
  16. package/data/54djM0oR6ky3Ey8e.js +350 -0
  17. package/data/6gyq3v1verxD7JO1.js +2 -0
  18. package/data/8054djM0oR6ky3Ey8e.d.ts +55 -0
  19. package/data/8054djM0oR6ky3Ey8e.js +350 -0
  20. package/data/KpokNd82rwjhackhQTBEoYKHg8zGbPXe.js +2 -0
  21. package/data/PrXel3aqGbp34JQn.js +2 -0
  22. package/data/XJ6NMLWnkAY3Rdx8.d.ts +843 -0
  23. package/data/XJ6NMLWnkAY3Rdx8.js +7989 -0
  24. package/data/YdoNP9K4rwQDwjJr.js +2 -0
  25. package/data/ZLvK29zj4L29Jowd.d.ts +55 -0
  26. package/data/ZLvK29zj4L29Jowd.js +372 -0
  27. package/data/auto3d-njL5J99VwCmnjtQElOmXQr.js +2 -0
  28. package/data/extrude-walls/ZLvK29zj4L29Jowd.d.ts +5 -0
  29. package/data/extrude-walls/ZLvK29zj4L29Jowd.js +14 -0
  30. package/data/extrude-walls/lo024DEgzanMj5BE.d.ts +5 -0
  31. package/data/extrude-walls/lo024DEgzanMj5BE.js +14 -0
  32. package/data/jd6oMOzPxnQ3BvxY_B7yw51J9rXlhYhjhGTOgRVqu6WeEqjNX.d.ts +85 -0
  33. package/data/jd6oMOzPxnQ3BvxY_B7yw51J9rXlhYhjhGTOgRVqu6WeEqjNX.js +511 -0
  34. package/data/lo024DEgzanMj5BE.d.ts +55 -0
  35. package/data/lo024DEgzanMj5BE.js +966 -0
  36. package/data/oPzy3ApbjjpD8YdR.js +2 -0
  37. package/data/qjAxMG4XbPn96wKG.js +2 -0
  38. package/data/rXel3aPQRRBD4JQn.js +2 -0
  39. package/data/vLykj3NWrllMrG06.d.ts +2 -0
  40. package/data/vLykj3NWrllMrG06.js +199 -2
  41. package/data/wz0QV9KA4ugyo9ME.js +2 -0
  42. package/data/zxMawr9raSg8LYjG.d.ts +53 -0
  43. package/data/zxMawr9raSg8LYjG.js +590 -0
  44. package/examples/FiveStateController/index.js +9 -15
  45. package/examples/VRHouse/Mobile.js +15 -1
  46. package/examples/VRHouse/PC.js +15 -1
  47. package/examples/VRHouse/index.js +15 -1
  48. package/index.js +4 -2
  49. package/package.json +8 -5
  50. package/plugins/AutoPreloadPlugin/index.d.ts +23 -0
  51. package/plugins/AutoPreloadPlugin/index.js +111 -0
  52. package/plugins/CSS3DRenderPlugin/components/Marker/index.js +24 -16
  53. package/plugins/CSS3DRenderPlugin/index.d.ts +11 -11
  54. package/plugins/CSS3DRenderPlugin/index.js +200 -122
  55. package/plugins/CameraMovementPlugin/index.js +33 -9
  56. package/plugins/CameraMovementPlugin/typing.js +2 -0
  57. package/plugins/ModelChassisCompassPlugin/index.d.ts +7 -3
  58. package/plugins/ModelChassisCompassPlugin/index.js +34 -33
  59. package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +13 -1
  60. package/plugins/ModelEntryDoorGuidePlugin/index.js +230 -2
  61. package/plugins/ModelExtrudeWallsPlugin/index.d.ts +16 -0
  62. package/plugins/ModelExtrudeWallsPlugin/index.js +252 -0
  63. package/plugins/ModelRoomLabelPlugin/Controller.d.ts +35 -0
  64. package/plugins/ModelRoomLabelPlugin/Controller.js +153 -0
  65. package/plugins/ModelRoomLabelPlugin/RoomLabelItem.d.ts +8 -0
  66. package/plugins/ModelRoomLabelPlugin/RoomLabelItem.js +66 -0
  67. package/plugins/ModelRoomLabelPlugin/RoomLabelItems.d.ts +7 -0
  68. package/plugins/ModelRoomLabelPlugin/RoomLabelItems.js +159 -0
  69. package/plugins/ModelRoomLabelPlugin/index.d.ts +8 -0
  70. package/plugins/ModelRoomLabelPlugin/index.js +18 -0
  71. package/plugins/ModelRoomLabelPlugin/typings.d.ts +35 -0
  72. package/plugins/ModelRoomLabelPlugin/typings.js +7 -0
  73. package/plugins/ModelRoomLabelPlugin/utils/parseData.d.ts +3 -0
  74. package/plugins/ModelRoomLabelPlugin/utils/parseData.js +35 -0
  75. package/plugins/ModelTVVideoPlugin/index.js +100 -16
  76. package/plugins/ModelViewPlugin/index.js +25 -1
  77. package/plugins/PanoCursorRaycasterPlugin/components/MovePointTowardsCamera.js +29 -25
  78. package/plugins/PanoCursorRaycasterPlugin/components/PointAxesHelper.js +15 -1
  79. package/plugins/PanoCursorRaycasterPlugin/index.js +13 -6
  80. package/plugins/PanoCursorRaycasterPlugin/utils/addLineToFive.js +4 -2
  81. package/plugins/PanoCursorRaycasterPlugin/utils/createLine.js +15 -1
  82. package/plugins/PanoDoorLabelPlugin/index.js +2 -0
  83. package/plugins/PanoIRobotPlugin/index.js +2 -0
  84. package/plugins/PanoMaskSelectorPlugin/compare.d.ts +1 -0
  85. package/plugins/PanoMaskSelectorPlugin/compare.js +17 -0
  86. package/plugins/PanoMaskSelectorPlugin/createBox.d.ts +7 -0
  87. package/plugins/PanoMaskSelectorPlugin/createBox.js +79 -0
  88. package/plugins/PanoMaskSelectorPlugin/createTextures.d.ts +3 -0
  89. package/plugins/PanoMaskSelectorPlugin/createTextures.js +45 -0
  90. package/plugins/PanoMaskSelectorPlugin/fragmentShader.d.ts +1 -0
  91. package/plugins/PanoMaskSelectorPlugin/fragmentShader.js +10 -0
  92. package/plugins/PanoMaskSelectorPlugin/index.d.ts +49 -0
  93. package/plugins/PanoMaskSelectorPlugin/index.js +348 -0
  94. package/plugins/PanoMaskSelectorPlugin/vertexShader.d.ts +1 -0
  95. package/plugins/PanoMaskSelectorPlugin/vertexShader.js +10 -0
  96. package/plugins/PanoRulerPlugin/data/roomInfo.js +2 -0
  97. package/plugins/PanoRulerPlugin/data/roomRules.js +2 -0
  98. package/plugins/PanoRulerPlugin/index.js +68 -20
  99. package/plugins/PanoRulerPlugin/typings.js +2 -0
  100. package/plugins/PanoTVVideoPlugin/index.js +88 -12
  101. package/plugins/TreasurePlugin/Controller.d.ts +15 -7
  102. package/plugins/TreasurePlugin/Controller.js +99 -60
  103. package/plugins/TreasurePlugin/TreasureFaceAnime.js +36 -21
  104. package/plugins/TreasurePlugin/TreasureObject.d.ts +12 -2
  105. package/plugins/TreasurePlugin/TreasureObject.js +243 -117
  106. package/plugins/TreasurePlugin/TreasureOpenAnime.js +38 -19
  107. package/plugins/TreasurePlugin/constants.js +2 -0
  108. package/plugins/TreasurePlugin/index.js +2 -0
  109. package/plugins/TreasurePlugin/typings.js +2 -0
  110. package/plugins/floorplan/Assets/floorplanExtraObject.js +2 -0
  111. package/plugins/floorplan/ModelFloorplanPlugin/Controller.js +71 -88
  112. package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.js +25 -5
  113. package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.js +19 -4
  114. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.js +28 -4
  115. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.js +28 -5
  116. package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.js +20 -6
  117. package/plugins/floorplan/ModelFloorplanPlugin/components/index.js +30 -8
  118. package/plugins/floorplan/ModelFloorplanPlugin/controller.style.js +2 -0
  119. package/plugins/floorplan/ModelFloorplanPlugin/index.js +4 -2
  120. package/plugins/floorplan/ModelFloorplanPlugin/typings/events.type.js +2 -0
  121. package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.js +2 -0
  122. package/plugins/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +14 -22
  123. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +25 -3
  124. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.js +6 -2
  125. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.js +19 -3
  126. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.js +28 -4
  127. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.js +22 -6
  128. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.js +29 -19
  129. package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.style.js +2 -0
  130. package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.js +44 -47
  131. package/plugins/floorplan/PanoFloorplanRadarPlugin/index.js +4 -2
  132. package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +50 -55
  133. package/plugins/floorplan/TopviewFloorplanPlugin/index.js +2 -0
  134. package/plugins/floorplan/TopviewFloorplanPlugin/style.js +2 -0
  135. package/plugins/floorplan/components/FloorplanImage.js +15 -1
  136. package/plugins/floorplan/typings/floorplanData.js +2 -0
  137. package/plugins/floorplan/typings/floorplanServerData.js +2 -0
  138. package/plugins/floorplan/utils/formatData.js +28 -10
  139. package/plugins/floorplan/utils/formatPosition.d.ts +4 -4
  140. package/plugins/floorplan/utils/formatPosition.js +10 -8
  141. package/shared-utils/Preloader.js +6 -0
  142. package/shared-utils/Subscribe.js +36 -16
  143. package/shared-utils/animationFrame/BetterTween.js +28 -27
  144. package/shared-utils/animationFrame/calculateProgress.js +2 -0
  145. package/shared-utils/animationFrame/formatRad.js +2 -0
  146. package/shared-utils/animationFrame/index.js +12 -0
  147. package/shared-utils/animationFrame/tween.js +17 -1
  148. package/shared-utils/changeModelCanvansOpacity.js +14 -0
  149. package/shared-utils/createCanvasTextTexture.d.ts +8 -0
  150. package/shared-utils/createCanvasTextTexture.js +31 -0
  151. package/shared-utils/createFiveContainer.js +23 -17
  152. package/shared-utils/createLine/index.js +15 -1
  153. package/shared-utils/debounce.js +4 -0
  154. package/shared-utils/equal.js +15 -4
  155. package/shared-utils/filter.js +36 -2
  156. package/shared-utils/five/changeMode.js +13 -17
  157. package/shared-utils/five/useFivePlugin.js +2 -0
  158. package/shared-utils/formatRad.js +2 -0
  159. package/shared-utils/getPxmm.js +15 -1
  160. package/shared-utils/getRandomColor.js +10 -0
  161. package/shared-utils/isNil.js +2 -0
  162. package/shared-utils/isTruelyObject.js +4 -0
  163. package/shared-utils/math/evenNumber.js +2 -0
  164. package/shared-utils/math/planimetry.js +10 -0
  165. package/shared-utils/math/rad2Deg.js +2 -0
  166. package/shared-utils/nearlyEqual.js +2 -0
  167. package/shared-utils/nextFrame.js +2 -0
  168. package/shared-utils/noop.js +2 -0
  169. package/shared-utils/object3d2LocalMatrix.js +20 -14
  170. package/shared-utils/px2rem.js +10 -0
  171. package/shared-utils/tap.js +2 -0
  172. package/shared-utils/three/centerPoint.js +2 -0
  173. package/shared-utils/three/getExtraModelLoader.js +14 -0
  174. package/shared-utils/three/getNormal.js +4 -0
  175. package/shared-utils/three/getTextureLoader.js +16 -0
  176. package/shared-utils/three/loadFbxObj.js +13 -5
  177. package/shared-utils/three/loadTexture.js +13 -5
  178. package/shared-utils/three/transformPositionToVector3.d.ts +7 -0
  179. package/shared-utils/three/{vecror3.js → transformPositionToVector3.js} +4 -2
  180. package/shared-utils/three/transfromToMeshBasicMaterial.d.ts +2 -0
  181. package/shared-utils/three/transfromToMeshBasicMaterial.js +33 -0
  182. package/shared-utils/throttle.js +4 -0
  183. package/shared-utils/to.js +8 -4
  184. package/shared-utils/useDebounce.js +6 -0
  185. package/shared-utils/useThrottle.js +6 -0
  186. package/shared-utils/uuid.js +8 -0
  187. package/shared-utils/vectorTocoordinates.js +2 -0
  188. package/typedoc/components.js +2 -0
  189. package/typedoc/plugins.d.ts +2 -0
  190. package/typedoc/plugins.js +41 -1
  191. package/typedoc/shared-utils.js +2 -0
  192. package/typedoc/typings.d.ts +1 -1
  193. package/typedoc/typings.js +2 -0
  194. package/typings/math.type.d.ts +2 -2
  195. package/typings/math.type.js +2 -0
  196. package/typings/utils.type.js +2 -0
  197. package/data/wYnRjQ4KZoV1yPoG.d.ts +0 -114
  198. package/data/wYnRjQ4KZoV1yPoG.js +0 -512
  199. package/plugins/PanoCursorRaycasterPlugin/utils/vecror3.d.ts +0 -7
  200. package/plugins/PanoCursorRaycasterPlugin/utils/vecror3.js +0 -18
  201. package/shared-utils/three/vecror3.d.ts +0 -7
@@ -1,31 +1,107 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ require("core-js/modules/es.weak-map.js");
4
+
5
+ require("core-js/modules/es.object.define-property.js");
6
+
7
+ require("core-js/modules/es.object.get-own-property-descriptor.js");
8
+
9
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
10
+
11
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
12
 
5
13
  Object.defineProperty(exports, "__esModule", {
6
14
  value: true
7
15
  });
8
16
  exports["default"] = exports.PanoTVVideoPlugin = void 0;
9
17
 
10
- var THREE = _interopRequireWildcard(require("three"));
18
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
19
 
12
- var _five = require("@realsee/five");
20
+ require("core-js/modules/es.object.to-string.js");
13
21
 
14
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
+ require("core-js/modules/es.promise.js");
15
23
 
16
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
+ require("core-js/modules/es.array.iterator.js");
25
+
26
+ require("core-js/modules/es.string.iterator.js");
27
+
28
+ require("core-js/modules/web.dom-collections.iterator.js");
29
+
30
+ require("core-js/modules/web.url.js");
31
+
32
+ require("core-js/modules/web.url-search-params.js");
33
+
34
+ require("core-js/modules/es.object.assign.js");
35
+
36
+ require("core-js/modules/es.array.map.js");
37
+
38
+ require("core-js/modules/es.array.for-each.js");
39
+
40
+ require("core-js/modules/web.dom-collections.for-each.js");
41
+
42
+ require("core-js/modules/es.array-buffer.slice.js");
43
+
44
+ require("core-js/modules/es.typed-array.float32-array.js");
45
+
46
+ require("core-js/modules/es.typed-array.copy-within.js");
47
+
48
+ require("core-js/modules/es.typed-array.every.js");
49
+
50
+ require("core-js/modules/es.typed-array.fill.js");
51
+
52
+ require("core-js/modules/es.typed-array.filter.js");
53
+
54
+ require("core-js/modules/es.typed-array.find.js");
17
55
 
18
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
56
+ require("core-js/modules/es.typed-array.find-index.js");
19
57
 
20
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
58
+ require("core-js/modules/es.typed-array.for-each.js");
21
59
 
22
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
60
+ require("core-js/modules/es.typed-array.includes.js");
23
61
 
24
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
62
+ require("core-js/modules/es.typed-array.index-of.js");
25
63
 
26
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
64
+ require("core-js/modules/es.typed-array.iterator.js");
27
65
 
28
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
66
+ require("core-js/modules/es.typed-array.join.js");
67
+
68
+ require("core-js/modules/es.typed-array.last-index-of.js");
69
+
70
+ require("core-js/modules/es.typed-array.map.js");
71
+
72
+ require("core-js/modules/es.typed-array.reduce.js");
73
+
74
+ require("core-js/modules/es.typed-array.reduce-right.js");
75
+
76
+ require("core-js/modules/es.typed-array.reverse.js");
77
+
78
+ require("core-js/modules/es.typed-array.set.js");
79
+
80
+ require("core-js/modules/es.typed-array.slice.js");
81
+
82
+ require("core-js/modules/es.typed-array.some.js");
83
+
84
+ require("core-js/modules/es.typed-array.sort.js");
85
+
86
+ require("core-js/modules/es.typed-array.subarray.js");
87
+
88
+ require("core-js/modules/es.typed-array.to-locale-string.js");
89
+
90
+ require("core-js/modules/es.typed-array.to-string.js");
91
+
92
+ require("core-js/modules/es.typed-array.uint32-array.js");
93
+
94
+ require("core-js/modules/es.function.name.js");
95
+
96
+ require("core-js/modules/es.array.concat.js");
97
+
98
+ var THREE = _interopRequireWildcard(require("three"));
99
+
100
+ var _five = require("@realsee/five");
101
+
102
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
103
+
104
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
105
 
30
106
  var PanoTVVideoPlugin = function PanoTVVideoPlugin(five, parameters) {
31
107
  var state = {
@@ -309,7 +385,7 @@ var PanoTVVideoPlugin = function PanoTVVideoPlugin(five, parameters) {
309
385
  if (!state.enabled) return;
310
386
  var meshArray = [];
311
387
  videoMeshes.forEach(function (meshes) {
312
- if (meshes) meshArray.push.apply(meshArray, _toConsumableArray(meshes));
388
+ if (meshes) meshArray.push.apply(meshArray, (0, _toConsumableArray2["default"])(meshes));
313
389
  });
314
390
 
315
391
  if (raycaster.intersectObjects(meshArray).length) {
@@ -1,6 +1,7 @@
1
1
  import * as THREE from 'three';
2
2
  import { Five, Subscribe } from '@realsee/five';
3
3
  import { TREASURE_TYPE } from './constants';
4
+ import { TreasureObject } from './TreasureObject';
4
5
  export declare type TreasureObjectAssetMap = Map<string, Promise<THREE.Group>>;
5
6
  /** 对每个宝箱实例的配置 */
6
7
  export interface TreasurePluginItemConfigData {
@@ -37,29 +38,36 @@ export interface TreasurePluginData {
37
38
  export declare type TreasurePluginParameterType = undefined;
38
39
  export declare type TreasurePluginEvents = {
39
40
  /** 点击宝箱事件
40
- * @param id: 宝箱 ID
41
+ * @param params.id: 宝箱 ID
41
42
  */
42
43
  tap: (params: {
43
44
  id: string;
44
45
  }) => void;
45
- /** 宝箱打开的动画执行完毕 */
46
+ /** 宝箱打开的动画执行完毕
47
+ * @param params.id: 宝箱 ID
48
+ */
46
49
  openAnimationEnded: (params: {
47
50
  id: string;
48
51
  }) => void;
49
52
  };
50
53
  export declare class TreasurePluginController {
51
- hooks: Subscribe<TreasurePluginEvents>;
54
+ readonly hooks: Subscribe<TreasurePluginEvents>;
55
+ readonly treasures: TreasureObject[];
52
56
  private five;
53
57
  private selfGroup;
54
- private treasures;
55
58
  private textureLoader;
56
59
  private modelLoader;
57
60
  constructor(five: Five);
58
- load(data: TreasurePluginData): Promise<boolean>;
59
- dispose(): void;
61
+ load(data: TreasurePluginData, options?: {
62
+ appendTreasuresAfterLoaded?: boolean;
63
+ }): Promise<TreasureObject[]>;
64
+ dispose: () => void;
65
+ appendChild(child: TreasureObject): TreasurePluginController;
66
+ appendChildByID(childID: string): TreasurePluginController;
67
+ getTreasureByID(id: string): TreasureObject | undefined;
60
68
  removeTreasureByID(id: string): boolean;
61
69
  private onTreasureClick;
62
- private getTextureObjectParams;
70
+ private getTreasureObjectParams;
63
71
  private onTreasureOpenAnimationEnded;
64
72
  private getConfig;
65
73
  }
@@ -1,87 +1,108 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ require("core-js/modules/es.weak-map.js");
4
+
5
+ require("core-js/modules/es.object.define-property.js");
6
+
7
+ require("core-js/modules/es.object.get-own-property-descriptor.js");
8
+
9
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
10
+
11
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
12
 
5
13
  Object.defineProperty(exports, "__esModule", {
6
14
  value: true
7
15
  });
8
16
  exports.TreasurePluginController = void 0;
9
17
 
10
- var THREE = _interopRequireWildcard(require("three"));
18
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
19
 
12
- var _five = require("@realsee/five");
20
+ require("core-js/modules/es.array.for-each.js");
13
21
 
14
- var _isNil = require("../../shared-utils/isNil");
22
+ require("core-js/modules/web.dom-collections.for-each.js");
15
23
 
16
- var _constants = require("./constants");
24
+ require("core-js/modules/es.object.values.js");
17
25
 
18
- var _TreasureObject = require("./TreasureObject");
26
+ require("core-js/modules/es.function.name.js");
19
27
 
20
- var _getTextureLoader = require("../../shared-utils/three/getTextureLoader");
28
+ require("core-js/modules/es.array.iterator.js");
21
29
 
22
- var _getExtraModelLoader = require("../../shared-utils/three/getExtraModelLoader");
30
+ require("core-js/modules/es.object.to-string.js");
23
31
 
24
- var _to = _interopRequireDefault(require("../../shared-utils/to"));
32
+ require("core-js/modules/es.promise.js");
25
33
 
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
34
+ require("core-js/modules/es.string.iterator.js");
27
35
 
28
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
36
+ require("core-js/modules/web.dom-collections.iterator.js");
29
37
 
30
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
38
+ require("core-js/modules/es.array.map.js");
39
+
40
+ require("core-js/modules/es.array.filter.js");
31
41
 
32
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
42
+ require("core-js/modules/es.array.find.js");
33
43
 
34
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
44
+ require("core-js/modules/es.array.find-index.js");
35
45
 
36
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
46
+ require("core-js/modules/es.array.slice.js");
37
47
 
38
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
48
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
39
49
 
40
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
50
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
41
51
 
42
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
52
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
43
53
 
44
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
54
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
45
55
 
46
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
56
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
47
57
 
48
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
58
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
49
59
 
50
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
60
+ var THREE = _interopRequireWildcard(require("three"));
61
+
62
+ var _five = require("@realsee/five");
51
63
 
52
- 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); } }
64
+ var _isNil = require("../../shared-utils/isNil");
53
65
 
54
- 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); }); }; }
66
+ var _constants = require("./constants");
55
67
 
56
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
68
+ var _TreasureObject = require("./TreasureObject");
57
69
 
58
- 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, descriptor.key, descriptor); } }
70
+ var _getTextureLoader = require("../../shared-utils/three/getTextureLoader");
59
71
 
60
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
72
+ var _getExtraModelLoader = require("../../shared-utils/three/getExtraModelLoader");
61
73
 
62
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
74
+ var _to = _interopRequireDefault(require("../../shared-utils/to"));
75
+
76
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
77
+
78
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
63
79
 
64
80
  var TreasurePluginController = /*#__PURE__*/function () {
65
81
  function TreasurePluginController(five) {
66
82
  var _this = this;
67
83
 
68
- _classCallCheck(this, TreasurePluginController);
69
-
70
- _defineProperty(this, "hooks", new _five.Subscribe());
71
-
72
- _defineProperty(this, "treasures", []);
84
+ (0, _classCallCheck2["default"])(this, TreasurePluginController);
85
+ (0, _defineProperty2["default"])(this, "hooks", new _five.Subscribe());
86
+ (0, _defineProperty2["default"])(this, "treasures", []);
87
+ (0, _defineProperty2["default"])(this, "textureLoader", (0, _getTextureLoader.getTextureLoader)());
88
+ (0, _defineProperty2["default"])(this, "modelLoader", (0, _getExtraModelLoader.getExtraModelLoader)());
89
+ (0, _defineProperty2["default"])(this, "dispose", function () {
90
+ _this.modelLoader.dispose();
73
91
 
74
- _defineProperty(this, "textureLoader", (0, _getTextureLoader.getTextureLoader)());
92
+ _this.textureLoader.dispose();
75
93
 
76
- _defineProperty(this, "modelLoader", (0, _getExtraModelLoader.getExtraModelLoader)());
94
+ _this.five.scene.remove(_this.selfGroup);
77
95
 
78
- _defineProperty(this, "onTreasureClick", function (id) {
96
+ _this.treasures.forEach(function (treasure) {
97
+ return treasure.dispose();
98
+ });
99
+ });
100
+ (0, _defineProperty2["default"])(this, "onTreasureClick", function (id) {
79
101
  _this.hooks.emit('tap', {
80
102
  id: id
81
103
  });
82
104
  });
83
-
84
- _defineProperty(this, "getTextureObjectParams", function (data) {
105
+ (0, _defineProperty2["default"])(this, "getTreasureObjectParams", function (data) {
85
106
  var config = _this.getConfig(data);
86
107
 
87
108
  var position = new THREE.Vector3().fromArray(Object.values(data.position));
@@ -96,40 +117,39 @@ var TreasurePluginController = /*#__PURE__*/function () {
96
117
  onOpenAnimationEnded: _this.onTreasureOpenAnimationEnded
97
118
  };
98
119
  });
99
-
100
- _defineProperty(this, "onTreasureOpenAnimationEnded", function (id) {
120
+ (0, _defineProperty2["default"])(this, "onTreasureOpenAnimationEnded", function (id) {
101
121
  _this.hooks.emit('openAnimationEnded', {
102
122
  id: id
103
123
  });
104
124
  });
105
-
106
125
  this.five = five; // ========== self group ==========
107
126
 
108
127
  this.selfGroup = new THREE.Group();
109
128
  this.selfGroup.name = 'treasure-plugin-group';
110
129
  this.five.scene.add(this.selfGroup);
130
+ this.five.once('dispose', this.dispose);
111
131
  }
112
132
 
113
- _createClass(TreasurePluginController, [{
133
+ (0, _createClass2["default"])(TreasurePluginController, [{
114
134
  key: "load",
115
135
  value: function () {
116
- var _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(data) {
117
- var _this$selfGroup;
136
+ var _load = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(data, options) {
137
+ var _this$treasures;
118
138
 
119
- var _yield$to, _yield$to2, error, treasures;
139
+ var _yield$to, _yield$to2, error, treasures, appendTreasuresAfterLoaded, _this$selfGroup;
120
140
 
121
- return regeneratorRuntime.wrap(function _callee$(_context) {
141
+ return _regenerator["default"].wrap(function _callee$(_context) {
122
142
  while (1) {
123
143
  switch (_context.prev = _context.next) {
124
144
  case 0:
125
145
  _context.next = 2;
126
- return (0, _to["default"])(Promise.all(data.treasures.map(this.getTextureObjectParams).filter(_isNil.notNil).map(function (params) {
146
+ return (0, _to["default"])(Promise.all(data.treasures.map(this.getTreasureObjectParams).filter(_isNil.notNil).map(function (params) {
127
147
  return new _TreasureObject.TreasureObject(params).load();
128
148
  })));
129
149
 
130
150
  case 2:
131
151
  _yield$to = _context.sent;
132
- _yield$to2 = _slicedToArray(_yield$to, 2);
152
+ _yield$to2 = (0, _slicedToArray2["default"])(_yield$to, 2);
133
153
  error = _yield$to2[0];
134
154
  treasures = _yield$to2[1];
135
155
 
@@ -141,12 +161,19 @@ var TreasurePluginController = /*#__PURE__*/function () {
141
161
  throw error;
142
162
 
143
163
  case 8:
144
- (_this$selfGroup = this.selfGroup).add.apply(_this$selfGroup, _toConsumableArray(treasures));
164
+ (_this$treasures = this.treasures).push.apply(_this$treasures, (0, _toConsumableArray2["default"])(treasures));
145
165
 
146
- this.treasures = treasures;
147
- return _context.abrupt("return", true);
166
+ appendTreasuresAfterLoaded = (options === null || options === void 0 ? void 0 : options.appendTreasuresAfterLoaded) || true;
148
167
 
149
- case 11:
168
+ if (appendTreasuresAfterLoaded) {
169
+ (_this$selfGroup = this.selfGroup).add.apply(_this$selfGroup, (0, _toConsumableArray2["default"])(treasures));
170
+
171
+ this.five.needsRender = true;
172
+ }
173
+
174
+ return _context.abrupt("return", treasures);
175
+
176
+ case 12:
150
177
  case "end":
151
178
  return _context.stop();
152
179
  }
@@ -154,19 +181,32 @@ var TreasurePluginController = /*#__PURE__*/function () {
154
181
  }, _callee, this);
155
182
  }));
156
183
 
157
- function load(_x) {
184
+ function load(_x, _x2) {
158
185
  return _load.apply(this, arguments);
159
186
  }
160
187
 
161
188
  return load;
162
189
  }()
163
190
  }, {
164
- key: "dispose",
165
- value: function dispose() {
166
- this.modelLoader.dispose();
167
- this.textureLoader.dispose();
168
- this.treasures.forEach(function (treasure) {
169
- return treasure.dispose();
191
+ key: "appendChild",
192
+ value: function appendChild(child) {
193
+ this.selfGroup.add(child);
194
+ this.five.needsRender = true;
195
+ return this;
196
+ }
197
+ }, {
198
+ key: "appendChildByID",
199
+ value: function appendChildByID(childID) {
200
+ var treasure = this.getTreasureByID(childID);
201
+ if (!treasure) throw new Error('can not find treasure which has ID ' + childID);
202
+ this.appendChild(treasure);
203
+ return this;
204
+ }
205
+ }, {
206
+ key: "getTreasureByID",
207
+ value: function getTreasureByID(id) {
208
+ return this.treasures.find(function (treasure) {
209
+ return treasure.treasureID === id;
170
210
  });
171
211
  }
172
212
  }, {
@@ -204,7 +244,6 @@ var TreasurePluginController = /*#__PURE__*/function () {
204
244
  };
205
245
  }
206
246
  }]);
207
-
208
247
  return TreasurePluginController;
209
248
  }();
210
249
 
@@ -1,43 +1,60 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ require("core-js/modules/es.weak-map.js");
4
+
5
+ require("core-js/modules/es.object.define-property.js");
6
+
7
+ require("core-js/modules/es.object.get-own-property-descriptor.js");
8
+
9
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
10
+
11
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
12
 
5
13
  Object.defineProperty(exports, "__esModule", {
6
14
  value: true
7
15
  });
8
16
  exports.TreasureFaceAnime = void 0;
9
17
 
10
- var THREE = _interopRequireWildcard(require("three"));
18
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
19
 
12
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
+ require("core-js/modules/web.timers.js");
13
21
 
14
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
+ require("core-js/modules/es.array.map.js");
15
23
 
16
- 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); } }
24
+ require("core-js/modules/es.array.iterator.js");
17
25
 
18
- 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); }); }; }
26
+ require("core-js/modules/es.object.to-string.js");
19
27
 
20
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
28
+ require("core-js/modules/es.promise.js");
21
29
 
22
- 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, descriptor.key, descriptor); } }
30
+ require("core-js/modules/es.string.iterator.js");
23
31
 
24
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
32
+ require("core-js/modules/web.dom-collections.iterator.js");
25
33
 
26
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
34
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
27
35
 
28
- var TreasureFaceAnime = /*#__PURE__*/function () {
29
- function TreasureFaceAnime(params) {
30
- var _this = this;
36
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
31
37
 
32
- _classCallCheck(this, TreasureFaceAnime);
38
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
33
39
 
34
- _defineProperty(this, "paused", true);
40
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
35
41
 
36
- _defineProperty(this, "faceAnimeStep", 0);
42
+ var THREE = _interopRequireWildcard(require("three"));
37
43
 
38
- _defineProperty(this, "play", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
44
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
45
+
46
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
47
+
48
+ var TreasureFaceAnime = /*#__PURE__*/function () {
49
+ function TreasureFaceAnime(params) {
50
+ var _this = this;
51
+
52
+ (0, _classCallCheck2["default"])(this, TreasureFaceAnime);
53
+ (0, _defineProperty2["default"])(this, "paused", true);
54
+ (0, _defineProperty2["default"])(this, "faceAnimeStep", 0);
55
+ (0, _defineProperty2["default"])(this, "play", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
39
56
  var faceMaterial, faceTextures;
40
- return regeneratorRuntime.wrap(function _callee$(_context) {
57
+ return _regenerator["default"].wrap(function _callee$(_context) {
41
58
  while (1) {
42
59
  switch (_context.prev = _context.next) {
43
60
  case 0:
@@ -84,7 +101,6 @@ var TreasureFaceAnime = /*#__PURE__*/function () {
84
101
  }
85
102
  }, _callee);
86
103
  })));
87
-
88
104
  this.five = params.five;
89
105
  this.treasureGroup = params.treasureGroup;
90
106
  this.faceTexturesPromise = Promise.all(params.textureUrls.map(params.loadTexture));
@@ -95,7 +111,7 @@ var TreasureFaceAnime = /*#__PURE__*/function () {
95
111
  this.initialFaceTexture.encoding = THREE.sRGBEncoding;
96
112
  }
97
113
 
98
- _createClass(TreasureFaceAnime, [{
114
+ (0, _createClass2["default"])(TreasureFaceAnime, [{
99
115
  key: "pause",
100
116
  value: function pause() {
101
117
  this.paused = true;
@@ -121,7 +137,6 @@ var TreasureFaceAnime = /*#__PURE__*/function () {
121
137
  this.faceAnimeTimer = void 0;
122
138
  }
123
139
  }]);
124
-
125
140
  return TreasureFaceAnime;
126
141
  }();
127
142
 
@@ -30,14 +30,24 @@ export declare class TreasureObject extends THREE.Object3D {
30
30
  private params;
31
31
  private faceAnime?;
32
32
  private openAnime?;
33
+ private modelGroupPromise;
33
34
  constructor(params: TreasureObjectParams);
35
+ load(): Promise<TreasureObject>;
36
+ show(params?: {
37
+ duration?: number;
38
+ }): Promise<boolean>;
39
+ hide(params?: {
40
+ duration?: number;
41
+ }): Promise<boolean>;
34
42
  /** 销毁当前宝箱实例
35
43
  * @description 注意 dispose 并不会销毁所使用的贴图,因为贴图会有共用关系,需要在最外层销毁
36
44
  */
37
45
  dispose(): void;
46
+ /** 旋转宝箱朝向用户 */
38
47
  rotateToCamera(): void;
39
- private open;
40
- load(): Promise<TreasureObject>;
48
+ /** 打开宝箱 */
49
+ open(): boolean;
50
+ private getModelPromise;
41
51
  private onFiveWantsTapGesture;
42
52
  private onFivePanoArrived;
43
53
  }