@realsee/dnalogel 0.1.0 → 0.1.4
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/data/8054djM0oR6ky3Ey8e.d.ts +55 -0
- package/data/8054djM0oR6ky3Ey8e.js +348 -0
- package/data/PrXel3aqGbp34JQn.js +10 -2
- package/data/XJ6NMLWnkAY3Rdx8.d.ts +843 -0
- package/data/XJ6NMLWnkAY3Rdx8.js +7987 -0
- package/data/jd6oMOzPxnQ3BvxY_B7yw51J9rXlhYhjhGTOgRVqu6WeEqjNX.d.ts +85 -0
- package/data/jd6oMOzPxnQ3BvxY_B7yw51J9rXlhYhjhGTOgRVqu6WeEqjNX.js +509 -0
- package/data/vLykj3NWrllMrG06.d.ts +2 -0
- package/data/vLykj3NWrllMrG06.js +197 -2
- package/data/zxMawr9raSg8LYjG.d.ts +53 -0
- package/data/zxMawr9raSg8LYjG.js +588 -0
- package/package.json +3 -3
- package/plugins/AutoPreloadPlugin/index.d.ts +23 -0
- package/plugins/AutoPreloadPlugin/index.js +85 -0
- package/plugins/CSS3DRenderPlugin/index.d.ts +11 -11
- package/plugins/CSS3DRenderPlugin/index.js +170 -120
- package/plugins/ModelChassisCompassPlugin/index.d.ts +7 -3
- package/plugins/ModelChassisCompassPlugin/index.js +13 -26
- package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +13 -1
- package/plugins/ModelEntryDoorGuidePlugin/index.js +212 -2
- package/plugins/ModelRoomLabelPlugin/Controller.d.ts +35 -0
- package/plugins/ModelRoomLabelPlugin/Controller.js +147 -0
- package/plugins/ModelRoomLabelPlugin/RoomLabelItem.d.ts +8 -0
- package/plugins/ModelRoomLabelPlugin/RoomLabelItem.js +48 -0
- package/plugins/ModelRoomLabelPlugin/RoomLabelItems.d.ts +7 -0
- package/plugins/ModelRoomLabelPlugin/RoomLabelItems.js +149 -0
- package/plugins/ModelRoomLabelPlugin/index.d.ts +8 -0
- package/plugins/ModelRoomLabelPlugin/index.js +16 -0
- package/plugins/ModelRoomLabelPlugin/typings.d.ts +35 -0
- package/plugins/ModelRoomLabelPlugin/typings.js +5 -0
- package/plugins/ModelRoomLabelPlugin/utils/parseData.d.ts +3 -0
- package/plugins/ModelRoomLabelPlugin/utils/parseData.js +29 -0
- package/plugins/PanoMaskSelectorPlugin/compare.d.ts +1 -0
- package/plugins/PanoMaskSelectorPlugin/compare.js +15 -0
- package/plugins/PanoMaskSelectorPlugin/createBox.d.ts +7 -0
- package/plugins/PanoMaskSelectorPlugin/createBox.js +61 -0
- package/plugins/PanoMaskSelectorPlugin/createTextures.d.ts +3 -0
- package/plugins/PanoMaskSelectorPlugin/createTextures.js +29 -0
- package/plugins/PanoMaskSelectorPlugin/fragmentShader.d.ts +1 -0
- package/plugins/PanoMaskSelectorPlugin/fragmentShader.js +8 -0
- package/plugins/PanoMaskSelectorPlugin/index.d.ts +49 -0
- package/plugins/PanoMaskSelectorPlugin/index.js +272 -0
- package/plugins/PanoMaskSelectorPlugin/vertexShader.d.ts +1 -0
- package/plugins/PanoMaskSelectorPlugin/vertexShader.js +8 -0
- package/plugins/TreasurePlugin/Controller.d.ts +53 -12
- package/plugins/TreasurePlugin/Controller.js +129 -60
- package/plugins/TreasurePlugin/TreasureFaceAnime.d.ts +8 -6
- package/plugins/TreasurePlugin/TreasureFaceAnime.js +4 -4
- package/plugins/TreasurePlugin/TreasureObject.d.ts +30 -12
- package/plugins/TreasurePlugin/TreasureObject.js +269 -53
- package/plugins/TreasurePlugin/TreasureOpenAnime.d.ts +4 -2
- package/plugins/TreasurePlugin/TreasureOpenAnime.js +10 -5
- package/plugins/TreasurePlugin/constants.d.ts +32 -11
- package/plugins/TreasurePlugin/constants.js +52 -17
- package/plugins/TreasurePlugin/index.d.ts +5 -5
- package/plugins/TreasurePlugin/index.js +8 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.js +4 -2
- package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.js +2 -1
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.js +5 -2
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.js +1 -1
- package/plugins/floorplan/typings/floorplanData.d.ts +5 -1
- package/plugins/floorplan/utils/formatData.js +1 -22
- package/plugins/floorplan/utils/formatPosition.d.ts +4 -4
- package/shared-utils/createCanvasTextTexture.d.ts +8 -0
- package/shared-utils/createCanvasTextTexture.js +29 -0
- package/shared-utils/isNil.d.ts +10 -0
- package/shared-utils/isNil.js +24 -0
- package/shared-utils/three/getExtraModelLoader.d.ts +6 -0
- package/shared-utils/three/getExtraModelLoader.js +31 -0
- package/shared-utils/three/getTextureLoader.d.ts +6 -0
- package/shared-utils/three/getTextureLoader.js +34 -0
- package/shared-utils/three/loadFbxObj.d.ts +1 -2
- package/shared-utils/three/loadFbxObj.js +6 -2
- package/shared-utils/three/transformPositionToVector3.d.ts +7 -0
- package/shared-utils/three/{vecror3.js → transformPositionToVector3.js} +2 -2
- package/shared-utils/three/transfromToMeshBasicMaterial.d.ts +2 -0
- package/shared-utils/three/transfromToMeshBasicMaterial.js +27 -0
- package/shared-utils/to.d.ts +0 -1
- package/shared-utils/to.js +45 -7
- package/typedoc/plugins.d.ts +3 -1
- package/typedoc/plugins.js +63 -13
- package/typedoc/typings.d.ts +1 -1
- package/typings/math.type.d.ts +2 -2
- package/data/wYnRjQ4KZoV1yPoG.d.ts +0 -114
- package/data/wYnRjQ4KZoV1yPoG.js +0 -512
- package/plugins/PanoCursorRaycasterPlugin/utils/vecror3.d.ts +0 -7
- package/plugins/PanoCursorRaycasterPlugin/utils/vecror3.js +0 -18
- package/plugins/TreasurePlugin/treasureDataMap.d.ts +0 -7
- package/plugins/TreasurePlugin/treasureDataMap.js +0 -20
- package/plugins/TreasurePlugin/utils/loadTreasureTextures.d.ts +0 -7
- package/plugins/TreasurePlugin/utils/loadTreasureTextures.js +0 -115
- package/shared-utils/three/vecror3.d.ts +0 -7
|
@@ -7,21 +7,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.TreasurePluginController = void 0;
|
|
9
9
|
|
|
10
|
-
var _five = require("@realsee/five");
|
|
11
|
-
|
|
12
10
|
var THREE = _interopRequireWildcard(require("three"));
|
|
13
11
|
|
|
14
|
-
var
|
|
12
|
+
var _five = require("@realsee/five");
|
|
13
|
+
|
|
14
|
+
var _isNil = require("../../shared-utils/isNil");
|
|
15
15
|
|
|
16
16
|
var _constants = require("./constants");
|
|
17
17
|
|
|
18
18
|
var _TreasureObject = require("./TreasureObject");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _getTextureLoader = require("../../shared-utils/three/getTextureLoader");
|
|
21
|
+
|
|
22
|
+
var _getExtraModelLoader = require("../../shared-utils/three/getExtraModelLoader");
|
|
21
23
|
|
|
22
|
-
var
|
|
24
|
+
var _to = _interopRequireDefault(require("../../shared-utils/to"));
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
27
|
|
|
26
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); }
|
|
27
29
|
|
|
@@ -59,10 +61,6 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
59
61
|
|
|
60
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; }
|
|
61
63
|
|
|
62
|
-
// load 时才开始加载资源
|
|
63
|
-
// 根据传入的数据判断需要加载哪些资源
|
|
64
|
-
// 先写死宝箱类型,后续改成配置表,然后根据表里面的类型加载数据
|
|
65
|
-
// FBX 文件里面的贴图默认用的是黄色贴图,所以对于默认的贴图逻辑有特殊处理
|
|
66
64
|
var TreasurePluginController = /*#__PURE__*/function () {
|
|
67
65
|
function TreasurePluginController(five) {
|
|
68
66
|
var _this = this;
|
|
@@ -71,12 +69,50 @@ var TreasurePluginController = /*#__PURE__*/function () {
|
|
|
71
69
|
|
|
72
70
|
_defineProperty(this, "hooks", new _five.Subscribe());
|
|
73
71
|
|
|
74
|
-
_defineProperty(this, "fbxLoader", new _FBXLoader.FBXLoader());
|
|
75
|
-
|
|
76
72
|
_defineProperty(this, "treasures", []);
|
|
77
73
|
|
|
74
|
+
_defineProperty(this, "textureLoader", (0, _getTextureLoader.getTextureLoader)());
|
|
75
|
+
|
|
76
|
+
_defineProperty(this, "modelLoader", (0, _getExtraModelLoader.getExtraModelLoader)());
|
|
77
|
+
|
|
78
|
+
_defineProperty(this, "dispose", function () {
|
|
79
|
+
_this.modelLoader.dispose();
|
|
80
|
+
|
|
81
|
+
_this.textureLoader.dispose();
|
|
82
|
+
|
|
83
|
+
_this.five.scene.remove(_this.selfGroup);
|
|
84
|
+
|
|
85
|
+
_this.treasures.forEach(function (treasure) {
|
|
86
|
+
return treasure.dispose();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
78
90
|
_defineProperty(this, "onTreasureClick", function (id) {
|
|
79
|
-
_this.hooks.emit('tap',
|
|
91
|
+
_this.hooks.emit('tap', {
|
|
92
|
+
id: id
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
_defineProperty(this, "getTreasureObjectParams", function (data) {
|
|
97
|
+
var config = _this.getConfig(data);
|
|
98
|
+
|
|
99
|
+
var position = new THREE.Vector3().fromArray(Object.values(data.position));
|
|
100
|
+
return {
|
|
101
|
+
config: config,
|
|
102
|
+
position: position,
|
|
103
|
+
id: data.id,
|
|
104
|
+
five: _this.five,
|
|
105
|
+
loadTexture: _this.textureLoader.load,
|
|
106
|
+
loadModelGroup: _this.modelLoader.load,
|
|
107
|
+
clickCallback: _this.onTreasureClick,
|
|
108
|
+
onOpenAnimationEnded: _this.onTreasureOpenAnimationEnded
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
_defineProperty(this, "onTreasureOpenAnimationEnded", function (id) {
|
|
113
|
+
_this.hooks.emit('openAnimationEnded', {
|
|
114
|
+
id: id
|
|
115
|
+
});
|
|
80
116
|
});
|
|
81
117
|
|
|
82
118
|
this.five = five; // ========== self group ==========
|
|
@@ -84,63 +120,53 @@ var TreasurePluginController = /*#__PURE__*/function () {
|
|
|
84
120
|
this.selfGroup = new THREE.Group();
|
|
85
121
|
this.selfGroup.name = 'treasure-plugin-group';
|
|
86
122
|
this.five.scene.add(this.selfGroup);
|
|
123
|
+
this.five.once('dispose', this.dispose);
|
|
87
124
|
}
|
|
88
125
|
|
|
89
126
|
_createClass(TreasurePluginController, [{
|
|
90
127
|
key: "load",
|
|
91
128
|
value: function () {
|
|
92
|
-
var _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(data) {
|
|
93
|
-
var
|
|
94
|
-
_this$selfGroup;
|
|
129
|
+
var _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(data, options) {
|
|
130
|
+
var _this$treasures;
|
|
95
131
|
|
|
96
|
-
var
|
|
132
|
+
var _yield$to, _yield$to2, error, treasures, appendTreasuresAfterLoaded, _this$selfGroup;
|
|
97
133
|
|
|
98
134
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
99
135
|
while (1) {
|
|
100
136
|
switch (_context.prev = _context.next) {
|
|
101
137
|
case 0:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
_yield$
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
treasure.scale.fromArray([0.008, 0.008, 0.008]);
|
|
135
|
-
return treasure;
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
(_this$selfGroup = this.selfGroup).add.apply(_this$selfGroup, _toConsumableArray(treasures));
|
|
139
|
-
|
|
140
|
-
this.treasures = treasures;
|
|
141
|
-
return _context.abrupt("return", true);
|
|
142
|
-
|
|
143
|
-
case 13:
|
|
138
|
+
_context.next = 2;
|
|
139
|
+
return (0, _to["default"])(Promise.all(data.treasures.map(this.getTreasureObjectParams).filter(_isNil.notNil).map(function (params) {
|
|
140
|
+
return new _TreasureObject.TreasureObject(params).load();
|
|
141
|
+
})));
|
|
142
|
+
|
|
143
|
+
case 2:
|
|
144
|
+
_yield$to = _context.sent;
|
|
145
|
+
_yield$to2 = _slicedToArray(_yield$to, 2);
|
|
146
|
+
error = _yield$to2[0];
|
|
147
|
+
treasures = _yield$to2[1];
|
|
148
|
+
|
|
149
|
+
if (!(error || !treasures)) {
|
|
150
|
+
_context.next = 8;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
throw error;
|
|
155
|
+
|
|
156
|
+
case 8:
|
|
157
|
+
(_this$treasures = this.treasures).push.apply(_this$treasures, _toConsumableArray(treasures));
|
|
158
|
+
|
|
159
|
+
appendTreasuresAfterLoaded = (options === null || options === void 0 ? void 0 : options.appendTreasuresAfterLoaded) || true;
|
|
160
|
+
|
|
161
|
+
if (appendTreasuresAfterLoaded) {
|
|
162
|
+
(_this$selfGroup = this.selfGroup).add.apply(_this$selfGroup, _toConsumableArray(treasures));
|
|
163
|
+
|
|
164
|
+
this.five.needsRender = true;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return _context.abrupt("return", treasures);
|
|
168
|
+
|
|
169
|
+
case 12:
|
|
144
170
|
case "end":
|
|
145
171
|
return _context.stop();
|
|
146
172
|
}
|
|
@@ -148,12 +174,34 @@ var TreasurePluginController = /*#__PURE__*/function () {
|
|
|
148
174
|
}, _callee, this);
|
|
149
175
|
}));
|
|
150
176
|
|
|
151
|
-
function load(_x) {
|
|
177
|
+
function load(_x, _x2) {
|
|
152
178
|
return _load.apply(this, arguments);
|
|
153
179
|
}
|
|
154
180
|
|
|
155
181
|
return load;
|
|
156
182
|
}()
|
|
183
|
+
}, {
|
|
184
|
+
key: "appendChild",
|
|
185
|
+
value: function appendChild(child) {
|
|
186
|
+
this.selfGroup.add(child);
|
|
187
|
+
this.five.needsRender = true;
|
|
188
|
+
return this;
|
|
189
|
+
}
|
|
190
|
+
}, {
|
|
191
|
+
key: "appendChildByID",
|
|
192
|
+
value: function appendChildByID(childID) {
|
|
193
|
+
var treasure = this.getTreasureByID(childID);
|
|
194
|
+
if (!treasure) throw new Error('can not find treasure which has ID ' + childID);
|
|
195
|
+
this.appendChild(treasure);
|
|
196
|
+
return this;
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
key: "getTreasureByID",
|
|
200
|
+
value: function getTreasureByID(id) {
|
|
201
|
+
return this.treasures.find(function (treasure) {
|
|
202
|
+
return treasure.treasureID === id;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
157
205
|
}, {
|
|
158
206
|
key: "removeTreasureByID",
|
|
159
207
|
value: function removeTreasureByID(id) {
|
|
@@ -167,6 +215,27 @@ var TreasurePluginController = /*#__PURE__*/function () {
|
|
|
167
215
|
this.treasures.slice(treasureIndex, 1);
|
|
168
216
|
return true;
|
|
169
217
|
}
|
|
218
|
+
}, {
|
|
219
|
+
key: "getConfig",
|
|
220
|
+
value: function getConfig(data) {
|
|
221
|
+
var _DEFAULT_TREASURE_CON, _ref2, _data$config$scale, _data$config, _data$config2, _data$config3, _data$config4;
|
|
222
|
+
|
|
223
|
+
var typeConfig = (_DEFAULT_TREASURE_CON = _constants.DEFAULT_TREASURE_CONFIGS.find(function (_ref) {
|
|
224
|
+
var type = _ref.type;
|
|
225
|
+
return type === data.type;
|
|
226
|
+
})) === null || _DEFAULT_TREASURE_CON === void 0 ? void 0 : _DEFAULT_TREASURE_CON.config;
|
|
227
|
+
var defaultConfig = _constants.DEFAULT_TREASURE_CONFIG;
|
|
228
|
+
var scale = (_ref2 = (_data$config$scale = data === null || data === void 0 ? void 0 : (_data$config = data.config) === null || _data$config === void 0 ? void 0 : _data$config.scale) !== null && _data$config$scale !== void 0 ? _data$config$scale : typeConfig === null || typeConfig === void 0 ? void 0 : typeConfig.scale) !== null && _ref2 !== void 0 ? _ref2 : defaultConfig.scale;
|
|
229
|
+
var objectUrl = (data === null || data === void 0 ? void 0 : (_data$config2 = data.config) === null || _data$config2 === void 0 ? void 0 : _data$config2.object_url) || (typeConfig === null || typeConfig === void 0 ? void 0 : typeConfig.objectUrl) || defaultConfig.objectUrl;
|
|
230
|
+
var boxTextureUrl = (data === null || data === void 0 ? void 0 : (_data$config3 = data.config) === null || _data$config3 === void 0 ? void 0 : _data$config3.box_texture_url) || (typeConfig === null || typeConfig === void 0 ? void 0 : typeConfig.boxTextureUrl) || defaultConfig.boxTextureUrl;
|
|
231
|
+
var faceAnimeTextureUrls = (data === null || data === void 0 ? void 0 : (_data$config4 = data.config) === null || _data$config4 === void 0 ? void 0 : _data$config4.face_anime_texture_urls) || (typeConfig === null || typeConfig === void 0 ? void 0 : typeConfig.faceAnimeTextureUrls) || defaultConfig.faceAnimeTextureUrls;
|
|
232
|
+
return {
|
|
233
|
+
scale: scale,
|
|
234
|
+
objectUrl: objectUrl,
|
|
235
|
+
boxTextureUrl: boxTextureUrl,
|
|
236
|
+
faceAnimeTextureUrls: faceAnimeTextureUrls
|
|
237
|
+
};
|
|
238
|
+
}
|
|
170
239
|
}]);
|
|
171
240
|
|
|
172
241
|
return TreasurePluginController;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
1
2
|
import { Five } from '@realsee/five';
|
|
2
|
-
import { Group
|
|
3
|
-
export interface
|
|
3
|
+
import { Group } from 'three';
|
|
4
|
+
export interface TreasureFaceAnimeParams {
|
|
4
5
|
five: Five;
|
|
5
6
|
treasureGroup: Group;
|
|
6
|
-
|
|
7
|
+
textureUrls: string[];
|
|
8
|
+
loadTexture: (url: string) => Promise<THREE.Texture>;
|
|
7
9
|
}
|
|
8
10
|
export declare class TreasureFaceAnime {
|
|
9
11
|
paused: boolean;
|
|
10
12
|
private five;
|
|
11
|
-
private treasureGroup;
|
|
12
13
|
private faceAnimeStep;
|
|
14
|
+
private treasureGroup;
|
|
15
|
+
private initialFaceTexture;
|
|
13
16
|
private faceAnimeTimer?;
|
|
14
17
|
private faceTexturesPromise;
|
|
15
|
-
private initialFaceTexture;
|
|
16
18
|
private faceMesh;
|
|
17
|
-
constructor(
|
|
19
|
+
constructor(params: TreasureFaceAnimeParams);
|
|
18
20
|
play: () => Promise<boolean>;
|
|
19
21
|
pause(): boolean;
|
|
20
22
|
dispose(): void;
|
|
@@ -26,7 +26,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
26
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; }
|
|
27
27
|
|
|
28
28
|
var TreasureFaceAnime = /*#__PURE__*/function () {
|
|
29
|
-
function TreasureFaceAnime(
|
|
29
|
+
function TreasureFaceAnime(params) {
|
|
30
30
|
var _this = this;
|
|
31
31
|
|
|
32
32
|
_classCallCheck(this, TreasureFaceAnime);
|
|
@@ -85,9 +85,9 @@ var TreasureFaceAnime = /*#__PURE__*/function () {
|
|
|
85
85
|
}, _callee);
|
|
86
86
|
})));
|
|
87
87
|
|
|
88
|
-
this.five =
|
|
89
|
-
this.treasureGroup =
|
|
90
|
-
this.faceTexturesPromise =
|
|
88
|
+
this.five = params.five;
|
|
89
|
+
this.treasureGroup = params.treasureGroup;
|
|
90
|
+
this.faceTexturesPromise = Promise.all(params.textureUrls.map(params.loadTexture));
|
|
91
91
|
this.faceMesh = this.treasureGroup.getObjectByName('face');
|
|
92
92
|
var initialFaceTexture = this.faceMesh.material.map;
|
|
93
93
|
if (!initialFaceTexture) throw new Error('初始化失败,不能从模型文件中找到对应的动画贴图');
|
|
@@ -1,35 +1,53 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { Five } from '@realsee/five';
|
|
3
|
+
export interface TreasureObjectConfig {
|
|
4
|
+
scale: number;
|
|
5
|
+
objectUrl: string;
|
|
6
|
+
boxTextureUrl?: string;
|
|
7
|
+
faceAnimeTextureUrls: string[];
|
|
8
|
+
}
|
|
3
9
|
/** 宝箱实例
|
|
4
10
|
* @description
|
|
5
11
|
* 点击宝箱可以打开宝箱
|
|
6
12
|
* @description
|
|
7
13
|
* 在宝箱未打开时,靠近宝箱或点击宝箱,宝箱会转动到朝向用户的方向
|
|
8
14
|
*/
|
|
9
|
-
export interface
|
|
15
|
+
export interface TreasureObjectParams {
|
|
10
16
|
id: string;
|
|
11
17
|
five: Five;
|
|
12
|
-
fbxGroup: THREE.Group;
|
|
13
18
|
position: THREE.Vector3;
|
|
14
|
-
|
|
15
|
-
faceTexturesPromise: Promise<THREE.Texture[]>;
|
|
19
|
+
config: TreasureObjectConfig;
|
|
16
20
|
clickCallback?: (id: string) => unknown;
|
|
21
|
+
onOpenAnimationEnded?: (id: string) => unknown;
|
|
22
|
+
loadTexture: (url: string) => Promise<THREE.Texture>;
|
|
23
|
+
loadModelGroup: (url: string) => Promise<THREE.Group>;
|
|
17
24
|
}
|
|
18
25
|
export declare class TreasureObject extends THREE.Object3D {
|
|
19
26
|
readonly treasureID: string;
|
|
20
27
|
readonly name = "treasureObject";
|
|
21
28
|
protected opened: boolean;
|
|
22
29
|
private five;
|
|
23
|
-
private
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
private
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
private params;
|
|
31
|
+
private faceAnime?;
|
|
32
|
+
private openAnime?;
|
|
33
|
+
private modelGroupPromise;
|
|
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>;
|
|
42
|
+
/** 销毁当前宝箱实例
|
|
43
|
+
* @description 注意 dispose 并不会销毁所使用的贴图,因为贴图会有共用关系,需要在最外层销毁
|
|
44
|
+
*/
|
|
29
45
|
dispose(): void;
|
|
46
|
+
/** 旋转宝箱朝向用户 */
|
|
30
47
|
rotateToCamera(): void;
|
|
31
|
-
|
|
32
|
-
|
|
48
|
+
/** 打开宝箱 */
|
|
49
|
+
open(): boolean;
|
|
50
|
+
private getModelPromise;
|
|
33
51
|
private onFiveWantsTapGesture;
|
|
34
52
|
private onFivePanoArrived;
|
|
35
53
|
}
|