bimatter-viewer-react 0.11.7 → 0.11.9
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/lib/Loaders/BmtLoader.d.ts +6 -0
- package/lib/Model.d.ts +2 -1
- package/lib/assets/BMTWorker-B6cln5F6.js +1 -0
- package/lib/assets/IFCWorker-F0BNIuiz.js +6 -0
- package/lib/index.js +985 -925
- package/lib/utils/GeometryUtils/progressiveDrawRange.d.ts +3 -0
- package/lib/utils/GeometryUtils/trueNorth.d.ts +2 -0
- package/lib/workers/WorkerMeshBvh.d.ts +3 -0
- package/package.json +1 -1
- package/lib/assets/BMTWorker-4FHDYd-p.js +0 -1
- package/lib/assets/IFCWorker-CfepOBoh.js +0 -6
package/lib/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import { d as e, l as t, n, t as r } from "./three.webgpu-7Fqpf016.js";
|
|
|
2
2
|
import { I as i, N as a, R as o, h as s, l as c, o as l } from "./three.tsl-Dfou2CS1.js";
|
|
3
3
|
import u, { Suspense as d, createContext as f, forwardRef as p, memo as m, useCallback as h, useContext as g, useEffect as _, useImperativeHandle as v, useLayoutEffect as y, useMemo as b, useRef as x, useState as S } from "react";
|
|
4
4
|
import { createRoot as C } from "react-dom/client";
|
|
5
|
-
import { Canvas as w, applyProps as
|
|
5
|
+
import { Canvas as w, applyProps as T, extend as E, useFrame as D, useThree as O } from "@react-three/fiber";
|
|
6
6
|
import "three";
|
|
7
|
-
import { AlwaysDepth as
|
|
7
|
+
import { AlwaysDepth as k, BackSide as ee, BasicDepthPacking as A, Box3 as j, BoxGeometry as te, BufferAttribute as M, BufferGeometry as ne, CanvasTexture as re, CatmullRomCurve3 as ie, Color as N, ConeGeometry as ae, DataTexture as oe, DepthStencilFormat as se, DepthTexture as ce, DoubleSide as le, DynamicDrawUsage as ue, Euler as P, EventDispatcher as de, Float32BufferAttribute as F, FloatType as I, FrontSide as fe, Group as L, HalfFloatType as pe, Line as me, Line3 as he, LineBasicMaterial as ge, LineDashedMaterial as _e, LineSegments as ve, LinearFilter as R, LinearSRGBColorSpace as ye, Material as be, MathUtils as xe, Matrix4 as z, Mesh as B, MeshBasicMaterial as Se, MeshLambertMaterial as Ce, MeshNormalMaterial as we, NearestFilter as V, NoBlending as Te, NoColorSpace as Ee, NoToneMapping as De, Object3D as Oe, OrthographicCamera as ke, PerspectiveCamera as Ae, Plane as je, REVISION as Me, RGBAFormat as Ne, RGFormat as Pe, Ray as Fe, Raycaster as Ie, RedFormat as Le, RepeatWrapping as Re, SRGBColorSpace as ze, Scene as Be, ShaderMaterial as Ve, ShapeUtils as He, Sphere as Ue, SphereGeometry as We, Sprite as Ge, SpriteMaterial as Ke, Texture as qe, TubeGeometry as Je, Uint32BufferAttribute as Ye, Uniform as H, UnsignedByteType as Xe, UnsignedInt248Type as Ze, UnsignedIntType as Qe, Vector2 as U, Vector3 as W, WebGLRenderTarget as $e } from "three";
|
|
8
8
|
import { createStore as et } from "zustand/vanilla";
|
|
9
9
|
import { Fragment as tt, jsx as G, jsxs as nt } from "react/jsx-runtime";
|
|
10
10
|
import { useStore as rt } from "zustand";
|
|
@@ -2038,7 +2038,7 @@ var Or = class {
|
|
|
2038
2038
|
//#endregion
|
|
2039
2039
|
//#region src/viewer/workers/BMTWorker.ts?worker
|
|
2040
2040
|
function Ar(e) {
|
|
2041
|
-
return new Worker("" + new URL("assets/BMTWorker-
|
|
2041
|
+
return new Worker("" + new URL("assets/BMTWorker-B6cln5F6.js", import.meta.url).href, { name: e?.name });
|
|
2042
2042
|
}
|
|
2043
2043
|
//#endregion
|
|
2044
2044
|
//#region src/viewer/workers/BMTWorkerClient.ts
|
|
@@ -2241,7 +2241,7 @@ function ti() {
|
|
|
2241
2241
|
//#endregion
|
|
2242
2242
|
//#region src/viewer/workers/IFCWorker.ts?worker
|
|
2243
2243
|
function ni(e) {
|
|
2244
|
-
return new Worker("" + new URL("assets/IFCWorker-
|
|
2244
|
+
return new Worker("" + new URL("assets/IFCWorker-F0BNIuiz.js", import.meta.url).href, { name: e?.name });
|
|
2245
2245
|
}
|
|
2246
2246
|
//#endregion
|
|
2247
2247
|
//#region src/viewer/workers/IFCWorkerClient.ts
|
|
@@ -2479,7 +2479,7 @@ var bi = new class {
|
|
|
2479
2479
|
}
|
|
2480
2480
|
return i;
|
|
2481
2481
|
}
|
|
2482
|
-
}(), xi = .5, Si = .04, Ci = .16, wi = Ci, Ti = xi * 2 - Ci * 2, Ei = xi - Si / 2, Di = xi - Ci / 2, Oi = xi - wi / 2, ki = .63, Ai = "#dfe6ec", ji = 260, Mi = 30, Ni = .3, Pi = 8, Fi = new W(0, 1, 0), Ii = 1e-8, Li = new
|
|
2482
|
+
}(), xi = .5, Si = .04, Ci = .16, wi = Ci, Ti = xi * 2 - Ci * 2, Ei = xi - Si / 2, Di = xi - Ci / 2, Oi = xi - wi / 2, ki = .63, Ai = "#dfe6ec", ji = 260, Mi = 30, Ni = .3, Pi = 8, Fi = new W(0, 1, 0), Ii = 1e-8, Li = new j(), Ri = new Ue(), zi = [
|
|
2483
2483
|
{
|
|
2484
2484
|
direction: [
|
|
2485
2485
|
0,
|
|
@@ -2740,7 +2740,7 @@ function Gi(e, t) {
|
|
|
2740
2740
|
r.font = i;
|
|
2741
2741
|
let a = r.measureText(e), o = a.actualBoundingBoxAscent || Mi * .8, s = a.actualBoundingBoxDescent || Mi * .2, c = Math.ceil(a.width + 36), l = Math.ceil(o + s + 20);
|
|
2742
2742
|
n.width = c, n.height = l, r.clearRect(0, 0, c, l), r.font = i, r.fillStyle = t, r.textAlign = "center", r.textBaseline = "alphabetic", r.fillText(e, c / 2, 10 + o);
|
|
2743
|
-
let u = new
|
|
2743
|
+
let u = new re(n);
|
|
2744
2744
|
return u.colorSpace = ze, u.generateMipmaps = !1, u.magFilter = R, u.minFilter = R, u.anisotropy = Pi, u.needsUpdate = !0, {
|
|
2745
2745
|
aspect: c / l,
|
|
2746
2746
|
texture: u
|
|
@@ -2841,7 +2841,7 @@ function $i({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
|
2841
2841
|
return e.addEventListener("controlstart", r), () => {
|
|
2842
2842
|
e.removeEventListener("controlstart", r);
|
|
2843
2843
|
};
|
|
2844
|
-
}, [t, n]),
|
|
2844
|
+
}, [t, n]), D(() => {
|
|
2845
2845
|
if (!e) return;
|
|
2846
2846
|
let r = t.current;
|
|
2847
2847
|
if (!r) return;
|
|
@@ -2892,8 +2892,8 @@ var ea = /* @__PURE__ */ (() => {
|
|
|
2892
2892
|
0,
|
|
2893
2893
|
0,
|
|
2894
2894
|
2
|
|
2895
|
-
]), n = new
|
|
2896
|
-
return n.setAttribute("position", new
|
|
2895
|
+
]), n = new ne();
|
|
2896
|
+
return n.setAttribute("position", new M(e, 3)), n.setAttribute("uv", new M(t, 2)), n;
|
|
2897
2897
|
})(), ta = class e {
|
|
2898
2898
|
static get fullscreenGeometry() {
|
|
2899
2899
|
return ea;
|
|
@@ -2937,7 +2937,7 @@ var ea = /* @__PURE__ */ (() => {
|
|
|
2937
2937
|
getDepthTexture() {
|
|
2938
2938
|
return null;
|
|
2939
2939
|
}
|
|
2940
|
-
setDepthTexture(e, t =
|
|
2940
|
+
setDepthTexture(e, t = A) {}
|
|
2941
2941
|
render(e, t, n, r, i) {
|
|
2942
2942
|
throw Error("Render method not implemented!");
|
|
2943
2943
|
}
|
|
@@ -2979,7 +2979,7 @@ var ea = /* @__PURE__ */ (() => {
|
|
|
2979
2979
|
depthTest: !1,
|
|
2980
2980
|
fragmentShader: ra,
|
|
2981
2981
|
vertexShader: ia
|
|
2982
|
-
}), this.depthFunc =
|
|
2982
|
+
}), this.depthFunc = k;
|
|
2983
2983
|
}
|
|
2984
2984
|
get inputBuffer() {
|
|
2985
2985
|
return this.uniforms.inputBuffer.value;
|
|
@@ -3052,7 +3052,7 @@ var ea = /* @__PURE__ */ (() => {
|
|
|
3052
3052
|
initialize(e, t, n) {
|
|
3053
3053
|
n !== void 0 && (this.renderTarget.texture.type = n, n === Xe ? e !== null && e.outputColorSpace === ze && (this.renderTarget.texture.colorSpace = ze) : this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH = "1");
|
|
3054
3054
|
}
|
|
3055
|
-
}, sa = /* @__PURE__ */ new
|
|
3055
|
+
}, sa = /* @__PURE__ */ new N(), ca = class extends ta {
|
|
3056
3056
|
constructor(e = !0, t = !0, n = !1) {
|
|
3057
3057
|
super("ClearPass", null, null), this.needsSwap = !1, this.color = e, this.depth = t, this.stencil = n, this.overrideClearColor = null, this.overrideClearAlpha = -1;
|
|
3058
3058
|
}
|
|
@@ -3298,7 +3298,7 @@ var ea = /* @__PURE__ */ (() => {
|
|
|
3298
3298
|
case le:
|
|
3299
3299
|
t = this.materialsFlatShadedDoubleSide;
|
|
3300
3300
|
break;
|
|
3301
|
-
case
|
|
3301
|
+
case ee:
|
|
3302
3302
|
t = this.materialsFlatShadedBackSide;
|
|
3303
3303
|
break;
|
|
3304
3304
|
default:
|
|
@@ -3309,7 +3309,7 @@ var ea = /* @__PURE__ */ (() => {
|
|
|
3309
3309
|
case le:
|
|
3310
3310
|
t = this.materialsDoubleSide;
|
|
3311
3311
|
break;
|
|
3312
|
-
case
|
|
3312
|
+
case ee:
|
|
3313
3313
|
t = this.materialsBackSide;
|
|
3314
3314
|
break;
|
|
3315
3315
|
default:
|
|
@@ -3341,7 +3341,7 @@ var ea = /* @__PURE__ */ (() => {
|
|
|
3341
3341
|
for (let n of t) n.uniforms = Object.assign({}, e.uniforms), n.side = fe;
|
|
3342
3342
|
t[2].skinning = !0, this.materialsBackSide = t.map((t) => {
|
|
3343
3343
|
let n = this.cloneMaterial(t);
|
|
3344
|
-
return n.uniforms = Object.assign({}, e.uniforms), n.side =
|
|
3344
|
+
return n.uniforms = Object.assign({}, e.uniforms), n.side = ee, n;
|
|
3345
3345
|
}), this.materialsDoubleSide = t.map((t) => {
|
|
3346
3346
|
let n = this.cloneMaterial(t);
|
|
3347
3347
|
return n.uniforms = Object.assign({}, e.uniforms), n.side = le, n;
|
|
@@ -3350,7 +3350,7 @@ var ea = /* @__PURE__ */ (() => {
|
|
|
3350
3350
|
return n.uniforms = Object.assign({}, e.uniforms), n.flatShading = !0, n;
|
|
3351
3351
|
}), this.materialsFlatShadedBackSide = t.map((t) => {
|
|
3352
3352
|
let n = this.cloneMaterial(t);
|
|
3353
|
-
return n.uniforms = Object.assign({}, e.uniforms), n.flatShading = !0, n.side =
|
|
3353
|
+
return n.uniforms = Object.assign({}, e.uniforms), n.flatShading = !0, n.side = ee, n;
|
|
3354
3354
|
}), this.materialsFlatShadedDoubleSide = t.map((t) => {
|
|
3355
3355
|
let n = this.cloneMaterial(t);
|
|
3356
3356
|
return n.uniforms = Object.assign({}, e.uniforms), n.flatShading = !0, n.side = le, n;
|
|
@@ -3635,7 +3635,7 @@ var ea = /* @__PURE__ */ (() => {
|
|
|
3635
3635
|
setChanged() {
|
|
3636
3636
|
this.dispatchEvent({ type: "change" });
|
|
3637
3637
|
}
|
|
3638
|
-
setDepthTexture(e, t =
|
|
3638
|
+
setDepthTexture(e, t = A) {}
|
|
3639
3639
|
update(e, t, n) {}
|
|
3640
3640
|
setSize(e, t) {}
|
|
3641
3641
|
initialize(e, t, n) {}
|
|
@@ -3879,7 +3879,7 @@ var ja = "#include <common>\n#include <packing>\nuniform vec2 cameraNearFar;\n#d
|
|
|
3879
3879
|
set depthPacking(e) {
|
|
3880
3880
|
this.defines.DEPTH_PACKING = e.toFixed(0), this.needsUpdate = !0;
|
|
3881
3881
|
}
|
|
3882
|
-
setDepthBuffer(e, t =
|
|
3882
|
+
setDepthBuffer(e, t = A) {
|
|
3883
3883
|
this.depthBuffer = e, this.depthPacking = t;
|
|
3884
3884
|
}
|
|
3885
3885
|
set noiseTexture(e) {
|
|
@@ -4077,7 +4077,7 @@ var ja = "#include <common>\n#include <packing>\nuniform vec2 cameraNearFar;\n#d
|
|
|
4077
4077
|
set depthPacking(e) {
|
|
4078
4078
|
this.defines.DEPTH_PACKING = e.toFixed(0), this.needsUpdate = !0;
|
|
4079
4079
|
}
|
|
4080
|
-
setDepthBuffer(e, t =
|
|
4080
|
+
setDepthBuffer(e, t = A) {
|
|
4081
4081
|
this.depthBuffer = e, this.depthPacking = t;
|
|
4082
4082
|
}
|
|
4083
4083
|
set normalBuffer(e) {
|
|
@@ -4114,7 +4114,7 @@ var ja = "#include <common>\n#include <packing>\nuniform vec2 cameraNearFar;\n#d
|
|
|
4114
4114
|
getResolution() {
|
|
4115
4115
|
return this.resolution;
|
|
4116
4116
|
}
|
|
4117
|
-
setDepthTexture(e, t =
|
|
4117
|
+
setDepthTexture(e, t = A) {
|
|
4118
4118
|
this.fullscreenMaterial.depthBuffer = e, this.fullscreenMaterial.depthPacking = t;
|
|
4119
4119
|
}
|
|
4120
4120
|
render(e, t, n, r, i) {
|
|
@@ -4129,7 +4129,7 @@ var ja = "#include <common>\n#include <packing>\nuniform vec2 cameraNearFar;\n#d
|
|
|
4129
4129
|
if (!(r.getExtension("EXT_color_buffer_float") || r.getExtension("EXT_color_buffer_half_float"))) throw Error("Rendering to float texture is not supported.");
|
|
4130
4130
|
}
|
|
4131
4131
|
}, Ra = "uniform lowp sampler2D aoBuffer;uniform float luminanceInfluence;uniform float intensity;\n#if defined(DEPTH_AWARE_UPSAMPLING) && defined(NORMAL_DEPTH)\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D normalDepthBuffer;\n#else\nuniform mediump sampler2D normalDepthBuffer;\n#endif\n#endif\n#ifdef COLORIZE\nuniform vec3 color;\n#endif\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,const in float depth,out vec4 outputColor){float aoLinear=texture2D(aoBuffer,uv).r;\n#if defined(DEPTH_AWARE_UPSAMPLING) && defined(NORMAL_DEPTH) && __VERSION__ == 300\nvec4 normalDepth[4];normalDepth[0]=textureOffset(normalDepthBuffer,uv,ivec2(0,0));normalDepth[1]=textureOffset(normalDepthBuffer,uv,ivec2(0,1));normalDepth[2]=textureOffset(normalDepthBuffer,uv,ivec2(1,0));normalDepth[3]=textureOffset(normalDepthBuffer,uv,ivec2(1,1));float dot01=dot(normalDepth[0].rgb,normalDepth[1].rgb);float dot02=dot(normalDepth[0].rgb,normalDepth[2].rgb);float dot03=dot(normalDepth[0].rgb,normalDepth[3].rgb);float minDot=min(dot01,min(dot02,dot03));float s=step(THRESHOLD,minDot);float smallestDistance=1.0;int index;for(int i=0;i<4;++i){float distance=abs(depth-normalDepth[i].a);if(distance<smallestDistance){smallestDistance=distance;index=i;}}ivec2 offsets[4];offsets[0]=ivec2(0,0);offsets[1]=ivec2(0,1);offsets[2]=ivec2(1,0);offsets[3]=ivec2(1,1);ivec2 coord=ivec2(uv*vec2(textureSize(aoBuffer,0)))+offsets[index];float aoNearest=texelFetch(aoBuffer,coord,0).r;float ao=mix(aoNearest,aoLinear,s);\n#else\nfloat ao=aoLinear;\n#endif\nfloat l=luminance(inputColor.rgb);ao=mix(ao,0.0,l*luminanceInfluence);ao=clamp(ao*intensity,0.0,1.0);\n#ifdef COLORIZE\noutputColor=vec4(1.0-ao*(1.0-color),inputColor.a);\n#else\noutputColor=vec4(vec3(1.0-ao),inputColor.a);\n#endif\n}", za = 64, Ba = class extends Sa {
|
|
4132
|
-
constructor(e, t, { blendFunction: n = J.MULTIPLY, samples: r = 9, rings: i = 7, normalDepthBuffer: a = null, depthAwareUpsampling: o = !0, worldDistanceThreshold: s, worldDistanceFalloff: c, worldProximityThreshold: l, worldProximityFalloff: u, distanceThreshold: d = .97, distanceFalloff: f = .03, rangeThreshold: p = 5e-4, rangeFalloff: m = .001, minRadiusScale: h = .1, luminanceInfluence: g = .7, radius: _ = .1825, intensity: v = 1, bias: y = .025, fade: b = .01, color: x = null, resolutionScale: S = 1, width: C = ya.AUTO_SIZE, height: w = ya.AUTO_SIZE, resolutionX:
|
|
4132
|
+
constructor(e, t, { blendFunction: n = J.MULTIPLY, samples: r = 9, rings: i = 7, normalDepthBuffer: a = null, depthAwareUpsampling: o = !0, worldDistanceThreshold: s, worldDistanceFalloff: c, worldProximityThreshold: l, worldProximityFalloff: u, distanceThreshold: d = .97, distanceFalloff: f = .03, rangeThreshold: p = 5e-4, rangeFalloff: m = .001, minRadiusScale: h = .1, luminanceInfluence: g = .7, radius: _ = .1825, intensity: v = 1, bias: y = .025, fade: b = .01, color: x = null, resolutionScale: S = 1, width: C = ya.AUTO_SIZE, height: w = ya.AUTO_SIZE, resolutionX: T = C, resolutionY: E = w } = {}) {
|
|
4133
4133
|
super("SSAOEffect", Ra, {
|
|
4134
4134
|
blendFunction: n,
|
|
4135
4135
|
attributes: ma.DEPTH,
|
|
@@ -4143,15 +4143,15 @@ var ja = "#include <common>\n#include <packing>\nuniform vec2 cameraNearFar;\n#d
|
|
|
4143
4143
|
["scale", new H(0)]
|
|
4144
4144
|
])
|
|
4145
4145
|
}), this.renderTarget = new $e(1, 1, { depthBuffer: !1 }), this.renderTarget.texture.name = "AO.Target", this.uniforms.get("aoBuffer").value = this.renderTarget.texture;
|
|
4146
|
-
let
|
|
4147
|
-
|
|
4146
|
+
let D = this.resolution = new ya(this, T, E, S);
|
|
4147
|
+
D.addEventListener("change", (e) => this.setSize(D.baseWidth, D.baseHeight)), this.camera = e, this.depthDownsamplingPass = new La({
|
|
4148
4148
|
normalBuffer: t,
|
|
4149
4149
|
resolutionScale: S
|
|
4150
4150
|
}), this.depthDownsamplingPass.enabled = a === null, this.ssaoPass = new Ca(new Na(e));
|
|
4151
|
-
let
|
|
4152
|
-
|
|
4153
|
-
let
|
|
4154
|
-
|
|
4151
|
+
let O = new Ta(za, za, Ne);
|
|
4152
|
+
O.wrapS = O.wrapT = Re;
|
|
4153
|
+
let k = this.ssaoMaterial;
|
|
4154
|
+
k.normalBuffer = t, k.noiseTexture = O, k.minRadiusScale = h, k.samples = r, k.radius = _, k.rings = i, k.fade = b, k.bias = y, k.distanceThreshold = d, k.distanceFalloff = f, k.proximityThreshold = p, k.proximityFalloff = m, s !== void 0 && (k.worldDistanceThreshold = s), c !== void 0 && (k.worldDistanceFalloff = c), l !== void 0 && (k.worldProximityThreshold = l), u !== void 0 && (k.worldProximityFalloff = u), a !== null && (this.ssaoMaterial.normalDepthBuffer = a, this.defines.set("NORMAL_DEPTH", "1")), this.depthAwareUpsampling = o, this.color = x;
|
|
4155
4155
|
}
|
|
4156
4156
|
set mainCamera(e) {
|
|
4157
4157
|
this.camera = e, this.ssaoMaterial.copyCameraSettings(e);
|
|
@@ -4210,7 +4210,7 @@ var ja = "#include <common>\n#include <packing>\nuniform vec2 cameraNearFar;\n#d
|
|
|
4210
4210
|
}
|
|
4211
4211
|
set color(e) {
|
|
4212
4212
|
let t = this.uniforms, n = this.defines;
|
|
4213
|
-
e === null ? n.has("COLORIZE") && (n.delete("COLORIZE"), t.get("color").value = null, this.setChanged()) : n.has("COLORIZE") ? t.get("color").value.set(e) : (n.set("COLORIZE", "1"), t.get("color").value = new
|
|
4213
|
+
e === null ? n.has("COLORIZE") && (n.delete("COLORIZE"), t.get("color").value = null, this.setChanged()) : n.has("COLORIZE") ? t.get("color").value.set(e) : (n.set("COLORIZE", "1"), t.get("color").value = new N(e), this.setChanged());
|
|
4214
4214
|
}
|
|
4215
4215
|
get luminanceInfluence() {
|
|
4216
4216
|
return this.uniforms.get("luminanceInfluence").value;
|
|
@@ -4236,7 +4236,7 @@ var ja = "#include <common>\n#include <packing>\nuniform vec2 cameraNearFar;\n#d
|
|
|
4236
4236
|
setProximityCutoff(e, t) {
|
|
4237
4237
|
this.ssaoMaterial.proximityThreshold = e, this.ssaoMaterial.proximityFalloff = t;
|
|
4238
4238
|
}
|
|
4239
|
-
setDepthTexture(e, t =
|
|
4239
|
+
setDepthTexture(e, t = A) {
|
|
4240
4240
|
this.depthDownsamplingPass.setDepthTexture(e, t), this.ssaoMaterial.depthBuffer = e, this.ssaoMaterial.depthPacking = t;
|
|
4241
4241
|
}
|
|
4242
4242
|
update(e, t, n) {
|
|
@@ -4301,7 +4301,7 @@ var ja = "#include <common>\n#include <packing>\nuniform vec2 cameraNearFar;\n#d
|
|
|
4301
4301
|
set depthPacking(e) {
|
|
4302
4302
|
this.defines.DEPTH_PACKING = e.toFixed(0), this.needsUpdate = !0;
|
|
4303
4303
|
}
|
|
4304
|
-
setDepthBuffer(e, t =
|
|
4304
|
+
setDepthBuffer(e, t = A) {
|
|
4305
4305
|
this.depthBuffer = e, this.depthPacking = t;
|
|
4306
4306
|
}
|
|
4307
4307
|
setShaderData(e) {
|
|
@@ -4456,7 +4456,7 @@ var qa = class extends ta {
|
|
|
4456
4456
|
getDepthTexture() {
|
|
4457
4457
|
return this.fullscreenMaterial.depthBuffer;
|
|
4458
4458
|
}
|
|
4459
|
-
setDepthTexture(e, t =
|
|
4459
|
+
setDepthTexture(e, t = A) {
|
|
4460
4460
|
this.fullscreenMaterial.depthBuffer = e, this.fullscreenMaterial.depthPacking = t;
|
|
4461
4461
|
for (let n of this.effects) n.setDepthTexture(e, t);
|
|
4462
4462
|
}
|
|
@@ -4493,7 +4493,7 @@ var qa = class extends ta {
|
|
|
4493
4493
|
let c = this.renderPass;
|
|
4494
4494
|
c.ignoreBackground = !0, c.skipShadowMapUpdate = !0;
|
|
4495
4495
|
let l = c.getClearPass();
|
|
4496
|
-
l.overrideClearColor = new
|
|
4496
|
+
l.overrideClearColor = new N(7829503), l.overrideClearAlpha = 1, this.renderTarget = n, this.renderTarget === void 0 && (this.renderTarget = new $e(1, 1, {
|
|
4497
4497
|
minFilter: V,
|
|
4498
4498
|
magFilter: V
|
|
4499
4499
|
}), this.renderTarget.texture.name = "NormalPass.Target");
|
|
@@ -5048,17 +5048,17 @@ new function e(t) {
|
|
|
5048
5048
|
}(Math.random());
|
|
5049
5049
|
//#endregion
|
|
5050
5050
|
//#region node_modules/@react-three/postprocessing/node_modules/maath/dist/easing-3be59c6d.esm.js
|
|
5051
|
-
var oo = /* @__PURE__ */ new class extends
|
|
5051
|
+
var oo = /* @__PURE__ */ new class extends ne {
|
|
5052
5052
|
boundingSphere = new Ue();
|
|
5053
5053
|
constructor() {
|
|
5054
|
-
super(), this.setAttribute("position", new
|
|
5054
|
+
super(), this.setAttribute("position", new M(new Float32Array([
|
|
5055
5055
|
-1,
|
|
5056
5056
|
-1,
|
|
5057
5057
|
3,
|
|
5058
5058
|
-1,
|
|
5059
5059
|
-1,
|
|
5060
5060
|
3
|
|
5061
|
-
]), 2)), this.setAttribute("uv", new
|
|
5061
|
+
]), 2)), this.setAttribute("uv", new M(new Float32Array([
|
|
5062
5062
|
0,
|
|
5063
5063
|
0,
|
|
5064
5064
|
2,
|
|
@@ -5247,7 +5247,7 @@ var _o = class extends ta {
|
|
|
5247
5247
|
renderMode: 0,
|
|
5248
5248
|
biasOffset: 0,
|
|
5249
5249
|
biasMultiplier: 0,
|
|
5250
|
-
color: new
|
|
5250
|
+
color: new N(0, 0, 0),
|
|
5251
5251
|
gammaCorrection: !0,
|
|
5252
5252
|
depthBufferType: vo.Default,
|
|
5253
5253
|
screenSpaceRadius: !1,
|
|
@@ -5296,7 +5296,7 @@ var _o = class extends ta {
|
|
|
5296
5296
|
opacity: 1,
|
|
5297
5297
|
vertexShader: "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4(position, 1);\n }",
|
|
5298
5298
|
fragmentShader: "\n uniform sampler2D tDiffuse;\n uniform float frame;\n varying vec2 vUv;\n void main() {\n vec4 color = texture2D(tDiffuse, vUv);\n gl_FragColor = vec4(color.rgb, 1.0 / (frame + 1.0));\n }\n "
|
|
5299
|
-
})), this.bluenoise = new oe(mo, 128, 128), this.bluenoise.colorSpace = Ee, this.bluenoise.wrapS = Re, this.bluenoise.wrapT = Re, this.bluenoise.minFilter = V, this.bluenoise.magFilter = V, this.bluenoise.needsUpdate = !0, this.lastTime = 0, this.timeRollingAverage = .99, this.needsDepthTexture = !0, this.needsSwap = !0, this._r = new U(), this._c = new
|
|
5299
|
+
})), this.bluenoise = new oe(mo, 128, 128), this.bluenoise.colorSpace = Ee, this.bluenoise.wrapS = Re, this.bluenoise.wrapT = Re, this.bluenoise.minFilter = V, this.bluenoise.magFilter = V, this.bluenoise.needsUpdate = !0, this.lastTime = 0, this.timeRollingAverage = .99, this.needsDepthTexture = !0, this.needsSwap = !0, this._r = new U(), this._c = new N();
|
|
5300
5300
|
}
|
|
5301
5301
|
configureHalfResTargets() {
|
|
5302
5302
|
this.firstFrame(), this.configuration.halfRes ? (this.depthDownsampleTarget = new ho(this.width / 2, this.height / 2, 2), Me <= 161 && (this.depthDownsampleTarget.textures = this.depthDownsampleTarget.texture), this.depthDownsampleTarget.textures[0].format = Le, this.depthDownsampleTarget.textures[0].type = I, this.depthDownsampleTarget.textures[0].minFilter = V, this.depthDownsampleTarget.textures[0].magFilter = V, this.depthDownsampleTarget.textures[0].depthBuffer = !1, this.depthDownsampleTarget.textures[1].format = Ne, this.depthDownsampleTarget.textures[1].type = pe, this.depthDownsampleTarget.textures[1].minFilter = V, this.depthDownsampleTarget.textures[1].magFilter = V, this.depthDownsampleTarget.textures[1].depthBuffer = !1, this.depthDownsampleQuad = new co(new Ve(po))) : (this.depthDownsampleTarget &&= (this.depthDownsampleTarget.dispose(), null), this.depthDownsampleQuad &&= (this.depthDownsampleQuad.dispose(), null));
|
|
@@ -5330,10 +5330,10 @@ var _o = class extends ta {
|
|
|
5330
5330
|
}))) : (this.transparencyRenderTargetDWFalse &&= (this.transparencyRenderTargetDWFalse.dispose(), null), this.transparencyRenderTargetDWTrue &&= (this.transparencyRenderTargetDWTrue.dispose(), null), this.depthCopyPass &&= (this.depthCopyPass.dispose(), null));
|
|
5331
5331
|
}
|
|
5332
5332
|
renderTransparency(e) {
|
|
5333
|
-
let t = this.scene.background, n = e.getClearColor(new
|
|
5333
|
+
let t = this.scene.background, n = e.getClearColor(new N()), r = e.getClearAlpha(), i = /* @__PURE__ */ new Map(), a = e.autoClearDepth;
|
|
5334
5334
|
this.scene.traverse((e) => {
|
|
5335
5335
|
i.set(e, e.visible);
|
|
5336
|
-
}), this.scene.background = null, e.autoClearDepth = !1, e.setClearColor(new
|
|
5336
|
+
}), this.scene.background = null, e.autoClearDepth = !1, e.setClearColor(new N(0, 0, 0), 0), this.depthCopyPass.material.uniforms.depthTexture.value = this.depthTexture, this.depthCopyPass.material.uniforms.reverseDepthBuffer.value = this.configuration.depthBufferType === vo.Reverse, e.setRenderTarget(this.transparencyRenderTargetDWFalse), this.scene.traverse((e) => {
|
|
5337
5337
|
e.material && (e.visible = i.get(e) && (e.material.transparent && !e.material.depthWrite && !e.userData.treatAsOpaque || !!e.userData.cannotReceiveAO));
|
|
5338
5338
|
}), e.clear(!0, !0, !0), this.depthCopyPass.render(e), e.render(this.scene, this.camera), e.setRenderTarget(this.transparencyRenderTargetDWTrue), this.scene.traverse((e) => {
|
|
5339
5339
|
e.material && (e.visible = i.get(e) && e.material.transparent && e.material.depthWrite && !e.userData.treatAsOpaque);
|
|
@@ -5421,7 +5421,7 @@ var _o = class extends ta {
|
|
|
5421
5421
|
Log: 2,
|
|
5422
5422
|
Reverse: 3
|
|
5423
5423
|
}, yo = /* @__PURE__ */ f(null), bo = (e) => (e.getAttributes() & 2) == 2, xo = /* @__PURE__ */ m(/* @__PURE__ */ p(({ children: e, camera: t, scene: n, resolutionScale: r, enabled: i = !0, renderPriority: a = 1, autoClear: o = !0, depthBuffer: s, enableNormalPass: c, stencilBuffer: l, multisampling: u = 8, frameBufferType: d = pe }, f) => {
|
|
5424
|
-
let { gl: p, scene: m, camera: h, size: g } =
|
|
5424
|
+
let { gl: p, scene: m, camera: h, size: g } = O(), S = n || m, C = t || h, [w, T, E] = b(() => {
|
|
5425
5425
|
let e = new pa(p, {
|
|
5426
5426
|
depthBuffer: s,
|
|
5427
5427
|
stencilBuffer: l,
|
|
@@ -5449,15 +5449,15 @@ var _o = class extends ta {
|
|
|
5449
5449
|
c,
|
|
5450
5450
|
r
|
|
5451
5451
|
]);
|
|
5452
|
-
_(() => w?.setSize(g.width, g.height), [w, g]),
|
|
5452
|
+
_(() => w?.setSize(g.width, g.height), [w, g]), D((e, t) => {
|
|
5453
5453
|
if (i) {
|
|
5454
5454
|
let e = p.autoClear;
|
|
5455
5455
|
p.autoClear = o, l && !o && p.clearStencil(), w.render(t), p.autoClear = e;
|
|
5456
5456
|
}
|
|
5457
5457
|
}, i ? a : 0);
|
|
5458
|
-
let
|
|
5458
|
+
let k = x(null);
|
|
5459
5459
|
y(() => {
|
|
5460
|
-
let e = [], t =
|
|
5460
|
+
let e = [], t = k.current.__r3f;
|
|
5461
5461
|
if (t && w) {
|
|
5462
5462
|
let n = t.children;
|
|
5463
5463
|
for (let t = 0; t < n.length; t++) {
|
|
@@ -5473,43 +5473,43 @@ var _o = class extends ta {
|
|
|
5473
5473
|
} else r instanceof ta && e.push(r);
|
|
5474
5474
|
}
|
|
5475
5475
|
for (let t of e) w?.addPass(t);
|
|
5476
|
-
|
|
5476
|
+
T && (T.enabled = !0), E && (E.enabled = !0);
|
|
5477
5477
|
}
|
|
5478
5478
|
return () => {
|
|
5479
5479
|
for (let t of e) w?.removePass(t);
|
|
5480
|
-
|
|
5480
|
+
T && (T.enabled = !1), E && (E.enabled = !1);
|
|
5481
5481
|
};
|
|
5482
5482
|
}, [
|
|
5483
5483
|
w,
|
|
5484
5484
|
e,
|
|
5485
5485
|
C,
|
|
5486
|
-
|
|
5487
|
-
|
|
5486
|
+
T,
|
|
5487
|
+
E
|
|
5488
5488
|
]), _(() => {
|
|
5489
5489
|
let e = p.toneMapping;
|
|
5490
5490
|
return p.toneMapping = De, () => {
|
|
5491
5491
|
p.toneMapping = e;
|
|
5492
5492
|
};
|
|
5493
5493
|
}, [p]);
|
|
5494
|
-
let
|
|
5494
|
+
let ee = b(() => ({
|
|
5495
5495
|
composer: w,
|
|
5496
|
-
normalPass:
|
|
5497
|
-
downSamplingPass:
|
|
5496
|
+
normalPass: T,
|
|
5497
|
+
downSamplingPass: E,
|
|
5498
5498
|
resolutionScale: r,
|
|
5499
5499
|
camera: C,
|
|
5500
5500
|
scene: S
|
|
5501
5501
|
}), [
|
|
5502
5502
|
w,
|
|
5503
|
-
ee,
|
|
5504
5503
|
T,
|
|
5504
|
+
E,
|
|
5505
5505
|
r,
|
|
5506
5506
|
C,
|
|
5507
5507
|
S
|
|
5508
5508
|
]);
|
|
5509
5509
|
return v(f, () => w, [w]), /* @__PURE__ */ G(yo.Provider, {
|
|
5510
|
-
value:
|
|
5510
|
+
value: ee,
|
|
5511
5511
|
children: /* @__PURE__ */ G("group", {
|
|
5512
|
-
ref:
|
|
5512
|
+
ref: k,
|
|
5513
5513
|
children: e
|
|
5514
5514
|
})
|
|
5515
5515
|
});
|
|
@@ -5517,9 +5517,9 @@ var _o = class extends ta {
|
|
|
5517
5517
|
let a = Co.get(e);
|
|
5518
5518
|
if (!a) {
|
|
5519
5519
|
let t = `@react-three/postprocessing/${e.name}-${So++}`;
|
|
5520
|
-
|
|
5520
|
+
E({ [t]: e }), Co.set(e, a = t);
|
|
5521
5521
|
}
|
|
5522
|
-
let o =
|
|
5522
|
+
let o = O((e) => e.camera), s = u.useMemo(() => [...t?.args ?? [], ...i.args ?? [{
|
|
5523
5523
|
...t,
|
|
5524
5524
|
...i
|
|
5525
5525
|
}]], [JSON.stringify(i)]);
|
|
@@ -5560,9 +5560,9 @@ var _o = class extends ta {
|
|
|
5560
5560
|
dispose: null
|
|
5561
5561
|
});
|
|
5562
5562
|
}), Eo = /* @__PURE__ */ p(({ halfRes: e, screenSpaceRadius: t, quality: n, depthAwareUpsampling: r = !0, aoRadius: i = 5, aoSamples: a = 16, denoiseSamples: o = 4, denoiseRadius: s = 12, distanceFalloff: c = 1, intensity: l = 1, color: u, renderMode: d = 0 }, f) => {
|
|
5563
|
-
let { camera: p, scene: m } =
|
|
5563
|
+
let { camera: p, scene: m } = O(), h = b(() => new _o(m, p), [p, m]);
|
|
5564
5564
|
return y(() => {
|
|
5565
|
-
|
|
5565
|
+
T(h.configuration, {
|
|
5566
5566
|
color: u,
|
|
5567
5567
|
aoRadius: i,
|
|
5568
5568
|
distanceFalloff: c,
|
|
@@ -5598,8 +5598,8 @@ var _o = class extends ta {
|
|
|
5598
5598
|
//#endregion
|
|
5599
5599
|
//#region src/viewer/ViewerComponents/Postproduction.tsx
|
|
5600
5600
|
function Do({ pipelineRef: e }) {
|
|
5601
|
-
let t =
|
|
5602
|
-
return
|
|
5601
|
+
let t = O((e) => e.camera), n = O((e) => e.gl), r = O((e) => e.scene);
|
|
5602
|
+
return D(() => {
|
|
5603
5603
|
let i = e.current;
|
|
5604
5604
|
if (i) {
|
|
5605
5605
|
i.render();
|
|
@@ -5667,7 +5667,7 @@ function Ao({ enabled: e }) {
|
|
|
5667
5667
|
});
|
|
5668
5668
|
}
|
|
5669
5669
|
function jo({ enabled: e }) {
|
|
5670
|
-
let t =
|
|
5670
|
+
let t = O((e) => e.camera), n = O((e) => e.gl), r = O((e) => e.invalidate), i = O((e) => e.scene), a = K((e) => e.postproductionPassType), o = K((e) => e.postproductionSaturation), s = K((e) => e.setPostproductionActivePassFilter), c = Oo(a), l = o !== 0, u = e && (c || l), d = x(null), [f, p] = S(null);
|
|
5671
5671
|
return _(() => {
|
|
5672
5672
|
u || s(null);
|
|
5673
5673
|
}, [u, s]), _(() => {
|
|
@@ -5769,7 +5769,7 @@ function Po(e, t, n = !1) {
|
|
|
5769
5769
|
}
|
|
5770
5770
|
}
|
|
5771
5771
|
function Fo({ active: e }) {
|
|
5772
|
-
let t =
|
|
5772
|
+
let t = O((e) => e.gl), n = O((e) => e.size), r = O((e) => e.viewport.dpr);
|
|
5773
5773
|
return _(() => {
|
|
5774
5774
|
if (!e) return;
|
|
5775
5775
|
let n = null, i = null, a = () => {
|
|
@@ -5802,7 +5802,7 @@ function Io({ active: e, onReady: t }) {
|
|
|
5802
5802
|
};
|
|
5803
5803
|
}, [
|
|
5804
5804
|
e,
|
|
5805
|
-
|
|
5805
|
+
O((e) => e.gl),
|
|
5806
5806
|
t
|
|
5807
5807
|
]), null;
|
|
5808
5808
|
}
|
|
@@ -5951,8 +5951,8 @@ function cs(e, t, n, r, i = Infinity, a, o) {
|
|
|
5951
5951
|
u = e.x - p, d = e.y - m, f = e.z - h;
|
|
5952
5952
|
let S = (n.x + s * p) * a, C = (n.y + s * m) * a, w = (n.z + s * h) * a;
|
|
5953
5953
|
n.x = (n.x - s * S) * l, n.y = (n.y - s * C) * l, n.z = (n.z - s * w) * l, o.x = u + (p + S) * l, o.y = d + (m + C) * l, o.z = f + (h + w) * l;
|
|
5954
|
-
let
|
|
5955
|
-
return
|
|
5954
|
+
let T = g - e.x, E = _ - e.y, D = v - e.z, O = o.x - g, k = o.y - _, ee = o.z - v;
|
|
5955
|
+
return T * O + E * k + D * ee > 0 && (o.x = g, o.y = _, o.z = v, n.x = (o.x - g) / a, n.y = (o.y - _) / a, n.z = (o.z - v) / a), o;
|
|
5956
5956
|
}
|
|
5957
5957
|
function ls(e, t) {
|
|
5958
5958
|
t.set(0, 0), e.forEach((e) => {
|
|
@@ -6710,7 +6710,7 @@ function zs(e) {
|
|
|
6710
6710
|
return !0;
|
|
6711
6711
|
}
|
|
6712
6712
|
function Bs(e) {
|
|
6713
|
-
let t =
|
|
6713
|
+
let t = O((e) => e.camera), n = O((e) => e.gl), r = O((e) => e.raycaster), i = x(null), a = x(null), o = x(new U()), s = h((e) => {
|
|
6714
6714
|
i.current = e;
|
|
6715
6715
|
}, []), c = h(() => {
|
|
6716
6716
|
let e = i.current;
|
|
@@ -6774,7 +6774,7 @@ function Ks(e) {
|
|
|
6774
6774
|
r.font = i;
|
|
6775
6775
|
let a = r.measureText(e), o = a.actualBoundingBoxAscent || Vs * .8, s = a.actualBoundingBoxDescent || Vs * .2, c = Math.max(1, Math.ceil(a.width + Hs * 2)), l = Math.max(1, Math.ceil(o + s + Us * 2));
|
|
6776
6776
|
n.width = Math.ceil(c * t), n.height = Math.ceil(l * t), r.scale(t, t), r.clearRect(0, 0, c, l), r.fillStyle = "rgba(255, 255, 255, 0.86)", r.strokeStyle = "rgba(29, 39, 51, 0.22)", r.lineWidth = 1, r.beginPath(), r.roundRect(.5, .5, c - 1, l - 1, 4), r.fill(), r.stroke(), r.font = i, r.fillStyle = "#111827", r.textAlign = "center", r.textBaseline = "middle", r.fillText(e, c / 2, l / 2);
|
|
6777
|
-
let u = new
|
|
6777
|
+
let u = new re(n);
|
|
6778
6778
|
return u.colorSpace = ze, u.generateMipmaps = !1, u.magFilter = R, u.minFilter = R, u.needsUpdate = !0, {
|
|
6779
6779
|
height: l,
|
|
6780
6780
|
texture: u,
|
|
@@ -6794,7 +6794,7 @@ var qs = class e {
|
|
|
6794
6794
|
boundingMaterial;
|
|
6795
6795
|
endpointGeometry;
|
|
6796
6796
|
endpointMaterial;
|
|
6797
|
-
lineGeometry = new
|
|
6797
|
+
lineGeometry = new ne();
|
|
6798
6798
|
lineMaterial;
|
|
6799
6799
|
ownerRoot;
|
|
6800
6800
|
endpointBaseScale;
|
|
@@ -6865,7 +6865,7 @@ var qs = class e {
|
|
|
6865
6865
|
return e.renderOrder = 5, e;
|
|
6866
6866
|
}
|
|
6867
6867
|
createBoundingBoxMesh() {
|
|
6868
|
-
let e = new B(new
|
|
6868
|
+
let e = new B(new te(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
|
|
6869
6869
|
return e.renderOrder = 3, e;
|
|
6870
6870
|
}
|
|
6871
6871
|
getTextContent() {
|
|
@@ -6884,7 +6884,7 @@ var qs = class e {
|
|
|
6884
6884
|
e.setXYZ(0, this.start.x, this.start.y, this.start.z), e.setXYZ(1, this.end.x, this.end.y, this.end.z), e.needsUpdate = !0, this.lineGeometry.computeBoundingSphere(), this.line.computeLineDistances(), this.endpointMeshes[0]?.position.copy(this.start), this.endpointMeshes[1]?.position.copy(this.end), this.endpointMeshes[0]?.lookAt(this.end), this.endpointMeshes[1]?.lookAt(this.start), this.labelSprite.position.copy(this.center), this.updateLabel(), this.updateBoundingBox();
|
|
6885
6885
|
}
|
|
6886
6886
|
updateBoundingBox() {
|
|
6887
|
-
this.boundingMesh && (this.boundingMesh.position.copy(this.center), this.boundingMesh.lookAt(this.end), this.boundingMesh.geometry.dispose(), this.boundingMesh.geometry = new
|
|
6887
|
+
this.boundingMesh && (this.boundingMesh.position.copy(this.center), this.boundingMesh.lookAt(this.end), this.boundingMesh.geometry.dispose(), this.boundingMesh.geometry = new te(1, 1, Math.max(this.length, .001)));
|
|
6888
6888
|
}
|
|
6889
6889
|
rescaleMesh(t, n, r) {
|
|
6890
6890
|
let i = Gs(n, t.position.distanceTo(n.position)) / Math.max(1, r) * 12 * e.scaleFactor;
|
|
@@ -6992,7 +6992,7 @@ var nc = class e {
|
|
|
6992
6992
|
this.setActive(!this.active);
|
|
6993
6993
|
}
|
|
6994
6994
|
setColor(e) {
|
|
6995
|
-
let t = e instanceof
|
|
6995
|
+
let t = e instanceof N ? e : new N(e);
|
|
6996
6996
|
this.endpointMaterial.color.copy(t), this.lineMaterial.color.copy(t), this.dimensions.forEach((e) => {
|
|
6997
6997
|
e.dimensionColor = t;
|
|
6998
6998
|
}), this.invalidate();
|
|
@@ -7235,7 +7235,7 @@ var nc = class e {
|
|
|
7235
7235
|
this.axis = this.axis === e ? null : e, this.shiftAxis = null, this.tabAxisOverride = !1;
|
|
7236
7236
|
}
|
|
7237
7237
|
static createEndpointGeometry(e = .1, t = .03) {
|
|
7238
|
-
let n = new
|
|
7238
|
+
let n = new ae(t, e);
|
|
7239
7239
|
return n.translate(0, -e / 2, 0), n.rotateX(-Math.PI / 2), n;
|
|
7240
7240
|
}
|
|
7241
7241
|
static createPreviewGeometry() {
|
|
@@ -7243,7 +7243,7 @@ var nc = class e {
|
|
|
7243
7243
|
}
|
|
7244
7244
|
};
|
|
7245
7245
|
function rc(e, t, n, r, i, a) {
|
|
7246
|
-
let o =
|
|
7246
|
+
let o = O((e) => e.camera), s = O((e) => e.gl), c = O((e) => e.scene), l = O((e) => e.size), u = Tt(), d = b(() => new nc({
|
|
7247
7247
|
camera: o,
|
|
7248
7248
|
cameraUtils: n,
|
|
7249
7249
|
controlRef: t,
|
|
@@ -7323,7 +7323,7 @@ function rc(e, t, n, r, i, a) {
|
|
|
7323
7323
|
c,
|
|
7324
7324
|
l.height,
|
|
7325
7325
|
u
|
|
7326
|
-
]), _(() => () => d.dispose(), [d]),
|
|
7326
|
+
]), _(() => () => d.dispose(), [d]), D(() => {
|
|
7327
7327
|
d.updateFrame();
|
|
7328
7328
|
}), b(() => ({
|
|
7329
7329
|
cancelDrawing: () => d.cancelDrawing(),
|
|
@@ -7359,7 +7359,7 @@ var ic = {
|
|
|
7359
7359
|
}, ac = "#ee2fe4", oc = .08, sc = .2, cc = .3, lc = 2, uc = {
|
|
7360
7360
|
x: 52,
|
|
7361
7361
|
y: -18
|
|
7362
|
-
}, dc = "Note", fc = "Comment", pc = 6, mc = new
|
|
7362
|
+
}, dc = "Note", fc = "Comment", pc = 6, mc = new j(), hc = new W(), gc = new W(), _c = new W(), vc = new W(), yc = new W(), bc = new W(), xc = new U();
|
|
7363
7363
|
function Sc(e) {
|
|
7364
7364
|
return e instanceof W ? e.clone() : Array.isArray(e) ? new W(e[0], e[1], e[2]) : new W(e.x, e.y, e.z);
|
|
7365
7365
|
}
|
|
@@ -7409,7 +7409,7 @@ function jc(e) {
|
|
|
7409
7409
|
function Mc(e, t, n, r) {
|
|
7410
7410
|
let { right: i, up: a } = kc(n), o = e.clone().add(t).multiplyScalar(.5), s = t.clone().sub(e).multiplyScalar(.5), c = Math.max(Math.abs(s.dot(i)), .15), l = Math.max(Math.abs(s.dot(a)), .15), u = Math.max(c, l) * oc, d = c + u, f = l + u, p = o.clone().addScaledVector(i, -d).addScaledVector(a, -f), m = o.clone().addScaledVector(i, d).addScaledVector(a, -f), h = o.clone().addScaledVector(i, d).addScaledVector(a, f), g = o.clone().addScaledVector(i, -d).addScaledVector(a, f), _ = cc, v = jc(d * 2), y = jc(f * 2), b = [];
|
|
7411
7411
|
Ac(b, p, m, a.clone().negate(), v, _), Ac(b, m, h, i, y, _), Ac(b, h, g, a, v, _), Ac(b, g, p, i.clone().negate(), y, _), b.push(b[0].clone());
|
|
7412
|
-
let x = new Je(new
|
|
7412
|
+
let x = new Je(new ie(b, !0, "catmullrom", .35), Math.max(b.length * 2, 80), sc, 6, !0);
|
|
7413
7413
|
x.computeBoundingSphere();
|
|
7414
7414
|
let S = new B(x, new Se({
|
|
7415
7415
|
color: Ec(r),
|
|
@@ -7510,7 +7510,7 @@ function Fc({ note: e, onContentChange: t, onOffsetChange: n }) {
|
|
|
7510
7510
|
outline: "none",
|
|
7511
7511
|
padding: 0,
|
|
7512
7512
|
width: "100%"
|
|
7513
|
-
},
|
|
7513
|
+
}, T = {
|
|
7514
7514
|
...w,
|
|
7515
7515
|
color: "#92400e",
|
|
7516
7516
|
fontSize: 11,
|
|
@@ -7518,13 +7518,13 @@ function Fc({ note: e, onContentChange: t, onOffsetChange: n }) {
|
|
|
7518
7518
|
letterSpacing: .4,
|
|
7519
7519
|
marginBottom: 4,
|
|
7520
7520
|
textTransform: "uppercase"
|
|
7521
|
-
},
|
|
7521
|
+
}, E = {
|
|
7522
7522
|
...w,
|
|
7523
7523
|
color: "#374151",
|
|
7524
7524
|
fontSize: 12,
|
|
7525
7525
|
lineHeight: 1.35,
|
|
7526
7526
|
resize: "none"
|
|
7527
|
-
},
|
|
7527
|
+
}, D = h(() => {
|
|
7528
7528
|
let e = r.current;
|
|
7529
7529
|
if (!e) return;
|
|
7530
7530
|
let t = e.getBoundingClientRect(), n = Math.max(t.width || e.offsetWidth || 1, 1), i = Math.max(t.height || e.offsetHeight || 1, 1);
|
|
@@ -7540,28 +7540,28 @@ function Fc({ note: e, onContentChange: t, onOffsetChange: n }) {
|
|
|
7540
7540
|
e.id,
|
|
7541
7541
|
n
|
|
7542
7542
|
]);
|
|
7543
|
-
let
|
|
7543
|
+
let O = h((e) => {
|
|
7544
7544
|
let t = s.current;
|
|
7545
7545
|
t && (e.preventDefault(), o.current(i.current, {
|
|
7546
7546
|
x: t.startOffset.x + e.clientX - t.startX,
|
|
7547
7547
|
y: t.startOffset.y + e.clientY - t.startY
|
|
7548
7548
|
}));
|
|
7549
|
-
}, []),
|
|
7550
|
-
s.current && (s.current = null, document.removeEventListener("pointermove",
|
|
7551
|
-
}, [
|
|
7549
|
+
}, []), k = h(() => {
|
|
7550
|
+
s.current && (s.current = null, document.removeEventListener("pointermove", O), document.removeEventListener("pointerup", k), document.removeEventListener("pointercancel", k));
|
|
7551
|
+
}, [O]), ee = h((e) => {
|
|
7552
7552
|
e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLButtonElement || (e.preventDefault(), e.stopPropagation(), e.nativeEvent.stopImmediatePropagation?.(), e.currentTarget.setPointerCapture?.(e.pointerId), s.current = {
|
|
7553
7553
|
startOffset: { ...a.current },
|
|
7554
7554
|
startX: e.clientX,
|
|
7555
7555
|
startY: e.clientY
|
|
7556
|
-
}, document.addEventListener("pointermove",
|
|
7557
|
-
}, [
|
|
7556
|
+
}, document.addEventListener("pointermove", O), document.addEventListener("pointerup", k), document.addEventListener("pointercancel", k));
|
|
7557
|
+
}, [O, k]);
|
|
7558
7558
|
return y(() => {
|
|
7559
7559
|
let e = r.current;
|
|
7560
7560
|
if (!e) return;
|
|
7561
|
-
|
|
7561
|
+
D();
|
|
7562
7562
|
let t = 0, n = requestAnimationFrame(() => {
|
|
7563
|
-
|
|
7564
|
-
}), i = typeof ResizeObserver < "u" ? new ResizeObserver(
|
|
7563
|
+
D(), t = requestAnimationFrame(D);
|
|
7564
|
+
}), i = typeof ResizeObserver < "u" ? new ResizeObserver(D) : null;
|
|
7565
7565
|
return i?.observe(e), () => {
|
|
7566
7566
|
cancelAnimationFrame(n), t && cancelAnimationFrame(t), i?.disconnect();
|
|
7567
7567
|
};
|
|
@@ -7569,10 +7569,10 @@ function Fc({ note: e, onContentChange: t, onOffsetChange: n }) {
|
|
|
7569
7569
|
e.settings?.render,
|
|
7570
7570
|
e.text,
|
|
7571
7571
|
e.title,
|
|
7572
|
-
|
|
7572
|
+
D
|
|
7573
7573
|
]), _(() => () => {
|
|
7574
|
-
document.removeEventListener("pointermove",
|
|
7575
|
-
}, [
|
|
7574
|
+
document.removeEventListener("pointermove", O), document.removeEventListener("pointerup", k), document.removeEventListener("pointercancel", k);
|
|
7575
|
+
}, [O, k]), /* @__PURE__ */ G(ot, {
|
|
7576
7576
|
center: !1,
|
|
7577
7577
|
position: e.point.toArray(),
|
|
7578
7578
|
transform: !1,
|
|
@@ -7589,18 +7589,18 @@ function Fc({ note: e, onContentChange: t, onOffsetChange: n }) {
|
|
|
7589
7589
|
/* @__PURE__ */ nt("div", {
|
|
7590
7590
|
ref: r,
|
|
7591
7591
|
style: v,
|
|
7592
|
-
onPointerDownCapture:
|
|
7592
|
+
onPointerDownCapture: ee,
|
|
7593
7593
|
children: [/* @__PURE__ */ G("div", {
|
|
7594
7594
|
style: b,
|
|
7595
|
-
onPointerDownCapture:
|
|
7595
|
+
onPointerDownCapture: ee,
|
|
7596
7596
|
children: /* @__PURE__ */ G("div", { style: C })
|
|
7597
7597
|
}), e.settings?.render ? /* @__PURE__ */ G(Nc, { content: e.settings.render }) : /* @__PURE__ */ nt(tt, { children: [/* @__PURE__ */ G("input", {
|
|
7598
|
-
style:
|
|
7598
|
+
style: T,
|
|
7599
7599
|
value: e.title,
|
|
7600
7600
|
onChange: (n) => t(e.id, n.target.value, e.text)
|
|
7601
7601
|
}), /* @__PURE__ */ G("textarea", {
|
|
7602
7602
|
rows: 2,
|
|
7603
|
-
style:
|
|
7603
|
+
style: E,
|
|
7604
7604
|
value: e.text,
|
|
7605
7605
|
onChange: (n) => t(e.id, e.title, n.target.value)
|
|
7606
7606
|
})] })]
|
|
@@ -7829,7 +7829,7 @@ var Ic = class {
|
|
|
7829
7829
|
};
|
|
7830
7830
|
};
|
|
7831
7831
|
function Lc(e, t) {
|
|
7832
|
-
let n =
|
|
7832
|
+
let n = O((e) => e.camera), r = O((e) => e.gl), i = O((e) => e.scene), a = t?.is2DView, o = t?.onChange, [s, c] = S(0), l = h(() => {
|
|
7833
7833
|
c((e) => e + 1), o?.();
|
|
7834
7834
|
}, [o]), u = b(() => new Ic({
|
|
7835
7835
|
camera: n,
|
|
@@ -7936,7 +7936,7 @@ function Zc(e, t) {
|
|
|
7936
7936
|
return n.size;
|
|
7937
7937
|
}
|
|
7938
7938
|
function Qc(e, t) {
|
|
7939
|
-
return new
|
|
7939
|
+
return new M(t ? new Uint32Array(e) : new Uint8Array(e), 1);
|
|
7940
7940
|
}
|
|
7941
7941
|
function $c(e) {
|
|
7942
7942
|
let t = e;
|
|
@@ -7953,8 +7953,8 @@ var tl = class {
|
|
|
7953
7953
|
capMesh;
|
|
7954
7954
|
context;
|
|
7955
7955
|
root = new L();
|
|
7956
|
-
box = new
|
|
7957
|
-
meshBox = new
|
|
7956
|
+
box = new j();
|
|
7957
|
+
meshBox = new j();
|
|
7958
7958
|
inverseMatrix = new z();
|
|
7959
7959
|
localPlane = new je();
|
|
7960
7960
|
tempLine = new he();
|
|
@@ -7972,7 +7972,7 @@ var tl = class {
|
|
|
7972
7972
|
colorIndex: [0],
|
|
7973
7973
|
ids: [0],
|
|
7974
7974
|
modelID: [0]
|
|
7975
|
-
}, this.updateBaseMaterialColor(), e.getUseWebGPU() ? this.setupWebGpuCapMaterial() : this.setupCapMaterialShader(), this.capMesh = new B(new
|
|
7975
|
+
}, this.updateBaseMaterialColor(), e.getUseWebGPU() ? this.setupWebGpuCapMaterial() : this.setupCapMaterialShader(), this.capMesh = new B(new ne(), this.capMaterial), this.capMesh.frustumCulled = !1, this.capMesh.renderOrder = Uc, this.root.add(this.capMesh), this.root.visible = this.active, this.root.name = "clipping-caps", this.root.renderOrder = Uc, this.context.getScene().add(this.root), this.context.caps.push(this), this.update();
|
|
7976
7976
|
}
|
|
7977
7977
|
createCapMaterial() {
|
|
7978
7978
|
return this.context.getUseWebGPU() ? new r({
|
|
@@ -8038,7 +8038,7 @@ var tl = class {
|
|
|
8038
8038
|
$c(this.capMesh.geometry), this.capMesh.geometry.dispose(), this.capMesh.geometry = e, this.updateVisualState(), this.capMesh.visible = (e.getAttribute("position")?.count ?? 0) >= 3;
|
|
8039
8039
|
}
|
|
8040
8040
|
setupWebGpuCapMaterial() {
|
|
8041
|
-
let e = s(c("colorIndex", "uint")), t = s(c("ids", "uint")), n = s(c("modelID", "uint")), r = i(new
|
|
8041
|
+
let e = s(c("colorIndex", "uint")), t = s(c("ids", "uint")), n = s(c("modelID", "uint")), r = i(new N(this.context.getPreselectionColor())), a = i(new N(this.context.getSelectionColor())), o = i(-1), u = i(-1), d = i(new N(this.context.getCapsColor())), f = e.greaterThan(.5), p = t.equal(o).and(n.equal(u)).and(l(e.sub(1)).greaterThan(.5));
|
|
8042
8042
|
this.capMaterial.colorNode = p.select(r, f.select(a, d)), this.capMaterial.userData.shader = { uniforms: {
|
|
8043
8043
|
capPreSelectionColor: r,
|
|
8044
8044
|
capSelectionColor: a,
|
|
@@ -8049,7 +8049,7 @@ var tl = class {
|
|
|
8049
8049
|
}
|
|
8050
8050
|
setupCapMaterialShader() {
|
|
8051
8051
|
this.capMaterial.onBeforeCompile = (e) => {
|
|
8052
|
-
e.uniforms.capPreSelectionColor = { value: new
|
|
8052
|
+
e.uniforms.capPreSelectionColor = { value: new N(this.context.getPreselectionColor()) }, e.uniforms.capSelectionColor = { value: new N(this.context.getSelectionColor()) }, e.uniforms.capPreSelectionId = { value: -1 }, e.uniforms.capPreSelectionModelID = { value: -1 }, e.vertexShader = e.vertexShader.replace("#include <common>", "\n #include <common>\n attribute float colorIndex;\n attribute uint ids;\n attribute uint modelID;\n flat varying float vCapColorIndex;\n flat varying float vCapId;\n flat varying float vCapModelID;\n "), e.vertexShader = e.vertexShader.replace("#include <begin_vertex>", "\n #include <begin_vertex>\n vCapColorIndex = colorIndex;\n vCapId = float(ids);\n vCapModelID = float(modelID);\n "), e.fragmentShader = e.fragmentShader.replace("#include <common>", "\n #include <common>\n uniform vec3 capPreSelectionColor;\n uniform vec3 capSelectionColor;\n uniform float capPreSelectionId;\n uniform float capPreSelectionModelID;\n flat varying float vCapColorIndex;\n flat varying float vCapId;\n flat varying float vCapModelID;\n "), e.fragmentShader = e.fragmentShader.replace("#include <map_fragment>", "\n #include <map_fragment>\n if(\n capPreSelectionId == vCapId &&\n capPreSelectionModelID == vCapModelID &&\n abs(vCapColorIndex - 1.0) > 0.5\n ){\n diffuseColor.rgb = capPreSelectionColor;\n }\n else if(vCapColorIndex > 0.5){\n diffuseColor.rgb = capSelectionColor;\n }\n "), this.capShader = e, this.capShaders.add(this.capShader), this.capMaterial.userData.shaders = this.capShaders, this.updateColorUniforms(), this.updatePreselectionUniforms();
|
|
8053
8053
|
};
|
|
8054
8054
|
}
|
|
8055
8055
|
updateBaseMaterialColor() {
|
|
@@ -8058,7 +8058,7 @@ var tl = class {
|
|
|
8058
8058
|
updateColorUniform(e, t) {
|
|
8059
8059
|
this.capShaders.forEach((n) => {
|
|
8060
8060
|
let r = n.uniforms[e];
|
|
8061
|
-
r && (r.value instanceof
|
|
8061
|
+
r && (r.value instanceof N ? r.value.set(t) : r.value = new N(t));
|
|
8062
8062
|
});
|
|
8063
8063
|
}
|
|
8064
8064
|
updateColorUniforms() {
|
|
@@ -8083,7 +8083,7 @@ var tl = class {
|
|
|
8083
8083
|
this.capMaterial.clippingPlanes = t, this.capMaterial.needsUpdate = !0;
|
|
8084
8084
|
}
|
|
8085
8085
|
createCapGeometry() {
|
|
8086
|
-
let e = new
|
|
8086
|
+
let e = new ne(), t = this.getModelWorldBox();
|
|
8087
8087
|
if (!t) return e;
|
|
8088
8088
|
let n = t.getSize(new W()).length();
|
|
8089
8089
|
this.tolerance = Math.max(Rc, n * zc), this.closeGapTolerance = Math.max(this.tolerance * Vc, n * Bc);
|
|
@@ -8275,14 +8275,14 @@ var tl = class {
|
|
|
8275
8275
|
}
|
|
8276
8276
|
}, nl = 1024, rl = 1, il = "__bimatterCameraMotionHidden";
|
|
8277
8277
|
function al(e) {
|
|
8278
|
-
let t = new
|
|
8278
|
+
let t = new M(new Float32Array(e * 3), 3, !1);
|
|
8279
8279
|
return t.setUsage(ue), t;
|
|
8280
8280
|
}
|
|
8281
8281
|
function ol(e) {
|
|
8282
8282
|
return Math.max(1, Math.ceil((e.geometry.index?.count ?? 0) / 3));
|
|
8283
8283
|
}
|
|
8284
8284
|
function sl(e, t) {
|
|
8285
|
-
let n = new
|
|
8285
|
+
let n = new ne(), r = Math.ceil(Math.min(Math.max(nl, ol(t) * .05), 32768));
|
|
8286
8286
|
n.setAttribute("position", al(r)), n.setDrawRange(0, 0);
|
|
8287
8287
|
let i = new ve(n, e);
|
|
8288
8288
|
return i.frustumCulled = !1, i.renderOrder = rl, i.visible = !1, i;
|
|
@@ -8450,7 +8450,7 @@ function Sl(e, t, n, r) {
|
|
|
8450
8450
|
}
|
|
8451
8451
|
function Cl({ camera: e, controls: t, invalidate: n, model: r, plane: i, size: a, viewNormal: o }) {
|
|
8452
8452
|
if (!r) return null;
|
|
8453
|
-
let s = new
|
|
8453
|
+
let s = new j().setFromObject(r);
|
|
8454
8454
|
if (s.isEmpty()) return null;
|
|
8455
8455
|
let c = i.clone().normalize(), l = (o && o.lengthSq() > 0 ? o.clone().normalize() : c.normal.clone()).negate();
|
|
8456
8456
|
l.lengthSq() === 0 && l.set(0, 0, -1), l.normalize();
|
|
@@ -8478,7 +8478,7 @@ function El(e) {
|
|
|
8478
8478
|
return e instanceof W ? e.clone() : Array.isArray(e) ? new W(e[0], e[1], e[2]) : new W(e.x, e.y, e.z);
|
|
8479
8479
|
}
|
|
8480
8480
|
function Dl(e, t, n) {
|
|
8481
|
-
let r = new
|
|
8481
|
+
let r = new j();
|
|
8482
8482
|
e && r.setFromObject(e);
|
|
8483
8483
|
let i = (e) => {
|
|
8484
8484
|
let r = Math.abs(n.x), i = Math.abs(n.y), a = Math.abs(n.z);
|
|
@@ -8665,36 +8665,36 @@ function ql({ clippingPlanes: e, modelRoot: t, plane: n, scene: r, useWebGPU: i,
|
|
|
8665
8665
|
};
|
|
8666
8666
|
}
|
|
8667
8667
|
function Jl({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInvalidate: r, registerNotesApi: i, sourceModel: a, useLocalClippingVisuals: o = !1, useWebGPU: s, viewNormal: c }) {
|
|
8668
|
-
let l =
|
|
8668
|
+
let l = O((e) => e.camera), u = O((e) => e.gl), d = O((e) => e.invalidate), f = O((e) => e.raycaster), p = O((e) => e.scene), m = O((e) => e.size), g = x(null), v = Tt(), y = K((e) => e.selected), C = K((e) => e.dimensionsActive), w = K((e) => e.preselectionColor), T = K((e) => e.selectionColor), E = b(() => jl(a, {
|
|
8669
8669
|
ignoreCameraMotionVisibility: !0,
|
|
8670
8670
|
skipLineSegments: !0
|
|
8671
|
-
}), [a]),
|
|
8671
|
+
}), [a]), k = x(E.root), ee = Bs(k), [A, j] = S([]), te = x([]), M = x(null), [ne, re] = S(() => e()), ie = x(""), N = b(() => ne.map((e) => jl(e, {
|
|
8672
8672
|
ignoreCameraMotionVisibility: !0,
|
|
8673
8673
|
rootInWorldSpace: !0
|
|
8674
|
-
}).root), [
|
|
8675
|
-
|
|
8676
|
-
...
|
|
8677
|
-
...
|
|
8674
|
+
}).root), [ne]), ae = x(N), oe = b(() => [
|
|
8675
|
+
E.root,
|
|
8676
|
+
...N,
|
|
8677
|
+
...A
|
|
8678
8678
|
], [
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8679
|
+
A,
|
|
8680
|
+
N,
|
|
8681
|
+
E.root
|
|
8682
8682
|
]), se = b(() => [
|
|
8683
|
-
|
|
8684
|
-
...
|
|
8685
|
-
...
|
|
8683
|
+
E.root,
|
|
8684
|
+
...N,
|
|
8685
|
+
...A
|
|
8686
8686
|
], [
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
]), ce = h(() => Bl([...
|
|
8691
|
-
let r = n.projectPoint(e, ue.current), i =
|
|
8687
|
+
A,
|
|
8688
|
+
N,
|
|
8689
|
+
E.root
|
|
8690
|
+
]), ce = h(() => Bl([...N, ...A]), [A, N]), le = h(() => Bl([...N, ...A]), [A, N]), ue = x(new W()), P = h((e, t) => {
|
|
8691
|
+
let r = n.projectPoint(e, ue.current), i = te.current.flatMap((e) => (e.getObject().updateMatrixWorld(!0), e.getSnapPoints(r, t))), a = Hl([...N, ...A], r, t);
|
|
8692
8692
|
return [...i, ...a];
|
|
8693
8693
|
}, [
|
|
8694
|
-
|
|
8694
|
+
A,
|
|
8695
8695
|
n,
|
|
8696
|
-
|
|
8697
|
-
]), de = h((e, t) => n.projectPoint(e, t), [n]), F = rc(
|
|
8696
|
+
N
|
|
8697
|
+
]), de = h((e, t) => n.projectPoint(e, t), [n]), F = rc(k, g, ee, ce, P, {
|
|
8698
8698
|
disableSelectionInteraction: !1,
|
|
8699
8699
|
getPrioritySnapObjects: le,
|
|
8700
8700
|
onChange: d,
|
|
@@ -8702,16 +8702,16 @@ function Jl({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInv
|
|
|
8702
8702
|
previewMarkerOffset: b(() => n.normal.clone().multiplyScalar(.12), [n]),
|
|
8703
8703
|
previewMarkerScaleFactor: 2.2,
|
|
8704
8704
|
projectPoint: de
|
|
8705
|
-
}), I = Lc(
|
|
8705
|
+
}), I = Lc(k, {
|
|
8706
8706
|
is2DView: !0,
|
|
8707
8707
|
onChange: d
|
|
8708
8708
|
}), fe = x(!1), L = x(!1);
|
|
8709
|
-
_(() => (
|
|
8710
|
-
|
|
8711
|
-
}), [
|
|
8709
|
+
_(() => (k.current = E.root, () => {
|
|
8710
|
+
k.current === E.root && (k.current = null);
|
|
8711
|
+
}), [E.root]), _(() => (ee.setClippingSource({
|
|
8712
8712
|
getActive: () => !0,
|
|
8713
8713
|
getPlanes: () => [n]
|
|
8714
|
-
}), () =>
|
|
8714
|
+
}), () => ee.setClippingSource(null)), [ee, n]), _(() => {
|
|
8715
8715
|
F.setActive(C), d();
|
|
8716
8716
|
}, [
|
|
8717
8717
|
C,
|
|
@@ -8744,49 +8744,49 @@ function Jl({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInv
|
|
|
8744
8744
|
d,
|
|
8745
8745
|
I
|
|
8746
8746
|
]), _(() => {
|
|
8747
|
-
|
|
8748
|
-
}, [
|
|
8747
|
+
ae.current = N;
|
|
8748
|
+
}, [N]), _(() => {
|
|
8749
8749
|
if (!o) return;
|
|
8750
8750
|
let e = ql({
|
|
8751
|
-
clippingPlanes: Wl([
|
|
8752
|
-
modelRoot:
|
|
8751
|
+
clippingPlanes: Wl([E.root, ...ae.current], n),
|
|
8752
|
+
modelRoot: E.root,
|
|
8753
8753
|
plane: n,
|
|
8754
8754
|
scene: p,
|
|
8755
8755
|
useWebGPU: s,
|
|
8756
8756
|
viewerStore: v
|
|
8757
8757
|
});
|
|
8758
|
-
|
|
8758
|
+
M.current = e;
|
|
8759
8759
|
let t = new ul(e, n);
|
|
8760
8760
|
t.create(), t.update();
|
|
8761
8761
|
let r = new tl(e, n);
|
|
8762
|
-
return r.setPreselection(null),
|
|
8763
|
-
|
|
8762
|
+
return r.setPreselection(null), te.current = [r], j(e.caps.map((e) => e.getObject()).filter((e) => e.visible)), d(), () => {
|
|
8763
|
+
te.current = [], M.current === e && (M.current = null), j([]), r.dispose(), t.dispose(), d();
|
|
8764
8764
|
};
|
|
8765
8765
|
}, [
|
|
8766
8766
|
d,
|
|
8767
8767
|
n,
|
|
8768
8768
|
p,
|
|
8769
|
-
|
|
8769
|
+
E.root,
|
|
8770
8770
|
o,
|
|
8771
8771
|
s,
|
|
8772
8772
|
v
|
|
8773
8773
|
]), _(() => {
|
|
8774
8774
|
if (!o) return;
|
|
8775
|
-
let e =
|
|
8776
|
-
e && Kl(e, n, Wl([
|
|
8775
|
+
let e = M.current;
|
|
8776
|
+
e && Kl(e, n, Wl([E.root, ...N], n)) && d();
|
|
8777
8777
|
}, [
|
|
8778
8778
|
d,
|
|
8779
8779
|
n,
|
|
8780
|
-
|
|
8781
|
-
|
|
8780
|
+
N,
|
|
8781
|
+
E.root,
|
|
8782
8782
|
o
|
|
8783
8783
|
]), _(() => {
|
|
8784
|
-
|
|
8784
|
+
te.current.forEach((e) => e.updateVisualState()), d();
|
|
8785
8785
|
}, [
|
|
8786
8786
|
d,
|
|
8787
8787
|
w,
|
|
8788
8788
|
y,
|
|
8789
|
-
|
|
8789
|
+
T
|
|
8790
8790
|
]);
|
|
8791
8791
|
let pe = h((e) => {
|
|
8792
8792
|
let t = Pl(e);
|
|
@@ -8849,12 +8849,12 @@ function Jl({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInv
|
|
|
8849
8849
|
f,
|
|
8850
8850
|
se
|
|
8851
8851
|
]);
|
|
8852
|
-
return
|
|
8852
|
+
return D(() => {
|
|
8853
8853
|
let t = e(), n = Fl(t);
|
|
8854
|
-
|
|
8854
|
+
ie.current !== n && (ie.current = n, re(t));
|
|
8855
8855
|
}), _(() => {
|
|
8856
8856
|
d();
|
|
8857
|
-
}, [
|
|
8857
|
+
}, [ne, d]), _(() => {
|
|
8858
8858
|
let e = u, t = e.localClippingEnabled, r = e.clippingPlanes;
|
|
8859
8859
|
return e.localClippingEnabled = !0, e.clippingPlanes = [n], () => {
|
|
8860
8860
|
e.localClippingEnabled = t, e.clippingPlanes = r;
|
|
@@ -8864,7 +8864,7 @@ function Jl({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInv
|
|
|
8864
8864
|
camera: l,
|
|
8865
8865
|
controls: g.current,
|
|
8866
8866
|
invalidate: d,
|
|
8867
|
-
model:
|
|
8867
|
+
model: E.root,
|
|
8868
8868
|
plane: n,
|
|
8869
8869
|
size: m,
|
|
8870
8870
|
viewNormal: c
|
|
@@ -8873,20 +8873,20 @@ function Jl({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInv
|
|
|
8873
8873
|
l,
|
|
8874
8874
|
d,
|
|
8875
8875
|
n,
|
|
8876
|
-
|
|
8876
|
+
E.root,
|
|
8877
8877
|
m,
|
|
8878
8878
|
c
|
|
8879
8879
|
]), /* @__PURE__ */ nt(tt, { children: [
|
|
8880
8880
|
/* @__PURE__ */ G("ambientLight", { intensity: 1.2 }),
|
|
8881
8881
|
/* @__PURE__ */ G("primitive", {
|
|
8882
|
-
object:
|
|
8882
|
+
object: E.root,
|
|
8883
8883
|
onClick: ge,
|
|
8884
8884
|
onPointerDown: pe,
|
|
8885
8885
|
onPointerLeave: _e,
|
|
8886
8886
|
onPointerMove: ve,
|
|
8887
8887
|
onPointerUp: he
|
|
8888
8888
|
}),
|
|
8889
|
-
|
|
8889
|
+
N.map((e) => /* @__PURE__ */ G("primitive", {
|
|
8890
8890
|
object: e,
|
|
8891
8891
|
onClick: ge,
|
|
8892
8892
|
onPointerDown: pe,
|
|
@@ -8894,7 +8894,7 @@ function Jl({ getExtraObjects: e, onPreselectionChange: t, plane: n, registerInv
|
|
|
8894
8894
|
onPointerMove: ve,
|
|
8895
8895
|
onPointerUp: he
|
|
8896
8896
|
}, e.uuid)),
|
|
8897
|
-
|
|
8897
|
+
A.map((e) => /* @__PURE__ */ G("primitive", {
|
|
8898
8898
|
object: e,
|
|
8899
8899
|
onClick: ge,
|
|
8900
8900
|
onPointerDown: pe,
|
|
@@ -8976,7 +8976,7 @@ function ru(e, t, n, r) {
|
|
|
8976
8976
|
o.font = s;
|
|
8977
8977
|
let u = o.measureText(t), d = u.actualBoundingBoxAscent || r * .8, f = u.actualBoundingBoxDescent || r * .2, p = Math.max(1, Math.ceil(u.width + c * 2)), m = Math.max(1, Math.ceil(d + f + l * 2));
|
|
8978
8978
|
a.width = Math.ceil(p * i), a.height = Math.ceil(m * i), o.scale(i, i), o.clearRect(0, 0, p, m), o.font = s, o.fillStyle = n, o.textAlign = "left", o.textBaseline = "alphabetic", o.fillText(t, c, l + d);
|
|
8979
|
-
let h = new
|
|
8979
|
+
let h = new re(a);
|
|
8980
8980
|
return h.colorSpace = ze, h.generateMipmaps = !1, h.magFilter = R, h.minFilter = R, h.needsUpdate = !0, {
|
|
8981
8981
|
disposeTimer: null,
|
|
8982
8982
|
height: m,
|
|
@@ -9037,8 +9037,8 @@ function du(e) {
|
|
|
9037
9037
|
return t < .55 && n >= .5 || t >= .55 && n >= .75 ? "#000000" : "#ffffff";
|
|
9038
9038
|
}
|
|
9039
9039
|
function fu(e) {
|
|
9040
|
-
let t =
|
|
9041
|
-
return b(() => e || (t instanceof
|
|
9040
|
+
let t = O((e) => e.scene.background);
|
|
9041
|
+
return b(() => e || (t instanceof N ? du(t) : Zl), [t, e]);
|
|
9042
9042
|
}
|
|
9043
9043
|
function pu({ axis: e, grid: t, endSide: n, startSide: r }) {
|
|
9044
9044
|
return Object.entries(e).flatMap(([e, i]) => {
|
|
@@ -9122,7 +9122,7 @@ function yu(e, t, n) {
|
|
|
9122
9122
|
}), r;
|
|
9123
9123
|
}
|
|
9124
9124
|
function bu({ color: e, fontSize: t, position: n, text: r }) {
|
|
9125
|
-
let { camera: i, size: a } =
|
|
9125
|
+
let { camera: i, size: a } = O(), o = x(null), s = x({
|
|
9126
9126
|
projectionScale: 0,
|
|
9127
9127
|
viewportHeight: 0
|
|
9128
9128
|
}), c = au(r, e, t), l = h((e, t) => {
|
|
@@ -9137,7 +9137,7 @@ function bu({ color: e, fontSize: t, position: n, text: r }) {
|
|
|
9137
9137
|
i,
|
|
9138
9138
|
a.height,
|
|
9139
9139
|
l
|
|
9140
|
-
]),
|
|
9140
|
+
]), D(({ camera: e, size: t }) => {
|
|
9141
9141
|
l(e, t.height);
|
|
9142
9142
|
}), /* @__PURE__ */ G("sprite", {
|
|
9143
9143
|
ref: o,
|
|
@@ -9155,7 +9155,7 @@ function bu({ color: e, fontSize: t, position: n, text: r }) {
|
|
|
9155
9155
|
});
|
|
9156
9156
|
}
|
|
9157
9157
|
function xu({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset: i, line: a, showBottom: o, showLeft: s, showRight: c, showTop: l }) {
|
|
9158
|
-
let u = b(() => new
|
|
9158
|
+
let u = b(() => new ne().setFromPoints(a.points), [a.points]), d = gu({
|
|
9159
9159
|
cameraPosition: e,
|
|
9160
9160
|
floorY: n,
|
|
9161
9161
|
line: a,
|
|
@@ -9184,7 +9184,7 @@ function xu({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
|
|
|
9184
9184
|
});
|
|
9185
9185
|
}
|
|
9186
9186
|
function Su({ color: e, floorY: t, fontSize: n = Xl, grids: r, labelOffset: i = Ql, showBottom: a = !0, showLeft: o = !0, showRight: s = !0, showTop: c = !0, visible: l = !0 }) {
|
|
9187
|
-
let u =
|
|
9187
|
+
let u = O((e) => e.camera), d = x(null), f = x(new W()), [p, m] = S(() => new W()), h = fu(e), g = b(() => r ? mu({
|
|
9188
9188
|
flattenToFloor: t !== void 0,
|
|
9189
9189
|
grids: r,
|
|
9190
9190
|
showBottom: a,
|
|
@@ -9204,7 +9204,7 @@ function Su({ color: e, floorY: t, fontSize: n = Xl, grids: r, labelOffset: i =
|
|
|
9204
9204
|
i,
|
|
9205
9205
|
g
|
|
9206
9206
|
]);
|
|
9207
|
-
return
|
|
9207
|
+
return D(() => {
|
|
9208
9208
|
let e = d.current;
|
|
9209
9209
|
if (!e) return;
|
|
9210
9210
|
let t = f.current.copy(u.position);
|
|
@@ -9242,7 +9242,7 @@ function Su({ color: e, floorY: t, fontSize: n = Xl, grids: r, labelOffset: i =
|
|
|
9242
9242
|
var Cu = 2;
|
|
9243
9243
|
function wu() {
|
|
9244
9244
|
let e = new oe(new Uint8Array(256 * 4), 256, 1, Ne, Xe);
|
|
9245
|
-
return e.magFilter = V, e.minFilter = V, e.generateMipmaps = !1, e.needsUpdate = !0, Eu(e, 1, new
|
|
9245
|
+
return e.magFilter = V, e.minFilter = V, e.generateMipmaps = !1, e.needsUpdate = !0, Eu(e, 1, new N(mt)), e;
|
|
9246
9246
|
}
|
|
9247
9247
|
function Tu(e) {
|
|
9248
9248
|
return `${e.r.toFixed(6)}:${e.g.toFixed(6)}:${e.b.toFixed(6)}`;
|
|
@@ -9257,7 +9257,7 @@ function Du(e) {
|
|
|
9257
9257
|
function Ou(e) {
|
|
9258
9258
|
let t = e.mesh.geometry.attributes.ids;
|
|
9259
9259
|
if (!t) return null;
|
|
9260
|
-
let n = new
|
|
9260
|
+
let n = new M(e.mesh.userData.useUint32ColorIndex === !0 ? new Uint32Array(t.count) : new Uint8Array(t.count), 1);
|
|
9261
9261
|
return e.mesh.geometry.setAttribute("colorIndex", n), n;
|
|
9262
9262
|
}
|
|
9263
9263
|
function ku(e, t) {
|
|
@@ -9320,7 +9320,7 @@ function Ru(e) {
|
|
|
9320
9320
|
_(() => {
|
|
9321
9321
|
s.current = t;
|
|
9322
9322
|
}, [t]), _(() => () => r.dispose(), [r]), _(() => {
|
|
9323
|
-
Eu(r, 1, new
|
|
9323
|
+
Eu(r, 1, new N(n));
|
|
9324
9324
|
}, [r, n]);
|
|
9325
9325
|
let d = h((e, t) => s.current[e]?.has(t) ? 1 : o.current.get(e)?.get(t) ?? 0, []), f = h((t, n) => {
|
|
9326
9326
|
let r = e.buildIndex();
|
|
@@ -9328,7 +9328,7 @@ function Ru(e) {
|
|
|
9328
9328
|
Pu(r.elementIndex.get(e), t, e, d(t, e), l.current, u.current);
|
|
9329
9329
|
});
|
|
9330
9330
|
}, [e, d]), p = h((e) => {
|
|
9331
|
-
let t = new
|
|
9331
|
+
let t = new N(e), n = Tu(t), o = i.current.get(n);
|
|
9332
9332
|
if (o !== void 0) return o;
|
|
9333
9333
|
let s = a.current;
|
|
9334
9334
|
if (s >= 256) throw Error("Element color palette is full. Maximum colors: 255.");
|
|
@@ -9405,20 +9405,52 @@ function Ru(e) {
|
|
|
9405
9405
|
};
|
|
9406
9406
|
}
|
|
9407
9407
|
//#endregion
|
|
9408
|
+
//#region src/viewer/utils/GeometryUtils/progressiveDrawRange.ts
|
|
9409
|
+
var zu = 10;
|
|
9410
|
+
function Bu(e) {
|
|
9411
|
+
return e.index?.count ?? e.getAttribute("position")?.count ?? 0;
|
|
9412
|
+
}
|
|
9413
|
+
function Vu(e, t) {
|
|
9414
|
+
if (e <= 3) return e;
|
|
9415
|
+
let n = Math.min(1, Math.max(0, t / zu)), r = Math.ceil(e * n), i = Math.ceil(r / 3) * 3;
|
|
9416
|
+
return Math.min(e, Math.max(3, i));
|
|
9417
|
+
}
|
|
9418
|
+
function Hu(e) {
|
|
9419
|
+
let t = Bu(e);
|
|
9420
|
+
t && e.setDrawRange(0, Vu(t, 1));
|
|
9421
|
+
}
|
|
9422
|
+
function Uu(e, t) {
|
|
9423
|
+
let n = Bu(e);
|
|
9424
|
+
if (!n) return t?.(), () => {};
|
|
9425
|
+
if (Hu(e), typeof requestAnimationFrame != "function") return e.setDrawRange(0, n), t?.(), () => {};
|
|
9426
|
+
let r = null, i = 1, a = !1, o = () => {
|
|
9427
|
+
if (!a) {
|
|
9428
|
+
if (i += 1, e.setDrawRange(0, Vu(n, i)), i >= zu) {
|
|
9429
|
+
e.setDrawRange(0, n), t?.();
|
|
9430
|
+
return;
|
|
9431
|
+
}
|
|
9432
|
+
r = requestAnimationFrame(o);
|
|
9433
|
+
}
|
|
9434
|
+
};
|
|
9435
|
+
return r = requestAnimationFrame(o), () => {
|
|
9436
|
+
a = !0, r !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(r);
|
|
9437
|
+
};
|
|
9438
|
+
}
|
|
9439
|
+
//#endregion
|
|
9408
9440
|
//#region src/viewer/SelectableMesh.tsx
|
|
9409
9441
|
B.prototype.raycast = pt;
|
|
9410
|
-
var
|
|
9411
|
-
function
|
|
9442
|
+
var Wu = 1 / 1.5;
|
|
9443
|
+
function Gu(e, t) {
|
|
9412
9444
|
let n = e.userData, r = n.shaders ?? /* @__PURE__ */ new Set();
|
|
9413
9445
|
r.add(t), n.shader = t, n.shaders = r;
|
|
9414
9446
|
}
|
|
9415
|
-
function
|
|
9447
|
+
function Ku(e) {
|
|
9416
9448
|
let t = e.userData;
|
|
9417
9449
|
return t.shaders ? Array.from(t.shaders) : t.shader ? [t.shader] : [];
|
|
9418
9450
|
}
|
|
9419
|
-
function
|
|
9420
|
-
let a = new
|
|
9421
|
-
n === "performance" && a.multiplyScalar(
|
|
9451
|
+
function qu({ colorPaletteTexture: e, material: t, materialMode: n = "quality", preselectionColor: r, useDoubleSideMaterial: i = !1 }) {
|
|
9452
|
+
let a = new N(t.r, t.g, t.b);
|
|
9453
|
+
n === "performance" && a.multiplyScalar(Wu);
|
|
9422
9454
|
let o = {
|
|
9423
9455
|
color: a.clone(),
|
|
9424
9456
|
transparent: !!(t.opacity && t.opacity != 1),
|
|
@@ -9431,7 +9463,7 @@ function Hu({ colorPaletteTexture: e, material: t, materialMode: n = "quality",
|
|
|
9431
9463
|
...l.defaultAttributeValues,
|
|
9432
9464
|
colorIndex: [0]
|
|
9433
9465
|
}, c.onBeforeCompile = (t) => {
|
|
9434
|
-
let n = new
|
|
9466
|
+
let n = new N(r);
|
|
9435
9467
|
t.uniforms.baseColor = { value: a.clone() }, t.uniforms.preSelectionColor = { value: n }, t.uniforms.preSelectionId = { value: -1 }, t.uniforms.elementColorPalette = { value: e }, t.vertexShader = t.vertexShader.replace("#include <common>", "\n #include <common>\n attribute float colorIndex;\n attribute uint ids;\n flat varying float vColorIndex;\n flat varying float vPreselectId;\n "), t.vertexShader = t.vertexShader.replace("#include <begin_vertex>", "\n #include <begin_vertex>\n vColorIndex = colorIndex;\n vPreselectId = float(ids);\n "), t.fragmentShader = t.fragmentShader.replace("#include <common>", "\n #include <common>\n uniform vec3 baseColor;\n uniform vec3 preSelectionColor;\n uniform sampler2D elementColorPalette;\n flat varying float vPreselectId;\n flat varying float vColorIndex;\n uniform float preSelectionId;\n "), t.fragmentShader = t.fragmentShader.replace("vec4 diffuseColor = vec4( diffuse, opacity );", `
|
|
9436
9468
|
vec4 diffuseColor;
|
|
9437
9469
|
if(preSelectionId == vPreselectId && abs(vColorIndex - 1.0) > 0.5){
|
|
@@ -9447,19 +9479,19 @@ function Hu({ colorPaletteTexture: e, material: t, materialMode: n = "quality",
|
|
|
9447
9479
|
else{
|
|
9448
9480
|
diffuseColor = vec4(baseColor, opacity);
|
|
9449
9481
|
}
|
|
9450
|
-
`),
|
|
9482
|
+
`), Gu(c, t);
|
|
9451
9483
|
}, c;
|
|
9452
9484
|
}
|
|
9453
|
-
function
|
|
9454
|
-
|
|
9485
|
+
function Ju(e, t) {
|
|
9486
|
+
Ku(e).forEach((e) => {
|
|
9455
9487
|
let n = e.uniforms.preSelectionColor;
|
|
9456
|
-
n && (n.value instanceof
|
|
9488
|
+
n && (n.value instanceof N ? n.value.set(t) : n.value = new N(t));
|
|
9457
9489
|
});
|
|
9458
9490
|
}
|
|
9459
|
-
var
|
|
9491
|
+
var Yu = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n = "quality", data: r, isIfcSpace: i = !1, meshMatrix: a, onReady: o, readyKey: s, useDoubleSideMaterial: c = !1 }) {
|
|
9460
9492
|
let l = x(null), u = x(o), d = K((e) => e.preselectionColor), f = x(d);
|
|
9461
9493
|
u.current = o, f.current = d;
|
|
9462
|
-
let p = b(() =>
|
|
9494
|
+
let p = b(() => qu({
|
|
9463
9495
|
colorPaletteTexture: e,
|
|
9464
9496
|
material: t,
|
|
9465
9497
|
materialMode: n,
|
|
@@ -9472,14 +9504,24 @@ var Wu = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9472
9504
|
c
|
|
9473
9505
|
]);
|
|
9474
9506
|
return _(() => {
|
|
9475
|
-
|
|
9476
|
-
}, [p, d]),
|
|
9507
|
+
Ju(p, d);
|
|
9508
|
+
}, [p, d]), y(() => {
|
|
9509
|
+
!r.boundsTree || !l.current || Hu(l.current.geometry);
|
|
9510
|
+
}, [r.boundsTree]), _(() => {
|
|
9477
9511
|
if (!l.current) return;
|
|
9478
|
-
let e = l.current.geometry, t = new dt(e, { indirect: !0 });
|
|
9479
|
-
|
|
9480
|
-
|
|
9512
|
+
let e = l.current.geometry, t = r.boundsTree ? dt.deserialize(r.boundsTree, e, { setIndex: !1 }) : new dt(e, { indirect: !0 });
|
|
9513
|
+
Object.assign(e, { boundsTree: t });
|
|
9514
|
+
let n = () => {
|
|
9515
|
+
s !== void 0 && u.current?.(s);
|
|
9516
|
+
}, i = r.boundsTree ? Uu(e, n) : void 0;
|
|
9517
|
+
return r.boundsTree || (e.setDrawRange(0, Infinity), n()), () => {
|
|
9518
|
+
i?.(), p.dispose(), Object.assign(e, { boundsTree: null });
|
|
9481
9519
|
};
|
|
9482
|
-
}, [
|
|
9520
|
+
}, [
|
|
9521
|
+
r.boundsTree,
|
|
9522
|
+
p,
|
|
9523
|
+
s
|
|
9524
|
+
]), /* @__PURE__ */ nt("mesh", {
|
|
9483
9525
|
frustumCulled: !0,
|
|
9484
9526
|
matrix: a,
|
|
9485
9527
|
matrixAutoUpdate: !1,
|
|
@@ -9509,10 +9551,10 @@ var Wu = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9509
9551
|
})
|
|
9510
9552
|
] }), /* @__PURE__ */ G("primitive", { object: p })]
|
|
9511
9553
|
});
|
|
9512
|
-
}),
|
|
9513
|
-
function
|
|
9514
|
-
let m = new
|
|
9515
|
-
u === "performance" && m.multiplyScalar(
|
|
9554
|
+
}), Xu = 1 / 1.5;
|
|
9555
|
+
function Zu({ colorPaletteTexture: e, material: t, materialMode: u, preselectionColor: d, selectionColor: f, useDoubleSideMaterial: p }) {
|
|
9556
|
+
let m = new N(t.r, t.g, t.b);
|
|
9557
|
+
u === "performance" && m.multiplyScalar(Xu);
|
|
9516
9558
|
let h = t.opacity ?? 1, g = {
|
|
9517
9559
|
color: m.clone(),
|
|
9518
9560
|
opacity: h,
|
|
@@ -9526,29 +9568,29 @@ function Ku({ colorPaletteTexture: e, material: t, materialMode: u, preselection
|
|
|
9526
9568
|
colorIndex: [0],
|
|
9527
9569
|
ids: [0]
|
|
9528
9570
|
};
|
|
9529
|
-
let y = s(c("colorIndex", "uint")), b = s(c("ids", "uint")), x = i(-1), S = i(new
|
|
9530
|
-
return v.colorNode =
|
|
9571
|
+
let y = s(c("colorIndex", "uint")), b = s(c("ids", "uint")), x = i(-1), S = i(new N(d)), C = i(new N(f)), w = i(m.clone()), T = i(h), E = a(e, o(y.add(.5).div(256), .5)).rgb, D = y.greaterThan(.5), O = l(y.sub(1)), k = O.lessThan(.5), ee = O.greaterThan(.5), A = b.equal(x).and(ee);
|
|
9572
|
+
return v.colorNode = A.select(S, k.select(C, D.select(E, w))), v.opacityNode = A.select(s(1), k.select(s(1), D.select(s(1), T))), v.userData.shader = { uniforms: {
|
|
9531
9573
|
elementColorPalette: { value: e },
|
|
9532
9574
|
preSelectionColor: S,
|
|
9533
9575
|
preSelectionId: x,
|
|
9534
9576
|
selectionColor: C
|
|
9535
9577
|
} }, v.userData.shaders = new Set([v.userData.shader]), v;
|
|
9536
9578
|
}
|
|
9537
|
-
function
|
|
9579
|
+
function Qu(e, { preselectionColor: t, selectionColor: n }) {
|
|
9538
9580
|
let r = e.userData, i = r.shaders ? Array.from(r.shaders) : r.shader ? [r.shader] : [], a = (e, t) => {
|
|
9539
9581
|
i.forEach((n) => {
|
|
9540
9582
|
let r = n.uniforms?.[e];
|
|
9541
|
-
r && (r.value instanceof
|
|
9583
|
+
r && (r.value instanceof N ? r.value.set(t) : r.value = new N(t));
|
|
9542
9584
|
});
|
|
9543
9585
|
};
|
|
9544
9586
|
a("preSelectionColor", t), a("selectionColor", n);
|
|
9545
9587
|
}
|
|
9546
|
-
var
|
|
9588
|
+
var $u = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n = "quality", data: r, isIfcSpace: i = !1, meshMatrix: a, onReady: o, readyKey: s, useDoubleSideMaterial: c = !1 }) {
|
|
9547
9589
|
let l = x(null), u = x(o), d = b(() => new Uint32Array(r.ids.length), [r.ids]);
|
|
9548
9590
|
u.current = o;
|
|
9549
9591
|
let f = b(() => {
|
|
9550
|
-
let e = new
|
|
9551
|
-
return e.setAttribute("position", new
|
|
9592
|
+
let e = new ne();
|
|
9593
|
+
return e.setAttribute("position", new M(r.pos, 3)), r.norm && e.setAttribute("normal", new M(r.norm, 3)), e.setAttribute("ids", new M(r.ids, 1)), e.setAttribute("colorIndex", new M(d, 1)), e.setIndex(new M(r.ind, 1)), n !== "performance" && !e.attributes.normal && e.computeVertexNormals(), r.boundsTree && Hu(e), e;
|
|
9552
9594
|
}, [
|
|
9553
9595
|
d,
|
|
9554
9596
|
r,
|
|
@@ -9557,7 +9599,7 @@ var Ju = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9557
9599
|
h.current = p;
|
|
9558
9600
|
let g = x(m);
|
|
9559
9601
|
g.current = m;
|
|
9560
|
-
let v = b(() =>
|
|
9602
|
+
let v = b(() => Zu({
|
|
9561
9603
|
colorPaletteTexture: e,
|
|
9562
9604
|
material: t,
|
|
9563
9605
|
materialMode: n,
|
|
@@ -9571,7 +9613,7 @@ var Ju = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9571
9613
|
c
|
|
9572
9614
|
]);
|
|
9573
9615
|
return _(() => {
|
|
9574
|
-
|
|
9616
|
+
Qu(v, {
|
|
9575
9617
|
preselectionColor: p,
|
|
9576
9618
|
selectionColor: m
|
|
9577
9619
|
});
|
|
@@ -9580,11 +9622,19 @@ var Ju = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9580
9622
|
p,
|
|
9581
9623
|
m
|
|
9582
9624
|
]), _(() => {
|
|
9583
|
-
let e = new dt(f, { indirect: !0 });
|
|
9584
|
-
|
|
9585
|
-
|
|
9625
|
+
let e = r.boundsTree ? dt.deserialize(r.boundsTree, f, { setIndex: !1 }) : new dt(f, { indirect: !0 });
|
|
9626
|
+
Object.assign(f, { boundsTree: e });
|
|
9627
|
+
let t = () => {
|
|
9628
|
+
s !== void 0 && u.current?.(s);
|
|
9629
|
+
}, n = r.boundsTree ? Uu(f, t) : void 0;
|
|
9630
|
+
return r.boundsTree || (f.setDrawRange(0, Infinity), t()), () => {
|
|
9631
|
+
n?.(), Object.assign(f, { boundsTree: null }), f.dispose();
|
|
9586
9632
|
};
|
|
9587
|
-
}, [
|
|
9633
|
+
}, [
|
|
9634
|
+
r.boundsTree,
|
|
9635
|
+
f,
|
|
9636
|
+
s
|
|
9637
|
+
]), _(() => () => v.dispose(), [v]), /* @__PURE__ */ nt("mesh", {
|
|
9588
9638
|
frustumCulled: !0,
|
|
9589
9639
|
matrix: a,
|
|
9590
9640
|
matrixAutoUpdate: !1,
|
|
@@ -9604,8 +9654,15 @@ var Ju = u.memo(function({ colorPaletteTexture: e, material: t, materialMode: n
|
|
|
9604
9654
|
object: f
|
|
9605
9655
|
}), /* @__PURE__ */ G("primitive", { object: v })]
|
|
9606
9656
|
});
|
|
9607
|
-
}),
|
|
9608
|
-
function
|
|
9657
|
+
}), ed = -1;
|
|
9658
|
+
function td(e, t, n) {
|
|
9659
|
+
let r = e.clone();
|
|
9660
|
+
return !n && Number.isFinite(t) && t !== 0 && r.multiply(new z().makeRotationY(t * ed)), r;
|
|
9661
|
+
}
|
|
9662
|
+
//#endregion
|
|
9663
|
+
//#region src/viewer/Model.tsx
|
|
9664
|
+
var nd = new z(), rd = /* @__PURE__ */ new WeakMap(), id = /* @__PURE__ */ new WeakMap();
|
|
9665
|
+
function ad(e) {
|
|
9609
9666
|
if (!e) return null;
|
|
9610
9667
|
try {
|
|
9611
9668
|
let t = JSON.parse(e);
|
|
@@ -9614,34 +9671,34 @@ function Qu(e) {
|
|
|
9614
9671
|
return console.warn("Model matrix parsing error", e), null;
|
|
9615
9672
|
}
|
|
9616
9673
|
}
|
|
9617
|
-
function
|
|
9618
|
-
return
|
|
9674
|
+
function od(e) {
|
|
9675
|
+
return ad(sd(e));
|
|
9619
9676
|
}
|
|
9620
|
-
function
|
|
9677
|
+
function sd(e) {
|
|
9621
9678
|
if (e.coordinationMatrix) return e.coordinationMatrix;
|
|
9622
9679
|
for (let t in e.data) {
|
|
9623
9680
|
let n = e.data[Number(t)]?.matrix;
|
|
9624
9681
|
if (n) return n;
|
|
9625
9682
|
}
|
|
9626
9683
|
}
|
|
9627
|
-
function
|
|
9628
|
-
let n = e.matrix ?? t ?? "", r =
|
|
9684
|
+
function cd(e, t) {
|
|
9685
|
+
let n = e.matrix ?? t ?? "", r = rd.get(e);
|
|
9629
9686
|
if (r && r.sourceMatrixKey === n) return r;
|
|
9630
|
-
let i = (
|
|
9687
|
+
let i = (ad(n) ?? new z()).clone().invert(), a = e.pos, o = new W(), s = Infinity;
|
|
9631
9688
|
for (let e = 0; e < a.length; e += 3) o.set(a[e], a[e + 1], a[e + 2]).applyMatrix4(i), Number.isFinite(o.y) && (s = Math.min(s, o.y));
|
|
9632
9689
|
let c = {
|
|
9633
9690
|
floorY: s,
|
|
9634
9691
|
meshMatrix: i,
|
|
9635
9692
|
sourceMatrixKey: n
|
|
9636
9693
|
};
|
|
9637
|
-
return
|
|
9694
|
+
return rd.set(e, c), c;
|
|
9638
9695
|
}
|
|
9639
|
-
function
|
|
9696
|
+
function ld(e, t) {
|
|
9640
9697
|
let n = e[t];
|
|
9641
9698
|
return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
|
|
9642
9699
|
}
|
|
9643
|
-
function
|
|
9644
|
-
let r =
|
|
9700
|
+
function ud(e, t, n) {
|
|
9701
|
+
let r = ld(e, "x"), i = ld(e, "y"), a = ld(e, "z"), o = ld(t, "x"), s = ld(t, "y"), c = ld(t, "z");
|
|
9645
9702
|
if (r === null || i === null || a === null || o === null || s === null || c === null) return null;
|
|
9646
9703
|
let l = new W(r + o, i + s, a + c).applyMatrix4(n);
|
|
9647
9704
|
return {
|
|
@@ -9650,14 +9707,14 @@ function rd(e, t, n) {
|
|
|
9650
9707
|
z: l.z
|
|
9651
9708
|
};
|
|
9652
9709
|
}
|
|
9653
|
-
function
|
|
9710
|
+
function dd(e, t, n) {
|
|
9654
9711
|
let r = {};
|
|
9655
9712
|
return Object.entries(e).forEach(([e, i]) => {
|
|
9656
|
-
let a = i.map((e) =>
|
|
9713
|
+
let a = i.map((e) => ud(e, t, n)).filter((e) => e !== null);
|
|
9657
9714
|
a.length >= 2 && (r[e] = a);
|
|
9658
9715
|
}), r;
|
|
9659
9716
|
}
|
|
9660
|
-
function
|
|
9717
|
+
function fd(e, t) {
|
|
9661
9718
|
return {
|
|
9662
9719
|
loc: {
|
|
9663
9720
|
x: 0,
|
|
@@ -9665,27 +9722,27 @@ function ad(e, t) {
|
|
|
9665
9722
|
z: 0
|
|
9666
9723
|
},
|
|
9667
9724
|
points: {
|
|
9668
|
-
u:
|
|
9669
|
-
v:
|
|
9725
|
+
u: dd(e.points.u, e.loc, t),
|
|
9726
|
+
v: dd(e.points.v, e.loc, t)
|
|
9670
9727
|
}
|
|
9671
9728
|
};
|
|
9672
9729
|
}
|
|
9673
|
-
function
|
|
9730
|
+
function pd(e, t) {
|
|
9674
9731
|
if (!e || !t) return e;
|
|
9675
|
-
let n =
|
|
9732
|
+
let n = id.get(e);
|
|
9676
9733
|
if (n && n.sourceMatrixKey === t) return n.grids;
|
|
9677
|
-
let r =
|
|
9734
|
+
let r = ad(t);
|
|
9678
9735
|
if (!r) return e;
|
|
9679
9736
|
let i = r.clone().invert(), a = {};
|
|
9680
9737
|
return Object.entries(e).forEach(([e, t]) => {
|
|
9681
|
-
a[e] =
|
|
9682
|
-
}),
|
|
9738
|
+
a[e] = fd(t, i);
|
|
9739
|
+
}), id.set(e, {
|
|
9683
9740
|
grids: a,
|
|
9684
9741
|
sourceMatrixKey: t
|
|
9685
9742
|
}), a;
|
|
9686
9743
|
}
|
|
9687
|
-
function
|
|
9688
|
-
let
|
|
9744
|
+
function md({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r, loadGeneration: i, materialMode: a, onUploadComplete: o, onUploadProgress: s, trueNorthEnabled: c = !0, useWebGPU: l = !1 }) {
|
|
9745
|
+
let u = K((e) => e.gridAxesVisibility), d = b(() => {
|
|
9689
9746
|
if (!r) return {
|
|
9690
9747
|
data: [],
|
|
9691
9748
|
coordinationMatrix: null,
|
|
@@ -9697,11 +9754,11 @@ function sd({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
9697
9754
|
e = !0;
|
|
9698
9755
|
break;
|
|
9699
9756
|
}
|
|
9700
|
-
let i = r.coordinationMatrix ??
|
|
9757
|
+
let i = r.coordinationMatrix ?? sd(r), a = od(r), o = e || a ? t?.clone() ?? a : null, s = Infinity, c = [];
|
|
9701
9758
|
for (let e in r.data) {
|
|
9702
9759
|
let t = r.data[Number(e)];
|
|
9703
9760
|
if (!t) continue;
|
|
9704
|
-
let a =
|
|
9761
|
+
let a = cd(t, i), o = t.mat;
|
|
9705
9762
|
s = Math.min(s, a.floorY), c.push({
|
|
9706
9763
|
data: t,
|
|
9707
9764
|
isIfcSpace: !!t.isIfcSpace,
|
|
@@ -9715,68 +9772,69 @@ function sd({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
9715
9772
|
data: c,
|
|
9716
9773
|
coordinationMatrix: o,
|
|
9717
9774
|
floorY: Number.isFinite(s) ? s : 0,
|
|
9718
|
-
grids:
|
|
9775
|
+
grids: pd(r.grids, i)
|
|
9719
9776
|
};
|
|
9720
9777
|
}, [
|
|
9721
9778
|
t,
|
|
9722
9779
|
r,
|
|
9723
9780
|
n
|
|
9724
|
-
]),
|
|
9781
|
+
]), f = x({
|
|
9725
9782
|
loadGeneration: i,
|
|
9726
9783
|
readyMeshKeys: /* @__PURE__ */ new Set()
|
|
9727
|
-
}),
|
|
9728
|
-
|
|
9784
|
+
}), p = x(o), m = x(s), g = x(i), _ = x(d.data.length);
|
|
9785
|
+
p.current = o, m.current = s, g.current = i, _.current = d.data.length, f.current.loadGeneration !== i && (f.current = {
|
|
9729
9786
|
loadGeneration: i,
|
|
9730
9787
|
readyMeshKeys: /* @__PURE__ */ new Set()
|
|
9731
9788
|
});
|
|
9732
|
-
let
|
|
9733
|
-
let t =
|
|
9789
|
+
let v = h((e) => {
|
|
9790
|
+
let t = f.current, n = g.current;
|
|
9734
9791
|
if (t.loadGeneration !== n || !e.startsWith(`${n}:`) || t.readyMeshKeys.has(e)) return;
|
|
9735
9792
|
t.readyMeshKeys.add(e);
|
|
9736
|
-
let r = t.readyMeshKeys.size, i =
|
|
9737
|
-
|
|
9793
|
+
let r = t.readyMeshKeys.size, i = _.current;
|
|
9794
|
+
m.current?.(r, i), r >= i && p.current?.(r);
|
|
9738
9795
|
}, []);
|
|
9739
9796
|
if (!r) return /* @__PURE__ */ G(tt, {});
|
|
9740
|
-
let
|
|
9797
|
+
let y = a ?? r.renderSettings?.materialMode ?? "quality", S = r.renderSettings?.useDoubleSideMaterial === !0, C = l ? $u : Yu, w = d.coordinationMatrix ?? nd, T = typeof r.trueNorthAngle == "number" && Number.isFinite(r.trueNorthAngle) ? r.trueNorthAngle : 0;
|
|
9741
9798
|
return /* @__PURE__ */ nt("group", {
|
|
9742
|
-
matrix:
|
|
9799
|
+
matrix: td(w, T, c),
|
|
9743
9800
|
matrixAutoUpdate: !1,
|
|
9744
9801
|
userData: b(() => ({
|
|
9745
9802
|
geometryTransformVersion: 0,
|
|
9746
9803
|
modelID: n,
|
|
9747
|
-
trueNorthAngle:
|
|
9748
|
-
trueNorthBaseMatrix:
|
|
9749
|
-
trueNorthEnabled:
|
|
9804
|
+
trueNorthAngle: T,
|
|
9805
|
+
trueNorthBaseMatrix: w.clone(),
|
|
9806
|
+
trueNorthEnabled: c
|
|
9750
9807
|
}), [
|
|
9808
|
+
w,
|
|
9751
9809
|
n,
|
|
9752
|
-
|
|
9753
|
-
|
|
9810
|
+
T,
|
|
9811
|
+
c
|
|
9754
9812
|
]),
|
|
9755
|
-
children: [
|
|
9813
|
+
children: [d.data.map((t) => /* @__PURE__ */ G(C, {
|
|
9756
9814
|
colorPaletteTexture: e,
|
|
9757
9815
|
data: t.data,
|
|
9758
9816
|
isIfcSpace: t.isIfcSpace,
|
|
9759
9817
|
material: t.material,
|
|
9760
|
-
materialMode:
|
|
9818
|
+
materialMode: y,
|
|
9761
9819
|
meshMatrix: t.meshMatrix,
|
|
9762
|
-
onReady:
|
|
9820
|
+
onReady: v,
|
|
9763
9821
|
readyKey: `${i}:${t.key}`,
|
|
9764
|
-
useDoubleSideMaterial:
|
|
9822
|
+
useDoubleSideMaterial: S
|
|
9765
9823
|
}, t.key)), /* @__PURE__ */ G(Su, {
|
|
9766
|
-
floorY:
|
|
9767
|
-
grids:
|
|
9768
|
-
showBottom:
|
|
9769
|
-
showLeft:
|
|
9770
|
-
showRight:
|
|
9771
|
-
showTop:
|
|
9772
|
-
visible:
|
|
9824
|
+
floorY: d.floorY,
|
|
9825
|
+
grids: d.grids,
|
|
9826
|
+
showBottom: u.bottom,
|
|
9827
|
+
showLeft: u.left,
|
|
9828
|
+
showRight: u.right,
|
|
9829
|
+
showTop: u.top,
|
|
9830
|
+
visible: u.visible
|
|
9773
9831
|
})]
|
|
9774
9832
|
});
|
|
9775
9833
|
}
|
|
9776
|
-
var
|
|
9834
|
+
var hd = m(md);
|
|
9777
9835
|
//#endregion
|
|
9778
9836
|
//#region src/viewer/utils/GeometryUtils/useGeometryIndex.ts
|
|
9779
|
-
function
|
|
9837
|
+
function gd() {
|
|
9780
9838
|
return {
|
|
9781
9839
|
elementBounds: /* @__PURE__ */ new Map(),
|
|
9782
9840
|
elementIndex: /* @__PURE__ */ new Map(),
|
|
@@ -9788,16 +9846,16 @@ function ld() {
|
|
|
9788
9846
|
version: ""
|
|
9789
9847
|
};
|
|
9790
9848
|
}
|
|
9791
|
-
function
|
|
9849
|
+
function _d(e, t, n, r) {
|
|
9792
9850
|
let i = e.get(t);
|
|
9793
9851
|
i || (i = /* @__PURE__ */ new Map(), e.set(t, i));
|
|
9794
9852
|
let a = i.get(n);
|
|
9795
|
-
a || (a = new
|
|
9853
|
+
a || (a = new j(), i.set(n, a)), a.expandByPoint(r);
|
|
9796
9854
|
}
|
|
9797
|
-
function
|
|
9855
|
+
function vd(e) {
|
|
9798
9856
|
return e instanceof Uint16Array || e instanceof Uint32Array ? e : e.length > 65535 ? new Uint32Array(e) : new Uint16Array(e);
|
|
9799
9857
|
}
|
|
9800
|
-
function
|
|
9858
|
+
function yd(e, t, n, r) {
|
|
9801
9859
|
let i = n.get(e);
|
|
9802
9860
|
if (i) return i;
|
|
9803
9861
|
i = {
|
|
@@ -9807,20 +9865,20 @@ function fd(e, t, n, r) {
|
|
|
9807
9865
|
let a = r.get(e);
|
|
9808
9866
|
return a || (a = [], r.set(e, a)), a.push(i), i;
|
|
9809
9867
|
}
|
|
9810
|
-
function
|
|
9811
|
-
n &&
|
|
9868
|
+
function bd(e, t, n, r, i, a) {
|
|
9869
|
+
n && yd(e, r, i, a).vertexRanges.push({
|
|
9812
9870
|
count: n,
|
|
9813
9871
|
start: t
|
|
9814
9872
|
});
|
|
9815
9873
|
}
|
|
9816
|
-
function
|
|
9817
|
-
n && (
|
|
9874
|
+
function xd(e, t, n, r, i, a) {
|
|
9875
|
+
n && (yd(e, r, i, a), r.triangleRanges.push({
|
|
9818
9876
|
count: n,
|
|
9819
9877
|
id: e,
|
|
9820
9878
|
start: t
|
|
9821
9879
|
}));
|
|
9822
9880
|
}
|
|
9823
|
-
function
|
|
9881
|
+
function Sd(e) {
|
|
9824
9882
|
let t = e;
|
|
9825
9883
|
for (; t;) {
|
|
9826
9884
|
let e = t.userData.modelID;
|
|
@@ -9829,16 +9887,16 @@ function hd(e) {
|
|
|
9829
9887
|
}
|
|
9830
9888
|
return 0;
|
|
9831
9889
|
}
|
|
9832
|
-
function
|
|
9890
|
+
function Cd(e) {
|
|
9833
9891
|
return e.name === "space" || e.userData.isIfcSpace === !0;
|
|
9834
9892
|
}
|
|
9835
|
-
function
|
|
9893
|
+
function wd(e) {
|
|
9836
9894
|
let t = e.userData.removedElementIds;
|
|
9837
9895
|
if (t instanceof Set) return t;
|
|
9838
9896
|
let n = /* @__PURE__ */ new Set();
|
|
9839
9897
|
return e.userData.removedElementIds = n, n;
|
|
9840
9898
|
}
|
|
9841
|
-
function
|
|
9899
|
+
function Td(e) {
|
|
9842
9900
|
if (!e) return "";
|
|
9843
9901
|
let t = [];
|
|
9844
9902
|
return e.traverse((e) => {
|
|
@@ -9846,22 +9904,22 @@ function vd(e) {
|
|
|
9846
9904
|
typeof n == "number" && typeof r == "number" && t.push("model-transform", String(n), String(r));
|
|
9847
9905
|
}), e.traverse((e) => {
|
|
9848
9906
|
if (!(e instanceof B)) return;
|
|
9849
|
-
let n = e.geometry, r =
|
|
9907
|
+
let n = e.geometry, r = wd(e);
|
|
9850
9908
|
t.push(e.uuid, n.uuid, String(n.attributes.ids?.count ?? 0), String(n.attributes.position?.count ?? 0)), r.size && t.push("removed", Array.from(r).sort((e, t) => e - t).join(","));
|
|
9851
9909
|
}), t.join(":");
|
|
9852
9910
|
}
|
|
9853
|
-
function
|
|
9854
|
-
let t = x(
|
|
9911
|
+
function Ed(e) {
|
|
9912
|
+
let t = x(gd()), n = h(() => {
|
|
9855
9913
|
let n = e.current, r = t.current;
|
|
9856
9914
|
if (!n) return r;
|
|
9857
|
-
let i =
|
|
9915
|
+
let i = Td(n);
|
|
9858
9916
|
if (r.indexedModel === n && r.records.size && r.version === i) return r;
|
|
9859
9917
|
let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), c = new W();
|
|
9860
9918
|
return n.updateMatrixWorld(!0), n.traverse((e) => {
|
|
9861
9919
|
if (!(e instanceof B)) return;
|
|
9862
9920
|
let t = e, n = t.geometry, i = n.index, l = n.attributes.ids;
|
|
9863
9921
|
if (!i || !l) return;
|
|
9864
|
-
let u = n.attributes.position, d =
|
|
9922
|
+
let u = n.attributes.position, d = Sd(t), f = Cd(t), p = wd(t), m = vd(i.array), h = {
|
|
9865
9923
|
hiddenIds: /* @__PURE__ */ new Set(),
|
|
9866
9924
|
initialVisible: t.visible,
|
|
9867
9925
|
isIfcSpace: f,
|
|
@@ -9876,23 +9934,23 @@ function yd(e) {
|
|
|
9876
9934
|
for (let e = 0; e < y; e++) {
|
|
9877
9935
|
let t = l.getX(m[e * 3]);
|
|
9878
9936
|
if (p.has(t)) {
|
|
9879
|
-
_ !== null &&
|
|
9937
|
+
_ !== null && xd(_, v, e - v, h, g, a), _ = null, v = e + 1;
|
|
9880
9938
|
continue;
|
|
9881
9939
|
}
|
|
9882
|
-
_ === null ? (_ = t, v = e) : t !== _ && (
|
|
9940
|
+
_ === null ? (_ = t, v = e) : t !== _ && (xd(_, v, e - v, h, g, a), _ = t, v = e);
|
|
9883
9941
|
}
|
|
9884
|
-
_ !== null &&
|
|
9942
|
+
_ !== null && xd(_, v, y - v, h, g, a);
|
|
9885
9943
|
let b = null, x = 0, S = u ? Math.min(l.count, u.count) : l.count;
|
|
9886
9944
|
u && t.updateWorldMatrix(!0, !1);
|
|
9887
9945
|
for (let e = 0; e < l.count; e++) {
|
|
9888
9946
|
let n = l.getX(e);
|
|
9889
9947
|
if (p.has(n)) {
|
|
9890
|
-
b !== null &&
|
|
9948
|
+
b !== null && bd(b, x, e - x, h, g, a), b = null, x = e + 1;
|
|
9891
9949
|
continue;
|
|
9892
9950
|
}
|
|
9893
|
-
u && e < S && (c.fromBufferAttribute(u, e).applyMatrix4(t.matrixWorld), Number.isFinite(c.x + c.y + c.z) &&
|
|
9951
|
+
u && e < S && (c.fromBufferAttribute(u, e).applyMatrix4(t.matrixWorld), Number.isFinite(c.x + c.y + c.z) && _d(o, d, n, c)), b === null ? (b = n, x = e) : n !== b && (bd(b, x, e - x, h, g, a), b = n, x = e);
|
|
9894
9952
|
}
|
|
9895
|
-
b !== null &&
|
|
9953
|
+
b !== null && bd(b, x, l.count - x, h, g, a), s.add(h), f && !r.ifcSpacesVisible && (t.visible = !1);
|
|
9896
9954
|
}), t.current = {
|
|
9897
9955
|
elementBounds: o,
|
|
9898
9956
|
elementIndex: a,
|
|
@@ -9904,7 +9962,7 @@ function yd(e) {
|
|
|
9904
9962
|
version: i
|
|
9905
9963
|
}, t.current;
|
|
9906
9964
|
}, [e]), r = h(() => {
|
|
9907
|
-
t.current =
|
|
9965
|
+
t.current = gd();
|
|
9908
9966
|
}, []);
|
|
9909
9967
|
return b(() => ({
|
|
9910
9968
|
buildIndex: n,
|
|
@@ -9913,80 +9971,79 @@ function yd(e) {
|
|
|
9913
9971
|
}
|
|
9914
9972
|
//#endregion
|
|
9915
9973
|
//#region src/viewer/utils/GeometryUtils/useGeometryUtils.ts
|
|
9916
|
-
|
|
9917
|
-
function xd(e, t) {
|
|
9974
|
+
function Dd(e, t) {
|
|
9918
9975
|
return e instanceof Uint32Array ? new Uint32Array(t) : new Uint16Array(t);
|
|
9919
9976
|
}
|
|
9920
|
-
function
|
|
9977
|
+
function Od(e) {
|
|
9921
9978
|
let t = e.geometry;
|
|
9922
9979
|
Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new dt(e.geometry, { indirect: !0 }) });
|
|
9923
9980
|
}
|
|
9924
|
-
function
|
|
9925
|
-
e.mesh.geometry.setIndex(new
|
|
9981
|
+
function kd(e, t, n = !0) {
|
|
9982
|
+
e.mesh.geometry.setIndex(new M(t, 1)), n && Od(e.mesh);
|
|
9926
9983
|
}
|
|
9927
|
-
function
|
|
9984
|
+
function Ad(e, t) {
|
|
9928
9985
|
return e.initialVisible && (!e.isIfcSpace || t);
|
|
9929
9986
|
}
|
|
9930
|
-
function
|
|
9987
|
+
function jd(e, t) {
|
|
9931
9988
|
let n = e.mesh.geometry, r = n.index?.array;
|
|
9932
|
-
e.mesh.visible =
|
|
9989
|
+
e.mesh.visible = Ad(e, t), r !== e.originalIndex && kd(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (Od(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
|
|
9933
9990
|
}
|
|
9934
|
-
function
|
|
9991
|
+
function Md(e) {
|
|
9935
9992
|
return e === null ? "*" : e.size ? Array.from(e).sort((e, t) => e - t).join(",") : "";
|
|
9936
9993
|
}
|
|
9937
|
-
function
|
|
9938
|
-
return `h:${
|
|
9994
|
+
function Nd(e, t, n, r) {
|
|
9995
|
+
return `h:${Md(e)}|i:${Md(n)}|s:${r ? Number(t) : ""}`;
|
|
9939
9996
|
}
|
|
9940
|
-
function
|
|
9997
|
+
function Pd(e, t, n) {
|
|
9941
9998
|
return !t.has(e) && (!n || n.has(e));
|
|
9942
9999
|
}
|
|
9943
|
-
function
|
|
10000
|
+
function Fd(e, t) {
|
|
9944
10001
|
Object.entries(e).forEach(([e, n]) => {
|
|
9945
10002
|
n.forEach((n) => t(Number(e), n));
|
|
9946
10003
|
});
|
|
9947
10004
|
}
|
|
9948
|
-
function
|
|
10005
|
+
function Id(e, t, n) {
|
|
9949
10006
|
e.hiddenIds.has(t) || (e.hiddenIds.add(t), n.add(e));
|
|
9950
10007
|
}
|
|
9951
|
-
function
|
|
10008
|
+
function Ld(e, t, n) {
|
|
9952
10009
|
e && console.log(`${t}:`, Date.now() - n, "ms");
|
|
9953
10010
|
}
|
|
9954
|
-
function
|
|
9955
|
-
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s =
|
|
10011
|
+
function Rd(e, t, n, r) {
|
|
10012
|
+
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = Nd(i, t, n, e.isIfcSpace);
|
|
9956
10013
|
if (e.visibleStateKey === s) return;
|
|
9957
10014
|
if (!i.size && !n) {
|
|
9958
|
-
|
|
10015
|
+
jd(e, t), e.visibleStateKey = s;
|
|
9959
10016
|
return;
|
|
9960
10017
|
}
|
|
9961
10018
|
let c = 0, l = 0;
|
|
9962
10019
|
if (o.forEach(({ count: e, id: t }) => {
|
|
9963
|
-
|
|
10020
|
+
Pd(t, i, n) ? c += e * 3 : l += e * 3;
|
|
9964
10021
|
}), !c) {
|
|
9965
|
-
|
|
10022
|
+
jd(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
|
|
9966
10023
|
return;
|
|
9967
10024
|
}
|
|
9968
10025
|
if (!l) {
|
|
9969
|
-
|
|
10026
|
+
jd(e, t), e.visibleStateKey = s;
|
|
9970
10027
|
return;
|
|
9971
10028
|
}
|
|
9972
|
-
e.mesh.visible =
|
|
9973
|
-
let u =
|
|
10029
|
+
e.mesh.visible = Ad(e, t);
|
|
10030
|
+
let u = Dd(a, c), d = 0;
|
|
9974
10031
|
for (let e = 0; e < o.length; e++) {
|
|
9975
10032
|
let { count: t, id: r, start: s } = o[e];
|
|
9976
|
-
if (!
|
|
10033
|
+
if (!Pd(r, i, n)) continue;
|
|
9977
10034
|
let c = s * 3, l = c + t * 3;
|
|
9978
10035
|
u.set(a.subarray(c, l), d), d += t * 3;
|
|
9979
10036
|
}
|
|
9980
|
-
r || (e.originalBoundsTree = null),
|
|
10037
|
+
r || (e.originalBoundsTree = null), kd(e, u), e.visibleStateKey = s;
|
|
9981
10038
|
}
|
|
9982
|
-
function
|
|
10039
|
+
function zd(e, t, n) {
|
|
9983
10040
|
let r = e.elementIndex.get(n);
|
|
9984
10041
|
if (!r) return;
|
|
9985
10042
|
let i = r.filter(({ record: e }) => e.modelID !== t);
|
|
9986
10043
|
i.length ? e.elementIndex.set(n, i) : e.elementIndex.delete(n);
|
|
9987
10044
|
}
|
|
9988
|
-
function
|
|
9989
|
-
let n =
|
|
10045
|
+
function Bd(e, t) {
|
|
10046
|
+
let n = wd(e.mesh), r = !1;
|
|
9990
10047
|
if (t.forEach((t) => {
|
|
9991
10048
|
e.hiddenIds.delete(t), !n.has(t) && (n.add(t), r = !0);
|
|
9992
10049
|
}), !r) return !1;
|
|
@@ -9999,53 +10056,53 @@ function Pd(e, t) {
|
|
|
9999
10056
|
start: a
|
|
10000
10057
|
}), a += e, o += e * 3);
|
|
10001
10058
|
});
|
|
10002
|
-
let s =
|
|
10059
|
+
let s = Dd(e.originalIndex, o), c = 0;
|
|
10003
10060
|
return e.triangleRanges.forEach(({ count: t, id: r, start: i }) => {
|
|
10004
10061
|
if (n.has(r)) return;
|
|
10005
10062
|
let a = i * 3, o = a + t * 3;
|
|
10006
10063
|
s.set(e.originalIndex.subarray(a, o), c), c += t * 3;
|
|
10007
10064
|
}), e.originalBoundsTree = null, e.originalIndex = s, e.triangleRanges = i, e.visibleStateKey = "", !0;
|
|
10008
10065
|
}
|
|
10009
|
-
function
|
|
10066
|
+
function Vd(e, t) {
|
|
10010
10067
|
return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
|
|
10011
10068
|
}
|
|
10012
|
-
function
|
|
10069
|
+
function Hd(e) {
|
|
10013
10070
|
let t = [];
|
|
10014
10071
|
return e?.children.forEach((e) => {
|
|
10015
10072
|
e instanceof L && typeof e.userData.modelID == "number" && t.push(e);
|
|
10016
10073
|
}), t;
|
|
10017
10074
|
}
|
|
10018
|
-
function
|
|
10075
|
+
function Ud(e) {
|
|
10019
10076
|
let t = e.userData.trueNorthBaseMatrix;
|
|
10020
10077
|
if (t instanceof z) return t;
|
|
10021
10078
|
let n = e.matrix.clone();
|
|
10022
10079
|
return e.userData.trueNorthBaseMatrix = n, n;
|
|
10023
10080
|
}
|
|
10024
|
-
function
|
|
10025
|
-
let n = Number(e.userData.trueNorthAngle ?? 0), r =
|
|
10026
|
-
|
|
10081
|
+
function Wd(e, t) {
|
|
10082
|
+
let n = Number(e.userData.trueNorthAngle ?? 0), r = td(Ud(e), n, t);
|
|
10083
|
+
e.matrix.copy(r), e.matrixAutoUpdate = !1, e.updateMatrixWorld(!0), e.userData.trueNorthEnabled = t, e.userData.geometryTransformVersion = (Number(e.userData.geometryTransformVersion) || 0) + 1;
|
|
10027
10084
|
}
|
|
10028
|
-
function
|
|
10085
|
+
function Gd(e) {
|
|
10029
10086
|
let t = K((e) => e.selected), n = K((e) => e.resetSelected), r = K((e) => e.showStats), i = K((e) => e.userDevice) === "pc", a = e.buildIndex, o = h(() => Array.from(a().elementIndex.keys()), [a]), s = h(() => a().ifcSpacesVisible, [a]), c = h((e, t) => {
|
|
10030
10087
|
let n = Date.now(), o = a(), s = /* @__PURE__ */ new Set();
|
|
10031
10088
|
t.forEach((t) => {
|
|
10032
10089
|
let n = o.elementIndex.get(t);
|
|
10033
10090
|
n && n.forEach(({ record: n }) => {
|
|
10034
|
-
n.modelID === e &&
|
|
10091
|
+
n.modelID === e && Id(n, t, s);
|
|
10035
10092
|
});
|
|
10036
|
-
}), s.forEach((e) =>
|
|
10093
|
+
}), s.forEach((e) => Rd(e, o.ifcSpacesVisible, Vd(o, e), i)), Ld(r, "hideByIds", n);
|
|
10037
10094
|
}, [
|
|
10038
10095
|
a,
|
|
10039
10096
|
i,
|
|
10040
10097
|
r
|
|
10041
10098
|
]), l = h(() => {
|
|
10042
10099
|
let e = Date.now(), o = a(), s = /* @__PURE__ */ new Set();
|
|
10043
|
-
|
|
10100
|
+
Fd(t, (e, t) => {
|
|
10044
10101
|
let n = o.elementIndex.get(t);
|
|
10045
10102
|
n && n.forEach(({ record: n }) => {
|
|
10046
|
-
n.modelID === e &&
|
|
10103
|
+
n.modelID === e && Id(n, t, s);
|
|
10047
10104
|
});
|
|
10048
|
-
}), s.forEach((e) =>
|
|
10105
|
+
}), s.forEach((e) => Rd(e, o.ifcSpacesVisible, Vd(o, e), i)), n(), Ld(r, "hideSelected", e);
|
|
10049
10106
|
}, [
|
|
10050
10107
|
a,
|
|
10051
10108
|
i,
|
|
@@ -10059,14 +10116,14 @@ function zd(e) {
|
|
|
10059
10116
|
n && n.forEach(({ record: n }) => {
|
|
10060
10117
|
n.modelID === e && n.hiddenIds.delete(t) && s.add(n);
|
|
10061
10118
|
});
|
|
10062
|
-
}), s.forEach((e) =>
|
|
10119
|
+
}), s.forEach((e) => Rd(e, o.ifcSpacesVisible, Vd(o, e), i)), Ld(r, "showByIds", n);
|
|
10063
10120
|
}, [
|
|
10064
10121
|
a,
|
|
10065
10122
|
i,
|
|
10066
10123
|
r
|
|
10067
10124
|
]), d = h((e, t) => {
|
|
10068
10125
|
let n = Date.now(), o = a();
|
|
10069
|
-
o.isolatedIdsByModel = new Map([[e, new Set(t)]]), o.isolatedIds = null, o.records.forEach((e) =>
|
|
10126
|
+
o.isolatedIdsByModel = new Map([[e, new Set(t)]]), o.isolatedIds = null, o.records.forEach((e) => Rd(e, o.ifcSpacesVisible, Vd(o, e), i)), Ld(r, "isolateByIds", n);
|
|
10070
10127
|
}, [
|
|
10071
10128
|
a,
|
|
10072
10129
|
i,
|
|
@@ -10081,24 +10138,24 @@ function zd(e) {
|
|
|
10081
10138
|
t.modelID === e && c.add(t);
|
|
10082
10139
|
});
|
|
10083
10140
|
}), !c.size) {
|
|
10084
|
-
|
|
10141
|
+
Ld(r, "removeByIds", n);
|
|
10085
10142
|
return;
|
|
10086
10143
|
}
|
|
10087
10144
|
c.forEach((e) => {
|
|
10088
|
-
|
|
10145
|
+
Bd(e, s);
|
|
10089
10146
|
}), s.forEach((t) => {
|
|
10090
|
-
|
|
10091
|
-
}), c.forEach((e) =>
|
|
10147
|
+
zd(o, e, t), o.elementBounds.get(e)?.delete(t), o.isolatedIds?.delete(t), o.isolatedIdsByModel?.get(e)?.delete(t);
|
|
10148
|
+
}), c.forEach((e) => Rd(e, o.ifcSpacesVisible, Vd(o, e), i)), Ld(r, "removeByIds", n);
|
|
10092
10149
|
}, [
|
|
10093
10150
|
a,
|
|
10094
10151
|
i,
|
|
10095
10152
|
r
|
|
10096
10153
|
]), p = h(() => {
|
|
10097
10154
|
let e = Date.now(), n = a(), o = /* @__PURE__ */ new Map();
|
|
10098
|
-
|
|
10155
|
+
Fd(t, (e, t) => {
|
|
10099
10156
|
let n = o.get(e);
|
|
10100
10157
|
n || (n = /* @__PURE__ */ new Set(), o.set(e, n)), n.add(t);
|
|
10101
|
-
}), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) =>
|
|
10158
|
+
}), n.isolatedIdsByModel = o, n.isolatedIds = null, n.records.forEach((e) => Rd(e, n.ifcSpacesVisible, Vd(n, e), i)), Ld(r, "isolateSelected", e);
|
|
10102
10159
|
}, [
|
|
10103
10160
|
a,
|
|
10104
10161
|
i,
|
|
@@ -10106,7 +10163,7 @@ function zd(e) {
|
|
|
10106
10163
|
r
|
|
10107
10164
|
]), m = h(() => {
|
|
10108
10165
|
let e = Date.now(), t = a();
|
|
10109
|
-
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) =>
|
|
10166
|
+
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => Rd(e, t.ifcSpacesVisible, Vd(t, e), i)), Ld(r, "resetIsolation", e);
|
|
10110
10167
|
}, [
|
|
10111
10168
|
a,
|
|
10112
10169
|
i,
|
|
@@ -10114,7 +10171,7 @@ function zd(e) {
|
|
|
10114
10171
|
]), g = h((e) => {
|
|
10115
10172
|
let t = a();
|
|
10116
10173
|
t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
|
|
10117
|
-
e.isIfcSpace &&
|
|
10174
|
+
e.isIfcSpace && Rd(e, t.ifcSpacesVisible, Vd(t, e), i);
|
|
10118
10175
|
}));
|
|
10119
10176
|
}, [a, i]), _ = h(() => {
|
|
10120
10177
|
g(!s());
|
|
@@ -10136,8 +10193,8 @@ function zd(e) {
|
|
|
10136
10193
|
showAll: h(() => {
|
|
10137
10194
|
let e = Date.now(), t = a();
|
|
10138
10195
|
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
|
|
10139
|
-
e.hiddenIds.clear(),
|
|
10140
|
-
}),
|
|
10196
|
+
e.hiddenIds.clear(), Rd(e, t.ifcSpacesVisible, Vd(t, e), i);
|
|
10197
|
+
}), Ld(r, "showAll", e);
|
|
10141
10198
|
}, [
|
|
10142
10199
|
a,
|
|
10143
10200
|
i,
|
|
@@ -10146,23 +10203,23 @@ function zd(e) {
|
|
|
10146
10203
|
showByIds: u,
|
|
10147
10204
|
toggleIIfcSpacesVisibility: _,
|
|
10148
10205
|
useTrueNorth: h((t = !0) => {
|
|
10149
|
-
let n =
|
|
10150
|
-
n.length && (n.forEach((e) =>
|
|
10206
|
+
let n = Hd(a().indexedModel);
|
|
10207
|
+
n.length && (n.forEach((e) => Wd(e, t)), e.resetIndex());
|
|
10151
10208
|
}, [a, e])
|
|
10152
10209
|
};
|
|
10153
10210
|
}
|
|
10154
10211
|
//#endregion
|
|
10155
10212
|
//#region src/viewer/utils/ClippingUtils/PlaneHelper.ts
|
|
10156
|
-
var
|
|
10157
|
-
function
|
|
10213
|
+
var Kd = "#0b2f5f", qd = "#0b2f5f", Jd = 0, Yd = "#165eb0", Xd = .3, Zd = .01, Qd = .025, $d = .015, ef = .02, tf = 1e-7, nf = .25, rf = .15, af = .25, of = 1e-5, sf = .2, cf = 1, lf = 1;
|
|
10214
|
+
function uf(e, t) {
|
|
10158
10215
|
let n = t.getBoundingClientRect();
|
|
10159
10216
|
return new U((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
|
|
10160
10217
|
}
|
|
10161
|
-
function
|
|
10218
|
+
function df(e) {
|
|
10162
10219
|
let t = e.getSize(new W());
|
|
10163
|
-
return Math.max(
|
|
10220
|
+
return Math.max(af, t.length() * Zd);
|
|
10164
10221
|
}
|
|
10165
|
-
var
|
|
10222
|
+
var ff = class extends Oe {
|
|
10166
10223
|
helper = new L();
|
|
10167
10224
|
borderMaterial;
|
|
10168
10225
|
material;
|
|
@@ -10182,15 +10239,15 @@ var of = class extends Oe {
|
|
|
10182
10239
|
listenersActive = !1;
|
|
10183
10240
|
constructor(e, t, n, r) {
|
|
10184
10241
|
super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new Se({
|
|
10185
|
-
color:
|
|
10242
|
+
color: qd,
|
|
10186
10243
|
depthWrite: !1,
|
|
10187
|
-
opacity:
|
|
10244
|
+
opacity: Jd,
|
|
10188
10245
|
side: le,
|
|
10189
10246
|
transparent: !0
|
|
10190
10247
|
}), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
|
|
10191
|
-
let i = Math.max(
|
|
10248
|
+
let i = Math.max(nf, Math.min(this.layout.width, this.layout.height) * Qd), a = Math.max(rf, Math.min(this.layout.width, this.layout.height) * $d);
|
|
10192
10249
|
this.borderMaterial = new _e({
|
|
10193
|
-
color:
|
|
10250
|
+
color: Kd,
|
|
10194
10251
|
dashSize: i,
|
|
10195
10252
|
depthWrite: !1,
|
|
10196
10253
|
gapSize: a
|
|
@@ -10221,7 +10278,7 @@ var of = class extends Oe {
|
|
|
10221
10278
|
}
|
|
10222
10279
|
updateBorderDash() {
|
|
10223
10280
|
let e = Math.min(this.layout.width, this.layout.height);
|
|
10224
|
-
this.borderMaterial.dashSize = Math.max(
|
|
10281
|
+
this.borderMaterial.dashSize = Math.max(nf, e * Qd), this.borderMaterial.gapSize = Math.max(rf, e * $d), this.borderMaterial.needsUpdate = !0;
|
|
10225
10282
|
}
|
|
10226
10283
|
addEventListeners() {
|
|
10227
10284
|
if (this.listenersActive) return;
|
|
@@ -10283,10 +10340,10 @@ var of = class extends Oe {
|
|
|
10283
10340
|
return !1;
|
|
10284
10341
|
}
|
|
10285
10342
|
getEdgeInteractionWidth() {
|
|
10286
|
-
return Math.min(
|
|
10343
|
+
return Math.min(cf, Math.max(sf, Math.min(this.layout.width, this.layout.height) * ef));
|
|
10287
10344
|
}
|
|
10288
10345
|
getDragDistanceEpsilon() {
|
|
10289
|
-
return Math.max(
|
|
10346
|
+
return Math.max(of, Math.min(this.layout.width, this.layout.height) * tf);
|
|
10290
10347
|
}
|
|
10291
10348
|
getPointToSegmentDistanceSquared(e, t, n) {
|
|
10292
10349
|
let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
|
|
@@ -10299,7 +10356,7 @@ var of = class extends Oe {
|
|
|
10299
10356
|
}
|
|
10300
10357
|
getPointerPointOnPlane(e, t) {
|
|
10301
10358
|
let n = this.context.getDomElement();
|
|
10302
|
-
this.pointer.copy(
|
|
10359
|
+
this.pointer.copy(uf(e, n));
|
|
10303
10360
|
let r = this.context.getRaycaster(), i = new W();
|
|
10304
10361
|
return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
|
|
10305
10362
|
}
|
|
@@ -10352,21 +10409,21 @@ var of = class extends Oe {
|
|
|
10352
10409
|
t && (this.context.clearHelpersHover(this), this.hasHelperPriority(e) && this.stopHelperPriorityEvent(e)), this.hovered !== t && this.setHovered(t);
|
|
10353
10410
|
}
|
|
10354
10411
|
setHovered(e) {
|
|
10355
|
-
this.hovered = e, this.material.color.set(e ?
|
|
10412
|
+
this.hovered = e, this.material.color.set(e ? Yd : qd), this.material.opacity = e ? Xd : Jd, this.material.needsUpdate = !0;
|
|
10356
10413
|
}
|
|
10357
10414
|
createPlaneMesh() {
|
|
10358
|
-
let e = new B(new
|
|
10415
|
+
let e = new B(new ne(), this.material);
|
|
10359
10416
|
return e.renderOrder = 2, e;
|
|
10360
10417
|
}
|
|
10361
10418
|
createBorder() {
|
|
10362
|
-
let e = new ve(new
|
|
10419
|
+
let e = new ve(new ne(), this.borderMaterial);
|
|
10363
10420
|
return e.renderOrder = 3, e;
|
|
10364
10421
|
}
|
|
10365
10422
|
replaceGeometry(e, t) {
|
|
10366
10423
|
e.geometry.dispose(), e.geometry = t;
|
|
10367
10424
|
}
|
|
10368
10425
|
createFillGeometry(e) {
|
|
10369
|
-
let t = new
|
|
10426
|
+
let t = new ne(), n = [];
|
|
10370
10427
|
if (e.length >= 3) {
|
|
10371
10428
|
let t = e[0];
|
|
10372
10429
|
for (let r = 1; r < e.length - 1; r++) {
|
|
@@ -10377,7 +10434,7 @@ var of = class extends Oe {
|
|
|
10377
10434
|
return t.setAttribute("position", new F(n, 3)), n.length && t.computeBoundingSphere(), t;
|
|
10378
10435
|
}
|
|
10379
10436
|
createBorderGeometry(e) {
|
|
10380
|
-
let t = new
|
|
10437
|
+
let t = new ne(), n = [];
|
|
10381
10438
|
if (e.length >= 2) for (let t = 0; t < e.length; t++) {
|
|
10382
10439
|
let r = e[t], i = e[(t + 1) % e.length];
|
|
10383
10440
|
n.push(r.x, r.y, 0, i.x, i.y, 0);
|
|
@@ -10428,12 +10485,12 @@ var of = class extends Oe {
|
|
|
10428
10485
|
getHelperLayout() {
|
|
10429
10486
|
let e = this.getModelWorldBox();
|
|
10430
10487
|
if (!e || e.isEmpty()) return {
|
|
10431
|
-
height:
|
|
10432
|
-
maxU:
|
|
10433
|
-
maxV:
|
|
10434
|
-
minU: -
|
|
10435
|
-
minV: -
|
|
10436
|
-
width:
|
|
10488
|
+
height: lf,
|
|
10489
|
+
maxU: lf / 2,
|
|
10490
|
+
maxV: lf / 2,
|
|
10491
|
+
minU: -lf / 2,
|
|
10492
|
+
minV: -lf / 2,
|
|
10493
|
+
width: lf
|
|
10437
10494
|
};
|
|
10438
10495
|
let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new W(), a = new W(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
|
|
10439
10496
|
if (r.forEach((e) => {
|
|
@@ -10441,14 +10498,14 @@ var of = class extends Oe {
|
|
|
10441
10498
|
let r = a.dot(t.u), u = a.dot(t.v);
|
|
10442
10499
|
o = Math.min(o, r), s = Math.max(s, r), c = Math.min(c, u), l = Math.max(l, u);
|
|
10443
10500
|
}), !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c) || !Number.isFinite(l)) return {
|
|
10444
|
-
height:
|
|
10445
|
-
maxU:
|
|
10446
|
-
maxV:
|
|
10447
|
-
minU: -
|
|
10448
|
-
minV: -
|
|
10449
|
-
width:
|
|
10501
|
+
height: lf,
|
|
10502
|
+
maxU: lf / 2,
|
|
10503
|
+
maxV: lf / 2,
|
|
10504
|
+
minU: -lf / 2,
|
|
10505
|
+
minV: -lf / 2,
|
|
10506
|
+
width: lf
|
|
10450
10507
|
};
|
|
10451
|
-
let u =
|
|
10508
|
+
let u = df(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(lf, f - d), g = Math.max(lf, m - p), _ = (d + f) / 2, v = (p + m) / 2;
|
|
10452
10509
|
return {
|
|
10453
10510
|
height: g,
|
|
10454
10511
|
maxU: _ + h / 2,
|
|
@@ -10470,7 +10527,7 @@ var of = class extends Oe {
|
|
|
10470
10527
|
this.helper.quaternion.setFromRotationMatrix(t);
|
|
10471
10528
|
}
|
|
10472
10529
|
getModelWorldBox() {
|
|
10473
|
-
let e = new
|
|
10530
|
+
let e = new j(), t = new j();
|
|
10474
10531
|
return this.context.getMeshes().forEach((n) => {
|
|
10475
10532
|
n.updateWorldMatrix(!0, !1), n.geometry.boundingBox || n.geometry.computeBoundingBox(), n.geometry.boundingBox && (t.copy(n.geometry.boundingBox).applyMatrix4(n.matrixWorld), e.union(t));
|
|
10476
10533
|
}), this.context.helpers.forEach((t) => {
|
|
@@ -10489,8 +10546,8 @@ var of = class extends Oe {
|
|
|
10489
10546
|
new W(e.max.x, e.max.y, e.max.z)
|
|
10490
10547
|
];
|
|
10491
10548
|
}
|
|
10492
|
-
},
|
|
10493
|
-
function
|
|
10549
|
+
}, pf = 250, mf = "#a9a9a9", hf = new W(0, 0, -1), gf = "__bimatterCameraMotionHidden";
|
|
10550
|
+
function _f(e, t) {
|
|
10494
10551
|
if (Array.isArray(e)) {
|
|
10495
10552
|
e.forEach((e) => {
|
|
10496
10553
|
e.clippingPlanes = t, e.needsUpdate = !0;
|
|
@@ -10499,13 +10556,13 @@ function df(e, t) {
|
|
|
10499
10556
|
}
|
|
10500
10557
|
e.clippingPlanes = t, e.needsUpdate = !0;
|
|
10501
10558
|
}
|
|
10502
|
-
function
|
|
10559
|
+
function vf(e) {
|
|
10503
10560
|
let t = [];
|
|
10504
10561
|
return e?.traverse((e) => {
|
|
10505
10562
|
e instanceof B && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
|
|
10506
10563
|
}), t;
|
|
10507
10564
|
}
|
|
10508
|
-
function
|
|
10565
|
+
function yf(e) {
|
|
10509
10566
|
let t = e;
|
|
10510
10567
|
for (; t;) {
|
|
10511
10568
|
let e = t.userData.modelID;
|
|
@@ -10514,14 +10571,14 @@ function pf(e) {
|
|
|
10514
10571
|
}
|
|
10515
10572
|
return 0;
|
|
10516
10573
|
}
|
|
10517
|
-
function
|
|
10574
|
+
function bf(e, t, n) {
|
|
10518
10575
|
let r = e;
|
|
10519
10576
|
r && (r.isClippingGroup = n, r.enabled = n && t.length > 0, r.clipIntersection = !1, r.clipShadows = !1, r.clippingPlanes = n ? t : []);
|
|
10520
10577
|
}
|
|
10521
|
-
function
|
|
10578
|
+
function xf(e, t) {
|
|
10522
10579
|
return t.clone().transformDirection(e.matrixWorld).normalize();
|
|
10523
10580
|
}
|
|
10524
|
-
function
|
|
10581
|
+
function Sf(e) {
|
|
10525
10582
|
if (!e) return null;
|
|
10526
10583
|
if ("x" in e) {
|
|
10527
10584
|
let t = new W(e.x, e.y, e.z);
|
|
@@ -10530,7 +10587,7 @@ function gf(e) {
|
|
|
10530
10587
|
let t = new W(e[0], e[1], e[2]);
|
|
10531
10588
|
return Number.isFinite(t.x + t.y + t.z) ? t : null;
|
|
10532
10589
|
}
|
|
10533
|
-
var
|
|
10590
|
+
var Cf = class {
|
|
10534
10591
|
planes = [];
|
|
10535
10592
|
caps = [];
|
|
10536
10593
|
edges = [];
|
|
@@ -10538,7 +10595,7 @@ var _f = class {
|
|
|
10538
10595
|
active = !1;
|
|
10539
10596
|
capsActive = !0;
|
|
10540
10597
|
capsCameraMotionActive = !1;
|
|
10541
|
-
capsColor =
|
|
10598
|
+
capsColor = mf;
|
|
10542
10599
|
context;
|
|
10543
10600
|
edgesActive = !0;
|
|
10544
10601
|
edgesCameraMotionActive = !1;
|
|
@@ -10595,13 +10652,13 @@ var _f = class {
|
|
|
10595
10652
|
return this.context.controlRef;
|
|
10596
10653
|
}
|
|
10597
10654
|
getMeshes() {
|
|
10598
|
-
return
|
|
10655
|
+
return vf(this.context.modelRef.current);
|
|
10599
10656
|
}
|
|
10600
10657
|
getPlanVisualObjects() {
|
|
10601
|
-
return [...this.caps.map((e) => e.getObject()).filter((e) => e.visible || e.userData[
|
|
10658
|
+
return [...this.caps.map((e) => e.getObject()).filter((e) => e.visible || e.userData[gf]), ...this.edges.flatMap((e) => e.getObjects(!0))];
|
|
10602
10659
|
}
|
|
10603
10660
|
getObjectModelID(e) {
|
|
10604
|
-
return
|
|
10661
|
+
return yf(e);
|
|
10605
10662
|
}
|
|
10606
10663
|
getEdgeSegmentsForPlane(e) {
|
|
10607
10664
|
return this.edgesActive ? this.edges.find((t) => t.plane === e && t.active)?.getIntersectionSegments() ?? null : null;
|
|
@@ -10640,12 +10697,12 @@ var _f = class {
|
|
|
10640
10697
|
if (this.capsCameraMotionActive !== e) {
|
|
10641
10698
|
if (this.capsCameraMotionActive = e, e) {
|
|
10642
10699
|
this.clearCapsDragIdleTimeout(), this.caps.forEach((e) => {
|
|
10643
|
-
e.getObject().userData[
|
|
10700
|
+
e.getObject().userData[gf] = !0, e.setVisible(!1);
|
|
10644
10701
|
}), this.context.onVisualChange?.();
|
|
10645
10702
|
return;
|
|
10646
10703
|
}
|
|
10647
10704
|
this.caps.forEach((e) => {
|
|
10648
|
-
delete e.getObject().userData[
|
|
10705
|
+
delete e.getObject().userData[gf], e.setVisible(this.active && this.capsActive && !this.capsDragActive);
|
|
10649
10706
|
}), this.context.onVisualChange?.();
|
|
10650
10707
|
}
|
|
10651
10708
|
}
|
|
@@ -10660,7 +10717,7 @@ var _f = class {
|
|
|
10660
10717
|
this.capsDragIdleTimeout = null, !(!this.active || !this.capsDragActive || this.capsCameraMotionActive) && (this.flushEdgesUpdate(), this.caps.forEach((e) => {
|
|
10661
10718
|
e.setVisible(!0), e.update();
|
|
10662
10719
|
}), this.updateCapsVisualState());
|
|
10663
|
-
},
|
|
10720
|
+
}, pf));
|
|
10664
10721
|
}
|
|
10665
10722
|
clearCapsDragIdleTimeout() {
|
|
10666
10723
|
this.capsDragIdleTimeout !== null && (window.clearTimeout(this.capsDragIdleTimeout), this.capsDragIdleTimeout = null);
|
|
@@ -10682,15 +10739,15 @@ var _f = class {
|
|
|
10682
10739
|
typeof this.helperHoverMoveState == "number" ? this.helperHoverMoveState += 1 : this.helperHoverMoveState === "start" && (this.helperHoverMoveState = 1);
|
|
10683
10740
|
};
|
|
10684
10741
|
getModelWorldBox() {
|
|
10685
|
-
let e = new
|
|
10742
|
+
let e = new j(), t = new j();
|
|
10686
10743
|
return this.getMeshes().forEach((n) => {
|
|
10687
10744
|
n.updateWorldMatrix(!0, !1), n.geometry.boundingBox || n.geometry.computeBoundingBox(), n.geometry.boundingBox && (t.copy(n.geometry.boundingBox).applyMatrix4(n.matrixWorld), e.union(t));
|
|
10688
10745
|
}), e.isEmpty() ? null : e;
|
|
10689
10746
|
}
|
|
10690
10747
|
getSelectedWorldBox() {
|
|
10691
|
-
let e = this.context.viewerStore.getState().selected, t = new
|
|
10748
|
+
let e = this.context.viewerStore.getState().selected, t = new j(), n = new W();
|
|
10692
10749
|
return this.getMeshes().forEach((r) => {
|
|
10693
|
-
let i = e[
|
|
10750
|
+
let i = e[yf(r)];
|
|
10694
10751
|
if (!i?.size) return;
|
|
10695
10752
|
let a = r.geometry.attributes.ids, o = r.geometry.attributes.position;
|
|
10696
10753
|
if (!a || !o) return;
|
|
@@ -10708,8 +10765,8 @@ var _f = class {
|
|
|
10708
10765
|
}
|
|
10709
10766
|
updateMaterials() {
|
|
10710
10767
|
let e = this.active ? this.planes : [];
|
|
10711
|
-
|
|
10712
|
-
|
|
10768
|
+
bf(this.context.modelRef.current, e, this.context.useWebGPU), this.getMeshes().forEach((t) => {
|
|
10769
|
+
_f(t.material, e);
|
|
10713
10770
|
}), this.context.camera.updateMatrixWorld();
|
|
10714
10771
|
}
|
|
10715
10772
|
setActive(e) {
|
|
@@ -10728,13 +10785,13 @@ var _f = class {
|
|
|
10728
10785
|
recursive: !1
|
|
10729
10786
|
});
|
|
10730
10787
|
if (!n?.face) return null;
|
|
10731
|
-
let r = n.point.clone(), i =
|
|
10788
|
+
let r = n.point.clone(), i = xf(n.object, n.face.normal);
|
|
10732
10789
|
r.add(i.clone().multiplyScalar(.001));
|
|
10733
10790
|
let a = new je().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
|
|
10734
10791
|
return this.addPlane(a, r, i), a.clone();
|
|
10735
10792
|
}
|
|
10736
10793
|
createPlaneFromPointAndNormal(e, t) {
|
|
10737
|
-
let n = typeof e == "number" ? this.getPointFromZ(e) :
|
|
10794
|
+
let n = typeof e == "number" ? this.getPointFromZ(e) : Sf(e), r = Sf(t ?? (typeof e == "number" ? hf : void 0));
|
|
10738
10795
|
if (!n || !r || r.lengthSq() === 0) return null;
|
|
10739
10796
|
r.normalize();
|
|
10740
10797
|
let i = new je().setFromNormalAndCoplanarPoint(r, n);
|
|
@@ -10743,7 +10800,7 @@ var _f = class {
|
|
|
10743
10800
|
createClippingRectangle(e = !1) {
|
|
10744
10801
|
let t = e ? this.getSelectedWorldBox() : this.getModelWorldBox();
|
|
10745
10802
|
if (!t) return [];
|
|
10746
|
-
let n =
|
|
10803
|
+
let n = df(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new W()), o = [
|
|
10747
10804
|
{
|
|
10748
10805
|
normal: new W(1, 0, 0),
|
|
10749
10806
|
point: new W(r.x, a.y, a.z)
|
|
@@ -10783,7 +10840,7 @@ var _f = class {
|
|
|
10783
10840
|
return new W(t?.x ?? 0, t?.y ?? 0, e);
|
|
10784
10841
|
}
|
|
10785
10842
|
addPlane(e, t, n) {
|
|
10786
|
-
if (this.active || this.setActive(!0), this.planes.push(e), new
|
|
10843
|
+
if (this.active || this.setActive(!0), this.planes.push(e), new ff(this, e, t, n), this.edgesActive) {
|
|
10787
10844
|
let t = new ul(this, e);
|
|
10788
10845
|
t.create(), t.update();
|
|
10789
10846
|
}
|
|
@@ -10842,9 +10899,9 @@ var _f = class {
|
|
|
10842
10899
|
this.clearCapsDragIdleTimeout(), this.deleteAllPlanes();
|
|
10843
10900
|
}
|
|
10844
10901
|
};
|
|
10845
|
-
function
|
|
10846
|
-
let a =
|
|
10847
|
-
u.current ||= new
|
|
10902
|
+
function wf(e, t, n, r = !1, i) {
|
|
10903
|
+
let a = O((e) => e.camera), o = O((e) => e.gl), s = O((e) => e.raycaster), c = O((e) => e.scene), l = Tt(), u = x(null);
|
|
10904
|
+
u.current ||= new Cf({
|
|
10848
10905
|
camera: a,
|
|
10849
10906
|
cameraUtils: n,
|
|
10850
10907
|
controlRef: t,
|
|
@@ -10925,15 +10982,15 @@ function vf(e, t, n, r = !1, i) {
|
|
|
10925
10982
|
}
|
|
10926
10983
|
//#endregion
|
|
10927
10984
|
//#region src/viewer/utils/Hotkeys/useHotkeysUtils.tsx
|
|
10928
|
-
function
|
|
10985
|
+
function Tf(e) {
|
|
10929
10986
|
return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement : !1;
|
|
10930
10987
|
}
|
|
10931
|
-
function
|
|
10988
|
+
function Ef(e = !0) {
|
|
10932
10989
|
let t = K((e) => e.api), n = K((e) => e.defaultHotkeysEnabled);
|
|
10933
10990
|
_(() => {
|
|
10934
10991
|
if (!e || !n) return;
|
|
10935
10992
|
let r = (e) => {
|
|
10936
|
-
|
|
10993
|
+
Tf(e.target) || (e.code === "KeyI" && t?.geometryUtils.isolateSelected(), e.code === "KeyH" && t?.geometryUtils.hideSelected(), e.code === "KeyC" && t?.geometryUtils.showAll(), e.code === "KeyP" && t?.clipping.createPlane(), e.code === "KeyM" && t?.dimensions.toggle(), e.code === "KeyN" && t?.notes.toggleNodeMode(), t?.notes.getNodeModeActive() && (e.code === "Digit1" && (e.preventDefault(), t.notes.createMarkupCloud()), e.code === "Digit2" && (e.preventDefault(), t.notes.createComment())));
|
|
10937
10994
|
};
|
|
10938
10995
|
return window.addEventListener("keydown", r), () => {
|
|
10939
10996
|
window.removeEventListener("keydown", r);
|
|
@@ -10946,8 +11003,8 @@ function bf(e = !0) {
|
|
|
10946
11003
|
}
|
|
10947
11004
|
//#endregion
|
|
10948
11005
|
//#region src/viewer/Selector/SelectionBox.ts
|
|
10949
|
-
var
|
|
10950
|
-
function
|
|
11006
|
+
var Df = new W(), Of = new W(), kf = new U(), Af = new W(), jf = new W(), Mf = new W(), Nf = new W(), Pf = new W(), Ff = new W(), If = new W();
|
|
11007
|
+
function Lf(e) {
|
|
10951
11008
|
let t = e;
|
|
10952
11009
|
for (; t;) {
|
|
10953
11010
|
let e = t.modelID ?? t.userData.modelID;
|
|
@@ -10956,7 +11013,7 @@ function jf(e) {
|
|
|
10956
11013
|
}
|
|
10957
11014
|
return 0;
|
|
10958
11015
|
}
|
|
10959
|
-
function
|
|
11016
|
+
function Rf(e) {
|
|
10960
11017
|
let t = e;
|
|
10961
11018
|
for (; t;) {
|
|
10962
11019
|
if (!t.visible) return !1;
|
|
@@ -10964,16 +11021,16 @@ function Mf(e) {
|
|
|
10964
11021
|
}
|
|
10965
11022
|
return !0;
|
|
10966
11023
|
}
|
|
10967
|
-
function
|
|
10968
|
-
return n.length ? (
|
|
11024
|
+
function zf(e, t, n) {
|
|
11025
|
+
return n.length ? (Af.copy(t).applyMatrix4(e.matrixWorld), Rs(Af, n)) : !0;
|
|
10969
11026
|
}
|
|
10970
|
-
function
|
|
10971
|
-
return i.length ? (
|
|
10972
|
-
let t = e.distanceToPoint(
|
|
11027
|
+
function Bf(e, t, n, r, i) {
|
|
11028
|
+
return i.length ? (jf.copy(t).applyMatrix4(e.matrixWorld), Mf.copy(n).applyMatrix4(e.matrixWorld), Nf.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
|
|
11029
|
+
let t = e.distanceToPoint(jf), n = e.distanceToPoint(Mf), r = e.distanceToPoint(Nf);
|
|
10973
11030
|
return !(t < -1e-6 && n < -1e-6 && r < -1e-6);
|
|
10974
11031
|
})) : !0;
|
|
10975
11032
|
}
|
|
10976
|
-
function
|
|
11033
|
+
function Vf(e) {
|
|
10977
11034
|
let t = e.getBoundingClientRect();
|
|
10978
11035
|
return {
|
|
10979
11036
|
height: t.height,
|
|
@@ -10982,7 +11039,7 @@ function Ff(e) {
|
|
|
10982
11039
|
width: t.width
|
|
10983
11040
|
};
|
|
10984
11041
|
}
|
|
10985
|
-
function
|
|
11042
|
+
function Hf(e) {
|
|
10986
11043
|
return {
|
|
10987
11044
|
boundsCheckMs: 0,
|
|
10988
11045
|
candidateIds: 0,
|
|
@@ -11008,7 +11065,7 @@ function If(e) {
|
|
|
11008
11065
|
triangleProjectionMs: 0
|
|
11009
11066
|
};
|
|
11010
11067
|
}
|
|
11011
|
-
function
|
|
11068
|
+
function Uf(e, t) {
|
|
11012
11069
|
return {
|
|
11013
11070
|
minX: Math.min(e.x, t.x),
|
|
11014
11071
|
minY: Math.min(e.y, t.y),
|
|
@@ -11016,43 +11073,43 @@ function Lf(e, t) {
|
|
|
11016
11073
|
maxY: Math.max(e.y, t.y)
|
|
11017
11074
|
};
|
|
11018
11075
|
}
|
|
11019
|
-
function
|
|
11076
|
+
function Wf(e, t) {
|
|
11020
11077
|
return t.x >= e.x ? "contains" : "intersects";
|
|
11021
11078
|
}
|
|
11022
|
-
function
|
|
11023
|
-
return
|
|
11079
|
+
function Gf(e, t) {
|
|
11080
|
+
return Kf(e.x, e.y, t);
|
|
11024
11081
|
}
|
|
11025
|
-
function
|
|
11082
|
+
function Kf(e, t, n) {
|
|
11026
11083
|
return e >= n.minX && e <= n.maxX && t >= n.minY && t <= n.maxY;
|
|
11027
11084
|
}
|
|
11028
|
-
function
|
|
11085
|
+
function qf(e, t, n, r, i, a) {
|
|
11029
11086
|
return (a - t) * (n - e) > (r - t) * (i - e);
|
|
11030
11087
|
}
|
|
11031
|
-
function
|
|
11032
|
-
return
|
|
11088
|
+
function Jf(e, t, n, r, i, a, o, s) {
|
|
11089
|
+
return qf(e, t, i, a, o, s) !== qf(n, r, i, a, o, s) && qf(e, t, n, r, i, a) !== qf(e, t, n, r, o, s);
|
|
11033
11090
|
}
|
|
11034
|
-
function
|
|
11091
|
+
function Yf(e, t, n, r, i) {
|
|
11035
11092
|
let a = .5 * (-r.y * i.x + n.y * (-r.x + i.x) + n.x * (r.y - i.y) + r.x * i.y), o = a < 0 ? -1 : 1, s = (n.y * i.x - n.x * i.y + (i.y - n.y) * e + (n.x - i.x) * t) * o, c = (n.x * r.y - n.y * r.x + (n.y - r.y) * e + (r.x - n.x) * t) * o;
|
|
11036
11093
|
return s >= 0 && c >= 0 && s + c <= 2 * a * o;
|
|
11037
11094
|
}
|
|
11038
|
-
function
|
|
11039
|
-
return
|
|
11095
|
+
function Xf(e, t, n, r) {
|
|
11096
|
+
return Gf(e, r) || Gf(t, r) || Gf(n, r) || Yf(r.minX, r.minY, e, t, n) || Yf(r.maxX, r.minY, e, t, n) || Yf(r.maxX, r.maxY, e, t, n) || Yf(r.minX, r.maxY, e, t, n) ? !0 : Zf(e, t, r) || Zf(t, n, r) || Zf(n, e, r);
|
|
11040
11097
|
}
|
|
11041
|
-
function
|
|
11042
|
-
return
|
|
11098
|
+
function Zf(e, t, n) {
|
|
11099
|
+
return Jf(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || Jf(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || Jf(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || Jf(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
|
|
11043
11100
|
}
|
|
11044
|
-
function
|
|
11045
|
-
let a =
|
|
11101
|
+
function Qf(e, t, n, r, i = new U()) {
|
|
11102
|
+
let a = Df.copy(t).applyMatrix4(e.matrixWorld).project(n);
|
|
11046
11103
|
return i.set((a.x + 1) / 2 * r.width + r.left, (-a.y + 1) / 2 * r.height + r.top);
|
|
11047
11104
|
}
|
|
11048
|
-
function
|
|
11105
|
+
function $f(e, t, n, r, i) {
|
|
11049
11106
|
let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
|
|
11050
|
-
for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++)
|
|
11107
|
+
for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) Of.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), Qf(e, Of, r, i, kf), a = Math.min(a, kf.x), o = Math.max(o, kf.x), s = Math.min(s, kf.y), c = Math.max(c, kf.y), Gf(kf, n) && (l += 1);
|
|
11051
11108
|
return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? ft : l === 8 ? lt : ut;
|
|
11052
11109
|
}
|
|
11053
|
-
function
|
|
11110
|
+
function ep(e, t, n, r) {
|
|
11054
11111
|
let i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
|
|
11055
|
-
for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++)
|
|
11112
|
+
for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) Of.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), Qf(e, Of, n, r, kf), i = Math.min(i, kf.x), a = Math.max(a, kf.x), o = Math.min(o, kf.y), s = Math.max(s, kf.y);
|
|
11056
11113
|
return {
|
|
11057
11114
|
minX: i,
|
|
11058
11115
|
minY: o,
|
|
@@ -11060,41 +11117,41 @@ function Jf(e, t, n, r) {
|
|
|
11060
11117
|
maxY: s
|
|
11061
11118
|
};
|
|
11062
11119
|
}
|
|
11063
|
-
function
|
|
11120
|
+
function tp(e, t) {
|
|
11064
11121
|
return !(e.maxX < t.minX || e.minX > t.maxX || e.maxY < t.minY || e.minY > t.maxY);
|
|
11065
11122
|
}
|
|
11066
|
-
function
|
|
11123
|
+
function np(e, t, n, r) {
|
|
11067
11124
|
e.geometry.boundingBox || e.geometry.computeBoundingBox();
|
|
11068
11125
|
let i = e.geometry.boundingBox;
|
|
11069
|
-
return i ?
|
|
11126
|
+
return i ? tp(ep(e, i, n, r), t) : !0;
|
|
11070
11127
|
}
|
|
11071
|
-
function
|
|
11128
|
+
function rp(e, t, n) {
|
|
11072
11129
|
let r = e.get(t);
|
|
11073
11130
|
r || (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
|
|
11074
11131
|
}
|
|
11075
|
-
function
|
|
11132
|
+
function ip(e) {
|
|
11076
11133
|
let t = 0;
|
|
11077
11134
|
return e.forEach((e) => {
|
|
11078
11135
|
t += e.size;
|
|
11079
11136
|
}), t;
|
|
11080
11137
|
}
|
|
11081
|
-
function
|
|
11138
|
+
function ap(e, t, n, r = []) {
|
|
11082
11139
|
let i = e.geometry, a = i.index, o = i.attributes.ids, s = i.attributes.position;
|
|
11083
11140
|
if (!a || !o || !s) return;
|
|
11084
11141
|
let c = t * 3;
|
|
11085
|
-
r.length && (
|
|
11142
|
+
r.length && (Pf.fromBufferAttribute(s, a.getX(c)), Ff.fromBufferAttribute(s, a.getX(c + 1)), If.fromBufferAttribute(s, a.getX(c + 2)), !Bf(e, Pf, Ff, If, r)) || rp(n, Lf(e), o.getX(a.getX(c)));
|
|
11086
11143
|
}
|
|
11087
|
-
function
|
|
11144
|
+
function op({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
|
|
11088
11145
|
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new W();
|
|
11089
11146
|
e.traverse((e) => {
|
|
11090
11147
|
let s = e;
|
|
11091
|
-
if (!s.isMesh || !
|
|
11148
|
+
if (!s.isMesh || !Rf(s)) return;
|
|
11092
11149
|
let u = s.geometry.attributes.ids, d = s.geometry.attributes.position;
|
|
11093
11150
|
if (!(!u || !d)) {
|
|
11094
11151
|
o && (o.containedVerticesVisited += u.count);
|
|
11095
11152
|
for (let e = 0; e < u.count; e++) {
|
|
11096
|
-
let f =
|
|
11097
|
-
if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !
|
|
11153
|
+
let f = Lf(s), p = u.getX(e);
|
|
11154
|
+
if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !zf(s, l, a))) continue;
|
|
11098
11155
|
o && (o.containedCandidateVertices += 1);
|
|
11099
11156
|
let m = `${f}:${p}`, h = c.get(m);
|
|
11100
11157
|
h || (h = {
|
|
@@ -11102,23 +11159,23 @@ function ep({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i,
|
|
|
11102
11159
|
inside: 0,
|
|
11103
11160
|
modelID: f,
|
|
11104
11161
|
total: 0
|
|
11105
|
-
}, c.set(m, h)), h.total += 1,
|
|
11162
|
+
}, c.set(m, h)), h.total += 1, Gf(Qf(s, l, t, n), r) && (h.inside += 1);
|
|
11106
11163
|
}
|
|
11107
11164
|
}
|
|
11108
11165
|
});
|
|
11109
11166
|
let u = /* @__PURE__ */ new Map();
|
|
11110
11167
|
return c.forEach((e) => {
|
|
11111
|
-
e.total > 0 && e.total === e.inside &&
|
|
11168
|
+
e.total > 0 && e.total === e.inside && rp(u, e.modelID, e.id);
|
|
11112
11169
|
}), o && (o.containedIdsMs += performance.now() - s), u;
|
|
11113
11170
|
}
|
|
11114
|
-
function
|
|
11171
|
+
function sp({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
|
|
11115
11172
|
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
11116
11173
|
if (!e) return c;
|
|
11117
|
-
let u =
|
|
11174
|
+
let u = Vf(r), d = performance.now();
|
|
11118
11175
|
e.updateMatrixWorld(!0), t.updateMatrixWorld(), o && (o.matrixUpdateMs += performance.now() - d), e.traverse((e) => {
|
|
11119
11176
|
let r = e;
|
|
11120
11177
|
if (!r.isMesh) return;
|
|
11121
|
-
if (o && (o.meshCount += 1), !
|
|
11178
|
+
if (o && (o.meshCount += 1), !Rf(r)) {
|
|
11122
11179
|
o && (o.skippedMeshCount += 1);
|
|
11123
11180
|
return;
|
|
11124
11181
|
}
|
|
@@ -11127,7 +11184,7 @@ function tp({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
11127
11184
|
o && (o.skippedMeshCount += 1);
|
|
11128
11185
|
return;
|
|
11129
11186
|
}
|
|
11130
|
-
let d = performance.now(), f =
|
|
11187
|
+
let d = performance.now(), f = np(r, i, t, u);
|
|
11131
11188
|
if (o && (o.boundsCheckMs += performance.now() - d), !f) {
|
|
11132
11189
|
o && (o.skippedMeshCount += 1);
|
|
11133
11190
|
return;
|
|
@@ -11135,26 +11192,26 @@ function tp({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
11135
11192
|
let p = performance.now();
|
|
11136
11193
|
s.shapecast({
|
|
11137
11194
|
intersectsBounds: (e) => {
|
|
11138
|
-
let n = performance.now(), a =
|
|
11195
|
+
let n = performance.now(), a = $f(r, e, i, t, u);
|
|
11139
11196
|
return o && (o.intersectsBoundsCalls += 1, o.intersectsBoundsMs += performance.now() - n), a;
|
|
11140
11197
|
},
|
|
11141
11198
|
intersectsRange: (e, t, i) => {
|
|
11142
11199
|
let u = performance.now();
|
|
11143
11200
|
if (o && (o.intersectsRangeCalls += 1), !i) return o && (o.intersectsRangeMs += performance.now() - u), !1;
|
|
11144
|
-
for (let i = e; i < e + t; i++)
|
|
11201
|
+
for (let i = e; i < e + t; i++) ap(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
|
|
11145
11202
|
return o && (o.intersectsRangeMs += performance.now() - u), !1;
|
|
11146
11203
|
},
|
|
11147
11204
|
intersectsTriangle: (e, s, d) => {
|
|
11148
11205
|
let f = performance.now();
|
|
11149
11206
|
if (o && (o.intersectsTriangleCalls += 1), !d) {
|
|
11150
|
-
let n = performance.now(), a =
|
|
11151
|
-
if (o && (o.triangleProjectionMs += performance.now() - n), !
|
|
11207
|
+
let n = performance.now(), a = Qf(r, e.a, t, u), s = Qf(r, e.b, t, u), c = Qf(r, e.c, t, u);
|
|
11208
|
+
if (o && (o.triangleProjectionMs += performance.now() - n), !Xf(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
|
|
11152
11209
|
}
|
|
11153
|
-
return a === "contains" ?
|
|
11210
|
+
return a === "contains" ? ap(r, s, l, n) : ap(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
|
|
11154
11211
|
}
|
|
11155
11212
|
}), o && (o.shapecastMs += performance.now() - p);
|
|
11156
11213
|
});
|
|
11157
|
-
let f = a === "contains" ?
|
|
11214
|
+
let f = a === "contains" ? op({
|
|
11158
11215
|
model: e,
|
|
11159
11216
|
camera: t,
|
|
11160
11217
|
clippingPlanes: n,
|
|
@@ -11163,19 +11220,19 @@ function tp({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
11163
11220
|
candidateIdsByModel: l,
|
|
11164
11221
|
profile: o
|
|
11165
11222
|
}) : c;
|
|
11166
|
-
return o && (o.candidateIds =
|
|
11223
|
+
return o && (o.candidateIds = ip(l), o.selectedIds = ip(f), o.totalMs = performance.now() - s), f;
|
|
11167
11224
|
}
|
|
11168
|
-
function
|
|
11169
|
-
let t =
|
|
11225
|
+
function cp(e) {
|
|
11226
|
+
let t = Hf(e.mode);
|
|
11170
11227
|
return {
|
|
11171
|
-
ids:
|
|
11228
|
+
ids: sp({
|
|
11172
11229
|
...e,
|
|
11173
11230
|
profile: t
|
|
11174
11231
|
}),
|
|
11175
11232
|
profile: t
|
|
11176
11233
|
};
|
|
11177
11234
|
}
|
|
11178
|
-
function
|
|
11235
|
+
function lp(e) {
|
|
11179
11236
|
return e === "contains" ? {
|
|
11180
11237
|
border: "rgb(37, 99, 235)",
|
|
11181
11238
|
background: "rgba(37, 99, 235, 0.16)"
|
|
@@ -11184,40 +11241,40 @@ function rp(e) {
|
|
|
11184
11241
|
background: "rgba(22, 163, 74, 0.16)"
|
|
11185
11242
|
};
|
|
11186
11243
|
}
|
|
11187
|
-
function
|
|
11188
|
-
let r =
|
|
11244
|
+
function up(e, t, n) {
|
|
11245
|
+
let r = lp(Wf(t, n));
|
|
11189
11246
|
if (!e.current) {
|
|
11190
11247
|
let t = document.createElement("div");
|
|
11191
11248
|
t.style.position = "fixed", t.style.pointerEvents = "none", t.style.zIndex = "10", e.current = t, document.body.appendChild(t);
|
|
11192
11249
|
}
|
|
11193
|
-
let i =
|
|
11250
|
+
let i = Uf(t, n);
|
|
11194
11251
|
e.current.style.border = `1px solid ${r.border}`, e.current.style.background = r.background, e.current.style.left = `${i.minX}px`, e.current.style.top = `${i.minY}px`, e.current.style.width = `${i.maxX - i.minX}px`, e.current.style.height = `${i.maxY - i.minY}px`;
|
|
11195
11252
|
}
|
|
11196
|
-
function
|
|
11253
|
+
function dp(e) {
|
|
11197
11254
|
e.current?.remove(), e.current = null;
|
|
11198
11255
|
}
|
|
11199
11256
|
//#endregion
|
|
11200
11257
|
//#region src/viewer/Selector/useSelector.tsx
|
|
11201
|
-
var
|
|
11202
|
-
function
|
|
11203
|
-
if (Array.isArray(e)) return e.flatMap((e) =>
|
|
11258
|
+
var fp = 40;
|
|
11259
|
+
function pp(e) {
|
|
11260
|
+
if (Array.isArray(e)) return e.flatMap((e) => pp(e));
|
|
11204
11261
|
let t = e.userData;
|
|
11205
11262
|
return t.shaders ? Array.from(t.shaders) : t.shader ? [t.shader] : [];
|
|
11206
11263
|
}
|
|
11207
|
-
function
|
|
11264
|
+
function mp(e) {
|
|
11208
11265
|
let t = x(e);
|
|
11209
11266
|
return t.current = e, t;
|
|
11210
11267
|
}
|
|
11211
|
-
function
|
|
11212
|
-
|
|
11268
|
+
function hp(e, t) {
|
|
11269
|
+
pp(e)?.forEach((e) => {
|
|
11213
11270
|
let n = e.uniforms.preSelectionId;
|
|
11214
11271
|
n && (n.value = t);
|
|
11215
11272
|
});
|
|
11216
11273
|
}
|
|
11217
|
-
function
|
|
11274
|
+
function gp(e) {
|
|
11218
11275
|
return Number(e.current?.modelID ?? 0);
|
|
11219
11276
|
}
|
|
11220
|
-
function
|
|
11277
|
+
function _p(e) {
|
|
11221
11278
|
let t = e;
|
|
11222
11279
|
for (; t;) {
|
|
11223
11280
|
let e = t.modelID ?? t.userData.modelID;
|
|
@@ -11226,7 +11283,7 @@ function dp(e) {
|
|
|
11226
11283
|
}
|
|
11227
11284
|
return 0;
|
|
11228
11285
|
}
|
|
11229
|
-
function
|
|
11286
|
+
function vp(e) {
|
|
11230
11287
|
let t = e;
|
|
11231
11288
|
for (; t;) {
|
|
11232
11289
|
if (!t.visible) return !1;
|
|
@@ -11234,7 +11291,7 @@ function fp(e) {
|
|
|
11234
11291
|
}
|
|
11235
11292
|
return !0;
|
|
11236
11293
|
}
|
|
11237
|
-
function
|
|
11294
|
+
function yp(e) {
|
|
11238
11295
|
if (!e) return "";
|
|
11239
11296
|
let t = [
|
|
11240
11297
|
e.uuid,
|
|
@@ -11247,85 +11304,85 @@ function pp(e) {
|
|
|
11247
11304
|
});
|
|
11248
11305
|
}), t.join(":");
|
|
11249
11306
|
}
|
|
11250
|
-
function
|
|
11251
|
-
if (!
|
|
11307
|
+
function bp(e) {
|
|
11308
|
+
if (!vp(e.object) || !(e.object instanceof B) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
|
|
11252
11309
|
let t = e.object.geometry;
|
|
11253
11310
|
return !!(t.index && t.attributes.ids);
|
|
11254
11311
|
}
|
|
11255
|
-
function
|
|
11256
|
-
if (!
|
|
11312
|
+
function xp(e) {
|
|
11313
|
+
if (!bp(e)) return null;
|
|
11257
11314
|
let t = e.object, n = t.geometry, r = n.index.getX(e.faceIndex * 3), i = n.attributes.ids;
|
|
11258
11315
|
if (r >= i.count) return null;
|
|
11259
11316
|
let a = n.attributes.modelID;
|
|
11260
11317
|
return {
|
|
11261
11318
|
elementID: i.getX(r),
|
|
11262
11319
|
hit: e,
|
|
11263
|
-
modelID: a ? a.getX(r) :
|
|
11320
|
+
modelID: a ? a.getX(r) : _p(t)
|
|
11264
11321
|
};
|
|
11265
11322
|
}
|
|
11266
|
-
function
|
|
11267
|
-
let c = x("end"), l = K((e) => e.selected), u = K((e) => e.setSelected), d = K((e) => e.addSelected), f = K((e) => e.removeSelected), p = K((e) => e.showStats), m = K((e) => e.preselectionEnabled), h =
|
|
11323
|
+
function Sp(e, t, n, r, i, a, o, s = 0) {
|
|
11324
|
+
let c = x("end"), l = K((e) => e.selected), u = K((e) => e.setSelected), d = K((e) => e.addSelected), f = K((e) => e.removeSelected), p = K((e) => e.showStats), m = K((e) => e.preselectionEnabled), h = mp(m), g = Tt(), v = x(null), y = x(null), b = x(!1), S = x(!1), C = x("add"), w = x(null), T = x(!1), E = x(0), D = x(null), k = x(null), ee = x(null), A = x(m), j = x({
|
|
11268
11325
|
meshesByModel: /* @__PURE__ */ new Map(),
|
|
11269
11326
|
root: null,
|
|
11270
11327
|
version: ""
|
|
11271
|
-
}),
|
|
11272
|
-
|
|
11273
|
-
},
|
|
11328
|
+
}), te = () => g.getState().selectionInteractionDisabled, M = () => h.current && (o?.() ?? !0), ne = () => c.current !== "end", re = () => {
|
|
11329
|
+
k.current = null, D.current !== null && (window.clearTimeout(D.current), D.current = null);
|
|
11330
|
+
}, ie = (e) => {
|
|
11274
11331
|
if (r) {
|
|
11275
11332
|
r(e);
|
|
11276
11333
|
return;
|
|
11277
11334
|
}
|
|
11278
11335
|
let n = t.current;
|
|
11279
11336
|
n && (n.cancel(), n.setOrbitPoint(e.x, e.y, e.z));
|
|
11280
|
-
},
|
|
11281
|
-
let t = e.current, n =
|
|
11337
|
+
}, N = () => {
|
|
11338
|
+
let t = e.current, n = yp(t), r = j.current;
|
|
11282
11339
|
if (r.root !== t || r.version !== n) {
|
|
11283
11340
|
let e = /* @__PURE__ */ new Map();
|
|
11284
11341
|
return t?.traverse((t) => {
|
|
11285
11342
|
if (!(t instanceof B) || !t.geometry.index || !t.geometry.attributes.ids) return;
|
|
11286
|
-
let n =
|
|
11343
|
+
let n = _p(t), r = e.get(n) ?? [];
|
|
11287
11344
|
r.push(t), e.set(n, r);
|
|
11288
|
-
}),
|
|
11345
|
+
}), j.current = {
|
|
11289
11346
|
meshesByModel: e,
|
|
11290
11347
|
root: t,
|
|
11291
11348
|
version: n
|
|
11292
|
-
},
|
|
11349
|
+
}, j.current;
|
|
11293
11350
|
}
|
|
11294
11351
|
return r;
|
|
11295
|
-
},
|
|
11352
|
+
}, ae = () => Array.from(N().meshesByModel.values()).flat(), oe = (e) => N().meshesByModel.get(e) ?? [], se = (e) => {
|
|
11296
11353
|
e && oe(e.modelID).forEach((e) => {
|
|
11297
|
-
e.preselected = !1,
|
|
11354
|
+
e.preselected = !1, hp(e.material, -1);
|
|
11298
11355
|
});
|
|
11299
11356
|
}, ce = () => {
|
|
11300
|
-
a?.(null), se(
|
|
11357
|
+
a?.(null), se(ee.current), ee.current = null;
|
|
11301
11358
|
};
|
|
11302
11359
|
_(() => {
|
|
11303
|
-
let e =
|
|
11304
|
-
|
|
11360
|
+
let e = A.current;
|
|
11361
|
+
A.current = m, !(!e || m) && (re(), ce());
|
|
11305
11362
|
}, [m]);
|
|
11306
11363
|
let le = (e, t) => {
|
|
11307
|
-
let n =
|
|
11364
|
+
let n = ee.current;
|
|
11308
11365
|
n?.modelID === e && n.elementID === t || (se(n), a?.({
|
|
11309
11366
|
elementID: t,
|
|
11310
11367
|
modelID: e
|
|
11311
11368
|
}), oe(e).forEach((e) => {
|
|
11312
|
-
e.preselected = !0,
|
|
11313
|
-
}),
|
|
11369
|
+
e.preselected = !0, hp(e.material, t);
|
|
11370
|
+
}), ee.current = {
|
|
11314
11371
|
elementID: t,
|
|
11315
11372
|
modelID: e
|
|
11316
11373
|
});
|
|
11317
11374
|
}, ue = () => {
|
|
11318
|
-
v.current = null, b.current = !1,
|
|
11375
|
+
v.current = null, b.current = !1, dp(y), t.current && (t.current.enabled = !0);
|
|
11319
11376
|
}, P = (e) => {
|
|
11320
|
-
if (
|
|
11321
|
-
|
|
11377
|
+
if (ne()) {
|
|
11378
|
+
re(), ce();
|
|
11322
11379
|
return;
|
|
11323
11380
|
}
|
|
11324
|
-
if (!
|
|
11381
|
+
if (!M()) {
|
|
11325
11382
|
ce();
|
|
11326
11383
|
return;
|
|
11327
11384
|
}
|
|
11328
|
-
if (
|
|
11385
|
+
if (te()) {
|
|
11329
11386
|
ce();
|
|
11330
11387
|
return;
|
|
11331
11388
|
}
|
|
@@ -11344,24 +11401,24 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11344
11401
|
return performance.now();
|
|
11345
11402
|
}
|
|
11346
11403
|
let F = (e) => {
|
|
11347
|
-
if (
|
|
11348
|
-
|
|
11404
|
+
if (ne()) {
|
|
11405
|
+
re(), ce();
|
|
11349
11406
|
return;
|
|
11350
11407
|
}
|
|
11351
|
-
if (!
|
|
11352
|
-
|
|
11408
|
+
if (!M()) {
|
|
11409
|
+
re(), ce();
|
|
11353
11410
|
return;
|
|
11354
11411
|
}
|
|
11355
|
-
if (
|
|
11356
|
-
|
|
11412
|
+
if (te()) {
|
|
11413
|
+
re(), ce();
|
|
11357
11414
|
return;
|
|
11358
11415
|
}
|
|
11359
|
-
if (
|
|
11360
|
-
let t = de() -
|
|
11361
|
-
|
|
11362
|
-
|
|
11363
|
-
let e =
|
|
11364
|
-
|
|
11416
|
+
if (k.current = e, D.current !== null) return;
|
|
11417
|
+
let t = de() - E.current, n = Math.max(0, fp - t);
|
|
11418
|
+
D.current = window.setTimeout(() => {
|
|
11419
|
+
D.current = null;
|
|
11420
|
+
let e = k.current;
|
|
11421
|
+
k.current = null, e && (E.current = performance.now(), P(e));
|
|
11365
11422
|
}, n);
|
|
11366
11423
|
}, I = x(null);
|
|
11367
11424
|
_(() => {
|
|
@@ -11372,7 +11429,7 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11372
11429
|
}
|
|
11373
11430
|
p && I.current !== null && (console.log("selection spend:", Date.now() - I.current, "ms"), I.current = null);
|
|
11374
11431
|
}, [l, p]);
|
|
11375
|
-
let { camera: fe, gl: L } =
|
|
11432
|
+
let { camera: fe, gl: L } = O();
|
|
11376
11433
|
function pe() {
|
|
11377
11434
|
return Date.now();
|
|
11378
11435
|
}
|
|
@@ -11380,12 +11437,12 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11380
11437
|
let t = L.domElement.getBoundingClientRect();
|
|
11381
11438
|
return e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom;
|
|
11382
11439
|
}, he = (t) => {
|
|
11383
|
-
if (
|
|
11384
|
-
|
|
11440
|
+
if (te()) {
|
|
11441
|
+
T.current = !1, S.current = !1, ce();
|
|
11385
11442
|
return;
|
|
11386
11443
|
}
|
|
11387
|
-
if (!
|
|
11388
|
-
if (
|
|
11444
|
+
if (!T.current) return;
|
|
11445
|
+
if (T.current = !1, S.current) {
|
|
11389
11446
|
S.current = !1;
|
|
11390
11447
|
return;
|
|
11391
11448
|
}
|
|
@@ -11394,38 +11451,38 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11394
11451
|
c.current = "end";
|
|
11395
11452
|
return;
|
|
11396
11453
|
}
|
|
11397
|
-
let n = t.shiftKey, r = t.ctrlKey, i = xe(t), a, o =
|
|
11454
|
+
let n = t.shiftKey, r = t.ctrlKey, i = xe(t), a, o = gp(e), s = null;
|
|
11398
11455
|
if (i && (o = i.modelID, s = i.hit.point, a = i.elementID), r) {
|
|
11399
11456
|
a !== void 0 && f(o, [a]);
|
|
11400
11457
|
return;
|
|
11401
11458
|
} else if (n) {
|
|
11402
|
-
a !== void 0 && (l[o]?.has(a) ?? !1 ? f(o, [a]) : (d(o, [a]), s &&
|
|
11459
|
+
a !== void 0 && (l[o]?.has(a) ?? !1 ? f(o, [a]) : (d(o, [a]), s && ie(s)));
|
|
11403
11460
|
return;
|
|
11404
11461
|
}
|
|
11405
|
-
u(o, a === void 0 ? [] : [a], !0), s &&
|
|
11462
|
+
u(o, a === void 0 ? [] : [a], !0), s && ie(s);
|
|
11406
11463
|
}, ge = (e) => {
|
|
11407
|
-
|
|
11464
|
+
te() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (v.current = new U(e.clientX, e.clientY), C.current = e.ctrlKey ? "remove" : "add", b.current = !1, t.current && (t.current.enabled = !1));
|
|
11408
11465
|
}, _e = (e) => {
|
|
11409
|
-
if (
|
|
11466
|
+
if (te()) {
|
|
11410
11467
|
ue();
|
|
11411
11468
|
return;
|
|
11412
11469
|
}
|
|
11413
11470
|
if (!v.current) return;
|
|
11414
11471
|
let t = new U(e.clientX, e.clientY), n = Math.abs(t.x - v.current.x), r = Math.abs(t.y - v.current.y);
|
|
11415
|
-
n < 6 && r < 6 || (b.current ||= !0, e.preventDefault(),
|
|
11472
|
+
n < 6 && r < 6 || (b.current ||= !0, e.preventDefault(), up(y, v.current, t));
|
|
11416
11473
|
}, ve = (r) => {
|
|
11417
|
-
if (
|
|
11474
|
+
if (te()) {
|
|
11418
11475
|
ue();
|
|
11419
11476
|
return;
|
|
11420
11477
|
}
|
|
11421
11478
|
if (!v.current) return;
|
|
11422
11479
|
I.current = pe();
|
|
11423
|
-
let i = b.current, a = new U(r.clientX, r.clientY), o =
|
|
11424
|
-
if (v.current = null, b.current = !1,
|
|
11480
|
+
let i = b.current, a = new U(r.clientX, r.clientY), o = Uf(v.current, a), s = Wf(v.current, a);
|
|
11481
|
+
if (v.current = null, b.current = !1, dp(y), t.current && setTimeout(() => {
|
|
11425
11482
|
t.current && (t.current.enabled = !0);
|
|
11426
11483
|
}, 100), !i) return;
|
|
11427
11484
|
S.current = !0, r.preventDefault();
|
|
11428
|
-
let { ids: c, profile: l } =
|
|
11485
|
+
let { ids: c, profile: l } = cp({
|
|
11429
11486
|
model: e.current,
|
|
11430
11487
|
camera: fe,
|
|
11431
11488
|
clippingPlanes: n.getActiveClippingPlanes(),
|
|
@@ -11445,7 +11502,7 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11445
11502
|
let i = Array.isArray(t) ? t.filter((e) => e.visible) : t ? [t] : [];
|
|
11446
11503
|
return i.length ? n.getIntersection(!1, {
|
|
11447
11504
|
event: e,
|
|
11448
|
-
filter:
|
|
11505
|
+
filter: bp,
|
|
11449
11506
|
firstHitOnly: r,
|
|
11450
11507
|
object: i,
|
|
11451
11508
|
recursive: !0
|
|
@@ -11453,11 +11510,11 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11453
11510
|
}, ye = () => i?.().filter((e) => e.visible) ?? [], be = (e, t) => {
|
|
11454
11511
|
let n = R(e, t, !0);
|
|
11455
11512
|
for (let e of n) {
|
|
11456
|
-
let t =
|
|
11513
|
+
let t = xp(e);
|
|
11457
11514
|
if (t) return t;
|
|
11458
11515
|
}
|
|
11459
11516
|
return null;
|
|
11460
|
-
}, xe = (e) => be(e, ye()) || be(e,
|
|
11517
|
+
}, xe = (e) => be(e, ye()) || be(e, ae()), z = mp({
|
|
11461
11518
|
clearPreselection: ce,
|
|
11462
11519
|
onBoxPointerDown: ge,
|
|
11463
11520
|
onBoxPointerMove: _e,
|
|
@@ -11472,10 +11529,10 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11472
11529
|
typeof c.current == "number" ? c.current += 1 : c.current === "start" && (c.current = 1);
|
|
11473
11530
|
}
|
|
11474
11531
|
function d() {
|
|
11475
|
-
c.current = "start",
|
|
11532
|
+
c.current = "start", re(), ce();
|
|
11476
11533
|
}
|
|
11477
11534
|
function f(e) {
|
|
11478
|
-
|
|
11535
|
+
T.current = e.button === 0 || e.ctrlKey, d();
|
|
11479
11536
|
}
|
|
11480
11537
|
function p() {
|
|
11481
11538
|
d();
|
|
@@ -11489,7 +11546,7 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11489
11546
|
e.ctrlKey && e.preventDefault();
|
|
11490
11547
|
}
|
|
11491
11548
|
return () => {
|
|
11492
|
-
|
|
11549
|
+
dp(y), D.current !== null && (window.clearTimeout(D.current), D.current = null), k.current = null, z.current.clearPreselection(), e?.removeEventListener("controlstart", p), e?.removeEventListener("update", u), n.removeEventListener("pointerdown", r), n.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a), window.removeEventListener("pointerup", o), n.removeEventListener("contextmenu", g), n.removeEventListener("pointerup", h), n.removeEventListener("pointerdown", f), m && (n.removeEventListener("pointermove", s), n.removeEventListener("pointerleave", l));
|
|
11493
11550
|
};
|
|
11494
11551
|
}, [
|
|
11495
11552
|
t,
|
|
@@ -11501,30 +11558,30 @@ function gp(e, t, n, r, i, a, o, s = 0) {
|
|
|
11501
11558
|
}
|
|
11502
11559
|
//#endregion
|
|
11503
11560
|
//#region src/viewer/Camera/useCameraFit.tsx
|
|
11504
|
-
var
|
|
11505
|
-
function
|
|
11506
|
-
let n = e.top === e.bottom ? 1 : Math.abs((e.right - e.left) / (e.top - e.bottom)), r = Math.max(
|
|
11561
|
+
var Cp = new W(1, 1, 1).normalize(), wp = 1.18, Tp = .001, Ep = .001, Dp = 4, Op = 1.45;
|
|
11562
|
+
function kp(e, t) {
|
|
11563
|
+
let n = e.top === e.bottom ? 1 : Math.abs((e.right - e.left) / (e.top - e.bottom)), r = Math.max(Ep, t) * Math.max(e.zoom, 1e-4), i = r * n;
|
|
11507
11564
|
e.left = -i / 2, e.right = i / 2, e.top = r / 2, e.bottom = -r / 2;
|
|
11508
11565
|
}
|
|
11509
|
-
function
|
|
11566
|
+
function Ap(e, t) {
|
|
11510
11567
|
let n = xe.degToRad(e.fov), r = 2 * Math.atan(Math.tan(n / 2) * e.aspect);
|
|
11511
|
-
return t / Math.sin(Math.min(n, r) / 2) *
|
|
11568
|
+
return t / Math.sin(Math.min(n, r) / 2) * wp;
|
|
11512
11569
|
}
|
|
11513
|
-
function
|
|
11514
|
-
let { camera: e } =
|
|
11570
|
+
function jp() {
|
|
11571
|
+
let { camera: e } = O();
|
|
11515
11572
|
return h((t, n, r) => {
|
|
11516
11573
|
if (!t.current || !(e instanceof Ae) && !(e instanceof ke)) return;
|
|
11517
|
-
let i = new
|
|
11574
|
+
let i = new j().setFromObject(t.current);
|
|
11518
11575
|
if (i.isEmpty()) return;
|
|
11519
|
-
let a = i.getCenter(new W()), o = i.getBoundingSphere(new Ue()), s = n.current, c = e instanceof Ae ?
|
|
11576
|
+
let a = i.getCenter(new W()), o = i.getBoundingSphere(new Ue()), s = n.current, c = e instanceof Ae ? Ap(e, o.radius) : Math.max(o.radius * Dp, Tp);
|
|
11520
11577
|
e.up.set(0, 1, 0);
|
|
11521
|
-
let l = a.clone().addScaledVector(
|
|
11522
|
-
s ? (s.cancel(), s.updateCameraUp(), s.setFocalOffset(0, 0, 0, !1), s.setLookAt(l.x, l.y, l.z, a.x, a.y, a.z, !1), e instanceof ke && s.fitToSphere(new Ue(a, o.radius *
|
|
11578
|
+
let l = a.clone().addScaledVector(Cp, c);
|
|
11579
|
+
s ? (s.cancel(), s.updateCameraUp(), s.setFocalOffset(0, 0, 0, !1), s.setLookAt(l.x, l.y, l.z, a.x, a.y, a.z, !1), e instanceof ke && s.fitToSphere(new Ue(a, o.radius * Op), !1), s.update(0), e.updateMatrixWorld(!0)) : (e.position.copy(l), e.lookAt(a)), e instanceof ke && (s || (e.zoom = 1, kp(e, o.radius * 2 * Op))), e.updateProjectionMatrix(), e.updateMatrixWorld(!0), r.current && (r.current.position.copy(a).addScaledVector(Cp, c * .8), r.current.lookAt(a));
|
|
11523
11580
|
}, [e]);
|
|
11524
11581
|
}
|
|
11525
11582
|
//#endregion
|
|
11526
11583
|
//#region src/viewer/Camera/FirstPersonControls.tsx
|
|
11527
|
-
var
|
|
11584
|
+
var Mp = 1, Np = .004, Pp = -Math.PI / 2 + .01, Fp = Math.PI / 2 - .01, Ip = .24, Lp = 4, Rp = 1e4, zp = .5, Bp = .01, Vp = 1.5, Hp = 1500, Up = 3, Wp = new Set([
|
|
11528
11585
|
"KeyW",
|
|
11529
11586
|
"KeyA",
|
|
11530
11587
|
"KeyS",
|
|
@@ -11533,62 +11590,62 @@ var Ep = 1, Dp = .004, Op = -Math.PI / 2 + .01, kp = Math.PI / 2 - .01, Ap = .24
|
|
|
11533
11590
|
"ShiftRight",
|
|
11534
11591
|
"ControlLeft",
|
|
11535
11592
|
"ControlRight"
|
|
11536
|
-
]),
|
|
11537
|
-
function
|
|
11593
|
+
]), Gp = new Set(["AltLeft", "AltRight"]), Kp = new W(), qp = new W(), Jp = new W(), Yp = new W(), Xp = new W(0, -1, 0);
|
|
11594
|
+
function Zp(e, t) {
|
|
11538
11595
|
return typeof e == "number" && Number.isFinite(e) ? e : t;
|
|
11539
11596
|
}
|
|
11540
|
-
function
|
|
11597
|
+
function Qp(e, t, n) {
|
|
11541
11598
|
return Math.min(n, Math.max(t, e));
|
|
11542
11599
|
}
|
|
11543
|
-
function
|
|
11544
|
-
return
|
|
11600
|
+
function $p(e, t, n, r) {
|
|
11601
|
+
return Qp(Zp(e, t), n, r);
|
|
11545
11602
|
}
|
|
11546
|
-
function
|
|
11603
|
+
function em(e) {
|
|
11547
11604
|
if (!(e instanceof HTMLElement)) return !1;
|
|
11548
11605
|
let t = e.tagName.toLowerCase();
|
|
11549
11606
|
return e.isContentEditable || t === "input" || t === "textarea" || t === "select";
|
|
11550
11607
|
}
|
|
11551
|
-
function
|
|
11608
|
+
function tm(e) {
|
|
11552
11609
|
if (!e) return {
|
|
11553
|
-
eyeHeight:
|
|
11554
|
-
groundMaxDistance:
|
|
11555
|
-
moveSpeed:
|
|
11610
|
+
eyeHeight: Vp,
|
|
11611
|
+
groundMaxDistance: Vp * Up,
|
|
11612
|
+
moveSpeed: Lp
|
|
11556
11613
|
};
|
|
11557
|
-
let t = new
|
|
11614
|
+
let t = new j().setFromObject(e);
|
|
11558
11615
|
if (t.isEmpty()) return {
|
|
11559
|
-
eyeHeight:
|
|
11560
|
-
groundMaxDistance:
|
|
11561
|
-
moveSpeed:
|
|
11616
|
+
eyeHeight: Vp,
|
|
11617
|
+
groundMaxDistance: Vp * Up,
|
|
11618
|
+
moveSpeed: Lp
|
|
11562
11619
|
};
|
|
11563
|
-
let n = t.getBoundingSphere(new Ue()).radius, r = Math.min(
|
|
11620
|
+
let n = t.getBoundingSphere(new Ue()).radius, r = Math.min(Hp, Math.max(Vp, n * Bp));
|
|
11564
11621
|
return {
|
|
11565
11622
|
eyeHeight: r,
|
|
11566
|
-
groundMaxDistance: r *
|
|
11567
|
-
moveSpeed: Math.min(
|
|
11623
|
+
groundMaxDistance: r * Up,
|
|
11624
|
+
moveSpeed: Math.min(Rp, Math.max(Lp, n * Ip))
|
|
11568
11625
|
};
|
|
11569
11626
|
}
|
|
11570
|
-
function
|
|
11571
|
-
let n =
|
|
11627
|
+
function nm(e, t) {
|
|
11628
|
+
let n = tm(e), r = $p(t.eyeHeight, n.eyeHeight, .01, Hp), i = $p(t.groundSnapDistanceRatio, Up, .1, 100);
|
|
11572
11629
|
return {
|
|
11573
11630
|
eyeHeight: r,
|
|
11574
|
-
groundCheckInterval: Math.round(
|
|
11631
|
+
groundCheckInterval: Math.round($p(t.groundCheckInterval, Mp, 1, 120)),
|
|
11575
11632
|
groundMaxDistance: r * i,
|
|
11576
|
-
lookSensitivity:
|
|
11577
|
-
moveSpeed:
|
|
11633
|
+
lookSensitivity: $p(t.lookSensitivity, Np, 1e-4, .1),
|
|
11634
|
+
moveSpeed: $p(t.speed, n.moveSpeed, .01, Rp)
|
|
11578
11635
|
};
|
|
11579
11636
|
}
|
|
11580
|
-
function
|
|
11581
|
-
return e.getWorldDirection(
|
|
11637
|
+
function rm(e) {
|
|
11638
|
+
return e.getWorldDirection(Kp), Kp.y = 0, Kp.lengthSq() === 0 && Kp.set(0, 0, -1), Kp.normalize();
|
|
11582
11639
|
}
|
|
11583
|
-
function
|
|
11584
|
-
return
|
|
11640
|
+
function im(e) {
|
|
11641
|
+
return qp.copy(e).cross(am).normalize(), qp.lengthSq() === 0 && qp.set(1, 0, 0), qp;
|
|
11585
11642
|
}
|
|
11586
|
-
var
|
|
11587
|
-
function
|
|
11643
|
+
var am = new W(0, 1, 0);
|
|
11644
|
+
function om(e, t) {
|
|
11588
11645
|
let n = t.current;
|
|
11589
|
-
n && (e.getWorldDirection(
|
|
11646
|
+
n && (e.getWorldDirection(Yp), Yp.add(e.position), n.enabled = !0, n.cancel(), n.updateCameraUp(), n.setLookAt(e.position.x, e.position.y, e.position.z, Yp.x, Yp.y, Yp.z, !1), n.stop(), n.update(0));
|
|
11590
11647
|
}
|
|
11591
|
-
function
|
|
11648
|
+
function sm(e) {
|
|
11592
11649
|
return e.find((e) => {
|
|
11593
11650
|
let t = e.object;
|
|
11594
11651
|
for (; t;) {
|
|
@@ -11598,42 +11655,42 @@ function tm(e) {
|
|
|
11598
11655
|
return !0;
|
|
11599
11656
|
});
|
|
11600
11657
|
}
|
|
11601
|
-
function
|
|
11602
|
-
let n =
|
|
11603
|
-
return
|
|
11658
|
+
function cm(e, t) {
|
|
11659
|
+
let n = im(rm(e));
|
|
11660
|
+
return Jp.set(0, 0, 0), t.has("KeyW") && (e.getWorldDirection(Kp), Jp.add(Kp)), t.has("KeyS") && (e.getWorldDirection(Kp), Jp.sub(Kp)), t.has("KeyD") && Jp.add(n), t.has("KeyA") && Jp.sub(n), (t.has("ShiftLeft") || t.has("ShiftRight")) && Jp.add(am), (t.has("ControlLeft") || t.has("ControlRight")) && Jp.sub(am), Jp;
|
|
11604
11661
|
}
|
|
11605
|
-
function
|
|
11662
|
+
function lm(e) {
|
|
11606
11663
|
return e.has("ShiftLeft") || e.has("ShiftRight") || e.has("ControlLeft") || e.has("ControlRight");
|
|
11607
11664
|
}
|
|
11608
|
-
function
|
|
11609
|
-
let a =
|
|
11665
|
+
function um({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }) {
|
|
11666
|
+
let a = O((e) => e.camera), o = O((e) => e.gl), s = O((e) => e.invalidate), c = Tt(), l = x(null), u = x(/* @__PURE__ */ new Set()), d = x(Vp), f = x(0), p = x(Vp * Up), m = x(Mp), h = x(Np), g = x(!1), v = x(!1), y = x(Lp), S = x({
|
|
11610
11667
|
pitch: 0,
|
|
11611
11668
|
yaw: 0
|
|
11612
11669
|
}), C = x(null), w = b(() => new Ie(), []);
|
|
11613
11670
|
return _(() => {
|
|
11614
11671
|
t.current = e;
|
|
11615
11672
|
}, [e, t]), _(() => {
|
|
11616
|
-
let e =
|
|
11673
|
+
let e = nm(r.current, i);
|
|
11617
11674
|
d.current = e.eyeHeight, m.current = e.groundCheckInterval, p.current = e.groundMaxDistance, h.current = e.lookSensitivity, y.current = e.moveSpeed;
|
|
11618
11675
|
}, [r, i]), _(() => {
|
|
11619
11676
|
let e = o.domElement, i = e.style.outline, c = e.style.userSelect;
|
|
11620
11677
|
e.tabIndex = Math.max(e.tabIndex, 0), e.style.outline = "none", e.style.userSelect = "none";
|
|
11621
11678
|
let _ = (e, t) => {
|
|
11622
11679
|
let n = S.current, r = h.current;
|
|
11623
|
-
n.yaw -= e * r, n.pitch -= t * r, n.pitch = Math.max(
|
|
11680
|
+
n.yaw -= e * r, n.pitch -= t * r, n.pitch = Math.max(Pp, Math.min(Fp, n.pitch)), a.quaternion.setFromEuler(new P(n.pitch, n.yaw, 0, "YXZ")), a.updateMatrixWorld(), s();
|
|
11624
11681
|
}, b = () => {
|
|
11625
11682
|
l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
11626
11683
|
}, x = (e) => {
|
|
11627
11684
|
if (!t.current) return;
|
|
11628
11685
|
n.current?.cancel(), n.current && (n.current.enabled = !1);
|
|
11629
|
-
let i =
|
|
11686
|
+
let i = cm(a, u.current);
|
|
11630
11687
|
if (i.lengthSq() === 0) return;
|
|
11631
|
-
let o = v.current ?
|
|
11632
|
-
if (i.normalize().multiplyScalar(y.current * o * e), a.position.add(i), f.current += 1, v.current && !
|
|
11688
|
+
let o = v.current ? zp : 1;
|
|
11689
|
+
if (i.normalize().multiplyScalar(y.current * o * e), a.position.add(i), f.current += 1, v.current && !lm(u.current) && f.current % m.current === 0) {
|
|
11633
11690
|
let e = w, t = e.firstHitOnly;
|
|
11634
|
-
e.firstHitOnly = !0, w.set(a.position,
|
|
11691
|
+
e.firstHitOnly = !0, w.set(a.position, Xp), w.far = p.current;
|
|
11635
11692
|
try {
|
|
11636
|
-
let e =
|
|
11693
|
+
let e = sm(r.current ? w.intersectObject(r.current, !0) : []);
|
|
11637
11694
|
e && (a.position.y = e.point.y + d.current);
|
|
11638
11695
|
} finally {
|
|
11639
11696
|
e.firstHitOnly = t, w.far = Infinity;
|
|
@@ -11648,27 +11705,27 @@ function im({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
11648
11705
|
let i = Math.min((r - e) / 1e3, .05);
|
|
11649
11706
|
e = r, x(i), s(), l.current = requestAnimationFrame(n);
|
|
11650
11707
|
});
|
|
11651
|
-
}, ee = () => {
|
|
11652
|
-
t.current && (e.focus(), g.current = !0, document.pointerLockElement !== e && e.requestPointerLock?.());
|
|
11653
11708
|
}, T = () => {
|
|
11709
|
+
t.current && (e.focus(), g.current = !0, document.pointerLockElement !== e && e.requestPointerLock?.());
|
|
11710
|
+
}, E = () => {
|
|
11654
11711
|
g.current = !1;
|
|
11655
|
-
}, E = (n) => {
|
|
11656
|
-
t.current && document.pointerLockElement !== e && g.current && (n.preventDefault(), n.stopPropagation(), _(n.movementX, n.movementY));
|
|
11657
11712
|
}, D = (n) => {
|
|
11713
|
+
t.current && document.pointerLockElement !== e && g.current && (n.preventDefault(), n.stopPropagation(), _(n.movementX, n.movementY));
|
|
11714
|
+
}, O = (n) => {
|
|
11658
11715
|
t.current && document.pointerLockElement === e && _(n.movementX, n.movementY);
|
|
11659
|
-
},
|
|
11660
|
-
if (t.current && !
|
|
11661
|
-
if (
|
|
11716
|
+
}, k = (e) => {
|
|
11717
|
+
if (t.current && !em(e.target)) {
|
|
11718
|
+
if (Gp.has(e.code)) {
|
|
11662
11719
|
e.repeat || (v.current = !v.current), e.preventDefault(), e.stopPropagation();
|
|
11663
11720
|
return;
|
|
11664
11721
|
}
|
|
11665
|
-
|
|
11722
|
+
Wp.has(e.code) && (e.preventDefault(), e.stopPropagation(), u.current.add(e.code), C(), s());
|
|
11666
11723
|
}
|
|
11667
|
-
},
|
|
11668
|
-
|
|
11724
|
+
}, ee = (e) => {
|
|
11725
|
+
Wp.has(e.code) && (u.current.delete(e.code), u.current.size || b());
|
|
11669
11726
|
};
|
|
11670
|
-
return e.addEventListener("pointerdown",
|
|
11671
|
-
e.removeEventListener("pointerdown",
|
|
11727
|
+
return e.addEventListener("pointerdown", T, !0), e.addEventListener("pointermove", D, !0), window.addEventListener("pointerup", E, !0), window.addEventListener("mousemove", O), window.addEventListener("keydown", k, !0), window.addEventListener("keyup", ee, !0), () => {
|
|
11728
|
+
e.removeEventListener("pointerdown", T, !0), e.removeEventListener("pointermove", D, !0), window.removeEventListener("pointerup", E, !0), window.removeEventListener("mousemove", O), window.removeEventListener("keydown", k, !0), window.removeEventListener("keyup", ee, !0), b(), e.style.outline = i, e.style.userSelect = c, g.current = !1, u.current.clear(), document.pointerLockElement === e && document.exitPointerLock(), om(a, n), s();
|
|
11672
11729
|
};
|
|
11673
11730
|
}, [
|
|
11674
11731
|
a,
|
|
@@ -11688,14 +11745,14 @@ function im({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
11688
11745
|
C.current = c.getState().preselectionEnabled, c.getState().setPreselectionEnabled(!1);
|
|
11689
11746
|
let l = n.current;
|
|
11690
11747
|
l && (l.enabled = !1, l.cancel());
|
|
11691
|
-
let f =
|
|
11748
|
+
let f = nm(r.current, i);
|
|
11692
11749
|
d.current = f.eyeHeight, m.current = f.groundCheckInterval, p.current = f.groundMaxDistance, h.current = f.lookSensitivity, y.current = f.moveSpeed;
|
|
11693
11750
|
let g = new P().setFromQuaternion(a.quaternion, "YXZ");
|
|
11694
11751
|
return S.current = {
|
|
11695
11752
|
pitch: g.x,
|
|
11696
11753
|
yaw: g.y
|
|
11697
11754
|
}, () => {
|
|
11698
|
-
u.current.clear(), t(), document.pointerLockElement === o.domElement && document.exitPointerLock(),
|
|
11755
|
+
u.current.clear(), t(), document.pointerLockElement === o.domElement && document.exitPointerLock(), om(a, n), s();
|
|
11699
11756
|
};
|
|
11700
11757
|
}, [
|
|
11701
11758
|
e,
|
|
@@ -11710,8 +11767,8 @@ function im({ active: e, activeRef: t, controlRef: n, modelRef: r, settings: i }
|
|
|
11710
11767
|
}
|
|
11711
11768
|
//#endregion
|
|
11712
11769
|
//#region src/viewer/ViewerComponents/ViewerScene.tsx
|
|
11713
|
-
var
|
|
11714
|
-
function
|
|
11770
|
+
var dm = .1, fm = .02, pm = 150, mm = 150, hm = 500, gm = 5e6, _m = 50, vm = .001, ym = .001, bm = 1e3, xm = 50, Sm = 30, Cm = 240, wm = 7, Tm = 1.25, Em = .08, Dm = new W(1, 1, 1).normalize(), Om = new j(), km = new Ue(), Am = new W(), jm = new W(), Mm = new W();
|
|
11771
|
+
function Nm(e = !1) {
|
|
11715
11772
|
return {
|
|
11716
11773
|
active: e,
|
|
11717
11774
|
finalFitDone: !1,
|
|
@@ -11719,23 +11776,23 @@ function Dm(e = !1) {
|
|
|
11719
11776
|
userInteractedAfterFirstFit: !1
|
|
11720
11777
|
};
|
|
11721
11778
|
}
|
|
11722
|
-
function
|
|
11779
|
+
function Pm(e) {
|
|
11723
11780
|
let t = [];
|
|
11724
11781
|
return e?.traverse((e) => {
|
|
11725
11782
|
e instanceof B && e.geometry.attributes.ids && t.push(e);
|
|
11726
11783
|
}), t;
|
|
11727
11784
|
}
|
|
11728
|
-
function
|
|
11785
|
+
function Fm(e) {
|
|
11729
11786
|
let t = e.geometry.index?.count;
|
|
11730
11787
|
return t === void 0 ? (e.geometry.attributes.position?.count ?? 0) / 3 : t / 3;
|
|
11731
11788
|
}
|
|
11732
|
-
function
|
|
11733
|
-
return e.reduce((e, t) => e +
|
|
11789
|
+
function Im(e) {
|
|
11790
|
+
return e.reduce((e, t) => e + Fm(t), 0);
|
|
11734
11791
|
}
|
|
11735
|
-
function
|
|
11736
|
-
return
|
|
11792
|
+
function Lm(e) {
|
|
11793
|
+
return Im(e) > gm;
|
|
11737
11794
|
}
|
|
11738
|
-
function
|
|
11795
|
+
function Rm(e, t) {
|
|
11739
11796
|
if (t <= 0 || !e.length) return [];
|
|
11740
11797
|
let n = [...e];
|
|
11741
11798
|
for (let e = n.length - 1; e > 0 && n.length - e <= t; e--) {
|
|
@@ -11744,10 +11801,10 @@ function Mm(e, t) {
|
|
|
11744
11801
|
}
|
|
11745
11802
|
return n.slice(-t);
|
|
11746
11803
|
}
|
|
11747
|
-
function
|
|
11804
|
+
function zm(e, t) {
|
|
11748
11805
|
if (t <= 0) return null;
|
|
11749
|
-
let n =
|
|
11750
|
-
if (!
|
|
11806
|
+
let n = Pm(e);
|
|
11807
|
+
if (!Lm(n)) return null;
|
|
11751
11808
|
let r = n.filter((e) => e.visible);
|
|
11752
11809
|
if (r.length < 2) return null;
|
|
11753
11810
|
let i = Math.min(r.length, Math.round(r.length * t));
|
|
@@ -11760,88 +11817,88 @@ function Nm(e, t) {
|
|
|
11760
11817
|
}
|
|
11761
11818
|
o.push(e);
|
|
11762
11819
|
});
|
|
11763
|
-
let s = [...
|
|
11764
|
-
return c > 0 && s.push(...
|
|
11820
|
+
let s = [...Rm(o, i)], c = i - s.length;
|
|
11821
|
+
return c > 0 && s.push(...Rm(a, c)), s.length ? {
|
|
11765
11822
|
hiddenMeshes: s,
|
|
11766
11823
|
root: e
|
|
11767
11824
|
} : null;
|
|
11768
11825
|
}
|
|
11769
|
-
function
|
|
11826
|
+
function Bm(e) {
|
|
11770
11827
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
11771
11828
|
return e.hiddenMeshes.forEach((e) => {
|
|
11772
11829
|
e.parent && (t.set(e, e.visible), e.visible && (e.userData[dl] = !0, e.visible = !1, n++));
|
|
11773
11830
|
}), n ? t : null;
|
|
11774
11831
|
}
|
|
11775
|
-
function
|
|
11832
|
+
function Vm(e) {
|
|
11776
11833
|
e?.forEach((e, t) => {
|
|
11777
11834
|
delete t.userData[dl], t.visible = e;
|
|
11778
11835
|
});
|
|
11779
11836
|
}
|
|
11780
|
-
function
|
|
11781
|
-
let t =
|
|
11782
|
-
return t ? Math.max(t.radius *
|
|
11837
|
+
function Hm(e) {
|
|
11838
|
+
let t = Wm(e);
|
|
11839
|
+
return t ? Math.max(t.radius * fm, dm) : dm;
|
|
11783
11840
|
}
|
|
11784
|
-
function
|
|
11841
|
+
function Um(e) {
|
|
11785
11842
|
if (e.dollyToCursor = !0, e.camera instanceof ke) {
|
|
11786
11843
|
e.mouseButtons.middle = Fs.ACTION.ZOOM, e.mouseButtons.wheel = Fs.ACTION.ZOOM, e.touches.two = Fs.ACTION.TOUCH_ZOOM_TRUCK, e.infinityDolly = !1;
|
|
11787
11844
|
return;
|
|
11788
11845
|
}
|
|
11789
11846
|
e.mouseButtons.middle = Fs.ACTION.DOLLY, e.mouseButtons.wheel = Fs.ACTION.DOLLY, e.touches.two = Fs.ACTION.TOUCH_DOLLY_TRUCK, e.infinityDolly = !0;
|
|
11790
11847
|
}
|
|
11791
|
-
function
|
|
11792
|
-
if (!e || (
|
|
11793
|
-
let t =
|
|
11848
|
+
function Wm(e) {
|
|
11849
|
+
if (!e || (Om.setFromObject(e), Om.isEmpty())) return null;
|
|
11850
|
+
let t = Om.getBoundingSphere(km);
|
|
11794
11851
|
return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
|
|
11795
11852
|
}
|
|
11796
|
-
function
|
|
11853
|
+
function Gm(e) {
|
|
11797
11854
|
return e.type === "Group" && typeof e.userData.modelID == "number";
|
|
11798
11855
|
}
|
|
11799
|
-
function
|
|
11800
|
-
return e?.children.filter(
|
|
11856
|
+
function Km(e) {
|
|
11857
|
+
return e?.children.filter(Gm) ?? [];
|
|
11801
11858
|
}
|
|
11802
|
-
function
|
|
11803
|
-
return
|
|
11859
|
+
function qm(e, t) {
|
|
11860
|
+
return Km(e).find((e) => e.userData.modelID === t) ?? null;
|
|
11804
11861
|
}
|
|
11805
|
-
function
|
|
11862
|
+
function Jm(e) {
|
|
11806
11863
|
return e instanceof ke ? "orthographic" : "perspective";
|
|
11807
11864
|
}
|
|
11808
|
-
function
|
|
11865
|
+
function Ym(e) {
|
|
11809
11866
|
return e instanceof Ae || e instanceof ke;
|
|
11810
11867
|
}
|
|
11811
|
-
function
|
|
11868
|
+
function Xm(e) {
|
|
11812
11869
|
return e.height > 0 ? e.width / e.height : 1;
|
|
11813
11870
|
}
|
|
11814
|
-
function
|
|
11815
|
-
return Math.max(
|
|
11871
|
+
function Zm(e) {
|
|
11872
|
+
return Math.max(ym, (e.top - e.bottom) / Math.max(e.zoom, 1e-4));
|
|
11816
11873
|
}
|
|
11817
|
-
function
|
|
11818
|
-
let r = Math.max(
|
|
11874
|
+
function Qm(e, t, n) {
|
|
11875
|
+
let r = Math.max(ym, n) * Math.max(e.zoom, 1e-4), i = r * t;
|
|
11819
11876
|
e.left = -i / 2, e.right = i / 2, e.top = r / 2, e.bottom = -r / 2, e.updateProjectionMatrix();
|
|
11820
11877
|
}
|
|
11821
|
-
function
|
|
11822
|
-
if (e instanceof ke) return
|
|
11878
|
+
function $m(e, t) {
|
|
11879
|
+
if (e instanceof ke) return Zm(e);
|
|
11823
11880
|
if (e instanceof Ae) {
|
|
11824
|
-
let n = Math.max(
|
|
11881
|
+
let n = Math.max(vm, e.position.distanceTo(t));
|
|
11825
11882
|
return 2 * Math.tan(xe.degToRad(e.fov) / 2) * n;
|
|
11826
11883
|
}
|
|
11827
11884
|
return 1;
|
|
11828
11885
|
}
|
|
11829
|
-
function
|
|
11830
|
-
let n =
|
|
11886
|
+
function eh(e, t) {
|
|
11887
|
+
let n = Xm(t);
|
|
11831
11888
|
if (e instanceof Ae) {
|
|
11832
11889
|
e.aspect = n, e.updateProjectionMatrix();
|
|
11833
11890
|
return;
|
|
11834
11891
|
}
|
|
11835
|
-
e instanceof ke &&
|
|
11892
|
+
e instanceof ke && Qm(e, n, Zm(e));
|
|
11836
11893
|
}
|
|
11837
|
-
function
|
|
11838
|
-
let n =
|
|
11894
|
+
function th(e, t) {
|
|
11895
|
+
let n = Wm(t);
|
|
11839
11896
|
if (!n) return;
|
|
11840
|
-
let r = Math.max(
|
|
11897
|
+
let r = Math.max(bm, n.radius * xm, e.near + 1);
|
|
11841
11898
|
Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
|
|
11842
11899
|
}
|
|
11843
|
-
function
|
|
11844
|
-
let n = new
|
|
11900
|
+
function nh(e, t) {
|
|
11901
|
+
let n = new j();
|
|
11845
11902
|
return Object.entries(e).forEach(([e, r]) => {
|
|
11846
11903
|
let i = Number(e), a = t.elementBounds.get(i);
|
|
11847
11904
|
a && r.forEach((e) => {
|
|
@@ -11850,35 +11907,35 @@ function Xm(e, t) {
|
|
|
11850
11907
|
});
|
|
11851
11908
|
}), n.isEmpty() ? null : n;
|
|
11852
11909
|
}
|
|
11853
|
-
function
|
|
11854
|
-
let t = e.getSize(
|
|
11855
|
-
return Number.isFinite(n) && n > 0 ? n *
|
|
11910
|
+
function rh(e) {
|
|
11911
|
+
let t = e.getSize(Mm), n = Math.max(t.x, t.y, t.z);
|
|
11912
|
+
return Number.isFinite(n) && n > 0 ? n * Em : dm;
|
|
11856
11913
|
}
|
|
11857
|
-
function
|
|
11858
|
-
let r = Math.max(
|
|
11859
|
-
return Number.isFinite(i) && i >= r ? e : (
|
|
11914
|
+
function ih(e, t, n) {
|
|
11915
|
+
let r = Math.max(dm, (Number.isFinite(n) ? n : dm) * Tm), i = t.position.distanceTo(e);
|
|
11916
|
+
return Number.isFinite(i) && i >= r ? e : (Am.copy(e).sub(t.position), (!Number.isFinite(Am.x + Am.y + Am.z) || Am.lengthSq() === 0) && t.getWorldDirection(Am), Am.lengthSq() === 0 && Am.set(0, 0, -1), Am.normalize(), jm.copy(t.position).addScaledVector(Am, r));
|
|
11860
11917
|
}
|
|
11861
|
-
function
|
|
11862
|
-
let
|
|
11918
|
+
function ah({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadGeneration: i, lightRef: a, materialMode: o, modelRef: s, modelsData: c, modelsLoading: l, initialPlanPlane: u, createPlanComment: d, createPlanMarkupCloud: f, deleteAllPlanNotes: p, onReady: m, onModelsReady: g, onCameraDprModeChange: v, publicApi: C, invalidatePlanViews: w, setPlanPreselectionHandler: T, setPlanVisualObjectsGetter: E, setSceneApi: D, setPlanNotesModeActive: k, usePerformanceMoving: ee, useWebGPU: A }) {
|
|
11919
|
+
let j = O((e) => e.camera), te = O((e) => e.gl), M = O((e) => e.invalidate), ne = O((e) => e.scene), re = O((e) => e.set), ie = O((e) => e.size), N = Ed(s), ae = Gd(N), { colorPaletteTexture: oe, colorUtils: se } = Ru(N), ce = Tt(), le = K((e) => e.selected), ue = Bs(s), P = wf(s, n, ue, A, w), de = h((e) => {
|
|
11863
11920
|
P.setCapsPreselection(e), w();
|
|
11864
11921
|
}, [P, w]);
|
|
11865
11922
|
_(() => {
|
|
11866
11923
|
w();
|
|
11867
|
-
}, [w, le]), _(() => (
|
|
11868
|
-
de(e),
|
|
11869
|
-
}), () =>
|
|
11924
|
+
}, [w, le]), _(() => (E(() => P.getPlanVisualObjects()), () => E(null)), [P, E]), _(() => (T((e) => {
|
|
11925
|
+
de(e), M();
|
|
11926
|
+
}), () => T(null)), [
|
|
11870
11927
|
P,
|
|
11871
|
-
|
|
11928
|
+
M,
|
|
11872
11929
|
de,
|
|
11873
|
-
|
|
11930
|
+
T
|
|
11874
11931
|
]);
|
|
11875
11932
|
let F = rc(s, n, ue, P.getSelectableObjects, P.getSnapPoints), I = h((e) => {
|
|
11876
11933
|
F.setActive(e), ce.getState().setDimensionsActive(e);
|
|
11877
11934
|
}, [F, ce]), fe = h(() => {
|
|
11878
11935
|
I(!F.getActive());
|
|
11879
11936
|
}, [F, I]), L = Lc(s), pe = h((e) => {
|
|
11880
|
-
L.setNodeModeActive(e),
|
|
11881
|
-
}, [L,
|
|
11937
|
+
L.setNodeModeActive(e), k(e);
|
|
11938
|
+
}, [L, k]), me = h(() => {
|
|
11882
11939
|
pe(!L.getNodeModeActive());
|
|
11883
11940
|
}, [L, pe]), he = b(() => ({
|
|
11884
11941
|
...L,
|
|
@@ -11902,51 +11959,51 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11902
11959
|
L,
|
|
11903
11960
|
pe,
|
|
11904
11961
|
me
|
|
11905
|
-
]), ge = b(() => new Qn(), []), _e =
|
|
11962
|
+
]), ge = b(() => new Qn(), []), _e = ae.buildIndex, ve = N.resetIndex, R = se.applyStoredColors, ye = jp(), be = x(null), z = x(null), B = x(null), Se = x(null), Ce = x(null), we = x(null), V = x(Nm()), Te = x([]), Ee = x(/* @__PURE__ */ new Map()), De = x(/* @__PURE__ */ new Set()), Oe = x(l), je = x(null), Me = x(null), Ne = x(null), Pe = x(0), Fe = x(!1), Ie = x(l), Le = x(!1), Re = x(!1), ze = x(i), Be = x(/* @__PURE__ */ new Map()), [Ve, He] = S(0), [Ue, We] = S(0), [Ge, Ke] = S(!0);
|
|
11906
11963
|
_(() => {
|
|
11907
11964
|
let e = new Set(Object.keys(c).map((e) => Number(e)));
|
|
11908
11965
|
De.current.forEach((t) => {
|
|
11909
11966
|
e.has(t) || se.clearModelColors(t);
|
|
11910
11967
|
}), De.current = e;
|
|
11911
11968
|
}, [se, c]);
|
|
11912
|
-
let [
|
|
11913
|
-
ze.current !== i && (ze.current = i, Be.current.clear(), V.current =
|
|
11914
|
-
let
|
|
11969
|
+
let [qe, Je] = S(!1), [Ye, H] = S({}), Xe = x(!1), Ze = K((e) => e.showStats), Qe = K((e) => e.lighting), U = K((e) => e.performanceMovingFactor);
|
|
11970
|
+
ze.current !== i && (ze.current = i, Be.current.clear(), V.current = Nm(), je.current = null);
|
|
11971
|
+
let $e = h((e, t, n) => {
|
|
11915
11972
|
let r = Be.current.get(e) ?? 0;
|
|
11916
11973
|
Be.current.set(e, t), n > 0 && t >= n && r < n && He((e) => e + 1);
|
|
11917
|
-
}, []),
|
|
11974
|
+
}, []), et = h((e) => {
|
|
11918
11975
|
if (s.current = e, !e) return;
|
|
11919
11976
|
let t = e;
|
|
11920
|
-
t.isClippingGroup =
|
|
11921
|
-
}, [s,
|
|
11977
|
+
t.isClippingGroup = A, t.enabled = !1, t.clipIntersection = !1, t.clipShadows = !1, t.clippingPlanes = [];
|
|
11978
|
+
}, [s, A]), rt = h((e) => {
|
|
11922
11979
|
let t = Me.current;
|
|
11923
11980
|
if (!t || e.camera.uuid !== t.cameraUuid) return !1;
|
|
11924
11981
|
Me.current = null, e.cancel(), e.updateCameraUp();
|
|
11925
11982
|
let n = e;
|
|
11926
|
-
return e.zoomTo(t.zoom, !1), e.setFocalOffset(0, 0, 0, !1), e.setLookAt(t.position.x, t.position.y, t.position.z, t.target.x, t.target.y, t.target.z, !1),
|
|
11927
|
-
}, [
|
|
11983
|
+
return e.zoomTo(t.zoom, !1), e.setFocalOffset(0, 0, 0, !1), e.setLookAt(t.position.x, t.position.y, t.position.z, t.target.x, t.target.y, t.target.z, !1), Um(e), e.minDistance = Hm(s.current), e.stop(), e.update(0), n.saveState?.(), M(), !0;
|
|
11984
|
+
}, [M, s]), it = h((e) => {
|
|
11928
11985
|
let t = n;
|
|
11929
|
-
t.current !== e && (t.current = e, e && (e.minDistance =
|
|
11986
|
+
t.current !== e && (t.current = e, e && (e.minDistance = Hm(s.current), Um(e), rt(e)), We((e) => e + 1));
|
|
11930
11987
|
}, [
|
|
11931
11988
|
n,
|
|
11932
11989
|
s,
|
|
11933
|
-
|
|
11934
|
-
]),
|
|
11935
|
-
|
|
11990
|
+
rt
|
|
11991
|
+
]), ot = h((e) => {
|
|
11992
|
+
Xe.current = e, Je(e);
|
|
11936
11993
|
let t = n.current;
|
|
11937
11994
|
t && (t.enabled = !e, e && (t.cancel(), t.stop()));
|
|
11938
|
-
}, [n]),
|
|
11939
|
-
|
|
11995
|
+
}, [n]), ct = h((e) => {
|
|
11996
|
+
H((t) => ({
|
|
11940
11997
|
...t,
|
|
11941
11998
|
...e
|
|
11942
11999
|
}));
|
|
11943
|
-
}, []),
|
|
11944
|
-
z.current !== null && (window.clearTimeout(z.current), z.current = null), B.current !== null && (window.clearTimeout(B.current), B.current = null), Se.current !== null && (window.clearTimeout(Se.current), Se.current = null),
|
|
12000
|
+
}, []), lt = h(() => {
|
|
12001
|
+
z.current !== null && (window.clearTimeout(z.current), z.current = null), B.current !== null && (window.clearTimeout(B.current), B.current = null), Se.current !== null && (window.clearTimeout(Se.current), Se.current = null), Vm(we.current), we.current = null, Ce.current = null, P.setCapsCameraMotionActive(!1), P.setEdgesCameraMotionActive?.(!1), v("sleep"), M();
|
|
11945
12002
|
}, [
|
|
11946
12003
|
P,
|
|
11947
|
-
|
|
12004
|
+
M,
|
|
11948
12005
|
v
|
|
11949
|
-
]),
|
|
12006
|
+
]), ut = h((e) => {
|
|
11950
12007
|
let t = n.current;
|
|
11951
12008
|
if (t) {
|
|
11952
12009
|
if (!e) {
|
|
@@ -11963,109 +12020,109 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
11963
12020
|
touches: { ...t.touches }
|
|
11964
12021
|
}, t.mouseButtons.left = Fs.ACTION.TRUCK, t.mouseButtons.middle = Fs.ACTION.ZOOM, t.mouseButtons.right = Fs.ACTION.TRUCK, t.mouseButtons.wheel = Fs.ACTION.ZOOM, t.touches.one = Fs.ACTION.TOUCH_TRUCK, t.touches.two = Fs.ACTION.TOUCH_ZOOM_TRUCK, t.touches.three = Fs.ACTION.TOUCH_TRUCK, t.dollyToCursor = !0, t.infinityDolly = !1);
|
|
11965
12022
|
}
|
|
11966
|
-
}, [n]),
|
|
12023
|
+
}, [n]), dt = h((e) => {
|
|
11967
12024
|
if (Fe.current = e, e) {
|
|
11968
|
-
|
|
12025
|
+
lt(), ut(!0);
|
|
11969
12026
|
return;
|
|
11970
12027
|
}
|
|
11971
|
-
|
|
11972
|
-
}, [
|
|
12028
|
+
ut(!1);
|
|
12029
|
+
}, [ut, lt]);
|
|
11973
12030
|
_(() => {
|
|
11974
|
-
Fe.current &&
|
|
11975
|
-
}, [Ue,
|
|
12031
|
+
Fe.current && ut(!0);
|
|
12032
|
+
}, [Ue, ut]), _(() => {
|
|
11976
12033
|
s.current && P.updateMaterials();
|
|
11977
12034
|
}, [
|
|
11978
12035
|
P,
|
|
11979
12036
|
s,
|
|
11980
|
-
|
|
12037
|
+
A
|
|
11981
12038
|
]), _(() => {
|
|
11982
|
-
|
|
12039
|
+
eh(j, ie), M();
|
|
11983
12040
|
}, [
|
|
11984
|
-
A,
|
|
11985
12041
|
j,
|
|
11986
|
-
|
|
11987
|
-
|
|
12042
|
+
M,
|
|
12043
|
+
ie.height,
|
|
12044
|
+
ie.width
|
|
11988
12045
|
]), y(() => {
|
|
11989
12046
|
let e = n.current;
|
|
11990
|
-
e &&
|
|
12047
|
+
e && rt(e);
|
|
11991
12048
|
}, [
|
|
11992
|
-
|
|
12049
|
+
j,
|
|
11993
12050
|
n,
|
|
11994
12051
|
Ue,
|
|
11995
|
-
|
|
12052
|
+
rt
|
|
11996
12053
|
]);
|
|
11997
|
-
let
|
|
12054
|
+
let ft = b(() => {
|
|
11998
12055
|
let e = Object.keys(c).sort((e, t) => Number(e) - Number(t));
|
|
11999
12056
|
for (let t of e) {
|
|
12000
|
-
let e =
|
|
12057
|
+
let e = sd(c[Number(t)]);
|
|
12001
12058
|
if (e) return e;
|
|
12002
12059
|
}
|
|
12003
12060
|
return null;
|
|
12004
|
-
}, [c]),
|
|
12005
|
-
Te.current =
|
|
12006
|
-
let e = new Set(
|
|
12061
|
+
}, [c]), pt = b(() => ad(ft ?? void 0), [ft]), mt = b(() => Object.entries(c).map(([e, t]) => [Number(e), t]), [c]), ht = b(() => mt.map(([e]) => e), [mt]), gt = b(() => new Map(mt.map(([e, t]) => [e, Object.keys(t.data).length])), [mt]);
|
|
12062
|
+
Te.current = ht, Ee.current = gt, Oe.current = l, _(() => {
|
|
12063
|
+
let e = new Set(ht);
|
|
12007
12064
|
Be.current.forEach((t, n) => {
|
|
12008
12065
|
e.has(n) || Be.current.delete(n);
|
|
12009
12066
|
});
|
|
12010
|
-
}, [
|
|
12011
|
-
let
|
|
12012
|
-
n.current && (n.current.minDistance =
|
|
12013
|
-
}, [n, s]),
|
|
12067
|
+
}, [ht]);
|
|
12068
|
+
let _t = o !== "performance", vt = h(() => {
|
|
12069
|
+
n.current && (n.current.minDistance = Hm(s.current));
|
|
12070
|
+
}, [n, s]), yt = h((e, t = !1) => {
|
|
12014
12071
|
let r = n.current;
|
|
12015
12072
|
if (!r) return !1;
|
|
12016
|
-
let i = t ?
|
|
12073
|
+
let i = t ? ih(e, j, r.minDistance) : e;
|
|
12017
12074
|
return r.cancel(), r.setOrbitPoint(i.x, i.y, i.z), !0;
|
|
12018
|
-
}, [
|
|
12019
|
-
be.current = e.clone(),
|
|
12020
|
-
}, [
|
|
12075
|
+
}, [j, n]), bt = h((e) => {
|
|
12076
|
+
be.current = e.clone(), yt(e, !0);
|
|
12077
|
+
}, [yt]), xt = h(() => {
|
|
12021
12078
|
be.current = null, ye(s, n, a);
|
|
12022
12079
|
}, [
|
|
12023
12080
|
n,
|
|
12024
12081
|
ye,
|
|
12025
12082
|
a,
|
|
12026
12083
|
s
|
|
12027
|
-
]),
|
|
12028
|
-
if (!
|
|
12029
|
-
if (
|
|
12084
|
+
]), St = h((e) => {
|
|
12085
|
+
if (!Ym(j)) return null;
|
|
12086
|
+
if (Jm(j) === e) return j;
|
|
12030
12087
|
let r = n.current, i = new W(), a = new W();
|
|
12031
|
-
r ? (r.getTarget(i, !0), r.getPosition(a, !0)) : (
|
|
12088
|
+
r ? (r.getTarget(i, !0), r.getPosition(a, !0)) : (j.getWorldDirection(i), a.copy(j.position), i.add(a));
|
|
12032
12089
|
let o = a.clone().sub(i);
|
|
12033
|
-
o.lengthSq() <
|
|
12034
|
-
let s =
|
|
12090
|
+
o.lengthSq() < vm * vm && j.getWorldDirection(o).multiplyScalar(-1), o.lengthSq() < vm * vm && o.copy(Dm), o.normalize();
|
|
12091
|
+
let s = Xm(ie), c = $m(j, i), l = j.near, u = j.far, d = e === "orthographic" ? new ke(-s * c * .5, s * c * .5, c * .5, -c * .5, l, u) : new Ae(_m, s, l, u);
|
|
12035
12092
|
if (d.manual = !0, d instanceof Ae) {
|
|
12036
12093
|
let e = c / (2 * Math.tan(xe.degToRad(d.fov) * .5));
|
|
12037
12094
|
a.copy(i).addScaledVector(o, e);
|
|
12038
12095
|
}
|
|
12039
|
-
return d.position.copy(a), d.up.copy(
|
|
12096
|
+
return d.position.copy(a), d.up.copy(j.up), d.layers.mask = j.layers.mask, d.lookAt(i), d.updateMatrixWorld(!0), eh(d, ie), Me.current = {
|
|
12040
12097
|
cameraUuid: d.uuid,
|
|
12041
12098
|
position: a.clone(),
|
|
12042
12099
|
target: i.clone(),
|
|
12043
12100
|
zoom: d.zoom
|
|
12044
|
-
}, r?.cancel(), je.current = d.uuid, t.current = d,
|
|
12101
|
+
}, r?.cancel(), je.current = d.uuid, t.current = d, re({ camera: d }), M(), d;
|
|
12045
12102
|
}, [
|
|
12046
|
-
|
|
12103
|
+
j,
|
|
12047
12104
|
t,
|
|
12048
12105
|
n,
|
|
12049
|
-
|
|
12106
|
+
M,
|
|
12050
12107
|
s,
|
|
12051
|
-
|
|
12052
|
-
|
|
12053
|
-
|
|
12054
|
-
]),
|
|
12055
|
-
let e =
|
|
12056
|
-
return
|
|
12057
|
-
}, [
|
|
12058
|
-
let i =
|
|
12108
|
+
re,
|
|
12109
|
+
ie.height,
|
|
12110
|
+
ie.width
|
|
12111
|
+
]), Ct = h(() => {
|
|
12112
|
+
let e = Jm(j) === "perspective" ? "orthographic" : "perspective";
|
|
12113
|
+
return St(e), e;
|
|
12114
|
+
}, [j, St]), wt = h((e, t, { createClippingPlane: r = !0 } = {}) => {
|
|
12115
|
+
let i = St("orthographic") ?? (Ym(j) ? j : null);
|
|
12059
12116
|
if (!i) return null;
|
|
12060
12117
|
let a = e.clone().normalize(), o = !1;
|
|
12061
|
-
Pe.current += 1,
|
|
12118
|
+
Pe.current += 1, dt(!0), P.setHelpersActive(!1), r && P.createPlaneFromPointAndNormal(wl(a), a.normal.clone());
|
|
12062
12119
|
let c = Cl({
|
|
12063
12120
|
camera: i,
|
|
12064
12121
|
controls: n.current,
|
|
12065
|
-
invalidate:
|
|
12122
|
+
invalidate: M,
|
|
12066
12123
|
model: s.current,
|
|
12067
12124
|
plane: a,
|
|
12068
|
-
size:
|
|
12125
|
+
size: ie,
|
|
12069
12126
|
viewNormal: t
|
|
12070
12127
|
});
|
|
12071
12128
|
return c ? (Me.current = {
|
|
@@ -12075,76 +12132,76 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12075
12132
|
zoom: c.zoom
|
|
12076
12133
|
}, je.current = i.uuid, be.current = null, {
|
|
12077
12134
|
dispose: () => {
|
|
12078
|
-
o || (o = !0, Pe.current = Math.max(0, Pe.current - 1), Pe.current ||
|
|
12135
|
+
o || (o = !0, Pe.current = Math.max(0, Pe.current - 1), Pe.current || dt(!1));
|
|
12079
12136
|
},
|
|
12080
12137
|
plane: a.clone()
|
|
12081
|
-
}) : (Pe.current = Math.max(0, Pe.current - 1), Pe.current ||
|
|
12138
|
+
}) : (Pe.current = Math.max(0, Pe.current - 1), Pe.current || dt(!1), null);
|
|
12082
12139
|
}, [
|
|
12083
|
-
|
|
12140
|
+
j,
|
|
12084
12141
|
P,
|
|
12085
12142
|
n,
|
|
12086
|
-
|
|
12143
|
+
M,
|
|
12087
12144
|
s,
|
|
12088
|
-
|
|
12089
|
-
|
|
12090
|
-
|
|
12145
|
+
St,
|
|
12146
|
+
dt,
|
|
12147
|
+
ie
|
|
12091
12148
|
]);
|
|
12092
12149
|
_(() => {
|
|
12093
|
-
if (!u || Re.current || !s.current || !
|
|
12150
|
+
if (!u || Re.current || !s.current || !Ym(j)) return;
|
|
12094
12151
|
let e = u.clone().normalize();
|
|
12095
12152
|
Re.current = !0;
|
|
12096
|
-
let t =
|
|
12097
|
-
t && (
|
|
12153
|
+
let t = St("orthographic") ?? (Ym(j) ? j : null);
|
|
12154
|
+
t && (dt(!0), P.setHelpersActive(!1), P.createPlaneFromPointAndNormal(wl(e), e.normal.clone()), requestAnimationFrame(() => {
|
|
12098
12155
|
Cl({
|
|
12099
12156
|
camera: t,
|
|
12100
12157
|
controls: n.current,
|
|
12101
|
-
invalidate:
|
|
12158
|
+
invalidate: M,
|
|
12102
12159
|
model: s.current,
|
|
12103
12160
|
plane: e,
|
|
12104
|
-
size:
|
|
12161
|
+
size: ie
|
|
12105
12162
|
});
|
|
12106
12163
|
}));
|
|
12107
12164
|
}, [
|
|
12108
|
-
|
|
12165
|
+
j,
|
|
12109
12166
|
P,
|
|
12110
12167
|
n,
|
|
12111
12168
|
u,
|
|
12112
|
-
|
|
12169
|
+
M,
|
|
12113
12170
|
s,
|
|
12114
|
-
|
|
12115
|
-
|
|
12116
|
-
|
|
12171
|
+
St,
|
|
12172
|
+
dt,
|
|
12173
|
+
ie
|
|
12117
12174
|
]);
|
|
12118
|
-
let
|
|
12175
|
+
let Et = h(() => {
|
|
12119
12176
|
if (Oe.current) return !0;
|
|
12120
12177
|
let e = Te.current;
|
|
12121
12178
|
return e.length ? !e.every((e) => {
|
|
12122
12179
|
let t = Ee.current.get(e) ?? 0;
|
|
12123
12180
|
return t <= 0 ? !0 : (Be.current.get(e) ?? 0) >= t;
|
|
12124
12181
|
}) : !1;
|
|
12125
|
-
}, []),
|
|
12182
|
+
}, []), Dt = h((t) => {
|
|
12126
12183
|
if (!t) return !1;
|
|
12127
|
-
let n =
|
|
12128
|
-
if (!e || !r) return n || (V.current =
|
|
12184
|
+
let n = Et();
|
|
12185
|
+
if (!e || !r) return n || (V.current = Nm()), !1;
|
|
12129
12186
|
let i = V.current;
|
|
12130
12187
|
if (n) {
|
|
12131
|
-
i.active || (V.current =
|
|
12188
|
+
i.active || (V.current = Nm(!0));
|
|
12132
12189
|
let e = V.current;
|
|
12133
12190
|
return e.firstFitDone ? !1 : (e.firstFitDone = !0, !0);
|
|
12134
12191
|
}
|
|
12135
|
-
return i.active ? i.finalFitDone ? !1 : i.firstFitDone && i.userInteractedAfterFirstFit ? (V.current =
|
|
12192
|
+
return i.active ? i.finalFitDone ? !1 : i.firstFitDone && i.userInteractedAfterFirstFit ? (V.current = Nm(), !1) : (i.finalFitDone = !0, !0) : !0;
|
|
12136
12193
|
}, [
|
|
12137
12194
|
e,
|
|
12138
12195
|
r,
|
|
12139
|
-
|
|
12140
|
-
]),
|
|
12196
|
+
Et
|
|
12197
|
+
]), Ot = h((e, t = !1) => {
|
|
12141
12198
|
let r = n.current;
|
|
12142
12199
|
if (!r) return;
|
|
12143
|
-
let i =
|
|
12200
|
+
let i = nh(e, N.buildIndex());
|
|
12144
12201
|
if (!i) return;
|
|
12145
12202
|
let a = i.getCenter(new W());
|
|
12146
12203
|
if (be.current = a.clone(), r.cancel(), t) {
|
|
12147
|
-
let e =
|
|
12204
|
+
let e = rh(i);
|
|
12148
12205
|
r.fitToBox(i, !0, {
|
|
12149
12206
|
paddingBottom: e,
|
|
12150
12207
|
paddingLeft: e,
|
|
@@ -12152,16 +12209,16 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12152
12209
|
paddingTop: e
|
|
12153
12210
|
}).then(() => {
|
|
12154
12211
|
let e = be.current;
|
|
12155
|
-
e &&
|
|
12212
|
+
e && yt(e, !0);
|
|
12156
12213
|
});
|
|
12157
12214
|
return;
|
|
12158
12215
|
}
|
|
12159
|
-
|
|
12216
|
+
yt(a, !0);
|
|
12160
12217
|
}, [
|
|
12161
|
-
|
|
12218
|
+
yt,
|
|
12162
12219
|
n,
|
|
12163
|
-
|
|
12164
|
-
]),
|
|
12220
|
+
N
|
|
12221
|
+
]), kt = b(() => {
|
|
12165
12222
|
let e = (e) => ({
|
|
12166
12223
|
...e,
|
|
12167
12224
|
activeViewRoot: s.current
|
|
@@ -12179,9 +12236,9 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12179
12236
|
let e = () => {
|
|
12180
12237
|
z.current !== null && (window.clearTimeout(z.current), z.current = null);
|
|
12181
12238
|
}, t = () => {
|
|
12182
|
-
we.current && (
|
|
12239
|
+
we.current && (Vm(we.current), we.current = null, M());
|
|
12183
12240
|
};
|
|
12184
|
-
if (!
|
|
12241
|
+
if (!ee) {
|
|
12185
12242
|
e(), t(), P.setCapsCameraMotionActive(!1), P.setEdgesCameraMotionActive?.(!1), v("sleep");
|
|
12186
12243
|
return;
|
|
12187
12244
|
}
|
|
@@ -12194,7 +12251,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12194
12251
|
return;
|
|
12195
12252
|
}
|
|
12196
12253
|
z.current = null, v("move"), P.setCapsCameraMotionActive(!0), P.setEdgesCameraMotionActive?.(!0);
|
|
12197
|
-
},
|
|
12254
|
+
}, pm));
|
|
12198
12255
|
}, a = () => {
|
|
12199
12256
|
e(), t(), P.setCapsCameraMotionActive(!1), P.setEdgesCameraMotionActive?.(!1), v("sleep");
|
|
12200
12257
|
};
|
|
@@ -12205,22 +12262,22 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12205
12262
|
P,
|
|
12206
12263
|
n,
|
|
12207
12264
|
Ue,
|
|
12208
|
-
|
|
12265
|
+
M,
|
|
12209
12266
|
v,
|
|
12210
|
-
|
|
12267
|
+
ee
|
|
12211
12268
|
]), _(() => {
|
|
12212
12269
|
let e = () => {
|
|
12213
12270
|
B.current !== null && (window.clearTimeout(B.current), B.current = null);
|
|
12214
12271
|
}, t = () => {
|
|
12215
12272
|
Se.current !== null && (window.clearTimeout(Se.current), Se.current = null);
|
|
12216
12273
|
}, r = (n = !1) => {
|
|
12217
|
-
e(), we.current && (
|
|
12274
|
+
e(), we.current && (Vm(we.current), we.current = null, M()), n && (t(), Ce.current = null);
|
|
12218
12275
|
}, i = () => {
|
|
12219
12276
|
t(), Se.current = window.setTimeout(() => {
|
|
12220
12277
|
Se.current = null, Ce.current = null;
|
|
12221
|
-
},
|
|
12278
|
+
}, hm);
|
|
12222
12279
|
};
|
|
12223
|
-
if (!
|
|
12280
|
+
if (!ee) {
|
|
12224
12281
|
r(!0);
|
|
12225
12282
|
return;
|
|
12226
12283
|
}
|
|
@@ -12228,13 +12285,13 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12228
12285
|
if (!a) return;
|
|
12229
12286
|
let o = () => {
|
|
12230
12287
|
if (B.current = null, Fe.current || we.current) return;
|
|
12231
|
-
s.current?.updateMatrixWorld(!0), (!Ce.current || Ce.current.root !== s.current) && (Ce.current =
|
|
12288
|
+
s.current?.updateMatrixWorld(!0), (!Ce.current || Ce.current.root !== s.current) && (Ce.current = zm(s.current, U));
|
|
12232
12289
|
let e = Ce.current;
|
|
12233
12290
|
if (!e) return;
|
|
12234
|
-
let t =
|
|
12235
|
-
t && (we.current = t,
|
|
12291
|
+
let t = Bm(e);
|
|
12292
|
+
t && (we.current = t, M());
|
|
12236
12293
|
}, c = () => {
|
|
12237
|
-
Fe.current || (t(), !we.current && B.current === null && (B.current = window.setTimeout(o,
|
|
12294
|
+
Fe.current || (t(), !we.current && B.current === null && (B.current = window.setTimeout(o, mm)));
|
|
12238
12295
|
}, l = () => {
|
|
12239
12296
|
r(), i();
|
|
12240
12297
|
};
|
|
@@ -12244,14 +12301,14 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12244
12301
|
}, [
|
|
12245
12302
|
n,
|
|
12246
12303
|
Ue,
|
|
12247
|
-
|
|
12304
|
+
M,
|
|
12248
12305
|
s,
|
|
12249
|
-
|
|
12250
|
-
|
|
12306
|
+
U,
|
|
12307
|
+
ee
|
|
12251
12308
|
]), _(() => {
|
|
12252
|
-
l && !Ie.current && (V.current =
|
|
12309
|
+
l && !Ie.current && (V.current = Nm(!0)), Ie.current = l;
|
|
12253
12310
|
}, [l]), _(() => {
|
|
12254
|
-
let e = n.current, t =
|
|
12311
|
+
let e = n.current, t = te.domElement, r = () => {
|
|
12255
12312
|
let e = V.current;
|
|
12256
12313
|
!e.active || !e.firstFitDone || (e.userInteractedAfterFirstFit = !0);
|
|
12257
12314
|
};
|
|
@@ -12261,61 +12318,61 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12261
12318
|
}, [
|
|
12262
12319
|
n,
|
|
12263
12320
|
Ue,
|
|
12264
|
-
|
|
12321
|
+
te
|
|
12265
12322
|
]);
|
|
12266
|
-
let
|
|
12267
|
-
return
|
|
12268
|
-
let e =
|
|
12323
|
+
let At = h(() => !Et(), [Et]);
|
|
12324
|
+
return Sp(s, n, ue, bt, P.getSelectableObjects, de, At, Ue), Ef(), _(() => {
|
|
12325
|
+
let e = te.domElement, t = (e) => {
|
|
12269
12326
|
let t = be.current;
|
|
12270
|
-
t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey ||
|
|
12327
|
+
t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || yt(t, !0));
|
|
12271
12328
|
};
|
|
12272
12329
|
return e.addEventListener("pointerdown", t, !0), () => {
|
|
12273
12330
|
e.removeEventListener("pointerdown", t, !0);
|
|
12274
12331
|
};
|
|
12275
|
-
}, [
|
|
12332
|
+
}, [yt, te]), _(() => (ue.setClippingSource(P), () => {
|
|
12276
12333
|
ue.setClippingSource(null);
|
|
12277
|
-
}), [ue, P]), _(() => (t.current =
|
|
12278
|
-
t.current ===
|
|
12279
|
-
}), [
|
|
12334
|
+
}), [ue, P]), _(() => (t.current = j, () => {
|
|
12335
|
+
t.current === j && (t.current = null);
|
|
12336
|
+
}), [j, t]), _(() => {
|
|
12280
12337
|
if (!s.current) return;
|
|
12281
12338
|
let t = null, n = null, r = !1, a = (e) => {
|
|
12282
12339
|
t = requestAnimationFrame(e);
|
|
12283
12340
|
}, o = () => {
|
|
12284
|
-
let e =
|
|
12341
|
+
let e = Et();
|
|
12285
12342
|
if (!e) {
|
|
12286
12343
|
let e = V.current;
|
|
12287
12344
|
if (e.active && e.firstFitDone && e.userInteractedAfterFirstFit) {
|
|
12288
|
-
V.current =
|
|
12345
|
+
V.current = Nm();
|
|
12289
12346
|
return;
|
|
12290
12347
|
}
|
|
12291
12348
|
}
|
|
12292
|
-
|
|
12349
|
+
xt(), e || (V.current = Nm());
|
|
12293
12350
|
}, c = () => {
|
|
12294
12351
|
if (e) {
|
|
12295
|
-
if (!
|
|
12352
|
+
if (!A) {
|
|
12296
12353
|
o();
|
|
12297
12354
|
return;
|
|
12298
12355
|
}
|
|
12299
12356
|
a(() => {
|
|
12300
12357
|
r || !s.current || (s.current.updateMatrixWorld(!0), (async () => {
|
|
12301
|
-
let e =
|
|
12358
|
+
let e = te;
|
|
12302
12359
|
if (typeof e.compileAsync == "function") try {
|
|
12303
|
-
await e.compileAsync(
|
|
12360
|
+
await e.compileAsync(ne, j);
|
|
12304
12361
|
} catch {}
|
|
12305
12362
|
r || !s.current || a(() => {
|
|
12306
|
-
r || !s.current || (s.current.updateMatrixWorld(!0), o(),
|
|
12363
|
+
r || !s.current || (s.current.updateMatrixWorld(!0), o(), M());
|
|
12307
12364
|
});
|
|
12308
12365
|
})());
|
|
12309
12366
|
});
|
|
12310
12367
|
}
|
|
12311
12368
|
}, l = () => {
|
|
12312
12369
|
if (n !== null) return;
|
|
12313
|
-
let e =
|
|
12370
|
+
let e = wm, t = () => {
|
|
12314
12371
|
if (r) {
|
|
12315
12372
|
n = null;
|
|
12316
12373
|
return;
|
|
12317
12374
|
}
|
|
12318
|
-
if (!s.current ||
|
|
12375
|
+
if (!s.current || Et()) {
|
|
12319
12376
|
n = null;
|
|
12320
12377
|
return;
|
|
12321
12378
|
}
|
|
@@ -12328,29 +12385,29 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12328
12385
|
n = requestAnimationFrame(t);
|
|
12329
12386
|
}, u = (e) => {
|
|
12330
12387
|
if (r || !s.current) return;
|
|
12331
|
-
s.current.updateMatrixWorld(!0), (
|
|
12388
|
+
s.current.updateMatrixWorld(!0), (j instanceof Ae || j instanceof ke) && th(j, s.current), vt(), ve();
|
|
12332
12389
|
let n = _e();
|
|
12333
12390
|
if (!n.records.size && e > 0) {
|
|
12334
12391
|
t = requestAnimationFrame(() => u(e - 1));
|
|
12335
12392
|
return;
|
|
12336
12393
|
}
|
|
12337
|
-
R(), P.syncWithModel(), F.syncWithModel(), n.records.size > 0 && !
|
|
12394
|
+
R(), P.syncWithModel(), F.syncWithModel(), n.records.size > 0 && !Et() && l(), je.current !== j.uuid && Dt(n.records.size > 0) && c();
|
|
12338
12395
|
};
|
|
12339
|
-
return a(() => u(
|
|
12396
|
+
return a(() => u(A ? Cm : Sm)), () => {
|
|
12340
12397
|
r = !0, t !== null && cancelAnimationFrame(t), n !== null && cancelAnimationFrame(n);
|
|
12341
12398
|
};
|
|
12342
12399
|
}, [
|
|
12343
12400
|
R,
|
|
12344
12401
|
e,
|
|
12345
12402
|
_e,
|
|
12346
|
-
|
|
12403
|
+
j,
|
|
12347
12404
|
P,
|
|
12348
12405
|
n,
|
|
12349
12406
|
F,
|
|
12350
|
-
|
|
12351
|
-
|
|
12407
|
+
xt,
|
|
12408
|
+
Et,
|
|
12352
12409
|
a,
|
|
12353
|
-
|
|
12410
|
+
te,
|
|
12354
12411
|
s,
|
|
12355
12412
|
c,
|
|
12356
12413
|
l,
|
|
@@ -12358,25 +12415,25 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12358
12415
|
i,
|
|
12359
12416
|
g,
|
|
12360
12417
|
ve,
|
|
12361
|
-
|
|
12362
|
-
|
|
12363
|
-
|
|
12364
|
-
|
|
12418
|
+
ne,
|
|
12419
|
+
Dt,
|
|
12420
|
+
vt,
|
|
12421
|
+
A
|
|
12365
12422
|
]), _(() => {
|
|
12366
12423
|
let e = () => {
|
|
12367
12424
|
P.getActive() && P.syncWithModel();
|
|
12368
12425
|
}, t = (t) => {
|
|
12369
12426
|
t(), e();
|
|
12370
12427
|
};
|
|
12371
|
-
return
|
|
12428
|
+
return D({
|
|
12372
12429
|
camera: {
|
|
12373
|
-
fitCamera:
|
|
12430
|
+
fitCamera: xt,
|
|
12374
12431
|
getIntersection: ue.getIntersection,
|
|
12375
|
-
getProjection: () =>
|
|
12376
|
-
setFirstPersonControlActive:
|
|
12377
|
-
setFirstPersonControlSettings:
|
|
12378
|
-
setProjection:
|
|
12379
|
-
toggleProjection:
|
|
12432
|
+
getProjection: () => Jm(j),
|
|
12433
|
+
setFirstPersonControlActive: ot,
|
|
12434
|
+
setFirstPersonControlSettings: ct,
|
|
12435
|
+
setProjection: St,
|
|
12436
|
+
toggleProjection: Ct
|
|
12380
12437
|
},
|
|
12381
12438
|
clipping: {
|
|
12382
12439
|
createClippingRectangle: P.createClippingRectangle,
|
|
@@ -12406,7 +12463,7 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12406
12463
|
rebuildModelByColors: se.rebuildModelByColors,
|
|
12407
12464
|
setColor: se.setColor
|
|
12408
12465
|
},
|
|
12409
|
-
converter:
|
|
12466
|
+
converter: kt,
|
|
12410
12467
|
dimensions: {
|
|
12411
12468
|
cancelDrawing: F.cancelDrawing,
|
|
12412
12469
|
changeAxes: F.changeAxes,
|
|
@@ -12439,61 +12496,63 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12439
12496
|
},
|
|
12440
12497
|
geometryUtils: {
|
|
12441
12498
|
get indexesState() {
|
|
12442
|
-
return
|
|
12499
|
+
return ae.indexesState;
|
|
12443
12500
|
},
|
|
12444
|
-
getAllIds:
|
|
12445
|
-
getIfcSpacesVisibility:
|
|
12446
|
-
getModelGeometry: (e) =>
|
|
12447
|
-
getModelsGeometry: () =>
|
|
12448
|
-
hideByIds: (e, n) => t(() =>
|
|
12449
|
-
hideSelected: () => t(
|
|
12450
|
-
isolateByIds: (e, n) => t(() =>
|
|
12451
|
-
isolateSelected: () => t(
|
|
12452
|
-
removeByIds: (e, n) => t(() =>
|
|
12453
|
-
resetIsolation: () => t(
|
|
12454
|
-
setIfcSpacesVisibility: (e) => t(() =>
|
|
12455
|
-
showAll: () => t(
|
|
12456
|
-
showByIds: (e, n) => t(() =>
|
|
12457
|
-
toggleIIfcSpacesVisibility: () => t(
|
|
12458
|
-
useTrueNorth: (e
|
|
12501
|
+
getAllIds: ae.getAllIds,
|
|
12502
|
+
getIfcSpacesVisibility: ae.getIfcSpacesVisibility,
|
|
12503
|
+
getModelGeometry: (e) => qm(s.current, e),
|
|
12504
|
+
getModelsGeometry: () => Km(s.current),
|
|
12505
|
+
hideByIds: (e, n) => t(() => ae.hideByIds(e, n)),
|
|
12506
|
+
hideSelected: () => t(ae.hideSelected),
|
|
12507
|
+
isolateByIds: (e, n) => t(() => ae.isolateByIds(e, n)),
|
|
12508
|
+
isolateSelected: () => t(ae.isolateSelected),
|
|
12509
|
+
removeByIds: (e, n) => t(() => ae.removeByIds(e, n)),
|
|
12510
|
+
resetIsolation: () => t(ae.resetIsolation),
|
|
12511
|
+
setIfcSpacesVisibility: (e) => t(() => ae.setIfcSpacesVisibility(e)),
|
|
12512
|
+
showAll: () => t(ae.showAll),
|
|
12513
|
+
showByIds: (e, n) => t(() => ae.showByIds(e, n)),
|
|
12514
|
+
toggleIIfcSpacesVisibility: () => t(ae.toggleIIfcSpacesVisibility),
|
|
12515
|
+
useTrueNorth: (e = !0) => {
|
|
12516
|
+
Ke(e), t(() => ae.useTrueNorth(e));
|
|
12517
|
+
}
|
|
12459
12518
|
},
|
|
12460
|
-
plans: { createPlan:
|
|
12461
|
-
selector: { setTargetToSelection:
|
|
12462
|
-
}), Le.current || (Le.current = !0, m?.(C)), () =>
|
|
12519
|
+
plans: { createPlan: wt },
|
|
12520
|
+
selector: { setTargetToSelection: Ot }
|
|
12521
|
+
}), Le.current || (Le.current = !0, m?.(C)), () => D(null);
|
|
12463
12522
|
}, [
|
|
12464
|
-
|
|
12523
|
+
j,
|
|
12465
12524
|
P,
|
|
12466
12525
|
ue,
|
|
12467
12526
|
se,
|
|
12468
12527
|
n,
|
|
12469
|
-
|
|
12470
|
-
|
|
12528
|
+
kt,
|
|
12529
|
+
wt,
|
|
12471
12530
|
F,
|
|
12472
|
-
|
|
12473
|
-
|
|
12531
|
+
xt,
|
|
12532
|
+
ae,
|
|
12474
12533
|
a,
|
|
12475
12534
|
s,
|
|
12476
12535
|
he,
|
|
12477
12536
|
m,
|
|
12478
12537
|
C,
|
|
12479
|
-
|
|
12538
|
+
St,
|
|
12480
12539
|
I,
|
|
12481
|
-
|
|
12482
|
-
|
|
12483
|
-
|
|
12484
|
-
|
|
12540
|
+
ot,
|
|
12541
|
+
ct,
|
|
12542
|
+
D,
|
|
12543
|
+
Ot,
|
|
12485
12544
|
fe,
|
|
12486
|
-
|
|
12545
|
+
Ct
|
|
12487
12546
|
]), /* @__PURE__ */ nt(tt, { children: [
|
|
12488
|
-
|
|
12489
|
-
ambientColor:
|
|
12490
|
-
ambientIntensity:
|
|
12491
|
-
directionalColor:
|
|
12492
|
-
directionalIntensity:
|
|
12547
|
+
_t && (A ? /* @__PURE__ */ G(Lo, {
|
|
12548
|
+
ambientColor: Qe.ambient.color,
|
|
12549
|
+
ambientIntensity: Qe.ambient.intensity,
|
|
12550
|
+
directionalColor: Qe.directional.color,
|
|
12551
|
+
directionalIntensity: Qe.directional.intensity,
|
|
12493
12552
|
lightRef: a
|
|
12494
12553
|
}) : /* @__PURE__ */ nt(tt, { children: [/* @__PURE__ */ G("ambientLight", {
|
|
12495
|
-
intensity:
|
|
12496
|
-
color:
|
|
12554
|
+
intensity: Qe.ambient.intensity,
|
|
12555
|
+
color: Qe.ambient.color
|
|
12497
12556
|
}), /* @__PURE__ */ G("directionalLight", {
|
|
12498
12557
|
ref: a,
|
|
12499
12558
|
position: [
|
|
@@ -12501,47 +12560,48 @@ function $m({ autoFitCamera: e, cameraRef: t, controlRef: n, fitToView: r, loadG
|
|
|
12501
12560
|
10,
|
|
12502
12561
|
10
|
|
12503
12562
|
],
|
|
12504
|
-
color:
|
|
12505
|
-
intensity:
|
|
12563
|
+
color: Qe.directional.color,
|
|
12564
|
+
intensity: Qe.directional.intensity
|
|
12506
12565
|
})] })),
|
|
12507
|
-
|
|
12566
|
+
Ze && /* @__PURE__ */ G(st, {}),
|
|
12508
12567
|
/* @__PURE__ */ G("group", {
|
|
12509
|
-
ref:
|
|
12510
|
-
children:
|
|
12568
|
+
ref: et,
|
|
12569
|
+
children: mt.map(([e, t]) => /* @__PURE__ */ G(hd, {
|
|
12511
12570
|
colorPaletteTexture: oe,
|
|
12512
|
-
coordinationMatrix:
|
|
12571
|
+
coordinationMatrix: pt,
|
|
12513
12572
|
data: t,
|
|
12514
12573
|
loadGeneration: i,
|
|
12515
12574
|
materialMode: o,
|
|
12516
12575
|
modelID: e,
|
|
12517
|
-
onUploadComplete: (t) =>
|
|
12518
|
-
onUploadProgress: (t, n) =>
|
|
12519
|
-
|
|
12576
|
+
onUploadComplete: (t) => $e(e, t, gt.get(e) ?? t),
|
|
12577
|
+
onUploadProgress: (t, n) => $e(e, t, n),
|
|
12578
|
+
trueNorthEnabled: Ge,
|
|
12579
|
+
useWebGPU: A
|
|
12520
12580
|
}, e))
|
|
12521
12581
|
}),
|
|
12522
12582
|
he.layer,
|
|
12523
|
-
/* @__PURE__ */ G(
|
|
12524
|
-
active:
|
|
12525
|
-
activeRef:
|
|
12583
|
+
/* @__PURE__ */ G(um, {
|
|
12584
|
+
active: qe,
|
|
12585
|
+
activeRef: Xe,
|
|
12526
12586
|
controlRef: n,
|
|
12527
12587
|
modelRef: s,
|
|
12528
|
-
settings:
|
|
12588
|
+
settings: Ye
|
|
12529
12589
|
}),
|
|
12530
|
-
!
|
|
12531
|
-
camera:
|
|
12590
|
+
!qe && /* @__PURE__ */ G(at, {
|
|
12591
|
+
camera: Ym(j) ? j : void 0,
|
|
12532
12592
|
dollyToCursor: !0,
|
|
12533
|
-
infinityDolly:
|
|
12534
|
-
minDistance:
|
|
12535
|
-
ref:
|
|
12593
|
+
infinityDolly: j instanceof Ae,
|
|
12594
|
+
minDistance: dm,
|
|
12595
|
+
ref: it,
|
|
12536
12596
|
draggingSmoothTime: .03,
|
|
12537
12597
|
smoothTime: .05
|
|
12538
|
-
},
|
|
12598
|
+
}, j.uuid)
|
|
12539
12599
|
] });
|
|
12540
12600
|
}
|
|
12541
12601
|
//#endregion
|
|
12542
12602
|
//#region src/viewer/Viewer.tsx
|
|
12543
|
-
var
|
|
12544
|
-
function
|
|
12603
|
+
var oh = .75, sh = .6;
|
|
12604
|
+
function ch(e, t, n) {
|
|
12545
12605
|
let r = e?.[t.modelID] ?? {
|
|
12546
12606
|
coordinationMatrix: t.coordinationMatrix ?? t.geometry.matrix ?? void 0,
|
|
12547
12607
|
data: {},
|
|
@@ -12566,11 +12626,11 @@ function nh(e, t, n) {
|
|
|
12566
12626
|
}
|
|
12567
12627
|
};
|
|
12568
12628
|
}
|
|
12569
|
-
function
|
|
12629
|
+
function lh(e) {
|
|
12570
12630
|
let t = {};
|
|
12571
12631
|
return e.materialMode !== void 0 && (t.materialMode = e.materialMode), e.uploadMode !== void 0 && (t.uploadMode = e.uploadMode), e.useDoubleSideMaterial !== void 0 && (t.useDoubleSideMaterial = e.useDoubleSideMaterial), Object.keys(t).length ? t : void 0;
|
|
12572
12632
|
}
|
|
12573
|
-
function
|
|
12633
|
+
function uh(e, t, n) {
|
|
12574
12634
|
let r = { ...e ?? {} };
|
|
12575
12635
|
return Object.entries(t).forEach(([t, i]) => {
|
|
12576
12636
|
let a = Number(t);
|
|
@@ -12583,33 +12643,33 @@ function ih(e, t, n) {
|
|
|
12583
12643
|
});
|
|
12584
12644
|
}), r;
|
|
12585
12645
|
}
|
|
12586
|
-
function
|
|
12646
|
+
function dh(e, t) {
|
|
12587
12647
|
if (!e || !Object.prototype.hasOwnProperty.call(e, t)) return e;
|
|
12588
12648
|
let n = { ...e };
|
|
12589
12649
|
return delete n[t], Object.keys(n).length ? n : void 0;
|
|
12590
12650
|
}
|
|
12591
|
-
function
|
|
12651
|
+
function fh(e, t) {
|
|
12592
12652
|
return Array.isArray(e) ? [Math.min(e[0], t), Math.min(e[1], t)] : typeof e == "number" ? Math.min(e, t) : t;
|
|
12593
12653
|
}
|
|
12594
|
-
function
|
|
12654
|
+
function ph(e) {
|
|
12595
12655
|
return Array.isArray(e) ? [Math.max(e[0], 2), Math.max(e[1], 2)] : typeof e == "number" ? Math.max(e, 2) : 2;
|
|
12596
12656
|
}
|
|
12597
|
-
function
|
|
12657
|
+
function mh() {
|
|
12598
12658
|
let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
12599
12659
|
return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
|
|
12600
12660
|
}
|
|
12601
|
-
function
|
|
12661
|
+
function hh({ autoFitCamera: e = !0, camera: t = {
|
|
12602
12662
|
position: [
|
|
12603
12663
|
10,
|
|
12604
12664
|
10,
|
|
12605
12665
|
10
|
|
12606
12666
|
],
|
|
12607
12667
|
fov: 50
|
|
12608
|
-
}, dpr: n = window.devicePixelRatio, fitToView: r, initialPlanPlane: i = null, modelUrls: a, modelSources: o, modelsData: s, materialMode: c, onReady: l, performanceMode: u = !1, publicApi: f, setModelsApi: p, setPlansContainerFactory: m, setSceneApi: g, showNavCube: v, showStats: y, usePerformanceMoving:
|
|
12609
|
-
let
|
|
12668
|
+
}, dpr: n = window.devicePixelRatio, fitToView: r, initialPlanPlane: i = null, modelUrls: a, modelSources: o, modelsData: s, materialMode: c, onReady: l, performanceMode: u = !1, publicApi: f, setModelsApi: p, setPlansContainerFactory: m, setSceneApi: g, showNavCube: v, showStats: y, usePerformanceMoving: T = !1, useWebGPU: E = !1 }) {
|
|
12669
|
+
let D = x(null), O = x(null), k = x(null), ee = x(null), [A, j] = S(), [te, M] = S(!1), [ne, re] = S(!0), [ie, N] = S(null), ae = x(void 0), oe = x(!1), se = x(null), ce = x(null), le = x({
|
|
12610
12670
|
lastProgress: 0,
|
|
12611
12671
|
requestID: 0
|
|
12612
|
-
}), ue = x(null), P = x(/* @__PURE__ */ new Set()), de = x(0), F = x(/* @__PURE__ */ new Map()), I = x(/* @__PURE__ */ new Set()), fe = x(/* @__PURE__ */ new Set()), L = x(!1), pe = x(null), me = x(null), he = x(/* @__PURE__ */ new Set()), ge = x(/* @__PURE__ */ new Map()), _e = x(!
|
|
12672
|
+
}), ue = x(null), P = x(/* @__PURE__ */ new Set()), de = x(0), F = x(/* @__PURE__ */ new Map()), I = x(/* @__PURE__ */ new Set()), fe = x(/* @__PURE__ */ new Set()), L = x(!1), pe = x(null), me = x(null), he = x(/* @__PURE__ */ new Set()), ge = x(/* @__PURE__ */ new Map()), _e = x(!E), ve = x(/* @__PURE__ */ new Set()), R = Tt(), ye = K((e) => e.setModelNames), be = K((e) => e.setModelProps), xe = K((e) => e.setModelStructure), z = K((e) => e.setShowNavCube), B = K((e) => e.setShowStats), Se = K((e) => e.setUserDevice), Ce = K((e) => e.showNavCube), we = te, V = we ? A ?? s : s ?? A, Te = r ?? ne, Ee = u ? fh(n, 1) : n, De = fh(Ee, u ? sh : oh), Oe = c ?? (u ? "performance" : void 0), [ke, Ae] = S("sleep"), je = ph(Ee), Me = b(() => E ? No({ performanceMode: u }) : u ? Wo : void 0, [u, E]), Ne = u ? Uo : Ho, Pe = h(() => {
|
|
12613
12673
|
I.current.forEach((e) => {
|
|
12614
12674
|
e();
|
|
12615
12675
|
});
|
|
@@ -12636,7 +12696,7 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12636
12696
|
t.setNodeModeActive(e);
|
|
12637
12697
|
});
|
|
12638
12698
|
}, []), Ve = h((e, t, r, i) => {
|
|
12639
|
-
let a =
|
|
12699
|
+
let a = k.current;
|
|
12640
12700
|
if (!a) return null;
|
|
12641
12701
|
F.current.get(t)?.handle.dispose();
|
|
12642
12702
|
let o = C(t), s = (i ? Tl(a, i) : e).clone().normalize(), c = {
|
|
@@ -12664,7 +12724,7 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12664
12724
|
registerNotesApi: Ie,
|
|
12665
12725
|
sourceModel: a,
|
|
12666
12726
|
useLocalClippingVisuals: !!i,
|
|
12667
|
-
useWebGPU:
|
|
12727
|
+
useWebGPU: E,
|
|
12668
12728
|
viewNormal: r
|
|
12669
12729
|
})
|
|
12670
12730
|
})), c;
|
|
@@ -12674,7 +12734,7 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12674
12734
|
u,
|
|
12675
12735
|
Fe,
|
|
12676
12736
|
Ie,
|
|
12677
|
-
|
|
12737
|
+
E,
|
|
12678
12738
|
R
|
|
12679
12739
|
]);
|
|
12680
12740
|
_(() => (m(Ve), () => m(null)), [Ve, m]);
|
|
@@ -12710,14 +12770,14 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12710
12770
|
e.forEach((e) => e());
|
|
12711
12771
|
}), ge.current.clear(), he.current.clear();
|
|
12712
12772
|
}, []), _(() => {
|
|
12713
|
-
|
|
12773
|
+
ae.current = V;
|
|
12714
12774
|
}, [V]), _(() => {
|
|
12715
12775
|
oe.current = we;
|
|
12716
12776
|
}, [we]), _(() => {
|
|
12717
|
-
se.current =
|
|
12718
|
-
}, [
|
|
12719
|
-
_e.current = !
|
|
12720
|
-
}, [
|
|
12777
|
+
se.current = ie;
|
|
12778
|
+
}, [ie]), _(() => {
|
|
12779
|
+
_e.current = !E, E || (ve.current.forEach((e) => e()), ve.current.clear());
|
|
12780
|
+
}, [E]);
|
|
12721
12781
|
let Je = h((e) => {
|
|
12722
12782
|
let t = le.current;
|
|
12723
12783
|
if (de.current !== t.requestID) return;
|
|
@@ -12725,41 +12785,41 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12725
12785
|
...e,
|
|
12726
12786
|
progress: n
|
|
12727
12787
|
};
|
|
12728
|
-
t.lastProgress = r.progress, se.current = r,
|
|
12788
|
+
t.lastProgress = r.progress, se.current = r, N(r), t.onModelProgress?.(r), t.onProgress?.(r);
|
|
12729
12789
|
}, []), Ye = h(() => {
|
|
12730
12790
|
de.current += 1, ge.current.forEach((e) => {
|
|
12731
12791
|
e.forEach((e) => e());
|
|
12732
|
-
}), ge.current.clear(), he.current.clear(),
|
|
12792
|
+
}), ge.current.clear(), he.current.clear(), M(!1), N(null), se.current = null, ce.current = null, le.current = {
|
|
12733
12793
|
lastProgress: 0,
|
|
12734
12794
|
requestID: de.current
|
|
12735
|
-
}, P.current.clear(),
|
|
12795
|
+
}, P.current.clear(), j(void 0), ae.current = void 0, ue.current?.(void 0), R.getState().setSelection({}), R.getState().setModelNames({}), R.getState().setModelProps({}), R.getState().setModelStructure({});
|
|
12736
12796
|
}, [R]), H = h((e, t) => {
|
|
12737
|
-
|
|
12797
|
+
j((n) => {
|
|
12738
12798
|
let r = e(n);
|
|
12739
|
-
return t?.(r), r;
|
|
12799
|
+
return r === n ? n : (ae.current = r, t?.(r), r);
|
|
12740
12800
|
});
|
|
12741
12801
|
}, []), Xe = h((e, t, n) => {
|
|
12742
|
-
H((t) =>
|
|
12802
|
+
H((t) => ch(t, e, n), t);
|
|
12743
12803
|
}, [H]), Ze = h(async (e, t = {}) => {
|
|
12744
|
-
let { clearViewer: n = !1, fitToView: r = !0, onChunk: i, onModelLoadingChange: a, onModelProgress: o, onModelsDataChange: s, onProgress: c, ...l } = t, u = de.current + 1, d =
|
|
12745
|
-
f || de.current !== u || (f = !0,
|
|
12804
|
+
let { clearViewer: n = !1, fitToView: r = !0, onChunk: i, onModelLoadingChange: a, onModelProgress: o, onModelsDataChange: s, onProgress: c, ...l } = t, u = de.current + 1, d = lh(l), f = !1, p = !1, m = () => {
|
|
12805
|
+
f || de.current !== u || (f = !0, M(!1));
|
|
12746
12806
|
}, h = () => {
|
|
12747
12807
|
p || de.current !== u || (p = !0, a?.(!1));
|
|
12748
12808
|
};
|
|
12749
12809
|
de.current = u, ge.current.forEach((e) => {
|
|
12750
12810
|
e.forEach((e) => e());
|
|
12751
|
-
}), ge.current.clear(), he.current.clear(),
|
|
12811
|
+
}), ge.current.clear(), he.current.clear(), N(null), se.current = null, ce.current = null, le.current = {
|
|
12752
12812
|
lastProgress: 0,
|
|
12753
12813
|
onModelProgress: o,
|
|
12754
12814
|
onProgress: c,
|
|
12755
12815
|
requestID: u
|
|
12756
|
-
}, s && (ue.current = s),
|
|
12816
|
+
}, s && (ue.current = s), re(r), M(!0), o?.(null), a?.(!0), R.getState().setSelection({}), n && (P.current.clear(), j({}), s?.({}));
|
|
12757
12817
|
let g = (e) => {
|
|
12758
12818
|
ce.current = e, Je(e);
|
|
12759
12819
|
};
|
|
12760
12820
|
try {
|
|
12761
12821
|
let t = !!l.useWorker;
|
|
12762
|
-
|
|
12822
|
+
E && (!n && !ae.current && (j({}), s?.({})), await Ge());
|
|
12763
12823
|
let r = await bi.loadModel(e, {
|
|
12764
12824
|
...l,
|
|
12765
12825
|
...t ? {
|
|
@@ -12772,7 +12832,7 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12772
12832
|
});
|
|
12773
12833
|
if (de.current !== u) return r;
|
|
12774
12834
|
let a = Object.fromEntries(Object.entries(r).filter(([e]) => !P.current.has(Number(e))));
|
|
12775
|
-
return H((e) => t ?
|
|
12835
|
+
return H((e) => t ? uh(e, a, P.current) : {
|
|
12776
12836
|
...e ?? {},
|
|
12777
12837
|
...a
|
|
12778
12838
|
}, s), m(), Object.keys(a).length > 0 && await qe(u), h(), r;
|
|
@@ -12783,17 +12843,17 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12783
12843
|
Xe,
|
|
12784
12844
|
Je,
|
|
12785
12845
|
H,
|
|
12786
|
-
|
|
12846
|
+
E,
|
|
12787
12847
|
R,
|
|
12788
12848
|
qe,
|
|
12789
12849
|
Ge
|
|
12790
12850
|
]), Qe = h((e) => {
|
|
12791
12851
|
if (!Number.isFinite(e)) return;
|
|
12792
12852
|
P.current.add(e);
|
|
12793
|
-
let t =
|
|
12794
|
-
n !== t && (
|
|
12853
|
+
let t = ae.current, n = dh(t, e);
|
|
12854
|
+
n !== t && (ae.current = n, j(n), ue.current?.(n)), R.getState().removeModelState(e);
|
|
12795
12855
|
}, [R]), U = b(() => ({
|
|
12796
|
-
getData: () =>
|
|
12856
|
+
getData: () => ae.current,
|
|
12797
12857
|
getLoading: () => oe.current,
|
|
12798
12858
|
getProgress: () => se.current,
|
|
12799
12859
|
loadModels: Ze,
|
|
@@ -12805,7 +12865,7 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12805
12865
|
Qe
|
|
12806
12866
|
]);
|
|
12807
12867
|
return _(() => (p(U), () => p(null)), [U, p]), _(() => {
|
|
12808
|
-
Se(
|
|
12868
|
+
Se(mh());
|
|
12809
12869
|
}, [Se]), _(() => {
|
|
12810
12870
|
B(!!y);
|
|
12811
12871
|
}, [B, y]), _(() => {
|
|
@@ -12838,7 +12898,7 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12838
12898
|
style: Bo,
|
|
12839
12899
|
children: [/* @__PURE__ */ nt(w, {
|
|
12840
12900
|
camera: t,
|
|
12841
|
-
dpr:
|
|
12901
|
+
dpr: T && ke === "move" ? De : Ee,
|
|
12842
12902
|
gl: Me,
|
|
12843
12903
|
children: [/* @__PURE__ */ G("color", {
|
|
12844
12904
|
attach: "background",
|
|
@@ -12851,19 +12911,19 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12851
12911
|
children: /* @__PURE__ */ G(Ro, {})
|
|
12852
12912
|
}),
|
|
12853
12913
|
/* @__PURE__ */ G(Io, {
|
|
12854
|
-
active:
|
|
12914
|
+
active: E,
|
|
12855
12915
|
onReady: We
|
|
12856
12916
|
}),
|
|
12857
|
-
/* @__PURE__ */ G(Fo, { active:
|
|
12858
|
-
/* @__PURE__ */ G(
|
|
12917
|
+
/* @__PURE__ */ G(Fo, { active: E }),
|
|
12918
|
+
/* @__PURE__ */ G(ah, {
|
|
12859
12919
|
autoFitCamera: e,
|
|
12860
|
-
cameraRef:
|
|
12861
|
-
controlRef:
|
|
12920
|
+
cameraRef: D,
|
|
12921
|
+
controlRef: O,
|
|
12862
12922
|
fitToView: Te,
|
|
12863
12923
|
loadGeneration: de.current,
|
|
12864
|
-
lightRef:
|
|
12924
|
+
lightRef: ee,
|
|
12865
12925
|
materialMode: Oe,
|
|
12866
|
-
modelRef:
|
|
12926
|
+
modelRef: k,
|
|
12867
12927
|
modelsData: V,
|
|
12868
12928
|
modelsLoading: we,
|
|
12869
12929
|
initialPlanPlane: i,
|
|
@@ -12879,14 +12939,14 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12879
12939
|
setPlanVisualObjectsGetter: He,
|
|
12880
12940
|
setSceneApi: g,
|
|
12881
12941
|
setPlanNotesModeActive: Be,
|
|
12882
|
-
usePerformanceMoving:
|
|
12883
|
-
useWebGPU:
|
|
12942
|
+
usePerformanceMoving: T,
|
|
12943
|
+
useWebGPU: E
|
|
12884
12944
|
}),
|
|
12885
|
-
/* @__PURE__ */ G(Ao, { enabled: !
|
|
12886
|
-
/* @__PURE__ */ G(jo, { enabled:
|
|
12945
|
+
/* @__PURE__ */ G(Ao, { enabled: !E }),
|
|
12946
|
+
/* @__PURE__ */ G(jo, { enabled: E })
|
|
12887
12947
|
]
|
|
12888
12948
|
})]
|
|
12889
|
-
},
|
|
12949
|
+
}, E ? "viewer-webgpu" : "viewer-webgl"), Ce && /* @__PURE__ */ G("div", {
|
|
12890
12950
|
style: zo,
|
|
12891
12951
|
children: /* @__PURE__ */ G(w, {
|
|
12892
12952
|
camera: Vo,
|
|
@@ -12895,15 +12955,15 @@ function lh({ autoFitCamera: e = !0, camera: t = {
|
|
|
12895
12955
|
orthographic: !0,
|
|
12896
12956
|
children: /* @__PURE__ */ G($i, {
|
|
12897
12957
|
active: !0,
|
|
12898
|
-
cameraRef:
|
|
12899
|
-
controlRef:
|
|
12900
|
-
modelRef:
|
|
12958
|
+
cameraRef: D,
|
|
12959
|
+
controlRef: O,
|
|
12960
|
+
modelRef: k
|
|
12901
12961
|
})
|
|
12902
12962
|
}, "nav-cube-webgl")
|
|
12903
12963
|
})]
|
|
12904
12964
|
}) : /* @__PURE__ */ G(tt, {});
|
|
12905
12965
|
}
|
|
12906
|
-
var
|
|
12966
|
+
var gh = p(function(e, t) {
|
|
12907
12967
|
let [n] = S(St), r = x(!1), i = x(!1), a = b(() => new Go(), []), o = b(() => new qo(), []), { defaultSelected: s, onSelectedChange: c, selected: l } = e, u = h((e) => {
|
|
12908
12968
|
a.set(e);
|
|
12909
12969
|
}, [a]), d = b(() => new Ko(), []), f = h((e) => {
|
|
@@ -12932,7 +12992,7 @@ var uh = p(function(e, t) {
|
|
|
12932
12992
|
});
|
|
12933
12993
|
}, [c, n]), /* @__PURE__ */ G(wt, {
|
|
12934
12994
|
store: n,
|
|
12935
|
-
children: /* @__PURE__ */ G(
|
|
12995
|
+
children: /* @__PURE__ */ G(hh, {
|
|
12936
12996
|
...e,
|
|
12937
12997
|
publicApi: m,
|
|
12938
12998
|
setModelsApi: f,
|
|
@@ -12941,6 +13001,6 @@ var uh = p(function(e, t) {
|
|
|
12941
13001
|
})
|
|
12942
13002
|
});
|
|
12943
13003
|
});
|
|
12944
|
-
|
|
13004
|
+
gh.displayName = "Viewer";
|
|
12945
13005
|
//#endregion
|
|
12946
|
-
export { kr as BMTLoader, Qn as BmtConverter, er as ConvertIfcFileToBmt, tr as ConvertToBmt, qs as DimensionLine, nc as DimensionsUtils, pr as FilteredElementsCollector, Su as ModelGrids, $i as NavigationCube,
|
|
13006
|
+
export { kr as BMTLoader, Qn as BmtConverter, er as ConvertIfcFileToBmt, tr as ConvertToBmt, qs as DimensionLine, nc as DimensionsUtils, pr as FilteredElementsCollector, Su as ModelGrids, $i as NavigationCube, gh as Viewer, wt as ViewerStoreProvider, $n as bmtConverter, ei as convertIfcFilesToBmtInWorker, ti as createBmtConverterWorker, zr as createBmtWorker, pi as createIfcWorker, St as createViewerStore, hn as exportExcel, fn as exportModelPropertiesToExcel, Rr as loadBmtModelsInWorker, fi as loadIfcModelsInWorker, bi as loader, rc as useDimensionsUtils, K as useViewerStore, Tt as useViewerStoreApi };
|