u-space 0.0.28 → 0.0.30
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/README.md +9 -0
- package/dist/Viewer-BKNV67Jj.cjs +1 -0
- package/dist/Viewer-Cs_y7IiH.js +1256 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +1715 -1497
- package/dist/plugins/atmosphere/AgxToneMapping.d.ts +1 -1
- package/dist/plugins/atmosphere/index.cjs +1 -1
- package/dist/plugins/atmosphere/index.js +4 -4
- package/dist/plugins/curve-movement/index.cjs +1 -1
- package/dist/plugins/curve-movement/index.js +1 -1
- package/dist/plugins/fire/index.cjs +1 -1
- package/dist/plugins/fire/index.js +5 -5
- package/dist/plugins/object-controls/index.cjs +1 -1
- package/dist/plugins/object-controls/index.js +4 -4
- package/dist/plugins/tiles/index.cjs +1 -1
- package/dist/plugins/tiles/index.js +5 -5
- package/dist/plugins/u-manager/index.cjs +51 -51
- package/dist/plugins/u-manager/index.d.ts +1 -1
- package/dist/plugins/u-manager/index.js +8330 -8637
- package/dist/plugins/u-manager/loaders/SceneEditableBatchLayer.d.ts +17 -0
- package/dist/plugins/u-manager/loaders/SceneInstancedLayer.d.ts +3 -3
- package/dist/plugins/u-manager/loaders/SceneLoader.d.ts +20 -3
- package/dist/plugins/u-manager/loaders/UManagerLoader.d.ts +4 -4
- package/dist/plugins/u-manager/semantics/objects/BuildingGroup.d.ts +12 -5
- package/dist/plugins/u-manager/semantics/objects/FacilityInstancedLayer.d.ts +4 -4
- package/dist/plugins/u-manager/semantics/objects/FloorMesh.d.ts +28 -22
- package/dist/plugins/u-manager/semantics/objects/SemanticGroup.d.ts +6 -6
- package/dist/protocol-C-OMPz15.js +10 -0
- package/dist/protocol-IUAzx0lk.cjs +1 -0
- package/dist/src/batches/EditableGeometryBatchLayer.d.ts +50 -0
- package/dist/src/batches/ModelInstancedLayer.d.ts +42 -0
- package/dist/src/batches/index.d.ts +2 -0
- package/dist/src/effects/TSLEffects.d.ts +24 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/instances/InstanceObject.d.ts +57 -0
- package/dist/src/instances/index.d.ts +1 -0
- package/dist/src/interactions/MeshBVHRaycast.d.ts +9 -0
- package/dist/src/interactions/index.d.ts +1 -0
- package/dist/src/viewers/RenderPipeline.d.ts +37 -0
- package/dist/src/viewers/ReversedDepthSSGICompat.d.ts +10 -0
- package/dist/src/viewers/ReversedDepthSSRCompat.d.ts +20 -0
- package/dist/src/viewers/Viewer.d.ts +3 -1
- package/dist/src/viewers/renderInvalidation.d.ts +2 -0
- package/dist/src/worker/FrameTimingWindow.d.ts +16 -0
- package/dist/src/worker/OffscreenViewerHost.d.ts +20 -0
- package/dist/src/worker/WorkerDomTarget.d.ts +44 -0
- package/dist/src/worker/createWorkerViewer.d.ts +18 -0
- package/dist/src/worker/index.d.ts +2 -0
- package/dist/src/worker/installWorkerImageLoader.d.ts +5 -0
- package/dist/src/worker/protocol.d.ts +102 -0
- package/dist/src/worker/runtime.d.ts +2 -0
- package/dist/worker/index.cjs +1 -0
- package/dist/worker/index.js +224 -0
- package/dist/worker/runtime.cjs +1 -0
- package/dist/worker/runtime.js +418 -0
- package/docs/api-batches.md +112 -0
- package/docs/api-effects.md +2 -2
- package/docs/api-interactions.md +8 -0
- package/docs/api-managers.md +1 -1
- package/docs/api-objects.md +207 -0
- package/docs/api-plugin-u-manager.md +245 -96
- package/docs/api-render-pipeline.md +103 -5
- package/docs/api-viewer.md +188 -1
- package/docs/changelog.md +69 -6
- package/docs/examples-guide.md +111 -17
- package/docs/getting-started.md +1 -1
- package/docs/index.md +11 -4
- package/docs/mcp.md +29 -14
- package/docs/release.md +95 -0
- package/package.json +27 -4
- package/dist/plugins/u-manager/instances/SemanticInstanceObject.d.ts +0 -37
- package/dist/plugins/u-manager/instances/SemanticModelInstancedLayer.d.ts +0 -33
- package/dist/plugins/u-manager/instances/index.d.ts +0 -2
package/dist/index.js
CHANGED
|
@@ -1,211 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
import { HDRLoader as gs } from "three/addons/loaders/HDRLoader.js";
|
|
21
|
-
import { clone as ys } from "three/addons/utils/SkeletonUtils.js";
|
|
22
|
-
import { Easing as f, Tween as ws } from "three/addons/libs/tween.module.js";
|
|
23
|
-
class vs {
|
|
24
|
-
/** The type of event (e.g., 'click', 'pointerdown'). */
|
|
25
|
-
type;
|
|
26
|
-
/** The original 3D object that triggered the event. */
|
|
27
|
-
target;
|
|
28
|
-
/** The current 3D object during the bubbling phase. */
|
|
29
|
-
currentTarget;
|
|
30
|
-
/** The intersection data from raycasting, or null if not applicable. */
|
|
31
|
-
intersect;
|
|
32
|
-
/** The original DOM event, or undefined if not applicable. */
|
|
33
|
-
originalEvent;
|
|
34
|
-
_propagationStopped = !1;
|
|
35
|
-
constructor(e) {
|
|
36
|
-
this.type = e.type, this.target = e.target, this.currentTarget = e.target, this.intersect = e.intersect, this.originalEvent = e.originalEvent;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Stops the event from bubbling up the parent chain.
|
|
40
|
-
*/
|
|
41
|
-
stopPropagation() {
|
|
42
|
-
this._propagationStopped = !0;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Returns true if `stopPropagation()` has been called.
|
|
46
|
-
*/
|
|
47
|
-
get propagationStopped() {
|
|
48
|
-
return this._propagationStopped;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
class bs {
|
|
52
|
-
domElement;
|
|
53
|
-
scene;
|
|
54
|
-
camera;
|
|
55
|
-
raycaster = new Ne();
|
|
56
|
-
pointer = new C();
|
|
57
|
-
hoveredObject = null;
|
|
58
|
-
pointerDownTime = 0;
|
|
59
|
-
pointerDownPos = new C();
|
|
60
|
-
clickTimer = null;
|
|
61
|
-
longPressThreshold = 500;
|
|
62
|
-
moveThreshold = 0.01;
|
|
63
|
-
/**
|
|
64
|
-
* The objects to check for intersections. default to all children of the scene (including nested).
|
|
65
|
-
*/
|
|
66
|
-
targetObjects;
|
|
67
|
-
/**
|
|
68
|
-
* Whether to enable pointer move events (pointermove, pointerenter, pointerleave).
|
|
69
|
-
* Disabled by default for performance optimization.
|
|
70
|
-
*/
|
|
71
|
-
pointerMoveEventsEnabled = !1;
|
|
72
|
-
/**
|
|
73
|
-
* Whether interaction is enabled globally.
|
|
74
|
-
*/
|
|
75
|
-
_enabled = !0;
|
|
76
|
-
/**
|
|
77
|
-
* Objects excluded from raycasting (via addIgnore or setInteractable(false)).
|
|
78
|
-
*/
|
|
79
|
-
_excludeSet = /* @__PURE__ */ new Set();
|
|
80
|
-
constructor(e, t, s) {
|
|
81
|
-
this.domElement = e, this.scene = t, this.camera = s, this.raycaster.params.Points.threshold = 0.1, this.raycaster.params.Line.threshold = 0.1, this.targetObjects = this.scene.children, this._bindEvents();
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Updates the camera reference (useful when switching cameras).
|
|
85
|
-
*/
|
|
86
|
-
setCamera(e) {
|
|
87
|
-
this.camera = e;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Enable all interactions.
|
|
91
|
-
*/
|
|
92
|
-
enable() {
|
|
93
|
-
this._enabled = !0;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Disable all interactions.
|
|
97
|
-
*/
|
|
98
|
-
disable() {
|
|
99
|
-
this._enabled = !1;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Set whether a specific object is interactable.
|
|
103
|
-
* When set to false, the object and its children are excluded from raycasting.
|
|
104
|
-
*/
|
|
105
|
-
setInteractable(e, t) {
|
|
106
|
-
t ? this._excludeSet.delete(e) : this._excludeSet.add(e);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Add an object to the exclude list (will not receive any events).
|
|
110
|
-
* Alias for `setInteractable(object, false)`.
|
|
111
|
-
*/
|
|
112
|
-
addIgnore(e) {
|
|
113
|
-
this._excludeSet.add(e);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Remove an object from the exclude list.
|
|
117
|
-
* Alias for `setInteractable(object, true)`.
|
|
118
|
-
*/
|
|
119
|
-
removeIgnore(e) {
|
|
120
|
-
this._excludeSet.delete(e);
|
|
121
|
-
}
|
|
122
|
-
_bindEvents() {
|
|
123
|
-
this.domElement.addEventListener("click", this._onClick), this.domElement.addEventListener("dblclick", this._onDblClick), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointerup", this._onPointerUp), this.domElement.addEventListener("pointermove", this._onPointerMove);
|
|
124
|
-
}
|
|
125
|
-
_updatePointer(e) {
|
|
126
|
-
const t = this.domElement.getBoundingClientRect();
|
|
127
|
-
this.pointer.x = (e.clientX - t.left) / t.width * 2 - 1, this.pointer.y = -((e.clientY - t.top) / t.height) * 2 + 1;
|
|
128
|
-
}
|
|
129
|
-
_getIntersects() {
|
|
130
|
-
this.raycaster.setFromCamera(this.pointer, this.camera);
|
|
131
|
-
const e = this.raycaster.intersectObjects(this.targetObjects, !0);
|
|
132
|
-
return this._excludeSet.size > 0 ? e.filter((t) => {
|
|
133
|
-
let s = t.object;
|
|
134
|
-
for (; s; ) {
|
|
135
|
-
if (this._excludeSet.has(s))
|
|
136
|
-
return !1;
|
|
137
|
-
s = s.parent;
|
|
138
|
-
}
|
|
139
|
-
return !0;
|
|
140
|
-
}) : e;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Dispatches an event to the target object and bubbles up the parent chain.
|
|
144
|
-
*/
|
|
145
|
-
_dispatchToTarget(e, t, s, n) {
|
|
146
|
-
const i = new vs({
|
|
147
|
-
type: e,
|
|
148
|
-
target: t,
|
|
149
|
-
intersect: s,
|
|
150
|
-
originalEvent: n
|
|
151
|
-
});
|
|
152
|
-
let r = t;
|
|
153
|
-
for (; r && !i.propagationStopped; )
|
|
154
|
-
i.currentTarget = r, r.dispatchEvent({ type: e, event: i }), r = r.parent;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Handles a DOM event by raycasting and dispatching to the first intersected object.
|
|
158
|
-
*/
|
|
159
|
-
_handleEvent(e, t) {
|
|
160
|
-
if (!this._enabled) return;
|
|
161
|
-
this._updatePointer(t);
|
|
162
|
-
const s = this._getIntersects();
|
|
163
|
-
if (s.length === 0) return;
|
|
164
|
-
const n = s[0];
|
|
165
|
-
this._dispatchToTarget(e, n.object, n, t);
|
|
166
|
-
}
|
|
167
|
-
_onClick = (e) => {
|
|
168
|
-
const t = Date.now() - this.pointerDownTime, s = this.pointer.distanceTo(this.pointerDownPos);
|
|
169
|
-
if (!(t > this.longPressThreshold || s > this.moveThreshold)) {
|
|
170
|
-
if (this.clickTimer) {
|
|
171
|
-
clearTimeout(this.clickTimer), this.clickTimer = null;
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
this.clickTimer = setTimeout(() => {
|
|
175
|
-
this._handleEvent("click", e), this.clickTimer = null;
|
|
176
|
-
}, 200);
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
_onDblClick = (e) => {
|
|
180
|
-
this.clickTimer && (clearTimeout(this.clickTimer), this.clickTimer = null), this._handleEvent("dblclick", e);
|
|
181
|
-
};
|
|
182
|
-
_onContextMenu = (e) => {
|
|
183
|
-
e.preventDefault();
|
|
184
|
-
};
|
|
185
|
-
_onPointerDown = (e) => {
|
|
186
|
-
this.pointerDownTime = Date.now(), this._updatePointer(e), this.pointerDownPos.copy(this.pointer), this._handleEvent("pointerdown", e);
|
|
187
|
-
};
|
|
188
|
-
_onPointerUp = (e) => {
|
|
189
|
-
if (this._updatePointer(e), e.button === 2) {
|
|
190
|
-
const t = Date.now() - this.pointerDownTime, s = this.pointer.distanceTo(this.pointerDownPos);
|
|
191
|
-
t <= this.longPressThreshold && s <= this.moveThreshold && this._handleEvent("rightclick", e);
|
|
192
|
-
}
|
|
193
|
-
this._handleEvent("pointerup", e);
|
|
194
|
-
};
|
|
195
|
-
_onPointerMove = (e) => {
|
|
196
|
-
if (!this._enabled || !this.pointerMoveEventsEnabled) return;
|
|
197
|
-
this._updatePointer(e);
|
|
198
|
-
const t = this._getIntersects(), s = t.length > 0 ? t[0].object : null, n = t.length > 0 ? t[0] : null;
|
|
199
|
-
this.hoveredObject !== s && (this.hoveredObject && this._dispatchToTarget("pointerleave", this.hoveredObject, null, e), this.hoveredObject = s, s && n && this._dispatchToTarget("pointerenter", s, n, e)), s && n && this._dispatchToTarget("pointermove", s, n, e);
|
|
200
|
-
};
|
|
201
|
-
/**
|
|
202
|
-
* Cleans up event listeners.
|
|
203
|
-
*/
|
|
204
|
-
dispose() {
|
|
205
|
-
this.domElement.removeEventListener("click", this._onClick), this.domElement.removeEventListener("dblclick", this._onDblClick), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.clickTimer && (clearTimeout(this.clickTimer), this.clickTimer = null), this.hoveredObject = null, this._excludeSet.clear();
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
class _n extends De {
|
|
1
|
+
import { g as Et } from "./Viewer-Cs_y7IiH.js";
|
|
2
|
+
import { C as Qi, a as qi, I as Yi, b as Vi, O as Ji, R as Zi, c as er, V as tr, e as sr } from "./Viewer-Cs_y7IiH.js";
|
|
3
|
+
import { EventDispatcher as qt, Vector2 as z, Box2 as Yt, Matrix4 as L, Vector3 as C, Scene as Vt, Color as A, AmbientLight as Jt, DirectionalLight as Pe, PointLight as Ne, SpotLight as ze, HemisphereLight as De, DirectionalLightHelper as Zt, PointLightHelper as es, SpotLightHelper as ts, HemisphereLightHelper as ss, MeshStandardNodeMaterial as K, Loader as ns, LoaderUtils as G, FileLoader as _t, TextureLoader as Ct, Group as H, SRGBColorSpace as Ot, RepeatWrapping as Re, BufferGeometry as Q, BufferAttribute as je, Mesh as P, FrontSide as is, BackSide as rs, DoubleSide as as, REVISION as ke, CubeTextureLoader as os, EquirectangularReflectionMapping as cs, Sprite as ls, AnimationMixer as hs, LoopRepeat as us, LoopOnce as ds, Box3 as $, SphereGeometry as ps, TubeGeometry as ms, LineCurve3 as fs, CatmullRomCurve3 as gs, SpriteNodeMaterial as ys, CanvasTexture as bs, ShapeGeometry as ws, Shape as At, ExtrudeGeometry as xs, PlaneGeometry as Ms, CircleGeometry as Is, Quaternion as Ss, BoxGeometry as vs, MeshBasicNodeMaterial as Bs, ClippingGroup as Es, Plane as _s, PlaneHelper as Cs, LineBasicMaterial as me, Line as fe, Object3D as Os, Sphere as ne, Float32BufferAttribute as As, SkinnedMesh as Ts, DataTexture as Ls, RGBAFormat as Ps, FloatType as Ns, NearestFilter as Ue, Texture as zs, Frustum as Ds, InstancedBufferAttribute as We, DynamicDrawUsage as Be, InstancedMesh as Rs, StorageInstancedBufferAttribute as js } from "three/webgpu";
|
|
4
|
+
import { GLTFLoader as Tt } from "three/addons/loaders/GLTFLoader.js";
|
|
5
|
+
import { FBXLoader as ks } from "three/addons/loaders/FBXLoader.js";
|
|
6
|
+
import { OBJLoader as Us } from "three/addons/loaders/OBJLoader.js";
|
|
7
|
+
import { STLLoader as Ws } from "three/addons/loaders/STLLoader.js";
|
|
8
|
+
import { DRACOLoader as Hs } from "three/addons/loaders/DRACOLoader.js";
|
|
9
|
+
import { KTX2Loader as Fs } from "three/addons/loaders/KTX2Loader.js";
|
|
10
|
+
import { MeshoptDecoder as He } from "three/addons/libs/meshopt_decoder.module.js";
|
|
11
|
+
import { HDRLoader as Gs } from "three/addons/loaders/HDRLoader.js";
|
|
12
|
+
import { clone as Le } from "three/addons/utils/SkeletonUtils.js";
|
|
13
|
+
import { color as V, uv as Fe, time as ge, pow as ye, sin as Ce, mix as be, mx_noise_float as Ge, uniform as ae, add as $s, vec4 as Ks, Fn as Lt, userData as U, materialColor as xe, select as F, materialOpacity as Oe, vec3 as Xs, attribute as Qs, int as $e, textureSize as qs, textureLoad as Ke, ivec2 as Ys, instancedBufferAttribute as Xe, float as Vs } from "three/tsl";
|
|
14
|
+
import { outline as Js } from "three/addons/tsl/display/OutlineNode.js";
|
|
15
|
+
import { Easing as x, Tween as Zs } from "three/addons/libs/tween.module.js";
|
|
16
|
+
import { mergeGeometries as en } from "three/addons/utils/BufferGeometryUtils.js";
|
|
17
|
+
import { CSS2DObject as ir } from "three/addons/renderers/CSS2DRenderer.js";
|
|
18
|
+
import { CSS3DObject as ar, CSS3DSprite as or } from "three/addons/renderers/CSS3DRenderer.js";
|
|
19
|
+
class Ci extends qt {
|
|
209
20
|
scene;
|
|
210
21
|
camera;
|
|
211
22
|
domElement;
|
|
@@ -215,8 +26,8 @@ class _n extends De {
|
|
|
215
26
|
// Box selection state
|
|
216
27
|
_boxSelectionEnabled = !1;
|
|
217
28
|
_isSelecting = !1;
|
|
218
|
-
_startPoint = new
|
|
219
|
-
_endPoint = new
|
|
29
|
+
_startPoint = new z();
|
|
30
|
+
_endPoint = new z();
|
|
220
31
|
_selectionBox = null;
|
|
221
32
|
_deep = !0;
|
|
222
33
|
/**
|
|
@@ -315,226 +126,33 @@ class _n extends De {
|
|
|
315
126
|
this._selectionBox.style.left = `${e}px`, this._selectionBox.style.top = `${t}px`, this._selectionBox.style.width = `${s}px`, this._selectionBox.style.height = `${n}px`;
|
|
316
127
|
}
|
|
317
128
|
_getObjectsInBox() {
|
|
318
|
-
const e = this._container.getBoundingClientRect(), t = e.width, s = e.height, n = new
|
|
129
|
+
const e = this._container.getBoundingClientRect(), t = e.width, s = e.height, n = new z(
|
|
319
130
|
this._startPoint.x / t * 2 - 1,
|
|
320
131
|
-(this._startPoint.y / s) * 2 + 1
|
|
321
|
-
), i = new
|
|
132
|
+
), i = new z(
|
|
322
133
|
this._endPoint.x / t * 2 - 1,
|
|
323
134
|
-(this._endPoint.y / s) * 2 + 1
|
|
324
|
-
),
|
|
325
|
-
new
|
|
326
|
-
new
|
|
327
|
-
), o = this.targetObjects || this.scene.children,
|
|
328
|
-
|
|
329
|
-
const
|
|
330
|
-
if (!
|
|
331
|
-
const
|
|
332
|
-
if (
|
|
333
|
-
for (const
|
|
334
|
-
|
|
135
|
+
), a = new Yt(
|
|
136
|
+
new z(Math.min(n.x, i.x), Math.min(n.y, i.y)),
|
|
137
|
+
new z(Math.max(n.x, i.x), Math.max(n.y, i.y))
|
|
138
|
+
), o = this.targetObjects || this.scene.children, c = [], l = new L();
|
|
139
|
+
l.multiplyMatrices(this.camera.projectionMatrix, this.camera.matrixWorldInverse);
|
|
140
|
+
const h = (u) => {
|
|
141
|
+
if (!u.visible) return;
|
|
142
|
+
const d = new C();
|
|
143
|
+
if (d.setFromMatrixPosition(u.matrixWorld), d.applyMatrix4(l), d.z > -1 && d.z < 1 && a.containsPoint(new z(d.x, d.y)) && c.push(u), this._deep)
|
|
144
|
+
for (const p of u.children)
|
|
145
|
+
h(p);
|
|
335
146
|
};
|
|
336
|
-
for (const
|
|
337
|
-
|
|
338
|
-
return
|
|
147
|
+
for (const u of o)
|
|
148
|
+
h(u);
|
|
149
|
+
return c;
|
|
339
150
|
}
|
|
340
151
|
dispose() {
|
|
341
152
|
this.disableBoxSelection(), this._selected.clear();
|
|
342
153
|
}
|
|
343
154
|
}
|
|
344
|
-
|
|
345
|
-
const t = h;
|
|
346
|
-
if (t.setSemanticVisible) {
|
|
347
|
-
t.setSemanticVisible(e);
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
h.visible = e, t.markSemanticRenderDirty?.();
|
|
351
|
-
}
|
|
352
|
-
class xs {
|
|
353
|
-
idMap = /* @__PURE__ */ new Map();
|
|
354
|
-
nameMap = /* @__PURE__ */ new Map();
|
|
355
|
-
typeMap = /* @__PURE__ */ new Map();
|
|
356
|
-
objectIds = /* @__PURE__ */ new Map();
|
|
357
|
-
allObjects = /* @__PURE__ */ new Set();
|
|
358
|
-
/**
|
|
359
|
-
* Add an object with a custom id.
|
|
360
|
-
* One object can have multiple ids.
|
|
361
|
-
*/
|
|
362
|
-
add(e, t) {
|
|
363
|
-
if (this.idMap.has(e)) {
|
|
364
|
-
console.warn(`ObjectManager: Object with id ${e} already exists.`);
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
this.idMap.set(e, t), this.allObjects.add(t), this.objectIds.has(t) || this.objectIds.set(t, /* @__PURE__ */ new Set()), this.objectIds.get(t).add(e), t.name && (this.nameMap.has(t.name) || this.nameMap.set(t.name, /* @__PURE__ */ new Set()), this.nameMap.get(t.name).add(t)), t.type && (this.typeMap.has(t.type) || this.typeMap.set(t.type, /* @__PURE__ */ new Set()), this.typeMap.get(t.type).add(t));
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Get an object by its custom id.
|
|
371
|
-
*/
|
|
372
|
-
getById(e) {
|
|
373
|
-
return this.idMap.get(e);
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Get all objects with a given name.
|
|
377
|
-
*/
|
|
378
|
-
getByName(e) {
|
|
379
|
-
return this.nameMap.get(e) || /* @__PURE__ */ new Set();
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Get all objects with a given type.
|
|
383
|
-
*/
|
|
384
|
-
getByType(e) {
|
|
385
|
-
return this.typeMap.get(e) || /* @__PURE__ */ new Set();
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Get all ids associated with an object.
|
|
389
|
-
*/
|
|
390
|
-
getObjectIds(e) {
|
|
391
|
-
return this.objectIds.get(e) || /* @__PURE__ */ new Set();
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* Remove an object and all its associated ids.
|
|
395
|
-
*/
|
|
396
|
-
remove(e) {
|
|
397
|
-
const t = this.objectIds.get(e);
|
|
398
|
-
if (t) {
|
|
399
|
-
for (const s of t)
|
|
400
|
-
this.idMap.delete(s);
|
|
401
|
-
this.objectIds.delete(e);
|
|
402
|
-
}
|
|
403
|
-
if (e.name && this.nameMap.has(e.name)) {
|
|
404
|
-
const s = this.nameMap.get(e.name);
|
|
405
|
-
s.delete(e), s.size === 0 && this.nameMap.delete(e.name);
|
|
406
|
-
}
|
|
407
|
-
if (e.type && this.typeMap.has(e.type)) {
|
|
408
|
-
const s = this.typeMap.get(e.type);
|
|
409
|
-
s.delete(e), s.size === 0 && this.typeMap.delete(e.type);
|
|
410
|
-
}
|
|
411
|
-
this.allObjects.delete(e);
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Remove an object by its id.
|
|
415
|
-
*/
|
|
416
|
-
removeById(e) {
|
|
417
|
-
const t = this.idMap.get(e);
|
|
418
|
-
t && this.remove(t);
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Remove all objects with a given name.
|
|
422
|
-
*/
|
|
423
|
-
removeByName(e) {
|
|
424
|
-
const t = this.getByName(e);
|
|
425
|
-
for (const s of t)
|
|
426
|
-
this.remove(s);
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Remove all objects with a given type.
|
|
430
|
-
*/
|
|
431
|
-
removeByType(e) {
|
|
432
|
-
const t = this.getByType(e);
|
|
433
|
-
for (const s of t)
|
|
434
|
-
this.remove(s);
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Clear all cached objects.
|
|
438
|
-
*/
|
|
439
|
-
clear() {
|
|
440
|
-
this.idMap.clear(), this.nameMap.clear(), this.typeMap.clear(), this.objectIds.clear(), this.allObjects.clear();
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
* Get all cached objects as a Set.
|
|
444
|
-
*/
|
|
445
|
-
getAll() {
|
|
446
|
-
return this.allObjects;
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Get the number of unique cached objects.
|
|
450
|
-
*/
|
|
451
|
-
get size() {
|
|
452
|
-
return this.allObjects.size;
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* Show an object by id.
|
|
456
|
-
*/
|
|
457
|
-
show(e) {
|
|
458
|
-
const t = this.idMap.get(e);
|
|
459
|
-
t && ee(t, !0);
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Hide an object by id.
|
|
463
|
-
*/
|
|
464
|
-
hide(e) {
|
|
465
|
-
const t = this.idMap.get(e);
|
|
466
|
-
t && ee(t, !1);
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* Show only the specified objects, hide all others.
|
|
470
|
-
*/
|
|
471
|
-
isolate(e) {
|
|
472
|
-
const t = new Set(e);
|
|
473
|
-
for (const s of this.allObjects) {
|
|
474
|
-
const n = this.objectIds.get(s) ?? /* @__PURE__ */ new Set();
|
|
475
|
-
ee(s, [...n].some((i) => t.has(i)));
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
* Set the opacity of an object's materials.
|
|
480
|
-
*/
|
|
481
|
-
setOpacity(e, t) {
|
|
482
|
-
const s = this.idMap.get(e);
|
|
483
|
-
if (!s) return;
|
|
484
|
-
const n = s;
|
|
485
|
-
if (n.setSemanticOpacity) {
|
|
486
|
-
n.setSemanticOpacity(t);
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
|
-
s.traverse((i) => {
|
|
490
|
-
if (!i.isMesh) return;
|
|
491
|
-
const r = i.material;
|
|
492
|
-
if (!r) return;
|
|
493
|
-
const o = Array.isArray(r) ? r : [r];
|
|
494
|
-
for (const a of o)
|
|
495
|
-
a.transparent = t < 1, a.opacity = t, a.needsUpdate = !0;
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Get the bounding box of an object by id, or all objects if no id provided.
|
|
500
|
-
*/
|
|
501
|
-
getBoundingBox(e) {
|
|
502
|
-
const t = new V();
|
|
503
|
-
if (e) {
|
|
504
|
-
const s = this.idMap.get(e);
|
|
505
|
-
s && t.setFromObject(s);
|
|
506
|
-
} else
|
|
507
|
-
for (const s of this.allObjects)
|
|
508
|
-
t.expandByObject(s);
|
|
509
|
-
return t;
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Iterate over all managed objects.
|
|
513
|
-
*/
|
|
514
|
-
forEach(e) {
|
|
515
|
-
for (const t of this.allObjects) {
|
|
516
|
-
const s = this.objectIds.get(t) || /* @__PURE__ */ new Set();
|
|
517
|
-
e(t, s);
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Filter objects by a predicate.
|
|
522
|
-
*/
|
|
523
|
-
filter(e) {
|
|
524
|
-
const t = [];
|
|
525
|
-
for (const s of this.allObjects)
|
|
526
|
-
e(s) && t.push(s);
|
|
527
|
-
return t;
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* Show all managed objects.
|
|
531
|
-
*/
|
|
532
|
-
showAll() {
|
|
533
|
-
for (const e of this.allObjects)
|
|
534
|
-
ee(e, !0);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
class En {
|
|
155
|
+
class Oi {
|
|
538
156
|
scenes = /* @__PURE__ */ new Map();
|
|
539
157
|
_activeSceneKey = null;
|
|
540
158
|
/**
|
|
@@ -547,8 +165,8 @@ class En {
|
|
|
547
165
|
* Create and register a new scene.
|
|
548
166
|
*/
|
|
549
167
|
create(e, t = {}) {
|
|
550
|
-
const s = new
|
|
551
|
-
return t.background !== void 0 && (s.background = new
|
|
168
|
+
const s = new Vt();
|
|
169
|
+
return t.background !== void 0 && (s.background = new A(t.background)), this.scenes.set(e, s), s;
|
|
552
170
|
}
|
|
553
171
|
/**
|
|
554
172
|
* Get a scene by key.
|
|
@@ -587,7 +205,7 @@ class En {
|
|
|
587
205
|
const t = this.scenes.get(e);
|
|
588
206
|
if (!t) return null;
|
|
589
207
|
let s = null;
|
|
590
|
-
return t.background instanceof
|
|
208
|
+
return t.background instanceof A && (s = `#${t.background.getHexString()}`), {
|
|
591
209
|
name: t.name || e,
|
|
592
210
|
background: s,
|
|
593
211
|
environmentRotation: {
|
|
@@ -608,7 +226,7 @@ class En {
|
|
|
608
226
|
return this.scenes.size;
|
|
609
227
|
}
|
|
610
228
|
}
|
|
611
|
-
class
|
|
229
|
+
class Ai {
|
|
612
230
|
scene;
|
|
613
231
|
lights = /* @__PURE__ */ new Map();
|
|
614
232
|
helpers = /* @__PURE__ */ new Map();
|
|
@@ -616,34 +234,34 @@ class Pn {
|
|
|
616
234
|
this.scene = e;
|
|
617
235
|
}
|
|
618
236
|
addAmbient(e, t = {}) {
|
|
619
|
-
const { color: s = 16777215, intensity: n = 0.5 } = t, i = new
|
|
237
|
+
const { color: s = 16777215, intensity: n = 0.5 } = t, i = new Jt(s, n);
|
|
620
238
|
return i.name = e, this._register(e, i), i;
|
|
621
239
|
}
|
|
622
240
|
addDirectional(e, t = {}) {
|
|
623
|
-
const { color: s = 16777215, intensity: n = 1, position: i = { x: 5, y: 10, z: 5 }, castShadow:
|
|
624
|
-
return
|
|
241
|
+
const { color: s = 16777215, intensity: n = 1, position: i = { x: 5, y: 10, z: 5 }, castShadow: a = !1, shadowMapSize: o = 1024 } = t, c = new Pe(s, n);
|
|
242
|
+
return c.position.set(i.x, i.y, i.z), c.castShadow = a, a && c.shadow.mapSize.setScalar(o), c.name = e, this._register(e, c), c;
|
|
625
243
|
}
|
|
626
244
|
addPoint(e, t = {}) {
|
|
627
|
-
const { color: s = 16777215, intensity: n = 1, distance: i = 0, decay:
|
|
628
|
-
return
|
|
245
|
+
const { color: s = 16777215, intensity: n = 1, distance: i = 0, decay: a = 2, position: o = { x: 0, y: 5, z: 0 }, castShadow: c = !1 } = t, l = new Ne(s, n, i, a);
|
|
246
|
+
return l.position.set(o.x, o.y, o.z), l.castShadow = c, l.name = e, this._register(e, l), l;
|
|
629
247
|
}
|
|
630
248
|
addSpot(e, t = {}) {
|
|
631
249
|
const {
|
|
632
250
|
color: s = 16777215,
|
|
633
251
|
intensity: n = 1,
|
|
634
252
|
distance: i = 0,
|
|
635
|
-
angle:
|
|
253
|
+
angle: a = Math.PI / 6,
|
|
636
254
|
penumbra: o = 0.1,
|
|
637
|
-
decay:
|
|
638
|
-
position:
|
|
639
|
-
target:
|
|
640
|
-
castShadow:
|
|
641
|
-
} = t,
|
|
642
|
-
return
|
|
255
|
+
decay: c = 2,
|
|
256
|
+
position: l = { x: 0, y: 10, z: 0 },
|
|
257
|
+
target: h,
|
|
258
|
+
castShadow: u = !1
|
|
259
|
+
} = t, d = new ze(s, n, i, a, o, c);
|
|
260
|
+
return d.position.set(l.x, l.y, l.z), h && d.target.position.set(h.x, h.y, h.z), d.castShadow = u, d.name = e, this._register(e, d), d;
|
|
643
261
|
}
|
|
644
262
|
addHemisphere(e, t = {}) {
|
|
645
|
-
const { skyColor: s = 8900331, groundColor: n = 3549447, intensity: i = 0.6 } = t,
|
|
646
|
-
return
|
|
263
|
+
const { skyColor: s = 8900331, groundColor: n = 3549447, intensity: i = 0.6 } = t, a = new De(s, n, i);
|
|
264
|
+
return a.name = e, this._register(e, a), a;
|
|
647
265
|
}
|
|
648
266
|
/**
|
|
649
267
|
* Apply a lighting preset to the scene.
|
|
@@ -682,803 +300,244 @@ class Pn {
|
|
|
682
300
|
*/
|
|
683
301
|
removeAll() {
|
|
684
302
|
const e = Array.from(this.lights.keys());
|
|
685
|
-
for (const t of e)
|
|
686
|
-
this.remove(t);
|
|
687
|
-
}
|
|
688
|
-
/**
|
|
689
|
-
* Show a visual helper for a light.
|
|
690
|
-
*/
|
|
691
|
-
showHelper(e) {
|
|
692
|
-
if (this.helpers.has(e)) return;
|
|
693
|
-
const t = this.lights.get(e);
|
|
694
|
-
if (!t) return;
|
|
695
|
-
let s = null;
|
|
696
|
-
t instanceof ye ? s = new ht(t, 1) : t instanceof we ? s = new lt(t, 0.5) : t instanceof ve ? s = new dt(t) : t instanceof be && (s = new pt(t, 1)), s && (this.scene.add(s), this.helpers.set(e, s));
|
|
697
|
-
}
|
|
698
|
-
/**
|
|
699
|
-
* Hide (remove) the helper for a light.
|
|
700
|
-
*/
|
|
701
|
-
hideHelper(e) {
|
|
702
|
-
const t = this.helpers.get(e);
|
|
703
|
-
t && (this.scene.remove(t), this.helpers.delete(e));
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* Show helpers for all lights.
|
|
707
|
-
*/
|
|
708
|
-
showAllHelpers() {
|
|
709
|
-
for (const [e] of this.lights)
|
|
710
|
-
this.showHelper(e);
|
|
711
|
-
}
|
|
712
|
-
/**
|
|
713
|
-
* Hide all helpers.
|
|
714
|
-
*/
|
|
715
|
-
hideAllHelpers() {
|
|
716
|
-
const e = Array.from(this.helpers.keys());
|
|
717
|
-
for (const t of e)
|
|
718
|
-
this.hideHelper(t);
|
|
719
|
-
}
|
|
720
|
-
_register(e, t) {
|
|
721
|
-
this.lights.has(e) && this.remove(e), this.lights.set(e, t), this.scene.add(t);
|
|
722
|
-
}
|
|
723
|
-
dispose() {
|
|
724
|
-
this.removeAll(), this.hideAllHelpers();
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
class Ss extends ut {
|
|
728
|
-
scene;
|
|
729
|
-
camera;
|
|
730
|
-
scenePass;
|
|
731
|
-
needsUpdateOutputNode;
|
|
732
|
-
#t;
|
|
733
|
-
#e;
|
|
734
|
-
#s = !1;
|
|
735
|
-
#r = { strength: 1, radius: 0, threshold: 0 };
|
|
736
|
-
#n = null;
|
|
737
|
-
#o = !1;
|
|
738
|
-
#a = {
|
|
739
|
-
sliceCount: 1,
|
|
740
|
-
stepCount: 12,
|
|
741
|
-
aoIntensity: 1,
|
|
742
|
-
giIntensity: 10,
|
|
743
|
-
radius: 12,
|
|
744
|
-
thickness: 1
|
|
745
|
-
};
|
|
746
|
-
#p = null;
|
|
747
|
-
#h = !1;
|
|
748
|
-
#l = null;
|
|
749
|
-
#u = null;
|
|
750
|
-
#d;
|
|
751
|
-
#c;
|
|
752
|
-
#m = !1;
|
|
753
|
-
#f = !0;
|
|
754
|
-
constructor(...e) {
|
|
755
|
-
const [t, s, n] = e;
|
|
756
|
-
super(t), this.scene = s, this.camera = n, this.scenePass = fe(s, n), this.needsUpdateOutputNode = !0, this.#t = /* @__PURE__ */ new Set(), this.#e = [], this.#d = /* @__PURE__ */ new Set(), this.#c = /* @__PURE__ */ new Map(), this.#g();
|
|
757
|
-
}
|
|
758
|
-
/** @deprecated Use `scenePass` instead */
|
|
759
|
-
get currentOutputNode() {
|
|
760
|
-
return this.scenePass;
|
|
761
|
-
}
|
|
762
|
-
addOverlayPass(e) {
|
|
763
|
-
this.#t.add(e), this.needsUpdateOutputNode = !0;
|
|
764
|
-
}
|
|
765
|
-
removeOverlayPass(e) {
|
|
766
|
-
this.#t.delete(e), this.needsUpdateOutputNode = !0;
|
|
767
|
-
}
|
|
768
|
-
setCamera(e) {
|
|
769
|
-
this.camera = e, this.#i();
|
|
770
|
-
}
|
|
771
|
-
/** @deprecated Use `setOutputComposer` instead */
|
|
772
|
-
setCurrentOutputNode(e) {
|
|
773
|
-
this.setOutputComposer(() => e);
|
|
774
|
-
}
|
|
775
|
-
/** @deprecated Use `setOutputComposer(null)` instead */
|
|
776
|
-
resetCurrentOutputNode() {
|
|
777
|
-
this.setOutputComposer(null);
|
|
778
|
-
}
|
|
779
|
-
setOutputComposer(e) {
|
|
780
|
-
this.#u = e, this.needsUpdateOutputNode = !0;
|
|
781
|
-
}
|
|
782
|
-
addOutputEffect(e) {
|
|
783
|
-
return this.#d.add(e), this.needsUpdateOutputNode = !0, this;
|
|
784
|
-
}
|
|
785
|
-
removeOutputEffect(e) {
|
|
786
|
-
return this.#d.delete(e), this.needsUpdateOutputNode = !0, this;
|
|
787
|
-
}
|
|
788
|
-
addMRTChannel(e, t) {
|
|
789
|
-
return this.#c.get(e) === t ? this : (this.#c.set(e, t), this.#i(), this);
|
|
790
|
-
}
|
|
791
|
-
removeMRTChannel(e) {
|
|
792
|
-
return this.#c.delete(e) && this.#i(), this;
|
|
793
|
-
}
|
|
794
|
-
enableBloom(e) {
|
|
795
|
-
e && Object.assign(this.#r, e), this.#s = !0, this.#i();
|
|
796
|
-
}
|
|
797
|
-
disableBloom() {
|
|
798
|
-
this.#s = !1, this.#n = null, this.#i();
|
|
799
|
-
}
|
|
800
|
-
updateBloom(e) {
|
|
801
|
-
Object.assign(this.#r, e), this.#s && (this.needsUpdateOutputNode = !0);
|
|
802
|
-
}
|
|
803
|
-
enableSSGI(e) {
|
|
804
|
-
e && Object.assign(this.#a, e), this.#o = !0, this.#i();
|
|
805
|
-
}
|
|
806
|
-
disableSSGI() {
|
|
807
|
-
this.#o = !1, this.#p = null, this.#i();
|
|
808
|
-
}
|
|
809
|
-
updateSSGI(e) {
|
|
810
|
-
if (Object.assign(this.#a, e), this.#p) {
|
|
811
|
-
const t = this.#p;
|
|
812
|
-
e.sliceCount !== void 0 && (t.sliceCount.value = e.sliceCount), e.stepCount !== void 0 && (t.stepCount.value = e.stepCount), e.aoIntensity !== void 0 && (t.aoIntensity.value = e.aoIntensity), e.giIntensity !== void 0 && (t.giIntensity.value = e.giIntensity), e.radius !== void 0 && (t.radius.value = e.radius), e.thickness !== void 0 && (t.thickness.value = e.thickness);
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
enableTRAA() {
|
|
816
|
-
this.#h = !0, this.#i();
|
|
817
|
-
}
|
|
818
|
-
disableTRAA() {
|
|
819
|
-
this.#h = !1, this.#l = null, this.#i();
|
|
820
|
-
}
|
|
821
|
-
#i() {
|
|
822
|
-
const e = this.scenePass;
|
|
823
|
-
this.scenePass = fe(this.scene, this.camera), this.#g(), this.needsUpdateOutputNode = !0, e.dispose();
|
|
824
|
-
}
|
|
825
|
-
#g() {
|
|
826
|
-
if (this.#s || this.#o || this.#h || this.#c.size > 0) {
|
|
827
|
-
const t = { output: Xt };
|
|
828
|
-
this.#c.forEach((s, n) => {
|
|
829
|
-
n !== "output" && (t[n] = s);
|
|
830
|
-
}), this.#s && (t.emissive = Vt), this.#o && (t.normal = Jt), this.#h && (t.velocity = Zt), this.scenePass.setMRT(qt(t));
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
#y() {
|
|
834
|
-
for (const e of this.#e)
|
|
835
|
-
e.dispose();
|
|
836
|
-
this.#e = [];
|
|
837
|
-
}
|
|
838
|
-
#w() {
|
|
839
|
-
let e = this.scenePass.getTextureNode();
|
|
840
|
-
if (this.#o)
|
|
841
|
-
if (!(this.camera instanceof se))
|
|
842
|
-
console.warn("RenderPipeline: SSGI requires a PerspectiveCamera, skipping.");
|
|
843
|
-
else {
|
|
844
|
-
const t = this.scenePass.getTextureNode(), s = this.scenePass.getTextureNode("depth"), n = this.scenePass.getTextureNode("normal"), i = ss(t, s, n, this.camera);
|
|
845
|
-
i.sliceCount.value = this.#a.sliceCount, i.stepCount.value = this.#a.stepCount, i.aoIntensity.value = this.#a.aoIntensity, i.giIntensity.value = this.#a.giIntensity, i.radius.value = this.#a.radius, i.thickness.value = this.#a.thickness, this.#p = i, e = Me(e, i), this.#e.push(i);
|
|
846
|
-
}
|
|
847
|
-
if (this.#s) {
|
|
848
|
-
const t = this.scenePass.getTextureNode("emissive");
|
|
849
|
-
this.#n = ts(
|
|
850
|
-
t,
|
|
851
|
-
this.#r.strength,
|
|
852
|
-
this.#r.radius,
|
|
853
|
-
this.#r.threshold
|
|
854
|
-
), e = Me(e, this.#n), this.#e.push(this.#n);
|
|
855
|
-
}
|
|
856
|
-
return e;
|
|
857
|
-
}
|
|
858
|
-
#v(e) {
|
|
859
|
-
e ? (this.#m || (this.#f = this.outputColorTransform), this.outputColorTransform = !1) : this.#m && (this.outputColorTransform = this.#f), this.#m = e;
|
|
860
|
-
}
|
|
861
|
-
#b() {
|
|
862
|
-
this.#y();
|
|
863
|
-
let e, t = !1, s = !1;
|
|
864
|
-
const n = this.#u !== null;
|
|
865
|
-
if (n ? e = this.#u(this.scenePass) : this.#s || this.#o ? e = this.#w() : e = this.#d.size > 0 ? this.scenePass.getTextureNode() : this.scenePass, n || this.#d.forEach((i) => {
|
|
866
|
-
t ||= i.includesTemporalAntialias === !0, s ||= i.includesOutputTransform === !0, e = i(this.scenePass, e);
|
|
867
|
-
}), this.#v(s), this.#h && !t) {
|
|
868
|
-
const i = this.scenePass.getTextureNode("depth"), r = this.scenePass.getTextureNode("velocity");
|
|
869
|
-
this.#l = ns(e, i, r, this.camera), this.#e.push(this.#l), e = this.#l;
|
|
870
|
-
} else
|
|
871
|
-
this.#l = null;
|
|
872
|
-
this.#t.size > 0 && this.#t.forEach((i) => {
|
|
873
|
-
const r = Yt(e, i);
|
|
874
|
-
this.#e.push(r), e = r;
|
|
875
|
-
}), this.outputNode = e, this.needsUpdate = !0;
|
|
876
|
-
}
|
|
877
|
-
render() {
|
|
878
|
-
this.needsUpdateOutputNode && (this.#b(), this.needsUpdateOutputNode = !1), super.render();
|
|
879
|
-
}
|
|
880
|
-
dispose() {
|
|
881
|
-
this.#y(), this.scenePass.dispose(), super.dispose();
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
const Cs = {
|
|
885
|
-
Vector2: C,
|
|
886
|
-
Vector3: v,
|
|
887
|
-
Vector4: ft,
|
|
888
|
-
Quaternion: mt,
|
|
889
|
-
Matrix4: ke,
|
|
890
|
-
Spherical: T,
|
|
891
|
-
Box3: V,
|
|
892
|
-
Sphere: Ue,
|
|
893
|
-
Raycaster: Ne
|
|
894
|
-
};
|
|
895
|
-
Ke.install({ THREE: Cs });
|
|
896
|
-
class Ms extends Ke {
|
|
897
|
-
constructor(...e) {
|
|
898
|
-
super(...e), this.minDistance = 0.2, this.smoothTime = 0.2, this.dollySpeed = 0.2;
|
|
899
|
-
}
|
|
900
|
-
/**
|
|
901
|
-
* Set absolute angle for azimuth to avoid spinning
|
|
902
|
-
*/
|
|
903
|
-
absoluteRotations() {
|
|
904
|
-
this.azimuthAngle = Ts(this.azimuthAngle, 0);
|
|
905
|
-
}
|
|
906
|
-
async flyToBox(e, t = {}) {
|
|
907
|
-
if (e.isEmpty())
|
|
908
|
-
return console.warn("CameraControls.flyToBox: The provided Box3 is empty."), !1;
|
|
909
|
-
this.absoluteRotations();
|
|
910
|
-
const { viewpoint: s = "frontTop", enableTransition: n = !0, padding: i = 0.1, cover: r = !1 } = t, o = [];
|
|
911
|
-
if (s !== "current") {
|
|
912
|
-
const a = Ae[s.toUpperCase()] ?? Ae.FRONTTOP, c = a.theta, l = a.phi;
|
|
913
|
-
o.push(
|
|
914
|
-
this.fitToBox(e, n, {
|
|
915
|
-
paddingLeft: i,
|
|
916
|
-
paddingRight: i,
|
|
917
|
-
paddingTop: i,
|
|
918
|
-
paddingBottom: i,
|
|
919
|
-
cover: r
|
|
920
|
-
})
|
|
921
|
-
), o.push(this.rotateTo(c, l, n));
|
|
922
|
-
} else {
|
|
923
|
-
const a = new Ue();
|
|
924
|
-
e.getBoundingSphere(a), a.radius += i, o.push(this.fitToSphere(a, n));
|
|
925
|
-
}
|
|
926
|
-
return await Promise.all(o), !0;
|
|
927
|
-
}
|
|
928
|
-
async flyToObject(e, t = {}) {
|
|
929
|
-
const s = new V().setFromObject(e);
|
|
930
|
-
return this.flyToBox(s, t);
|
|
931
|
-
}
|
|
932
|
-
/**
|
|
933
|
-
* Fly camera to a specific position and look-at target.
|
|
934
|
-
*/
|
|
935
|
-
async flyTo(e, t, s = {}) {
|
|
936
|
-
const { enableTransition: n = !0 } = s;
|
|
937
|
-
return this.absoluteRotations(), this.setLookAt(e.x, e.y, e.z, t.x, t.y, t.z, n);
|
|
938
|
-
}
|
|
939
|
-
/**
|
|
940
|
-
* Get the current camera viewpoint data (position, target, zoom).
|
|
941
|
-
*/
|
|
942
|
-
getCameraViewpoint() {
|
|
943
|
-
const e = new v(), t = new v();
|
|
944
|
-
return this.getPosition(e), this.getTarget(t), {
|
|
945
|
-
position: { x: e.x, y: e.y, z: e.z },
|
|
946
|
-
target: { x: t.x, y: t.y, z: t.z },
|
|
947
|
-
zoom: this.camera.zoom
|
|
948
|
-
};
|
|
949
|
-
}
|
|
950
|
-
/**
|
|
951
|
-
* Lock camera controls (disable all user interaction).
|
|
952
|
-
*/
|
|
953
|
-
lock() {
|
|
954
|
-
this.enabled = !1;
|
|
955
|
-
}
|
|
956
|
-
/**
|
|
957
|
-
* Unlock camera controls (re-enable user interaction).
|
|
958
|
-
*/
|
|
959
|
-
unlock() {
|
|
960
|
-
this.enabled = !0;
|
|
961
|
-
}
|
|
962
|
-
/**
|
|
963
|
-
* Switch between 2D top-down and 3D perspective views.
|
|
964
|
-
*/
|
|
965
|
-
async setViewMode(e, t = !0) {
|
|
966
|
-
if (e === "2d") {
|
|
967
|
-
const s = new v();
|
|
968
|
-
this.getTarget(s), await this.rotateTo(0, 0, t), this.minPolarAngle = 0, this.maxPolarAngle = 0;
|
|
969
|
-
} else
|
|
970
|
-
this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, await this.rotateTo(0, Math.PI / 4, t);
|
|
971
|
-
}
|
|
972
|
-
async setCameraViewpoint(e, t = !0) {
|
|
973
|
-
const { position: s, target: n, zoom: i = this.camera.zoom } = e;
|
|
974
|
-
return Promise.all([
|
|
975
|
-
this.zoomTo(i, t),
|
|
976
|
-
this.setLookAt(s.x, s.y, s.z, n.x, n.y, n.z, t)
|
|
977
|
-
]);
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
const Ae = {
|
|
981
|
-
LEFT: new T(0, Math.PI / 2, -Math.PI / 2),
|
|
982
|
-
RIGHT: new T(0, Math.PI / 2, Math.PI / 2),
|
|
983
|
-
FRONT: new T(0, Math.PI / 2, 0),
|
|
984
|
-
BACK: new T(0, Math.PI / 2, Math.PI),
|
|
985
|
-
TOP: new T(0, 0, 0),
|
|
986
|
-
BOTTOM: new T(0, Math.PI, 0),
|
|
987
|
-
FRONTTOP: new T(0, Math.PI / 4, 0),
|
|
988
|
-
BACKTOP: new T(0, Math.PI / 4, Math.PI),
|
|
989
|
-
LEFTTOP: new T(0, Math.PI / 4, -Math.PI / 2),
|
|
990
|
-
RIGHTTOP: new T(0, Math.PI / 4, Math.PI / 2),
|
|
991
|
-
LEFTFRONTTOP: new T(0, Math.PI / 4, -Math.PI / 4),
|
|
992
|
-
RIGHTFRONTTOP: new T(0, Math.PI / 4, Math.PI / 4),
|
|
993
|
-
LEFTBACKTOP: new T(0, Math.PI / 4, -Math.PI / 4 * 3),
|
|
994
|
-
RIGHTBACKTOP: new T(0, Math.PI / 4, Math.PI / 4 * 3)
|
|
995
|
-
};
|
|
996
|
-
function Ts(h, e) {
|
|
997
|
-
const t = h - e;
|
|
998
|
-
return gt.euclideanModulo(t + Math.PI, Math.PI * 2) - Math.PI;
|
|
999
|
-
}
|
|
1000
|
-
class _s {
|
|
1001
|
-
environment = new is();
|
|
1002
|
-
renderer;
|
|
1003
|
-
pmremGenerator;
|
|
1004
|
-
envMap = null;
|
|
1005
|
-
constructor(e) {
|
|
1006
|
-
this.renderer = e, this.pmremGenerator = new yt(e);
|
|
1007
|
-
}
|
|
1008
|
-
update() {
|
|
1009
|
-
this.envMap || (this.envMap = this.pmremGenerator.fromScene(this.environment).texture);
|
|
1010
|
-
}
|
|
1011
|
-
dispose() {
|
|
1012
|
-
this.pmremGenerator.dispose(), this.envMap?.dispose();
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
const te = 128;
|
|
1016
|
-
class Es extends rs {
|
|
1017
|
-
viewer;
|
|
1018
|
-
overlayPass;
|
|
1019
|
-
constructor(e) {
|
|
1020
|
-
super(e.camera, e.el), this.viewer = e;
|
|
1021
|
-
const t = new ne(-2, 2, 2, -2, 0, 4);
|
|
1022
|
-
t.position.set(0, 0, 2), this.overlayPass = fe(this, t), this.setLabels("x", "y", "z");
|
|
1023
|
-
}
|
|
1024
|
-
_update = () => {
|
|
1025
|
-
this.quaternion.copy(this.viewer.camera.quaternion).invert();
|
|
1026
|
-
const e = this.location;
|
|
1027
|
-
let t, s;
|
|
1028
|
-
e.left !== null ? t = e.left : t = this.viewer.el.offsetWidth - te - e.right, e.top !== null ? s = e.top : s = this.viewer.el.offsetHeight - te - e.bottom, this.overlayPass.setViewport(t, s, te, te);
|
|
1029
|
-
};
|
|
1030
|
-
enable() {
|
|
1031
|
-
return this.viewer.renderPipeline.addOverlayPass(this.overlayPass), this.viewer.addEventListener("beforeRender", this._update), this.viewer.render(), this;
|
|
1032
|
-
}
|
|
1033
|
-
disable() {
|
|
1034
|
-
return this.viewer.renderPipeline.removeOverlayPass(this.overlayPass), this.viewer.removeEventListener("beforeRender", this._update), this.viewer.render(), this;
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
const qe = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;", Ps = qe + "z-index:0;", Os = qe + "z-index:1;";
|
|
1038
|
-
class As {
|
|
1039
|
-
el;
|
|
1040
|
-
css2dRenderer = null;
|
|
1041
|
-
css3dRenderer = null;
|
|
1042
|
-
constructor(e) {
|
|
1043
|
-
this.el = e, getComputedStyle(e).position === "static" && (e.style.position = "relative");
|
|
1044
|
-
}
|
|
1045
|
-
initCSS2DRenderer() {
|
|
1046
|
-
const e = new os();
|
|
1047
|
-
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = Os, this.el.appendChild(e.domElement), this.css2dRenderer = e, e;
|
|
1048
|
-
}
|
|
1049
|
-
initCSS3DRenderer() {
|
|
1050
|
-
const e = new cs();
|
|
1051
|
-
return e.setSize(this.el.clientWidth, this.el.clientHeight), e.domElement.style.cssText = Ps, this.el.appendChild(e.domElement), this.css3dRenderer = e, e;
|
|
1052
|
-
}
|
|
1053
|
-
createCSS2DObject(e) {
|
|
1054
|
-
return this.css2dRenderer || this.initCSS2DRenderer(), new as(e);
|
|
1055
|
-
}
|
|
1056
|
-
createCSS25DObject(e) {
|
|
1057
|
-
return this.css3dRenderer || this.initCSS3DRenderer(), new hs(e);
|
|
1058
|
-
}
|
|
1059
|
-
createCSS3DObject(e) {
|
|
1060
|
-
return this.css3dRenderer || this.initCSS3DRenderer(), new ls(e);
|
|
1061
|
-
}
|
|
1062
|
-
render(e, t) {
|
|
1063
|
-
this.css2dRenderer && this.css2dRenderer.render(e, t), this.css3dRenderer && this.css3dRenderer.render(e, t);
|
|
1064
|
-
}
|
|
1065
|
-
resize(e, t) {
|
|
1066
|
-
this.css2dRenderer && this.css2dRenderer.setSize(e, t), this.css3dRenderer && this.css3dRenderer.setSize(e, t);
|
|
1067
|
-
}
|
|
1068
|
-
dispose() {
|
|
1069
|
-
this.css2dRenderer && (this.el.removeChild(this.css2dRenderer.domElement), this.css2dRenderer = null), this.css3dRenderer && (this.el.removeChild(this.css3dRenderer.domElement), this.css3dRenderer = null);
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
const Bs = "timestamp-query";
|
|
1073
|
-
class Is {
|
|
1074
|
-
el;
|
|
1075
|
-
renderer;
|
|
1076
|
-
container;
|
|
1077
|
-
drawCallsText;
|
|
1078
|
-
frameCallsText;
|
|
1079
|
-
trianglesText;
|
|
1080
|
-
pointsText;
|
|
1081
|
-
linesText;
|
|
1082
|
-
timestampText;
|
|
1083
|
-
_enabled = !1;
|
|
1084
|
-
#t = !1;
|
|
1085
|
-
constructor(e, t) {
|
|
1086
|
-
this.el = e, this.renderer = t;
|
|
1087
|
-
const s = document.createElement("div");
|
|
1088
|
-
s.style.position = "absolute", s.style.left = "12px", s.style.bottom = "12px", s.style.fontSize = "12px", s.style.color = "#fff", s.style.pointerEvents = "none", this.container = s;
|
|
1089
|
-
function n(r, o = !0) {
|
|
1090
|
-
const a = document.createElement("span");
|
|
1091
|
-
return o && (a.style.marginLeft = "6px"), a.innerText = r, a;
|
|
1092
|
-
}
|
|
1093
|
-
function i() {
|
|
1094
|
-
return document.createElement("br");
|
|
1095
|
-
}
|
|
1096
|
-
this.drawCallsText = n("0"), this.frameCallsText = n("0"), this.trianglesText = n("0"), this.linesText = n("0"), this.pointsText = n("0"), this.timestampText = n("0"), this.container.appendChild(n("draw calls", !1)), this.container.appendChild(this.drawCallsText), this.container.appendChild(i()), this.container.appendChild(n("frame calls", !1)), this.container.appendChild(this.frameCallsText), this.container.appendChild(i()), this.container.appendChild(n("triangles", !1)), this.container.appendChild(this.trianglesText), this.container.appendChild(i()), this.container.appendChild(n("points", !1)), this.container.appendChild(this.pointsText), this.container.appendChild(i()), this.container.appendChild(n("lines", !1)), this.container.appendChild(this.linesText), this.container.appendChild(i()), this.container.appendChild(n("timestamp", !1)), this.container.appendChild(this.timestampText), this.container.appendChild(i());
|
|
1097
|
-
}
|
|
1098
|
-
update() {
|
|
1099
|
-
if (this._enabled) {
|
|
1100
|
-
const { render: e } = this.renderer.info;
|
|
1101
|
-
if (this.drawCallsText.innerText = e.drawCalls.toString(), this.frameCallsText.innerText = e.frameCalls.toString(), this.trianglesText.innerText = e.triangles.toString(), this.pointsText.innerText = e.points.toString(), this.linesText.innerText = e.lines.toString(), !this.#t) {
|
|
1102
|
-
this.timestampText.innerText = "0";
|
|
1103
|
-
return;
|
|
1104
|
-
}
|
|
1105
|
-
this.#n(Z.RENDER).then((t) => {
|
|
1106
|
-
this._enabled && (this.timestampText.innerText = t?.toFixed(2) ?? "0");
|
|
1107
|
-
}), this.#n(Z.COMPUTE);
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
enable() {
|
|
1111
|
-
this._enabled = !0, this.#r(!0), this.el.appendChild(this.container);
|
|
1112
|
-
}
|
|
1113
|
-
disable() {
|
|
1114
|
-
this._enabled = !1, this.#r(!1), this.#o(), this.container.remove();
|
|
1115
|
-
}
|
|
1116
|
-
dispose() {
|
|
1117
|
-
this.disable();
|
|
1118
|
-
}
|
|
1119
|
-
#e() {
|
|
1120
|
-
return this.renderer.backend;
|
|
1121
|
-
}
|
|
1122
|
-
#s() {
|
|
1123
|
-
try {
|
|
1124
|
-
return this.renderer.hasFeature(Bs);
|
|
1125
|
-
} catch {
|
|
1126
|
-
return !0;
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
#r(e) {
|
|
1130
|
-
const t = this.#e();
|
|
1131
|
-
if (!t) {
|
|
1132
|
-
this.#t = !1;
|
|
1133
|
-
return;
|
|
1134
|
-
}
|
|
1135
|
-
t.trackTimestamp = e && this.#s(), this.#t = t.trackTimestamp === !0;
|
|
1136
|
-
}
|
|
1137
|
-
#n(e) {
|
|
1138
|
-
const t = this.#e()?.timestampQueryPool?.[e];
|
|
1139
|
-
return t?.resolveQueriesAsync ? Promise.resolve(t.resolveQueriesAsync()).catch(() => {
|
|
1140
|
-
}) : Promise.resolve(void 0);
|
|
1141
|
-
}
|
|
1142
|
-
#o() {
|
|
1143
|
-
this.#n(Z.RENDER), this.#n(Z.COMPUTE);
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
wt.enabled = !0;
|
|
1147
|
-
class On extends De {
|
|
1148
|
-
el;
|
|
1149
|
-
renderer;
|
|
1150
|
-
scene;
|
|
1151
|
-
camera;
|
|
1152
|
-
info;
|
|
1153
|
-
controls;
|
|
1154
|
-
renderPipeline;
|
|
1155
|
-
timer;
|
|
1156
|
-
roomEnvironment;
|
|
1157
|
-
interactionManager;
|
|
1158
|
-
objectManager;
|
|
1159
|
-
viewerHelper;
|
|
1160
|
-
cssRenderer;
|
|
1161
|
-
frameCount = 1;
|
|
1162
|
-
frameloop = "demand";
|
|
1163
|
-
constructor({ el: e, rendererOptions: t }) {
|
|
1164
|
-
super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new Is(this.el, this.renderer), this.controls = new Ms(this.camera, this.renderer.domElement), this.renderPipeline = new Ss(this.renderer, this.scene, this.camera), this.timer = new vt(), this.roomEnvironment = new _s(this.renderer), this.interactionManager = new bs(this.renderer.domElement, this.scene, this.camera), this.objectManager = new xs(), this.viewerHelper = new Es(this), this.cssRenderer = new As(this.el), window.addEventListener("resize", this.onWindowResize);
|
|
1165
|
-
}
|
|
1166
|
-
onWindowResize = () => {
|
|
1167
|
-
const e = this.el.clientWidth, t = this.el.clientHeight;
|
|
1168
|
-
this.camera instanceof se ? (this.camera.aspect = e / t, this.camera.updateProjectionMatrix()) : this.camera instanceof ne && (this.camera.left = -e / 2, this.camera.right = e / 2, this.camera.top = t / 2, this.camera.bottom = -t / 2, this.camera.updateProjectionMatrix()), this.renderer.setSize(e, t), this.cssRenderer.resize(e, t), this.render();
|
|
1169
|
-
};
|
|
1170
|
-
async init() {
|
|
1171
|
-
await this.renderer.init(), this.roomEnvironment.update(), this.scene.environment = this.roomEnvironment.envMap;
|
|
1172
|
-
}
|
|
1173
|
-
setCamera(e) {
|
|
1174
|
-
this.camera = e, this.controls.camera = e, this.interactionManager.setCamera(e), this.renderPipeline.setCamera(e), this.onWindowResize(), this.dispatchEvent({ type: "cameraChange", camera: e });
|
|
1175
|
-
}
|
|
1176
|
-
setCameraByType(e) {
|
|
1177
|
-
e === "perspective" && !(this.camera instanceof se) ? this.setCamera(this.createPerspectiveCamera()) : e === "orthographic" && !(this.camera instanceof ne) && this.setCamera(this.createOrthographicCamera());
|
|
1178
|
-
}
|
|
1179
|
-
render(e = 1) {
|
|
1180
|
-
return this.frameCount += e, new Promise((t) => {
|
|
1181
|
-
const s = () => {
|
|
1182
|
-
this.removeEventListener("afterRender", s), t();
|
|
1183
|
-
};
|
|
1184
|
-
this.addEventListener("afterRender", s);
|
|
1185
|
-
});
|
|
1186
|
-
}
|
|
1187
|
-
animate = (e) => {
|
|
1188
|
-
this.timer.update(e);
|
|
1189
|
-
const t = this.timer.getDelta();
|
|
1190
|
-
this.dispatchEvent({ type: "beforeControlsUpdate", time: e, delta: t });
|
|
1191
|
-
let s = this.controls.update(t);
|
|
1192
|
-
this.dispatchEvent({ type: "afterControlsUpdate", time: e, delta: t }), this.frameCount > 0 && (this.frameCount--, s = !0), this.frameloop === "always" && (s = !0), s && (this.dispatchEvent({ type: "beforeRender", time: e, delta: t }), this.renderer.info.reset(), this.renderPipeline.render(), this.cssRenderer.render(this.scene, this.camera), this.info.update(), this.dispatchEvent({ type: "afterRender", time: e, delta: t }));
|
|
1193
|
-
};
|
|
1194
|
-
_initRenderer(e) {
|
|
1195
|
-
const t = new bt({
|
|
1196
|
-
reversedDepthBuffer: !0,
|
|
1197
|
-
antialias: !1,
|
|
1198
|
-
depth: !1,
|
|
1199
|
-
trackTimestamp: !1,
|
|
1200
|
-
...e
|
|
1201
|
-
});
|
|
1202
|
-
return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type = xt, t.toneMapping = St, t.toneMappingExposure = 1, t.info.autoReset = !1, t.setPixelRatio(Math.min(window.devicePixelRatio, 1.5)), t.setAnimationLoop(this.animate), this.el.appendChild(t.domElement), t;
|
|
1203
|
-
}
|
|
1204
|
-
createScene() {
|
|
1205
|
-
const e = new je();
|
|
1206
|
-
return e.background = new M(0), e;
|
|
1207
|
-
}
|
|
1208
|
-
createPerspectiveCamera() {
|
|
1209
|
-
const e = new se(50, this.el.clientWidth / this.el.clientHeight, 0.1, 1e5);
|
|
1210
|
-
return e.position.setScalar(5), e;
|
|
1211
|
-
}
|
|
1212
|
-
createOrthographicCamera() {
|
|
1213
|
-
const e = new ne(
|
|
1214
|
-
-this.el.clientWidth / 2,
|
|
1215
|
-
this.el.clientWidth / 2,
|
|
1216
|
-
this.el.clientHeight / 2,
|
|
1217
|
-
-this.el.clientHeight / 2,
|
|
1218
|
-
0.1,
|
|
1219
|
-
1e5
|
|
1220
|
-
);
|
|
1221
|
-
return e.position.setScalar(5), e;
|
|
1222
|
-
}
|
|
1223
|
-
/**
|
|
1224
|
-
* Manually trigger a resize update.
|
|
1225
|
-
*/
|
|
1226
|
-
resize(e, t) {
|
|
1227
|
-
e !== void 0 && t !== void 0 && (this.el.style.width = `${e}px`, this.el.style.height = `${t}px`), this.onWindowResize();
|
|
1228
|
-
}
|
|
1229
|
-
/**
|
|
1230
|
-
* Capture a screenshot of the current render.
|
|
1231
|
-
*/
|
|
1232
|
-
async screenshot(e = {}) {
|
|
1233
|
-
const { type: t = "image/png", quality: s = 1 } = e, n = this.el.clientWidth, i = this.el.clientHeight, r = e.width && e.height;
|
|
1234
|
-
r && this.renderer.setSize(e.width, e.height), await this.render();
|
|
1235
|
-
const o = this.renderer.domElement.toDataURL(t, s);
|
|
1236
|
-
return r && (this.renderer.setSize(n, i), this.onWindowResize()), o;
|
|
1237
|
-
}
|
|
1238
|
-
/**
|
|
1239
|
-
* Set the scene background color, texture, or null.
|
|
1240
|
-
*/
|
|
1241
|
-
setBackground(e) {
|
|
1242
|
-
e === null ? this.scene.background = null : e instanceof M || typeof e == "number" || typeof e == "string" ? this.scene.background = new M(e) : this.scene.background = e, this.render();
|
|
1243
|
-
}
|
|
1244
|
-
/**
|
|
1245
|
-
* Set the scene environment map for reflections / IBL.
|
|
1246
|
-
*/
|
|
1247
|
-
setEnvironment(e) {
|
|
1248
|
-
this.scene.environment = e, this.render();
|
|
303
|
+
for (const t of e)
|
|
304
|
+
this.remove(t);
|
|
1249
305
|
}
|
|
1250
306
|
/**
|
|
1251
|
-
*
|
|
307
|
+
* Show a visual helper for a light.
|
|
1252
308
|
*/
|
|
1253
|
-
|
|
1254
|
-
this.
|
|
309
|
+
showHelper(e) {
|
|
310
|
+
if (this.helpers.has(e)) return;
|
|
311
|
+
const t = this.lights.get(e);
|
|
312
|
+
if (!t) return;
|
|
313
|
+
let s = null;
|
|
314
|
+
t instanceof Pe ? s = new Zt(t, 1) : t instanceof Ne ? s = new es(t, 0.5) : t instanceof ze ? s = new ts(t) : t instanceof De && (s = new ss(t, 1)), s && (this.scene.add(s), this.helpers.set(e, s));
|
|
1255
315
|
}
|
|
1256
316
|
/**
|
|
1257
|
-
*
|
|
317
|
+
* Hide (remove) the helper for a light.
|
|
1258
318
|
*/
|
|
1259
|
-
|
|
1260
|
-
|
|
319
|
+
hideHelper(e) {
|
|
320
|
+
const t = this.helpers.get(e);
|
|
321
|
+
t && (this.scene.remove(t), this.helpers.delete(e));
|
|
1261
322
|
}
|
|
1262
323
|
/**
|
|
1263
|
-
*
|
|
324
|
+
* Show helpers for all lights.
|
|
1264
325
|
*/
|
|
1265
|
-
|
|
1266
|
-
const
|
|
1267
|
-
|
|
326
|
+
showAllHelpers() {
|
|
327
|
+
for (const [e] of this.lights)
|
|
328
|
+
this.showHelper(e);
|
|
1268
329
|
}
|
|
1269
330
|
/**
|
|
1270
|
-
*
|
|
331
|
+
* Hide all helpers.
|
|
1271
332
|
*/
|
|
1272
|
-
|
|
1273
|
-
const
|
|
1274
|
-
|
|
333
|
+
hideAllHelpers() {
|
|
334
|
+
const e = Array.from(this.helpers.keys());
|
|
335
|
+
for (const t of e)
|
|
336
|
+
this.hideHelper(t);
|
|
1275
337
|
}
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
*/
|
|
1279
|
-
disableFog() {
|
|
1280
|
-
this.scene.fog = null, this.render();
|
|
338
|
+
_register(e, t) {
|
|
339
|
+
this.lights.has(e) && this.remove(e), this.lights.set(e, t), this.scene.add(t);
|
|
1281
340
|
}
|
|
1282
341
|
dispose() {
|
|
1283
|
-
this.
|
|
342
|
+
this.removeAll(), this.hideAllHelpers();
|
|
1284
343
|
}
|
|
1285
344
|
}
|
|
1286
|
-
class
|
|
345
|
+
class tn extends Tt {
|
|
1287
346
|
constructor(e) {
|
|
1288
347
|
super(e);
|
|
1289
348
|
}
|
|
1290
349
|
parse(e, t, s, n) {
|
|
1291
|
-
if (
|
|
1292
|
-
const
|
|
1293
|
-
return super.parse(
|
|
350
|
+
if (sn(e.slice(0, 8)) === "SBMG----") {
|
|
351
|
+
const a = nn(e.slice(8));
|
|
352
|
+
return super.parse(a, t, s, n);
|
|
1294
353
|
} else
|
|
1295
354
|
return super.parse(e, t, s, n);
|
|
1296
355
|
}
|
|
1297
356
|
}
|
|
1298
|
-
function
|
|
1299
|
-
return new TextDecoder().decode(new Uint8Array(
|
|
357
|
+
function sn(r) {
|
|
358
|
+
return new TextDecoder().decode(new Uint8Array(r));
|
|
1300
359
|
}
|
|
1301
|
-
function
|
|
1302
|
-
const e = new DataView(
|
|
360
|
+
function nn(r) {
|
|
361
|
+
const e = new DataView(r);
|
|
1303
362
|
for (let t = 0; t < e.byteLength; t++) {
|
|
1304
363
|
const s = e.getUint8(t), n = (s >> 4 & 15) + (s << 4 & 240);
|
|
1305
364
|
e.setUint8(t, n);
|
|
1306
365
|
}
|
|
1307
366
|
return e.buffer;
|
|
1308
367
|
}
|
|
1309
|
-
const
|
|
1310
|
-
function
|
|
1311
|
-
let e =
|
|
1312
|
-
const t = new Uint8Array(
|
|
1313
|
-
if (
|
|
1314
|
-
return
|
|
1315
|
-
e +=
|
|
1316
|
-
const n = new Uint8Array(
|
|
368
|
+
const rn = 8, an = 130, Qe = 66, on = "SBK-----", cn = "SBM-----", Pt = new TextDecoder(), ln = new TextEncoder();
|
|
369
|
+
function hn(r) {
|
|
370
|
+
let e = rn;
|
|
371
|
+
const t = new Uint8Array(r, 0, e);
|
|
372
|
+
if (Pt.decode(t) !== on)
|
|
373
|
+
return r;
|
|
374
|
+
e += an;
|
|
375
|
+
const n = new Uint8Array(r, 0, e);
|
|
1317
376
|
if (n[40] === 1) {
|
|
1318
|
-
const
|
|
1319
|
-
let
|
|
1320
|
-
const
|
|
1321
|
-
for (let
|
|
1322
|
-
|
|
1323
|
-
const m = new Uint8Array(
|
|
1324
|
-
return m.set(
|
|
377
|
+
const a = ln.encode(cn), o = new Uint8Array([n[41]]), c = un(n), l = dn(c);
|
|
378
|
+
let h = Qe % l.length;
|
|
379
|
+
const u = e + Qe, d = new Uint8Array(r, u), p = new Uint8Array(d.length);
|
|
380
|
+
for (let b = 0; b < d.length; b++)
|
|
381
|
+
p[b] = d[b] ^ l[h], h = (h + 1) % l.length;
|
|
382
|
+
const m = new Uint8Array(a.length + o.length + p.length);
|
|
383
|
+
return m.set(a), m.set(o, a.length), m.set(p, a.length + o.length), m.buffer;
|
|
1325
384
|
}
|
|
1326
385
|
}
|
|
1327
|
-
function
|
|
386
|
+
function un(r) {
|
|
1328
387
|
const e = new Uint8Array(128);
|
|
1329
|
-
return e.set(
|
|
388
|
+
return e.set(r.slice(42, 74), 0), e.set(r.slice(74, 138), 32), e.set(r.slice(8, 40), 96), e;
|
|
1330
389
|
}
|
|
1331
|
-
function
|
|
390
|
+
function dn(r) {
|
|
1332
391
|
const e = new Uint8Array(64);
|
|
1333
|
-
return e.set(
|
|
392
|
+
return e.set(r.slice(0, 8), 0), e.set(r.slice(24, 32), 8), e.set(r.slice(40, 56), 16), e.set(r.slice(64, 88), 32), e.set(r.slice(96, 104), 56), e;
|
|
1334
393
|
}
|
|
1335
|
-
const
|
|
1336
|
-
const s =
|
|
1337
|
-
let n =
|
|
394
|
+
const pn = (r, e, t) => {
|
|
395
|
+
const s = r.buffer.slice(t, t + e);
|
|
396
|
+
let n = Pt.decode(s);
|
|
1338
397
|
return n = n.replace("\\", "/"), n.startsWith("Maps/") || (n = `Maps/${n}`), n;
|
|
1339
|
-
},
|
|
1340
|
-
const [s, n, i,
|
|
1341
|
-
return new
|
|
1342
|
-
name:
|
|
1343
|
-
color: new
|
|
1344
|
-
opacity:
|
|
1345
|
-
transparent:
|
|
398
|
+
}, mn = (r, e, t) => {
|
|
399
|
+
const [s, n, i, a, o] = e, c = t || a < 1;
|
|
400
|
+
return new K({
|
|
401
|
+
name: r,
|
|
402
|
+
color: new A(s, n, i),
|
|
403
|
+
opacity: a,
|
|
404
|
+
transparent: c,
|
|
1346
405
|
alphaTest: 0.01,
|
|
1347
406
|
side: o
|
|
1348
407
|
});
|
|
1349
|
-
},
|
|
1350
|
-
class
|
|
408
|
+
}, fn = (r) => r?.toLowerCase().endsWith(".png") ?? !1;
|
|
409
|
+
class gn {
|
|
1351
410
|
data;
|
|
1352
411
|
options;
|
|
1353
412
|
textureLoader;
|
|
1354
413
|
littleEndian = !0;
|
|
1355
414
|
materials = /* @__PURE__ */ new Map();
|
|
1356
415
|
constructor(e, t) {
|
|
1357
|
-
this.data = e, this.options = t, this.textureLoader = new
|
|
416
|
+
this.data = e, this.options = t, this.textureLoader = new Ct(t.manager), this.textureLoader.setCrossOrigin(t.crossOrigin), this.textureLoader.setRequestHeader(t.requestHeader);
|
|
1358
417
|
}
|
|
1359
418
|
parse(e, t) {
|
|
1360
419
|
let s = this.data;
|
|
1361
|
-
const n =
|
|
420
|
+
const n = hn(this.data);
|
|
1362
421
|
n && (s = n);
|
|
1363
422
|
const i = new DataView(s);
|
|
1364
|
-
let
|
|
1365
|
-
const o = i.getUint8(
|
|
1366
|
-
|
|
423
|
+
let a = 8;
|
|
424
|
+
const o = i.getUint8(a);
|
|
425
|
+
a += 1, o === 1 ? this._parseV2(i, a, e) : o === 2 ? this._parseV2(i, a, e) : o === 3 ? this._parseV3(i, a, e) : t?.(new Error(`SBMLoader: Unsupported SBM version: ${o}`));
|
|
1367
426
|
}
|
|
1368
427
|
_parseV2(e, t, s) {
|
|
1369
|
-
const n = new
|
|
428
|
+
const n = new H(), i = e.getUint16(t, this.littleEndian);
|
|
1370
429
|
t += 2;
|
|
1371
|
-
const
|
|
430
|
+
const a = e.getUint16(t, this.littleEndian);
|
|
1372
431
|
t += 2;
|
|
1373
432
|
for (let o = 0; o < i; ++o) {
|
|
1374
|
-
const
|
|
433
|
+
const c = e.getUint16(t, this.littleEndian).toString();
|
|
1375
434
|
t += 2, t += 4, t += 4, t += 4, t += 4;
|
|
1376
|
-
const c = e.getFloat32(t, this.littleEndian);
|
|
1377
|
-
t += 4;
|
|
1378
435
|
const l = e.getFloat32(t, this.littleEndian);
|
|
1379
436
|
t += 4;
|
|
1380
|
-
const
|
|
437
|
+
const h = e.getFloat32(t, this.littleEndian);
|
|
1381
438
|
t += 4;
|
|
1382
|
-
const
|
|
439
|
+
const u = e.getFloat32(t, this.littleEndian);
|
|
440
|
+
t += 4;
|
|
441
|
+
const d = e.getFloat32(t, this.littleEndian);
|
|
1383
442
|
t += 4, t += 4, t += 4, t += 4, t += 4;
|
|
1384
|
-
let
|
|
1385
|
-
t += 1,
|
|
443
|
+
let p = e.getUint8(t);
|
|
444
|
+
t += 1, p === 0 ? p = is : p === 1 ? p = rs : p === 2 && (p = as);
|
|
1386
445
|
const m = e.getUint16(t, this.littleEndian);
|
|
1387
446
|
t += 2;
|
|
1388
|
-
const
|
|
1389
|
-
if (t += m, !this.materials.has(
|
|
1390
|
-
const
|
|
1391
|
-
this.materials.set(
|
|
1392
|
-
|
|
447
|
+
const b = m > 0 ? pn(e, m, t) : "";
|
|
448
|
+
if (t += m, !this.materials.has(c)) {
|
|
449
|
+
const w = mn(c, [l, h, u, d, p], fn(b));
|
|
450
|
+
this.materials.set(c, w), b && this.options.path && this.textureLoader.load(G.resolveURL(b, this.options.path), (g) => {
|
|
451
|
+
g.colorSpace = Ot, g.wrapS = Re, g.wrapT = Re, g.flipY = !1, g.anisotropy = 16, w.map = g;
|
|
1393
452
|
});
|
|
1394
453
|
}
|
|
1395
454
|
}
|
|
1396
|
-
for (let o = 0; o <
|
|
1397
|
-
const a = e.getUint16(t, this.littleEndian).toString();
|
|
1398
|
-
t += 2;
|
|
455
|
+
for (let o = 0; o < a; ++o) {
|
|
1399
456
|
const c = e.getUint16(t, this.littleEndian).toString();
|
|
1400
457
|
t += 2;
|
|
1401
|
-
const l =
|
|
458
|
+
const l = e.getUint16(t, this.littleEndian).toString();
|
|
459
|
+
t += 2;
|
|
460
|
+
const h = [], u = [], d = [], p = [], m = e.getUint16(t, this.littleEndian);
|
|
1402
461
|
if (t += 2, m > 0)
|
|
1403
|
-
for (let
|
|
1404
|
-
const
|
|
1405
|
-
|
|
462
|
+
for (let y = 0; y < m; y++) {
|
|
463
|
+
const _ = new C();
|
|
464
|
+
_.setX(e.getFloat32(t, this.littleEndian)), t += 4, _.setY(e.getFloat32(t, this.littleEndian)), t += 4, _.setZ(e.getFloat32(t, this.littleEndian)), t += 4, h.push(_);
|
|
1406
465
|
}
|
|
1407
|
-
const
|
|
1408
|
-
if (t += 2,
|
|
1409
|
-
for (let
|
|
466
|
+
const b = e.getUint16(t, this.littleEndian);
|
|
467
|
+
if (t += 2, b > 0)
|
|
468
|
+
for (let y = 0; y < b; y++)
|
|
1410
469
|
t += 4, t += 4, t += 4;
|
|
1411
470
|
const S = e.getUint16(t, this.littleEndian);
|
|
1412
471
|
if (t += 2, S > 0)
|
|
1413
|
-
for (let
|
|
1414
|
-
const
|
|
1415
|
-
|
|
472
|
+
for (let y = 0; y < S; y++) {
|
|
473
|
+
const _ = new z();
|
|
474
|
+
_.setX(e.getFloat32(t, this.littleEndian)), t += 4, _.setY(e.getFloat32(t, this.littleEndian)), t += 4, u.push(_);
|
|
1416
475
|
}
|
|
1417
|
-
const
|
|
1418
|
-
if (t += 2,
|
|
1419
|
-
for (let
|
|
1420
|
-
const
|
|
476
|
+
const w = e.getUint16(t, this.littleEndian);
|
|
477
|
+
if (t += 2, w > 0)
|
|
478
|
+
for (let y = 0; y < w; y++) {
|
|
479
|
+
const _ = e.getUint16(t, this.littleEndian);
|
|
1421
480
|
t += 2;
|
|
1422
|
-
const
|
|
481
|
+
const k = e.getUint16(t, this.littleEndian);
|
|
1423
482
|
t += 2;
|
|
1424
483
|
const N = e.getUint16(t, this.littleEndian);
|
|
1425
484
|
t += 2;
|
|
1426
|
-
const
|
|
1427
|
-
|
|
485
|
+
const D = [_, k, N];
|
|
486
|
+
d.push(D), u.length > 0 && p.push([u[D[0]], u[D[1]], u[D[2]]]);
|
|
1428
487
|
}
|
|
1429
|
-
const
|
|
1430
|
-
for (let
|
|
1431
|
-
const
|
|
1432
|
-
|
|
1433
|
-
let
|
|
1434
|
-
const
|
|
1435
|
-
|
|
488
|
+
const g = [], I = [];
|
|
489
|
+
for (let y = 0; y < d.length; y++) {
|
|
490
|
+
const _ = d[y], k = h[_[0]], N = h[_[1]], D = h[_[2]];
|
|
491
|
+
g.push(...k.toArray(), ...N.toArray(), ...D.toArray());
|
|
492
|
+
let Y = new z(), R = new z(), f = new z();
|
|
493
|
+
const E = p[y];
|
|
494
|
+
E !== void 0 && (Y = E[0], R = E[1], f = E[2]), I.push(...Y.toArray(), ...R.toArray(), ...f.toArray());
|
|
1436
495
|
}
|
|
1437
|
-
const
|
|
1438
|
-
if (
|
|
1439
|
-
const
|
|
1440
|
-
|
|
496
|
+
const B = new Float32Array(g), O = new Float32Array(I), T = new Q();
|
|
497
|
+
if (B.length > 0 && T.setAttribute("position", new je(B, 3)), O.length > 0 && T.setAttribute("uv", new je(O, 2)), T.computeVertexNormals(), this.materials.has(l)) {
|
|
498
|
+
const y = new P(T, this.materials.get(l));
|
|
499
|
+
y.name = c, y.castShadow = !0, y.receiveShadow = !0, n.add(y);
|
|
1441
500
|
}
|
|
1442
501
|
}
|
|
1443
502
|
s(n);
|
|
1444
503
|
}
|
|
1445
504
|
_parseV3(e, t, s) {
|
|
1446
|
-
const n = new
|
|
505
|
+
const n = new H();
|
|
1447
506
|
console.warn("SBMLoader: SBM version 3 is not supported yet."), s(n);
|
|
1448
507
|
}
|
|
1449
508
|
}
|
|
1450
|
-
class
|
|
509
|
+
class yn extends ns {
|
|
1451
510
|
load(e, t, s, n) {
|
|
1452
511
|
let i;
|
|
1453
512
|
if (this.resourcePath !== "")
|
|
1454
513
|
i = this.resourcePath;
|
|
1455
514
|
else if (this.path !== "") {
|
|
1456
|
-
const
|
|
1457
|
-
i =
|
|
515
|
+
const c = G.extractUrlBase(e);
|
|
516
|
+
i = G.resolveURL(c, this.path);
|
|
1458
517
|
} else
|
|
1459
|
-
i =
|
|
518
|
+
i = G.extractUrlBase(e);
|
|
1460
519
|
this.manager.itemStart(e);
|
|
1461
|
-
const
|
|
1462
|
-
n ? n(
|
|
1463
|
-
}, o = new
|
|
520
|
+
const a = (c) => {
|
|
521
|
+
n ? n(c) : console.error(c), this.manager.itemError(e), this.manager.itemEnd(e);
|
|
522
|
+
}, o = new _t(this.manager);
|
|
1464
523
|
o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(
|
|
1465
524
|
e,
|
|
1466
|
-
(
|
|
525
|
+
(c) => {
|
|
1467
526
|
try {
|
|
1468
527
|
this.parse(
|
|
1469
|
-
|
|
528
|
+
c,
|
|
1470
529
|
i,
|
|
1471
|
-
(
|
|
1472
|
-
t(
|
|
530
|
+
(l) => {
|
|
531
|
+
t(l), this.manager.itemEnd(e);
|
|
1473
532
|
},
|
|
1474
|
-
|
|
533
|
+
a
|
|
1475
534
|
);
|
|
1476
|
-
} catch (
|
|
1477
|
-
|
|
535
|
+
} catch (l) {
|
|
536
|
+
a(l);
|
|
1478
537
|
}
|
|
1479
538
|
},
|
|
1480
539
|
s,
|
|
1481
|
-
|
|
540
|
+
a
|
|
1482
541
|
);
|
|
1483
542
|
}
|
|
1484
543
|
parse(e, t, s, n) {
|
|
@@ -1487,7 +546,7 @@ class qs extends Tt {
|
|
|
1487
546
|
n?.(new Error(`SBMLoader: Invalid SBM format: ${i}`));
|
|
1488
547
|
return;
|
|
1489
548
|
}
|
|
1490
|
-
new
|
|
549
|
+
new gn(e, {
|
|
1491
550
|
path: t,
|
|
1492
551
|
crossOrigin: this.crossOrigin,
|
|
1493
552
|
requestHeader: this.requestHeader,
|
|
@@ -1509,7 +568,7 @@ class qs extends Tt {
|
|
|
1509
568
|
});
|
|
1510
569
|
}
|
|
1511
570
|
}
|
|
1512
|
-
const
|
|
571
|
+
const bn = [
|
|
1513
572
|
"map",
|
|
1514
573
|
"alphaMap",
|
|
1515
574
|
"aoMap",
|
|
@@ -1536,36 +595,36 @@ const Xs = [
|
|
|
1536
595
|
"thicknessMap",
|
|
1537
596
|
"transmissionMap"
|
|
1538
597
|
];
|
|
1539
|
-
function
|
|
1540
|
-
return
|
|
1541
|
-
if (!(e instanceof
|
|
598
|
+
function oe(r) {
|
|
599
|
+
return r.traverse((e) => {
|
|
600
|
+
if (!(e instanceof P)) return;
|
|
1542
601
|
const t = Array.isArray(e.material) ? e.material : [e.material];
|
|
1543
602
|
for (const s of t) {
|
|
1544
603
|
if (!s) continue;
|
|
1545
604
|
let n = !1;
|
|
1546
|
-
for (const i of
|
|
1547
|
-
const
|
|
1548
|
-
|
|
605
|
+
for (const i of bn) {
|
|
606
|
+
const a = s[i];
|
|
607
|
+
a?.isTexture && a.image == null && (a.dispose(), s[i] = null, n = !0);
|
|
1549
608
|
}
|
|
1550
609
|
n && (s.needsUpdate = !0);
|
|
1551
610
|
}
|
|
1552
|
-
}),
|
|
611
|
+
}), r;
|
|
1553
612
|
}
|
|
1554
|
-
class
|
|
613
|
+
class X {
|
|
1555
614
|
static CACHE_NAME = "u-space-model-loader-cache";
|
|
1556
|
-
static fileLoader = new
|
|
1557
|
-
static dracoLoader = new
|
|
1558
|
-
`https://cdn.jsdelivr.net/npm/three@0.${
|
|
615
|
+
static fileLoader = new _t().setResponseType("arraybuffer");
|
|
616
|
+
static dracoLoader = new Hs().setDecoderPath(
|
|
617
|
+
`https://cdn.jsdelivr.net/npm/three@0.${ke}.0/examples/jsm/libs/draco/`
|
|
1559
618
|
);
|
|
1560
|
-
static ktx2Loader = new
|
|
1561
|
-
`https://cdn.jsdelivr.net/npm/three@0.${
|
|
619
|
+
static ktx2Loader = new Fs().setTranscoderPath(
|
|
620
|
+
`https://cdn.jsdelivr.net/npm/three@0.${ke}.0/examples/jsm/libs/basis/`
|
|
1562
621
|
);
|
|
1563
|
-
static gltfLoader = new
|
|
1564
|
-
static sbmxLoader = new
|
|
1565
|
-
static sbmLoader = new
|
|
1566
|
-
static fbxLoader = new
|
|
1567
|
-
static objLoader = new
|
|
1568
|
-
static stlLoader = new
|
|
622
|
+
static gltfLoader = new Tt().setDRACOLoader(X.dracoLoader).setKTX2Loader(X.ktx2Loader).setMeshoptDecoder(He);
|
|
623
|
+
static sbmxLoader = new tn().setDRACOLoader(X.dracoLoader).setKTX2Loader(X.ktx2Loader).setMeshoptDecoder(He);
|
|
624
|
+
static sbmLoader = new yn();
|
|
625
|
+
static fbxLoader = new ks();
|
|
626
|
+
static objLoader = new Us();
|
|
627
|
+
static stlLoader = new Ws();
|
|
1569
628
|
static setLoadingManager(e) {
|
|
1570
629
|
this.fileLoader.manager = e, this.dracoLoader.manager = e, this.ktx2Loader.manager = e, this.gltfLoader.manager = e, this.sbmxLoader.manager = e, this.sbmLoader.manager = e, this.fbxLoader.manager = e, this.objLoader.manager = e, this.stlLoader.manager = e;
|
|
1571
630
|
}
|
|
@@ -1593,23 +652,23 @@ class D {
|
|
|
1593
652
|
switch (t.persistent && typeof caches < "u" ? n = await this.getPersistentData(e) : n = await this.fileLoader.loadAsync(e), s) {
|
|
1594
653
|
case "gltf":
|
|
1595
654
|
case "glb":
|
|
1596
|
-
const i = await this.gltfLoader.parseAsync(n,
|
|
1597
|
-
return i.scene.animations = i.animations,
|
|
655
|
+
const i = await this.gltfLoader.parseAsync(n, G.extractUrlBase(e));
|
|
656
|
+
return i.scene.animations = i.animations, oe(i.scene);
|
|
1598
657
|
case "sbmx":
|
|
1599
|
-
const
|
|
1600
|
-
return
|
|
658
|
+
const a = await this.sbmxLoader.parseAsync(n, G.extractUrlBase(e));
|
|
659
|
+
return a.scene.animations = a.animations, oe(a.scene);
|
|
1601
660
|
case "sbm":
|
|
1602
|
-
const o = await this.sbmLoader.parseAsync(n,
|
|
1603
|
-
return
|
|
661
|
+
const o = await this.sbmLoader.parseAsync(n, G.extractUrlBase(e));
|
|
662
|
+
return oe(o);
|
|
1604
663
|
case "fbx":
|
|
1605
|
-
const
|
|
1606
|
-
return
|
|
664
|
+
const c = this.fbxLoader.parse(n, G.extractUrlBase(e));
|
|
665
|
+
return oe(c);
|
|
1607
666
|
case "obj":
|
|
1608
|
-
const
|
|
1609
|
-
return
|
|
667
|
+
const l = new TextDecoder().decode(n), h = this.objLoader.parse(l);
|
|
668
|
+
return oe(h);
|
|
1610
669
|
case "stl":
|
|
1611
|
-
const
|
|
1612
|
-
return new
|
|
670
|
+
const u = this.stlLoader.parse(n);
|
|
671
|
+
return new P(u, new K());
|
|
1613
672
|
default:
|
|
1614
673
|
throw new Error(`Unsupported model format: ${s}`);
|
|
1615
674
|
}
|
|
@@ -1626,10 +685,10 @@ class D {
|
|
|
1626
685
|
}
|
|
1627
686
|
}
|
|
1628
687
|
}
|
|
1629
|
-
class
|
|
1630
|
-
static textureLoader = new
|
|
1631
|
-
static hdrLoader = new
|
|
1632
|
-
static cubeTextureLoader = new
|
|
688
|
+
class Ti {
|
|
689
|
+
static textureLoader = new Ct();
|
|
690
|
+
static hdrLoader = new Gs();
|
|
691
|
+
static cubeTextureLoader = new os();
|
|
1633
692
|
static setLoadingManager(e) {
|
|
1634
693
|
this.textureLoader.manager = e, this.hdrLoader.manager = e, this.cubeTextureLoader.manager = e;
|
|
1635
694
|
}
|
|
@@ -1638,13 +697,13 @@ class An {
|
|
|
1638
697
|
}
|
|
1639
698
|
static async loadAsyncHDR(e) {
|
|
1640
699
|
const t = await this.hdrLoader.loadAsync(e);
|
|
1641
|
-
return t.mapping =
|
|
700
|
+
return t.mapping = cs, t;
|
|
1642
701
|
}
|
|
1643
702
|
static async loadAsyncCubeTexture(e, t) {
|
|
1644
703
|
return this.cubeTextureLoader.setPath(e), await this.cubeTextureLoader.loadAsync(t);
|
|
1645
704
|
}
|
|
1646
705
|
}
|
|
1647
|
-
class
|
|
706
|
+
class q extends P {
|
|
1648
707
|
isBaseMesh = !0;
|
|
1649
708
|
type = "BaseMesh";
|
|
1650
709
|
castShadow = !0;
|
|
@@ -1657,7 +716,7 @@ class G extends k {
|
|
|
1657
716
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1658
717
|
}
|
|
1659
718
|
}
|
|
1660
|
-
class
|
|
719
|
+
class ue extends H {
|
|
1661
720
|
isBaseGroup = !0;
|
|
1662
721
|
type = "BaseGroup";
|
|
1663
722
|
ignoreInvisibleWhenRaycast = !0;
|
|
@@ -1668,7 +727,7 @@ class Ye extends R {
|
|
|
1668
727
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1669
728
|
}
|
|
1670
729
|
}
|
|
1671
|
-
class
|
|
730
|
+
class wn extends ls {
|
|
1672
731
|
isBaseSprite = !0;
|
|
1673
732
|
type = "BaseSprite";
|
|
1674
733
|
ignoreInvisibleWhenRaycast = !0;
|
|
@@ -1679,7 +738,7 @@ class Ys extends Bt {
|
|
|
1679
738
|
return this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0 ? !1 : super.raycast(e, t);
|
|
1680
739
|
}
|
|
1681
740
|
}
|
|
1682
|
-
class
|
|
741
|
+
class we extends ue {
|
|
1683
742
|
isModel = !0;
|
|
1684
743
|
type = "Model";
|
|
1685
744
|
static memoryCache = /* @__PURE__ */ new Map();
|
|
@@ -1693,21 +752,21 @@ class he extends Ye {
|
|
|
1693
752
|
const { url: t, cache: s = !0, persistent: n = !0 } = e;
|
|
1694
753
|
try {
|
|
1695
754
|
let i;
|
|
1696
|
-
s ?
|
|
1697
|
-
const
|
|
1698
|
-
return this.add(o), o.animations && o.animations.length > 0 && (this.animations = o.animations, this.mixer = new
|
|
755
|
+
s ? we.memoryCache.has(t) ? i = we.memoryCache.get(t) : (i = X.loadAsync(t, { persistent: n }), we.memoryCache.set(t, i)) : i = X.loadAsync(t, { persistent: n });
|
|
756
|
+
const a = await i, o = Le(a);
|
|
757
|
+
return this.add(o), o.animations && o.animations.length > 0 && (this.animations = o.animations, this.mixer = new hs(o)), o;
|
|
1699
758
|
} catch (i) {
|
|
1700
759
|
return console.error(`[Model] Failed to load model from ${t}:`, i), null;
|
|
1701
760
|
}
|
|
1702
761
|
}
|
|
1703
762
|
playAnimation(e, t = {}) {
|
|
1704
763
|
if (!this.mixer || this.animations.length === 0) return null;
|
|
1705
|
-
const { loop: s = !0, repetitions: n = 1 / 0, timeScale: i = 1, clampWhenFinished:
|
|
764
|
+
const { loop: s = !0, repetitions: n = 1 / 0, timeScale: i = 1, clampWhenFinished: a = !1 } = t;
|
|
1706
765
|
let o;
|
|
1707
|
-
if (e === void 0 ? o = this.animations[0] : typeof e == "number" ? o = this.animations[e] : o = this.animations.find((
|
|
766
|
+
if (e === void 0 ? o = this.animations[0] : typeof e == "number" ? o = this.animations[e] : o = this.animations.find((l) => l.name === e), !o)
|
|
1708
767
|
return console.warn(`[Model] Animation not found: ${e}`), null;
|
|
1709
|
-
let
|
|
1710
|
-
return
|
|
768
|
+
let c = this.actions.get(o.name);
|
|
769
|
+
return c || (c = this.mixer.clipAction(o), this.actions.set(o.name, c)), c.setLoop(s ? us : ds, n), c.clampWhenFinished = a, c.timeScale = i, c.reset().play(), c;
|
|
1711
770
|
}
|
|
1712
771
|
playAllAnimations(e = {}) {
|
|
1713
772
|
return this.animations.map((t, s) => this.playAnimation(s, e)).filter((t) => t !== null);
|
|
@@ -1728,13 +787,13 @@ class he extends Ye {
|
|
|
1728
787
|
* Get the axis-aligned bounding box of this model.
|
|
1729
788
|
*/
|
|
1730
789
|
getBoundingBox() {
|
|
1731
|
-
return new
|
|
790
|
+
return new $().setFromObject(this);
|
|
1732
791
|
}
|
|
1733
792
|
/**
|
|
1734
793
|
* Get the center point of this model's bounding box.
|
|
1735
794
|
*/
|
|
1736
795
|
getCenter() {
|
|
1737
|
-
const e = new
|
|
796
|
+
const e = new C();
|
|
1738
797
|
return this.getBoundingBox().getCenter(e), e;
|
|
1739
798
|
}
|
|
1740
799
|
/**
|
|
@@ -1742,7 +801,7 @@ class he extends Ye {
|
|
|
1742
801
|
*/
|
|
1743
802
|
setMaterial(e) {
|
|
1744
803
|
this.traverse((t) => {
|
|
1745
|
-
t instanceof
|
|
804
|
+
t instanceof P && (t.material = e);
|
|
1746
805
|
});
|
|
1747
806
|
}
|
|
1748
807
|
static clearMemoryCache() {
|
|
@@ -1752,11 +811,11 @@ class he extends Ye {
|
|
|
1752
811
|
typeof caches < "u" && await caches.delete("u-space-loader-cache");
|
|
1753
812
|
}
|
|
1754
813
|
}
|
|
1755
|
-
class
|
|
814
|
+
class xn extends q {
|
|
1756
815
|
isSphereMesh = !0;
|
|
1757
816
|
type = "SphereMesh";
|
|
1758
817
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
1759
|
-
super(), this.geometry = new
|
|
818
|
+
super(), this.geometry = new ps(
|
|
1760
819
|
e?.radius,
|
|
1761
820
|
e?.widthSegments,
|
|
1762
821
|
e?.heightSegments,
|
|
@@ -1764,23 +823,23 @@ class Vs extends G {
|
|
|
1764
823
|
e?.phiLength,
|
|
1765
824
|
e?.thetaStart,
|
|
1766
825
|
e?.thetaLength
|
|
1767
|
-
), this.material = new
|
|
826
|
+
), this.material = new K(t);
|
|
1768
827
|
}
|
|
1769
828
|
}
|
|
1770
|
-
class
|
|
829
|
+
class qe extends q {
|
|
1771
830
|
isTubeMesh = !0;
|
|
1772
831
|
type = "TubeMesh";
|
|
1773
832
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
1774
|
-
super(), this.geometry = new
|
|
833
|
+
super(), this.geometry = new ms(
|
|
1775
834
|
e?.path,
|
|
1776
835
|
e?.tubularSegments,
|
|
1777
836
|
e?.radius,
|
|
1778
837
|
e?.radialSegments,
|
|
1779
838
|
e?.closed
|
|
1780
|
-
), this.material = new
|
|
839
|
+
), this.material = new K(t);
|
|
1781
840
|
}
|
|
1782
841
|
}
|
|
1783
|
-
class
|
|
842
|
+
class Li extends ue {
|
|
1784
843
|
isTopology = !0;
|
|
1785
844
|
type = "Topology";
|
|
1786
845
|
// Visuals
|
|
@@ -1826,12 +885,12 @@ class Bn extends Ye {
|
|
|
1826
885
|
* @param bidirectional If true, adds the reverse edge as well. Default true.
|
|
1827
886
|
*/
|
|
1828
887
|
addEdge(e, t, s, n = !0) {
|
|
1829
|
-
const i = this.nodes.get(e),
|
|
1830
|
-
if (!i || !
|
|
888
|
+
const i = this.nodes.get(e), a = this.nodes.get(t);
|
|
889
|
+
if (!i || !a) {
|
|
1831
890
|
console.error(`[Topology] Cannot add edge. One or both nodes not found: ${e}, ${t}`);
|
|
1832
891
|
return;
|
|
1833
892
|
}
|
|
1834
|
-
const o = s ?? i.distanceTo(
|
|
893
|
+
const o = s ?? i.distanceTo(a);
|
|
1835
894
|
this.getNeighbors(e)?.set(t, o), n && this.getNeighbors(t)?.set(e, o);
|
|
1836
895
|
}
|
|
1837
896
|
/**
|
|
@@ -1850,41 +909,41 @@ class Bn extends Ye {
|
|
|
1850
909
|
if (!this.nodes.has(e) || !this.nodes.has(t))
|
|
1851
910
|
return console.warn("[Topology] Start or End node not found."), [];
|
|
1852
911
|
const s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
1853
|
-
for (const [
|
|
1854
|
-
s.set(
|
|
912
|
+
for (const [c] of this.nodes)
|
|
913
|
+
s.set(c, 1 / 0), n.set(c, null), i.add(c);
|
|
1855
914
|
for (s.set(e, 0); i.size > 0; ) {
|
|
1856
|
-
let
|
|
1857
|
-
for (const
|
|
1858
|
-
const
|
|
1859
|
-
|
|
915
|
+
let c = null, l = 1 / 0;
|
|
916
|
+
for (const u of i) {
|
|
917
|
+
const d = s.get(u);
|
|
918
|
+
d < l && (l = d, c = u);
|
|
1860
919
|
}
|
|
1861
|
-
if (
|
|
920
|
+
if (c === null || c === t || l === 1 / 0)
|
|
1862
921
|
break;
|
|
1863
|
-
i.delete(
|
|
1864
|
-
const
|
|
1865
|
-
if (
|
|
1866
|
-
for (const [
|
|
1867
|
-
if (!i.has(
|
|
1868
|
-
const
|
|
1869
|
-
|
|
922
|
+
i.delete(c);
|
|
923
|
+
const h = this.adjacencyMap?.get(c);
|
|
924
|
+
if (h)
|
|
925
|
+
for (const [u, d] of h) {
|
|
926
|
+
if (!i.has(u)) continue;
|
|
927
|
+
const p = s.get(c) + d;
|
|
928
|
+
p < s.get(u) && (s.set(u, p), n.set(u, c));
|
|
1870
929
|
}
|
|
1871
930
|
}
|
|
1872
|
-
const
|
|
931
|
+
const a = [];
|
|
1873
932
|
let o = t;
|
|
1874
933
|
if (n.get(t) === null && e !== t)
|
|
1875
934
|
return [];
|
|
1876
935
|
for (; o !== null; ) {
|
|
1877
|
-
const
|
|
1878
|
-
|
|
936
|
+
const c = this.nodes.get(o);
|
|
937
|
+
c && a.unshift(c), o = n.get(o) || null;
|
|
1879
938
|
}
|
|
1880
|
-
return
|
|
939
|
+
return a;
|
|
1881
940
|
}
|
|
1882
941
|
/**
|
|
1883
942
|
* Renders the entire topology graph structure using TubeGeometry and Spheres.
|
|
1884
943
|
*/
|
|
1885
944
|
renderGraph() {
|
|
1886
|
-
this.clearGraph(), this.graphGroup = new
|
|
1887
|
-
const e = new
|
|
945
|
+
this.clearGraph(), this.graphGroup = new H();
|
|
946
|
+
const e = new xn({
|
|
1888
947
|
geometryParameters: {
|
|
1889
948
|
radius: this.parameters.nodeRadius,
|
|
1890
949
|
widthSegments: 16,
|
|
@@ -1900,15 +959,15 @@ class Bn extends Ye {
|
|
|
1900
959
|
});
|
|
1901
960
|
const t = /* @__PURE__ */ new Set();
|
|
1902
961
|
this.adjacencyMap.forEach((s, n) => {
|
|
1903
|
-
s.forEach((i,
|
|
1904
|
-
const o = [n,
|
|
962
|
+
s.forEach((i, a) => {
|
|
963
|
+
const o = [n, a].sort().join("-");
|
|
1905
964
|
if (t.has(o)) return;
|
|
1906
965
|
t.add(o);
|
|
1907
|
-
const
|
|
1908
|
-
if (
|
|
1909
|
-
const
|
|
966
|
+
const c = this.nodes.get(n), l = this.nodes.get(a);
|
|
967
|
+
if (c && l) {
|
|
968
|
+
const h = new fs(c, l), u = new qe({
|
|
1910
969
|
geometryParameters: {
|
|
1911
|
-
path:
|
|
970
|
+
path: h,
|
|
1912
971
|
tubularSegments: 1,
|
|
1913
972
|
radius: this.parameters.edgeRadius,
|
|
1914
973
|
radialSegments: 8,
|
|
@@ -1918,14 +977,14 @@ class Bn extends Ye {
|
|
|
1918
977
|
color: this.parameters.edgeColor
|
|
1919
978
|
}
|
|
1920
979
|
});
|
|
1921
|
-
Object.assign(
|
|
980
|
+
Object.assign(u.userData, { from: n, to: a, weight: i, type: "edge" }), this.graphGroup.add(u);
|
|
1922
981
|
}
|
|
1923
982
|
});
|
|
1924
983
|
}), this.add(this.graphGroup);
|
|
1925
984
|
}
|
|
1926
985
|
clearGraph() {
|
|
1927
986
|
this.graphGroup && (this.remove(this.graphGroup), this.graphGroup.traverse((e) => {
|
|
1928
|
-
e instanceof
|
|
987
|
+
e instanceof P && (e.geometry.dispose(), e.material.dispose());
|
|
1929
988
|
}), this.graphGroup = null);
|
|
1930
989
|
}
|
|
1931
990
|
/**
|
|
@@ -1933,7 +992,7 @@ class Bn extends Ye {
|
|
|
1933
992
|
*/
|
|
1934
993
|
renderPath(e, t = this.parameters.pathColor) {
|
|
1935
994
|
if (e.length < 2) return;
|
|
1936
|
-
const s = new
|
|
995
|
+
const s = new gs(e, !1, "catmullrom", 0), n = new qe({
|
|
1937
996
|
geometryParameters: {
|
|
1938
997
|
path: s,
|
|
1939
998
|
tubularSegments: e.length * 10,
|
|
@@ -1959,9 +1018,9 @@ class Bn extends Ye {
|
|
|
1959
1018
|
});
|
|
1960
1019
|
const t = [], s = /* @__PURE__ */ new Set();
|
|
1961
1020
|
return this.adjacencyMap.forEach((n, i) => {
|
|
1962
|
-
n.forEach((
|
|
1963
|
-
const
|
|
1964
|
-
s.has(
|
|
1021
|
+
n.forEach((a, o) => {
|
|
1022
|
+
const c = [i, o].sort().join("-");
|
|
1023
|
+
s.has(c) || (s.add(c), t.push({ from: i, to: o, weight: a }));
|
|
1965
1024
|
});
|
|
1966
1025
|
}), { nodes: e, edges: t };
|
|
1967
1026
|
}
|
|
@@ -1971,7 +1030,7 @@ class Bn extends Ye {
|
|
|
1971
1030
|
*/
|
|
1972
1031
|
importData(e) {
|
|
1973
1032
|
this.clearGraph(), this.clearPaths(), this.nodes.clear(), this.adjacencyMap.clear(), Object.entries(e.nodes).forEach(([t, s]) => {
|
|
1974
|
-
this.addNode(t, new
|
|
1033
|
+
this.addNode(t, new C(s.x, s.y, s.z));
|
|
1975
1034
|
}), e.edges.forEach(({ from: t, to: s, weight: n }) => {
|
|
1976
1035
|
this.addEdge(t, s, n);
|
|
1977
1036
|
}), this.renderGraph();
|
|
@@ -1983,7 +1042,7 @@ class Bn extends Ye {
|
|
|
1983
1042
|
return this.adjacencyMap.get(e);
|
|
1984
1043
|
}
|
|
1985
1044
|
}
|
|
1986
|
-
class
|
|
1045
|
+
class Pi extends wn {
|
|
1987
1046
|
isPoi = !0;
|
|
1988
1047
|
type = "Poi";
|
|
1989
1048
|
parameters = {
|
|
@@ -2002,7 +1061,7 @@ class In extends Ys {
|
|
|
2002
1061
|
_canvas = document.createElement("canvas");
|
|
2003
1062
|
_lastParametersJSON = "";
|
|
2004
1063
|
constructor(e = {}) {
|
|
2005
|
-
super(new
|
|
1064
|
+
super(new ys()), Object.assign(this.parameters, e), this.updateAsync();
|
|
2006
1065
|
}
|
|
2007
1066
|
/**
|
|
2008
1067
|
* Update the POI with new parameters
|
|
@@ -2018,33 +1077,33 @@ class In extends Ys {
|
|
|
2018
1077
|
n.font = `${this.parameters.fontSize}px ${this.parameters.fontFamily}`;
|
|
2019
1078
|
let i = null;
|
|
2020
1079
|
this.parameters.img && (i = await this._loadImage(this.parameters.img));
|
|
2021
|
-
const { text:
|
|
2022
|
-
let
|
|
2023
|
-
const
|
|
2024
|
-
if (
|
|
2025
|
-
switch (
|
|
1080
|
+
const { text: a, fontSize: o, color: c, iconSize: l, padding: h, backgroundColor: u, borderRadius: d, textPosition: p, scaleFactor: m } = this.parameters, b = n.measureText(a), S = a ? b.width : 0, w = a ? o : 0;
|
|
1081
|
+
let g = 0, I = 0, B = 0, O = 0, T = 0, y = 0;
|
|
1082
|
+
const _ = !!i, k = !!a;
|
|
1083
|
+
if (_ && k)
|
|
1084
|
+
switch (p) {
|
|
2026
1085
|
case "top":
|
|
2027
|
-
|
|
1086
|
+
g = Math.max(l, S), I = l + h + w, T = (g - S) / 2, y = w / 2, B = (g - l) / 2, O = w + h;
|
|
2028
1087
|
break;
|
|
2029
1088
|
case "bottom":
|
|
2030
|
-
|
|
1089
|
+
g = Math.max(l, S), I = l + h + w, B = (g - l) / 2, O = 0, T = (g - S) / 2, y = l + h + w / 2;
|
|
2031
1090
|
break;
|
|
2032
1091
|
case "left":
|
|
2033
|
-
|
|
1092
|
+
g = l + h + S, I = Math.max(l, w), T = 0, y = I / 2, B = S + h, O = (I - l) / 2;
|
|
2034
1093
|
break;
|
|
2035
1094
|
default:
|
|
2036
|
-
|
|
1095
|
+
g = l + h + S, I = Math.max(l, w), B = 0, O = (I - l) / 2, T = l + h, y = I / 2;
|
|
2037
1096
|
break;
|
|
2038
1097
|
}
|
|
2039
|
-
else
|
|
2040
|
-
const N =
|
|
2041
|
-
if (s.width = N, s.height =
|
|
2042
|
-
n.fillStyle =
|
|
2043
|
-
const
|
|
2044
|
-
n.textBaseline = "alphabetic", n.fillText(
|
|
1098
|
+
else _ ? (g = l, I = l, B = 0, O = 0) : k && (g = S, I = w, T = 0, y = w / 2);
|
|
1099
|
+
const N = g + h * 2, D = I + h * 2;
|
|
1100
|
+
if (s.width = N, s.height = D, n.font = `${o}px ${this.parameters.fontFamily}`, u && (n.fillStyle = u, this._drawRoundedRect(n, 0, 0, N, D, d), n.fill()), _ && n.drawImage(i, B + h, O + h, l, l), k) {
|
|
1101
|
+
n.fillStyle = c;
|
|
1102
|
+
const f = n.measureText(a), E = f.actualBoundingBoxAscent + f.actualBoundingBoxDescent, M = f.actualBoundingBoxAscent - E / 2;
|
|
1103
|
+
n.textBaseline = "alphabetic", n.fillText(a, T + h, y + h + M);
|
|
2045
1104
|
}
|
|
2046
|
-
const
|
|
2047
|
-
|
|
1105
|
+
const Y = this.material.map, R = new bs(s);
|
|
1106
|
+
R.colorSpace = Ot, this.material.map = R, Y?.dispose(), this.scale.set(N * m, D * m, 1);
|
|
2048
1107
|
}
|
|
2049
1108
|
_loadImage(e) {
|
|
2050
1109
|
return new Promise((t, s) => {
|
|
@@ -2055,87 +1114,110 @@ class In extends Ys {
|
|
|
2055
1114
|
t(e);
|
|
2056
1115
|
});
|
|
2057
1116
|
}
|
|
2058
|
-
_drawRoundedRect(e, t, s, n, i,
|
|
2059
|
-
e.beginPath(), e.moveTo(t +
|
|
1117
|
+
_drawRoundedRect(e, t, s, n, i, a) {
|
|
1118
|
+
e.beginPath(), e.moveTo(t + a, s), e.lineTo(t + n - a, s), e.quadraticCurveTo(t + n, s, t + n, s + a), e.lineTo(t + n, s + i - a), e.quadraticCurveTo(t + n, s + i, t + n - a, s + i), e.lineTo(t + a, s + i), e.quadraticCurveTo(t, s + i, t, s + i - a), e.lineTo(t, s + a), e.quadraticCurveTo(t, s, t + a, s), e.closePath();
|
|
2060
1119
|
}
|
|
2061
1120
|
dispose() {
|
|
2062
1121
|
this.material.map?.dispose(), this.material.dispose();
|
|
2063
1122
|
}
|
|
2064
1123
|
}
|
|
2065
|
-
class
|
|
1124
|
+
class Nt extends q {
|
|
2066
1125
|
isShapeMesh = !0;
|
|
2067
1126
|
type = "ShapeMesh";
|
|
2068
1127
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2069
|
-
super(), this.geometry = new
|
|
1128
|
+
super(), this.geometry = new ws(e?.shape, e?.curveSegments), this.material = new K(t), this.geometry.rotateX(-Math.PI / 2);
|
|
2070
1129
|
}
|
|
2071
1130
|
static createFromPoints(e, t = {}) {
|
|
2072
|
-
return new
|
|
1131
|
+
return new Nt({
|
|
2073
1132
|
...t,
|
|
2074
1133
|
geometryParameters: {
|
|
2075
1134
|
...t.geometryParameters,
|
|
2076
|
-
shape: new
|
|
1135
|
+
shape: new At(e.map((s) => new z(s.x, -s.z)))
|
|
2077
1136
|
}
|
|
2078
1137
|
});
|
|
2079
1138
|
}
|
|
2080
1139
|
}
|
|
2081
|
-
class
|
|
1140
|
+
class zt extends q {
|
|
2082
1141
|
isExtrudeMesh = !0;
|
|
2083
1142
|
type = "ExtrudeMesh";
|
|
2084
1143
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2085
|
-
super(), this.geometry = new
|
|
1144
|
+
super(), this.geometry = new xs(e?.shape, e?.options), this.material = new K(t), this.geometry.rotateX(-Math.PI / 2);
|
|
2086
1145
|
}
|
|
2087
1146
|
static createFromPoints(e, t = {}) {
|
|
2088
|
-
return e && e.length === 0 && (e = void 0), new
|
|
1147
|
+
return e && e.length === 0 && (e = void 0), new zt({
|
|
2089
1148
|
...t,
|
|
2090
1149
|
geometryParameters: {
|
|
2091
1150
|
...t.geometryParameters,
|
|
2092
|
-
shape: new
|
|
1151
|
+
shape: new At(e?.map((s) => new z(s.x, -s.z)))
|
|
2093
1152
|
}
|
|
2094
1153
|
});
|
|
2095
1154
|
}
|
|
2096
1155
|
}
|
|
2097
|
-
class
|
|
1156
|
+
class Ni extends q {
|
|
2098
1157
|
isPlaneMesh = !0;
|
|
2099
1158
|
type = "PlaneMesh";
|
|
2100
1159
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2101
|
-
super(), this.geometry = new
|
|
1160
|
+
super(), this.geometry = new Ms(
|
|
2102
1161
|
e?.width,
|
|
2103
1162
|
e?.height,
|
|
2104
1163
|
e?.widthSegments,
|
|
2105
1164
|
e?.heightSegments
|
|
2106
|
-
), this.material = new
|
|
1165
|
+
), this.material = new K(t);
|
|
2107
1166
|
}
|
|
2108
1167
|
}
|
|
2109
|
-
class
|
|
1168
|
+
class zi extends q {
|
|
2110
1169
|
isCircleMesh = !0;
|
|
2111
1170
|
type = "CircleMesh";
|
|
2112
1171
|
constructor({ geometryParameters: e, materialParameters: t } = {}) {
|
|
2113
1172
|
super(
|
|
2114
|
-
new
|
|
1173
|
+
new Is(
|
|
2115
1174
|
e?.radius,
|
|
2116
1175
|
e?.segments,
|
|
2117
1176
|
e?.thetaStart,
|
|
2118
1177
|
e?.thetaLength
|
|
2119
1178
|
),
|
|
2120
|
-
new
|
|
1179
|
+
new K(t)
|
|
2121
1180
|
), this.geometry.rotateX(-Math.PI / 2);
|
|
2122
1181
|
}
|
|
2123
1182
|
}
|
|
2124
|
-
class
|
|
1183
|
+
class J {
|
|
2125
1184
|
static traverseMeshes(e, t) {
|
|
2126
1185
|
e.traverse((s) => {
|
|
2127
|
-
s instanceof
|
|
1186
|
+
s instanceof P && t(s);
|
|
2128
1187
|
});
|
|
2129
1188
|
}
|
|
2130
1189
|
}
|
|
2131
|
-
|
|
1190
|
+
const Mn = 3, In = 1, Sn = 0, vn = 2, Bn = 1e-3, Ye = new C(), Z = new C(), En = new Ss();
|
|
1191
|
+
function Ve(r) {
|
|
1192
|
+
return r.isInstanceObject === !0;
|
|
1193
|
+
}
|
|
1194
|
+
function Je(r) {
|
|
1195
|
+
let e = !1;
|
|
1196
|
+
return r.traverse((t) => {
|
|
1197
|
+
if (e) return;
|
|
1198
|
+
const s = t;
|
|
1199
|
+
e = s.isMesh === !0 || s.isSprite === !0;
|
|
1200
|
+
}), e;
|
|
1201
|
+
}
|
|
1202
|
+
function _n(r) {
|
|
1203
|
+
let e = r;
|
|
1204
|
+
for (; e; ) {
|
|
1205
|
+
if (!e.visible) return !1;
|
|
1206
|
+
e = e.parent;
|
|
1207
|
+
}
|
|
1208
|
+
return !0;
|
|
1209
|
+
}
|
|
1210
|
+
function Ze(r) {
|
|
1211
|
+
return r === void 0 || !Number.isFinite(r) || r <= 0 ? vn : r;
|
|
1212
|
+
}
|
|
1213
|
+
class Di {
|
|
2132
1214
|
static flow(e = {}) {
|
|
2133
|
-
const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity:
|
|
2134
|
-
return
|
|
1215
|
+
const { baseColor: t = 16777215, flowColor: s = 65280, speed: n = 1, scale: i = 3, intensity: a = 4 } = e, o = V(new A(t)), c = V(new A(s)), l = Fe().x.mul(i).sub(ge.mul(n)), h = ye(Ce(l).add(1).mul(0.5), a);
|
|
1216
|
+
return be(o, c, h);
|
|
2135
1217
|
}
|
|
2136
1218
|
static breathe(e = {}) {
|
|
2137
|
-
const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e,
|
|
2138
|
-
return
|
|
1219
|
+
const { baseColor: t = 16777215, breathColor: s = 65280, speed: n = 1, intensity: i = 2 } = e, a = V(new A(t)), o = V(new A(s)), c = Ce(ge.mul(n)).add(1).mul(0.5), l = ye(c, i);
|
|
1220
|
+
return be(a, o, l);
|
|
2139
1221
|
}
|
|
2140
1222
|
static fluid(e = {}) {
|
|
2141
1223
|
const {
|
|
@@ -2143,81 +1225,154 @@ class zn {
|
|
|
2143
1225
|
flowColor: s = 255,
|
|
2144
1226
|
speed: n = 1,
|
|
2145
1227
|
scale: i = 1,
|
|
2146
|
-
intensity:
|
|
1228
|
+
intensity: a = 1,
|
|
2147
1229
|
distortion: o = 0.5
|
|
2148
|
-
} = e,
|
|
2149
|
-
return
|
|
1230
|
+
} = e, c = V(new A(t)), l = V(new A(s)), h = Fe().mul(i), u = ge.mul(n), d = Ge(h.add(u), 1, 0), p = h.add(d.mul(o)), m = Ge(p, 1, 0).add(1).mul(0.5), b = ye(m, a);
|
|
1231
|
+
return be(c, l, b);
|
|
1232
|
+
}
|
|
1233
|
+
static outline(e = {}) {
|
|
1234
|
+
let t = [...e.selectedObjects ?? []];
|
|
1235
|
+
const s = [], n = /* @__PURE__ */ new Map(), i = new $();
|
|
1236
|
+
let a = null, o = null, c = null, l = null, h = null, u = e.instanceBoundsProxy ?? !0, d = e.instanceBoundsPadding ?? 0, p = e.instanceBoundsMinSize ?? Bn, m = Ze(e.downSampleRatio);
|
|
1237
|
+
const b = ae(e.edgeStrength ?? Mn), S = ae(e.edgeThickness ?? In), w = ae(e.edgeGlow ?? Sn), g = ae(new A(e.visibleEdgeColor ?? 16777215)), I = ae(new A(e.hiddenEdgeColor ?? 5125686)), B = () => (l ??= new vs(1, 1, 1), l), O = () => (h || (h = new Bs({ color: 16777215 }), h.colorWrite = !1, h.depthWrite = !1, h.name = "u-space.outline.instanceBoundsProxy"), h), T = (f) => {
|
|
1238
|
+
const { source: E, mesh: M } = f, v = E.getInstanceBoundingBox?.(i, !0);
|
|
1239
|
+
if (!v || v.isEmpty() || !_n(E)) {
|
|
1240
|
+
M.visible = !1;
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
v.getCenter(Ye), v.getSize(Z);
|
|
1244
|
+
const j = Math.max(0, d), re = Math.max(0, p);
|
|
1245
|
+
Z.set(
|
|
1246
|
+
Math.max(Z.x + j * 2, re),
|
|
1247
|
+
Math.max(Z.y + j * 2, re),
|
|
1248
|
+
Math.max(Z.z + j * 2, re)
|
|
1249
|
+
), M.visible = !0, M.layers.mask = E.layers.mask, M.matrix.compose(Ye, En, Z), M.matrixWorldNeedsUpdate = !0;
|
|
1250
|
+
}, y = (f) => {
|
|
1251
|
+
f.unsubscribe?.(), f.mesh.removeFromParent();
|
|
1252
|
+
}, _ = (f, E) => {
|
|
1253
|
+
let M = n.get(f);
|
|
1254
|
+
if (!M) {
|
|
1255
|
+
const v = new P(B(), O());
|
|
1256
|
+
v.name = `u-space.outline.instanceBoundsProxy:${f.uuid}`, v.matrixAutoUpdate = !1, v.castShadow = !1, v.receiveShadow = !1, v.frustumCulled = !1, v.raycast = () => {
|
|
1257
|
+
}, v.userData.instanceObject = f, M = {
|
|
1258
|
+
source: f,
|
|
1259
|
+
mesh: v,
|
|
1260
|
+
unsubscribe: f.onInstanceRenderDirty?.(() => T(M)) ?? null
|
|
1261
|
+
}, n.set(f, M);
|
|
1262
|
+
}
|
|
1263
|
+
return M.mesh.parent !== E && (M.mesh.removeFromParent(), E.add(M.mesh)), T(M), M.mesh.visible ? M.mesh : null;
|
|
1264
|
+
}, k = (f, E) => {
|
|
1265
|
+
const M = f.getInstanceRenderObject?.();
|
|
1266
|
+
return M && Je(M) ? M : Je(f) ? f : u && f.getInstanceBoundingBox ? _(f, E) : null;
|
|
1267
|
+
}, N = (f) => {
|
|
1268
|
+
const E = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new Set();
|
|
1269
|
+
for (const v of t) {
|
|
1270
|
+
const j = Ve(v) ? k(v, f) : v;
|
|
1271
|
+
j && (E.add(j), Ve(v) && n.get(v)?.mesh === j && M.add(v));
|
|
1272
|
+
}
|
|
1273
|
+
n.forEach((v, j) => {
|
|
1274
|
+
M.has(j) || (y(v), n.delete(j));
|
|
1275
|
+
}), s.length = 0, E.forEach((v) => s.push(v));
|
|
1276
|
+
}, D = () => {
|
|
1277
|
+
a?.dispose(), a = null;
|
|
1278
|
+
}, Y = (f, E) => {
|
|
1279
|
+
if (a && o === f && c === E)
|
|
1280
|
+
return a.downSampleRatio = m, a;
|
|
1281
|
+
D(), o = f, c = E, a = Js(f, E, {
|
|
1282
|
+
selectedObjects: s,
|
|
1283
|
+
edgeThickness: S,
|
|
1284
|
+
edgeGlow: w,
|
|
1285
|
+
downSampleRatio: m
|
|
1286
|
+
});
|
|
1287
|
+
const M = a.updateBefore.bind(a);
|
|
1288
|
+
return a.updateBefore = (v) => (N(f), M(v)), a;
|
|
1289
|
+
}, R = ((f, E) => {
|
|
1290
|
+
const M = f.scene, v = f.camera;
|
|
1291
|
+
N(M);
|
|
1292
|
+
const j = Y(M, v), re = j.visibleEdge.mul(g).add(j.hiddenEdge.mul(I)).mul(b);
|
|
1293
|
+
return $s(E, Ks(re, 0));
|
|
1294
|
+
});
|
|
1295
|
+
return Object.defineProperties(R, {
|
|
1296
|
+
outlineNode: {
|
|
1297
|
+
get: () => a
|
|
1298
|
+
},
|
|
1299
|
+
selectedObjects: {
|
|
1300
|
+
get: () => t
|
|
1301
|
+
}
|
|
1302
|
+
}), R.setSelectedObjects = (f) => (t = [...f], o && N(o), R), R.update = (f) => (f.edgeStrength !== void 0 && (b.value = f.edgeStrength), f.edgeThickness !== void 0 && (S.value = f.edgeThickness), f.edgeGlow !== void 0 && (w.value = f.edgeGlow), f.visibleEdgeColor !== void 0 && g.value.set(f.visibleEdgeColor), f.hiddenEdgeColor !== void 0 && I.value.set(f.hiddenEdgeColor), f.instanceBoundsProxy !== void 0 && (u = f.instanceBoundsProxy), f.instanceBoundsPadding !== void 0 && (d = f.instanceBoundsPadding), f.instanceBoundsMinSize !== void 0 && (p = f.instanceBoundsMinSize), f.downSampleRatio !== void 0 && (m = Ze(f.downSampleRatio), a && (a.downSampleRatio = m)), o && N(o), R), R.dispose = () => {
|
|
1303
|
+
D(), n.forEach(y), n.clear(), l?.dispose(), h?.dispose(), l = null, h = null, t = [], s.length = 0, o = null, c = null;
|
|
1304
|
+
}, R;
|
|
2150
1305
|
}
|
|
2151
1306
|
}
|
|
2152
|
-
function
|
|
1307
|
+
function Ri(r) {
|
|
2153
1308
|
}
|
|
2154
|
-
const
|
|
2155
|
-
const
|
|
2156
|
-
return
|
|
2157
|
-
})(),
|
|
2158
|
-
const
|
|
2159
|
-
return
|
|
1309
|
+
const ie = "uSpaceHighlight", he = `${ie}/enabled`, Dt = `${ie}/opacity`, Rt = `${ie}/color`, jt = `${ie}/overwrite`, kt = `${ie}/multiplyOpacity`, Me = `${ie}/instancedOriginalOpacity`, ve = "uSpaceBreathe", Ie = `${ve}/enabled`, Ut = `${ve}/color`, Wt = `${ve}/speed`, Ht = `${ve}/intensity`, Se = /* @__PURE__ */ new WeakMap(), Cn = Lt(() => {
|
|
1310
|
+
const r = U(he, "uint"), e = U(Rt, "uint"), t = U(jt, "uint"), s = st(e), n = xe.mul(s), i = F(t.greaterThan(0), s, n), a = F(r.greaterThan(0), i, xe), o = U(Ie, "uint"), c = U(Ut, "uint"), l = U(Wt, "float"), h = U(Ht, "float"), u = st(c), d = Ce(ge.mul(l)).add(1).mul(0.5), p = ye(d, h), m = be(a, u, p);
|
|
1311
|
+
return F(o.greaterThan(0), m, a);
|
|
1312
|
+
})(), On = Lt(() => {
|
|
1313
|
+
const r = U(he, "uint"), e = U(Dt, "float"), t = U(kt, "uint"), s = F(t.greaterThan(0), Oe.mul(e), e);
|
|
1314
|
+
return F(r.greaterThan(0), s, Oe);
|
|
2160
1315
|
})();
|
|
2161
|
-
function
|
|
2162
|
-
return Array.isArray(
|
|
1316
|
+
function le(r) {
|
|
1317
|
+
return Array.isArray(r.material) ? r.material : [r.material];
|
|
2163
1318
|
}
|
|
2164
|
-
function
|
|
2165
|
-
|
|
1319
|
+
function et(r) {
|
|
1320
|
+
le(r).forEach((t) => {
|
|
2166
1321
|
if (!t) return;
|
|
2167
|
-
let s =
|
|
1322
|
+
let s = Se.get(t);
|
|
2168
1323
|
s || (s = {
|
|
2169
1324
|
colorNode: t.colorNode,
|
|
2170
1325
|
opacityNode: t.opacityNode,
|
|
2171
1326
|
transparent: t.transparent,
|
|
2172
1327
|
depthWrite: t.depthWrite,
|
|
2173
1328
|
activeMeshes: /* @__PURE__ */ new Set()
|
|
2174
|
-
},
|
|
1329
|
+
}, Se.set(t, s)), s.activeMeshes.add(r), t.transparent = !0, t.colorNode = Cn, t.opacityNode = On, t.needsUpdate = !0;
|
|
2175
1330
|
});
|
|
2176
1331
|
}
|
|
2177
|
-
function
|
|
2178
|
-
const e =
|
|
1332
|
+
function tt(r) {
|
|
1333
|
+
const e = r.userData[he], t = r.userData[Ie];
|
|
2179
1334
|
if (e || t) return;
|
|
2180
|
-
|
|
1335
|
+
le(r).forEach((n) => {
|
|
2181
1336
|
if (!n) return;
|
|
2182
|
-
const i =
|
|
2183
|
-
i && (i.activeMeshes.delete(
|
|
1337
|
+
const i = Se.get(n);
|
|
1338
|
+
i && (i.activeMeshes.delete(r), !(i.activeMeshes.size > 0) && (n.colorNode = i.colorNode, n.opacityNode = i.opacityNode, n.transparent = i.transparent, n.depthWrite = i.depthWrite, n.needsUpdate = !0, Se.delete(n)));
|
|
2184
1339
|
});
|
|
2185
1340
|
}
|
|
2186
|
-
function
|
|
2187
|
-
const n =
|
|
1341
|
+
function An(r, e, t, s) {
|
|
1342
|
+
const n = r, i = n.setInstanceHighlight;
|
|
2188
1343
|
if (i)
|
|
2189
|
-
return i.call(
|
|
2190
|
-
const
|
|
2191
|
-
return !
|
|
2192
|
-
hasColor:
|
|
2193
|
-
color:
|
|
2194
|
-
opacity:
|
|
2195
|
-
}),
|
|
2196
|
-
}
|
|
2197
|
-
function
|
|
2198
|
-
const e =
|
|
1344
|
+
return i.call(r, e, t, s), !0;
|
|
1345
|
+
const a = n.setInstanceColor, o = n.setInstanceOpacity, c = n.getInstanceOpacity, l = n.getInstanceColor, h = n.hasInstanceColor;
|
|
1346
|
+
return !a || !o ? !1 : (r.userData[Me] === void 0 && (r.userData[Me] = {
|
|
1347
|
+
hasColor: h?.call(r) ?? !1,
|
|
1348
|
+
color: l?.call(r, new A()).getHex() ?? 16777215,
|
|
1349
|
+
opacity: c?.call(r) ?? 1
|
|
1350
|
+
}), a.call(r, e), o.call(r, t), !0);
|
|
1351
|
+
}
|
|
1352
|
+
function Tn(r) {
|
|
1353
|
+
const e = r, t = e.clearInstanceHighlight;
|
|
2199
1354
|
if (t)
|
|
2200
|
-
return t.call(
|
|
2201
|
-
const s = e.
|
|
1355
|
+
return t.call(r), !0;
|
|
1356
|
+
const s = e.resetInstanceColor, n = e.setInstanceColor, i = e.setInstanceOpacity;
|
|
2202
1357
|
if (!s || !i) return !1;
|
|
2203
|
-
const
|
|
2204
|
-
return
|
|
1358
|
+
const a = r.userData[Me];
|
|
1359
|
+
return a && (a.hasColor && n ? n.call(r, a.color) : s.call(r), i.call(r, a.opacity), Reflect.deleteProperty(r.userData, Me)), !0;
|
|
2205
1360
|
}
|
|
2206
|
-
class
|
|
1361
|
+
class se {
|
|
2207
1362
|
static highlightColor(e, t = {}) {
|
|
2208
|
-
const s = Array.isArray(e) ? e : [e], { opacity: n = 0.5, color: i = 16711680, overwrite:
|
|
2209
|
-
for (const
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
1363
|
+
const s = Array.isArray(e) ? e : [e], { opacity: n = 0.5, color: i = 16711680, overwrite: a = !1, depthWrite: o, multiplyOpacity: c = !1 } = t, l = new A(i).getHex();
|
|
1364
|
+
for (const h of s)
|
|
1365
|
+
An(h, i, n, a) || J.traverseMeshes(h, (u) => {
|
|
1366
|
+
u.userData[he] = 1, u.userData[Dt] = n, u.userData[Rt] = l, u.userData[jt] = a ? 1 : 0, u.userData[kt] = c ? 1 : 0, et(u), o !== void 0 && le(u).forEach((p) => {
|
|
1367
|
+
p && (p.depthWrite = o);
|
|
2213
1368
|
});
|
|
2214
1369
|
});
|
|
2215
1370
|
}
|
|
2216
1371
|
static removeHighlightColor(e) {
|
|
2217
1372
|
const t = Array.isArray(e) ? e : [e];
|
|
2218
1373
|
for (const s of t)
|
|
2219
|
-
|
|
2220
|
-
n.userData[
|
|
1374
|
+
Tn(s) || J.traverseMeshes(s, (n) => {
|
|
1375
|
+
n.userData[he] = 0, tt(n);
|
|
2221
1376
|
});
|
|
2222
1377
|
}
|
|
2223
1378
|
static breatheColor(e, t = {}) {
|
|
@@ -2229,17 +1384,17 @@ class le {
|
|
|
2229
1384
|
},
|
|
2230
1385
|
t
|
|
2231
1386
|
);
|
|
2232
|
-
n.color = new
|
|
1387
|
+
n.color = new A(n.color).getHex();
|
|
2233
1388
|
for (const i of s)
|
|
2234
|
-
|
|
2235
|
-
|
|
1389
|
+
J.traverseMeshes(i, (a) => {
|
|
1390
|
+
a.userData[Ie] = 1, a.userData[Ut] = n.color, a.userData[Wt] = n.speed, a.userData[Ht] = n.intensity, et(a);
|
|
2236
1391
|
});
|
|
2237
1392
|
}
|
|
2238
1393
|
static removeBreatheColor(e) {
|
|
2239
1394
|
const t = Array.isArray(e) ? e : [e];
|
|
2240
1395
|
for (const s of t)
|
|
2241
|
-
|
|
2242
|
-
n.userData[
|
|
1396
|
+
J.traverseMeshes(s, (n) => {
|
|
1397
|
+
n.userData[Ie] = 0, tt(n);
|
|
2243
1398
|
});
|
|
2244
1399
|
}
|
|
2245
1400
|
/**
|
|
@@ -2248,10 +1403,10 @@ class le {
|
|
|
2248
1403
|
static wireframe(e, t = !0) {
|
|
2249
1404
|
const s = Array.isArray(e) ? e : [e];
|
|
2250
1405
|
for (const n of s)
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
if (!
|
|
2254
|
-
const o =
|
|
1406
|
+
J.traverseMeshes(n, (i) => {
|
|
1407
|
+
le(i).forEach((a) => {
|
|
1408
|
+
if (!a) return;
|
|
1409
|
+
const o = a;
|
|
2255
1410
|
o.wireframe = t, o.needsUpdate = !0;
|
|
2256
1411
|
});
|
|
2257
1412
|
});
|
|
@@ -2260,7 +1415,7 @@ class le {
|
|
|
2260
1415
|
* Remove wireframe mode.
|
|
2261
1416
|
*/
|
|
2262
1417
|
static removeWireframe(e) {
|
|
2263
|
-
|
|
1418
|
+
se.wireframe(e, !1);
|
|
2264
1419
|
}
|
|
2265
1420
|
/**
|
|
2266
1421
|
* Fade in object(s) from fully transparent to original opacity.
|
|
@@ -2268,7 +1423,7 @@ class le {
|
|
|
2268
1423
|
*/
|
|
2269
1424
|
static fadeIn(e, t = {}) {
|
|
2270
1425
|
const { duration: s = 500 } = t;
|
|
2271
|
-
return
|
|
1426
|
+
return se._fade(e, 0, 1, s);
|
|
2272
1427
|
}
|
|
2273
1428
|
/**
|
|
2274
1429
|
* Fade out object(s) to fully transparent.
|
|
@@ -2276,61 +1431,62 @@ class le {
|
|
|
2276
1431
|
*/
|
|
2277
1432
|
static fadeOut(e, t = {}) {
|
|
2278
1433
|
const { duration: s = 500 } = t;
|
|
2279
|
-
return
|
|
1434
|
+
return se._fade(e, 1, 0, s);
|
|
2280
1435
|
}
|
|
2281
1436
|
static _fade(e, t, s, n) {
|
|
2282
|
-
const i = Array.isArray(e) ? e : [e],
|
|
1437
|
+
const i = Array.isArray(e) ? e : [e], a = /* @__PURE__ */ new Map();
|
|
2283
1438
|
for (const o of i)
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
if (!
|
|
2287
|
-
const
|
|
2288
|
-
|
|
2289
|
-
material:
|
|
2290
|
-
targetOpacity:
|
|
2291
|
-
originalOpacity:
|
|
2292
|
-
originalTransparent:
|
|
2293
|
-
}),
|
|
1439
|
+
J.traverseMeshes(o, (c) => {
|
|
1440
|
+
le(c).forEach((l) => {
|
|
1441
|
+
if (!l || a.has(l)) return;
|
|
1442
|
+
const h = l.opacity, u = l.transparent, d = s >= 1 ? h : s;
|
|
1443
|
+
a.set(l, {
|
|
1444
|
+
material: l,
|
|
1445
|
+
targetOpacity: d,
|
|
1446
|
+
originalOpacity: h,
|
|
1447
|
+
originalTransparent: u
|
|
1448
|
+
}), l.transparent = !0, l.opacity = t, l.needsUpdate = !0;
|
|
2294
1449
|
});
|
|
2295
1450
|
});
|
|
2296
|
-
return
|
|
2297
|
-
const
|
|
2298
|
-
let
|
|
2299
|
-
const
|
|
2300
|
-
const
|
|
1451
|
+
return a.size === 0 ? Promise.resolve() : new Promise((o) => {
|
|
1452
|
+
const c = performance.now();
|
|
1453
|
+
let l = 0;
|
|
1454
|
+
const h = () => {
|
|
1455
|
+
const u = performance.now() - c, d = Math.min(u / n, 1);
|
|
2301
1456
|
if (!i[0].parent) {
|
|
2302
|
-
cancelAnimationFrame(
|
|
1457
|
+
cancelAnimationFrame(l), o();
|
|
2303
1458
|
return;
|
|
2304
1459
|
}
|
|
2305
|
-
for (const { material: m, targetOpacity:
|
|
2306
|
-
m.opacity = t + (
|
|
2307
|
-
if (
|
|
2308
|
-
|
|
1460
|
+
for (const { material: m, targetOpacity: b } of a.values())
|
|
1461
|
+
m.opacity = t + (b - t) * d, m.needsUpdate = !0;
|
|
1462
|
+
if (d < 1)
|
|
1463
|
+
l = requestAnimationFrame(h);
|
|
2309
1464
|
else {
|
|
2310
1465
|
if (s >= 1)
|
|
2311
|
-
for (const { material: m, originalOpacity:
|
|
2312
|
-
m.opacity =
|
|
1466
|
+
for (const { material: m, originalOpacity: b, originalTransparent: S } of a.values())
|
|
1467
|
+
m.opacity = b, m.transparent = S, m.needsUpdate = !0;
|
|
2313
1468
|
o();
|
|
2314
1469
|
}
|
|
2315
1470
|
};
|
|
2316
|
-
|
|
1471
|
+
l = requestAnimationFrame(h);
|
|
2317
1472
|
});
|
|
2318
1473
|
}
|
|
2319
1474
|
}
|
|
2320
|
-
const
|
|
2321
|
-
const e =
|
|
2322
|
-
return
|
|
1475
|
+
const st = (r) => {
|
|
1476
|
+
const e = r.shiftRight(16).bitAnd(255).toFloat().div(255), t = r.shiftRight(8).bitAnd(255).toFloat().div(255), s = r.bitAnd(255).toFloat().div(255);
|
|
1477
|
+
return Xs(e, t, s);
|
|
2323
1478
|
};
|
|
2324
|
-
class
|
|
1479
|
+
class Ln extends Zs {
|
|
2325
1480
|
viewer;
|
|
2326
1481
|
constructor(e, t) {
|
|
2327
1482
|
super(t), this.viewer = e;
|
|
2328
1483
|
}
|
|
2329
1484
|
_update = ({ time: e }) => {
|
|
2330
|
-
this.update(e)
|
|
1485
|
+
const t = this.update(e);
|
|
1486
|
+
this.viewer.invalidate(), t || this.viewer.removeEventListener("afterControlsUpdate", this._update);
|
|
2331
1487
|
};
|
|
2332
1488
|
easingByMode(e) {
|
|
2333
|
-
const t =
|
|
1489
|
+
const t = Pn[e];
|
|
2334
1490
|
return super.easing(t);
|
|
2335
1491
|
}
|
|
2336
1492
|
start(e, t) {
|
|
@@ -2340,54 +1496,54 @@ class sn extends ws {
|
|
|
2340
1496
|
return this.viewer.removeEventListener("afterControlsUpdate", this._update), super.stop();
|
|
2341
1497
|
}
|
|
2342
1498
|
}
|
|
2343
|
-
function
|
|
2344
|
-
return new Promise((
|
|
2345
|
-
const { duration:
|
|
2346
|
-
n?.(m,
|
|
1499
|
+
function ji(r, e, t, s = {}, n, i) {
|
|
1500
|
+
return new Promise((a, o) => {
|
|
1501
|
+
const { duration: c = 1e3, delay: l = 0, repeat: h = !1, mode: u = "Linear.None", yoyo: d = !1 } = s, p = new Ln(r, e).to(t, c).easingByMode(u).delay(l).onUpdate((m) => {
|
|
1502
|
+
n?.(m, p);
|
|
2347
1503
|
}).onComplete(() => {
|
|
2348
|
-
|
|
1504
|
+
a();
|
|
2349
1505
|
}).onStop(() => {
|
|
2350
1506
|
o("animation stop");
|
|
2351
1507
|
}).onStart(() => {
|
|
2352
|
-
i?.(
|
|
1508
|
+
i?.(p);
|
|
2353
1509
|
});
|
|
2354
|
-
typeof
|
|
1510
|
+
typeof h == "number" ? p.repeat(h) : typeof h == "boolean" && h && p.repeat(1 / 0), d && p.repeatDelay(20), p.yoyo(d), p.start();
|
|
2355
1511
|
});
|
|
2356
1512
|
}
|
|
2357
|
-
const
|
|
2358
|
-
"Linear.None":
|
|
2359
|
-
"Quadratic.In":
|
|
2360
|
-
"Quadratic.Out":
|
|
2361
|
-
"Quadratic.InOut":
|
|
2362
|
-
"Cubic.In":
|
|
2363
|
-
"Cubic.Out":
|
|
2364
|
-
"Cubic.InOut":
|
|
2365
|
-
"Quartic.In":
|
|
2366
|
-
"Quartic.Out":
|
|
2367
|
-
"Quartic.InOut":
|
|
2368
|
-
"Quintic.In":
|
|
2369
|
-
"Quintic.Out":
|
|
2370
|
-
"Quintic.InOut":
|
|
2371
|
-
"Sinusoidal.In":
|
|
2372
|
-
"Sinusoidal.Out":
|
|
2373
|
-
"Sinusoidal.InOut":
|
|
2374
|
-
"Exponential.In":
|
|
2375
|
-
"Exponential.Out":
|
|
2376
|
-
"Exponential.InOut":
|
|
2377
|
-
"Circular.In":
|
|
2378
|
-
"Circular.Out":
|
|
2379
|
-
"Circular.InOut":
|
|
2380
|
-
"Elastic.In":
|
|
2381
|
-
"Elastic.Out":
|
|
2382
|
-
"Elastic.InOut":
|
|
2383
|
-
"Back.In":
|
|
2384
|
-
"Back.Out":
|
|
2385
|
-
"Back.InOut":
|
|
2386
|
-
"Bounce.In":
|
|
2387
|
-
"Bounce.Out":
|
|
2388
|
-
"Bounce.InOut":
|
|
1513
|
+
const Pn = {
|
|
1514
|
+
"Linear.None": x.Linear.None,
|
|
1515
|
+
"Quadratic.In": x.Quadratic.In,
|
|
1516
|
+
"Quadratic.Out": x.Quadratic.Out,
|
|
1517
|
+
"Quadratic.InOut": x.Quadratic.InOut,
|
|
1518
|
+
"Cubic.In": x.Cubic.In,
|
|
1519
|
+
"Cubic.Out": x.Cubic.Out,
|
|
1520
|
+
"Cubic.InOut": x.Cubic.InOut,
|
|
1521
|
+
"Quartic.In": x.Quartic.In,
|
|
1522
|
+
"Quartic.Out": x.Quartic.Out,
|
|
1523
|
+
"Quartic.InOut": x.Quartic.InOut,
|
|
1524
|
+
"Quintic.In": x.Quintic.In,
|
|
1525
|
+
"Quintic.Out": x.Quintic.Out,
|
|
1526
|
+
"Quintic.InOut": x.Quintic.InOut,
|
|
1527
|
+
"Sinusoidal.In": x.Sinusoidal.In,
|
|
1528
|
+
"Sinusoidal.Out": x.Sinusoidal.Out,
|
|
1529
|
+
"Sinusoidal.InOut": x.Sinusoidal.InOut,
|
|
1530
|
+
"Exponential.In": x.Exponential.In,
|
|
1531
|
+
"Exponential.Out": x.Exponential.Out,
|
|
1532
|
+
"Exponential.InOut": x.Exponential.InOut,
|
|
1533
|
+
"Circular.In": x.Circular.In,
|
|
1534
|
+
"Circular.Out": x.Circular.Out,
|
|
1535
|
+
"Circular.InOut": x.Circular.InOut,
|
|
1536
|
+
"Elastic.In": x.Elastic.In,
|
|
1537
|
+
"Elastic.Out": x.Elastic.Out,
|
|
1538
|
+
"Elastic.InOut": x.Elastic.InOut,
|
|
1539
|
+
"Back.In": x.Back.In,
|
|
1540
|
+
"Back.Out": x.Back.Out,
|
|
1541
|
+
"Back.InOut": x.Back.InOut,
|
|
1542
|
+
"Bounce.In": x.Bounce.In,
|
|
1543
|
+
"Bounce.Out": x.Bounce.Out,
|
|
1544
|
+
"Bounce.InOut": x.Bounce.InOut
|
|
2389
1545
|
};
|
|
2390
|
-
class
|
|
1546
|
+
class ki {
|
|
2391
1547
|
scene;
|
|
2392
1548
|
planes = /* @__PURE__ */ new Map();
|
|
2393
1549
|
helpers = /* @__PURE__ */ new Map();
|
|
@@ -2396,7 +1552,7 @@ class kn {
|
|
|
2396
1552
|
*/
|
|
2397
1553
|
group;
|
|
2398
1554
|
constructor(e) {
|
|
2399
|
-
this.scene = e, this.group = new
|
|
1555
|
+
this.scene = e, this.group = new Es(), this.group.name = "__clippingToolGroup", this.scene.add(this.group);
|
|
2400
1556
|
}
|
|
2401
1557
|
/**
|
|
2402
1558
|
* Move all current scene children (except the clipping group itself) into the ClippingGroup,
|
|
@@ -2435,35 +1591,35 @@ class kn {
|
|
|
2435
1591
|
normal: s = { x: 0, y: -1, z: 0 },
|
|
2436
1592
|
constant: n = 0,
|
|
2437
1593
|
showHelper: i = !1,
|
|
2438
|
-
helperSize:
|
|
1594
|
+
helperSize: a = 5,
|
|
2439
1595
|
helperColor: o = 16711680
|
|
2440
|
-
} = t,
|
|
2441
|
-
return this.planes.set(e,
|
|
1596
|
+
} = t, c = new _s(new C(s.x, s.y, s.z), n);
|
|
1597
|
+
return this.planes.set(e, c), this._syncPlanes(), i && this.showHelper(e, a, o), c;
|
|
2442
1598
|
}
|
|
2443
1599
|
/**
|
|
2444
1600
|
* Add six clipping planes that form a box around a Box3.
|
|
2445
1601
|
* Returns the six plane ids: `${id}_+x`, `${id}_-x`, etc.
|
|
2446
1602
|
*/
|
|
2447
1603
|
addBox(e, t, s = {}) {
|
|
2448
|
-
const { showHelpers: n = !1, helperColor: i = 16711680 } = s,
|
|
1604
|
+
const { showHelpers: n = !1, helperColor: i = 16711680 } = s, a = t.min, o = t.max, c = [
|
|
2449
1605
|
{ suffix: "+x", normal: { x: -1, y: 0, z: 0 }, constant: o.x },
|
|
2450
|
-
{ suffix: "-x", normal: { x: 1, y: 0, z: 0 }, constant: -
|
|
1606
|
+
{ suffix: "-x", normal: { x: 1, y: 0, z: 0 }, constant: -a.x },
|
|
2451
1607
|
{ suffix: "+y", normal: { x: 0, y: -1, z: 0 }, constant: o.y },
|
|
2452
|
-
{ suffix: "-y", normal: { x: 0, y: 1, z: 0 }, constant: -
|
|
1608
|
+
{ suffix: "-y", normal: { x: 0, y: 1, z: 0 }, constant: -a.y },
|
|
2453
1609
|
{ suffix: "+z", normal: { x: 0, y: 0, z: -1 }, constant: o.z },
|
|
2454
|
-
{ suffix: "-z", normal: { x: 0, y: 0, z: 1 }, constant: -
|
|
2455
|
-
],
|
|
2456
|
-
for (const
|
|
2457
|
-
const
|
|
2458
|
-
this.addPlane(
|
|
1610
|
+
{ suffix: "-z", normal: { x: 0, y: 0, z: 1 }, constant: -a.z }
|
|
1611
|
+
], l = [];
|
|
1612
|
+
for (const h of c) {
|
|
1613
|
+
const u = `${e}_${h.suffix}`;
|
|
1614
|
+
this.addPlane(u, { normal: h.normal, constant: h.constant, showHelper: n, helperColor: i }), l.push(u);
|
|
2459
1615
|
}
|
|
2460
|
-
return
|
|
1616
|
+
return l;
|
|
2461
1617
|
}
|
|
2462
1618
|
/**
|
|
2463
1619
|
* Add a clipping box from an object's bounding box with optional padding.
|
|
2464
1620
|
*/
|
|
2465
1621
|
addBoxFromObject(e, t, s = 0, n = {}) {
|
|
2466
|
-
const i = new
|
|
1622
|
+
const i = new $().setFromObject(t);
|
|
2467
1623
|
return i.expandByScalar(s), this.addBox(e, i, n);
|
|
2468
1624
|
}
|
|
2469
1625
|
/**
|
|
@@ -2503,7 +1659,7 @@ class kn {
|
|
|
2503
1659
|
this.hideHelper(e);
|
|
2504
1660
|
const n = this.planes.get(e);
|
|
2505
1661
|
if (!n) return;
|
|
2506
|
-
const i = new
|
|
1662
|
+
const i = new Cs(n, t, new A(s).getHex());
|
|
2507
1663
|
i.name = e, this.helpers.set(e, i), this.scene.add(i);
|
|
2508
1664
|
}
|
|
2509
1665
|
/**
|
|
@@ -2529,7 +1685,7 @@ class kn {
|
|
|
2529
1685
|
this.detach(), this.removeAll(), this.scene.remove(this.group);
|
|
2530
1686
|
}
|
|
2531
1687
|
}
|
|
2532
|
-
class
|
|
1688
|
+
class Ui {
|
|
2533
1689
|
scene;
|
|
2534
1690
|
measurements = /* @__PURE__ */ new Map();
|
|
2535
1691
|
_idCounter = 0;
|
|
@@ -2540,19 +1696,19 @@ class jn {
|
|
|
2540
1696
|
* Measure distance between two points.
|
|
2541
1697
|
*/
|
|
2542
1698
|
measureDistance(e, t, s = {}) {
|
|
2543
|
-
const { lineColor: n = 16776960 } = s, i = new
|
|
2544
|
-
|
|
2545
|
-
const
|
|
2546
|
-
|
|
2547
|
-
const
|
|
2548
|
-
id:
|
|
1699
|
+
const { lineColor: n = 16776960 } = s, i = new C(e.x, e.y, e.z), a = new C(t.x, t.y, t.z), o = i.distanceTo(a), c = `measure_dist_${this._idCounter++}`, l = new H();
|
|
1700
|
+
l.name = c;
|
|
1701
|
+
const h = new Q().setFromPoints([i, a]), u = new me({ color: n }), d = new fe(h, u);
|
|
1702
|
+
l.add(d), this.scene.add(l);
|
|
1703
|
+
const p = {
|
|
1704
|
+
id: c,
|
|
2549
1705
|
type: "distance",
|
|
2550
1706
|
value: o,
|
|
2551
1707
|
unit: "m",
|
|
2552
|
-
points: [i,
|
|
2553
|
-
object:
|
|
1708
|
+
points: [i, a],
|
|
1709
|
+
object: l
|
|
2554
1710
|
};
|
|
2555
|
-
return this.measurements.set(
|
|
1711
|
+
return this.measurements.set(c, p), p;
|
|
2556
1712
|
}
|
|
2557
1713
|
/**
|
|
2558
1714
|
* Measure the area of a polygon defined by 3+ coplanar points.
|
|
@@ -2561,37 +1717,37 @@ class jn {
|
|
|
2561
1717
|
const { lineColor: s = 65280 } = t;
|
|
2562
1718
|
if (e.length < 3)
|
|
2563
1719
|
throw new Error("MeasureTool.measureArea requires at least 3 points");
|
|
2564
|
-
const n = e.map((
|
|
2565
|
-
o.name =
|
|
2566
|
-
const
|
|
2567
|
-
o.add(
|
|
2568
|
-
const
|
|
2569
|
-
id:
|
|
1720
|
+
const n = e.map((p) => new C(p.x, p.y, p.z)), i = this._calculatePolygonArea(n), a = `measure_area_${this._idCounter++}`, o = new H();
|
|
1721
|
+
o.name = a;
|
|
1722
|
+
const c = [...n, n[0]], l = new Q().setFromPoints(c), h = new me({ color: s }), u = new fe(l, h);
|
|
1723
|
+
o.add(u), this.scene.add(o);
|
|
1724
|
+
const d = {
|
|
1725
|
+
id: a,
|
|
2570
1726
|
type: "area",
|
|
2571
1727
|
value: i,
|
|
2572
1728
|
unit: "m²",
|
|
2573
1729
|
points: n,
|
|
2574
1730
|
object: o
|
|
2575
1731
|
};
|
|
2576
|
-
return this.measurements.set(
|
|
1732
|
+
return this.measurements.set(a, d), d;
|
|
2577
1733
|
}
|
|
2578
1734
|
/**
|
|
2579
1735
|
* Measure the angle between three points (vertex at the middle point).
|
|
2580
1736
|
*/
|
|
2581
1737
|
measureAngle(e, t, s, n = {}) {
|
|
2582
|
-
const { lineColor: i = 16746496 } = n,
|
|
2583
|
-
m.name =
|
|
2584
|
-
const
|
|
2585
|
-
m.add(
|
|
2586
|
-
const
|
|
2587
|
-
id:
|
|
1738
|
+
const { lineColor: i = 16746496 } = n, a = new C(e.x, e.y, e.z), o = new C(t.x, t.y, t.z), c = new C(s.x, s.y, s.z), l = a.clone().sub(o).normalize(), h = c.clone().sub(o).normalize(), d = Math.acos(Math.max(-1, Math.min(1, l.dot(h)))) * 180 / Math.PI, p = `measure_angle_${this._idCounter++}`, m = new H();
|
|
1739
|
+
m.name = p;
|
|
1740
|
+
const b = new Q().setFromPoints([a, o, c]), S = new me({ color: i }), w = new fe(b, S);
|
|
1741
|
+
m.add(w), this.scene.add(m);
|
|
1742
|
+
const g = {
|
|
1743
|
+
id: p,
|
|
2588
1744
|
type: "angle",
|
|
2589
|
-
value:
|
|
1745
|
+
value: d,
|
|
2590
1746
|
unit: "°",
|
|
2591
|
-
points: [
|
|
1747
|
+
points: [a, o, c],
|
|
2592
1748
|
object: m
|
|
2593
1749
|
};
|
|
2594
|
-
return this.measurements.set(
|
|
1750
|
+
return this.measurements.set(p, g), g;
|
|
2595
1751
|
}
|
|
2596
1752
|
/**
|
|
2597
1753
|
* Get a measurement result by id.
|
|
@@ -2626,15 +1782,15 @@ class jn {
|
|
|
2626
1782
|
* Calculate polygon area using cross product method (Newell's method).
|
|
2627
1783
|
*/
|
|
2628
1784
|
_calculatePolygonArea(e) {
|
|
2629
|
-
const t = e.length, s = new
|
|
1785
|
+
const t = e.length, s = new C();
|
|
2630
1786
|
for (let i = 0; i < t; i++) {
|
|
2631
|
-
const
|
|
2632
|
-
s.add(
|
|
1787
|
+
const a = e[i], o = e[(i + 1) % t], c = new C().crossVectors(a, o);
|
|
1788
|
+
s.add(c);
|
|
2633
1789
|
}
|
|
2634
|
-
const n = new
|
|
1790
|
+
const n = new C();
|
|
2635
1791
|
if (t >= 3) {
|
|
2636
|
-
const i = e[1].clone().sub(e[0]),
|
|
2637
|
-
n.crossVectors(i,
|
|
1792
|
+
const i = e[1].clone().sub(e[0]), a = e[2].clone().sub(e[0]);
|
|
1793
|
+
n.crossVectors(i, a).normalize();
|
|
2638
1794
|
}
|
|
2639
1795
|
return Math.abs(s.dot(n)) / 2;
|
|
2640
1796
|
}
|
|
@@ -2642,7 +1798,7 @@ class jn {
|
|
|
2642
1798
|
this.removeAll();
|
|
2643
1799
|
}
|
|
2644
1800
|
}
|
|
2645
|
-
class
|
|
1801
|
+
class Wi {
|
|
2646
1802
|
scene;
|
|
2647
1803
|
annotations = /* @__PURE__ */ new Map();
|
|
2648
1804
|
_idCounter = 0;
|
|
@@ -2662,9 +1818,9 @@ class Un {
|
|
|
2662
1818
|
*/
|
|
2663
1819
|
add(e, t) {
|
|
2664
1820
|
this.annotations.has(e) && this.remove(e);
|
|
2665
|
-
const s = new
|
|
1821
|
+
const s = new H();
|
|
2666
1822
|
s.name = `annotation_${e}`;
|
|
2667
|
-
const n = new
|
|
1823
|
+
const n = new C(t.position.x, t.position.y, t.position.z);
|
|
2668
1824
|
s.position.copy(n);
|
|
2669
1825
|
const i = document.createElement("div");
|
|
2670
1826
|
if (i.innerHTML = t.content, i.style.cssText = `
|
|
@@ -2676,32 +1832,32 @@ class Un {
|
|
|
2676
1832
|
pointer-events: auto;
|
|
2677
1833
|
white-space: nowrap;
|
|
2678
1834
|
`, t.labelStyle)
|
|
2679
|
-
for (const
|
|
2680
|
-
const
|
|
2681
|
-
|
|
1835
|
+
for (const l of Object.keys(t.labelStyle)) {
|
|
1836
|
+
const h = t.labelStyle[l];
|
|
1837
|
+
h !== void 0 && (i.style[l] = h);
|
|
2682
1838
|
}
|
|
2683
|
-
let
|
|
1839
|
+
let a = null;
|
|
2684
1840
|
const o = t.labelOffset || { x: 0, y: 2, z: 0 };
|
|
2685
1841
|
if (t.showLeaderLine !== !1) {
|
|
2686
|
-
const { lineColor:
|
|
2687
|
-
new
|
|
2688
|
-
new
|
|
2689
|
-
]),
|
|
2690
|
-
|
|
1842
|
+
const { lineColor: l = 16777215 } = t, h = new Q().setFromPoints([
|
|
1843
|
+
new C(0, 0, 0),
|
|
1844
|
+
new C(o.x, o.y, o.z)
|
|
1845
|
+
]), u = new me({ color: l });
|
|
1846
|
+
a = new fe(h, u), s.add(a);
|
|
2691
1847
|
}
|
|
2692
1848
|
if (this._createCSSObject) {
|
|
2693
|
-
const
|
|
2694
|
-
|
|
1849
|
+
const l = this._createCSSObject(i);
|
|
1850
|
+
l.position.set(o.x, o.y, o.z), s.add(l);
|
|
2695
1851
|
}
|
|
2696
1852
|
this.scene.add(s);
|
|
2697
|
-
const
|
|
1853
|
+
const c = {
|
|
2698
1854
|
id: e,
|
|
2699
1855
|
options: t,
|
|
2700
1856
|
group: s,
|
|
2701
1857
|
labelElement: i,
|
|
2702
|
-
line:
|
|
1858
|
+
line: a
|
|
2703
1859
|
};
|
|
2704
|
-
return this.annotations.set(e,
|
|
1860
|
+
return this.annotations.set(e, c), c;
|
|
2705
1861
|
}
|
|
2706
1862
|
/**
|
|
2707
1863
|
* Quick-add a text annotation.
|
|
@@ -2795,47 +1951,1109 @@ class Un {
|
|
|
2795
1951
|
this.removeAll();
|
|
2796
1952
|
}
|
|
2797
1953
|
}
|
|
2798
|
-
const
|
|
2799
|
-
|
|
1954
|
+
const nt = new L(), Nn = 1e-6, zn = 1e-6, it = "uSpaceInstanceOriginalMaterialState", rt = 0, Ee = 1, Dn = 2;
|
|
1955
|
+
function Rn(r) {
|
|
1956
|
+
let e = r;
|
|
1957
|
+
for (; e; ) {
|
|
1958
|
+
if (!e.visible) return !1;
|
|
1959
|
+
e = e.parent;
|
|
1960
|
+
}
|
|
1961
|
+
return !0;
|
|
1962
|
+
}
|
|
1963
|
+
function jn(r, e) {
|
|
1964
|
+
const t = r.elements, s = e.elements;
|
|
1965
|
+
for (let n = 0; n < 16; n++)
|
|
1966
|
+
if (Math.abs(t[n] - s[n]) > Nn) return !1;
|
|
1967
|
+
return !0;
|
|
1968
|
+
}
|
|
1969
|
+
function Ft(r) {
|
|
1970
|
+
const e = r.material;
|
|
1971
|
+
return Array.isArray(e) ? e : [e];
|
|
1972
|
+
}
|
|
1973
|
+
function Gt(r) {
|
|
1974
|
+
const e = r.userData, t = e[it];
|
|
1975
|
+
if (t) return t;
|
|
1976
|
+
const s = {
|
|
1977
|
+
transparent: r.transparent,
|
|
1978
|
+
opacity: r.opacity
|
|
1979
|
+
};
|
|
1980
|
+
return e[it] = s, s;
|
|
1981
|
+
}
|
|
1982
|
+
function kn(r, e) {
|
|
1983
|
+
r.traverse((t) => {
|
|
1984
|
+
const s = t;
|
|
1985
|
+
s.isMesh && Ft(s).forEach((n) => {
|
|
1986
|
+
if (!n) return;
|
|
1987
|
+
const i = n, a = Gt(i), o = a.opacity * e;
|
|
1988
|
+
i.transparent = a.transparent || o < 1, i.opacity = o, i.needsUpdate = !0;
|
|
1989
|
+
});
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1992
|
+
function Un(r) {
|
|
1993
|
+
r.traverse((e) => {
|
|
1994
|
+
const t = e;
|
|
1995
|
+
t.isMesh && Ft(t).forEach((s) => {
|
|
1996
|
+
if (!s) return;
|
|
1997
|
+
const n = s, i = Gt(n);
|
|
1998
|
+
n.transparent = i.transparent, n.opacity = i.opacity, n.needsUpdate = !0;
|
|
1999
|
+
});
|
|
2000
|
+
});
|
|
2001
|
+
}
|
|
2002
|
+
class Hi extends ue {
|
|
2003
|
+
isInstanceObject = !0;
|
|
2004
|
+
type = "InstanceObject";
|
|
2005
|
+
instanceId = "";
|
|
2006
|
+
instanceKind = "";
|
|
2007
|
+
instanceName = "";
|
|
2008
|
+
geometry = new Q();
|
|
2009
|
+
boundingBox = null;
|
|
2010
|
+
boundingSphere = null;
|
|
2011
|
+
#t = {
|
|
2012
|
+
color: null,
|
|
2013
|
+
colorMode: rt,
|
|
2014
|
+
opacity: 1
|
|
2015
|
+
};
|
|
2016
|
+
#a = null;
|
|
2017
|
+
#s = null;
|
|
2018
|
+
#e = null;
|
|
2019
|
+
#n = null;
|
|
2020
|
+
#i = /* @__PURE__ */ new Set();
|
|
2021
|
+
#o = new L();
|
|
2022
|
+
#c = !1;
|
|
2023
|
+
#l = !0;
|
|
2024
|
+
#h = !1;
|
|
2025
|
+
#d;
|
|
2026
|
+
constructor(e = {}) {
|
|
2027
|
+
super(), this.#d = e.boundsName ?? "InstanceBounds";
|
|
2028
|
+
}
|
|
2029
|
+
setInstanceIdentity(e) {
|
|
2030
|
+
let t = !1;
|
|
2031
|
+
if (e.id !== void 0) {
|
|
2032
|
+
const s = e.id ?? "";
|
|
2033
|
+
this.instanceId !== s && (this.instanceId = s, t = !0);
|
|
2034
|
+
}
|
|
2035
|
+
if (e.kind !== void 0) {
|
|
2036
|
+
const s = e.kind ?? "";
|
|
2037
|
+
this.instanceKind !== s && (this.instanceKind = s, t = !0);
|
|
2038
|
+
}
|
|
2039
|
+
if (e.name !== void 0) {
|
|
2040
|
+
const s = e.name ?? "";
|
|
2041
|
+
this.instanceName !== s && (this.instanceName = s, t = !0);
|
|
2042
|
+
}
|
|
2043
|
+
return t && this.markInstanceRenderDirty(), this;
|
|
2044
|
+
}
|
|
2045
|
+
setInstanceBounds(e) {
|
|
2046
|
+
if (e.isEmpty()) return this;
|
|
2047
|
+
this.#s && this.remove(this.#s);
|
|
2048
|
+
const t = new Q();
|
|
2049
|
+
t.boundingBox = e.clone();
|
|
2050
|
+
const s = new Os();
|
|
2051
|
+
return s.name = this.#d, s.visible = !1, s.geometry = t, s.raycast = () => {
|
|
2052
|
+
}, this.#s = s, this.add(s), this.#p(), this.markInstanceRenderDirty(), this;
|
|
2053
|
+
}
|
|
2054
|
+
setInstanceRenderObject(e) {
|
|
2055
|
+
return this.#e && this.#e !== e && this.#e.parent === this && this.remove(this.#e), this.#e = e, e && e.parent !== this && this.add(e), this.#u(), this.#p(), this.markInstanceRenderDirty(), this;
|
|
2056
|
+
}
|
|
2057
|
+
getInstanceRenderObject() {
|
|
2058
|
+
return this.#e;
|
|
2059
|
+
}
|
|
2060
|
+
setInstanceMaterializer(e) {
|
|
2061
|
+
return this.#n = e, this;
|
|
2062
|
+
}
|
|
2063
|
+
hasInstanceMaterializer(e) {
|
|
2064
|
+
return this.#n === e;
|
|
2065
|
+
}
|
|
2066
|
+
clearInstanceMaterializer(e) {
|
|
2067
|
+
return (e === void 0 || this.#n === e) && (this.#n = null), this;
|
|
2068
|
+
}
|
|
2069
|
+
materialize() {
|
|
2070
|
+
return this.#n?.() ?? this.#e ?? null;
|
|
2071
|
+
}
|
|
2072
|
+
computeBoundingBox() {
|
|
2073
|
+
this.boundingBox === null && (this.boundingBox = new $()), this.getInstanceBoundingBox(this.boundingBox, !1);
|
|
2074
|
+
}
|
|
2075
|
+
computeBoundingSphere() {
|
|
2076
|
+
if (this.boundingSphere === null && (this.boundingSphere = new ne()), this.boundingBox === null && this.computeBoundingBox(), !this.boundingBox || this.boundingBox.isEmpty()) {
|
|
2077
|
+
this.boundingSphere.makeEmpty();
|
|
2078
|
+
return;
|
|
2079
|
+
}
|
|
2080
|
+
this.boundingBox.getBoundingSphere(this.boundingSphere);
|
|
2081
|
+
}
|
|
2082
|
+
getInstanceBoundingBox(e = new $(), t = !1) {
|
|
2083
|
+
const s = this.#s?.geometry?.boundingBox;
|
|
2084
|
+
return s ? (e.copy(s), t && (this.updateWorldMatrix(!0, !1), e.applyMatrix4(this.matrixWorld)), e) : this.#e ? (e.setFromObject(this.#e), t || (this.updateWorldMatrix(!0, !1), nt.copy(this.matrixWorld).invert(), e.applyMatrix4(nt)), e) : e.makeEmpty();
|
|
2085
|
+
}
|
|
2086
|
+
setInstanceVisible(e) {
|
|
2087
|
+
return this.visible === e ? this : (this.visible = e, this.markInstanceRenderDirty(), this);
|
|
2088
|
+
}
|
|
2089
|
+
setInstanceColor(e) {
|
|
2090
|
+
return this.#t.color = new A(e), this.#t.colorMode = Ee, this.#u(), this.markInstanceRenderDirty(), this;
|
|
2091
|
+
}
|
|
2092
|
+
resetInstanceColor() {
|
|
2093
|
+
return this.#t.color === null ? this : (this.#t.color = null, this.#t.colorMode = rt, this.#u(), this.markInstanceRenderDirty(), this);
|
|
2094
|
+
}
|
|
2095
|
+
setInstanceOpacity(e) {
|
|
2096
|
+
const t = Math.max(0, Math.min(1, e));
|
|
2097
|
+
return Math.abs(this.#t.opacity - t) <= zn ? this : (this.#t.opacity = t, this.#u(), this.markInstanceRenderDirty(), this);
|
|
2098
|
+
}
|
|
2099
|
+
getInstanceColor(e = new A()) {
|
|
2100
|
+
const t = this.#m();
|
|
2101
|
+
return t.color ? e.copy(t.color) : e.setRGB(1, 1, 1);
|
|
2102
|
+
}
|
|
2103
|
+
hasInstanceColor() {
|
|
2104
|
+
return this.#m().color !== null;
|
|
2105
|
+
}
|
|
2106
|
+
getInstanceOpacity() {
|
|
2107
|
+
return this.#m().opacity;
|
|
2108
|
+
}
|
|
2109
|
+
setInstanceHighlight(e, t, s = !1) {
|
|
2110
|
+
return this.#a = {
|
|
2111
|
+
color: new A(e),
|
|
2112
|
+
colorMode: s ? Ee : Dn,
|
|
2113
|
+
opacity: Math.max(0, Math.min(1, t))
|
|
2114
|
+
}, this.#u(), this.markInstanceRenderDirty(), this;
|
|
2115
|
+
}
|
|
2116
|
+
clearInstanceHighlight() {
|
|
2117
|
+
return this.#a === null ? this : (this.#a = null, this.#u(), this.markInstanceRenderDirty(), this);
|
|
2118
|
+
}
|
|
2119
|
+
getInstanceColorMode() {
|
|
2120
|
+
return this.#m().colorMode;
|
|
2121
|
+
}
|
|
2122
|
+
onInstanceRenderDirty(e) {
|
|
2123
|
+
return this.#i.add(e), () => this.#i.delete(e);
|
|
2124
|
+
}
|
|
2125
|
+
markInstanceRenderDirty() {
|
|
2126
|
+
return this.#i.forEach((e) => e()), this;
|
|
2127
|
+
}
|
|
2128
|
+
updateMatrixWorld(e) {
|
|
2129
|
+
super.updateMatrixWorld(e), this.#r();
|
|
2130
|
+
}
|
|
2131
|
+
updateWorldMatrix(e, t) {
|
|
2132
|
+
super.updateWorldMatrix(e, t), this.#r();
|
|
2133
|
+
}
|
|
2134
|
+
#r() {
|
|
2135
|
+
const e = Rn(this);
|
|
2136
|
+
(!this.#c || !jn(this.matrixWorld, this.#o) || !this.#h || e !== this.#l) && (this.#c = !0, this.#h = !0, this.#o.copy(this.matrixWorld), this.#l = e, this.markInstanceRenderDirty());
|
|
2137
|
+
}
|
|
2138
|
+
#p() {
|
|
2139
|
+
this.boundingBox = null, this.boundingSphere = null;
|
|
2140
|
+
}
|
|
2141
|
+
#m() {
|
|
2142
|
+
return this.#a ?? this.#t;
|
|
2143
|
+
}
|
|
2144
|
+
#u() {
|
|
2145
|
+
if (!this.#e) return;
|
|
2146
|
+
const e = this.#m();
|
|
2147
|
+
if (e.color) {
|
|
2148
|
+
Un(this.#e), se.highlightColor(this.#e, {
|
|
2149
|
+
color: e.color,
|
|
2150
|
+
opacity: e.opacity,
|
|
2151
|
+
overwrite: e.colorMode === Ee,
|
|
2152
|
+
multiplyOpacity: !0
|
|
2153
|
+
});
|
|
2154
|
+
return;
|
|
2155
|
+
}
|
|
2156
|
+
se.removeHighlightColor(this.#e), kn(this.#e, e.opacity);
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
function Fi(r) {
|
|
2160
|
+
return r.isInstanceObject === !0;
|
|
2161
|
+
}
|
|
2162
|
+
const Wn = /* @__PURE__ */ new Set([
|
|
2163
|
+
"MeshBasicMaterial",
|
|
2164
|
+
"MeshLambertMaterial",
|
|
2165
|
+
"MeshPhongMaterial",
|
|
2166
|
+
"MeshStandardMaterial",
|
|
2167
|
+
"MeshPhysicalMaterial"
|
|
2168
|
+
]), at = /* @__PURE__ */ new WeakMap();
|
|
2169
|
+
let Hn = 1;
|
|
2170
|
+
const ot = new L(), ce = new L(), ct = new L();
|
|
2171
|
+
function Fn(r, e, t = 1e-6) {
|
|
2172
|
+
const s = r.elements, n = e.elements;
|
|
2173
|
+
for (let i = 0; i < 16; i++)
|
|
2174
|
+
if (Math.abs(s[i] - n[i]) > t) return !1;
|
|
2175
|
+
return !0;
|
|
2176
|
+
}
|
|
2177
|
+
function $t(r) {
|
|
2178
|
+
let e = r;
|
|
2179
|
+
for (; e; ) {
|
|
2180
|
+
if (!e.visible) return !1;
|
|
2181
|
+
e = e.parent;
|
|
2182
|
+
}
|
|
2183
|
+
return !0;
|
|
2184
|
+
}
|
|
2185
|
+
function Gn(r) {
|
|
2186
|
+
const e = r.source.data;
|
|
2187
|
+
if (!e || typeof e != "object" && typeof e != "function")
|
|
2188
|
+
return `texture:${r.uuid}`;
|
|
2189
|
+
let t = at.get(e);
|
|
2190
|
+
return t === void 0 && (t = Hn++, at.set(e, t)), `source:${t}`;
|
|
2191
|
+
}
|
|
2192
|
+
function $n(r) {
|
|
2193
|
+
return JSON.stringify([
|
|
2194
|
+
Gn(r),
|
|
2195
|
+
r.mapping,
|
|
2196
|
+
r.channel,
|
|
2197
|
+
r.wrapS,
|
|
2198
|
+
r.wrapT,
|
|
2199
|
+
r.magFilter,
|
|
2200
|
+
r.minFilter,
|
|
2201
|
+
r.anisotropy,
|
|
2202
|
+
r.format,
|
|
2203
|
+
r.internalFormat,
|
|
2204
|
+
r.type,
|
|
2205
|
+
r.offset.toArray(),
|
|
2206
|
+
r.repeat.toArray(),
|
|
2207
|
+
r.center.toArray(),
|
|
2208
|
+
r.rotation,
|
|
2209
|
+
r.matrixAutoUpdate,
|
|
2210
|
+
r.matrix.toArray(),
|
|
2211
|
+
r.generateMipmaps,
|
|
2212
|
+
r.premultiplyAlpha,
|
|
2213
|
+
r.flipY,
|
|
2214
|
+
r.unpackAlignment,
|
|
2215
|
+
r.colorSpace,
|
|
2216
|
+
"compareFunction" in r ? r.compareFunction : null
|
|
2217
|
+
]);
|
|
2218
|
+
}
|
|
2219
|
+
function Ae(r) {
|
|
2220
|
+
if (Array.isArray(r)) return r.map(Ae);
|
|
2221
|
+
if (!r || typeof r != "object") return r;
|
|
2222
|
+
const e = r;
|
|
2223
|
+
return Object.fromEntries(
|
|
2224
|
+
Object.keys(e).sort().map((t) => [t, Ae(e[t])])
|
|
2225
|
+
);
|
|
2226
|
+
}
|
|
2227
|
+
function Te(r, e) {
|
|
2228
|
+
if (Array.isArray(r)) return r.map((s) => Te(s, e));
|
|
2229
|
+
if (!r || typeof r != "object")
|
|
2230
|
+
return typeof r == "string" ? e.get(r) ?? r : r;
|
|
2231
|
+
const t = r;
|
|
2232
|
+
return Object.fromEntries(
|
|
2233
|
+
Object.keys(t).filter((s) => s !== "metadata" && s !== "uuid" && s !== "name").sort().map((s) => [s, Te(t[s], e)])
|
|
2234
|
+
);
|
|
2235
|
+
}
|
|
2236
|
+
function Kn(r) {
|
|
2237
|
+
if (!Wn.has(r.type) || r.transparent || r.opacity < 0.999 || r.visible === !1) return null;
|
|
2238
|
+
const e = r;
|
|
2239
|
+
if (Object.keys(e).some((i) => i.endsWith("Node") && e[i] != null) || Object.hasOwn(r, "onBeforeCompile")) return null;
|
|
2240
|
+
const t = /* @__PURE__ */ new Map();
|
|
2241
|
+
Object.values(e).forEach((i) => {
|
|
2242
|
+
i instanceof zs && t.set(i.uuid, $n(i));
|
|
2243
|
+
});
|
|
2244
|
+
const s = {
|
|
2245
|
+
geometries: {},
|
|
2246
|
+
materials: {},
|
|
2247
|
+
textures: {},
|
|
2248
|
+
images: {},
|
|
2249
|
+
shapes: {},
|
|
2250
|
+
skeletons: {},
|
|
2251
|
+
animations: {},
|
|
2252
|
+
nodes: {}
|
|
2253
|
+
}, n = r.toJSON(s);
|
|
2254
|
+
return JSON.stringify(Ae(Te(n, t)));
|
|
2255
|
+
}
|
|
2256
|
+
function Xn(r) {
|
|
2257
|
+
if (Object.keys(r.morphAttributes).length > 0 || r.drawRange.start !== 0 || r.drawRange.count !== 1 / 0) return null;
|
|
2258
|
+
const e = Object.entries(r.attributes).sort(([t], [s]) => t.localeCompare(s)).map(([t, s]) => "isInterleavedBufferAttribute" in s ? null : [t, s.itemSize, s.normalized, s.array.constructor.name, s.gpuType]);
|
|
2259
|
+
return e.some((t) => t === null) ? null : JSON.stringify([
|
|
2260
|
+
r.index?.array.constructor.name ?? "non-indexed",
|
|
2261
|
+
e
|
|
2262
|
+
]);
|
|
2263
|
+
}
|
|
2264
|
+
function Qn(r, e) {
|
|
2265
|
+
const t = [], s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), i = !e && (r.animations.length > 0 || r.mixer !== null);
|
|
2266
|
+
return i && n.add("animation"), r.updateWorldMatrix(!0, !0), ot.copy(r.matrixWorld).invert(), r.traverseVisible((a) => {
|
|
2267
|
+
if (!(a instanceof P)) return;
|
|
2268
|
+
if (i) {
|
|
2269
|
+
s.add(a);
|
|
2270
|
+
return;
|
|
2271
|
+
}
|
|
2272
|
+
if (a instanceof Ts) {
|
|
2273
|
+
s.add(a), n.add("skinned");
|
|
2274
|
+
return;
|
|
2275
|
+
}
|
|
2276
|
+
if (a.morphTargetInfluences) {
|
|
2277
|
+
s.add(a), n.add("morph");
|
|
2278
|
+
return;
|
|
2279
|
+
}
|
|
2280
|
+
if (Array.isArray(a.material)) {
|
|
2281
|
+
s.add(a), n.add("material-array");
|
|
2282
|
+
return;
|
|
2283
|
+
}
|
|
2284
|
+
const o = Kn(a.material), c = Xn(a.geometry);
|
|
2285
|
+
if (!o) {
|
|
2286
|
+
s.add(a), n.add(a.material.transparent || a.material.opacity < 0.999 ? "transparent" : `material:${a.material.type}`);
|
|
2287
|
+
return;
|
|
2288
|
+
}
|
|
2289
|
+
if (!c) {
|
|
2290
|
+
s.add(a), n.add("geometry-layout");
|
|
2291
|
+
return;
|
|
2292
|
+
}
|
|
2293
|
+
if (a.matrixWorld.determinant() <= 0) {
|
|
2294
|
+
s.add(a), n.add("negative-scale");
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
t.push({
|
|
2298
|
+
mesh: a,
|
|
2299
|
+
localMatrix: ot.clone().multiply(a.matrixWorld),
|
|
2300
|
+
materialKey: o,
|
|
2301
|
+
geometryKey: c
|
|
2302
|
+
});
|
|
2303
|
+
}), t.length === 0 && s.size === 0 && n.add("empty"), {
|
|
2304
|
+
meshes: t,
|
|
2305
|
+
fallbackMeshes: s,
|
|
2306
|
+
fallbackReasons: n
|
|
2307
|
+
};
|
|
2308
|
+
}
|
|
2309
|
+
function qn(r, e) {
|
|
2310
|
+
const t = Le(r), s = [], n = [];
|
|
2311
|
+
return r.traverse((i) => {
|
|
2312
|
+
i instanceof P && s.push(i);
|
|
2313
|
+
}), t.traverse((i) => {
|
|
2314
|
+
i instanceof P && n.push(i);
|
|
2315
|
+
}), s.forEach((i, a) => {
|
|
2316
|
+
e.has(i) && n[a] && (n[a].visible = !1);
|
|
2317
|
+
}), t;
|
|
2318
|
+
}
|
|
2319
|
+
function Yn(r) {
|
|
2320
|
+
const e = Le(r), t = /* @__PURE__ */ new Map(), s = (n) => {
|
|
2321
|
+
let i = t.get(n);
|
|
2322
|
+
return i || (i = n.clone(), t.set(n, i)), i;
|
|
2323
|
+
};
|
|
2324
|
+
return e.traverse((n) => {
|
|
2325
|
+
n instanceof P && (n.material = Array.isArray(n.material) ? n.material.map(s) : s(n.material));
|
|
2326
|
+
}), e;
|
|
2327
|
+
}
|
|
2328
|
+
function Vn(r) {
|
|
2329
|
+
return Math.max(1, Math.ceil(Math.sqrt(Math.max(1, r))));
|
|
2330
|
+
}
|
|
2331
|
+
function Jn(r) {
|
|
2332
|
+
const e = new Ls(new Float32Array(r * r * 4), r, r, Ps, Ns);
|
|
2333
|
+
return e.magFilter = Ue, e.minFilter = Ue, e.generateMipmaps = !1, e.needsUpdate = !0, e;
|
|
2334
|
+
}
|
|
2335
|
+
function Zn(r, e) {
|
|
2336
|
+
const t = r.clone(), s = Qs("batchObjectIndex", "float").toInt(), n = $e(qs(Ke(e), $e(0)).x).toConst(), i = s.mod(n).toConst(), a = s.div(n).toConst(), o = Ke(e, Ys(i, a)), c = t.colorNode ?? xe, l = F(o.a.greaterThan(1.5), c.mul(o.rgb), o.rgb);
|
|
2337
|
+
return t.colorNode = F(o.a.greaterThan(0.5), l, c), t.maskNode = o.a.greaterThan(-0.5), t.needsUpdate = !0, t;
|
|
2338
|
+
}
|
|
2339
|
+
function lt(r) {
|
|
2340
|
+
let e = 0, t = r.parent;
|
|
2341
|
+
for (; t; )
|
|
2342
|
+
e++, t = t.parent;
|
|
2343
|
+
return e;
|
|
2344
|
+
}
|
|
2345
|
+
class ei extends q {
|
|
2346
|
+
objectIndices;
|
|
2347
|
+
states;
|
|
2348
|
+
#t;
|
|
2349
|
+
constructor(e, t, s, n) {
|
|
2350
|
+
super(e, t), this.objectIndices = s, this.states = n, this.userData.editableGeometryBatch = !0;
|
|
2351
|
+
}
|
|
2352
|
+
raycast(e, t) {
|
|
2353
|
+
if (this.visible === !1 && this.ignoreInvisibleWhenRaycast === !0)
|
|
2354
|
+
return !1;
|
|
2355
|
+
this.#t === void 0 && (this.#t = Et(this.geometry));
|
|
2356
|
+
const s = [];
|
|
2357
|
+
this.#t ? this.#t.raycastObject3D(this, e, s) : super.raycast(e, s), s.forEach((n) => {
|
|
2358
|
+
const i = n.faceIndex;
|
|
2359
|
+
if (i == null) return;
|
|
2360
|
+
const a = i * 3, o = this.geometry.index?.getX(a) ?? a, c = this.objectIndices[o], l = c === void 0 ? void 0 : this.states[c], h = l?.instance;
|
|
2361
|
+
!l || l.materialized || !h || !$t(h) || h.getInstanceOpacity() <= 1e-3 || (n.object = h, n.batchObjectIndex = c, t.push(n));
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
class Gi extends ue {
|
|
2366
|
+
isEditableGeometryBatchLayer = !0;
|
|
2367
|
+
type = "EditableGeometryBatchLayer";
|
|
2368
|
+
options;
|
|
2369
|
+
stats = {
|
|
2370
|
+
instances: 0,
|
|
2371
|
+
sourceMeshes: 0,
|
|
2372
|
+
batches: 0,
|
|
2373
|
+
drawCallsSaved: 0,
|
|
2374
|
+
vertices: 0,
|
|
2375
|
+
indices: 0,
|
|
2376
|
+
unsupportedInstances: 0,
|
|
2377
|
+
unsupportedByReason: {}
|
|
2378
|
+
};
|
|
2379
|
+
#t = [];
|
|
2380
|
+
#a = /* @__PURE__ */ new Set();
|
|
2381
|
+
#s = [];
|
|
2382
|
+
#e = /* @__PURE__ */ new Map();
|
|
2383
|
+
#n = /* @__PURE__ */ new Set();
|
|
2384
|
+
#i = null;
|
|
2385
|
+
#o = new L();
|
|
2386
|
+
#c = !1;
|
|
2387
|
+
#l = !1;
|
|
2388
|
+
#h = !1;
|
|
2389
|
+
constructor(e = {}) {
|
|
2390
|
+
super(), this.name = "EditableGeometryBatches", this.options = {
|
|
2391
|
+
maxVerticesPerBatch: e.maxVerticesPerBatch ?? 15e5,
|
|
2392
|
+
maxIndicesPerBatch: e.maxIndicesPerBatch ?? 45e5,
|
|
2393
|
+
freezeAnimations: e.freezeAnimations ?? !1
|
|
2394
|
+
};
|
|
2395
|
+
}
|
|
2396
|
+
addSource(e) {
|
|
2397
|
+
if (this.#l) throw new Error("EditableGeometryBatchLayer has been disposed.");
|
|
2398
|
+
if (this.#c) throw new Error("EditableGeometryBatchLayer has already been built.");
|
|
2399
|
+
const { key: t, template: s, instances: n } = e, i = /* @__PURE__ */ new Set();
|
|
2400
|
+
n.forEach((l) => {
|
|
2401
|
+
if (i.has(l) || this.#a.has(l))
|
|
2402
|
+
throw new Error(
|
|
2403
|
+
"EditableGeometryBatchLayer cannot batch the same InstanceObject more than once."
|
|
2404
|
+
);
|
|
2405
|
+
i.add(l);
|
|
2406
|
+
});
|
|
2407
|
+
const { meshes: a, fallbackMeshes: o, fallbackReasons: c } = Qn(
|
|
2408
|
+
s,
|
|
2409
|
+
this.options.freezeAnimations
|
|
2410
|
+
);
|
|
2411
|
+
return i.forEach((l) => this.#a.add(l)), this.#t.push({
|
|
2412
|
+
key: t,
|
|
2413
|
+
template: s,
|
|
2414
|
+
instances: [...n],
|
|
2415
|
+
meshes: a,
|
|
2416
|
+
fallbackMeshes: o,
|
|
2417
|
+
fallbackReasons: c,
|
|
2418
|
+
bounds: new $().setFromObject(s)
|
|
2419
|
+
}), a.length > 0;
|
|
2420
|
+
}
|
|
2421
|
+
build() {
|
|
2422
|
+
if (this.#l) throw new Error("EditableGeometryBatchLayer has been disposed.");
|
|
2423
|
+
if (this.#c) throw new Error("EditableGeometryBatchLayer.build() can only be called once.");
|
|
2424
|
+
this.#c = !0, this.updateWorldMatrix(!0, !1), this.#o.copy(this.matrixWorld).invert();
|
|
2425
|
+
const e = [], t = /* @__PURE__ */ new Map(), s = (i, a, o, c) => {
|
|
2426
|
+
if (o.length === 0) return;
|
|
2427
|
+
const l = c.size > 0 ? [...c] : ["unknown"];
|
|
2428
|
+
e.push({ key: i.key, template: a, instances: o, reasons: l }), l.forEach((h) => {
|
|
2429
|
+
this.stats.unsupportedByReason[h] = (this.stats.unsupportedByReason[h] ?? 0) + o.length;
|
|
2430
|
+
});
|
|
2431
|
+
};
|
|
2432
|
+
this.#t.forEach((i) => {
|
|
2433
|
+
const a = [], o = [];
|
|
2434
|
+
i.instances.forEach((l) => {
|
|
2435
|
+
l.updateWorldMatrix(!0, !1), ce.multiplyMatrices(this.#o, l.matrixWorld), ce.determinant() <= 0 ? o.push(l) : a.push({ instance: l, matrix: ce.clone() });
|
|
2436
|
+
});
|
|
2437
|
+
const c = i.fallbackReasons.size > 0 ? i.fallbackReasons : /* @__PURE__ */ new Set(["unknown"]);
|
|
2438
|
+
if (i.meshes.length === 0) {
|
|
2439
|
+
s(
|
|
2440
|
+
i,
|
|
2441
|
+
i.template,
|
|
2442
|
+
a.map(({ instance: l }) => l),
|
|
2443
|
+
c
|
|
2444
|
+
), s(
|
|
2445
|
+
i,
|
|
2446
|
+
i.template,
|
|
2447
|
+
o,
|
|
2448
|
+
/* @__PURE__ */ new Set([...c, "negative-scale"])
|
|
2449
|
+
);
|
|
2450
|
+
return;
|
|
2451
|
+
}
|
|
2452
|
+
i.fallbackMeshes.size > 0 && s(
|
|
2453
|
+
i,
|
|
2454
|
+
qn(
|
|
2455
|
+
i.template,
|
|
2456
|
+
new Set(i.meshes.map(({ mesh: l }) => l))
|
|
2457
|
+
),
|
|
2458
|
+
a.map(({ instance: l }) => l),
|
|
2459
|
+
c
|
|
2460
|
+
), s(
|
|
2461
|
+
i,
|
|
2462
|
+
i.template,
|
|
2463
|
+
o,
|
|
2464
|
+
/* @__PURE__ */ new Set([...i.fallbackReasons, "negative-scale"])
|
|
2465
|
+
), a.forEach(({ instance: l, matrix: h }) => {
|
|
2466
|
+
const u = this.#s.length, d = () => this.materialize(l), p = {
|
|
2467
|
+
instance: l,
|
|
2468
|
+
template: i.template,
|
|
2469
|
+
initialMatrix: h,
|
|
2470
|
+
objectIndex: u,
|
|
2471
|
+
materialized: !1,
|
|
2472
|
+
materializer: d,
|
|
2473
|
+
unsubscribe: () => {
|
|
2474
|
+
}
|
|
2475
|
+
};
|
|
2476
|
+
p.unsubscribe = l.onInstanceRenderDirty(() => this.#p(p)), this.#s.push(p), this.#e.set(l, p), l.setInstanceBounds(i.bounds), l.setInstanceMaterializer(d), this.#n.add(p), i.meshes.forEach(({ mesh: m, localMatrix: b, materialKey: S, geometryKey: w }) => {
|
|
2477
|
+
ct.multiplyMatrices(h, b);
|
|
2478
|
+
const g = m.geometry.clone().applyMatrix4(ct), I = g.getAttribute("position");
|
|
2479
|
+
g.setAttribute(
|
|
2480
|
+
"batchObjectIndex",
|
|
2481
|
+
new As(new Float32Array(I.count).fill(u), 1)
|
|
2482
|
+
);
|
|
2483
|
+
const B = JSON.stringify([
|
|
2484
|
+
S,
|
|
2485
|
+
w,
|
|
2486
|
+
m.castShadow,
|
|
2487
|
+
m.receiveShadow,
|
|
2488
|
+
m.renderOrder
|
|
2489
|
+
]), O = t.get(B), T = {
|
|
2490
|
+
geometry: g,
|
|
2491
|
+
material: m.material,
|
|
2492
|
+
castShadow: m.castShadow,
|
|
2493
|
+
receiveShadow: m.receiveShadow,
|
|
2494
|
+
renderOrder: m.renderOrder,
|
|
2495
|
+
objectIndices: new Array(I.count).fill(u)
|
|
2496
|
+
};
|
|
2497
|
+
O ? O.push(T) : t.set(B, [T]), this.stats.sourceMeshes++, this.stats.vertices += I.count, this.stats.indices += g.index?.count ?? I.count;
|
|
2498
|
+
});
|
|
2499
|
+
});
|
|
2500
|
+
}), this.stats.instances = this.#s.length, this.stats.unsupportedInstances = e.reduce((i, a) => i + a.instances.length, 0);
|
|
2501
|
+
const n = Vn(this.#s.length);
|
|
2502
|
+
return this.#i = Jn(n), this.#r(), t.forEach((i) => this.#d(i)), this.stats.batches = this.children.length, this.stats.drawCallsSaved = Math.max(0, this.stats.sourceMeshes - this.stats.batches), this.children.forEach((i) => {
|
|
2503
|
+
i instanceof P && (i.onBeforeRender = () => this.#r());
|
|
2504
|
+
}), { stats: { ...this.stats }, unsupported: e };
|
|
2505
|
+
}
|
|
2506
|
+
materialize(e) {
|
|
2507
|
+
const t = this.#e.get(e);
|
|
2508
|
+
if (!t || t.materialized) return e.getInstanceRenderObject();
|
|
2509
|
+
const s = Yn(t.template);
|
|
2510
|
+
return s.position.set(0, 0, 0), s.quaternion.identity(), s.scale.set(1, 1, 1), s.matrix.identity(), t.materialized = !0, e.setInstanceRenderObject(s), s.updateWorldMatrix(!0, !0), this.#n.add(t), this.dispatchEvent({ type: "materialize", instance: e, object: s }), s;
|
|
2511
|
+
}
|
|
2512
|
+
#d(e) {
|
|
2513
|
+
const t = [];
|
|
2514
|
+
let s = [], n = 0, i = 0;
|
|
2515
|
+
e.forEach((a) => {
|
|
2516
|
+
const o = a.geometry.getAttribute("position").count, c = a.geometry.index?.count ?? o;
|
|
2517
|
+
s.length > 0 && (n + o > this.options.maxVerticesPerBatch || i + c > this.options.maxIndicesPerBatch) && (t.push(s), s = [], n = 0, i = 0), s.push(a), n += o, i += c;
|
|
2518
|
+
}), s.length > 0 && t.push(s), t.forEach((a) => {
|
|
2519
|
+
const o = en(a.map((d) => d.geometry), !1);
|
|
2520
|
+
if (a.forEach((d) => d.geometry.dispose()), !o || !this.#i) return;
|
|
2521
|
+
o.computeBoundingBox(), o.computeBoundingSphere();
|
|
2522
|
+
const c = a[0], l = a.flatMap((d) => d.objectIndices), h = Zn(c.material, this.#i), u = new ei(
|
|
2523
|
+
o,
|
|
2524
|
+
h,
|
|
2525
|
+
l,
|
|
2526
|
+
this.#s
|
|
2527
|
+
);
|
|
2528
|
+
u.name = `EditableGeometryBatch:${this.children.length}`, u.castShadow = c.castShadow, u.receiveShadow = c.receiveShadow, u.renderOrder = c.renderOrder, u.matrixAutoUpdate = !1, this.add(u);
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
#r() {
|
|
2532
|
+
if (!(!this.#i || this.#n.size === 0 || this.#h)) {
|
|
2533
|
+
this.#h = !0;
|
|
2534
|
+
try {
|
|
2535
|
+
this.updateWorldMatrix(!0, !1), this.#o.copy(this.matrixWorld).invert();
|
|
2536
|
+
const e = this.#i.image.data;
|
|
2537
|
+
[...this.#n].sort((t, s) => lt(t.instance) - lt(s.instance)).forEach((t) => {
|
|
2538
|
+
const { instance: s, objectIndex: n } = t;
|
|
2539
|
+
s.updateWorldMatrix(!0, !1), ce.multiplyMatrices(this.#o, s.matrixWorld), !t.materialized && s.getInstanceRenderObject() !== null && !s.hasInstanceMaterializer(t.materializer) && (t.materialized = !0), !t.materialized && !Fn(ce, t.initialMatrix) && this.materialize(s), !t.materialized && s.getInstanceOpacity() < 0.999 && this.materialize(s);
|
|
2540
|
+
const i = n * 4, a = !t.materialized && $t(s) && s.getInstanceOpacity() > 1e-3, o = s.getInstanceColor();
|
|
2541
|
+
e[i] = o.r, e[i + 1] = o.g, e[i + 2] = o.b, e[i + 3] = a ? s.getInstanceColorMode() : -1, this.#n.delete(t);
|
|
2542
|
+
}), this.#i.needsUpdate = !0;
|
|
2543
|
+
} finally {
|
|
2544
|
+
this.#h = !1;
|
|
2545
|
+
}
|
|
2546
|
+
this.#n.size > 0 && this.#r();
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
#p(e) {
|
|
2550
|
+
this.#n.add(e), this.#r();
|
|
2551
|
+
}
|
|
2552
|
+
dispose() {
|
|
2553
|
+
this.#l || (this.#l = !0, this.#s.forEach((e) => {
|
|
2554
|
+
e.unsubscribe(), e.instance.clearInstanceMaterializer(e.materializer);
|
|
2555
|
+
}), this.#s.length = 0, this.#e.clear(), this.#a.clear(), this.#n.clear(), this.#t.length = 0, this.#i?.dispose(), this.#i = null, this.traverse((e) => {
|
|
2556
|
+
if (!(e instanceof P)) return;
|
|
2557
|
+
e.geometry.dispose(), (Array.isArray(e.material) ? e.material : [e.material]).forEach((s) => s.dispose());
|
|
2558
|
+
}), this.clear());
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
const ht = new L(), de = new L(), ut = new L(), dt = new L(), pt = new $(), mt = new ne(), ft = new ne(), ti = new Ds(), ee = new A(), gt = new z(), yt = new C(), bt = new L(), wt = new L(), xt = new ne(), pe = [], Kt = 1e-6, W = 1e-6, Xt = 0.999, si = 0, Mt = 1;
|
|
2562
|
+
function ni(r, e, t) {
|
|
2563
|
+
const s = r.elements;
|
|
2564
|
+
for (let n = 0; n < 16; n++)
|
|
2565
|
+
if (Math.abs(s[n] - e[t + n]) > Kt) return !1;
|
|
2566
|
+
return !0;
|
|
2567
|
+
}
|
|
2568
|
+
function ii(r, e, t, s) {
|
|
2569
|
+
return Math.abs(r.r - t[s]) <= W && Math.abs(r.g - t[s + 1]) <= W && Math.abs(r.b - t[s + 2]) <= W && Math.abs(e - t[s + 3]) <= W;
|
|
2570
|
+
}
|
|
2571
|
+
function It(r, e) {
|
|
2572
|
+
const t = r.elements, s = e.elements;
|
|
2573
|
+
for (let n = 0; n < 16; n++)
|
|
2574
|
+
if (Math.abs(t[n] - s[n]) > Kt) return !1;
|
|
2575
|
+
return !0;
|
|
2576
|
+
}
|
|
2577
|
+
function _e(r) {
|
|
2578
|
+
let e = r;
|
|
2579
|
+
for (; e; ) {
|
|
2580
|
+
if (!e.visible) return !1;
|
|
2581
|
+
e = e.parent;
|
|
2582
|
+
}
|
|
2583
|
+
return !0;
|
|
2584
|
+
}
|
|
2585
|
+
function ri(r) {
|
|
2586
|
+
const e = r.geometry.morphAttributes;
|
|
2587
|
+
return Object.values(e).some((t) => t?.length);
|
|
2588
|
+
}
|
|
2589
|
+
function ai(r) {
|
|
2590
|
+
const e = r.material;
|
|
2591
|
+
if (!Array.isArray(e)) return !0;
|
|
2592
|
+
if (e.length === 0 || !e.every(Boolean)) return !1;
|
|
2593
|
+
const t = r.geometry.groups;
|
|
2594
|
+
return t.length === 0 ? !1 : t.every((s) => {
|
|
2595
|
+
const n = s.materialIndex ?? 0;
|
|
2596
|
+
return Number.isInteger(s.start) && s.start >= 0 && Number.isInteger(s.count) && s.count > 0 && Number.isInteger(n) && n >= 0 && n < e.length;
|
|
2597
|
+
});
|
|
2598
|
+
}
|
|
2599
|
+
function oi(r) {
|
|
2600
|
+
return !r.isSkinnedMesh && !ri(r) && ai(r);
|
|
2601
|
+
}
|
|
2602
|
+
function St(r) {
|
|
2603
|
+
return Array.isArray(r) ? r : [r];
|
|
2604
|
+
}
|
|
2605
|
+
function Qt(r) {
|
|
2606
|
+
return r.transparent || r.opacity < Xt;
|
|
2607
|
+
}
|
|
2608
|
+
function vt(r, e, t) {
|
|
2609
|
+
const s = r.clone(), n = Xe(e, "vec4", 4, 0), i = Xe(t, "float", 1, 0), a = s.colorNode ?? xe, o = s.opacityNode ? Vs(s.opacityNode) : Oe, c = F(n.a.greaterThan(1.5), a.mul(n.rgb), n.rgb);
|
|
2610
|
+
return s.colorNode = F(n.a.greaterThan(0.5), c, a), s.opacityNode = o.mul(i), s.transparent = Qt(r), s.needsUpdate = !0, s;
|
|
2611
|
+
}
|
|
2612
|
+
function ci(r, e, t) {
|
|
2613
|
+
return Array.isArray(r) ? r.map((s) => vt(s, e, t)) : vt(r, e, t);
|
|
2614
|
+
}
|
|
2615
|
+
function li(r) {
|
|
2616
|
+
const e = [], t = new L();
|
|
2617
|
+
let s = !1;
|
|
2618
|
+
return r.updateWorldMatrix(!0, !0), t.copy(r.matrixWorld).invert(), r.traverse((n) => {
|
|
2619
|
+
if (!s && !(!(n instanceof P) || !n.visible)) {
|
|
2620
|
+
if (!oi(n)) {
|
|
2621
|
+
s = !0;
|
|
2622
|
+
return;
|
|
2623
|
+
}
|
|
2624
|
+
n.updateWorldMatrix(!0, !1), e.push({
|
|
2625
|
+
mesh: n,
|
|
2626
|
+
localMatrix: t.clone().multiply(n.matrixWorld)
|
|
2627
|
+
});
|
|
2628
|
+
}
|
|
2629
|
+
}), s ? [] : e;
|
|
2630
|
+
}
|
|
2631
|
+
function hi(r) {
|
|
2632
|
+
const e = new $();
|
|
2633
|
+
return r.forEach(({ mesh: t, localMatrix: s }) => {
|
|
2634
|
+
const n = t.geometry;
|
|
2635
|
+
n.boundingBox || n.computeBoundingBox(), n.boundingBox && (pt.copy(n.boundingBox).applyMatrix4(s), e.union(pt));
|
|
2636
|
+
}), e;
|
|
2637
|
+
}
|
|
2638
|
+
function te(r) {
|
|
2639
|
+
const e = r;
|
|
2640
|
+
"needsUpdate" in e && (e.needsUpdate = !0);
|
|
2641
|
+
}
|
|
2642
|
+
function Bt(r, e = Mt) {
|
|
2643
|
+
let t = Math.max(Mt, e);
|
|
2644
|
+
for (; t < r; )
|
|
2645
|
+
t *= 2;
|
|
2646
|
+
return t;
|
|
2647
|
+
}
|
|
2648
|
+
function ui(r) {
|
|
2649
|
+
return r !== null && typeof r == "object" && Symbol.iterator in r;
|
|
2650
|
+
}
|
|
2651
|
+
class $i extends ue {
|
|
2652
|
+
isModelInstancedLayer = !0;
|
|
2653
|
+
type = "ModelInstancedLayer";
|
|
2654
|
+
#t = [];
|
|
2655
|
+
#a = /* @__PURE__ */ new Map();
|
|
2656
|
+
#s = /* @__PURE__ */ new Map();
|
|
2657
|
+
#e = /* @__PURE__ */ new Map();
|
|
2658
|
+
#n = !0;
|
|
2659
|
+
#i = !1;
|
|
2660
|
+
#o = !0;
|
|
2661
|
+
#c = si;
|
|
2662
|
+
#l;
|
|
2663
|
+
#h;
|
|
2664
|
+
constructor(e = {}) {
|
|
2665
|
+
super(), this.name = e.name ?? "ModelInstances", this.#l = e.instanceKind ?? "", this.#h = e.getHitUserData ?? (() => ({}));
|
|
2666
|
+
}
|
|
2667
|
+
get instanceKind() {
|
|
2668
|
+
return this.#l;
|
|
2669
|
+
}
|
|
2670
|
+
getInstances() {
|
|
2671
|
+
const e = [];
|
|
2672
|
+
return this.#r((t) => e.push(t)), e;
|
|
2673
|
+
}
|
|
2674
|
+
getInstanceById(e) {
|
|
2675
|
+
return this.#w(), this.#e.get(e);
|
|
2676
|
+
}
|
|
2677
|
+
hasInstance(e) {
|
|
2678
|
+
return this.#w(), this.#e.has(e);
|
|
2679
|
+
}
|
|
2680
|
+
getInstanceCulling() {
|
|
2681
|
+
return {
|
|
2682
|
+
enabled: this.#i,
|
|
2683
|
+
frustum: this.#o,
|
|
2684
|
+
minScreenRadius: this.#c
|
|
2685
|
+
};
|
|
2686
|
+
}
|
|
2687
|
+
setInstanceCulling(e = {}) {
|
|
2688
|
+
let t = !1;
|
|
2689
|
+
if (e.enabled !== void 0 && this.#i !== e.enabled && (this.#i = e.enabled, t = !0), e.frustum !== void 0 && this.#o !== e.frustum && (this.#o = e.frustum, t = !0), e.minScreenRadius !== void 0) {
|
|
2690
|
+
const s = Math.max(0, e.minScreenRadius);
|
|
2691
|
+
Math.abs(this.#c - s) > W && (this.#c = s, t = !0);
|
|
2692
|
+
}
|
|
2693
|
+
return t && this.#t.forEach((s) => this.#v(s)), this;
|
|
2694
|
+
}
|
|
2695
|
+
setInstanceVisible(e) {
|
|
2696
|
+
return this.visible !== e && (this.visible = e), this.#r((t) => {
|
|
2697
|
+
t.setInstanceVisible(e);
|
|
2698
|
+
}), this;
|
|
2699
|
+
}
|
|
2700
|
+
setInstanceColor(e) {
|
|
2701
|
+
return this.#r((t) => {
|
|
2702
|
+
t.setInstanceColor(e);
|
|
2703
|
+
}), this;
|
|
2704
|
+
}
|
|
2705
|
+
resetInstanceColor() {
|
|
2706
|
+
return this.#r((e) => {
|
|
2707
|
+
e.resetInstanceColor();
|
|
2708
|
+
}), this;
|
|
2709
|
+
}
|
|
2710
|
+
setInstanceOpacity(e) {
|
|
2711
|
+
return this.#r((t) => {
|
|
2712
|
+
t.setInstanceOpacity(e);
|
|
2713
|
+
}), this;
|
|
2714
|
+
}
|
|
2715
|
+
setInstanceHighlight(e, t, s = !1) {
|
|
2716
|
+
return this.#r((n) => {
|
|
2717
|
+
n.setInstanceHighlight(e, t, s);
|
|
2718
|
+
}), this;
|
|
2719
|
+
}
|
|
2720
|
+
clearInstanceHighlight() {
|
|
2721
|
+
return this.#r((e) => {
|
|
2722
|
+
e.clearInstanceHighlight();
|
|
2723
|
+
}), this;
|
|
2724
|
+
}
|
|
2725
|
+
reserveBatch(e, t, s) {
|
|
2726
|
+
const n = Math.floor(s);
|
|
2727
|
+
return n <= 0 ? !1 : this.#d(e, t, n) !== null;
|
|
2728
|
+
}
|
|
2729
|
+
addInstance(e, t, s) {
|
|
2730
|
+
return this.addInstances(e, t, [s]);
|
|
2731
|
+
}
|
|
2732
|
+
addInstances(e, t, s) {
|
|
2733
|
+
if (s.length === 0) return !1;
|
|
2734
|
+
const n = this.#a.has(e), i = this.#d(e, t, s.length);
|
|
2735
|
+
if (!i) return !1;
|
|
2736
|
+
const a = [], o = /* @__PURE__ */ new Set();
|
|
2737
|
+
return s.forEach((c) => {
|
|
2738
|
+
o.has(c) || (o.add(c), this.#s.get(c) === i) || a.push(c);
|
|
2739
|
+
}), a.length === 0 ? !0 : this.#E(a) ? (a.forEach((c) => {
|
|
2740
|
+
const l = this.#s.get(c);
|
|
2741
|
+
l && l !== i && this.#I(l, c);
|
|
2742
|
+
}), this.#M(i, i.instances.length + a.length), a.forEach((c) => {
|
|
2743
|
+
c.setInstanceBounds(i.templateBounds), i.instances.push(c), this.#s.set(c, i), i.unsubscribeByInstance.set(
|
|
2744
|
+
c,
|
|
2745
|
+
c.onInstanceRenderDirty(() => {
|
|
2746
|
+
this.#g(), this.#y(i);
|
|
2747
|
+
})
|
|
2748
|
+
);
|
|
2749
|
+
}), this.#g(), this.#b(i), this.#y(i), !0) : (!n && i.instances.length === 0 && this.#f(i), !1);
|
|
2750
|
+
}
|
|
2751
|
+
removeInstance(e) {
|
|
2752
|
+
return this.removeInstances([e]) > 0;
|
|
2753
|
+
}
|
|
2754
|
+
removeInstances(e) {
|
|
2755
|
+
const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), n = typeof e == "string" || !ui(e) ? [e] : e;
|
|
2756
|
+
for (const a of n)
|
|
2757
|
+
typeof a == "string" ? t.add(a) : this.#s.has(a) && s.add(a);
|
|
2758
|
+
t.size > 0 && (this.#w(), t.forEach((a) => {
|
|
2759
|
+
const o = this.#e.get(a);
|
|
2760
|
+
o && s.add(o);
|
|
2761
|
+
}));
|
|
2762
|
+
let i = 0;
|
|
2763
|
+
return s.forEach((a) => {
|
|
2764
|
+
const o = this.#s.get(a);
|
|
2765
|
+
o && this.#I(o, a) && i++;
|
|
2766
|
+
}), i;
|
|
2767
|
+
}
|
|
2768
|
+
removeBatch(e) {
|
|
2769
|
+
const t = this.#a.get(e);
|
|
2770
|
+
return t ? (this.#f(t), !0) : !1;
|
|
2771
|
+
}
|
|
2772
|
+
clearBatches() {
|
|
2773
|
+
return [...this.#a.values()].forEach((e) => this.#f(e)), this;
|
|
2774
|
+
}
|
|
2775
|
+
#d(e, t, s) {
|
|
2776
|
+
const n = this.#a.get(e);
|
|
2777
|
+
if (n)
|
|
2778
|
+
return this.#M(n, s), n;
|
|
2779
|
+
if (t.animations?.length) return null;
|
|
2780
|
+
const i = li(t);
|
|
2781
|
+
if (i.length === 0) return null;
|
|
2782
|
+
const a = hi(i), o = new H();
|
|
2783
|
+
o.name = e, this.add(o);
|
|
2784
|
+
const c = {
|
|
2785
|
+
url: e,
|
|
2786
|
+
batch: o,
|
|
2787
|
+
templateMeshes: i,
|
|
2788
|
+
templateBounds: a,
|
|
2789
|
+
records: [],
|
|
2790
|
+
instances: [],
|
|
2791
|
+
unsubscribeByInstance: /* @__PURE__ */ new Map(),
|
|
2792
|
+
capacity: Bt(s)
|
|
2793
|
+
};
|
|
2794
|
+
return i.forEach(({ mesh: l, localMatrix: h }, u) => {
|
|
2795
|
+
const d = this.#p(c, l, h, u);
|
|
2796
|
+
c.records.push(d), this.#t.push(d);
|
|
2797
|
+
}), this.#a.set(e, c), this.#b(c), c;
|
|
2798
|
+
}
|
|
2799
|
+
#r(e) {
|
|
2800
|
+
const t = /* @__PURE__ */ new Set();
|
|
2801
|
+
this.#a.forEach((s) => {
|
|
2802
|
+
s.instances.forEach((n) => {
|
|
2803
|
+
t.has(n) || (t.add(n), e(n));
|
|
2804
|
+
});
|
|
2805
|
+
});
|
|
2806
|
+
}
|
|
2807
|
+
#p(e, t, s, n) {
|
|
2808
|
+
const i = new We(new Float32Array(e.capacity * 4), 4), a = new We(new Float32Array(e.capacity).fill(1), 1);
|
|
2809
|
+
i.setUsage(Be), a.setUsage(Be);
|
|
2810
|
+
const o = ci(
|
|
2811
|
+
t.material,
|
|
2812
|
+
i,
|
|
2813
|
+
a
|
|
2814
|
+
), c = St(o), l = St(t.material).some(
|
|
2815
|
+
Qt
|
|
2816
|
+
), h = new Rs(t.geometry, o, e.capacity);
|
|
2817
|
+
h.instanceMatrix = new js(e.capacity, 16), h.count = 0, h.name = t.name || `${e.url}#${n}`, h.castShadow = t.castShadow, h.receiveShadow = t.receiveShadow, h.frustumCulled = !0, h.matrixAutoUpdate = !1, h.instanceMatrix.setUsage(Be), h.userData.url = e.url;
|
|
2818
|
+
const u = new P(t.geometry, o);
|
|
2819
|
+
u.matrixAutoUpdate = !1;
|
|
2820
|
+
const d = {
|
|
2821
|
+
batchRecord: e,
|
|
2822
|
+
mesh: h,
|
|
2823
|
+
boundsTree: void 0,
|
|
2824
|
+
raycastMesh: u,
|
|
2825
|
+
localMatrix: s.clone(),
|
|
2826
|
+
fullBoundingSphere: new ne(),
|
|
2827
|
+
materials: c,
|
|
2828
|
+
hasSourceTransparency: l,
|
|
2829
|
+
colorAttribute: i,
|
|
2830
|
+
opacityAttribute: a,
|
|
2831
|
+
renderedInstances: [],
|
|
2832
|
+
visibleInstances: [],
|
|
2833
|
+
lastCameraMatrixWorldInverse: new L(),
|
|
2834
|
+
lastCameraProjectionMatrix: new L(),
|
|
2835
|
+
lastViewportHeight: 0,
|
|
2836
|
+
hasLastCameraState: !1,
|
|
2837
|
+
dirty: !0
|
|
2838
|
+
};
|
|
2839
|
+
h.userData.getInstanceObjectByRenderIndex = (m) => d.renderedInstances[m], h.userData.raycastAcceleration = "lazy";
|
|
2840
|
+
const p = h.raycast.bind(h);
|
|
2841
|
+
return h.raycast = (m, b) => {
|
|
2842
|
+
if (this.#B(d), !this.#m(d, m)) return;
|
|
2843
|
+
d.boundsTree === void 0 && (d.boundsTree = Et(d.mesh.geometry), d.mesh.userData.raycastAcceleration = d.boundsTree ? "three-mesh-bvh" : "default");
|
|
2844
|
+
const S = b.length;
|
|
2845
|
+
d.boundsTree ? this.#u(d, m, b) : p(m, b);
|
|
2846
|
+
for (let w = S; w < b.length; ) {
|
|
2847
|
+
const g = b[w], I = g.instanceId;
|
|
2848
|
+
if (I === void 0) {
|
|
2849
|
+
w++;
|
|
2850
|
+
continue;
|
|
2851
|
+
}
|
|
2852
|
+
const B = d.renderedInstances[I];
|
|
2853
|
+
if (!B || !_e(B)) {
|
|
2854
|
+
b.splice(w, 1);
|
|
2855
|
+
continue;
|
|
2856
|
+
}
|
|
2857
|
+
g.object = B, g.instanceObject = B, g.instanceObjectId = B.instanceId, g.instanceKind = B.instanceKind || this.#l, g.instanceName = B.instanceName, g.instanceIndex = I, Object.assign(g, this.#h(B, I)), w++;
|
|
2858
|
+
}
|
|
2859
|
+
}, h.onBeforeRender = (m, b, S) => this.#B(d, m, S), e.batch.add(h), d;
|
|
2860
|
+
}
|
|
2861
|
+
#m(e, t) {
|
|
2862
|
+
const { mesh: s } = e;
|
|
2863
|
+
return s.count === 0 ? !1 : (s.boundingSphere === null && s.computeBoundingSphere(), s.boundingSphere ? (xt.copy(s.boundingSphere).applyMatrix4(s.matrixWorld), t.ray.intersectsSphere(xt)) : !0);
|
|
2864
|
+
}
|
|
2865
|
+
#u(e, t, s) {
|
|
2866
|
+
const { mesh: n, boundsTree: i, raycastMesh: a } = e;
|
|
2867
|
+
if (!(!i || n.count === 0)) {
|
|
2868
|
+
a.geometry = n.geometry, a.material = n.material;
|
|
2869
|
+
for (let o = 0; o < n.count; o++)
|
|
2870
|
+
n.getMatrixAt(o, bt), wt.multiplyMatrices(n.matrixWorld, bt), a.matrixWorld.copy(wt), pe.length = 0, i.raycastObject3D(a, t, pe), pe.forEach((c) => {
|
|
2871
|
+
c.instanceId = o, c.object = n, s.push(c);
|
|
2872
|
+
}), pe.length = 0;
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
#M(e, t) {
|
|
2876
|
+
if (t <= e.capacity) return;
|
|
2877
|
+
e.capacity = Bt(t, e.capacity);
|
|
2878
|
+
const s = new Set(e.records);
|
|
2879
|
+
s.forEach((n) => this.#S(n)), this.#t = this.#t.filter((n) => !s.has(n)), e.records = e.templateMeshes.map(({ mesh: n, localMatrix: i }, a) => {
|
|
2880
|
+
const o = this.#p(e, n, i, a);
|
|
2881
|
+
return this.#t.push(o), o;
|
|
2882
|
+
}), this.#y(e);
|
|
2883
|
+
}
|
|
2884
|
+
#I(e, t) {
|
|
2885
|
+
const s = e.instances.indexOf(t);
|
|
2886
|
+
return s === -1 ? !1 : (e.instances.splice(s, 1), e.records.forEach((n) => n.visibleInstances.splice(s, 1)), this.#s.delete(t), this.#g(), e.unsubscribeByInstance.get(t)?.(), e.unsubscribeByInstance.delete(t), e.instances.length === 0 ? (this.#f(e), !0) : (this.#b(e), this.#y(e), !0));
|
|
2887
|
+
}
|
|
2888
|
+
#f(e) {
|
|
2889
|
+
e.unsubscribeByInstance.forEach((s) => s()), e.instances.forEach((s) => this.#s.delete(s)), e.unsubscribeByInstance.clear(), e.instances.length = 0, this.#g();
|
|
2890
|
+
const t = new Set(e.records);
|
|
2891
|
+
t.forEach((s) => this.#S(s)), this.#t = this.#t.filter((s) => !t.has(s)), e.records.length = 0, e.templateMeshes.length = 0, this.#a.delete(e.url), this.remove(e.batch);
|
|
2892
|
+
}
|
|
2893
|
+
#S(e) {
|
|
2894
|
+
e.batchRecord.batch.remove(e.mesh), e.mesh.dispose(), e.materials.forEach((t) => t.dispose());
|
|
2895
|
+
}
|
|
2896
|
+
#b(e) {
|
|
2897
|
+
Object.assign(e.batch.userData, {
|
|
2898
|
+
url: e.url,
|
|
2899
|
+
count: e.instances.length,
|
|
2900
|
+
capacity: e.capacity,
|
|
2901
|
+
instanceKind: this.#l
|
|
2902
|
+
}), delete e.batch.userData.sceneInstances, delete e.batch.userData.facilities, e.records.forEach((t) => {
|
|
2903
|
+
delete t.mesh.userData.instances;
|
|
2904
|
+
});
|
|
2905
|
+
}
|
|
2906
|
+
#E(e) {
|
|
2907
|
+
const t = new Set(e), s = /* @__PURE__ */ new Map();
|
|
2908
|
+
for (const i of e) {
|
|
2909
|
+
const { instanceId: a } = i;
|
|
2910
|
+
if (!a) continue;
|
|
2911
|
+
const o = s.get(a);
|
|
2912
|
+
if (o && o !== i) return !1;
|
|
2913
|
+
s.set(a, i);
|
|
2914
|
+
}
|
|
2915
|
+
let n = !0;
|
|
2916
|
+
return s.forEach((i, a) => {
|
|
2917
|
+
n && this.#r((o) => {
|
|
2918
|
+
!n || t.has(o) || o.instanceId === a && (n = !1);
|
|
2919
|
+
});
|
|
2920
|
+
}), n;
|
|
2921
|
+
}
|
|
2922
|
+
#w() {
|
|
2923
|
+
if (!this.#n) return;
|
|
2924
|
+
this.#e.clear();
|
|
2925
|
+
const e = /* @__PURE__ */ new Set();
|
|
2926
|
+
this.#r((t) => {
|
|
2927
|
+
const { instanceId: s } = t;
|
|
2928
|
+
if (!s || e.has(s)) return;
|
|
2929
|
+
const n = this.#e.get(s);
|
|
2930
|
+
if (n && n !== t) {
|
|
2931
|
+
this.#e.delete(s), e.add(s);
|
|
2932
|
+
return;
|
|
2933
|
+
}
|
|
2934
|
+
this.#e.set(s, t);
|
|
2935
|
+
}), this.#n = !1;
|
|
2936
|
+
}
|
|
2937
|
+
#g() {
|
|
2938
|
+
this.#n = !0;
|
|
2939
|
+
}
|
|
2940
|
+
#y(e) {
|
|
2941
|
+
e.records.forEach((t) => this.#v(t));
|
|
2942
|
+
}
|
|
2943
|
+
#v(e) {
|
|
2944
|
+
e.dirty = !0, e.hasLastCameraState = !1, e.mesh.visible = !0, e.mesh.frustumCulled = !1, te(e.batchRecord.batch);
|
|
2945
|
+
}
|
|
2946
|
+
#B(e, t, s) {
|
|
2947
|
+
const n = this.#C(t), i = this.#O(e, s, n);
|
|
2948
|
+
!e.dirty && !this.#_(e) && !i || this.#P(e, s, n);
|
|
2949
|
+
}
|
|
2950
|
+
#_(e) {
|
|
2951
|
+
const { instances: t } = e.batchRecord;
|
|
2952
|
+
for (let s = 0; s < t.length; s++)
|
|
2953
|
+
if (e.visibleInstances[s] !== _e(t[s]))
|
|
2954
|
+
return e.dirty = !0, te(e.batchRecord.batch), !0;
|
|
2955
|
+
return !1;
|
|
2956
|
+
}
|
|
2957
|
+
#C(e) {
|
|
2958
|
+
return e?.getDrawingBufferSize ? (e.getDrawingBufferSize(gt), gt.y) : 0;
|
|
2959
|
+
}
|
|
2960
|
+
#O(e, t, s) {
|
|
2961
|
+
return this.#x(t, s) ? e.hasLastCameraState ? !It(e.lastCameraMatrixWorldInverse, t.matrixWorldInverse) || !It(e.lastCameraProjectionMatrix, t.projectionMatrix) || Math.abs(e.lastViewportHeight - s) > W : !0 : !1;
|
|
2962
|
+
}
|
|
2963
|
+
#x(e, t) {
|
|
2964
|
+
return this.#i && e !== void 0 && (this.#o || this.#c > 0 && t > 0);
|
|
2965
|
+
}
|
|
2966
|
+
#A(e, t) {
|
|
2967
|
+
if (!this.#x(e, t)) return null;
|
|
2968
|
+
let s = null;
|
|
2969
|
+
return this.#o && (dt.multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse), s = ti.setFromProjectionMatrix(dt)), { camera: e, frustum: s, viewportHeight: t };
|
|
2970
|
+
}
|
|
2971
|
+
#T(e, t) {
|
|
2972
|
+
return t ? t.frustum && !t.frustum.intersectsSphere(e) ? !1 : this.#c <= 0 || t.viewportHeight <= 0 ? !0 : this.#L(e, t.camera, t.viewportHeight) >= this.#c : !0;
|
|
2973
|
+
}
|
|
2974
|
+
#L(e, t, s) {
|
|
2975
|
+
const n = Math.abs(t.projectionMatrix.elements[5]);
|
|
2976
|
+
if (n <= W) return 1 / 0;
|
|
2977
|
+
if (t.isOrthographicCamera)
|
|
2978
|
+
return e.radius * n * s * 0.5;
|
|
2979
|
+
yt.copy(e.center).applyMatrix4(t.matrixWorldInverse);
|
|
2980
|
+
const i = -yt.z;
|
|
2981
|
+
return i <= W ? 1 / 0 : e.radius * n * s * 0.5 / i;
|
|
2982
|
+
}
|
|
2983
|
+
#P(e, t, s = 0) {
|
|
2984
|
+
this.updateWorldMatrix(!0, !1), ht.copy(this.matrixWorld).invert();
|
|
2985
|
+
const n = e.mesh.instanceMatrix.array, i = e.colorAttribute.array, a = e.opacityAttribute.array, o = e.mesh.geometry;
|
|
2986
|
+
let c = !1, l = !1, h = !1, u = 0, d = 0, p = !1;
|
|
2987
|
+
const m = e.mesh.count, b = this.#A(t, s);
|
|
2988
|
+
o.boundingSphere || o.computeBoundingSphere(), e.fullBoundingSphere.makeEmpty(), e.renderedInstances.length = 0, e.batchRecord.instances.forEach((g, I) => {
|
|
2989
|
+
const B = _e(g);
|
|
2990
|
+
e.visibleInstances[I] = B, g.updateWorldMatrix(!0, !1), de.multiplyMatrices(ht, g.matrixWorld).multiply(e.localMatrix);
|
|
2991
|
+
const O = g.getInstanceOpacity();
|
|
2992
|
+
if (!(B && O > W) || (d++, o.boundingSphere && (mt.copy(o.boundingSphere).applyMatrix4(de), e.fullBoundingSphere.union(mt), b && (ut.multiplyMatrices(g.matrixWorld, e.localMatrix), ft.copy(o.boundingSphere).applyMatrix4(ut), !this.#T(ft, b)))))
|
|
2993
|
+
return;
|
|
2994
|
+
const y = u, _ = y * 16;
|
|
2995
|
+
ni(de, n, _) || (e.mesh.setMatrixAt(y, de), c = !0), ee.copy(g.getInstanceColor(ee));
|
|
2996
|
+
const k = g.getInstanceColorMode(), N = y * 4;
|
|
2997
|
+
ii(ee, k, i, N) || (e.colorAttribute.setXYZW(y, ee.r, ee.g, ee.b, k), l = !0), O < Xt && (p = !0), Math.abs(O - a[y]) > W && (e.opacityAttribute.setX(y, O), h = !0), e.renderedInstances[y] = g, u++;
|
|
2998
|
+
}), e.mesh.count = u, m !== u && (c = !0, l = !0, h = !0, te(e.batchRecord.batch));
|
|
2999
|
+
const S = d > 0;
|
|
3000
|
+
e.mesh.visible !== S && (e.mesh.visible = S, te(e.batchRecord.batch)), e.mesh.frustumCulled !== !0 && (e.mesh.frustumCulled = !0, te(e.batchRecord.batch)), c && (e.mesh.instanceMatrix.needsUpdate = !0), l && (e.colorAttribute.needsUpdate = !0), h && (e.opacityAttribute.needsUpdate = !0), e.mesh.boundingSphere === null && (e.mesh.boundingSphere = new ne()), e.mesh.boundingSphere.copy(e.fullBoundingSphere);
|
|
3001
|
+
const w = e.hasSourceTransparency || p;
|
|
3002
|
+
e.materials.forEach((g) => {
|
|
3003
|
+
g.transparent !== w && (g.transparent = w, g.needsUpdate = !0, te(e.batchRecord.batch));
|
|
3004
|
+
}), t && this.#x(t, s) ? (e.lastCameraMatrixWorldInverse.copy(t.matrixWorldInverse), e.lastCameraProjectionMatrix.copy(t.projectionMatrix), e.lastViewportHeight = s, e.hasLastCameraState = !0) : e.hasLastCameraState = !1, e.dirty = !1;
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
|
+
const di = "0.0.30";
|
|
3008
|
+
typeof window < "u" && (window.__USPACE__ = { version: di });
|
|
2800
3009
|
export {
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
3010
|
+
Wi as AnnotationManager,
|
|
3011
|
+
ue as BaseGroup,
|
|
3012
|
+
q as BaseMesh,
|
|
3013
|
+
wn as BaseSprite,
|
|
3014
|
+
ir as CSS2DObject,
|
|
3015
|
+
ar as CSS3DObject,
|
|
3016
|
+
or as CSS3DSprite,
|
|
3017
|
+
Qi as CSSRenderer,
|
|
3018
|
+
qi as CameraControls,
|
|
3019
|
+
zi as CircleMesh,
|
|
3020
|
+
ki as ClippingTool,
|
|
3021
|
+
Gi as EditableGeometryBatchLayer,
|
|
3022
|
+
zt as ExtrudeMesh,
|
|
3023
|
+
rt as INSTANCE_COLOR_MODE_NONE,
|
|
3024
|
+
Ee as INSTANCE_COLOR_MODE_OVERRIDE,
|
|
3025
|
+
Dn as INSTANCE_COLOR_MODE_TINT,
|
|
3026
|
+
Hi as InstanceObject,
|
|
3027
|
+
Yi as InteractionEvent,
|
|
3028
|
+
Vi as InteractionManager,
|
|
3029
|
+
Ai as LightManager,
|
|
3030
|
+
se as MaterialEffects,
|
|
3031
|
+
Ui as MeasureTool,
|
|
3032
|
+
we as Model,
|
|
3033
|
+
$i as ModelInstancedLayer,
|
|
3034
|
+
X as ModelLoaderManager,
|
|
3035
|
+
Ji as ObjectManager,
|
|
3036
|
+
J as ObjectUtils,
|
|
3037
|
+
Ni as PlaneMesh,
|
|
3038
|
+
Pi as Poi,
|
|
3039
|
+
Zi as RenderPipeline,
|
|
3040
|
+
er as RoomEnvironment,
|
|
3041
|
+
yn as SBMLoader,
|
|
3042
|
+
tn as SBMXLoader,
|
|
3043
|
+
Oi as SceneManager,
|
|
3044
|
+
Ci as Selection,
|
|
3045
|
+
Nt as ShapeMesh,
|
|
3046
|
+
xn as SphereMesh,
|
|
3047
|
+
Di as TSLEffects,
|
|
3048
|
+
Ti as TextureLoaderManager,
|
|
3049
|
+
Li as Topology,
|
|
3050
|
+
qe as TubeMesh,
|
|
3051
|
+
Ln as Tween,
|
|
3052
|
+
tr as Viewer,
|
|
3053
|
+
sr as enableMeshBVHRaycast,
|
|
3054
|
+
Et as getGeometryBoundsTree,
|
|
3055
|
+
Fi as isInstanceObject,
|
|
3056
|
+
Ri as reinterpretType,
|
|
3057
|
+
ji as tweenAnimation,
|
|
3058
|
+
di as version
|
|
2841
3059
|
};
|