@realsee/dnalogel 2.0.5-alpha.4 → 2.0.5-alpha.6
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/index.cjs.js +14 -14
- package/dist/index.es.js +1044 -1042
- package/dist/index.js +1044 -1042
- package/dist/index.umd.js +15 -15
- package/docs/classes/CruisePluginController.html +14 -14
- package/docs/classes/Magnifier.html +4 -4
- package/docs/classes/ModelRoomLabelController.html +4 -4
- package/docs/classes/PaintBrush.html +3 -3
- 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/PaintBrushTypeEnum.html +1 -1
- package/docs/enums/Rotation.html +2 -2
- package/docs/index.html +1 -1
- package/docs/interfaces/CSS3DRenderPluginEventMap.html +2 -2
- package/docs/interfaces/CSS3DRenderPluginState.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/FloorplanServerDoorItem.html +1 -1
- package/docs/interfaces/FloorplanServerDoorPosition.html +1 -1
- 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/PaintBrushAction.html +7 -7
- package/docs/interfaces/PaintBrushConfigs.html +1 -1
- package/docs/interfaces/PaintBrushState.html +1 -1
- package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
- package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
- package/docs/interfaces/PanoMeasureParameterType.html +2 -2
- 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 +17 -17
- package/libs/ModelTVVideoPlugin/Plugin.js +84 -82
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { parseModelTVVideoPoints as
|
|
3
|
-
import { CSS3DRenderPlugin as
|
|
1
|
+
import * as c from "three";
|
|
2
|
+
import { parseModelTVVideoPoints as z } from "./utils/parseData.js";
|
|
3
|
+
import { CSS3DRenderPlugin as O } from "../CSS3DRenderPlugin/index.js";
|
|
4
4
|
import "./typings.js";
|
|
5
5
|
import "../CSS3DRenderPlugin/Controller.js";
|
|
6
6
|
import "../CSS3DRenderPlugin/CSS3DRender.js";
|
|
@@ -10,30 +10,32 @@ import "../CSS3DRenderPlugin/utils/evenNumber.js";
|
|
|
10
10
|
import "../CSS3DRenderPlugin/utils/positionToVector3.js";
|
|
11
11
|
import "../CSS3DRenderPlugin/utils/CSS3DObjectPlus.js";
|
|
12
12
|
import "../CSS3DRenderPlugin/utils/centerPoint.js";
|
|
13
|
-
const
|
|
13
|
+
const W = (d, { videoElement: M }) => {
|
|
14
14
|
const t = {
|
|
15
15
|
videoMeshes: [],
|
|
16
16
|
videoTextureEnabled: !1,
|
|
17
17
|
videoSource: "",
|
|
18
18
|
rectPoints: [],
|
|
19
19
|
enabled: !1,
|
|
20
|
-
videoElement:
|
|
21
|
-
}, f =
|
|
20
|
+
videoElement: M
|
|
21
|
+
}, f = O(d), p = /* @__PURE__ */ new Map(), A = (e) => {
|
|
22
22
|
t.videoTexture && (t.videoTexture.image.muted = e);
|
|
23
|
-
},
|
|
23
|
+
}, R = () => t.videoTexture ? t.videoTexture.image.muted : !0, x = () => {
|
|
24
24
|
if (t.enabled || !t.videoTexture)
|
|
25
25
|
return;
|
|
26
|
-
t.enabled = !0, t.videoMeshes =
|
|
26
|
+
t.enabled = !0, t.videoMeshes = F(), t.videoMeshes.forEach((r) => d.scene.add(r)), p.forEach((r) => {
|
|
27
|
+
r.enable();
|
|
28
|
+
});
|
|
27
29
|
const e = () => {
|
|
28
30
|
if (!t.videoTexture)
|
|
29
31
|
return;
|
|
30
|
-
const
|
|
32
|
+
const r = () => {
|
|
31
33
|
var s;
|
|
32
|
-
!t.videoTexture || ((s = t.videoTexture) == null || s.image.removeEventListener("timeupdate",
|
|
34
|
+
!t.videoTexture || ((s = t.videoTexture) == null || s.image.removeEventListener("timeupdate", r), t.videoTextureEnabled = !0, t.videoMeshes.forEach((n) => {
|
|
33
35
|
n.material.map !== t.videoTexture && (n.material.map = t.videoTexture);
|
|
34
|
-
}),
|
|
36
|
+
}), d.needsRender = !0);
|
|
35
37
|
};
|
|
36
|
-
t.videoTexture.image.addEventListener("timeupdate",
|
|
38
|
+
t.videoTexture.image.addEventListener("timeupdate", r), t.videoTexture && t.videoMeshes.length && (t.videoTexture.image.play(), t.videoTexture.image.onplay = () => {
|
|
37
39
|
f.hide();
|
|
38
40
|
}, t.videoTexture.image.onpause = () => {
|
|
39
41
|
f.show();
|
|
@@ -41,118 +43,118 @@ const q = (i, { videoElement: E }) => {
|
|
|
41
43
|
t.videoTexture.image.muted = !1, t.videoTexture.image.play();
|
|
42
44
|
});
|
|
43
45
|
};
|
|
44
|
-
if (
|
|
46
|
+
if (d.model.loaded)
|
|
45
47
|
e();
|
|
46
48
|
else
|
|
47
|
-
return
|
|
49
|
+
return d.once("modelLoaded", () => e());
|
|
48
50
|
b();
|
|
49
51
|
}, T = () => {
|
|
50
52
|
!t.enabled || (t.enabled = !1, t.videoMeshes.forEach((e) => {
|
|
51
|
-
e.geometry.dispose(), e.material.dispose(),
|
|
52
|
-
}),
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
e.geometry.dispose(), e.material.dispose(), d.scene.remove(e), t.videoTexture && t.videoTexture.image.pause();
|
|
54
|
+
}), p.forEach((e) => {
|
|
55
|
+
e.disable();
|
|
56
|
+
}), t.videoMeshes = [], d.needsRender = !0);
|
|
57
|
+
}, F = () => t.rectPoints.map((e, r) => {
|
|
58
|
+
const s = new c.BufferGeometry(), n = 128, a = [];
|
|
55
59
|
a.push(...e[0].toArray());
|
|
56
|
-
for (let
|
|
60
|
+
for (let o = 1; o < n; o++)
|
|
57
61
|
a.push(
|
|
58
|
-
e[0].x + (e[1].x - e[0].x) *
|
|
59
|
-
e[0].y + (e[1].y - e[0].y) *
|
|
60
|
-
e[0].z + (e[1].z - e[0].z) *
|
|
62
|
+
e[0].x + (e[1].x - e[0].x) * o / n,
|
|
63
|
+
e[0].y + (e[1].y - e[0].y) * o / n,
|
|
64
|
+
e[0].z + (e[1].z - e[0].z) * o / n
|
|
61
65
|
);
|
|
62
66
|
a.push(...e[1].toArray()), a.push(...e[2].toArray());
|
|
63
|
-
for (let
|
|
67
|
+
for (let o = 1; o < n; o++)
|
|
64
68
|
a.push(
|
|
65
|
-
e[2].x + (e[3].x - e[2].x) *
|
|
66
|
-
e[2].y + (e[3].y - e[2].y) *
|
|
67
|
-
e[2].z + (e[3].z - e[2].z) *
|
|
69
|
+
e[2].x + (e[3].x - e[2].x) * o / n,
|
|
70
|
+
e[2].y + (e[3].y - e[2].y) * o / n,
|
|
71
|
+
e[2].z + (e[3].z - e[2].z) * o / n
|
|
68
72
|
);
|
|
69
73
|
a.push(...e[3].toArray());
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
for (let
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
for (let
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
const i = [];
|
|
75
|
+
i.push(0, 1);
|
|
76
|
+
for (let o = 1; o < n; o++)
|
|
77
|
+
i.push(0, 1 - o / n);
|
|
78
|
+
i.push(0, 0), i.push(1, 0);
|
|
79
|
+
for (let o = 1; o < n; o++)
|
|
80
|
+
i.push(1, o / n);
|
|
81
|
+
i.push(1, 1);
|
|
78
82
|
const u = [];
|
|
79
|
-
for (let
|
|
80
|
-
u.push(
|
|
81
|
-
s.setAttribute("position", new
|
|
82
|
-
const m = new
|
|
83
|
+
for (let o = 0; o < n; o++)
|
|
84
|
+
u.push(o, o + 1, n * 2 - o, o, n * 2 - o, n * 2 + 1 - o);
|
|
85
|
+
s.setAttribute("position", new c.BufferAttribute(new Float32Array(a), 3)), s.setAttribute("uv", new c.BufferAttribute(new Float32Array(i), 2)), s.setIndex(new c.BufferAttribute(new Uint32Array(u), 1));
|
|
86
|
+
const m = new c.MeshBasicMaterial({
|
|
83
87
|
map: t.videoTextureEnabled ? t.videoTexture : t.imageTexture,
|
|
84
|
-
side:
|
|
85
|
-
}), l = new
|
|
86
|
-
l.renderOrder = 1, l.name = `ModelTVVideoPlugin-${
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
88
|
+
side: c.DoubleSide
|
|
89
|
+
}), l = new c.Mesh(s, m);
|
|
90
|
+
l.renderOrder = 1, l.name = `ModelTVVideoPlugin-${r}-${performance.now()}`;
|
|
91
|
+
const I = [e[1], e[2], e[3], e[0]], h = f.create3DDomContainer(I);
|
|
92
|
+
if (h != null && h.container) {
|
|
93
|
+
const o = document.createElement("div");
|
|
94
|
+
o.classList.add("play-icon"), o.style.width = "100%", o.style.height = "100%", o.style.display = "flex", o.style.justifyContent = "center", o.style.alignItems = "center", o.style.pointerEvents = "none", h.container.appendChild(o);
|
|
95
|
+
const y = document.createElement("img");
|
|
96
|
+
y.src = "//vrlab-static.ljcdn.com/release/web/play.2ada5b6f.png", y.style.width = "200px", y.style.pointerEvents = "auto", y.onclick = () => {
|
|
93
97
|
t.videoTexture.image.muted = !1, t.videoTexture.image.play();
|
|
94
|
-
},
|
|
98
|
+
}, o.appendChild(y), p.set(l, h);
|
|
95
99
|
}
|
|
96
100
|
return l;
|
|
97
|
-
}),
|
|
98
|
-
const
|
|
99
|
-
return
|
|
100
|
-
},
|
|
101
|
+
}), P = (e) => {
|
|
102
|
+
const r = new c.TextureLoader().load(e);
|
|
103
|
+
return r.minFilter = c.LinearFilter, r.magFilter = c.LinearFilter, r.format = c.RGBFormat, r;
|
|
104
|
+
}, L = (e, r) => new Promise((s, n) => {
|
|
101
105
|
const a = new XMLHttpRequest();
|
|
102
106
|
a.onreadystatechange = () => {
|
|
103
107
|
if (a.readyState == 4)
|
|
104
108
|
if (a.status == 200) {
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const u = new
|
|
108
|
-
u.minFilter =
|
|
109
|
+
const i = window.URL || window.webkitURL;
|
|
110
|
+
r = r || document.createElement("video"), r.crossOrigin = "anonymous", r.muted = !0, r.loop = !0, r.playsInline = !0, r.src = i.createObjectURL(a.response);
|
|
111
|
+
const u = new c.VideoTexture(r);
|
|
112
|
+
u.minFilter = c.LinearFilter, u.magFilter = c.LinearFilter, u.format = c.RGBFormat, s(Object.assign(u, { videoSource: e }));
|
|
109
113
|
} else
|
|
110
114
|
n(new Error("Video download Error: " + a.status));
|
|
111
|
-
}, a.onerror = (
|
|
112
|
-
}),
|
|
115
|
+
}, a.onerror = (i) => n(i), a.open("GET", e), a.responseType = "blob", a.send();
|
|
116
|
+
}), V = async (e, r) => {
|
|
117
|
+
p.forEach((i) => i.dispose()), p.clear();
|
|
113
118
|
const { video_src: s, video_poster_src: n, points: a } = e;
|
|
114
|
-
t.videoSource = s, t.rectPoints =
|
|
119
|
+
t.videoSource = s, t.rectPoints = z(a).map((i) => i.map(({ x: u, y: m, z: l }) => new c.Vector3(u, m, l))), t.imageTexture = P(n), r && (t.videoElement = r), t.videoTexture = await L(t.videoSource, t.videoElement), t.enabled = !!e.enable, t.enabled && x();
|
|
115
120
|
}, g = (e) => {
|
|
116
121
|
if (!t.enabled)
|
|
117
122
|
return;
|
|
118
|
-
const
|
|
119
|
-
if (!(!
|
|
123
|
+
const r = t.videoMeshes;
|
|
124
|
+
if (!(!r || e.intersectObjects(r).length === 0))
|
|
120
125
|
return t.videoTexture && (t.videoTexture.image.paused || t.videoTexture.image.pause()), !1;
|
|
121
126
|
}, v = (e) => {
|
|
122
|
-
|
|
127
|
+
var r;
|
|
128
|
+
e === "Floorplan" ? f.hide() : (r = t.videoTexture) != null && r.image.paused ? f.show() : f.hide();
|
|
123
129
|
}, b = () => {
|
|
124
130
|
if (!t.enabled)
|
|
125
131
|
return;
|
|
126
|
-
const e =
|
|
127
|
-
if (
|
|
128
|
-
const n =
|
|
129
|
-
u && u.distance + l < m ?
|
|
130
|
-
}), !
|
|
131
|
-
const
|
|
132
|
+
const e = d.camera.position;
|
|
133
|
+
if (p.forEach((r, s) => {
|
|
134
|
+
const n = r.css3DObject.position.clone(), a = n.clone().sub(e).normalize(), i = new c.Raycaster(e, a), u = d.model.intersectRaycaster(i)[0], m = n.distanceTo(e), l = 0.01;
|
|
135
|
+
u && u.distance + l < m ? r.hide() : r.show();
|
|
136
|
+
}), !R()) {
|
|
137
|
+
const r = t.rectPoints.find((s) => {
|
|
132
138
|
const n = s[0].clone().add(s[1]).add(s[2]).add(s[3]).divideScalar(4);
|
|
133
139
|
return s.map((a) => a.clone().add(n).divideScalar(2)).filter((a) => {
|
|
134
|
-
const
|
|
135
|
-
return !(m && m.distance + l <
|
|
140
|
+
const i = a.distanceTo(e), u = new c.Raycaster(e, a.clone().sub(e).normalize()), m = d.model.intersectRaycaster(u)[0], l = 0.01;
|
|
141
|
+
return !(m && m.distance + l < i);
|
|
136
142
|
}).length >= 2;
|
|
137
143
|
});
|
|
138
|
-
(!
|
|
144
|
+
(!r || r.length === 0) && A(!0);
|
|
139
145
|
}
|
|
140
146
|
}, w = () => {
|
|
141
147
|
b();
|
|
142
|
-
},
|
|
143
|
-
T(), t.videoTexture = void 0, i.off("modeChange", v), i.off("wantsTapGesture", g), i.off("panoArrived", w), i.off("renderFrame", () => {
|
|
144
|
-
t.videoMeshes.forEach((e) => {
|
|
145
|
-
e && (e.needsRender = !0);
|
|
146
|
-
});
|
|
147
|
-
}), y.clear();
|
|
148
|
-
};
|
|
149
|
-
return i.on("modeChange", v), i.on("wantsTapGesture", g), i.on("panoArrived", w), i.on("renderFrame", () => {
|
|
148
|
+
}, E = () => {
|
|
150
149
|
t.videoMeshes.forEach((e) => {
|
|
151
150
|
e && (e.needsRender = !0);
|
|
152
151
|
});
|
|
153
|
-
}
|
|
152
|
+
}, S = () => {
|
|
153
|
+
T(), t.videoTexture = void 0, d.off("modeChange", v), d.off("wantsTapGesture", g), d.off("panoArrived", w), d.off("renderFrame", E), p.clear();
|
|
154
|
+
};
|
|
155
|
+
return d.on("modeChange", v), d.on("wantsTapGesture", g), d.on("panoArrived", w), d.on("renderFrame", E), { enable: x, disable: T, load: V, dispose: S, state: t, css3DRenderPlugin: f };
|
|
154
156
|
};
|
|
155
157
|
export {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
W as ModelTVVideoPlugin,
|
|
159
|
+
W as default
|
|
158
160
|
};
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"repository": "https://github.com/realsee-developer/dnalogel.git",
|
|
10
10
|
"description": "如视 VR 看房插件合集",
|
|
11
11
|
"private": false,
|
|
12
|
-
"version": "2.0.5-alpha.
|
|
12
|
+
"version": "2.0.5-alpha.6",
|
|
13
13
|
"license": "SEE LICENSE IN TERMS.txt",
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "sh bin/build-production.sh",
|