@realsee/dnalogel 2.0.0-alpha.42 → 2.0.0-alpha.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CSS3DRenderPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/CameraMovementPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/CameraMovementPlugin/index.js +15 -40
- package/dist/ItemLabelPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/ModelChassisCompassPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/ModelChassisCompassPlugin/index.js +5 -30
- package/dist/ModelEntryDoorGuidePlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/ModelEntryDoorGuidePlugin/index.js +8 -33
- package/dist/ModelItemLabelPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/ModelRoomLabelPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/ModelTVVideoPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/ModelTVVideoPlugin/index.js +3 -28
- package/dist/ModelViewPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoCompassPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoCompassPlugin/index.js +64 -99
- package/dist/PanoCursorRaycasterPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoMeasurePlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoRulerPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoRulerPlugin/index.js +3 -28
- package/dist/PanoRulerProPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/PanoRulerProPlugin/index.js +29 -58
- package/dist/PanoSpatialTagPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/floorplan/ModelFloorplanPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/floorplan/ModelFloorplanPlugin/index.js +115 -156
- package/dist/floorplan/PanoFloorplanRadarPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/floorplan/PanoFloorplanRadarPlugin/index.js +71 -110
- package/dist/floorplan/TopviewFloorplanPlugin/PanoCompassPlugin/index.d.ts +1 -1
- package/dist/floorplan/TopviewFloorplanPlugin/index.js +114 -159
- package/dist/index.es.js +341 -416
- package/dist/index.js +341 -416
- package/dist/index.umd.js +341 -416
- package/docs/assets/search.js +1 -1
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- package/docs/enums/CameraMovementEffect.html +2 -2
- package/docs/enums/DIRECTION.html +1 -1
- package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
- package/docs/enums/Rotation.html +2 -2
- package/docs/index.html +2 -2
- package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
- package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/FloorplanBounding.html +4 -4
- package/docs/interfaces/FloorplanData.html +2 -2
- package/docs/interfaces/FloorplanEntrance.html +7 -7
- package/docs/interfaces/FloorplanExtraObject.html +3 -3
- package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
- package/docs/interfaces/FloorplanFloorData.html +2 -2
- package/docs/interfaces/FloorplanImagePosition.html +2 -2
- package/docs/interfaces/FloorplanObserver.html +2 -2
- package/docs/interfaces/FloorplanOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanPosition.html +2 -2
- package/docs/interfaces/FloorplanRoomItem.html +6 -6
- package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
- package/docs/interfaces/FloorplanServerBounding.html +4 -4
- package/docs/interfaces/FloorplanServerComputedData.html +1 -1
- package/docs/interfaces/FloorplanServerData.html +2 -2
- package/docs/interfaces/FloorplanServerEntrance.html +7 -7
- package/docs/interfaces/FloorplanServerFloorData.html +2 -2
- package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
- package/docs/interfaces/FloorplanServerObserver.html +2 -2
- package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
- package/docs/interfaces/FloorplanServerPosition.html +2 -2
- package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
- package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
- package/docs/interfaces/ItemLabelPluginData.html +1 -1
- package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/LineJson.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
- package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
- package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
- package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
- package/docs/interfaces/ModelViewPluginExportType.html +1 -1
- package/docs/interfaces/OpenParameter.html +2 -2
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
- package/docs/interfaces/PanoMeasureParameterType.html +1 -1
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -1
- package/docs/interfaces/PanoRulerProPluginState.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
- package/docs/interfaces/Point.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/Room.html +1 -1
- package/docs/interfaces/RoomInfo.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/RoomRules.html +1 -1
- package/docs/interfaces/Rooms.html +1 -1
- package/docs/modules.html +18 -18
- package/libs/CameraMovementPlugin/CameraMovementPlugin.js +15 -24
- package/libs/ModelChassisCompassPlugin/Plugin.js +5 -14
- package/libs/ModelEntryDoorGuidePlugin/Plugin.js +8 -17
- package/libs/ModelTVVideoPlugin/Plugin.js +3 -12
- package/libs/PanoCompassPlugin/controller.js +56 -73
- package/libs/PanoCompassPlugin/index.d.ts +1 -1
- package/libs/PanoRulerPlugin/Plugin.js +3 -12
- package/libs/PanoRulerProPlugin/Controller.js +29 -42
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +29 -42
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +43 -60
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +58 -79
- package/libs/floorplan/utils/correctFiveState.js +20 -31
- package/libs/floorplan/utils/formatData.js +28 -43
- package/libs/shared-utils/five/changeMode.js +28 -39
- package/libs/shared-utils/three/loadFbxObj.js +9 -20
- package/libs/shared-utils/three/loadTexture.js +6 -17
- package/libs/shared-utils/to.js +10 -21
- package/package.json +14 -14
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { Five } from '@realsee/five';
|
|
11
2
|
import * as TWEEN from '@tweenjs/tween.js';
|
|
12
3
|
import { tweenProgress } from '../shared-utils/animationFrame/tween';
|
|
@@ -38,21 +29,21 @@ const getLongitudeParams = (from, to, rotation) => {
|
|
|
38
29
|
*/
|
|
39
30
|
export const CameraMovementPlugin = (five) => {
|
|
40
31
|
const state = {};
|
|
41
|
-
const move = (args, duration, opts = { preload: true }) =>
|
|
32
|
+
const move = async (args, duration, opts = { preload: true }) => {
|
|
42
33
|
if (state.interruptCallback) {
|
|
43
34
|
state.interruptCallback(false);
|
|
44
35
|
}
|
|
45
36
|
if (opts.asyncStartCallback) {
|
|
46
|
-
|
|
37
|
+
await opts.asyncStartCallback();
|
|
47
38
|
}
|
|
48
39
|
if (args.mode && args.mode !== five.currentMode) {
|
|
49
|
-
|
|
40
|
+
await five.changeMode(args.mode);
|
|
50
41
|
}
|
|
51
42
|
if (opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex) {
|
|
52
|
-
|
|
43
|
+
await five.preloadPano(args.panoIndex);
|
|
53
44
|
}
|
|
54
45
|
if (opts.asyncEndCallback) {
|
|
55
|
-
|
|
46
|
+
await opts.asyncEndCallback();
|
|
56
47
|
}
|
|
57
48
|
if (args.panoIndex === undefined &&
|
|
58
49
|
args.fov === undefined &&
|
|
@@ -60,7 +51,7 @@ export const CameraMovementPlugin = (five) => {
|
|
|
60
51
|
args.longitude === undefined) {
|
|
61
52
|
return true;
|
|
62
53
|
}
|
|
63
|
-
return
|
|
54
|
+
return await new Promise((resolve, reject) => {
|
|
64
55
|
const panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
|
|
65
56
|
if (panoIndex !== undefined) {
|
|
66
57
|
five.moveToPano(panoIndex, Object.assign({
|
|
@@ -73,7 +64,7 @@ export const CameraMovementPlugin = (five) => {
|
|
|
73
64
|
reject(false);
|
|
74
65
|
}
|
|
75
66
|
});
|
|
76
|
-
}
|
|
67
|
+
};
|
|
77
68
|
const getAnimeParams = (args) => {
|
|
78
69
|
const currentFiveState = five.state;
|
|
79
70
|
// latitude
|
|
@@ -89,20 +80,20 @@ export const CameraMovementPlugin = (five) => {
|
|
|
89
80
|
to: { latitude: toLatitude, longitude: toLongitude, fov: toFov },
|
|
90
81
|
};
|
|
91
82
|
};
|
|
92
|
-
const rotate = (args, duration, opts = {}) =>
|
|
83
|
+
const rotate = async (args, duration, opts = {}) => {
|
|
93
84
|
if (state.interruptCallback) {
|
|
94
85
|
state.interruptCallback(false);
|
|
95
86
|
}
|
|
96
87
|
if (opts.asyncStartCallback) {
|
|
97
|
-
|
|
88
|
+
await opts.asyncStartCallback();
|
|
98
89
|
}
|
|
99
90
|
if (five.currentMode !== Five.Mode.Panorama) {
|
|
100
|
-
|
|
91
|
+
await five.changeMode(Five.Mode.Panorama);
|
|
101
92
|
}
|
|
102
93
|
if (args.panoIndex !== undefined && args.panoIndex !== five.panoIndex) {
|
|
103
94
|
if (opts.preload)
|
|
104
|
-
|
|
105
|
-
|
|
95
|
+
await five.preloadPano(args.panoIndex);
|
|
96
|
+
await new Promise((resolve, reject) => {
|
|
106
97
|
if (!args.panoIndex) {
|
|
107
98
|
resolve(true);
|
|
108
99
|
return;
|
|
@@ -114,10 +105,10 @@ export const CameraMovementPlugin = (five) => {
|
|
|
114
105
|
});
|
|
115
106
|
}
|
|
116
107
|
if (opts.asyncEndCallback) {
|
|
117
|
-
|
|
108
|
+
await opts.asyncEndCallback();
|
|
118
109
|
}
|
|
119
110
|
const { from, to } = getAnimeParams(args);
|
|
120
|
-
return
|
|
111
|
+
return await new Promise((resolve) => {
|
|
121
112
|
const onUpdate = ({ progress }) => {
|
|
122
113
|
const state = {};
|
|
123
114
|
state.longitude = progressNumber(from.longitude, to.longitude, progress);
|
|
@@ -159,7 +150,7 @@ export const CameraMovementPlugin = (five) => {
|
|
|
159
150
|
state.interruptCallback(true);
|
|
160
151
|
}, duration);
|
|
161
152
|
});
|
|
162
|
-
}
|
|
153
|
+
};
|
|
163
154
|
return {
|
|
164
155
|
move,
|
|
165
156
|
rotate,
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import * as THREE from 'three';
|
|
11
2
|
import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader';
|
|
12
3
|
import object3d2LocalMatrix from '../shared-utils/object3d2LocalMatrix';
|
|
@@ -20,10 +11,10 @@ export const ModelChassisCompassPlugin = (five, params) => {
|
|
|
20
11
|
const defaultNorthRad = (_a = params.north_rad) !== null && _a !== void 0 ? _a : undefined;
|
|
21
12
|
// 局部状态
|
|
22
13
|
const state = {};
|
|
23
|
-
const load = (data) =>
|
|
24
|
-
var
|
|
14
|
+
const load = async (data) => {
|
|
15
|
+
var _a;
|
|
25
16
|
const fbxUrl = (data === null || data === void 0 ? void 0 : data.fbx_url) || defaultFbxUrl;
|
|
26
|
-
const northRad = (
|
|
17
|
+
const northRad = (_a = data === null || data === void 0 ? void 0 : data.north_rad) !== null && _a !== void 0 ? _a : defaultNorthRad;
|
|
27
18
|
if (typeof northRad !== 'number') {
|
|
28
19
|
throw new Error('"northRad"配置参数缺失:未配置指南针指向!');
|
|
29
20
|
}
|
|
@@ -32,7 +23,7 @@ export const ModelChassisCompassPlugin = (five, params) => {
|
|
|
32
23
|
const zOffset = bounding.max.z - bounding.min.z;
|
|
33
24
|
const maxOffset = Math.max(xOffset, zOffset);
|
|
34
25
|
const fbxLoader = new FBXLoader();
|
|
35
|
-
const object =
|
|
26
|
+
const object = await fbxLoader.loadAsync(fbxUrl);
|
|
36
27
|
transfromToMeshBasicMaterial(object, {
|
|
37
28
|
transparent: true,
|
|
38
29
|
side: THREE.DoubleSide,
|
|
@@ -46,7 +37,7 @@ export const ModelChassisCompassPlugin = (five, params) => {
|
|
|
46
37
|
object3d2LocalMatrix(object, { position, rotation, scale });
|
|
47
38
|
state.object = object;
|
|
48
39
|
return true;
|
|
49
|
-
}
|
|
40
|
+
};
|
|
50
41
|
const onCameraUpdate = ({ latitude }) => {
|
|
51
42
|
if (!state.object)
|
|
52
43
|
return;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { AnimationMixer, MeshBasicMaterial } from 'three';
|
|
11
2
|
import * as THREE from 'three';
|
|
12
3
|
import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader';
|
|
@@ -25,25 +16,25 @@ export const ModelEntryDoorGuidePlugin = (five, params) => {
|
|
|
25
16
|
const defaultRad = (_c = params.rad) !== null && _c !== void 0 ? _c : undefined;
|
|
26
17
|
const defaultFbxUrl = params.fbx_url || '//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx';
|
|
27
18
|
const mixers = [];
|
|
28
|
-
const load = (data) =>
|
|
29
|
-
var
|
|
30
|
-
const position = (
|
|
19
|
+
const load = async (data) => {
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
21
|
+
const position = (_a = data === null || data === void 0 ? void 0 : data.position) !== null && _a !== void 0 ? _a : defaultModelPosition;
|
|
31
22
|
if (!position)
|
|
32
23
|
return Promise.reject(`ModelEntryDoorGuidePlugin.load(): position is undefined`);
|
|
33
24
|
const modelPosition = transformPositionToVector3(position);
|
|
34
|
-
const rad = (
|
|
35
|
-
const fbxUrl = (
|
|
25
|
+
const rad = (_b = data === null || data === void 0 ? void 0 : data.rad) !== null && _b !== void 0 ? _b : defaultRad;
|
|
26
|
+
const fbxUrl = (_c = data === null || data === void 0 ? void 0 : data.fbx_url) !== null && _c !== void 0 ? _c : defaultFbxUrl;
|
|
36
27
|
state.rad = rad;
|
|
37
28
|
if (rad === undefined)
|
|
38
29
|
return Promise.reject(`ModelEntryDoorGuidePlugin.load(): rad is ${rad}`);
|
|
39
30
|
// 加载模型
|
|
40
|
-
const object =
|
|
31
|
+
const object = await new FBXLoader().loadAsync(fbxUrl);
|
|
41
32
|
// 设置位置
|
|
42
33
|
object.position.copy(modelPosition);
|
|
43
34
|
object.rotation.z = rad;
|
|
44
35
|
object.scale.set(0.8, 0.8, 0.8);
|
|
45
36
|
transfromToMeshBasicMaterial(object, { transparent: true, side: THREE.DoubleSide });
|
|
46
|
-
const textMesh = (
|
|
37
|
+
const textMesh = (_g = (_f = (_e = (_d = object.children) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.children) === null || _f === void 0 ? void 0 : _f[3]) === null || _g === void 0 ? void 0 : _g.clone();
|
|
47
38
|
if (!textMesh)
|
|
48
39
|
return Promise.reject(`ModelEntryDoorGuidePlugin.load(): textMesh is ${textMesh}`);
|
|
49
40
|
textMesh.material = new MeshBasicMaterial({ transparent: true, map: createCanvasTextTexture('入户门') });
|
|
@@ -51,7 +42,7 @@ export const ModelEntryDoorGuidePlugin = (five, params) => {
|
|
|
51
42
|
object.children[0].add(textMesh);
|
|
52
43
|
state.object = object;
|
|
53
44
|
return true;
|
|
54
|
-
}
|
|
45
|
+
};
|
|
55
46
|
const initAnimation = () => {
|
|
56
47
|
if (state.animation)
|
|
57
48
|
return;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import * as THREE from 'three';
|
|
11
2
|
import { parseModelTVVideoPoints } from "./utils/parseData";
|
|
12
3
|
export const ModelTVVideoPlugin = (five, { videoElement }) => {
|
|
@@ -161,7 +152,7 @@ export const ModelTVVideoPlugin = (five, { videoElement }) => {
|
|
|
161
152
|
xhr.send();
|
|
162
153
|
});
|
|
163
154
|
};
|
|
164
|
-
const load = (data, videoElement) =>
|
|
155
|
+
const load = async (data, videoElement) => {
|
|
165
156
|
const { video_src, video_poster_src, points } = data;
|
|
166
157
|
state.videoSource = video_src;
|
|
167
158
|
// TODO 存疑,先处理多一次遍历 o(2n)
|
|
@@ -171,11 +162,11 @@ export const ModelTVVideoPlugin = (five, { videoElement }) => {
|
|
|
171
162
|
if (videoElement) {
|
|
172
163
|
state.videoElement = videoElement;
|
|
173
164
|
}
|
|
174
|
-
state.videoTexture =
|
|
165
|
+
state.videoTexture = await getVideoTexture(state.videoSource, state.videoElement);
|
|
175
166
|
state.enabled = !!data.enable;
|
|
176
167
|
if (state.enabled)
|
|
177
168
|
enable();
|
|
178
|
-
}
|
|
169
|
+
};
|
|
179
170
|
const dispose = () => {
|
|
180
171
|
disable();
|
|
181
172
|
state.videoTexture = undefined;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import * as THREE from 'three';
|
|
11
2
|
import { Five } from '@realsee/five';
|
|
12
3
|
import * as BasePlugin from '../base/BasePluginWithData';
|
|
@@ -379,19 +370,17 @@ export class PanoCompassController extends BasePlugin.Controller {
|
|
|
379
370
|
this.init();
|
|
380
371
|
}
|
|
381
372
|
}
|
|
382
|
-
load(data, state, userAction = true) {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
this.setState(state, { userAction });
|
|
391
|
-
}
|
|
392
|
-
this.hooks.emit('dataLoaded', this.data);
|
|
373
|
+
async load(data, state, userAction = true) {
|
|
374
|
+
const nextData = await this.formatData(data);
|
|
375
|
+
if (JSON.stringify(this.data) !== JSON.stringify(nextData)) {
|
|
376
|
+
this.hooks.emit('dataChange', nextData, this.data);
|
|
377
|
+
this.data = Object.assign({}, nextData);
|
|
378
|
+
this.init();
|
|
379
|
+
if (state) {
|
|
380
|
+
this.setState(state, { userAction });
|
|
393
381
|
}
|
|
394
|
-
|
|
382
|
+
this.hooks.emit('dataLoaded', this.data);
|
|
383
|
+
}
|
|
395
384
|
}
|
|
396
385
|
formatData(serverData) {
|
|
397
386
|
if (serverData.version && serverData.data) {
|
|
@@ -405,64 +394,58 @@ export class PanoCompassController extends BasePlugin.Controller {
|
|
|
405
394
|
* 初始化
|
|
406
395
|
* @todo 逻辑需要细分
|
|
407
396
|
*/
|
|
408
|
-
init() {
|
|
397
|
+
async init() {
|
|
409
398
|
var _a, _b, _c, _d;
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
|
|
428
|
-
}
|
|
429
|
-
this.group.add(this.entryDoorMesh);
|
|
399
|
+
const northRad = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.north_rad) !== null && _b !== void 0 ? _b : null;
|
|
400
|
+
this._clearCompassIfNeed();
|
|
401
|
+
if (northRad !== null) {
|
|
402
|
+
this.compassMesh = await this.loadCompassMesh();
|
|
403
|
+
this.compassMesh.rotateX(-Math.PI / 2);
|
|
404
|
+
this.compassMesh.rotateZ(northRad - Math.PI / 2);
|
|
405
|
+
this.group.add(this.compassMesh);
|
|
406
|
+
}
|
|
407
|
+
const entrance = (_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c.entrance) !== null && _d !== void 0 ? _d : null;
|
|
408
|
+
this._clearEntryDoorIfNeed();
|
|
409
|
+
if (entrance !== null) {
|
|
410
|
+
this.entryDoorMesh = await this.loadEntryDoorMesh();
|
|
411
|
+
this.roomInfoWrapperInstance = this.loadRoomInfo();
|
|
412
|
+
this.roomInfoInstance = getRoomInfoInstance();
|
|
413
|
+
this.entryDoorMesh.rotateX(-Math.PI / 2);
|
|
414
|
+
if (this.roomInfoWrapperInstance) {
|
|
415
|
+
this.roomInfoInstance.appendTo(this.roomInfoWrapperInstance.container);
|
|
430
416
|
}
|
|
431
|
-
this.
|
|
432
|
-
|
|
433
|
-
|
|
417
|
+
this.group.add(this.entryDoorMesh);
|
|
418
|
+
}
|
|
419
|
+
this.onFivePanoArrived(this.five.panoIndex || 0);
|
|
420
|
+
this.five.needsRender = true;
|
|
434
421
|
}
|
|
435
|
-
loadCompassMesh() {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
depthTest: false,
|
|
445
|
-
});
|
|
446
|
-
const compassMesh = new THREE.Mesh(compassGeometry, compassMaterial);
|
|
447
|
-
compassMesh.name = 'pano-compass-mesh';
|
|
448
|
-
return compassMesh;
|
|
422
|
+
async loadCompassMesh() {
|
|
423
|
+
const compassImageUrl = this.state.config.compassImageUrl;
|
|
424
|
+
const compassTexture = await loadTexture(compassImageUrl);
|
|
425
|
+
const compassGeometry = new THREE.CircleGeometry(0.7, 32);
|
|
426
|
+
const compassMaterial = new THREE.MeshBasicMaterial({
|
|
427
|
+
map: compassTexture,
|
|
428
|
+
transparent: true,
|
|
429
|
+
opacity: 0,
|
|
430
|
+
depthTest: false,
|
|
449
431
|
});
|
|
432
|
+
const compassMesh = new THREE.Mesh(compassGeometry, compassMaterial);
|
|
433
|
+
compassMesh.name = 'pano-compass-mesh';
|
|
434
|
+
return compassMesh;
|
|
450
435
|
}
|
|
451
|
-
loadEntryDoorMesh() {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
depthTest: false,
|
|
461
|
-
});
|
|
462
|
-
const entryDoorMesh = new THREE.Mesh(entryDoorGeometry, entryDoorMaterial);
|
|
463
|
-
entryDoorMesh.name = 'pano-compass-entry-door';
|
|
464
|
-
return entryDoorMesh;
|
|
436
|
+
async loadEntryDoorMesh() {
|
|
437
|
+
const entryDoorImageUrl = this.state.config.entryDoorImageUrl;
|
|
438
|
+
const entryDoorTexture = await loadTexture(entryDoorImageUrl);
|
|
439
|
+
const entryDoorGeometry = new THREE.PlaneGeometry(0.2, 0.16);
|
|
440
|
+
const entryDoorMaterial = new THREE.MeshBasicMaterial({
|
|
441
|
+
map: entryDoorTexture,
|
|
442
|
+
transparent: true,
|
|
443
|
+
opacity: 0.8,
|
|
444
|
+
depthTest: false,
|
|
465
445
|
});
|
|
446
|
+
const entryDoorMesh = new THREE.Mesh(entryDoorGeometry, entryDoorMaterial);
|
|
447
|
+
entryDoorMesh.name = 'pano-compass-entry-door';
|
|
448
|
+
return entryDoorMesh;
|
|
466
449
|
}
|
|
467
450
|
loadRoomInfo() {
|
|
468
451
|
const points = [
|
|
@@ -4,4 +4,4 @@ import type { PanoCompassPluginParameterType } from './typings';
|
|
|
4
4
|
export declare type PanoCompassPluginExportType = PanoCompassController;
|
|
5
5
|
export declare const PanoCompassPlugin: FivePlugin<PanoCompassPluginParameterType, PanoCompassPluginExportType>;
|
|
6
6
|
export default PanoCompassPlugin;
|
|
7
|
-
export type { PanoCompassPluginParameterType } from './typings';
|
|
7
|
+
export type { PanoCompassPluginParameterType, PanoCompassPluginData } from './typings';
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { Five } from '@realsee/five';
|
|
11
2
|
import { Raycaster, Vector3 } from 'three';
|
|
12
3
|
import { intersectionOfLine } from '../shared-utils/math/planimetry';
|
|
@@ -171,7 +162,7 @@ export const PanoRulerPlugin = (five, params) => {
|
|
|
171
162
|
freshRule();
|
|
172
163
|
return true;
|
|
173
164
|
};
|
|
174
|
-
const load = (_roomInfo, _roomRules, options) =>
|
|
165
|
+
const load = async (_roomInfo, _roomRules, options) => {
|
|
175
166
|
const roomInfo = _roomInfo || params.roomInfo;
|
|
176
167
|
const roomRules = _roomRules || params.roomRules;
|
|
177
168
|
if (!roomInfo || !roomRules) {
|
|
@@ -183,9 +174,9 @@ export const PanoRulerPlugin = (five, params) => {
|
|
|
183
174
|
return _load(roomInfo, roomRules);
|
|
184
175
|
}
|
|
185
176
|
else {
|
|
186
|
-
return
|
|
177
|
+
return await new Promise((resolve) => five.once('modelLoaded', () => resolve(_load(roomInfo, roomRules))));
|
|
187
178
|
}
|
|
188
|
-
}
|
|
179
|
+
};
|
|
189
180
|
if (params.roomInfo && params.roomRules) {
|
|
190
181
|
load(params.roomInfo, params.roomRules);
|
|
191
182
|
}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import RulerItems from './RulerItems';
|
|
11
2
|
export default class Controller {
|
|
12
3
|
constructor(five, params) {
|
|
@@ -59,22 +50,20 @@ export default class Controller {
|
|
|
59
50
|
if ((_a = params.options) === null || _a === void 0 ? void 0 : _a.className)
|
|
60
51
|
this.container.classList.add((_b = params.options) === null || _b === void 0 ? void 0 : _b.className);
|
|
61
52
|
}
|
|
62
|
-
this.five.once('modelLoaded', () =>
|
|
63
|
-
var
|
|
64
|
-
(
|
|
65
|
-
})
|
|
53
|
+
this.five.once('modelLoaded', async () => {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
(_b = (_a = this.five.getElement()) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.append(this.container);
|
|
56
|
+
});
|
|
66
57
|
this.five.once('dispose', () => this.dispose());
|
|
67
58
|
}
|
|
68
|
-
load(serverData) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this.state.loaded = true;
|
|
77
|
-
});
|
|
59
|
+
async load(serverData) {
|
|
60
|
+
if (!this.five.work)
|
|
61
|
+
return;
|
|
62
|
+
const data = serverData.data;
|
|
63
|
+
if (!data)
|
|
64
|
+
throw new Error('标尺数据依赖不齐全!');
|
|
65
|
+
this.panoRulerProData = data;
|
|
66
|
+
this.state.loaded = true;
|
|
78
67
|
}
|
|
79
68
|
enable() {
|
|
80
69
|
if (!this.state.loaded)
|
|
@@ -92,26 +81,24 @@ export default class Controller {
|
|
|
92
81
|
this.render();
|
|
93
82
|
return true;
|
|
94
83
|
}
|
|
95
|
-
render() {
|
|
84
|
+
async render() {
|
|
96
85
|
var _a;
|
|
97
|
-
|
|
98
|
-
if (this.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
});
|
|
86
|
+
if (this.state.enabled) {
|
|
87
|
+
if (!this.panoRulerProData || !this.container)
|
|
88
|
+
return;
|
|
89
|
+
this.rulerItems = new RulerItems({
|
|
90
|
+
target: this.container,
|
|
91
|
+
props: {
|
|
92
|
+
five: this.five,
|
|
93
|
+
rulerDatas: this.panoRulerProData,
|
|
94
|
+
options: this.state.options,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
(_a = this.rulerItems) === null || _a === void 0 ? void 0 : _a.$destroy();
|
|
100
|
+
this.rulerItems = undefined;
|
|
101
|
+
}
|
|
115
102
|
}
|
|
116
103
|
dispose() {
|
|
117
104
|
if (this.container) {
|