viral-viewer-2 7.2.5 → 7.2.7
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-batched-mesh.d.ts +12 -0
- package/dist/components/custom-objects/viral-instanced-mesh-v2.d.ts +20 -1
- package/dist/components/post-processing/alpha-selection-outline-pass.d.ts +49 -0
- package/dist/components/post-processing/post-processing-renderer.d.ts +41 -0
- package/dist/components/post-processing/stencil-selection-outline-pass.d.ts +54 -0
- package/dist/components/visibility-manager/viral-visibility-manager.d.ts +34 -0
- package/dist/index.mjs +1266 -904
- package/package.json +1 -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 Vi, disposeBoundsTree as
|
|
5
|
-
import
|
|
6
|
-
import { 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
|
|
1
|
+
import { Vector3 as E, Box3 as F, Mesh as x, BufferAttribute as z, BufferGeometry as he, EdgesGeometry as Mt, MeshBasicMaterial as Y, PointLight as Ft, Object3D as Wt, InstancedMesh as pe, Color as N, InstancedBufferAttribute as Fe, Matrix4 as ce, LineSegments as wt, Line as gt, Points as Et, Clock as si, AnimationMixer as ni, Vector2 as H, Vector4 as ri, Quaternion as ai, Spherical as Gt, Sphere as Ut, Raycaster as Vt, MathUtils as oi, PerspectiveCamera as Ge, OrthographicCamera as St, Euler as li, MeshPhongMaterial as ft, FrontSide as ci, MeshStandardMaterial as ne, DoubleSide as ae, ObjectLoader as hi, ShaderMaterial as re, WebGLRenderTarget as ve, DepthTexture as Ct, UnsignedShortType as At, MeshNormalMaterial as di, RGBAFormat as qt, HalfFloatType as Qt, NearestFilter as Rt, WebGLRenderer as Zt, SRGBColorSpace as ui, VSMShadowMap as pi, Scene as Tt, SphereGeometry as Lt, DirectionalLight as pt, AmbientLight as mi, CameraHelper as gi, BoxGeometry as Pt, AxesHelper as fi, BoxHelper as vi, Box3Helper as bi, PlaneGeometry as ue, Plane as ge, Fog as wi, PointsMaterial as yi, LOD as xi, TextureLoader as Mi, CanvasTexture as kt, SpriteMaterial as Bt, Sprite as zt, LineBasicMaterial as Ei } from "three";
|
|
2
|
+
import { SimplifyModifier as Si } from "three/examples/jsm/modifiers/SimplifyModifier";
|
|
3
|
+
import { LineSegmentsGeometry as Yt, LineSegments2 as Xt, SSAARenderPass as Ci, FXAAShader as Ai, TAARenderPass as _i, SAOPass as Ii, SSAOPass as mt } from "three/examples/jsm/Addons";
|
|
4
|
+
import { computeBoundsTree as Vi, disposeBoundsTree as Ti, acceleratedRaycast as Pi } from "three-mesh-bvh";
|
|
5
|
+
import be from "camera-controls";
|
|
6
|
+
import { inflate as Oi, Inflate as Di } from "pako";
|
|
7
|
+
import { Potree as Ri, PointSizeType as Li, PointShape as ki, PointColorType as Bi } from "potree-core-viral";
|
|
8
|
+
import { GLTFLoader as zi } from "three/examples/jsm/loaders/GLTFLoader";
|
|
9
|
+
import { LineMaterial as Kt } from "three/examples/jsm/lines/LineMaterial";
|
|
10
|
+
import { N8AOPass as Ni } from "n8ao";
|
|
11
|
+
import { EffectComposer as $i } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
12
|
+
import { OutlinePass as ji } from "three/examples/jsm/postprocessing/OutlinePass";
|
|
13
|
+
import { OutputPass as Hi } from "three/examples/jsm/postprocessing/OutputPass";
|
|
14
|
+
import { RenderPass as Fi } from "three/examples/jsm/postprocessing/RenderPass";
|
|
15
15
|
import { ShaderPass as yt } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
16
|
-
import { SMAAPass as
|
|
17
|
-
import { GammaCorrectionShader as
|
|
18
|
-
import { Pass as
|
|
19
|
-
import { TransformControls as
|
|
20
|
-
import { LineSegments2 as
|
|
21
|
-
import { LineSegmentsGeometry as
|
|
22
|
-
class
|
|
16
|
+
import { SMAAPass as Wi } from "three/examples/jsm/postprocessing/SMAAPass";
|
|
17
|
+
import { GammaCorrectionShader as Gi } from "three/examples/jsm/shaders/GammaCorrectionShader";
|
|
18
|
+
import { Pass as Ot, FullScreenQuad as Dt } from "three/examples/jsm/postprocessing/Pass";
|
|
19
|
+
import { TransformControls as Ui } from "three/examples/jsm/controls/TransformControls";
|
|
20
|
+
import { LineSegments2 as qi } from "three/examples/jsm/lines/LineSegments2";
|
|
21
|
+
import { LineSegmentsGeometry as Qi } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
22
|
+
class vt {
|
|
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 Zi = {
|
|
29
29
|
background: "#ffffff",
|
|
30
30
|
primary: "#17312c",
|
|
31
31
|
secondary: "#56b77e",
|
|
@@ -37,8 +37,8 @@ const Qi = {
|
|
|
37
37
|
added: "#16C47F",
|
|
38
38
|
modified: "#FFD65A",
|
|
39
39
|
notChanged: "#000000"
|
|
40
|
-
}, y =
|
|
41
|
-
class
|
|
40
|
+
}, y = Zi;
|
|
41
|
+
class J {
|
|
42
42
|
static information(e) {
|
|
43
43
|
console.log(
|
|
44
44
|
`%c ${e}`,
|
|
@@ -48,7 +48,7 @@ class Q {
|
|
|
48
48
|
static error(e) {
|
|
49
49
|
console.log(
|
|
50
50
|
`%c ${e}`,
|
|
51
|
-
`color: ${y.
|
|
51
|
+
`color: ${y.secondary}; 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 D {
|
|
61
61
|
static middlePoint(e, t) {
|
|
62
62
|
return new E(
|
|
63
63
|
(e.x + t.x) / 2,
|
|
@@ -100,20 +100,20 @@ class R {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
static rgbToThreejsColor(e, t, i) {
|
|
103
|
-
return "#" +
|
|
103
|
+
return "#" + D.componentToHex(e) + D.componentToHex(t) + D.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 F();
|
|
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 Si();
|
|
117
117
|
console.log(e);
|
|
118
118
|
const s = i.modify(
|
|
119
119
|
e.geometry.clone(),
|
|
@@ -122,8 +122,8 @@ class R {
|
|
|
122
122
|
return new x(s, e.material);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
const
|
|
126
|
-
class
|
|
125
|
+
const Yi = D.hexToRGB(y.secondary), Xi = 0.99;
|
|
126
|
+
class ee 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
|
}
|
|
@@ -189,14 +189,14 @@ class Z extends x {
|
|
|
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 S = m;
|
|
193
|
+
for (let C = 0; C < b; C++)
|
|
194
|
+
c[u++] = v.buffer[C * 3], c[u++] = v.buffer[C * 3 + 1], c[u++] = v.buffer[C * 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 C = 0; C < b - 2; C += 3)
|
|
196
|
+
d[f++] = m + C, d[f++] = m + C + 1, d[f++] = m + C + 2, w.push(m + C, m + C + 1, m + C + 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: S,
|
|
200
200
|
count: b,
|
|
201
201
|
indices: w
|
|
202
202
|
}), m += b, this._bufferElements.push(v);
|
|
@@ -329,7 +329,7 @@ class Z extends x {
|
|
|
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 he();
|
|
333
333
|
for (const o of this._bufferElements) {
|
|
334
334
|
const a = o.buffer;
|
|
335
335
|
if (!a || a.length < 9)
|
|
@@ -350,7 +350,7 @@ class Z extends x {
|
|
|
350
350
|
const a = o.buffer;
|
|
351
351
|
if (!a || a.length < 9)
|
|
352
352
|
continue;
|
|
353
|
-
const l = new
|
|
353
|
+
const l = new he();
|
|
354
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++) {
|
|
@@ -369,8 +369,8 @@ class Z extends x {
|
|
|
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 Yt();
|
|
373
|
+
r.setPositions(i), this._edgeLines = new Xt(r, this._edgeMaterial), this.add(this._edgeLines);
|
|
374
374
|
}
|
|
375
375
|
/** Show edges ONLY for the given elements */
|
|
376
376
|
isolateEdge(e) {
|
|
@@ -429,13 +429,43 @@ class Z extends x {
|
|
|
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, Yi), this._setSelectionAlpha(this._selectedElements, Xi);
|
|
433
433
|
}
|
|
434
434
|
get selectedElements() {
|
|
435
435
|
return this._selectedElements;
|
|
436
436
|
}
|
|
437
437
|
unselect() {
|
|
438
|
-
this._selectedElements.length !== 0 && (this.resetColor(this._selectedElements), this._selectedElements = []);
|
|
438
|
+
this._selectedElements.length !== 0 && (this._setSelectionAlpha(this._selectedElements, 1), this.resetColor(this._selectedElements), this._selectedElements = []);
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Set alpha value for elements (used for selection marking)
|
|
442
|
+
* This is VERY fast - only updates alpha channel, no geometry copying
|
|
443
|
+
*
|
|
444
|
+
* When setting alpha to 1.0 (removing selection), respects hidden/isolated state
|
|
445
|
+
*/
|
|
446
|
+
_setSelectionAlpha(e, t) {
|
|
447
|
+
var s;
|
|
448
|
+
if (!this._colors)
|
|
449
|
+
return;
|
|
450
|
+
const i = this.geometry.getAttribute("color");
|
|
451
|
+
if (i.itemSize === 4) {
|
|
452
|
+
for (const { modelId: n, elementId: r } of e) {
|
|
453
|
+
const o = (s = this._elementMap.get(n)) == null ? void 0 : s.get(r);
|
|
454
|
+
if (!o)
|
|
455
|
+
continue;
|
|
456
|
+
let a = t;
|
|
457
|
+
if (t === 1) {
|
|
458
|
+
const l = `${n}:${r}`, c = this._elementOpacityMap.get(l);
|
|
459
|
+
c !== void 0 ? a = c : this._isolatedSet.size > 0 ? a = this._isolatedSet.has(l) ? 1 : 0 : this._hiddenSet.has(l) && (a = 0);
|
|
460
|
+
}
|
|
461
|
+
for (const l of o)
|
|
462
|
+
for (let c = 0; c < l.count; c++) {
|
|
463
|
+
const h = (l.start + c) * 4 + 3;
|
|
464
|
+
this._colors[h] = a;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
i.needsUpdate = !0;
|
|
468
|
+
}
|
|
439
469
|
}
|
|
440
470
|
//#endregion
|
|
441
471
|
//#region Hide/Isolate/Show
|
|
@@ -617,7 +647,7 @@ class Z extends x {
|
|
|
617
647
|
*/
|
|
618
648
|
_createDepthPrePass() {
|
|
619
649
|
this._removeDepthPrePass();
|
|
620
|
-
const e = this.material, t = new
|
|
650
|
+
const e = this.material, t = new Y({
|
|
621
651
|
vertexColors: !0,
|
|
622
652
|
transparent: !0,
|
|
623
653
|
alphaTest: 0.5,
|
|
@@ -956,8 +986,8 @@ class Z extends x {
|
|
|
956
986
|
n && e.push(n);
|
|
957
987
|
}
|
|
958
988
|
});
|
|
959
|
-
const t =
|
|
960
|
-
t && !this._pointLight && (this._pointLight = new
|
|
989
|
+
const t = D.getCenterPoint(e), i = this.getFarthestDistance(t, e);
|
|
990
|
+
t && !this._pointLight && (this._pointLight = new Ft(16562741, 1, i, 0.1), this._pointLight.position.copy(t), this.add(this._pointLight)), this._isGeneratedLights = !0;
|
|
961
991
|
}
|
|
962
992
|
this._pointLight && (this._pointLight.visible = !0);
|
|
963
993
|
}
|
|
@@ -992,7 +1022,7 @@ class Z extends x {
|
|
|
992
1022
|
);
|
|
993
1023
|
if (t.length === 0)
|
|
994
1024
|
return null;
|
|
995
|
-
const i = new
|
|
1025
|
+
const i = new F(), s = new E();
|
|
996
1026
|
for (const n of t)
|
|
997
1027
|
if (n.buffer)
|
|
998
1028
|
for (let r = 0; r < n.buffer.length; r += 3)
|
|
@@ -1043,7 +1073,7 @@ class Z extends x {
|
|
|
1043
1073
|
o,
|
|
1044
1074
|
100
|
|
1045
1075
|
// Process 100 elements at a time
|
|
1046
|
-
), l = new
|
|
1076
|
+
), l = new ee(
|
|
1047
1077
|
void 0,
|
|
1048
1078
|
Array.isArray(this.material) ? this.material[0] : this.material,
|
|
1049
1079
|
this.workerPool
|
|
@@ -1086,12 +1116,12 @@ class Z extends x {
|
|
|
1086
1116
|
}), 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
1117
|
}
|
|
1088
1118
|
}
|
|
1089
|
-
let
|
|
1090
|
-
class
|
|
1119
|
+
let Ki = 1;
|
|
1120
|
+
class Nt {
|
|
1091
1121
|
constructor(e) {
|
|
1092
1122
|
this._worker = new Worker(e), this._worker.onmessage = (t) => {
|
|
1093
1123
|
this._OnMessage(t);
|
|
1094
|
-
}, this._resolve = null, this._id =
|
|
1124
|
+
}, this._resolve = null, this._id = Ki++;
|
|
1095
1125
|
}
|
|
1096
1126
|
_OnMessage(e) {
|
|
1097
1127
|
const t = this._resolve;
|
|
@@ -1107,14 +1137,14 @@ class Bt {
|
|
|
1107
1137
|
this._worker.terminate();
|
|
1108
1138
|
}
|
|
1109
1139
|
}
|
|
1110
|
-
class
|
|
1140
|
+
class oe {
|
|
1111
1141
|
/**
|
|
1112
1142
|
*
|
|
1113
1143
|
* @param maxSize maximum number of worker
|
|
1114
1144
|
* @param scriptPath javascript path for worker execute
|
|
1115
1145
|
*/
|
|
1116
1146
|
constructor(e, t) {
|
|
1117
|
-
this._workers = [], this.maximumNumberOfWorker = e, this.scriptPath = t, this._workers.push(new
|
|
1147
|
+
this._workers = [], this.maximumNumberOfWorker = e, this.scriptPath = t, this._workers.push(new Nt(t)), this._free = [...this._workers], this._busy = {}, this._queue = [];
|
|
1118
1148
|
}
|
|
1119
1149
|
get length() {
|
|
1120
1150
|
return this._workers.length;
|
|
@@ -1133,7 +1163,7 @@ class ee {
|
|
|
1133
1163
|
_PumpQueue() {
|
|
1134
1164
|
for (; this._queue.length > 0; ) {
|
|
1135
1165
|
if (this._free.length == 0 && this._workers.length < this.maximumNumberOfWorker) {
|
|
1136
|
-
const s = new
|
|
1166
|
+
const s = new Nt(this.scriptPath);
|
|
1137
1167
|
this._workers.push(s), this._free.push(s);
|
|
1138
1168
|
}
|
|
1139
1169
|
if (this._free.length == 0)
|
|
@@ -1150,7 +1180,7 @@ class ee {
|
|
|
1150
1180
|
this._workers.forEach((e) => e.dispose()), this._workers = [], this._free = [], this._busy = {}, this._queue = [];
|
|
1151
1181
|
}
|
|
1152
1182
|
}
|
|
1153
|
-
const
|
|
1183
|
+
const Ji = D.hexToRGB(y.secondary), qe = class qe extends Wt {
|
|
1154
1184
|
constructor(e) {
|
|
1155
1185
|
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);
|
|
1156
1186
|
}
|
|
@@ -1191,26 +1221,28 @@ const Xi = R.hexToRGB(y.accent), We = class We extends jt {
|
|
|
1191
1221
|
);
|
|
1192
1222
|
}
|
|
1193
1223
|
_createInstancedMesh(e, t, i) {
|
|
1194
|
-
const s = this._createGeometryFromBuffer(e.buffer), n = new
|
|
1195
|
-
t.forEach(({ element:
|
|
1196
|
-
const
|
|
1197
|
-
n.setMatrixAt(
|
|
1198
|
-
const
|
|
1199
|
-
this._originalTransforms.has(
|
|
1200
|
-
const
|
|
1201
|
-
r[
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1224
|
+
const s = this._createGeometryFromBuffer(e.buffer), n = new pe(s, this.material, t.length), r = new Float32Array(t.length * 3);
|
|
1225
|
+
t.forEach(({ element: l, instanceData: c }, h) => {
|
|
1226
|
+
const d = this._transformArrayToMatrix4(c.transform);
|
|
1227
|
+
n.setMatrixAt(h, d);
|
|
1228
|
+
const u = l.modelId.toString(), p = c.elementId;
|
|
1229
|
+
this._originalTransforms.has(u) || this._originalTransforms.set(u, /* @__PURE__ */ new Map()), this._originalTransforms.get(u).set(p, d.clone());
|
|
1230
|
+
const m = this._originalColor || new N(1, 1, 1);
|
|
1231
|
+
r[h * 3] = m.r, r[h * 3 + 1] = m.g, r[h * 3 + 2] = m.b, this._elementMap.has(u) || this._elementMap.set(u, /* @__PURE__ */ new Map());
|
|
1232
|
+
const f = this._elementMap.get(u);
|
|
1233
|
+
f.has(p) || f.set(p, []), f.get(p).push({
|
|
1204
1234
|
geometryKey: i,
|
|
1205
|
-
instanceIndex:
|
|
1235
|
+
instanceIndex: h,
|
|
1206
1236
|
instancedMesh: n
|
|
1207
1237
|
});
|
|
1208
|
-
}), n.instanceColor = new
|
|
1238
|
+
}), n.instanceColor = new Fe(r, 3), n.instanceMatrix.needsUpdate = !0;
|
|
1209
1239
|
const o = new Float32Array(t.length);
|
|
1210
|
-
|
|
1240
|
+
o.fill(1), s.setAttribute("instanceOpacity", new Fe(o, 1));
|
|
1241
|
+
const a = new Float32Array(t.length);
|
|
1242
|
+
return a.fill(0), s.setAttribute("instanceSelected", new Fe(a, 1)), this.material && "vertexColors" in this.material && (this.material.vertexColors = !0, this.material.needsUpdate = !0), n;
|
|
1211
1243
|
}
|
|
1212
1244
|
_createGeometryFromBuffer(e) {
|
|
1213
|
-
const t = new
|
|
1245
|
+
const t = new he();
|
|
1214
1246
|
t.setAttribute("position", new z(e, 3));
|
|
1215
1247
|
const i = e.length / 3, s = Math.floor(i / 3), n = new Uint32Array(s * 3);
|
|
1216
1248
|
for (let o = 0; o < s; o++) {
|
|
@@ -1229,9 +1261,9 @@ const Xi = R.hexToRGB(y.accent), We = class We extends jt {
|
|
|
1229
1261
|
}
|
|
1230
1262
|
_transformArrayToMatrix4(e) {
|
|
1231
1263
|
if (e.length === 16)
|
|
1232
|
-
return new
|
|
1264
|
+
return new ce().fromArray(e);
|
|
1233
1265
|
if (e.length === 12) {
|
|
1234
|
-
const t = new
|
|
1266
|
+
const t = new ce();
|
|
1235
1267
|
return t.set(
|
|
1236
1268
|
e[0],
|
|
1237
1269
|
e[1],
|
|
@@ -1251,7 +1283,7 @@ const Xi = R.hexToRGB(y.accent), We = class We extends jt {
|
|
|
1251
1283
|
1
|
|
1252
1284
|
), t;
|
|
1253
1285
|
} else
|
|
1254
|
-
return console.warn("Unsupported transform array length:", e.length), new
|
|
1286
|
+
return console.warn("Unsupported transform array length:", e.length), new ce().identity();
|
|
1255
1287
|
}
|
|
1256
1288
|
_generateGeometryKey(e) {
|
|
1257
1289
|
let t = e.length.toString();
|
|
@@ -1267,10 +1299,29 @@ const Xi = R.hexToRGB(y.accent), We = class We extends jt {
|
|
|
1267
1299
|
}
|
|
1268
1300
|
//#region Selection and Color Control
|
|
1269
1301
|
select(e, t = []) {
|
|
1270
|
-
this.unselect(), this._selectedElements = e, this.changeColor(this._selectedElements,
|
|
1302
|
+
this.unselect(), this._selectedElements = e, this.changeColor(this._selectedElements, Ji), this._setInstanceSelection(this._selectedElements, 1);
|
|
1271
1303
|
}
|
|
1272
1304
|
unselect() {
|
|
1273
|
-
this._selectedElements.length > 0 && (this.resetColor(this._selectedElements), this._selectedElements = []);
|
|
1305
|
+
this._selectedElements.length > 0 && (this._setInstanceSelection(this._selectedElements, 0), this.resetColor(this._selectedElements), this._selectedElements = []);
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Set instance selection state for fast outline detection
|
|
1309
|
+
* @param elements - Elements to set selection for
|
|
1310
|
+
* @param selected - 1.0 = selected, 0.0 = not selected
|
|
1311
|
+
*/
|
|
1312
|
+
_setInstanceSelection(e, t) {
|
|
1313
|
+
var i;
|
|
1314
|
+
this._ensureSelectionAttributes();
|
|
1315
|
+
for (const { modelId: s, elementId: n } of e) {
|
|
1316
|
+
const r = (i = this._elementMap.get(s)) == null ? void 0 : i.get(n);
|
|
1317
|
+
if (r)
|
|
1318
|
+
for (const { instancedMesh: o, instanceIndex: a } of r) {
|
|
1319
|
+
const l = o.geometry.getAttribute(
|
|
1320
|
+
"instanceSelected"
|
|
1321
|
+
);
|
|
1322
|
+
l && (l.array[a] = t, l.needsUpdate = !0);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1274
1325
|
}
|
|
1275
1326
|
/**
|
|
1276
1327
|
* Changes the color of multiple elements.
|
|
@@ -1394,7 +1445,7 @@ const Xi = R.hexToRGB(y.accent), We = class We extends jt {
|
|
|
1394
1445
|
var r;
|
|
1395
1446
|
const n = (r = this._elementMap.get(i)) == null ? void 0 : r.get(s);
|
|
1396
1447
|
n && n.forEach(({ instancedMesh: o, instanceIndex: a }) => {
|
|
1397
|
-
o.setMatrixAt(a,
|
|
1448
|
+
o.setMatrixAt(a, qe.ZERO_MATRIX), o.instanceMatrix.needsUpdate = !0;
|
|
1398
1449
|
});
|
|
1399
1450
|
}));
|
|
1400
1451
|
}
|
|
@@ -1412,7 +1463,7 @@ const Xi = R.hexToRGB(y.accent), We = class We extends jt {
|
|
|
1412
1463
|
this._isolatedSet.add(s);
|
|
1413
1464
|
}), this._isolatingElements = [...t], this._isolatedSet.size === 0 ? (this.visible = !1, this._isolatingElements) : (this._instancedMeshes.forEach((i) => {
|
|
1414
1465
|
for (let s = 0; s < i.count; s++)
|
|
1415
|
-
i.setMatrixAt(s,
|
|
1466
|
+
i.setMatrixAt(s, qe.ZERO_MATRIX);
|
|
1416
1467
|
i.instanceMatrix.needsUpdate = !0;
|
|
1417
1468
|
}), t.forEach(({ modelId: i, elementId: s }) => {
|
|
1418
1469
|
var o, a;
|
|
@@ -1482,7 +1533,10 @@ const Xi = R.hexToRGB(y.accent), We = class We extends jt {
|
|
|
1482
1533
|
//#endregion
|
|
1483
1534
|
//#region Opacity Control (Per-Instance Transparency)
|
|
1484
1535
|
/**
|
|
1485
|
-
* Inject per-instance opacity shader into material
|
|
1536
|
+
* Inject per-instance opacity and selection shader into material
|
|
1537
|
+
* Enables:
|
|
1538
|
+
* - Per-instance opacity (ghosting, hiding)
|
|
1539
|
+
* - Selection alpha marker (for fast outline detection via AlphaSelectionOutlinePass)
|
|
1486
1540
|
* Must be called after material is set and before rendering
|
|
1487
1541
|
*/
|
|
1488
1542
|
injectOpacityShader() {
|
|
@@ -1494,19 +1548,28 @@ const Xi = R.hexToRGB(y.accent), We = class We extends jt {
|
|
|
1494
1548
|
"#include <common>",
|
|
1495
1549
|
`#include <common>
|
|
1496
1550
|
attribute float instanceOpacity;
|
|
1497
|
-
|
|
1551
|
+
attribute float instanceSelected;
|
|
1552
|
+
varying float vInstanceOpacity;
|
|
1553
|
+
varying float vInstanceSelected;`
|
|
1498
1554
|
), t.vertexShader = t.vertexShader.replace(
|
|
1499
1555
|
"#include <begin_vertex>",
|
|
1500
1556
|
`#include <begin_vertex>
|
|
1501
|
-
vInstanceOpacity = instanceOpacity
|
|
1557
|
+
vInstanceOpacity = instanceOpacity;
|
|
1558
|
+
vInstanceSelected = instanceSelected;`
|
|
1502
1559
|
), t.fragmentShader = t.fragmentShader.replace(
|
|
1503
1560
|
"#include <common>",
|
|
1504
1561
|
`#include <common>
|
|
1505
|
-
varying float vInstanceOpacity
|
|
1562
|
+
varying float vInstanceOpacity;
|
|
1563
|
+
varying float vInstanceSelected;`
|
|
1506
1564
|
), t.fragmentShader = t.fragmentShader.replace(
|
|
1507
1565
|
"#include <dithering_fragment>",
|
|
1508
1566
|
`#include <dithering_fragment>
|
|
1567
|
+
// Apply per-instance opacity
|
|
1509
1568
|
gl_FragColor.a *= vInstanceOpacity;
|
|
1569
|
+
// If selected, set alpha to SELECTION_ALPHA (0.99) for outline detection
|
|
1570
|
+
if (vInstanceSelected > 0.5) {
|
|
1571
|
+
gl_FragColor.a = 0.99;
|
|
1572
|
+
}
|
|
1510
1573
|
if (gl_FragColor.a < 0.01) discard;`
|
|
1511
1574
|
);
|
|
1512
1575
|
}, e._opacityInjected = !0, e.needsUpdate = !0);
|
|
@@ -1519,11 +1582,25 @@ if (gl_FragColor.a < 0.01) discard;`
|
|
|
1519
1582
|
if (!e.geometry.getAttribute("instanceOpacity")) {
|
|
1520
1583
|
const t = new Float32Array(e.count);
|
|
1521
1584
|
t.fill(1);
|
|
1522
|
-
const i = new
|
|
1585
|
+
const i = new Fe(t, 1);
|
|
1523
1586
|
e.geometry.setAttribute("instanceOpacity", i);
|
|
1524
1587
|
}
|
|
1525
1588
|
});
|
|
1526
1589
|
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Ensure all instanced meshes have selection attribute
|
|
1592
|
+
* Used for fast outline detection via AlphaSelectionOutlinePass
|
|
1593
|
+
*/
|
|
1594
|
+
_ensureSelectionAttributes() {
|
|
1595
|
+
this._instancedMeshes.forEach((e) => {
|
|
1596
|
+
if (!e.geometry.getAttribute("instanceSelected")) {
|
|
1597
|
+
const t = new Float32Array(e.count);
|
|
1598
|
+
t.fill(0);
|
|
1599
|
+
const i = new Fe(t, 1);
|
|
1600
|
+
e.geometry.setAttribute("instanceSelected", i);
|
|
1601
|
+
}
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1527
1604
|
/**
|
|
1528
1605
|
* Update opacity for specific instances
|
|
1529
1606
|
*/
|
|
@@ -1598,7 +1675,7 @@ if (gl_FragColor.a < 0.01) discard;`
|
|
|
1598
1675
|
*/
|
|
1599
1676
|
_createDepthPrePass() {
|
|
1600
1677
|
this._removeDepthPrePass(), this._instancedMeshes.forEach((e) => {
|
|
1601
|
-
const t = e.material, i = new
|
|
1678
|
+
const t = e.material, i = new Y({
|
|
1602
1679
|
colorWrite: !1,
|
|
1603
1680
|
depthWrite: !0,
|
|
1604
1681
|
side: t == null ? void 0 : t.side
|
|
@@ -1623,7 +1700,7 @@ varying float vInstanceOpacity;`
|
|
|
1623
1700
|
if (vInstanceOpacity < 0.5) discard;`
|
|
1624
1701
|
);
|
|
1625
1702
|
}, i.needsUpdate = !0;
|
|
1626
|
-
const s = new
|
|
1703
|
+
const s = new pe(
|
|
1627
1704
|
e.geometry,
|
|
1628
1705
|
i,
|
|
1629
1706
|
e.count
|
|
@@ -1758,7 +1835,7 @@ if (vInstanceOpacity < 0.5) discard;`
|
|
|
1758
1835
|
r.length * o
|
|
1759
1836
|
);
|
|
1760
1837
|
for (let c = 0; c < o; c++) {
|
|
1761
|
-
const h = new
|
|
1838
|
+
const h = new ce();
|
|
1762
1839
|
e.getMatrixAt(c, h);
|
|
1763
1840
|
const d = c * r.length;
|
|
1764
1841
|
for (let u = 0; u < r.length; u += 3) {
|
|
@@ -1770,9 +1847,9 @@ if (vInstanceOpacity < 0.5) discard;`
|
|
|
1770
1847
|
p.applyMatrix4(h), a[d + u] = p.x, a[d + u + 1] = p.y, a[d + u + 2] = p.z;
|
|
1771
1848
|
}
|
|
1772
1849
|
}
|
|
1773
|
-
const l = new
|
|
1850
|
+
const l = new Yt();
|
|
1774
1851
|
if (l.setPositions(a), this._edgeMaterial) {
|
|
1775
|
-
const c = new
|
|
1852
|
+
const c = new Xt(l, this._edgeMaterial);
|
|
1776
1853
|
this.add(c), this._edgeLines.set(t, c);
|
|
1777
1854
|
}
|
|
1778
1855
|
}
|
|
@@ -1802,7 +1879,7 @@ if (vInstanceOpacity < 0.5) discard;`
|
|
|
1802
1879
|
* Custom raycast function for instanced meshes
|
|
1803
1880
|
*/
|
|
1804
1881
|
_instancedRaycast(e, t, i) {
|
|
1805
|
-
const s =
|
|
1882
|
+
const s = pe.prototype.raycast, n = [];
|
|
1806
1883
|
s.call(e, t, n), n.forEach((r) => {
|
|
1807
1884
|
if (r.instanceId !== void 0) {
|
|
1808
1885
|
const o = this.findElementByInstancedMeshAndIndex(
|
|
@@ -1853,15 +1930,15 @@ if (vInstanceOpacity < 0.5) discard;`
|
|
|
1853
1930
|
}
|
|
1854
1931
|
getElementBoxs(e) {
|
|
1855
1932
|
var s;
|
|
1856
|
-
const t = new
|
|
1933
|
+
const t = new F();
|
|
1857
1934
|
let i = !1;
|
|
1858
1935
|
for (const n of e) {
|
|
1859
1936
|
const r = (s = this._elementMap.get(n.modelId)) == null ? void 0 : s.get(n.elementId);
|
|
1860
1937
|
if (!(!r || r.length === 0))
|
|
1861
1938
|
for (const { instancedMesh: o, instanceIndex: a } of r) {
|
|
1862
|
-
const l = new
|
|
1939
|
+
const l = new ce();
|
|
1863
1940
|
o.getMatrixAt(a, l);
|
|
1864
|
-
const c = new
|
|
1941
|
+
const c = new F().setFromBufferAttribute(
|
|
1865
1942
|
o.geometry.getAttribute("position")
|
|
1866
1943
|
);
|
|
1867
1944
|
c.applyMatrix4(l), t.union(c), i = !0;
|
|
@@ -1893,8 +1970,8 @@ if (vInstanceOpacity < 0.5) discard;`
|
|
|
1893
1970
|
n && e.push(n);
|
|
1894
1971
|
}
|
|
1895
1972
|
});
|
|
1896
|
-
const t =
|
|
1897
|
-
t && !this._pointLight && (this._pointLight = new
|
|
1973
|
+
const t = D.getCenterPoint(e), i = this.getFarthestDistance(t, e);
|
|
1974
|
+
t && !this._pointLight && (this._pointLight = new Ft(16562741, 1, i, 0.1), this._pointLight.position.copy(t), this.add(this._pointLight)), this._isGeneratedLights = !0;
|
|
1898
1975
|
}
|
|
1899
1976
|
this._pointLight && (this._pointLight.visible = !0);
|
|
1900
1977
|
}
|
|
@@ -1930,9 +2007,9 @@ if (vInstanceOpacity < 0.5) discard;`
|
|
|
1930
2007
|
}
|
|
1931
2008
|
//#endregion
|
|
1932
2009
|
};
|
|
1933
|
-
|
|
1934
|
-
let
|
|
1935
|
-
const
|
|
2010
|
+
qe.ZERO_MATRIX = new ce().makeScale(0, 0, 0);
|
|
2011
|
+
let me = qe;
|
|
2012
|
+
const es = `
|
|
1936
2013
|
// Web Worker code as string (to be created as blob URL)
|
|
1937
2014
|
self.onmessage = function(e) {
|
|
1938
2015
|
const {
|
|
@@ -2046,16 +2123,16 @@ self.onmessage = function(e) {
|
|
|
2046
2123
|
}
|
|
2047
2124
|
};
|
|
2048
2125
|
`;
|
|
2049
|
-
class
|
|
2126
|
+
class ts extends x {
|
|
2050
2127
|
constructor() {
|
|
2051
2128
|
super(), this.workerPool = null, this.bimModels = [], this.isReady = !1, this._batchedMeshes = [], this._instancedMeshes = [], this._isolatingElements = [], this._initializeWorkerPool(4);
|
|
2052
2129
|
}
|
|
2053
2130
|
_initializeWorkerPool(e) {
|
|
2054
2131
|
try {
|
|
2055
|
-
const t = new Blob([
|
|
2132
|
+
const t = new Blob([es], {
|
|
2056
2133
|
type: "application/javascript"
|
|
2057
2134
|
}), i = URL.createObjectURL(t);
|
|
2058
|
-
this.workerPool = new
|
|
2135
|
+
this.workerPool = new oe(
|
|
2059
2136
|
e || navigator.hardwareConcurrency || 4,
|
|
2060
2137
|
i
|
|
2061
2138
|
), console.log(
|
|
@@ -2067,9 +2144,9 @@ class Ji extends x {
|
|
|
2067
2144
|
}
|
|
2068
2145
|
get bounds() {
|
|
2069
2146
|
try {
|
|
2070
|
-
return new
|
|
2147
|
+
return new F().setFromObject(this);
|
|
2071
2148
|
} catch {
|
|
2072
|
-
return new
|
|
2149
|
+
return new F();
|
|
2073
2150
|
}
|
|
2074
2151
|
}
|
|
2075
2152
|
setReady(e) {
|
|
@@ -2092,8 +2169,8 @@ class Ji extends x {
|
|
|
2092
2169
|
* Get diagnostic info about merged model structure
|
|
2093
2170
|
*/
|
|
2094
2171
|
getDiagnostics() {
|
|
2095
|
-
const e = this.children.filter((s) => s instanceof
|
|
2096
|
-
(s) => s instanceof
|
|
2172
|
+
const e = this.children.filter((s) => s instanceof ee).length, t = this.children.filter(
|
|
2173
|
+
(s) => s instanceof me
|
|
2097
2174
|
).length;
|
|
2098
2175
|
let i = 0;
|
|
2099
2176
|
return this._batchedMeshes.forEach((s) => {
|
|
@@ -2119,9 +2196,9 @@ class Ji extends x {
|
|
|
2119
2196
|
}
|
|
2120
2197
|
hide(e) {
|
|
2121
2198
|
this._batchedMeshes.forEach((t) => {
|
|
2122
|
-
t.hide(e)
|
|
2199
|
+
t.hide(e);
|
|
2123
2200
|
}), this._instancedMeshes.forEach((t) => {
|
|
2124
|
-
t.hide(e)
|
|
2201
|
+
t.hide(e);
|
|
2125
2202
|
});
|
|
2126
2203
|
}
|
|
2127
2204
|
isolate(e) {
|
|
@@ -2234,7 +2311,7 @@ class Ji extends x {
|
|
|
2234
2311
|
return null;
|
|
2235
2312
|
const n = new Float32Array(s);
|
|
2236
2313
|
let r = 0;
|
|
2237
|
-
const o = new
|
|
2314
|
+
const o = new ce(), a = new E();
|
|
2238
2315
|
for (const l of i)
|
|
2239
2316
|
if (l.buffer)
|
|
2240
2317
|
if (l.instances && l.instances.length > 0)
|
|
@@ -2272,7 +2349,7 @@ class Ji extends x {
|
|
|
2272
2349
|
}), this._instancedMeshes.forEach((i) => {
|
|
2273
2350
|
const s = i.getElementBoxs(e);
|
|
2274
2351
|
s && t.push(s);
|
|
2275
|
-
}),
|
|
2352
|
+
}), D.mergeBoundingBoxes(t);
|
|
2276
2353
|
}
|
|
2277
2354
|
/**
|
|
2278
2355
|
* reset visibility/ geometries only not reset color
|
|
@@ -2354,67 +2431,67 @@ class Ji extends x {
|
|
|
2354
2431
|
this.isReady = !1, this._batchedMeshes.forEach((e) => e.dispose()), this._batchedMeshes = [], this._instancedMeshes.forEach((e) => e.dispose()), this._instancedMeshes = [], this.children = [];
|
|
2355
2432
|
}
|
|
2356
2433
|
}
|
|
2357
|
-
class
|
|
2434
|
+
class gr {
|
|
2358
2435
|
constructor() {
|
|
2359
2436
|
this.MaterialIndex = 0, this.Vertices = [], this.Indices = [], this.Name = "", this.Instances = [];
|
|
2360
2437
|
}
|
|
2361
2438
|
}
|
|
2362
|
-
class
|
|
2439
|
+
class fr {
|
|
2363
2440
|
constructor() {
|
|
2364
2441
|
this.MaterialIndex = 0, this.Elements = [];
|
|
2365
2442
|
}
|
|
2366
2443
|
}
|
|
2367
|
-
class
|
|
2444
|
+
class vr {
|
|
2368
2445
|
constructor() {
|
|
2369
2446
|
this.Vertices = [], this.Indices = [], this.Instances = [], this.Id = "";
|
|
2370
2447
|
}
|
|
2371
2448
|
}
|
|
2372
|
-
class
|
|
2449
|
+
class br {
|
|
2373
2450
|
constructor() {
|
|
2374
2451
|
this.Vertices = [], this.Indices = [], this.Transform = null;
|
|
2375
2452
|
}
|
|
2376
2453
|
}
|
|
2377
|
-
class
|
|
2454
|
+
class wr {
|
|
2378
2455
|
constructor() {
|
|
2379
2456
|
this.buffer = null, this.instances = [];
|
|
2380
2457
|
}
|
|
2381
2458
|
}
|
|
2382
|
-
class
|
|
2459
|
+
class yr {
|
|
2383
2460
|
constructor() {
|
|
2384
2461
|
this.Solids = [], this.Id = "", this.Instances = [];
|
|
2385
2462
|
}
|
|
2386
2463
|
}
|
|
2387
|
-
class
|
|
2464
|
+
class xr {
|
|
2388
2465
|
constructor() {
|
|
2389
|
-
this.Materials = [], this.Elements = [], this.Camera = new
|
|
2466
|
+
this.Materials = [], this.Elements = [], this.Camera = new Jt();
|
|
2390
2467
|
}
|
|
2391
2468
|
}
|
|
2392
|
-
class
|
|
2469
|
+
class Mr {
|
|
2393
2470
|
constructor() {
|
|
2394
2471
|
this.MaterialIndex = 0, this.Vertices = [], this.Indices = [], this.Buffer = [];
|
|
2395
2472
|
}
|
|
2396
2473
|
}
|
|
2397
|
-
class
|
|
2474
|
+
class Jt {
|
|
2398
2475
|
constructor() {
|
|
2399
|
-
this.scale = 0, this.origin = new
|
|
2476
|
+
this.scale = 0, this.origin = new de(), this.eyePosition = new de(), this.upDirection = new de(), this.forwardDirection = new de(), this.target = new de(), this.box = new is();
|
|
2400
2477
|
}
|
|
2401
2478
|
}
|
|
2402
|
-
class
|
|
2479
|
+
class is {
|
|
2403
2480
|
constructor() {
|
|
2404
|
-
this.min = new
|
|
2481
|
+
this.min = new de(), this.max = new de();
|
|
2405
2482
|
}
|
|
2406
2483
|
}
|
|
2407
|
-
class
|
|
2484
|
+
class Er {
|
|
2408
2485
|
constructor() {
|
|
2409
|
-
this.Data = {}, this.CameraData = new
|
|
2486
|
+
this.Data = {}, this.CameraData = new Jt(), this.Translation = [];
|
|
2410
2487
|
}
|
|
2411
2488
|
}
|
|
2412
|
-
class
|
|
2489
|
+
class de {
|
|
2413
2490
|
constructor() {
|
|
2414
2491
|
this.X = 0, this.Y = 0, this.Z = 0;
|
|
2415
2492
|
}
|
|
2416
2493
|
}
|
|
2417
|
-
const
|
|
2494
|
+
const ss = {
|
|
2418
2495
|
enabled: !0,
|
|
2419
2496
|
castShadow: !0,
|
|
2420
2497
|
intensity: 5,
|
|
@@ -2425,7 +2502,7 @@ const ts = {
|
|
|
2425
2502
|
indirectLightIntensity: 1.2,
|
|
2426
2503
|
shadowcatcher: !0
|
|
2427
2504
|
};
|
|
2428
|
-
function
|
|
2505
|
+
function ns() {
|
|
2429
2506
|
function g(i) {
|
|
2430
2507
|
let s = 0;
|
|
2431
2508
|
for (let n = 0; n < i.length; n++)
|
|
@@ -2455,25 +2532,25 @@ function is() {
|
|
|
2455
2532
|
for (let v = 0; v < a; v++)
|
|
2456
2533
|
i.forEach((b) => {
|
|
2457
2534
|
const w = u.get(b.id);
|
|
2458
|
-
w.vx = 0, w.vy = 0, i.forEach((
|
|
2459
|
-
if (b.id ===
|
|
2535
|
+
w.vx = 0, w.vy = 0, i.forEach((S) => {
|
|
2536
|
+
if (b.id === S.id)
|
|
2460
2537
|
return;
|
|
2461
|
-
const A = u.get(
|
|
2462
|
-
w.vx +=
|
|
2538
|
+
const A = u.get(S.id), C = w.x - A.x, _ = w.y - A.y, I = C * C + _ * _, T = Math.sqrt(I) || 1, M = d * d / T;
|
|
2539
|
+
w.vx += C / T * M, w.vy += _ / T * M;
|
|
2463
2540
|
});
|
|
2464
2541
|
}), s.forEach((b) => {
|
|
2465
|
-
const w = String(b.source),
|
|
2466
|
-
if (!A || !
|
|
2542
|
+
const w = String(b.source), S = String(b.target), A = u.get(w), C = u.get(S);
|
|
2543
|
+
if (!A || !C)
|
|
2467
2544
|
return;
|
|
2468
|
-
const _ = A.x -
|
|
2469
|
-
A.vx -=
|
|
2545
|
+
const _ = A.x - C.x, I = A.y - C.y, T = Math.sqrt(_ * _ + I * I) || 1, M = T * T / d, V = _ / T * M, L = I / T * M;
|
|
2546
|
+
A.vx -= V, A.vy -= L, C.vx += V, C.vy += L;
|
|
2470
2547
|
}), i.forEach((b) => {
|
|
2471
|
-
const w = u.get(b.id),
|
|
2472
|
-
if (w.x += w.vx /
|
|
2473
|
-
const
|
|
2474
|
-
if (Math.sqrt(T * T + M * M) >
|
|
2475
|
-
const
|
|
2476
|
-
w.x =
|
|
2548
|
+
const w = u.get(b.id), S = Math.sqrt(w.vx * w.vx + w.vy * w.vy) || 1, A = Math.min(S, p);
|
|
2549
|
+
if (w.x += w.vx / S * A, w.y += w.vy / S * A, l === "circular") {
|
|
2550
|
+
const C = r / 2, _ = o / 2, I = Math.min(r, o) / 2, T = w.x - C, M = w.y - _;
|
|
2551
|
+
if (Math.sqrt(T * T + M * M) > I) {
|
|
2552
|
+
const L = Math.atan2(M, T);
|
|
2553
|
+
w.x = C + I * Math.cos(L), w.y = _ + I * Math.sin(L);
|
|
2477
2554
|
}
|
|
2478
2555
|
} else
|
|
2479
2556
|
w.x = Math.max(0, Math.min(r, w.x)), w.y = Math.max(0, Math.min(o, w.y));
|
|
@@ -2507,11 +2584,11 @@ function is() {
|
|
|
2507
2584
|
}
|
|
2508
2585
|
};
|
|
2509
2586
|
}
|
|
2510
|
-
const
|
|
2511
|
-
class
|
|
2587
|
+
const rs = ns;
|
|
2588
|
+
class as {
|
|
2512
2589
|
constructor() {
|
|
2513
|
-
const e = new Blob([`(${
|
|
2514
|
-
this.workerPool = new
|
|
2590
|
+
const e = new Blob([`(${rs})()`]), t = URL.createObjectURL(e);
|
|
2591
|
+
this.workerPool = new oe(2, t);
|
|
2515
2592
|
}
|
|
2516
2593
|
computeLayout(e, t, i, s) {
|
|
2517
2594
|
const n = {
|
|
@@ -2530,7 +2607,7 @@ class ns {
|
|
|
2530
2607
|
this.workerPool.dispose();
|
|
2531
2608
|
}
|
|
2532
2609
|
}
|
|
2533
|
-
class
|
|
2610
|
+
class os {
|
|
2534
2611
|
constructor(e, t) {
|
|
2535
2612
|
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 = {
|
|
2536
2613
|
ON_LEVEL: "HAS_ELEMENT",
|
|
@@ -2798,19 +2875,19 @@ class rs {
|
|
|
2798
2875
|
}), l("Building edges", n, n);
|
|
2799
2876
|
const d = [];
|
|
2800
2877
|
this._elementMap.forEach((f, v) => {
|
|
2801
|
-
var w,
|
|
2802
|
-
if (a++, (!(f != null && f.Category) || !((w = f.Category) != null && w.value) || f.Category.value == null) && (!(f != null && f.ObjectType) || !((
|
|
2878
|
+
var w, S, A, C, _;
|
|
2879
|
+
if (a++, (!(f != null && f.Category) || !((w = f.Category) != null && w.value) || f.Category.value == null) && (!(f != null && f.ObjectType) || !((S = f.ObjectType) != null && S.value) || f.ObjectType.value == null) || !h.has(v))
|
|
2803
2880
|
return;
|
|
2804
2881
|
const b = ((A = f == null ? void 0 : f.Name) == null ? void 0 : A.value) || v.toString();
|
|
2805
2882
|
d.push({
|
|
2806
2883
|
id: String(v),
|
|
2807
2884
|
label: b,
|
|
2808
|
-
group: ((
|
|
2885
|
+
group: ((C = f == null ? void 0 : f.Category) == null ? void 0 : C.value) || ((_ = f == null ? void 0 : f.ObjectType) == null ? void 0 : _.value)
|
|
2809
2886
|
});
|
|
2810
2887
|
}), l("Building nodes", d.length, d.length);
|
|
2811
2888
|
const u = d.map((f) => f.id), p = this._calculateNodeLevels(c, u);
|
|
2812
2889
|
a += r, l("Calculating levels", d.length, d.length);
|
|
2813
|
-
const m = new
|
|
2890
|
+
const m = new as();
|
|
2814
2891
|
l(
|
|
2815
2892
|
"Computing layout",
|
|
2816
2893
|
0,
|
|
@@ -2818,12 +2895,12 @@ class rs {
|
|
|
2818
2895
|
), m.computeLayout(d, c, e, (f) => {
|
|
2819
2896
|
a++;
|
|
2820
2897
|
const v = d.map((b) => {
|
|
2821
|
-
const w = f[b.id],
|
|
2898
|
+
const w = f[b.id], S = p.get(b.id);
|
|
2822
2899
|
return {
|
|
2823
2900
|
...b,
|
|
2824
2901
|
x: (w == null ? void 0 : w.x) ?? 0,
|
|
2825
2902
|
y: (w == null ? void 0 : w.y) ?? 0,
|
|
2826
|
-
level:
|
|
2903
|
+
level: S
|
|
2827
2904
|
};
|
|
2828
2905
|
});
|
|
2829
2906
|
a++, m.dispose(), t == null || t({
|
|
@@ -2866,22 +2943,22 @@ class rs {
|
|
|
2866
2943
|
b.vx = 0, b.vy = 0, e.forEach((w) => {
|
|
2867
2944
|
if (v.id === w.id)
|
|
2868
2945
|
return;
|
|
2869
|
-
const
|
|
2870
|
-
b.vx += A /
|
|
2946
|
+
const S = h.get(w.id), A = b.x - S.x, C = b.y - S.y, _ = A * A + C * C, I = Math.sqrt(_) || 1, T = c * c / I;
|
|
2947
|
+
b.vx += A / I * T, b.vy += C / I * T;
|
|
2871
2948
|
});
|
|
2872
2949
|
}), t.forEach((v) => {
|
|
2873
|
-
const b = String(v.source), w = String(v.target),
|
|
2874
|
-
if (!
|
|
2950
|
+
const b = String(v.source), w = String(v.target), S = h.get(b), A = h.get(w);
|
|
2951
|
+
if (!S || !A)
|
|
2875
2952
|
return;
|
|
2876
|
-
const
|
|
2877
|
-
|
|
2953
|
+
const C = S.x - A.x, _ = S.y - A.y, I = Math.sqrt(C * C + _ * _) || 1, T = I * I / c, M = C / I * T, V = _ / I * T;
|
|
2954
|
+
S.vx -= M, S.vy -= V, A.vx += M, A.vy += V;
|
|
2878
2955
|
}), e.forEach((v) => {
|
|
2879
|
-
const b = h.get(v.id), w = Math.sqrt(b.vx * b.vx + b.vy * b.vy) || 1,
|
|
2880
|
-
if (b.x += b.vx / w *
|
|
2881
|
-
const A = s / 2,
|
|
2882
|
-
if (Math.sqrt(
|
|
2883
|
-
const
|
|
2884
|
-
b.x = A + _ * Math.cos(
|
|
2956
|
+
const b = h.get(v.id), w = Math.sqrt(b.vx * b.vx + b.vy * b.vy) || 1, S = Math.min(w, u);
|
|
2957
|
+
if (b.x += b.vx / w * S, b.y += b.vy / w * S, o === "circular") {
|
|
2958
|
+
const A = s / 2, C = n / 2, _ = Math.min(s, n) / 2, I = b.x - A, T = b.y - C;
|
|
2959
|
+
if (Math.sqrt(I * I + T * T) > _) {
|
|
2960
|
+
const V = Math.atan2(T, I);
|
|
2961
|
+
b.x = A + _ * Math.cos(V), b.y = C + _ * Math.sin(V);
|
|
2885
2962
|
}
|
|
2886
2963
|
} else
|
|
2887
2964
|
b.x = Math.max(0, Math.min(s, b.x)), b.y = Math.max(0, Math.min(n, b.y));
|
|
@@ -2909,12 +2986,12 @@ class rs {
|
|
|
2909
2986
|
}
|
|
2910
2987
|
//#endregion
|
|
2911
2988
|
}
|
|
2912
|
-
class
|
|
2989
|
+
class Sr {
|
|
2913
2990
|
constructor() {
|
|
2914
2991
|
this.children = /* @__PURE__ */ new Map(), this.keys = /* @__PURE__ */ new Set();
|
|
2915
2992
|
}
|
|
2916
2993
|
}
|
|
2917
|
-
var
|
|
2994
|
+
var $ = /* @__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))($ || {}), se = /* @__PURE__ */ ((g) => (g[g.ON_WAKE = 0] = "ON_WAKE", g[g.ON_SLEEP = 1] = "ON_SLEEP", g[g.ON_UPDATE = 2] = "ON_UPDATE", g))(se || {}), we = /* @__PURE__ */ ((g) => (g[g.KEYDOWN = 0] = "KEYDOWN", g[g.KEYUP = 1] = "KEYUP", g))(we || {}), 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
2995
|
class _t {
|
|
2919
2996
|
constructor() {
|
|
2920
2997
|
this.items = {};
|
|
@@ -2951,7 +3028,7 @@ class _t {
|
|
|
2951
3028
|
return Object.keys(this.items).length;
|
|
2952
3029
|
}
|
|
2953
3030
|
}
|
|
2954
|
-
class
|
|
3031
|
+
class Cr {
|
|
2955
3032
|
constructor(e, t) {
|
|
2956
3033
|
this.delay = e, this.eventHandler = t, this.timerId = null, this.handleEvent = (i) => {
|
|
2957
3034
|
this.timerId && clearTimeout(this.timerId), this.timerId = setTimeout(() => {
|
|
@@ -2960,22 +3037,22 @@ class yr {
|
|
|
2960
3037
|
};
|
|
2961
3038
|
}
|
|
2962
3039
|
}
|
|
2963
|
-
class
|
|
3040
|
+
class ls {
|
|
2964
3041
|
constructor() {
|
|
2965
3042
|
this.deleted = [], this.added = [], this.modified = [], this.notChanged = [];
|
|
2966
3043
|
}
|
|
2967
3044
|
}
|
|
2968
|
-
class
|
|
3045
|
+
class cs {
|
|
2969
3046
|
constructor() {
|
|
2970
3047
|
this.clashes = new _t();
|
|
2971
3048
|
}
|
|
2972
3049
|
}
|
|
2973
|
-
class
|
|
3050
|
+
class hs {
|
|
2974
3051
|
constructor() {
|
|
2975
3052
|
this.value = {}, this.elementIds = [], this.modelId = -1;
|
|
2976
3053
|
}
|
|
2977
3054
|
}
|
|
2978
|
-
class
|
|
3055
|
+
class ds {
|
|
2979
3056
|
constructor(e) {
|
|
2980
3057
|
this.viralViewerApi = e, this.panel = null, this.batchListContainer = null, this.isVisible = !1, this.selectedBatchMesh = null, this.inject();
|
|
2981
3058
|
}
|
|
@@ -3041,7 +3118,7 @@ class cs {
|
|
|
3041
3118
|
transition: background-color 0.2s;
|
|
3042
3119
|
`
|
|
3043
3120
|
), i.addEventListener("mouseenter", () => {
|
|
3044
|
-
i.style.backgroundColor = y.
|
|
3121
|
+
i.style.backgroundColor = y.secondary;
|
|
3045
3122
|
}), i.addEventListener("mouseleave", () => {
|
|
3046
3123
|
i.style.backgroundColor = y.primary;
|
|
3047
3124
|
}), i;
|
|
@@ -3062,7 +3139,7 @@ class cs {
|
|
|
3062
3139
|
background-color: rgba(0, 0, 0, 0.1);
|
|
3063
3140
|
}
|
|
3064
3141
|
.batch-item.selected {
|
|
3065
|
-
border-color: ${y.
|
|
3142
|
+
border-color: ${y.secondary};
|
|
3066
3143
|
background-color: rgba(128, 214, 218, 0.2);
|
|
3067
3144
|
}
|
|
3068
3145
|
.batch-item-title {
|
|
@@ -3191,7 +3268,7 @@ class cs {
|
|
|
3191
3268
|
this.clearIsolation(), this.panel && (this.panel.remove(), this.panel = null);
|
|
3192
3269
|
}
|
|
3193
3270
|
}
|
|
3194
|
-
class
|
|
3271
|
+
class us {
|
|
3195
3272
|
constructor(e) {
|
|
3196
3273
|
this.viralViewerApi = e, this.panel = null, this.instancedListContainer = null, this.isVisible = !1, this.selectedInstancedMesh = null, this.selectedInternalMesh = null, this.inject();
|
|
3197
3274
|
}
|
|
@@ -3261,7 +3338,7 @@ class hs {
|
|
|
3261
3338
|
min-width: 80px;
|
|
3262
3339
|
`
|
|
3263
3340
|
), i.addEventListener("mouseenter", () => {
|
|
3264
|
-
i.style.backgroundColor = y.
|
|
3341
|
+
i.style.backgroundColor = y.secondary;
|
|
3265
3342
|
}), i.addEventListener("mouseleave", () => {
|
|
3266
3343
|
i.style.backgroundColor = y.primary;
|
|
3267
3344
|
}), i;
|
|
@@ -3284,7 +3361,7 @@ class hs {
|
|
|
3284
3361
|
background-color: rgba(0, 0, 0, 0.1);
|
|
3285
3362
|
}
|
|
3286
3363
|
.instanced-item.selected {
|
|
3287
|
-
border-color: ${y.
|
|
3364
|
+
border-color: ${y.secondary};
|
|
3288
3365
|
background-color: rgba(128, 214, 218, 0.2);
|
|
3289
3366
|
}
|
|
3290
3367
|
.instanced-item-title {
|
|
@@ -3336,7 +3413,7 @@ class hs {
|
|
|
3336
3413
|
}
|
|
3337
3414
|
.internal-mesh-item.selected {
|
|
3338
3415
|
background-color: rgba(33, 150, 243, 0.2);
|
|
3339
|
-
border-left-color: ${y.
|
|
3416
|
+
border-left-color: ${y.secondary};
|
|
3340
3417
|
}
|
|
3341
3418
|
`, document.head.appendChild(e);
|
|
3342
3419
|
}
|
|
@@ -3405,8 +3482,8 @@ class hs {
|
|
|
3405
3482
|
</div>
|
|
3406
3483
|
<span style="font-size: 14px; color: #666;">▶</span>
|
|
3407
3484
|
`, u.addEventListener("click", (b) => {
|
|
3408
|
-
const w = d.querySelector(".instanced-wrapper-content"),
|
|
3409
|
-
w &&
|
|
3485
|
+
const w = d.querySelector(".instanced-wrapper-content"), S = u.querySelector("span");
|
|
3486
|
+
w && S && (w.classList.toggle("expanded"), S.textContent = w.classList.contains("expanded") ? "▼" : "▶");
|
|
3410
3487
|
});
|
|
3411
3488
|
const p = document.createElement("div");
|
|
3412
3489
|
p.className = "instanced-wrapper-content";
|
|
@@ -3427,8 +3504,8 @@ class hs {
|
|
|
3427
3504
|
), m.addEventListener("click", (b) => {
|
|
3428
3505
|
b.stopPropagation(), this.isolateWrapper(r, d);
|
|
3429
3506
|
}), p.appendChild(m), a.forEach((b, w) => {
|
|
3430
|
-
var
|
|
3431
|
-
const
|
|
3507
|
+
var I;
|
|
3508
|
+
const S = b.geometry, A = ((I = S.attributes.position) == null ? void 0 : I.count) || 0, C = S.index ? S.index.count / 3 : A / 3, _ = document.createElement("div");
|
|
3432
3509
|
_.className = "internal-mesh-item", _.innerHTML = `
|
|
3433
3510
|
<div style="font-weight: 600; font-size: 12px; margin-bottom: 2px;">
|
|
3434
3511
|
InstancedMesh ${w + 1}
|
|
@@ -3436,7 +3513,7 @@ class hs {
|
|
|
3436
3513
|
<div class="instanced-item-info">
|
|
3437
3514
|
Instances: ${b.count.toLocaleString()}<br>
|
|
3438
3515
|
Base Vertices: ${A.toLocaleString()}<br>
|
|
3439
|
-
Base Triangles: ${Math.floor(
|
|
3516
|
+
Base Triangles: ${Math.floor(C).toLocaleString()}<br>
|
|
3440
3517
|
Total Rendered: ${(A * b.count).toLocaleString()} verts
|
|
3441
3518
|
</div>
|
|
3442
3519
|
`, _.addEventListener("click", (T) => {
|
|
@@ -3587,7 +3664,7 @@ class hs {
|
|
|
3587
3664
|
this.clearIsolation(), this.panel && (this.panel.remove(), this.panel = null);
|
|
3588
3665
|
}
|
|
3589
3666
|
}
|
|
3590
|
-
class
|
|
3667
|
+
class ps {
|
|
3591
3668
|
constructor(e) {
|
|
3592
3669
|
this.viralViewerApi = e, this.panel = null, this.contentContainer = null, this.isVisible = !1, this.lastAnalysis = null, this.inject();
|
|
3593
3670
|
}
|
|
@@ -3652,7 +3729,7 @@ class ds {
|
|
|
3652
3729
|
transition: background-color 0.2s;
|
|
3653
3730
|
`
|
|
3654
3731
|
), i.addEventListener("mouseenter", () => {
|
|
3655
|
-
i.style.backgroundColor = y.
|
|
3732
|
+
i.style.backgroundColor = y.secondary;
|
|
3656
3733
|
}), i.addEventListener("mouseleave", () => {
|
|
3657
3734
|
i.style.backgroundColor = y.primary;
|
|
3658
3735
|
}), i;
|
|
@@ -3894,8 +3971,8 @@ class ds {
|
|
|
3894
3971
|
let t = 0, i = 0, s = 0, n = "N/A";
|
|
3895
3972
|
if (e instanceof x) {
|
|
3896
3973
|
const c = e.geometry;
|
|
3897
|
-
c && (c.attributes.position && (t = c.attributes.position.count), c.index ? i = c.index.count / 3 : i = t / 3), e instanceof
|
|
3898
|
-
} else if (e instanceof wt || e instanceof
|
|
3974
|
+
c && (c.attributes.position && (t = c.attributes.position.count), c.index ? i = c.index.count / 3 : i = t / 3), e instanceof pe ? (s = 1, n = "Instanced", i *= e.count) : e instanceof ee ? (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");
|
|
3975
|
+
} else if (e instanceof wt || e instanceof gt) {
|
|
3899
3976
|
s = e.visible ? 1 : 0, n = "Line";
|
|
3900
3977
|
const c = e.geometry;
|
|
3901
3978
|
c && c.attributes.position && (t = c.attributes.position.count);
|
|
@@ -3922,7 +3999,7 @@ class ds {
|
|
|
3922
3999
|
};
|
|
3923
4000
|
}
|
|
3924
4001
|
isRenderable(e) {
|
|
3925
|
-
return e instanceof x || e instanceof wt || e instanceof
|
|
4002
|
+
return e instanceof x || e instanceof wt || e instanceof gt || e instanceof Et;
|
|
3926
4003
|
}
|
|
3927
4004
|
isVisibleInHierarchy(e) {
|
|
3928
4005
|
let t = e;
|
|
@@ -3948,7 +4025,7 @@ class ds {
|
|
|
3948
4025
|
return `v${s}_i${n}_${r}`;
|
|
3949
4026
|
}
|
|
3950
4027
|
categorizeObject(e, t, i) {
|
|
3951
|
-
e instanceof
|
|
4028
|
+
e instanceof ee ? i.batchedMeshes.push(t) : e instanceof me || e instanceof pe ? i.instancedMeshes.push(t) : e instanceof x ? i.regularMeshes.push(t) : e instanceof wt || e instanceof gt ? i.edgeMeshes.push(t) : this.isRenderable(e) && i.otherObjects.push(t);
|
|
3952
4029
|
}
|
|
3953
4030
|
analyzeMergedModel(e) {
|
|
3954
4031
|
const t = this.viralViewerApi.viralScene.bimWorld, i = t.getDiagnostics();
|
|
@@ -4209,7 +4286,7 @@ class ds {
|
|
|
4209
4286
|
var a;
|
|
4210
4287
|
const i = " ".repeat(t), s = e.visible ? "✅" : "❌", n = e.constructor.name, r = e.children.length;
|
|
4211
4288
|
let o = "";
|
|
4212
|
-
e instanceof x && e.geometry && (o = ` [V:${((a = e.geometry.attributes.position) == null ? void 0 : a.count) || 0}]`), e instanceof
|
|
4289
|
+
e instanceof x && e.geometry && (o = ` [V:${((a = e.geometry.attributes.position) == null ? void 0 : a.count) || 0}]`), e instanceof pe && (o += ` [Instances:${e.count}]`), console.log(
|
|
4213
4290
|
`${i}${s} ${e.name || "[unnamed]"} (${n})${o} [${r} children]`
|
|
4214
4291
|
), t < 3 ? e.children.forEach((l) => {
|
|
4215
4292
|
this.logObjectTree(l, t + 1);
|
|
@@ -4234,10 +4311,10 @@ class ds {
|
|
|
4234
4311
|
this.panel && (this.panel.remove(), this.panel = null);
|
|
4235
4312
|
}
|
|
4236
4313
|
}
|
|
4237
|
-
class
|
|
4314
|
+
class ms {
|
|
4238
4315
|
// 5 seconds for cleanup
|
|
4239
4316
|
constructor(e) {
|
|
4240
|
-
this.viralViewerApi = e, this.clock = new
|
|
4317
|
+
this.viralViewerApi = e, this.clock = new si(), this.lastSpatialUpdateTime = 0, this.lastCleanupTime = 0, this.spatialUpdateInterval = 16, this.cleanupInterval = 5e3, this.isRainEnabled = !1;
|
|
4241
4318
|
}
|
|
4242
4319
|
devAnimation() {
|
|
4243
4320
|
var i, s, n, r, o;
|
|
@@ -4280,7 +4357,7 @@ class us {
|
|
|
4280
4357
|
this.isRainEnabled = e, this.isRainEnabled && this.rainAnimation();
|
|
4281
4358
|
}
|
|
4282
4359
|
}
|
|
4283
|
-
class
|
|
4360
|
+
class gs {
|
|
4284
4361
|
static generateRandomString(e) {
|
|
4285
4362
|
const t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
4286
4363
|
let i = "";
|
|
@@ -4291,21 +4368,21 @@ class ps {
|
|
|
4291
4368
|
return i;
|
|
4292
4369
|
}
|
|
4293
4370
|
}
|
|
4294
|
-
const
|
|
4295
|
-
class
|
|
4371
|
+
const fs = 0.032;
|
|
4372
|
+
class vs {
|
|
4296
4373
|
constructor(e, t, i, s, n = 2, r = 1, o, a) {
|
|
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 =
|
|
4374
|
+
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 = gs.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(
|
|
4298
4375
|
"style",
|
|
4299
4376
|
"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"
|
|
4300
4377
|
), this.nameDiv.id = this.id, this.nameDiv.append(this.name), this.viralViewerApi.targetElement.appendChild(this.nameDiv)), this.chatDiv = document.createElement("div"), this.chatDiv.setAttribute(
|
|
4301
4378
|
"style",
|
|
4302
4379
|
"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"
|
|
4303
|
-
), this.viralViewerApi.targetElement.appendChild(this.chatDiv), this.MOVEMENT_SPEED =
|
|
4380
|
+
), this.viralViewerApi.targetElement.appendChild(this.chatDiv), this.MOVEMENT_SPEED = fs * r, this.viralViewerApi.viralLoader.threeLoader.loadGLTF(t, (l) => {
|
|
4304
4381
|
this.avatar = l.scene;
|
|
4305
4382
|
const c = new E(n, n, n);
|
|
4306
|
-
this.avatar.scale.copy(c), console.log(this.avatar), this.mixer = new
|
|
4383
|
+
this.avatar.scale.copy(c), console.log(this.avatar), this.mixer = new ni(l.scene), this.viralViewerApi.viralScene.scene.add(l.scene), this.viralViewerApi.viralRenderer.render(), this.viralViewerApi.viralLoader.threeLoader.loadGLTF(i, (h) => {
|
|
4307
4384
|
this.idleAnimation = this.mixer.clipAction(h.animations[0]), this.viralViewerApi.viralLoader.threeLoader.loadGLTF(s, (d) => {
|
|
4308
|
-
this.walkAnimation = this.mixer.clipAction(d.animations[0]),
|
|
4385
|
+
this.walkAnimation = this.mixer.clipAction(d.animations[0]), J.information("load avatar succeed!"), this.isReady = !0, this.idle();
|
|
4309
4386
|
});
|
|
4310
4387
|
});
|
|
4311
4388
|
});
|
|
@@ -4363,12 +4440,12 @@ class gs {
|
|
|
4363
4440
|
(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);
|
|
4364
4441
|
}
|
|
4365
4442
|
}
|
|
4366
|
-
class
|
|
4443
|
+
class bs {
|
|
4367
4444
|
constructor(e) {
|
|
4368
4445
|
this.viralViewerApi = e, this.avatars = [];
|
|
4369
4446
|
}
|
|
4370
4447
|
load(e, t, i, s = 2, n = 1, r, o) {
|
|
4371
|
-
const a = new
|
|
4448
|
+
const a = new vs(
|
|
4372
4449
|
this.viralViewerApi,
|
|
4373
4450
|
e,
|
|
4374
4451
|
t,
|
|
@@ -4385,40 +4462,40 @@ class fs {
|
|
|
4385
4462
|
t && t.dispose(), this.avatars = this.avatars.filter((i) => i.id !== e);
|
|
4386
4463
|
}
|
|
4387
4464
|
}
|
|
4388
|
-
class
|
|
4465
|
+
class ws {
|
|
4389
4466
|
constructor() {
|
|
4390
|
-
|
|
4467
|
+
he.prototype.computeBoundsTree = Vi, he.prototype.disposeBoundsTree = Ti, x.prototype.raycast = Pi;
|
|
4391
4468
|
}
|
|
4392
4469
|
applyThreeMeshBVH(e) {
|
|
4393
4470
|
e.boundsTree || e.computeBoundsTree();
|
|
4394
4471
|
}
|
|
4395
4472
|
}
|
|
4396
|
-
const
|
|
4473
|
+
const ys = {
|
|
4397
4474
|
Vector2: H,
|
|
4398
4475
|
Vector3: E,
|
|
4399
|
-
Vector4:
|
|
4400
|
-
Quaternion:
|
|
4401
|
-
Matrix4:
|
|
4402
|
-
Spherical:
|
|
4403
|
-
Box3:
|
|
4404
|
-
Sphere:
|
|
4405
|
-
Raycaster:
|
|
4406
|
-
MathUtils:
|
|
4476
|
+
Vector4: ri,
|
|
4477
|
+
Quaternion: ai,
|
|
4478
|
+
Matrix4: ce,
|
|
4479
|
+
Spherical: Gt,
|
|
4480
|
+
Box3: F,
|
|
4481
|
+
Sphere: Ut,
|
|
4482
|
+
Raycaster: Vt,
|
|
4483
|
+
MathUtils: oi
|
|
4407
4484
|
};
|
|
4408
|
-
|
|
4409
|
-
class
|
|
4485
|
+
be.install({ THREE: ys });
|
|
4486
|
+
class xs {
|
|
4410
4487
|
constructor(e) {
|
|
4411
|
-
this.viralViewerApi = e, this.raycaster = new
|
|
4488
|
+
this.viralViewerApi = e, this.raycaster = new Vt(), 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);
|
|
4412
4489
|
}
|
|
4413
4490
|
setupCamera() {
|
|
4414
|
-
this._perspectiveCamera = new
|
|
4491
|
+
this._perspectiveCamera = new Ge(
|
|
4415
4492
|
60,
|
|
4416
4493
|
this.targetElement.clientWidth / this.targetElement.clientHeight,
|
|
4417
4494
|
0.1,
|
|
4418
4495
|
1e4
|
|
4419
4496
|
);
|
|
4420
4497
|
const e = this.targetElement.offsetWidth / this.targetElement.offsetHeight;
|
|
4421
|
-
this._orthoCamera = new
|
|
4498
|
+
this._orthoCamera = new St(
|
|
4422
4499
|
-this._frustumSize * e / 2,
|
|
4423
4500
|
this._frustumSize * e / 2,
|
|
4424
4501
|
this._frustumSize / 2,
|
|
@@ -4429,10 +4506,10 @@ class ws {
|
|
|
4429
4506
|
}
|
|
4430
4507
|
_initCameraControl() {
|
|
4431
4508
|
var e, t, i;
|
|
4432
|
-
this.camera && ((e = this.cameraControls) == null || e.removeAllEventListeners(), (t = this.cameraControls) == null || t.dispose(), this.cameraControls = new
|
|
4509
|
+
this.camera && ((e = this.cameraControls) == null || e.removeAllEventListeners(), (t = this.cameraControls) == null || t.dispose(), this.cameraControls = new be(
|
|
4433
4510
|
this.camera,
|
|
4434
4511
|
this.viralViewerApi.viralRenderer.renderer.domElement
|
|
4435
|
-
), this.cameraControls.draggingSmoothTime = 0.05, this.cameraControls.smoothTime = 0.05, this.cameraControls.setTarget(0, 0, 0), this.cameraControls.mouseButtons.middle =
|
|
4512
|
+
), this.cameraControls.draggingSmoothTime = 0.05, this.cameraControls.smoothTime = 0.05, this.cameraControls.setTarget(0, 0, 0), this.cameraControls.mouseButtons.middle = be.ACTION.OFFSET, this.cameraControls.addEventListener("control", (s) => {
|
|
4436
4513
|
this.onUsing = !0, this.cameraWakeQueuedEvents.length > 0 && this.cameraWakeQueuedEvents.forEach((n) => {
|
|
4437
4514
|
const [r, o] = n;
|
|
4438
4515
|
o();
|
|
@@ -4460,7 +4537,7 @@ class ws {
|
|
|
4460
4537
|
*/
|
|
4461
4538
|
resizeCanvas() {
|
|
4462
4539
|
if (this.camera) {
|
|
4463
|
-
if (this.camera instanceof
|
|
4540
|
+
if (this.camera instanceof Ge && (this.camera.aspect = this.targetElement.clientWidth / this.targetElement.clientHeight), this.camera instanceof St) {
|
|
4464
4541
|
const e = this.targetElement.offsetWidth / this.targetElement.offsetHeight;
|
|
4465
4542
|
this.camera.left = -this._frustumSize * e / 2, this.camera.right = this._frustumSize * e / 2, this.camera.top = this._frustumSize / 2, this.camera.bottom = -this._frustumSize / 2;
|
|
4466
4543
|
}
|
|
@@ -4471,7 +4548,7 @@ class ws {
|
|
|
4471
4548
|
}
|
|
4472
4549
|
}
|
|
4473
4550
|
resizeCanvas2() {
|
|
4474
|
-
this.camera && (this.camera instanceof
|
|
4551
|
+
this.camera && (this.camera instanceof Ge && (this.camera.aspect = this.targetElement.offsetWidth / this.targetElement.offsetHeight), this.camera.updateProjectionMatrix(), this.viralViewerApi.viralRenderer.updateSize(
|
|
4475
4552
|
this.targetElement.offsetWidth,
|
|
4476
4553
|
this.targetElement.offsetHeight
|
|
4477
4554
|
), this.viralViewerApi.viralRenderer.render());
|
|
@@ -4581,7 +4658,7 @@ class ws {
|
|
|
4581
4658
|
const t = this.viralViewerApi.viralScene.scene;
|
|
4582
4659
|
if (!t || !this.camera)
|
|
4583
4660
|
return;
|
|
4584
|
-
const s = new
|
|
4661
|
+
const s = new F().setFromObject(t).getSize(new E()), n = Math.max(s.x, s.y, s.z);
|
|
4585
4662
|
this.camera.far = n + e, this.camera.updateProjectionMatrix(), this.cameraControls && (this.cameraControls.maxDistance = this.camera.far * 0.95);
|
|
4586
4663
|
}
|
|
4587
4664
|
/**
|
|
@@ -4592,32 +4669,32 @@ class ws {
|
|
|
4592
4669
|
*/
|
|
4593
4670
|
addEventListener(e, t, i) {
|
|
4594
4671
|
switch (e) {
|
|
4595
|
-
case
|
|
4672
|
+
case se.ON_WAKE:
|
|
4596
4673
|
this.cameraWakeQueuedEvents.push([t, i]);
|
|
4597
4674
|
break;
|
|
4598
|
-
case
|
|
4675
|
+
case se.ON_SLEEP:
|
|
4599
4676
|
this.cameraSleepQueuedEvents.push([t, i]);
|
|
4600
4677
|
break;
|
|
4601
|
-
case
|
|
4678
|
+
case se.ON_UPDATE:
|
|
4602
4679
|
this.cameraUpdateQueuedEvents.push([t, i]);
|
|
4603
4680
|
break;
|
|
4604
4681
|
}
|
|
4605
4682
|
}
|
|
4606
4683
|
removeEventListener(e, t) {
|
|
4607
4684
|
switch (e) {
|
|
4608
|
-
case
|
|
4685
|
+
case se.ON_WAKE:
|
|
4609
4686
|
{
|
|
4610
4687
|
const i = this.cameraWakeQueuedEvents.findIndex((s) => s[0] === t);
|
|
4611
4688
|
this.cameraWakeQueuedEvents.splice(i, 1);
|
|
4612
4689
|
}
|
|
4613
4690
|
break;
|
|
4614
|
-
case
|
|
4691
|
+
case se.ON_SLEEP:
|
|
4615
4692
|
{
|
|
4616
4693
|
const i = this.cameraSleepQueuedEvents.findIndex((s) => s[0] === t);
|
|
4617
4694
|
this.cameraSleepQueuedEvents.splice(i, 1);
|
|
4618
4695
|
}
|
|
4619
4696
|
break;
|
|
4620
|
-
case
|
|
4697
|
+
case se.ON_UPDATE:
|
|
4621
4698
|
{
|
|
4622
4699
|
const i = this.cameraUpdateQueuedEvents.findIndex((s) => s[0] === t);
|
|
4623
4700
|
this.cameraUpdateQueuedEvents.splice(i, 1);
|
|
@@ -4643,7 +4720,7 @@ class ws {
|
|
|
4643
4720
|
*/
|
|
4644
4721
|
async focusCameraOnModel(e, t = !1) {
|
|
4645
4722
|
var u, p, m, f, v;
|
|
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 =
|
|
4723
|
+
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 = D.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);
|
|
4647
4724
|
await ((u = this.viralViewerApi.viralCamera.cameraControls) == null ? void 0 : u.setTarget(
|
|
4648
4725
|
n.x,
|
|
4649
4726
|
n.y,
|
|
@@ -4653,7 +4730,7 @@ class ws {
|
|
|
4653
4730
|
2 * l / 2,
|
|
4654
4731
|
-(2 * l) / 2
|
|
4655
4732
|
));
|
|
4656
|
-
const c = new
|
|
4733
|
+
const c = new F(i, s);
|
|
4657
4734
|
await ((m = this.viralViewerApi.viralCamera.cameraControls) == null ? void 0 : m.fitToBox(c, !1));
|
|
4658
4735
|
const h = new E();
|
|
4659
4736
|
(f = this.viralViewerApi.viralCamera.cameraControls) == null || f.getPosition(h);
|
|
@@ -4667,27 +4744,27 @@ class ws {
|
|
|
4667
4744
|
}
|
|
4668
4745
|
//#endregion
|
|
4669
4746
|
}
|
|
4670
|
-
class
|
|
4747
|
+
class Ms {
|
|
4671
4748
|
pakoUnzip(e) {
|
|
4672
4749
|
const t = new Uint8Array(e);
|
|
4673
|
-
return
|
|
4750
|
+
return Oi(t);
|
|
4674
4751
|
}
|
|
4675
4752
|
pakoStreamUnzip(e) {
|
|
4676
|
-
const t = new
|
|
4753
|
+
const t = new Di();
|
|
4677
4754
|
return t.push(e, !0), t.result;
|
|
4678
4755
|
}
|
|
4679
4756
|
}
|
|
4680
|
-
class
|
|
4757
|
+
class le {
|
|
4681
4758
|
constructor(e, t, i) {
|
|
4682
4759
|
this.x = 0, this.y = 0, this.z = 0, this.x = e, this.y = t, this.z = i;
|
|
4683
4760
|
}
|
|
4684
4761
|
}
|
|
4685
|
-
class
|
|
4762
|
+
class P {
|
|
4686
4763
|
static doesEdgeIncludePlane(e, t, i, s, n, r = 1e-7) {
|
|
4687
|
-
const o =
|
|
4764
|
+
const o = P.subtract(s, i), a = P.subtract(n, i), l = P.crossProduct(o, a), c = -P.dotProduct(l, i), h = P.dotProduct(l, e) + c, d = P.dotProduct(l, t) + c;
|
|
4688
4765
|
if (Math.abs(h) > r || Math.abs(d) > r)
|
|
4689
4766
|
return !1;
|
|
4690
|
-
const u =
|
|
4767
|
+
const u = P.isPointInTriangle(e, i, s, n, r), p = P.isPointInTriangle(t, i, s, n, r);
|
|
4691
4768
|
return !(!u || !p);
|
|
4692
4769
|
}
|
|
4693
4770
|
/**
|
|
@@ -4700,14 +4777,14 @@ class O {
|
|
|
4700
4777
|
* @returns boolean - Whether the edge intersects the triangle
|
|
4701
4778
|
*/
|
|
4702
4779
|
static doesEdgeIntersectTriangle(e, t, i, s, n, r = 5) {
|
|
4703
|
-
const o =
|
|
4780
|
+
const o = P.subtract(s, i), a = P.subtract(n, i), l = P.crossProduct(o, a), c = -P.dotProduct(l, i), h = P.subtract(t, e), d = P.dotProduct(l, h);
|
|
4704
4781
|
if (Math.abs(d) < 1e-7)
|
|
4705
4782
|
return !1;
|
|
4706
|
-
const u = -(
|
|
4783
|
+
const u = -(P.dotProduct(l, e) + c) / d;
|
|
4707
4784
|
if (u < -r || u > 1 + r)
|
|
4708
4785
|
return !1;
|
|
4709
|
-
const p =
|
|
4710
|
-
return m < r || f < r ? !1 :
|
|
4786
|
+
const p = P.add(e, P.scale(h, u)), m = P.distance(p, e), f = P.distance(p, t);
|
|
4787
|
+
return m < r || f < r ? !1 : P.isPointInTriangle(p, i, s, n, r);
|
|
4711
4788
|
}
|
|
4712
4789
|
/**
|
|
4713
4790
|
* Check if a point lies inside a triangle using barycentric coordinates
|
|
@@ -4718,7 +4795,7 @@ class O {
|
|
|
4718
4795
|
* @returns boolean - Whether the point lies inside the triangle
|
|
4719
4796
|
*/
|
|
4720
4797
|
static isPointInTriangle(e, t, i, s, n = 1e-7) {
|
|
4721
|
-
const r =
|
|
4798
|
+
const r = P.subtract(i, t), o = P.subtract(s, i), a = P.subtract(t, s), l = P.subtract(e, t), c = P.subtract(e, i), h = P.subtract(e, s), d = P.crossProduct(r, l), u = P.crossProduct(o, c), p = P.crossProduct(a, h), m = P.normalize(d), f = P.normalize(u), v = P.normalize(p), b = P.dotProduct(m, f), w = P.dotProduct(f, v);
|
|
4722
4799
|
return b > 1 - n && w > 1 - n;
|
|
4723
4800
|
}
|
|
4724
4801
|
// Vector math helper functions
|
|
@@ -4745,22 +4822,22 @@ class O {
|
|
|
4745
4822
|
const t = Math.sqrt(
|
|
4746
4823
|
e.x * e.x + e.y * e.y + e.z * e.z
|
|
4747
4824
|
);
|
|
4748
|
-
return t < 1e-7 ? new
|
|
4825
|
+
return t < 1e-7 ? new le(0, 0, 0) : new le(e.x / t, e.y / t, e.z / t);
|
|
4749
4826
|
}
|
|
4750
4827
|
static distance(e, t) {
|
|
4751
4828
|
return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2 + (e.z - t.z) ** 2);
|
|
4752
4829
|
}
|
|
4753
4830
|
static doTrianglesIntersect(e, t, i, s, n, r, o = 1e-3) {
|
|
4754
|
-
return !!(
|
|
4831
|
+
return !!(P.doesEdgeIntersectTriangle(e, t, s, n, r, o) || P.doesEdgeIntersectTriangle(t, i, s, n, r, o) || P.doesEdgeIntersectTriangle(i, e, s, n, r, o));
|
|
4755
4832
|
}
|
|
4756
4833
|
static objectsIntersect(e, t, i = 1e-3) {
|
|
4757
4834
|
for (let s = 0; s < e.length; s += 9) {
|
|
4758
|
-
const n = new
|
|
4835
|
+
const n = new le(e[s], e[s + 1], e[s + 2]), r = new le(e[s + 3], e[s + 4], e[s + 5]), o = new le(e[s + 6], e[s + 7], e[s + 8]);
|
|
4759
4836
|
for (let a = 0; a < t.length; a += 9) {
|
|
4760
|
-
const l = new
|
|
4761
|
-
if (
|
|
4837
|
+
const l = new le(t[a], t[a + 1], t[a + 2]), c = new le(t[a + 3], t[a + 4], t[a + 5]), h = new le(t[a + 6], t[a + 7], t[a + 8]);
|
|
4838
|
+
if (P.doesEdgeIncludePlane(n, r, l, c, h, i) && P.doesEdgeIncludePlane(r, o, l, c, h, i))
|
|
4762
4839
|
return console.log("belong to face"), !1;
|
|
4763
|
-
if (
|
|
4840
|
+
if (P.doTrianglesIntersect(n, r, o, l, c, h, i))
|
|
4764
4841
|
return !0;
|
|
4765
4842
|
}
|
|
4766
4843
|
}
|
|
@@ -4771,7 +4848,7 @@ class O {
|
|
|
4771
4848
|
return i && s && n;
|
|
4772
4849
|
}
|
|
4773
4850
|
}
|
|
4774
|
-
function
|
|
4851
|
+
function Es() {
|
|
4775
4852
|
class g {
|
|
4776
4853
|
constructor(t, i, s) {
|
|
4777
4854
|
this.X = 0, this.Y = 0, this.Z = 0, this.X = t, this.Y = i, this.Z = s;
|
|
@@ -4793,11 +4870,11 @@ function xs() {
|
|
|
4793
4870
|
self.postMessage(i());
|
|
4794
4871
|
};
|
|
4795
4872
|
}
|
|
4796
|
-
const
|
|
4797
|
-
class
|
|
4873
|
+
const Ss = Es;
|
|
4874
|
+
class Cs {
|
|
4798
4875
|
constructor() {
|
|
4799
|
-
const e = new Blob([`(${
|
|
4800
|
-
this.workerPool = new
|
|
4876
|
+
const e = new Blob([`(${Ss})()`]), t = URL.createObjectURL(e);
|
|
4877
|
+
this.workerPool = new oe(navigator.hardwareConcurrency || 10, t);
|
|
4801
4878
|
}
|
|
4802
4879
|
getBoundingBox(e, t = (i) => {
|
|
4803
4880
|
}) {
|
|
@@ -4809,7 +4886,7 @@ class Es {
|
|
|
4809
4886
|
);
|
|
4810
4887
|
}
|
|
4811
4888
|
}
|
|
4812
|
-
function
|
|
4889
|
+
function As() {
|
|
4813
4890
|
self.onmessage = (g) => {
|
|
4814
4891
|
const e = g.data;
|
|
4815
4892
|
function t(s, n, r = 0.1) {
|
|
@@ -4827,11 +4904,11 @@ function Cs() {
|
|
|
4827
4904
|
self.postMessage(i);
|
|
4828
4905
|
};
|
|
4829
4906
|
}
|
|
4830
|
-
const
|
|
4831
|
-
class
|
|
4907
|
+
const _s = As;
|
|
4908
|
+
class Is {
|
|
4832
4909
|
constructor() {
|
|
4833
|
-
const e = new Blob([`(${
|
|
4834
|
-
this.workerPool = new
|
|
4910
|
+
const e = new Blob([`(${_s})()`]), t = URL.createObjectURL(e);
|
|
4911
|
+
this.workerPool = new oe(4, t);
|
|
4835
4912
|
}
|
|
4836
4913
|
checkIntersect(e, t = (i) => {
|
|
4837
4914
|
}) {
|
|
@@ -4840,7 +4917,7 @@ class As {
|
|
|
4840
4917
|
});
|
|
4841
4918
|
}
|
|
4842
4919
|
}
|
|
4843
|
-
function
|
|
4920
|
+
function Vs() {
|
|
4844
4921
|
class g {
|
|
4845
4922
|
constructor() {
|
|
4846
4923
|
this.children = /* @__PURE__ */ new Map(), this.keys = /* @__PURE__ */ new Set();
|
|
@@ -4932,11 +5009,11 @@ function _s() {
|
|
|
4932
5009
|
}
|
|
4933
5010
|
};
|
|
4934
5011
|
}
|
|
4935
|
-
const
|
|
4936
|
-
class
|
|
5012
|
+
const Ts = Vs;
|
|
5013
|
+
class Ps {
|
|
4937
5014
|
constructor() {
|
|
4938
|
-
const e = new Blob([`(${
|
|
4939
|
-
this.workerPool = new
|
|
5015
|
+
const e = new Blob([`(${Ts})()`]), t = URL.createObjectURL(e);
|
|
5016
|
+
this.workerPool = new oe(2, t);
|
|
4940
5017
|
}
|
|
4941
5018
|
buildTreeNode(e, t = (i) => {
|
|
4942
5019
|
}) {
|
|
@@ -4945,7 +5022,7 @@ class Is {
|
|
|
4945
5022
|
});
|
|
4946
5023
|
}
|
|
4947
5024
|
}
|
|
4948
|
-
function
|
|
5025
|
+
function Os() {
|
|
4949
5026
|
class g {
|
|
4950
5027
|
constructor(u, p, m) {
|
|
4951
5028
|
this.x = 0, this.y = 0, this.z = 0, this.x = u, this.y = p, this.z = m;
|
|
@@ -4980,46 +5057,46 @@ function Ts() {
|
|
|
4980
5057
|
return Math.sqrt((d.x - u.x) ** 2 + (d.y - u.y) ** 2 + (d.z - u.z) ** 2);
|
|
4981
5058
|
}
|
|
4982
5059
|
function a(d, u, p, m, f = 1e-7) {
|
|
4983
|
-
const v = e(p, u), b = e(m, p), w = e(u, m),
|
|
4984
|
-
return B > 1 - f &&
|
|
5060
|
+
const v = e(p, u), b = e(m, p), w = e(u, m), S = e(d, u), A = e(d, p), C = e(d, m), _ = n(v, S), I = n(b, A), T = n(w, C), M = r(_), V = r(I), L = r(T), B = s(M, V), O = s(V, L);
|
|
5061
|
+
return B > 1 - f && O > 1 - f;
|
|
4985
5062
|
}
|
|
4986
5063
|
function l(d, u, p, m, f, v, b = 1e-3) {
|
|
4987
5064
|
return !!(h(d, u, m, f, v, b) || h(u, p, m, f, v, b) || h(p, d, m, f, v, b));
|
|
4988
5065
|
}
|
|
4989
5066
|
function c(d, u, p, m, f, v = 1e-7) {
|
|
4990
|
-
const b = e(m, p), w = e(f, p),
|
|
4991
|
-
if (Math.abs(
|
|
5067
|
+
const b = e(m, p), w = e(f, p), S = n(b, w), A = -s(S, p), C = s(S, d) + A, _ = s(S, u) + A;
|
|
5068
|
+
if (Math.abs(C) > v || Math.abs(_) > v)
|
|
4992
5069
|
return !1;
|
|
4993
|
-
const
|
|
4994
|
-
return !(!
|
|
5070
|
+
const I = a(d, p, m, f, v), T = a(u, p, m, f, v);
|
|
5071
|
+
return !(!I || !T);
|
|
4995
5072
|
}
|
|
4996
5073
|
function h(d, u, p, m, f, v = 5) {
|
|
4997
|
-
const b = e(m, p), w = e(f, p),
|
|
5074
|
+
const b = e(m, p), w = e(f, p), S = n(b, w), A = -s(S, p), C = e(u, d), _ = s(S, C);
|
|
4998
5075
|
if (Math.abs(_) < 1e-7)
|
|
4999
5076
|
return !1;
|
|
5000
|
-
const
|
|
5001
|
-
if (
|
|
5077
|
+
const I = -(s(S, d) + A) / _;
|
|
5078
|
+
if (I < -v || I > 1 + v)
|
|
5002
5079
|
return !1;
|
|
5003
|
-
const T = t(d, i(
|
|
5004
|
-
return M < v ||
|
|
5080
|
+
const T = t(d, i(C, I)), M = o(T, d), V = o(T, u);
|
|
5081
|
+
return M < v || V < v ? !1 : a(T, p, m, f, v);
|
|
5005
5082
|
}
|
|
5006
5083
|
self.onmessage = (d) => {
|
|
5007
5084
|
const u = d.data, p = u.buffer1, m = u.buffer2, f = 1e-3;
|
|
5008
5085
|
for (let v = 0; v < p.length; v += 9) {
|
|
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]),
|
|
5086
|
+
const b = new g(p[v], p[v + 1], p[v + 2]), w = new g(p[v + 3], p[v + 4], p[v + 5]), S = new g(p[v + 6], p[v + 7], p[v + 8]);
|
|
5010
5087
|
for (let A = 0; A < m.length; A += 9) {
|
|
5011
|
-
const
|
|
5012
|
-
c(b, w,
|
|
5088
|
+
const C = new g(m[A], m[A + 1], m[A + 2]), _ = new g(m[A + 3], m[A + 4], m[A + 5]), I = new g(m[A + 6], m[A + 7], m[A + 8]);
|
|
5089
|
+
c(b, w, C, _, I, f) && c(w, S, C, _, I, f) && (console.log("belong to face"), self.postMessage(!1)), l(b, w, S, C, _, I, f) && self.postMessage(!0);
|
|
5013
5090
|
}
|
|
5014
5091
|
}
|
|
5015
5092
|
self.postMessage(!1);
|
|
5016
5093
|
};
|
|
5017
5094
|
}
|
|
5018
|
-
const
|
|
5019
|
-
class
|
|
5095
|
+
const Ds = Os;
|
|
5096
|
+
class Rs {
|
|
5020
5097
|
constructor() {
|
|
5021
|
-
const e = new Blob([`(${
|
|
5022
|
-
this.workerPool = new
|
|
5098
|
+
const e = new Blob([`(${Ds})()`]), t = URL.createObjectURL(e);
|
|
5099
|
+
this.workerPool = new oe(navigator.hardwareConcurrency || 10, t);
|
|
5023
5100
|
}
|
|
5024
5101
|
checkClash(e, t = (i) => {
|
|
5025
5102
|
}) {
|
|
@@ -5028,7 +5105,7 @@ class Os {
|
|
|
5028
5105
|
});
|
|
5029
5106
|
}
|
|
5030
5107
|
}
|
|
5031
|
-
function
|
|
5108
|
+
function Ls() {
|
|
5032
5109
|
self.addEventListener(
|
|
5033
5110
|
"message",
|
|
5034
5111
|
(g) => {
|
|
@@ -5062,28 +5139,28 @@ function Ds() {
|
|
|
5062
5139
|
!1
|
|
5063
5140
|
);
|
|
5064
5141
|
}
|
|
5065
|
-
const
|
|
5066
|
-
class
|
|
5142
|
+
const ks = Ls;
|
|
5143
|
+
class Bs {
|
|
5067
5144
|
constructor() {
|
|
5068
|
-
const e = new Blob([`(${
|
|
5069
|
-
this.workerPool = new
|
|
5145
|
+
const e = new Blob([`(${ks})()`]), t = URL.createObjectURL(e);
|
|
5146
|
+
this.workerPool = new oe(2, t);
|
|
5070
5147
|
}
|
|
5071
5148
|
fetch(e, t = (n) => {
|
|
5072
5149
|
}, i, s) {
|
|
5073
|
-
const n = new
|
|
5150
|
+
const n = new zs(e, i, s);
|
|
5074
5151
|
this.workerPool.Enqueue(n, (r) => {
|
|
5075
5152
|
t(r);
|
|
5076
5153
|
});
|
|
5077
5154
|
}
|
|
5078
5155
|
}
|
|
5079
|
-
class
|
|
5156
|
+
class zs {
|
|
5080
5157
|
constructor(e, t, i) {
|
|
5081
5158
|
this.url = "", this.url = e, this.byteRangeStart = t, this.byteRangeEnd = i;
|
|
5082
5159
|
}
|
|
5083
5160
|
}
|
|
5084
|
-
class
|
|
5161
|
+
class Ns {
|
|
5085
5162
|
constructor(e) {
|
|
5086
|
-
this.viralViewerApi = e, this.dataTree = [], this.trackingData = /* @__PURE__ */ new Map(), this.fetchDataWorker = new
|
|
5163
|
+
this.viralViewerApi = e, this.dataTree = [], this.trackingData = /* @__PURE__ */ new Map(), this.fetchDataWorker = new Bs(), this.buildTreeNodeWorker = new Ps(), this._boundingBoxWorker = new Cs(), this._boundingBoxIntersectWorker = new Is(), this._checkClashWorker = new Rs(), 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());
|
|
5087
5164
|
}
|
|
5088
5165
|
addTrackingData(e, t) {
|
|
5089
5166
|
this.trackingData.set(e, t);
|
|
@@ -5133,7 +5210,7 @@ class Bs {
|
|
|
5133
5210
|
addData(e) {
|
|
5134
5211
|
const t = performance.now(), i = Object.keys(e.Data).length;
|
|
5135
5212
|
console.log(`[DataManager] Adding ${i} elements to data tree...`);
|
|
5136
|
-
const s = new
|
|
5213
|
+
const s = new os();
|
|
5137
5214
|
s.addElements(e.Data), e.Relationships && (s.addRelationships(e.Relationships), s.buildGraphIndex()), this.dataTree.push(s), this.viralViewerApi.emit(k.LOADED_DATA, {
|
|
5138
5215
|
modelId: this.dataTree.length - 1
|
|
5139
5216
|
}), console.log(
|
|
@@ -5211,7 +5288,7 @@ class Bs {
|
|
|
5211
5288
|
* @returns
|
|
5212
5289
|
*/
|
|
5213
5290
|
compareModels(e = 0, t = 1) {
|
|
5214
|
-
const i = new
|
|
5291
|
+
const i = new ls();
|
|
5215
5292
|
if (!this.dataTree[e] || !this.dataTree[t])
|
|
5216
5293
|
return i;
|
|
5217
5294
|
const s = this.dataTree[e].elementData, n = this.dataTree[t].elementData, r = this._getDiffKeys(s[0], n[0]);
|
|
@@ -5239,46 +5316,46 @@ class Bs {
|
|
|
5239
5316
|
}
|
|
5240
5317
|
return this.viralViewerApi.viralVisibilityManager.exceptElements = [], this.viralViewerApi.viralScene.bimWorld.changeColor(
|
|
5241
5318
|
i.deleted.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
|
|
5242
|
-
|
|
5319
|
+
D.hexToRGB(y.deleted),
|
|
5243
5320
|
!0
|
|
5244
5321
|
), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
|
|
5245
5322
|
elements: i.deleted.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
|
|
5246
|
-
color:
|
|
5323
|
+
color: D.hexToRGB(y.deleted)
|
|
5247
5324
|
}), this.viralViewerApi.viralScene.bimWorld.changeColor(
|
|
5248
5325
|
i.added.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
|
|
5249
|
-
|
|
5326
|
+
D.hexToRGB(y.added),
|
|
5250
5327
|
!0
|
|
5251
5328
|
), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
|
|
5252
5329
|
elements: i.added.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
|
|
5253
|
-
color:
|
|
5330
|
+
color: D.hexToRGB(y.added)
|
|
5254
5331
|
}), this.viralViewerApi.viralScene.bimWorld.changeColor(
|
|
5255
5332
|
i.modified.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
|
|
5256
|
-
|
|
5333
|
+
D.hexToRGB(y.modified),
|
|
5257
5334
|
!0
|
|
5258
5335
|
), this.viralViewerApi.viralScene.bimWorld.changeColor(
|
|
5259
5336
|
i.modified.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
|
|
5260
|
-
|
|
5337
|
+
D.hexToRGB(y.modified),
|
|
5261
5338
|
!0
|
|
5262
5339
|
), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
|
|
5263
5340
|
elements: i.modified.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
|
|
5264
|
-
color:
|
|
5341
|
+
color: D.hexToRGB(y.modified)
|
|
5265
5342
|
}), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
|
|
5266
5343
|
elements: i.modified.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
|
|
5267
|
-
color:
|
|
5344
|
+
color: D.hexToRGB(y.modified)
|
|
5268
5345
|
}), this.viralViewerApi.viralScene.bimWorld.changeColor(
|
|
5269
5346
|
i.notChanged.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
|
|
5270
|
-
|
|
5347
|
+
D.hexToRGB(y.notChanged),
|
|
5271
5348
|
!0
|
|
5272
5349
|
), this.viralViewerApi.viralScene.bimWorld.changeColor(
|
|
5273
5350
|
i.notChanged.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
|
|
5274
|
-
|
|
5351
|
+
D.hexToRGB(y.notChanged),
|
|
5275
5352
|
!0
|
|
5276
5353
|
), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
|
|
5277
5354
|
elements: i.notChanged.map((a) => ({ elementId: a.toString(), modelId: e.toString() })),
|
|
5278
|
-
color:
|
|
5355
|
+
color: D.hexToRGB(y.notChanged)
|
|
5279
5356
|
}), this.viralViewerApi.viralVisibilityManager.exceptElements.push({
|
|
5280
5357
|
elements: i.notChanged.map((a) => ({ elementId: a.toString(), modelId: t.toString() })),
|
|
5281
|
-
color:
|
|
5358
|
+
color: D.hexToRGB(y.notChanged)
|
|
5282
5359
|
}), this.viralViewerApi.viralRenderer.render(), i;
|
|
5283
5360
|
}
|
|
5284
5361
|
uncompareModels() {
|
|
@@ -5307,7 +5384,7 @@ class Bs {
|
|
|
5307
5384
|
if (i.length > 0 && s.length > 0) {
|
|
5308
5385
|
const n = i[0], r = s[0];
|
|
5309
5386
|
console.log(
|
|
5310
|
-
|
|
5387
|
+
P.objectsIntersect(
|
|
5311
5388
|
Array.from(n.buffer),
|
|
5312
5389
|
Array.from(r.buffer)
|
|
5313
5390
|
)
|
|
@@ -5320,7 +5397,7 @@ class Bs {
|
|
|
5320
5397
|
* @param secondModelIndex
|
|
5321
5398
|
*/
|
|
5322
5399
|
async checkClashModels(e = 0, t = 0) {
|
|
5323
|
-
const i = new
|
|
5400
|
+
const i = new cs(), s = this.viralViewerApi.viralScene.bimWorld.getElementsByModel(e), n = e === t ? s : this.viralViewerApi.viralScene.bimWorld.getElementsByModel(t);
|
|
5324
5401
|
if (s.length === 0 || n.length === 0)
|
|
5325
5402
|
return i;
|
|
5326
5403
|
const r = (h) => new Promise((d) => {
|
|
@@ -5361,13 +5438,13 @@ class Bs {
|
|
|
5361
5438
|
(w) => f.includes(Number.parseInt(w.elementId))
|
|
5362
5439
|
), b = [];
|
|
5363
5440
|
for (let w = 0; w < v.length; w++) {
|
|
5364
|
-
const
|
|
5365
|
-
if (d.buffer &&
|
|
5366
|
-
const A = () => new Promise((
|
|
5441
|
+
const S = v[w];
|
|
5442
|
+
if (d.buffer && S.buffer) {
|
|
5443
|
+
const A = () => new Promise((C) => {
|
|
5367
5444
|
this._checkClashWorker.checkClash(
|
|
5368
5445
|
{
|
|
5369
5446
|
buffer1: Array.from(d.buffer),
|
|
5370
|
-
buffer2: Array.from(
|
|
5447
|
+
buffer2: Array.from(S.buffer)
|
|
5371
5448
|
},
|
|
5372
5449
|
(_) => {
|
|
5373
5450
|
if (_) {
|
|
@@ -5377,14 +5454,14 @@ class Bs {
|
|
|
5377
5454
|
Number.parseInt(d.elementId),
|
|
5378
5455
|
[]
|
|
5379
5456
|
);
|
|
5380
|
-
const
|
|
5457
|
+
const I = i.clashes.get(
|
|
5381
5458
|
Number.parseInt(d.elementId)
|
|
5382
5459
|
);
|
|
5383
|
-
|
|
5384
|
-
Number.parseInt(
|
|
5460
|
+
I == null || I.push(
|
|
5461
|
+
Number.parseInt(S.elementId)
|
|
5385
5462
|
);
|
|
5386
5463
|
}
|
|
5387
|
-
|
|
5464
|
+
C();
|
|
5388
5465
|
}
|
|
5389
5466
|
);
|
|
5390
5467
|
});
|
|
@@ -5411,7 +5488,7 @@ class Bs {
|
|
|
5411
5488
|
(h) => this._shallowCompare(h.value, l)
|
|
5412
5489
|
);
|
|
5413
5490
|
if (c < 0) {
|
|
5414
|
-
const h = new
|
|
5491
|
+
const h = new hs();
|
|
5415
5492
|
h.value = l, h.modelId = s, h.elementIds = [], h.elementIds.push(Number(o)), t.push(h);
|
|
5416
5493
|
} else
|
|
5417
5494
|
t[c].elementIds.push(Number(o));
|
|
@@ -5438,7 +5515,7 @@ class Bs {
|
|
|
5438
5515
|
}
|
|
5439
5516
|
//#endregion
|
|
5440
5517
|
}
|
|
5441
|
-
class
|
|
5518
|
+
class $s {
|
|
5442
5519
|
constructor() {
|
|
5443
5520
|
this.events = {
|
|
5444
5521
|
[k.LOADED_SCENE]: [],
|
|
@@ -5480,7 +5557,7 @@ class zs {
|
|
|
5480
5557
|
i && i.forEach((s) => s(...t));
|
|
5481
5558
|
}
|
|
5482
5559
|
}
|
|
5483
|
-
class
|
|
5560
|
+
class js {
|
|
5484
5561
|
constructor(e) {
|
|
5485
5562
|
this.viralViewerApi = e, this.keydownQueuedEvents = [], this.keyupQueuedEvents = [], this.setupKeyPress();
|
|
5486
5563
|
}
|
|
@@ -5505,17 +5582,17 @@ class Ns {
|
|
|
5505
5582
|
*/
|
|
5506
5583
|
addEventListener(e, t, i) {
|
|
5507
5584
|
switch (e) {
|
|
5508
|
-
case
|
|
5585
|
+
case we.KEYDOWN:
|
|
5509
5586
|
this.keydownQueuedEvents.push([t, i]);
|
|
5510
5587
|
break;
|
|
5511
|
-
case
|
|
5588
|
+
case we.KEYUP:
|
|
5512
5589
|
this.keyupQueuedEvents.push([t, i]);
|
|
5513
5590
|
break;
|
|
5514
5591
|
}
|
|
5515
5592
|
}
|
|
5516
5593
|
removeEventListener(e, t) {
|
|
5517
5594
|
switch (e) {
|
|
5518
|
-
case
|
|
5595
|
+
case we.KEYDOWN:
|
|
5519
5596
|
{
|
|
5520
5597
|
const i = this.keydownQueuedEvents.findIndex((s) => s[0] === t);
|
|
5521
5598
|
this.keydownQueuedEvents.splice(i, 1);
|
|
@@ -5528,7 +5605,7 @@ class Ns {
|
|
|
5528
5605
|
}
|
|
5529
5606
|
//#endregion
|
|
5530
5607
|
}
|
|
5531
|
-
class
|
|
5608
|
+
class Hs {
|
|
5532
5609
|
constructor(e) {
|
|
5533
5610
|
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) => {
|
|
5534
5611
|
var i, s, n;
|
|
@@ -5539,10 +5616,10 @@ class $s {
|
|
|
5539
5616
|
c(t);
|
|
5540
5617
|
});
|
|
5541
5618
|
const r = performance.now(), o = this.viralViewerApi.viralCamera.clientToWorld();
|
|
5542
|
-
if (this.viralViewerApi.options.isDev &&
|
|
5619
|
+
if (this.viralViewerApi.options.isDev && J.information("Time to ray cast: " + (performance.now() - r)), o && o.length > 0 && !((i = this.viralViewerApi.viralSectionBox) != null && i.isVisible)) {
|
|
5543
5620
|
let l = null;
|
|
5544
5621
|
for (const c of o)
|
|
5545
|
-
if (c.object instanceof
|
|
5622
|
+
if (c.object instanceof ee) {
|
|
5546
5623
|
const h = c.object.findElementByFaceIndex(
|
|
5547
5624
|
((s = c.face) == null ? void 0 : s.a) ?? 0
|
|
5548
5625
|
);
|
|
@@ -5559,7 +5636,7 @@ class $s {
|
|
|
5559
5636
|
}
|
|
5560
5637
|
l = c;
|
|
5561
5638
|
break;
|
|
5562
|
-
} else if (c.object instanceof
|
|
5639
|
+
} else if (c.object instanceof me) {
|
|
5563
5640
|
const h = c;
|
|
5564
5641
|
if (h.modelId && h.elementId) {
|
|
5565
5642
|
const d = c.object.isElementVisible(
|
|
@@ -5574,7 +5651,7 @@ class $s {
|
|
|
5574
5651
|
}
|
|
5575
5652
|
l = c;
|
|
5576
5653
|
break;
|
|
5577
|
-
} else if (c.object instanceof
|
|
5654
|
+
} else if (c.object instanceof pe) {
|
|
5578
5655
|
l = c;
|
|
5579
5656
|
break;
|
|
5580
5657
|
}
|
|
@@ -5628,53 +5705,53 @@ class $s {
|
|
|
5628
5705
|
*/
|
|
5629
5706
|
addEventListener(e, t, i) {
|
|
5630
5707
|
switch (e) {
|
|
5631
|
-
case
|
|
5708
|
+
case $.ON_MOUSE_MOVE:
|
|
5632
5709
|
this.mouseMoveQueuedEvents.push([t, i]);
|
|
5633
5710
|
break;
|
|
5634
|
-
case
|
|
5711
|
+
case $.ON_MOUSE_DOWN_LEFT:
|
|
5635
5712
|
this.mouseDownLeftQueuedEvents.push([t, i]);
|
|
5636
5713
|
break;
|
|
5637
|
-
case
|
|
5714
|
+
case $.ON_MOUSE_UP_LEFT:
|
|
5638
5715
|
this.mouseUpLeftQueuedEvents.push([t, i]);
|
|
5639
5716
|
break;
|
|
5640
|
-
case
|
|
5717
|
+
case $.ON_MOUSE_DOWN_RIGHT:
|
|
5641
5718
|
this.mouseDownRightQueuedEvents.push([t, i]);
|
|
5642
5719
|
break;
|
|
5643
|
-
case
|
|
5720
|
+
case $.ON_MOUSE_UP_RIGHT:
|
|
5644
5721
|
this.mouseUpRightQueuedEvents.push([t, i]);
|
|
5645
5722
|
break;
|
|
5646
|
-
case
|
|
5723
|
+
case $.ON_MOUSE_DOUBLE_CLICK:
|
|
5647
5724
|
this.mouseDoubleClickQueuedEvents.push([t, i]);
|
|
5648
5725
|
break;
|
|
5649
5726
|
}
|
|
5650
5727
|
}
|
|
5651
5728
|
removeEventListener(e, t) {
|
|
5652
5729
|
switch (e) {
|
|
5653
|
-
case
|
|
5730
|
+
case $.ON_MOUSE_MOVE:
|
|
5654
5731
|
{
|
|
5655
5732
|
const i = this.mouseMoveQueuedEvents.findIndex((s) => s[0] === t);
|
|
5656
5733
|
this.mouseMoveQueuedEvents.splice(i, 1);
|
|
5657
5734
|
}
|
|
5658
5735
|
break;
|
|
5659
|
-
case
|
|
5736
|
+
case $.ON_MOUSE_DOWN_LEFT:
|
|
5660
5737
|
{
|
|
5661
5738
|
const i = this.mouseDownLeftQueuedEvents.findIndex((s) => s[0] === t);
|
|
5662
5739
|
this.mouseDownLeftQueuedEvents.splice(i, 1);
|
|
5663
5740
|
}
|
|
5664
5741
|
break;
|
|
5665
|
-
case
|
|
5742
|
+
case $.ON_MOUSE_UP_LEFT:
|
|
5666
5743
|
{
|
|
5667
5744
|
const i = this.mouseUpLeftQueuedEvents.findIndex((s) => s[0] === t);
|
|
5668
5745
|
this.mouseUpLeftQueuedEvents.splice(i, 1);
|
|
5669
5746
|
}
|
|
5670
5747
|
break;
|
|
5671
|
-
case
|
|
5748
|
+
case $.ON_MOUSE_DOWN_RIGHT:
|
|
5672
5749
|
{
|
|
5673
5750
|
const i = this.mouseDownRightQueuedEvents.findIndex((s) => s[0] === t);
|
|
5674
5751
|
this.mouseDownRightQueuedEvents.splice(i, 1);
|
|
5675
5752
|
}
|
|
5676
5753
|
break;
|
|
5677
|
-
case
|
|
5754
|
+
case $.ON_MOUSE_UP_RIGHT:
|
|
5678
5755
|
{
|
|
5679
5756
|
const i = this.mouseUpRightQueuedEvents.findIndex((s) => s[0] === t);
|
|
5680
5757
|
this.mouseUpRightQueuedEvents.splice(i, 1);
|
|
@@ -5702,14 +5779,14 @@ class $s {
|
|
|
5702
5779
|
}
|
|
5703
5780
|
//#endregion
|
|
5704
5781
|
}
|
|
5705
|
-
const
|
|
5782
|
+
const We = {
|
|
5706
5783
|
showAll: (g, e) => `<svg xmlns="http://www.w3.org/2000/svg" fill=${e || ""} height=${g || 24} viewBox="0 -960 960 960" width="24"><path d="M240-160q-33 0-56.5-23.5T160-240q0-33 23.5-56.5T240-320q33 0 56.5 23.5T320-240q0 33-23.5 56.5T240-160Zm240 0q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm240 0q-33 0-56.5-23.5T640-240q0-33 23.5-56.5T720-320q33 0 56.5 23.5T800-240q0 33-23.5 56.5T720-160ZM240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400ZM240-640q-33 0-56.5-23.5T160-720q0-33 23.5-56.5T240-800q33 0 56.5 23.5T320-720q0 33-23.5 56.5T240-640Zm240 0q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Zm240 0q-33 0-56.5-23.5T640-720q0-33 23.5-56.5T720-800q33 0 56.5 23.5T800-720q0 33-23.5 56.5T720-640Z"/></svg>`,
|
|
5707
5784
|
isolate: (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-760v-80h80v80h-80Zm0 640v-80h80v80h-80ZM280-760v-80h80v80h-80Zm0 640v-80h80v80h-80ZM120-760v-80h80v80h-80Zm0 160v-80h80v80h-80Zm0 160v-80h80v80h-80Zm0 160v-80h80v80h-80Zm0 160v-80h80v80h-80Zm480 0v-80h80v-560h-80v-80h240v80h-80v560h80v80H600Z"/></svg>`,
|
|
5708
5785
|
hide: (g, e) => `<svg xmlns="http://www.w3.org/2000/svg" fill=${e || ""} height=${g || 24} viewBox="0 -960 960 960" width="24"><path d="M200-120q-33 0-56.5-23.5T120-200h80v80Zm-80-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160q0-33 23.5-56.5T200-840v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm60 640-56-56 142-142-142-142 56-56 142 142 142-142 56 56-142 142 142 142-56 56-142-142-142 142Zm100-640v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80q33 0 56.5 23.5T840-760h-80Z"/></svg>`,
|
|
5709
5786
|
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>`,
|
|
5710
5787
|
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>`
|
|
5711
5788
|
};
|
|
5712
|
-
class
|
|
5789
|
+
class Fs {
|
|
5713
5790
|
constructor(e) {
|
|
5714
5791
|
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;
|
|
5715
5792
|
}
|
|
@@ -5717,40 +5794,40 @@ class js {
|
|
|
5717
5794
|
this.viralViewerApi.viralContextMenu && (this.viralViewerApi.viralContextMenu.addContextItem(
|
|
5718
5795
|
0,
|
|
5719
5796
|
"Show all elements",
|
|
5720
|
-
|
|
5797
|
+
We.showAll(void 0, y.primary),
|
|
5721
5798
|
(e) => {
|
|
5722
5799
|
this._visibilityManager.showAll2(), this.viralViewerApi.viralContextMenu.hideContextMenu();
|
|
5723
5800
|
}
|
|
5724
5801
|
), this.viralViewerApi.viralContextMenu.addContextItem(
|
|
5725
5802
|
1,
|
|
5726
5803
|
"Isolate",
|
|
5727
|
-
|
|
5804
|
+
We.isolate(void 0, y.primary),
|
|
5728
5805
|
(e) => {
|
|
5729
5806
|
this._visibilityManager.isolate2(), this.viralViewerApi.viralContextMenu.hideContextMenu();
|
|
5730
5807
|
}
|
|
5731
5808
|
), this.viralViewerApi.viralContextMenu.addContextItem(
|
|
5732
5809
|
2,
|
|
5733
5810
|
"Hide",
|
|
5734
|
-
|
|
5811
|
+
We.hide(void 0, y.primary),
|
|
5735
5812
|
(e) => {
|
|
5736
5813
|
this._visibilityManager.hide2(), this.viralViewerApi.viralContextMenu.hideContextMenu();
|
|
5737
5814
|
}
|
|
5738
5815
|
), this.viralViewerApi.viralContextMenu.addContextItem(
|
|
5739
5816
|
3,
|
|
5740
5817
|
"Focus",
|
|
5741
|
-
|
|
5818
|
+
We.focus(void 0, y.primary),
|
|
5742
5819
|
(e) => {
|
|
5743
5820
|
this._visibilityManager.zoomTo(), this.viralViewerApi.viralContextMenu.hideContextMenu();
|
|
5744
5821
|
}
|
|
5745
5822
|
), this.viralViewerApi.viralContextMenu.addContextItem(
|
|
5746
5823
|
4,
|
|
5747
5824
|
"Properties",
|
|
5748
|
-
|
|
5825
|
+
We.properties(void 0, y.secondary),
|
|
5749
5826
|
(e) => {
|
|
5750
5827
|
this.viralViewerApi.viralDraggableModal.show(), this.viralViewerApi.viralContextMenu.hideContextMenu();
|
|
5751
5828
|
}
|
|
5752
5829
|
)), this.viralViewerApi.viralMouse && (this.viralViewerApi.viralMouse.addEventListener(
|
|
5753
|
-
|
|
5830
|
+
$.ON_MOUSE_DOWN_RIGHT,
|
|
5754
5831
|
"ShowContextMenu",
|
|
5755
5832
|
(e) => {
|
|
5756
5833
|
this.viralViewerApi.viralContextMenu.showContextMenu(
|
|
@@ -5760,7 +5837,7 @@ class js {
|
|
|
5760
5837
|
);
|
|
5761
5838
|
}
|
|
5762
5839
|
), this.viralViewerApi.viralMouse.addEventListener(
|
|
5763
|
-
|
|
5840
|
+
$.ON_MOUSE_DOWN_LEFT,
|
|
5764
5841
|
"HideContextMenu",
|
|
5765
5842
|
(e) => {
|
|
5766
5843
|
this.viralViewerApi.viralContextMenu.hideContextMenu();
|
|
@@ -5770,13 +5847,13 @@ class js {
|
|
|
5770
5847
|
// ms to wait before confirming camera is steady
|
|
5771
5848
|
cameraHandler() {
|
|
5772
5849
|
this.viralViewerApi.viralCamera && (this.viralViewerApi.viralCamera.addEventListener(
|
|
5773
|
-
|
|
5850
|
+
se.ON_WAKE,
|
|
5774
5851
|
"hide objects",
|
|
5775
5852
|
() => {
|
|
5776
5853
|
this._sleepDebounceTimer && (clearTimeout(this._sleepDebounceTimer), this._sleepDebounceTimer = null), this.viralViewerApi.viralVisibilityManager.bypassScreenSpaceEdge(), this.viralViewerApi.viralVisibilityManager.bypassSelectionOutline(), this.viralViewerApi.viralVisibilityManager.disableAmbientOcclusion(), this.viralViewerApi.viralVisibilityManager.disableSampling();
|
|
5777
5854
|
}
|
|
5778
5855
|
), this.viralViewerApi.viralCamera.addEventListener(
|
|
5779
|
-
|
|
5856
|
+
se.ON_SLEEP,
|
|
5780
5857
|
"unhide objects",
|
|
5781
5858
|
() => {
|
|
5782
5859
|
this._sleepDebounceTimer && clearTimeout(this._sleepDebounceTimer), this._sleepDebounceTimer = setTimeout(() => {
|
|
@@ -5802,13 +5879,13 @@ class js {
|
|
|
5802
5879
|
let e = null;
|
|
5803
5880
|
const t = 250;
|
|
5804
5881
|
this.viralViewerApi.viralMouse.addEventListener(
|
|
5805
|
-
|
|
5882
|
+
$.ON_MOUSE_DOWN_LEFT,
|
|
5806
5883
|
"SelectElement",
|
|
5807
5884
|
(i) => {
|
|
5808
5885
|
e = performance.now();
|
|
5809
5886
|
}
|
|
5810
5887
|
), this.viralViewerApi.viralMouse.addEventListener(
|
|
5811
|
-
|
|
5888
|
+
$.ON_MOUSE_UP_LEFT,
|
|
5812
5889
|
"SelectElementUp",
|
|
5813
5890
|
(i) => {
|
|
5814
5891
|
var s, n;
|
|
@@ -5831,7 +5908,7 @@ class js {
|
|
|
5831
5908
|
if (c)
|
|
5832
5909
|
break;
|
|
5833
5910
|
const d = h;
|
|
5834
|
-
if (d.object instanceof
|
|
5911
|
+
if (d.object instanceof ee && d.face) {
|
|
5835
5912
|
const u = d.object.findElementByFaceIndex(
|
|
5836
5913
|
d.face.a
|
|
5837
5914
|
);
|
|
@@ -5896,14 +5973,14 @@ class js {
|
|
|
5896
5973
|
//#region Double Click element handler
|
|
5897
5974
|
doubleClickElementHandler() {
|
|
5898
5975
|
this.viralViewerApi.viralMouse.addEventListener(
|
|
5899
|
-
|
|
5976
|
+
$.ON_MOUSE_DOUBLE_CLICK,
|
|
5900
5977
|
"DoubleClickElement",
|
|
5901
5978
|
(e) => {
|
|
5902
5979
|
const t = this.viralViewerApi.viralCamera.clientToWorld();
|
|
5903
5980
|
if (t && (t == null ? void 0 : t.length) > 0)
|
|
5904
5981
|
for (const s of t) {
|
|
5905
5982
|
const n = s;
|
|
5906
|
-
if (n.object instanceof
|
|
5983
|
+
if (n.object instanceof ee && n.face) {
|
|
5907
5984
|
const r = n.object.findElementByFaceIndex(
|
|
5908
5985
|
n.face.a
|
|
5909
5986
|
);
|
|
@@ -5940,13 +6017,13 @@ class js {
|
|
|
5940
6017
|
}
|
|
5941
6018
|
keyboardHandler() {
|
|
5942
6019
|
this.viralViewerApi.viralKeyboard && (this.viralViewerApi.viralKeyboard.addEventListener(
|
|
5943
|
-
|
|
6020
|
+
we.KEYUP,
|
|
5944
6021
|
"KeyUp",
|
|
5945
6022
|
(e) => {
|
|
5946
6023
|
e.shiftKey === !1 && (this.isShiftPressed = !1);
|
|
5947
6024
|
}
|
|
5948
6025
|
), this.viralViewerApi.viralKeyboard.addEventListener(
|
|
5949
|
-
|
|
6026
|
+
we.KEYDOWN,
|
|
5950
6027
|
"KeyDown",
|
|
5951
6028
|
(e) => {
|
|
5952
6029
|
e.shiftKey && (this.isShiftPressed = !0);
|
|
@@ -5955,7 +6032,7 @@ class js {
|
|
|
5955
6032
|
}
|
|
5956
6033
|
//#endregion
|
|
5957
6034
|
}
|
|
5958
|
-
class
|
|
6035
|
+
class Ws {
|
|
5959
6036
|
constructor(e, t) {
|
|
5960
6037
|
this.viralViewerApi = e, this.options = t, this.viralViewerApi.on(k.LOADED_SCENE, () => this.loadedScene()), this.viralViewerApi.on(
|
|
5961
6038
|
k.LOADED_MATERIAL_MANAGER,
|
|
@@ -5966,41 +6043,41 @@ class Hs {
|
|
|
5966
6043
|
);
|
|
5967
6044
|
}
|
|
5968
6045
|
loadedScene() {
|
|
5969
|
-
this.options.isDev &&
|
|
6046
|
+
this.options.isDev && J.information("scene loaded!"), this.viralViewerApi.off(k.LOADED_SCENE, () => this.loadedScene());
|
|
5970
6047
|
}
|
|
5971
6048
|
loadedMaterialManager() {
|
|
5972
|
-
this.options.isDev &&
|
|
6049
|
+
this.options.isDev && J.information("material manager loaded!"), this.viralViewerApi.off(
|
|
5973
6050
|
k.LOADED_MATERIAL_MANAGER,
|
|
5974
6051
|
() => this.loadedMaterialManager()
|
|
5975
6052
|
);
|
|
5976
6053
|
}
|
|
5977
6054
|
loadedRenderer() {
|
|
5978
|
-
this.options.isDev &&
|
|
6055
|
+
this.options.isDev && J.information("renderer loaded!"), this.viralViewerApi.off(k.LOADED_RENDERER, () => this.loadedRenderer());
|
|
5979
6056
|
}
|
|
5980
6057
|
loadedCamera() {
|
|
5981
|
-
this.options.isDev &&
|
|
6058
|
+
this.options.isDev && J.information("camera loaded!");
|
|
5982
6059
|
}
|
|
5983
6060
|
loadedCube() {
|
|
5984
|
-
this.options.isDev &&
|
|
6061
|
+
this.options.isDev && J.information("cube loaded!"), this.viralViewerApi.off(k.LOADED_CUBE, () => this.loadedCube());
|
|
5985
6062
|
}
|
|
5986
6063
|
loadedTools() {
|
|
5987
|
-
this.options.isDev &&
|
|
6064
|
+
this.options.isDev && J.information("tools loaded!"), this.viralViewerApi.off(k.LOADED_TOOLS, () => this.loadedTools());
|
|
5988
6065
|
}
|
|
5989
6066
|
async loadedModels(e) {
|
|
5990
|
-
this.options.isDev &&
|
|
5991
|
-
if (t instanceof
|
|
6067
|
+
this.options.isDev && J.information(`model ${e.modelId} loaded!`), this.viralViewerApi.viralScene.selectables = [], this.viralViewerApi.viralScene.selectables = [], this.viralViewerApi.viralScene.bimWorld.children.forEach((t) => {
|
|
6068
|
+
if (t instanceof ee) {
|
|
5992
6069
|
this.viralViewerApi.viralScene.selectables.push(t);
|
|
5993
6070
|
return;
|
|
5994
6071
|
}
|
|
5995
|
-
t instanceof
|
|
6072
|
+
t instanceof me && t.getInstancedMeshes().forEach((s) => {
|
|
5996
6073
|
this.viralViewerApi.viralScene.selectables.push(s);
|
|
5997
6074
|
});
|
|
5998
6075
|
});
|
|
5999
6076
|
}
|
|
6000
6077
|
}
|
|
6001
|
-
class
|
|
6078
|
+
class Gs {
|
|
6002
6079
|
constructor(e) {
|
|
6003
|
-
this.viralViewerApi = e, this.potree = new
|
|
6080
|
+
this.viralViewerApi = e, this.potree = new Ri(), this.pointClouds = [];
|
|
6004
6081
|
}
|
|
6005
6082
|
/**
|
|
6006
6083
|
*
|
|
@@ -6016,13 +6093,13 @@ class Fs {
|
|
|
6016
6093
|
(r = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || r.disableOutline(), this.potree.pointBudget = s, this.potree.loadPointCloudCustom(e, t, i).then((o) => {
|
|
6017
6094
|
var d;
|
|
6018
6095
|
const a = o.material;
|
|
6019
|
-
a.size = 1, a.pointSizeType =
|
|
6020
|
-
const l = new E(0, -1.5, 3), c = new
|
|
6096
|
+
a.size = 1, a.pointSizeType = Li.ADAPTIVE, a.shape = ki.CIRCLE, a.pointColorType = Bi.RGB, a.inputColorEncoding = 1, a.outputColorEncoding = 1, console.log(o.boundingBox);
|
|
6097
|
+
const l = new E(0, -1.5, 3), c = new li(-Math.PI / 2, 0, 0), h = new E(2, 2, 2);
|
|
6021
6098
|
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);
|
|
6022
6099
|
});
|
|
6023
6100
|
}
|
|
6024
6101
|
}
|
|
6025
|
-
class
|
|
6102
|
+
class Us {
|
|
6026
6103
|
static getDeviceType() {
|
|
6027
6104
|
const e = navigator.userAgent.toLowerCase(), t = /iphone|ipod|android.*mobile|blackberry|opera mini|windows phone/i.test(
|
|
6028
6105
|
e
|
|
@@ -6030,7 +6107,7 @@ class Ws {
|
|
|
6030
6107
|
return t ? "mobile" : i ? "tablet" : "pc";
|
|
6031
6108
|
}
|
|
6032
6109
|
}
|
|
6033
|
-
class
|
|
6110
|
+
class qs {
|
|
6034
6111
|
constructor() {
|
|
6035
6112
|
this.gl = null, this.specs = null, this.initWebGL(), this.detectSpecs();
|
|
6036
6113
|
}
|
|
@@ -6174,7 +6251,7 @@ class Gs {
|
|
|
6174
6251
|
});
|
|
6175
6252
|
}
|
|
6176
6253
|
}
|
|
6177
|
-
class
|
|
6254
|
+
class Qs {
|
|
6178
6255
|
constructor() {
|
|
6179
6256
|
this.modelId = -1, this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new _t();
|
|
6180
6257
|
}
|
|
@@ -6183,7 +6260,7 @@ class Us {
|
|
|
6183
6260
|
this.elements = [], this.materials = [], this.mapMaterialsToMaterialManager = new _t();
|
|
6184
6261
|
}
|
|
6185
6262
|
}
|
|
6186
|
-
class
|
|
6263
|
+
class Zs {
|
|
6187
6264
|
constructor() {
|
|
6188
6265
|
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;
|
|
6189
6266
|
}
|
|
@@ -6332,8 +6409,8 @@ class qs {
|
|
|
6332
6409
|
}
|
|
6333
6410
|
}
|
|
6334
6411
|
}
|
|
6335
|
-
const
|
|
6336
|
-
function
|
|
6412
|
+
const Ys = new Zs();
|
|
6413
|
+
function Xs() {
|
|
6337
6414
|
class g {
|
|
6338
6415
|
constructor() {
|
|
6339
6416
|
this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
@@ -6380,8 +6457,8 @@ function Zs() {
|
|
|
6380
6457
|
]);
|
|
6381
6458
|
const u = d.elements;
|
|
6382
6459
|
for (let p = 0; p < o; p++) {
|
|
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]),
|
|
6384
|
-
a[
|
|
6460
|
+
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]), S = p * 3;
|
|
6461
|
+
a[S] = (u[0] * f + u[4] * v + u[8] * b + u[12]) * w, a[S + 1] = (u[1] * f + u[5] * v + u[9] * b + u[13]) * w, a[S + 2] = (u[2] * f + u[6] * v + u[10] * b + u[14]) * w;
|
|
6385
6462
|
}
|
|
6386
6463
|
return a;
|
|
6387
6464
|
}
|
|
@@ -6418,8 +6495,8 @@ function Zs() {
|
|
|
6418
6495
|
}), self.postMessage(r);
|
|
6419
6496
|
};
|
|
6420
6497
|
}
|
|
6421
|
-
const
|
|
6422
|
-
function
|
|
6498
|
+
const Ks = Xs;
|
|
6499
|
+
function Js() {
|
|
6423
6500
|
class g {
|
|
6424
6501
|
constructor() {
|
|
6425
6502
|
this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
@@ -6466,8 +6543,8 @@ function Xs() {
|
|
|
6466
6543
|
]);
|
|
6467
6544
|
const u = d.elements;
|
|
6468
6545
|
for (let p = 0; p < o; p++) {
|
|
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]),
|
|
6470
|
-
a[
|
|
6546
|
+
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]), S = p * 3;
|
|
6547
|
+
a[S] = (u[0] * f + u[4] * v + u[8] * b + u[12]) * w, a[S + 1] = (u[1] * f + u[5] * v + u[9] * b + u[13]) * w, a[S + 2] = (u[2] * f + u[6] * v + u[10] * b + u[14]) * w;
|
|
6471
6548
|
}
|
|
6472
6549
|
return a;
|
|
6473
6550
|
}
|
|
@@ -6509,19 +6586,19 @@ function Xs() {
|
|
|
6509
6586
|
}), self.postMessage(r);
|
|
6510
6587
|
};
|
|
6511
6588
|
}
|
|
6512
|
-
const
|
|
6513
|
-
class
|
|
6589
|
+
const en = Js;
|
|
6590
|
+
class tn {
|
|
6514
6591
|
// Or 5K objects
|
|
6515
6592
|
//#endregion
|
|
6516
6593
|
constructor(e) {
|
|
6517
6594
|
this.viralViewerApi = e, this.lastRenderTime = 0, this.elementBuffer = /* @__PURE__ */ new Map(), this.BATCH_THRESHOLD_VERTICES = 1e5, this.BATCH_THRESHOLD_OBJECTS = 5e3;
|
|
6518
|
-
const t = new Blob([`(${
|
|
6519
|
-
this.workerPool = new
|
|
6595
|
+
const t = new Blob([`(${Ks})()`]), i = URL.createObjectURL(t);
|
|
6596
|
+
this.workerPool = new oe(
|
|
6520
6597
|
navigator.hardwareConcurrency || this.viralViewerApi.options.numberOfWorker,
|
|
6521
6598
|
i
|
|
6522
6599
|
);
|
|
6523
|
-
const s = new Blob([`(${
|
|
6524
|
-
this.workerPool2 = new
|
|
6600
|
+
const s = new Blob([`(${en})()`]), n = URL.createObjectURL(s);
|
|
6601
|
+
this.workerPool2 = new oe(
|
|
6525
6602
|
this.viralViewerApi.options.numberOfWorker,
|
|
6526
6603
|
n
|
|
6527
6604
|
);
|
|
@@ -6533,11 +6610,11 @@ class Js {
|
|
|
6533
6610
|
*/
|
|
6534
6611
|
initial(e) {
|
|
6535
6612
|
console.log(e);
|
|
6536
|
-
const t = new
|
|
6613
|
+
const t = new Qs();
|
|
6537
6614
|
t.modelId = this.viralViewerApi.viralScene.bimWorld.bimModels.length, this.viralViewerApi.viralScene.bimWorld.bimModels.push(t);
|
|
6538
6615
|
const i = this.viralViewerApi.viralScene.bimWorld.bimModels.length - 1;
|
|
6539
6616
|
for (let s = 0; s < e.length; s++) {
|
|
6540
|
-
const n = e[s], r =
|
|
6617
|
+
const n = e[s], r = D.rgbToThreejsColor(
|
|
6541
6618
|
n.Red,
|
|
6542
6619
|
n.Green,
|
|
6543
6620
|
n.Blue
|
|
@@ -6545,7 +6622,7 @@ class Js {
|
|
|
6545
6622
|
(a) => a.userData.red === n.Red && a.userData.green === n.Green && a.userData.blue === n.Blue && a.userData.opacity === n.Opacity
|
|
6546
6623
|
);
|
|
6547
6624
|
if (o < 0) {
|
|
6548
|
-
const a = new
|
|
6625
|
+
const a = new ft({
|
|
6549
6626
|
color: r,
|
|
6550
6627
|
opacity: n.Opacity,
|
|
6551
6628
|
transparent: n.Opacity !== 1,
|
|
@@ -6556,7 +6633,7 @@ class Js {
|
|
|
6556
6633
|
// polygonOffset: true,
|
|
6557
6634
|
// polygonOffsetFactor: 1,
|
|
6558
6635
|
// polygonOffsetUnits: 0.1,
|
|
6559
|
-
side:
|
|
6636
|
+
side: ci
|
|
6560
6637
|
// 🔧 FIX: Changed from DoubleSide to halve draw calls
|
|
6561
6638
|
});
|
|
6562
6639
|
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);
|
|
@@ -6572,7 +6649,7 @@ class Js {
|
|
|
6572
6649
|
*/
|
|
6573
6650
|
loadElement(e, t, i = () => {
|
|
6574
6651
|
}, s = null) {
|
|
6575
|
-
const { highDuplicationElements: n, lowDuplicationElements: r } =
|
|
6652
|
+
const { highDuplicationElements: n, lowDuplicationElements: r } = Ys.analyze(t), o = r.map((p) => p.element), a = n.map((p) => p.element), l = o.length > 0, c = a.length > 0;
|
|
6576
6653
|
if (!l && !c) {
|
|
6577
6654
|
i();
|
|
6578
6655
|
return;
|
|
@@ -6662,7 +6739,7 @@ class Js {
|
|
|
6662
6739
|
createSingleMergedMesh(e, t, i) {
|
|
6663
6740
|
const s = this.createOptimizedMaterial(t);
|
|
6664
6741
|
this.viralViewerApi.viralMaterialManager.mergeMaterials.push(s);
|
|
6665
|
-
const n = new
|
|
6742
|
+
const n = new ee(
|
|
6666
6743
|
void 0,
|
|
6667
6744
|
s,
|
|
6668
6745
|
this.viralViewerApi.viralScene.bimWorld.workerPool
|
|
@@ -6672,7 +6749,7 @@ class Js {
|
|
|
6672
6749
|
createSingleInstancedMesh(e, t, i) {
|
|
6673
6750
|
const s = this.createOptimizedMaterial(t);
|
|
6674
6751
|
this.viralViewerApi.viralMaterialManager.mergeMaterials.push(s);
|
|
6675
|
-
const n = new
|
|
6752
|
+
const n = new me(s);
|
|
6676
6753
|
n.globalMaterialIndex = i, n.addBufferElements(e, t.color), n.castShadow = !0, n.receiveShadow = !0, s.userData.renderOrderHint && (n.renderOrder = s.userData.renderOrderHint), console.log(n), this.viralViewerApi.viralScene.bimWorld.addInstancedMesh(n);
|
|
6677
6754
|
}
|
|
6678
6755
|
/**
|
|
@@ -6680,14 +6757,14 @@ class Js {
|
|
|
6680
6757
|
* Uses onBeforeCompile to inject custom shader code for RGBA vertex colors
|
|
6681
6758
|
*/
|
|
6682
6759
|
createOptimizedMaterial(e) {
|
|
6683
|
-
const t =
|
|
6760
|
+
const t = Us.getDeviceType() === "pc", i = (r, o = 2) => {
|
|
6684
6761
|
if (!r)
|
|
6685
6762
|
return 16777215;
|
|
6686
6763
|
const a = r.clone();
|
|
6687
6764
|
return a.multiplyScalar(o), a;
|
|
6688
|
-
}, s = e.transparent || e.opacity < 1, n = t ? new
|
|
6765
|
+
}, s = e.transparent || e.opacity < 1, n = t ? new ne({
|
|
6689
6766
|
vertexColors: !0,
|
|
6690
|
-
side:
|
|
6767
|
+
side: ae,
|
|
6691
6768
|
// 🔧 FIX: Changed from DoubleSide to halve draw calls
|
|
6692
6769
|
opacity: e.opacity,
|
|
6693
6770
|
transparent: !0,
|
|
@@ -6705,7 +6782,7 @@ class Js {
|
|
|
6705
6782
|
isOriginallyTransparent: s
|
|
6706
6783
|
// Track original state
|
|
6707
6784
|
}
|
|
6708
|
-
}) : new
|
|
6785
|
+
}) : new Y({
|
|
6709
6786
|
vertexColors: !0,
|
|
6710
6787
|
opacity: e.opacity,
|
|
6711
6788
|
transparent: !0,
|
|
@@ -6851,9 +6928,9 @@ class Js {
|
|
|
6851
6928
|
}
|
|
6852
6929
|
//#endregion
|
|
6853
6930
|
}
|
|
6854
|
-
class
|
|
6931
|
+
class sn {
|
|
6855
6932
|
constructor(e) {
|
|
6856
|
-
this.viralViewerApi = e, this.elements = [], this._loadBatchedElementWorker = new
|
|
6933
|
+
this.viralViewerApi = e, this.elements = [], this._loadBatchedElementWorker = new tn(e);
|
|
6857
6934
|
}
|
|
6858
6935
|
//#region Load worker
|
|
6859
6936
|
async load(e, t, i, s = () => {
|
|
@@ -6924,7 +7001,7 @@ class en {
|
|
|
6924
7001
|
}
|
|
6925
7002
|
}
|
|
6926
7003
|
} catch (o) {
|
|
6927
|
-
|
|
7004
|
+
J.error(o);
|
|
6928
7005
|
}
|
|
6929
7006
|
})();
|
|
6930
7007
|
}
|
|
@@ -6997,9 +7074,9 @@ class en {
|
|
|
6997
7074
|
}), this.viralViewerApi.viralMaterialManager.mergeMaterials = [], this.viralViewerApi.viralVisibilityManager.disableGroundShadow(), this.viralViewerApi.viralRenderer.render(), this.viralViewerApi.viralDataManager.dataTree = [], this.viralViewerApi.viralScene.selectables = [];
|
|
6998
7075
|
}
|
|
6999
7076
|
}
|
|
7000
|
-
class
|
|
7077
|
+
class nn {
|
|
7001
7078
|
constructor(e) {
|
|
7002
|
-
this.viralViewerApi = e, this.objectLoader = new
|
|
7079
|
+
this.viralViewerApi = e, this.objectLoader = new hi(), this.gltfLoader = new zi();
|
|
7003
7080
|
}
|
|
7004
7081
|
parseObject(e) {
|
|
7005
7082
|
return this.objectLoader.parse(e);
|
|
@@ -7011,34 +7088,34 @@ class tn {
|
|
|
7011
7088
|
this.gltfLoader.load(e, t, i, s);
|
|
7012
7089
|
}
|
|
7013
7090
|
}
|
|
7014
|
-
class
|
|
7091
|
+
class rn {
|
|
7015
7092
|
constructor(e) {
|
|
7016
|
-
this.viralViewerApi = e, this.revitLoader = new
|
|
7093
|
+
this.viralViewerApi = e, this.revitLoader = new sn(this.viralViewerApi), this.pointCloudLoader = new Gs(this.viralViewerApi), this.threeLoader = new nn(this.viralViewerApi);
|
|
7017
7094
|
}
|
|
7018
7095
|
}
|
|
7019
|
-
class
|
|
7096
|
+
class an {
|
|
7020
7097
|
constructor(e) {
|
|
7021
|
-
this.viralViewerApi = e, this.hoverMaterial = new
|
|
7022
|
-
color:
|
|
7098
|
+
this.viralViewerApi = e, this.hoverMaterial = new ft({
|
|
7099
|
+
color: D.hexToThreejsColor(y.secondary),
|
|
7023
7100
|
opacity: 0.7,
|
|
7024
7101
|
transparent: !0,
|
|
7025
7102
|
depthTest: !1,
|
|
7026
7103
|
name: "Render Material",
|
|
7027
7104
|
flatShading: !0
|
|
7028
|
-
}), this.selectedMaterial = new
|
|
7029
|
-
color:
|
|
7105
|
+
}), this.selectedMaterial = new ft({
|
|
7106
|
+
color: D.hexToThreejsColor(y.secondary),
|
|
7030
7107
|
opacity: 0.7,
|
|
7031
7108
|
transparent: !0,
|
|
7032
7109
|
name: "Render Material",
|
|
7033
7110
|
depthTest: !1,
|
|
7034
7111
|
flatShading: !0
|
|
7035
|
-
}), this.edgeMaterial = new
|
|
7036
|
-
color:
|
|
7112
|
+
}), this.edgeMaterial = new Kt({
|
|
7113
|
+
color: D.hexToThreejsColor(y.edge),
|
|
7037
7114
|
linewidth: 2,
|
|
7038
7115
|
resolution: new H(window.innerWidth, window.innerHeight),
|
|
7039
7116
|
transparent: !0,
|
|
7040
7117
|
opacity: 0.8
|
|
7041
|
-
}), this.outlineMaterial = new
|
|
7118
|
+
}), this.outlineMaterial = new ne({
|
|
7042
7119
|
transparent: !0,
|
|
7043
7120
|
opacity: 0
|
|
7044
7121
|
}), this.materials = [], this.mergeMaterials = [], this.originalColors = [], this.viralViewerApi.emit(k.LOADED_MATERIAL_MANAGER);
|
|
@@ -7063,13 +7140,141 @@ class nn {
|
|
|
7063
7140
|
resetToOriginal() {
|
|
7064
7141
|
for (let e = 0; e < this.materials.length; e++) {
|
|
7065
7142
|
const t = this.materials[e];
|
|
7066
|
-
t instanceof
|
|
7143
|
+
t instanceof ft && t.color.set(this.originalColors[e]);
|
|
7144
|
+
}
|
|
7145
|
+
}
|
|
7146
|
+
}
|
|
7147
|
+
const on = {
|
|
7148
|
+
outlineColor: new N(y.secondary),
|
|
7149
|
+
outlineOpacity: 1,
|
|
7150
|
+
outlineThickness: 2,
|
|
7151
|
+
selectionAlpha: 0.99,
|
|
7152
|
+
alphaTolerance: 5e-3
|
|
7153
|
+
}, $t = `
|
|
7154
|
+
varying vec2 vUv;
|
|
7155
|
+
void main() {
|
|
7156
|
+
vUv = uv;
|
|
7157
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
7158
|
+
}
|
|
7159
|
+
`, ln = `
|
|
7160
|
+
precision highp float;
|
|
7161
|
+
|
|
7162
|
+
uniform sampler2D tDiffuse;
|
|
7163
|
+
|
|
7164
|
+
uniform vec2 resolution;
|
|
7165
|
+
uniform vec3 outlineColor;
|
|
7166
|
+
uniform float outlineOpacity;
|
|
7167
|
+
uniform float outlineThickness;
|
|
7168
|
+
uniform float selectionAlpha;
|
|
7169
|
+
uniform float alphaTolerance;
|
|
7170
|
+
|
|
7171
|
+
varying vec2 vUv;
|
|
7172
|
+
|
|
7173
|
+
// Check if pixel is selected based on alpha
|
|
7174
|
+
float isSelected(vec4 color) {
|
|
7175
|
+
return abs(color.a - selectionAlpha) < alphaTolerance ? 1.0 : 0.0;
|
|
7176
|
+
}
|
|
7177
|
+
|
|
7178
|
+
// Edge detection - find boundaries between selected and non-selected
|
|
7179
|
+
float detectSelectionEdge(vec2 uv, vec2 texelSize) {
|
|
7180
|
+
// Sample center
|
|
7181
|
+
vec4 center = texture2D(tDiffuse, uv);
|
|
7182
|
+
float centerSelected = isSelected(center);
|
|
7183
|
+
|
|
7184
|
+
// If center is selected, check if any neighbor is NOT selected (inner edge)
|
|
7185
|
+
// If center is NOT selected, check if any neighbor IS selected (outer edge)
|
|
7186
|
+
|
|
7187
|
+
float maxDiff = 0.0;
|
|
7188
|
+
|
|
7189
|
+
// Sample 8 neighbors at outline thickness distance
|
|
7190
|
+
for (float y = -1.0; y <= 1.0; y += 1.0) {
|
|
7191
|
+
for (float x = -1.0; x <= 1.0; x += 1.0) {
|
|
7192
|
+
if (x == 0.0 && y == 0.0) continue;
|
|
7193
|
+
|
|
7194
|
+
vec2 offset = vec2(x, y) * texelSize * outlineThickness;
|
|
7195
|
+
vec4 neighbor = texture2D(tDiffuse, uv + offset);
|
|
7196
|
+
float neighborSelected = isSelected(neighbor);
|
|
7197
|
+
|
|
7198
|
+
maxDiff = max(maxDiff, abs(centerSelected - neighborSelected));
|
|
7199
|
+
}
|
|
7200
|
+
}
|
|
7201
|
+
|
|
7202
|
+
// Only draw outline OUTSIDE selection (where center is NOT selected but has selected neighbor)
|
|
7203
|
+
if (centerSelected > 0.5) {
|
|
7204
|
+
return 0.0; // Don't draw outline inside selected area
|
|
7205
|
+
}
|
|
7206
|
+
|
|
7207
|
+
return maxDiff;
|
|
7208
|
+
}
|
|
7209
|
+
|
|
7210
|
+
void main() {
|
|
7211
|
+
vec2 texelSize = 1.0 / resolution;
|
|
7212
|
+
vec4 sceneColor = texture2D(tDiffuse, vUv);
|
|
7213
|
+
|
|
7214
|
+
// Detect selection boundary
|
|
7215
|
+
float edge = detectSelectionEdge(vUv, texelSize);
|
|
7216
|
+
|
|
7217
|
+
if (edge < 0.5) {
|
|
7218
|
+
// Restore original alpha if it was selection marker
|
|
7219
|
+
float originalAlpha = isSelected(sceneColor) > 0.5 ? 1.0 : sceneColor.a;
|
|
7220
|
+
gl_FragColor = vec4(sceneColor.rgb, originalAlpha);
|
|
7221
|
+
return;
|
|
7222
|
+
}
|
|
7223
|
+
|
|
7224
|
+
// Apply outline
|
|
7225
|
+
vec3 finalColor = mix(sceneColor.rgb, outlineColor, outlineOpacity);
|
|
7226
|
+
gl_FragColor = vec4(finalColor, 1.0);
|
|
7227
|
+
}
|
|
7228
|
+
`;
|
|
7229
|
+
class cn extends Ot {
|
|
7230
|
+
constructor(e, t = {}) {
|
|
7231
|
+
super(), this.copyMaterial = null, this.bypass = !1, this.hasSelection = !1, this.resolution = e, this.options = { ...on, ...t }, this.outlineMaterial = new re({
|
|
7232
|
+
uniforms: {
|
|
7233
|
+
tDiffuse: { value: null },
|
|
7234
|
+
resolution: { value: this.resolution },
|
|
7235
|
+
outlineColor: { value: this.options.outlineColor },
|
|
7236
|
+
outlineOpacity: { value: this.options.outlineOpacity },
|
|
7237
|
+
outlineThickness: { value: this.options.outlineThickness },
|
|
7238
|
+
selectionAlpha: { value: this.options.selectionAlpha },
|
|
7239
|
+
alphaTolerance: { value: this.options.alphaTolerance }
|
|
7240
|
+
},
|
|
7241
|
+
vertexShader: $t,
|
|
7242
|
+
fragmentShader: ln
|
|
7243
|
+
}), this.fsQuad = new Dt(this.outlineMaterial);
|
|
7244
|
+
}
|
|
7245
|
+
setOptions(e) {
|
|
7246
|
+
this.options = { ...this.options, ...e };
|
|
7247
|
+
const t = this.outlineMaterial.uniforms;
|
|
7248
|
+
t.outlineColor.value = this.options.outlineColor, t.outlineOpacity.value = this.options.outlineOpacity, t.outlineThickness.value = this.options.outlineThickness, t.selectionAlpha.value = this.options.selectionAlpha, t.alphaTolerance.value = this.options.alphaTolerance;
|
|
7249
|
+
}
|
|
7250
|
+
render(e, t, i, s, n) {
|
|
7251
|
+
if (this.bypass || !this.hasSelection) {
|
|
7252
|
+
this.copyMaterial || (this.copyMaterial = new re({
|
|
7253
|
+
uniforms: { tDiffuse: { value: null } },
|
|
7254
|
+
vertexShader: $t,
|
|
7255
|
+
fragmentShader: `
|
|
7256
|
+
uniform sampler2D tDiffuse;
|
|
7257
|
+
varying vec2 vUv;
|
|
7258
|
+
void main() {
|
|
7259
|
+
gl_FragColor = texture2D(tDiffuse, vUv);
|
|
7260
|
+
}
|
|
7261
|
+
`
|
|
7262
|
+
})), this.copyMaterial.uniforms.tDiffuse.value = i.texture, this.fsQuad.material = this.copyMaterial, e.setRenderTarget(this.renderToScreen ? null : t), this.fsQuad.render(e);
|
|
7263
|
+
return;
|
|
7067
7264
|
}
|
|
7265
|
+
this.outlineMaterial.uniforms.tDiffuse.value = i.texture, this.fsQuad.material = this.outlineMaterial, e.setRenderTarget(this.renderToScreen ? null : t), this.fsQuad.render(e);
|
|
7266
|
+
}
|
|
7267
|
+
setSize(e, t) {
|
|
7268
|
+
this.resolution.set(e, t), this.outlineMaterial.uniforms.resolution.value = this.resolution;
|
|
7269
|
+
}
|
|
7270
|
+
dispose() {
|
|
7271
|
+
var e;
|
|
7272
|
+
this.outlineMaterial.dispose(), (e = this.copyMaterial) == null || e.dispose(), this.fsQuad.dispose();
|
|
7068
7273
|
}
|
|
7069
7274
|
}
|
|
7070
|
-
function
|
|
7071
|
-
const g = new
|
|
7072
|
-
side:
|
|
7275
|
+
function hn() {
|
|
7276
|
+
const g = new di({
|
|
7277
|
+
side: ae
|
|
7073
7278
|
});
|
|
7074
7279
|
return g.onBeforeCompile = (e) => {
|
|
7075
7280
|
e.vertexShader = `attribute vec4 color;
|
|
@@ -7089,10 +7294,10 @@ function rn() {
|
|
|
7089
7294
|
);
|
|
7090
7295
|
}, g;
|
|
7091
7296
|
}
|
|
7092
|
-
function
|
|
7093
|
-
const g = new
|
|
7297
|
+
function dn() {
|
|
7298
|
+
const g = new Y({
|
|
7094
7299
|
colorWrite: !1,
|
|
7095
|
-
side:
|
|
7300
|
+
side: ae
|
|
7096
7301
|
});
|
|
7097
7302
|
return g.onBeforeCompile = (e) => {
|
|
7098
7303
|
e.vertexShader = `attribute vec4 color;
|
|
@@ -7112,8 +7317,8 @@ function an() {
|
|
|
7112
7317
|
);
|
|
7113
7318
|
}, g;
|
|
7114
7319
|
}
|
|
7115
|
-
const
|
|
7116
|
-
edgeColor: new
|
|
7320
|
+
const un = {
|
|
7321
|
+
edgeColor: new N(0),
|
|
7117
7322
|
edgeOpacity: 0.6,
|
|
7118
7323
|
// Reduced for subtlety, better perf
|
|
7119
7324
|
edgeThickness: 1,
|
|
@@ -7130,14 +7335,14 @@ const on = {
|
|
|
7130
7335
|
// Keep - good for creases
|
|
7131
7336
|
enableObjectIdEdges: !1
|
|
7132
7337
|
// Disable by default - most expensive (extra render pass)
|
|
7133
|
-
},
|
|
7338
|
+
}, pn = `
|
|
7134
7339
|
varying vec2 vUv;
|
|
7135
7340
|
|
|
7136
7341
|
void main() {
|
|
7137
7342
|
vUv = uv;
|
|
7138
7343
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
7139
7344
|
}
|
|
7140
|
-
`,
|
|
7345
|
+
`, mn = `
|
|
7141
7346
|
precision highp float;
|
|
7142
7347
|
|
|
7143
7348
|
uniform sampler2D tDiffuse; // Color buffer (from main render)
|
|
@@ -7303,7 +7508,7 @@ void main() {
|
|
|
7303
7508
|
|
|
7304
7509
|
gl_FragColor = vec4(finalColor, color.a);
|
|
7305
7510
|
}
|
|
7306
|
-
`,
|
|
7511
|
+
`, gn = `
|
|
7307
7512
|
attribute float objectIndex;
|
|
7308
7513
|
varying float vObjectIndex;
|
|
7309
7514
|
|
|
@@ -7311,7 +7516,7 @@ void main() {
|
|
|
7311
7516
|
vObjectIndex = objectIndex;
|
|
7312
7517
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
7313
7518
|
}
|
|
7314
|
-
`,
|
|
7519
|
+
`, fn = `
|
|
7315
7520
|
precision highp float;
|
|
7316
7521
|
varying float vObjectIndex;
|
|
7317
7522
|
|
|
@@ -7327,34 +7532,34 @@ void main() {
|
|
|
7327
7532
|
gl_FragColor = vec4(packIndex(vObjectIndex), 1.0);
|
|
7328
7533
|
}
|
|
7329
7534
|
`;
|
|
7330
|
-
class
|
|
7535
|
+
class vn extends Ot {
|
|
7331
7536
|
constructor(e, t, i, s) {
|
|
7332
|
-
super(), this.excludeObjects = [], this.bypass = !1, this.scene = e, this.camera = t, this.resolution = i || new H(window.innerWidth, window.innerHeight), this.options = { ...
|
|
7537
|
+
super(), this.excludeObjects = [], this.bypass = !1, this.scene = e, this.camera = t, this.resolution = i || new H(window.innerWidth, window.innerHeight), this.options = { ...un, ...s };
|
|
7333
7538
|
const n = {
|
|
7334
|
-
format:
|
|
7335
|
-
type:
|
|
7336
|
-
minFilter:
|
|
7337
|
-
magFilter:
|
|
7539
|
+
format: qt,
|
|
7540
|
+
type: Qt,
|
|
7541
|
+
minFilter: Rt,
|
|
7542
|
+
magFilter: Rt
|
|
7338
7543
|
};
|
|
7339
|
-
this.normalTarget = new
|
|
7544
|
+
this.normalTarget = new ve(this.resolution.x, this.resolution.y, {
|
|
7340
7545
|
...n,
|
|
7341
7546
|
depthBuffer: !0
|
|
7342
|
-
}), this.normalTarget.depthTexture = new
|
|
7547
|
+
}), this.normalTarget.depthTexture = new Ct(
|
|
7343
7548
|
this.resolution.x,
|
|
7344
7549
|
this.resolution.y,
|
|
7345
7550
|
At
|
|
7346
|
-
), this.depthTarget = new
|
|
7551
|
+
), this.depthTarget = new ve(this.resolution.x, this.resolution.y, {
|
|
7347
7552
|
...n,
|
|
7348
7553
|
depthBuffer: !0
|
|
7349
|
-
}), this.depthTarget.depthTexture = new
|
|
7554
|
+
}), this.depthTarget.depthTexture = new Ct(
|
|
7350
7555
|
this.resolution.x,
|
|
7351
7556
|
this.resolution.y,
|
|
7352
7557
|
At
|
|
7353
|
-
), this.objectIdTarget = new
|
|
7354
|
-
vertexShader:
|
|
7355
|
-
fragmentShader:
|
|
7356
|
-
side:
|
|
7357
|
-
}), this.edgeMaterial = new
|
|
7558
|
+
), this.objectIdTarget = new ve(this.resolution.x, this.resolution.y, n), this.normalMaterial = hn(), this.depthMaterial = dn(), this.objectIdMaterial = new re({
|
|
7559
|
+
vertexShader: gn,
|
|
7560
|
+
fragmentShader: fn,
|
|
7561
|
+
side: ae
|
|
7562
|
+
}), this.edgeMaterial = new re({
|
|
7358
7563
|
uniforms: {
|
|
7359
7564
|
tDiffuse: { value: null },
|
|
7360
7565
|
tDepth: { value: null },
|
|
@@ -7375,9 +7580,9 @@ class un extends Yt {
|
|
|
7375
7580
|
enableNormalEdges: { value: this.options.enableNormalEdges },
|
|
7376
7581
|
enableObjectIdEdges: { value: this.options.enableObjectIdEdges }
|
|
7377
7582
|
},
|
|
7378
|
-
vertexShader:
|
|
7379
|
-
fragmentShader:
|
|
7380
|
-
}), this.copyMaterial = new
|
|
7583
|
+
vertexShader: pn,
|
|
7584
|
+
fragmentShader: mn
|
|
7585
|
+
}), this.copyMaterial = new re({
|
|
7381
7586
|
uniforms: {
|
|
7382
7587
|
tDiffuse: { value: null }
|
|
7383
7588
|
},
|
|
@@ -7395,7 +7600,7 @@ class un extends Yt {
|
|
|
7395
7600
|
gl_FragColor = texture2D(tDiffuse, vUv);
|
|
7396
7601
|
}
|
|
7397
7602
|
`
|
|
7398
|
-
}), this.fsQuad = new
|
|
7603
|
+
}), this.fsQuad = new Dt(this.edgeMaterial);
|
|
7399
7604
|
}
|
|
7400
7605
|
/**
|
|
7401
7606
|
* Update options
|
|
@@ -7453,19 +7658,19 @@ class un extends Yt {
|
|
|
7453
7658
|
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();
|
|
7454
7659
|
}
|
|
7455
7660
|
}
|
|
7456
|
-
const
|
|
7457
|
-
outlineColor: new
|
|
7661
|
+
const bn = {
|
|
7662
|
+
outlineColor: new N(y.secondary),
|
|
7458
7663
|
outlineOpacity: 1,
|
|
7459
7664
|
outlineThickness: 2,
|
|
7460
7665
|
showOccluded: !0,
|
|
7461
7666
|
occludedOpacity: 0.5
|
|
7462
|
-
}, xt =
|
|
7667
|
+
}, xt = D.hexToRGB(y.secondary), jt = `
|
|
7463
7668
|
varying vec2 vUv;
|
|
7464
7669
|
void main() {
|
|
7465
7670
|
vUv = uv;
|
|
7466
7671
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
7467
7672
|
}
|
|
7468
|
-
`,
|
|
7673
|
+
`, wn = `
|
|
7469
7674
|
precision highp float;
|
|
7470
7675
|
|
|
7471
7676
|
uniform sampler2D tDiffuse; // Original scene
|
|
@@ -7553,7 +7758,7 @@ void main() {
|
|
|
7553
7758
|
|
|
7554
7759
|
gl_FragColor = vec4(finalColor, sceneColor.a);
|
|
7555
7760
|
}
|
|
7556
|
-
`,
|
|
7761
|
+
`, yn = `
|
|
7557
7762
|
varying vec3 vVertexColor;
|
|
7558
7763
|
|
|
7559
7764
|
void main() {
|
|
@@ -7566,13 +7771,20 @@ void main() {
|
|
|
7566
7771
|
vVertexColor = vec3(1.0);
|
|
7567
7772
|
#endif
|
|
7568
7773
|
|
|
7774
|
+
// For InstancedMesh: per-vertex color is white (1,1,1), so multiplying by
|
|
7775
|
+
// instanceColor gives exactly the per-instance selection color.
|
|
7776
|
+
// Without this, all instanced fragments read white and never match selectColor.
|
|
7777
|
+
#ifdef USE_INSTANCING_COLOR
|
|
7778
|
+
vVertexColor *= instanceColor.rgb;
|
|
7779
|
+
#endif
|
|
7780
|
+
|
|
7569
7781
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
7570
7782
|
|
|
7571
7783
|
#ifdef USE_INSTANCING
|
|
7572
7784
|
gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(position, 1.0);
|
|
7573
7785
|
#endif
|
|
7574
7786
|
}
|
|
7575
|
-
`,
|
|
7787
|
+
`, xn = `
|
|
7576
7788
|
precision highp float;
|
|
7577
7789
|
|
|
7578
7790
|
uniform vec3 selectColor;
|
|
@@ -7589,28 +7801,28 @@ void main() {
|
|
|
7589
7801
|
gl_FragColor = vec4(1.0); // White mask for selected
|
|
7590
7802
|
}
|
|
7591
7803
|
`;
|
|
7592
|
-
class
|
|
7804
|
+
class Mn extends Ot {
|
|
7593
7805
|
constructor(e, t, i, s = {}) {
|
|
7594
|
-
super(), this.copyMaterial = null, this.hasSelection = !1, this.bypass = !1, this.scene = e, this.camera = t, this.resolution = i, this.options = { ...
|
|
7806
|
+
super(), this.copyMaterial = null, this.hasSelection = !1, this.bypass = !1, this.scene = e, this.camera = t, this.resolution = i, this.options = { ...bn, ...s };
|
|
7595
7807
|
const n = i.clone().multiplyScalar(0.5);
|
|
7596
|
-
this.maskRenderTarget = new
|
|
7808
|
+
this.maskRenderTarget = new ve(n.x, n.y, {
|
|
7597
7809
|
depthBuffer: !0
|
|
7598
|
-
}), this.maskDepthRenderTarget = new
|
|
7810
|
+
}), this.maskDepthRenderTarget = new ve(n.x, n.y, {
|
|
7599
7811
|
depthBuffer: !0
|
|
7600
|
-
}), this.selectionFilterMaterial = new
|
|
7812
|
+
}), this.selectionFilterMaterial = new re({
|
|
7601
7813
|
uniforms: {
|
|
7602
7814
|
selectColor: {
|
|
7603
7815
|
value: [xt.r, xt.g, xt.b]
|
|
7604
7816
|
},
|
|
7605
7817
|
colorTolerance: { value: 0.01 }
|
|
7606
7818
|
},
|
|
7607
|
-
vertexShader:
|
|
7608
|
-
fragmentShader:
|
|
7819
|
+
vertexShader: yn,
|
|
7820
|
+
fragmentShader: xn,
|
|
7609
7821
|
vertexColors: !0,
|
|
7610
|
-
side:
|
|
7822
|
+
side: ae,
|
|
7611
7823
|
depthTest: !this.options.showOccluded,
|
|
7612
7824
|
depthWrite: !0
|
|
7613
|
-
}), this.selectionFilterMaterialDepth = this.selectionFilterMaterial.clone(), this.selectionFilterMaterialDepth.depthTest = !0, this.outlineMaterial = new
|
|
7825
|
+
}), this.selectionFilterMaterialDepth = this.selectionFilterMaterial.clone(), this.selectionFilterMaterialDepth.depthTest = !0, this.outlineMaterial = new re({
|
|
7614
7826
|
uniforms: {
|
|
7615
7827
|
tDiffuse: { value: null },
|
|
7616
7828
|
tMask: { value: this.maskRenderTarget.texture },
|
|
@@ -7623,9 +7835,9 @@ class vn extends Yt {
|
|
|
7623
7835
|
showOccluded: { value: this.options.showOccluded },
|
|
7624
7836
|
occludedOpacity: { value: this.options.occludedOpacity }
|
|
7625
7837
|
},
|
|
7626
|
-
vertexShader:
|
|
7627
|
-
fragmentShader:
|
|
7628
|
-
}), this.fsQuad = new
|
|
7838
|
+
vertexShader: jt,
|
|
7839
|
+
fragmentShader: wn
|
|
7840
|
+
}), this.fsQuad = new Dt(this.outlineMaterial);
|
|
7629
7841
|
}
|
|
7630
7842
|
/**
|
|
7631
7843
|
* Notify the pass whether there is an active selection.
|
|
@@ -7666,9 +7878,9 @@ class vn extends Yt {
|
|
|
7666
7878
|
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
7879
|
}
|
|
7668
7880
|
_renderCopyPass(e, t, i) {
|
|
7669
|
-
this.copyMaterial || (this.copyMaterial = new
|
|
7881
|
+
this.copyMaterial || (this.copyMaterial = new re({
|
|
7670
7882
|
uniforms: { tDiffuse: { value: null } },
|
|
7671
|
-
vertexShader:
|
|
7883
|
+
vertexShader: jt,
|
|
7672
7884
|
fragmentShader: `
|
|
7673
7885
|
uniform sampler2D tDiffuse;
|
|
7674
7886
|
varying vec2 vUv;
|
|
@@ -7688,10 +7900,10 @@ class vn extends Yt {
|
|
|
7688
7900
|
this.maskRenderTarget.dispose(), this.maskDepthRenderTarget.dispose(), this.selectionFilterMaterial.dispose(), this.selectionFilterMaterialDepth.dispose(), this.outlineMaterial.dispose(), (e = this.copyMaterial) == null || e.dispose(), this.fsQuad.dispose();
|
|
7689
7901
|
}
|
|
7690
7902
|
}
|
|
7691
|
-
new H(1024, 1024), new
|
|
7692
|
-
class
|
|
7903
|
+
new H(1024, 1024), new N(0);
|
|
7904
|
+
class En {
|
|
7693
7905
|
constructor(e, t) {
|
|
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
|
|
7906
|
+
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.alphaSelectionOutlinePass = null, this.perfChecker = new qs(), this._whiteShader = {
|
|
7695
7907
|
uniforms: {
|
|
7696
7908
|
tDiffuse: { value: null },
|
|
7697
7909
|
shadowTexture: { value: null },
|
|
@@ -7724,13 +7936,13 @@ class bn {
|
|
|
7724
7936
|
};
|
|
7725
7937
|
const i = new H();
|
|
7726
7938
|
e.getSize(i);
|
|
7727
|
-
const s = new
|
|
7728
|
-
format:
|
|
7729
|
-
type:
|
|
7939
|
+
const s = new ve(i.x, i.y, {
|
|
7940
|
+
format: qt,
|
|
7941
|
+
type: Qt,
|
|
7730
7942
|
depthBuffer: !0,
|
|
7731
7943
|
stencilBuffer: !1
|
|
7732
7944
|
});
|
|
7733
|
-
s.depthTexture = new
|
|
7945
|
+
s.depthTexture = new Ct(i.x, i.y, At), this.composer = new $i(this.renderer, s), this.composer.setSize(window.innerWidth, window.innerHeight);
|
|
7734
7946
|
}
|
|
7735
7947
|
isWebGL2Available() {
|
|
7736
7948
|
return !!window.WebGL2RenderingContext;
|
|
@@ -7739,7 +7951,7 @@ class bn {
|
|
|
7739
7951
|
this.composer.render();
|
|
7740
7952
|
}
|
|
7741
7953
|
initRenderPass(e, t) {
|
|
7742
|
-
this.renderPass = new
|
|
7954
|
+
this.renderPass = new Fi(e, t), this.composer.addPass(this.renderPass);
|
|
7743
7955
|
const i = this.perfChecker.getSpecs();
|
|
7744
7956
|
if (console.log(i), this.perfChecker.canHandleExpensiveEffects()) {
|
|
7745
7957
|
//! this pass cause slow render on weak machine, turn it off when camera moving
|
|
@@ -7749,18 +7961,18 @@ class bn {
|
|
|
7749
7961
|
this.initn8aoPass(e, t);
|
|
7750
7962
|
} else
|
|
7751
7963
|
this.perfChecker.canHandleBasicEffects();
|
|
7752
|
-
this.initScreenSpaceEdgesPass(e, t), this.initSelectionOutlinePass(e, t);
|
|
7964
|
+
this.initScreenSpaceEdgesPass(e, t), this.initSelectionOutlinePass(e, t), this.initAlphaSelectionOutlinePass(), this.alphaSelectionOutlinePass && (this.alphaSelectionOutlinePass.enabled = !1);
|
|
7753
7965
|
//! this pass slow render too, turn it off when we dont use
|
|
7754
|
-
const s = new
|
|
7966
|
+
const s = new Hi();
|
|
7755
7967
|
this.composer.addPass(s);
|
|
7756
7968
|
}
|
|
7757
7969
|
initGammaPass() {
|
|
7758
|
-
this.gammaPass = new yt(
|
|
7970
|
+
this.gammaPass = new yt(Gi), this.composer.addPass(this.gammaPass);
|
|
7759
7971
|
}
|
|
7760
7972
|
//#region N8AOPass
|
|
7761
7973
|
initn8aoPass(e, t) {
|
|
7762
7974
|
//! need to optimize this base on performance
|
|
7763
|
-
this.n8aoPass = new
|
|
7975
|
+
this.n8aoPass = new Ni(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);
|
|
7764
7976
|
}
|
|
7765
7977
|
enableN8AOPass() {
|
|
7766
7978
|
this.n8aoPass && (this.n8aoPass.setDisplayMode("Combined"), this.n8aoPass.enabled = !0);
|
|
@@ -7777,19 +7989,19 @@ class bn {
|
|
|
7777
7989
|
//#endregion
|
|
7778
7990
|
//#region Anti Aliases Passes
|
|
7779
7991
|
initSMAAPass() {
|
|
7780
|
-
this.smaaPass = new
|
|
7992
|
+
this.smaaPass = new Wi(), this.smaaPass.renderToScreen = !0, this.composer.addPass(this.smaaPass);
|
|
7781
7993
|
}
|
|
7782
7994
|
initSSAAPass(e, t) {
|
|
7783
7995
|
this.ssaaPass = new Ci(e, t), this.ssaaPass.unbiased = !0, this.ssaaPass.sampleLevel = 2, this.composer.addPass(this.ssaaPass);
|
|
7784
7996
|
}
|
|
7785
7997
|
initFXAAPass() {
|
|
7786
|
-
this.fxaaPass = new yt(
|
|
7998
|
+
this.fxaaPass = new yt(Ai), this.fxaaPass.uniforms.resolution.value.set(
|
|
7787
7999
|
1 / window.innerWidth,
|
|
7788
8000
|
1 / window.innerHeight
|
|
7789
8001
|
), this.composer.addPass(this.fxaaPass);
|
|
7790
8002
|
}
|
|
7791
8003
|
initTAAPass(e, t) {
|
|
7792
|
-
this.taaPass = new
|
|
8004
|
+
this.taaPass = new _i(e, t), this.taaPass.sampleLevel = 2, this.taaPass.unbiased = !1, this.composer.addPass(this.taaPass);
|
|
7793
8005
|
}
|
|
7794
8006
|
enableTAA() {
|
|
7795
8007
|
this.taaPass && (this.taaPass.enabled = !0);
|
|
@@ -7800,18 +8012,18 @@ class bn {
|
|
|
7800
8012
|
//#endregion
|
|
7801
8013
|
//#region SAO
|
|
7802
8014
|
initSAOPass(e, t) {
|
|
7803
|
-
this.saoPass = new
|
|
8015
|
+
this.saoPass = new Ii(e, t), this.saoPass.params.saoIntensity = 1e-4, this.saoPass.params.saoKernelRadius = 10, this.composer.addPass(this.saoPass);
|
|
7804
8016
|
}
|
|
7805
8017
|
//#endregion
|
|
7806
8018
|
//#region SSAO
|
|
7807
8019
|
initSSAOPass(e, t) {
|
|
7808
|
-
this.ssaoPass = new
|
|
8020
|
+
this.ssaoPass = new mt(e, t), this.ssaoPass.output = mt.OUTPUT.Default, this.ssaoPass.kernelRadius = 8, this.ssaoPass.minDistance = 1e-5, this.ssaoPass.maxDistance = 0.02, this.ssaoPass.enabled = !0, this.ssaoPass.renderToScreen = !0, this.composer.addPass(this.ssaoPass);
|
|
7809
8021
|
}
|
|
7810
8022
|
enableSSAO() {
|
|
7811
|
-
this.ssaoPass && (this.ssaoPass.output =
|
|
8023
|
+
this.ssaoPass && (this.ssaoPass.output = mt.OUTPUT.SSAO, this.ssaoPass.kernelRadius = 64, this.ssaoPass.minDistance = 1e-3, this.ssaoPass.maxDistance = 0.02);
|
|
7812
8024
|
}
|
|
7813
8025
|
disableSSAO() {
|
|
7814
|
-
this.ssaoPass && (this.ssaoPass.output =
|
|
8026
|
+
this.ssaoPass && (this.ssaoPass.output = mt.OUTPUT.Default, this.ssaoPass.kernelRadius = 1, this.ssaoPass.minDistance = 5e-4, this.ssaoPass.maxDistance = 0.3);
|
|
7815
8027
|
}
|
|
7816
8028
|
//#endregion
|
|
7817
8029
|
//#region SOBEL
|
|
@@ -7831,12 +8043,12 @@ class bn {
|
|
|
7831
8043
|
* - Object ID discontinuity detection (object boundaries)
|
|
7832
8044
|
*/
|
|
7833
8045
|
initScreenSpaceEdgesPass(e, t) {
|
|
7834
|
-
this.screenSpaceEdgesPass = new
|
|
8046
|
+
this.screenSpaceEdgesPass = new vn(
|
|
7835
8047
|
e,
|
|
7836
8048
|
t,
|
|
7837
8049
|
new H(window.innerWidth, window.innerHeight),
|
|
7838
8050
|
{
|
|
7839
|
-
edgeColor: new
|
|
8051
|
+
edgeColor: new N(0),
|
|
7840
8052
|
edgeOpacity: 1,
|
|
7841
8053
|
edgeThickness: 2,
|
|
7842
8054
|
depthMultiplier: 1.5,
|
|
@@ -7887,7 +8099,7 @@ class bn {
|
|
|
7887
8099
|
*/
|
|
7888
8100
|
setScreenSpaceEdgeColor(e) {
|
|
7889
8101
|
if (this.screenSpaceEdgesPass) {
|
|
7890
|
-
const t = typeof e == "number" ? new
|
|
8102
|
+
const t = typeof e == "number" ? new N(e) : e;
|
|
7891
8103
|
this.screenSpaceEdgesPass.setOptions({ edgeColor: t });
|
|
7892
8104
|
}
|
|
7893
8105
|
}
|
|
@@ -7918,7 +8130,7 @@ class bn {
|
|
|
7918
8130
|
*/
|
|
7919
8131
|
setScreenSpaceEdgesPenMode() {
|
|
7920
8132
|
this.screenSpaceEdgesPass && this.screenSpaceEdgesPass.setOptions({
|
|
7921
|
-
edgeColor: new
|
|
8133
|
+
edgeColor: new N(0),
|
|
7922
8134
|
edgeOpacity: 1,
|
|
7923
8135
|
edgeThickness: 1.5
|
|
7924
8136
|
});
|
|
@@ -7928,7 +8140,7 @@ class bn {
|
|
|
7928
8140
|
*/
|
|
7929
8141
|
setScreenSpaceEdgesShadedMode() {
|
|
7930
8142
|
this.screenSpaceEdgesPass && this.screenSpaceEdgesPass.setOptions({
|
|
7931
|
-
edgeColor: new
|
|
8143
|
+
edgeColor: new N(0),
|
|
7932
8144
|
edgeOpacity: 0.8,
|
|
7933
8145
|
edgeThickness: 1.5
|
|
7934
8146
|
});
|
|
@@ -7939,13 +8151,13 @@ class bn {
|
|
|
7939
8151
|
//#endregion
|
|
7940
8152
|
//#region Outline Pass
|
|
7941
8153
|
initOutlinePass(e, t) {
|
|
7942
|
-
this.outlinePass = new
|
|
8154
|
+
this.outlinePass = new ji(
|
|
7943
8155
|
new H(window.innerWidth, window.innerHeight),
|
|
7944
8156
|
e,
|
|
7945
8157
|
t,
|
|
7946
8158
|
// TODO : investigate why this effect when render new model
|
|
7947
8159
|
[this.viralViewerApi.viralScene.outlineModel]
|
|
7948
|
-
), this.outlinePass.edgeStrength = 5, this.outlinePass.edgeGlow = 0.4, this.outlinePass.edgeThickness = 2, this.outlinePass.pulsePeriod = 0, this.outlinePass.visibleEdgeColor.set(y.
|
|
8160
|
+
), this.outlinePass.edgeStrength = 5, this.outlinePass.edgeGlow = 0.4, this.outlinePass.edgeThickness = 2, this.outlinePass.pulsePeriod = 0, this.outlinePass.visibleEdgeColor.set(y.secondary), this.outlinePass.hiddenEdgeColor.set(y.secondary), this.outlinePass.enabled = !1, this.outlinePass.renderToScreen = !1, this.composer.addPass(this.outlinePass);
|
|
7949
8161
|
}
|
|
7950
8162
|
enableOutline() {
|
|
7951
8163
|
this.outlinePass && (this.outlinePass.enabled = !0, this.outlinePass.renderToScreen = !0);
|
|
@@ -7961,12 +8173,12 @@ class bn {
|
|
|
7961
8173
|
* Cost: 1 extra draw call + 1 fullscreen pass
|
|
7962
8174
|
*/
|
|
7963
8175
|
initSelectionOutlinePass(e, t) {
|
|
7964
|
-
this.selectionOutlinePass = new
|
|
8176
|
+
this.selectionOutlinePass = new Mn(
|
|
7965
8177
|
e,
|
|
7966
8178
|
t,
|
|
7967
8179
|
new H(window.innerWidth, window.innerHeight),
|
|
7968
8180
|
{
|
|
7969
|
-
outlineColor: new
|
|
8181
|
+
outlineColor: new N(y.secondary),
|
|
7970
8182
|
outlineOpacity: 1,
|
|
7971
8183
|
outlineThickness: 2,
|
|
7972
8184
|
showOccluded: !0,
|
|
@@ -8027,7 +8239,7 @@ class bn {
|
|
|
8027
8239
|
*/
|
|
8028
8240
|
setSelectionOutlineColor(e) {
|
|
8029
8241
|
if (this.selectionOutlinePass) {
|
|
8030
|
-
const t = e instanceof
|
|
8242
|
+
const t = e instanceof N ? e : new N(e);
|
|
8031
8243
|
this.selectionOutlinePass.setOptions({ outlineColor: t });
|
|
8032
8244
|
}
|
|
8033
8245
|
}
|
|
@@ -8038,10 +8250,77 @@ class bn {
|
|
|
8038
8250
|
this.selectionOutlinePass && this.selectionOutlinePass.setOptions({ outlineThickness: e });
|
|
8039
8251
|
}
|
|
8040
8252
|
//#endregion
|
|
8253
|
+
//#region Alpha Selection Outline Pass (Ultra-Fast)
|
|
8254
|
+
/**
|
|
8255
|
+
* Initialize alpha-based selection outline pass
|
|
8256
|
+
* ZERO extra render passes - detects selection via alpha channel in main render
|
|
8257
|
+
* Cost: 1 fullscreen pass only (no geometry re-render)
|
|
8258
|
+
*
|
|
8259
|
+
* This is MUCH faster than SelectionOutlinePass for large selections
|
|
8260
|
+
* Works with both batched meshes (per-vertex alpha) and instanced meshes (per-instance alpha)
|
|
8261
|
+
*/
|
|
8262
|
+
initAlphaSelectionOutlinePass() {
|
|
8263
|
+
this.alphaSelectionOutlinePass = new cn(
|
|
8264
|
+
new H(window.innerWidth, window.innerHeight),
|
|
8265
|
+
{
|
|
8266
|
+
outlineColor: new N(y.secondary),
|
|
8267
|
+
outlineOpacity: 1,
|
|
8268
|
+
outlineThickness: 2
|
|
8269
|
+
}
|
|
8270
|
+
), this.alphaSelectionOutlinePass.enabled = !0, this.composer.addPass(this.alphaSelectionOutlinePass);
|
|
8271
|
+
}
|
|
8272
|
+
/**
|
|
8273
|
+
* Enable alpha selection outline rendering
|
|
8274
|
+
*/
|
|
8275
|
+
enableAlphaSelectionOutline() {
|
|
8276
|
+
this.alphaSelectionOutlinePass && (this.alphaSelectionOutlinePass.enabled = !0);
|
|
8277
|
+
}
|
|
8278
|
+
/**
|
|
8279
|
+
* Disable alpha selection outline rendering
|
|
8280
|
+
*/
|
|
8281
|
+
disableAlphaSelectionOutline() {
|
|
8282
|
+
this.alphaSelectionOutlinePass && (this.alphaSelectionOutlinePass.enabled = !1);
|
|
8283
|
+
}
|
|
8284
|
+
/**
|
|
8285
|
+
* Bypass alpha selection outline (instant, zero cost)
|
|
8286
|
+
*/
|
|
8287
|
+
bypassAlphaSelectionOutline() {
|
|
8288
|
+
this.alphaSelectionOutlinePass && (this.alphaSelectionOutlinePass.bypass = !0);
|
|
8289
|
+
}
|
|
8290
|
+
/**
|
|
8291
|
+
* Resume alpha selection outline after bypassing
|
|
8292
|
+
*/
|
|
8293
|
+
resumeAlphaSelectionOutline() {
|
|
8294
|
+
this.alphaSelectionOutlinePass && (this.alphaSelectionOutlinePass.bypass = !1);
|
|
8295
|
+
}
|
|
8296
|
+
/**
|
|
8297
|
+
* Set alpha selection outline color
|
|
8298
|
+
*/
|
|
8299
|
+
setAlphaSelectionOutlineColor(e) {
|
|
8300
|
+
if (this.alphaSelectionOutlinePass) {
|
|
8301
|
+
const t = e instanceof N ? e : new N(e);
|
|
8302
|
+
this.alphaSelectionOutlinePass.setOptions({ outlineColor: t });
|
|
8303
|
+
}
|
|
8304
|
+
}
|
|
8305
|
+
/**
|
|
8306
|
+
* Set alpha selection outline thickness in pixels
|
|
8307
|
+
*/
|
|
8308
|
+
setAlphaSelectionOutlineThickness(e) {
|
|
8309
|
+
this.alphaSelectionOutlinePass && this.alphaSelectionOutlinePass.setOptions({ outlineThickness: e });
|
|
8310
|
+
}
|
|
8311
|
+
/**
|
|
8312
|
+
* Update alpha selection outline state
|
|
8313
|
+
* Call this when selection changes
|
|
8314
|
+
* @param hasSelection - Whether there's any selection active
|
|
8315
|
+
*/
|
|
8316
|
+
updateAlphaSelectionOutline(e) {
|
|
8317
|
+
this.alphaSelectionOutlinePass && (this.alphaSelectionOutlinePass.hasSelection = e);
|
|
8318
|
+
}
|
|
8319
|
+
//#endregion
|
|
8041
8320
|
}
|
|
8042
|
-
class
|
|
8321
|
+
class Sn {
|
|
8043
8322
|
constructor(e) {
|
|
8044
|
-
this.viralViewerApi = e, this.renderer = new
|
|
8323
|
+
this.viralViewerApi = e, this.renderer = new Zt({
|
|
8045
8324
|
alpha: !0,
|
|
8046
8325
|
antialias: !0,
|
|
8047
8326
|
stencil: !0,
|
|
@@ -8053,7 +8332,7 @@ class wn {
|
|
|
8053
8332
|
console.log("Max Fragment Uniform Vectors ->", i), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setSize(
|
|
8054
8333
|
this.viralViewerApi.targetElement.offsetWidth,
|
|
8055
8334
|
this.viralViewerApi.targetElement.offsetHeight
|
|
8056
|
-
), this.renderer.outputColorSpace =
|
|
8335
|
+
), this.renderer.outputColorSpace = ui, this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type = pi, 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 En(
|
|
8057
8336
|
this.renderer,
|
|
8058
8337
|
this.viralViewerApi
|
|
8059
8338
|
)), this.jitterOffsets = this.generateJitterOffsets(), this.viralViewerApi.emit(k.LOADED_RENDERER);
|
|
@@ -8133,7 +8412,7 @@ class wn {
|
|
|
8133
8412
|
// Applies jitter and renders the scene with anti-aliasing
|
|
8134
8413
|
applyJitter() {
|
|
8135
8414
|
const [e, t] = this.jitterOffsets[this.jitterIndex], i = this.viralViewerApi.viralCamera.camera;
|
|
8136
|
-
if (i instanceof
|
|
8415
|
+
if (i instanceof St) {
|
|
8137
8416
|
const s = this.size.x, n = this.size.y, r = i.right - i.left, o = i.top - i.bottom, a = s / r, l = n / o;
|
|
8138
8417
|
i.setViewOffset(
|
|
8139
8418
|
r,
|
|
@@ -8144,7 +8423,7 @@ class wn {
|
|
|
8144
8423
|
o
|
|
8145
8424
|
);
|
|
8146
8425
|
} else
|
|
8147
|
-
i instanceof
|
|
8426
|
+
i instanceof Ge && (i.projectionMatrix.elements[8] = e / this.size.x, i.projectionMatrix.elements[9] = t / this.size.y);
|
|
8148
8427
|
this.jitterIndex = (this.jitterIndex + 1) % this.samples;
|
|
8149
8428
|
}
|
|
8150
8429
|
// Generates jitter offsets for the specified number of samples
|
|
@@ -8161,21 +8440,21 @@ class wn {
|
|
|
8161
8440
|
return this.renderer.domElement.toDataURL("image/png");
|
|
8162
8441
|
}
|
|
8163
8442
|
}
|
|
8164
|
-
const
|
|
8443
|
+
const fe = {
|
|
8165
8444
|
pivotPoint: "viral_pivot_point",
|
|
8166
8445
|
isolateModel: "viral_isolate_model",
|
|
8167
8446
|
mergedModel: "viral_merged_model",
|
|
8168
8447
|
outlineModel: "viral_outline_model",
|
|
8169
8448
|
sunlight: "viral_sunlight"
|
|
8170
8449
|
};
|
|
8171
|
-
class
|
|
8450
|
+
class Cn {
|
|
8172
8451
|
constructor(e) {
|
|
8173
|
-
this.viralViewerApi = e, this.scene = new Tt(), this.objects = [], this.models = [], this.bimWorld = new
|
|
8452
|
+
this.viralViewerApi = e, this.scene = new Tt(), this.objects = [], this.models = [], this.bimWorld = new ts(), this.outlineModel = new x(), this.hideables = [], this.selectables = [], this.edges = [], this.sunLight = null, this.lights = [], this.transformControls = null, this.lightHelpers = [], this.fullScreenQuadMaterial = new Y({
|
|
8174
8453
|
map: null,
|
|
8175
8454
|
// Use the render target's texture
|
|
8176
|
-
side:
|
|
8177
|
-
}), this.fullScreenQuad = null, this.viralViewerApi.emit(k.LOADED_SCENE), this.bimWorld.name =
|
|
8178
|
-
const t = new
|
|
8455
|
+
side: ae
|
|
8456
|
+
}), this.fullScreenQuad = null, this.viralViewerApi.emit(k.LOADED_SCENE), this.bimWorld.name = fe.mergedModel, this.addModel(this.bimWorld), this.outlineModel.name = fe.outlineModel, this.outlineModel.renderOrder = 0, this.addModel(this.outlineModel);
|
|
8457
|
+
const t = new Lt(5, 32, 32), i = new ne({
|
|
8179
8458
|
color: 16768256,
|
|
8180
8459
|
emissive: 16755200,
|
|
8181
8460
|
emissiveIntensity: 1
|
|
@@ -8206,28 +8485,28 @@ class yn {
|
|
|
8206
8485
|
}
|
|
8207
8486
|
//#region lights
|
|
8208
8487
|
addLights() {
|
|
8209
|
-
const e = new
|
|
8488
|
+
const e = new pt(16777215, 1);
|
|
8210
8489
|
e.position.set(1, 1, 1).normalize();
|
|
8211
|
-
const t = new
|
|
8490
|
+
const t = new pt(16777215, 1.5);
|
|
8212
8491
|
t.position.set(0, -1, 0).normalize();
|
|
8213
|
-
const i = new
|
|
8492
|
+
const i = new pt(16777215, 1);
|
|
8214
8493
|
i.position.set(-1, 1, -1).normalize();
|
|
8215
|
-
const s = new
|
|
8216
|
-
this.sunLight = new
|
|
8217
|
-
const n = new
|
|
8494
|
+
const s = new mi(16777215, 1);
|
|
8495
|
+
this.sunLight = new pt(16777215, 4), this.sunLight.name = fe.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;
|
|
8496
|
+
const n = new gi(this.sunLight.shadow.camera);
|
|
8218
8497
|
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);
|
|
8219
8498
|
}
|
|
8220
8499
|
//#endregion
|
|
8221
8500
|
addPivotPoint() {
|
|
8222
|
-
const e = new
|
|
8223
|
-
color:
|
|
8501
|
+
const e = new Lt(1, 16, 16), t = new Y({
|
|
8502
|
+
color: D.hexToThreejsColor(y.secondary)
|
|
8224
8503
|
// transparent: true,
|
|
8225
8504
|
// opacity: 0.5,
|
|
8226
8505
|
}), i = new x(e, t);
|
|
8227
|
-
i.name =
|
|
8506
|
+
i.name = fe.pivotPoint, i.visible = !1, this.addObject(i);
|
|
8228
8507
|
}
|
|
8229
8508
|
addTransformControls(e) {
|
|
8230
|
-
this.transformControls = new
|
|
8509
|
+
this.transformControls = new Ui(
|
|
8231
8510
|
e,
|
|
8232
8511
|
this.viralViewerApi.viralRenderer.renderer.domElement
|
|
8233
8512
|
);
|
|
@@ -8246,14 +8525,14 @@ class yn {
|
|
|
8246
8525
|
if (this.scene) {
|
|
8247
8526
|
const e = new x(
|
|
8248
8527
|
new Pt(1, 1, 1),
|
|
8249
|
-
new
|
|
8528
|
+
new ne({ color: 16711680 })
|
|
8250
8529
|
);
|
|
8251
8530
|
e.castShadow = !0, e.receiveShadow = !0, this.addObject(e);
|
|
8252
8531
|
}
|
|
8253
8532
|
}
|
|
8254
8533
|
addAxes() {
|
|
8255
8534
|
if (this.scene) {
|
|
8256
|
-
const e = new
|
|
8535
|
+
const e = new fi(10);
|
|
8257
8536
|
e.renderOrder = 999, e.material.depthTest = !1, e.material.depthWrite = !1, this.addObject(e);
|
|
8258
8537
|
}
|
|
8259
8538
|
}
|
|
@@ -8267,20 +8546,20 @@ class yn {
|
|
|
8267
8546
|
* Add box helper to check mesh
|
|
8268
8547
|
*/
|
|
8269
8548
|
addBoxHelper(e) {
|
|
8270
|
-
const t = new
|
|
8549
|
+
const t = new vi(e, 16711680);
|
|
8271
8550
|
this.addObject(t);
|
|
8272
8551
|
}
|
|
8273
8552
|
addBox3Helper(e) {
|
|
8274
|
-
const t = new
|
|
8553
|
+
const t = new bi(e, 16776960);
|
|
8275
8554
|
this.addObject(t);
|
|
8276
8555
|
}
|
|
8277
8556
|
addFullscreenQuad() {
|
|
8278
|
-
const e = new
|
|
8557
|
+
const e = new ue(window.innerWidth, window.innerHeight);
|
|
8279
8558
|
this.fullScreenQuad = new x(e, this.fullScreenQuadMaterial), this.addObject(this.fullScreenQuad);
|
|
8280
8559
|
}
|
|
8281
8560
|
//#endregion
|
|
8282
8561
|
}
|
|
8283
|
-
const
|
|
8562
|
+
const Ht = new Float32Array([
|
|
8284
8563
|
// Bottom face (Y = -1)
|
|
8285
8564
|
-1,
|
|
8286
8565
|
-1,
|
|
@@ -8356,7 +8635,7 @@ const Nt = new Float32Array([
|
|
|
8356
8635
|
-1,
|
|
8357
8636
|
1,
|
|
8358
8637
|
1
|
|
8359
|
-
]),
|
|
8638
|
+
]), An = [
|
|
8360
8639
|
new E(1, 0, 0),
|
|
8361
8640
|
// 0: +X
|
|
8362
8641
|
new E(-1, 0, 0),
|
|
@@ -8369,9 +8648,9 @@ const Nt = new Float32Array([
|
|
|
8369
8648
|
// 4: +Z
|
|
8370
8649
|
new E(0, 0, -1)
|
|
8371
8650
|
// 5: -Z
|
|
8372
|
-
],
|
|
8651
|
+
], Qe = class Qe {
|
|
8373
8652
|
constructor(e) {
|
|
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
|
|
8653
|
+
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 Wt(), this._selectedFaceIndex = -1, this._clippingPlanes = [], this._transformedEdges = new Float32Array(72);
|
|
8375
8654
|
}
|
|
8376
8655
|
/** Whether section box is active (clipping enabled) */
|
|
8377
8656
|
get isActive() {
|
|
@@ -8461,7 +8740,7 @@ const Nt = new Float32Array([
|
|
|
8461
8740
|
}
|
|
8462
8741
|
const i = this._getFaceCenter(e);
|
|
8463
8742
|
this._dragAnchor.position.copy(i), this._dragAnchor.updateMatrixWorld(!0), t.attach(this._dragAnchor), t.setMode("translate");
|
|
8464
|
-
const s =
|
|
8743
|
+
const s = An[e];
|
|
8465
8744
|
t.showX = Math.abs(s.x) > 0.5, t.showY = Math.abs(s.y) > 0.5, t.showZ = Math.abs(s.z) > 0.5, this._positionFaceHighlight(e);
|
|
8466
8745
|
}
|
|
8467
8746
|
onDragAnchorChanged() {
|
|
@@ -8495,46 +8774,46 @@ const Nt = new Float32Array([
|
|
|
8495
8774
|
}
|
|
8496
8775
|
// --- Private methods ---
|
|
8497
8776
|
_initFromBoundingBox() {
|
|
8498
|
-
const e = new
|
|
8777
|
+
const e = new F().setFromObject(this.viralViewerApi.viralScene.bimWorld);
|
|
8499
8778
|
e.getCenter(this._center), e.getSize(this._halfSize).multiplyScalar(0.5), this._initialCenter.copy(this._center), this._initialHalfSize.copy(this._halfSize), this._isGenerated = !0;
|
|
8500
8779
|
}
|
|
8501
8780
|
_createVisuals() {
|
|
8502
8781
|
if (this._boxOutline)
|
|
8503
8782
|
return;
|
|
8504
|
-
this._outlineMaterial = new
|
|
8505
|
-
color:
|
|
8783
|
+
this._outlineMaterial = new Kt({
|
|
8784
|
+
color: D.hexToThreejsColor(y.secondary),
|
|
8506
8785
|
linewidth: 2,
|
|
8507
8786
|
resolution: new H(window.innerWidth, window.innerHeight),
|
|
8508
8787
|
worldUnits: !1,
|
|
8509
8788
|
transparent: !1,
|
|
8510
8789
|
depthTest: !0,
|
|
8511
8790
|
depthWrite: !0
|
|
8512
|
-
}), this._outlineGeometry = new
|
|
8513
|
-
const e = new Pt(2, 2, 2), t = new
|
|
8791
|
+
}), this._outlineGeometry = new Qi(), this._outlineGeometry.setPositions(Ht), this._boxOutline = new qi(this._outlineGeometry, this._outlineMaterial), this._boxOutline.name = "SectionBoxOutline", this._boxOutline.renderOrder = 0, this._boxOutline.frustumCulled = !1, this.viralViewerApi.viralScene.addObject(this._boxOutline);
|
|
8792
|
+
const e = new Pt(2, 2, 2), t = new Y({
|
|
8514
8793
|
transparent: !0,
|
|
8515
8794
|
opacity: 0,
|
|
8516
|
-
side:
|
|
8795
|
+
side: ae,
|
|
8517
8796
|
depthWrite: !1,
|
|
8518
8797
|
depthTest: !1
|
|
8519
8798
|
});
|
|
8520
8799
|
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
|
|
8522
|
-
color:
|
|
8800
|
+
const i = new Y({
|
|
8801
|
+
color: D.hexToThreejsColor(y.secondary),
|
|
8523
8802
|
transparent: !0,
|
|
8524
8803
|
opacity: 0.15,
|
|
8525
|
-
side:
|
|
8804
|
+
side: ae,
|
|
8526
8805
|
depthWrite: !1,
|
|
8527
8806
|
depthTest: !1,
|
|
8528
8807
|
polygonOffset: !0,
|
|
8529
8808
|
polygonOffsetFactor: 1,
|
|
8530
8809
|
polygonOffsetUnits: 1
|
|
8531
8810
|
});
|
|
8532
|
-
this._facePlaneMesh = new x(new
|
|
8811
|
+
this._facePlaneMesh = new x(new ue(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);
|
|
8533
8812
|
}
|
|
8534
8813
|
_updateVisuals() {
|
|
8535
8814
|
if (!this._boxOutline || !this._outlineGeometry || !this._hitBoxMesh)
|
|
8536
8815
|
return;
|
|
8537
|
-
const e =
|
|
8816
|
+
const e = Qe.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 = Ht, l = this._transformedEdges;
|
|
8538
8817
|
for (let c = 0; c < 72; c += 3)
|
|
8539
8818
|
l[c] = t + n * a[c], l[c + 1] = i + r * a[c + 1], l[c + 2] = s + o * a[c + 2];
|
|
8540
8819
|
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) {
|
|
@@ -8548,17 +8827,17 @@ const Nt = new Float32Array([
|
|
|
8548
8827
|
_updateClippingPlanes() {
|
|
8549
8828
|
const e = this._center.clone().sub(this._halfSize), t = this._center.clone().add(this._halfSize);
|
|
8550
8829
|
this._clippingPlanes.length === 0 ? this._clippingPlanes = [
|
|
8551
|
-
new
|
|
8830
|
+
new ge(new E(1, 0, 0), -e.x),
|
|
8552
8831
|
// -X face: keeps x >= min.x
|
|
8553
|
-
new
|
|
8832
|
+
new ge(new E(-1, 0, 0), t.x),
|
|
8554
8833
|
// +X face: keeps x <= max.x
|
|
8555
|
-
new
|
|
8834
|
+
new ge(new E(0, 1, 0), -e.y),
|
|
8556
8835
|
// -Y face
|
|
8557
|
-
new
|
|
8836
|
+
new ge(new E(0, -1, 0), t.y),
|
|
8558
8837
|
// +Y face
|
|
8559
|
-
new
|
|
8838
|
+
new ge(new E(0, 0, 1), -e.z),
|
|
8560
8839
|
// -Z face
|
|
8561
|
-
new
|
|
8840
|
+
new ge(new E(0, 0, -1), t.z)
|
|
8562
8841
|
// +Z face
|
|
8563
8842
|
] : (this._clippingPlanes[0].constant = -e.x, this._clippingPlanes[1].constant = t.x, this._clippingPlanes[2].constant = -e.y, this._clippingPlanes[3].constant = t.y, this._clippingPlanes[4].constant = -e.z, this._clippingPlanes[5].constant = t.z), this.viralViewerApi.viralRenderer.renderer.clippingPlanes = this._clippingPlanes;
|
|
8564
8843
|
}
|
|
@@ -8584,7 +8863,7 @@ const Nt = new Float32Array([
|
|
|
8584
8863
|
_positionFaceHighlight(e) {
|
|
8585
8864
|
if (!this._facePlaneMesh)
|
|
8586
8865
|
return;
|
|
8587
|
-
const t = this._center, i =
|
|
8866
|
+
const t = this._center, i = Qe.VISUAL_INSET, s = this._halfSize.x * (1 - i), n = this._halfSize.y * (1 - i), r = this._halfSize.z * (1 - i);
|
|
8588
8867
|
switch (this._facePlaneMesh.visible = !0, this._facePlaneMesh.rotation.set(0, 0, 0), e) {
|
|
8589
8868
|
case 0:
|
|
8590
8869
|
this._facePlaneMesh.scale.set(r * 2, n * 2, 1), this._facePlaneMesh.position.set(t.x + s, t.y, t.z), this._facePlaneMesh.rotation.y = Math.PI / 2;
|
|
@@ -8634,9 +8913,9 @@ const Nt = new Float32Array([
|
|
|
8634
8913
|
);
|
|
8635
8914
|
}
|
|
8636
8915
|
};
|
|
8637
|
-
|
|
8638
|
-
let
|
|
8639
|
-
var
|
|
8916
|
+
Qe.VISUAL_INSET = 2e-3;
|
|
8917
|
+
let It = Qe;
|
|
8918
|
+
var Ue = () => {
|
|
8640
8919
|
var g = 0, e = document.createElement("div");
|
|
8641
8920
|
e.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", e.addEventListener(
|
|
8642
8921
|
"click",
|
|
@@ -8653,9 +8932,9 @@ var Fe = () => {
|
|
|
8653
8932
|
e.children[h].style.display = h === c ? "block" : "none";
|
|
8654
8933
|
g = c;
|
|
8655
8934
|
}
|
|
8656
|
-
var s = (performance || Date).now(), n = s, r = 0, o = t(
|
|
8935
|
+
var s = (performance || Date).now(), n = s, r = 0, o = t(Ue.Panel("FPS", "#0ff", "#002")), a = t(Ue.Panel("MS", "#0f0", "#020"));
|
|
8657
8936
|
if (self.performance && self.performance.memory)
|
|
8658
|
-
var l = t(
|
|
8937
|
+
var l = t(Ue.Panel("MB", "#f08", "#201"));
|
|
8659
8938
|
return i(0), {
|
|
8660
8939
|
REVISION: 16,
|
|
8661
8940
|
dom: e,
|
|
@@ -8684,7 +8963,7 @@ var Fe = () => {
|
|
|
8684
8963
|
setMode: i
|
|
8685
8964
|
};
|
|
8686
8965
|
};
|
|
8687
|
-
|
|
8966
|
+
Ue.Panel = (g, e, t) => {
|
|
8688
8967
|
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");
|
|
8689
8968
|
m.width = o, m.height = a, m.style.cssText = "width:80px;height:48px";
|
|
8690
8969
|
var f = m.getContext("2d");
|
|
@@ -8714,14 +8993,14 @@ Fe.Panel = (g, e, t) => {
|
|
|
8714
8993
|
}
|
|
8715
8994
|
};
|
|
8716
8995
|
};
|
|
8717
|
-
class
|
|
8996
|
+
class _n {
|
|
8718
8997
|
constructor(e) {
|
|
8719
|
-
this.viralViewerApi = e, this.stats = null, this.viralViewerApi.targetElement && (this.stats =
|
|
8998
|
+
this.viralViewerApi = e, this.stats = null, this.viralViewerApi.targetElement && (this.stats = Ue(), this.stats.showPanel(0), this.viralViewerApi.targetElement.appendChild(this.stats.dom));
|
|
8720
8999
|
}
|
|
8721
9000
|
}
|
|
8722
|
-
class
|
|
9001
|
+
class In {
|
|
8723
9002
|
constructor(e) {
|
|
8724
|
-
this.viralViewerApi = e, this._selectionOutlineEnabled = !0, this.exceptElements = [], this.isolateModelId = "0", this.sunConfiguration =
|
|
9003
|
+
this.viralViewerApi = e, this._selectionOutlineEnabled = !0, this.exceptElements = [], this.isolateModelId = "0", this.sunConfiguration = ss, this._ground = null, this._alphaSelectionOutlineEnabled = !1, this.opacity = 1, this._fog = new wi(13421772, 1, 1e3), this.rainGeometry = new he(), 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;
|
|
8725
9004
|
}
|
|
8726
9005
|
/**
|
|
8727
9006
|
* show all elements and reset back to normal visualization
|
|
@@ -8737,13 +9016,19 @@ class En {
|
|
|
8737
9016
|
for (const i of this.viralViewerApi.viralScene.bimWorld.bimModels) {
|
|
8738
9017
|
const s = i.modelId.toString();
|
|
8739
9018
|
for (const n of i.elements)
|
|
8740
|
-
|
|
9019
|
+
if (n.Instances.length > 0)
|
|
9020
|
+
for (const r of n.Instances)
|
|
9021
|
+
t.push({
|
|
9022
|
+
modelId: s,
|
|
9023
|
+
elementId: r.Id
|
|
9024
|
+
});
|
|
9025
|
+
else
|
|
8741
9026
|
t.push({
|
|
8742
9027
|
modelId: s,
|
|
8743
|
-
elementId:
|
|
9028
|
+
elementId: n.Id
|
|
8744
9029
|
});
|
|
8745
9030
|
}
|
|
8746
|
-
e.hide(t), this.viralViewerApi.viralRenderer.render();
|
|
9031
|
+
console.log(t), e.hide(t), this.viralViewerApi.viralRenderer.render();
|
|
8747
9032
|
}
|
|
8748
9033
|
/**
|
|
8749
9034
|
*
|
|
@@ -8855,15 +9140,15 @@ class En {
|
|
|
8855
9140
|
this.viralViewerApi.viralScene.sunLight && (this.viralViewerApi.viralScene.sunLight.castShadow = !1), this.viralViewerApi.viralRenderer.render();
|
|
8856
9141
|
}
|
|
8857
9142
|
_adjustLightForMesh(e, t) {
|
|
8858
|
-
const i = new
|
|
9143
|
+
const i = new F().setFromObject(e), s = i.min, n = i.max, r = s.distanceTo(n), o = i.getCenter(new E()), a = t.shadow.camera;
|
|
8859
9144
|
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;
|
|
8860
9145
|
}
|
|
8861
9146
|
_updateDirectLights(e, t) {
|
|
8862
|
-
const i =
|
|
9147
|
+
const i = D.mergeBoundingBoxes(e), s = i.min, n = i.max;
|
|
8863
9148
|
s.distanceTo(n);
|
|
8864
9149
|
const r = i.getCenter(new E()), o = this.sunConfiguration.elevation, a = this.sunConfiguration.azimuth, l = this.sunConfiguration.radius || 0;
|
|
8865
|
-
this.sunConfiguration.castShadow !== void 0 && (t.castShadow = this.sunConfiguration.castShadow), this.sunConfiguration.intensity !== void 0 && (t.intensity = this.sunConfiguration.intensity), t.color = new
|
|
8866
|
-
const c = i.getBoundingSphere(new
|
|
9150
|
+
this.sunConfiguration.castShadow !== void 0 && (t.castShadow = this.sunConfiguration.castShadow), this.sunConfiguration.intensity !== void 0 && (t.intensity = this.sunConfiguration.intensity), t.color = new N(this.sunConfiguration.color), this.sunConfiguration.enabled !== void 0 && (t.visible = this.sunConfiguration.enabled), t.position.copy(r);
|
|
9151
|
+
const c = i.getBoundingSphere(new Ut()), h = new Gt(c.radius + l, o, a);
|
|
8867
9152
|
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);
|
|
8868
9153
|
}
|
|
8869
9154
|
_updateLightShadowCamera(e, t) {
|
|
@@ -8878,7 +9163,7 @@ class En {
|
|
|
8878
9163
|
new E(s.x, s.y, s.z)
|
|
8879
9164
|
];
|
|
8880
9165
|
n.forEach((o) => o.applyMatrix4(e.shadow.camera.matrixWorldInverse));
|
|
8881
|
-
const r = new
|
|
9166
|
+
const r = new F().setFromPoints(n);
|
|
8882
9167
|
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;
|
|
8883
9168
|
}
|
|
8884
9169
|
//#endregion
|
|
@@ -8959,7 +9244,7 @@ class En {
|
|
|
8959
9244
|
enableAllWhite() {
|
|
8960
9245
|
this.viralViewerApi.viralMaterialManager.mergeMaterials.forEach(
|
|
8961
9246
|
(e) => {
|
|
8962
|
-
e.vertexColors = !1, e.color = new
|
|
9247
|
+
e.vertexColors = !1, e.color = new N(16448250), e.needsUpdate = !0;
|
|
8963
9248
|
}
|
|
8964
9249
|
), this.viralViewerApi.viralRenderer.render();
|
|
8965
9250
|
}
|
|
@@ -8992,18 +9277,18 @@ class En {
|
|
|
8992
9277
|
if (this._ground)
|
|
8993
9278
|
this._ground.visible = !0, this.viralViewerApi.viralRenderer.render();
|
|
8994
9279
|
else {
|
|
8995
|
-
let t = new
|
|
9280
|
+
let t = new F();
|
|
8996
9281
|
if (e)
|
|
8997
|
-
t = new
|
|
9282
|
+
t = new F().setFromObject(e);
|
|
8998
9283
|
else {
|
|
8999
9284
|
const a = [this.viralViewerApi.viralScene.bimWorld.bounds];
|
|
9000
|
-
t =
|
|
9285
|
+
t = D.mergeBoundingBoxes(a);
|
|
9001
9286
|
}
|
|
9002
9287
|
const i = new E();
|
|
9003
9288
|
t.getSize(i);
|
|
9004
|
-
const s = t.max.x - t.min.x, n = t.max.z - t.min.z, r = t.min.y, o = new
|
|
9289
|
+
const s = t.max.x - t.min.x, n = t.max.z - t.min.z, r = t.min.y, o = new re({
|
|
9005
9290
|
uniforms: {
|
|
9006
|
-
color: { value: new
|
|
9291
|
+
color: { value: new N(0) },
|
|
9007
9292
|
opacity: { value: 0.5 }
|
|
9008
9293
|
},
|
|
9009
9294
|
vertexShader: `
|
|
@@ -9026,7 +9311,7 @@ class En {
|
|
|
9026
9311
|
transparent: !0
|
|
9027
9312
|
});
|
|
9028
9313
|
this._ground = new x(
|
|
9029
|
-
new
|
|
9314
|
+
new ue(s * 1.5, n * 1.5),
|
|
9030
9315
|
o
|
|
9031
9316
|
// Semi-transparent shadow material
|
|
9032
9317
|
), this._ground.rotation.x = -Math.PI / 2, this._ground.position.set(
|
|
@@ -9066,7 +9351,7 @@ class En {
|
|
|
9066
9351
|
for (let i = 0; i < t.length; i++) {
|
|
9067
9352
|
const s = t[i];
|
|
9068
9353
|
if (s.buffer) {
|
|
9069
|
-
const n = new
|
|
9354
|
+
const n = new he();
|
|
9070
9355
|
n.setAttribute("position", new z(s.buffer, 3));
|
|
9071
9356
|
const r = new x(
|
|
9072
9357
|
n,
|
|
@@ -9130,24 +9415,83 @@ class En {
|
|
|
9130
9415
|
get selectionOutlineEnabled() {
|
|
9131
9416
|
return this._selectionOutlineEnabled;
|
|
9132
9417
|
}
|
|
9418
|
+
/**
|
|
9419
|
+
* Update alpha selection outline state
|
|
9420
|
+
* This is MUCH faster than updateSelectionOutline() - no geometry copying needed
|
|
9421
|
+
*/
|
|
9422
|
+
updateAlphaSelectionOutline() {
|
|
9423
|
+
var t;
|
|
9424
|
+
if (!this._alphaSelectionOutlineEnabled)
|
|
9425
|
+
return;
|
|
9426
|
+
const e = this.viralViewerApi.viralScene.bimWorld.getSelectedElements().length > 0;
|
|
9427
|
+
(t = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || t.updateAlphaSelectionOutline(
|
|
9428
|
+
e
|
|
9429
|
+
);
|
|
9430
|
+
}
|
|
9431
|
+
/**
|
|
9432
|
+
* Enable alpha selection outline effect
|
|
9433
|
+
* This is the FAST outline mode - constant cost regardless of selection size
|
|
9434
|
+
*/
|
|
9435
|
+
enableAlphaSelectionOutline() {
|
|
9436
|
+
var e;
|
|
9437
|
+
(e = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || e.enableAlphaSelectionOutline();
|
|
9438
|
+
}
|
|
9439
|
+
/**
|
|
9440
|
+
* Disable alpha selection outline effect
|
|
9441
|
+
*/
|
|
9442
|
+
disableAlphaSelectionOutline() {
|
|
9443
|
+
var e;
|
|
9444
|
+
(e = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || e.disableAlphaSelectionOutline();
|
|
9445
|
+
}
|
|
9446
|
+
/**
|
|
9447
|
+
* Set whether alpha selection outline mode is enabled
|
|
9448
|
+
* This is the recommended mode for large selections (1000+ elements)
|
|
9449
|
+
* @param enabled - true to enable, false to disable
|
|
9450
|
+
*/
|
|
9451
|
+
setAlphaSelectionOutlineMode(e) {
|
|
9452
|
+
var t;
|
|
9453
|
+
this._alphaSelectionOutlineEnabled = e, e ? (this.enableAlphaSelectionOutline(), this.updateAlphaSelectionOutline()) : ((t = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || t.updateAlphaSelectionOutline(
|
|
9454
|
+
!1
|
|
9455
|
+
), this.disableAlphaSelectionOutline()), this.viralViewerApi.viralRenderer.render();
|
|
9456
|
+
}
|
|
9457
|
+
/**
|
|
9458
|
+
* Get whether alpha selection outline mode is enabled
|
|
9459
|
+
*/
|
|
9460
|
+
get alphaSelectionOutlineEnabled() {
|
|
9461
|
+
return this._alphaSelectionOutlineEnabled;
|
|
9462
|
+
}
|
|
9463
|
+
/**
|
|
9464
|
+
* Bypass alpha selection outline (fast, for camera movement)
|
|
9465
|
+
*/
|
|
9466
|
+
bypassAlphaSelectionOutline() {
|
|
9467
|
+
var e;
|
|
9468
|
+
(e = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || e.bypassAlphaSelectionOutline();
|
|
9469
|
+
}
|
|
9470
|
+
/**
|
|
9471
|
+
* Resume alpha selection outline after bypass
|
|
9472
|
+
*/
|
|
9473
|
+
resumeAlphaSelectionOutline() {
|
|
9474
|
+
var e;
|
|
9475
|
+
(e = this.viralViewerApi.viralRenderer.postProcessingRenderer) == null || e.resumeAlphaSelectionOutline();
|
|
9476
|
+
}
|
|
9133
9477
|
//#endregion
|
|
9134
9478
|
//#region night
|
|
9135
9479
|
enableNight() {
|
|
9136
9480
|
this.viralViewerApi.viralScene.lights.forEach((e) => {
|
|
9137
|
-
e.name !==
|
|
9481
|
+
e.name !== fe.sunlight && (e.visible = !1);
|
|
9138
9482
|
}), this.viralViewerApi.viralMaterialManager.mergeMaterials.forEach((e) => {
|
|
9139
|
-
e instanceof
|
|
9483
|
+
e instanceof ne && e.transparent && (e.emissiveIntensity = 0.5);
|
|
9140
9484
|
}), this.viralViewerApi.viralScene.bimWorld.children.forEach((e) => {
|
|
9141
|
-
e.material instanceof
|
|
9485
|
+
e.material instanceof ne && e.material.transparent && e.enableLights && e.enableLights();
|
|
9142
9486
|
}), this.viralViewerApi.viralRenderer.render();
|
|
9143
9487
|
}
|
|
9144
9488
|
disableNight() {
|
|
9145
9489
|
this.viralViewerApi.viralScene.lights.forEach((e) => {
|
|
9146
|
-
e.name !==
|
|
9490
|
+
e.name !== fe.sunlight && (e.visible = !0);
|
|
9147
9491
|
}), this.viralViewerApi.viralMaterialManager.mergeMaterials.forEach((e) => {
|
|
9148
|
-
e instanceof
|
|
9492
|
+
e instanceof ne && e.transparent && (e.emissiveIntensity = 0);
|
|
9149
9493
|
}), this.viralViewerApi.viralScene.bimWorld.children.forEach((e) => {
|
|
9150
|
-
e.material instanceof
|
|
9494
|
+
e.material instanceof ne && e.material.transparent && e.disableLights && e.disableLights();
|
|
9151
9495
|
}), this.viralViewerApi.viralRenderer.render();
|
|
9152
9496
|
}
|
|
9153
9497
|
//#endregion
|
|
@@ -9191,7 +9535,7 @@ class En {
|
|
|
9191
9535
|
for (let n = 0; n < t; n++)
|
|
9192
9536
|
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;
|
|
9193
9537
|
this.rainGeometry.setAttribute("position", new z(i, 3));
|
|
9194
|
-
const s = new
|
|
9538
|
+
const s = new yi({
|
|
9195
9539
|
color: 11184810,
|
|
9196
9540
|
size: 0.2,
|
|
9197
9541
|
transparent: !0,
|
|
@@ -9270,7 +9614,7 @@ class En {
|
|
|
9270
9614
|
generateLOD() {
|
|
9271
9615
|
this.viralViewerApi.viralScene.bimWorld.children.forEach((e) => {
|
|
9272
9616
|
if (e.isMesh) {
|
|
9273
|
-
const t = new
|
|
9617
|
+
const t = new xi(), i = D.createLowResMesh(e, 0.5);
|
|
9274
9618
|
t.addLevel(e, 50), t.addLevel(i, 200), this.viralViewerApi.viralScene.bimWorld.add(t), this.viralViewerApi.viralScene.bimWorld.remove(e);
|
|
9275
9619
|
}
|
|
9276
9620
|
});
|
|
@@ -9279,7 +9623,7 @@ class En {
|
|
|
9279
9623
|
* Generate a random but distinct color for each material ID
|
|
9280
9624
|
*/
|
|
9281
9625
|
_generateDistinctColor(e) {
|
|
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
|
|
9626
|
+
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 N();
|
|
9283
9627
|
return r.setHSL(i, s, n), r;
|
|
9284
9628
|
}
|
|
9285
9629
|
/**
|
|
@@ -9295,7 +9639,7 @@ class En {
|
|
|
9295
9639
|
i,
|
|
9296
9640
|
this._generateDistinctColor(i)
|
|
9297
9641
|
);
|
|
9298
|
-
const s = this._batchColors.get(i), n = new
|
|
9642
|
+
const s = this._batchColors.get(i), n = new ne({
|
|
9299
9643
|
color: s,
|
|
9300
9644
|
roughness: 0.7,
|
|
9301
9645
|
metalness: 0.2,
|
|
@@ -9336,19 +9680,28 @@ class En {
|
|
|
9336
9680
|
let t = 0;
|
|
9337
9681
|
for (const r of this.viralViewerApi.viralScene.bimWorld.bimModels)
|
|
9338
9682
|
for (const o of r.elements)
|
|
9339
|
-
t += o.Instances.length;
|
|
9683
|
+
o.Instances.length > 0 ? t += o.Instances.length : t += 1;
|
|
9340
9684
|
const i = Math.round(t * e / 100), s = [];
|
|
9341
9685
|
let n = 0;
|
|
9342
9686
|
e:
|
|
9343
9687
|
for (const r of this.viralViewerApi.viralScene.bimWorld.bimModels) {
|
|
9344
9688
|
const o = r.modelId.toString();
|
|
9345
9689
|
for (const a of r.elements)
|
|
9346
|
-
|
|
9690
|
+
if (a.Instances.length > 0)
|
|
9691
|
+
for (const l of a.Instances) {
|
|
9692
|
+
if (n >= i)
|
|
9693
|
+
break e;
|
|
9694
|
+
s.push({
|
|
9695
|
+
modelId: o,
|
|
9696
|
+
elementId: l.Id
|
|
9697
|
+
}), n++;
|
|
9698
|
+
}
|
|
9699
|
+
else {
|
|
9347
9700
|
if (n >= i)
|
|
9348
9701
|
break e;
|
|
9349
9702
|
s.push({
|
|
9350
9703
|
modelId: o,
|
|
9351
|
-
elementId:
|
|
9704
|
+
elementId: a.Id
|
|
9352
9705
|
}), n++;
|
|
9353
9706
|
}
|
|
9354
9707
|
}
|
|
@@ -9357,16 +9710,22 @@ class En {
|
|
|
9357
9710
|
changeRandomColor(e = this.randomColor) {
|
|
9358
9711
|
const t = [];
|
|
9359
9712
|
for (let s = 0; s < this.viralViewerApi.viralScene.bimWorld.bimModels.length; s++) {
|
|
9360
|
-
const n = this.viralViewerApi.viralScene.bimWorld.bimModels[s];
|
|
9361
|
-
for (let
|
|
9362
|
-
const
|
|
9363
|
-
|
|
9364
|
-
|
|
9713
|
+
const n = this.viralViewerApi.viralScene.bimWorld.bimModels[s], r = n.modelId.toString();
|
|
9714
|
+
for (let o = 0; o < n.elements.length; o++) {
|
|
9715
|
+
const a = n.elements[o];
|
|
9716
|
+
if (a.Instances.length > 0)
|
|
9717
|
+
for (let l = 0; l < a.Instances.length; l++) {
|
|
9718
|
+
const c = a.Instances[l];
|
|
9719
|
+
t.push({
|
|
9720
|
+
modelId: r,
|
|
9721
|
+
elementId: c.Id
|
|
9722
|
+
});
|
|
9723
|
+
}
|
|
9724
|
+
else
|
|
9365
9725
|
t.push({
|
|
9366
|
-
modelId:
|
|
9367
|
-
elementId:
|
|
9726
|
+
modelId: r,
|
|
9727
|
+
elementId: a.Id
|
|
9368
9728
|
});
|
|
9369
|
-
}
|
|
9370
9729
|
}
|
|
9371
9730
|
}
|
|
9372
9731
|
const i = {
|
|
@@ -9378,7 +9737,7 @@ class En {
|
|
|
9378
9737
|
}
|
|
9379
9738
|
//#endregion
|
|
9380
9739
|
}
|
|
9381
|
-
class
|
|
9740
|
+
class Vn {
|
|
9382
9741
|
constructor(e) {
|
|
9383
9742
|
this.viralViewerApi = e, this.contextMenu = null, this.contextItems = [], this.injectContextMenu();
|
|
9384
9743
|
}
|
|
@@ -9411,7 +9770,7 @@ class Cn {
|
|
|
9411
9770
|
for (let i = 0; i < this.contextItems.length; i++) {
|
|
9412
9771
|
if (e.findIndex((l) => l == this.contextItems[i][0]) < 0)
|
|
9413
9772
|
continue;
|
|
9414
|
-
const [s, n, r, o] = this.contextItems[i], a =
|
|
9773
|
+
const [s, n, r, o] = this.contextItems[i], a = vt.createElementFromHTML(
|
|
9415
9774
|
`<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>`
|
|
9416
9775
|
);
|
|
9417
9776
|
a.addEventListener("click", (l) => {
|
|
@@ -9428,7 +9787,7 @@ class Cn {
|
|
|
9428
9787
|
this.contextItems.push([e, t, i, s]);
|
|
9429
9788
|
}
|
|
9430
9789
|
}
|
|
9431
|
-
class
|
|
9790
|
+
class Tn {
|
|
9432
9791
|
constructor(e) {
|
|
9433
9792
|
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">
|
|
9434
9793
|
<div class="modal-content">
|
|
@@ -9505,7 +9864,7 @@ class Sn {
|
|
|
9505
9864
|
}
|
|
9506
9865
|
|
|
9507
9866
|
.close:hover {
|
|
9508
|
-
color: ${y.
|
|
9867
|
+
color: ${y.secondary};
|
|
9509
9868
|
}
|
|
9510
9869
|
::-webkit-scrollbar {
|
|
9511
9870
|
width: 5px;
|
|
@@ -9538,7 +9897,7 @@ class Sn {
|
|
|
9538
9897
|
inject() {
|
|
9539
9898
|
if (this.viralViewerApi.targetElement) {
|
|
9540
9899
|
const e = document.createElement("style");
|
|
9541
|
-
e.innerHTML = this.rawModalStyle, document.head.appendChild(e), this.modal =
|
|
9900
|
+
e.innerHTML = this.rawModalStyle, document.head.appendChild(e), this.modal = vt.createElementFromHTML(this.rawModal), this.viralViewerApi.targetElement.appendChild(this.modal);
|
|
9542
9901
|
const t = this.viralViewerApi.targetElement.getBoundingClientRect(), i = this.modal.querySelector(".modal-content");
|
|
9543
9902
|
i && (i.style.maxHeight = `${t.height - 20}px`);
|
|
9544
9903
|
const s = document.getElementById("modal-header"), n = document.getElementById("resizeHandle"), r = document.getElementById("column-resizer");
|
|
@@ -9619,22 +9978,22 @@ class Sn {
|
|
|
9619
9978
|
}
|
|
9620
9979
|
}
|
|
9621
9980
|
}
|
|
9622
|
-
const
|
|
9981
|
+
const ei = {
|
|
9623
9982
|
QUICK_SAND: {
|
|
9624
9983
|
importLink: "https://fonts.googleapis.com/css2?family=Quicksand:wght@300&display=swap",
|
|
9625
9984
|
fontFamily: "Quicksand, sans-serif"
|
|
9626
9985
|
}
|
|
9627
|
-
},
|
|
9986
|
+
}, Pn = (g) => {
|
|
9628
9987
|
const e = document.createElement("style");
|
|
9629
|
-
e.innerHTML = `@import url(${
|
|
9630
|
-
},
|
|
9631
|
-
const t =
|
|
9988
|
+
e.innerHTML = `@import url(${ei[g]});`, document.head.appendChild(e);
|
|
9989
|
+
}, On = (g, e) => {
|
|
9990
|
+
const t = ei[e];
|
|
9632
9991
|
g && t && (g.style.fontFamily = t.fontFamily);
|
|
9633
9992
|
};
|
|
9634
|
-
class
|
|
9993
|
+
class Dn {
|
|
9635
9994
|
constructor(e) {
|
|
9636
9995
|
this.viralNavigationCube = e, this._mouseDownTime = null, this.clickThreshold = 250, this._handleClick = async (t) => {
|
|
9637
|
-
var c, h, d, u, p, m, f, v, b, w,
|
|
9996
|
+
var c, h, d, u, p, m, f, v, b, w, S, A, C, _, I, T, M, V, L, B, O, R, U, j, q, Q;
|
|
9638
9997
|
if (!((c = this.viralNavigationCube.cubeScene) != null && c.activePlane) || (h = this.viralNavigationCube.cubeCamera) != null && h.cameraControlHasMoved)
|
|
9639
9998
|
return console.log("false"), !1;
|
|
9640
9999
|
let i = new E(
|
|
@@ -9643,27 +10002,27 @@ class Vn {
|
|
|
9643
10002
|
(p = this.viralNavigationCube.cubeScene) == null ? void 0 : p.activePlane.position.z
|
|
9644
10003
|
);
|
|
9645
10004
|
if (((m = this.viralNavigationCube.cubeScene) == null ? void 0 : m.activePlane.children.length) > 0) {
|
|
9646
|
-
let
|
|
9647
|
-
for (let
|
|
9648
|
-
const G = (v = this.viralNavigationCube.cubeScene) == null ? void 0 : v.activePlane.children[
|
|
9649
|
-
|
|
10005
|
+
let X = 0, W = 0, K = 0;
|
|
10006
|
+
for (let Z = 0; Z < ((f = this.viralNavigationCube.cubeScene) == null ? void 0 : f.activePlane.children.length); Z++) {
|
|
10007
|
+
const G = (v = this.viralNavigationCube.cubeScene) == null ? void 0 : v.activePlane.children[Z];
|
|
10008
|
+
X += G.position.x, W += G.position.y, K += G.position.z;
|
|
9650
10009
|
}
|
|
9651
10010
|
i = new E(
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
10011
|
+
X / ((b = this.viralNavigationCube.cubeScene) == null ? void 0 : b.activePlane.children.length),
|
|
10012
|
+
W / ((w = this.viralNavigationCube.cubeScene) == null ? void 0 : w.activePlane.children.length),
|
|
10013
|
+
K / ((S = this.viralNavigationCube.cubeScene) == null ? void 0 : S.activePlane.children.length)
|
|
9655
10014
|
);
|
|
9656
10015
|
}
|
|
9657
10016
|
const s = new E();
|
|
9658
|
-
(A = this.viralNavigationCube.cubeCamera) == null
|
|
10017
|
+
(C = (A = this.viralNavigationCube.cubeCamera) == null ? void 0 : A.cameraControls) == null || C.getTarget(s);
|
|
9659
10018
|
const n = i.clone().sub(s).normalize();
|
|
9660
|
-
(
|
|
9661
|
-
(
|
|
10019
|
+
(M = (_ = this.viralNavigationCube.cubeCamera) == null ? void 0 : _.cameraControlOldPosition) == null || M.copy(
|
|
10020
|
+
(T = (I = this.viralNavigationCube.cubeCamera) == null ? void 0 : I.camera) == null ? void 0 : T.position
|
|
9662
10021
|
);
|
|
9663
10022
|
const r = new E();
|
|
9664
|
-
(
|
|
10023
|
+
(L = (V = this.viralNavigationCube.viralViewerApi.viralCamera) == null ? void 0 : V.cameraControls) == null || L.getTarget(r);
|
|
9665
10024
|
const o = new E();
|
|
9666
|
-
(
|
|
10025
|
+
(O = (B = this.viralNavigationCube.viralViewerApi.viralCamera) == null ? void 0 : B.cameraControls) == null || O.getPosition(
|
|
9667
10026
|
o
|
|
9668
10027
|
);
|
|
9669
10028
|
const a = o.clone().sub(r).length(), l = new E(
|
|
@@ -9671,100 +10030,103 @@ class Vn {
|
|
|
9671
10030
|
Math.round(n.y),
|
|
9672
10031
|
Math.round(n.z)
|
|
9673
10032
|
);
|
|
9674
|
-
l.multiplyScalar(a), (
|
|
10033
|
+
l.normalize(), l.multiplyScalar(a), (R = this.viralNavigationCube.viralViewerApi.viralCamera.camera) == null || R.updateMatrixWorld(), (U = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || U.setTarget(0, 0, 0), n.multiplyScalar(2), (q = (j = this.viralNavigationCube.cubeCamera) == null ? void 0 : j.cameraControls) == null || q.setPosition(
|
|
9675
10034
|
n.x,
|
|
9676
10035
|
n.y,
|
|
9677
10036
|
n.z,
|
|
9678
10037
|
!0
|
|
9679
|
-
), (
|
|
10038
|
+
), (Q = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || Q.setPosition(
|
|
9680
10039
|
l.x,
|
|
9681
10040
|
l.y,
|
|
9682
10041
|
l.z,
|
|
9683
10042
|
!0
|
|
9684
10043
|
);
|
|
9685
10044
|
}, this._handleMouseUp = async (t) => {
|
|
9686
|
-
var i, s, n, r, o, a, l, c, h, d, u, p, m, f, v, b, w,
|
|
10045
|
+
var i, s, n, r, o, a, l, c, h, d, u, p, m, f, v, b, w, S, A, C, _, I, T, M, V, L;
|
|
9687
10046
|
if (console.log(this._mouseDownTime), this._mouseDownTime !== null && performance.now() - this._mouseDownTime < this.clickThreshold) {
|
|
9688
10047
|
if (!((i = this.viralNavigationCube.cubeScene) != null && i.activePlane) || (s = this.viralNavigationCube.cubeCamera) != null && s.cameraControlHasMoved)
|
|
9689
10048
|
return console.log("false"), !1;
|
|
9690
|
-
let
|
|
10049
|
+
let R = new E(
|
|
9691
10050
|
(n = this.viralNavigationCube.cubeScene) == null ? void 0 : n.activePlane.position.x,
|
|
9692
10051
|
(r = this.viralNavigationCube.cubeScene) == null ? void 0 : r.activePlane.position.y,
|
|
9693
10052
|
(o = this.viralNavigationCube.cubeScene) == null ? void 0 : o.activePlane.position.z
|
|
9694
10053
|
);
|
|
9695
10054
|
if (((a = this.viralNavigationCube.cubeScene) == null ? void 0 : a.activePlane.children.length) > 0) {
|
|
9696
|
-
let
|
|
9697
|
-
for (let
|
|
9698
|
-
const
|
|
9699
|
-
|
|
10055
|
+
let K = 0, Z = 0, G = 0;
|
|
10056
|
+
for (let te = 0; te < ((l = this.viralNavigationCube.cubeScene) == null ? void 0 : l.activePlane.children.length); te++) {
|
|
10057
|
+
const ie = (c = this.viralNavigationCube.cubeScene) == null ? void 0 : c.activePlane.children[te];
|
|
10058
|
+
K += ie.position.x, Z += ie.position.y, G += ie.position.z;
|
|
9700
10059
|
}
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
10060
|
+
R = new E(
|
|
10061
|
+
K / ((h = this.viralNavigationCube.cubeScene) == null ? void 0 : h.activePlane.children.length),
|
|
10062
|
+
Z / ((d = this.viralNavigationCube.cubeScene) == null ? void 0 : d.activePlane.children.length),
|
|
9704
10063
|
G / ((u = this.viralNavigationCube.cubeScene) == null ? void 0 : u.activePlane.children.length)
|
|
9705
10064
|
);
|
|
9706
10065
|
}
|
|
9707
|
-
const
|
|
9708
|
-
(p = this.viralNavigationCube.cubeCamera) == null
|
|
9709
|
-
|
|
10066
|
+
const U = new E();
|
|
10067
|
+
(m = (p = this.viralNavigationCube.cubeCamera) == null ? void 0 : p.cameraControls) == null || m.getTarget(
|
|
10068
|
+
U
|
|
9710
10069
|
);
|
|
9711
|
-
const
|
|
9712
|
-
(
|
|
9713
|
-
(
|
|
10070
|
+
const j = R.clone().sub(U).normalize();
|
|
10071
|
+
(w = (f = this.viralNavigationCube.cubeCamera) == null ? void 0 : f.cameraControlOldPosition) == null || w.copy(
|
|
10072
|
+
(b = (v = this.viralNavigationCube.cubeCamera) == null ? void 0 : v.camera) == null ? void 0 : b.position
|
|
9714
10073
|
);
|
|
9715
|
-
const
|
|
9716
|
-
(
|
|
9717
|
-
|
|
10074
|
+
const q = new E();
|
|
10075
|
+
(A = (S = this.viralNavigationCube.viralViewerApi.viralCamera) == null ? void 0 : S.cameraControls) == null || A.getTarget(
|
|
10076
|
+
q
|
|
9718
10077
|
);
|
|
9719
|
-
const
|
|
9720
|
-
(
|
|
9721
|
-
|
|
10078
|
+
const Q = new E();
|
|
10079
|
+
(_ = (C = this.viralNavigationCube.viralViewerApi.viralCamera) == null ? void 0 : C.cameraControls) == null || _.getPosition(
|
|
10080
|
+
Q
|
|
9722
10081
|
);
|
|
9723
|
-
const
|
|
9724
|
-
Math.round(
|
|
9725
|
-
Math.round(
|
|
9726
|
-
Math.round(
|
|
10082
|
+
const X = Q.clone().sub(q).length(), W = new E(
|
|
10083
|
+
Math.round(j.x),
|
|
10084
|
+
Math.round(j.y),
|
|
10085
|
+
Math.round(j.z)
|
|
9727
10086
|
);
|
|
9728
|
-
|
|
10087
|
+
W.multiplyScalar(X), (I = this.viralNavigationCube.viralViewerApi.viralCamera.camera) == null || I.updateMatrixWorld(), (T = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || T.setTarget(
|
|
9729
10088
|
0,
|
|
9730
10089
|
0,
|
|
9731
10090
|
0
|
|
9732
|
-
),
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
10091
|
+
), j.multiplyScalar(2), (V = (M = this.viralNavigationCube.cubeCamera) == null ? void 0 : M.cameraControls) == null || V.setPosition(
|
|
10092
|
+
j.x,
|
|
10093
|
+
j.y,
|
|
10094
|
+
j.z,
|
|
9736
10095
|
!0
|
|
9737
|
-
), (
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
10096
|
+
), (L = this.viralNavigationCube.viralViewerApi.viralCamera.cameraControls) == null || L.setPosition(
|
|
10097
|
+
W.x,
|
|
10098
|
+
W.y,
|
|
10099
|
+
W.z,
|
|
9741
10100
|
!0
|
|
9742
10101
|
);
|
|
9743
10102
|
}
|
|
9744
10103
|
this._mouseDownTime = null;
|
|
9745
10104
|
}, this.handleMove = async (t) => {
|
|
9746
|
-
var
|
|
9747
|
-
if ((
|
|
10105
|
+
var c, h, d, u, p, m, f;
|
|
10106
|
+
if ((c = this.viralNavigationCube.cubeScene) != null && c.activePlane) {
|
|
9748
10107
|
this.viralNavigationCube.cubeScene.activePlane.material.opacity = 0, this.viralNavigationCube.cubeScene.activePlane.material.needsUpdate = !0;
|
|
9749
|
-
for (let
|
|
9750
|
-
const
|
|
9751
|
-
|
|
10108
|
+
for (let v = 0; v < this.viralNavigationCube.cubeScene.activePlane.children.length; v++) {
|
|
10109
|
+
const b = this.viralNavigationCube.cubeScene.activePlane.children[v];
|
|
10110
|
+
b.material.opacity = 0, b.needsUpdate = !0;
|
|
9752
10111
|
}
|
|
9753
10112
|
this.viralNavigationCube.cubeScene.activePlane = null;
|
|
9754
10113
|
}
|
|
9755
|
-
const i = t.offsetX, s = t.offsetY, n = (
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
10114
|
+
const i = t.offsetX, s = t.offsetY, n = (d = (h = this.viralNavigationCube.cubeRenderer) == null ? void 0 : h.renderer) == null ? void 0 : d.getSize(new H()), r = new H(i / n.width * 2 - 1, -s / n.height * 2 + 1), o = (u = this.viralNavigationCube.cubeCamera) == null ? void 0 : u.camera;
|
|
10115
|
+
if (!o)
|
|
10116
|
+
return;
|
|
10117
|
+
const a = new Vt();
|
|
10118
|
+
a.setFromCamera(r, o);
|
|
10119
|
+
const l = a.intersectObjects((p = this.viralNavigationCube.cubeScene) == null ? void 0 : p.objects);
|
|
10120
|
+
if (l.length > 0 && l[0].object !== ((m = this.viralNavigationCube.cubeScene) == null ? void 0 : m.cube)) {
|
|
10121
|
+
if (l[0].object.parent && l[0].object.parent.name !== "" && (l[0].object.parent.children.length === 2 || l[0].object.parent.children.length === 3)) {
|
|
10122
|
+
this.viralNavigationCube.cubeScene.activePlane = l[0].object.parent;
|
|
10123
|
+
for (let v = 0; v < this.viralNavigationCube.cubeScene.activePlane.children.length; v++) {
|
|
10124
|
+
const b = this.viralNavigationCube.cubeScene.activePlane.children[v];
|
|
10125
|
+
b.material.opacity = 0.2, b.needsUpdate = !0;
|
|
9764
10126
|
}
|
|
9765
10127
|
} else
|
|
9766
|
-
this.viralNavigationCube.cubeScene.activePlane =
|
|
9767
|
-
(
|
|
10128
|
+
this.viralNavigationCube.cubeScene.activePlane = l[0].object, this.viralNavigationCube.cubeScene.activePlane.material.opacity = 0.2, this.viralNavigationCube.cubeScene.activePlane.material.needsUpdate = !0;
|
|
10129
|
+
(f = this.viralNavigationCube.cubeRenderer) == null || f.render();
|
|
9768
10130
|
}
|
|
9769
10131
|
}, this.viralNavigationCube.cubeRenderer && (this._setupMouseClick(this.viralNavigationCube.cubeRenderer.renderer.domElement), this.setupMouseMove(this.viralNavigationCube.cubeRenderer.renderer.domElement));
|
|
9770
10132
|
}
|
|
@@ -9779,17 +10141,17 @@ class Vn {
|
|
|
9779
10141
|
}
|
|
9780
10142
|
//#endregion
|
|
9781
10143
|
}
|
|
9782
|
-
class
|
|
10144
|
+
class Rn {
|
|
9783
10145
|
constructor(e) {
|
|
9784
10146
|
this.viralNavigationCube = e, this.camera = null, this.cameraControls = null, this.cameraControlOldPosition = new E(), this.cameraControlNewPosition = new E(), this.cameraControlHasMoved = !1, this.setupCamera(), this.setupHandle();
|
|
9785
10147
|
}
|
|
9786
10148
|
setupCamera() {
|
|
9787
10149
|
if (this.viralNavigationCube.targetElement && this.viralNavigationCube.cubeRenderer) {
|
|
9788
10150
|
const e = this.viralNavigationCube.targetElement.offsetWidth, t = this.viralNavigationCube.targetElement.offsetHeight;
|
|
9789
|
-
this.camera = new
|
|
10151
|
+
this.camera = new Ge(60, e / t, 0.01, 100), this.camera.position.set(0, 0, 2), this.cameraControls = new be(
|
|
9790
10152
|
this.camera,
|
|
9791
10153
|
this.viralNavigationCube.cubeRenderer.renderer.domElement
|
|
9792
|
-
), this.cameraControls.dollyToCursor = !1, this.cameraControls.infinityDolly = !1, this.cameraControls.setTarget(0, 0, 0), this.cameraControls.polarRotateSpeed = 0.15, this.cameraControls.azimuthRotateSpeed = 0.15, this.cameraControls.mouseButtons.middle =
|
|
10154
|
+
), this.cameraControls.dollyToCursor = !1, this.cameraControls.infinityDolly = !1, this.cameraControls.setTarget(0, 0, 0), this.cameraControls.polarRotateSpeed = 0.15, this.cameraControls.azimuthRotateSpeed = 0.15, this.cameraControls.mouseButtons.middle = be.ACTION.NONE, this.cameraControls.mouseButtons.wheel = be.ACTION.NONE, this.cameraControls.addEventListener("control", (i) => {
|
|
9793
10155
|
console.log("view cube navigate"), this.viralNavigationCube.viralViewerApi.viralCamera.updateMainCamera();
|
|
9794
10156
|
});
|
|
9795
10157
|
}
|
|
@@ -9817,9 +10179,9 @@ class In {
|
|
|
9817
10179
|
window.addEventListener("mousedown", e, !1), window.addEventListener("mousemove", t, !1), window.addEventListener("touchstart", e, !1), window.addEventListener("touchmove", t, !0);
|
|
9818
10180
|
}
|
|
9819
10181
|
}
|
|
9820
|
-
class
|
|
10182
|
+
class Ln {
|
|
9821
10183
|
constructor(e) {
|
|
9822
|
-
this.viralNavigationCube = e, this.renderer = new
|
|
10184
|
+
this.viralNavigationCube = e, this.renderer = new Zt({
|
|
9823
10185
|
alpha: !0,
|
|
9824
10186
|
antialias: !0,
|
|
9825
10187
|
logarithmicDepthBuffer: !0
|
|
@@ -9852,7 +10214,7 @@ class Tn {
|
|
|
9852
10214
|
// }
|
|
9853
10215
|
// }
|
|
9854
10216
|
}
|
|
9855
|
-
class
|
|
10217
|
+
class kn {
|
|
9856
10218
|
constructor(e, t = 1) {
|
|
9857
10219
|
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();
|
|
9858
10220
|
}
|
|
@@ -9860,12 +10222,12 @@ class Pn {
|
|
|
9860
10222
|
this.scene.add(e), this.objects.push(e);
|
|
9861
10223
|
}
|
|
9862
10224
|
addCube() {
|
|
9863
|
-
const e = [], t = ["RIGHT", "LEFT", "TOP", "BOTTOM", "FRONT", "BACK"], i = new
|
|
10225
|
+
const e = [], t = ["RIGHT", "LEFT", "TOP", "BOTTOM", "FRONT", "BACK"], i = new Mi(), s = document.createElement("canvas"), n = s.getContext("2d"), r = 64;
|
|
9864
10226
|
if (s.width = r, s.height = r, n) {
|
|
9865
10227
|
n.font = 'bolder 12px "Open sans", Arial', n.textBaseline = "middle", n.textAlign = "center";
|
|
9866
10228
|
const o = `${y.background}`;
|
|
9867
10229
|
for (let l = 0; l < 6; l++)
|
|
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
|
|
10230
|
+
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 Y({
|
|
9869
10231
|
map: i.load(s.toDataURL())
|
|
9870
10232
|
});
|
|
9871
10233
|
const a = this.cubeScale;
|
|
@@ -9873,13 +10235,13 @@ class Pn {
|
|
|
9873
10235
|
}
|
|
9874
10236
|
}
|
|
9875
10237
|
addPlanes() {
|
|
9876
|
-
const e = this.cubeScale, t = new
|
|
9877
|
-
side:
|
|
10238
|
+
const e = this.cubeScale, t = new Y({
|
|
10239
|
+
side: ae,
|
|
9878
10240
|
color: 6659921,
|
|
9879
10241
|
transparent: !0,
|
|
9880
10242
|
opacity: 0,
|
|
9881
10243
|
depthTest: !1
|
|
9882
|
-
}), i = 0.7 * e, s = 0.7 * e, n = 0.15 * e, r = new
|
|
10244
|
+
}), i = 0.7 * e, s = 0.7 * e, n = 0.15 * e, r = new ue(i, i), o = new ue(n, s), a = new ue(n, n), l = 0.51 * e, c = new x(r, t.clone());
|
|
9883
10245
|
c.position.z = l, c.name = "FRONT";
|
|
9884
10246
|
const h = new x(o, t.clone());
|
|
9885
10247
|
h.position.z = l, h.position.x = i / 2 + n / 2;
|
|
@@ -9899,144 +10261,144 @@ class Pn {
|
|
|
9899
10261
|
b.position.z = l, b.position.x = -(i / 2 + n / 2), b.position.y = -(i / 2 + n / 2);
|
|
9900
10262
|
const w = new x(r, t.clone());
|
|
9901
10263
|
w.position.z = -l, w.name = "BACK";
|
|
9902
|
-
const
|
|
9903
|
-
|
|
10264
|
+
const S = new x(o, t.clone());
|
|
10265
|
+
S.position.z = -l, S.position.x = i / 2 + n / 2;
|
|
9904
10266
|
const A = new x(o, t.clone());
|
|
9905
10267
|
A.position.z = -l, A.position.x = -(i / 2 + n / 2);
|
|
9906
|
-
const
|
|
9907
|
-
|
|
10268
|
+
const C = new x(o, t.clone());
|
|
10269
|
+
C.position.z = -l, C.rotation.z = Math.PI / 2, C.position.y = i / 2 + n / 2;
|
|
9908
10270
|
const _ = new x(o, t.clone());
|
|
9909
10271
|
_.position.z = -l, _.rotation.z = Math.PI / 2, _.position.y = -(i / 2 + n / 2);
|
|
9910
|
-
const
|
|
9911
|
-
|
|
10272
|
+
const I = new x(a, t.clone());
|
|
10273
|
+
I.position.z = -l, I.position.x = i / 2 + n / 2, I.position.y = i / 2 + n / 2;
|
|
9912
10274
|
const T = new x(a, t.clone());
|
|
9913
10275
|
T.position.z = -l, T.position.x = -(i / 2 + n / 2), T.position.y = i / 2 + n / 2;
|
|
9914
10276
|
const M = new x(a, t.clone());
|
|
9915
10277
|
M.position.z = -l, M.position.x = -(i / 2 + n / 2), M.position.y = -(i / 2 + n / 2);
|
|
9916
|
-
const
|
|
9917
|
-
|
|
9918
|
-
const
|
|
9919
|
-
|
|
10278
|
+
const V = new x(a, t.clone());
|
|
10279
|
+
V.position.z = -l, V.position.x = i / 2 + n / 2, V.position.y = -(i / 2 + n / 2);
|
|
10280
|
+
const L = new x(r, t.clone());
|
|
10281
|
+
L.rotation.y = Math.PI / 2, L.position.x = l, L.name = "RIGHT";
|
|
9920
10282
|
const B = new x(o, t.clone());
|
|
9921
10283
|
B.rotation.y = Math.PI / 2, B.position.x = l, B.position.z = i / 2 + n / 2;
|
|
9922
|
-
const
|
|
9923
|
-
|
|
9924
|
-
const
|
|
9925
|
-
|
|
9926
|
-
const
|
|
9927
|
-
|
|
9928
|
-
const
|
|
9929
|
-
|
|
9930
|
-
const
|
|
9931
|
-
|
|
9932
|
-
const
|
|
9933
|
-
|
|
9934
|
-
const
|
|
9935
|
-
|
|
9936
|
-
const
|
|
9937
|
-
|
|
9938
|
-
const
|
|
9939
|
-
|
|
9940
|
-
const
|
|
9941
|
-
|
|
9942
|
-
const
|
|
9943
|
-
|
|
9944
|
-
const
|
|
9945
|
-
|
|
9946
|
-
const
|
|
9947
|
-
|
|
9948
|
-
const be = new x(a, t.clone());
|
|
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;
|
|
9950
|
-
const we = new x(a, t.clone());
|
|
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);
|
|
10284
|
+
const O = new x(o, t.clone());
|
|
10285
|
+
O.rotation.y = Math.PI / 2, O.position.x = l, O.position.z = -(i / 2 + n / 2);
|
|
10286
|
+
const R = new x(o, t.clone());
|
|
10287
|
+
R.rotation.y = Math.PI / 2, R.position.x = l, R.rotation.z = Math.PI / 2, R.position.y = i / 2 + n / 2;
|
|
10288
|
+
const U = new x(o, t.clone());
|
|
10289
|
+
U.rotation.y = Math.PI / 2, U.position.x = l, U.rotation.z = Math.PI / 2, U.position.y = -(i / 2 + n / 2);
|
|
10290
|
+
const j = new x(a, t.clone());
|
|
10291
|
+
j.rotation.y = Math.PI / 2, j.position.x = l, j.position.z = i / 2 + n / 2, j.position.y = i / 2 + n / 2;
|
|
10292
|
+
const q = new x(a, t.clone());
|
|
10293
|
+
q.rotation.y = Math.PI / 2, q.position.x = l, q.position.z = -(i / 2 + n / 2), q.position.y = i / 2 + n / 2;
|
|
10294
|
+
const Q = new x(a, t.clone());
|
|
10295
|
+
Q.rotation.y = Math.PI / 2, Q.position.x = l, Q.position.z = -(i / 2 + n / 2), Q.position.y = -(i / 2 + n / 2);
|
|
10296
|
+
const X = new x(a, t.clone());
|
|
10297
|
+
X.rotation.y = Math.PI / 2, X.position.x = l, X.position.z = i / 2 + n / 2, X.position.y = -(i / 2 + n / 2);
|
|
10298
|
+
const W = new x(r, t.clone());
|
|
10299
|
+
W.rotation.y = Math.PI / 2, W.position.x = -l, W.name = "LEFT";
|
|
10300
|
+
const K = new x(o, t.clone());
|
|
10301
|
+
K.rotation.y = Math.PI / 2, K.position.x = -l, K.position.z = i / 2 + n / 2;
|
|
10302
|
+
const Z = new x(o, t.clone());
|
|
10303
|
+
Z.rotation.y = Math.PI / 2, Z.position.x = -l, Z.position.z = -(i / 2 + n / 2);
|
|
10304
|
+
const G = new x(o, t.clone());
|
|
10305
|
+
G.rotation.y = Math.PI / 2, G.position.x = -l, G.rotation.z = Math.PI / 2, G.position.y = i / 2 + n / 2;
|
|
10306
|
+
const te = new x(o, t.clone());
|
|
10307
|
+
te.rotation.y = Math.PI / 2, te.position.x = -l, te.rotation.z = Math.PI / 2, te.position.y = -(i / 2 + n / 2);
|
|
10308
|
+
const ie = new x(a, t.clone());
|
|
10309
|
+
ie.rotation.y = Math.PI / 2, ie.position.x = -l, ie.position.z = -(i / 2 + n / 2), ie.position.y = i / 2 + n / 2;
|
|
9952
10310
|
const ye = new x(a, t.clone());
|
|
9953
|
-
ye.rotation.y = Math.PI / 2, ye.position.x = -l, ye.position.z =
|
|
9954
|
-
const
|
|
9955
|
-
|
|
9956
|
-
const
|
|
9957
|
-
|
|
10311
|
+
ye.rotation.y = Math.PI / 2, ye.position.x = -l, ye.position.z = i / 2 + n / 2, ye.position.y = i / 2 + n / 2;
|
|
10312
|
+
const xe = new x(a, t.clone());
|
|
10313
|
+
xe.rotation.y = Math.PI / 2, xe.position.x = -l, xe.position.z = i / 2 + n / 2, xe.position.y = -(i / 2 + n / 2);
|
|
10314
|
+
const Me = new x(a, t.clone());
|
|
10315
|
+
Me.rotation.y = Math.PI / 2, Me.position.x = -l, Me.position.z = -(i / 2 + n / 2), Me.position.y = -(i / 2 + n / 2);
|
|
10316
|
+
const Ze = new x(r, t.clone());
|
|
10317
|
+
Ze.rotation.x = Math.PI / 2, Ze.position.y = l, Ze.name = "TOP";
|
|
9958
10318
|
const Ye = new x(o, t.clone());
|
|
9959
|
-
Ye.rotation.x = Math.PI / 2, Ye.position.y = l, Ye.position.x =
|
|
9960
|
-
const
|
|
9961
|
-
|
|
9962
|
-
const
|
|
9963
|
-
|
|
9964
|
-
const
|
|
9965
|
-
|
|
10319
|
+
Ye.rotation.x = Math.PI / 2, Ye.position.y = l, Ye.position.x = i / 2 + n / 2;
|
|
10320
|
+
const Xe = new x(o, t.clone());
|
|
10321
|
+
Xe.rotation.x = Math.PI / 2, Xe.position.y = l, Xe.position.x = -(i / 2 + n / 2);
|
|
10322
|
+
const Ee = new x(o, t.clone());
|
|
10323
|
+
Ee.rotation.x = Math.PI / 2, Ee.position.y = l, Ee.rotation.z = Math.PI / 2, Ee.position.z = i / 2 + n / 2;
|
|
10324
|
+
const Se = new x(o, t.clone());
|
|
10325
|
+
Se.rotation.x = Math.PI / 2, Se.position.y = l, Se.rotation.z = Math.PI / 2, Se.position.z = -(i / 2 + n / 2);
|
|
9966
10326
|
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;
|
|
10327
|
+
Ce.rotation.x = Math.PI / 2, Ce.position.y = l, Ce.position.z = -(i / 2 + n / 2), Ce.position.x = -(i / 2 + n / 2);
|
|
9970
10328
|
const Ae = new x(a, t.clone());
|
|
9971
|
-
Ae.rotation.x = Math.PI / 2, Ae.position.y = l, Ae.position.z = i / 2 + n / 2, Ae.position.x =
|
|
9972
|
-
const
|
|
9973
|
-
|
|
9974
|
-
const
|
|
9975
|
-
|
|
10329
|
+
Ae.rotation.x = Math.PI / 2, Ae.position.y = l, Ae.position.z = -(i / 2 + n / 2), Ae.position.x = i / 2 + n / 2;
|
|
10330
|
+
const _e = new x(a, t.clone());
|
|
10331
|
+
_e.rotation.x = Math.PI / 2, _e.position.y = l, _e.position.z = i / 2 + n / 2, _e.position.x = i / 2 + n / 2;
|
|
10332
|
+
const Ie = new x(a, t.clone());
|
|
10333
|
+
Ie.rotation.x = Math.PI / 2, Ie.position.y = l, Ie.position.z = i / 2 + n / 2, Ie.position.x = -(i / 2 + n / 2);
|
|
10334
|
+
const Ke = new x(r, t.clone());
|
|
10335
|
+
Ke.rotation.x = Math.PI / 2, Ke.position.y = -l, Ke.name = "BOTTOM";
|
|
9976
10336
|
const Je = new x(o, t.clone());
|
|
9977
|
-
Je.rotation.x = Math.PI / 2, Je.position.y = -l, Je.position.x =
|
|
9978
|
-
const
|
|
9979
|
-
|
|
10337
|
+
Je.rotation.x = Math.PI / 2, Je.position.y = -l, Je.position.x = i / 2 + n / 2;
|
|
10338
|
+
const et = new x(o, t.clone());
|
|
10339
|
+
et.rotation.x = Math.PI / 2, et.position.y = -l, et.position.x = -(i / 2 + n / 2);
|
|
9980
10340
|
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 =
|
|
9982
|
-
const
|
|
9983
|
-
|
|
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;
|
|
10341
|
+
Ve.rotation.x = Math.PI / 2, Ve.position.y = -l, Ve.rotation.z = Math.PI / 2, Ve.position.z = i / 2 + n / 2;
|
|
10342
|
+
const Te = new x(o, t.clone());
|
|
10343
|
+
Te.rotation.x = Math.PI / 2, Te.position.y = -l, Te.rotation.z = Math.PI / 2, Te.position.z = -(i / 2 + n / 2);
|
|
9986
10344
|
const Pe = new x(a, t.clone());
|
|
9987
|
-
Pe.rotation.x = Math.PI / 2, Pe.position.y = -l, Pe.position.z =
|
|
10345
|
+
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
10346
|
const Oe = new x(a, t.clone());
|
|
9989
|
-
Oe.rotation.x = Math.PI / 2, Oe.position.y = -l, Oe.position.z =
|
|
9990
|
-
const
|
|
10347
|
+
Oe.rotation.x = Math.PI / 2, Oe.position.y = -l, Oe.position.z = i / 2 + n / 2, Oe.position.x = i / 2 + n / 2;
|
|
10348
|
+
const De = new x(a, t.clone());
|
|
10349
|
+
De.rotation.x = Math.PI / 2, De.position.y = -l, De.position.z = -(i / 2 + n / 2), De.position.x = i / 2 + n / 2;
|
|
10350
|
+
const Re = new x(a, t.clone());
|
|
10351
|
+
Re.rotation.x = Math.PI / 2, Re.position.y = -l, Re.position.z = -(i / 2 + n / 2), Re.position.x = -(i / 2 + n / 2);
|
|
10352
|
+
const ti = new Y({
|
|
9991
10353
|
color: 11184810
|
|
9992
|
-
}),
|
|
9993
|
-
|
|
9994
|
-
const et = new x();
|
|
9995
|
-
et.name = "1131", et.add(h), et.add(B), this.addObject(et);
|
|
10354
|
+
}), ii = new ue(1 * e, 1 * e), bt = new x(ii, ti);
|
|
10355
|
+
bt.rotation.x = -Math.PI / 2, bt.position.y = -0.6 * e, this.addObject(c), this.addObject(w), this.addObject(L), this.addObject(W), this.addObject(Ze), this.addObject(Ke), this.addObject(bt);
|
|
9996
10356
|
const tt = new x();
|
|
9997
|
-
tt.name = "
|
|
10357
|
+
tt.name = "1131", tt.add(h), tt.add(B), this.addObject(tt);
|
|
9998
10358
|
const it = new x();
|
|
9999
|
-
it.name = "
|
|
10359
|
+
it.name = "1241", it.add(d), it.add(K), this.addObject(it);
|
|
10000
10360
|
const st = new x();
|
|
10001
|
-
st.name = "
|
|
10361
|
+
st.name = "1353", st.add(u), st.add(Ee), this.addObject(st);
|
|
10002
10362
|
const nt = new x();
|
|
10003
|
-
nt.name = "
|
|
10363
|
+
nt.name = "1463", nt.add(p), nt.add(Ve), this.addObject(nt);
|
|
10004
10364
|
const rt = new x();
|
|
10005
|
-
rt.name = "
|
|
10365
|
+
rt.name = "2464", rt.add(_), rt.add(Te), this.addObject(rt);
|
|
10006
10366
|
const at = new x();
|
|
10007
|
-
at.name = "
|
|
10367
|
+
at.name = "3221", at.add(O), at.add(S), this.addObject(at);
|
|
10008
10368
|
const ot = new x();
|
|
10009
|
-
ot.name = "
|
|
10369
|
+
ot.name = "3351", ot.add(R), ot.add(Ye), this.addObject(ot);
|
|
10010
10370
|
const lt = new x();
|
|
10011
|
-
lt.name = "
|
|
10371
|
+
lt.name = "3461", lt.add(U), lt.add(Je), this.addObject(lt);
|
|
10012
10372
|
const ct = new x();
|
|
10013
|
-
ct.name = "
|
|
10373
|
+
ct.name = "4222", ct.add(Z), ct.add(A), this.addObject(ct);
|
|
10014
10374
|
const ht = new x();
|
|
10015
|
-
ht.name = "
|
|
10375
|
+
ht.name = "4352", ht.add(G), ht.add(Xe), this.addObject(ht);
|
|
10016
10376
|
const dt = new x();
|
|
10017
|
-
dt.name = "
|
|
10018
|
-
const
|
|
10019
|
-
|
|
10020
|
-
const Re = new x();
|
|
10021
|
-
Re.name = "corner2", Re.add(f), Re.add(U), Re.add(Se), this.addObject(Re);
|
|
10377
|
+
dt.name = "3462", dt.add(te), dt.add(et), this.addObject(dt);
|
|
10378
|
+
const ut = new x();
|
|
10379
|
+
ut.name = "5423", ut.add(Se), ut.add(C), this.addObject(ut);
|
|
10022
10380
|
const Le = new x();
|
|
10023
|
-
Le.name = "
|
|
10381
|
+
Le.name = "corner1", Le.add(m), Le.add(Ie), Le.add(ye), this.addObject(Le);
|
|
10024
10382
|
const ke = new x();
|
|
10025
|
-
ke.name = "
|
|
10383
|
+
ke.name = "corner2", ke.add(f), ke.add(j), ke.add(_e), this.addObject(ke);
|
|
10026
10384
|
const Be = new x();
|
|
10027
|
-
Be.name = "
|
|
10385
|
+
Be.name = "corner3", Be.add(v), Be.add(X), Be.add(Oe), this.addObject(Be);
|
|
10028
10386
|
const ze = new x();
|
|
10029
|
-
ze.name = "
|
|
10387
|
+
ze.name = "corner4", ze.add(b), ze.add(xe), ze.add(Pe), this.addObject(ze);
|
|
10030
10388
|
const Ne = new x();
|
|
10031
|
-
Ne.name = "
|
|
10389
|
+
Ne.name = "corner5", Ne.add(I), Ne.add(q), Ne.add(Ae), this.addObject(Ne);
|
|
10032
10390
|
const $e = new x();
|
|
10033
|
-
$e.name = "
|
|
10391
|
+
$e.name = "corner6", $e.add(T), $e.add(Ce), $e.add(ie), this.addObject($e);
|
|
10392
|
+
const je = new x();
|
|
10393
|
+
je.name = "corner7", je.add(M), je.add(Me), je.add(Re), this.addObject(je);
|
|
10394
|
+
const He = new x();
|
|
10395
|
+
He.name = "corner8", He.add(V), He.add(Q), He.add(De), this.addObject(He);
|
|
10034
10396
|
}
|
|
10035
10397
|
}
|
|
10036
|
-
class
|
|
10398
|
+
class Bn {
|
|
10037
10399
|
//* view cube from third party (new approach)
|
|
10038
10400
|
constructor(e, t = 1) {
|
|
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
|
|
10401
|
+
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 kn(this, this.cubeScale), this.cubeRenderer = new Ln(this), this.cubeCamera = new Rn(this), this.cubeMouse = new Dn(this)), this.viralViewerApi.emit(k.LOADED_CUBE);
|
|
10040
10402
|
}
|
|
10041
10403
|
injectCubeWrapperElement() {
|
|
10042
10404
|
if (this.viralViewerApi.targetElement) {
|
|
@@ -10057,7 +10419,7 @@ class On {
|
|
|
10057
10419
|
this.viralViewerApi.viralCamera.backHome();
|
|
10058
10420
|
}
|
|
10059
10421
|
}
|
|
10060
|
-
class
|
|
10422
|
+
class zn {
|
|
10061
10423
|
constructor(e) {
|
|
10062
10424
|
this.viralViewerApi = e, this.contextMenu = null, this.injectContextMenu();
|
|
10063
10425
|
}
|
|
@@ -10074,7 +10436,7 @@ class Dn {
|
|
|
10074
10436
|
this.contextMenu && this.contextMenu.style.setProperty("display", "none");
|
|
10075
10437
|
}
|
|
10076
10438
|
}
|
|
10077
|
-
class
|
|
10439
|
+
class Nn {
|
|
10078
10440
|
constructor(e) {
|
|
10079
10441
|
this.viralViewerApi = e, this.spinner = null, this.logo = `<svg
|
|
10080
10442
|
width="348.25488"
|
|
@@ -10144,7 +10506,7 @@ class Rn {
|
|
|
10144
10506
|
"style",
|
|
10145
10507
|
`width: 200px; height: 200px; border-radius: 50%; border: 2px solid #ccc; border-top: 2px solid ${y.primary}; animation: spin 1.5s linear infinite;`
|
|
10146
10508
|
);
|
|
10147
|
-
const n =
|
|
10509
|
+
const n = vt.createElementFromHTML(this.logo);
|
|
10148
10510
|
n.setAttribute(
|
|
10149
10511
|
"style",
|
|
10150
10512
|
"height:150px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)"
|
|
@@ -10158,7 +10520,7 @@ class Rn {
|
|
|
10158
10520
|
this.spinner && this.spinner.style.setProperty("display", "none");
|
|
10159
10521
|
}
|
|
10160
10522
|
}
|
|
10161
|
-
class
|
|
10523
|
+
class $n {
|
|
10162
10524
|
constructor(e) {
|
|
10163
10525
|
this.viralTools = e;
|
|
10164
10526
|
}
|
|
@@ -10167,7 +10529,7 @@ class Ln {
|
|
|
10167
10529
|
e.activate && console.log((t = this.viralTools.viralViewerApi.viralCamera.camera) == null ? void 0 : t.position);
|
|
10168
10530
|
}
|
|
10169
10531
|
}
|
|
10170
|
-
class
|
|
10532
|
+
class jn {
|
|
10171
10533
|
constructor(e) {
|
|
10172
10534
|
this.viralTools = e;
|
|
10173
10535
|
}
|
|
@@ -10175,7 +10537,7 @@ class kn {
|
|
|
10175
10537
|
this.viralTools.viralViewerApi.targetElement && e.activate;
|
|
10176
10538
|
}
|
|
10177
10539
|
}
|
|
10178
|
-
class
|
|
10540
|
+
class Hn {
|
|
10179
10541
|
constructor(e) {
|
|
10180
10542
|
this.viralTools = e;
|
|
10181
10543
|
}
|
|
@@ -10192,7 +10554,7 @@ class Bn {
|
|
|
10192
10554
|
));
|
|
10193
10555
|
}
|
|
10194
10556
|
}
|
|
10195
|
-
class
|
|
10557
|
+
class Fn {
|
|
10196
10558
|
constructor(e) {
|
|
10197
10559
|
this.viralTools = e, this.isActivated = !1;
|
|
10198
10560
|
}
|
|
@@ -10212,7 +10574,7 @@ class zn {
|
|
|
10212
10574
|
}
|
|
10213
10575
|
}
|
|
10214
10576
|
}
|
|
10215
|
-
class
|
|
10577
|
+
class Wn {
|
|
10216
10578
|
constructor(e) {
|
|
10217
10579
|
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;
|
|
10218
10580
|
}
|
|
@@ -10251,7 +10613,7 @@ class Nn {
|
|
|
10251
10613
|
const s = this.defaultSprite.clone();
|
|
10252
10614
|
s.position.copy(this.point1), this.tempMeasure.add(s);
|
|
10253
10615
|
} else if (this.point1 && !this.point2) {
|
|
10254
|
-
this.point2 = i,
|
|
10616
|
+
this.point2 = i, D.clearChildren(this.tempMeasure);
|
|
10255
10617
|
const s = this.defaultSprite.clone();
|
|
10256
10618
|
s.position.copy(this.point1), this.measureObject.add(s);
|
|
10257
10619
|
const n = this.defaultSprite.clone();
|
|
@@ -10278,18 +10640,18 @@ class Nn {
|
|
|
10278
10640
|
const a = o * 0.8 / 2;
|
|
10279
10641
|
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;
|
|
10280
10642
|
}
|
|
10281
|
-
const t = new
|
|
10643
|
+
const t = new kt(e()), i = new Bt({
|
|
10282
10644
|
map: t,
|
|
10283
10645
|
sizeAttenuation: !1
|
|
10284
|
-
}), s = new
|
|
10646
|
+
}), s = new zt(i);
|
|
10285
10647
|
return s.scale.setScalar(0.08), s;
|
|
10286
10648
|
}
|
|
10287
10649
|
makeLine(e, t) {
|
|
10288
|
-
const i = new
|
|
10289
|
-
color:
|
|
10650
|
+
const i = new Ei({
|
|
10651
|
+
color: D.hexToThreejsColor(y.primary),
|
|
10290
10652
|
linewidth: 20
|
|
10291
|
-
}), s = [e, t], n = new
|
|
10292
|
-
return new
|
|
10653
|
+
}), s = [e, t], n = new he().setFromPoints(s);
|
|
10654
|
+
return new gt(n, i);
|
|
10293
10655
|
}
|
|
10294
10656
|
makeDistanceSprite(e, t) {
|
|
10295
10657
|
function i(c, h, d, u, p, m) {
|
|
@@ -10308,24 +10670,24 @@ class Nn {
|
|
|
10308
10670
|
10
|
|
10309
10671
|
), n.shadowBlur = 0, n.fillStyle = "#fff", n.textAlign = "left", n.textBaseline = "top", n.font = "bolder " + r + 'px "Open Sans", Arial', n.fillText(h, u + m, p + m);
|
|
10310
10672
|
}
|
|
10311
|
-
const o = new
|
|
10312
|
-
new
|
|
10673
|
+
const o = new kt(s), a = new zt(
|
|
10674
|
+
new Bt({
|
|
10313
10675
|
map: o,
|
|
10314
10676
|
sizeAttenuation: !1
|
|
10315
10677
|
})
|
|
10316
10678
|
);
|
|
10317
10679
|
a.scale.set(2e-3 * s.width * 0.5, 25e-4 * s.height * 0.5, 1);
|
|
10318
|
-
const l =
|
|
10680
|
+
const l = D.middlePoint(e, t);
|
|
10319
10681
|
return a.position.copy(l), a;
|
|
10320
10682
|
}
|
|
10321
10683
|
dispose() {
|
|
10322
|
-
this.resetPickedPoints(),
|
|
10684
|
+
this.resetPickedPoints(), D.clearChildren(this.measureObject), D.clearChildren(this.tempMeasure), this.viralTools.viralViewerApi.viralRenderer.render();
|
|
10323
10685
|
}
|
|
10324
10686
|
onKeyPress(e) {
|
|
10325
|
-
e.code == "Escape" && (
|
|
10687
|
+
e.code == "Escape" && (D.clearChildren(this.tempMeasure), this.point1 = null, this.point2 = null, this.tempPoint2 = null, this.viralTools.viralViewerApi.viralRenderer.render());
|
|
10326
10688
|
}
|
|
10327
10689
|
}
|
|
10328
|
-
class
|
|
10690
|
+
class Gn {
|
|
10329
10691
|
constructor(e) {
|
|
10330
10692
|
this.viralTools = e;
|
|
10331
10693
|
}
|
|
@@ -10337,7 +10699,7 @@ class $n {
|
|
|
10337
10699
|
if (e.activate) {
|
|
10338
10700
|
if (t) {
|
|
10339
10701
|
if (t.visible = !0, this.viralTools.viralViewerApi.viralScene.models.length > 0) {
|
|
10340
|
-
const i = new
|
|
10702
|
+
const i = new F().setFromObject(
|
|
10341
10703
|
this.viralTools.viralViewerApi.viralScene.models[0]
|
|
10342
10704
|
), s = new E();
|
|
10343
10705
|
i.getSize(s);
|
|
@@ -10360,7 +10722,7 @@ class $n {
|
|
|
10360
10722
|
}
|
|
10361
10723
|
}
|
|
10362
10724
|
}
|
|
10363
|
-
class
|
|
10725
|
+
class Un {
|
|
10364
10726
|
constructor(e) {
|
|
10365
10727
|
this.viralViewerApi = e, this.tools = [
|
|
10366
10728
|
{
|
|
@@ -10464,7 +10826,7 @@ class jn {
|
|
|
10464
10826
|
}
|
|
10465
10827
|
]
|
|
10466
10828
|
}
|
|
10467
|
-
], this.items = [], this.viralToolAvatar = new
|
|
10829
|
+
], this.items = [], this.viralToolAvatar = new jn(this), this.viralToolDarkMode = new Hn(this), this.viralToolSunlight = new Gn(this), this.viralToolElevation = new Fn(this), this.viralToolMeasure = new Wn(this), this.viralToolAmbientOcclusion = new $n(this), this.dehydratedCachedData(), this.executeToolsByDefault(), this.injectTools(), this.viralViewerApi.emit(k.LOADED_TOOLS);
|
|
10468
10830
|
}
|
|
10469
10831
|
//#region Init
|
|
10470
10832
|
injectTools() {
|
|
@@ -10508,7 +10870,7 @@ class jn {
|
|
|
10508
10870
|
}, l.onmouseleave = () => {
|
|
10509
10871
|
l.style.setProperty("background-color", "unset");
|
|
10510
10872
|
};
|
|
10511
|
-
const c =
|
|
10873
|
+
const c = vt.createElementFromHTML(r.svg);
|
|
10512
10874
|
r.activate && c && c.setAttribute("fill", `${y.secondary}`), l.appendChild(c), o.appendChild(l), s.appendChild(o);
|
|
10513
10875
|
}
|
|
10514
10876
|
e.appendChild(s);
|
|
@@ -10548,7 +10910,7 @@ class jn {
|
|
|
10548
10910
|
}
|
|
10549
10911
|
//#endregion
|
|
10550
10912
|
}
|
|
10551
|
-
class
|
|
10913
|
+
class qn {
|
|
10552
10914
|
set(e, t) {
|
|
10553
10915
|
localStorage[e] = t;
|
|
10554
10916
|
}
|
|
@@ -10597,7 +10959,7 @@ class Hn {
|
|
|
10597
10959
|
localStorage.clear();
|
|
10598
10960
|
}
|
|
10599
10961
|
}
|
|
10600
|
-
class
|
|
10962
|
+
class Ar extends $s {
|
|
10601
10963
|
constructor(e = {
|
|
10602
10964
|
isDev: !1,
|
|
10603
10965
|
cameraZUp: !1,
|
|
@@ -10609,13 +10971,13 @@ class xr extends zs {
|
|
|
10609
10971
|
adaptiveEdges: !0,
|
|
10610
10972
|
adaptiveAmbientOcclusion: !0
|
|
10611
10973
|
}) {
|
|
10612
|
-
super(), this.viralCompressProcessor = new
|
|
10974
|
+
super(), this.viralCompressProcessor = new Ms(), this.localStorageService = new qn(), this.viralStats = null, this.viralSectionBox = null, this.viralBatchDebugPanel = null, this.viralRenderDebugPanel = null, this.viralInstancedDebugPanel = null, this.options = e, this.viralLifecycleEventHandler = new Ws(this, this.options), this.targetElement = e.container, Pn("QUICK_SAND"), On(this.targetElement, "QUICK_SAND"), this.options.enableTools && (this.viralTools = new Un(this)), this.viralSpinner = new Nn(this), this.viralDraggableModal = new Tn(this), this.viralContextMenu = new Vn(this), this.viralPivotPoint = new zn(this), this.viralScene = new Cn(this), this.viralMaterialManager = new an(this), this.viralRenderer = new Sn(this), this.viralCamera = new xs(this), this.options.enableNavigationCube && (this.viralNavigationCube = new Bn(
|
|
10613
10975
|
this,
|
|
10614
10976
|
this.options.navigationCubeScale || 1
|
|
10615
|
-
)), this.viralMouse = new
|
|
10977
|
+
)), this.viralMouse = new Hs(this), this.viralKeyboard = new js(this), this.viralAnimation = new ms(this), this.viralVisibilityManager = new In(this), this.viralCentralizedEventHandler = new Fs(this), this.viralLoader = new rn(this), this.viralBVH = new ws(), this.viralDataManager = new Ns(this), this.viralAvatarManager = new bs(this), this.options.isDev && (this.viralStats = new _n(this)), this.options.isDev ? this.viralAnimation.devAnimation() : this.viralAnimation.animation();
|
|
10616
10978
|
const t = window;
|
|
10617
|
-
t.VIRAL_VIEWER = this, this.viralSectionBox = new
|
|
10618
|
-
var A,
|
|
10979
|
+
t.VIRAL_VIEWER = this, this.viralSectionBox = new It(this), this.viralBatchDebugPanel = new ds(this), this.viralRenderDebugPanel = new ps(this), this.viralInstancedDebugPanel = new us(this), this.options.isDev && import("./lil-gui.esm-BtfdsiIY.mjs").then(({ GUI: i }) => {
|
|
10980
|
+
var A, C, _, I, T;
|
|
10619
10981
|
const s = new i({ title: "Controls" }), n = s.addFolder("Sun Light");
|
|
10620
10982
|
n.add(this.viralScene.sunLight, "visible").onChange(() => {
|
|
10621
10983
|
this.viralRenderer.render();
|
|
@@ -10627,7 +10989,7 @@ class xr extends zs {
|
|
|
10627
10989
|
this.viralVisibilityManager.enableShadow(), this.viralRenderer.render();
|
|
10628
10990
|
}), n.open();
|
|
10629
10991
|
const r = s.addFolder("Visibility");
|
|
10630
|
-
r.add(this.viralVisibilityManager, "isolateModelId"), r.add(this.viralVisibilityManager, "isolateModel"), r.add(this.viralVisibilityManager, "enableEdge"), r.add(this.viralVisibilityManager, "disableEdge"), r.add(this.viralVisibilityManager, "enableGroundShadow"), r.add(this.viralVisibilityManager, "disableGroundShadow"), r.add(this.viralVisibilityManager, "enableAllWhite"), r.add(this.viralVisibilityManager, "disableAllWhite"), r.add(this.viralVisibilityManager, "enableNight"), r.add(this.viralVisibilityManager, "disableNight"), r.add(this.viralVisibilityManager, "enableFog"), r.add(this.viralVisibilityManager, "disableFog"), r.add(this.viralVisibilityManager, "enableRain"), r.add(this.viralVisibilityManager, "disableRain"), r.add(this.viralVisibilityManager, "showBatches"), r.add(this.viralVisibilityManager, "hideBatches"), r.add(this.viralVisibilityManager, "selectAllElements");
|
|
10992
|
+
r.add(this.viralVisibilityManager, "isolateModelId"), r.add(this.viralVisibilityManager, "isolateModel"), r.add(this.viralVisibilityManager, "enableEdge"), r.add(this.viralVisibilityManager, "disableEdge"), r.add(this.viralVisibilityManager, "enableGroundShadow"), r.add(this.viralVisibilityManager, "disableGroundShadow"), r.add(this.viralVisibilityManager, "enableAllWhite"), r.add(this.viralVisibilityManager, "disableAllWhite"), r.add(this.viralVisibilityManager, "enableNight"), r.add(this.viralVisibilityManager, "disableNight"), r.add(this.viralVisibilityManager, "enableFog"), r.add(this.viralVisibilityManager, "disableFog"), r.add(this.viralVisibilityManager, "enableRain"), r.add(this.viralVisibilityManager, "disableRain"), r.add(this.viralVisibilityManager, "showBatches"), r.add(this.viralVisibilityManager, "hideBatches"), r.add(this.viralVisibilityManager, "selectAllElements"), r.add(this.viralVisibilityManager, "hideAllElements");
|
|
10631
10993
|
const o = s.addFolder("Selection Outline"), a = {
|
|
10632
10994
|
enabled: this.viralVisibilityManager.selectionOutlineEnabled,
|
|
10633
10995
|
color: "#00d9ff",
|
|
@@ -10636,22 +10998,22 @@ class xr extends zs {
|
|
|
10636
10998
|
o.add(a, "enabled").name("Outline Enabled").onChange((M) => {
|
|
10637
10999
|
this.viralVisibilityManager.setSelectionOutlineMode(M);
|
|
10638
11000
|
}), o.addColor(a, "color").name("Outline Color").onChange((M) => {
|
|
10639
|
-
var
|
|
10640
|
-
(
|
|
11001
|
+
var V;
|
|
11002
|
+
(V = this.viralRenderer.postProcessingRenderer) == null || V.setSelectionOutlineColor(M), this.viralRenderer.render();
|
|
10641
11003
|
}), o.add(a, "thickness", 0.5, 5, 0.5).name("Thickness").onChange((M) => {
|
|
10642
|
-
var
|
|
10643
|
-
(
|
|
11004
|
+
var V;
|
|
11005
|
+
(V = this.viralRenderer.postProcessingRenderer) == null || V.setSelectionOutlineThickness(
|
|
10644
11006
|
M
|
|
10645
11007
|
), this.viralRenderer.render();
|
|
10646
11008
|
}), o.add(this.viralVisibilityManager, "updateSelectionOutline").name("Refresh");
|
|
10647
11009
|
const l = { randomCount: 500 }, c = () => {
|
|
10648
11010
|
const M = [];
|
|
10649
|
-
for (let
|
|
10650
|
-
const
|
|
10651
|
-
for (const B of
|
|
11011
|
+
for (let V = 0; V < this.viralDataManager.dataTree.length; V++) {
|
|
11012
|
+
const L = this.viralDataManager.dataTree[V];
|
|
11013
|
+
for (const B of L.getAllElements())
|
|
10652
11014
|
M.push({
|
|
10653
11015
|
elementId: B.elementId.toString(),
|
|
10654
|
-
modelId:
|
|
11016
|
+
modelId: V.toString()
|
|
10655
11017
|
});
|
|
10656
11018
|
}
|
|
10657
11019
|
return M;
|
|
@@ -10662,13 +11024,13 @@ class xr extends zs {
|
|
|
10662
11024
|
);
|
|
10663
11025
|
},
|
|
10664
11026
|
selectRandom: () => {
|
|
10665
|
-
const M = c(),
|
|
10666
|
-
for (let B = M.length - 1; B > M.length - 1 -
|
|
10667
|
-
const
|
|
10668
|
-
[M[B], M[
|
|
11027
|
+
const M = c(), V = Math.min(l.randomCount, M.length);
|
|
11028
|
+
for (let B = M.length - 1; B > M.length - 1 - V; B--) {
|
|
11029
|
+
const O = Math.floor(Math.random() * (B + 1));
|
|
11030
|
+
[M[B], M[O]] = [M[O], M[B]];
|
|
10669
11031
|
}
|
|
10670
|
-
const
|
|
10671
|
-
console.log(`--- Outline Benchmark (random ${
|
|
11032
|
+
const L = M.slice(M.length - V);
|
|
11033
|
+
console.log(`--- Outline Benchmark (random ${V}) ---`), console.time("⏱️ select + outline total"), this.viralVisibilityManager.selectElements(L), console.timeEnd("⏱️ select + outline total"), console.log(`📊 Selected: ${V} / ${M.length} elements`);
|
|
10672
11034
|
},
|
|
10673
11035
|
unselectAll: () => {
|
|
10674
11036
|
console.time("⏱️ unselect + outline"), this.viralVisibilityManager.unselectElements(), console.timeEnd("⏱️ unselect + outline");
|
|
@@ -10749,47 +11111,47 @@ class xr extends zs {
|
|
|
10749
11111
|
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) => {
|
|
10750
11112
|
console.log("The value is now " + M), this.viralMaterialManager.edgeMaterial.linewidth = M, this.viralRenderer.render();
|
|
10751
11113
|
}), this.viralRenderer.postProcessingRenderer) {
|
|
10752
|
-
const M = s.addFolder("Post Processing"),
|
|
10753
|
-
|
|
11114
|
+
const M = s.addFolder("Post Processing"), V = M.addFolder("N8ao");
|
|
11115
|
+
V.add(
|
|
10754
11116
|
(A = this.viralRenderer.postProcessingRenderer) == null ? void 0 : A.n8aoPass.configuration,
|
|
10755
11117
|
"aoSamples",
|
|
10756
11118
|
1,
|
|
10757
11119
|
64,
|
|
10758
11120
|
1
|
|
10759
|
-
).onChange((
|
|
10760
|
-
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoSamples =
|
|
10761
|
-
}),
|
|
10762
|
-
(
|
|
11121
|
+
).onChange((O) => {
|
|
11122
|
+
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoSamples = O, this.viralRenderer.render();
|
|
11123
|
+
}), V.add(
|
|
11124
|
+
(C = this.viralRenderer.postProcessingRenderer) == null ? void 0 : C.n8aoPass.configuration,
|
|
10763
11125
|
"aoRadius",
|
|
10764
11126
|
1,
|
|
10765
11127
|
10,
|
|
10766
11128
|
0.01
|
|
10767
|
-
).onChange((
|
|
10768
|
-
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoRadius =
|
|
10769
|
-
}),
|
|
11129
|
+
).onChange((O) => {
|
|
11130
|
+
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.aoRadius = O, this.viralRenderer.render();
|
|
11131
|
+
}), V.add(
|
|
10770
11132
|
(_ = this.viralRenderer.postProcessingRenderer) == null ? void 0 : _.n8aoPass.configuration,
|
|
10771
11133
|
"denoiseRadius",
|
|
10772
11134
|
0,
|
|
10773
11135
|
24,
|
|
10774
11136
|
0.01
|
|
10775
|
-
).onChange((
|
|
10776
|
-
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.denoiseRadius =
|
|
10777
|
-
}),
|
|
10778
|
-
(
|
|
11137
|
+
).onChange((O) => {
|
|
11138
|
+
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.denoiseRadius = O, this.viralRenderer.render();
|
|
11139
|
+
}), V.add(
|
|
11140
|
+
(I = this.viralRenderer.postProcessingRenderer) == null ? void 0 : I.n8aoPass.configuration,
|
|
10779
11141
|
"intensity",
|
|
10780
11142
|
0,
|
|
10781
11143
|
10,
|
|
10782
11144
|
0.01
|
|
10783
|
-
).onChange((
|
|
10784
|
-
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.intensity =
|
|
10785
|
-
}),
|
|
11145
|
+
).onChange((O) => {
|
|
11146
|
+
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.intensity = O, this.viralRenderer.render();
|
|
11147
|
+
}), V.add(
|
|
10786
11148
|
(T = this.viralRenderer.postProcessingRenderer) == null ? void 0 : T.n8aoPass.configuration,
|
|
10787
11149
|
"distanceFalloff",
|
|
10788
11150
|
0,
|
|
10789
11151
|
10,
|
|
10790
11152
|
0.01
|
|
10791
|
-
).onChange((
|
|
10792
|
-
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.distanceFalloff =
|
|
11153
|
+
).onChange((O) => {
|
|
11154
|
+
this.viralRenderer.postProcessingRenderer.n8aoPass.configuration.distanceFalloff = O, this.viralRenderer.render();
|
|
10793
11155
|
}), M.add(
|
|
10794
11156
|
this.viralRenderer.postProcessingRenderer,
|
|
10795
11157
|
"enableSobel"
|
|
@@ -10797,11 +11159,11 @@ class xr extends zs {
|
|
|
10797
11159
|
this.viralRenderer.postProcessingRenderer,
|
|
10798
11160
|
"disableSobel"
|
|
10799
11161
|
);
|
|
10800
|
-
const
|
|
10801
|
-
|
|
11162
|
+
const L = M.addFolder("Screen-Space Edges");
|
|
11163
|
+
L.add(this.viralRenderer.postProcessingRenderer, "enableScreenSpaceEdges").name("Enable"), L.add(this.viralRenderer.postProcessingRenderer, "disableScreenSpaceEdges").name("Disable"), L.add(
|
|
10802
11164
|
this.viralRenderer.postProcessingRenderer,
|
|
10803
11165
|
"setScreenSpaceEdgesPenMode"
|
|
10804
|
-
).name("Pen Mode"),
|
|
11166
|
+
).name("Pen Mode"), L.add(
|
|
10805
11167
|
this.viralRenderer.postProcessingRenderer,
|
|
10806
11168
|
"setScreenSpaceEdgesShadedMode"
|
|
10807
11169
|
).name("Shaded Mode");
|
|
@@ -10824,48 +11186,48 @@ class xr extends zs {
|
|
|
10824
11186
|
enableObjectIdEdges: !1
|
|
10825
11187
|
// Disable - most expensive
|
|
10826
11188
|
};
|
|
10827
|
-
|
|
10828
|
-
var
|
|
10829
|
-
(
|
|
10830
|
-
parseInt(
|
|
11189
|
+
L.addColor(B, "edgeColor").name("Edge Color").onChange((O) => {
|
|
11190
|
+
var R;
|
|
11191
|
+
(R = this.viralRenderer.postProcessingRenderer) == null || R.setScreenSpaceEdgeColor(
|
|
11192
|
+
parseInt(O.replace("#", "0x"))
|
|
10831
11193
|
), this.viralRenderer.render();
|
|
10832
|
-
}),
|
|
10833
|
-
var
|
|
10834
|
-
(
|
|
10835
|
-
}),
|
|
10836
|
-
var
|
|
10837
|
-
(
|
|
10838
|
-
|
|
11194
|
+
}), L.add(B, "edgeOpacity", 0, 1, 0.05).name("Opacity").onChange((O) => {
|
|
11195
|
+
var R;
|
|
11196
|
+
(R = this.viralRenderer.postProcessingRenderer) == null || R.setScreenSpaceEdgeOpacity(O), this.viralRenderer.render();
|
|
11197
|
+
}), L.add(B, "edgeThickness", 0.5, 5, 0.1).name("Thickness").onChange((O) => {
|
|
11198
|
+
var R;
|
|
11199
|
+
(R = this.viralRenderer.postProcessingRenderer) == null || R.setScreenSpaceEdgeThickness(
|
|
11200
|
+
O
|
|
10839
11201
|
), this.viralRenderer.render();
|
|
10840
|
-
}),
|
|
10841
|
-
var
|
|
10842
|
-
(
|
|
10843
|
-
depthMultiplier:
|
|
11202
|
+
}), L.add(B, "depthMultiplier", 0, 3, 0.1).name("Depth Sensitivity").onChange((O) => {
|
|
11203
|
+
var R;
|
|
11204
|
+
(R = this.viralRenderer.postProcessingRenderer) == null || R.setScreenSpaceEdgesOptions({
|
|
11205
|
+
depthMultiplier: O
|
|
10844
11206
|
}), this.viralRenderer.render();
|
|
10845
|
-
}),
|
|
10846
|
-
var
|
|
10847
|
-
(
|
|
10848
|
-
normalMultiplier:
|
|
11207
|
+
}), L.add(B, "normalMultiplier", 0, 3, 0.1).name("Normal Sensitivity").onChange((O) => {
|
|
11208
|
+
var R;
|
|
11209
|
+
(R = this.viralRenderer.postProcessingRenderer) == null || R.setScreenSpaceEdgesOptions({
|
|
11210
|
+
normalMultiplier: O
|
|
10849
11211
|
}), this.viralRenderer.render();
|
|
10850
|
-
}),
|
|
10851
|
-
var
|
|
10852
|
-
(
|
|
10853
|
-
normalBias:
|
|
11212
|
+
}), L.add(B, "normalBias", 0, 1, 0.01).name("Normal Bias").onChange((O) => {
|
|
11213
|
+
var R;
|
|
11214
|
+
(R = this.viralRenderer.postProcessingRenderer) == null || R.setScreenSpaceEdgesOptions({
|
|
11215
|
+
normalBias: O
|
|
10854
11216
|
}), this.viralRenderer.render();
|
|
10855
|
-
}),
|
|
10856
|
-
var
|
|
10857
|
-
(
|
|
10858
|
-
depth:
|
|
11217
|
+
}), L.add(B, "enableDepthEdges").name("Depth Edges").onChange((O) => {
|
|
11218
|
+
var R;
|
|
11219
|
+
(R = this.viralRenderer.postProcessingRenderer) == null || R.setScreenSpaceEdgeMethods({
|
|
11220
|
+
depth: O
|
|
10859
11221
|
}), this.viralRenderer.render();
|
|
10860
|
-
}),
|
|
10861
|
-
var
|
|
10862
|
-
(
|
|
10863
|
-
normal:
|
|
11222
|
+
}), L.add(B, "enableNormalEdges").name("Normal Edges").onChange((O) => {
|
|
11223
|
+
var R;
|
|
11224
|
+
(R = this.viralRenderer.postProcessingRenderer) == null || R.setScreenSpaceEdgeMethods({
|
|
11225
|
+
normal: O
|
|
10864
11226
|
}), this.viralRenderer.render();
|
|
10865
|
-
}),
|
|
10866
|
-
var
|
|
10867
|
-
(
|
|
10868
|
-
objectId:
|
|
11227
|
+
}), L.add(B, "enableObjectIdEdges").name("Object ID Edges").onChange((O) => {
|
|
11228
|
+
var R;
|
|
11229
|
+
(R = this.viralRenderer.postProcessingRenderer) == null || R.setScreenSpaceEdgeMethods({
|
|
11230
|
+
objectId: O
|
|
10869
11231
|
}), this.viralRenderer.render();
|
|
10870
11232
|
});
|
|
10871
11233
|
}
|
|
@@ -10873,37 +11235,37 @@ class xr extends zs {
|
|
|
10873
11235
|
}
|
|
10874
11236
|
}
|
|
10875
11237
|
export {
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
11238
|
+
wr as BufferElement,
|
|
11239
|
+
cs as CheckClashResult,
|
|
11240
|
+
ls as CompareModelsResult,
|
|
11241
|
+
os as DataTree,
|
|
11242
|
+
Cr as DebouncedEventHandler,
|
|
11243
|
+
ss as DefaultLightConfiguration,
|
|
10882
11244
|
_t as Dictionary,
|
|
10883
|
-
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
11245
|
+
vr as ElementFragment,
|
|
11246
|
+
fr as Fragment,
|
|
11247
|
+
hs as GroupByResult,
|
|
11248
|
+
vt as HTMLUtil,
|
|
11249
|
+
J as LogUtil,
|
|
11250
|
+
D as THREEUtil,
|
|
11251
|
+
Sr as TreeNode,
|
|
11252
|
+
ts as ViralBIMWorld,
|
|
11253
|
+
ds as ViralBatchDebugPanel,
|
|
11254
|
+
ee as ViralBatchedMesh,
|
|
11255
|
+
se as ViralCameraEventType,
|
|
11256
|
+
us as ViralInstancedDebugPanel,
|
|
11257
|
+
we as ViralKeyboardEventType,
|
|
11258
|
+
$ as ViralMouseEventType,
|
|
11259
|
+
de as ViralPoint,
|
|
11260
|
+
ps as ViralRenderDebugPanel,
|
|
11261
|
+
Ar as ViralViewerApi,
|
|
11262
|
+
br as ViralViewerRevitGeometry,
|
|
11263
|
+
gr as ViralViewerRevitNoneStructuralGeometry,
|
|
11264
|
+
is as ViralutionBox,
|
|
11265
|
+
Jt as ViralutionCamera,
|
|
11266
|
+
yr as ViralutionElement,
|
|
10905
11267
|
k as ViralutionEvent,
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
11268
|
+
Mr as ViralutionSolid,
|
|
11269
|
+
xr as ViralutionStandaloneModel,
|
|
11270
|
+
Er as ViralutionTrackingModel
|
|
10909
11271
|
};
|