@realsee/dnalogel 2.0.0-alpha.13 → 2.0.0-alpha.14
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/CHANGELOG.md +49 -0
- package/README.md +78 -28
- package/dist/ModelItemLabelPlugin/index.js +16 -4
- package/dist/ModelItemLabelPlugin/typings.d.ts +1 -0
- package/dist/ModelTVVideoPlugin/index.d.ts +4 -0
- package/dist/ModelTVVideoPlugin/index.js +326 -0
- package/dist/ModelTVVideoPlugin/typings.d.ts +25 -0
- package/dist/ModelTVVideoPlugin/utils/parseData.d.ts +2 -0
- package/dist/PanoMeasurePlugin/index.js +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +292 -7
- package/dist/index.js +292 -6
- package/dist/index.umd.js +292 -6
- package/docs/assets/main.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/ModelRoomLabelController.html +6 -6
- package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
- package/docs/enums/ModelFloorplanErrorType.html +1 -1
- package/docs/index.html +78 -33
- 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/ModelFloorplanParameterType.html +1 -1
- package/docs/interfaces/ModelFloorplanViewEvent.html +2 -2
- package/docs/interfaces/ModelItemLabelPluginData.html +1 -0
- package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -0
- package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -0
- package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
- package/docs/interfaces/ModelTVVideoPluginData.html +1 -0
- package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -0
- package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -0
- package/docs/interfaces/PanoCompassPluginData.html +1 -1
- package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
- package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
- package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
- package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
- package/docs/interfaces/PointJson.html +1 -1
- package/docs/interfaces/RoomLabel.html +7 -7
- package/docs/interfaces/TopviewFloorplanPluginParameterType.html +1 -1
- package/docs/modules.html +12 -12
- package/libs/ModelItemLabelPlugin/index.js +16 -4
- package/libs/ModelItemLabelPlugin/typings.d.ts +1 -0
- package/libs/ModelTVVideoPlugin/index.d.ts +4 -0
- package/libs/ModelTVVideoPlugin/index.js +263 -0
- package/libs/ModelTVVideoPlugin/typings.d.ts +25 -0
- package/libs/ModelTVVideoPlugin/typings.js +7 -0
- package/libs/ModelTVVideoPlugin/utils/parseData.d.ts +2 -0
- package/libs/ModelTVVideoPlugin/utils/parseData.js +13 -0
- package/libs/index.d.ts +3 -0
- package/libs/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10660,10 +10660,10 @@ if (typeof undefined$1 === 'function' && undefined$1.amd) {
|
|
|
10660
10660
|
|
|
10661
10661
|
var Hammer = hammer.exports;
|
|
10662
10662
|
|
|
10663
|
-
var Hammer$1 = /*#__PURE__*/_mergeNamespaces({
|
|
10663
|
+
var Hammer$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/_mergeNamespaces({
|
|
10664
10664
|
__proto__: null,
|
|
10665
10665
|
'default': Hammer
|
|
10666
|
-
}, [hammer.exports]);
|
|
10666
|
+
}, [hammer.exports]));
|
|
10667
10667
|
|
|
10668
10668
|
// uuid
|
|
10669
10669
|
function S4() {
|
|
@@ -14762,7 +14762,8 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
14762
14762
|
app: undefined,
|
|
14763
14763
|
hooks: new five.Subscribe(),
|
|
14764
14764
|
modelOcclusionEnable: (_a = params === null || params === void 0 ? void 0 : params.modelOcclusionEnable) !== null && _a !== void 0 ? _a : true,
|
|
14765
|
-
displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : DISPLAY_STRATEGY_TYPE.SMALL
|
|
14765
|
+
displayStrategyType: (_b = params === null || params === void 0 ? void 0 : params.displayStrategyType) !== null && _b !== void 0 ? _b : DISPLAY_STRATEGY_TYPE.SMALL,
|
|
14766
|
+
pending: false
|
|
14766
14767
|
};
|
|
14767
14768
|
pluginState.container.setAttribute('class', 'model-item-label-plugin-container');
|
|
14768
14769
|
pluginState.container.style.cssText = `
|
|
@@ -14771,8 +14772,8 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
14771
14772
|
top: 0;
|
|
14772
14773
|
width: 100%;
|
|
14773
14774
|
height: 100%;
|
|
14774
|
-
pointerEvents: none;
|
|
14775
14775
|
`;
|
|
14776
|
+
pluginState.container.style.pointerEvents = 'none'; // 写到 cssText 里不生效
|
|
14776
14777
|
const appendTo = (wrapper) => {
|
|
14777
14778
|
pluginState.wrapper = wrapper;
|
|
14778
14779
|
wrapper.appendChild(pluginState.container);
|
|
@@ -14780,7 +14781,6 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
14780
14781
|
return true;
|
|
14781
14782
|
};
|
|
14782
14783
|
const load = (data) => {
|
|
14783
|
-
console.log('🐶--当前标签总条数: ', data.model_item_labels.length);
|
|
14784
14784
|
pluginState.itemLabels = parseModelItemLabelPluginData(data);
|
|
14785
14785
|
render();
|
|
14786
14786
|
};
|
|
@@ -14803,23 +14803,30 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
14803
14803
|
pluginState.container.remove();
|
|
14804
14804
|
};
|
|
14805
14805
|
const handleRerender = () => {
|
|
14806
|
-
if (!pluginState.enabled || !pluginState.fiveModeEnabled)
|
|
14806
|
+
if (!pluginState.enabled || !pluginState.fiveModeEnabled || pluginState.pending)
|
|
14807
14807
|
return;
|
|
14808
|
+
pluginState.pending = true;
|
|
14808
14809
|
disable();
|
|
14809
14810
|
};
|
|
14810
14811
|
const rerender = (a, b, c) => {
|
|
14812
|
+
if (!pluginState.pending)
|
|
14813
|
+
return;
|
|
14811
14814
|
if (!pluginState.fiveModeEnabled)
|
|
14812
14815
|
return;
|
|
14813
14816
|
if (!c)
|
|
14814
14817
|
return;
|
|
14818
|
+
pluginState.pending = false;
|
|
14815
14819
|
enable();
|
|
14816
14820
|
render();
|
|
14817
14821
|
};
|
|
14818
14822
|
const handleInteriaPanRerender = (a, b) => {
|
|
14823
|
+
if (!pluginState.pending)
|
|
14824
|
+
return;
|
|
14819
14825
|
if (!pluginState.fiveModeEnabled)
|
|
14820
14826
|
return;
|
|
14821
14827
|
if (!b)
|
|
14822
14828
|
return;
|
|
14829
|
+
pluginState.pending = false;
|
|
14823
14830
|
enable();
|
|
14824
14831
|
render();
|
|
14825
14832
|
};
|
|
@@ -14829,10 +14836,13 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
14829
14836
|
}
|
|
14830
14837
|
};
|
|
14831
14838
|
const handlePanGesture = (pose, final) => {
|
|
14839
|
+
if (!pluginState.pending)
|
|
14840
|
+
return;
|
|
14832
14841
|
if (!pluginState.fiveModeEnabled)
|
|
14833
14842
|
return;
|
|
14834
14843
|
if (!final)
|
|
14835
14844
|
return;
|
|
14845
|
+
pluginState.pending = false;
|
|
14836
14846
|
enable();
|
|
14837
14847
|
render();
|
|
14838
14848
|
};
|
|
@@ -14897,6 +14907,8 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
14897
14907
|
five$1.off('pinchGesture', rerender);
|
|
14898
14908
|
};
|
|
14899
14909
|
const onFiveModeChange = (mode) => {
|
|
14910
|
+
if (!pluginState.enabled || pluginState.pending)
|
|
14911
|
+
return;
|
|
14900
14912
|
if (mode !== five.Five.Mode.Floorplan) {
|
|
14901
14913
|
pluginState.fiveModeEnabled = false;
|
|
14902
14914
|
render();
|
|
@@ -14918,6 +14930,279 @@ const ModelItemLabelPlugin = (five$1, params) => {
|
|
|
14918
14930
|
};
|
|
14919
14931
|
};
|
|
14920
14932
|
|
|
14933
|
+
var DIRECTION;
|
|
14934
|
+
(function (DIRECTION) {
|
|
14935
|
+
DIRECTION["TOP_LEFT"] = "topLeft";
|
|
14936
|
+
DIRECTION["TOP_RIGHT"] = "topRight";
|
|
14937
|
+
DIRECTION["BOTTOM_LEFT"] = "bottomLeft";
|
|
14938
|
+
DIRECTION["BOTTOM_RIGHT"] = "bottomRight";
|
|
14939
|
+
})(DIRECTION || (DIRECTION = {}));
|
|
14940
|
+
|
|
14941
|
+
function parseModelTVVideoPoints(points) {
|
|
14942
|
+
if (points.length === 0)
|
|
14943
|
+
return [];
|
|
14944
|
+
if (Array.isArray(points[0]))
|
|
14945
|
+
return points;
|
|
14946
|
+
let newPoints = [];
|
|
14947
|
+
points.map(point => {
|
|
14948
|
+
const newPoint = [point[DIRECTION.TOP_LEFT], point[DIRECTION.BOTTOM_LEFT], point[DIRECTION.BOTTOM_RIGHT], point[DIRECTION.TOP_RIGHT]];
|
|
14949
|
+
newPoints.push(newPoint);
|
|
14950
|
+
});
|
|
14951
|
+
return newPoints;
|
|
14952
|
+
}
|
|
14953
|
+
|
|
14954
|
+
const ModelTVVideoPlugin = (five, { videoElement }) => {
|
|
14955
|
+
const state = {
|
|
14956
|
+
videoMeshes: [],
|
|
14957
|
+
videoTextureEnabled: false,
|
|
14958
|
+
videoSource: '',
|
|
14959
|
+
rectPoints: [],
|
|
14960
|
+
enabled: false,
|
|
14961
|
+
videoElement: videoElement,
|
|
14962
|
+
};
|
|
14963
|
+
const setMuted = (muted) => {
|
|
14964
|
+
if (state.videoTexture) {
|
|
14965
|
+
state.videoTexture.image.muted = muted;
|
|
14966
|
+
state.videoTexture.image.play();
|
|
14967
|
+
}
|
|
14968
|
+
};
|
|
14969
|
+
const getMuted = () => {
|
|
14970
|
+
if (state.videoTexture)
|
|
14971
|
+
return state.videoTexture.image.muted;
|
|
14972
|
+
else
|
|
14973
|
+
return true;
|
|
14974
|
+
};
|
|
14975
|
+
const enable = () => {
|
|
14976
|
+
if (state.enabled)
|
|
14977
|
+
return;
|
|
14978
|
+
if (!state.videoTexture)
|
|
14979
|
+
return;
|
|
14980
|
+
state.enabled = true;
|
|
14981
|
+
state.videoMeshes = createPanoVideoMeshes();
|
|
14982
|
+
console.log('state.videoMeshes', state.videoMeshes);
|
|
14983
|
+
state.videoMeshes.forEach((mesh) => five.scene.add(mesh));
|
|
14984
|
+
const play = () => {
|
|
14985
|
+
console.log('play', state.videoTexture);
|
|
14986
|
+
if (!state.videoTexture)
|
|
14987
|
+
return;
|
|
14988
|
+
const timeupdate = () => {
|
|
14989
|
+
var _a;
|
|
14990
|
+
if (!state.videoTexture)
|
|
14991
|
+
return;
|
|
14992
|
+
(_a = state.videoTexture) === null || _a === void 0 ? void 0 : _a.image.removeEventListener('timeupdate', timeupdate);
|
|
14993
|
+
state.videoTextureEnabled = true;
|
|
14994
|
+
state.videoMeshes.forEach((mesh) => {
|
|
14995
|
+
if (mesh.material.map !== state.videoTexture)
|
|
14996
|
+
mesh.material.map = state.videoTexture;
|
|
14997
|
+
});
|
|
14998
|
+
five.needsRender = true;
|
|
14999
|
+
};
|
|
15000
|
+
state.videoTexture.image.addEventListener('timeupdate', timeupdate);
|
|
15001
|
+
if (state.videoTexture && state.videoMeshes.length) {
|
|
15002
|
+
state.videoTexture.image.play();
|
|
15003
|
+
}
|
|
15004
|
+
};
|
|
15005
|
+
if (five.model.loaded)
|
|
15006
|
+
play();
|
|
15007
|
+
else {
|
|
15008
|
+
return five.once('modelLoaded', () => play());
|
|
15009
|
+
}
|
|
15010
|
+
};
|
|
15011
|
+
const disable = () => {
|
|
15012
|
+
if (!state.enabled)
|
|
15013
|
+
return;
|
|
15014
|
+
state.enabled = false;
|
|
15015
|
+
state.videoMeshes.forEach((mesh) => {
|
|
15016
|
+
mesh.geometry.dispose();
|
|
15017
|
+
mesh.material.dispose();
|
|
15018
|
+
five.scene.remove(mesh);
|
|
15019
|
+
if (state.videoTexture)
|
|
15020
|
+
state.videoTexture.image.pause();
|
|
15021
|
+
});
|
|
15022
|
+
state.videoMeshes = [];
|
|
15023
|
+
five.needsRender = true;
|
|
15024
|
+
};
|
|
15025
|
+
const createPanoVideoMeshes = () => {
|
|
15026
|
+
return state.rectPoints.map((points, index) => {
|
|
15027
|
+
const geometry = new THREE__namespace.BufferGeometry();
|
|
15028
|
+
const segments = 128;
|
|
15029
|
+
const verticesArray = [];
|
|
15030
|
+
verticesArray.push(points[0].x, points[0].y, points[0].z);
|
|
15031
|
+
for (let i = 1; i < segments; i++) {
|
|
15032
|
+
verticesArray.push(points[0].x + ((points[1].x - points[0].x) * i) / segments, points[0].y + ((points[1].y - points[0].y) * i) / segments, points[0].z + ((points[1].z - points[0].z) * i) / segments);
|
|
15033
|
+
}
|
|
15034
|
+
verticesArray.push(points[1].x, points[1].y, points[1].z);
|
|
15035
|
+
verticesArray.push(points[2].x, points[2].y, points[2].z);
|
|
15036
|
+
for (let i = 1; i < segments; i++) {
|
|
15037
|
+
verticesArray.push(points[2].x + ((points[3].x - points[2].x) * i) / segments, points[2].y + ((points[3].y - points[2].y) * i) / segments, points[2].z + ((points[3].z - points[2].z) * i) / segments);
|
|
15038
|
+
}
|
|
15039
|
+
verticesArray.push(points[3].x, points[3].y, points[3].z);
|
|
15040
|
+
const uvArray = [];
|
|
15041
|
+
uvArray.push(0, 1);
|
|
15042
|
+
for (let i = 1; i < segments; i++) {
|
|
15043
|
+
uvArray.push(0, 1 - i / segments);
|
|
15044
|
+
}
|
|
15045
|
+
uvArray.push(0, 0);
|
|
15046
|
+
uvArray.push(1, 0);
|
|
15047
|
+
for (let i = 1; i < segments; i++) {
|
|
15048
|
+
uvArray.push(1, i / segments);
|
|
15049
|
+
}
|
|
15050
|
+
uvArray.push(1, 1);
|
|
15051
|
+
const indicesArray = [];
|
|
15052
|
+
for (let i = 0; i < segments; i++) {
|
|
15053
|
+
indicesArray.push(i, i + 1, segments * 2 - i, i, segments * 2 - i, segments * 2 + 1 - i);
|
|
15054
|
+
}
|
|
15055
|
+
geometry.setAttribute('position', new THREE__namespace.BufferAttribute(new Float32Array(verticesArray), 3));
|
|
15056
|
+
geometry.setAttribute('uv', new THREE__namespace.BufferAttribute(new Float32Array(uvArray), 2));
|
|
15057
|
+
geometry.setIndex(new THREE__namespace.BufferAttribute(new Uint32Array(indicesArray), 1));
|
|
15058
|
+
const material = new THREE__namespace.MeshBasicMaterial({
|
|
15059
|
+
map: state.videoTextureEnabled ? state.videoTexture : state.imageTexture,
|
|
15060
|
+
side: THREE__namespace.DoubleSide,
|
|
15061
|
+
});
|
|
15062
|
+
const mesh = new THREE__namespace.Mesh(geometry, material);
|
|
15063
|
+
mesh.renderOrder = 1;
|
|
15064
|
+
mesh.name = `ModelTVVideoPlugin-${index}-${performance.now()}`;
|
|
15065
|
+
return mesh;
|
|
15066
|
+
});
|
|
15067
|
+
};
|
|
15068
|
+
const getImageTexture = (source) => {
|
|
15069
|
+
const texture = new THREE__namespace.TextureLoader().load(source);
|
|
15070
|
+
texture.minFilter = THREE__namespace.LinearFilter;
|
|
15071
|
+
texture.magFilter = THREE__namespace.LinearFilter;
|
|
15072
|
+
texture.format = THREE__namespace.RGBFormat;
|
|
15073
|
+
return texture;
|
|
15074
|
+
};
|
|
15075
|
+
const getVideoTexture = (source, video) => {
|
|
15076
|
+
return new Promise((resolve, reject) => {
|
|
15077
|
+
const xhr = new XMLHttpRequest();
|
|
15078
|
+
xhr.onreadystatechange = () => {
|
|
15079
|
+
if (xhr.readyState == 4) {
|
|
15080
|
+
if (xhr.status == 200) {
|
|
15081
|
+
const url = window.URL || window.webkitURL;
|
|
15082
|
+
video = video || document.createElement('video');
|
|
15083
|
+
video.crossOrigin = 'anonymous';
|
|
15084
|
+
video.autoplay = true;
|
|
15085
|
+
video.muted = true;
|
|
15086
|
+
video.loop = true;
|
|
15087
|
+
video.playsInline = true;
|
|
15088
|
+
video.src = url.createObjectURL(xhr.response);
|
|
15089
|
+
const texture = new THREE__namespace.VideoTexture(video);
|
|
15090
|
+
texture.minFilter = THREE__namespace.LinearFilter;
|
|
15091
|
+
texture.magFilter = THREE__namespace.LinearFilter;
|
|
15092
|
+
texture.format = THREE__namespace.RGBFormat;
|
|
15093
|
+
resolve(Object.assign(texture, { videoSource: source }));
|
|
15094
|
+
}
|
|
15095
|
+
else {
|
|
15096
|
+
reject(new Error('Video download Error: ' + xhr.status));
|
|
15097
|
+
}
|
|
15098
|
+
}
|
|
15099
|
+
};
|
|
15100
|
+
xhr.onerror = (error) => reject(error);
|
|
15101
|
+
xhr.open('GET', source);
|
|
15102
|
+
xhr.responseType = 'blob';
|
|
15103
|
+
xhr.send();
|
|
15104
|
+
});
|
|
15105
|
+
};
|
|
15106
|
+
const load = (data, videoElement) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15107
|
+
const { video_src, video_poster_src, points } = data;
|
|
15108
|
+
state.videoSource = video_src;
|
|
15109
|
+
// TODO 存疑,先处理多一次遍历 o(2n)
|
|
15110
|
+
state.rectPoints = parseModelTVVideoPoints(points)
|
|
15111
|
+
.map((items) => items.map(({ x, y, z }) => new THREE__namespace.Vector3(x, y, z)));
|
|
15112
|
+
state.imageTexture = getImageTexture(video_poster_src);
|
|
15113
|
+
if (videoElement) {
|
|
15114
|
+
state.videoElement = videoElement;
|
|
15115
|
+
}
|
|
15116
|
+
state.videoTexture = yield getVideoTexture(state.videoSource, state.videoElement);
|
|
15117
|
+
state.enabled = !!data.enable;
|
|
15118
|
+
if (state.enabled)
|
|
15119
|
+
enable();
|
|
15120
|
+
});
|
|
15121
|
+
const dispose = () => {
|
|
15122
|
+
disable();
|
|
15123
|
+
state.videoTexture = undefined;
|
|
15124
|
+
five.off('modeChange', () => setMuted(true));
|
|
15125
|
+
five.off('wantsTapGesture', (raycaster) => {
|
|
15126
|
+
if (!state.enabled)
|
|
15127
|
+
return;
|
|
15128
|
+
const [intersect] = raycaster.intersectObjects(five.scene.children, true);
|
|
15129
|
+
if (!!intersect && /^video/.test(intersect.object.name)) {
|
|
15130
|
+
if (state.videoTexture)
|
|
15131
|
+
setMuted(!state.videoTexture.image.muted);
|
|
15132
|
+
return false;
|
|
15133
|
+
}
|
|
15134
|
+
});
|
|
15135
|
+
five.off('panoArrived', () => {
|
|
15136
|
+
if (!state.enabled)
|
|
15137
|
+
return;
|
|
15138
|
+
if (getMuted())
|
|
15139
|
+
return;
|
|
15140
|
+
const cameraPosition = five.camera.position;
|
|
15141
|
+
const visible = state.rectPoints.find((points) => {
|
|
15142
|
+
const centerVector = points.reduce((total, curr) => new THREE__namespace.Vector3(total.x + curr.x / points.length, total.y + curr.y / points.length, total.z + curr.z / points.length), new THREE__namespace.Vector3());
|
|
15143
|
+
return (points.map((point) => new THREE__namespace.Vector3((point.x + centerVector.x) / 2, (point.y + centerVector.y) / 2, (point.z + centerVector.z) / 2)).filter((vector) => {
|
|
15144
|
+
vector = vector.clone().sub(cameraPosition).normalize();
|
|
15145
|
+
const raycaster = new THREE__namespace.Raycaster(cameraPosition, vector);
|
|
15146
|
+
const [intersect] = raycaster.intersectObjects(five.scene.children, true);
|
|
15147
|
+
return !!intersect && /^video/.test(intersect.object.name);
|
|
15148
|
+
}).length >= 2);
|
|
15149
|
+
});
|
|
15150
|
+
if (!visible)
|
|
15151
|
+
setMuted(true);
|
|
15152
|
+
});
|
|
15153
|
+
five.off('renderFrame', () => {
|
|
15154
|
+
// console.log('renderFrame', state.videoMeshes)
|
|
15155
|
+
state.videoMeshes.forEach((meshes) => {
|
|
15156
|
+
if (meshes)
|
|
15157
|
+
//@ts-ignore
|
|
15158
|
+
meshes.needsRender = true;
|
|
15159
|
+
});
|
|
15160
|
+
});
|
|
15161
|
+
};
|
|
15162
|
+
five.on('modeChange', () => setMuted(true));
|
|
15163
|
+
five.on('wantsTapGesture', (raycaster) => {
|
|
15164
|
+
if (!state.enabled)
|
|
15165
|
+
return;
|
|
15166
|
+
const targetMesh = five.scene.children.find(item => /^ModelTVVideoPlugin/.test(item.name));
|
|
15167
|
+
if (!targetMesh)
|
|
15168
|
+
return;
|
|
15169
|
+
const intersectObjects = raycaster.intersectObjects([targetMesh]);
|
|
15170
|
+
if (intersectObjects.length === 0)
|
|
15171
|
+
return;
|
|
15172
|
+
if (state.videoTexture)
|
|
15173
|
+
setMuted(!state.videoTexture.image.muted); // TODO toggle video play
|
|
15174
|
+
return false;
|
|
15175
|
+
});
|
|
15176
|
+
five.on('panoArrived', () => {
|
|
15177
|
+
if (!state.enabled)
|
|
15178
|
+
return;
|
|
15179
|
+
if (getMuted())
|
|
15180
|
+
return;
|
|
15181
|
+
const cameraPosition = five.camera.position;
|
|
15182
|
+
const visible = state.rectPoints.find((points) => {
|
|
15183
|
+
const centerVector = points.reduce((total, curr) => new THREE__namespace.Vector3(total.x + curr.x / points.length, total.y + curr.y / points.length, total.z + curr.z / points.length), new THREE__namespace.Vector3());
|
|
15184
|
+
return (points.map((point) => new THREE__namespace.Vector3((point.x + centerVector.x) / 2, (point.y + centerVector.y) / 2, (point.z + centerVector.z) / 2)).filter((vector) => {
|
|
15185
|
+
vector = vector.clone().sub(cameraPosition).normalize();
|
|
15186
|
+
const raycaster = new THREE__namespace.Raycaster(cameraPosition, vector);
|
|
15187
|
+
const [intersect] = raycaster.intersectObjects(five.scene.children, true);
|
|
15188
|
+
return !!intersect && /^video/.test(intersect.object.name);
|
|
15189
|
+
}).length >= 2);
|
|
15190
|
+
});
|
|
15191
|
+
if (!visible)
|
|
15192
|
+
setMuted(true);
|
|
15193
|
+
});
|
|
15194
|
+
five.on('renderFrame', () => {
|
|
15195
|
+
// console.log('renderFrame', state.videoMeshes)
|
|
15196
|
+
state.videoMeshes.forEach((meshes) => {
|
|
15197
|
+
if (meshes)
|
|
15198
|
+
//@ts-ignore
|
|
15199
|
+
meshes.needsRender = true;
|
|
15200
|
+
});
|
|
15201
|
+
});
|
|
15202
|
+
Object.assign(window, { $state: state });
|
|
15203
|
+
return { enable, disable, load, dispose };
|
|
15204
|
+
};
|
|
15205
|
+
|
|
14921
15206
|
exports.CSS3DRenderPlugin = CSS3DRenderPlugin;
|
|
14922
15207
|
exports.CameraMovementPlugin = CameraMovementPlugin;
|
|
14923
15208
|
exports.ModelChassisCompassPlugin = ModelChassisCompassPlugin;
|
|
@@ -14925,6 +15210,7 @@ exports.ModelEntryDoorGuidePlugin = ModelEntryDoorGuidePlugin;
|
|
|
14925
15210
|
exports.ModelFloorplanPlugin = ModelFloorplanPlugin;
|
|
14926
15211
|
exports.ModelItemLabelPlugin = ModelItemLabelPlugin;
|
|
14927
15212
|
exports.ModelRoomLabelPlugin = ModelRoomLabelPlugin;
|
|
15213
|
+
exports.ModelTVVideoPlugin = ModelTVVideoPlugin;
|
|
14928
15214
|
exports.ModelViewPlugin = ModelViewPlugin;
|
|
14929
15215
|
exports.PanoCompassPlugin = PanoCompassPlugin;
|
|
14930
15216
|
exports.PanoCursorRaycasterPlugin = PanoCursorRaycasterPlugin;
|