@realsee/dnalogel 3.78.0-alpha.3 → 3.78.0
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 +40 -10
- package/dist/DigitalPerformancePlugin/controller/index.d.ts +224 -0
- package/dist/DigitalPerformancePlugin/core/DigitalHuman.d.ts +55 -0
- package/dist/DigitalPerformancePlugin/core/DigitalPlayground.d.ts +40 -0
- package/dist/DigitalPerformancePlugin/core/DigitalStateMachine.d.ts +150 -0
- package/dist/DigitalPerformancePlugin/core/Trace.d.ts +9 -0
- package/dist/DigitalPerformancePlugin/index.d.ts +11 -0
- package/dist/DigitalPerformancePlugin/mock.d.ts +76 -0
- package/dist/DigitalPerformancePlugin/typings/index.d.ts +79 -0
- package/dist/PanoTagPlugin/controller/Tag/MaskTag.shaders.d.ts +0 -6
- package/dist/PanoTagPlugin/typings/tag/TagConfig.d.ts +20 -2
- package/dist/PanoTagPlugin/utils/tagPosition.d.ts +2 -1
- package/dist/Sculpt/Meshes/Line.d.ts +4 -0
- package/dist/Sculpt/Objects/Base/Editor.d.ts +9 -2
- package/dist/index.cjs.js +101 -88
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14196 -12441
- package/dist/index.umd.js +83 -70
- package/dist/shared-utils/five/getFiveFromParentChain.d.ts +8 -0
- package/libs/AreaMakerPlugin/Controller.js +3 -2
- package/libs/AreaMakerPlugin/index.js +3 -2
- package/libs/AreaMakerPlugin/utils/Item.js +3 -2
- package/libs/CSS3DRenderPlugin/Controller.js +3 -2
- package/libs/CSS3DRenderPlugin/index.js +6 -5
- package/libs/CSS3DRenderPlugin/utils/three/CSS3DObject.js +39 -38
- package/libs/CSS3DRenderPlugin/utils/three/CSS3DRender.js +10 -9
- package/libs/CruisePlugin/BaseController.js +5 -4
- package/libs/CruisePlugin/Move.js +3 -2
- package/libs/CruisePlugin/Work.js +3 -2
- package/libs/CruisePlugin/index.js +7 -6
- package/libs/CurrentPanoImagePlugin/Controller.js +15 -14
- package/libs/CurrentPanoImagePlugin/index.js +4 -3
- package/libs/DigitalPerformancePlugin/controller/index.d.ts +2 -2
- package/libs/DigitalPerformancePlugin/controller/index.js +164 -173
- package/libs/DigitalPerformancePlugin/core/DigitalHuman.d.ts +16 -6
- package/libs/DigitalPerformancePlugin/core/DigitalHuman.js +128 -102
- package/libs/DigitalPerformancePlugin/core/DigitalPlayground.d.ts +11 -5
- package/libs/DigitalPerformancePlugin/core/DigitalPlayground.js +84 -74
- package/libs/DigitalPerformancePlugin/core/DigitalStateMachine.d.ts +7 -0
- package/libs/DigitalPerformancePlugin/mock.d.ts +6 -0
- package/libs/DigitalPerformancePlugin/mock.js +272 -274
- package/libs/GuideLinePlugin/Controller.js +7 -6
- package/libs/GuideLinePlugin/GuideLineItem.js +5 -4
- package/libs/GuideLinePlugin/GuideLineModeItem/index.js +51 -48
- package/libs/GuideLinePlugin/GuideLineModeItem.js +5 -2
- package/libs/GuideLinePlugin/index.js +7 -6
- package/libs/MeasurePlugin/Controller.js +11 -10
- package/libs/MeasurePlugin/index.js +5 -4
- package/libs/MeasurePlugin/utils/MeasureMesh.js +3 -2
- package/libs/ModelChassisCompassPlugin/Plugin.js +4 -3
- package/libs/ModelChassisCompassPlugin/index.js +1 -0
- package/libs/ModelEntryDoorGuidePlugin/Plugin.js +6 -5
- package/libs/ModelEntryDoorGuidePlugin/index.js +1 -0
- package/libs/ModelMakerPlugin/Controller.js +3 -2
- package/libs/ModelMakerPlugin/index.js +3 -2
- package/libs/ModelMakerPlugin/item/baseItem.js +3 -2
- package/libs/ModelMakerPlugin/item/boxItem.js +3 -2
- package/libs/ModelMakerPlugin/item/polygonItem.js +3 -2
- package/libs/ModelMakerPlugin/item/prismItem.js +3 -2
- package/libs/ModelTVVideoPlugin/Plugin.js +4 -3
- package/libs/ModelTVVideoPlugin/index.js +3 -2
- package/libs/ModelViewPlugin/Plugin.js +20 -19
- package/libs/ModelViewPlugin/index.js +1 -0
- package/libs/Object3DHelperPlugin/Controller.js +3 -2
- package/libs/Object3DHelperPlugin/index.js +6 -5
- package/libs/PanoCompassPlugin/Controller.js +3 -2
- package/libs/PanoCompassPlugin/index.js +4 -3
- package/libs/PanoDoorLabelPlugin/Controller.js +24 -23
- package/libs/PanoDoorLabelPlugin/index.js +4 -3
- package/libs/PanoMeasurePlugin/Components/Controller0.js +3 -2
- package/libs/PanoMeasurePlugin/Components/Controller1.js +3 -2
- package/libs/PanoMeasurePlugin/Controller/EditController.js +3 -2
- package/libs/PanoMeasurePlugin/Controller/WatchController.js +3 -2
- package/libs/PanoMeasurePlugin/Controller/index.js +3 -2
- package/libs/PanoMeasurePlugin/Model/area.js +3 -2
- package/libs/PanoMeasurePlugin/Modules/Magnifier.js +1 -0
- package/libs/PanoMeasurePlugin/Modules/UIController/index.js +16 -15
- package/libs/PanoMeasurePlugin/index.js +14 -13
- package/libs/PanoMeasurePlugin/utils/dom/areaDom.js +3 -2
- package/libs/PanoRulerProPlugin/Controller.js +3 -2
- package/libs/PanoRulerProPlugin/RulerItems.js +42 -41
- package/libs/PanoRulerProPlugin/index.js +4 -3
- package/libs/PanoSpatialTagPlugin/Plugin.js +34 -33
- package/libs/PanoSpatialTagPlugin/index.js +1 -0
- package/libs/PanoTagPlugin/Components/Common/TagPoint.js +141 -138
- package/libs/PanoTagPlugin/Components/Common/TagPopover/PopoverContent.js +3 -2
- package/libs/PanoTagPlugin/Components/Common/TagPopover/TagPopoverToolBar.js +3 -2
- package/libs/PanoTagPlugin/Components/Common/TagPopover/index.js +3 -2
- package/libs/PanoTagPlugin/Components/Tag/MarketingTag.js +3 -2
- package/libs/PanoTagPlugin/Components/Tag/index.js +3 -2
- package/libs/PanoTagPlugin/Components/TagContainer.js +3 -2
- package/libs/PanoTagPlugin/Components/TagItem.js +131 -122
- package/libs/PanoTagPlugin/controller/Tag/BaseTag.js +50 -49
- package/libs/PanoTagPlugin/controller/Tag/BoxTag.js +69 -65
- package/libs/PanoTagPlugin/controller/Tag/MaskTag.js +1 -0
- package/libs/PanoTagPlugin/controller/Tag/MaskTag.shaders.d.ts +0 -6
- package/libs/PanoTagPlugin/controller/Tag/MaskTag.shaders.js +2 -90
- package/libs/PanoTagPlugin/controller/Tag/ModelTag.js +3 -2
- package/libs/PanoTagPlugin/controller/Tag/PlaneTag.js +3 -2
- package/libs/PanoTagPlugin/controller/Tag/PointTag.js +3 -2
- package/libs/PanoTagPlugin/controller/Tag/PolygonTag.js +31 -29
- package/libs/PanoTagPlugin/controller/TagRender.js +3 -2
- package/libs/PanoTagPlugin/controller/TagUtil.js +3 -2
- package/libs/PanoTagPlugin/controller/index.js +30 -29
- package/libs/PanoTagPlugin/index.js +12 -11
- package/libs/PanoTagPlugin/typings/tag/TagConfig.d.ts +20 -2
- package/libs/PanoTagPlugin/utils/index.js +31 -30
- package/libs/PanoTagPlugin/utils/tag/calculateTagConfig.js +3 -2
- package/libs/PanoTagPlugin/utils/tag/format.js +3 -2
- package/libs/PanoTagPlugin/utils/tagPosition.d.ts +2 -1
- package/libs/PanoTagPlugin/utils/tagPosition.js +34 -32
- package/libs/PanoVideoPlugin/Controller.js +9 -8
- package/libs/PanoVideoPlugin/VideoMeshController.js +3 -2
- package/libs/PanoVideoPlugin/index.js +6 -5
- package/libs/PipelinePlugin/Controller.js +3 -2
- package/libs/PipelinePlugin/index.js +4 -3
- package/libs/PipelinePlugin/utils/Objects/FlowPipe.js +3 -2
- package/libs/PipelinePlugin/utils/Objects/HighlightPipe.js +3 -2
- package/libs/PipelinePlugin/utils/Objects/Pipe.js +1 -0
- package/libs/Sculpt/Meshes/Line.d.ts +4 -0
- package/libs/Sculpt/Meshes/Line.js +85 -76
- package/libs/Sculpt/Meshes/Point.js +28 -28
- package/libs/Sculpt/Meshes/Polygon.js +43 -43
- package/libs/Sculpt/Objects/Base/Editor.d.ts +9 -2
- package/libs/Sculpt/Objects/Base/Editor.js +72 -63
- package/libs/Sculpt/index.js +1 -1
- package/libs/Sculpt/utils/Modules/Cursor.js +7 -7
- package/libs/base/BasePlugin.js +5 -5
- package/libs/floorplan/FloorplanGuidePlugin/Controller.js +3 -2
- package/libs/floorplan/FloorplanGuidePlugin/index.js +4 -3
- package/libs/floorplan/MapviewFloorplanPlugin/Controller.js +3 -2
- package/libs/floorplan/MapviewFloorplanPlugin/index.js +4 -3
- package/libs/floorplan/ModelFloorplanPlugin/Controller.js +3 -2
- package/libs/floorplan/ModelFloorplanPlugin/index.js +4 -3
- package/libs/floorplan/PanoFloorplanRadarPlugin/Controller.js +3 -2
- package/libs/floorplan/PanoFloorplanRadarPlugin/index.js +4 -3
- package/libs/floorplan/TopviewFloorplanPlugin/Controller.js +3 -2
- package/libs/floorplan/TopviewFloorplanPlugin/index.js +4 -3
- package/libs/index.d.ts +1 -0
- package/libs/index.js +162 -150
- package/libs/shared-utils/five/getFiveFromParentChain.d.ts +8 -0
- package/libs/shared-utils/five/getFiveFromParentChain.js +20 -0
- package/libs/shared-utils/logger.js +1 -1
- package/libs/shared-utils/three/PointSelector/utils/PointHelper2.js +1 -0
- package/libs/shared-utils/url/replace-static-prefix.js +12 -7
- package/package.json +3 -3
- package/libs/PanoTagPlugin/controller/Tag/MaskTag1.d.ts +0 -202
- package/libs/PanoTagPlugin/controller/Tag/MaskTag1.js +0 -617
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var Q = Object.defineProperty, Y = Object.defineProperties;
|
|
2
2
|
var ee = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var V = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var $ = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var P = Math.pow, D = (g, t, e) => t in g ? Q(g, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : g[t] = e, y = (g, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
7
|
+
$.call(t, e) && D(g, e, t[e]);
|
|
8
8
|
if (V)
|
|
9
9
|
for (var e of V(t))
|
|
10
10
|
z.call(t, e) && D(g, e, t[e]);
|
|
@@ -13,7 +13,7 @@ var k = Math.pow, D = (g, t, e) => t in g ? Q(g, t, { enumerable: !0, configurab
|
|
|
13
13
|
var W = (g, t) => {
|
|
14
14
|
var e = {};
|
|
15
15
|
for (var i in g)
|
|
16
|
-
|
|
16
|
+
$.call(g, i) && t.indexOf(i) < 0 && (e[i] = g[i]);
|
|
17
17
|
if (g != null && V)
|
|
18
18
|
for (var i of V(g))
|
|
19
19
|
t.indexOf(i) < 0 && z.call(g, i) && (e[i] = g[i]);
|
|
@@ -41,13 +41,13 @@ import { calculateTagConfig as R } from "../../utils/tag/calculateTagConfig.js";
|
|
|
41
41
|
import { getTagStickType as ie } from "../../utils/tag/format.js";
|
|
42
42
|
import "../../../shared-utils/tag.js";
|
|
43
43
|
import { isPanoramaLike as E, isModelLike as B } from "../../../shared-utils/five/mode.js";
|
|
44
|
-
import * as
|
|
44
|
+
import * as k from "three";
|
|
45
45
|
import "../../../vendor/hammerjs/hammer.js";
|
|
46
46
|
import "../../../shared-utils/three/PointSelector/index.js";
|
|
47
47
|
import { centerPoint as ne } from "../../../shared-utils/three/centerPoint.js";
|
|
48
48
|
import "../../../shared-utils/three/CSS3DRenderer/index.js";
|
|
49
49
|
import "../../../CSS3DRenderPlugin/utils/generateBehindFiveElement.js";
|
|
50
|
-
import { anyPositionToVector3 as
|
|
50
|
+
import { anyPositionToVector3 as w } from "../../../shared-utils/positionToVector3.js";
|
|
51
51
|
import { toArray as se } from "../../../shared-utils/util.js";
|
|
52
52
|
import "@realsee/five/line";
|
|
53
53
|
import { isNil as J, notNil as H } from "../../../shared-utils/isNil.js";
|
|
@@ -58,19 +58,19 @@ import "../../../vendor/@tweenjs/tween/dist/tween.esm.js.js";
|
|
|
58
58
|
import "../../../CSS3DRenderPlugin/utils/three/CSS3DRender.js";
|
|
59
59
|
import "../../../vendor/earcut/src/earcut.js";
|
|
60
60
|
import { vectorToCoordinates as le } from "../../../shared-utils/vectorToCoordinate.js";
|
|
61
|
-
import { transformPosition as
|
|
61
|
+
import { transformPosition as O } from "../../../shared-utils/five/transformPosition.js";
|
|
62
62
|
import { lookPoint as ae } from "../../../shared-utils/five/lookPoint.js";
|
|
63
63
|
import { uuid as fe } from "../../../shared-utils/uuid.js";
|
|
64
64
|
import "../../../shared-utils/five/FivePuppet.js";
|
|
65
|
-
import { objectAssignDeepExports as
|
|
65
|
+
import { objectAssignDeepExports as T } from "../../../vendor/object-assign-deep/objectAssignDeep.js";
|
|
66
66
|
import { getTagPosition as q, getTagCenterPosition as X } from "../../utils/tagPosition.js";
|
|
67
67
|
import { checkRange as S } from "../../utils/checkRange.js";
|
|
68
|
-
import { isMediaPlaneTag as Z, isMediaModelTag as
|
|
68
|
+
import { isMediaPlaneTag as Z, isMediaModelTag as _ } from "../../utils/tag/tagCheck.js";
|
|
69
69
|
import { getUrlExt as G } from "../../../shared-utils/url/getUrl.js";
|
|
70
70
|
import { getFloorIndex as de } from "../../../shared-utils/five/getFloorIndex.js";
|
|
71
71
|
import { safeObj as K } from "../../../shared-utils/safeObj.js";
|
|
72
72
|
import { Cache as ce } from "../../utils/Cache.js";
|
|
73
|
-
import { _raycaster as
|
|
73
|
+
import { _raycaster as N } from "../../../shared-utils/three/temp.js";
|
|
74
74
|
import { withResolvers as ue } from "../../../shared-utils/promise/withResolvers.js";
|
|
75
75
|
import "../../../shared-utils/typescript/entries.js";
|
|
76
76
|
import "../../utils/tag/adaptConfig.js";
|
|
@@ -105,6 +105,7 @@ import "../../../Sculpt/typings/style.js";
|
|
|
105
105
|
import "../../../shared-utils/three/IObject3D.js";
|
|
106
106
|
import "../../../Sculpt/utils/Meshes/getLengthHTML.js";
|
|
107
107
|
import "../../../shared-utils/three/applyObjectMatrixWorld.js";
|
|
108
|
+
import "../../../shared-utils/five/getFiveFromParentChain.js";
|
|
108
109
|
import "../../../shared-utils/three/core/LineGeometry.js";
|
|
109
110
|
import "../../../shared-utils/three/core/LineMaterial.js";
|
|
110
111
|
import "../../../shared-utils/three/core/Line2.js";
|
|
@@ -122,7 +123,7 @@ import "../../../CSS3DRenderPlugin/utils/three/CSS3DScene.js";
|
|
|
122
123
|
import "../../../CSS3DRenderPlugin/utils/getAllCSS3DObject.js";
|
|
123
124
|
import "../../../CSS3DRenderPlugin/utils/three/CSS3DGroup.js";
|
|
124
125
|
import "../../../shared-utils/formatRad.js";
|
|
125
|
-
class
|
|
126
|
+
class Ht {
|
|
126
127
|
constructor(t, e) {
|
|
127
128
|
a(this, "plugin");
|
|
128
129
|
a(this, "id");
|
|
@@ -189,14 +190,14 @@ class Jt {
|
|
|
189
190
|
const s = JSON.parse(JSON.stringify(e.data)), o = (f = e.initialConfig) != null ? f : e.config ? JSON.parse(JSON.stringify(e.config)) : {};
|
|
190
191
|
e.initialConfig = o;
|
|
191
192
|
const l = R(e, t.config), r = this.getConfig(e);
|
|
192
|
-
e.config = r, this.id = (m = e.id) != null ? m : fe(), this.enabled = (p = e.enabled) != null ? p : !0, this.contentType = e.contentType, this.hoverEnabled = (c = (d = r.popoverConfig) == null ? void 0 : d.enabled) != null ? c : !0, this.data = (u = r.initialData) != null && u.important ?
|
|
193
|
+
e.config = r, this.id = (m = e.id) != null ? m : fe(), this.enabled = (p = e.enabled) != null ? p : !0, this.contentType = e.contentType, this.hoverEnabled = (c = (d = r.popoverConfig) == null ? void 0 : d.enabled) != null ? c : !0, this.data = (u = r.initialData) != null && u.important ? T(e.data, s, r.initialData) : T(e.data, r.initialData, s);
|
|
193
194
|
let n;
|
|
194
195
|
typeof r.unfoldedConfig == "object" ? r.unfoldedConfig.keep === "unfolded" ? n = !0 : r.unfoldedConfig.keep === "folded" ? n = !1 : n = !this.can("fold") : n = !this.can("fold"), this.state = y({
|
|
195
196
|
visible: void 0,
|
|
196
197
|
unfolded: n
|
|
197
198
|
}, r.initialState), this.isPopoverConfigEnabled() && (this.state.unfolded = !1), this.normalLineLength = (b = (v = e.style) == null ? void 0 : v.point) == null ? void 0 : b.normalLen, this.originPosition = e.position, e.originPosition = this.originPosition, this.position = (() => {
|
|
198
199
|
var U;
|
|
199
|
-
const h = e.originPosition,
|
|
200
|
+
const h = e.originPosition, x = t.workUtil.transform;
|
|
200
201
|
if (e.stickType === "3DBox") {
|
|
201
202
|
if (!h)
|
|
202
203
|
return {
|
|
@@ -204,25 +205,25 @@ class Jt {
|
|
|
204
205
|
end: [0, 0, 0],
|
|
205
206
|
rotation: [0, 0, 0]
|
|
206
207
|
};
|
|
207
|
-
const { start:
|
|
208
|
+
const { start: C, end: A, rotation: F } = h;
|
|
208
209
|
return {
|
|
209
|
-
start:
|
|
210
|
-
end:
|
|
211
|
-
rotation:
|
|
210
|
+
start: w(C.map((I) => Number(I))).toArray(),
|
|
211
|
+
end: w(A.map((I) => Number(I))).toArray(),
|
|
212
|
+
rotation: w(F.map((I) => Number(I))).toArray()
|
|
212
213
|
};
|
|
213
214
|
}
|
|
214
215
|
if (e.stickType === "Polygon")
|
|
215
|
-
return h ? h.map(
|
|
216
|
+
return h ? h.map(w).map((C) => O(C, x).toArray()) : [];
|
|
216
217
|
if (!h)
|
|
217
218
|
return;
|
|
218
|
-
let
|
|
219
|
-
if (Array.isArray(h) && h.length === 4 ?
|
|
220
|
-
const
|
|
221
|
-
|
|
219
|
+
let M = h;
|
|
220
|
+
if (Array.isArray(h) && h.length === 4 ? M = h.map(w).map((C) => O(C, x).toArray()) : M = O(w(h), x).toArray(), (e.stickType === "2DPoint" || e.stickType === "3DPoint") && ((U = r == null ? void 0 : r.tagNormalLineConfig) != null && U.enabled) && e.normal && this.normalLineLength) {
|
|
221
|
+
const C = new k.Vector3().fromArray(e.normal);
|
|
222
|
+
M = new k.Vector3().fromArray(M).clone().add(C.clone().setLength(this.normalLineLength)).toArray();
|
|
222
223
|
}
|
|
223
|
-
return
|
|
224
|
+
return M;
|
|
224
225
|
})(), this.matrix = e.matrix ? (() => {
|
|
225
|
-
const h = new
|
|
226
|
+
const h = new k.Matrix4().fromArray(e.matrix);
|
|
226
227
|
return h.premultiply(t.workUtil.transform), h.elements;
|
|
227
228
|
})() : e.matrix, this.initialConfig = o, this.computedConfig = l, this.stickType = i, this.config = e.config, this.fiveState = e.fiveState, this.normal = e.normal, this.cache = new ce(), this.hooks = new te(), Object.keys(e).forEach((h) => {
|
|
228
229
|
this[h] === void 0 && e[h] !== void 0 && (this[h] = e[h]);
|
|
@@ -325,8 +326,8 @@ class Jt {
|
|
|
325
326
|
c.push(this.dom), c.push((b = (v = this.tag3DContentSvelte) == null ? void 0 : v.css3DInstance) == null ? void 0 : b.container), c.push((h = this.model) == null ? void 0 : h.object), c.push(this.mediaPlane), c.push(this.boxShape), c.push(this.polygonShape);
|
|
326
327
|
const u = this.getAdditionalBlinkTargets();
|
|
327
328
|
if (u) {
|
|
328
|
-
const
|
|
329
|
-
c.push(...
|
|
329
|
+
const x = Array.isArray(u) ? u : [u];
|
|
330
|
+
c.push(...x);
|
|
330
331
|
}
|
|
331
332
|
return c.filter(Boolean);
|
|
332
333
|
})();
|
|
@@ -398,7 +399,7 @@ class Jt {
|
|
|
398
399
|
* @param deepMerge 是否深度合并 data,默认为 true
|
|
399
400
|
*/
|
|
400
401
|
setData(t, e = !0) {
|
|
401
|
-
e ? this.data =
|
|
402
|
+
e ? this.data = T(this.data, t) : this.data = y(y({}, this.data), t), this.hooks.emit("dataChanged", this.data);
|
|
402
403
|
}
|
|
403
404
|
/**
|
|
404
405
|
* @description 修改标签位置
|
|
@@ -411,7 +412,7 @@ class Jt {
|
|
|
411
412
|
* @param deepMerge 是否深度合并 data,默认为 true
|
|
412
413
|
*/
|
|
413
414
|
set(t, e = !0) {
|
|
414
|
-
this.plugin.tagsLengthWillUpdate = !0, e ?
|
|
415
|
+
this.plugin.tagsLengthWillUpdate = !0, e ? T(this, t) : Object.assign(this, t), this.cache.clear();
|
|
415
416
|
}
|
|
416
417
|
updateConfig() {
|
|
417
418
|
var i;
|
|
@@ -420,7 +421,7 @@ class Jt {
|
|
|
420
421
|
const e = this.getConfig();
|
|
421
422
|
if (this.config = e, this.config.initialData) {
|
|
422
423
|
const s = JSON.parse(JSON.stringify(this.data));
|
|
423
|
-
this.data = (i = e.initialData) != null && i.important ?
|
|
424
|
+
this.data = (i = e.initialData) != null && i.important ? T(this.data, s, e.initialData) : T(this.data, e.initialData, s);
|
|
424
425
|
}
|
|
425
426
|
this.cache.clear();
|
|
426
427
|
}
|
|
@@ -450,17 +451,17 @@ class Jt {
|
|
|
450
451
|
if (!i || !i.start)
|
|
451
452
|
return 1 / 0;
|
|
452
453
|
const s = i.start;
|
|
453
|
-
return
|
|
454
|
+
return P(s[0] - t.x, 2) + P(s[1] - t.y, 2) + P(s[2] - t.z, 2);
|
|
454
455
|
}
|
|
455
456
|
if (this.stickType === "Polygon") {
|
|
456
457
|
const i = this.position;
|
|
457
458
|
if (!i || i.length === 0)
|
|
458
459
|
return 1 / 0;
|
|
459
460
|
const s = i[0];
|
|
460
|
-
return
|
|
461
|
+
return P(s[0] - t.x, 2) + P(s[1] - t.y, 2) + P(s[2] - t.z, 2);
|
|
461
462
|
}
|
|
462
463
|
let e;
|
|
463
|
-
return this.position || console.log(this, "no position"), Array.isArray(this.position[0]) ? e = this.position[0] : e = this.position,
|
|
464
|
+
return this.position || console.log(this, "no position"), Array.isArray(this.position[0]) ? e = this.position[0] : e = this.position, P(e[0] - t.x, 2) + P(e[1] - t.y, 2) + P(e[2] - t.z, 2);
|
|
464
465
|
}
|
|
465
466
|
getVisible(t) {
|
|
466
467
|
if (!this.enabled || !this.plugin.state.enabled || !this.fiveUtil.model)
|
|
@@ -519,7 +520,7 @@ class Jt {
|
|
|
519
520
|
if (i[0].type === "Image")
|
|
520
521
|
return G(i[0].url) === "gif" ? "Dom" : "Mesh";
|
|
521
522
|
}
|
|
522
|
-
} else if (
|
|
523
|
+
} else if (_(this))
|
|
523
524
|
return i.length === 1 && i[0].type === "Image" ? G(i[0].url) === "gif" ? "Dom" : "Mesh" : "BehindDom";
|
|
524
525
|
}
|
|
525
526
|
})();
|
|
@@ -647,21 +648,21 @@ class Jt {
|
|
|
647
648
|
);
|
|
648
649
|
let l = 0, r = 0;
|
|
649
650
|
for (const d of o) {
|
|
650
|
-
const c = new
|
|
651
|
+
const c = new k.Vector3().subVectors(d, s).normalize();
|
|
651
652
|
let u;
|
|
652
|
-
|
|
653
|
-
const [v] = this.fiveUtil.model.intersectRaycaster(
|
|
653
|
+
N.set(s, c);
|
|
654
|
+
const [v] = this.fiveUtil.model.intersectRaycaster(N);
|
|
654
655
|
u = v == null ? void 0 : v.distance;
|
|
655
656
|
const b = (() => {
|
|
656
|
-
if (!
|
|
657
|
+
if (!_(this))
|
|
657
658
|
return;
|
|
658
|
-
const
|
|
659
|
-
var
|
|
660
|
-
return (
|
|
661
|
-
}).filter(H), [A] =
|
|
659
|
+
const C = this.plugin.tags.filter(_).map((F) => {
|
|
660
|
+
var I;
|
|
661
|
+
return (I = F.model) == null ? void 0 : I.object;
|
|
662
|
+
}).filter(H), [A] = N.intersectObjects(C, !0);
|
|
662
663
|
return A;
|
|
663
|
-
})(), h = s.distanceTo(d),
|
|
664
|
-
u = Math.min(u != null ? u : 1 / 0, (m = b == null ? void 0 : b.distance) != null ? m : 1 / 0), u +
|
|
664
|
+
})(), h = s.distanceTo(d), x = (f = e.distanceAccuracy) != null ? f : 0.01;
|
|
665
|
+
u = Math.min(u != null ? u : 1 / 0, (m = b == null ? void 0 : b.distance) != null ? m : 1 / 0), u + x >= h ? l++ : r++;
|
|
665
666
|
const U = (p = e.needPassed) != null ? p : 1;
|
|
666
667
|
if (l >= U)
|
|
667
668
|
return { value: !0 };
|
|
@@ -747,16 +748,16 @@ class Jt {
|
|
|
747
748
|
if (t.autoUnfold.strategy === "FoldWhenMove")
|
|
748
749
|
return !1;
|
|
749
750
|
if (t.autoUnfold.strategy === "ScreenCenter") {
|
|
750
|
-
const s = this.plugin.filterPointTag, o = new
|
|
751
|
+
const s = this.plugin.filterPointTag, o = new k.Matrix4();
|
|
751
752
|
o.multiplyMatrices(this.five.camera.projectionMatrix, this.five.camera.matrixWorldInverse);
|
|
752
|
-
const l = new
|
|
753
|
+
const l = new k.Frustum();
|
|
753
754
|
l.setFromProjectionMatrix(o);
|
|
754
|
-
const r = this.five.camera.getWorldDirection(new
|
|
755
|
+
const r = this.five.camera.getWorldDirection(new k.Vector3()), f = s.filter((p) => {
|
|
755
756
|
var v, b;
|
|
756
757
|
if (!p.currentVisible)
|
|
757
758
|
return !1;
|
|
758
759
|
const d = p.getConfig().unfoldedConfig;
|
|
759
|
-
if (p.manuallyOperated || typeof d != "object" || (d == null ? void 0 : d.autoUnfold) === !1 || ((v = d == null ? void 0 : d.autoUnfold) == null ? void 0 : v.strategy) !== "ScreenCenter" || d.keep || ((b = d.autoUnfold) == null ? void 0 : b.enable) === !1 || !l.containsPoint(new
|
|
760
|
+
if (p.manuallyOperated || typeof d != "object" || (d == null ? void 0 : d.autoUnfold) === !1 || ((v = d == null ? void 0 : d.autoUnfold) == null ? void 0 : v.strategy) !== "ScreenCenter" || d.keep || ((b = d.autoUnfold) == null ? void 0 : b.enable) === !1 || !l.containsPoint(new k.Vector3().fromArray(p.position)))
|
|
760
761
|
return !1;
|
|
761
762
|
const u = d.autoUnfold.distance;
|
|
762
763
|
if (u) {
|
|
@@ -766,7 +767,7 @@ class Jt {
|
|
|
766
767
|
}
|
|
767
768
|
return !0;
|
|
768
769
|
}).sort((p, d) => {
|
|
769
|
-
const c = new
|
|
770
|
+
const c = new k.Vector3().fromArray(p.position), u = new k.Vector3().fromArray(d.position);
|
|
770
771
|
return r.angleTo(c.sub(this.five.camera.position)) - r.angleTo(u.sub(this.five.camera.position));
|
|
771
772
|
}).findIndex((p) => p.id === this.id);
|
|
772
773
|
if (f === -1 || f <= ((i = t.autoUnfold.maxNumber) != null ? i : 1) - 1 === !1)
|
|
@@ -838,5 +839,5 @@ class Jt {
|
|
|
838
839
|
}
|
|
839
840
|
}
|
|
840
841
|
export {
|
|
841
|
-
|
|
842
|
+
Ht as BaseTag
|
|
842
843
|
};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
for (var t in
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
for (var t of
|
|
9
|
-
|
|
1
|
+
var P = Object.defineProperty;
|
|
2
|
+
var b = Object.getOwnPropertySymbols;
|
|
3
|
+
var E = Object.prototype.hasOwnProperty, B = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var S = (a, n, t) => n in a ? P(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t, y = (a, n) => {
|
|
5
|
+
for (var t in n || (n = {}))
|
|
6
|
+
E.call(n, t) && S(a, t, n[t]);
|
|
7
|
+
if (b)
|
|
8
|
+
for (var t of b(n))
|
|
9
|
+
B.call(n, t) && S(a, t, n[t]);
|
|
10
10
|
return a;
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var e = (
|
|
12
|
+
var f = (a, n, t) => (S(a, typeof n != "symbol" ? n + "" : n, t), t);
|
|
13
|
+
var g = (a, n, t) => new Promise((i, o) => {
|
|
14
|
+
var e = (p) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
} catch (
|
|
18
|
-
o(
|
|
16
|
+
l(t.next(p));
|
|
17
|
+
} catch (h) {
|
|
18
|
+
o(h);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, s = (p) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
} catch (
|
|
24
|
-
o(
|
|
22
|
+
l(t.throw(p));
|
|
23
|
+
} catch (h) {
|
|
24
|
+
o(h);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, l = (p) => p.done ? i(p.value) : Promise.resolve(p.value).then(e, s);
|
|
27
|
+
l((t = t.apply(a, n)).next());
|
|
28
28
|
});
|
|
29
|
-
import { BaseTag as
|
|
29
|
+
import { BaseTag as z } from "./BaseTag.js";
|
|
30
30
|
import * as r from "three";
|
|
31
|
-
import { Sculpt as
|
|
32
|
-
import { Box as
|
|
31
|
+
import { Sculpt as T } from "../../../Sculpt/index.js";
|
|
32
|
+
import { Box as D } from "../../../Sculpt/Objects/Box/index.js";
|
|
33
33
|
import "../../../shared-utils/tag.js";
|
|
34
34
|
import "../../../vendor/hammerjs/hammer.js";
|
|
35
35
|
import "../../../shared-utils/three/PointSelector/index.js";
|
|
@@ -43,10 +43,11 @@ import "../../../shared-utils/three/blink.js";
|
|
|
43
43
|
import "../../../vendor/@tweenjs/tween/dist/tween.esm.js.js";
|
|
44
44
|
import "../../../CSS3DRenderPlugin/utils/three/CSS3DRender.js";
|
|
45
45
|
import "../../../vendor/earcut/src/earcut.js";
|
|
46
|
-
import {
|
|
46
|
+
import { transformPosition as x } from "../../../shared-utils/five/transformPosition.js";
|
|
47
|
+
import { uuid as M } from "../../../shared-utils/uuid.js";
|
|
47
48
|
import "../../../shared-utils/five/FivePuppet.js";
|
|
48
|
-
import { getBoxCorners as
|
|
49
|
-
import { sculptDataToBoxPosition as
|
|
49
|
+
import { getBoxCorners as A, applyMatrixToPoints as F } from "../../utils/tagPosition.js";
|
|
50
|
+
import { sculptDataToBoxPosition as U } from "../../utils/sculptDataToBoxPosition.js";
|
|
50
51
|
import "../../../shared-utils/Subscribe.js";
|
|
51
52
|
import "../../utils/tag/calculateTagConfig.js";
|
|
52
53
|
import "../../../vendor/object-assign-deep/objectAssignDeep.js";
|
|
@@ -62,7 +63,6 @@ import "../../../shared-utils/util.js";
|
|
|
62
63
|
import "../../../shared-utils/isNil.js";
|
|
63
64
|
import "../../../shared-utils/vectorToCoordinate.js";
|
|
64
65
|
import "../../../shared-utils/formatRad.js";
|
|
65
|
-
import "../../../shared-utils/five/transformPosition.js";
|
|
66
66
|
import "../../../shared-utils/five/lookPoint.js";
|
|
67
67
|
import "../../../shared-utils/Utils/FiveUtil.js";
|
|
68
68
|
import "../../../shared-utils/Utils/BaseUtil.js";
|
|
@@ -100,6 +100,7 @@ import "../../../Sculpt/typings/style.js";
|
|
|
100
100
|
import "../../../shared-utils/three/IObject3D.js";
|
|
101
101
|
import "../../../Sculpt/utils/Meshes/getLengthHTML.js";
|
|
102
102
|
import "../../../shared-utils/three/applyObjectMatrixWorld.js";
|
|
103
|
+
import "../../../shared-utils/five/getFiveFromParentChain.js";
|
|
103
104
|
import "../../../shared-utils/three/core/LineGeometry.js";
|
|
104
105
|
import "../../../shared-utils/three/core/LineMaterial.js";
|
|
105
106
|
import "../../../shared-utils/three/core/Line2.js";
|
|
@@ -210,25 +211,25 @@ import "../../../shared-utils/forReverseEach.js";
|
|
|
210
211
|
import "../../../Sculpt/Objects/Line/index.js";
|
|
211
212
|
import "../../../Sculpt/Editors/BoxMeshEditor.js";
|
|
212
213
|
import "../../../Sculpt/Meshes/Box.js";
|
|
213
|
-
class
|
|
214
|
+
class ne extends z {
|
|
214
215
|
constructor(t, i) {
|
|
215
216
|
super(t, i);
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
f(this, "tagStyle");
|
|
218
|
+
f(this, "clickEventDispose");
|
|
219
|
+
f(this, "domClickDispose");
|
|
220
|
+
f(this, "screenPosition", null);
|
|
220
221
|
this.tagStyle = i.style, this.initializeSculptBox(), this.updateVisible();
|
|
221
222
|
}
|
|
222
223
|
/**
|
|
223
224
|
* 获取 Box 样式配置(合并用户配置和默认值)
|
|
224
225
|
*/
|
|
225
226
|
getBoxStyle() {
|
|
226
|
-
var i, o, e,
|
|
227
|
+
var i, o, e, s;
|
|
227
228
|
const t = ((i = this.tagStyle) == null ? void 0 : i.boxOrPolygon) || {};
|
|
228
229
|
return {
|
|
229
230
|
color: (o = t.color) != null ? o : 16777215,
|
|
230
231
|
opacity: (e = t.opacity) != null ? e : 0.4,
|
|
231
|
-
lineColor: (
|
|
232
|
+
lineColor: (s = t.color) != null ? s : 16777215,
|
|
232
233
|
lineWidth: 1
|
|
233
234
|
};
|
|
234
235
|
}
|
|
@@ -245,7 +246,7 @@ class ie extends C {
|
|
|
245
246
|
* 更新标签数据
|
|
246
247
|
*/
|
|
247
248
|
set(t, i = !0) {
|
|
248
|
-
super.set(t, i), t.style && (this.tagStyle =
|
|
249
|
+
super.set(t, i), t.style && (this.tagStyle = y(y({}, this.tagStyle), t.style)), t.position && (this.boxShape ? this.updateSculptBox() : this.initializeSculptBox()), t.style && this.boxShape && this.updateBoxStyle();
|
|
249
250
|
}
|
|
250
251
|
/**
|
|
251
252
|
* 设置标签数据
|
|
@@ -257,21 +258,21 @@ class ie extends C {
|
|
|
257
258
|
* 获取盒子的中心点
|
|
258
259
|
*/
|
|
259
260
|
getCenter() {
|
|
260
|
-
const t = this.
|
|
261
|
+
const t = this.position;
|
|
261
262
|
if (!(t != null && t.start) || !(t != null && t.end))
|
|
262
263
|
return [0, 0, 0];
|
|
263
|
-
const i = t.end.map((
|
|
264
|
-
return
|
|
264
|
+
const i = t.end.map((h) => Number(h)), o = t.start.map((h) => Number(h)), e = i[0] / 2 + o[0] / 2, s = i[1] / 2 + o[1] / 2, l = i[2] / 2 + o[2] / 2, p = new r.Vector3(e, s, l);
|
|
265
|
+
return x(p, this.workUtil.transform).toArray();
|
|
265
266
|
}
|
|
266
267
|
/**
|
|
267
268
|
* 获取盒子的8个角点坐标
|
|
268
269
|
*/
|
|
269
270
|
getCorners() {
|
|
270
271
|
if (this.boxShape) {
|
|
271
|
-
const t = this.boxShape.data, i = t.points.map((
|
|
272
|
+
const t = this.boxShape.data, i = t.points.map((s) => u(s)), o = new r.Vector3().subVectors(
|
|
272
273
|
u(t.heightPoint),
|
|
273
274
|
i[0]
|
|
274
|
-
), e = i.map((
|
|
275
|
+
), e = i.map((s) => s.clone().add(o));
|
|
275
276
|
return [...i, ...e];
|
|
276
277
|
}
|
|
277
278
|
return [];
|
|
@@ -295,13 +296,13 @@ class ie extends C {
|
|
|
295
296
|
const t = this.position;
|
|
296
297
|
if (!(t != null && t.start) || !(t != null && t.end) || !(t != null && t.rotation))
|
|
297
298
|
return;
|
|
298
|
-
const i = new
|
|
299
|
+
const i = new T(this.five, void 0, {
|
|
299
300
|
magnifier: null
|
|
300
301
|
});
|
|
301
302
|
i.clear(), i.group.removeFromParent();
|
|
302
|
-
const o = this.boxPositionToSculptData(t), e = this.getBoxStyle(),
|
|
303
|
+
const o = this.boxPositionToSculptData(t), e = this.getBoxStyle(), s = new D(
|
|
303
304
|
{
|
|
304
|
-
id:
|
|
305
|
+
id: M(),
|
|
305
306
|
type: "Box",
|
|
306
307
|
points: o.bottomPoints,
|
|
307
308
|
heightPoint: o.heightPoint,
|
|
@@ -313,9 +314,9 @@ class ie extends C {
|
|
|
313
314
|
// occlusionMode: 'translucence' as any,
|
|
314
315
|
}
|
|
315
316
|
);
|
|
316
|
-
|
|
317
|
+
s.visible = this.visible, this.plugin.imagePlaneGroup.add(s), this.boxShape = s, s.editor.hooks.on("objectUpdate", () => {
|
|
317
318
|
this.syncBoxPositionFromSculpt();
|
|
318
|
-
}),
|
|
319
|
+
}), s.editor.disable(), this.setupClickEvents();
|
|
319
320
|
}
|
|
320
321
|
/**
|
|
321
322
|
* 设置点击事件
|
|
@@ -366,7 +367,7 @@ class ie extends C {
|
|
|
366
367
|
* 用于编辑已存在的 Box
|
|
367
368
|
*/
|
|
368
369
|
editorEnable() {
|
|
369
|
-
return
|
|
370
|
+
return g(this, null, function* () {
|
|
370
371
|
if (!this.position) {
|
|
371
372
|
console.warn("[BoxTag] Cannot enable editor without position. Call startDrawing() first.");
|
|
372
373
|
return;
|
|
@@ -386,20 +387,23 @@ class ie extends C {
|
|
|
386
387
|
syncBoxPositionFromSculpt() {
|
|
387
388
|
if (!this.boxShape)
|
|
388
389
|
return;
|
|
389
|
-
const t = this.boxShape.data, i = t.points.map((
|
|
390
|
+
const t = this.boxShape.data, i = t.points.map((s) => u(s)), o = u(t.heightPoint), e = U(i, o);
|
|
390
391
|
this.position = e, this.hooks.emit("positionChanged", e);
|
|
391
392
|
}
|
|
392
393
|
/**
|
|
393
394
|
* 将 BoxPosition 转换为 Sculpt 需要的数据格式
|
|
394
395
|
*/
|
|
395
396
|
boxPositionToSculptData(t) {
|
|
396
|
-
const i = u(t.start), o = u(t.end), e = new r.Euler().fromArray(t.rotation),
|
|
397
|
+
const i = u(t.start), o = u(t.end), e = new r.Euler().fromArray(t.rotation), s = new r.Vector3((i.x + o.x) / 2, (i.y + o.y) / 2, (i.z + o.z) / 2), l = new r.Vector3(Math.abs(o.x - i.x) / 2, Math.abs(o.y - i.y) / 2, Math.abs(o.z - i.z) / 2), p = new r.Matrix4().makeRotationFromEuler(e), h = [
|
|
397
398
|
new r.Vector3(-0.5, -0.5, -0.5),
|
|
398
399
|
new r.Vector3(0.5, -0.5, -0.5),
|
|
399
400
|
new r.Vector3(0.5, -0.5, 0.5),
|
|
400
401
|
new r.Vector3(-0.5, -0.5, 0.5)
|
|
401
|
-
],
|
|
402
|
-
|
|
402
|
+
], d = new r.Vector3(-0.5, 0.5, -0.5), c = l.clone().multiplyScalar(2), m = this.workUtil.transform, v = h.map((V) => {
|
|
403
|
+
const C = V.clone().multiply(c).applyMatrix4(p).add(s);
|
|
404
|
+
return x(C, m);
|
|
405
|
+
}), w = d.clone().multiply(c).applyMatrix4(p).add(s), k = x(w, m);
|
|
406
|
+
return { bottomPoints: v, heightPoint: k };
|
|
403
407
|
}
|
|
404
408
|
/**
|
|
405
409
|
* @description 点击事件处理
|
|
@@ -453,7 +457,7 @@ class ie extends C {
|
|
|
453
457
|
this.screenPosition = null, this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
454
458
|
return;
|
|
455
459
|
}
|
|
456
|
-
const o = new r.Vector3().fromArray(i.start), e = new r.Vector3().fromArray(i.end),
|
|
460
|
+
const o = new r.Vector3().fromArray(i.start), e = new r.Vector3().fromArray(i.end), s = new r.Euler().fromArray(i.rotation), l = [
|
|
457
461
|
new r.Vector3(o.x, o.y, o.z),
|
|
458
462
|
new r.Vector3(e.x, o.y, o.z),
|
|
459
463
|
new r.Vector3(o.x, e.y, o.z),
|
|
@@ -462,29 +466,29 @@ class ie extends C {
|
|
|
462
466
|
new r.Vector3(e.x, o.y, e.z),
|
|
463
467
|
new r.Vector3(o.x, e.y, e.z),
|
|
464
468
|
new r.Vector3(e.x, e.y, e.z)
|
|
465
|
-
],
|
|
466
|
-
|
|
467
|
-
|
|
469
|
+
], p = new r.Vector3().addVectors(o, e).multiplyScalar(0.5), h = this.workUtil.transform;
|
|
470
|
+
l.forEach((m) => {
|
|
471
|
+
m.sub(p).applyEuler(s).add(p), m.copy(x(m, h));
|
|
468
472
|
});
|
|
469
|
-
let
|
|
470
|
-
|
|
471
|
-
|
|
473
|
+
let d = l[0];
|
|
474
|
+
l.forEach((m) => {
|
|
475
|
+
m.x > d.x && (d = m);
|
|
472
476
|
});
|
|
473
|
-
const
|
|
474
|
-
if (
|
|
477
|
+
const c = d.clone().project(this.five.camera);
|
|
478
|
+
if (c.x < -1 || c.x > 1 || c.y < -1 || c.y > 1 || c.z < 0 || c.z > 1)
|
|
475
479
|
this.screenPosition = null;
|
|
476
480
|
else if (this.five.renderer) {
|
|
477
|
-
const
|
|
481
|
+
const m = this.five.renderer.getSize(new r.Vector2());
|
|
478
482
|
this.screenPosition = {
|
|
479
|
-
leftPx: (
|
|
480
|
-
topPx: (-
|
|
483
|
+
leftPx: (c.x + 1) / 2 * m.x,
|
|
484
|
+
topPx: (-c.y + 1) / 2 * m.y,
|
|
481
485
|
scale: 1
|
|
482
486
|
};
|
|
483
487
|
}
|
|
484
488
|
this.plugin.addRenderQueue({ type: "TagContainerSvelte", keys: ["tags"] });
|
|
485
489
|
}
|
|
486
490
|
get centerPosition() {
|
|
487
|
-
const t =
|
|
491
|
+
const t = A(this.position, this.workUtil.transform), i = F(t, this.matrix);
|
|
488
492
|
let o = i[0];
|
|
489
493
|
return i.forEach((e) => {
|
|
490
494
|
e.x > o.x && (o = e);
|
|
@@ -508,5 +512,5 @@ class ie extends C {
|
|
|
508
512
|
}
|
|
509
513
|
}
|
|
510
514
|
export {
|
|
511
|
-
|
|
515
|
+
ne as BoxTag
|
|
512
516
|
};
|
|
@@ -85,6 +85,7 @@ import "../../../Sculpt/typings/style.js";
|
|
|
85
85
|
import "../../../shared-utils/three/IObject3D.js";
|
|
86
86
|
import "../../../Sculpt/utils/Meshes/getLengthHTML.js";
|
|
87
87
|
import "../../../shared-utils/three/applyObjectMatrixWorld.js";
|
|
88
|
+
import "../../../shared-utils/five/getFiveFromParentChain.js";
|
|
88
89
|
import "../../../shared-utils/three/core/LineGeometry.js";
|
|
89
90
|
import "../../../shared-utils/three/core/LineMaterial.js";
|
|
90
91
|
import "../../../shared-utils/three/core/Line2.js";
|
|
@@ -6,11 +6,5 @@
|
|
|
6
6
|
* Vertex Shader
|
|
7
7
|
*/
|
|
8
8
|
export declare const maskVertexShader = "\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";
|
|
9
|
-
/**
|
|
10
|
-
* Fragment Shader
|
|
11
|
-
* 实现颜色匹配和高亮渲染逻辑
|
|
12
|
-
* 参考 MosaicPlugin 的边缘检测实现
|
|
13
|
-
*/
|
|
14
|
-
export declare const maskFragmentShader = "\n#define RESOLUTION 2048.0\n\nvarying vec2 vUv;\nuniform sampler2D map;\nuniform vec4 color;\nuniform float tolerance;\nuniform vec3 highlightColor;\nuniform float opacity;\n\nfloat colorGap(vec3 color1, vec3 color2) {\n float gap = abs(color1.r - color2.r) + abs(color1.g - color2.g) + abs(color1.b - color2.b);\n return gap;\n}\n\n// \u5224\u65AD\u50CF\u7D20\u662F\u5426\u5339\u914D\u76EE\u6807\u989C\u8272\nbool isMatchingColor(vec3 pixelColor) {\n // \u6392\u9664\u9ED1\u8272\u50CF\u7D20\n if (pixelColor.r == 0.0 && pixelColor.g == 0.0 && pixelColor.b == 0.0) {\n return false;\n }\n return colorGap(pixelColor, color.rgb) < tolerance;\n}\n\n// \u8FB9\u7F18\u68C0\u6D4B\u51FD\u6570\uFF1A\u53C2\u8003 MosaicPlugin \u5B9E\u73B0\nfloat detectEdge(sampler2D map, vec2 uv) {\n vec4 centerColor = texture2D(map, uv);\n \n // \u5F53\u524D\u50CF\u7D20\u5FC5\u987B\u5339\u914D\u76EE\u6807\u989C\u8272\n if (!isMatchingColor(centerColor.rgb)) {\n return 0.0;\n }\n \n float step = 1.0 / RESOLUTION;\n \n // \u68C0\u67E54\u4E2A\u4E3B\u8981\u65B9\u5411\u7684\u90BB\u5C45\u50CF\u7D20\n vec4 upColor = texture2D(map, uv + vec2(0.0, -step));\n vec4 leftColor = texture2D(map, uv + vec2(-step, 0.0));\n vec4 rightColor = texture2D(map, uv + vec2(step, 0.0));\n vec4 downColor = texture2D(map, uv + vec2(0.0, step));\n \n // \u53EA\u6709\u5F53\u524D\u50CF\u7D20\u5339\u914D\u989C\u8272\uFF0C\u4E14\u81F3\u5C11\u6709\u4E00\u4E2A\u90BB\u5C45\u4E0D\u5339\u914D\u65F6\uFF0C\u624D\u662F\u8FB9\u7F18\n bool hasNonMatchingNeighbor = \n !isMatchingColor(upColor.rgb) || \n !isMatchingColor(leftColor.rgb) || \n !isMatchingColor(rightColor.rgb) || \n !isMatchingColor(downColor.rgb);\n \n return hasNonMatchingNeighbor ? 1.0 : 0.0;\n}\n\nvoid main() {\n vec4 image = texture2D(map, vUv);\n \n // \u6392\u9664\u9ED1\u8272\u50CF\u7D20\n if (image.r == 0.0 && image.g == 0.0 && image.b == 0.0) {\n discard;\n }\n \n // \u8BA1\u7B97\u5F53\u524D\u50CF\u7D20\u4E0E\u76EE\u6807\u989C\u8272\u7684\u5DEE\u5F02\n float gap = colorGap(image.rgb, color.rgb);\n \n // \u4F7F\u7528\u56FA\u5B9A\u5E73\u6ED1\u8303\u56F4\u5B9E\u73B0\u989C\u8272\u5339\u914D\u8FB9\u754C\n float smoothRange = 0.01;\n \n // \u5E73\u6ED1\u7684\u989C\u8272\u5339\u914D\u56E0\u5B50\uFF080-1\uFF09\n float matchFactor = 1.0 - smoothstep(tolerance - smoothRange, tolerance + smoothRange, gap);\n \n if (matchFactor > 0.0) {\n // \u4F7F\u7528\u65B0\u7684\u8FB9\u7F18\u68C0\u6D4B\u65B9\u6CD5\n float isEdge = detectEdge(map, vUv);\n \n // \u8FB9\u7F18\u4F7F\u7528\u5B8C\u5168\u4E0D\u900F\u660E\uFF0C\u5185\u90E8\u4F7F\u7528\u8BBE\u5B9A\u7684\u900F\u660E\u5EA6\n float alpha = mix(opacity, 1.0, isEdge);\n \n // \u5E94\u7528\u5339\u914D\u56E0\u5B50\u5B9E\u73B0\u8FB9\u754C\u5E73\u6ED1\uFF0C\u4F46\u4FDD\u7559\u6700\u5C0F 0.9 \u7684\u900F\u660E\u5EA6\n // \u8FD9\u6837\u5373\u4F7F\u5728\u8FB9\u754C\u5904\u4E5F\u4E0D\u4F1A\u5B8C\u5168\u900F\u660E\uFF0C\u540C\u65F6\u5B8C\u5168\u5339\u914D\u533A\u57DF\u4FDD\u6301\u8BBE\u5B9A\u7684\u900F\u660E\u5EA6\n alpha *= max(matchFactor, 0.9);\n \n gl_FragColor = vec4(highlightColor, alpha);\n } else {\n discard;\n }\n}\n";
|
|
15
9
|
/** 多 style:mergedTexture 中每组 3 像素为 color(id)/tolerance+highlight/opacity,用 color 作 id 匹配 */
|
|
16
10
|
export declare const maskFragmentShaderMulti = "\n#define RESOLUTION 2048.0\n#define MAX_GROUPS 64\n#define STRICT_MATCH 0.5/255.0\n\nvarying vec2 vUv;\nuniform sampler2D map;\nuniform sampler2D mergedTexture;\nuniform float groupCount;\nuniform float textureWidth;\nuniform float pixelsPerGroup;\n\nfloat colorGap(vec3 a, vec3 b) {\n return abs(a.r - b.r) + abs(a.g - b.g) + abs(a.b - b.b);\n}\n\nvec4 readStyleColor(float groupIndex) {\n float px = groupIndex * pixelsPerGroup;\n float texX = (px + 0.5) / textureWidth;\n return texture2D(mergedTexture, vec2(texX, 0.5));\n}\n\nvec4 readStyleToleranceHighlight(float groupIndex) {\n float px = groupIndex * pixelsPerGroup + 1.0;\n float texX = (px + 0.5) / textureWidth;\n return texture2D(mergedTexture, vec2(texX, 0.5));\n}\n\nfloat readStyleOpacity(float groupIndex) {\n float px = groupIndex * pixelsPerGroup + 2.0;\n float texX = (px + 0.5) / textureWidth;\n return texture2D(mergedTexture, vec2(texX, 0.5)).r;\n}\n\nfloat detectEdge(sampler2D map, vec2 uv, vec3 matchColor, float tolerance) {\n vec4 centerColor = texture2D(map, uv);\n if (colorGap(centerColor.rgb, matchColor) >= tolerance) return 0.0;\n float step = 1.0 / RESOLUTION;\n vec4 u = texture2D(map, uv + vec2(0.0, -step));\n vec4 l = texture2D(map, uv + vec2(-step, 0.0));\n vec4 r = texture2D(map, uv + vec2(step, 0.0));\n vec4 d = texture2D(map, uv + vec2(0.0, step));\n bool edge = colorGap(u.rgb, matchColor) >= tolerance || colorGap(l.rgb, matchColor) >= tolerance\n || colorGap(r.rgb, matchColor) >= tolerance || colorGap(d.rgb, matchColor) >= tolerance;\n return edge ? 1.0 : 0.0;\n}\n\nvoid main() {\n vec4 image = texture2D(map, vUv);\n if (image.r == 0.0 && image.g == 0.0 && image.b == 0.0) discard;\n\n // WebGL 1.0 \u8981\u6C42\u5FAA\u73AF\u7EC8\u6B62\u6761\u4EF6\u5FC5\u987B\u662F\u7F16\u8BD1\u65F6\u5E38\u91CF\uFF0C\u6240\u4EE5\u7528 MAX_GROUPS\uFF0C\u5FAA\u73AF\u5185\u68C0\u67E5 groupCount\n for (float i = 0.0; i < float(MAX_GROUPS); i += 1.0) {\n if (i < groupCount) {\n vec4 styleColor = readStyleColor(i);\n vec3 colorRgb = styleColor.rgb;\n float tol = readStyleToleranceHighlight(i).r * 3.0;\n vec3 highlight = readStyleToleranceHighlight(i).gba;\n float opacity = readStyleOpacity(i);\n \n if (opacity > 0.0) {\n float gap = colorGap(image.rgb, colorRgb);\n if (gap > STRICT_MATCH) continue;\n float smoothRange = 0.01;\n float matchFactor = 1.0 - smoothstep(tol - smoothRange, tol + smoothRange, gap);\n if (matchFactor > 0.0) {\n float isEdge = detectEdge(map, vUv, colorRgb, tol);\n float alpha = mix(opacity, 1.0, isEdge);\n alpha *= max(matchFactor, 0.9);\n gl_FragColor = vec4(highlight, alpha);\n return;\n }\n }\n }\n }\n discard;\n}\n";
|