@realsee/dnalogel 4.0.0-webgpu.3 → 4.0.0-webgpu.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/CHANGELOG.md +6 -0
- package/dist/floorplan.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +270 -35
- package/dist/index.js.map +1 -0
- package/dist/internal/{BasePlugin-CT5K8m36.js → BasePlugin-DC5m72La.js} +3 -3
- package/dist/internal/{BasePlugin-CT5K8m36.js.map → BasePlugin-DC5m72La.js.map} +1 -1
- package/dist/internal/BasePluginWithData-D_0W46_q.js +7 -0
- package/dist/internal/{BasePluginWithData-9z4tpAT4.js.map → BasePluginWithData-D_0W46_q.js.map} +1 -1
- package/dist/internal/{BetterTween-BX0aTvP1.js → BetterTween-DmptqE8m.js} +2 -2
- package/dist/internal/{BetterTween-BX0aTvP1.js.map → BetterTween-DmptqE8m.js.map} +1 -1
- package/dist/internal/{CSS3DRenderPlugin-ccSpcvwd.js → CSS3DRenderPlugin-CEatgl0m.js} +3 -3
- package/dist/internal/CSS3DRenderPlugin-CEatgl0m.js.map +1 -0
- package/dist/internal/{Controller-Csut_kcH.js → Controller-D6o4OGWJ.js} +8 -8
- package/dist/internal/{Controller-Csut_kcH.js.map → Controller-D6o4OGWJ.js.map} +1 -1
- package/dist/internal/{FiveDomEvents-3H9NvDOz.js → FiveDomEvents-BUBLFzti.js} +2 -2
- package/dist/internal/{FiveDomEvents-3H9NvDOz.js.map → FiveDomEvents-BUBLFzti.js.map} +1 -1
- package/dist/internal/FivePuppet-C6QmVY70.js +67 -0
- package/dist/internal/FivePuppet-C6QmVY70.js.map +1 -0
- package/dist/internal/{PointHelper-D565h9b_.js → PointHelper-DIhgdjY2.js} +48 -48
- package/dist/internal/{PointHelper-D565h9b_.js.map → PointHelper-DIhgdjY2.js.map} +1 -1
- package/dist/internal/{Polygon-CBGvYUfJ.js → Polygon-D3xIL1Pl.js} +30 -30
- package/dist/internal/{Polygon-CBGvYUfJ.js.map → Polygon-D3xIL1Pl.js.map} +1 -1
- package/dist/internal/{Prism-Dm5ESkgg.js → Prism-CJlyAEAU.js} +13 -13
- package/dist/internal/{Prism-Dm5ESkgg.js.map → Prism-CJlyAEAU.js.map} +1 -1
- package/dist/internal/{Rectangle-D-zkDycu.js → Rectangle-BpL9lNKU.js} +118 -129
- package/dist/internal/Rectangle-BpL9lNKU.js.map +1 -0
- package/dist/internal/{Work-DF8j5GnL.js → Work-BE4AgdwH.js} +9 -9
- package/dist/internal/{Work-DF8j5GnL.js.map → Work-BE4AgdwH.js.map} +1 -1
- package/dist/internal/{animationFrame-XGKHIeQK.js → animationFrame-CacKXN8l.js} +14 -3
- package/dist/internal/animationFrame-CacKXN8l.js.map +1 -0
- package/dist/internal/{area-maker-Bd9l2pIp.js → area-maker-Bnhx4SkH.js} +4 -4
- package/dist/internal/{area-maker-Bd9l2pIp.js.map → area-maker-Bnhx4SkH.js.map} +1 -1
- package/dist/internal/{boundingBox-DvCor5Hd.js → boundingBox-CIqXgNXW.js} +2 -2
- package/dist/internal/{boundingBox-DvCor5Hd.js.map → boundingBox-CIqXgNXW.js.map} +1 -1
- package/dist/internal/{camera-movement-CwI7UqUk.js → camera-movement-C1pwfMk_.js} +2 -2
- package/dist/internal/camera-movement-C1pwfMk_.js.map +1 -0
- package/dist/internal/{changeMode-BVGYCoqu.js → changeMode-D_I2AOjH.js} +2 -2
- package/dist/internal/{changeMode-BVGYCoqu.js.map → changeMode-D_I2AOjH.js.map} +1 -1
- package/dist/internal/{controller-BWkZT0l1.js → controller-DIDtFrBE.js} +1991 -2050
- package/dist/internal/controller-DIDtFrBE.js.map +1 -0
- package/dist/internal/{cruise-C3F0eNQ-.js → cruise-B50Tcq66.js} +2 -2
- package/dist/internal/{cruise-C3F0eNQ-.js.map → cruise-B50Tcq66.js.map} +1 -1
- package/dist/internal/{current-pano-image-DKUWluR-.js → current-pano-image-BCFr6njt.js} +4 -4
- package/dist/internal/{current-pano-image-DKUWluR-.js.map → current-pano-image-BCFr6njt.js.map} +1 -1
- package/dist/internal/{defaultUrls-CjKkS9k9.js → defaultUrls-CfMtGzqM.js} +14 -3
- package/dist/internal/defaultUrls-CfMtGzqM.js.map +1 -0
- package/dist/internal/{fire-scene-CczaBz2_.js → fire-scene-BzZGvyh_.js} +9 -4
- package/dist/internal/fire-scene-BzZGvyh_.js.map +1 -0
- package/dist/internal/{fiveModelLoad-mg-TnpnM.js → fiveModelLoad-BUIBYxzp.js} +2 -2
- package/dist/internal/{fiveModelLoad-mg-TnpnM.js.map → fiveModelLoad-BUIBYxzp.js.map} +1 -1
- package/dist/internal/{floorplan-KWlIsTvO.js → floorplan-C8BGw87S.js} +5 -5
- package/dist/internal/{floorplan-KWlIsTvO.js.map → floorplan-C8BGw87S.js.map} +1 -1
- package/dist/internal/{generatePolygonGeometry-B_5JFq8y.js → generatePolygonGeometry-BOnzdCaG.js} +181 -178
- package/dist/internal/generatePolygonGeometry-BOnzdCaG.js.map +1 -0
- package/dist/internal/{lookObject-wesf8xt6.js → lookObject-DuRab5wf.js} +2 -2
- package/dist/internal/{lookObject-wesf8xt6.js.map → lookObject-DuRab5wf.js.map} +1 -1
- package/dist/internal/{measure-BX6boAC7.js → measure-B4jFwdQ6.js} +5 -5
- package/dist/internal/{measure-BX6boAC7.js.map → measure-B4jFwdQ6.js.map} +1 -1
- package/dist/internal/{model-chassis-compass-InVNmOAQ.js → model-chassis-compass-C6NTVMLo.js} +2 -2
- package/dist/internal/{model-chassis-compass-InVNmOAQ.js.map → model-chassis-compass-C6NTVMLo.js.map} +1 -1
- package/dist/internal/{model-entry-door-guide-wZbyY77a.js → model-entry-door-guide-DnGTLY2s.js} +2 -2
- package/dist/internal/{model-entry-door-guide-wZbyY77a.js.map → model-entry-door-guide-DnGTLY2s.js.map} +1 -1
- package/dist/internal/{model-maker-uO8xlTuO.js → model-maker-B1mnDdKY.js} +15 -15
- package/dist/internal/{model-maker-uO8xlTuO.js.map → model-maker-B1mnDdKY.js.map} +1 -1
- package/dist/internal/{model-tv-video-DzXb2JRf.js → model-tv-video-BP-7HoDC.js} +2 -2
- package/dist/internal/{model-tv-video-DzXb2JRf.js.map → model-tv-video-BP-7HoDC.js.map} +1 -1
- package/dist/internal/{model-view-CBeeMM98.js → model-view-BWUU0-uq.js} +2 -2
- package/dist/internal/{model-view-CBeeMM98.js.map → model-view-BWUU0-uq.js.map} +1 -1
- package/dist/internal/object3d-helper-CbRRhnLV.js +7 -0
- package/dist/internal/{object3d-helper-DDYsVPN6.js.map → object3d-helper-CbRRhnLV.js.map} +1 -1
- package/dist/internal/{pano-compass-jSr629BP.js → pano-compass-BRTM0dCc.js} +7 -7
- package/dist/internal/{pano-compass-jSr629BP.js.map → pano-compass-BRTM0dCc.js.map} +1 -1
- package/dist/internal/{pano-door-label-DKoYIKLa.js → pano-door-label-BLjYGZrr.js} +3 -3
- package/dist/internal/{pano-door-label-DKoYIKLa.js.map → pano-door-label-BLjYGZrr.js.map} +1 -1
- package/dist/internal/{pano-measure-DW9mdx1O.js → pano-measure-BIgCWkVJ.js} +14 -14
- package/dist/internal/{pano-measure-DW9mdx1O.js.map → pano-measure-BIgCWkVJ.js.map} +1 -1
- package/dist/internal/{pano-ruler-pro-D7q0Ob21.js → pano-ruler-pro-D9yTbHJz.js} +2 -2
- package/dist/internal/{pano-ruler-pro-D7q0Ob21.js.map → pano-ruler-pro-D9yTbHJz.js.map} +1 -1
- package/dist/internal/{pano-spatial-tag-D0qn-__S.js → pano-spatial-tag-B7Gxn3BS.js} +3 -3
- package/dist/internal/{pano-spatial-tag-D0qn-__S.js.map → pano-spatial-tag-B7Gxn3BS.js.map} +1 -1
- package/dist/internal/{pano-tag-BW5MXXws.js → pano-tag-Bchz-jED.js} +2 -2
- package/dist/internal/{pano-tag-BW5MXXws.js.map → pano-tag-Bchz-jED.js.map} +1 -1
- package/dist/internal/{pano-video-Bmud_CAn.js → pano-video-BufYQMqo.js} +3 -3
- package/dist/internal/{pano-video-Bmud_CAn.js.map → pano-video-BufYQMqo.js.map} +1 -1
- package/dist/internal/{pipeline-DDqgb1gw.js → pipeline-t_3IMXKB.js} +4 -4
- package/dist/internal/{pipeline-DDqgb1gw.js.map → pipeline-t_3IMXKB.js.map} +1 -1
- package/dist/internal/{sculpt-BNkLJR6p.js → sculpt-BCK4PMwL.js} +64 -63
- package/dist/internal/{sculpt-BNkLJR6p.js.map → sculpt-BCK4PMwL.js.map} +1 -1
- package/dist/internal/tagPosition-DA9YguT8.js +176 -0
- package/dist/internal/tagPosition-DA9YguT8.js.map +1 -0
- package/dist/internal/withResolvers-DVr4bnnk.js +15 -0
- package/dist/internal/withResolvers-DVr4bnnk.js.map +1 -0
- package/dist/plugins/area-maker.js +1 -1
- package/dist/plugins/camera-movement.js +1 -1
- package/dist/plugins/cruise.js +2 -2
- package/dist/plugins/css3d-render.js +1 -1
- package/dist/plugins/current-pano-image.js +1 -1
- package/dist/plugins/digital-performance.d.ts +1 -1
- package/dist/plugins/digital-performance.js +1 -1
- package/dist/plugins/fire-scene.d.ts +1 -1
- package/dist/plugins/fire-scene.js +1 -1
- package/dist/plugins/guide-line.js +1 -1
- package/dist/plugins/measure.js +1 -1
- package/dist/plugins/model-chassis-compass.js +1 -1
- package/dist/plugins/model-entry-door-guide.js +1 -1
- package/dist/plugins/model-maker.d.ts +1 -1
- package/dist/plugins/model-maker.js +1 -1
- package/dist/plugins/model-tv-video.js +1 -1
- package/dist/plugins/model-view.js +1 -1
- package/dist/plugins/object3d-helper.d.ts +1 -1
- package/dist/plugins/object3d-helper.js +3 -1
- package/dist/plugins/pano-compass.js +1 -1
- package/dist/plugins/pano-door-label.js +1 -1
- package/dist/plugins/pano-measure.js +1 -1
- package/dist/plugins/pano-ruler-pro.js +1 -1
- package/dist/plugins/pano-spatial-tag.js +1 -1
- package/dist/plugins/pano-tag.d.ts +1 -1
- package/dist/plugins/pano-tag.js +4 -1
- package/dist/plugins/pano-video.js +1 -1
- package/dist/plugins/pipeline.js +1 -1
- package/dist/plugins/sculpt.d.ts +1 -1
- package/dist/plugins/sculpt.js +7 -1
- package/dist/types/public/index.d.ts +2 -0
- package/dist/types/public/plugins/digital-performance.d.ts +1 -0
- package/dist/types/public/plugins/fire-scene.d.ts +1 -0
- package/dist/types/public/plugins/model-maker.d.ts +1 -0
- package/dist/types/public/plugins/object3d-helper.d.ts +1 -0
- package/dist/types/public/plugins/pano-tag.d.ts +2 -0
- package/dist/types/public/plugins/sculpt.d.ts +8 -0
- package/dist/types/public/utils.d.ts +5 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +16 -50
- package/package.json +1 -1
- package/dist/internal/BasePluginWithData-9z4tpAT4.js +0 -7
- package/dist/internal/CSS3DRenderPlugin-ccSpcvwd.js.map +0 -1
- package/dist/internal/Rectangle-D-zkDycu.js.map +0 -1
- package/dist/internal/animationFrame-XGKHIeQK.js.map +0 -1
- package/dist/internal/blink-DD_0mH-m.js +0 -113
- package/dist/internal/blink-DD_0mH-m.js.map +0 -1
- package/dist/internal/camera-movement-CwI7UqUk.js.map +0 -1
- package/dist/internal/controller-BWkZT0l1.js.map +0 -1
- package/dist/internal/defaultUrls-CjKkS9k9.js.map +0 -1
- package/dist/internal/fire-scene-CczaBz2_.js.map +0 -1
- package/dist/internal/generatePolygonGeometry-B_5JFq8y.js.map +0 -1
- package/dist/internal/object3d-helper-DDYsVPN6.js +0 -7
- package/dist/utils.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as e, a as t, c as n, f as r, h as i, p as a, t as o, u as s, w as c, x as l } from "./generatePolygonGeometry-BOnzdCaG.js";
|
|
2
2
|
import { i as u } from "./util-vGeVT4oo.js";
|
|
3
3
|
import { n as d } from "./getNormal-BatLuzsS.js";
|
|
4
4
|
import { n as f } from "./isNil-CQNA0Sbe.js";
|
|
@@ -36,7 +36,7 @@ var h = class extends m {
|
|
|
36
36
|
paramsStyle;
|
|
37
37
|
_visible = !0;
|
|
38
38
|
get five() {
|
|
39
|
-
return
|
|
39
|
+
return c(this);
|
|
40
40
|
}
|
|
41
41
|
constructor(e) {
|
|
42
42
|
super();
|
|
@@ -61,25 +61,25 @@ var h = class extends m {
|
|
|
61
61
|
depthWrite: !1,
|
|
62
62
|
depthTest: !1,
|
|
63
63
|
opacity: i.opacity * .5
|
|
64
|
-
}),
|
|
65
|
-
this.fontMesh =
|
|
66
|
-
|
|
64
|
+
}), o = new h(i), c = new h(a);
|
|
65
|
+
this.fontMesh = o, this.backgroundMesh = c, o.name = "FontMesh", c.name = "BackgroundMesh", o.renderOrder = 10, c.renderOrder = 0, this.add(o, c), e?.point && this.position.copy(u(e.point)), e && this.setStyle(e), this.addEventListener("removed", () => {
|
|
66
|
+
s.cacheObject.delete(this), s.checkDom(this);
|
|
67
67
|
}), this.addEventListener("added", () => {
|
|
68
|
-
|
|
69
|
-
}),
|
|
68
|
+
s.cacheObject.add(this);
|
|
69
|
+
}), s.checkDomEveryFrame();
|
|
70
70
|
}
|
|
71
71
|
setStyle(e) {
|
|
72
72
|
f(e.color) && (this.fontMesh.pointMaterial.setValues({ color: e.color }), this.backgroundMesh.pointMaterial.setValues({ color: e.color })), f(e.size) && (this.fontMesh.pointMaterial.setValues({ size: e.size }), this.backgroundMesh.pointMaterial.setValues({ size: e.size })), f(e.occlusionVisibility) && (e.occlusionVisibility ? e.occlusionMode === "depthTest" ? (this.fontMesh.pointMaterial.depthTest = !1, this.backgroundMesh.visible = !1) : (this.fontMesh.pointMaterial.depthTest = !0, this.backgroundMesh.visible = !0) : (this.fontMesh.pointMaterial.depthTest = !0, this.backgroundMesh.visible = !1));
|
|
73
73
|
}
|
|
74
74
|
highlight() {
|
|
75
|
-
this.highlighted || (this.highlighted = !0, this.opacityBeforeHighlight = this.fontMesh.pointMaterial.opacity, this.fontMesh.pointMaterial.setValues({ opacity: this.opacityBeforeHighlight *
|
|
75
|
+
this.highlighted || (this.highlighted = !0, this.opacityBeforeHighlight = this.fontMesh.pointMaterial.opacity, this.fontMesh.pointMaterial.setValues({ opacity: this.opacityBeforeHighlight * l }));
|
|
76
76
|
}
|
|
77
77
|
unhighlight() {
|
|
78
78
|
this.highlighted && (this.highlighted = !1, this.fontMesh.pointMaterial.setValues({ opacity: this.opacityBeforeHighlight }));
|
|
79
79
|
}
|
|
80
80
|
updateMatrixWorld(e) {
|
|
81
81
|
super.updateMatrixWorld(e);
|
|
82
|
-
let t =
|
|
82
|
+
let t = a(this, this.position).toArray().join(",");
|
|
83
83
|
t !== this.lastRenderDomItem && (this.updateDom(), this.lastRenderDomItem = t);
|
|
84
84
|
}
|
|
85
85
|
_onAdded = () => {
|
|
@@ -95,17 +95,17 @@ var h = class extends m {
|
|
|
95
95
|
this.dom && (this.dom.container.style.display = "none");
|
|
96
96
|
};
|
|
97
97
|
updateDom() {
|
|
98
|
-
let
|
|
99
|
-
|
|
100
|
-
let
|
|
101
|
-
this.dom && this.dom.__text !== e && (this.dom.__text = e, e instanceof HTMLElement ? (this.dom.container.innerHTML = "", this.dom.container.appendChild(e)) : e ? this.dom.container.innerHTML =
|
|
98
|
+
let t = this.paramsStyle.tip;
|
|
99
|
+
t && !this.dom && this.five && (this.dom = new e(this.five), this.dom.intersectCheck = !1, this.dom.simulate3D = !0, this.dom.container.style.display = this.visible ? "block" : "none");
|
|
100
|
+
let n = (e) => {
|
|
101
|
+
this.dom && this.dom.__text !== e && (this.dom.__text = e, e instanceof HTMLElement ? (this.dom.container.innerHTML = "", this.dom.container.appendChild(e)) : e ? this.dom.container.innerHTML = i(e, {
|
|
102
102
|
style: "",
|
|
103
103
|
offsetY: -20
|
|
104
104
|
}) : this.dom.container.innerHTML = "");
|
|
105
105
|
};
|
|
106
|
-
|
|
106
|
+
t ? (n(t), this.dom.setPosition(this.position.clone())) : n(null);
|
|
107
107
|
}
|
|
108
|
-
}, v = class extends
|
|
108
|
+
}, v = class extends n {
|
|
109
109
|
name = "LineWithDotsMesh";
|
|
110
110
|
pointGroup = new d();
|
|
111
111
|
_paramsStyle;
|
|
@@ -219,7 +219,7 @@ var h = class extends m {
|
|
|
219
219
|
}, f(e.color) && (this.meshFont.material.color.set(new p.Color(e.color)), this.needsRender = !0), f(e.opacity) && (this.meshFont.material.opacity = e.opacity, this.meshBackground.material.opacity = .3 / .5 * this.meshFont.material.opacity, this.needsRender = !0), this.setOcclusionVisibility(e);
|
|
220
220
|
}
|
|
221
221
|
highlight(e) {
|
|
222
|
-
this.highlighted = !0, f(e?.color) ? (this.colorBeforeHighlight = this.colorBeforeHighlight ?? this.meshFont.material.color.clone(), this.meshFont.material.color.set(new p.Color(e.color))) : (this.opacityBeforeHighlight = this.opacityBeforeHighlight ?? this.opacity, this.meshFont.material.opacity = this.opacity *
|
|
222
|
+
this.highlighted = !0, f(e?.color) ? (this.colorBeforeHighlight = this.colorBeforeHighlight ?? this.meshFont.material.color.clone(), this.meshFont.material.color.set(new p.Color(e.color))) : (this.opacityBeforeHighlight = this.opacityBeforeHighlight ?? this.opacity, this.meshFont.material.opacity = this.opacity * l, this.meshBackground.material.opacity = .3 / .5 * this.meshFont.material.opacity), this.needsRender = !0;
|
|
223
223
|
}
|
|
224
224
|
unhighlight() {
|
|
225
225
|
this.highlighted = !1, f(this.opacityBeforeHighlight) && (this.meshFont.material.opacity = this.opacityBeforeHighlight, this.meshBackground.material.opacity = .3 / .5 * this.meshFont.material.opacity, this.opacityBeforeHighlight = void 0), f(this.colorBeforeHighlight) && (this.meshFont.material.color = new p.Color(this.colorBeforeHighlight), this.colorBeforeHighlight = void 0), this.needsRender = !0;
|
|
@@ -248,7 +248,7 @@ var x = class extends y {
|
|
|
248
248
|
return this.geometryInfo?.center.clone();
|
|
249
249
|
}
|
|
250
250
|
get geometryInfo() {
|
|
251
|
-
return this.geometryInfoNeedUpdate &&= (this._geometryInfo = this.isBlank ? null :
|
|
251
|
+
return this.geometryInfoNeedUpdate &&= (this._geometryInfo = this.isBlank ? null : t(this.geometry), !1), this._geometryInfo;
|
|
252
252
|
}
|
|
253
253
|
points = [];
|
|
254
254
|
planeHelperNeedUpdate = !0;
|
|
@@ -256,21 +256,21 @@ var x = class extends y {
|
|
|
256
256
|
_paramsStyle;
|
|
257
257
|
areaDom;
|
|
258
258
|
get five() {
|
|
259
|
-
return
|
|
259
|
+
return c(this);
|
|
260
260
|
}
|
|
261
261
|
planeHelper = null;
|
|
262
262
|
_geometryInfo = null;
|
|
263
263
|
lastRenderAreaItem;
|
|
264
264
|
constructor(e) {
|
|
265
265
|
super(e), e?.points && this.setPoints(e.points), this._paramsStyle = e ?? {}, this.updateAreaItems(), this.addEventListener("removed", () => {
|
|
266
|
-
|
|
266
|
+
s.cacheObject.delete(this), s.checkDom(this);
|
|
267
267
|
}), this.addEventListener("added", () => {
|
|
268
|
-
|
|
269
|
-
}),
|
|
268
|
+
s.cacheObject.add(this);
|
|
269
|
+
}), s.checkDomEveryFrame();
|
|
270
270
|
}
|
|
271
271
|
updateMatrixWorld(e) {
|
|
272
272
|
if (super.updateMatrixWorld(e), this.center) {
|
|
273
|
-
let e =
|
|
273
|
+
let e = a(this, this.center).toArray().join(",");
|
|
274
274
|
e !== this.lastRenderAreaItem && (this.updateAreaItems(), this.lastRenderAreaItem = e);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
@@ -284,7 +284,7 @@ var x = class extends y {
|
|
|
284
284
|
}
|
|
285
285
|
setPoints(e, t) {
|
|
286
286
|
let n = e.map(u);
|
|
287
|
-
this.points = n, this.geometry =
|
|
287
|
+
this.points = n, this.geometry = o(this.points, { checkLinesIntersect: t?.checkLinesIntersect ?? !0 }) ?? b, this.planeHelperNeedUpdate = !0, this.geometryInfoNeedUpdate = !0, this.updateAreaItems();
|
|
288
288
|
}
|
|
289
289
|
projectPoint(e) {
|
|
290
290
|
return e && (this.planeHelperNeedUpdate && this.updatePlaneHelper(), this.planeHelper ? this.planeHelper.projectPoint(e, new p.Vector3()) : e);
|
|
@@ -305,20 +305,20 @@ var x = class extends y {
|
|
|
305
305
|
this.planeHelper = this.points.length >= 3 ? new p.Plane().setFromCoplanarPoints(this.points[0], this.points[1], this.points[2]) : null, this.planeHelperNeedUpdate = !1;
|
|
306
306
|
}
|
|
307
307
|
updateAreaItems() {
|
|
308
|
-
let
|
|
308
|
+
let t = () => {
|
|
309
309
|
this.areaDom?.destroy(), this.areaDom = void 0;
|
|
310
310
|
};
|
|
311
|
-
if (!this._paramsStyle.lengthEnable || !this.geometryInfo) return
|
|
311
|
+
if (!this._paramsStyle.lengthEnable || !this.geometryInfo) return t();
|
|
312
312
|
if (!this.five) return console.error("Five not found");
|
|
313
313
|
this.areaDom = this.areaDom ?? (() => {
|
|
314
|
-
let
|
|
315
|
-
return
|
|
314
|
+
let t = new e(this.five);
|
|
315
|
+
return t.intersectCheck = !(this._paramsStyle.occlusionVisibility ?? !0), t.simulate3D = !0, t;
|
|
316
316
|
})(), this.areaDom.setPosition(this.center);
|
|
317
|
-
let
|
|
318
|
-
|
|
317
|
+
let n = r(this.geometryInfo.area, this._paramsStyle.lengthUnit);
|
|
318
|
+
n ? this.areaDom.container.innerHTML = i(n, { style: "color: #FFFFFF; background: #3366FF" }) : this.areaDom.container.innerHTML = "";
|
|
319
319
|
}
|
|
320
320
|
};
|
|
321
321
|
//#endregion
|
|
322
322
|
export { _ as i, y as n, v as r, x as t };
|
|
323
323
|
|
|
324
|
-
//# sourceMappingURL=Polygon-
|
|
324
|
+
//# sourceMappingURL=Polygon-D3xIL1Pl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Polygon-CBGvYUfJ.js","names":["getFiveFromParentChain","DEFAULT_HIGHLIGHT_OPACITY","transformUnitSquare","localToWorld","LightTag","getGeometryInfo","RenderDom","getLengthHTML","LineMesh","generatePolygonGeometry","anyPositionToVector3","IObject3D","notNil","THREE","PointSprite","Sprite","pointMaterial","sharedCircleTexture","PointMesh","paramsStyle","params","materialParams","materialFront","materialBackground","fontMesh","backgroundMesh","force","lastRenderDomItem","tip","render","str","LineWithDotsMesh","p","points","vectors","pointMesh","vector","style","ColoredMesh","geometry","meshFront","meshBackground","occlusionMode","occlusionVisibility","blankGeometry","PolygonMesh","lastRenderAreaItem","config","point","clear","tag","areaString"],"sources":["../../src/shared-utils/three/PointSprite.ts","../../src/Sculpt/Meshes/Point.ts","../../src/Sculpt/Meshes/LineWithDots.ts","../../src/Sculpt/utils/three/ColoredMesh.ts","../../src/Sculpt/Meshes/Polygon.ts"],"sourcesContent":["import { Sprite, type PointsNodeMaterial, type SpriteMaterial } from 'three/webgpu'\n\n/** Sprite geometry supplies UVs; PointsNodeMaterial supplies pixel-sized billboards on WebGPU. */\nexport class PointSprite extends Sprite {\n public constructor(public readonly pointMaterial: PointsNodeMaterial) {\n // Three supports node materials here; the Sprite constructor type still names SpriteMaterial.\n super(pointMaterial as unknown as SpriteMaterial)\n }\n}\n","import * as THREE from 'three/webgpu'\nimport {\n DEFAULT_HIGHLIGHT_OPACITY,\n type ColorStyle,\n type DisplayInfoConfig,\n type OcclusionStyle,\n type OpacityStyle,\n} from '../typings/style'\nimport { IObject3D } from '../../shared-utils/three/IObject3D'\nimport { anyPositionToVector3 } from '../../shared-utils/positionToVector3'\nimport type { PointData } from '../utils/data'\nimport { notNil } from '../../shared-utils'\nimport { LightTag } from '../../shared-utils/tag'\nimport { localToWorld } from '../../shared-utils/three/applyObjectMatrixWorld'\nimport { getFiveFromParentChain } from '../../shared-utils/five/getFiveFromParentChain'\nimport type { Five } from '@realsee/five-webgpu'\nimport { getLengthHTML } from '../utils/Meshes/getLengthHTML'\nimport { RenderDom } from '../utils/renderDom'\nexport type { PointData } from '../utils/data'\n\nexport const circleImageURL =\n 'data:image/png;base64,' +\n 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQg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8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg=='\n\nlet sharedCircleTexture: THREE.Texture | null = null\n\nimport { PointSprite } from '../../shared-utils/three/PointSprite'\n\nexport type PointStyle = ColorStyle & { size: number } & OcclusionStyle & Partial<DisplayInfoConfig> & OpacityStyle\n\nexport class PointMesh extends IObject3D {\n public name = 'PointMesh'\n\n public get color() {\n return this.fontMesh.pointMaterial.color\n }\n\n public get size() {\n return this.fontMesh.pointMaterial.size\n }\n\n public get style() {\n return {\n color: this.color,\n size: this.size,\n opacity: this.fontMesh.pointMaterial.opacity,\n occlusionVisibility: this.fontMesh.pointMaterial.depthTest,\n occlusionMode: this.backgroundMesh.visible ? 'depthWrite' : 'depthTest',\n }\n }\n\n public dom: LightTag\n\n private opacityBeforeHighlight: number\n private highlighted = false\n\n private fontMesh: PointSprite\n private backgroundMesh: PointSprite\n\n private lastRenderDomItem: string\n\n private paramsStyle: Partial<PointStyle>\n\n private _visible = true\n\n private get five(): Five | undefined {\n return getFiveFromParentChain(this)\n }\n\n public constructor(params?: Partial<PointStyle & PointData>) {\n super()\n\n const { point, ...paramsStyle } = params ?? {}\n\n this.paramsStyle = paramsStyle ?? {}\n\n\n const materialParams = {\n positionNode: THREE.TSL.vec3(0),\n transparent: true,\n side: THREE.DoubleSide,\n size: params?.size ?? 8,\n map: sharedCircleTexture || (sharedCircleTexture = new THREE.TextureLoader().load(circleImageURL)),\n sizeAttenuation: false,\n }\n\n // 上层\n const materialFront = new THREE.PointsNodeMaterial({\n ...materialParams,\n color: params?.color ?? 0xffffff,\n depthTest: true,\n opacity: params?.opacity ?? 1,\n })\n\n // 下层\n const materialBackground = new THREE.PointsNodeMaterial({\n ...materialParams,\n size: materialFront.size,\n color: materialFront.color,\n depthWrite: false,\n depthTest: false,\n opacity: materialFront.opacity * 0.5,\n })\n\n const fontMesh = new PointSprite(materialFront)\n const backgroundMesh = new PointSprite(materialBackground)\n\n this.fontMesh = fontMesh\n this.backgroundMesh = backgroundMesh\n\n fontMesh.name = 'FontMesh'\n backgroundMesh.name = 'BackgroundMesh'\n\n fontMesh.renderOrder = 10\n backgroundMesh.renderOrder = 0\n\n this.add(fontMesh, backgroundMesh)\n\n if (params?.point) {\n this.position.copy(anyPositionToVector3(params.point))\n }\n\n if (params) this.setStyle(params)\n\n this.addEventListener('removed', () => {\n RenderDom.cacheObject.delete(this)\n RenderDom.checkDom(this)\n })\n this.addEventListener('added', () => {\n RenderDom.cacheObject.add(this)\n })\n\n RenderDom.checkDomEveryFrame()\n }\n\n public setStyle(params: Partial<PointStyle>) {\n if (notNil(params.color)) {\n this.fontMesh.pointMaterial.setValues({ color: params.color })\n this.backgroundMesh.pointMaterial.setValues({ color: params.color })\n }\n if (notNil(params.size)) {\n this.fontMesh.pointMaterial.setValues({ size: params.size })\n this.backgroundMesh.pointMaterial.setValues({ size: params.size })\n }\n if (notNil(params.occlusionVisibility)) {\n if (params.occlusionVisibility) {\n if (params.occlusionMode === 'depthTest') {\n this.fontMesh.pointMaterial.depthTest = false\n this.backgroundMesh.visible = false\n } else {\n this.fontMesh.pointMaterial.depthTest = true\n this.backgroundMesh.visible = true\n }\n } else {\n this.fontMesh.pointMaterial.depthTest = true\n this.backgroundMesh.visible = false\n }\n }\n }\n\n public highlight() {\n if (this.highlighted) return\n this.highlighted = true\n this.opacityBeforeHighlight = this.fontMesh.pointMaterial.opacity\n this.fontMesh.pointMaterial.setValues({ opacity: this.opacityBeforeHighlight * DEFAULT_HIGHLIGHT_OPACITY })\n }\n\n public unhighlight() {\n if (!this.highlighted) return\n this.highlighted = false\n this.fontMesh.pointMaterial.setValues({ opacity: this.opacityBeforeHighlight })\n }\n\n public updateMatrixWorld(force?: boolean) {\n super.updateMatrixWorld(force)\n const lastRenderDomItem = localToWorld(this, this.position).toArray().join(',')\n if (lastRenderDomItem !== this.lastRenderDomItem) {\n this.updateDom()\n this.lastRenderDomItem = lastRenderDomItem\n }\n }\n\n public _onAdded = () => {\n if (!this.dom) this.updateDom()\n }\n\n public _onRemoved = () => {\n this.dom?.destroy()\n this.dom = undefined\n }\n\n public _onShowed = () => {\n if (this.dom) this.dom.container.style.display = 'block'\n }\n\n public _onHidden = () => {\n if (this.dom) this.dom.container.style.display = 'none'\n }\n\n private updateDom() {\n const tip = this.paramsStyle.tip\n if (tip && !this.dom && this.five) {\n this.dom = new LightTag(this.five)\n this.dom.intersectCheck = false\n this.dom.simulate3D = true\n this.dom.container.style.display = this.visible ? 'block' : 'none'\n }\n\n const render = (str: string | HTMLElement | null) => {\n if (!this.dom) return\n\n if ((this.dom as any).__text === str) return\n ;(this.dom as any).__text = str\n\n if (str instanceof HTMLElement) {\n this.dom.container.innerHTML = ''\n this.dom.container.appendChild(str)\n } else if (str) {\n this.dom.container.innerHTML = getLengthHTML(str, {\n style: '',\n offsetY: -20, // 移动label到点的上方,否则会遮挡鼠标选点\n })\n } else {\n this.dom.container.innerHTML = ''\n }\n }\n\n if (!tip) {\n render(null)\n } else {\n render(tip)\n this.dom.setPosition(this.position.clone())\n }\n }\n}\n","import { anyPositionToVector3, type AnyPositions } from '../../shared-utils/positionToVector3'\nimport { PointMesh } from './Point'\nimport { notNil } from '../../shared-utils'\nimport { LineMesh, type LineMeshStyle } from './Line'\nimport { IObject3D } from '../../shared-utils/three/IObject3D'\nimport type { PointsData } from '../utils/data'\nimport type { Color } from '../typings/style'\nimport type { Overwrite } from '../../typings/utils.type'\n\ntype Style = LineMeshStyle & {\n pointVisibility?: boolean | { startPoint?: boolean; endPoint?: boolean }\n /**\n * 点颜色\n */\n pointColor?: Color\n /**\n * 点透明度\n */\n pointOpacity?: number\n /**\n * 线颜色\n */\n lineColor?: Color\n /**\n * 线透明度\n */\n lineOpacity?: number\n}\n\n/**\n * Represents a mesh that consists of a line with dots at the start and end points.\n */\nexport class LineWithDotsMesh extends LineMesh {\n public name = 'LineWithDotsMesh'\n\n public pointGroup: Overwrite<IObject3D, { children: Array<PointMesh> }> = new IObject3D() as any\n private _paramsStyle: Style\n\n public get startPoint() {\n return this.pointMeshes[0]\n }\n public get endPoint() {\n if (this.pointMeshes.length < 2) return null\n return this.pointMeshes[this.pointMeshes.length - 1]\n }\n public get visiblePointMeshes() {\n return this.pointMeshes.filter((p) => p.visible)\n }\n public get pointMeshes() {\n return this.pointGroup.children as PointMesh[]\n }\n\n public constructor(params?: Partial<Style & PointsData>) {\n super()\n this.add(this.pointGroup)\n\n if (params) this.setStyle(params)\n if (params?.points) {\n this.setPoints(params.points)\n }\n }\n\n public setPoints(points: AnyPositions) {\n super.setPoints(points)\n const vectors = points.map(anyPositionToVector3).filter(notNil)\n\n this.pointGroup.removeChildren()\n this.addIfNotExists(this.pointGroup)\n\n vectors.forEach((vector) => {\n const pointMesh = new PointMesh({\n ...this.style,\n color: this._paramsStyle?.pointColor ?? this._paramsStyle?.lineColor,\n tip: undefined,\n })\n pointMesh.position.copy(vector)\n this.pointGroup.add(pointMesh)\n })\n\n this.updateEdgePointsVisibility()\n\n this.needsRender = true\n }\n\n public setStyle = (style: Partial<Style>) => {\n super.setStyle(style)\n this._paramsStyle = { ...this._paramsStyle, ...style }\n this.pointMeshes.forEach((pointMesh) =>\n pointMesh.setStyle({ ...this._paramsStyle, color: this._paramsStyle?.pointColor ?? this._paramsStyle?.lineColor, tip: undefined }),\n )\n this.updateEdgePointsVisibility()\n this.needsRender = true\n }\n\n public highlight = (params?: { color?: Color }) => {\n super.highlight(params)\n this.pointMeshes.forEach((pointMesh) => pointMesh.highlight())\n }\n\n public unhighlight = () => {\n super.unhighlight()\n this.pointMeshes.forEach((pointMesh) => pointMesh.unhighlight())\n }\n\n private updateEdgePointsVisibility = () => {\n if (notNil(this._paramsStyle?.pointVisibility)) {\n if (this.startPoint)\n this.startPoint.visible =\n typeof this._paramsStyle.pointVisibility === 'object'\n ? this._paramsStyle.pointVisibility.startPoint\n : this._paramsStyle.pointVisibility\n if (this.endPoint)\n this.endPoint.visible =\n typeof this._paramsStyle.pointVisibility === 'object'\n ? this._paramsStyle.pointVisibility.endPoint\n : this._paramsStyle.pointVisibility\n }\n }\n}\n","import * as THREE from 'three/webgpu'\nimport {\n DEFAULT_COLOR,\n type ColorStyle,\n type OpacityStyle,\n type OcclusionStyle,\n DEFAULT_HIGHLIGHT_OPACITY,\n DEFAULT_OPACITY,\n type Color,\n} from '../../typings/style'\nimport { IObject3D } from '../../../shared-utils/three/IObject3D'\nimport { notNil } from '../../../shared-utils'\n\nexport type ColoredMeshStyle = OpacityStyle & ColorStyle & OcclusionStyle\n\nexport default class ColoredMesh<\n TGeometry extends THREE.BufferGeometry = THREE.BufferGeometry,\n> extends IObject3D {\n public name = 'ColoredMesh'\n\n public meshFont: THREE.Mesh<TGeometry, THREE.MeshBasicMaterial>\n public meshBackground: THREE.Mesh<TGeometry, THREE.MeshBasicMaterial>\n\n public get style() {\n return {\n color: this.color,\n opacity: this.opacity,\n occlusionVisibility: this.occlusionVisibility,\n occlusionMode: this.occlusionMode,\n }\n }\n\n public get color() {\n return this.meshFont.material.color\n }\n\n public get opacity() {\n return this.meshFont.material.opacity\n }\n\n public get occlusionVisibility() {\n return Boolean(this.meshBackground.parent) || this.meshFont.material.depthTest === false\n }\n\n public get occlusionMode(): 'depthTest' | 'translucence' {\n return this.meshFont.material.depthTest === false ? 'depthTest' : 'translucence'\n }\n\n public set geometry(geometry: TGeometry) {\n this._geometry = geometry\n this.meshFont.geometry = geometry\n this.meshBackground.geometry = geometry\n }\n\n public get geometry() {\n return this._geometry\n }\n\n private paramsStyle: Partial<ColoredMeshStyle> = {}\n\n private _geometry: TGeometry = new THREE.BufferGeometry() as TGeometry\n\n private highlighted = false\n private opacityBeforeHighlight: number\n private colorBeforeHighlight: Color\n\n public constructor(params?: Partial<ColoredMeshStyle>) {\n super()\n\n this.paramsStyle = params ?? {}\n // 蓝的\n const materialFront = new THREE.MeshBasicMaterial({\n color: new THREE.Color(params?.color ?? DEFAULT_COLOR), // Three converts sRGB literals to its linear working space.\n transparent: true,\n side: THREE.DoubleSide,\n depthTest: true,\n depthWrite: false,\n opacity: params?.opacity ?? DEFAULT_OPACITY,\n })\n // 白的\n const materialBackground = new THREE.MeshBasicMaterial({\n color: 0xffffff,\n transparent: true,\n side: THREE.DoubleSide,\n depthTest: false,\n depthWrite: false,\n opacity: (0.3 / 0.5) * materialFront.opacity,\n })\n\n const meshFront = new THREE.Mesh(this.geometry, materialFront)\n const meshBackground = new THREE.Mesh(this.geometry, materialBackground)\n\n meshFront.name = 'MeshFront'\n meshBackground.name = 'MeshBackground'\n\n // 让蓝色的在白色的上面\n meshFront.renderOrder = 1\n meshBackground.renderOrder = 0\n\n this.meshFont = meshFront\n this.meshBackground = meshBackground\n\n this.add(meshFront)\n\n this.setOcclusionVisibility({ occlusionVisibility: params?.occlusionVisibility, occlusionMode: params?.occlusionMode })\n }\n\n public setStyle(params: Partial<ColoredMeshStyle>) {\n this.paramsStyle = { ...this.paramsStyle, ...params }\n if (notNil(params.color)) {\n this.meshFont.material.color.set(new THREE.Color(params.color))\n this.needsRender = true\n }\n if (notNil(params.opacity)) {\n this.meshFont.material.opacity = params.opacity\n this.meshBackground.material.opacity = (0.3 / 0.5) * this.meshFont.material.opacity\n this.needsRender = true\n }\n this.setOcclusionVisibility(params)\n }\n\n public highlight(params?: { color?: Color }) {\n this.highlighted = true\n\n if (notNil(params?.color)) {\n this.colorBeforeHighlight = this.colorBeforeHighlight ?? this.meshFont.material.color.clone()\n this.meshFont.material.color.set(new THREE.Color(params.color))\n } else {\n this.opacityBeforeHighlight = this.opacityBeforeHighlight ?? this.opacity\n this.meshFont.material.opacity = this.opacity * DEFAULT_HIGHLIGHT_OPACITY\n this.meshBackground.material.opacity = (0.3 / 0.5) * this.meshFont.material.opacity\n }\n\n this.needsRender = true\n }\n\n public unhighlight() {\n this.highlighted = false\n\n if (notNil(this.opacityBeforeHighlight)) {\n this.meshFont.material.opacity = this.opacityBeforeHighlight\n this.meshBackground.material.opacity = (0.3 / 0.5) * this.meshFont.material.opacity\n this.opacityBeforeHighlight = undefined\n }\n\n if (notNil(this.colorBeforeHighlight)) {\n this.meshFont.material.color = new THREE.Color(this.colorBeforeHighlight)\n this.colorBeforeHighlight = undefined\n }\n\n this.needsRender = true\n }\n\n private setOcclusionVisibility(params: Partial<OcclusionStyle>) {\n const occlusionMode = params.occlusionMode ?? this.paramsStyle.occlusionMode ?? 'translucence'\n const occlusionVisibility = params.occlusionVisibility ?? this.paramsStyle.occlusionVisibility\n if (notNil(occlusionVisibility)) {\n if (occlusionVisibility) {\n if (occlusionMode === 'depthTest') {\n this.meshFont.material.depthTest = false\n this.remove(this.meshBackground)\n } else if (occlusionMode === 'translucence') {\n this.meshFont.material.depthTest = true\n this.addIfNotExists(this.meshBackground)\n }\n } else {\n this.meshFont.material.depthTest = true\n this.remove(this.meshBackground)\n }\n }\n }\n}\n","import * as THREE from 'three/webgpu'\nimport generatePolygonGeometry from '../../shared-utils/three/generatePolygonGeometry'\nimport { anyPositionToVector3, type AnyPositions } from '../../shared-utils/positionToVector3'\nimport ColoredMesh, { type ColoredMeshStyle } from '../utils/three/ColoredMesh'\nimport { getGeometryInfo } from '../../shared-utils/three/geometryUtil'\nimport type { PointsData } from '../utils/data'\nimport { LightTag } from '../../shared-utils/tag'\nimport { getLengthHTML } from '../utils/Meshes/getLengthHTML'\nimport { localToWorld } from '../../shared-utils/three/applyObjectMatrixWorld'\nimport { getFiveFromParentChain } from '../../shared-utils/five/getFiveFromParentChain'\nimport type { Five } from '@realsee/five-webgpu'\nimport { notNil } from '../../shared-utils'\nimport type { LengthConfig } from '../typings/style'\nimport { transformUnitSquare } from '../utils/unit'\nimport { RenderDom } from '../utils/renderDom'\n\nexport const blankGeometry: THREE.BufferGeometry & { isBlank: true } = new THREE.BufferGeometry() as any\nblankGeometry.name = 'blankGeometry'\nblankGeometry.isBlank = true\n\nexport type PolygonStyle = ColoredMeshStyle & LengthConfig\n\nexport type PolygonData = PointsData\n\nexport class PolygonMesh extends ColoredMesh<THREE.BufferGeometry> {\n public name = 'PolygonMesh'\n\n public get normal() {\n if (this.points.length >= 3) {\n return new THREE.Vector3()\n .crossVectors(this.points[1].clone().sub(this.points[0]), this.points[2].clone().sub(this.points[0]))\n .normalize()\n } else {\n return new THREE.Vector3(0, 0, 1)\n }\n }\n\n public get style() {\n return { ...super.style, lengthEnable: this._paramsStyle.lengthEnable }\n }\n\n public get isBlank() {\n return Boolean((this.geometry as any).isBlank)\n }\n\n public get center() {\n return this.geometryInfo?.center.clone()\n }\n\n public get geometryInfo() {\n if (this.geometryInfoNeedUpdate) {\n if (this.isBlank) {\n this._geometryInfo = null\n } else {\n this._geometryInfo = getGeometryInfo(this.geometry)\n }\n this.geometryInfoNeedUpdate = false\n }\n return this._geometryInfo\n }\n\n public points: THREE.Vector3[] = []\n\n public planeHelperNeedUpdate = true\n public geometryInfoNeedUpdate = true\n\n public _paramsStyle: Partial<PolygonStyle>\n\n public areaDom?: LightTag\n\n private get five(): Five | undefined {\n return getFiveFromParentChain(this)\n }\n\n private planeHelper: THREE.Plane | null = null\n private _geometryInfo: { area: number; center: THREE.Vector3 } | null = null\n\n private lastRenderAreaItem: string\n\n public constructor(params?: Partial<PolygonStyle & PolygonData>) {\n super(params)\n\n if (params?.points) this.setPoints(params.points)\n this._paramsStyle = params ?? {}\n this.updateAreaItems()\n\n this.addEventListener('removed', () => {\n RenderDom.cacheObject.delete(this)\n RenderDom.checkDom(this)\n })\n this.addEventListener('added', () => {\n RenderDom.cacheObject.add(this)\n })\n\n RenderDom.checkDomEveryFrame()\n }\n\n public updateMatrixWorld(force?: boolean) {\n super.updateMatrixWorld(force)\n if (this.center) {\n const lastRenderAreaItem = localToWorld(this, this.center).toArray().join(',')\n if (lastRenderAreaItem !== this.lastRenderAreaItem) {\n this.updateAreaItems()\n this.lastRenderAreaItem = lastRenderAreaItem\n }\n }\n }\n\n public setStyle(params: Partial<ColoredMeshStyle>): void {\n this._paramsStyle = { ...this._paramsStyle, ...params }\n super.setStyle(this._paramsStyle)\n\n const occlusionVisibility = this._paramsStyle.occlusionVisibility ?? true\n if (this.areaDom) this.areaDom.intersectCheck = !occlusionVisibility\n\n this.updateAreaItems()\n }\n\n public setPoints(points: AnyPositions, config?: { checkLinesIntersect?: boolean }): void {\n const vectors = points.map(anyPositionToVector3)\n this.points = vectors\n\n this.geometry = generatePolygonGeometry(this.points, { checkLinesIntersect: config?.checkLinesIntersect ?? true }) ?? blankGeometry\n\n this.planeHelperNeedUpdate = true\n this.geometryInfoNeedUpdate = true\n\n this.updateAreaItems()\n }\n\n /**\n * @description: 获取一个点投影在当前平面上的点\n */\n public projectPoint(point: THREE.Vector3) {\n if (!point) return point\n\n if (this.planeHelperNeedUpdate) this.updatePlaneHelper()\n\n return this.planeHelper ? this.planeHelper.projectPoint(point, new THREE.Vector3()) : point\n }\n\n public _onAdded = () => {\n if (!this.areaDom) this.updateAreaItems()\n }\n\n public _onRemoved = () => {\n this.areaDom?.destroy()\n this.areaDom = undefined\n }\n\n public _onShowed = () => {\n if (this.areaDom) this.areaDom.container.style.display = 'block'\n }\n\n public _onHidden = () => {\n if (this.areaDom) this.areaDom.container.style.display = 'none'\n }\n\n private updatePlaneHelper() {\n if (this.points.length >= 3) {\n this.planeHelper = new THREE.Plane().setFromCoplanarPoints(this.points[0], this.points[1], this.points[2])\n } else {\n this.planeHelper = null\n }\n this.planeHelperNeedUpdate = false\n }\n\n private updateAreaItems() {\n const clear = () => {\n this.areaDom?.destroy()\n this.areaDom = undefined\n }\n if (!this._paramsStyle.lengthEnable) return clear()\n if (!this.geometryInfo) return clear()\n\n if (!this.five) return console.error('Five not found')\n\n this.areaDom =\n this.areaDom ??\n (() => {\n const tag = new LightTag(this.five)\n const occlusionVisibility = this._paramsStyle.occlusionVisibility ?? true\n tag.intersectCheck = !occlusionVisibility\n tag.simulate3D = true\n return tag\n })()\n\n this.areaDom.setPosition(this.center)\n const areaString = transformUnitSquare(this.geometryInfo.area, this._paramsStyle.lengthUnit)\n\n if (!areaString) {\n this.areaDom.container.innerHTML = ''\n } else {\n this.areaDom.container.innerHTML = getLengthHTML(areaString, {\n style: `color: #FFFFFF; background: #3366FF`,\n })\n }\n }\n}\n"],"mappings":";;;;;;;AAGA,IAAac,IAAb,cAAiCC,EAAO;CACH;CAAnC,YAAmB,GAAmD;EAAnC,AAEjC,MAAMC,CAA0C,GAFf,KAAA,gBAAAA;CAGnC;AACF,GCgBIC,IAA4C,MAMnCC,IAAb,cAA+BP,EAAU;CACvC,OAAc;CAEd,IAAW,QAAQ;EACjB,OAAO,KAAK,SAAS,cAAc;CACrC;CAEA,IAAW,OAAO;EAChB,OAAO,KAAK,SAAS,cAAc;CACrC;CAEA,IAAW,QAAQ;EACjB,OAAO;GACL,OAAO,KAAK;GACZ,MAAM,KAAK;GACX,SAAS,KAAK,SAAS,cAAc;GACrC,qBAAqB,KAAK,SAAS,cAAc;GACjD,eAAe,KAAK,eAAe,UAAU,eAAe;EAC9D;CACF;CAEA;CAEA;CACA,cAAsB;CAEtB;CACA;CAEA;CAEA;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,UAAU,YAAY;CAMvC;AACF"}
|
|
1
|
+
{"version":3,"file":"Polygon-D3xIL1Pl.js","names":["LightTag","getGeometryInfo","LineMesh","transformUnitSquare","getLengthHTML","localToWorld","generatePolygonGeometry","RenderDom","getFiveFromParentChain","DEFAULT_HIGHLIGHT_OPACITY","anyPositionToVector3","IObject3D","notNil","THREE","PointSprite","Sprite","pointMaterial","sharedCircleTexture","PointMesh","paramsStyle","params","materialParams","materialFront","materialBackground","fontMesh","backgroundMesh","force","lastRenderDomItem","tip","render","str","LineWithDotsMesh","p","points","vectors","pointMesh","vector","style","ColoredMesh","geometry","meshFront","meshBackground","occlusionMode","occlusionVisibility","blankGeometry","PolygonMesh","lastRenderAreaItem","config","point","clear","tag","areaString"],"sources":["../../src/shared-utils/three/PointSprite.ts","../../src/Sculpt/Meshes/Point.ts","../../src/Sculpt/Meshes/LineWithDots.ts","../../src/Sculpt/utils/three/ColoredMesh.ts","../../src/Sculpt/Meshes/Polygon.ts"],"sourcesContent":["import { Sprite, type PointsNodeMaterial, type SpriteMaterial } from 'three/webgpu'\n\n/** Sprite geometry supplies UVs; PointsNodeMaterial supplies pixel-sized billboards on WebGPU. */\nexport class PointSprite extends Sprite {\n public constructor(public readonly pointMaterial: PointsNodeMaterial) {\n // Three supports node materials here; the Sprite constructor type still names SpriteMaterial.\n super(pointMaterial as unknown as SpriteMaterial)\n }\n}\n","import * as THREE from 'three/webgpu'\nimport {\n DEFAULT_HIGHLIGHT_OPACITY,\n type ColorStyle,\n type DisplayInfoConfig,\n type OcclusionStyle,\n type OpacityStyle,\n} from '../typings/style'\nimport { IObject3D } from '../../shared-utils/three/IObject3D'\nimport { anyPositionToVector3 } from '../../shared-utils/positionToVector3'\nimport type { PointData } from '../utils/data'\nimport { notNil } from '../../shared-utils'\nimport { LightTag } from '../../shared-utils/tag'\nimport { localToWorld } from '../../shared-utils/three/applyObjectMatrixWorld'\nimport { getFiveFromParentChain } from '../../shared-utils/five/getFiveFromParentChain'\nimport type { Five } from '@realsee/five-webgpu'\nimport { getLengthHTML } from '../utils/Meshes/getLengthHTML'\nimport { RenderDom } from '../utils/renderDom'\nexport type { PointData } from '../utils/data'\n\nexport const circleImageURL =\n 'data:image/png;base64,' +\n 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg=='\n\nlet sharedCircleTexture: THREE.Texture | null = null\n\nimport { PointSprite } from '../../shared-utils/three/PointSprite'\n\nexport type PointStyle = ColorStyle & { size: number } & OcclusionStyle & Partial<DisplayInfoConfig> & OpacityStyle\n\nexport class PointMesh extends IObject3D {\n public name = 'PointMesh'\n\n public get color() {\n return this.fontMesh.pointMaterial.color\n }\n\n public get size() {\n return this.fontMesh.pointMaterial.size\n }\n\n public get style() {\n return {\n color: this.color,\n size: this.size,\n opacity: this.fontMesh.pointMaterial.opacity,\n occlusionVisibility: this.fontMesh.pointMaterial.depthTest,\n occlusionMode: this.backgroundMesh.visible ? 'depthWrite' : 'depthTest',\n }\n }\n\n public dom: LightTag\n\n private opacityBeforeHighlight: number\n private highlighted = false\n\n private fontMesh: PointSprite\n private backgroundMesh: PointSprite\n\n private lastRenderDomItem: string\n\n private paramsStyle: Partial<PointStyle>\n\n private _visible = true\n\n private get five(): Five | undefined {\n return getFiveFromParentChain(this)\n }\n\n public constructor(params?: Partial<PointStyle & PointData>) {\n super()\n\n const { point, ...paramsStyle } = params ?? {}\n\n this.paramsStyle = paramsStyle ?? {}\n\n\n const materialParams = {\n positionNode: THREE.TSL.vec3(0),\n transparent: true,\n side: THREE.DoubleSide,\n size: params?.size ?? 8,\n map: sharedCircleTexture || (sharedCircleTexture = new THREE.TextureLoader().load(circleImageURL)),\n sizeAttenuation: false,\n }\n\n // 上层\n const materialFront = new THREE.PointsNodeMaterial({\n ...materialParams,\n color: params?.color ?? 0xffffff,\n depthTest: true,\n opacity: params?.opacity ?? 1,\n })\n\n // 下层\n const materialBackground = new THREE.PointsNodeMaterial({\n ...materialParams,\n size: materialFront.size,\n color: materialFront.color,\n depthWrite: false,\n depthTest: false,\n opacity: materialFront.opacity * 0.5,\n })\n\n const fontMesh = new PointSprite(materialFront)\n const backgroundMesh = new PointSprite(materialBackground)\n\n this.fontMesh = fontMesh\n this.backgroundMesh = backgroundMesh\n\n fontMesh.name = 'FontMesh'\n backgroundMesh.name = 'BackgroundMesh'\n\n fontMesh.renderOrder = 10\n backgroundMesh.renderOrder = 0\n\n this.add(fontMesh, backgroundMesh)\n\n if (params?.point) {\n this.position.copy(anyPositionToVector3(params.point))\n }\n\n if (params) this.setStyle(params)\n\n this.addEventListener('removed', () => {\n RenderDom.cacheObject.delete(this)\n RenderDom.checkDom(this)\n })\n this.addEventListener('added', () => {\n RenderDom.cacheObject.add(this)\n })\n\n RenderDom.checkDomEveryFrame()\n }\n\n public setStyle(params: Partial<PointStyle>) {\n if (notNil(params.color)) {\n this.fontMesh.pointMaterial.setValues({ color: params.color })\n this.backgroundMesh.pointMaterial.setValues({ color: params.color })\n }\n if (notNil(params.size)) {\n this.fontMesh.pointMaterial.setValues({ size: params.size })\n this.backgroundMesh.pointMaterial.setValues({ size: params.size })\n }\n if (notNil(params.occlusionVisibility)) {\n if (params.occlusionVisibility) {\n if (params.occlusionMode === 'depthTest') {\n this.fontMesh.pointMaterial.depthTest = false\n this.backgroundMesh.visible = false\n } else {\n this.fontMesh.pointMaterial.depthTest = true\n this.backgroundMesh.visible = true\n }\n } else {\n this.fontMesh.pointMaterial.depthTest = true\n this.backgroundMesh.visible = false\n }\n }\n }\n\n public highlight() {\n if (this.highlighted) return\n this.highlighted = true\n this.opacityBeforeHighlight = this.fontMesh.pointMaterial.opacity\n this.fontMesh.pointMaterial.setValues({ opacity: this.opacityBeforeHighlight * DEFAULT_HIGHLIGHT_OPACITY })\n }\n\n public unhighlight() {\n if (!this.highlighted) return\n this.highlighted = false\n this.fontMesh.pointMaterial.setValues({ opacity: this.opacityBeforeHighlight })\n }\n\n public updateMatrixWorld(force?: boolean) {\n super.updateMatrixWorld(force)\n const lastRenderDomItem = localToWorld(this, this.position).toArray().join(',')\n if (lastRenderDomItem !== this.lastRenderDomItem) {\n this.updateDom()\n this.lastRenderDomItem = lastRenderDomItem\n }\n }\n\n public _onAdded = () => {\n if (!this.dom) this.updateDom()\n }\n\n public _onRemoved = () => {\n this.dom?.destroy()\n this.dom = undefined\n }\n\n public _onShowed = () => {\n if (this.dom) this.dom.container.style.display = 'block'\n }\n\n public _onHidden = () => {\n if (this.dom) this.dom.container.style.display = 'none'\n }\n\n private updateDom() {\n const tip = this.paramsStyle.tip\n if (tip && !this.dom && this.five) {\n this.dom = new LightTag(this.five)\n this.dom.intersectCheck = false\n this.dom.simulate3D = true\n this.dom.container.style.display = this.visible ? 'block' : 'none'\n }\n\n const render = (str: string | HTMLElement | null) => {\n if (!this.dom) return\n\n if ((this.dom as any).__text === str) return\n ;(this.dom as any).__text = str\n\n if (str instanceof HTMLElement) {\n this.dom.container.innerHTML = ''\n this.dom.container.appendChild(str)\n } else if (str) {\n this.dom.container.innerHTML = getLengthHTML(str, {\n style: '',\n offsetY: -20, // 移动label到点的上方,否则会遮挡鼠标选点\n })\n } else {\n this.dom.container.innerHTML = ''\n }\n }\n\n if (!tip) {\n render(null)\n } else {\n render(tip)\n this.dom.setPosition(this.position.clone())\n }\n }\n}\n","import { anyPositionToVector3, type AnyPositions } from '../../shared-utils/positionToVector3'\nimport { PointMesh } from './Point'\nimport { notNil } from '../../shared-utils'\nimport { LineMesh, type LineMeshStyle } from './Line'\nimport { IObject3D } from '../../shared-utils/three/IObject3D'\nimport type { PointsData } from '../utils/data'\nimport type { Color } from '../typings/style'\nimport type { Overwrite } from '../../typings/utils.type'\n\ntype Style = LineMeshStyle & {\n pointVisibility?: boolean | { startPoint?: boolean; endPoint?: boolean }\n /**\n * 点颜色\n */\n pointColor?: Color\n /**\n * 点透明度\n */\n pointOpacity?: number\n /**\n * 线颜色\n */\n lineColor?: Color\n /**\n * 线透明度\n */\n lineOpacity?: number\n}\n\n/**\n * Represents a mesh that consists of a line with dots at the start and end points.\n */\nexport class LineWithDotsMesh extends LineMesh {\n public name = 'LineWithDotsMesh'\n\n public pointGroup: Overwrite<IObject3D, { children: Array<PointMesh> }> = new IObject3D() as any\n private _paramsStyle: Style\n\n public get startPoint() {\n return this.pointMeshes[0]\n }\n public get endPoint() {\n if (this.pointMeshes.length < 2) return null\n return this.pointMeshes[this.pointMeshes.length - 1]\n }\n public get visiblePointMeshes() {\n return this.pointMeshes.filter((p) => p.visible)\n }\n public get pointMeshes() {\n return this.pointGroup.children as PointMesh[]\n }\n\n public constructor(params?: Partial<Style & PointsData>) {\n super()\n this.add(this.pointGroup)\n\n if (params) this.setStyle(params)\n if (params?.points) {\n this.setPoints(params.points)\n }\n }\n\n public setPoints(points: AnyPositions) {\n super.setPoints(points)\n const vectors = points.map(anyPositionToVector3).filter(notNil)\n\n this.pointGroup.removeChildren()\n this.addIfNotExists(this.pointGroup)\n\n vectors.forEach((vector) => {\n const pointMesh = new PointMesh({\n ...this.style,\n color: this._paramsStyle?.pointColor ?? this._paramsStyle?.lineColor,\n tip: undefined,\n })\n pointMesh.position.copy(vector)\n this.pointGroup.add(pointMesh)\n })\n\n this.updateEdgePointsVisibility()\n\n this.needsRender = true\n }\n\n public setStyle = (style: Partial<Style>) => {\n super.setStyle(style)\n this._paramsStyle = { ...this._paramsStyle, ...style }\n this.pointMeshes.forEach((pointMesh) =>\n pointMesh.setStyle({ ...this._paramsStyle, color: this._paramsStyle?.pointColor ?? this._paramsStyle?.lineColor, tip: undefined }),\n )\n this.updateEdgePointsVisibility()\n this.needsRender = true\n }\n\n public highlight = (params?: { color?: Color }) => {\n super.highlight(params)\n this.pointMeshes.forEach((pointMesh) => pointMesh.highlight())\n }\n\n public unhighlight = () => {\n super.unhighlight()\n this.pointMeshes.forEach((pointMesh) => pointMesh.unhighlight())\n }\n\n private updateEdgePointsVisibility = () => {\n if (notNil(this._paramsStyle?.pointVisibility)) {\n if (this.startPoint)\n this.startPoint.visible =\n typeof this._paramsStyle.pointVisibility === 'object'\n ? this._paramsStyle.pointVisibility.startPoint\n : this._paramsStyle.pointVisibility\n if (this.endPoint)\n this.endPoint.visible =\n typeof this._paramsStyle.pointVisibility === 'object'\n ? this._paramsStyle.pointVisibility.endPoint\n : this._paramsStyle.pointVisibility\n }\n }\n}\n","import * as THREE from 'three/webgpu'\nimport {\n DEFAULT_COLOR,\n type ColorStyle,\n type OpacityStyle,\n type OcclusionStyle,\n DEFAULT_HIGHLIGHT_OPACITY,\n DEFAULT_OPACITY,\n type Color,\n} from '../../typings/style'\nimport { IObject3D } from '../../../shared-utils/three/IObject3D'\nimport { notNil } from '../../../shared-utils'\n\nexport type ColoredMeshStyle = OpacityStyle & ColorStyle & OcclusionStyle\n\nexport default class ColoredMesh<\n TGeometry extends THREE.BufferGeometry = THREE.BufferGeometry,\n> extends IObject3D {\n public name = 'ColoredMesh'\n\n public meshFont: THREE.Mesh<TGeometry, THREE.MeshBasicMaterial>\n public meshBackground: THREE.Mesh<TGeometry, THREE.MeshBasicMaterial>\n\n public get style() {\n return {\n color: this.color,\n opacity: this.opacity,\n occlusionVisibility: this.occlusionVisibility,\n occlusionMode: this.occlusionMode,\n }\n }\n\n public get color() {\n return this.meshFont.material.color\n }\n\n public get opacity() {\n return this.meshFont.material.opacity\n }\n\n public get occlusionVisibility() {\n return Boolean(this.meshBackground.parent) || this.meshFont.material.depthTest === false\n }\n\n public get occlusionMode(): 'depthTest' | 'translucence' {\n return this.meshFont.material.depthTest === false ? 'depthTest' : 'translucence'\n }\n\n public set geometry(geometry: TGeometry) {\n this._geometry = geometry\n this.meshFont.geometry = geometry\n this.meshBackground.geometry = geometry\n }\n\n public get geometry() {\n return this._geometry\n }\n\n private paramsStyle: Partial<ColoredMeshStyle> = {}\n\n private _geometry: TGeometry = new THREE.BufferGeometry() as TGeometry\n\n private highlighted = false\n private opacityBeforeHighlight: number\n private colorBeforeHighlight: Color\n\n public constructor(params?: Partial<ColoredMeshStyle>) {\n super()\n\n this.paramsStyle = params ?? {}\n // 蓝的\n const materialFront = new THREE.MeshBasicMaterial({\n color: new THREE.Color(params?.color ?? DEFAULT_COLOR), // Three converts sRGB literals to its linear working space.\n transparent: true,\n side: THREE.DoubleSide,\n depthTest: true,\n depthWrite: false,\n opacity: params?.opacity ?? DEFAULT_OPACITY,\n })\n // 白的\n const materialBackground = new THREE.MeshBasicMaterial({\n color: 0xffffff,\n transparent: true,\n side: THREE.DoubleSide,\n depthTest: false,\n depthWrite: false,\n opacity: (0.3 / 0.5) * materialFront.opacity,\n })\n\n const meshFront = new THREE.Mesh(this.geometry, materialFront)\n const meshBackground = new THREE.Mesh(this.geometry, materialBackground)\n\n meshFront.name = 'MeshFront'\n meshBackground.name = 'MeshBackground'\n\n // 让蓝色的在白色的上面\n meshFront.renderOrder = 1\n meshBackground.renderOrder = 0\n\n this.meshFont = meshFront\n this.meshBackground = meshBackground\n\n this.add(meshFront)\n\n this.setOcclusionVisibility({ occlusionVisibility: params?.occlusionVisibility, occlusionMode: params?.occlusionMode })\n }\n\n public setStyle(params: Partial<ColoredMeshStyle>) {\n this.paramsStyle = { ...this.paramsStyle, ...params }\n if (notNil(params.color)) {\n this.meshFont.material.color.set(new THREE.Color(params.color))\n this.needsRender = true\n }\n if (notNil(params.opacity)) {\n this.meshFont.material.opacity = params.opacity\n this.meshBackground.material.opacity = (0.3 / 0.5) * this.meshFont.material.opacity\n this.needsRender = true\n }\n this.setOcclusionVisibility(params)\n }\n\n public highlight(params?: { color?: Color }) {\n this.highlighted = true\n\n if (notNil(params?.color)) {\n this.colorBeforeHighlight = this.colorBeforeHighlight ?? this.meshFont.material.color.clone()\n this.meshFont.material.color.set(new THREE.Color(params.color))\n } else {\n this.opacityBeforeHighlight = this.opacityBeforeHighlight ?? this.opacity\n this.meshFont.material.opacity = this.opacity * DEFAULT_HIGHLIGHT_OPACITY\n this.meshBackground.material.opacity = (0.3 / 0.5) * this.meshFont.material.opacity\n }\n\n this.needsRender = true\n }\n\n public unhighlight() {\n this.highlighted = false\n\n if (notNil(this.opacityBeforeHighlight)) {\n this.meshFont.material.opacity = this.opacityBeforeHighlight\n this.meshBackground.material.opacity = (0.3 / 0.5) * this.meshFont.material.opacity\n this.opacityBeforeHighlight = undefined\n }\n\n if (notNil(this.colorBeforeHighlight)) {\n this.meshFont.material.color = new THREE.Color(this.colorBeforeHighlight)\n this.colorBeforeHighlight = undefined\n }\n\n this.needsRender = true\n }\n\n private setOcclusionVisibility(params: Partial<OcclusionStyle>) {\n const occlusionMode = params.occlusionMode ?? this.paramsStyle.occlusionMode ?? 'translucence'\n const occlusionVisibility = params.occlusionVisibility ?? this.paramsStyle.occlusionVisibility\n if (notNil(occlusionVisibility)) {\n if (occlusionVisibility) {\n if (occlusionMode === 'depthTest') {\n this.meshFont.material.depthTest = false\n this.remove(this.meshBackground)\n } else if (occlusionMode === 'translucence') {\n this.meshFont.material.depthTest = true\n this.addIfNotExists(this.meshBackground)\n }\n } else {\n this.meshFont.material.depthTest = true\n this.remove(this.meshBackground)\n }\n }\n }\n}\n","import * as THREE from 'three/webgpu'\nimport generatePolygonGeometry from '../../shared-utils/three/generatePolygonGeometry'\nimport { anyPositionToVector3, type AnyPositions } from '../../shared-utils/positionToVector3'\nimport ColoredMesh, { type ColoredMeshStyle } from '../utils/three/ColoredMesh'\nimport { getGeometryInfo } from '../../shared-utils/three/geometryUtil'\nimport type { PointsData } from '../utils/data'\nimport { LightTag } from '../../shared-utils/tag'\nimport { getLengthHTML } from '../utils/Meshes/getLengthHTML'\nimport { localToWorld } from '../../shared-utils/three/applyObjectMatrixWorld'\nimport { getFiveFromParentChain } from '../../shared-utils/five/getFiveFromParentChain'\nimport type { Five } from '@realsee/five-webgpu'\nimport { notNil } from '../../shared-utils'\nimport type { LengthConfig } from '../typings/style'\nimport { transformUnitSquare } from '../utils/unit'\nimport { RenderDom } from '../utils/renderDom'\n\nexport const blankGeometry: THREE.BufferGeometry & { isBlank: true } = new THREE.BufferGeometry() as any\nblankGeometry.name = 'blankGeometry'\nblankGeometry.isBlank = true\n\nexport type PolygonStyle = ColoredMeshStyle & LengthConfig\n\nexport type PolygonData = PointsData\n\nexport class PolygonMesh extends ColoredMesh<THREE.BufferGeometry> {\n public name = 'PolygonMesh'\n\n public get normal() {\n if (this.points.length >= 3) {\n return new THREE.Vector3()\n .crossVectors(this.points[1].clone().sub(this.points[0]), this.points[2].clone().sub(this.points[0]))\n .normalize()\n } else {\n return new THREE.Vector3(0, 0, 1)\n }\n }\n\n public get style() {\n return { ...super.style, lengthEnable: this._paramsStyle.lengthEnable }\n }\n\n public get isBlank() {\n return Boolean((this.geometry as any).isBlank)\n }\n\n public get center() {\n return this.geometryInfo?.center.clone()\n }\n\n public get geometryInfo() {\n if (this.geometryInfoNeedUpdate) {\n if (this.isBlank) {\n this._geometryInfo = null\n } else {\n this._geometryInfo = getGeometryInfo(this.geometry)\n }\n this.geometryInfoNeedUpdate = false\n }\n return this._geometryInfo\n }\n\n public points: THREE.Vector3[] = []\n\n public planeHelperNeedUpdate = true\n public geometryInfoNeedUpdate = true\n\n public _paramsStyle: Partial<PolygonStyle>\n\n public areaDom?: LightTag\n\n private get five(): Five | undefined {\n return getFiveFromParentChain(this)\n }\n\n private planeHelper: THREE.Plane | null = null\n private _geometryInfo: { area: number; center: THREE.Vector3 } | null = null\n\n private lastRenderAreaItem: string\n\n public constructor(params?: Partial<PolygonStyle & PolygonData>) {\n super(params)\n\n if (params?.points) this.setPoints(params.points)\n this._paramsStyle = params ?? {}\n this.updateAreaItems()\n\n this.addEventListener('removed', () => {\n RenderDom.cacheObject.delete(this)\n RenderDom.checkDom(this)\n })\n this.addEventListener('added', () => {\n RenderDom.cacheObject.add(this)\n })\n\n RenderDom.checkDomEveryFrame()\n }\n\n public updateMatrixWorld(force?: boolean) {\n super.updateMatrixWorld(force)\n if (this.center) {\n const lastRenderAreaItem = localToWorld(this, this.center).toArray().join(',')\n if (lastRenderAreaItem !== this.lastRenderAreaItem) {\n this.updateAreaItems()\n this.lastRenderAreaItem = lastRenderAreaItem\n }\n }\n }\n\n public setStyle(params: Partial<ColoredMeshStyle>): void {\n this._paramsStyle = { ...this._paramsStyle, ...params }\n super.setStyle(this._paramsStyle)\n\n const occlusionVisibility = this._paramsStyle.occlusionVisibility ?? true\n if (this.areaDom) this.areaDom.intersectCheck = !occlusionVisibility\n\n this.updateAreaItems()\n }\n\n public setPoints(points: AnyPositions, config?: { checkLinesIntersect?: boolean }): void {\n const vectors = points.map(anyPositionToVector3)\n this.points = vectors\n\n this.geometry = generatePolygonGeometry(this.points, { checkLinesIntersect: config?.checkLinesIntersect ?? true }) ?? blankGeometry\n\n this.planeHelperNeedUpdate = true\n this.geometryInfoNeedUpdate = true\n\n this.updateAreaItems()\n }\n\n /**\n * @description: 获取一个点投影在当前平面上的点\n */\n public projectPoint(point: THREE.Vector3) {\n if (!point) return point\n\n if (this.planeHelperNeedUpdate) this.updatePlaneHelper()\n\n return this.planeHelper ? this.planeHelper.projectPoint(point, new THREE.Vector3()) : point\n }\n\n public _onAdded = () => {\n if (!this.areaDom) this.updateAreaItems()\n }\n\n public _onRemoved = () => {\n this.areaDom?.destroy()\n this.areaDom = undefined\n }\n\n public _onShowed = () => {\n if (this.areaDom) this.areaDom.container.style.display = 'block'\n }\n\n public _onHidden = () => {\n if (this.areaDom) this.areaDom.container.style.display = 'none'\n }\n\n private updatePlaneHelper() {\n if (this.points.length >= 3) {\n this.planeHelper = new THREE.Plane().setFromCoplanarPoints(this.points[0], this.points[1], this.points[2])\n } else {\n this.planeHelper = null\n }\n this.planeHelperNeedUpdate = false\n }\n\n private updateAreaItems() {\n const clear = () => {\n this.areaDom?.destroy()\n this.areaDom = undefined\n }\n if (!this._paramsStyle.lengthEnable) return clear()\n if (!this.geometryInfo) return clear()\n\n if (!this.five) return console.error('Five not found')\n\n this.areaDom =\n this.areaDom ??\n (() => {\n const tag = new LightTag(this.five)\n const occlusionVisibility = this._paramsStyle.occlusionVisibility ?? true\n tag.intersectCheck = !occlusionVisibility\n tag.simulate3D = true\n return tag\n })()\n\n this.areaDom.setPosition(this.center)\n const areaString = transformUnitSquare(this.geometryInfo.area, this._paramsStyle.lengthUnit)\n\n if (!areaString) {\n this.areaDom.container.innerHTML = ''\n } else {\n this.areaDom.container.innerHTML = getLengthHTML(areaString, {\n style: `color: #FFFFFF; background: #3366FF`,\n })\n }\n }\n}\n"],"mappings":";;;;;;;AAGA,IAAac,IAAb,cAAiCC,EAAO;CACH;CAAnC,YAAmB,GAAmD;EAAnC,AAEjC,MAAMC,CAA0C,GAFf,KAAA,gBAAAA;CAGnC;AACF,GCgBIC,IAA4C,MAMnCC,IAAb,cAA+BP,EAAU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,IAAMC,IAAM,IAAIlD,EAAS,KAAK,IAAI;GAIlC,OAFA,EAAI,iBAAiB,EADO,KAAK,aAAa,uBAAuB,KAErE,EAAI,aAAa,IACVkD;EACT,EAAA,CAAG,GAEL,KAAK,QAAQ,YAAY,KAAK,MAAM;EACpC,IAAMC,IAAahD,EAAoB,KAAK,aAAa,MAAM,KAAK,aAAa,UAAU;EAE3F,AAAKgD,IAGH,KAAK,QAAQ,UAAU,YAAY/C,EAAc+C,GAAY,EAC3D,OAAO,sCACT,CAAC,IAJD,KAAK,QAAQ,UAAU,YAAY;CAMvC;AACF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as e, o as t, r as n, s as r } from "./generatePolygonGeometry-BOnzdCaG.js";
|
|
2
2
|
import { i } from "./util-vGeVT4oo.js";
|
|
3
3
|
import { n as a } from "./getNormal-BatLuzsS.js";
|
|
4
4
|
import { i as o } from "./resizeObserver-AY-35us4.js";
|
|
5
5
|
import { r as s } from "./Line2-CDxLMjGj.js";
|
|
6
|
-
import { n as c, r as l, t as u } from "./Polygon-
|
|
6
|
+
import { n as c, r as l, t as u } from "./Polygon-D3xIL1Pl.js";
|
|
7
7
|
import * as d from "three/webgpu";
|
|
8
8
|
import { AnimationFrameLoop as f } from "@realsee/five-webgpu";
|
|
9
9
|
//#region src/shared-utils/three/closeVectors.ts
|
|
@@ -338,27 +338,27 @@ var b = class extends d.BufferGeometry {
|
|
|
338
338
|
get geometryInfo() {
|
|
339
339
|
if (this.geometryInfoNeedUpdate) {
|
|
340
340
|
this.geometryInfoNeedUpdate = !1;
|
|
341
|
-
let
|
|
342
|
-
if (!
|
|
341
|
+
let e = this.prismMesh.geometry.bottomPositions, n = this.prismMesh.geometry.topPosition;
|
|
342
|
+
if (!e || e.length < 3 || !n) {
|
|
343
343
|
this._geometryInfoCache = void 0;
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
|
-
let i =
|
|
347
|
-
new d.Vector3().fromArray(
|
|
348
|
-
new d.Vector3().fromArray(n
|
|
349
|
-
new d.Vector3().fromArray(n
|
|
346
|
+
let i = e.map((t, n) => n >= e.length - 2 ? null : [
|
|
347
|
+
new d.Vector3().fromArray(e[0]),
|
|
348
|
+
new d.Vector3().fromArray(e[n + 1]),
|
|
349
|
+
new d.Vector3().fromArray(e[n + 2])
|
|
350
350
|
]).filter(Boolean);
|
|
351
351
|
if (i.length === 0) {
|
|
352
352
|
this._geometryInfoCache = void 0;
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
355
|
let a = 0, o = new d.Vector3();
|
|
356
|
-
for (let [
|
|
357
|
-
let i = e
|
|
356
|
+
for (let [e, n, s] of i) {
|
|
357
|
+
let i = t(e, n, s), c = r(e, n, s, i);
|
|
358
358
|
a += i, o.add(c);
|
|
359
359
|
}
|
|
360
360
|
o = o.divideScalar(a);
|
|
361
|
-
let s = new d.Vector3().fromArray(
|
|
361
|
+
let s = new d.Vector3().fromArray(n).sub(new d.Vector3().fromArray(e[0])), c = o.clone().add(s.divideScalar(2));
|
|
362
362
|
this._geometryInfoCache = { center: c };
|
|
363
363
|
}
|
|
364
364
|
return this._geometryInfoCache;
|
|
@@ -377,7 +377,7 @@ var b = class extends d.BufferGeometry {
|
|
|
377
377
|
}
|
|
378
378
|
_geometryInfoCache;
|
|
379
379
|
geometryInfoNeedUpdate = !0;
|
|
380
|
-
edgeMesh = new
|
|
380
|
+
edgeMesh = new e();
|
|
381
381
|
prismMesh = new c();
|
|
382
382
|
paramStyle;
|
|
383
383
|
constructor(e) {
|
|
@@ -481,4 +481,4 @@ var b = class extends d.BufferGeometry {
|
|
|
481
481
|
//#endregion
|
|
482
482
|
export { g as i, _ as n, h as r, C as t };
|
|
483
483
|
|
|
484
|
-
//# sourceMappingURL=Prism-
|
|
484
|
+
//# sourceMappingURL=Prism-CJlyAEAU.js.map
|