viral-viewer-2 7.2.4 → 7.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/custom-objects/viral-bim-world.d.ts +0 -6
- package/dist/components/post-processing/post-processing-renderer.d.ts +5 -0
- package/dist/components/post-processing/selection-outline-pass.d.ts +21 -16
- package/dist/components/visibility-manager/viral-visibility-manager.d.ts +4 -7
- package/dist/index.mjs +996 -1013
- package/package.json +1 -1
- package/dist/components/worker/merge-positions.worker.d.ts +0 -19
- package/dist/components/worker-script/merge-positions.script.d.ts +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { Vector3 as E, Box3 as
|
|
2
|
-
import { SimplifyModifier as
|
|
3
|
-
import { LineSegmentsGeometry as
|
|
4
|
-
import { computeBoundsTree as
|
|
1
|
+
import { Vector3 as E, Box3 as j, Mesh as x, BufferAttribute as z, BufferGeometry as ne, EdgesGeometry as Mt, MeshBasicMaterial as q, PointLight as $t, Object3D as jt, InstancedMesh as oe, Color as $, InstancedBufferAttribute as bt, Matrix4 as se, LineSegments as wt, Line as mt, Points as Et, Clock as ii, AnimationMixer as si, Vector2 as H, Vector4 as ni, Quaternion as ri, Spherical as Ht, Sphere as Ft, Raycaster as It, MathUtils as ai, PerspectiveCamera as He, OrthographicCamera as Ct, Euler as oi, MeshPhongMaterial as gt, FrontSide as li, MeshStandardMaterial as K, DoubleSide as J, ObjectLoader as ci, WebGLRenderTarget as ue, DepthTexture as St, UnsignedShortType as At, ShaderMaterial as le, MeshNormalMaterial as hi, RGBAFormat as Wt, HalfFloatType as Gt, NearestFilter as Ot, WebGLRenderer as Ut, SRGBColorSpace as di, VSMShadowMap as ui, Scene as Tt, SphereGeometry as Dt, DirectionalLight as ut, AmbientLight as pi, CameraHelper as mi, BoxGeometry as Pt, AxesHelper as gi, BoxHelper as fi, Box3Helper as vi, PlaneGeometry as ae, Plane as he, Fog as bi, PointsMaterial as wi, LOD as yi, TextureLoader as xi, CanvasTexture as Rt, SpriteMaterial as Lt, Sprite as kt, LineBasicMaterial as Mi } from "three";
|
|
2
|
+
import { SimplifyModifier as Ei } from "three/examples/jsm/modifiers/SimplifyModifier";
|
|
3
|
+
import { LineSegmentsGeometry as qt, LineSegments2 as Qt, SSAARenderPass as Ci, FXAAShader as Si, TAARenderPass as Ai, SAOPass as _i, SSAOPass as pt } from "three/examples/jsm/Addons";
|
|
4
|
+
import { computeBoundsTree as Vi, disposeBoundsTree as Ii, acceleratedRaycast as Ti } from "three-mesh-bvh";
|
|
5
5
|
import pe from "camera-controls";
|
|
6
|
-
import { inflate as Pi, Inflate as
|
|
7
|
-
import { Potree as
|
|
8
|
-
import { GLTFLoader as
|
|
9
|
-
import { LineMaterial as
|
|
10
|
-
import { N8AOPass as
|
|
11
|
-
import { EffectComposer as
|
|
12
|
-
import { OutlinePass as
|
|
13
|
-
import { OutputPass as
|
|
14
|
-
import { RenderPass as
|
|
15
|
-
import { ShaderPass as
|
|
16
|
-
import { SMAAPass as
|
|
6
|
+
import { inflate as Pi, Inflate as Oi } from "pako";
|
|
7
|
+
import { Potree as Di, PointSizeType as Ri, PointShape as Li, PointColorType as ki } from "potree-core-viral";
|
|
8
|
+
import { GLTFLoader as Bi } from "three/examples/jsm/loaders/GLTFLoader";
|
|
9
|
+
import { LineMaterial as Zt } from "three/examples/jsm/lines/LineMaterial";
|
|
10
|
+
import { N8AOPass as zi } from "n8ao";
|
|
11
|
+
import { EffectComposer as Ni } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
12
|
+
import { OutlinePass as $i } from "three/examples/jsm/postprocessing/OutlinePass";
|
|
13
|
+
import { OutputPass as ji } from "three/examples/jsm/postprocessing/OutputPass";
|
|
14
|
+
import { RenderPass as Hi } from "three/examples/jsm/postprocessing/RenderPass";
|
|
15
|
+
import { ShaderPass as yt } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
16
|
+
import { SMAAPass as Fi } from "three/examples/jsm/postprocessing/SMAAPass";
|
|
17
17
|
import { GammaCorrectionShader as Wi } from "three/examples/jsm/shaders/GammaCorrectionShader";
|
|
18
|
-
import { Pass as
|
|
19
|
-
import { TransformControls as
|
|
20
|
-
import { LineSegments2 as
|
|
21
|
-
import { LineSegmentsGeometry as
|
|
22
|
-
class
|
|
18
|
+
import { Pass as Yt, FullScreenQuad as Xt } from "three/examples/jsm/postprocessing/Pass";
|
|
19
|
+
import { TransformControls as Gi } from "three/examples/jsm/controls/TransformControls";
|
|
20
|
+
import { LineSegments2 as Ui } from "three/examples/jsm/lines/LineSegments2";
|
|
21
|
+
import { LineSegmentsGeometry as qi } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
22
|
+
class ft {
|
|
23
23
|
static createElementFromHTML(e) {
|
|
24
24
|
const t = document.createElement("div");
|
|
25
25
|
return t.innerHTML = e.trim(), t.firstChild;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const Qi = {
|
|
29
29
|
background: "#ffffff",
|
|
30
30
|
primary: "#17312c",
|
|
31
31
|
secondary: "#56b77e",
|
|
@@ -37,18 +37,18 @@ const qi = {
|
|
|
37
37
|
added: "#16C47F",
|
|
38
38
|
modified: "#FFD65A",
|
|
39
39
|
notChanged: "#000000"
|
|
40
|
-
},
|
|
40
|
+
}, y = Qi;
|
|
41
41
|
class Q {
|
|
42
42
|
static information(e) {
|
|
43
43
|
console.log(
|
|
44
44
|
`%c ${e}`,
|
|
45
|
-
`color: ${
|
|
45
|
+
`color: ${y.primary}; background: ${y.background}; font-size: 16px;`
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
static error(e) {
|
|
49
49
|
console.log(
|
|
50
50
|
`%c ${e}`,
|
|
51
|
-
`color: ${
|
|
51
|
+
`color: ${y.accent}; background: ${y.background}; font-size: 16px;`
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
static memory(e) {
|
|
@@ -57,7 +57,7 @@ class Q {
|
|
|
57
57
|
) : console.log("Memory tracking is not supported in this browser.");
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
class
|
|
60
|
+
class R {
|
|
61
61
|
static middlePoint(e, t) {
|
|
62
62
|
return new E(
|
|
63
63
|
(e.x + t.x) / 2,
|
|
@@ -100,30 +100,30 @@ class D {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
static rgbToThreejsColor(e, t, i) {
|
|
103
|
-
return "#" +
|
|
103
|
+
return "#" + R.componentToHex(e) + R.componentToHex(t) + R.componentToHex(i);
|
|
104
104
|
}
|
|
105
105
|
static componentToHex(e) {
|
|
106
106
|
var t = e.toString(16);
|
|
107
107
|
return t.length == 1 ? "0" + t : t;
|
|
108
108
|
}
|
|
109
109
|
static mergeBoundingBoxes(e) {
|
|
110
|
-
const t = new
|
|
110
|
+
const t = new j();
|
|
111
111
|
return e.forEach((i) => {
|
|
112
112
|
t.union(i);
|
|
113
113
|
}), t;
|
|
114
114
|
}
|
|
115
115
|
static createLowResMesh(e, t = 0.5) {
|
|
116
|
-
const i = new
|
|
116
|
+
const i = new Ei();
|
|
117
117
|
console.log(e);
|
|
118
118
|
const s = i.modify(
|
|
119
119
|
e.geometry.clone(),
|
|
120
120
|
Math.floor(e.geometry.attributes.position.count * t)
|
|
121
121
|
);
|
|
122
|
-
return new
|
|
122
|
+
return new x(s, e.material);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
const
|
|
126
|
-
class Z extends
|
|
125
|
+
const Zi = R.hexToRGB(y.accent);
|
|
126
|
+
class Z extends x {
|
|
127
127
|
constructor(e, t, i) {
|
|
128
128
|
super(e, t), this.globalMaterialIndex = -1, this.workerPool = null, this._depthPrePassMesh = null, this._bufferElements = [], this._colors = null, this._originalColor = null, this._elementMap = /* @__PURE__ */ new Map(), this._isBatching = !1, this._batchQueue = [], this._isProcessingQueue = !1, this._edgeLines = null, this._edgeRanges = /* @__PURE__ */ new Map(), this._edgeThreshold = 60, this._edgeMaterial = null, this._selectedElements = [], this._hidingElements = [], this._isolatingElements = [], this._hiddenSet = /* @__PURE__ */ new Set(), this._isolatedSet = /* @__PURE__ */ new Set(), this._elementOpacityMap = /* @__PURE__ */ new Map(), this._isRGBAMode = !1, this._elementOriginalColors = /* @__PURE__ */ new Map(), this._temporaryColors = /* @__PURE__ */ new Map(), this._isGeneratedLights = !1, this._pointLight = null, this.workerPool = i || null;
|
|
129
129
|
}
|
|
@@ -156,7 +156,7 @@ class Z extends y {
|
|
|
156
156
|
indices: m
|
|
157
157
|
}), o += p;
|
|
158
158
|
}
|
|
159
|
-
this.geometry.setAttribute("position", new
|
|
159
|
+
this.geometry.setAttribute("position", new z(s, 3)), this.geometry.setAttribute("color", new z(r, 4)), this.geometry.setIndex(new z(n, 1)), this.geometry.computeVertexNormals(), this.geometry.computeBoundingSphere();
|
|
160
160
|
try {
|
|
161
161
|
this.geometry.computeBoundsTree();
|
|
162
162
|
} catch {
|
|
@@ -189,18 +189,18 @@ class Z extends y {
|
|
|
189
189
|
return;
|
|
190
190
|
const b = v.buffer.length / 3, w = [];
|
|
191
191
|
this._elementMap.has(v.modelId.toString()) || this._elementMap.set(v.modelId.toString(), /* @__PURE__ */ new Map());
|
|
192
|
-
const
|
|
193
|
-
for (let
|
|
194
|
-
c[u++] = v.buffer[
|
|
195
|
-
for (let
|
|
196
|
-
d[f++] = m +
|
|
192
|
+
const C = m;
|
|
193
|
+
for (let S = 0; S < b; S++)
|
|
194
|
+
c[u++] = v.buffer[S * 3], c[u++] = v.buffer[S * 3 + 1], c[u++] = v.buffer[S * 3 + 2], this._originalColor && (h[p++] = this._originalColor.r, h[p++] = this._originalColor.g, h[p++] = this._originalColor.b, h[p++] = 1);
|
|
195
|
+
for (let S = 0; S < b - 2; S += 3)
|
|
196
|
+
d[f++] = m + S, d[f++] = m + S + 1, d[f++] = m + S + 2, w.push(m + S, m + S + 1, m + S + 2);
|
|
197
197
|
const A = this._elementMap.get(v.modelId.toString());
|
|
198
198
|
A.has(v.elementId) || A.set(v.elementId, []), A.get(v.elementId).push({
|
|
199
|
-
start:
|
|
199
|
+
start: C,
|
|
200
200
|
count: b,
|
|
201
201
|
indices: w
|
|
202
202
|
}), m += b, this._bufferElements.push(v);
|
|
203
|
-
}), this.geometry.setAttribute("position", new
|
|
203
|
+
}), this.geometry.setAttribute("position", new z(c, 3)), this.geometry.setAttribute("color", new z(h, 4)), this.geometry.setIndex(new z(d, 1)), this.geometry.hasAttribute("normal") && this.geometry.deleteAttribute("normal"), this.geometry.computeVertexNormals(), this.geometry.boundingSphere = null, this.geometry.computeBoundingSphere();
|
|
204
204
|
try {
|
|
205
205
|
this.geometry.boundsTree && (this.geometry.boundsTree = null), this.geometry.computeBoundsTree();
|
|
206
206
|
} catch {
|
|
@@ -270,7 +270,7 @@ class Z extends y {
|
|
|
270
270
|
const { newPositions: t, newColors: i, newIndices: s, elementMappings: n } = e;
|
|
271
271
|
try {
|
|
272
272
|
const r = new Float32Array(t), o = new Float32Array(i), a = new Uint32Array(s);
|
|
273
|
-
this.geometry.setAttribute("position", new
|
|
273
|
+
this.geometry.setAttribute("position", new z(r, 3)), this.geometry.setAttribute("color", new z(o, 3)), this.geometry.setIndex(new z(a, 1)), n.forEach((l) => {
|
|
274
274
|
const { modelId: c, elementId: h, start: d, count: u, indices: p } = l;
|
|
275
275
|
this._elementMap.has(c) || this._elementMap.set(c, /* @__PURE__ */ new Map());
|
|
276
276
|
const m = this._elementMap.get(c);
|
|
@@ -329,19 +329,19 @@ class Z extends y {
|
|
|
329
329
|
if (this._edgeLines && (this.remove(this._edgeLines), this._edgeLines.geometry.dispose(), this._edgeLines = null), this._edgeRanges.clear(), !this._edgeMaterial)
|
|
330
330
|
return;
|
|
331
331
|
let e = 0;
|
|
332
|
-
const t = new
|
|
332
|
+
const t = new ne();
|
|
333
333
|
for (const o of this._bufferElements) {
|
|
334
334
|
const a = o.buffer;
|
|
335
335
|
if (!a || a.length < 9)
|
|
336
336
|
continue;
|
|
337
|
-
t.setAttribute("position", new
|
|
337
|
+
t.setAttribute("position", new z(a, 3));
|
|
338
338
|
const l = Math.floor(a.length / 3 / 3), c = new Uint32Array(l * 3);
|
|
339
339
|
for (let d = 0; d < l; d++) {
|
|
340
340
|
const u = d * 3;
|
|
341
341
|
c[u] = u, c[u + 1] = u + 1, c[u + 2] = u + 2;
|
|
342
342
|
}
|
|
343
|
-
t.setIndex(new
|
|
344
|
-
const h = new
|
|
343
|
+
t.setIndex(new z(c, 1));
|
|
344
|
+
const h = new Mt(t, this._edgeThreshold);
|
|
345
345
|
e += h.getAttribute("position").count, h.dispose(), t.deleteAttribute("position"), t.setIndex(null);
|
|
346
346
|
}
|
|
347
347
|
const i = new Float32Array(e * 3);
|
|
@@ -350,15 +350,15 @@ class Z extends y {
|
|
|
350
350
|
const a = o.buffer;
|
|
351
351
|
if (!a || a.length < 9)
|
|
352
352
|
continue;
|
|
353
|
-
const l = new
|
|
354
|
-
l.setAttribute("position", new
|
|
353
|
+
const l = new ne();
|
|
354
|
+
l.setAttribute("position", new z(a, 3));
|
|
355
355
|
const c = Math.floor(a.length / 3 / 3), h = new Uint32Array(c * 3);
|
|
356
356
|
for (let b = 0; b < c; b++) {
|
|
357
357
|
const w = b * 3;
|
|
358
358
|
h[w] = w, h[w + 1] = w + 1, h[w + 2] = w + 2;
|
|
359
359
|
}
|
|
360
|
-
l.setIndex(new
|
|
361
|
-
const d = new
|
|
360
|
+
l.setIndex(new z(h, 1));
|
|
361
|
+
const d = new Mt(l, this._edgeThreshold), u = d.getAttribute("position");
|
|
362
362
|
i.set(u.array, s * 3);
|
|
363
363
|
const p = s, m = u.count;
|
|
364
364
|
let f = this._edgeRanges.get(o.modelId.toString());
|
|
@@ -369,8 +369,8 @@ class Z extends y {
|
|
|
369
369
|
const n = new Uint32Array(e);
|
|
370
370
|
for (let o = 0; o < e; o++)
|
|
371
371
|
n[o] = o;
|
|
372
|
-
const r = new
|
|
373
|
-
r.setPositions(i), this._edgeLines = new
|
|
372
|
+
const r = new qt();
|
|
373
|
+
r.setPositions(i), this._edgeLines = new Qt(r, this._edgeMaterial), this.add(this._edgeLines);
|
|
374
374
|
}
|
|
375
375
|
/** Show edges ONLY for the given elements */
|
|
376
376
|
isolateEdge(e) {
|
|
@@ -391,7 +391,7 @@ class Z extends y {
|
|
|
391
391
|
let s = 0;
|
|
392
392
|
for (const n of t)
|
|
393
393
|
i[s++] = n;
|
|
394
|
-
this._edgeLines.geometry.setIndex(new
|
|
394
|
+
this._edgeLines.geometry.setIndex(new z(i, 1));
|
|
395
395
|
}
|
|
396
396
|
/** Hide edges for the given elements (keep all others) */
|
|
397
397
|
hideEdge(e) {
|
|
@@ -413,7 +413,7 @@ class Z extends y {
|
|
|
413
413
|
let n = 0;
|
|
414
414
|
for (let r = 0; r < i.length; r++)
|
|
415
415
|
i[r] && (s[n++] = r);
|
|
416
|
-
this._edgeLines.geometry.setIndex(new
|
|
416
|
+
this._edgeLines.geometry.setIndex(new z(s, 1));
|
|
417
417
|
}
|
|
418
418
|
/** Restore all edges */
|
|
419
419
|
edgeReset() {
|
|
@@ -422,14 +422,14 @@ class Z extends y {
|
|
|
422
422
|
const e = this._edgeLines.geometry.getAttribute("position"), t = new Uint32Array(e.count);
|
|
423
423
|
for (let i = 0; i < t.length; i++)
|
|
424
424
|
t[i] = i;
|
|
425
|
-
this._edgeLines.geometry.setIndex(new
|
|
425
|
+
this._edgeLines.geometry.setIndex(new z(t, 1));
|
|
426
426
|
}
|
|
427
427
|
//#region Selection
|
|
428
428
|
/**
|
|
429
429
|
* Select elements (highlights them with accent color)
|
|
430
430
|
*/
|
|
431
431
|
select(e, t = []) {
|
|
432
|
-
this.unselect(), this._selectedElements = e, this.changeColor(this._selectedElements,
|
|
432
|
+
this.unselect(), this._selectedElements = e, this.changeColor(this._selectedElements, Zi);
|
|
433
433
|
}
|
|
434
434
|
get selectedElements() {
|
|
435
435
|
return this._selectedElements;
|
|
@@ -617,7 +617,7 @@ class Z extends y {
|
|
|
617
617
|
*/
|
|
618
618
|
_createDepthPrePass() {
|
|
619
619
|
this._removeDepthPrePass();
|
|
620
|
-
const e = this.material, t = new
|
|
620
|
+
const e = this.material, t = new q({
|
|
621
621
|
vertexColors: !0,
|
|
622
622
|
transparent: !0,
|
|
623
623
|
alphaTest: 0.5,
|
|
@@ -625,7 +625,7 @@ class Z extends y {
|
|
|
625
625
|
depthWrite: !0,
|
|
626
626
|
side: e == null ? void 0 : e.side
|
|
627
627
|
});
|
|
628
|
-
this._depthPrePassMesh = new
|
|
628
|
+
this._depthPrePassMesh = new x(this.geometry, t), this._depthPrePassMesh.renderOrder = 0, this._depthPrePassMesh.matrixAutoUpdate = !1, this._depthPrePassMesh.matrixWorld.copy(this.matrixWorld), this.parent && this.parent.add(this._depthPrePassMesh);
|
|
629
629
|
}
|
|
630
630
|
/**
|
|
631
631
|
* Remove and dispose the depth pre-pass mesh
|
|
@@ -888,7 +888,7 @@ class Z extends y {
|
|
|
888
888
|
s[c] = a.r, s[c + 1] = a.g, s[c + 2] = a.b;
|
|
889
889
|
}
|
|
890
890
|
}
|
|
891
|
-
this.geometry.setAttribute("color", new
|
|
891
|
+
this.geometry.setAttribute("color", new z(s, t)), this.geometry.attributes.color.needsUpdate = !0, this._colors = s, console.log("✅ Unique colors assigned to each face.");
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
894
|
/**
|
|
@@ -956,8 +956,8 @@ class Z extends y {
|
|
|
956
956
|
n && e.push(n);
|
|
957
957
|
}
|
|
958
958
|
});
|
|
959
|
-
const t =
|
|
960
|
-
t && !this._pointLight && (this._pointLight = new
|
|
959
|
+
const t = R.getCenterPoint(e), i = this.getFarthestDistance(t, e);
|
|
960
|
+
t && !this._pointLight && (this._pointLight = new $t(16562741, 1, i, 0.1), this._pointLight.position.copy(t), this.add(this._pointLight)), this._isGeneratedLights = !0;
|
|
961
961
|
}
|
|
962
962
|
this._pointLight && (this._pointLight.visible = !0);
|
|
963
963
|
}
|
|
@@ -992,7 +992,7 @@ class Z extends y {
|
|
|
992
992
|
);
|
|
993
993
|
if (t.length === 0)
|
|
994
994
|
return null;
|
|
995
|
-
const i = new
|
|
995
|
+
const i = new j(), s = new E();
|
|
996
996
|
for (const n of t)
|
|
997
997
|
if (n.buffer)
|
|
998
998
|
for (let r = 0; r < n.buffer.length; r += 3)
|
|
@@ -1086,12 +1086,12 @@ class Z extends y {
|
|
|
1086
1086
|
}), this.geometry.index && this.geometry.setIndex(null)), this._edgeLines && (this._edgeLines.geometry && this._edgeLines.geometry.dispose(), this.remove(this._edgeLines), this._edgeLines = null), this.geometry = null;
|
|
1087
1087
|
}
|
|
1088
1088
|
}
|
|
1089
|
-
let
|
|
1089
|
+
let Yi = 1;
|
|
1090
1090
|
class Bt {
|
|
1091
1091
|
constructor(e) {
|
|
1092
1092
|
this._worker = new Worker(e), this._worker.onmessage = (t) => {
|
|
1093
1093
|
this._OnMessage(t);
|
|
1094
|
-
}, this._resolve = null, this._id =
|
|
1094
|
+
}, this._resolve = null, this._id = Yi++;
|
|
1095
1095
|
}
|
|
1096
1096
|
_OnMessage(e) {
|
|
1097
1097
|
const t = this._resolve;
|
|
@@ -1107,7 +1107,7 @@ class Bt {
|
|
|
1107
1107
|
this._worker.terminate();
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
|
-
class
|
|
1110
|
+
class ee {
|
|
1111
1111
|
/**
|
|
1112
1112
|
*
|
|
1113
1113
|
* @param maxSize maximum number of worker
|
|
@@ -1150,93 +1150,7 @@ class te {
|
|
|
1150
1150
|
this._workers.forEach((e) => e.dispose()), this._workers = [], this._free = [], this._busy = {}, this._queue = [];
|
|
1151
1151
|
}
|
|
1152
1152
|
}
|
|
1153
|
-
|
|
1154
|
-
self.onmessage = (g) => {
|
|
1155
|
-
const {
|
|
1156
|
-
bufferElements: e,
|
|
1157
|
-
selectedKeys: t
|
|
1158
|
-
} = g.data, i = new Set(t);
|
|
1159
|
-
let s = 0;
|
|
1160
|
-
for (const o of e) {
|
|
1161
|
-
const a = new Float32Array(o.buffer);
|
|
1162
|
-
if (o.instances && o.instances.length > 0)
|
|
1163
|
-
for (const l of o.instances) {
|
|
1164
|
-
const c = `${o.modelId}-${l.elementId}`;
|
|
1165
|
-
i.has(c) && (s += a.length);
|
|
1166
|
-
}
|
|
1167
|
-
else
|
|
1168
|
-
s += a.length;
|
|
1169
|
-
}
|
|
1170
|
-
if (s === 0) {
|
|
1171
|
-
self.postMessage({ positions: null });
|
|
1172
|
-
return;
|
|
1173
|
-
}
|
|
1174
|
-
const n = new Float32Array(s);
|
|
1175
|
-
let r = 0;
|
|
1176
|
-
for (const o of e) {
|
|
1177
|
-
const a = new Float32Array(o.buffer);
|
|
1178
|
-
if (o.instances && o.instances.length > 0)
|
|
1179
|
-
for (const l of o.instances) {
|
|
1180
|
-
const c = `${o.modelId}-${l.elementId}`;
|
|
1181
|
-
if (!i.has(c))
|
|
1182
|
-
continue;
|
|
1183
|
-
const h = l.transform;
|
|
1184
|
-
for (let d = 0; d < a.length; d += 3) {
|
|
1185
|
-
const u = a[d], p = a[d + 1], m = a[d + 2], f = 1 / (h[3] * u + h[7] * p + h[11] * m + h[15]);
|
|
1186
|
-
n[r] = (h[0] * u + h[4] * p + h[8] * m + h[12]) * f, n[r + 1] = (h[1] * u + h[5] * p + h[9] * m + h[13]) * f, n[r + 2] = (h[2] * u + h[6] * p + h[10] * m + h[14]) * f, r += 3;
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
else
|
|
1190
|
-
n.set(a, r), r += a.length;
|
|
1191
|
-
}
|
|
1192
|
-
self.postMessage({ positions: n.buffer }, [n.buffer]);
|
|
1193
|
-
};
|
|
1194
|
-
}
|
|
1195
|
-
const Xi = Yi;
|
|
1196
|
-
class Ki {
|
|
1197
|
-
constructor() {
|
|
1198
|
-
this._resolve = null, this._requestId = 0;
|
|
1199
|
-
const e = new Blob([`(${Xi})()`]), t = URL.createObjectURL(e);
|
|
1200
|
-
this._worker = new Worker(t), this._worker.onmessage = (i) => {
|
|
1201
|
-
const s = this._resolve;
|
|
1202
|
-
if (this._resolve = null, s) {
|
|
1203
|
-
const n = i.data.positions ? new Float32Array(i.data.positions) : null;
|
|
1204
|
-
s(n);
|
|
1205
|
-
}
|
|
1206
|
-
};
|
|
1207
|
-
}
|
|
1208
|
-
/**
|
|
1209
|
-
* Merge selected element positions in a background thread.
|
|
1210
|
-
* Cancels any in-flight request automatically.
|
|
1211
|
-
*/
|
|
1212
|
-
merge(e, t) {
|
|
1213
|
-
this._resolve && (this._resolve(null), this._resolve = null);
|
|
1214
|
-
const i = ++this._requestId, s = [], n = e.filter((r) => r.buffer).map((r) => {
|
|
1215
|
-
const o = r.buffer.slice().buffer;
|
|
1216
|
-
return s.push(o), {
|
|
1217
|
-
buffer: o,
|
|
1218
|
-
modelId: r.modelId,
|
|
1219
|
-
instances: r.instances
|
|
1220
|
-
};
|
|
1221
|
-
});
|
|
1222
|
-
return new Promise((r) => {
|
|
1223
|
-
this._resolve = (o) => {
|
|
1224
|
-
if (i !== this._requestId) {
|
|
1225
|
-
r(null);
|
|
1226
|
-
return;
|
|
1227
|
-
}
|
|
1228
|
-
r(o);
|
|
1229
|
-
}, this._worker.postMessage(
|
|
1230
|
-
{ bufferElements: n, selectedKeys: t },
|
|
1231
|
-
s
|
|
1232
|
-
);
|
|
1233
|
-
});
|
|
1234
|
-
}
|
|
1235
|
-
dispose() {
|
|
1236
|
-
this._worker.terminate();
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
const Ji = D.hexToRGB(x.accent), Fe = class Fe extends $t {
|
|
1153
|
+
const Xi = R.hexToRGB(y.accent), We = class We extends jt {
|
|
1240
1154
|
constructor(e) {
|
|
1241
1155
|
super(), this.material = e, this.globalMaterialIndex = -1, this._depthPrePassMeshes = [], this._instancedMeshes = /* @__PURE__ */ new Map(), this._bufferElements = [], this._originalColor = null, this._elementMap = /* @__PURE__ */ new Map(), this._originalTransforms = /* @__PURE__ */ new Map(), this._elementOpacity = /* @__PURE__ */ new Map(), this._temporaryColors = /* @__PURE__ */ new Map(), this._selectedElements = [], this._hidingElements = [], this._isolatingElements = [], this._edgeLines = /* @__PURE__ */ new Map(), this._edgeRanges = /* @__PURE__ */ new Map(), this._edgeThreshold = 60, this._edgeMaterial = null, this._isGeneratedLights = !1, this._pointLight = null, this._hiddenSet = /* @__PURE__ */ new Set(), this._isolatedSet = /* @__PURE__ */ new Set(), this.material && "vertexColors" in this.material && (this.material.vertexColors = !0, this.material.needsUpdate = !0);
|
|
1242
1156
|
}
|
|
@@ -1283,7 +1197,7 @@ const Ji = D.hexToRGB(x.accent), Fe = class Fe extends $t {
|
|
|
1283
1197
|
n.setMatrixAt(c, h);
|
|
1284
1198
|
const d = a.modelId.toString(), u = l.elementId;
|
|
1285
1199
|
this._originalTransforms.has(d) || this._originalTransforms.set(d, /* @__PURE__ */ new Map()), this._originalTransforms.get(d).set(u, h.clone());
|
|
1286
|
-
const p = this._originalColor || new
|
|
1200
|
+
const p = this._originalColor || new $(1, 1, 1);
|
|
1287
1201
|
r[c * 3] = p.r, r[c * 3 + 1] = p.g, r[c * 3 + 2] = p.b, this._elementMap.has(d) || this._elementMap.set(d, /* @__PURE__ */ new Map());
|
|
1288
1202
|
const m = this._elementMap.get(d);
|
|
1289
1203
|
m.has(u) || m.set(u, []), m.get(u).push({
|
|
@@ -1291,13 +1205,13 @@ const Ji = D.hexToRGB(x.accent), Fe = class Fe extends $t {
|
|
|
1291
1205
|
instanceIndex: c,
|
|
1292
1206
|
instancedMesh: n
|
|
1293
1207
|
});
|
|
1294
|
-
}), n.instanceColor = new
|
|
1208
|
+
}), n.instanceColor = new bt(r, 3), n.instanceMatrix.needsUpdate = !0;
|
|
1295
1209
|
const o = new Float32Array(t.length);
|
|
1296
|
-
return o.fill(1), s.setAttribute("instanceOpacity", new
|
|
1210
|
+
return o.fill(1), s.setAttribute("instanceOpacity", new bt(o, 1)), this.material && "vertexColors" in this.material && (this.material.vertexColors = !0, this.material.needsUpdate = !0), n;
|
|
1297
1211
|
}
|
|
1298
1212
|
_createGeometryFromBuffer(e) {
|
|
1299
|
-
const t = new
|
|
1300
|
-
t.setAttribute("position", new
|
|
1213
|
+
const t = new ne();
|
|
1214
|
+
t.setAttribute("position", new z(e, 3));
|
|
1301
1215
|
const i = e.length / 3, s = Math.floor(i / 3), n = new Uint32Array(s * 3);
|
|
1302
1216
|
for (let o = 0; o < s; o++) {
|
|
1303
1217
|
const a = o * 3;
|
|
@@ -1306,7 +1220,7 @@ const Ji = D.hexToRGB(x.accent), Fe = class Fe extends $t {
|
|
|
1306
1220
|
const r = new Float32Array(i * 3);
|
|
1307
1221
|
for (let o = 0; o < i; o++)
|
|
1308
1222
|
r[o * 3] = 1, r[o * 3 + 1] = 1, r[o * 3 + 2] = 1;
|
|
1309
|
-
t.setAttribute("color", new
|
|
1223
|
+
t.setAttribute("color", new z(r, 3)), t.setIndex(new z(n, 1)), t.computeVertexNormals(), t.computeBoundingSphere();
|
|
1310
1224
|
try {
|
|
1311
1225
|
t.computeBoundsTree();
|
|
1312
1226
|
} catch {
|
|
@@ -1315,9 +1229,9 @@ const Ji = D.hexToRGB(x.accent), Fe = class Fe extends $t {
|
|
|
1315
1229
|
}
|
|
1316
1230
|
_transformArrayToMatrix4(e) {
|
|
1317
1231
|
if (e.length === 16)
|
|
1318
|
-
return new
|
|
1232
|
+
return new se().fromArray(e);
|
|
1319
1233
|
if (e.length === 12) {
|
|
1320
|
-
const t = new
|
|
1234
|
+
const t = new se();
|
|
1321
1235
|
return t.set(
|
|
1322
1236
|
e[0],
|
|
1323
1237
|
e[1],
|
|
@@ -1337,7 +1251,7 @@ const Ji = D.hexToRGB(x.accent), Fe = class Fe extends $t {
|
|
|
1337
1251
|
1
|
|
1338
1252
|
), t;
|
|
1339
1253
|
} else
|
|
1340
|
-
return console.warn("Unsupported transform array length:", e.length), new
|
|
1254
|
+
return console.warn("Unsupported transform array length:", e.length), new se().identity();
|
|
1341
1255
|
}
|
|
1342
1256
|
_generateGeometryKey(e) {
|
|
1343
1257
|
let t = e.length.toString();
|
|
@@ -1353,7 +1267,7 @@ const Ji = D.hexToRGB(x.accent), Fe = class Fe extends $t {
|
|
|
1353
1267
|
}
|
|
1354
1268
|
//#region Selection and Color Control
|
|
1355
1269
|
select(e, t = []) {
|
|
1356
|
-
this.unselect(), this._selectedElements = e, this.changeColor(this._selectedElements,
|
|
1270
|
+
this.unselect(), this._selectedElements = e, this.changeColor(this._selectedElements, Xi);
|
|
1357
1271
|
}
|
|
1358
1272
|
unselect() {
|
|
1359
1273
|
this._selectedElements.length > 0 && (this.resetColor(this._selectedElements), this._selectedElements = []);
|
|
@@ -1480,7 +1394,7 @@ const Ji = D.hexToRGB(x.accent), Fe = class Fe extends $t {
|
|
|
1480
1394
|
var r;
|
|
1481
1395
|
const n = (r = this._elementMap.get(i)) == null ? void 0 : r.get(s);
|
|
1482
1396
|
n && n.forEach(({ instancedMesh: o, instanceIndex: a }) => {
|
|
1483
|
-
o.setMatrixAt(a,
|
|
1397
|
+
o.setMatrixAt(a, We.ZERO_MATRIX), o.instanceMatrix.needsUpdate = !0;
|
|
1484
1398
|
});
|
|
1485
1399
|
}));
|
|
1486
1400
|
}
|
|
@@ -1498,7 +1412,7 @@ const Ji = D.hexToRGB(x.accent), Fe = class Fe extends $t {
|
|
|
1498
1412
|
this._isolatedSet.add(s);
|
|
1499
1413
|
}), this._isolatingElements = [...t], this._isolatedSet.size === 0 ? (this.visible = !1, this._isolatingElements) : (this._instancedMeshes.forEach((i) => {
|
|
1500
1414
|
for (let s = 0; s < i.count; s++)
|
|
1501
|
-
i.setMatrixAt(s,
|
|
1415
|
+
i.setMatrixAt(s, We.ZERO_MATRIX);
|
|
1502
1416
|
i.instanceMatrix.needsUpdate = !0;
|
|
1503
1417
|
}), t.forEach(({ modelId: i, elementId: s }) => {
|
|
1504
1418
|
var o, a;
|
|
@@ -1605,7 +1519,7 @@ if (gl_FragColor.a < 0.01) discard;`
|
|
|
1605
1519
|
if (!e.geometry.getAttribute("instanceOpacity")) {
|
|
1606
1520
|
const t = new Float32Array(e.count);
|
|
1607
1521
|
t.fill(1);
|
|
1608
|
-
const i = new
|
|
1522
|
+
const i = new bt(t, 1);
|
|
1609
1523
|
e.geometry.setAttribute("instanceOpacity", i);
|
|
1610
1524
|
}
|
|
1611
1525
|
});
|
|
@@ -1684,7 +1598,7 @@ if (gl_FragColor.a < 0.01) discard;`
|
|
|
1684
1598
|
*/
|
|
1685
1599
|
_createDepthPrePass() {
|
|
1686
1600
|
this._removeDepthPrePass(), this._instancedMeshes.forEach((e) => {
|
|
1687
|
-
const t = e.material, i = new
|
|
1601
|
+
const t = e.material, i = new q({
|
|
1688
1602
|
colorWrite: !1,
|
|
1689
1603
|
depthWrite: !0,
|
|
1690
1604
|
side: t == null ? void 0 : t.side
|
|
@@ -1838,13 +1752,13 @@ if (vInstanceOpacity < 0.5) discard;`
|
|
|
1838
1752
|
this._edgeLines.forEach((e) => {
|
|
1839
1753
|
this.remove(e), e.geometry.dispose();
|
|
1840
1754
|
}), this._edgeLines.clear(), this._edgeRanges.clear(), this._edgeMaterial && this._instancedMeshes.forEach((e, t) => {
|
|
1841
|
-
const i = e.geometry, s = new
|
|
1755
|
+
const i = e.geometry, s = new Mt(i, this._edgeThreshold);
|
|
1842
1756
|
if (s.getAttribute("position")) {
|
|
1843
1757
|
const r = s.getAttribute("position").array, o = e.count, a = new Float32Array(
|
|
1844
1758
|
r.length * o
|
|
1845
1759
|
);
|
|
1846
1760
|
for (let c = 0; c < o; c++) {
|
|
1847
|
-
const h = new
|
|
1761
|
+
const h = new se();
|
|
1848
1762
|
e.getMatrixAt(c, h);
|
|
1849
1763
|
const d = c * r.length;
|
|
1850
1764
|
for (let u = 0; u < r.length; u += 3) {
|
|
@@ -1856,9 +1770,9 @@ if (vInstanceOpacity < 0.5) discard;`
|
|
|
1856
1770
|
p.applyMatrix4(h), a[d + u] = p.x, a[d + u + 1] = p.y, a[d + u + 2] = p.z;
|
|
1857
1771
|
}
|
|
1858
1772
|
}
|
|
1859
|
-
const l = new
|
|
1773
|
+
const l = new qt();
|
|
1860
1774
|
if (l.setPositions(a), this._edgeMaterial) {
|
|
1861
|
-
const c = new
|
|
1775
|
+
const c = new Qt(l, this._edgeMaterial);
|
|
1862
1776
|
this.add(c), this._edgeLines.set(t, c);
|
|
1863
1777
|
}
|
|
1864
1778
|
}
|
|
@@ -1939,15 +1853,15 @@ if (vInstanceOpacity < 0.5) discard;`
|
|
|
1939
1853
|
}
|
|
1940
1854
|
getElementBoxs(e) {
|
|
1941
1855
|
var s;
|
|
1942
|
-
const t = new
|
|
1856
|
+
const t = new j();
|
|
1943
1857
|
let i = !1;
|
|
1944
1858
|
for (const n of e) {
|
|
1945
1859
|
const r = (s = this._elementMap.get(n.modelId)) == null ? void 0 : s.get(n.elementId);
|
|
1946
1860
|
if (!(!r || r.length === 0))
|
|
1947
1861
|
for (const { instancedMesh: o, instanceIndex: a } of r) {
|
|
1948
|
-
const l = new
|
|
1862
|
+
const l = new se();
|
|
1949
1863
|
o.getMatrixAt(a, l);
|
|
1950
|
-
const c = new
|
|
1864
|
+
const c = new j().setFromBufferAttribute(
|
|
1951
1865
|
o.geometry.getAttribute("position")
|
|
1952
1866
|
);
|
|
1953
1867
|
c.applyMatrix4(l), t.union(c), i = !0;
|
|
@@ -1979,8 +1893,8 @@ if (vInstanceOpacity < 0.5) discard;`
|
|
|
1979
1893
|
n && e.push(n);
|
|
1980
1894
|
}
|
|
1981
1895
|
});
|
|
1982
|
-
const t =
|
|
1983
|
-
t && !this._pointLight && (this._pointLight = new
|
|
1896
|
+
const t = R.getCenterPoint(e), i = this.getFarthestDistance(t, e);
|
|
1897
|
+
t && !this._pointLight && (this._pointLight = new $t(16562741, 1, i, 0.1), this._pointLight.position.copy(t), this.add(this._pointLight)), this._isGeneratedLights = !0;
|
|
1984
1898
|
}
|
|
1985
1899
|
this._pointLight && (this._pointLight.visible = !0);
|
|
1986
1900
|
}
|
|
@@ -2016,9 +1930,9 @@ if (vInstanceOpacity < 0.5) discard;`
|
|
|
2016
1930
|
}
|
|
2017
1931
|
//#endregion
|
|
2018
1932
|
};
|
|
2019
|
-
|
|
2020
|
-
let ce =
|
|
2021
|
-
const
|
|
1933
|
+
We.ZERO_MATRIX = new se().makeScale(0, 0, 0);
|
|
1934
|
+
let ce = We;
|
|
1935
|
+
const Ki = `
|
|
2022
1936
|
// Web Worker code as string (to be created as blob URL)
|
|
2023
1937
|
self.onmessage = function(e) {
|
|
2024
1938
|
const {
|
|
@@ -2132,16 +2046,16 @@ self.onmessage = function(e) {
|
|
|
2132
2046
|
}
|
|
2133
2047
|
};
|
|
2134
2048
|
`;
|
|
2135
|
-
class
|
|
2049
|
+
class Ji extends x {
|
|
2136
2050
|
constructor() {
|
|
2137
|
-
super(), this.workerPool = null, this.
|
|
2051
|
+
super(), this.workerPool = null, this.bimModels = [], this.isReady = !1, this._batchedMeshes = [], this._instancedMeshes = [], this._isolatingElements = [], this._initializeWorkerPool(4);
|
|
2138
2052
|
}
|
|
2139
2053
|
_initializeWorkerPool(e) {
|
|
2140
2054
|
try {
|
|
2141
|
-
const t = new Blob([
|
|
2055
|
+
const t = new Blob([Ki], {
|
|
2142
2056
|
type: "application/javascript"
|
|
2143
2057
|
}), i = URL.createObjectURL(t);
|
|
2144
|
-
this.workerPool = new
|
|
2058
|
+
this.workerPool = new ee(
|
|
2145
2059
|
e || navigator.hardwareConcurrency || 4,
|
|
2146
2060
|
i
|
|
2147
2061
|
), console.log(
|
|
@@ -2153,9 +2067,9 @@ class ts extends y {
|
|
|
2153
2067
|
}
|
|
2154
2068
|
get bounds() {
|
|
2155
2069
|
try {
|
|
2156
|
-
return new
|
|
2070
|
+
return new j().setFromObject(this);
|
|
2157
2071
|
} catch {
|
|
2158
|
-
return new
|
|
2072
|
+
return new j();
|
|
2159
2073
|
}
|
|
2160
2074
|
}
|
|
2161
2075
|
setReady(e) {
|
|
@@ -2320,7 +2234,7 @@ class ts extends y {
|
|
|
2320
2234
|
return null;
|
|
2321
2235
|
const n = new Float32Array(s);
|
|
2322
2236
|
let r = 0;
|
|
2323
|
-
const o = new
|
|
2237
|
+
const o = new se(), a = new E();
|
|
2324
2238
|
for (const l of i)
|
|
2325
2239
|
if (l.buffer)
|
|
2326
2240
|
if (l.instances && l.instances.length > 0)
|
|
@@ -2336,17 +2250,6 @@ class ts extends y {
|
|
|
2336
2250
|
n.set(l.buffer, r), r += l.buffer.length;
|
|
2337
2251
|
return n;
|
|
2338
2252
|
}
|
|
2339
|
-
/**
|
|
2340
|
-
* Async version — offloads vertex merging to a Web Worker so the main thread stays unblocked.
|
|
2341
|
-
* Automatically cancels any in-flight request when called again.
|
|
2342
|
-
*/
|
|
2343
|
-
async getSelectedElementsPositionsAsync() {
|
|
2344
|
-
const e = this.getSelectedElements();
|
|
2345
|
-
if (e.length === 0)
|
|
2346
|
-
return null;
|
|
2347
|
-
const t = e.map((s) => `${s.modelId}-${s.elementId}`), i = this.getElements(e);
|
|
2348
|
-
return i.length === 0 ? null : (this._mergePositionsWorker || (this._mergePositionsWorker = new Ki()), this._mergePositionsWorker.merge(i, t));
|
|
2349
|
-
}
|
|
2350
2253
|
/**
|
|
2351
2254
|
* Changes the color of multiple elements in the merged mesh.
|
|
2352
2255
|
* Works with RGBA color buffer (preserves existing alpha values)
|
|
@@ -2369,7 +2272,7 @@ class ts extends y {
|
|
|
2369
2272
|
}), this._instancedMeshes.forEach((i) => {
|
|
2370
2273
|
const s = i.getElementBoxs(e);
|
|
2371
2274
|
s && t.push(s);
|
|
2372
|
-
}),
|
|
2275
|
+
}), R.mergeBoundingBoxes(t);
|
|
2373
2276
|
}
|
|
2374
2277
|
/**
|
|
2375
2278
|
* reset visibility/ geometries only not reset color
|
|
@@ -2448,8 +2351,7 @@ class ts extends y {
|
|
|
2448
2351
|
* *then regenerate again
|
|
2449
2352
|
*/
|
|
2450
2353
|
dispose() {
|
|
2451
|
-
|
|
2452
|
-
this.isReady = !1, this._batchedMeshes.forEach((t) => t.dispose()), this._batchedMeshes = [], this._instancedMeshes.forEach((t) => t.dispose()), this._instancedMeshes = [], (e = this._mergePositionsWorker) == null || e.dispose(), this._mergePositionsWorker = null, this.children = [];
|
|
2354
|
+
this.isReady = !1, this._batchedMeshes.forEach((e) => e.dispose()), this._batchedMeshes = [], this._instancedMeshes.forEach((e) => e.dispose()), this._instancedMeshes = [], this.children = [];
|
|
2453
2355
|
}
|
|
2454
2356
|
}
|
|
2455
2357
|
class hr {
|
|
@@ -2484,7 +2386,7 @@ class gr {
|
|
|
2484
2386
|
}
|
|
2485
2387
|
class fr {
|
|
2486
2388
|
constructor() {
|
|
2487
|
-
this.Materials = [], this.Elements = [], this.Camera = new
|
|
2389
|
+
this.Materials = [], this.Elements = [], this.Camera = new Kt();
|
|
2488
2390
|
}
|
|
2489
2391
|
}
|
|
2490
2392
|
class vr {
|
|
@@ -2492,19 +2394,19 @@ class vr {
|
|
|
2492
2394
|
this.MaterialIndex = 0, this.Vertices = [], this.Indices = [], this.Buffer = [];
|
|
2493
2395
|
}
|
|
2494
2396
|
}
|
|
2495
|
-
class
|
|
2397
|
+
class Kt {
|
|
2496
2398
|
constructor() {
|
|
2497
|
-
this.scale = 0, this.origin = new re(), this.eyePosition = new re(), this.upDirection = new re(), this.forwardDirection = new re(), this.target = new re(), this.box = new
|
|
2399
|
+
this.scale = 0, this.origin = new re(), this.eyePosition = new re(), this.upDirection = new re(), this.forwardDirection = new re(), this.target = new re(), this.box = new es();
|
|
2498
2400
|
}
|
|
2499
2401
|
}
|
|
2500
|
-
class
|
|
2402
|
+
class es {
|
|
2501
2403
|
constructor() {
|
|
2502
2404
|
this.min = new re(), this.max = new re();
|
|
2503
2405
|
}
|
|
2504
2406
|
}
|
|
2505
2407
|
class br {
|
|
2506
2408
|
constructor() {
|
|
2507
|
-
this.Data = {}, this.CameraData = new
|
|
2409
|
+
this.Data = {}, this.CameraData = new Kt(), this.Translation = [];
|
|
2508
2410
|
}
|
|
2509
2411
|
}
|
|
2510
2412
|
class re {
|
|
@@ -2512,7 +2414,7 @@ class re {
|
|
|
2512
2414
|
this.X = 0, this.Y = 0, this.Z = 0;
|
|
2513
2415
|
}
|
|
2514
2416
|
}
|
|
2515
|
-
const
|
|
2417
|
+
const ts = {
|
|
2516
2418
|
enabled: !0,
|
|
2517
2419
|
castShadow: !0,
|
|
2518
2420
|
intensity: 5,
|
|
@@ -2523,7 +2425,7 @@ const ss = {
|
|
|
2523
2425
|
indirectLightIntensity: 1.2,
|
|
2524
2426
|
shadowcatcher: !0
|
|
2525
2427
|
};
|
|
2526
|
-
function
|
|
2428
|
+
function is() {
|
|
2527
2429
|
function g(i) {
|
|
2528
2430
|
let s = 0;
|
|
2529
2431
|
for (let n = 0; n < i.length; n++)
|
|
@@ -2553,25 +2455,25 @@ function ns() {
|
|
|
2553
2455
|
for (let v = 0; v < a; v++)
|
|
2554
2456
|
i.forEach((b) => {
|
|
2555
2457
|
const w = u.get(b.id);
|
|
2556
|
-
w.vx = 0, w.vy = 0, i.forEach((
|
|
2557
|
-
if (b.id ===
|
|
2458
|
+
w.vx = 0, w.vy = 0, i.forEach((C) => {
|
|
2459
|
+
if (b.id === C.id)
|
|
2558
2460
|
return;
|
|
2559
|
-
const A = u.get(
|
|
2560
|
-
w.vx +=
|
|
2461
|
+
const A = u.get(C.id), S = w.x - A.x, _ = w.y - A.y, V = S * S + _ * _, T = Math.sqrt(V) || 1, M = d * d / T;
|
|
2462
|
+
w.vx += S / T * M, w.vy += _ / T * M;
|
|
2561
2463
|
});
|
|
2562
2464
|
}), s.forEach((b) => {
|
|
2563
|
-
const w = String(b.source),
|
|
2564
|
-
if (!A || !
|
|
2465
|
+
const w = String(b.source), C = String(b.target), A = u.get(w), S = u.get(C);
|
|
2466
|
+
if (!A || !S)
|
|
2565
2467
|
return;
|
|
2566
|
-
const
|
|
2567
|
-
A.vx -=
|
|
2468
|
+
const _ = A.x - S.x, V = A.y - S.y, T = Math.sqrt(_ * _ + V * V) || 1, M = T * T / d, I = _ / T * M, D = V / T * M;
|
|
2469
|
+
A.vx -= I, A.vy -= D, S.vx += I, S.vy += D;
|
|
2568
2470
|
}), i.forEach((b) => {
|
|
2569
|
-
const w = u.get(b.id),
|
|
2570
|
-
if (w.x += w.vx /
|
|
2571
|
-
const
|
|
2572
|
-
if (Math.sqrt(
|
|
2573
|
-
const
|
|
2574
|
-
w.x =
|
|
2471
|
+
const w = u.get(b.id), C = Math.sqrt(w.vx * w.vx + w.vy * w.vy) || 1, A = Math.min(C, p);
|
|
2472
|
+
if (w.x += w.vx / C * A, w.y += w.vy / C * A, l === "circular") {
|
|
2473
|
+
const S = r / 2, _ = o / 2, V = Math.min(r, o) / 2, T = w.x - S, M = w.y - _;
|
|
2474
|
+
if (Math.sqrt(T * T + M * M) > V) {
|
|
2475
|
+
const D = Math.atan2(M, T);
|
|
2476
|
+
w.x = S + V * Math.cos(D), w.y = _ + V * Math.sin(D);
|
|
2575
2477
|
}
|
|
2576
2478
|
} else
|
|
2577
2479
|
w.x = Math.max(0, Math.min(r, w.x)), w.y = Math.max(0, Math.min(o, w.y));
|
|
@@ -2605,11 +2507,11 @@ function ns() {
|
|
|
2605
2507
|
}
|
|
2606
2508
|
};
|
|
2607
2509
|
}
|
|
2608
|
-
const
|
|
2609
|
-
class
|
|
2510
|
+
const ss = is;
|
|
2511
|
+
class ns {
|
|
2610
2512
|
constructor() {
|
|
2611
|
-
const e = new Blob([`(${
|
|
2612
|
-
this.workerPool = new
|
|
2513
|
+
const e = new Blob([`(${ss})()`]), t = URL.createObjectURL(e);
|
|
2514
|
+
this.workerPool = new ee(2, t);
|
|
2613
2515
|
}
|
|
2614
2516
|
computeLayout(e, t, i, s) {
|
|
2615
2517
|
const n = {
|
|
@@ -2628,7 +2530,7 @@ class as {
|
|
|
2628
2530
|
this.workerPool.dispose();
|
|
2629
2531
|
}
|
|
2630
2532
|
}
|
|
2631
|
-
class
|
|
2533
|
+
class rs {
|
|
2632
2534
|
constructor(e, t) {
|
|
2633
2535
|
this._elementMap = /* @__PURE__ */ new Map(), this._relationships = [], this._searchIndex = null, this._searchIndexBuilt = !1, this._outEdges = /* @__PURE__ */ new Map(), this._inEdges = /* @__PURE__ */ new Map(), this._edgesByType = /* @__PURE__ */ new Map(), this.INVERSE = {
|
|
2634
2536
|
ON_LEVEL: "HAS_ELEMENT",
|
|
@@ -2896,19 +2798,19 @@ class os {
|
|
|
2896
2798
|
}), l("Building edges", n, n);
|
|
2897
2799
|
const d = [];
|
|
2898
2800
|
this._elementMap.forEach((f, v) => {
|
|
2899
|
-
var w,
|
|
2900
|
-
if (a++, (!(f != null && f.Category) || !((w = f.Category) != null && w.value) || f.Category.value == null) && (!(f != null && f.ObjectType) || !((
|
|
2801
|
+
var w, C, A, S, _;
|
|
2802
|
+
if (a++, (!(f != null && f.Category) || !((w = f.Category) != null && w.value) || f.Category.value == null) && (!(f != null && f.ObjectType) || !((C = f.ObjectType) != null && C.value) || f.ObjectType.value == null) || !h.has(v))
|
|
2901
2803
|
return;
|
|
2902
2804
|
const b = ((A = f == null ? void 0 : f.Name) == null ? void 0 : A.value) || v.toString();
|
|
2903
2805
|
d.push({
|
|
2904
2806
|
id: String(v),
|
|
2905
2807
|
label: b,
|
|
2906
|
-
group: ((
|
|
2808
|
+
group: ((S = f == null ? void 0 : f.Category) == null ? void 0 : S.value) || ((_ = f == null ? void 0 : f.ObjectType) == null ? void 0 : _.value)
|
|
2907
2809
|
});
|
|
2908
2810
|
}), l("Building nodes", d.length, d.length);
|
|
2909
2811
|
const u = d.map((f) => f.id), p = this._calculateNodeLevels(c, u);
|
|
2910
2812
|
a += r, l("Calculating levels", d.length, d.length);
|
|
2911
|
-
const m = new
|
|
2813
|
+
const m = new ns();
|
|
2912
2814
|
l(
|
|
2913
2815
|
"Computing layout",
|
|
2914
2816
|
0,
|
|
@@ -2916,12 +2818,12 @@ class os {
|
|
|
2916
2818
|
), m.computeLayout(d, c, e, (f) => {
|
|
2917
2819
|
a++;
|
|
2918
2820
|
const v = d.map((b) => {
|
|
2919
|
-
const w = f[b.id],
|
|
2821
|
+
const w = f[b.id], C = p.get(b.id);
|
|
2920
2822
|
return {
|
|
2921
2823
|
...b,
|
|
2922
2824
|
x: (w == null ? void 0 : w.x) ?? 0,
|
|
2923
2825
|
y: (w == null ? void 0 : w.y) ?? 0,
|
|
2924
|
-
level:
|
|
2826
|
+
level: C
|
|
2925
2827
|
};
|
|
2926
2828
|
});
|
|
2927
2829
|
a++, m.dispose(), t == null || t({
|
|
@@ -2964,22 +2866,22 @@ class os {
|
|
|
2964
2866
|
b.vx = 0, b.vy = 0, e.forEach((w) => {
|
|
2965
2867
|
if (v.id === w.id)
|
|
2966
2868
|
return;
|
|
2967
|
-
const
|
|
2968
|
-
b.vx += A /
|
|
2869
|
+
const C = h.get(w.id), A = b.x - C.x, S = b.y - C.y, _ = A * A + S * S, V = Math.sqrt(_) || 1, T = c * c / V;
|
|
2870
|
+
b.vx += A / V * T, b.vy += S / V * T;
|
|
2969
2871
|
});
|
|
2970
2872
|
}), t.forEach((v) => {
|
|
2971
|
-
const b = String(v.source), w = String(v.target),
|
|
2972
|
-
if (!
|
|
2873
|
+
const b = String(v.source), w = String(v.target), C = h.get(b), A = h.get(w);
|
|
2874
|
+
if (!C || !A)
|
|
2973
2875
|
return;
|
|
2974
|
-
const
|
|
2975
|
-
|
|
2876
|
+
const S = C.x - A.x, _ = C.y - A.y, V = Math.sqrt(S * S + _ * _) || 1, T = V * V / c, M = S / V * T, I = _ / V * T;
|
|
2877
|
+
C.vx -= M, C.vy -= I, A.vx += M, A.vy += I;
|
|
2976
2878
|
}), e.forEach((v) => {
|
|
2977
|
-
const b = h.get(v.id), w = Math.sqrt(b.vx * b.vx + b.vy * b.vy) || 1,
|
|
2978
|
-
if (b.x += b.vx / w *
|
|
2979
|
-
const A = s / 2,
|
|
2980
|
-
if (Math.sqrt(
|
|
2981
|
-
const
|
|
2982
|
-
b.x = A +
|
|
2879
|
+
const b = h.get(v.id), w = Math.sqrt(b.vx * b.vx + b.vy * b.vy) || 1, C = Math.min(w, u);
|
|
2880
|
+
if (b.x += b.vx / w * C, b.y += b.vy / w * C, o === "circular") {
|
|
2881
|
+
const A = s / 2, S = n / 2, _ = Math.min(s, n) / 2, V = b.x - A, T = b.y - S;
|
|
2882
|
+
if (Math.sqrt(V * V + T * T) > _) {
|
|
2883
|
+
const I = Math.atan2(T, V);
|
|
2884
|
+
b.x = A + _ * Math.cos(I), b.y = S + _ * Math.sin(I);
|
|
2983
2885
|
}
|
|
2984
2886
|
} else
|
|
2985
2887
|
b.x = Math.max(0, Math.min(s, b.x)), b.y = Math.max(0, Math.min(n, b.y));
|
|
@@ -3012,8 +2914,8 @@ class wr {
|
|
|
3012
2914
|
this.children = /* @__PURE__ */ new Map(), this.keys = /* @__PURE__ */ new Set();
|
|
3013
2915
|
}
|
|
3014
2916
|
}
|
|
3015
|
-
var
|
|
3016
|
-
class
|
|
2917
|
+
var N = /* @__PURE__ */ ((g) => (g[g.ON_MOUSE_MOVE = 0] = "ON_MOUSE_MOVE", g[g.ON_MOUSE_DOWN_LEFT = 1] = "ON_MOUSE_DOWN_LEFT", g[g.ON_MOUSE_UP_LEFT = 2] = "ON_MOUSE_UP_LEFT", g[g.ON_MOUSE_DOWN_RIGHT = 3] = "ON_MOUSE_DOWN_RIGHT", g[g.ON_MOUSE_UP_RIGHT = 4] = "ON_MOUSE_UP_RIGHT", g[g.ON_MOUSE_DOUBLE_CLICK = 5] = "ON_MOUSE_DOUBLE_CLICK", g))(N || {}), X = /* @__PURE__ */ ((g) => (g[g.ON_WAKE = 0] = "ON_WAKE", g[g.ON_SLEEP = 1] = "ON_SLEEP", g[g.ON_UPDATE = 2] = "ON_UPDATE", g))(X || {}), me = /* @__PURE__ */ ((g) => (g[g.KEYDOWN = 0] = "KEYDOWN", g[g.KEYUP = 1] = "KEYUP", g))(me || {}), k = /* @__PURE__ */ ((g) => (g[g.LOADED_SCENE = 0] = "LOADED_SCENE", g[g.LOADED_MATERIAL_MANAGER = 1] = "LOADED_MATERIAL_MANAGER", g[g.LOADED_RENDERER = 2] = "LOADED_RENDERER", g[g.LOADED_CAMERA = 3] = "LOADED_CAMERA", g[g.LOADED_CUBE = 4] = "LOADED_CUBE", g[g.LOADED_TOOLS = 5] = "LOADED_TOOLS", g[g.LOADED_SEPERATE_MODEL = 6] = "LOADED_SEPERATE_MODEL", g[g.GENERATED_MERGE_MODEL = 7] = "GENERATED_MERGE_MODEL", g[g.LOADED_DATA = 8] = "LOADED_DATA", g[g.SELECT_ELEMENTS = 9] = "SELECT_ELEMENTS", g[g.UNSELECT_ELEMENTS = 10] = "UNSELECT_ELEMENTS", g))(k || {});
|
|
2918
|
+
class _t {
|
|
3017
2919
|
constructor() {
|
|
3018
2920
|
this.items = {};
|
|
3019
2921
|
}
|
|
@@ -3058,22 +2960,22 @@ class yr {
|
|
|
3058
2960
|
};
|
|
3059
2961
|
}
|
|
3060
2962
|
}
|
|
3061
|
-
class
|
|
2963
|
+
class as {
|
|
3062
2964
|
constructor() {
|
|
3063
2965
|
this.deleted = [], this.added = [], this.modified = [], this.notChanged = [];
|
|
3064
2966
|
}
|
|
3065
2967
|
}
|
|
3066
|
-
class
|
|
2968
|
+
class os {
|
|
3067
2969
|
constructor() {
|
|
3068
|
-
this.clashes = new
|
|
2970
|
+
this.clashes = new _t();
|
|
3069
2971
|
}
|
|
3070
2972
|
}
|
|
3071
|
-
class
|
|
2973
|
+
class ls {
|
|
3072
2974
|
constructor() {
|
|
3073
2975
|
this.value = {}, this.elementIds = [], this.modelId = -1;
|
|
3074
2976
|
}
|
|
3075
2977
|
}
|
|
3076
|
-
class
|
|
2978
|
+
class cs {
|
|
3077
2979
|
constructor(e) {
|
|
3078
2980
|
this.viralViewerApi = e, this.panel = null, this.batchListContainer = null, this.isVisible = !1, this.selectedBatchMesh = null, this.inject();
|
|
3079
2981
|
}
|
|
@@ -3088,7 +2990,7 @@ class ds {
|
|
|
3088
2990
|
right: 10px;
|
|
3089
2991
|
width: 300px;
|
|
3090
2992
|
max-height: 80vh;
|
|
3091
|
-
background-color: ${
|
|
2993
|
+
background-color: ${y.background};
|
|
3092
2994
|
border: 1px solid #ccc;
|
|
3093
2995
|
border-radius: 8px;
|
|
3094
2996
|
padding: 15px;
|
|
@@ -3102,8 +3004,8 @@ class ds {
|
|
|
3102
3004
|
const e = document.createElement("div");
|
|
3103
3005
|
e.innerHTML = `
|
|
3104
3006
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
|
|
3105
|
-
<h3 style="margin: 0; color: ${
|
|
3106
|
-
<span id="batch-debug-close" style="cursor: pointer; font-size: 20px; color: ${
|
|
3007
|
+
<h3 style="margin: 0; color: ${y.secondary}; font-size: 16px;">Batch Debug Panel</h3>
|
|
3008
|
+
<span id="batch-debug-close" style="cursor: pointer; font-size: 20px; color: ${y.secondary};">×</span>
|
|
3107
3009
|
</div>
|
|
3108
3010
|
`, this.panel.appendChild(e);
|
|
3109
3011
|
const t = document.createElement("div");
|
|
@@ -3112,7 +3014,7 @@ class ds {
|
|
|
3112
3014
|
t.appendChild(i), t.appendChild(s), this.panel.appendChild(t);
|
|
3113
3015
|
const n = document.createElement("div");
|
|
3114
3016
|
n.innerHTML = `
|
|
3115
|
-
<h4 style="margin: 10px 0 5px 0; color: ${
|
|
3017
|
+
<h4 style="margin: 10px 0 5px 0; color: ${y.secondary}; font-size: 14px;">Batched Meshes</h4>
|
|
3116
3018
|
`, this.panel.appendChild(n), this.batchListContainer = document.createElement("div"), this.batchListContainer.setAttribute(
|
|
3117
3019
|
"style",
|
|
3118
3020
|
`
|
|
@@ -3129,7 +3031,7 @@ class ds {
|
|
|
3129
3031
|
`
|
|
3130
3032
|
flex: 1;
|
|
3131
3033
|
padding: 8px;
|
|
3132
|
-
background-color: ${
|
|
3034
|
+
background-color: ${y.primary};
|
|
3133
3035
|
color: white;
|
|
3134
3036
|
border: none;
|
|
3135
3037
|
border-radius: 4px;
|
|
@@ -3139,9 +3041,9 @@ class ds {
|
|
|
3139
3041
|
transition: background-color 0.2s;
|
|
3140
3042
|
`
|
|
3141
3043
|
), i.addEventListener("mouseenter", () => {
|
|
3142
|
-
i.style.backgroundColor =
|
|
3044
|
+
i.style.backgroundColor = y.accent;
|
|
3143
3045
|
}), i.addEventListener("mouseleave", () => {
|
|
3144
|
-
i.style.backgroundColor =
|
|
3046
|
+
i.style.backgroundColor = y.primary;
|
|
3145
3047
|
}), i;
|
|
3146
3048
|
}
|
|
3147
3049
|
injectStyles() {
|
|
@@ -3160,12 +3062,12 @@ class ds {
|
|
|
3160
3062
|
background-color: rgba(0, 0, 0, 0.1);
|
|
3161
3063
|
}
|
|
3162
3064
|
.batch-item.selected {
|
|
3163
|
-
border-color: ${
|
|
3065
|
+
border-color: ${y.accent};
|
|
3164
3066
|
background-color: rgba(128, 214, 218, 0.2);
|
|
3165
3067
|
}
|
|
3166
3068
|
.batch-item-title {
|
|
3167
3069
|
font-weight: 600;
|
|
3168
|
-
color: ${
|
|
3070
|
+
color: ${y.secondary};
|
|
3169
3071
|
font-size: 13px;
|
|
3170
3072
|
margin-bottom: 4px;
|
|
3171
3073
|
}
|
|
@@ -3246,7 +3148,7 @@ class ds {
|
|
|
3246
3148
|
background-color: rgba(128, 214, 218, 0.1);
|
|
3247
3149
|
border-radius: 4px;
|
|
3248
3150
|
font-size: 11px;
|
|
3249
|
-
color: ${
|
|
3151
|
+
color: ${y.secondary};
|
|
3250
3152
|
text-align: center;
|
|
3251
3153
|
`
|
|
3252
3154
|
), i.innerHTML = `
|
|
@@ -3289,7 +3191,7 @@ class ds {
|
|
|
3289
3191
|
this.clearIsolation(), this.panel && (this.panel.remove(), this.panel = null);
|
|
3290
3192
|
}
|
|
3291
3193
|
}
|
|
3292
|
-
class
|
|
3194
|
+
class hs {
|
|
3293
3195
|
constructor(e) {
|
|
3294
3196
|
this.viralViewerApi = e, this.panel = null, this.instancedListContainer = null, this.isVisible = !1, this.selectedInstancedMesh = null, this.selectedInternalMesh = null, this.inject();
|
|
3295
3197
|
}
|
|
@@ -3304,7 +3206,7 @@ class us {
|
|
|
3304
3206
|
right: 320px;
|
|
3305
3207
|
width: 350px;
|
|
3306
3208
|
max-height: 80vh;
|
|
3307
|
-
background-color: ${
|
|
3209
|
+
background-color: ${y.background};
|
|
3308
3210
|
border: 1px solid #ccc;
|
|
3309
3211
|
border-radius: 8px;
|
|
3310
3212
|
padding: 15px;
|
|
@@ -3318,8 +3220,8 @@ class us {
|
|
|
3318
3220
|
const e = document.createElement("div");
|
|
3319
3221
|
e.innerHTML = `
|
|
3320
3222
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
|
|
3321
|
-
<h3 style="margin: 0; color: ${
|
|
3322
|
-
<span id="instanced-debug-close" style="cursor: pointer; font-size: 20px; color: ${
|
|
3223
|
+
<h3 style="margin: 0; color: ${y.secondary}; font-size: 16px;">🔄 Instanced Debug Panel</h3>
|
|
3224
|
+
<span id="instanced-debug-close" style="cursor: pointer; font-size: 20px; color: ${y.secondary};">×</span>
|
|
3323
3225
|
</div>
|
|
3324
3226
|
`, this.panel.appendChild(e);
|
|
3325
3227
|
const t = document.createElement("div");
|
|
@@ -3331,7 +3233,7 @@ class us {
|
|
|
3331
3233
|
t.appendChild(i), t.appendChild(s), t.appendChild(n), this.panel.appendChild(t);
|
|
3332
3234
|
const r = document.createElement("div");
|
|
3333
3235
|
r.innerHTML = `
|
|
3334
|
-
<h4 style="margin: 10px 0 5px 0; color: ${
|
|
3236
|
+
<h4 style="margin: 10px 0 5px 0; color: ${y.secondary}; font-size: 14px;">Instanced Meshes (ViralInstancedMeshV2)</h4>
|
|
3335
3237
|
`, this.panel.appendChild(r), this.instancedListContainer = document.createElement("div"), this.instancedListContainer.setAttribute(
|
|
3336
3238
|
"style",
|
|
3337
3239
|
`
|
|
@@ -3348,7 +3250,7 @@ class us {
|
|
|
3348
3250
|
`
|
|
3349
3251
|
flex: 1;
|
|
3350
3252
|
padding: 8px;
|
|
3351
|
-
background-color: ${
|
|
3253
|
+
background-color: ${y.primary};
|
|
3352
3254
|
color: white;
|
|
3353
3255
|
border: none;
|
|
3354
3256
|
border-radius: 4px;
|
|
@@ -3359,9 +3261,9 @@ class us {
|
|
|
3359
3261
|
min-width: 80px;
|
|
3360
3262
|
`
|
|
3361
3263
|
), i.addEventListener("mouseenter", () => {
|
|
3362
|
-
i.style.backgroundColor =
|
|
3264
|
+
i.style.backgroundColor = y.accent;
|
|
3363
3265
|
}), i.addEventListener("mouseleave", () => {
|
|
3364
|
-
i.style.backgroundColor =
|
|
3266
|
+
i.style.backgroundColor = y.primary;
|
|
3365
3267
|
}), i;
|
|
3366
3268
|
}
|
|
3367
3269
|
injectStyles() {
|
|
@@ -3382,12 +3284,12 @@ class us {
|
|
|
3382
3284
|
background-color: rgba(0, 0, 0, 0.1);
|
|
3383
3285
|
}
|
|
3384
3286
|
.instanced-item.selected {
|
|
3385
|
-
border-color: ${
|
|
3287
|
+
border-color: ${y.accent};
|
|
3386
3288
|
background-color: rgba(128, 214, 218, 0.2);
|
|
3387
3289
|
}
|
|
3388
3290
|
.instanced-item-title {
|
|
3389
3291
|
font-weight: 600;
|
|
3390
|
-
color: ${
|
|
3292
|
+
color: ${y.secondary};
|
|
3391
3293
|
font-size: 13px;
|
|
3392
3294
|
margin-bottom: 4px;
|
|
3393
3295
|
}
|
|
@@ -3434,7 +3336,7 @@ class us {
|
|
|
3434
3336
|
}
|
|
3435
3337
|
.internal-mesh-item.selected {
|
|
3436
3338
|
background-color: rgba(33, 150, 243, 0.2);
|
|
3437
|
-
border-left-color: ${
|
|
3339
|
+
border-left-color: ${y.accent};
|
|
3438
3340
|
}
|
|
3439
3341
|
`, document.head.appendChild(e);
|
|
3440
3342
|
}
|
|
@@ -3503,8 +3405,8 @@ class us {
|
|
|
3503
3405
|
</div>
|
|
3504
3406
|
<span style="font-size: 14px; color: #666;">▶</span>
|
|
3505
3407
|
`, u.addEventListener("click", (b) => {
|
|
3506
|
-
const w = d.querySelector(".instanced-wrapper-content"),
|
|
3507
|
-
w &&
|
|
3408
|
+
const w = d.querySelector(".instanced-wrapper-content"), C = u.querySelector("span");
|
|
3409
|
+
w && C && (w.classList.toggle("expanded"), C.textContent = w.classList.contains("expanded") ? "▼" : "▶");
|
|
3508
3410
|
});
|
|
3509
3411
|
const p = document.createElement("div");
|
|
3510
3412
|
p.className = "instanced-wrapper-content";
|
|
@@ -3525,21 +3427,21 @@ class us {
|
|
|
3525
3427
|
), m.addEventListener("click", (b) => {
|
|
3526
3428
|
b.stopPropagation(), this.isolateWrapper(r, d);
|
|
3527
3429
|
}), p.appendChild(m), a.forEach((b, w) => {
|
|
3528
|
-
var
|
|
3529
|
-
const
|
|
3530
|
-
|
|
3430
|
+
var V;
|
|
3431
|
+
const C = b.geometry, A = ((V = C.attributes.position) == null ? void 0 : V.count) || 0, S = C.index ? C.index.count / 3 : A / 3, _ = document.createElement("div");
|
|
3432
|
+
_.className = "internal-mesh-item", _.innerHTML = `
|
|
3531
3433
|
<div style="font-weight: 600; font-size: 12px; margin-bottom: 2px;">
|
|
3532
3434
|
InstancedMesh ${w + 1}
|
|
3533
3435
|
</div>
|
|
3534
3436
|
<div class="instanced-item-info">
|
|
3535
3437
|
Instances: ${b.count.toLocaleString()}<br>
|
|
3536
3438
|
Base Vertices: ${A.toLocaleString()}<br>
|
|
3537
|
-
Base Triangles: ${Math.floor(
|
|
3439
|
+
Base Triangles: ${Math.floor(S).toLocaleString()}<br>
|
|
3538
3440
|
Total Rendered: ${(A * b.count).toLocaleString()} verts
|
|
3539
3441
|
</div>
|
|
3540
|
-
`,
|
|
3541
|
-
|
|
3542
|
-
}), p.appendChild(
|
|
3442
|
+
`, _.addEventListener("click", (T) => {
|
|
3443
|
+
T.stopPropagation(), this.isolateInternalMesh(r, b, _);
|
|
3444
|
+
}), p.appendChild(_);
|
|
3543
3445
|
}), d.appendChild(u), d.appendChild(p), this.instancedListContainer.appendChild(d);
|
|
3544
3446
|
});
|
|
3545
3447
|
const n = document.createElement("div");
|
|
@@ -3551,7 +3453,7 @@ class us {
|
|
|
3551
3453
|
background-color: rgba(128, 214, 218, 0.1);
|
|
3552
3454
|
border-radius: 4px;
|
|
3553
3455
|
font-size: 11px;
|
|
3554
|
-
color: ${
|
|
3456
|
+
color: ${y.secondary};
|
|
3555
3457
|
text-align: center;
|
|
3556
3458
|
`
|
|
3557
3459
|
), n.innerHTML = `
|
|
@@ -3685,7 +3587,7 @@ class us {
|
|
|
3685
3587
|
this.clearIsolation(), this.panel && (this.panel.remove(), this.panel = null);
|
|
3686
3588
|
}
|
|
3687
3589
|
}
|
|
3688
|
-
class
|
|
3590
|
+
class ds {
|
|
3689
3591
|
constructor(e) {
|
|
3690
3592
|
this.viralViewerApi = e, this.panel = null, this.contentContainer = null, this.isVisible = !1, this.lastAnalysis = null, this.inject();
|
|
3691
3593
|
}
|
|
@@ -3700,7 +3602,7 @@ class ps {
|
|
|
3700
3602
|
left: 10px;
|
|
3701
3603
|
width: 450px;
|
|
3702
3604
|
max-height: 85vh;
|
|
3703
|
-
background-color: ${
|
|
3605
|
+
background-color: ${y.background};
|
|
3704
3606
|
border: 1px solid #ccc;
|
|
3705
3607
|
border-radius: 8px;
|
|
3706
3608
|
padding: 15px;
|
|
@@ -3715,8 +3617,8 @@ class ps {
|
|
|
3715
3617
|
const e = document.createElement("div");
|
|
3716
3618
|
e.innerHTML = `
|
|
3717
3619
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
|
|
3718
|
-
<h3 style="margin: 0; color: ${
|
|
3719
|
-
<span id="render-debug-close" style="cursor: pointer; font-size: 20px; color: ${
|
|
3620
|
+
<h3 style="margin: 0; color: ${y.secondary}; font-size: 16px;">🔍 Render Debug Panel</h3>
|
|
3621
|
+
<span id="render-debug-close" style="cursor: pointer; font-size: 20px; color: ${y.secondary};">×</span>
|
|
3720
3622
|
</div>
|
|
3721
3623
|
`, this.panel.appendChild(e);
|
|
3722
3624
|
const t = document.createElement("div");
|
|
@@ -3740,7 +3642,7 @@ class ps {
|
|
|
3740
3642
|
"style",
|
|
3741
3643
|
`
|
|
3742
3644
|
padding: 8px 12px;
|
|
3743
|
-
background-color: ${
|
|
3645
|
+
background-color: ${y.primary};
|
|
3744
3646
|
color: white;
|
|
3745
3647
|
border: none;
|
|
3746
3648
|
border-radius: 4px;
|
|
@@ -3750,9 +3652,9 @@ class ps {
|
|
|
3750
3652
|
transition: background-color 0.2s;
|
|
3751
3653
|
`
|
|
3752
3654
|
), i.addEventListener("mouseenter", () => {
|
|
3753
|
-
i.style.backgroundColor =
|
|
3655
|
+
i.style.backgroundColor = y.accent;
|
|
3754
3656
|
}), i.addEventListener("mouseleave", () => {
|
|
3755
|
-
i.style.backgroundColor =
|
|
3657
|
+
i.style.backgroundColor = y.primary;
|
|
3756
3658
|
}), i;
|
|
3757
3659
|
}
|
|
3758
3660
|
injectStyles() {
|
|
@@ -3766,7 +3668,7 @@ class ps {
|
|
|
3766
3668
|
}
|
|
3767
3669
|
.render-section-title {
|
|
3768
3670
|
font-weight: 600;
|
|
3769
|
-
color: ${
|
|
3671
|
+
color: ${y.secondary};
|
|
3770
3672
|
font-size: 13px;
|
|
3771
3673
|
margin-bottom: 8px;
|
|
3772
3674
|
display: flex;
|
|
@@ -3812,7 +3714,7 @@ class ps {
|
|
|
3812
3714
|
}
|
|
3813
3715
|
.stat-value {
|
|
3814
3716
|
font-weight: 600;
|
|
3815
|
-
color: ${
|
|
3717
|
+
color: ${y.secondary};
|
|
3816
3718
|
}
|
|
3817
3719
|
.warning-box {
|
|
3818
3720
|
padding: 8px;
|
|
@@ -3915,7 +3817,7 @@ class ps {
|
|
|
3915
3817
|
);
|
|
3916
3818
|
} else
|
|
3917
3819
|
i.set(n.id, r);
|
|
3918
|
-
if (n instanceof
|
|
3820
|
+
if (n instanceof x && n.geometry) {
|
|
3919
3821
|
const o = this.getGeometryHash(n);
|
|
3920
3822
|
o !== "no-geometry" && o !== "no-position" && r.vertices > 0 && (s.has(o) || s.set(o, []), s.get(o).push(r));
|
|
3921
3823
|
}
|
|
@@ -3990,14 +3892,14 @@ class ps {
|
|
|
3990
3892
|
extractObjectInfo(e) {
|
|
3991
3893
|
var a, l;
|
|
3992
3894
|
let t = 0, i = 0, s = 0, n = "N/A";
|
|
3993
|
-
if (e instanceof
|
|
3895
|
+
if (e instanceof x) {
|
|
3994
3896
|
const c = e.geometry;
|
|
3995
3897
|
c && (c.attributes.position && (t = c.attributes.position.count), c.index ? i = c.index.count / 3 : i = t / 3), e instanceof oe ? (s = 1, n = "Instanced", i *= e.count) : e instanceof Z ? (s = 1, n = "Batched") : (s = e.visible ? 1 : 0, n = Array.isArray(e.material) ? "Multi-Material" : ((a = e.material) == null ? void 0 : a.type) || "Unknown");
|
|
3996
|
-
} else if (e instanceof
|
|
3898
|
+
} else if (e instanceof wt || e instanceof mt) {
|
|
3997
3899
|
s = e.visible ? 1 : 0, n = "Line";
|
|
3998
3900
|
const c = e.geometry;
|
|
3999
3901
|
c && c.attributes.position && (t = c.attributes.position.count);
|
|
4000
|
-
} else if (e instanceof
|
|
3902
|
+
} else if (e instanceof Et) {
|
|
4001
3903
|
s = e.visible ? 1 : 0, n = "Points";
|
|
4002
3904
|
const c = e.geometry;
|
|
4003
3905
|
c && c.attributes.position && (t = c.attributes.position.count);
|
|
@@ -4020,7 +3922,7 @@ class ps {
|
|
|
4020
3922
|
};
|
|
4021
3923
|
}
|
|
4022
3924
|
isRenderable(e) {
|
|
4023
|
-
return e instanceof
|
|
3925
|
+
return e instanceof x || e instanceof wt || e instanceof mt || e instanceof Et;
|
|
4024
3926
|
}
|
|
4025
3927
|
isVisibleInHierarchy(e) {
|
|
4026
3928
|
let t = e;
|
|
@@ -4046,7 +3948,7 @@ class ps {
|
|
|
4046
3948
|
return `v${s}_i${n}_${r}`;
|
|
4047
3949
|
}
|
|
4048
3950
|
categorizeObject(e, t, i) {
|
|
4049
|
-
e instanceof Z ? i.batchedMeshes.push(t) : e instanceof ce || e instanceof oe ? i.instancedMeshes.push(t) : e instanceof
|
|
3951
|
+
e instanceof Z ? i.batchedMeshes.push(t) : e instanceof ce || e instanceof oe ? i.instancedMeshes.push(t) : e instanceof x ? i.regularMeshes.push(t) : e instanceof wt || e instanceof mt ? i.edgeMeshes.push(t) : this.isRenderable(e) && i.otherObjects.push(t);
|
|
4050
3952
|
}
|
|
4051
3953
|
analyzeMergedModel(e) {
|
|
4052
3954
|
const t = this.viralViewerApi.viralScene.bimWorld, i = t.getDiagnostics();
|
|
@@ -4215,7 +4117,7 @@ class ps {
|
|
|
4215
4117
|
n.id === e && (i = n);
|
|
4216
4118
|
}), i !== void 0) {
|
|
4217
4119
|
const n = i;
|
|
4218
|
-
console.log("🔍 Selected object:", n), console.log(" - Name:", n.name), console.log(" - Type:", n.constructor.name), console.log(" - Visible:", n.visible), console.log(" - Position:", n.position), console.log(" - Parent:", ((s = n.parent) == null ? void 0 : s.name) || "Scene"), n instanceof
|
|
4120
|
+
console.log("🔍 Selected object:", n), console.log(" - Name:", n.name), console.log(" - Type:", n.constructor.name), console.log(" - Visible:", n.visible), console.log(" - Position:", n.position), console.log(" - Parent:", ((s = n.parent) == null ? void 0 : s.name) || "Scene"), n instanceof x && (console.log(" - Geometry:", n.geometry), console.log(" - Material:", n.material)), window.__VIRAL_DEBUG_SELECTED = n, console.log(" 📌 Object stored in window.__VIRAL_DEBUG_SELECTED for inspection");
|
|
4219
4121
|
}
|
|
4220
4122
|
}
|
|
4221
4123
|
logToConsole() {
|
|
@@ -4307,7 +4209,7 @@ class ps {
|
|
|
4307
4209
|
var a;
|
|
4308
4210
|
const i = " ".repeat(t), s = e.visible ? "✅" : "❌", n = e.constructor.name, r = e.children.length;
|
|
4309
4211
|
let o = "";
|
|
4310
|
-
e instanceof
|
|
4212
|
+
e instanceof x && e.geometry && (o = ` [V:${((a = e.geometry.attributes.position) == null ? void 0 : a.count) || 0}]`), e instanceof oe && (o += ` [Instances:${e.count}]`), console.log(
|
|
4311
4213
|
`${i}${s} ${e.name || "[unnamed]"} (${n})${o} [${r} children]`
|
|
4312
4214
|
), t < 3 ? e.children.forEach((l) => {
|
|
4313
4215
|
this.logObjectTree(l, t + 1);
|
|
@@ -4332,10 +4234,10 @@ class ps {
|
|
|
4332
4234
|
this.panel && (this.panel.remove(), this.panel = null);
|
|
4333
4235
|
}
|
|
4334
4236
|
}
|
|
4335
|
-
class
|
|
4237
|
+
class us {
|
|
4336
4238
|
// 5 seconds for cleanup
|
|
4337
4239
|
constructor(e) {
|
|
4338
|
-
this.viralViewerApi = e, this.clock = new
|
|
4240
|
+
this.viralViewerApi = e, this.clock = new ii(), this.lastSpatialUpdateTime = 0, this.lastCleanupTime = 0, this.spatialUpdateInterval = 16, this.cleanupInterval = 5e3, this.isRainEnabled = !1;
|
|
4339
4241
|
}
|
|
4340
4242
|
devAnimation() {
|
|
4341
4243
|
var i, s, n, r, o;
|
|
@@ -4378,7 +4280,7 @@ class ms {
|
|
|
4378
4280
|
this.isRainEnabled = e, this.isRainEnabled && this.rainAnimation();
|
|
4379
4281
|
}
|
|
4380
4282
|
}
|
|
4381
|
-
class
|
|
4283
|
+
class ps {
|
|
4382
4284
|
static generateRandomString(e) {
|
|
4383
4285
|
const t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
4384
4286
|
let i = "";
|
|
@@ -4389,19 +4291,19 @@ class gs {
|
|
|
4389
4291
|
return i;
|
|
4390
4292
|
}
|
|
4391
4293
|
}
|
|
4392
|
-
const
|
|
4393
|
-
class
|
|
4294
|
+
const ms = 0.032;
|
|
4295
|
+
class gs {
|
|
4394
4296
|
constructor(e, t, i, s, n = 2, r = 1, o, a) {
|
|
4395
|
-
this.viralViewerApi = e, this.scaleRatio = n, this.mixer = null, this.idleAnimation = null, this.walkAnimation = null, this.avatar = null, this.destination = null, this.isReady = !1, this.name = "", this.id =
|
|
4297
|
+
this.viralViewerApi = e, this.scaleRatio = n, this.mixer = null, this.idleAnimation = null, this.walkAnimation = null, this.avatar = null, this.destination = null, this.isReady = !1, this.name = "", this.id = ps.generateRandomString(10), this.MOVEMENT_SPEED = 0.032, this.talkContent = "", o && (this.id = o), a && (this.name = a, this.nameDiv = document.createElement("div"), this.nameDiv.setAttribute(
|
|
4396
4298
|
"style",
|
|
4397
4299
|
"position: absolute; top:0; left:0;transform: translateX(-50%); pointer-events: none; background-color:rgba(226, 230, 220,1); color:rgb(23, 49, 44); padding: 5px ; border-radius:5px; font-size:x-small"
|
|
4398
4300
|
), this.nameDiv.id = this.id, this.nameDiv.append(this.name), this.viralViewerApi.targetElement.appendChild(this.nameDiv)), this.chatDiv = document.createElement("div"), this.chatDiv.setAttribute(
|
|
4399
4301
|
"style",
|
|
4400
4302
|
"position: absolute;display:none; top:0; left:0;transform: translate(-50%, -100%); pointer-events: none; background-color:rgba(226, 230, 220,1); color:rgb(23, 49, 44); padding: 5px ; border-radius:5px; font-size:x-small"
|
|
4401
|
-
), this.viralViewerApi.targetElement.appendChild(this.chatDiv), this.MOVEMENT_SPEED =
|
|
4303
|
+
), this.viralViewerApi.targetElement.appendChild(this.chatDiv), this.MOVEMENT_SPEED = ms * r, this.viralViewerApi.viralLoader.threeLoader.loadGLTF(t, (l) => {
|
|
4402
4304
|
this.avatar = l.scene;
|
|
4403
4305
|
const c = new E(n, n, n);
|
|
4404
|
-
this.avatar.scale.copy(c), console.log(this.avatar), this.mixer = new
|
|
4306
|
+
this.avatar.scale.copy(c), console.log(this.avatar), this.mixer = new si(l.scene), this.viralViewerApi.viralScene.scene.add(l.scene), this.viralViewerApi.viralRenderer.render(), this.viralViewerApi.viralLoader.threeLoader.loadGLTF(i, (h) => {
|
|
4405
4307
|
this.idleAnimation = this.mixer.clipAction(h.animations[0]), this.viralViewerApi.viralLoader.threeLoader.loadGLTF(s, (d) => {
|
|
4406
4308
|
this.walkAnimation = this.mixer.clipAction(d.animations[0]), Q.information("load avatar succeed!"), this.isReady = !0, this.idle();
|
|
4407
4309
|
});
|
|
@@ -4461,12 +4363,12 @@ class vs {
|
|
|
4461
4363
|
(e = this.avatar) == null || e.removeFromParent(), this.mixer = null, this.walkAnimation = null, this.avatar = null, (i = (t = this.nameDiv) == null ? void 0 : t.parentNode) == null || i.removeChild(this.nameDiv), (n = (s = this.chatDiv) == null ? void 0 : s.parentNode) == null || n.removeChild(this.chatDiv);
|
|
4462
4364
|
}
|
|
4463
4365
|
}
|
|
4464
|
-
class
|
|
4366
|
+
class fs {
|
|
4465
4367
|
constructor(e) {
|
|
4466
4368
|
this.viralViewerApi = e, this.avatars = [];
|
|
4467
4369
|
}
|
|
4468
4370
|
load(e, t, i, s = 2, n = 1, r, o) {
|
|
4469
|
-
const a = new
|
|
4371
|
+
const a = new gs(
|
|
4470
4372
|
this.viralViewerApi,
|
|
4471
4373
|
e,
|
|
4472
4374
|
t,
|
|
@@ -4483,30 +4385,30 @@ class bs {
|
|
|
4483
4385
|
t && t.dispose(), this.avatars = this.avatars.filter((i) => i.id !== e);
|
|
4484
4386
|
}
|
|
4485
4387
|
}
|
|
4486
|
-
class
|
|
4388
|
+
class vs {
|
|
4487
4389
|
constructor() {
|
|
4488
|
-
|
|
4390
|
+
ne.prototype.computeBoundsTree = Vi, ne.prototype.disposeBoundsTree = Ii, x.prototype.raycast = Ti;
|
|
4489
4391
|
}
|
|
4490
4392
|
applyThreeMeshBVH(e) {
|
|
4491
4393
|
e.boundsTree || e.computeBoundsTree();
|
|
4492
4394
|
}
|
|
4493
4395
|
}
|
|
4494
|
-
const
|
|
4495
|
-
Vector2:
|
|
4396
|
+
const bs = {
|
|
4397
|
+
Vector2: H,
|
|
4496
4398
|
Vector3: E,
|
|
4497
|
-
Vector4:
|
|
4498
|
-
Quaternion:
|
|
4499
|
-
Matrix4:
|
|
4500
|
-
Spherical:
|
|
4501
|
-
Box3:
|
|
4502
|
-
Sphere:
|
|
4503
|
-
Raycaster:
|
|
4504
|
-
MathUtils:
|
|
4399
|
+
Vector4: ni,
|
|
4400
|
+
Quaternion: ri,
|
|
4401
|
+
Matrix4: se,
|
|
4402
|
+
Spherical: Ht,
|
|
4403
|
+
Box3: j,
|
|
4404
|
+
Sphere: Ft,
|
|
4405
|
+
Raycaster: It,
|
|
4406
|
+
MathUtils: ai
|
|
4505
4407
|
};
|
|
4506
|
-
pe.install({ THREE:
|
|
4507
|
-
class
|
|
4408
|
+
pe.install({ THREE: bs });
|
|
4409
|
+
class ws {
|
|
4508
4410
|
constructor(e) {
|
|
4509
|
-
this.viralViewerApi = e, this.raycaster = new
|
|
4411
|
+
this.viralViewerApi = e, this.raycaster = new It(), this.camera = null, this._orthoCamera = null, this._perspectiveCamera = null, this._frustumSize = 200, this.cameraControls = null, this.onUsing = !1, this.modelId = "0", this.elementId = "243274", this.cameraWakeQueuedEvents = [], this.cameraSleepQueuedEvents = [], this.cameraUpdateQueuedEvents = [], this.targetElement = this.viralViewerApi.options.container, this.setupCamera(), this.viralViewerApi.emit(k.LOADED_CAMERA);
|
|
4510
4412
|
}
|
|
4511
4413
|
setupCamera() {
|
|
4512
4414
|
this._perspectiveCamera = new He(
|
|
@@ -4679,7 +4581,7 @@ class xs {
|
|
|
4679
4581
|
const t = this.viralViewerApi.viralScene.scene;
|
|
4680
4582
|
if (!t || !this.camera)
|
|
4681
4583
|
return;
|
|
4682
|
-
const s = new
|
|
4584
|
+
const s = new j().setFromObject(t).getSize(new E()), n = Math.max(s.x, s.y, s.z);
|
|
4683
4585
|
this.camera.far = n + e, this.camera.updateProjectionMatrix(), this.cameraControls && (this.cameraControls.maxDistance = this.camera.far * 0.95);
|
|
4684
4586
|
}
|
|
4685
4587
|
/**
|
|
@@ -4741,7 +4643,7 @@ class xs {
|
|
|
4741
4643
|
*/
|
|
4742
4644
|
async focusCameraOnModel(e, t = !1) {
|
|
4743
4645
|
var u, p, m, f, v;
|
|
4744
|
-
const i = new E(-e.box.min.X, e.box.min.Z, e.box.min.Y), s = new E(-e.box.max.X, e.box.max.Z, e.box.max.Y), n =
|
|
4646
|
+
const i = new E(-e.box.min.X, e.box.min.Z, e.box.min.Y), s = new E(-e.box.max.X, e.box.max.Z, e.box.max.Y), n = R.middlePoint(i, s), r = Math.abs(e.box.max.X - e.box.min.X), o = Math.abs(e.box.max.Y - e.box.min.Y), a = Math.abs(e.box.max.Z - e.box.min.Z), l = Math.max(r, o, a);
|
|
4745
4647
|
await ((u = this.viralViewerApi.viralCamera.cameraControls) == null ? void 0 : u.setTarget(
|
|
4746
4648
|
n.x,
|
|
4747
4649
|
n.y,
|
|
@@ -4751,7 +4653,7 @@ class xs {
|
|
|
4751
4653
|
2 * l / 2,
|
|
4752
4654
|
-(2 * l) / 2
|
|
4753
4655
|
));
|
|
4754
|
-
const c = new
|
|
4656
|
+
const c = new j(i, s);
|
|
4755
4657
|
await ((m = this.viralViewerApi.viralCamera.cameraControls) == null ? void 0 : m.fitToBox(c, !1));
|
|
4756
4658
|
const h = new E();
|
|
4757
4659
|
(f = this.viralViewerApi.viralCamera.cameraControls) == null || f.getPosition(h);
|
|
@@ -4765,27 +4667,27 @@ class xs {
|
|
|
4765
4667
|
}
|
|
4766
4668
|
//#endregion
|
|
4767
4669
|
}
|
|
4768
|
-
class
|
|
4670
|
+
class ys {
|
|
4769
4671
|
pakoUnzip(e) {
|
|
4770
4672
|
const t = new Uint8Array(e);
|
|
4771
4673
|
return Pi(t);
|
|
4772
4674
|
}
|
|
4773
4675
|
pakoStreamUnzip(e) {
|
|
4774
|
-
const t = new
|
|
4676
|
+
const t = new Oi();
|
|
4775
4677
|
return t.push(e, !0), t.result;
|
|
4776
4678
|
}
|
|
4777
4679
|
}
|
|
4778
|
-
class
|
|
4680
|
+
class ie {
|
|
4779
4681
|
constructor(e, t, i) {
|
|
4780
4682
|
this.x = 0, this.y = 0, this.z = 0, this.x = e, this.y = t, this.z = i;
|
|
4781
4683
|
}
|
|
4782
4684
|
}
|
|
4783
|
-
class
|
|
4685
|
+
class O {
|
|
4784
4686
|
static doesEdgeIncludePlane(e, t, i, s, n, r = 1e-7) {
|
|
4785
|
-
const o =
|
|
4687
|
+
const o = O.subtract(s, i), a = O.subtract(n, i), l = O.crossProduct(o, a), c = -O.dotProduct(l, i), h = O.dotProduct(l, e) + c, d = O.dotProduct(l, t) + c;
|
|
4786
4688
|
if (Math.abs(h) > r || Math.abs(d) > r)
|
|
4787
4689
|
return !1;
|
|
4788
|
-
const u =
|
|
4690
|
+
const u = O.isPointInTriangle(e, i, s, n, r), p = O.isPointInTriangle(t, i, s, n, r);
|
|
4789
4691
|
return !(!u || !p);
|
|
4790
4692
|
}
|
|
4791
4693
|
/**
|
|
@@ -4798,14 +4700,14 @@ class T {
|
|
|
4798
4700
|
* @returns boolean - Whether the edge intersects the triangle
|
|
4799
4701
|
*/
|
|
4800
4702
|
static doesEdgeIntersectTriangle(e, t, i, s, n, r = 5) {
|
|
4801
|
-
const o =
|
|
4703
|
+
const o = O.subtract(s, i), a = O.subtract(n, i), l = O.crossProduct(o, a), c = -O.dotProduct(l, i), h = O.subtract(t, e), d = O.dotProduct(l, h);
|
|
4802
4704
|
if (Math.abs(d) < 1e-7)
|
|
4803
4705
|
return !1;
|
|
4804
|
-
const u = -(
|
|
4706
|
+
const u = -(O.dotProduct(l, e) + c) / d;
|
|
4805
4707
|
if (u < -r || u > 1 + r)
|
|
4806
4708
|
return !1;
|
|
4807
|
-
const p =
|
|
4808
|
-
return m < r || f < r ? !1 :
|
|
4709
|
+
const p = O.add(e, O.scale(h, u)), m = O.distance(p, e), f = O.distance(p, t);
|
|
4710
|
+
return m < r || f < r ? !1 : O.isPointInTriangle(p, i, s, n, r);
|
|
4809
4711
|
}
|
|
4810
4712
|
/**
|
|
4811
4713
|
* Check if a point lies inside a triangle using barycentric coordinates
|
|
@@ -4816,7 +4718,7 @@ class T {
|
|
|
4816
4718
|
* @returns boolean - Whether the point lies inside the triangle
|
|
4817
4719
|
*/
|
|
4818
4720
|
static isPointInTriangle(e, t, i, s, n = 1e-7) {
|
|
4819
|
-
const r =
|
|
4721
|
+
const r = O.subtract(i, t), o = O.subtract(s, i), a = O.subtract(t, s), l = O.subtract(e, t), c = O.subtract(e, i), h = O.subtract(e, s), d = O.crossProduct(r, l), u = O.crossProduct(o, c), p = O.crossProduct(a, h), m = O.normalize(d), f = O.normalize(u), v = O.normalize(p), b = O.dotProduct(m, f), w = O.dotProduct(f, v);
|
|
4820
4722
|
return b > 1 - n && w > 1 - n;
|
|
4821
4723
|
}
|
|
4822
4724
|
// Vector math helper functions
|
|
@@ -4843,22 +4745,22 @@ class T {
|
|
|
4843
4745
|
const t = Math.sqrt(
|
|
4844
4746
|
e.x * e.x + e.y * e.y + e.z * e.z
|
|
4845
4747
|
);
|
|
4846
|
-
return t < 1e-7 ? new
|
|
4748
|
+
return t < 1e-7 ? new ie(0, 0, 0) : new ie(e.x / t, e.y / t, e.z / t);
|
|
4847
4749
|
}
|
|
4848
4750
|
static distance(e, t) {
|
|
4849
4751
|
return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2 + (e.z - t.z) ** 2);
|
|
4850
4752
|
}
|
|
4851
4753
|
static doTrianglesIntersect(e, t, i, s, n, r, o = 1e-3) {
|
|
4852
|
-
return !!(
|
|
4754
|
+
return !!(O.doesEdgeIntersectTriangle(e, t, s, n, r, o) || O.doesEdgeIntersectTriangle(t, i, s, n, r, o) || O.doesEdgeIntersectTriangle(i, e, s, n, r, o));
|
|
4853
4755
|
}
|
|
4854
4756
|
static objectsIntersect(e, t, i = 1e-3) {
|
|
4855
4757
|
for (let s = 0; s < e.length; s += 9) {
|
|
4856
|
-
const n = new
|
|
4758
|
+
const n = new ie(e[s], e[s + 1], e[s + 2]), r = new ie(e[s + 3], e[s + 4], e[s + 5]), o = new ie(e[s + 6], e[s + 7], e[s + 8]);
|
|
4857
4759
|
for (let a = 0; a < t.length; a += 9) {
|
|
4858
|
-
const l = new
|
|
4859
|
-
if (
|
|
4760
|
+
const l = new ie(t[a], t[a + 1], t[a + 2]), c = new ie(t[a + 3], t[a + 4], t[a + 5]), h = new ie(t[a + 6], t[a + 7], t[a + 8]);
|
|
4761
|
+
if (O.doesEdgeIncludePlane(n, r, l, c, h, i) && O.doesEdgeIncludePlane(r, o, l, c, h, i))
|
|
4860
4762
|
return console.log("belong to face"), !1;
|
|
4861
|
-
if (
|
|
4763
|
+
if (O.doTrianglesIntersect(n, r, o, l, c, h, i))
|
|
4862
4764
|
return !0;
|
|
4863
4765
|
}
|
|
4864
4766
|
}
|
|
@@ -4869,7 +4771,7 @@ class T {
|
|
|
4869
4771
|
return i && s && n;
|
|
4870
4772
|
}
|
|
4871
4773
|
}
|
|
4872
|
-
function
|
|
4774
|
+
function xs() {
|
|
4873
4775
|
class g {
|
|
4874
4776
|
constructor(t, i, s) {
|
|
4875
4777
|
this.X = 0, this.Y = 0, this.Z = 0, this.X = t, this.Y = i, this.Z = s;
|
|
@@ -4891,11 +4793,11 @@ function Es() {
|
|
|
4891
4793
|
self.postMessage(i());
|
|
4892
4794
|
};
|
|
4893
4795
|
}
|
|
4894
|
-
const
|
|
4895
|
-
class
|
|
4796
|
+
const Ms = xs;
|
|
4797
|
+
class Es {
|
|
4896
4798
|
constructor() {
|
|
4897
|
-
const e = new Blob([`(${
|
|
4898
|
-
this.workerPool = new
|
|
4799
|
+
const e = new Blob([`(${Ms})()`]), t = URL.createObjectURL(e);
|
|
4800
|
+
this.workerPool = new ee(navigator.hardwareConcurrency || 10, t);
|
|
4899
4801
|
}
|
|
4900
4802
|
getBoundingBox(e, t = (i) => {
|
|
4901
4803
|
}) {
|
|
@@ -4907,7 +4809,7 @@ class Cs {
|
|
|
4907
4809
|
);
|
|
4908
4810
|
}
|
|
4909
4811
|
}
|
|
4910
|
-
function
|
|
4812
|
+
function Cs() {
|
|
4911
4813
|
self.onmessage = (g) => {
|
|
4912
4814
|
const e = g.data;
|
|
4913
4815
|
function t(s, n, r = 0.1) {
|
|
@@ -4925,11 +4827,11 @@ function As() {
|
|
|
4925
4827
|
self.postMessage(i);
|
|
4926
4828
|
};
|
|
4927
4829
|
}
|
|
4928
|
-
const
|
|
4929
|
-
class
|
|
4830
|
+
const Ss = Cs;
|
|
4831
|
+
class As {
|
|
4930
4832
|
constructor() {
|
|
4931
|
-
const e = new Blob([`(${
|
|
4932
|
-
this.workerPool = new
|
|
4833
|
+
const e = new Blob([`(${Ss})()`]), t = URL.createObjectURL(e);
|
|
4834
|
+
this.workerPool = new ee(4, t);
|
|
4933
4835
|
}
|
|
4934
4836
|
checkIntersect(e, t = (i) => {
|
|
4935
4837
|
}) {
|
|
@@ -4938,7 +4840,7 @@ class Is {
|
|
|
4938
4840
|
});
|
|
4939
4841
|
}
|
|
4940
4842
|
}
|
|
4941
|
-
function
|
|
4843
|
+
function _s() {
|
|
4942
4844
|
class g {
|
|
4943
4845
|
constructor() {
|
|
4944
4846
|
this.children = /* @__PURE__ */ new Map(), this.keys = /* @__PURE__ */ new Set();
|
|
@@ -5030,11 +4932,11 @@ function Vs() {
|
|
|
5030
4932
|
}
|
|
5031
4933
|
};
|
|
5032
4934
|
}
|
|
5033
|
-
const
|
|
5034
|
-
class
|
|
4935
|
+
const Vs = _s;
|
|
4936
|
+
class Is {
|
|
5035
4937
|
constructor() {
|
|
5036
|
-
const e = new Blob([`(${
|
|
5037
|
-
this.workerPool = new
|
|
4938
|
+
const e = new Blob([`(${Vs})()`]), t = URL.createObjectURL(e);
|
|
4939
|
+
this.workerPool = new ee(2, t);
|
|
5038
4940
|
}
|
|
5039
4941
|
buildTreeNode(e, t = (i) => {
|
|
5040
4942
|
}) {
|
|
@@ -5043,7 +4945,7 @@ class Ts {
|
|
|
5043
4945
|
});
|
|
5044
4946
|
}
|
|
5045
4947
|
}
|
|
5046
|
-
function
|
|
4948
|
+
function Ts() {
|
|
5047
4949
|
class g {
|
|
5048
4950
|
constructor(u, p, m) {
|
|
5049
4951
|
this.x = 0, this.y = 0, this.z = 0, this.x = u, this.y = p, this.z = m;
|
|
@@ -5078,46 +4980,46 @@ function Os() {
|
|
|
5078
4980
|
return Math.sqrt((d.x - u.x) ** 2 + (d.y - u.y) ** 2 + (d.z - u.z) ** 2);
|
|
5079
4981
|
}
|
|
5080
4982
|
function a(d, u, p, m, f = 1e-7) {
|
|
5081
|
-
const v = e(p, u), b = e(m, p), w = e(u, m),
|
|
5082
|
-
return
|
|
4983
|
+
const v = e(p, u), b = e(m, p), w = e(u, m), C = e(d, u), A = e(d, p), S = e(d, m), _ = n(v, C), V = n(b, A), T = n(w, S), M = r(_), I = r(V), D = r(T), B = s(M, I), P = s(I, D);
|
|
4984
|
+
return B > 1 - f && P > 1 - f;
|
|
5083
4985
|
}
|
|
5084
4986
|
function l(d, u, p, m, f, v, b = 1e-3) {
|
|
5085
4987
|
return !!(h(d, u, m, f, v, b) || h(u, p, m, f, v, b) || h(p, d, m, f, v, b));
|
|
5086
4988
|
}
|
|
5087
4989
|
function c(d, u, p, m, f, v = 1e-7) {
|
|
5088
|
-
const b = e(m, p), w = e(f, p),
|
|
5089
|
-
if (Math.abs(
|
|
4990
|
+
const b = e(m, p), w = e(f, p), C = n(b, w), A = -s(C, p), S = s(C, d) + A, _ = s(C, u) + A;
|
|
4991
|
+
if (Math.abs(S) > v || Math.abs(_) > v)
|
|
5090
4992
|
return !1;
|
|
5091
|
-
const
|
|
5092
|
-
return !(!
|
|
4993
|
+
const V = a(d, p, m, f, v), T = a(u, p, m, f, v);
|
|
4994
|
+
return !(!V || !T);
|
|
5093
4995
|
}
|
|
5094
4996
|
function h(d, u, p, m, f, v = 5) {
|
|
5095
|
-
const b = e(m, p), w = e(f, p),
|
|
5096
|
-
if (Math.abs(
|
|
4997
|
+
const b = e(m, p), w = e(f, p), C = n(b, w), A = -s(C, p), S = e(u, d), _ = s(C, S);
|
|
4998
|
+
if (Math.abs(_) < 1e-7)
|
|
5097
4999
|
return !1;
|
|
5098
|
-
const
|
|
5099
|
-
if (
|
|
5000
|
+
const V = -(s(C, d) + A) / _;
|
|
5001
|
+
if (V < -v || V > 1 + v)
|
|
5100
5002
|
return !1;
|
|
5101
|
-
const
|
|
5102
|
-
return
|
|
5003
|
+
const T = t(d, i(S, V)), M = o(T, d), I = o(T, u);
|
|
5004
|
+
return M < v || I < v ? !1 : a(T, p, m, f, v);
|
|
5103
5005
|
}
|
|
5104
5006
|
self.onmessage = (d) => {
|
|
5105
5007
|
const u = d.data, p = u.buffer1, m = u.buffer2, f = 1e-3;
|
|
5106
5008
|
for (let v = 0; v < p.length; v += 9) {
|
|
5107
|
-
const b = new g(p[v], p[v + 1], p[v + 2]), w = new g(p[v + 3], p[v + 4], p[v + 5]),
|
|
5009
|
+
const b = new g(p[v], p[v + 1], p[v + 2]), w = new g(p[v + 3], p[v + 4], p[v + 5]), C = new g(p[v + 6], p[v + 7], p[v + 8]);
|
|
5108
5010
|
for (let A = 0; A < m.length; A += 9) {
|
|
5109
|
-
const
|
|
5110
|
-
c(b, w,
|
|
5011
|
+
const S = new g(m[A], m[A + 1], m[A + 2]), _ = new g(m[A + 3], m[A + 4], m[A + 5]), V = new g(m[A + 6], m[A + 7], m[A + 8]);
|
|
5012
|
+
c(b, w, S, _, V, f) && c(w, C, S, _, V, f) && (console.log("belong to face"), self.postMessage(!1)), l(b, w, C, S, _, V, f) && self.postMessage(!0);
|
|
5111
5013
|
}
|
|
5112
5014
|
}
|
|
5113
5015
|
self.postMessage(!1);
|
|
5114
5016
|
};
|
|
5115
5017
|
}
|
|
5116
|
-
const
|
|
5117
|
-
class
|
|
5018
|
+
const Ps = Ts;
|
|
5019
|
+
class Os {
|
|
5118
5020
|
constructor() {
|
|
5119
|
-
const e = new Blob([`(${
|
|
5120
|
-
this.workerPool = new
|
|
5021
|
+
const e = new Blob([`(${Ps})()`]), t = URL.createObjectURL(e);
|
|
5022
|
+
this.workerPool = new ee(navigator.hardwareConcurrency || 10, t);
|
|
5121
5023
|
}
|
|
5122
5024
|
checkClash(e, t = (i) => {
|
|
5123
5025
|
}) {
|
|
@@ -5126,7 +5028,7 @@ class Rs {
|
|
|
5126
5028
|
});
|
|
5127
5029
|
}
|
|
5128
5030
|
}
|
|
5129
|
-
function
|
|
5031
|
+
function Ds() {
|
|
5130
5032
|
self.addEventListener(
|
|
5131
5033
|
"message",
|
|
5132
5034
|
(g) => {
|
|
@@ -5160,28 +5062,28 @@ function Ls() {
|
|
|
5160
5062
|
!1
|
|
5161
5063
|
);
|
|
5162
5064
|
}
|
|
5163
|
-
const
|
|
5164
|
-
class
|
|
5065
|
+
const Rs = Ds;
|
|
5066
|
+
class Ls {
|
|
5165
5067
|
constructor() {
|
|
5166
|
-
const e = new Blob([`(${
|
|
5167
|
-
this.workerPool = new
|
|
5068
|
+
const e = new Blob([`(${Rs})()`]), t = URL.createObjectURL(e);
|
|
5069
|
+
this.workerPool = new ee(2, t);
|
|
5168
5070
|
}
|
|
5169
5071
|
fetch(e, t = (n) => {
|
|
5170
5072
|
}, i, s) {
|
|
5171
|
-
const n = new
|
|
5073
|
+
const n = new ks(e, i, s);
|
|
5172
5074
|
this.workerPool.Enqueue(n, (r) => {
|
|
5173
5075
|
t(r);
|
|
5174
5076
|
});
|
|
5175
5077
|
}
|
|
5176
5078
|
}
|
|
5177
|
-
class
|
|
5079
|
+
class ks {
|
|
5178
5080
|
constructor(e, t, i) {
|
|
5179
5081
|
this.url = "", this.url = e, this.byteRangeStart = t, this.byteRangeEnd = i;
|
|
5180
5082
|
}
|
|
5181
5083
|
}
|
|
5182
|
-
class
|
|
5084
|
+
class Bs {
|
|
5183
5085
|
constructor(e) {
|
|
5184
|
-
this.viralViewerApi = e, this.dataTree = [], this.trackingData = /* @__PURE__ */ new Map(), this.fetchDataWorker = new
|
|
5086
|
+
this.viralViewerApi = e, this.dataTree = [], this.trackingData = /* @__PURE__ */ new Map(), this.fetchDataWorker = new Ls(), this.buildTreeNodeWorker = new Is(), this._boundingBoxWorker = new Es(), this._boundingBoxIntersectWorker = new As(), this._checkClashWorker = new Os(), this.searchValue = "", this.firstElementId = "211850", this.secondElementId = "680539", this.groupByKeyword = "Category", this._shallowCompare = (t, i) => JSON.stringify(Object.keys(t).sort()) === JSON.stringify(Object.keys(i).sort()) && JSON.stringify(Object.values(t).sort()) === JSON.stringify(Object.values(i).sort());
|
|
5185
5087
|
}
|
|
5186
5088
|
addTrackingData(e, t) {
|
|
5187
5089
|
this.trackingData.set(e, t);
|
|
@@ -5231,8 +5133,8 @@ class Ns {
|
|
|
5231
5133
|
addData(e) {
|
|
5232
5134
|
const t = performance.now(), i = Object.keys(e.Data).length;
|
|
5233
5135
|
console.log(`[DataManager] Adding ${i} elements to data tree...`);
|
|
5234
|
-
const s = new
|
|
5235
|
-
s.addElements(e.Data), e.Relationships && (s.addRelationships(e.Relationships), s.buildGraphIndex()), this.dataTree.push(s), this.viralViewerApi.emit(
|
|
5136
|
+
const s = new rs();
|
|
5137
|
+
s.addElements(e.Data), e.Relationships && (s.addRelationships(e.Relationships), s.buildGraphIndex()), this.dataTree.push(s), this.viralViewerApi.emit(k.LOADED_DATA, {
|
|
5236
5138
|
modelId: this.dataTree.length - 1
|
|
5237
5139
|
}), console.log(
|
|
5238
5140
|
`[DataManager] Data tree created in ${(performance.now() - t).toFixed(2)}ms`
|
|
@@ -5309,7 +5211,7 @@ class Ns {
|
|
|
5309
5211
|
* @returns
|
|
5310
5212
|
*/
|
|
5311
5213
|
compareModels(e = 0, t = 1) {
|
|
5312
|
-
const i = new
|
|
5214
|
+
const i = new as();
|
|
5313
5215
|
if (!this.dataTree[e] || !this.dataTree[t])
|
|
5314
5216
|
return i;
|
|
5315
5217
|
const s = this.dataTree[e].elementData, n = this.dataTree[t].elementData, r = this._getDiffKeys(s[0], n[0]);
|
|
@@ -5337,46 +5239,46 @@ class Ns {
|
|
|
5337
5239
|
}
|
|
5338
5240
|
return this.viralViewerApi.viralVisibilityManager.exceptElements = [], this.viralViewerApi.viralScene.bimWorld.changeColor(
|
|
5339
5241
|
i.deleted.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
|
|
5340
|
-
|
|
5242
|
+
R.hexToRGB(y.deleted),
|
|
5341
5243
|
!0
|
|
5342
5244
|
), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
|
|
5343
5245
|
elements: i.deleted.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
|
|
5344
|
-
color:
|
|
5246
|
+
color: R.hexToRGB(y.deleted)
|
|
5345
5247
|
}), this.viralViewerApi.viralScene.bimWorld.changeColor(
|
|
5346
5248
|
i.added.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
|
|
5347
|
-
|
|
5249
|
+
R.hexToRGB(y.added),
|
|
5348
5250
|
!0
|
|
5349
5251
|
), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
|
|
5350
5252
|
elements: i.added.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
|
|
5351
|
-
color:
|
|
5253
|
+
color: R.hexToRGB(y.added)
|
|
5352
5254
|
}), this.viralViewerApi.viralScene.bimWorld.changeColor(
|
|
5353
5255
|
i.modified.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
|
|
5354
|
-
|
|
5256
|
+
R.hexToRGB(y.modified),
|
|
5355
5257
|
!0
|
|
5356
5258
|
), this.viralViewerApi.viralScene.bimWorld.changeColor(
|
|
5357
5259
|
i.modified.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
|
|
5358
|
-
|
|
5260
|
+
R.hexToRGB(y.modified),
|
|
5359
5261
|
!0
|
|
5360
5262
|
), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
|
|
5361
5263
|
elements: i.modified.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
|
|
5362
|
-
color:
|
|
5264
|
+
color: R.hexToRGB(y.modified)
|
|
5363
5265
|
}), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
|
|
5364
5266
|
elements: i.modified.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
|
|
5365
|
-
color:
|
|
5267
|
+
color: R.hexToRGB(y.modified)
|
|
5366
5268
|
}), this.viralViewerApi.viralScene.bimWorld.changeColor(
|
|
5367
5269
|
i.notChanged.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
|
|
5368
|
-
|
|
5270
|
+
R.hexToRGB(y.notChanged),
|
|
5369
5271
|
!0
|
|
5370
5272
|
), this.viralViewerApi.viralScene.bimWorld.changeColor(
|
|
5371
5273
|
i.notChanged.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
|
|
5372
|
-
|
|
5274
|
+
R.hexToRGB(y.notChanged),
|
|
5373
5275
|
!0
|
|
5374
5276
|
), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
|
|
5375
5277
|
elements: i.notChanged.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
|
|
5376
|
-
color:
|
|
5278
|
+
color: R.hexToRGB(y.notChanged)
|
|
5377
5279
|
}), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
|
|
5378
5280
|
elements: i.notChanged.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
|
|
5379
|
-
color:
|
|
5281
|
+
color: R.hexToRGB(y.notChanged)
|
|
5380
5282
|
}), this.viralViewerApi.viralRenderer.render(), i;
|
|
5381
5283
|
}
|
|
5382
5284
|
uncompareModels() {
|
|
@@ -5405,7 +5307,7 @@ class Ns {
|
|
|
5405
5307
|
if (i.length > 0 && s.length > 0) {
|
|
5406
5308
|
const n = i[0], r = s[0];
|
|
5407
5309
|
console.log(
|
|
5408
|
-
|
|
5310
|
+
O.objectsIntersect(
|
|
5409
5311
|
Array.from(n.buffer),
|
|
5410
5312
|
Array.from(r.buffer)
|
|
5411
5313
|
)
|
|
@@ -5418,7 +5320,7 @@ class Ns {
|
|
|
5418
5320
|
* @param secondModelIndex
|
|
5419
5321
|
*/
|
|
5420
5322
|
async checkClashModels(e = 0, t = 0) {
|
|
5421
|
-
const i = new
|
|
5323
|
+
const i = new os(), s = this.viralViewerApi.viralScene.bimWorld.getElementsByModel(e), n = e === t ? s : this.viralViewerApi.viralScene.bimWorld.getElementsByModel(t);
|
|
5422
5324
|
if (s.length === 0 || n.length === 0)
|
|
5423
5325
|
return i;
|
|
5424
5326
|
const r = (h) => new Promise((d) => {
|
|
@@ -5459,30 +5361,30 @@ class Ns {
|
|
|
5459
5361
|
(w) => f.includes(Number.parseInt(w.elementId))
|
|
5460
5362
|
), b = [];
|
|
5461
5363
|
for (let w = 0; w < v.length; w++) {
|
|
5462
|
-
const
|
|
5463
|
-
if (d.buffer &&
|
|
5464
|
-
const A = () => new Promise((
|
|
5364
|
+
const C = v[w];
|
|
5365
|
+
if (d.buffer && C.buffer) {
|
|
5366
|
+
const A = () => new Promise((S) => {
|
|
5465
5367
|
this._checkClashWorker.checkClash(
|
|
5466
5368
|
{
|
|
5467
5369
|
buffer1: Array.from(d.buffer),
|
|
5468
|
-
buffer2: Array.from(
|
|
5370
|
+
buffer2: Array.from(C.buffer)
|
|
5469
5371
|
},
|
|
5470
|
-
(
|
|
5471
|
-
if (
|
|
5372
|
+
(_) => {
|
|
5373
|
+
if (_) {
|
|
5472
5374
|
i.clashes.containsKey(
|
|
5473
5375
|
Number.parseInt(d.elementId)
|
|
5474
5376
|
) || i.clashes.add(
|
|
5475
5377
|
Number.parseInt(d.elementId),
|
|
5476
5378
|
[]
|
|
5477
5379
|
);
|
|
5478
|
-
const
|
|
5380
|
+
const V = i.clashes.get(
|
|
5479
5381
|
Number.parseInt(d.elementId)
|
|
5480
5382
|
);
|
|
5481
|
-
|
|
5482
|
-
Number.parseInt(
|
|
5383
|
+
V == null || V.push(
|
|
5384
|
+
Number.parseInt(C.elementId)
|
|
5483
5385
|
);
|
|
5484
5386
|
}
|
|
5485
|
-
|
|
5387
|
+
S();
|
|
5486
5388
|
}
|
|
5487
5389
|
);
|
|
5488
5390
|
});
|
|
@@ -5509,7 +5411,7 @@ class Ns {
|
|
|
5509
5411
|
(h) => this._shallowCompare(h.value, l)
|
|
5510
5412
|
);
|
|
5511
5413
|
if (c < 0) {
|
|
5512
|
-
const h = new
|
|
5414
|
+
const h = new ls();
|
|
5513
5415
|
h.value = l, h.modelId = s, h.elementIds = [], h.elementIds.push(Number(o)), t.push(h);
|
|
5514
5416
|
} else
|
|
5515
5417
|
t[c].elementIds.push(Number(o));
|
|
@@ -5536,20 +5438,20 @@ class Ns {
|
|
|
5536
5438
|
}
|
|
5537
5439
|
//#endregion
|
|
5538
5440
|
}
|
|
5539
|
-
class
|
|
5441
|
+
class zs {
|
|
5540
5442
|
constructor() {
|
|
5541
5443
|
this.events = {
|
|
5542
|
-
[
|
|
5543
|
-
[
|
|
5544
|
-
[
|
|
5545
|
-
[
|
|
5546
|
-
[
|
|
5547
|
-
[
|
|
5548
|
-
[
|
|
5549
|
-
[
|
|
5550
|
-
[
|
|
5551
|
-
[
|
|
5552
|
-
[
|
|
5444
|
+
[k.LOADED_SCENE]: [],
|
|
5445
|
+
[k.LOADED_MATERIAL_MANAGER]: [],
|
|
5446
|
+
[k.LOADED_RENDERER]: [],
|
|
5447
|
+
[k.LOADED_CAMERA]: [],
|
|
5448
|
+
[k.LOADED_CUBE]: [],
|
|
5449
|
+
[k.LOADED_TOOLS]: [],
|
|
5450
|
+
[k.LOADED_SEPERATE_MODEL]: [],
|
|
5451
|
+
[k.GENERATED_MERGE_MODEL]: [],
|
|
5452
|
+
[k.LOADED_DATA]: [],
|
|
5453
|
+
[k.SELECT_ELEMENTS]: [],
|
|
5454
|
+
[k.UNSELECT_ELEMENTS]: []
|
|
5553
5455
|
};
|
|
5554
5456
|
}
|
|
5555
5457
|
/**
|
|
@@ -5578,7 +5480,7 @@ class $s {
|
|
|
5578
5480
|
i && i.forEach((s) => s(...t));
|
|
5579
5481
|
}
|
|
5580
5482
|
}
|
|
5581
|
-
class
|
|
5483
|
+
class Ns {
|
|
5582
5484
|
constructor(e) {
|
|
5583
5485
|
this.viralViewerApi = e, this.keydownQueuedEvents = [], this.keyupQueuedEvents = [], this.setupKeyPress();
|
|
5584
5486
|
}
|
|
@@ -5626,9 +5528,9 @@ class js {
|
|
|
5626
5528
|
}
|
|
5627
5529
|
//#endregion
|
|
5628
5530
|
}
|
|
5629
|
-
class
|
|
5531
|
+
class $s {
|
|
5630
5532
|
constructor(e) {
|
|
5631
|
-
this.viralViewerApi = e, this.position = new
|
|
5533
|
+
this.viralViewerApi = e, this.position = new H(), this.rawPosition = new H(), this.mouseMoveQueuedEvents = [], this.mouseDownLeftQueuedEvents = [], this.mouseUpLeftQueuedEvents = [], this.mouseDownRightQueuedEvents = [], this.mouseUpRightQueuedEvents = [], this.mouseDoubleClickQueuedEvents = [], this.handleClick = async (t) => {
|
|
5632
5534
|
var i, s, n;
|
|
5633
5535
|
if (this.viralViewerApi) {
|
|
5634
5536
|
if (t.button === 0) {
|
|
@@ -5726,53 +5628,53 @@ class Hs {
|
|
|
5726
5628
|
*/
|
|
5727
5629
|
addEventListener(e, t, i) {
|
|
5728
5630
|
switch (e) {
|
|
5729
|
-
case
|
|
5631
|
+
case N.ON_MOUSE_MOVE:
|
|
5730
5632
|
this.mouseMoveQueuedEvents.push([t, i]);
|
|
5731
5633
|
break;
|
|
5732
|
-
case
|
|
5634
|
+
case N.ON_MOUSE_DOWN_LEFT:
|
|
5733
5635
|
this.mouseDownLeftQueuedEvents.push([t, i]);
|
|
5734
5636
|
break;
|
|
5735
|
-
case
|
|
5637
|
+
case N.ON_MOUSE_UP_LEFT:
|
|
5736
5638
|
this.mouseUpLeftQueuedEvents.push([t, i]);
|
|
5737
5639
|
break;
|
|
5738
|
-
case
|
|
5640
|
+
case N.ON_MOUSE_DOWN_RIGHT:
|
|
5739
5641
|
this.mouseDownRightQueuedEvents.push([t, i]);
|
|
5740
5642
|
break;
|
|
5741
|
-
case
|
|
5643
|
+
case N.ON_MOUSE_UP_RIGHT:
|
|
5742
5644
|
this.mouseUpRightQueuedEvents.push([t, i]);
|
|
5743
5645
|
break;
|
|
5744
|
-
case
|
|
5646
|
+
case N.ON_MOUSE_DOUBLE_CLICK:
|
|
5745
5647
|
this.mouseDoubleClickQueuedEvents.push([t, i]);
|
|
5746
5648
|
break;
|
|
5747
5649
|
}
|
|
5748
5650
|
}
|
|
5749
5651
|
removeEventListener(e, t) {
|
|
5750
5652
|
switch (e) {
|
|
5751
|
-
case
|
|
5653
|
+
case N.ON_MOUSE_MOVE:
|
|
5752
5654
|
{
|
|
5753
5655
|
const i = this.mouseMoveQueuedEvents.findIndex((s) => s[0] === t);
|
|
5754
5656
|
this.mouseMoveQueuedEvents.splice(i, 1);
|
|
5755
5657
|
}
|
|
5756
5658
|
break;
|
|
5757
|
-
case
|
|
5659
|
+
case N.ON_MOUSE_DOWN_LEFT:
|
|
5758
5660
|
{
|
|
5759
5661
|
const i = this.mouseDownLeftQueuedEvents.findIndex((s) => s[0] === t);
|
|
5760
5662
|
this.mouseDownLeftQueuedEvents.splice(i, 1);
|
|
5761
5663
|
}
|
|
5762
5664
|
break;
|
|
5763
|
-
case
|
|
5665
|
+
case N.ON_MOUSE_UP_LEFT:
|
|
5764
5666
|
{
|
|
5765
5667
|
const i = this.mouseUpLeftQueuedEvents.findIndex((s) => s[0] === t);
|
|
5766
5668
|
this.mouseUpLeftQueuedEvents.splice(i, 1);
|
|
5767
5669
|
}
|
|
5768
5670
|
break;
|
|
5769
|
-
case
|
|
5671
|
+
case N.ON_MOUSE_DOWN_RIGHT:
|
|
5770
5672
|
{
|
|
5771
5673
|
const i = this.mouseDownRightQueuedEvents.findIndex((s) => s[0] === t);
|
|
5772
5674
|
this.mouseDownRightQueuedEvents.splice(i, 1);
|
|
5773
5675
|
}
|
|
5774
5676
|
break;
|
|
5775
|
-
case
|
|
5677
|
+
case N.ON_MOUSE_UP_RIGHT:
|
|
5776
5678
|
{
|
|
5777
5679
|
const i = this.mouseUpRightQueuedEvents.findIndex((s) => s[0] === t);
|
|
5778
5680
|
this.mouseUpRightQueuedEvents.splice(i, 1);
|
|
@@ -5807,7 +5709,7 @@ const je = {
|
|
|
5807
5709
|
focus: (g, e) => `<svg xmlns="http://www.w3.org/2000/svg" fill=${e || ""} height=${g || 24} viewBox="0 -960 960 960" width="24"><path d="M120-120v-200h80v120h120v80H120Zm520 0v-80h120v-120h80v200H640ZM120-640v-200h200v80H200v120h-80Zm640 0v-120H640v-80h200v200h-80Z"/></svg>`,
|
|
5808
5710
|
properties: (g, e) => `<svg xmlns="http://www.w3.org/2000/svg" fill=${e || ""} height=${g || 24} viewBox="0 -960 960 960" width="24"><path d="M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>`
|
|
5809
5711
|
};
|
|
5810
|
-
class
|
|
5712
|
+
class js {
|
|
5811
5713
|
constructor(e) {
|
|
5812
5714
|
this.viralViewerApi = e, this.elementProperties = {}, this._sleepDebounceTimer = null, this._sleepDebounceDelay = 150, this.resizeObserver = null, this.isShiftPressed = !1, this.windowHandler(), this.contextMenuEventHandler(), this.selectElementHandler2(), this.doubleClickElementHandler(), this.keyboardHandler(), this.cameraHandler(), this._visibilityManager = this.viralViewerApi.viralVisibilityManager;
|
|
5813
5715
|
}
|
|
@@ -5815,40 +5717,40 @@ class Ws {
|
|
|
5815
5717
|
this.viralViewerApi.viralContextMenu && (this.viralViewerApi.viralContextMenu.addContextItem(
|
|
5816
5718
|
0,
|
|
5817
5719
|
"Show all elements",
|
|
5818
|
-
je.showAll(void 0,
|
|
5720
|
+
je.showAll(void 0, y.primary),
|
|
5819
5721
|
(e) => {
|
|
5820
5722
|
this._visibilityManager.showAll2(), this.viralViewerApi.viralContextMenu.hideContextMenu();
|
|
5821
5723
|
}
|
|
5822
5724
|
), this.viralViewerApi.viralContextMenu.addContextItem(
|
|
5823
5725
|
1,
|
|
5824
5726
|
"Isolate",
|
|
5825
|
-
je.isolate(void 0,
|
|
5727
|
+
je.isolate(void 0, y.primary),
|
|
5826
5728
|
(e) => {
|
|
5827
5729
|
this._visibilityManager.isolate2(), this.viralViewerApi.viralContextMenu.hideContextMenu();
|
|
5828
5730
|
}
|
|
5829
5731
|
), this.viralViewerApi.viralContextMenu.addContextItem(
|
|
5830
5732
|
2,
|
|
5831
5733
|
"Hide",
|
|
5832
|
-
je.hide(void 0,
|
|
5734
|
+
je.hide(void 0, y.primary),
|
|
5833
5735
|
(e) => {
|
|
5834
5736
|
this._visibilityManager.hide2(), this.viralViewerApi.viralContextMenu.hideContextMenu();
|
|
5835
5737
|
}
|
|
5836
5738
|
), this.viralViewerApi.viralContextMenu.addContextItem(
|
|
5837
5739
|
3,
|
|
5838
5740
|
"Focus",
|
|
5839
|
-
je.focus(void 0,
|
|
5741
|
+
je.focus(void 0, y.primary),
|
|
5840
5742
|
(e) => {
|
|
5841
5743
|
this._visibilityManager.zoomTo(), this.viralViewerApi.viralContextMenu.hideContextMenu();
|
|
5842
5744
|
}
|
|
5843
5745
|
), this.viralViewerApi.viralContextMenu.addContextItem(
|
|
5844
5746
|
4,
|
|
5845
5747
|
"Properties",
|
|
5846
|
-
je.properties(void 0,
|
|
5748
|
+
je.properties(void 0, y.secondary),
|
|
5847
5749
|
(e) => {
|
|
5848
5750
|
this.viralViewerApi.viralDraggableModal.show(), this.viralViewerApi.viralContextMenu.hideContextMenu();
|
|
5849
5751
|
}
|
|
5850
5752
|
)), this.viralViewerApi.viralMouse && (this.viralViewerApi.viralMouse.addEventListener(
|
|
5851
|
-
|
|
5753
|
+
N.ON_MOUSE_DOWN_RIGHT,
|
|
5852
5754
|
"ShowContextMenu",
|
|
5853
5755
|
(e) => {
|
|
5854
5756
|
this.viralViewerApi.viralContextMenu.showContextMenu(
|
|
@@ -5858,7 +5760,7 @@ class Ws {
|
|
|
5858
5760
|
);
|
|
5859
5761
|
}
|
|
5860
5762
|
), this.viralViewerApi.viralMouse.addEventListener(
|
|
5861
|
-
|
|
5763
|
+
N.ON_MOUSE_DOWN_LEFT,
|
|
5862
5764
|
"HideContextMenu",
|
|
5863
5765
|
(e) => {
|
|
5864
5766
|
this.viralViewerApi.viralContextMenu.hideContextMenu();
|
|
@@ -5900,13 +5802,13 @@ class Ws {
|
|
|
5900
5802
|
let e = null;
|
|
5901
5803
|
const t = 250;
|
|
5902
5804
|
this.viralViewerApi.viralMouse.addEventListener(
|
|
5903
|
-
|
|
5805
|
+
N.ON_MOUSE_DOWN_LEFT,
|
|
5904
5806
|
"SelectElement",
|
|
5905
5807
|
(i) => {
|
|
5906
5808
|
e = performance.now();
|
|
5907
5809
|
}
|
|
5908
5810
|
), this.viralViewerApi.viralMouse.addEventListener(
|
|
5909
|
-
|
|
5811
|
+
N.ON_MOUSE_UP_LEFT,
|
|
5910
5812
|
"SelectElementUp",
|
|
5911
5813
|
(i) => {
|
|
5912
5814
|
var s, n;
|
|
@@ -5994,7 +5896,7 @@ class Ws {
|
|
|
5994
5896
|
//#region Double Click element handler
|
|
5995
5897
|
doubleClickElementHandler() {
|
|
5996
5898
|
this.viralViewerApi.viralMouse.addEventListener(
|
|
5997
|
-
|
|
5899
|
+
N.ON_MOUSE_DOUBLE_CLICK,
|
|
5998
5900
|
"DoubleClickElement",
|
|
5999
5901
|
(e) => {
|
|
6000
5902
|
const t = this.viralViewerApi.viralCamera.clientToWorld();
|
|
@@ -6053,36 +5955,36 @@ class Ws {
|
|
|
6053
5955
|
}
|
|
6054
5956
|
//#endregion
|
|
6055
5957
|
}
|
|
6056
|
-
class
|
|
5958
|
+
class Hs {
|
|
6057
5959
|
constructor(e, t) {
|
|
6058
|
-
this.viralViewerApi = e, this.options = t, this.viralViewerApi.on(
|
|
6059
|
-
|
|
5960
|
+
this.viralViewerApi = e, this.options = t, this.viralViewerApi.on(k.LOADED_SCENE, () => this.loadedScene()), this.viralViewerApi.on(
|
|
5961
|
+
k.LOADED_MATERIAL_MANAGER,
|
|
6060
5962
|
() => this.loadedMaterialManager()
|
|
6061
|
-
), this.viralViewerApi.on(
|
|
6062
|
-
|
|
5963
|
+
), this.viralViewerApi.on(k.LOADED_RENDERER, () => this.loadedRenderer()), this.viralViewerApi.on(k.LOADED_CAMERA, () => this.loadedCamera()), this.viralViewerApi.on(k.LOADED_CUBE, () => this.loadedCube()), this.viralViewerApi.on(k.LOADED_TOOLS, () => this.loadedTools()), this.viralViewerApi.on(
|
|
5964
|
+
k.LOADED_SEPERATE_MODEL,
|
|
6063
5965
|
(i) => this.loadedModels(i)
|
|
6064
5966
|
);
|
|
6065
5967
|
}
|
|
6066
5968
|
loadedScene() {
|
|
6067
|
-
this.options.isDev && Q.information("scene loaded!"), this.viralViewerApi.off(
|
|
5969
|
+
this.options.isDev && Q.information("scene loaded!"), this.viralViewerApi.off(k.LOADED_SCENE, () => this.loadedScene());
|
|
6068
5970
|
}
|
|
6069
5971
|
loadedMaterialManager() {
|
|
6070
5972
|
this.options.isDev && Q.information("material manager loaded!"), this.viralViewerApi.off(
|
|
6071
|
-
|
|
5973
|
+
k.LOADED_MATERIAL_MANAGER,
|
|
6072
5974
|
() => this.loadedMaterialManager()
|
|
6073
5975
|
);
|
|
6074
5976
|
}
|
|
6075
5977
|
loadedRenderer() {
|
|
6076
|
-
this.options.isDev && Q.information("renderer loaded!"), this.viralViewerApi.off(
|
|
5978
|
+
this.options.isDev && Q.information("renderer loaded!"), this.viralViewerApi.off(k.LOADED_RENDERER, () => this.loadedRenderer());
|
|
6077
5979
|
}
|
|
6078
5980
|
loadedCamera() {
|
|
6079
5981
|
this.options.isDev && Q.information("camera loaded!");
|
|
6080
5982
|
}
|
|
6081
5983
|
loadedCube() {
|
|
6082
|
-
this.options.isDev && Q.information("cube loaded!"), this.viralViewerApi.off(
|
|
5984
|
+
this.options.isDev && Q.information("cube loaded!"), this.viralViewerApi.off(k.LOADED_CUBE, () => this.loadedCube());
|
|
6083
5985
|
}
|
|
6084
5986
|
loadedTools() {
|
|
6085
|
-
this.options.isDev && Q.information("tools loaded!"), this.viralViewerApi.off(
|
|
5987
|
+
this.options.isDev && Q.information("tools loaded!"), this.viralViewerApi.off(k.LOADED_TOOLS, () => this.loadedTools());
|
|
6086
5988
|
}
|
|
6087
5989
|
async loadedModels(e) {
|
|
6088
5990
|
this.options.isDev && Q.information(`model ${e.modelId} loaded!`), this.viralViewerApi.viralScene.selectables = [], this.viralViewerApi.viralScene.selectables = [], this.viralViewerApi.viralScene.bimWorld.children.forEach((t) => {
|
|
@@ -6096,9 +5998,9 @@ class Fs {
|
|
|
6096
5998
|
});
|
|
6097
5999
|
}
|
|
6098
6000
|
}
|
|
6099
|
-
class
|
|
6001
|
+
class Fs {
|
|
6100
6002
|
constructor(e) {
|
|
6101
|
-
this.viralViewerApi = e, this.potree = new
|
|
6003
|
+
this.viralViewerApi = e, this.potree = new Di(), this.pointClouds = [];
|
|
6102
6004
|
}
|
|
6103
6005
|
/**
|
|
6104
6006
|
*
|
|
@@ -6114,13 +6016,13 @@ class Gs {
|
|
|
6114
6016
|
(r = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || r.disableOutline(), this.potree.pointBudget = s, this.potree.loadPointCloudCustom(e, t, i).then((o) => {
|
|
6115
6017
|
var d;
|
|
6116
6018
|
const a = o.material;
|
|
6117
|
-
a.size = 1, a.pointSizeType =
|
|
6118
|
-
const l = new E(0, -1.5, 3), c = new
|
|
6019
|
+
a.size = 1, a.pointSizeType = Ri.ADAPTIVE, a.shape = Li.CIRCLE, a.pointColorType = ki.RGB, a.inputColorEncoding = 1, a.outputColorEncoding = 1, console.log(o.boundingBox);
|
|
6020
|
+
const l = new E(0, -1.5, 3), c = new oi(-Math.PI / 2, 0, 0), h = new E(2, 2, 2);
|
|
6119
6021
|
o.position.copy(l), o.rotation.copy(c), o.scale.copy(h), this.viralViewerApi.viralScene.addModel(o), this.viralViewerApi.viralScene.selectables.push(o), this.pointClouds.push(o), this.viralViewerApi.viralCamera.camera && ((d = this.viralViewerApi.viralCamera.cameraControls) == null || d.fitToBox(o.boundingBox, !0)), n(o);
|
|
6120
6022
|
});
|
|
6121
6023
|
}
|
|
6122
6024
|
}
|
|
6123
|
-
class
|
|
6025
|
+
class Ws {
|
|
6124
6026
|
static getDeviceType() {
|
|
6125
6027
|
const e = navigator.userAgent.toLowerCase(), t = /iphone|ipod|android.*mobile|blackberry|opera mini|windows phone/i.test(
|
|
6126
6028
|
e
|
|
@@ -6128,7 +6030,7 @@ class Us {
|
|
|
6128
6030
|
return t ? "mobile" : i ? "tablet" : "pc";
|
|
6129
6031
|
}
|
|
6130
6032
|
}
|
|
6131
|
-
class
|
|
6033
|
+
class Gs {
|
|
6132
6034
|
constructor() {
|
|
6133
6035
|
this.gl = null, this.specs = null, this.initWebGL(), this.detectSpecs();
|
|
6134
6036
|
}
|
|
@@ -6272,16 +6174,16 @@ class qs {
|
|
|
6272
6174
|
});
|
|
6273
6175
|
}
|
|
6274
6176
|
}
|
|
6275
|
-
class
|
|
6177
|
+
class Us {
|
|
6276
6178
|
constructor() {
|
|
6277
|
-
this.modelId = -1, this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new
|
|
6179
|
+
this.modelId = -1, this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new _t();
|
|
6278
6180
|
}
|
|
6279
6181
|
//#endregion
|
|
6280
6182
|
dispose() {
|
|
6281
|
-
this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new
|
|
6183
|
+
this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new _t();
|
|
6282
6184
|
}
|
|
6283
6185
|
}
|
|
6284
|
-
class
|
|
6186
|
+
class qs {
|
|
6285
6187
|
constructor() {
|
|
6286
6188
|
this.MIN_VERTEX_INSTANCES_FOR_INSTANCING = 1e3, this.MIN_INSTANCES_FOR_INSTANCING = 3, this.MAX_DRAW_CALLS = 25, this.MIN_INSTANCED_VERTEX_RATIO = 0.6, this.HIGH_VERTEX_THRESHOLD = 500;
|
|
6287
6189
|
}
|
|
@@ -6430,8 +6332,8 @@ class Zs {
|
|
|
6430
6332
|
}
|
|
6431
6333
|
}
|
|
6432
6334
|
}
|
|
6433
|
-
const
|
|
6434
|
-
function
|
|
6335
|
+
const Qs = new qs();
|
|
6336
|
+
function Zs() {
|
|
6435
6337
|
class g {
|
|
6436
6338
|
constructor() {
|
|
6437
6339
|
this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
@@ -6478,8 +6380,8 @@ function Xs() {
|
|
|
6478
6380
|
]);
|
|
6479
6381
|
const u = d.elements;
|
|
6480
6382
|
for (let p = 0; p < o; p++) {
|
|
6481
|
-
const m = s[i[p]], f = -m.X, v = m.Z, b = m.Y, w = 1 / (u[3] * f + u[7] * v + u[11] * b + u[15]),
|
|
6482
|
-
a[
|
|
6383
|
+
const m = s[i[p]], f = -m.X, v = m.Z, b = m.Y, w = 1 / (u[3] * f + u[7] * v + u[11] * b + u[15]), C = p * 3;
|
|
6384
|
+
a[C] = (u[0] * f + u[4] * v + u[8] * b + u[12]) * w, a[C + 1] = (u[1] * f + u[5] * v + u[9] * b + u[13]) * w, a[C + 2] = (u[2] * f + u[6] * v + u[10] * b + u[14]) * w;
|
|
6483
6385
|
}
|
|
6484
6386
|
return a;
|
|
6485
6387
|
}
|
|
@@ -6516,8 +6418,8 @@ function Xs() {
|
|
|
6516
6418
|
}), self.postMessage(r);
|
|
6517
6419
|
};
|
|
6518
6420
|
}
|
|
6519
|
-
const
|
|
6520
|
-
function
|
|
6421
|
+
const Ys = Zs;
|
|
6422
|
+
function Xs() {
|
|
6521
6423
|
class g {
|
|
6522
6424
|
constructor() {
|
|
6523
6425
|
this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
@@ -6564,8 +6466,8 @@ function Js() {
|
|
|
6564
6466
|
]);
|
|
6565
6467
|
const u = d.elements;
|
|
6566
6468
|
for (let p = 0; p < o; p++) {
|
|
6567
|
-
const m = s[i[p]], f = -m.X, v = m.Z, b = m.Y, w = 1 / (u[3] * f + u[7] * v + u[11] * b + u[15]),
|
|
6568
|
-
a[
|
|
6469
|
+
const m = s[i[p]], f = -m.X, v = m.Z, b = m.Y, w = 1 / (u[3] * f + u[7] * v + u[11] * b + u[15]), C = p * 3;
|
|
6470
|
+
a[C] = (u[0] * f + u[4] * v + u[8] * b + u[12]) * w, a[C + 1] = (u[1] * f + u[5] * v + u[9] * b + u[13]) * w, a[C + 2] = (u[2] * f + u[6] * v + u[10] * b + u[14]) * w;
|
|
6569
6471
|
}
|
|
6570
6472
|
return a;
|
|
6571
6473
|
}
|
|
@@ -6607,19 +6509,19 @@ function Js() {
|
|
|
6607
6509
|
}), self.postMessage(r);
|
|
6608
6510
|
};
|
|
6609
6511
|
}
|
|
6610
|
-
const
|
|
6611
|
-
class
|
|
6512
|
+
const Ks = Xs;
|
|
6513
|
+
class Js {
|
|
6612
6514
|
// Or 5K objects
|
|
6613
6515
|
//#endregion
|
|
6614
6516
|
constructor(e) {
|
|
6615
6517
|
this.viralViewerApi = e, this.lastRenderTime = 0, this.elementBuffer = /* @__PURE__ */ new Map(), this.BATCH_THRESHOLD_VERTICES = 1e5, this.BATCH_THRESHOLD_OBJECTS = 5e3;
|
|
6616
|
-
const t = new Blob([`(${
|
|
6617
|
-
this.workerPool = new
|
|
6518
|
+
const t = new Blob([`(${Ys})()`]), i = URL.createObjectURL(t);
|
|
6519
|
+
this.workerPool = new ee(
|
|
6618
6520
|
navigator.hardwareConcurrency || this.viralViewerApi.options.numberOfWorker,
|
|
6619
6521
|
i
|
|
6620
6522
|
);
|
|
6621
|
-
const s = new Blob([`(${
|
|
6622
|
-
this.workerPool2 = new
|
|
6523
|
+
const s = new Blob([`(${Ks})()`]), n = URL.createObjectURL(s);
|
|
6524
|
+
this.workerPool2 = new ee(
|
|
6623
6525
|
this.viralViewerApi.options.numberOfWorker,
|
|
6624
6526
|
n
|
|
6625
6527
|
);
|
|
@@ -6631,11 +6533,11 @@ class tn {
|
|
|
6631
6533
|
*/
|
|
6632
6534
|
initial(e) {
|
|
6633
6535
|
console.log(e);
|
|
6634
|
-
const t = new
|
|
6536
|
+
const t = new Us();
|
|
6635
6537
|
t.modelId = this.viralViewerApi.viralScene.bimWorld.bimModels.length, this.viralViewerApi.viralScene.bimWorld.bimModels.push(t);
|
|
6636
6538
|
const i = this.viralViewerApi.viralScene.bimWorld.bimModels.length - 1;
|
|
6637
6539
|
for (let s = 0; s < e.length; s++) {
|
|
6638
|
-
const n = e[s], r =
|
|
6540
|
+
const n = e[s], r = R.rgbToThreejsColor(
|
|
6639
6541
|
n.Red,
|
|
6640
6542
|
n.Green,
|
|
6641
6543
|
n.Blue
|
|
@@ -6654,7 +6556,7 @@ class tn {
|
|
|
6654
6556
|
// polygonOffset: true,
|
|
6655
6557
|
// polygonOffsetFactor: 1,
|
|
6656
6558
|
// polygonOffsetUnits: 0.1,
|
|
6657
|
-
side:
|
|
6559
|
+
side: li
|
|
6658
6560
|
// 🔧 FIX: Changed from DoubleSide to halve draw calls
|
|
6659
6561
|
});
|
|
6660
6562
|
a.userData.red = n.Red, a.userData.green = n.Green, a.userData.blue = n.Blue, a.userData.opacity = n.Opacity, this.viralViewerApi.viralMaterialManager.materials.push(a);
|
|
@@ -6670,7 +6572,7 @@ class tn {
|
|
|
6670
6572
|
*/
|
|
6671
6573
|
loadElement(e, t, i = () => {
|
|
6672
6574
|
}, s = null) {
|
|
6673
|
-
const { highDuplicationElements: n, lowDuplicationElements: r } =
|
|
6575
|
+
const { highDuplicationElements: n, lowDuplicationElements: r } = Qs.analyze(t), o = r.map((p) => p.element), a = n.map((p) => p.element), l = o.length > 0, c = a.length > 0;
|
|
6674
6576
|
if (!l && !c) {
|
|
6675
6577
|
i();
|
|
6676
6578
|
return;
|
|
@@ -6778,14 +6680,14 @@ class tn {
|
|
|
6778
6680
|
* Uses onBeforeCompile to inject custom shader code for RGBA vertex colors
|
|
6779
6681
|
*/
|
|
6780
6682
|
createOptimizedMaterial(e) {
|
|
6781
|
-
const t =
|
|
6683
|
+
const t = Ws.getDeviceType() === "pc", i = (r, o = 2) => {
|
|
6782
6684
|
if (!r)
|
|
6783
6685
|
return 16777215;
|
|
6784
6686
|
const a = r.clone();
|
|
6785
6687
|
return a.multiplyScalar(o), a;
|
|
6786
6688
|
}, s = e.transparent || e.opacity < 1, n = t ? new K({
|
|
6787
6689
|
vertexColors: !0,
|
|
6788
|
-
side:
|
|
6690
|
+
side: J,
|
|
6789
6691
|
// 🔧 FIX: Changed from DoubleSide to halve draw calls
|
|
6790
6692
|
opacity: e.opacity,
|
|
6791
6693
|
transparent: !0,
|
|
@@ -6803,7 +6705,7 @@ class tn {
|
|
|
6803
6705
|
isOriginallyTransparent: s
|
|
6804
6706
|
// Track original state
|
|
6805
6707
|
}
|
|
6806
|
-
}) : new
|
|
6708
|
+
}) : new q({
|
|
6807
6709
|
vertexColors: !0,
|
|
6808
6710
|
opacity: e.opacity,
|
|
6809
6711
|
transparent: !0,
|
|
@@ -6949,9 +6851,9 @@ class tn {
|
|
|
6949
6851
|
}
|
|
6950
6852
|
//#endregion
|
|
6951
6853
|
}
|
|
6952
|
-
class
|
|
6854
|
+
class en {
|
|
6953
6855
|
constructor(e) {
|
|
6954
|
-
this.viralViewerApi = e, this.elements = [], this._loadBatchedElementWorker = new
|
|
6856
|
+
this.viralViewerApi = e, this.elements = [], this._loadBatchedElementWorker = new Js(e);
|
|
6955
6857
|
}
|
|
6956
6858
|
//#region Load worker
|
|
6957
6859
|
async load(e, t, i, s = () => {
|
|
@@ -7003,7 +6905,7 @@ class sn {
|
|
|
7003
6905
|
p,
|
|
7004
6906
|
() => {
|
|
7005
6907
|
u += 1, u === d && (this._loadBatchedElementWorker.flushAllBuffers(), this.viralViewerApi.emit(
|
|
7006
|
-
|
|
6908
|
+
k.LOADED_SEPERATE_MODEL,
|
|
7007
6909
|
{ modelId: c }
|
|
7008
6910
|
), this.viralViewerApi.viralVisibilityManager.enableShadow(), this.viralViewerApi.viralVisibilityManager.enableAmbientOcclusion(), this.viralViewerApi.viralVisibilityManager.enableAmbientOcclusionScreenSpaceRadius(), this.viralViewerApi.viralVisibilityManager.enableScreenSpaceEdge(
|
|
7009
6911
|
"shaded"
|
|
@@ -7011,7 +6913,7 @@ class sn {
|
|
|
7011
6913
|
},
|
|
7012
6914
|
h
|
|
7013
6915
|
) : (u += 1, u === d && (this._loadBatchedElementWorker.flushAllBuffers(), this.viralViewerApi.emit(
|
|
7014
|
-
|
|
6916
|
+
k.LOADED_SEPERATE_MODEL,
|
|
7015
6917
|
{ modelId: c }
|
|
7016
6918
|
), this.viralViewerApi.viralVisibilityManager.enableShadow(), this.viralViewerApi.viralVisibilityManager.enableAmbientOcclusion(), this.viralViewerApi.viralVisibilityManager.enableAmbientOcclusionScreenSpaceRadius(), this.viralViewerApi.viralVisibilityManager.enableScreenSpaceEdge(
|
|
7017
6919
|
"shaded"
|
|
@@ -7095,9 +6997,9 @@ class sn {
|
|
|
7095
6997
|
}), this.viralViewerApi.viralMaterialManager.mergeMaterials = [], this.viralViewerApi.viralVisibilityManager.disableGroundShadow(), this.viralViewerApi.viralRenderer.render(), this.viralViewerApi.viralDataManager.dataTree = [], this.viralViewerApi.viralScene.selectables = [];
|
|
7096
6998
|
}
|
|
7097
6999
|
}
|
|
7098
|
-
class
|
|
7000
|
+
class tn {
|
|
7099
7001
|
constructor(e) {
|
|
7100
|
-
this.viralViewerApi = e, this.objectLoader = new
|
|
7002
|
+
this.viralViewerApi = e, this.objectLoader = new ci(), this.gltfLoader = new Bi();
|
|
7101
7003
|
}
|
|
7102
7004
|
parseObject(e) {
|
|
7103
7005
|
return this.objectLoader.parse(e);
|
|
@@ -7109,37 +7011,37 @@ class nn {
|
|
|
7109
7011
|
this.gltfLoader.load(e, t, i, s);
|
|
7110
7012
|
}
|
|
7111
7013
|
}
|
|
7112
|
-
class
|
|
7014
|
+
class sn {
|
|
7113
7015
|
constructor(e) {
|
|
7114
|
-
this.viralViewerApi = e, this.revitLoader = new
|
|
7016
|
+
this.viralViewerApi = e, this.revitLoader = new en(this.viralViewerApi), this.pointCloudLoader = new Fs(this.viralViewerApi), this.threeLoader = new tn(this.viralViewerApi);
|
|
7115
7017
|
}
|
|
7116
7018
|
}
|
|
7117
|
-
class
|
|
7019
|
+
class nn {
|
|
7118
7020
|
constructor(e) {
|
|
7119
7021
|
this.viralViewerApi = e, this.hoverMaterial = new gt({
|
|
7120
|
-
color:
|
|
7022
|
+
color: R.hexToThreejsColor(y.secondary),
|
|
7121
7023
|
opacity: 0.7,
|
|
7122
7024
|
transparent: !0,
|
|
7123
7025
|
depthTest: !1,
|
|
7124
7026
|
name: "Render Material",
|
|
7125
7027
|
flatShading: !0
|
|
7126
7028
|
}), this.selectedMaterial = new gt({
|
|
7127
|
-
color:
|
|
7029
|
+
color: R.hexToThreejsColor(y.secondary),
|
|
7128
7030
|
opacity: 0.7,
|
|
7129
7031
|
transparent: !0,
|
|
7130
7032
|
name: "Render Material",
|
|
7131
7033
|
depthTest: !1,
|
|
7132
7034
|
flatShading: !0
|
|
7133
|
-
}), this.edgeMaterial = new
|
|
7134
|
-
color:
|
|
7035
|
+
}), this.edgeMaterial = new Zt({
|
|
7036
|
+
color: R.hexToThreejsColor(y.edge),
|
|
7135
7037
|
linewidth: 2,
|
|
7136
|
-
resolution: new
|
|
7038
|
+
resolution: new H(window.innerWidth, window.innerHeight),
|
|
7137
7039
|
transparent: !0,
|
|
7138
7040
|
opacity: 0.8
|
|
7139
7041
|
}), this.outlineMaterial = new K({
|
|
7140
7042
|
transparent: !0,
|
|
7141
7043
|
opacity: 0
|
|
7142
|
-
}), this.materials = [], this.mergeMaterials = [], this.originalColors = [], this.viralViewerApi.emit(
|
|
7044
|
+
}), this.materials = [], this.mergeMaterials = [], this.originalColors = [], this.viralViewerApi.emit(k.LOADED_MATERIAL_MANAGER);
|
|
7143
7045
|
}
|
|
7144
7046
|
/**
|
|
7145
7047
|
* Checks if a material has a color property.
|
|
@@ -7165,9 +7067,9 @@ class an {
|
|
|
7165
7067
|
}
|
|
7166
7068
|
}
|
|
7167
7069
|
}
|
|
7168
|
-
function
|
|
7169
|
-
const g = new
|
|
7170
|
-
side:
|
|
7070
|
+
function rn() {
|
|
7071
|
+
const g = new hi({
|
|
7072
|
+
side: J
|
|
7171
7073
|
});
|
|
7172
7074
|
return g.onBeforeCompile = (e) => {
|
|
7173
7075
|
e.vertexShader = `attribute vec4 color;
|
|
@@ -7187,10 +7089,10 @@ function on() {
|
|
|
7187
7089
|
);
|
|
7188
7090
|
}, g;
|
|
7189
7091
|
}
|
|
7190
|
-
function
|
|
7191
|
-
const g = new
|
|
7092
|
+
function an() {
|
|
7093
|
+
const g = new q({
|
|
7192
7094
|
colorWrite: !1,
|
|
7193
|
-
side:
|
|
7095
|
+
side: J
|
|
7194
7096
|
});
|
|
7195
7097
|
return g.onBeforeCompile = (e) => {
|
|
7196
7098
|
e.vertexShader = `attribute vec4 color;
|
|
@@ -7210,8 +7112,8 @@ function ln() {
|
|
|
7210
7112
|
);
|
|
7211
7113
|
}, g;
|
|
7212
7114
|
}
|
|
7213
|
-
const
|
|
7214
|
-
edgeColor: new
|
|
7115
|
+
const on = {
|
|
7116
|
+
edgeColor: new $(0),
|
|
7215
7117
|
edgeOpacity: 0.6,
|
|
7216
7118
|
// Reduced for subtlety, better perf
|
|
7217
7119
|
edgeThickness: 1,
|
|
@@ -7228,14 +7130,14 @@ const cn = {
|
|
|
7228
7130
|
// Keep - good for creases
|
|
7229
7131
|
enableObjectIdEdges: !1
|
|
7230
7132
|
// Disable by default - most expensive (extra render pass)
|
|
7231
|
-
},
|
|
7133
|
+
}, ln = `
|
|
7232
7134
|
varying vec2 vUv;
|
|
7233
7135
|
|
|
7234
7136
|
void main() {
|
|
7235
7137
|
vUv = uv;
|
|
7236
7138
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
7237
7139
|
}
|
|
7238
|
-
`,
|
|
7140
|
+
`, cn = `
|
|
7239
7141
|
precision highp float;
|
|
7240
7142
|
|
|
7241
7143
|
uniform sampler2D tDiffuse; // Color buffer (from main render)
|
|
@@ -7401,7 +7303,7 @@ void main() {
|
|
|
7401
7303
|
|
|
7402
7304
|
gl_FragColor = vec4(finalColor, color.a);
|
|
7403
7305
|
}
|
|
7404
|
-
`,
|
|
7306
|
+
`, hn = `
|
|
7405
7307
|
attribute float objectIndex;
|
|
7406
7308
|
varying float vObjectIndex;
|
|
7407
7309
|
|
|
@@ -7409,7 +7311,7 @@ void main() {
|
|
|
7409
7311
|
vObjectIndex = objectIndex;
|
|
7410
7312
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
7411
7313
|
}
|
|
7412
|
-
`,
|
|
7314
|
+
`, dn = `
|
|
7413
7315
|
precision highp float;
|
|
7414
7316
|
varying float vObjectIndex;
|
|
7415
7317
|
|
|
@@ -7425,33 +7327,33 @@ void main() {
|
|
|
7425
7327
|
gl_FragColor = vec4(packIndex(vObjectIndex), 1.0);
|
|
7426
7328
|
}
|
|
7427
7329
|
`;
|
|
7428
|
-
class
|
|
7330
|
+
class un extends Yt {
|
|
7429
7331
|
constructor(e, t, i, s) {
|
|
7430
|
-
super(), this.excludeObjects = [], this.bypass = !1, this.scene = e, this.camera = t, this.resolution = i || new
|
|
7332
|
+
super(), this.excludeObjects = [], this.bypass = !1, this.scene = e, this.camera = t, this.resolution = i || new H(window.innerWidth, window.innerHeight), this.options = { ...on, ...s };
|
|
7431
7333
|
const n = {
|
|
7432
7334
|
format: Wt,
|
|
7433
|
-
type:
|
|
7335
|
+
type: Gt,
|
|
7434
7336
|
minFilter: Ot,
|
|
7435
7337
|
magFilter: Ot
|
|
7436
7338
|
};
|
|
7437
7339
|
this.normalTarget = new ue(this.resolution.x, this.resolution.y, {
|
|
7438
7340
|
...n,
|
|
7439
7341
|
depthBuffer: !0
|
|
7440
|
-
}), this.normalTarget.depthTexture = new
|
|
7342
|
+
}), this.normalTarget.depthTexture = new St(
|
|
7441
7343
|
this.resolution.x,
|
|
7442
7344
|
this.resolution.y,
|
|
7443
|
-
|
|
7345
|
+
At
|
|
7444
7346
|
), this.depthTarget = new ue(this.resolution.x, this.resolution.y, {
|
|
7445
7347
|
...n,
|
|
7446
7348
|
depthBuffer: !0
|
|
7447
|
-
}), this.depthTarget.depthTexture = new
|
|
7349
|
+
}), this.depthTarget.depthTexture = new St(
|
|
7448
7350
|
this.resolution.x,
|
|
7449
7351
|
this.resolution.y,
|
|
7450
|
-
|
|
7451
|
-
), this.objectIdTarget = new ue(this.resolution.x, this.resolution.y, n), this.normalMaterial =
|
|
7452
|
-
vertexShader:
|
|
7453
|
-
fragmentShader:
|
|
7454
|
-
side:
|
|
7352
|
+
At
|
|
7353
|
+
), this.objectIdTarget = new ue(this.resolution.x, this.resolution.y, n), this.normalMaterial = rn(), this.depthMaterial = an(), this.objectIdMaterial = new le({
|
|
7354
|
+
vertexShader: hn,
|
|
7355
|
+
fragmentShader: dn,
|
|
7356
|
+
side: J
|
|
7455
7357
|
}), this.edgeMaterial = new le({
|
|
7456
7358
|
uniforms: {
|
|
7457
7359
|
tDiffuse: { value: null },
|
|
@@ -7473,8 +7375,8 @@ class mn extends Zt {
|
|
|
7473
7375
|
enableNormalEdges: { value: this.options.enableNormalEdges },
|
|
7474
7376
|
enableObjectIdEdges: { value: this.options.enableObjectIdEdges }
|
|
7475
7377
|
},
|
|
7476
|
-
vertexShader:
|
|
7477
|
-
fragmentShader:
|
|
7378
|
+
vertexShader: ln,
|
|
7379
|
+
fragmentShader: cn
|
|
7478
7380
|
}), this.copyMaterial = new le({
|
|
7479
7381
|
uniforms: {
|
|
7480
7382
|
tDiffuse: { value: null }
|
|
@@ -7493,7 +7395,7 @@ class mn extends Zt {
|
|
|
7493
7395
|
gl_FragColor = texture2D(tDiffuse, vUv);
|
|
7494
7396
|
}
|
|
7495
7397
|
`
|
|
7496
|
-
}), this.fsQuad = new
|
|
7398
|
+
}), this.fsQuad = new Xt(this.edgeMaterial);
|
|
7497
7399
|
}
|
|
7498
7400
|
/**
|
|
7499
7401
|
* Update options
|
|
@@ -7551,19 +7453,19 @@ class mn extends Zt {
|
|
|
7551
7453
|
this.normalTarget.dispose(), this.depthTarget.dispose(), this.objectIdTarget.dispose(), this.normalMaterial.dispose(), this.depthMaterial.dispose(), this.edgeMaterial.dispose(), this.objectIdMaterial.dispose(), this.copyMaterial.dispose(), this.fsQuad.dispose();
|
|
7552
7454
|
}
|
|
7553
7455
|
}
|
|
7554
|
-
const
|
|
7555
|
-
outlineColor: new
|
|
7456
|
+
const pn = {
|
|
7457
|
+
outlineColor: new $(y.accent),
|
|
7556
7458
|
outlineOpacity: 1,
|
|
7557
7459
|
outlineThickness: 2,
|
|
7558
7460
|
showOccluded: !0,
|
|
7559
7461
|
occludedOpacity: 0.5
|
|
7560
|
-
},
|
|
7462
|
+
}, xt = R.hexToRGB(y.accent), zt = `
|
|
7561
7463
|
varying vec2 vUv;
|
|
7562
7464
|
void main() {
|
|
7563
7465
|
vUv = uv;
|
|
7564
7466
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
7565
7467
|
}
|
|
7566
|
-
`,
|
|
7468
|
+
`, mn = `
|
|
7567
7469
|
precision highp float;
|
|
7568
7470
|
|
|
7569
7471
|
uniform sampler2D tDiffuse; // Original scene
|
|
@@ -7597,11 +7499,11 @@ float detectEdge(vec2 uv, vec2 texelSize) {
|
|
|
7597
7499
|
float tx0y0 = texture2D(tMask, uv + texelSize * vec2(-1.0, -1.0) * outlineThickness).r;
|
|
7598
7500
|
float tx1y0 = texture2D(tMask, uv + texelSize * vec2( 0.0, -1.0) * outlineThickness).r;
|
|
7599
7501
|
float tx2y0 = texture2D(tMask, uv + texelSize * vec2( 1.0, -1.0) * outlineThickness).r;
|
|
7600
|
-
|
|
7502
|
+
|
|
7601
7503
|
float tx0y1 = texture2D(tMask, uv + texelSize * vec2(-1.0, 0.0) * outlineThickness).r;
|
|
7602
7504
|
float tx1y1 = texture2D(tMask, uv + texelSize * vec2( 0.0, 0.0) * outlineThickness).r;
|
|
7603
7505
|
float tx2y1 = texture2D(tMask, uv + texelSize * vec2( 1.0, 0.0) * outlineThickness).r;
|
|
7604
|
-
|
|
7506
|
+
|
|
7605
7507
|
float tx0y2 = texture2D(tMask, uv + texelSize * vec2(-1.0, 1.0) * outlineThickness).r;
|
|
7606
7508
|
float tx1y2 = texture2D(tMask, uv + texelSize * vec2( 0.0, 1.0) * outlineThickness).r;
|
|
7607
7509
|
float tx2y2 = texture2D(tMask, uv + texelSize * vec2( 1.0, 1.0) * outlineThickness).r;
|
|
@@ -7619,54 +7521,96 @@ float detectEdge(vec2 uv, vec2 texelSize) {
|
|
|
7619
7521
|
|
|
7620
7522
|
void main() {
|
|
7621
7523
|
vec2 texelSize = 1.0 / resolution;
|
|
7622
|
-
|
|
7524
|
+
|
|
7623
7525
|
// Get original scene color
|
|
7624
7526
|
vec4 sceneColor = texture2D(tDiffuse, vUv);
|
|
7625
|
-
|
|
7527
|
+
|
|
7626
7528
|
// Detect edge strength
|
|
7627
7529
|
float edge = detectEdge(vUv, texelSize);
|
|
7628
|
-
|
|
7530
|
+
|
|
7629
7531
|
// Skip if no edge
|
|
7630
7532
|
if (edge < 0.1) {
|
|
7631
7533
|
gl_FragColor = sceneColor;
|
|
7632
7534
|
return;
|
|
7633
7535
|
}
|
|
7634
|
-
|
|
7536
|
+
|
|
7635
7537
|
// Clamp edge intensity
|
|
7636
7538
|
edge = clamp(edge, 0.0, 1.0);
|
|
7637
|
-
|
|
7539
|
+
|
|
7638
7540
|
// Check occlusion (is the selected object behind something?)
|
|
7639
7541
|
float sceneDepth = texture2D(tDepth, vUv).r;
|
|
7640
7542
|
float maskDepth = texture2D(tMaskDepth, vUv).r;
|
|
7641
|
-
|
|
7543
|
+
|
|
7642
7544
|
float finalOpacity = outlineOpacity;
|
|
7643
|
-
|
|
7545
|
+
|
|
7644
7546
|
// If mask depth is further than scene depth, outline is occluded
|
|
7645
7547
|
if (showOccluded && maskDepth > sceneDepth + 0.0001) {
|
|
7646
7548
|
finalOpacity *= occludedOpacity;
|
|
7647
7549
|
}
|
|
7648
|
-
|
|
7550
|
+
|
|
7649
7551
|
// Composite outline over scene
|
|
7650
7552
|
vec3 finalColor = mix(sceneColor.rgb, outlineColor, edge * finalOpacity);
|
|
7651
|
-
|
|
7553
|
+
|
|
7652
7554
|
gl_FragColor = vec4(finalColor, sceneColor.a);
|
|
7653
7555
|
}
|
|
7556
|
+
`, gn = `
|
|
7557
|
+
varying vec3 vVertexColor;
|
|
7558
|
+
|
|
7559
|
+
void main() {
|
|
7560
|
+
// Three.js injects vertex color handling when vertexColors is enabled
|
|
7561
|
+
// For regular meshes: reads "color" attribute
|
|
7562
|
+
// For InstancedMesh: reads "instanceColor" and multiplies into color
|
|
7563
|
+
#ifdef USE_COLOR
|
|
7564
|
+
vVertexColor = color.rgb;
|
|
7565
|
+
#else
|
|
7566
|
+
vVertexColor = vec3(1.0);
|
|
7567
|
+
#endif
|
|
7568
|
+
|
|
7569
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
7570
|
+
|
|
7571
|
+
#ifdef USE_INSTANCING
|
|
7572
|
+
gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(position, 1.0);
|
|
7573
|
+
#endif
|
|
7574
|
+
}
|
|
7575
|
+
`, fn = `
|
|
7576
|
+
precision highp float;
|
|
7577
|
+
|
|
7578
|
+
uniform vec3 selectColor;
|
|
7579
|
+
uniform float colorTolerance;
|
|
7580
|
+
|
|
7581
|
+
varying vec3 vVertexColor;
|
|
7582
|
+
|
|
7583
|
+
void main() {
|
|
7584
|
+
// Check if this fragment's color matches the selection color
|
|
7585
|
+
float dist = distance(vVertexColor, selectColor);
|
|
7586
|
+
if (dist > colorTolerance) {
|
|
7587
|
+
discard;
|
|
7588
|
+
}
|
|
7589
|
+
gl_FragColor = vec4(1.0); // White mask for selected
|
|
7590
|
+
}
|
|
7654
7591
|
`;
|
|
7655
|
-
class vn extends
|
|
7592
|
+
class vn extends Yt {
|
|
7656
7593
|
constructor(e, t, i, s = {}) {
|
|
7657
|
-
super(), this.copyMaterial = null, this.
|
|
7594
|
+
super(), this.copyMaterial = null, this.hasSelection = !1, this.bypass = !1, this.scene = e, this.camera = t, this.resolution = i, this.options = { ...pn, ...s };
|
|
7658
7595
|
const n = i.clone().multiplyScalar(0.5);
|
|
7659
7596
|
this.maskRenderTarget = new ue(n.x, n.y, {
|
|
7660
7597
|
depthBuffer: !0
|
|
7661
7598
|
}), this.maskDepthRenderTarget = new ue(n.x, n.y, {
|
|
7662
7599
|
depthBuffer: !0
|
|
7663
|
-
}), this.
|
|
7664
|
-
|
|
7665
|
-
|
|
7600
|
+
}), this.selectionFilterMaterial = new le({
|
|
7601
|
+
uniforms: {
|
|
7602
|
+
selectColor: {
|
|
7603
|
+
value: [xt.r, xt.g, xt.b]
|
|
7604
|
+
},
|
|
7605
|
+
colorTolerance: { value: 0.01 }
|
|
7606
|
+
},
|
|
7607
|
+
vertexShader: gn,
|
|
7608
|
+
fragmentShader: fn,
|
|
7609
|
+
vertexColors: !0,
|
|
7610
|
+
side: J,
|
|
7666
7611
|
depthTest: !this.options.showOccluded,
|
|
7667
|
-
// Disable depth test to capture occluded parts
|
|
7668
7612
|
depthWrite: !0
|
|
7669
|
-
}), this.outlineMaterial = new le({
|
|
7613
|
+
}), this.selectionFilterMaterialDepth = this.selectionFilterMaterial.clone(), this.selectionFilterMaterialDepth.depthTest = !0, this.outlineMaterial = new le({
|
|
7670
7614
|
uniforms: {
|
|
7671
7615
|
tDiffuse: { value: null },
|
|
7672
7616
|
tMask: { value: this.maskRenderTarget.texture },
|
|
@@ -7679,23 +7623,23 @@ class vn extends Zt {
|
|
|
7679
7623
|
showOccluded: { value: this.options.showOccluded },
|
|
7680
7624
|
occludedOpacity: { value: this.options.occludedOpacity }
|
|
7681
7625
|
},
|
|
7682
|
-
vertexShader:
|
|
7683
|
-
fragmentShader:
|
|
7684
|
-
}), this.
|
|
7626
|
+
vertexShader: zt,
|
|
7627
|
+
fragmentShader: mn
|
|
7628
|
+
}), this.fsQuad = new Xt(this.outlineMaterial);
|
|
7685
7629
|
}
|
|
7686
7630
|
/**
|
|
7687
|
-
*
|
|
7688
|
-
*
|
|
7689
|
-
|
|
7631
|
+
* Notify the pass whether there is an active selection.
|
|
7632
|
+
* No data transfer needed — the GPU reads selection state from vertex colors.
|
|
7633
|
+
*/
|
|
7634
|
+
setHasSelection(e) {
|
|
7635
|
+
this.hasSelection = e;
|
|
7636
|
+
}
|
|
7637
|
+
/**
|
|
7638
|
+
* Legacy method — kept for backward compatibility.
|
|
7639
|
+
* With the GPU-based approach, this just toggles hasSelection.
|
|
7690
7640
|
*/
|
|
7691
7641
|
updateSelectionGeometry(e) {
|
|
7692
|
-
|
|
7693
|
-
this.hasSelection = !1, this.selectionGeometry.setDrawRange(0, 0);
|
|
7694
|
-
return;
|
|
7695
|
-
}
|
|
7696
|
-
this.hasSelection = !0;
|
|
7697
|
-
const t = e.length / 3;
|
|
7698
|
-
(!this.selectionBuffer || this.selectionBuffer.length < e.length) && (this.selectionBuffer = new Float32Array(e.length), this.selectionAttribute = new L(this.selectionBuffer, 3), this.selectionGeometry.setAttribute("position", this.selectionAttribute)), this.selectionBuffer.set(e), this.selectionAttribute && (this.selectionAttribute.needsUpdate = !0), this.selectionGeometry.setDrawRange(0, t), this.selectionMesh || (this.selectionMesh = new y(this.selectionGeometry, this.maskMaterial), this.selectionMesh.frustumCulled = !1, this.maskScene.add(this.selectionMesh));
|
|
7642
|
+
this.hasSelection = e !== null && e.length > 0;
|
|
7699
7643
|
}
|
|
7700
7644
|
/**
|
|
7701
7645
|
* Get whether there's an active selection
|
|
@@ -7707,39 +7651,32 @@ class vn extends Zt {
|
|
|
7707
7651
|
* Update outline options
|
|
7708
7652
|
*/
|
|
7709
7653
|
setOptions(e) {
|
|
7710
|
-
this.options = { ...this.options, ...e }, this.outlineMaterial.uniforms.outlineColor.value = this.options.outlineColor, this.outlineMaterial.uniforms.outlineOpacity.value = this.options.outlineOpacity, this.outlineMaterial.uniforms.outlineThickness.value = this.options.outlineThickness, this.outlineMaterial.uniforms.showOccluded.value = this.options.showOccluded, this.outlineMaterial.uniforms.occludedOpacity.value = this.options.occludedOpacity, this.
|
|
7654
|
+
this.options = { ...this.options, ...e }, this.outlineMaterial.uniforms.outlineColor.value = this.options.outlineColor, this.outlineMaterial.uniforms.outlineOpacity.value = this.options.outlineOpacity, this.outlineMaterial.uniforms.outlineThickness.value = this.options.outlineThickness, this.outlineMaterial.uniforms.showOccluded.value = this.options.showOccluded, this.outlineMaterial.uniforms.occludedOpacity.value = this.options.occludedOpacity, this.selectionFilterMaterial.depthTest = !this.options.showOccluded;
|
|
7711
7655
|
}
|
|
7712
7656
|
render(e, t, i, s, n) {
|
|
7713
7657
|
if (this.bypass) {
|
|
7714
|
-
this.
|
|
7715
|
-
uniforms: { tDiffuse: { value: null } },
|
|
7716
|
-
vertexShader: Mt,
|
|
7717
|
-
fragmentShader: `
|
|
7718
|
-
uniform sampler2D tDiffuse;
|
|
7719
|
-
varying vec2 vUv;
|
|
7720
|
-
void main() {
|
|
7721
|
-
gl_FragColor = texture2D(tDiffuse, vUv);
|
|
7722
|
-
}
|
|
7723
|
-
`
|
|
7724
|
-
})), this.copyMaterial.uniforms.tDiffuse.value = i.texture, this.fsQuad.material = this.copyMaterial, this.renderToScreen ? e.setRenderTarget(null) : e.setRenderTarget(t), this.fsQuad.render(e), this.fsQuad.material = this.outlineMaterial;
|
|
7658
|
+
this._renderCopyPass(e, i, t);
|
|
7725
7659
|
return;
|
|
7726
7660
|
}
|
|
7727
|
-
if (!this.hasSelection || !this.enabled
|
|
7728
|
-
this.
|
|
7729
|
-
uniforms: { tDiffuse: { value: null } },
|
|
7730
|
-
vertexShader: Mt,
|
|
7731
|
-
fragmentShader: `
|
|
7732
|
-
uniform sampler2D tDiffuse;
|
|
7733
|
-
varying vec2 vUv;
|
|
7734
|
-
void main() {
|
|
7735
|
-
gl_FragColor = texture2D(tDiffuse, vUv);
|
|
7736
|
-
}
|
|
7737
|
-
`
|
|
7738
|
-
})), this.copyMaterial.uniforms.tDiffuse.value = i.texture, this.fsQuad.material = this.copyMaterial, this.renderToScreen ? e.setRenderTarget(null) : e.setRenderTarget(t), this.fsQuad.render(e);
|
|
7661
|
+
if (!this.hasSelection || !this.enabled) {
|
|
7662
|
+
this._renderCopyPass(e, i, t);
|
|
7739
7663
|
return;
|
|
7740
7664
|
}
|
|
7741
|
-
const r = e.getRenderTarget(), o = e.autoClear;
|
|
7742
|
-
e.setRenderTarget(this.maskRenderTarget), e.setClearColor(0, 0), e.clear(), e.render(this.
|
|
7665
|
+
const r = e.getRenderTarget(), o = e.autoClear, a = this.scene.overrideMaterial;
|
|
7666
|
+
e.setRenderTarget(this.maskRenderTarget), e.setClearColor(0, 0), e.clear(), this.scene.overrideMaterial = this.selectionFilterMaterial, e.render(this.scene, this.camera), this.options.showOccluded && (e.setRenderTarget(this.maskDepthRenderTarget), e.clear(), this.scene.overrideMaterial = this.selectionFilterMaterialDepth, e.render(this.scene, this.camera)), this.scene.overrideMaterial = a, this.outlineMaterial.uniforms.tDiffuse.value = i.texture, this.outlineMaterial.uniforms.tMask.value = this.maskRenderTarget.texture, i.depthTexture && (this.outlineMaterial.uniforms.tDepth.value = i.depthTexture), this.renderToScreen ? e.setRenderTarget(null) : e.setRenderTarget(t), this.fsQuad.material = this.outlineMaterial, this.fsQuad.render(e), e.setRenderTarget(r), e.autoClear = o;
|
|
7667
|
+
}
|
|
7668
|
+
_renderCopyPass(e, t, i) {
|
|
7669
|
+
this.copyMaterial || (this.copyMaterial = new le({
|
|
7670
|
+
uniforms: { tDiffuse: { value: null } },
|
|
7671
|
+
vertexShader: zt,
|
|
7672
|
+
fragmentShader: `
|
|
7673
|
+
uniform sampler2D tDiffuse;
|
|
7674
|
+
varying vec2 vUv;
|
|
7675
|
+
void main() {
|
|
7676
|
+
gl_FragColor = texture2D(tDiffuse, vUv);
|
|
7677
|
+
}
|
|
7678
|
+
`
|
|
7679
|
+
})), this.copyMaterial.uniforms.tDiffuse.value = t.texture, this.fsQuad.material = this.copyMaterial, this.renderToScreen ? e.setRenderTarget(null) : e.setRenderTarget(i), this.fsQuad.render(e), this.fsQuad.material = this.outlineMaterial;
|
|
7743
7680
|
}
|
|
7744
7681
|
setSize(e, t) {
|
|
7745
7682
|
this.resolution.set(e, t);
|
|
@@ -7748,13 +7685,13 @@ class vn extends Zt {
|
|
|
7748
7685
|
}
|
|
7749
7686
|
dispose() {
|
|
7750
7687
|
var e;
|
|
7751
|
-
this.maskRenderTarget.dispose(), this.maskDepthRenderTarget.dispose(), this.
|
|
7688
|
+
this.maskRenderTarget.dispose(), this.maskDepthRenderTarget.dispose(), this.selectionFilterMaterial.dispose(), this.selectionFilterMaterialDepth.dispose(), this.outlineMaterial.dispose(), (e = this.copyMaterial) == null || e.dispose(), this.fsQuad.dispose();
|
|
7752
7689
|
}
|
|
7753
7690
|
}
|
|
7754
|
-
new
|
|
7691
|
+
new H(1024, 1024), new $(0);
|
|
7755
7692
|
class bn {
|
|
7756
7693
|
constructor(e, t) {
|
|
7757
|
-
this.renderer = e, this.viralViewerApi = t, this.gammaPass = null, this.ssaoPass = null, this.saoPass = null, this.smaaPass = null, this.ssaaPass = null, this.fxaaPass = null, this.taaPass = null, this.sobelPass = null, this.whitePass = null, this.shadowRemovalPass = null, this.outlinePass = null, this.screenSpaceEdgesPass = null, this.selectionOutlinePass = null, this.perfChecker = new
|
|
7694
|
+
this.renderer = e, this.viralViewerApi = t, this.gammaPass = null, this.ssaoPass = null, this.saoPass = null, this.smaaPass = null, this.ssaaPass = null, this.fxaaPass = null, this.taaPass = null, this.sobelPass = null, this.whitePass = null, this.shadowRemovalPass = null, this.outlinePass = null, this.screenSpaceEdgesPass = null, this.selectionOutlinePass = null, this.perfChecker = new Gs(), this._whiteShader = {
|
|
7758
7695
|
uniforms: {
|
|
7759
7696
|
tDiffuse: { value: null },
|
|
7760
7697
|
shadowTexture: { value: null },
|
|
@@ -7785,15 +7722,15 @@ class bn {
|
|
|
7785
7722
|
}
|
|
7786
7723
|
`
|
|
7787
7724
|
};
|
|
7788
|
-
const i = new
|
|
7725
|
+
const i = new H();
|
|
7789
7726
|
e.getSize(i);
|
|
7790
7727
|
const s = new ue(i.x, i.y, {
|
|
7791
7728
|
format: Wt,
|
|
7792
|
-
type:
|
|
7729
|
+
type: Gt,
|
|
7793
7730
|
depthBuffer: !0,
|
|
7794
7731
|
stencilBuffer: !1
|
|
7795
7732
|
});
|
|
7796
|
-
s.depthTexture = new
|
|
7733
|
+
s.depthTexture = new St(i.x, i.y, At), this.composer = new Ni(this.renderer, s), this.composer.setSize(window.innerWidth, window.innerHeight);
|
|
7797
7734
|
}
|
|
7798
7735
|
isWebGL2Available() {
|
|
7799
7736
|
return !!window.WebGL2RenderingContext;
|
|
@@ -7802,7 +7739,7 @@ class bn {
|
|
|
7802
7739
|
this.composer.render();
|
|
7803
7740
|
}
|
|
7804
7741
|
initRenderPass(e, t) {
|
|
7805
|
-
this.renderPass = new
|
|
7742
|
+
this.renderPass = new Hi(e, t), this.composer.addPass(this.renderPass);
|
|
7806
7743
|
const i = this.perfChecker.getSpecs();
|
|
7807
7744
|
if (console.log(i), this.perfChecker.canHandleExpensiveEffects()) {
|
|
7808
7745
|
//! this pass cause slow render on weak machine, turn it off when camera moving
|
|
@@ -7814,16 +7751,16 @@ class bn {
|
|
|
7814
7751
|
this.perfChecker.canHandleBasicEffects();
|
|
7815
7752
|
this.initScreenSpaceEdgesPass(e, t), this.initSelectionOutlinePass(e, t);
|
|
7816
7753
|
//! this pass slow render too, turn it off when we dont use
|
|
7817
|
-
const s = new
|
|
7754
|
+
const s = new ji();
|
|
7818
7755
|
this.composer.addPass(s);
|
|
7819
7756
|
}
|
|
7820
7757
|
initGammaPass() {
|
|
7821
|
-
this.gammaPass = new
|
|
7758
|
+
this.gammaPass = new yt(Wi), this.composer.addPass(this.gammaPass);
|
|
7822
7759
|
}
|
|
7823
7760
|
//#region N8AOPass
|
|
7824
7761
|
initn8aoPass(e, t) {
|
|
7825
7762
|
//! need to optimize this base on performance
|
|
7826
|
-
this.n8aoPass = new
|
|
7763
|
+
this.n8aoPass = new zi(e, t), this.n8aoPass.configuration.aoSamples = 16, this.n8aoPass.configuration.denoiseRadius = 16, this.n8aoPass.configuration.intensity = 5, this.n8aoPass.configuration.aoRadius = 10, this.n8aoPass.configuration.quality = "Low", this.n8aoPass.configuration.gammaCorrection = !1, this.n8aoPass.configuration.halfRes = !1, this.n8aoPass.configuration.distanceFalloff = 5, this.n8aoPass.configuration.accumulate = !1, this.n8aoPass.configuration.renderToScreen = !1, this.composer.addPass(this.n8aoPass);
|
|
7827
7764
|
}
|
|
7828
7765
|
enableN8AOPass() {
|
|
7829
7766
|
this.n8aoPass && (this.n8aoPass.setDisplayMode("Combined"), this.n8aoPass.enabled = !0);
|
|
@@ -7840,19 +7777,19 @@ class bn {
|
|
|
7840
7777
|
//#endregion
|
|
7841
7778
|
//#region Anti Aliases Passes
|
|
7842
7779
|
initSMAAPass() {
|
|
7843
|
-
this.smaaPass = new
|
|
7780
|
+
this.smaaPass = new Fi(), this.smaaPass.renderToScreen = !0, this.composer.addPass(this.smaaPass);
|
|
7844
7781
|
}
|
|
7845
7782
|
initSSAAPass(e, t) {
|
|
7846
|
-
this.ssaaPass = new
|
|
7783
|
+
this.ssaaPass = new Ci(e, t), this.ssaaPass.unbiased = !0, this.ssaaPass.sampleLevel = 2, this.composer.addPass(this.ssaaPass);
|
|
7847
7784
|
}
|
|
7848
7785
|
initFXAAPass() {
|
|
7849
|
-
this.fxaaPass = new
|
|
7786
|
+
this.fxaaPass = new yt(Si), this.fxaaPass.uniforms.resolution.value.set(
|
|
7850
7787
|
1 / window.innerWidth,
|
|
7851
7788
|
1 / window.innerHeight
|
|
7852
7789
|
), this.composer.addPass(this.fxaaPass);
|
|
7853
7790
|
}
|
|
7854
7791
|
initTAAPass(e, t) {
|
|
7855
|
-
this.taaPass = new
|
|
7792
|
+
this.taaPass = new Ai(e, t), this.taaPass.sampleLevel = 2, this.taaPass.unbiased = !1, this.composer.addPass(this.taaPass);
|
|
7856
7793
|
}
|
|
7857
7794
|
enableTAA() {
|
|
7858
7795
|
this.taaPass && (this.taaPass.enabled = !0);
|
|
@@ -7863,7 +7800,7 @@ class bn {
|
|
|
7863
7800
|
//#endregion
|
|
7864
7801
|
//#region SAO
|
|
7865
7802
|
initSAOPass(e, t) {
|
|
7866
|
-
this.saoPass = new
|
|
7803
|
+
this.saoPass = new _i(e, t), this.saoPass.params.saoIntensity = 1e-4, this.saoPass.params.saoKernelRadius = 10, this.composer.addPass(this.saoPass);
|
|
7867
7804
|
}
|
|
7868
7805
|
//#endregion
|
|
7869
7806
|
//#region SSAO
|
|
@@ -7894,12 +7831,12 @@ class bn {
|
|
|
7894
7831
|
* - Object ID discontinuity detection (object boundaries)
|
|
7895
7832
|
*/
|
|
7896
7833
|
initScreenSpaceEdgesPass(e, t) {
|
|
7897
|
-
this.screenSpaceEdgesPass = new
|
|
7834
|
+
this.screenSpaceEdgesPass = new un(
|
|
7898
7835
|
e,
|
|
7899
7836
|
t,
|
|
7900
|
-
new
|
|
7837
|
+
new H(window.innerWidth, window.innerHeight),
|
|
7901
7838
|
{
|
|
7902
|
-
edgeColor: new
|
|
7839
|
+
edgeColor: new $(0),
|
|
7903
7840
|
edgeOpacity: 1,
|
|
7904
7841
|
edgeThickness: 2,
|
|
7905
7842
|
depthMultiplier: 1.5,
|
|
@@ -7950,7 +7887,7 @@ class bn {
|
|
|
7950
7887
|
*/
|
|
7951
7888
|
setScreenSpaceEdgeColor(e) {
|
|
7952
7889
|
if (this.screenSpaceEdgesPass) {
|
|
7953
|
-
const t = typeof e == "number" ? new
|
|
7890
|
+
const t = typeof e == "number" ? new $(e) : e;
|
|
7954
7891
|
this.screenSpaceEdgesPass.setOptions({ edgeColor: t });
|
|
7955
7892
|
}
|
|
7956
7893
|
}
|
|
@@ -7981,7 +7918,7 @@ class bn {
|
|
|
7981
7918
|
*/
|
|
7982
7919
|
setScreenSpaceEdgesPenMode() {
|
|
7983
7920
|
this.screenSpaceEdgesPass && this.screenSpaceEdgesPass.setOptions({
|
|
7984
|
-
edgeColor: new
|
|
7921
|
+
edgeColor: new $(0),
|
|
7985
7922
|
edgeOpacity: 1,
|
|
7986
7923
|
edgeThickness: 1.5
|
|
7987
7924
|
});
|
|
@@ -7991,24 +7928,24 @@ class bn {
|
|
|
7991
7928
|
*/
|
|
7992
7929
|
setScreenSpaceEdgesShadedMode() {
|
|
7993
7930
|
this.screenSpaceEdgesPass && this.screenSpaceEdgesPass.setOptions({
|
|
7994
|
-
edgeColor: new
|
|
7931
|
+
edgeColor: new $(0),
|
|
7995
7932
|
edgeOpacity: 0.8,
|
|
7996
7933
|
edgeThickness: 1.5
|
|
7997
7934
|
});
|
|
7998
7935
|
}
|
|
7999
7936
|
initWhitePass() {
|
|
8000
|
-
this.whitePass = new
|
|
7937
|
+
this.whitePass = new yt(this._whiteShader), this.composer.addPass(this.whitePass);
|
|
8001
7938
|
}
|
|
8002
7939
|
//#endregion
|
|
8003
7940
|
//#region Outline Pass
|
|
8004
7941
|
initOutlinePass(e, t) {
|
|
8005
|
-
this.outlinePass = new
|
|
8006
|
-
new
|
|
7942
|
+
this.outlinePass = new $i(
|
|
7943
|
+
new H(window.innerWidth, window.innerHeight),
|
|
8007
7944
|
e,
|
|
8008
7945
|
t,
|
|
8009
7946
|
// TODO : investigate why this effect when render new model
|
|
8010
7947
|
[this.viralViewerApi.viralScene.outlineModel]
|
|
8011
|
-
), this.outlinePass.edgeStrength = 5, this.outlinePass.edgeGlow = 0.4, this.outlinePass.edgeThickness = 2, this.outlinePass.pulsePeriod = 0, this.outlinePass.visibleEdgeColor.set(
|
|
7948
|
+
), this.outlinePass.edgeStrength = 5, this.outlinePass.edgeGlow = 0.4, this.outlinePass.edgeThickness = 2, this.outlinePass.pulsePeriod = 0, this.outlinePass.visibleEdgeColor.set(y.accent), this.outlinePass.hiddenEdgeColor.set(y.accent), this.outlinePass.enabled = !1, this.outlinePass.renderToScreen = !1, this.composer.addPass(this.outlinePass);
|
|
8012
7949
|
}
|
|
8013
7950
|
enableOutline() {
|
|
8014
7951
|
this.outlinePass && (this.outlinePass.enabled = !0, this.outlinePass.renderToScreen = !0);
|
|
@@ -8027,9 +7964,9 @@ class bn {
|
|
|
8027
7964
|
this.selectionOutlinePass = new vn(
|
|
8028
7965
|
e,
|
|
8029
7966
|
t,
|
|
8030
|
-
new
|
|
7967
|
+
new H(window.innerWidth, window.innerHeight),
|
|
8031
7968
|
{
|
|
8032
|
-
outlineColor: new
|
|
7969
|
+
outlineColor: new $(y.accent),
|
|
8033
7970
|
outlineOpacity: 1,
|
|
8034
7971
|
outlineThickness: 2,
|
|
8035
7972
|
showOccluded: !0,
|
|
@@ -8045,6 +7982,13 @@ class bn {
|
|
|
8045
7982
|
updateSelectionOutline(e) {
|
|
8046
7983
|
this.selectionOutlinePass && this.selectionOutlinePass.updateSelectionGeometry(e);
|
|
8047
7984
|
}
|
|
7985
|
+
/**
|
|
7986
|
+
* Notify the outline pass whether elements are currently selected.
|
|
7987
|
+
* The GPU reads selection state directly from vertex colors — no data transfer needed.
|
|
7988
|
+
*/
|
|
7989
|
+
setSelectionOutlineActive(e) {
|
|
7990
|
+
this.selectionOutlinePass && this.selectionOutlinePass.setHasSelection(e);
|
|
7991
|
+
}
|
|
8048
7992
|
/**
|
|
8049
7993
|
* Enable selection outline rendering
|
|
8050
7994
|
*/
|
|
@@ -8083,7 +8027,7 @@ class bn {
|
|
|
8083
8027
|
*/
|
|
8084
8028
|
setSelectionOutlineColor(e) {
|
|
8085
8029
|
if (this.selectionOutlinePass) {
|
|
8086
|
-
const t = e instanceof
|
|
8030
|
+
const t = e instanceof $ ? e : new $(e);
|
|
8087
8031
|
this.selectionOutlinePass.setOptions({ outlineColor: t });
|
|
8088
8032
|
}
|
|
8089
8033
|
}
|
|
@@ -8097,22 +8041,22 @@ class bn {
|
|
|
8097
8041
|
}
|
|
8098
8042
|
class wn {
|
|
8099
8043
|
constructor(e) {
|
|
8100
|
-
this.viralViewerApi = e, this.renderer = new
|
|
8044
|
+
this.viralViewerApi = e, this.renderer = new Ut({
|
|
8101
8045
|
alpha: !0,
|
|
8102
8046
|
antialias: !0,
|
|
8103
8047
|
stencil: !0,
|
|
8104
8048
|
logarithmicDepthBuffer: !0,
|
|
8105
8049
|
powerPreference: "high-performance",
|
|
8106
8050
|
preserveDrawingBuffer: !0
|
|
8107
|
-
}), this._t = 0, this._lastSpatialStatsTime = 0, this.renderTimeout = null, this.jitterOffsets = [], this.jitterIndex = 0, this.size = new
|
|
8051
|
+
}), this._t = 0, this._lastSpatialStatsTime = 0, this.renderTimeout = null, this.jitterOffsets = [], this.jitterIndex = 0, this.size = new H(window.innerWidth, window.innerHeight), this.samples = 4;
|
|
8108
8052
|
const t = this.renderer.getContext(), i = t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS);
|
|
8109
8053
|
console.log("Max Fragment Uniform Vectors ->", i), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(
|
|
8110
8054
|
this.viralViewerApi.targetElement.offsetWidth,
|
|
8111
8055
|
this.viralViewerApi.targetElement.offsetHeight
|
|
8112
|
-
), this.renderer.outputColorSpace =
|
|
8056
|
+
), this.renderer.outputColorSpace = di, this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type = ui, this.renderer.shadowMap.autoUpdate = !1, this.renderer.shadowMap.needsUpdate = !0, this.renderer.info.autoReset = !1, this.viralViewerApi.targetElement.appendChild(this.renderer.domElement), this.viralViewerApi.options.enablePostProcessing !== !1 && (this.postProcessingRenderer = new bn(
|
|
8113
8057
|
this.renderer,
|
|
8114
8058
|
this.viralViewerApi
|
|
8115
|
-
)), this.jitterOffsets = this.generateJitterOffsets(), this.viralViewerApi.emit(
|
|
8059
|
+
)), this.jitterOffsets = this.generateJitterOffsets(), this.viralViewerApi.emit(k.LOADED_RENDERER);
|
|
8116
8060
|
}
|
|
8117
8061
|
updateSize(e, t) {
|
|
8118
8062
|
this.renderer.setSize(e, t), this.postProcessingRenderer && this.postProcessingRenderer.composer.setSize(e, t);
|
|
@@ -8226,17 +8170,17 @@ const de = {
|
|
|
8226
8170
|
};
|
|
8227
8171
|
class yn {
|
|
8228
8172
|
constructor(e) {
|
|
8229
|
-
this.viralViewerApi = e, this.scene = new
|
|
8173
|
+
this.viralViewerApi = e, this.scene = new Tt(), this.objects = [], this.models = [], this.bimWorld = new Ji(), this.outlineModel = new x(), this.hideables = [], this.selectables = [], this.edges = [], this.sunLight = null, this.lights = [], this.transformControls = null, this.lightHelpers = [], this.fullScreenQuadMaterial = new q({
|
|
8230
8174
|
map: null,
|
|
8231
8175
|
// Use the render target's texture
|
|
8232
|
-
side:
|
|
8233
|
-
}), this.fullScreenQuad = null, this.viralViewerApi.emit(
|
|
8176
|
+
side: J
|
|
8177
|
+
}), this.fullScreenQuad = null, this.viralViewerApi.emit(k.LOADED_SCENE), this.bimWorld.name = de.mergedModel, this.addModel(this.bimWorld), this.outlineModel.name = de.outlineModel, this.outlineModel.renderOrder = 0, this.addModel(this.outlineModel);
|
|
8234
8178
|
const t = new Dt(5, 32, 32), i = new K({
|
|
8235
8179
|
color: 16768256,
|
|
8236
8180
|
emissive: 16755200,
|
|
8237
8181
|
emissiveIntensity: 1
|
|
8238
8182
|
});
|
|
8239
|
-
this.sunSphere = new
|
|
8183
|
+
this.sunSphere = new x(t, i), this.sunSphere.visible = !1, this.addObject(this.sunSphere), this.addLights(), this.addPivotPoint(), this.viralViewerApi.options.isDev && this.addAxes();
|
|
8240
8184
|
}
|
|
8241
8185
|
//#region Add Main Objects
|
|
8242
8186
|
addObject(e) {
|
|
@@ -8268,22 +8212,22 @@ class yn {
|
|
|
8268
8212
|
t.position.set(0, -1, 0).normalize();
|
|
8269
8213
|
const i = new ut(16777215, 1);
|
|
8270
8214
|
i.position.set(-1, 1, -1).normalize();
|
|
8271
|
-
const s = new
|
|
8215
|
+
const s = new pi(16777215, 1);
|
|
8272
8216
|
this.sunLight = new ut(16777215, 4), this.sunLight.name = de.sunlight, this.sunLight.castShadow = !1, this.sunLight.position.set(50, 50, 50), this.sunLight.shadow.camera.top = 50, this.sunLight.shadow.camera.bottom = -50, this.sunLight.shadow.camera.left = -50, this.sunLight.shadow.camera.right = 50, this.sunLight.shadow.mapSize.x = 2048, this.sunLight.shadow.mapSize.y = 2048, this.sunLight.shadow.camera.near = 5, this.sunLight.shadow.camera.far = 350, this.sunLight.shadow.bias = -1e-3, this.sunLight.shadow.radius = 2, this.sunLight.visible = !0;
|
|
8273
|
-
const n = new
|
|
8217
|
+
const n = new mi(this.sunLight.shadow.camera);
|
|
8274
8218
|
n.visible = !1, this.addObject(e), this.addObject(t), this.addObject(i), this.addObject(s), this.addObject(this.sunLight), this.addObject(n), this.lights.push(e), this.lights.push(t), this.lights.push(i), this.lights.push(s), this.lights.push(this.sunLight), this.lightHelpers.push(n);
|
|
8275
8219
|
}
|
|
8276
8220
|
//#endregion
|
|
8277
8221
|
addPivotPoint() {
|
|
8278
|
-
const e = new Dt(1, 16, 16), t = new
|
|
8279
|
-
color:
|
|
8222
|
+
const e = new Dt(1, 16, 16), t = new q({
|
|
8223
|
+
color: R.hexToThreejsColor(y.accent)
|
|
8280
8224
|
// transparent: true,
|
|
8281
8225
|
// opacity: 0.5,
|
|
8282
|
-
}), i = new
|
|
8226
|
+
}), i = new x(e, t);
|
|
8283
8227
|
i.name = de.pivotPoint, i.visible = !1, this.addObject(i);
|
|
8284
8228
|
}
|
|
8285
8229
|
addTransformControls(e) {
|
|
8286
|
-
this.transformControls = new
|
|
8230
|
+
this.transformControls = new Gi(
|
|
8287
8231
|
e,
|
|
8288
8232
|
this.viralViewerApi.viralRenderer.renderer.domElement
|
|
8289
8233
|
);
|
|
@@ -8300,8 +8244,8 @@ class yn {
|
|
|
8300
8244
|
//#region Helper
|
|
8301
8245
|
addCube() {
|
|
8302
8246
|
if (this.scene) {
|
|
8303
|
-
const e = new
|
|
8304
|
-
new
|
|
8247
|
+
const e = new x(
|
|
8248
|
+
new Pt(1, 1, 1),
|
|
8305
8249
|
new K({ color: 16711680 })
|
|
8306
8250
|
);
|
|
8307
8251
|
e.castShadow = !0, e.receiveShadow = !0, this.addObject(e);
|
|
@@ -8309,7 +8253,7 @@ class yn {
|
|
|
8309
8253
|
}
|
|
8310
8254
|
addAxes() {
|
|
8311
8255
|
if (this.scene) {
|
|
8312
|
-
const e = new
|
|
8256
|
+
const e = new gi(10);
|
|
8313
8257
|
e.renderOrder = 999, e.material.depthTest = !1, e.material.depthWrite = !1, this.addObject(e);
|
|
8314
8258
|
}
|
|
8315
8259
|
}
|
|
@@ -8323,20 +8267,20 @@ class yn {
|
|
|
8323
8267
|
* Add box helper to check mesh
|
|
8324
8268
|
*/
|
|
8325
8269
|
addBoxHelper(e) {
|
|
8326
|
-
const t = new
|
|
8270
|
+
const t = new fi(e, 16711680);
|
|
8327
8271
|
this.addObject(t);
|
|
8328
8272
|
}
|
|
8329
8273
|
addBox3Helper(e) {
|
|
8330
|
-
const t = new
|
|
8274
|
+
const t = new vi(e, 16776960);
|
|
8331
8275
|
this.addObject(t);
|
|
8332
8276
|
}
|
|
8333
8277
|
addFullscreenQuad() {
|
|
8334
8278
|
const e = new ae(window.innerWidth, window.innerHeight);
|
|
8335
|
-
this.fullScreenQuad = new
|
|
8279
|
+
this.fullScreenQuad = new x(e, this.fullScreenQuadMaterial), this.addObject(this.fullScreenQuad);
|
|
8336
8280
|
}
|
|
8337
8281
|
//#endregion
|
|
8338
8282
|
}
|
|
8339
|
-
const
|
|
8283
|
+
const Nt = new Float32Array([
|
|
8340
8284
|
// Bottom face (Y = -1)
|
|
8341
8285
|
-1,
|
|
8342
8286
|
-1,
|
|
@@ -8427,7 +8371,7 @@ const zt = new Float32Array([
|
|
|
8427
8371
|
// 5: -Z
|
|
8428
8372
|
], Ge = class Ge {
|
|
8429
8373
|
constructor(e) {
|
|
8430
|
-
this.viralViewerApi = e, this._isGenerated = !1, this._isActive = !1, this._isVisible = !1, this._initialCenter = new E(), this._initialHalfSize = new E(), this._center = new E(), this._halfSize = new E(), this._boxOutline = null, this._outlineGeometry = null, this._outlineMaterial = null, this._hitBoxMesh = null, this._facePlaneMesh = null, this._dragAnchor = new
|
|
8374
|
+
this.viralViewerApi = e, this._isGenerated = !1, this._isActive = !1, this._isVisible = !1, this._initialCenter = new E(), this._initialHalfSize = new E(), this._center = new E(), this._halfSize = new E(), this._boxOutline = null, this._outlineGeometry = null, this._outlineMaterial = null, this._hitBoxMesh = null, this._facePlaneMesh = null, this._dragAnchor = new jt(), this._selectedFaceIndex = -1, this._clippingPlanes = [], this._transformedEdges = new Float32Array(72);
|
|
8431
8375
|
}
|
|
8432
8376
|
/** Whether section box is active (clipping enabled) */
|
|
8433
8377
|
get isActive() {
|
|
@@ -8551,46 +8495,46 @@ const zt = new Float32Array([
|
|
|
8551
8495
|
}
|
|
8552
8496
|
// --- Private methods ---
|
|
8553
8497
|
_initFromBoundingBox() {
|
|
8554
|
-
const e = new
|
|
8498
|
+
const e = new j().setFromObject(this.viralViewerApi.viralScene.bimWorld);
|
|
8555
8499
|
e.getCenter(this._center), e.getSize(this._halfSize).multiplyScalar(0.5), this._initialCenter.copy(this._center), this._initialHalfSize.copy(this._halfSize), this._isGenerated = !0;
|
|
8556
8500
|
}
|
|
8557
8501
|
_createVisuals() {
|
|
8558
8502
|
if (this._boxOutline)
|
|
8559
8503
|
return;
|
|
8560
|
-
this._outlineMaterial = new
|
|
8561
|
-
color:
|
|
8504
|
+
this._outlineMaterial = new Zt({
|
|
8505
|
+
color: R.hexToThreejsColor(y.accent),
|
|
8562
8506
|
linewidth: 2,
|
|
8563
|
-
resolution: new
|
|
8507
|
+
resolution: new H(window.innerWidth, window.innerHeight),
|
|
8564
8508
|
worldUnits: !1,
|
|
8565
8509
|
transparent: !1,
|
|
8566
8510
|
depthTest: !0,
|
|
8567
8511
|
depthWrite: !0
|
|
8568
|
-
}), this._outlineGeometry = new
|
|
8569
|
-
const e = new
|
|
8512
|
+
}), this._outlineGeometry = new qi(), this._outlineGeometry.setPositions(Nt), this._boxOutline = new Ui(this._outlineGeometry, this._outlineMaterial), this._boxOutline.name = "SectionBoxOutline", this._boxOutline.renderOrder = 0, this._boxOutline.frustumCulled = !1, this.viralViewerApi.viralScene.addObject(this._boxOutline);
|
|
8513
|
+
const e = new Pt(2, 2, 2), t = new q({
|
|
8570
8514
|
transparent: !0,
|
|
8571
8515
|
opacity: 0,
|
|
8572
|
-
side:
|
|
8516
|
+
side: J,
|
|
8573
8517
|
depthWrite: !1,
|
|
8574
8518
|
depthTest: !1
|
|
8575
8519
|
});
|
|
8576
|
-
this._hitBoxMesh = new
|
|
8577
|
-
const i = new
|
|
8578
|
-
color:
|
|
8520
|
+
this._hitBoxMesh = new x(e, t), this._hitBoxMesh.name = "SectionBoxHit", this._hitBoxMesh.visible = !0, this._hitBoxMesh.renderOrder = -1, this.viralViewerApi.viralScene.addObject(this._hitBoxMesh);
|
|
8521
|
+
const i = new q({
|
|
8522
|
+
color: R.hexToThreejsColor(y.accent),
|
|
8579
8523
|
transparent: !0,
|
|
8580
8524
|
opacity: 0.15,
|
|
8581
|
-
side:
|
|
8525
|
+
side: J,
|
|
8582
8526
|
depthWrite: !1,
|
|
8583
8527
|
depthTest: !1,
|
|
8584
8528
|
polygonOffset: !0,
|
|
8585
8529
|
polygonOffsetFactor: 1,
|
|
8586
8530
|
polygonOffsetUnits: 1
|
|
8587
8531
|
});
|
|
8588
|
-
this._facePlaneMesh = new
|
|
8532
|
+
this._facePlaneMesh = new x(new ae(1, 1), i), this._facePlaneMesh.name = "SectionBoxFaceHighlight", this._facePlaneMesh.visible = !1, this._facePlaneMesh.renderOrder = 997, this.viralViewerApi.viralScene.addObject(this._facePlaneMesh), this._dragAnchor.name = "SectionBoxDragAnchor", this.viralViewerApi.viralScene.scene.add(this._dragAnchor);
|
|
8589
8533
|
}
|
|
8590
8534
|
_updateVisuals() {
|
|
8591
8535
|
if (!this._boxOutline || !this._outlineGeometry || !this._hitBoxMesh)
|
|
8592
8536
|
return;
|
|
8593
|
-
const e = Ge.VISUAL_INSET, t = this._center.x, i = this._center.y, s = this._center.z, n = this._halfSize.x * (1 - e), r = this._halfSize.y * (1 - e), o = this._halfSize.z * (1 - e), a =
|
|
8537
|
+
const e = Ge.VISUAL_INSET, t = this._center.x, i = this._center.y, s = this._center.z, n = this._halfSize.x * (1 - e), r = this._halfSize.y * (1 - e), o = this._halfSize.z * (1 - e), a = Nt, l = this._transformedEdges;
|
|
8594
8538
|
for (let c = 0; c < 72; c += 3)
|
|
8595
8539
|
l[c] = t + n * a[c], l[c + 1] = i + r * a[c + 1], l[c + 2] = s + o * a[c + 2];
|
|
8596
8540
|
if (this._outlineGeometry.setPositions(l), this._boxOutline.computeLineDistances(), this._boxOutline.geometry.computeBoundingSphere(), this._hitBoxMesh.position.copy(this._center), this._hitBoxMesh.scale.copy(this._halfSize), this._hitBoxMesh.updateMatrixWorld(!0), this._outlineMaterial) {
|
|
@@ -8692,7 +8636,7 @@ const zt = new Float32Array([
|
|
|
8692
8636
|
};
|
|
8693
8637
|
Ge.VISUAL_INSET = 2e-3;
|
|
8694
8638
|
let Vt = Ge;
|
|
8695
|
-
var
|
|
8639
|
+
var Fe = () => {
|
|
8696
8640
|
var g = 0, e = document.createElement("div");
|
|
8697
8641
|
e.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", e.addEventListener(
|
|
8698
8642
|
"click",
|
|
@@ -8709,9 +8653,9 @@ var We = () => {
|
|
|
8709
8653
|
e.children[h].style.display = h === c ? "block" : "none";
|
|
8710
8654
|
g = c;
|
|
8711
8655
|
}
|
|
8712
|
-
var s = (performance || Date).now(), n = s, r = 0, o = t(
|
|
8656
|
+
var s = (performance || Date).now(), n = s, r = 0, o = t(Fe.Panel("FPS", "#0ff", "#002")), a = t(Fe.Panel("MS", "#0f0", "#020"));
|
|
8713
8657
|
if (self.performance && self.performance.memory)
|
|
8714
|
-
var l = t(
|
|
8658
|
+
var l = t(Fe.Panel("MB", "#f08", "#201"));
|
|
8715
8659
|
return i(0), {
|
|
8716
8660
|
REVISION: 16,
|
|
8717
8661
|
dom: e,
|
|
@@ -8740,7 +8684,7 @@ var We = () => {
|
|
|
8740
8684
|
setMode: i
|
|
8741
8685
|
};
|
|
8742
8686
|
};
|
|
8743
|
-
|
|
8687
|
+
Fe.Panel = (g, e, t) => {
|
|
8744
8688
|
var i = 1 / 0, s = 0, n = Math.round, r = n(window.devicePixelRatio || 1), o = 80 * r, a = 48 * r, l = 3 * r, c = 2 * r, h = 3 * r, d = 15 * r, u = 74 * r, p = 30 * r, m = document.createElement("canvas");
|
|
8745
8689
|
m.width = o, m.height = a, m.style.cssText = "width:80px;height:48px";
|
|
8746
8690
|
var f = m.getContext("2d");
|
|
@@ -8772,12 +8716,12 @@ We.Panel = (g, e, t) => {
|
|
|
8772
8716
|
};
|
|
8773
8717
|
class Mn {
|
|
8774
8718
|
constructor(e) {
|
|
8775
|
-
this.viralViewerApi = e, this.stats = null, this.viralViewerApi.targetElement && (this.stats =
|
|
8719
|
+
this.viralViewerApi = e, this.stats = null, this.viralViewerApi.targetElement && (this.stats = Fe(), this.stats.showPanel(0), this.viralViewerApi.targetElement.appendChild(this.stats.dom));
|
|
8776
8720
|
}
|
|
8777
8721
|
}
|
|
8778
8722
|
class En {
|
|
8779
8723
|
constructor(e) {
|
|
8780
|
-
this.viralViewerApi = e, this._selectionOutlineEnabled = !0, this.
|
|
8724
|
+
this.viralViewerApi = e, this._selectionOutlineEnabled = !0, this.exceptElements = [], this.isolateModelId = "0", this.sunConfiguration = ts, this._ground = null, this.opacity = 1, this._fog = new bi(13421772, 1, 1e3), this.rainGeometry = new ne(), this.rain = null, this._isGeneratedRain = !1, this.ghostMode = !0, this._batchColors = /* @__PURE__ */ new Map(), this._originalBatchMaterials = /* @__PURE__ */ new Map(), this._batchVisualizationEnabled = !1, this.showHidePercentage = 100, this.randomColor = 100;
|
|
8781
8725
|
}
|
|
8782
8726
|
/**
|
|
8783
8727
|
* show all elements and reset back to normal visualization
|
|
@@ -8786,10 +8730,20 @@ class En {
|
|
|
8786
8730
|
this.viralViewerApi.viralScene.bimWorld.resetVisibility(), this.viralViewerApi.viralRenderer.render();
|
|
8787
8731
|
}
|
|
8788
8732
|
/**
|
|
8789
|
-
*
|
|
8733
|
+
* Hide all elements (sets all meshes invisible)
|
|
8790
8734
|
*/
|
|
8791
8735
|
hideAllElements() {
|
|
8792
|
-
this.viralViewerApi.viralScene.bimWorld
|
|
8736
|
+
const e = this.viralViewerApi.viralScene.bimWorld, t = [];
|
|
8737
|
+
for (const i of this.viralViewerApi.viralScene.bimWorld.bimModels) {
|
|
8738
|
+
const s = i.modelId.toString();
|
|
8739
|
+
for (const n of i.elements)
|
|
8740
|
+
for (const r of n.Instances)
|
|
8741
|
+
t.push({
|
|
8742
|
+
modelId: s,
|
|
8743
|
+
elementId: r.Id
|
|
8744
|
+
});
|
|
8745
|
+
}
|
|
8746
|
+
e.hide(t), this.viralViewerApi.viralRenderer.render();
|
|
8793
8747
|
}
|
|
8794
8748
|
/**
|
|
8795
8749
|
*
|
|
@@ -8836,7 +8790,7 @@ class En {
|
|
|
8836
8790
|
* Select elements (replaces current selection)
|
|
8837
8791
|
*/
|
|
8838
8792
|
selectElements(e) {
|
|
8839
|
-
e.length > 0 && (this.viralViewerApi.emit(
|
|
8793
|
+
e.length > 0 && (this.viralViewerApi.emit(k.SELECT_ELEMENTS, e), this.viralViewerApi.viralScene.bimWorld.select(e, this.exceptElements), this.notifySelectionOutline(!0), this.viralViewerApi.viralRenderer.render());
|
|
8840
8794
|
}
|
|
8841
8795
|
/**
|
|
8842
8796
|
* Add elements to current selection (multi-select with Shift)
|
|
@@ -8855,13 +8809,13 @@ class En {
|
|
|
8855
8809
|
) || s.push(r);
|
|
8856
8810
|
});
|
|
8857
8811
|
const n = [...s, ...i];
|
|
8858
|
-
n.length > 0 ? (this.viralViewerApi.viralScene.bimWorld.select(n, this.exceptElements), this.
|
|
8812
|
+
n.length > 0 ? (this.viralViewerApi.viralScene.bimWorld.select(n, this.exceptElements), this.notifySelectionOutline(!0), this.viralViewerApi.viralRenderer.render()) : this.unselectElements();
|
|
8859
8813
|
}
|
|
8860
8814
|
/**
|
|
8861
8815
|
* Unselect all elements
|
|
8862
8816
|
*/
|
|
8863
8817
|
unselectElements() {
|
|
8864
|
-
this.viralViewerApi.viralScene.bimWorld.unselect(), this.viralViewerApi.emit(
|
|
8818
|
+
this.viralViewerApi.viralScene.bimWorld.unselect(), this.viralViewerApi.emit(k.UNSELECT_ELEMENTS), this.notifySelectionOutline(!1), this.viralViewerApi.viralRenderer.render();
|
|
8865
8819
|
}
|
|
8866
8820
|
selectAllElements() {
|
|
8867
8821
|
console.time("⏱️ selectAllElements - gathering elements");
|
|
@@ -8901,15 +8855,15 @@ class En {
|
|
|
8901
8855
|
this.viralViewerApi.viralScene.sunLight && (this.viralViewerApi.viralScene.sunLight.castShadow = !1), this.viralViewerApi.viralRenderer.render();
|
|
8902
8856
|
}
|
|
8903
8857
|
_adjustLightForMesh(e, t) {
|
|
8904
|
-
const i = new
|
|
8858
|
+
const i = new j().setFromObject(e), s = i.min, n = i.max, r = s.distanceTo(n), o = i.getCenter(new E()), a = t.shadow.camera;
|
|
8905
8859
|
a.left = -r / 2, a.right = r / 2, a.top = r / 2, a.bottom = -r / 2, a.near = 0.1, a.far = r + t.position.distanceTo(o), t.position.set(o.x + r / 2, o.y + r / 2, o.z + r / 2), t.target.position.copy(o), t.shadow.camera.updateProjectionMatrix(), t.castShadow = !0;
|
|
8906
8860
|
}
|
|
8907
8861
|
_updateDirectLights(e, t) {
|
|
8908
|
-
const i =
|
|
8862
|
+
const i = R.mergeBoundingBoxes(e), s = i.min, n = i.max;
|
|
8909
8863
|
s.distanceTo(n);
|
|
8910
8864
|
const r = i.getCenter(new E()), o = this.sunConfiguration.elevation, a = this.sunConfiguration.azimuth, l = this.sunConfiguration.radius || 0;
|
|
8911
|
-
this.sunConfiguration.castShadow !== void 0 && (t.castShadow = this.sunConfiguration.castShadow), this.sunConfiguration.intensity !== void 0 && (t.intensity = this.sunConfiguration.intensity), t.color = new
|
|
8912
|
-
const c = i.getBoundingSphere(new
|
|
8865
|
+
this.sunConfiguration.castShadow !== void 0 && (t.castShadow = this.sunConfiguration.castShadow), this.sunConfiguration.intensity !== void 0 && (t.intensity = this.sunConfiguration.intensity), t.color = new $(this.sunConfiguration.color), this.sunConfiguration.enabled !== void 0 && (t.visible = this.sunConfiguration.enabled), t.position.copy(r);
|
|
8866
|
+
const c = i.getBoundingSphere(new Ft()), h = new Ht(c.radius + l, o, a);
|
|
8913
8867
|
t.position.setFromSpherical(h), t.position.add(r), t.updateWorldMatrix(!0, !0), t.shadow.updateMatrices(t), this._updateLightShadowCamera(t, i), this.viralViewerApi.viralScene.sunSphere.position.copy(t.position);
|
|
8914
8868
|
}
|
|
8915
8869
|
_updateLightShadowCamera(e, t) {
|
|
@@ -8924,7 +8878,7 @@ class En {
|
|
|
8924
8878
|
new E(s.x, s.y, s.z)
|
|
8925
8879
|
];
|
|
8926
8880
|
n.forEach((o) => o.applyMatrix4(e.shadow.camera.matrixWorldInverse));
|
|
8927
|
-
const r = new
|
|
8881
|
+
const r = new j().setFromPoints(n);
|
|
8928
8882
|
e.shadow.camera.left = r.min.x, e.shadow.camera.right = r.max.x, e.shadow.camera.top = r.min.y, e.shadow.camera.bottom = r.max.y, e.shadow.camera.near = Math.abs(r.max.z), e.shadow.camera.far = Math.abs(r.min.z), e.shadow.camera.updateProjectionMatrix(), this.viralViewerApi.viralRenderer.renderer.shadowMap.needsUpdate = !0;
|
|
8929
8883
|
}
|
|
8930
8884
|
//#endregion
|
|
@@ -9005,7 +8959,7 @@ class En {
|
|
|
9005
8959
|
enableAllWhite() {
|
|
9006
8960
|
this.viralViewerApi.viralMaterialManager.mergeMaterials.forEach(
|
|
9007
8961
|
(e) => {
|
|
9008
|
-
e.vertexColors = !1, e.color = new
|
|
8962
|
+
e.vertexColors = !1, e.color = new $(16448250), e.needsUpdate = !0;
|
|
9009
8963
|
}
|
|
9010
8964
|
), this.viralViewerApi.viralRenderer.render();
|
|
9011
8965
|
}
|
|
@@ -9038,18 +8992,18 @@ class En {
|
|
|
9038
8992
|
if (this._ground)
|
|
9039
8993
|
this._ground.visible = !0, this.viralViewerApi.viralRenderer.render();
|
|
9040
8994
|
else {
|
|
9041
|
-
let t = new
|
|
8995
|
+
let t = new j();
|
|
9042
8996
|
if (e)
|
|
9043
|
-
t = new
|
|
8997
|
+
t = new j().setFromObject(e);
|
|
9044
8998
|
else {
|
|
9045
8999
|
const a = [this.viralViewerApi.viralScene.bimWorld.bounds];
|
|
9046
|
-
t =
|
|
9000
|
+
t = R.mergeBoundingBoxes(a);
|
|
9047
9001
|
}
|
|
9048
9002
|
const i = new E();
|
|
9049
9003
|
t.getSize(i);
|
|
9050
9004
|
const s = t.max.x - t.min.x, n = t.max.z - t.min.z, r = t.min.y, o = new le({
|
|
9051
9005
|
uniforms: {
|
|
9052
|
-
color: { value: new
|
|
9006
|
+
color: { value: new $(0) },
|
|
9053
9007
|
opacity: { value: 0.5 }
|
|
9054
9008
|
},
|
|
9055
9009
|
vertexShader: `
|
|
@@ -9071,7 +9025,7 @@ class En {
|
|
|
9071
9025
|
`,
|
|
9072
9026
|
transparent: !0
|
|
9073
9027
|
});
|
|
9074
|
-
this._ground = new
|
|
9028
|
+
this._ground = new x(
|
|
9075
9029
|
new ae(s * 1.5, n * 1.5),
|
|
9076
9030
|
o
|
|
9077
9031
|
// Semi-transparent shadow material
|
|
@@ -9112,9 +9066,9 @@ class En {
|
|
|
9112
9066
|
for (let i = 0; i < t.length; i++) {
|
|
9113
9067
|
const s = t[i];
|
|
9114
9068
|
if (s.buffer) {
|
|
9115
|
-
const n = new
|
|
9116
|
-
n.setAttribute("position", new
|
|
9117
|
-
const r = new
|
|
9069
|
+
const n = new ne();
|
|
9070
|
+
n.setAttribute("position", new z(s.buffer, 3));
|
|
9071
|
+
const r = new x(
|
|
9118
9072
|
n,
|
|
9119
9073
|
this.viralViewerApi.viralMaterialManager.outlineMaterial
|
|
9120
9074
|
);
|
|
@@ -9128,27 +9082,20 @@ class En {
|
|
|
9128
9082
|
* Uses merged geometry for efficient rendering
|
|
9129
9083
|
*/
|
|
9130
9084
|
updateSelectionOutline() {
|
|
9131
|
-
var t;
|
|
9132
9085
|
if (!this._selectionOutlineEnabled)
|
|
9133
9086
|
return;
|
|
9134
|
-
const e = this.viralViewerApi.viralScene.bimWorld.
|
|
9135
|
-
|
|
9087
|
+
const e = this.viralViewerApi.viralScene.bimWorld.getSelectedElements().length > 0;
|
|
9088
|
+
this.notifySelectionOutline(e);
|
|
9136
9089
|
}
|
|
9137
9090
|
/**
|
|
9138
|
-
*
|
|
9139
|
-
*
|
|
9140
|
-
* Uses Web Worker to avoid blocking the main thread.
|
|
9091
|
+
* Notify the outline pass whether there is an active selection.
|
|
9092
|
+
* The GPU reads selection state directly from vertex colors — no CPU work needed.
|
|
9141
9093
|
*/
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
const e = await this.viralViewerApi.viralScene.bimWorld.getSelectedElementsPositionsAsync();
|
|
9148
|
-
(t = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || t.updateSelectionOutline(
|
|
9149
|
-
e
|
|
9150
|
-
), this.viralViewerApi.viralRenderer.render();
|
|
9151
|
-
}));
|
|
9094
|
+
notifySelectionOutline(e) {
|
|
9095
|
+
var t;
|
|
9096
|
+
this._selectionOutlineEnabled || (e = !1), (t = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || t.setSelectionOutlineActive(
|
|
9097
|
+
e
|
|
9098
|
+
);
|
|
9152
9099
|
}
|
|
9153
9100
|
/**
|
|
9154
9101
|
* Enable selection outline effect
|
|
@@ -9169,8 +9116,13 @@ class En {
|
|
|
9169
9116
|
* @param enabled - true to enable outline on selection, false to disable
|
|
9170
9117
|
*/
|
|
9171
9118
|
setSelectionOutlineMode(e) {
|
|
9172
|
-
|
|
9173
|
-
|
|
9119
|
+
if (this._selectionOutlineEnabled = e, e) {
|
|
9120
|
+
this.enableSelectionOutline();
|
|
9121
|
+
const t = this.viralViewerApi.viralScene.bimWorld.getSelectedElements().length > 0;
|
|
9122
|
+
this.notifySelectionOutline(t);
|
|
9123
|
+
} else
|
|
9124
|
+
this.notifySelectionOutline(!1), this.disableSelectionOutline();
|
|
9125
|
+
this.viralViewerApi.viralRenderer.render();
|
|
9174
9126
|
}
|
|
9175
9127
|
/**
|
|
9176
9128
|
* Get whether selection outline mode is enabled
|
|
@@ -9238,14 +9190,14 @@ class En {
|
|
|
9238
9190
|
const e = this.viralViewerApi.viralScene.bimWorld.bounds, t = 1e4, i = new Float32Array(t * 3);
|
|
9239
9191
|
for (let n = 0; n < t; n++)
|
|
9240
9192
|
i[n * 3] = Math.random() * (e.max.x - e.min.x) + e.min.x, i[n * 3 + 1] = Math.random() * (e.max.y + 100 - e.min.y) + e.min.y, i[n * 3 + 2] = Math.random() * (e.max.z - e.min.z) + e.min.z;
|
|
9241
|
-
this.rainGeometry.setAttribute("position", new
|
|
9242
|
-
const s = new
|
|
9193
|
+
this.rainGeometry.setAttribute("position", new z(i, 3));
|
|
9194
|
+
const s = new wi({
|
|
9243
9195
|
color: 11184810,
|
|
9244
9196
|
size: 0.2,
|
|
9245
9197
|
transparent: !0,
|
|
9246
9198
|
opacity: 0.8
|
|
9247
9199
|
});
|
|
9248
|
-
this.rain = new
|
|
9200
|
+
this.rain = new Et(this.rainGeometry, s), this.viralViewerApi.viralScene.addObject(this.rain), this._isGeneratedRain = !0;
|
|
9249
9201
|
}
|
|
9250
9202
|
this.rain && (this.rain.visible = !0), this.viralViewerApi.viralAnimation.toggleRain(!0);
|
|
9251
9203
|
}
|
|
@@ -9318,7 +9270,7 @@ class En {
|
|
|
9318
9270
|
generateLOD() {
|
|
9319
9271
|
this.viralViewerApi.viralScene.bimWorld.children.forEach((e) => {
|
|
9320
9272
|
if (e.isMesh) {
|
|
9321
|
-
const t = new
|
|
9273
|
+
const t = new yi(), i = R.createLowResMesh(e, 0.5);
|
|
9322
9274
|
t.addLevel(e, 50), t.addLevel(i, 200), this.viralViewerApi.viralScene.bimWorld.add(t), this.viralViewerApi.viralScene.bimWorld.remove(e);
|
|
9323
9275
|
}
|
|
9324
9276
|
});
|
|
@@ -9327,7 +9279,7 @@ class En {
|
|
|
9327
9279
|
* Generate a random but distinct color for each material ID
|
|
9328
9280
|
*/
|
|
9329
9281
|
_generateDistinctColor(e) {
|
|
9330
|
-
const i = e * 0.618033988749895 % 1, s = 0.7 + Math.sin(e * 0.5) * 0.3, n = 0.5 + Math.cos(e * 0.7) * 0.2, r = new
|
|
9282
|
+
const i = e * 0.618033988749895 % 1, s = 0.7 + Math.sin(e * 0.5) * 0.3, n = 0.5 + Math.cos(e * 0.7) * 0.2, r = new $();
|
|
9331
9283
|
return r.setHSL(i, s, n), r;
|
|
9332
9284
|
}
|
|
9333
9285
|
/**
|
|
@@ -9426,7 +9378,7 @@ class En {
|
|
|
9426
9378
|
}
|
|
9427
9379
|
//#endregion
|
|
9428
9380
|
}
|
|
9429
|
-
class
|
|
9381
|
+
class Cn {
|
|
9430
9382
|
constructor(e) {
|
|
9431
9383
|
this.viralViewerApi = e, this.contextMenu = null, this.contextItems = [], this.injectContextMenu();
|
|
9432
9384
|
}
|
|
@@ -9436,14 +9388,14 @@ class Sn {
|
|
|
9436
9388
|
transition: background-color 0.3s ease;
|
|
9437
9389
|
}
|
|
9438
9390
|
.hover-element:hover {
|
|
9439
|
-
background-color: ${
|
|
9391
|
+
background-color: ${y.hover};
|
|
9440
9392
|
|
|
9441
9393
|
}`, t = document.createElement("style");
|
|
9442
9394
|
t.innerHTML = e, document.head.appendChild(t), this.viralViewerApi.targetElement && (this.contextMenu = document.createElement("div"), this.contextMenu.addEventListener("contextmenu", (i) => {
|
|
9443
9395
|
i.preventDefault();
|
|
9444
9396
|
}), this.contextMenu.setAttribute(
|
|
9445
9397
|
"style",
|
|
9446
|
-
`position: absolute;top:0px;left:0px;background-color: ${
|
|
9398
|
+
`position: absolute;top:0px;left:0px;background-color: ${y.background};justify-content: center;display:none; z-index: 100; flex-direction:column; padding: 10px 0; border-radius:10px`
|
|
9447
9399
|
), this.viralViewerApi.targetElement.appendChild(this.contextMenu));
|
|
9448
9400
|
}
|
|
9449
9401
|
showContextMenu(e, t, i) {
|
|
@@ -9459,8 +9411,8 @@ class Sn {
|
|
|
9459
9411
|
for (let i = 0; i < this.contextItems.length; i++) {
|
|
9460
9412
|
if (e.findIndex((l) => l == this.contextItems[i][0]) < 0)
|
|
9461
9413
|
continue;
|
|
9462
|
-
const [s, n, r, o] = this.contextItems[i], a =
|
|
9463
|
-
`<div class="hover-element" style="padding: 5px 10px; cursor: pointer; color:${
|
|
9414
|
+
const [s, n, r, o] = this.contextItems[i], a = ft.createElementFromHTML(
|
|
9415
|
+
`<div class="hover-element" style="padding: 5px 10px; cursor: pointer; color:${y.primary}; display:flex; align-items:center">${r} <p style="margin:0px !important;padding-left:5px">${n}</p></div>`
|
|
9464
9416
|
);
|
|
9465
9417
|
a.addEventListener("click", (l) => {
|
|
9466
9418
|
l.stopPropagation(), o(l);
|
|
@@ -9476,7 +9428,7 @@ class Sn {
|
|
|
9476
9428
|
this.contextItems.push([e, t, i, s]);
|
|
9477
9429
|
}
|
|
9478
9430
|
}
|
|
9479
|
-
class
|
|
9431
|
+
class Sn {
|
|
9480
9432
|
constructor(e) {
|
|
9481
9433
|
this.viralViewerApi = e, this.modal = null, this.modalTitle = null, this.modalBody = null, this.modalBodyLeft = null, this.modalBodyRight = null, this.properties = null, this.rawModal = `<div class="modal" id="myModal">
|
|
9482
9434
|
<div class="modal-content">
|
|
@@ -9488,7 +9440,7 @@ class Cn {
|
|
|
9488
9440
|
flex-shrink: 0;
|
|
9489
9441
|
">
|
|
9490
9442
|
<span class="close" id="closeBtn">×</span>
|
|
9491
|
-
<h2 style="margin: 0px !important;color:${
|
|
9443
|
+
<h2 style="margin: 0px !important;color:${y.secondary};white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" id="modal-title">
|
|
9492
9444
|
</h2>
|
|
9493
9445
|
</div>
|
|
9494
9446
|
<div id="modal-body" style="overflow-y: auto;overflow-x: hidden;flex: 1;min-height: 0;">
|
|
@@ -9509,7 +9461,7 @@ class Cn {
|
|
|
9509
9461
|
}
|
|
9510
9462
|
|
|
9511
9463
|
.modal-content {
|
|
9512
|
-
background-color: ${
|
|
9464
|
+
background-color: ${y.background};
|
|
9513
9465
|
border: 1px solid #ccc;
|
|
9514
9466
|
border-radius: 5px;
|
|
9515
9467
|
padding: 10px;
|
|
@@ -9529,7 +9481,7 @@ class Cn {
|
|
|
9529
9481
|
width: 15px;
|
|
9530
9482
|
height: 15px;
|
|
9531
9483
|
cursor: nwse-resize;
|
|
9532
|
-
background: linear-gradient(135deg, transparent 0%, transparent 50%, ${
|
|
9484
|
+
background: linear-gradient(135deg, transparent 0%, transparent 50%, ${y.secondary} 50%, ${y.secondary} 100%);
|
|
9533
9485
|
opacity: 0.5;
|
|
9534
9486
|
border-bottom-right-radius: 5px;
|
|
9535
9487
|
}
|
|
@@ -9553,7 +9505,7 @@ class Cn {
|
|
|
9553
9505
|
}
|
|
9554
9506
|
|
|
9555
9507
|
.close:hover {
|
|
9556
|
-
color: ${
|
|
9508
|
+
color: ${y.accent};
|
|
9557
9509
|
}
|
|
9558
9510
|
::-webkit-scrollbar {
|
|
9559
9511
|
width: 5px;
|
|
@@ -9586,7 +9538,7 @@ class Cn {
|
|
|
9586
9538
|
inject() {
|
|
9587
9539
|
if (this.viralViewerApi.targetElement) {
|
|
9588
9540
|
const e = document.createElement("style");
|
|
9589
|
-
e.innerHTML = this.rawModalStyle, document.head.appendChild(e), this.modal =
|
|
9541
|
+
e.innerHTML = this.rawModalStyle, document.head.appendChild(e), this.modal = ft.createElementFromHTML(this.rawModal), this.viralViewerApi.targetElement.appendChild(this.modal);
|
|
9590
9542
|
const t = this.viralViewerApi.targetElement.getBoundingClientRect(), i = this.modal.querySelector(".modal-content");
|
|
9591
9543
|
i && (i.style.maxHeight = `${t.height - 20}px`);
|
|
9592
9544
|
const s = document.getElementById("modal-header"), n = document.getElementById("resizeHandle"), r = document.getElementById("column-resizer");
|
|
@@ -9662,27 +9614,27 @@ class Cn {
|
|
|
9662
9614
|
for (let o = 0; o < r.length; o++) {
|
|
9663
9615
|
const a = r[o], l = this.properties[a], c = (l == null ? void 0 : l.name) || a;
|
|
9664
9616
|
let h = ((n = l == null ? void 0 : l.value) == null ? void 0 : n.toString()) || (l == null ? void 0 : l.toString());
|
|
9665
|
-
(l == null ? void 0 : l.value) === "<None>" && (h = "None"), this.modalBodyLeft.innerHTML += `<p style="margin:0px !important;color:${
|
|
9617
|
+
(l == null ? void 0 : l.value) === "<None>" && (h = "None"), this.modalBodyLeft.innerHTML += `<p style="margin:0px !important;color:${y.primary};font-weight:600;font-size:14px;line-height:20px;" title="${c}">${c}</p>`, this.modalBodyRight.innerHTML += `<p style="margin:0px !important;color:${y.primary};font-size:14px;line-height:20px;" title="${h}">${h}</p>`;
|
|
9666
9618
|
}
|
|
9667
9619
|
}
|
|
9668
9620
|
}
|
|
9669
9621
|
}
|
|
9670
|
-
const
|
|
9622
|
+
const Jt = {
|
|
9671
9623
|
QUICK_SAND: {
|
|
9672
9624
|
importLink: "https://fonts.googleapis.com/css2?family=Quicksand:wght@300&display=swap",
|
|
9673
9625
|
fontFamily: "Quicksand, sans-serif"
|
|
9674
9626
|
}
|
|
9675
9627
|
}, An = (g) => {
|
|
9676
9628
|
const e = document.createElement("style");
|
|
9677
|
-
e.innerHTML = `@import url(${
|
|
9629
|
+
e.innerHTML = `@import url(${Jt[g]});`, document.head.appendChild(e);
|
|
9678
9630
|
}, _n = (g, e) => {
|
|
9679
|
-
const t =
|
|
9631
|
+
const t = Jt[e];
|
|
9680
9632
|
g && t && (g.style.fontFamily = t.fontFamily);
|
|
9681
9633
|
};
|
|
9682
|
-
class
|
|
9634
|
+
class Vn {
|
|
9683
9635
|
constructor(e) {
|
|
9684
9636
|
this.viralNavigationCube = e, this._mouseDownTime = null, this.clickThreshold = 250, this._handleClick = async (t) => {
|
|
9685
|
-
var c, h, d, u, p, m, f, v, b, w,
|
|
9637
|
+
var c, h, d, u, p, m, f, v, b, w, C, A, S, _, V, T, M, I, D, B, P;
|
|
9686
9638
|
if (!((c = this.viralNavigationCube.cubeScene) != null && c.activePlane) || (h = this.viralNavigationCube.cubeCamera) != null && h.cameraControlHasMoved)
|
|
9687
9639
|
return console.log("false"), !1;
|
|
9688
9640
|
let i = new E(
|
|
@@ -9691,27 +9643,27 @@ class In {
|
|
|
9691
9643
|
(p = this.viralNavigationCube.cubeScene) == null ? void 0 : p.activePlane.position.z
|
|
9692
9644
|
);
|
|
9693
9645
|
if (((m = this.viralNavigationCube.cubeScene) == null ? void 0 : m.activePlane.children.length) > 0) {
|
|
9694
|
-
let
|
|
9646
|
+
let L = 0, F = 0, U = 0;
|
|
9695
9647
|
for (let W = 0; W < ((f = this.viralNavigationCube.cubeScene) == null ? void 0 : f.activePlane.children.length); W++) {
|
|
9696
|
-
const
|
|
9697
|
-
|
|
9648
|
+
const G = (v = this.viralNavigationCube.cubeScene) == null ? void 0 : v.activePlane.children[W];
|
|
9649
|
+
L += G.position.x, F += G.position.y, U += G.position.z;
|
|
9698
9650
|
}
|
|
9699
9651
|
i = new E(
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
U / ((
|
|
9652
|
+
L / ((b = this.viralNavigationCube.cubeScene) == null ? void 0 : b.activePlane.children.length),
|
|
9653
|
+
F / ((w = this.viralNavigationCube.cubeScene) == null ? void 0 : w.activePlane.children.length),
|
|
9654
|
+
U / ((C = this.viralNavigationCube.cubeScene) == null ? void 0 : C.activePlane.children.length)
|
|
9703
9655
|
);
|
|
9704
9656
|
}
|
|
9705
9657
|
const s = new E();
|
|
9706
9658
|
(A = this.viralNavigationCube.cubeCamera) == null || A.cameraControls.getTarget(s);
|
|
9707
9659
|
const n = i.clone().sub(s).normalize();
|
|
9708
|
-
(
|
|
9709
|
-
(
|
|
9660
|
+
(V = this.viralNavigationCube.cubeCamera) == null || V.cameraControlOldPosition.copy(
|
|
9661
|
+
(_ = (S = this.viralNavigationCube.cubeCamera) == null ? void 0 : S.camera) == null ? void 0 : _.position
|
|
9710
9662
|
);
|
|
9711
9663
|
const r = new E();
|
|
9712
|
-
(
|
|
9664
|
+
(T = this.viralNavigationCube.viralViewerApi.viralCamera) == null || T.cameraControls.getTarget(r);
|
|
9713
9665
|
const o = new E();
|
|
9714
|
-
(
|
|
9666
|
+
(M = this.viralNavigationCube.viralViewerApi.viralCamera) == null || M.cameraControls.getPosition(
|
|
9715
9667
|
o
|
|
9716
9668
|
);
|
|
9717
9669
|
const a = o.clone().sub(r).length(), l = new E(
|
|
@@ -9719,73 +9671,73 @@ class In {
|
|
|
9719
9671
|
Math.round(n.y),
|
|
9720
9672
|
Math.round(n.z)
|
|
9721
9673
|
);
|
|
9722
|
-
l.multiplyScalar(a), (
|
|
9674
|
+
l.multiplyScalar(a), (I = this.viralNavigationCube.viralViewerApi.viralCamera.camera) == null || I.updateMatrixWorld(), (D = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || D.setTarget(0, 0, 0), n.multiplyScalar(2), (B = this.viralNavigationCube.cubeCamera) == null || B.cameraControls.setPosition(
|
|
9723
9675
|
n.x,
|
|
9724
9676
|
n.y,
|
|
9725
9677
|
n.z,
|
|
9726
9678
|
!0
|
|
9727
|
-
), (
|
|
9679
|
+
), (P = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || P.setPosition(
|
|
9728
9680
|
l.x,
|
|
9729
9681
|
l.y,
|
|
9730
9682
|
l.z,
|
|
9731
9683
|
!0
|
|
9732
9684
|
);
|
|
9733
9685
|
}, this._handleMouseUp = async (t) => {
|
|
9734
|
-
var i, s, n, r, o, a, l, c, h, d, u, p, m, f, v, b, w,
|
|
9686
|
+
var i, s, n, r, o, a, l, c, h, d, u, p, m, f, v, b, w, C, A, S, _;
|
|
9735
9687
|
if (console.log(this._mouseDownTime), this._mouseDownTime !== null && performance.now() - this._mouseDownTime < this.clickThreshold) {
|
|
9736
9688
|
if (!((i = this.viralNavigationCube.cubeScene) != null && i.activePlane) || (s = this.viralNavigationCube.cubeCamera) != null && s.cameraControlHasMoved)
|
|
9737
9689
|
return console.log("false"), !1;
|
|
9738
|
-
let
|
|
9690
|
+
let M = new E(
|
|
9739
9691
|
(n = this.viralNavigationCube.cubeScene) == null ? void 0 : n.activePlane.position.x,
|
|
9740
9692
|
(r = this.viralNavigationCube.cubeScene) == null ? void 0 : r.activePlane.position.y,
|
|
9741
9693
|
(o = this.viralNavigationCube.cubeScene) == null ? void 0 : o.activePlane.position.z
|
|
9742
9694
|
);
|
|
9743
9695
|
if (((a = this.viralNavigationCube.cubeScene) == null ? void 0 : a.activePlane.children.length) > 0) {
|
|
9744
|
-
let U = 0, W = 0,
|
|
9696
|
+
let U = 0, W = 0, G = 0;
|
|
9745
9697
|
for (let Y = 0; Y < ((l = this.viralNavigationCube.cubeScene) == null ? void 0 : l.activePlane.children.length); Y++) {
|
|
9746
|
-
const
|
|
9747
|
-
U +=
|
|
9698
|
+
const te = (c = this.viralNavigationCube.cubeScene) == null ? void 0 : c.activePlane.children[Y];
|
|
9699
|
+
U += te.position.x, W += te.position.y, G += te.position.z;
|
|
9748
9700
|
}
|
|
9749
|
-
|
|
9701
|
+
M = new E(
|
|
9750
9702
|
U / ((h = this.viralNavigationCube.cubeScene) == null ? void 0 : h.activePlane.children.length),
|
|
9751
9703
|
W / ((d = this.viralNavigationCube.cubeScene) == null ? void 0 : d.activePlane.children.length),
|
|
9752
|
-
|
|
9704
|
+
G / ((u = this.viralNavigationCube.cubeScene) == null ? void 0 : u.activePlane.children.length)
|
|
9753
9705
|
);
|
|
9754
9706
|
}
|
|
9755
|
-
const
|
|
9707
|
+
const I = new E();
|
|
9756
9708
|
(p = this.viralNavigationCube.cubeCamera) == null || p.cameraControls.getTarget(
|
|
9757
|
-
|
|
9709
|
+
I
|
|
9758
9710
|
);
|
|
9759
|
-
const
|
|
9711
|
+
const D = M.clone().sub(I).normalize();
|
|
9760
9712
|
(v = this.viralNavigationCube.cubeCamera) == null || v.cameraControlOldPosition.copy(
|
|
9761
9713
|
(f = (m = this.viralNavigationCube.cubeCamera) == null ? void 0 : m.camera) == null ? void 0 : f.position
|
|
9762
9714
|
);
|
|
9763
|
-
const
|
|
9715
|
+
const B = new E();
|
|
9764
9716
|
(b = this.viralNavigationCube.viralViewerApi.viralCamera) == null || b.cameraControls.getTarget(
|
|
9765
|
-
|
|
9717
|
+
B
|
|
9766
9718
|
);
|
|
9767
|
-
const
|
|
9719
|
+
const P = new E();
|
|
9768
9720
|
(w = this.viralNavigationCube.viralViewerApi.viralCamera) == null || w.cameraControls.getPosition(
|
|
9769
|
-
|
|
9721
|
+
P
|
|
9770
9722
|
);
|
|
9771
|
-
const
|
|
9772
|
-
Math.round(
|
|
9773
|
-
Math.round(
|
|
9774
|
-
Math.round(
|
|
9723
|
+
const L = P.clone().sub(B).length(), F = new E(
|
|
9724
|
+
Math.round(D.x),
|
|
9725
|
+
Math.round(D.y),
|
|
9726
|
+
Math.round(D.z)
|
|
9775
9727
|
);
|
|
9776
|
-
|
|
9728
|
+
F.multiplyScalar(L), (C = this.viralNavigationCube.viralViewerApi.viralCamera.camera) == null || C.updateMatrixWorld(), (A = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || A.setTarget(
|
|
9777
9729
|
0,
|
|
9778
9730
|
0,
|
|
9779
9731
|
0
|
|
9780
|
-
),
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9732
|
+
), D.multiplyScalar(2), (S = this.viralNavigationCube.cubeCamera) == null || S.cameraControls.setPosition(
|
|
9733
|
+
D.x,
|
|
9734
|
+
D.y,
|
|
9735
|
+
D.z,
|
|
9784
9736
|
!0
|
|
9785
|
-
), (
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9737
|
+
), (_ = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || _.setPosition(
|
|
9738
|
+
F.x,
|
|
9739
|
+
F.y,
|
|
9740
|
+
F.z,
|
|
9789
9741
|
!0
|
|
9790
9742
|
);
|
|
9791
9743
|
}
|
|
@@ -9800,7 +9752,7 @@ class In {
|
|
|
9800
9752
|
}
|
|
9801
9753
|
this.viralNavigationCube.cubeScene.activePlane = null;
|
|
9802
9754
|
}
|
|
9803
|
-
const i = t.offsetX, s = t.offsetY, n = (c = this.viralNavigationCube.cubeRenderer) == null ? void 0 : c.renderer.getSize(new
|
|
9755
|
+
const i = t.offsetX, s = t.offsetY, n = (c = this.viralNavigationCube.cubeRenderer) == null ? void 0 : c.renderer.getSize(new H()), r = new H(i / n.width * 2 - 1, -s / n.height * 2 + 1), o = new It();
|
|
9804
9756
|
o.setFromCamera(r, (h = this.viralNavigationCube.cubeCamera) == null ? void 0 : h.camera);
|
|
9805
9757
|
const a = o.intersectObjects((d = this.viralNavigationCube.cubeScene) == null ? void 0 : d.objects);
|
|
9806
9758
|
if (a.length > 0 && a[0].object != ((u = this.viralNavigationCube.cubeScene) == null ? void 0 : u.cube)) {
|
|
@@ -9827,7 +9779,7 @@ class In {
|
|
|
9827
9779
|
}
|
|
9828
9780
|
//#endregion
|
|
9829
9781
|
}
|
|
9830
|
-
class
|
|
9782
|
+
class In {
|
|
9831
9783
|
constructor(e) {
|
|
9832
9784
|
this.viralNavigationCube = e, this.camera = null, this.cameraControls = null, this.cameraControlOldPosition = new E(), this.cameraControlNewPosition = new E(), this.cameraControlHasMoved = !1, this.setupCamera(), this.setupHandle();
|
|
9833
9785
|
}
|
|
@@ -9865,9 +9817,9 @@ class Vn {
|
|
|
9865
9817
|
window.addEventListener("mousedown", e, !1), window.addEventListener("mousemove", t, !1), window.addEventListener("touchstart", e, !1), window.addEventListener("touchmove", t, !0);
|
|
9866
9818
|
}
|
|
9867
9819
|
}
|
|
9868
|
-
class
|
|
9820
|
+
class Tn {
|
|
9869
9821
|
constructor(e) {
|
|
9870
|
-
this.viralNavigationCube = e, this.renderer = new
|
|
9822
|
+
this.viralNavigationCube = e, this.renderer = new Ut({
|
|
9871
9823
|
alpha: !0,
|
|
9872
9824
|
antialias: !0,
|
|
9873
9825
|
logarithmicDepthBuffer: !0
|
|
@@ -9900,191 +9852,191 @@ class Pn {
|
|
|
9900
9852
|
// }
|
|
9901
9853
|
// }
|
|
9902
9854
|
}
|
|
9903
|
-
class
|
|
9855
|
+
class Pn {
|
|
9904
9856
|
constructor(e, t = 1) {
|
|
9905
|
-
this.viralNavigationCube = e, this.scene = new
|
|
9857
|
+
this.viralNavigationCube = e, this.scene = new Tt(), this.objects = [], this.cube = null, this.activePlane = null, this.cubeScale = 1, this.cubeScale = Math.round(Math.max(0.1, Math.min(1, t)) * 10) / 10, this.addCube(), this.addPlanes();
|
|
9906
9858
|
}
|
|
9907
9859
|
addObject(e) {
|
|
9908
9860
|
this.scene.add(e), this.objects.push(e);
|
|
9909
9861
|
}
|
|
9910
9862
|
addCube() {
|
|
9911
|
-
const e = [], t = ["RIGHT", "LEFT", "TOP", "BOTTOM", "FRONT", "BACK"], i = new
|
|
9863
|
+
const e = [], t = ["RIGHT", "LEFT", "TOP", "BOTTOM", "FRONT", "BACK"], i = new xi(), s = document.createElement("canvas"), n = s.getContext("2d"), r = 64;
|
|
9912
9864
|
if (s.width = r, s.height = r, n) {
|
|
9913
9865
|
n.font = 'bolder 12px "Open sans", Arial', n.textBaseline = "middle", n.textAlign = "center";
|
|
9914
|
-
const o = `${
|
|
9866
|
+
const o = `${y.background}`;
|
|
9915
9867
|
for (let l = 0; l < 6; l++)
|
|
9916
|
-
t[l] == "TOP" || t[l] == "BOTTOM", n.fillStyle = o, n.fillRect(0, 0, r, r), n.strokeStyle = `${
|
|
9868
|
+
t[l] == "TOP" || t[l] == "BOTTOM", n.fillStyle = o, n.fillRect(0, 0, r, r), n.strokeStyle = `${y.primary}`, n.setLineDash([8, 8]), n.lineWidth = 4, n.strokeRect(0, 0, r, r), n.fillStyle = `${y.primary}`, n.fillText(t[l], r / 2, r / 2), e[l] = new q({
|
|
9917
9869
|
map: i.load(s.toDataURL())
|
|
9918
9870
|
});
|
|
9919
9871
|
const a = this.cubeScale;
|
|
9920
|
-
this.cube = new
|
|
9872
|
+
this.cube = new x(new Pt(a, a, a), e), this.addObject(this.cube);
|
|
9921
9873
|
}
|
|
9922
9874
|
}
|
|
9923
9875
|
addPlanes() {
|
|
9924
|
-
const e = this.cubeScale, t = new
|
|
9925
|
-
side:
|
|
9876
|
+
const e = this.cubeScale, t = new q({
|
|
9877
|
+
side: J,
|
|
9926
9878
|
color: 6659921,
|
|
9927
9879
|
transparent: !0,
|
|
9928
9880
|
opacity: 0,
|
|
9929
9881
|
depthTest: !1
|
|
9930
|
-
}), i = 0.7 * e, s = 0.7 * e, n = 0.15 * e, r = new ae(i, i), o = new ae(n, s), a = new ae(n, n), l = 0.51 * e, c = new
|
|
9882
|
+
}), i = 0.7 * e, s = 0.7 * e, n = 0.15 * e, r = new ae(i, i), o = new ae(n, s), a = new ae(n, n), l = 0.51 * e, c = new x(r, t.clone());
|
|
9931
9883
|
c.position.z = l, c.name = "FRONT";
|
|
9932
|
-
const h = new
|
|
9884
|
+
const h = new x(o, t.clone());
|
|
9933
9885
|
h.position.z = l, h.position.x = i / 2 + n / 2;
|
|
9934
|
-
const d = new
|
|
9886
|
+
const d = new x(o, t.clone());
|
|
9935
9887
|
d.position.z = l, d.position.x = -(i / 2 + n / 2);
|
|
9936
|
-
const u = new
|
|
9888
|
+
const u = new x(o, t.clone());
|
|
9937
9889
|
u.position.z = l, u.rotation.z = Math.PI / 2, u.position.y = i / 2 + n / 2;
|
|
9938
|
-
const p = new
|
|
9890
|
+
const p = new x(o, t.clone());
|
|
9939
9891
|
p.position.z = l, p.rotation.z = Math.PI / 2, p.position.y = -(i / 2 + n / 2);
|
|
9940
|
-
const m = new
|
|
9892
|
+
const m = new x(a, t.clone());
|
|
9941
9893
|
m.position.z = l, m.position.x = -(i / 2 + n / 2), m.position.y = i / 2 + n / 2;
|
|
9942
|
-
const f = new
|
|
9894
|
+
const f = new x(a, t.clone());
|
|
9943
9895
|
f.position.z = l, f.position.x = i / 2 + n / 2, f.position.y = i / 2 + n / 2;
|
|
9944
|
-
const v = new
|
|
9896
|
+
const v = new x(a, t.clone());
|
|
9945
9897
|
v.position.z = l, v.position.x = i / 2 + n / 2, v.position.y = -(i / 2 + n / 2);
|
|
9946
|
-
const b = new
|
|
9898
|
+
const b = new x(a, t.clone());
|
|
9947
9899
|
b.position.z = l, b.position.x = -(i / 2 + n / 2), b.position.y = -(i / 2 + n / 2);
|
|
9948
|
-
const w = new
|
|
9900
|
+
const w = new x(r, t.clone());
|
|
9949
9901
|
w.position.z = -l, w.name = "BACK";
|
|
9950
|
-
const
|
|
9951
|
-
|
|
9952
|
-
const A = new
|
|
9902
|
+
const C = new x(o, t.clone());
|
|
9903
|
+
C.position.z = -l, C.position.x = i / 2 + n / 2;
|
|
9904
|
+
const A = new x(o, t.clone());
|
|
9953
9905
|
A.position.z = -l, A.position.x = -(i / 2 + n / 2);
|
|
9954
|
-
const
|
|
9955
|
-
|
|
9956
|
-
const
|
|
9957
|
-
|
|
9958
|
-
const
|
|
9959
|
-
|
|
9960
|
-
const
|
|
9961
|
-
|
|
9962
|
-
const
|
|
9963
|
-
|
|
9964
|
-
const
|
|
9965
|
-
|
|
9966
|
-
const
|
|
9967
|
-
|
|
9968
|
-
const
|
|
9969
|
-
|
|
9970
|
-
const
|
|
9971
|
-
|
|
9972
|
-
const
|
|
9973
|
-
|
|
9974
|
-
const
|
|
9975
|
-
|
|
9976
|
-
const U = new
|
|
9906
|
+
const S = new x(o, t.clone());
|
|
9907
|
+
S.position.z = -l, S.rotation.z = Math.PI / 2, S.position.y = i / 2 + n / 2;
|
|
9908
|
+
const _ = new x(o, t.clone());
|
|
9909
|
+
_.position.z = -l, _.rotation.z = Math.PI / 2, _.position.y = -(i / 2 + n / 2);
|
|
9910
|
+
const V = new x(a, t.clone());
|
|
9911
|
+
V.position.z = -l, V.position.x = i / 2 + n / 2, V.position.y = i / 2 + n / 2;
|
|
9912
|
+
const T = new x(a, t.clone());
|
|
9913
|
+
T.position.z = -l, T.position.x = -(i / 2 + n / 2), T.position.y = i / 2 + n / 2;
|
|
9914
|
+
const M = new x(a, t.clone());
|
|
9915
|
+
M.position.z = -l, M.position.x = -(i / 2 + n / 2), M.position.y = -(i / 2 + n / 2);
|
|
9916
|
+
const I = new x(a, t.clone());
|
|
9917
|
+
I.position.z = -l, I.position.x = i / 2 + n / 2, I.position.y = -(i / 2 + n / 2);
|
|
9918
|
+
const D = new x(r, t.clone());
|
|
9919
|
+
D.rotation.y = Math.PI / 2, D.position.x = l, D.name = "RIGHT";
|
|
9920
|
+
const B = new x(o, t.clone());
|
|
9921
|
+
B.rotation.y = Math.PI / 2, B.position.x = l, B.position.z = i / 2 + n / 2;
|
|
9922
|
+
const P = new x(o, t.clone());
|
|
9923
|
+
P.rotation.y = Math.PI / 2, P.position.x = l, P.position.z = -(i / 2 + n / 2);
|
|
9924
|
+
const L = new x(o, t.clone());
|
|
9925
|
+
L.rotation.y = Math.PI / 2, L.position.x = l, L.rotation.z = Math.PI / 2, L.position.y = i / 2 + n / 2;
|
|
9926
|
+
const F = new x(o, t.clone());
|
|
9927
|
+
F.rotation.y = Math.PI / 2, F.position.x = l, F.rotation.z = Math.PI / 2, F.position.y = -(i / 2 + n / 2);
|
|
9928
|
+
const U = new x(a, t.clone());
|
|
9977
9929
|
U.rotation.y = Math.PI / 2, U.position.x = l, U.position.z = i / 2 + n / 2, U.position.y = i / 2 + n / 2;
|
|
9978
|
-
const W = new
|
|
9930
|
+
const W = new x(a, t.clone());
|
|
9979
9931
|
W.rotation.y = Math.PI / 2, W.position.x = l, W.position.z = -(i / 2 + n / 2), W.position.y = i / 2 + n / 2;
|
|
9980
|
-
const
|
|
9981
|
-
|
|
9982
|
-
const Y = new
|
|
9932
|
+
const G = new x(a, t.clone());
|
|
9933
|
+
G.rotation.y = Math.PI / 2, G.position.x = l, G.position.z = -(i / 2 + n / 2), G.position.y = -(i / 2 + n / 2);
|
|
9934
|
+
const Y = new x(a, t.clone());
|
|
9983
9935
|
Y.rotation.y = Math.PI / 2, Y.position.x = l, Y.position.z = i / 2 + n / 2, Y.position.y = -(i / 2 + n / 2);
|
|
9984
|
-
const
|
|
9985
|
-
|
|
9986
|
-
const Ue = new
|
|
9936
|
+
const te = new x(r, t.clone());
|
|
9937
|
+
te.rotation.y = Math.PI / 2, te.position.x = -l, te.name = "LEFT";
|
|
9938
|
+
const Ue = new x(o, t.clone());
|
|
9987
9939
|
Ue.rotation.y = Math.PI / 2, Ue.position.x = -l, Ue.position.z = i / 2 + n / 2;
|
|
9988
|
-
const qe = new
|
|
9940
|
+
const qe = new x(o, t.clone());
|
|
9989
9941
|
qe.rotation.y = Math.PI / 2, qe.position.x = -l, qe.position.z = -(i / 2 + n / 2);
|
|
9990
|
-
const ge = new
|
|
9942
|
+
const ge = new x(o, t.clone());
|
|
9991
9943
|
ge.rotation.y = Math.PI / 2, ge.position.x = -l, ge.rotation.z = Math.PI / 2, ge.position.y = i / 2 + n / 2;
|
|
9992
|
-
const fe = new
|
|
9944
|
+
const fe = new x(o, t.clone());
|
|
9993
9945
|
fe.rotation.y = Math.PI / 2, fe.position.x = -l, fe.rotation.z = Math.PI / 2, fe.position.y = -(i / 2 + n / 2);
|
|
9994
|
-
const ve = new
|
|
9946
|
+
const ve = new x(a, t.clone());
|
|
9995
9947
|
ve.rotation.y = Math.PI / 2, ve.position.x = -l, ve.position.z = -(i / 2 + n / 2), ve.position.y = i / 2 + n / 2;
|
|
9996
|
-
const be = new
|
|
9948
|
+
const be = new x(a, t.clone());
|
|
9997
9949
|
be.rotation.y = Math.PI / 2, be.position.x = -l, be.position.z = i / 2 + n / 2, be.position.y = i / 2 + n / 2;
|
|
9998
|
-
const we = new
|
|
9950
|
+
const we = new x(a, t.clone());
|
|
9999
9951
|
we.rotation.y = Math.PI / 2, we.position.x = -l, we.position.z = i / 2 + n / 2, we.position.y = -(i / 2 + n / 2);
|
|
10000
|
-
const ye = new
|
|
9952
|
+
const ye = new x(a, t.clone());
|
|
10001
9953
|
ye.rotation.y = Math.PI / 2, ye.position.x = -l, ye.position.z = -(i / 2 + n / 2), ye.position.y = -(i / 2 + n / 2);
|
|
10002
|
-
const Qe = new
|
|
9954
|
+
const Qe = new x(r, t.clone());
|
|
10003
9955
|
Qe.rotation.x = Math.PI / 2, Qe.position.y = l, Qe.name = "TOP";
|
|
10004
|
-
const Ze = new
|
|
9956
|
+
const Ze = new x(o, t.clone());
|
|
10005
9957
|
Ze.rotation.x = Math.PI / 2, Ze.position.y = l, Ze.position.x = i / 2 + n / 2;
|
|
10006
|
-
const Ye = new
|
|
9958
|
+
const Ye = new x(o, t.clone());
|
|
10007
9959
|
Ye.rotation.x = Math.PI / 2, Ye.position.y = l, Ye.position.x = -(i / 2 + n / 2);
|
|
10008
|
-
const xe = new
|
|
9960
|
+
const xe = new x(o, t.clone());
|
|
10009
9961
|
xe.rotation.x = Math.PI / 2, xe.position.y = l, xe.rotation.z = Math.PI / 2, xe.position.z = i / 2 + n / 2;
|
|
10010
|
-
const Me = new
|
|
9962
|
+
const Me = new x(o, t.clone());
|
|
10011
9963
|
Me.rotation.x = Math.PI / 2, Me.position.y = l, Me.rotation.z = Math.PI / 2, Me.position.z = -(i / 2 + n / 2);
|
|
10012
|
-
const Ee = new
|
|
9964
|
+
const Ee = new x(a, t.clone());
|
|
10013
9965
|
Ee.rotation.x = Math.PI / 2, Ee.position.y = l, Ee.position.z = -(i / 2 + n / 2), Ee.position.x = -(i / 2 + n / 2);
|
|
10014
|
-
const
|
|
10015
|
-
|
|
10016
|
-
const
|
|
10017
|
-
|
|
10018
|
-
const Ae = new
|
|
9966
|
+
const Ce = new x(a, t.clone());
|
|
9967
|
+
Ce.rotation.x = Math.PI / 2, Ce.position.y = l, Ce.position.z = -(i / 2 + n / 2), Ce.position.x = i / 2 + n / 2;
|
|
9968
|
+
const Se = new x(a, t.clone());
|
|
9969
|
+
Se.rotation.x = Math.PI / 2, Se.position.y = l, Se.position.z = i / 2 + n / 2, Se.position.x = i / 2 + n / 2;
|
|
9970
|
+
const Ae = new x(a, t.clone());
|
|
10019
9971
|
Ae.rotation.x = Math.PI / 2, Ae.position.y = l, Ae.position.z = i / 2 + n / 2, Ae.position.x = -(i / 2 + n / 2);
|
|
10020
|
-
const Xe = new
|
|
9972
|
+
const Xe = new x(r, t.clone());
|
|
10021
9973
|
Xe.rotation.x = Math.PI / 2, Xe.position.y = -l, Xe.name = "BOTTOM";
|
|
10022
|
-
const Ke = new
|
|
9974
|
+
const Ke = new x(o, t.clone());
|
|
10023
9975
|
Ke.rotation.x = Math.PI / 2, Ke.position.y = -l, Ke.position.x = i / 2 + n / 2;
|
|
10024
|
-
const Je = new
|
|
9976
|
+
const Je = new x(o, t.clone());
|
|
10025
9977
|
Je.rotation.x = Math.PI / 2, Je.position.y = -l, Je.position.x = -(i / 2 + n / 2);
|
|
10026
|
-
const _e = new
|
|
9978
|
+
const _e = new x(o, t.clone());
|
|
10027
9979
|
_e.rotation.x = Math.PI / 2, _e.position.y = -l, _e.rotation.z = Math.PI / 2, _e.position.z = i / 2 + n / 2;
|
|
10028
|
-
const
|
|
10029
|
-
|
|
10030
|
-
const
|
|
10031
|
-
|
|
10032
|
-
const
|
|
10033
|
-
|
|
10034
|
-
const
|
|
10035
|
-
|
|
10036
|
-
const Oe = new
|
|
9980
|
+
const Ve = new x(o, t.clone());
|
|
9981
|
+
Ve.rotation.x = Math.PI / 2, Ve.position.y = -l, Ve.rotation.z = Math.PI / 2, Ve.position.z = -(i / 2 + n / 2);
|
|
9982
|
+
const Ie = new x(a, t.clone());
|
|
9983
|
+
Ie.rotation.x = Math.PI / 2, Ie.position.y = -l, Ie.position.z = i / 2 + n / 2, Ie.position.x = -(i / 2 + n / 2);
|
|
9984
|
+
const Te = new x(a, t.clone());
|
|
9985
|
+
Te.rotation.x = Math.PI / 2, Te.position.y = -l, Te.position.z = i / 2 + n / 2, Te.position.x = i / 2 + n / 2;
|
|
9986
|
+
const Pe = new x(a, t.clone());
|
|
9987
|
+
Pe.rotation.x = Math.PI / 2, Pe.position.y = -l, Pe.position.z = -(i / 2 + n / 2), Pe.position.x = i / 2 + n / 2;
|
|
9988
|
+
const Oe = new x(a, t.clone());
|
|
10037
9989
|
Oe.rotation.x = Math.PI / 2, Oe.position.y = -l, Oe.position.z = -(i / 2 + n / 2), Oe.position.x = -(i / 2 + n / 2);
|
|
10038
|
-
const
|
|
9990
|
+
const ei = new q({
|
|
10039
9991
|
color: 11184810
|
|
10040
|
-
}),
|
|
10041
|
-
|
|
10042
|
-
const et = new
|
|
10043
|
-
et.name = "1131", et.add(h), et.add(
|
|
10044
|
-
const tt = new
|
|
9992
|
+
}), ti = new ae(1 * e, 1 * e), vt = new x(ti, ei);
|
|
9993
|
+
vt.rotation.x = -Math.PI / 2, vt.position.y = -0.6 * e, this.addObject(c), this.addObject(w), this.addObject(D), this.addObject(te), this.addObject(Qe), this.addObject(Xe), this.addObject(vt);
|
|
9994
|
+
const et = new x();
|
|
9995
|
+
et.name = "1131", et.add(h), et.add(B), this.addObject(et);
|
|
9996
|
+
const tt = new x();
|
|
10045
9997
|
tt.name = "1241", tt.add(d), tt.add(Ue), this.addObject(tt);
|
|
10046
|
-
const it = new
|
|
9998
|
+
const it = new x();
|
|
10047
9999
|
it.name = "1353", it.add(u), it.add(xe), this.addObject(it);
|
|
10048
|
-
const st = new
|
|
10000
|
+
const st = new x();
|
|
10049
10001
|
st.name = "1463", st.add(p), st.add(_e), this.addObject(st);
|
|
10050
|
-
const nt = new
|
|
10051
|
-
nt.name = "2464", nt.add(
|
|
10052
|
-
const rt = new
|
|
10053
|
-
rt.name = "3221", rt.add(
|
|
10054
|
-
const at = new
|
|
10055
|
-
at.name = "3351", at.add(
|
|
10056
|
-
const ot = new
|
|
10057
|
-
ot.name = "3461", ot.add(
|
|
10058
|
-
const lt = new
|
|
10002
|
+
const nt = new x();
|
|
10003
|
+
nt.name = "2464", nt.add(_), nt.add(Ve), this.addObject(nt);
|
|
10004
|
+
const rt = new x();
|
|
10005
|
+
rt.name = "3221", rt.add(P), rt.add(C), this.addObject(rt);
|
|
10006
|
+
const at = new x();
|
|
10007
|
+
at.name = "3351", at.add(L), at.add(Ze), this.addObject(at);
|
|
10008
|
+
const ot = new x();
|
|
10009
|
+
ot.name = "3461", ot.add(F), ot.add(Ke), this.addObject(ot);
|
|
10010
|
+
const lt = new x();
|
|
10059
10011
|
lt.name = "4222", lt.add(qe), lt.add(A), this.addObject(lt);
|
|
10060
|
-
const ct = new
|
|
10012
|
+
const ct = new x();
|
|
10061
10013
|
ct.name = "4352", ct.add(ge), ct.add(Ye), this.addObject(ct);
|
|
10062
|
-
const ht = new
|
|
10014
|
+
const ht = new x();
|
|
10063
10015
|
ht.name = "3462", ht.add(fe), ht.add(Je), this.addObject(ht);
|
|
10064
|
-
const dt = new
|
|
10065
|
-
dt.name = "5423", dt.add(Me), dt.add(
|
|
10066
|
-
const De = new
|
|
10016
|
+
const dt = new x();
|
|
10017
|
+
dt.name = "5423", dt.add(Me), dt.add(S), this.addObject(dt);
|
|
10018
|
+
const De = new x();
|
|
10067
10019
|
De.name = "corner1", De.add(m), De.add(Ae), De.add(be), this.addObject(De);
|
|
10068
|
-
const Re = new
|
|
10069
|
-
Re.name = "corner2", Re.add(f), Re.add(U), Re.add(
|
|
10070
|
-
const Le = new
|
|
10071
|
-
Le.name = "corner3", Le.add(v), Le.add(Y), Le.add(
|
|
10072
|
-
const ke = new
|
|
10073
|
-
ke.name = "corner4", ke.add(b), ke.add(we), ke.add(
|
|
10074
|
-
const Be = new
|
|
10075
|
-
Be.name = "corner5", Be.add(
|
|
10076
|
-
const ze = new
|
|
10077
|
-
ze.name = "corner6", ze.add(
|
|
10078
|
-
const Ne = new
|
|
10079
|
-
Ne.name = "corner7", Ne.add(
|
|
10080
|
-
const $e = new
|
|
10081
|
-
$e.name = "corner8", $e.add(
|
|
10020
|
+
const Re = new x();
|
|
10021
|
+
Re.name = "corner2", Re.add(f), Re.add(U), Re.add(Se), this.addObject(Re);
|
|
10022
|
+
const Le = new x();
|
|
10023
|
+
Le.name = "corner3", Le.add(v), Le.add(Y), Le.add(Te), this.addObject(Le);
|
|
10024
|
+
const ke = new x();
|
|
10025
|
+
ke.name = "corner4", ke.add(b), ke.add(we), ke.add(Ie), this.addObject(ke);
|
|
10026
|
+
const Be = new x();
|
|
10027
|
+
Be.name = "corner5", Be.add(V), Be.add(W), Be.add(Ce), this.addObject(Be);
|
|
10028
|
+
const ze = new x();
|
|
10029
|
+
ze.name = "corner6", ze.add(T), ze.add(Ee), ze.add(ve), this.addObject(ze);
|
|
10030
|
+
const Ne = new x();
|
|
10031
|
+
Ne.name = "corner7", Ne.add(M), Ne.add(ye), Ne.add(Oe), this.addObject(Ne);
|
|
10032
|
+
const $e = new x();
|
|
10033
|
+
$e.name = "corner8", $e.add(I), $e.add(G), $e.add(Pe), this.addObject($e);
|
|
10082
10034
|
}
|
|
10083
10035
|
}
|
|
10084
10036
|
class On {
|
|
10085
10037
|
//* view cube from third party (new approach)
|
|
10086
10038
|
constructor(e, t = 1) {
|
|
10087
|
-
this.viralViewerApi = e, this.targetElement = null, this.cubeScene = null, this.cubeRenderer = null, this.cubeCamera = null, this.cubeMouse = null, this.cubeScale = 1, this.cubeScale = Math.round(Math.max(0.1, Math.min(1, t)) * 10) / 10, this.injectCubeWrapperElement(), this.targetElement = document.getElementById("orientCubeWrapper"), this.targetElement && (this.cubeScene = new
|
|
10039
|
+
this.viralViewerApi = e, this.targetElement = null, this.cubeScene = null, this.cubeRenderer = null, this.cubeCamera = null, this.cubeMouse = null, this.cubeScale = 1, this.cubeScale = Math.round(Math.max(0.1, Math.min(1, t)) * 10) / 10, this.injectCubeWrapperElement(), this.targetElement = document.getElementById("orientCubeWrapper"), this.targetElement && (this.cubeScene = new Pn(this, this.cubeScale), this.cubeRenderer = new Tn(this), this.cubeCamera = new In(this), this.cubeMouse = new Vn(this)), this.viralViewerApi.emit(k.LOADED_CUBE);
|
|
10088
10040
|
}
|
|
10089
10041
|
injectCubeWrapperElement() {
|
|
10090
10042
|
if (this.viralViewerApi.targetElement) {
|
|
@@ -10112,7 +10064,7 @@ class Dn {
|
|
|
10112
10064
|
injectContextMenu() {
|
|
10113
10065
|
this.viralViewerApi.targetElement && (this.contextMenu = document.createElement("div"), this.contextMenu.setAttribute("id", "viral-pivot-point"), this.contextMenu.setAttribute(
|
|
10114
10066
|
"style",
|
|
10115
|
-
`position: absolute;top:0px;left:0px;background-color: ${
|
|
10067
|
+
`position: absolute;top:0px;left:0px;background-color: ${y.secondary}; border-radius:5px; height: 10px; width:10px; opacity:80%; transform: translate(-50%, -50%);display: none`
|
|
10116
10068
|
), this.viralViewerApi.targetElement.appendChild(this.contextMenu));
|
|
10117
10069
|
}
|
|
10118
10070
|
show(e, t) {
|
|
@@ -10185,14 +10137,14 @@ class Rn {
|
|
|
10185
10137
|
if (t.innerHTML = e, document.head.appendChild(t), this.viralViewerApi.targetElement) {
|
|
10186
10138
|
this.spinner = document.createElement("div"), this.spinner.setAttribute(
|
|
10187
10139
|
"style",
|
|
10188
|
-
`position: absolute;top:0px;left:0px;right:0px;bottom:0px;background-color: ${
|
|
10140
|
+
`position: absolute;top:0px;left:0px;right:0px;bottom:0px;background-color: ${y.background};justify-content: center;align-items: center;display:none; z-index: 100`
|
|
10189
10141
|
);
|
|
10190
10142
|
const i = document.createElement("div"), s = document.createElement("div");
|
|
10191
10143
|
s.setAttribute(
|
|
10192
10144
|
"style",
|
|
10193
|
-
`width: 200px; height: 200px; border-radius: 50%; border: 2px solid #ccc; border-top: 2px solid ${
|
|
10145
|
+
`width: 200px; height: 200px; border-radius: 50%; border: 2px solid #ccc; border-top: 2px solid ${y.primary}; animation: spin 1.5s linear infinite;`
|
|
10194
10146
|
);
|
|
10195
|
-
const n =
|
|
10147
|
+
const n = ft.createElementFromHTML(this.logo);
|
|
10196
10148
|
n.setAttribute(
|
|
10197
10149
|
"style",
|
|
10198
10150
|
"height:150px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)"
|
|
@@ -10262,7 +10214,7 @@ class zn {
|
|
|
10262
10214
|
}
|
|
10263
10215
|
class Nn {
|
|
10264
10216
|
constructor(e) {
|
|
10265
|
-
this.viralTools = e, this.viralToolMeasureScene = new
|
|
10217
|
+
this.viralTools = e, this.viralToolMeasureScene = new Tt(), this.isActivated = !1, this.measures = [], this.point1 = null, this.point2 = null, this.tempPoint2 = null, this.defaultSprite = this.makeSprite(), this.measureObject = new x(), this.tempMeasure = new x(), this.tempSprite1 = null, this.tempLine = null, this.tempSprite2 = null;
|
|
10266
10218
|
}
|
|
10267
10219
|
activate(e) {
|
|
10268
10220
|
this.isActivated = e.activate, this.isActivated ? (this.viralToolMeasureScene.getObjectByName("measure-object") || (this.measureObject.name = "measure-object", this.viralToolMeasureScene.add(this.measureObject)), this.viralToolMeasureScene.getObjectByName("temp-measure") || (this.tempMeasure.name = "temp-measure", this.viralToolMeasureScene.add(this.tempMeasure))) : this.dispose();
|
|
@@ -10299,7 +10251,7 @@ class Nn {
|
|
|
10299
10251
|
const s = this.defaultSprite.clone();
|
|
10300
10252
|
s.position.copy(this.point1), this.tempMeasure.add(s);
|
|
10301
10253
|
} else if (this.point1 && !this.point2) {
|
|
10302
|
-
this.point2 = i,
|
|
10254
|
+
this.point2 = i, R.clearChildren(this.tempMeasure);
|
|
10303
10255
|
const s = this.defaultSprite.clone();
|
|
10304
10256
|
s.position.copy(this.point1), this.measureObject.add(s);
|
|
10305
10257
|
const n = this.defaultSprite.clone();
|
|
@@ -10324,7 +10276,7 @@ class Nn {
|
|
|
10324
10276
|
const n = document.createElement("canvas"), r = n.getContext("2d"), o = 32;
|
|
10325
10277
|
n.width = o, n.height = o;
|
|
10326
10278
|
const a = o * 0.8 / 2;
|
|
10327
|
-
return r && (r.shadowBlur = 5, r.shadowColor = "#555", r.fillStyle = "#fff", r.beginPath(), r.arc(o / 2, o / 2, a, 0, Math.PI * 2), r.closePath(), r.fill(), r.shadowBlur = 0, r.fillStyle =
|
|
10279
|
+
return r && (r.shadowBlur = 5, r.shadowColor = "#555", r.fillStyle = "#fff", r.beginPath(), r.arc(o / 2, o / 2, a, 0, Math.PI * 2), r.closePath(), r.fill(), r.shadowBlur = 0, r.fillStyle = y.primary, r.beginPath(), r.arc(o / 2, o / 2, a * 0.5, 0, Math.PI * 2), r.closePath(), r.fill()), n;
|
|
10328
10280
|
}
|
|
10329
10281
|
const t = new Rt(e()), i = new Lt({
|
|
10330
10282
|
map: t,
|
|
@@ -10333,10 +10285,10 @@ class Nn {
|
|
|
10333
10285
|
return s.scale.setScalar(0.08), s;
|
|
10334
10286
|
}
|
|
10335
10287
|
makeLine(e, t) {
|
|
10336
|
-
const i = new
|
|
10337
|
-
color:
|
|
10288
|
+
const i = new Mi({
|
|
10289
|
+
color: R.hexToThreejsColor(y.primary),
|
|
10338
10290
|
linewidth: 20
|
|
10339
|
-
}), s = [e, t], n = new
|
|
10291
|
+
}), s = [e, t], n = new ne().setFromPoints(s);
|
|
10340
10292
|
return new mt(n, i);
|
|
10341
10293
|
}
|
|
10342
10294
|
makeDistanceSprite(e, t) {
|
|
@@ -10347,7 +10299,7 @@ class Nn {
|
|
|
10347
10299
|
if (n) {
|
|
10348
10300
|
n.font = "bolder " + r + 'px "Open Sans", Arial';
|
|
10349
10301
|
const h = "~ " + Math.round(e.distanceTo(t)), d = n.measureText(h), u = 20, p = 10, m = 10;
|
|
10350
|
-
s.width = d.width + u * 2 + m * 2, s.height = r + p * 2 + m * 2, n.shadowBlur = 10, n.shadowColor = "#555", n.fillStyle =
|
|
10302
|
+
s.width = d.width + u * 2 + m * 2, s.height = r + p * 2 + m * 2, n.shadowBlur = 10, n.shadowColor = "#555", n.fillStyle = y.primary, i(
|
|
10351
10303
|
n,
|
|
10352
10304
|
m,
|
|
10353
10305
|
m,
|
|
@@ -10363,14 +10315,14 @@ class Nn {
|
|
|
10363
10315
|
})
|
|
10364
10316
|
);
|
|
10365
10317
|
a.scale.set(2e-3 * s.width * 0.5, 25e-4 * s.height * 0.5, 1);
|
|
10366
|
-
const l =
|
|
10318
|
+
const l = R.middlePoint(e, t);
|
|
10367
10319
|
return a.position.copy(l), a;
|
|
10368
10320
|
}
|
|
10369
10321
|
dispose() {
|
|
10370
|
-
this.resetPickedPoints(),
|
|
10322
|
+
this.resetPickedPoints(), R.clearChildren(this.measureObject), R.clearChildren(this.tempMeasure), this.viralTools.viralViewerApi.viralRenderer.render();
|
|
10371
10323
|
}
|
|
10372
10324
|
onKeyPress(e) {
|
|
10373
|
-
e.code == "Escape" && (
|
|
10325
|
+
e.code == "Escape" && (R.clearChildren(this.tempMeasure), this.point1 = null, this.point2 = null, this.tempPoint2 = null, this.viralTools.viralViewerApi.viralRenderer.render());
|
|
10374
10326
|
}
|
|
10375
10327
|
}
|
|
10376
10328
|
class $n {
|
|
@@ -10385,7 +10337,7 @@ class $n {
|
|
|
10385
10337
|
if (e.activate) {
|
|
10386
10338
|
if (t) {
|
|
10387
10339
|
if (t.visible = !0, this.viralTools.viralViewerApi.viralScene.models.length > 0) {
|
|
10388
|
-
const i = new
|
|
10340
|
+
const i = new j().setFromObject(
|
|
10389
10341
|
this.viralTools.viralViewerApi.viralScene.models[0]
|
|
10390
10342
|
), s = new E();
|
|
10391
10343
|
i.getSize(s);
|
|
@@ -10415,7 +10367,7 @@ class jn {
|
|
|
10415
10367
|
name: "navigation",
|
|
10416
10368
|
tools: [
|
|
10417
10369
|
{
|
|
10418
|
-
svg: `<svg fill="${
|
|
10370
|
+
svg: `<svg fill="${y.primary}" style="height: 20px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>cursor-move</title><path d="M13,6V11H18V7.75L22.25,12L18,16.25V13H13V18H16.25L12,22.25L7.75,18H11V13H6V16.25L1.75,12L6,7.75V11H11V6H7.75L12,1.75L16.25,6H13Z" /></svg>`,
|
|
10419
10371
|
index: 0,
|
|
10420
10372
|
activate: !0,
|
|
10421
10373
|
allowDehydrated: !1,
|
|
@@ -10424,7 +10376,7 @@ class jn {
|
|
|
10424
10376
|
}
|
|
10425
10377
|
},
|
|
10426
10378
|
{
|
|
10427
|
-
svg: `<svg fill="${
|
|
10379
|
+
svg: `<svg fill="${y.primary}" style="height: 20px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>nature-people-outline</title><path d="M16 20V16.12C19.47 15.71 22.17 12.76 22.17 9.17C22.17 5.3 19.04 2.17 15.17 2.17C13.31 2.17 11.53 2.91 10.22 4.22C8.91 5.53 8.17 7.31 8.17 9.17C8.17 9.95 8.3 10.69 8.53 11.38C8.64 11.71 8.77 12.03 8.93 12.33C9.91 14.27 11.78 15.68 14 16.06V20H6V17H7V12.95C7 12.72 6.89 12.5 6.74 12.33L6.71 12.29L6.66 12.25C6.5 12.09 6.25 12 6 12H3C2.76 12 2.5 12.09 2.34 12.25L2.29 12.29C2.11 12.5 2 12.74 2 13V17H3V22H19V20H16M15.08 14.22L14.33 14.09C11.96 13.69 10.17 11.64 10.17 9.17C10.17 7.84 10.7 6.57 11.63 5.63C12.57 4.7 13.85 4.17 15.17 4.17C17.93 4.17 20.17 6.41 20.17 9.17C20.17 11.73 18.24 13.84 15.77 14.13L15.08 14.21M4.5 11C5.33 11 6 10.33 6 9.5C6 8.67 5.33 8 4.5 8C3.67 8 3 8.67 3 9.5C3 10.33 3.67 11 4.5 11Z" /></svg>`,
|
|
10428
10380
|
index: 1,
|
|
10429
10381
|
activate: !1,
|
|
10430
10382
|
allowDehydrated: !1,
|
|
@@ -10437,7 +10389,7 @@ class jn {
|
|
|
10437
10389
|
name: "helper",
|
|
10438
10390
|
tools: [
|
|
10439
10391
|
{
|
|
10440
|
-
svg: `<svg fill="${
|
|
10392
|
+
svg: `<svg fill="${y.primary}" style="height: 20px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>flag-variant-outline</title><path d="M6,3A1,1 0 0,1 7,4V4.88C8.06,4.44 9.5,4 11,4C14,4 14,6 16,6C19,6 20,4 20,4V12C20,12 19,14 16,14C13,14 13,12 11,12C8,12 7,14 7,14V21H5V4A1,1 0 0,1 6,3M7,7.25V11.5C7,11.5 9,10 11,10C13,10 14,12 16,12C18,12 18,11 18,11V7.5C18,7.5 17,8 16,8C14,8 13,6 11,6C9,6 7,7.25 7,7.25Z" /></svg>`,
|
|
10441
10393
|
index: 0,
|
|
10442
10394
|
activate: !1,
|
|
10443
10395
|
allowDehydrated: !1,
|
|
@@ -10445,7 +10397,7 @@ class jn {
|
|
|
10445
10397
|
action: (t) => this.viralToolElevation.activate(t)
|
|
10446
10398
|
},
|
|
10447
10399
|
{
|
|
10448
|
-
svg: `<svg fill="${
|
|
10400
|
+
svg: `<svg fill="${y.primary}" style="height: 20px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>ruler</title><path d="M1.39,18.36L3.16,16.6L4.58,18L5.64,16.95L4.22,15.54L5.64,14.12L8.11,16.6L9.17,15.54L6.7,13.06L8.11,11.65L9.53,13.06L10.59,12L9.17,10.59L10.59,9.17L13.06,11.65L14.12,10.59L11.65,8.11L13.06,6.7L14.47,8.11L15.54,7.05L14.12,5.64L15.54,4.22L18,6.7L19.07,5.64L16.6,3.16L18.36,1.39L22.61,5.64L5.64,22.61L1.39,18.36Z" /></svg>`,
|
|
10449
10401
|
index: 1,
|
|
10450
10402
|
activate: !1,
|
|
10451
10403
|
allowDehydrated: !1,
|
|
@@ -10453,7 +10405,7 @@ class jn {
|
|
|
10453
10405
|
action: (t) => this.viralToolMeasure.activate(t)
|
|
10454
10406
|
},
|
|
10455
10407
|
{
|
|
10456
|
-
svg: `<svg fill="${
|
|
10408
|
+
svg: `<svg fill="${y.primary}" style="height: 20px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>vector-intersection</title><path d="M3.14,1A2.14,2.14 0 0,0 1,3.14V5H3V3H5V1H3.14M7,1V3H10V1H7M12,1V3H14V5H16V3.14C16,1.96 15.04,1 13.86,1H12M1,7V10H3V7H1M9,7C7.89,7 7,7.89 7,9C7,11.33 7,16 7,16C7,16 11.57,16 13.86,16A2.14,2.14 0 0,0 16,13.86C16,11.57 16,7 16,7C16,7 11.33,7 9,7M18,7V9H20V11H22V9C22,7.89 21.11,7 20,7H18M9,9H14V14H9V9M1,12V13.86C1,15.04 1.96,16 3.14,16H5V14H3V12H1M20,13V16H22V13H20M7,18V20C7,21.11 7.89,22 9,22H11V20H9V18H7M20,18V20H18V22H20C21.11,22 22,21.11 22,20V18H20M13,20V22H16V20H13Z" /></svg>`,
|
|
10457
10409
|
index: 2,
|
|
10458
10410
|
activate: !1,
|
|
10459
10411
|
allowDehydrated: !1,
|
|
@@ -10467,7 +10419,7 @@ class jn {
|
|
|
10467
10419
|
name: "environment",
|
|
10468
10420
|
tools: [
|
|
10469
10421
|
{
|
|
10470
|
-
svg: `<svg fill="${
|
|
10422
|
+
svg: `<svg fill="${y.primary}" style="height: 20px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>white-balance-sunny</title><path d="M3.55 19.09L4.96 20.5L6.76 18.71L5.34 17.29M12 6C8.69 6 6 8.69 6 12S8.69 18 12 18 18 15.31 18 12C18 8.68 15.31 6 12 6M20 13H23V11H20M17.24 18.71L19.04 20.5L20.45 19.09L18.66 17.29M20.45 5L19.04 3.6L17.24 5.39L18.66 6.81M13 1H11V4H13M6.76 5.39L4.96 3.6L3.55 5L5.34 6.81L6.76 5.39M1 13H4V11H1M13 20H11V23H13" /></svg>`,
|
|
10471
10423
|
index: 0,
|
|
10472
10424
|
activate: !1,
|
|
10473
10425
|
allowDehydrated: !1,
|
|
@@ -10475,7 +10427,7 @@ class jn {
|
|
|
10475
10427
|
action: (t) => this.viralToolSunlight.activate(t)
|
|
10476
10428
|
},
|
|
10477
10429
|
{
|
|
10478
|
-
svg: `<svg fill="${
|
|
10430
|
+
svg: `<svg fill="${y.primary}" style="height: 20px;" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M480-120q-75 0-140.5-28.5t-114-77q-48.5-48.5-77-114T120-480q0-75 28.5-140.5t77-114q48.5-48.5 114-77T480-840q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-480q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-120ZM200-480q0 83 44.5 152T365-225q-42-51-63.5-120T280-492q0-66 16-125t46-107q-66 38-104 103t-38 141Zm348 272q75-19 130-74t74-130L548-208Zm-67-18 278-278q-2-14-4-28.5t-7-28.5L444-257q8 9 17.5 16.5T481-226Zm-74-79 315-315q-6-10-12-19.5T696-658L385-348q5 11 10.5 21.5T407-305Zm-40-108 286-287q-10-8-19.5-14.5T613-727L360-474q1 16 2.5 31t4.5 30Zm0-152 185-186q-15-4-30-6t-30-3q-49 29-81 79t-44 116Zm-25-159Z"/></svg>`,
|
|
10479
10431
|
index: 1,
|
|
10480
10432
|
activate: !1,
|
|
10481
10433
|
allowDehydrated: !1,
|
|
@@ -10488,7 +10440,7 @@ class jn {
|
|
|
10488
10440
|
name: "theme",
|
|
10489
10441
|
tools: [
|
|
10490
10442
|
{
|
|
10491
|
-
svg: `<svg fill="${
|
|
10443
|
+
svg: `<svg fill="${y.primary}" style="height: 20px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>moon-waning-crescent</title><path d="M2 12A10 10 0 0 0 15 21.54A10 10 0 0 1 15 2.46A10 10 0 0 0 2 12Z" /></svg>`,
|
|
10492
10444
|
index: 0,
|
|
10493
10445
|
activate: !1,
|
|
10494
10446
|
allowDehydrated: !0,
|
|
@@ -10501,7 +10453,7 @@ class jn {
|
|
|
10501
10453
|
name: "debug",
|
|
10502
10454
|
tools: [
|
|
10503
10455
|
{
|
|
10504
|
-
svg: `<svg fill="${
|
|
10456
|
+
svg: `<svg fill="${y.primary}" style="height: 20px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>cube-scan</title><path d="M17 22L22 19V13L17 16V22M17 8V2L22 5V11L17 8M1 8L6 11L11 8L6 5L1 8M6 13L1 10V16L6 19V13M13 16L8 13V19L13 22V16M13 8L8 5V11L13 8Z" /></svg>`,
|
|
10505
10457
|
index: 0,
|
|
10506
10458
|
activate: !1,
|
|
10507
10459
|
allowDehydrated: !1,
|
|
@@ -10512,7 +10464,7 @@ class jn {
|
|
|
10512
10464
|
}
|
|
10513
10465
|
]
|
|
10514
10466
|
}
|
|
10515
|
-
], this.items = [], this.viralToolAvatar = new kn(this), this.viralToolDarkMode = new Bn(this), this.viralToolSunlight = new $n(this), this.viralToolElevation = new zn(this), this.viralToolMeasure = new Nn(this), this.viralToolAmbientOcclusion = new Ln(this), this.dehydratedCachedData(), this.executeToolsByDefault(), this.injectTools(), this.viralViewerApi.emit(
|
|
10467
|
+
], this.items = [], this.viralToolAvatar = new kn(this), this.viralToolDarkMode = new Bn(this), this.viralToolSunlight = new $n(this), this.viralToolElevation = new zn(this), this.viralToolMeasure = new Nn(this), this.viralToolAmbientOcclusion = new Ln(this), this.dehydratedCachedData(), this.executeToolsByDefault(), this.injectTools(), this.viralViewerApi.emit(k.LOADED_TOOLS);
|
|
10516
10468
|
}
|
|
10517
10469
|
//#region Init
|
|
10518
10470
|
injectTools() {
|
|
@@ -10526,7 +10478,7 @@ class jn {
|
|
|
10526
10478
|
const i = this.tools[t], s = document.createElement("div");
|
|
10527
10479
|
s.setAttribute(
|
|
10528
10480
|
"style",
|
|
10529
|
-
`padding: 8px 10px 10px 10px; display: flex;flex-direction: row;justify-content: center; align-items: center; background-color: ${
|
|
10481
|
+
`padding: 8px 10px 10px 10px; display: flex;flex-direction: row;justify-content: center; align-items: center; background-color: ${y.background}; border-radius: 10px; pointer-events: visible;margin: 0 2.5px;`
|
|
10530
10482
|
);
|
|
10531
10483
|
for (let n = 0; n < i.tools.length; n++) {
|
|
10532
10484
|
const r = i.tools[n], o = document.createElement("div");
|
|
@@ -10539,10 +10491,10 @@ class jn {
|
|
|
10539
10491
|
const a = document.createElement("div");
|
|
10540
10492
|
a.setAttribute(
|
|
10541
10493
|
"style",
|
|
10542
|
-
`border-top: 2px solid ; padding-bottom: 2px; border-color: ${
|
|
10494
|
+
`border-top: 2px solid ; padding-bottom: 2px; border-color: ${y.background};`
|
|
10543
10495
|
), r.activate && a.setAttribute(
|
|
10544
10496
|
"style",
|
|
10545
|
-
`border-top: 2px solid ; padding-bottom: 2px; border-color: ${
|
|
10497
|
+
`border-top: 2px solid ; padding-bottom: 2px; border-color: ${y.secondary};`
|
|
10546
10498
|
), o.appendChild(a);
|
|
10547
10499
|
const l = document.createElement("div");
|
|
10548
10500
|
l.setAttribute(
|
|
@@ -10556,8 +10508,8 @@ class jn {
|
|
|
10556
10508
|
}, l.onmouseleave = () => {
|
|
10557
10509
|
l.style.setProperty("background-color", "unset");
|
|
10558
10510
|
};
|
|
10559
|
-
const c =
|
|
10560
|
-
r.activate && c && c.setAttribute("fill", `${
|
|
10511
|
+
const c = ft.createElementFromHTML(r.svg);
|
|
10512
|
+
r.activate && c && c.setAttribute("fill", `${y.secondary}`), l.appendChild(c), o.appendChild(l), s.appendChild(o);
|
|
10561
10513
|
}
|
|
10562
10514
|
e.appendChild(s);
|
|
10563
10515
|
}
|
|
@@ -10591,7 +10543,7 @@ class jn {
|
|
|
10591
10543
|
if (s) {
|
|
10592
10544
|
s.activate = !s.activate;
|
|
10593
10545
|
const n = t.children[0], o = t.children[1].children[0];
|
|
10594
|
-
s.activate ? (n.style.setProperty("border-color", `${
|
|
10546
|
+
s.activate ? (n.style.setProperty("border-color", `${y.secondary}`), o.setAttribute("fill", `${y.secondary}`)) : (n.style.setProperty("border-color", `${y.background}`), o.setAttribute("fill", `${y.primary}`)), s.action(s);
|
|
10595
10547
|
}
|
|
10596
10548
|
}
|
|
10597
10549
|
//#endregion
|
|
@@ -10645,7 +10597,7 @@ class Hn {
|
|
|
10645
10597
|
localStorage.clear();
|
|
10646
10598
|
}
|
|
10647
10599
|
}
|
|
10648
|
-
class xr extends
|
|
10600
|
+
class xr extends zs {
|
|
10649
10601
|
constructor(e = {
|
|
10650
10602
|
isDev: !1,
|
|
10651
10603
|
cameraZUp: !1,
|
|
@@ -10657,13 +10609,13 @@ class xr extends $s {
|
|
|
10657
10609
|
adaptiveEdges: !0,
|
|
10658
10610
|
adaptiveAmbientOcclusion: !0
|
|
10659
10611
|
}) {
|
|
10660
|
-
super(), this.viralCompressProcessor = new
|
|
10612
|
+
super(), this.viralCompressProcessor = new ys(), this.localStorageService = new Hn(), this.viralStats = null, this.viralSectionBox = null, this.viralBatchDebugPanel = null, this.viralRenderDebugPanel = null, this.viralInstancedDebugPanel = null, this.options = e, this.viralLifecycleEventHandler = new Hs(this, this.options), this.targetElement = e.container, An("QUICK_SAND"), _n(this.targetElement, "QUICK_SAND"), this.options.enableTools && (this.viralTools = new jn(this)), this.viralSpinner = new Rn(this), this.viralDraggableModal = new Sn(this), this.viralContextMenu = new Cn(this), this.viralPivotPoint = new Dn(this), this.viralScene = new yn(this), this.viralMaterialManager = new nn(this), this.viralRenderer = new wn(this), this.viralCamera = new ws(this), this.options.enableNavigationCube && (this.viralNavigationCube = new On(
|
|
10661
10613
|
this,
|
|
10662
10614
|
this.options.navigationCubeScale || 1
|
|
10663
|
-
)), this.viralMouse = new
|
|
10615
|
+
)), this.viralMouse = new $s(this), this.viralKeyboard = new Ns(this), this.viralAnimation = new us(this), this.viralVisibilityManager = new En(this), this.viralCentralizedEventHandler = new js(this), this.viralLoader = new sn(this), this.viralBVH = new vs(), this.viralDataManager = new Bs(this), this.viralAvatarManager = new fs(this), this.options.isDev && (this.viralStats = new Mn(this)), this.options.isDev ? this.viralAnimation.devAnimation() : this.viralAnimation.animation();
|
|
10664
10616
|
const t = window;
|
|
10665
|
-
t.VIRAL_VIEWER = this, this.viralSectionBox = new Vt(this), this.viralBatchDebugPanel = new
|
|
10666
|
-
var
|
|
10617
|
+
t.VIRAL_VIEWER = this, this.viralSectionBox = new Vt(this), this.viralBatchDebugPanel = new cs(this), this.viralRenderDebugPanel = new ds(this), this.viralInstancedDebugPanel = new hs(this), this.options.isDev && import("./lil-gui.esm-BtfdsiIY.mjs").then(({ GUI: i }) => {
|
|
10618
|
+
var A, S, _, V, T;
|
|
10667
10619
|
const s = new i({ title: "Controls" }), n = s.addFolder("Sun Light");
|
|
10668
10620
|
n.add(this.viralScene.sunLight, "visible").onChange(() => {
|
|
10669
10621
|
this.viralRenderer.render();
|
|
@@ -10684,15 +10636,46 @@ class xr extends $s {
|
|
|
10684
10636
|
o.add(a, "enabled").name("Outline Enabled").onChange((M) => {
|
|
10685
10637
|
this.viralVisibilityManager.setSelectionOutlineMode(M);
|
|
10686
10638
|
}), o.addColor(a, "color").name("Outline Color").onChange((M) => {
|
|
10687
|
-
var
|
|
10688
|
-
(
|
|
10639
|
+
var I;
|
|
10640
|
+
(I = this.viralRenderer.postProcessingRenderer) == null || I.setSelectionOutlineColor(M), this.viralRenderer.render();
|
|
10689
10641
|
}), o.add(a, "thickness", 0.5, 5, 0.5).name("Thickness").onChange((M) => {
|
|
10690
|
-
var
|
|
10691
|
-
(
|
|
10642
|
+
var I;
|
|
10643
|
+
(I = this.viralRenderer.postProcessingRenderer) == null || I.setSelectionOutlineThickness(
|
|
10692
10644
|
M
|
|
10693
10645
|
), this.viralRenderer.render();
|
|
10694
|
-
}), o.add(this.viralVisibilityManager, "updateSelectionOutline").name("Refresh")
|
|
10695
|
-
const l =
|
|
10646
|
+
}), o.add(this.viralVisibilityManager, "updateSelectionOutline").name("Refresh");
|
|
10647
|
+
const l = { randomCount: 500 }, c = () => {
|
|
10648
|
+
const M = [];
|
|
10649
|
+
for (let I = 0; I < this.viralDataManager.dataTree.length; I++) {
|
|
10650
|
+
const D = this.viralDataManager.dataTree[I];
|
|
10651
|
+
for (const B of D.getAllElements())
|
|
10652
|
+
M.push({
|
|
10653
|
+
elementId: B.elementId.toString(),
|
|
10654
|
+
modelId: I.toString()
|
|
10655
|
+
});
|
|
10656
|
+
}
|
|
10657
|
+
return M;
|
|
10658
|
+
}, h = {
|
|
10659
|
+
selectAllAndMeasure: () => {
|
|
10660
|
+
console.log("--- Outline Benchmark ---"), console.time("⏱️ select + outline total"), this.viralVisibilityManager.selectAllElements(), console.timeEnd("⏱️ select + outline total"), console.log(
|
|
10661
|
+
`📊 Selected: ${this.viralScene.bimWorld.getSelectedElements().length} elements`
|
|
10662
|
+
);
|
|
10663
|
+
},
|
|
10664
|
+
selectRandom: () => {
|
|
10665
|
+
const M = c(), I = Math.min(l.randomCount, M.length);
|
|
10666
|
+
for (let B = M.length - 1; B > M.length - 1 - I; B--) {
|
|
10667
|
+
const P = Math.floor(Math.random() * (B + 1));
|
|
10668
|
+
[M[B], M[P]] = [M[P], M[B]];
|
|
10669
|
+
}
|
|
10670
|
+
const D = M.slice(M.length - I);
|
|
10671
|
+
console.log(`--- Outline Benchmark (random ${I}) ---`), console.time("⏱️ select + outline total"), this.viralVisibilityManager.selectElements(D), console.timeEnd("⏱️ select + outline total"), console.log(`📊 Selected: ${I} / ${M.length} elements`);
|
|
10672
|
+
},
|
|
10673
|
+
unselectAll: () => {
|
|
10674
|
+
console.time("⏱️ unselect + outline"), this.viralVisibilityManager.unselectElements(), console.timeEnd("⏱️ unselect + outline");
|
|
10675
|
+
}
|
|
10676
|
+
};
|
|
10677
|
+
o.add(l, "randomCount", 1, 5e3, 1).name("Random Count"), o.add(h, "selectRandom").name("⏱️ Select Random (bench)"), o.add(h, "selectAllAndMeasure").name("⏱️ Select All (bench)"), o.add(h, "unselectAll").name("⏱️ Unselect All (bench)"), o.open();
|
|
10678
|
+
const d = s.addFolder("Debug Panels"), u = {
|
|
10696
10679
|
showBatchDebugPanel: () => {
|
|
10697
10680
|
var M;
|
|
10698
10681
|
return (M = this.viralBatchDebugPanel) == null ? void 0 : M.show();
|
|
@@ -10722,91 +10705,91 @@ class xr extends $s {
|
|
|
10722
10705
|
return (M = this.viralRenderDebugPanel) == null ? void 0 : M.logToConsole();
|
|
10723
10706
|
}
|
|
10724
10707
|
};
|
|
10725
|
-
|
|
10708
|
+
d.add(u, "showRenderDebugPanel").name("🔍 Show Render Debug"), d.add(u, "hideRenderDebugPanel").name("Hide Render Debug"), d.add(u, "logSceneAnalysis").name("📋 Log to Console"), d.add(u, "showBatchDebugPanel").name("📦 Show Batch Debug"), d.add(u, "hideBatchDebugPanel").name("Hide Batch Debug"), d.add(u, "showInstancedDebugPanel").name("🔄 Show Instanced Debug"), d.add(u, "hideInstancedDebugPanel").name("Hide Instanced Debug"), d.open(), r.add(this.viralVisibilityManager, "opacity", 0, 1, 0.1).onChange(() => {
|
|
10726
10709
|
this.viralVisibilityManager.setOpacity();
|
|
10727
10710
|
}), r.add(this.viralVisibilityManager, "showHidePercentage", 0, 100, 1).onChange(() => {
|
|
10728
10711
|
this.viralVisibilityManager.showHideByPercentage();
|
|
10729
10712
|
}), r.add(this.viralVisibilityManager, "randomColor", 0, 100, 1).onChange(() => {
|
|
10730
10713
|
this.viralVisibilityManager.changeRandomColor();
|
|
10731
10714
|
});
|
|
10732
|
-
const
|
|
10715
|
+
const p = r.addFolder("Element Opacity"), m = {
|
|
10733
10716
|
ghostOpacity: 0.12,
|
|
10734
10717
|
elementOpacity: 0.5,
|
|
10735
10718
|
ghostSelected: () => {
|
|
10736
10719
|
const M = this.viralScene.bimWorld.getSelectedElements();
|
|
10737
10720
|
M.length > 0 && this.viralVisibilityManager.setElementGhost(
|
|
10738
10721
|
M,
|
|
10739
|
-
|
|
10722
|
+
m.ghostOpacity
|
|
10740
10723
|
);
|
|
10741
10724
|
},
|
|
10742
10725
|
ghostExceptSelected: () => {
|
|
10743
10726
|
const M = this.viralScene.bimWorld.getSelectedElements();
|
|
10744
10727
|
M.length > 0 && this.viralVisibilityManager.ghostExcept(
|
|
10745
10728
|
M,
|
|
10746
|
-
|
|
10729
|
+
m.ghostOpacity
|
|
10747
10730
|
);
|
|
10748
10731
|
},
|
|
10749
10732
|
setSelectedOpacity: () => {
|
|
10750
10733
|
const M = this.viralScene.bimWorld.getSelectedElements();
|
|
10751
10734
|
M.length > 0 && this.viralVisibilityManager.setElementOpacity(
|
|
10752
10735
|
M,
|
|
10753
|
-
|
|
10736
|
+
m.elementOpacity
|
|
10754
10737
|
);
|
|
10755
10738
|
},
|
|
10756
10739
|
resetOpacity: () => {
|
|
10757
10740
|
this.viralVisibilityManager.resetElementOpacity();
|
|
10758
10741
|
}
|
|
10759
10742
|
};
|
|
10760
|
-
|
|
10761
|
-
const
|
|
10762
|
-
|
|
10763
|
-
const
|
|
10764
|
-
|
|
10765
|
-
const
|
|
10766
|
-
if (
|
|
10743
|
+
p.add(m, "ghostOpacity", 0, 1, 0.01).name("Ghost Opacity"), p.add(m, "elementOpacity", 0, 1, 0.01).name("Element Opacity"), p.add(m, "ghostSelected").name("Ghost Selected"), p.add(m, "ghostExceptSelected").name("Ghost Except Selected"), p.add(m, "setSelectedOpacity").name("Set Selected Opacity"), p.add(m, "resetOpacity").name("Reset All Opacity"), r.close();
|
|
10744
|
+
const f = s.addFolder("Camera");
|
|
10745
|
+
f.add(this.viralCamera, "enableOrthographicCamera"), f.add(this.viralCamera, "enablePerspectiveCamera"), f.add(this.viralCamera, "modelId"), f.add(this.viralCamera, "elementId"), f.add(this.viralCamera, "zoomTo");
|
|
10746
|
+
const v = s.addFolder("Data");
|
|
10747
|
+
v.add(this.viralDataManager, "searchValue"), v.add(this.viralDataManager, "searchElementData"), v.add(this.viralDataManager, "compareModels"), v.add(this.viralDataManager, "uncompareModels"), v.add(this.viralDataManager, "firstElementId"), v.add(this.viralDataManager, "secondElementId"), v.add(this.viralDataManager, "checkClash"), v.add(this.viralDataManager, "checkClashModels"), v.add(this.viralDataManager, "groupByKeyword"), v.add(this.viralDataManager, "groupBy");
|
|
10748
|
+
const b = s.addFolder("Section Box");
|
|
10749
|
+
if (b.add(this.viralVisibilityManager, "enableSectionBox").name("Enable (Activate)"), b.add(this.viralVisibilityManager, "disableSectionBox").name("Disable (Deactivate)"), b.add(this.viralVisibilityManager, "showSectionBox").name("Show Visuals"), b.add(this.viralVisibilityManager, "hideSectionBox").name("Hide Visuals"), b.add(this.viralVisibilityManager, "resetSectionBox").name("Reset to Initial"), s.addFolder("Model Management").add(this.viralLoader.revitLoader, "disposeModels"), s.addFolder("Materials").add(this.viralMaterialManager.edgeMaterial, "linewidth", 0, 10, 1).onChange((M) => {
|
|
10767
10750
|
console.log("The value is now " + M), this.viralMaterialManager.edgeMaterial.linewidth = M, this.viralRenderer.render();
|
|
10768
10751
|
}), this.viralRenderer.postProcessingRenderer) {
|
|
10769
|
-
const M = s.addFolder("Post Processing"),
|
|
10770
|
-
|
|
10771
|
-
(
|
|
10752
|
+
const M = s.addFolder("Post Processing"), I = M.addFolder("N8ao");
|
|
10753
|
+
I.add(
|
|
10754
|
+
(A = this.viralRenderer.postProcessingRenderer) == null ? void 0 : A.n8aoPass.configuration,
|
|
10772
10755
|
"aoSamples",
|
|
10773
10756
|
1,
|
|
10774
10757
|
64,
|
|
10775
10758
|
1
|
|
10776
|
-
).onChange((
|
|
10777
|
-
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoSamples =
|
|
10778
|
-
}),
|
|
10779
|
-
(
|
|
10759
|
+
).onChange((P) => {
|
|
10760
|
+
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoSamples = P, this.viralRenderer.render();
|
|
10761
|
+
}), I.add(
|
|
10762
|
+
(S = this.viralRenderer.postProcessingRenderer) == null ? void 0 : S.n8aoPass.configuration,
|
|
10780
10763
|
"aoRadius",
|
|
10781
10764
|
1,
|
|
10782
10765
|
10,
|
|
10783
10766
|
0.01
|
|
10784
|
-
).onChange((
|
|
10785
|
-
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoRadius =
|
|
10786
|
-
}),
|
|
10787
|
-
(
|
|
10767
|
+
).onChange((P) => {
|
|
10768
|
+
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoRadius = P, this.viralRenderer.render();
|
|
10769
|
+
}), I.add(
|
|
10770
|
+
(_ = this.viralRenderer.postProcessingRenderer) == null ? void 0 : _.n8aoPass.configuration,
|
|
10788
10771
|
"denoiseRadius",
|
|
10789
10772
|
0,
|
|
10790
10773
|
24,
|
|
10791
10774
|
0.01
|
|
10792
|
-
).onChange((
|
|
10793
|
-
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.denoiseRadius =
|
|
10794
|
-
}),
|
|
10795
|
-
(
|
|
10775
|
+
).onChange((P) => {
|
|
10776
|
+
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.denoiseRadius = P, this.viralRenderer.render();
|
|
10777
|
+
}), I.add(
|
|
10778
|
+
(V = this.viralRenderer.postProcessingRenderer) == null ? void 0 : V.n8aoPass.configuration,
|
|
10796
10779
|
"intensity",
|
|
10797
10780
|
0,
|
|
10798
10781
|
10,
|
|
10799
10782
|
0.01
|
|
10800
|
-
).onChange((
|
|
10801
|
-
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.intensity =
|
|
10802
|
-
}),
|
|
10803
|
-
(
|
|
10783
|
+
).onChange((P) => {
|
|
10784
|
+
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.intensity = P, this.viralRenderer.render();
|
|
10785
|
+
}), I.add(
|
|
10786
|
+
(T = this.viralRenderer.postProcessingRenderer) == null ? void 0 : T.n8aoPass.configuration,
|
|
10804
10787
|
"distanceFalloff",
|
|
10805
10788
|
0,
|
|
10806
10789
|
10,
|
|
10807
10790
|
0.01
|
|
10808
|
-
).onChange((
|
|
10809
|
-
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.distanceFalloff =
|
|
10791
|
+
).onChange((P) => {
|
|
10792
|
+
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.distanceFalloff = P, this.viralRenderer.render();
|
|
10810
10793
|
}), M.add(
|
|
10811
10794
|
this.viralRenderer.postProcessingRenderer,
|
|
10812
10795
|
"enableSobel"
|
|
@@ -10814,15 +10797,15 @@ class xr extends $s {
|
|
|
10814
10797
|
this.viralRenderer.postProcessingRenderer,
|
|
10815
10798
|
"disableSobel"
|
|
10816
10799
|
);
|
|
10817
|
-
const
|
|
10818
|
-
|
|
10800
|
+
const D = M.addFolder("Screen-Space Edges");
|
|
10801
|
+
D.add(this.viralRenderer.postProcessingRenderer, "enableScreenSpaceEdges").name("Enable"), D.add(this.viralRenderer.postProcessingRenderer, "disableScreenSpaceEdges").name("Disable"), D.add(
|
|
10819
10802
|
this.viralRenderer.postProcessingRenderer,
|
|
10820
10803
|
"setScreenSpaceEdgesPenMode"
|
|
10821
|
-
).name("Pen Mode"),
|
|
10804
|
+
).name("Pen Mode"), D.add(
|
|
10822
10805
|
this.viralRenderer.postProcessingRenderer,
|
|
10823
10806
|
"setScreenSpaceEdgesShadedMode"
|
|
10824
10807
|
).name("Shaded Mode");
|
|
10825
|
-
const
|
|
10808
|
+
const B = {
|
|
10826
10809
|
edgeColor: "#000000",
|
|
10827
10810
|
edgeOpacity: 1,
|
|
10828
10811
|
// Slightly reduced for subtlety
|
|
@@ -10841,48 +10824,48 @@ class xr extends $s {
|
|
|
10841
10824
|
enableObjectIdEdges: !1
|
|
10842
10825
|
// Disable - most expensive
|
|
10843
10826
|
};
|
|
10844
|
-
|
|
10845
|
-
var
|
|
10846
|
-
(
|
|
10847
|
-
parseInt(
|
|
10827
|
+
D.addColor(B, "edgeColor").name("Edge Color").onChange((P) => {
|
|
10828
|
+
var L;
|
|
10829
|
+
(L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgeColor(
|
|
10830
|
+
parseInt(P.replace("#", "0x"))
|
|
10848
10831
|
), this.viralRenderer.render();
|
|
10849
|
-
}),
|
|
10850
|
-
var
|
|
10851
|
-
(
|
|
10852
|
-
}),
|
|
10853
|
-
var
|
|
10854
|
-
(
|
|
10855
|
-
|
|
10832
|
+
}), D.add(B, "edgeOpacity", 0, 1, 0.05).name("Opacity").onChange((P) => {
|
|
10833
|
+
var L;
|
|
10834
|
+
(L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgeOpacity(P), this.viralRenderer.render();
|
|
10835
|
+
}), D.add(B, "edgeThickness", 0.5, 5, 0.1).name("Thickness").onChange((P) => {
|
|
10836
|
+
var L;
|
|
10837
|
+
(L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgeThickness(
|
|
10838
|
+
P
|
|
10856
10839
|
), this.viralRenderer.render();
|
|
10857
|
-
}),
|
|
10858
|
-
var
|
|
10859
|
-
(
|
|
10860
|
-
depthMultiplier:
|
|
10840
|
+
}), D.add(B, "depthMultiplier", 0, 3, 0.1).name("Depth Sensitivity").onChange((P) => {
|
|
10841
|
+
var L;
|
|
10842
|
+
(L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgesOptions({
|
|
10843
|
+
depthMultiplier: P
|
|
10861
10844
|
}), this.viralRenderer.render();
|
|
10862
|
-
}),
|
|
10863
|
-
var
|
|
10864
|
-
(
|
|
10865
|
-
normalMultiplier:
|
|
10845
|
+
}), D.add(B, "normalMultiplier", 0, 3, 0.1).name("Normal Sensitivity").onChange((P) => {
|
|
10846
|
+
var L;
|
|
10847
|
+
(L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgesOptions({
|
|
10848
|
+
normalMultiplier: P
|
|
10866
10849
|
}), this.viralRenderer.render();
|
|
10867
|
-
}),
|
|
10868
|
-
var
|
|
10869
|
-
(
|
|
10870
|
-
normalBias:
|
|
10850
|
+
}), D.add(B, "normalBias", 0, 1, 0.01).name("Normal Bias").onChange((P) => {
|
|
10851
|
+
var L;
|
|
10852
|
+
(L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgesOptions({
|
|
10853
|
+
normalBias: P
|
|
10871
10854
|
}), this.viralRenderer.render();
|
|
10872
|
-
}),
|
|
10873
|
-
var
|
|
10874
|
-
(
|
|
10875
|
-
depth:
|
|
10855
|
+
}), D.add(B, "enableDepthEdges").name("Depth Edges").onChange((P) => {
|
|
10856
|
+
var L;
|
|
10857
|
+
(L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgeMethods({
|
|
10858
|
+
depth: P
|
|
10876
10859
|
}), this.viralRenderer.render();
|
|
10877
|
-
}),
|
|
10878
|
-
var
|
|
10879
|
-
(
|
|
10880
|
-
normal:
|
|
10860
|
+
}), D.add(B, "enableNormalEdges").name("Normal Edges").onChange((P) => {
|
|
10861
|
+
var L;
|
|
10862
|
+
(L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgeMethods({
|
|
10863
|
+
normal: P
|
|
10881
10864
|
}), this.viralRenderer.render();
|
|
10882
|
-
}),
|
|
10883
|
-
var
|
|
10884
|
-
(
|
|
10885
|
-
objectId:
|
|
10865
|
+
}), D.add(B, "enableObjectIdEdges").name("Object ID Edges").onChange((P) => {
|
|
10866
|
+
var L;
|
|
10867
|
+
(L = this.viralRenderer.postProcessingRenderer) == null || L.setScreenSpaceEdgeMethods({
|
|
10868
|
+
objectId: P
|
|
10886
10869
|
}), this.viralRenderer.render();
|
|
10887
10870
|
});
|
|
10888
10871
|
}
|
|
@@ -10891,35 +10874,35 @@ class xr extends $s {
|
|
|
10891
10874
|
}
|
|
10892
10875
|
export {
|
|
10893
10876
|
mr as BufferElement,
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10877
|
+
os as CheckClashResult,
|
|
10878
|
+
as as CompareModelsResult,
|
|
10879
|
+
rs as DataTree,
|
|
10897
10880
|
yr as DebouncedEventHandler,
|
|
10898
|
-
|
|
10899
|
-
|
|
10881
|
+
ts as DefaultLightConfiguration,
|
|
10882
|
+
_t as Dictionary,
|
|
10900
10883
|
ur as ElementFragment,
|
|
10901
10884
|
dr as Fragment,
|
|
10902
|
-
|
|
10903
|
-
|
|
10885
|
+
ls as GroupByResult,
|
|
10886
|
+
ft as HTMLUtil,
|
|
10904
10887
|
Q as LogUtil,
|
|
10905
|
-
|
|
10888
|
+
R as THREEUtil,
|
|
10906
10889
|
wr as TreeNode,
|
|
10907
|
-
|
|
10908
|
-
|
|
10890
|
+
Ji as ViralBIMWorld,
|
|
10891
|
+
cs as ViralBatchDebugPanel,
|
|
10909
10892
|
Z as ViralBatchedMesh,
|
|
10910
10893
|
X as ViralCameraEventType,
|
|
10911
|
-
|
|
10894
|
+
hs as ViralInstancedDebugPanel,
|
|
10912
10895
|
me as ViralKeyboardEventType,
|
|
10913
|
-
|
|
10896
|
+
N as ViralMouseEventType,
|
|
10914
10897
|
re as ViralPoint,
|
|
10915
|
-
|
|
10898
|
+
ds as ViralRenderDebugPanel,
|
|
10916
10899
|
xr as ViralViewerApi,
|
|
10917
10900
|
pr as ViralViewerRevitGeometry,
|
|
10918
10901
|
hr as ViralViewerRevitNoneStructuralGeometry,
|
|
10919
|
-
|
|
10920
|
-
|
|
10902
|
+
es as ViralutionBox,
|
|
10903
|
+
Kt as ViralutionCamera,
|
|
10921
10904
|
gr as ViralutionElement,
|
|
10922
|
-
|
|
10905
|
+
k as ViralutionEvent,
|
|
10923
10906
|
vr as ViralutionSolid,
|
|
10924
10907
|
fr as ViralutionStandaloneModel,
|
|
10925
10908
|
br as ViralutionTrackingModel
|