u-space 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.js +165 -140
- package/dist/plugins/atmosphere/Atmosphere.d.ts +47 -3
- package/dist/plugins/atmosphere/index.cjs +1 -1
- package/dist/plugins/atmosphere/index.js +299 -3
- package/dist/plugins/u-manager/index.cjs +1 -1
- package/dist/plugins/u-manager/index.js +577 -580
- package/dist/plugins/u-manager/semantics/FloorMesh.d.ts +24 -3
- package/dist/src/viewers/RenderPipeline.d.ts +8 -0
- package/docs/api-objects.md +2 -0
- package/docs/api-plugin-atmosphere.md +94 -2
- package/docs/api-render-pipeline.md +20 -4
- package/docs/changelog.md +12 -0
- package/docs/mcp.md +1 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Raycaster as Be, Vector2 as
|
|
2
|
-
import { pass as de, mrt as Gt, output as $t, add as be, blendColor as Wt, emissive as Kt, normalView as Qt, velocity as Xt, color as H, uv as xe, time as te, pow as se, sin as pe, mix as ne, mx_noise_float as
|
|
1
|
+
import { Raycaster as Be, Vector2 as C, EventDispatcher as Le, Box2 as tt, Matrix4 as Ie, Vector3 as w, Box3 as X, Scene as Re, Color as M, AmbientLight as st, DirectionalLight as ue, PointLight as me, SpotLight as fe, HemisphereLight as ge, DirectionalLightHelper as nt, PointLightHelper as it, SpotLightHelper as rt, HemisphereLightHelper as ot, RenderPipeline as at, PerspectiveCamera as J, Sphere as ze, Spherical as S, Quaternion as ct, Vector4 as ht, MathUtils as lt, PMREMGenerator as dt, OrthographicCamera as V, TimestampQuery as pt, Cache as ut, Timer as mt, WebGPURenderer as ft, PCFShadowMap as gt, AgXToneMapping as yt, Fog as wt, FogExp2 as vt, MeshStandardNodeMaterial as R, Loader as bt, LoaderUtils as L, FileLoader as Ne, TextureLoader as je, Group as I, SRGBColorSpace as De, RepeatWrapping as ye, BufferGeometry as K, BufferAttribute as we, Mesh as D, FrontSide as xt, BackSide as Ct, DoubleSide as St, REVISION as ve, CubeTextureLoader as Mt, EquirectangularReflectionMapping as _t, Sprite as Tt, AnimationMixer as Et, LoopRepeat as Pt, LoopOnce as Ot, SphereGeometry as At, TubeGeometry as Bt, LineCurve3 as Lt, CatmullRomCurve3 as It, SpriteNodeMaterial as Rt, CanvasTexture as zt, ShapeGeometry as Nt, Shape as ke, ExtrudeGeometry as jt, PlaneGeometry as Dt, CircleGeometry as kt, ClippingGroup as Ut, Plane as Ht, PlaneHelper as Ft, LineBasicMaterial as Z, Line as ee } from "three/webgpu";
|
|
2
|
+
import { pass as de, mrt as Gt, output as $t, add as be, blendColor as Wt, emissive as Kt, normalView as Qt, velocity as Xt, color as H, uv as xe, time as te, pow as se, sin as pe, mix as ne, mx_noise_float as Ce, Fn as Ue, userData as B, materialColor as Se, select as ie, materialOpacity as qt, vec3 as Yt } from "three/tsl";
|
|
3
3
|
import { bloom as Jt } from "three/addons/tsl/display/BloomNode.js";
|
|
4
4
|
import { ssgi as Vt } from "three/addons/tsl/display/SSGINode.js";
|
|
5
5
|
import { traa as Zt } from "three/addons/tsl/display/TRAANode.js";
|
|
@@ -20,7 +20,7 @@ import { MeshoptDecoder as Me } from "three/addons/libs/meshopt_decoder.module.j
|
|
|
20
20
|
import { HDRLoader as ps } from "three/addons/loaders/HDRLoader.js";
|
|
21
21
|
import { clone as us } from "three/addons/utils/SkeletonUtils.js";
|
|
22
22
|
import { Easing as m, Tween as ms } from "three/addons/libs/tween.module.js";
|
|
23
|
-
class
|
|
23
|
+
class fs {
|
|
24
24
|
/** The type of event (e.g., 'click', 'pointerdown'). */
|
|
25
25
|
type;
|
|
26
26
|
/** The original 3D object that triggered the event. */
|
|
@@ -48,15 +48,15 @@ class gs {
|
|
|
48
48
|
return this._propagationStopped;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
class
|
|
51
|
+
class gs {
|
|
52
52
|
domElement;
|
|
53
53
|
scene;
|
|
54
54
|
camera;
|
|
55
55
|
raycaster = new Be();
|
|
56
|
-
pointer = new
|
|
56
|
+
pointer = new C();
|
|
57
57
|
hoveredObject = null;
|
|
58
58
|
pointerDownTime = 0;
|
|
59
|
-
pointerDownPos = new
|
|
59
|
+
pointerDownPos = new C();
|
|
60
60
|
clickTimer = null;
|
|
61
61
|
longPressThreshold = 500;
|
|
62
62
|
moveThreshold = 0.01;
|
|
@@ -143,7 +143,7 @@ class fs {
|
|
|
143
143
|
* Dispatches an event to the target object and bubbles up the parent chain.
|
|
144
144
|
*/
|
|
145
145
|
_dispatchToTarget(e, t, s, n) {
|
|
146
|
-
const i = new
|
|
146
|
+
const i = new fs({
|
|
147
147
|
type: e,
|
|
148
148
|
target: t,
|
|
149
149
|
intersect: s,
|
|
@@ -215,8 +215,8 @@ class vn extends Le {
|
|
|
215
215
|
// Box selection state
|
|
216
216
|
_boxSelectionEnabled = !1;
|
|
217
217
|
_isSelecting = !1;
|
|
218
|
-
_startPoint = new
|
|
219
|
-
_endPoint = new
|
|
218
|
+
_startPoint = new C();
|
|
219
|
+
_endPoint = new C();
|
|
220
220
|
_selectionBox = null;
|
|
221
221
|
_deep = !0;
|
|
222
222
|
/**
|
|
@@ -315,21 +315,21 @@ class vn extends Le {
|
|
|
315
315
|
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
316
|
}
|
|
317
317
|
_getObjectsInBox() {
|
|
318
|
-
const e = this._container.getBoundingClientRect(), t = e.width, s = e.height, n = new
|
|
318
|
+
const e = this._container.getBoundingClientRect(), t = e.width, s = e.height, n = new C(
|
|
319
319
|
this._startPoint.x / t * 2 - 1,
|
|
320
320
|
-(this._startPoint.y / s) * 2 + 1
|
|
321
|
-
), i = new
|
|
321
|
+
), i = new C(
|
|
322
322
|
this._endPoint.x / t * 2 - 1,
|
|
323
323
|
-(this._endPoint.y / s) * 2 + 1
|
|
324
324
|
), r = new tt(
|
|
325
|
-
new
|
|
326
|
-
new
|
|
325
|
+
new C(Math.min(n.x, i.x), Math.min(n.y, i.y)),
|
|
326
|
+
new C(Math.max(n.x, i.x), Math.max(n.y, i.y))
|
|
327
327
|
), o = this.targetObjects || this.scene.children, a = [], c = new Ie();
|
|
328
328
|
c.multiplyMatrices(this.camera.projectionMatrix, this.camera.matrixWorldInverse);
|
|
329
329
|
const l = (d) => {
|
|
330
330
|
if (!d.visible) return;
|
|
331
331
|
const p = new w();
|
|
332
|
-
if (p.setFromMatrixPosition(d.matrixWorld), p.applyMatrix4(c), p.z > -1 && p.z < 1 && r.containsPoint(new
|
|
332
|
+
if (p.setFromMatrixPosition(d.matrixWorld), p.applyMatrix4(c), p.z > -1 && p.z < 1 && r.containsPoint(new C(p.x, p.y)) && a.push(d), this._deep)
|
|
333
333
|
for (const u of d.children)
|
|
334
334
|
l(u);
|
|
335
335
|
};
|
|
@@ -622,11 +622,11 @@ class xn {
|
|
|
622
622
|
position: c = { x: 0, y: 10, z: 0 },
|
|
623
623
|
target: l,
|
|
624
624
|
castShadow: d = !1
|
|
625
|
-
} = t, p = new
|
|
625
|
+
} = t, p = new fe(s, n, i, r, o, a);
|
|
626
626
|
return p.position.set(c.x, c.y, c.z), l && p.target.position.set(l.x, l.y, l.z), p.castShadow = d, p.name = e, this._register(e, p), p;
|
|
627
627
|
}
|
|
628
628
|
addHemisphere(e, t = {}) {
|
|
629
|
-
const { skyColor: s = 8900331, groundColor: n = 3549447, intensity: i = 0.6 } = t, r = new
|
|
629
|
+
const { skyColor: s = 8900331, groundColor: n = 3549447, intensity: i = 0.6 } = t, r = new ge(s, n, i);
|
|
630
630
|
return r.name = e, this._register(e, r), r;
|
|
631
631
|
}
|
|
632
632
|
/**
|
|
@@ -677,7 +677,7 @@ class xn {
|
|
|
677
677
|
const t = this.lights.get(e);
|
|
678
678
|
if (!t) return;
|
|
679
679
|
let s = null;
|
|
680
|
-
t instanceof ue ? s = new nt(t, 1) : t instanceof me ? s = new it(t, 0.5) : t instanceof
|
|
680
|
+
t instanceof ue ? s = new nt(t, 1) : t instanceof me ? s = new it(t, 0.5) : t instanceof fe ? s = new rt(t) : t instanceof ge && (s = new ot(t, 1)), s && (this.scene.add(s), this.helpers.set(e, s));
|
|
681
681
|
}
|
|
682
682
|
/**
|
|
683
683
|
* Hide (remove) the helper for a light.
|
|
@@ -713,13 +713,13 @@ class ws extends at {
|
|
|
713
713
|
camera;
|
|
714
714
|
scenePass;
|
|
715
715
|
needsUpdateOutputNode;
|
|
716
|
-
#
|
|
717
|
-
#
|
|
718
|
-
#
|
|
719
|
-
#
|
|
720
|
-
#
|
|
716
|
+
#o;
|
|
717
|
+
#s;
|
|
718
|
+
#n = !1;
|
|
719
|
+
#a = { strength: 1, radius: 0, threshold: 0 };
|
|
720
|
+
#d = null;
|
|
721
721
|
#i = !1;
|
|
722
|
-
#
|
|
722
|
+
#t = {
|
|
723
723
|
sliceCount: 1,
|
|
724
724
|
stepCount: 12,
|
|
725
725
|
aoIntensity: 1,
|
|
@@ -727,26 +727,30 @@ class ws extends at {
|
|
|
727
727
|
radius: 12,
|
|
728
728
|
thickness: 1
|
|
729
729
|
};
|
|
730
|
+
#p = null;
|
|
731
|
+
#c = !1;
|
|
730
732
|
#h = null;
|
|
731
|
-
#
|
|
732
|
-
#l
|
|
733
|
-
#
|
|
733
|
+
#u = null;
|
|
734
|
+
#l;
|
|
735
|
+
#r;
|
|
736
|
+
#m = !1;
|
|
737
|
+
#f = !0;
|
|
734
738
|
constructor(...e) {
|
|
735
739
|
const [t, s, n] = e;
|
|
736
|
-
super(t), this.scene = s, this.camera = n, this.scenePass = de(s, n), this.needsUpdateOutputNode = !0, this.#
|
|
740
|
+
super(t), this.scene = s, this.camera = n, this.scenePass = de(s, n), this.needsUpdateOutputNode = !0, this.#o = /* @__PURE__ */ new Set(), this.#s = [], this.#l = /* @__PURE__ */ new Set(), this.#r = /* @__PURE__ */ new Map(), this.#g();
|
|
737
741
|
}
|
|
738
742
|
/** @deprecated Use `scenePass` instead */
|
|
739
743
|
get currentOutputNode() {
|
|
740
744
|
return this.scenePass;
|
|
741
745
|
}
|
|
742
746
|
addOverlayPass(e) {
|
|
743
|
-
this.#
|
|
747
|
+
this.#o.add(e), this.needsUpdateOutputNode = !0;
|
|
744
748
|
}
|
|
745
749
|
removeOverlayPass(e) {
|
|
746
|
-
this.#
|
|
750
|
+
this.#o.delete(e), this.needsUpdateOutputNode = !0;
|
|
747
751
|
}
|
|
748
752
|
setCamera(e) {
|
|
749
|
-
this.camera = e, this.#
|
|
753
|
+
this.camera = e, this.#e();
|
|
750
754
|
}
|
|
751
755
|
/** @deprecated Use `setOutputComposer` instead */
|
|
752
756
|
setCurrentOutputNode(e) {
|
|
@@ -757,96 +761,117 @@ class ws extends at {
|
|
|
757
761
|
this.setOutputComposer(null);
|
|
758
762
|
}
|
|
759
763
|
setOutputComposer(e) {
|
|
760
|
-
this.#
|
|
764
|
+
this.#u = e, this.needsUpdateOutputNode = !0;
|
|
765
|
+
}
|
|
766
|
+
addOutputEffect(e) {
|
|
767
|
+
return this.#l.add(e), this.needsUpdateOutputNode = !0, this;
|
|
768
|
+
}
|
|
769
|
+
removeOutputEffect(e) {
|
|
770
|
+
return this.#l.delete(e), this.needsUpdateOutputNode = !0, this;
|
|
771
|
+
}
|
|
772
|
+
addMRTChannel(e, t) {
|
|
773
|
+
return this.#r.get(e) === t ? this : (this.#r.set(e, t), this.#e(), this);
|
|
774
|
+
}
|
|
775
|
+
removeMRTChannel(e) {
|
|
776
|
+
return this.#r.delete(e) && this.#e(), this;
|
|
761
777
|
}
|
|
762
778
|
enableBloom(e) {
|
|
763
|
-
e && Object.assign(this.#
|
|
779
|
+
e && Object.assign(this.#a, e), this.#n = !0, this.#e();
|
|
764
780
|
}
|
|
765
781
|
disableBloom() {
|
|
766
|
-
this.#
|
|
782
|
+
this.#n = !1, this.#d = null, this.#e();
|
|
767
783
|
}
|
|
768
784
|
updateBloom(e) {
|
|
769
|
-
Object.assign(this.#
|
|
785
|
+
Object.assign(this.#a, e), this.#n && (this.needsUpdateOutputNode = !0);
|
|
770
786
|
}
|
|
771
787
|
enableSSGI(e) {
|
|
772
|
-
e && Object.assign(this.#
|
|
788
|
+
e && Object.assign(this.#t, e), this.#i = !0, this.#e();
|
|
773
789
|
}
|
|
774
790
|
disableSSGI() {
|
|
775
|
-
this.#i = !1, this.#
|
|
791
|
+
this.#i = !1, this.#p = null, this.#e();
|
|
776
792
|
}
|
|
777
793
|
updateSSGI(e) {
|
|
778
|
-
if (Object.assign(this.#
|
|
779
|
-
const t = this.#
|
|
794
|
+
if (Object.assign(this.#t, e), this.#p) {
|
|
795
|
+
const t = this.#p;
|
|
780
796
|
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);
|
|
781
797
|
}
|
|
782
798
|
}
|
|
783
799
|
enableTRAA() {
|
|
784
|
-
this.#
|
|
800
|
+
this.#c = !0, this.#e();
|
|
785
801
|
}
|
|
786
802
|
disableTRAA() {
|
|
787
|
-
this.#
|
|
803
|
+
this.#c = !1, this.#h = null, this.#e();
|
|
788
804
|
}
|
|
789
|
-
#
|
|
805
|
+
#e() {
|
|
790
806
|
const e = this.scenePass;
|
|
791
|
-
this.scenePass = de(this.scene, this.camera), this.#
|
|
807
|
+
this.scenePass = de(this.scene, this.camera), this.#g(), this.needsUpdateOutputNode = !0, e.dispose();
|
|
792
808
|
}
|
|
793
|
-
#
|
|
794
|
-
if (this.#
|
|
809
|
+
#g() {
|
|
810
|
+
if (this.#n || this.#i || this.#c || this.#r.size > 0) {
|
|
795
811
|
const t = { output: $t };
|
|
796
|
-
this.#s
|
|
812
|
+
this.#r.forEach((s, n) => {
|
|
813
|
+
n !== "output" && (t[n] = s);
|
|
814
|
+
}), this.#n && (t.emissive = Kt), this.#i && (t.normal = Qt), this.#c && (t.velocity = Xt), this.scenePass.setMRT(Gt(t));
|
|
797
815
|
}
|
|
798
816
|
}
|
|
799
|
-
#
|
|
800
|
-
for (const e of this.#
|
|
817
|
+
#y() {
|
|
818
|
+
for (const e of this.#s)
|
|
801
819
|
e.dispose();
|
|
802
|
-
this.#
|
|
820
|
+
this.#s = [];
|
|
803
821
|
}
|
|
804
|
-
#
|
|
822
|
+
#w() {
|
|
805
823
|
let e = this.scenePass.getTextureNode();
|
|
806
824
|
if (this.#i)
|
|
807
825
|
if (!(this.camera instanceof J))
|
|
808
826
|
console.warn("RenderPipeline: SSGI requires a PerspectiveCamera, skipping.");
|
|
809
827
|
else {
|
|
810
828
|
const t = this.scenePass.getTextureNode(), s = this.scenePass.getTextureNode("depth"), n = this.scenePass.getTextureNode("normal"), i = Vt(t, s, n, this.camera);
|
|
811
|
-
i.sliceCount.value = this.#
|
|
829
|
+
i.sliceCount.value = this.#t.sliceCount, i.stepCount.value = this.#t.stepCount, i.aoIntensity.value = this.#t.aoIntensity, i.giIntensity.value = this.#t.giIntensity, i.radius.value = this.#t.radius, i.thickness.value = this.#t.thickness, this.#p = i, e = be(e, i), this.#s.push(i);
|
|
812
830
|
}
|
|
813
|
-
if (this.#
|
|
831
|
+
if (this.#n) {
|
|
814
832
|
const t = this.scenePass.getTextureNode("emissive");
|
|
815
|
-
this.#
|
|
833
|
+
this.#d = Jt(
|
|
816
834
|
t,
|
|
817
|
-
this.#
|
|
818
|
-
this.#
|
|
819
|
-
this.#
|
|
820
|
-
), e = be(e, this.#
|
|
835
|
+
this.#a.strength,
|
|
836
|
+
this.#a.radius,
|
|
837
|
+
this.#a.threshold
|
|
838
|
+
), e = be(e, this.#d), this.#s.push(this.#d);
|
|
821
839
|
}
|
|
822
840
|
return e;
|
|
823
841
|
}
|
|
824
|
-
#
|
|
825
|
-
this.#
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
this.#
|
|
832
|
-
|
|
833
|
-
|
|
842
|
+
#v(e) {
|
|
843
|
+
e ? (this.#m || (this.#f = this.outputColorTransform), this.outputColorTransform = !1) : this.#m && (this.outputColorTransform = this.#f), this.#m = e;
|
|
844
|
+
}
|
|
845
|
+
#b() {
|
|
846
|
+
this.#y();
|
|
847
|
+
let e, t = !1, s = !1;
|
|
848
|
+
const n = this.#u !== null;
|
|
849
|
+
if (n ? e = this.#u(this.scenePass) : this.#n || this.#i ? e = this.#w() : e = this.#l.size > 0 ? this.scenePass.getTextureNode() : this.scenePass, n || this.#l.forEach((i) => {
|
|
850
|
+
t ||= i.includesTemporalAntialias === !0, s ||= i.includesOutputTransform === !0, e = i(this.scenePass, e);
|
|
851
|
+
}), this.#v(s), this.#c && !t) {
|
|
852
|
+
const i = this.scenePass.getTextureNode("depth"), r = this.scenePass.getTextureNode("velocity");
|
|
853
|
+
this.#h = Zt(e, i, r, this.camera), this.#s.push(this.#h), e = this.#h;
|
|
854
|
+
} else
|
|
855
|
+
this.#h = null;
|
|
856
|
+
this.#o.size > 0 && this.#o.forEach((i) => {
|
|
857
|
+
const r = Wt(e, i);
|
|
858
|
+
this.#s.push(r), e = r;
|
|
834
859
|
}), this.outputNode = e, this.needsUpdate = !0;
|
|
835
860
|
}
|
|
836
861
|
render() {
|
|
837
|
-
this.needsUpdateOutputNode && (this.#
|
|
862
|
+
this.needsUpdateOutputNode && (this.#b(), this.needsUpdateOutputNode = !1), super.render();
|
|
838
863
|
}
|
|
839
864
|
dispose() {
|
|
840
|
-
this.#
|
|
865
|
+
this.#y(), this.scenePass.dispose(), super.dispose();
|
|
841
866
|
}
|
|
842
867
|
}
|
|
843
868
|
const vs = {
|
|
844
|
-
Vector2:
|
|
869
|
+
Vector2: C,
|
|
845
870
|
Vector3: w,
|
|
846
871
|
Vector4: ht,
|
|
847
872
|
Quaternion: ct,
|
|
848
873
|
Matrix4: Ie,
|
|
849
|
-
Spherical:
|
|
874
|
+
Spherical: S,
|
|
850
875
|
Box3: X,
|
|
851
876
|
Sphere: ze,
|
|
852
877
|
Raycaster: Be
|
|
@@ -937,26 +962,26 @@ class bs extends He {
|
|
|
937
962
|
}
|
|
938
963
|
}
|
|
939
964
|
const _e = {
|
|
940
|
-
LEFT: new
|
|
941
|
-
RIGHT: new
|
|
942
|
-
FRONT: new
|
|
943
|
-
BACK: new
|
|
944
|
-
TOP: new
|
|
945
|
-
BOTTOM: new
|
|
946
|
-
FRONTTOP: new
|
|
947
|
-
BACKTOP: new
|
|
948
|
-
LEFTTOP: new
|
|
949
|
-
RIGHTTOP: new
|
|
950
|
-
LEFTFRONTTOP: new
|
|
951
|
-
RIGHTFRONTTOP: new
|
|
952
|
-
LEFTBACKTOP: new
|
|
953
|
-
RIGHTBACKTOP: new
|
|
965
|
+
LEFT: new S(0, Math.PI / 2, -Math.PI / 2),
|
|
966
|
+
RIGHT: new S(0, Math.PI / 2, Math.PI / 2),
|
|
967
|
+
FRONT: new S(0, Math.PI / 2, 0),
|
|
968
|
+
BACK: new S(0, Math.PI / 2, Math.PI),
|
|
969
|
+
TOP: new S(0, 0, 0),
|
|
970
|
+
BOTTOM: new S(0, Math.PI, 0),
|
|
971
|
+
FRONTTOP: new S(0, Math.PI / 4, 0),
|
|
972
|
+
BACKTOP: new S(0, Math.PI / 4, Math.PI),
|
|
973
|
+
LEFTTOP: new S(0, Math.PI / 4, -Math.PI / 2),
|
|
974
|
+
RIGHTTOP: new S(0, Math.PI / 4, Math.PI / 2),
|
|
975
|
+
LEFTFRONTTOP: new S(0, Math.PI / 4, -Math.PI / 4),
|
|
976
|
+
RIGHTFRONTTOP: new S(0, Math.PI / 4, Math.PI / 4),
|
|
977
|
+
LEFTBACKTOP: new S(0, Math.PI / 4, -Math.PI / 4 * 3),
|
|
978
|
+
RIGHTBACKTOP: new S(0, Math.PI / 4, Math.PI / 4 * 3)
|
|
954
979
|
};
|
|
955
980
|
function xs(h, e) {
|
|
956
981
|
const t = h - e;
|
|
957
982
|
return lt.euclideanModulo(t + Math.PI, Math.PI * 2) - Math.PI;
|
|
958
983
|
}
|
|
959
|
-
class
|
|
984
|
+
class Cs {
|
|
960
985
|
environment = new es();
|
|
961
986
|
renderer;
|
|
962
987
|
pmremGenerator;
|
|
@@ -972,7 +997,7 @@ class Ss {
|
|
|
972
997
|
}
|
|
973
998
|
}
|
|
974
999
|
const Y = 128;
|
|
975
|
-
class
|
|
1000
|
+
class Ss extends ts {
|
|
976
1001
|
viewer;
|
|
977
1002
|
overlayPass;
|
|
978
1003
|
constructor(e) {
|
|
@@ -1071,7 +1096,7 @@ class Es {
|
|
|
1071
1096
|
}
|
|
1072
1097
|
}
|
|
1073
1098
|
ut.enabled = !0;
|
|
1074
|
-
class
|
|
1099
|
+
class Cn extends Le {
|
|
1075
1100
|
el;
|
|
1076
1101
|
renderer;
|
|
1077
1102
|
scene;
|
|
@@ -1088,7 +1113,7 @@ class Sn extends Le {
|
|
|
1088
1113
|
frameCount = 1;
|
|
1089
1114
|
frameloop = "demand";
|
|
1090
1115
|
constructor({ el: e, rendererOptions: t }) {
|
|
1091
|
-
super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new Es(this.el, this.renderer), this.controls = new bs(this.camera, this.renderer.domElement), this.renderPipeline = new ws(this.renderer, this.scene, this.camera), this.timer = new mt(), this.roomEnvironment = new
|
|
1116
|
+
super(), this.el = e, this.renderer = this._initRenderer(t), this.scene = this.createScene(), this.camera = this.createPerspectiveCamera(), this.info = new Es(this.el, this.renderer), this.controls = new bs(this.camera, this.renderer.domElement), this.renderPipeline = new ws(this.renderer, this.scene, this.camera), this.timer = new mt(), this.roomEnvironment = new Cs(this.renderer), this.interactionManager = new gs(this.renderer.domElement, this.scene, this.camera), this.objectManager = new ys(), this.viewerHelper = new Ss(this), this.cssRenderer = new Ts(this.el), window.addEventListener("resize", this.onWindowResize);
|
|
1092
1117
|
}
|
|
1093
1118
|
onWindowResize = () => {
|
|
1094
1119
|
const e = this.el.clientWidth, t = this.el.clientHeight;
|
|
@@ -1119,14 +1144,14 @@ class Sn extends Le {
|
|
|
1119
1144
|
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 }));
|
|
1120
1145
|
};
|
|
1121
1146
|
_initRenderer(e) {
|
|
1122
|
-
const t = new
|
|
1147
|
+
const t = new ft({
|
|
1123
1148
|
logarithmicDepthBuffer: !0,
|
|
1124
1149
|
antialias: !1,
|
|
1125
1150
|
depth: !1,
|
|
1126
1151
|
trackTimestamp: !0,
|
|
1127
1152
|
...e
|
|
1128
1153
|
});
|
|
1129
|
-
return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type =
|
|
1154
|
+
return t.setSize(this.el.clientWidth, this.el.clientHeight), t.shadowMap.enabled = !0, t.shadowMap.type = gt, t.toneMapping = yt, t.toneMappingExposure = 1, t.info.autoReset = !1, t.setPixelRatio(window.devicePixelRatio), t.setAnimationLoop(this.animate), this.el.appendChild(t.domElement), t;
|
|
1130
1155
|
}
|
|
1131
1156
|
createScene() {
|
|
1132
1157
|
const e = new Re();
|
|
@@ -1247,8 +1272,8 @@ function Ns(h) {
|
|
|
1247
1272
|
const d = e + Te, p = new Uint8Array(h, d), u = new Uint8Array(p.length);
|
|
1248
1273
|
for (let v = 0; v < p.length; v++)
|
|
1249
1274
|
u[v] = p[v] ^ c[l], l = (l + 1) % c.length;
|
|
1250
|
-
const
|
|
1251
|
-
return
|
|
1275
|
+
const f = new Uint8Array(r.length + o.length + u.length);
|
|
1276
|
+
return f.set(r), f.set(o, r.length), f.set(u, r.length + o.length), f.buffer;
|
|
1252
1277
|
}
|
|
1253
1278
|
}
|
|
1254
1279
|
function js(h) {
|
|
@@ -1309,11 +1334,11 @@ class Fs {
|
|
|
1309
1334
|
const p = e.getFloat32(t, this.littleEndian);
|
|
1310
1335
|
t += 4, t += 4, t += 4, t += 4, t += 4;
|
|
1311
1336
|
let u = e.getUint8(t);
|
|
1312
|
-
t += 1, u === 0 ? u = xt : u === 1 ? u =
|
|
1313
|
-
const
|
|
1337
|
+
t += 1, u === 0 ? u = xt : u === 1 ? u = Ct : u === 2 && (u = St);
|
|
1338
|
+
const f = e.getUint16(t, this.littleEndian);
|
|
1314
1339
|
t += 2;
|
|
1315
|
-
const v =
|
|
1316
|
-
if (t +=
|
|
1340
|
+
const v = f > 0 ? ks(e, f, t) : "";
|
|
1341
|
+
if (t += f, !this.materials.has(a)) {
|
|
1317
1342
|
const x = Us(a, [c, l, d, p, u], Hs(v));
|
|
1318
1343
|
this.materials.set(a, x), v && this.options.path && this.textureLoader.load(L.resolveURL(v, this.options.path), (y) => {
|
|
1319
1344
|
y.colorSpace = De, y.wrapS = ye, y.wrapT = ye, y.flipY = !1, y.anisotropy = 16, x.map = y;
|
|
@@ -1325,25 +1350,25 @@ class Fs {
|
|
|
1325
1350
|
t += 2;
|
|
1326
1351
|
const c = e.getUint16(t, this.littleEndian).toString();
|
|
1327
1352
|
t += 2;
|
|
1328
|
-
const l = [], d = [], p = [], u = [],
|
|
1329
|
-
if (t += 2,
|
|
1330
|
-
for (let
|
|
1353
|
+
const l = [], d = [], p = [], u = [], f = e.getUint16(t, this.littleEndian);
|
|
1354
|
+
if (t += 2, f > 0)
|
|
1355
|
+
for (let g = 0; g < f; g++) {
|
|
1331
1356
|
const b = new w();
|
|
1332
1357
|
b.setX(e.getFloat32(t, this.littleEndian)), t += 4, b.setY(e.getFloat32(t, this.littleEndian)), t += 4, b.setZ(e.getFloat32(t, this.littleEndian)), t += 4, l.push(b);
|
|
1333
1358
|
}
|
|
1334
1359
|
const v = e.getUint16(t, this.littleEndian);
|
|
1335
1360
|
if (t += 2, v > 0)
|
|
1336
|
-
for (let
|
|
1361
|
+
for (let g = 0; g < v; g++)
|
|
1337
1362
|
t += 4, t += 4, t += 4;
|
|
1338
1363
|
const _ = e.getUint16(t, this.littleEndian);
|
|
1339
1364
|
if (t += 2, _ > 0)
|
|
1340
|
-
for (let
|
|
1341
|
-
const b = new
|
|
1365
|
+
for (let g = 0; g < _; g++) {
|
|
1366
|
+
const b = new C();
|
|
1342
1367
|
b.setX(e.getFloat32(t, this.littleEndian)), t += 4, b.setY(e.getFloat32(t, this.littleEndian)), t += 4, d.push(b);
|
|
1343
1368
|
}
|
|
1344
1369
|
const x = e.getUint16(t, this.littleEndian);
|
|
1345
1370
|
if (t += 2, x > 0)
|
|
1346
|
-
for (let
|
|
1371
|
+
for (let g = 0; g < x; g++) {
|
|
1347
1372
|
const b = e.getUint16(t, this.littleEndian);
|
|
1348
1373
|
t += 2;
|
|
1349
1374
|
const z = e.getUint16(t, this.littleEndian);
|
|
@@ -1354,17 +1379,17 @@ class Fs {
|
|
|
1354
1379
|
p.push(P), d.length > 0 && u.push([d[P[0]], d[P[1]], d[P[2]]]);
|
|
1355
1380
|
}
|
|
1356
1381
|
const y = [], T = [];
|
|
1357
|
-
for (let
|
|
1358
|
-
const b = p[
|
|
1382
|
+
for (let g = 0; g < p.length; g++) {
|
|
1383
|
+
const b = p[g], z = l[b[0]], N = l[b[1]], P = l[b[2]];
|
|
1359
1384
|
y.push(...z.toArray(), ...N.toArray(), ...P.toArray());
|
|
1360
|
-
let q = new
|
|
1361
|
-
const U = u[
|
|
1385
|
+
let q = new C(), $ = new C(), k = new C();
|
|
1386
|
+
const U = u[g];
|
|
1362
1387
|
U !== void 0 && (q = U[0], $ = U[1], k = U[2]), T.push(...q.toArray(), ...$.toArray(), ...k.toArray());
|
|
1363
1388
|
}
|
|
1364
1389
|
const O = new Float32Array(y), A = new Float32Array(T), E = new K();
|
|
1365
1390
|
if (O.length > 0 && E.setAttribute("position", new we(O, 3)), A.length > 0 && E.setAttribute("uv", new we(A, 2)), E.computeVertexNormals(), this.materials.has(c)) {
|
|
1366
|
-
const
|
|
1367
|
-
|
|
1391
|
+
const g = new D(E, this.materials.get(c));
|
|
1392
|
+
g.name = a, g.castShadow = !0, g.receiveShadow = !0, n.add(g);
|
|
1368
1393
|
}
|
|
1369
1394
|
}
|
|
1370
1395
|
s(n);
|
|
@@ -1553,7 +1578,7 @@ class j {
|
|
|
1553
1578
|
}
|
|
1554
1579
|
}
|
|
1555
1580
|
}
|
|
1556
|
-
class
|
|
1581
|
+
class Sn {
|
|
1557
1582
|
static textureLoader = new je();
|
|
1558
1583
|
static hdrLoader = new ps();
|
|
1559
1584
|
static cubeTextureLoader = new Mt();
|
|
@@ -1945,33 +1970,33 @@ class _n extends Ws {
|
|
|
1945
1970
|
n.font = `${this.parameters.fontSize}px ${this.parameters.fontFamily}`;
|
|
1946
1971
|
let i = null;
|
|
1947
1972
|
this.parameters.img && (i = await this._loadImage(this.parameters.img));
|
|
1948
|
-
const { text: r, fontSize: o, color: a, iconSize: c, padding: l, backgroundColor: d, borderRadius: p, textPosition: u, scaleFactor:
|
|
1949
|
-
let y = 0, T = 0, O = 0, A = 0, E = 0,
|
|
1973
|
+
const { text: r, fontSize: o, color: a, iconSize: c, padding: l, backgroundColor: d, borderRadius: p, textPosition: u, scaleFactor: f } = this.parameters, v = n.measureText(r), _ = r ? v.width : 0, x = r ? o : 0;
|
|
1974
|
+
let y = 0, T = 0, O = 0, A = 0, E = 0, g = 0;
|
|
1950
1975
|
const b = !!i, z = !!r;
|
|
1951
1976
|
if (b && z)
|
|
1952
1977
|
switch (u) {
|
|
1953
1978
|
case "top":
|
|
1954
|
-
y = Math.max(c, _), T = c + l + x, E = (y - _) / 2,
|
|
1979
|
+
y = Math.max(c, _), T = c + l + x, E = (y - _) / 2, g = x / 2, O = (y - c) / 2, A = x + l;
|
|
1955
1980
|
break;
|
|
1956
1981
|
case "bottom":
|
|
1957
|
-
y = Math.max(c, _), T = c + l + x, O = (y - c) / 2, A = 0, E = (y - _) / 2,
|
|
1982
|
+
y = Math.max(c, _), T = c + l + x, O = (y - c) / 2, A = 0, E = (y - _) / 2, g = c + l + x / 2;
|
|
1958
1983
|
break;
|
|
1959
1984
|
case "left":
|
|
1960
|
-
y = c + l + _, T = Math.max(c, x), E = 0,
|
|
1985
|
+
y = c + l + _, T = Math.max(c, x), E = 0, g = T / 2, O = _ + l, A = (T - c) / 2;
|
|
1961
1986
|
break;
|
|
1962
1987
|
default:
|
|
1963
|
-
y = c + l + _, T = Math.max(c, x), O = 0, A = (T - c) / 2, E = c + l,
|
|
1988
|
+
y = c + l + _, T = Math.max(c, x), O = 0, A = (T - c) / 2, E = c + l, g = T / 2;
|
|
1964
1989
|
break;
|
|
1965
1990
|
}
|
|
1966
|
-
else b ? (y = c, T = c, O = 0, A = 0) : z && (y = _, T = x, E = 0,
|
|
1991
|
+
else b ? (y = c, T = c, O = 0, A = 0) : z && (y = _, T = x, E = 0, g = x / 2);
|
|
1967
1992
|
const N = y + l * 2, P = T + l * 2;
|
|
1968
1993
|
if (s.width = N, s.height = P, n.font = `${o}px ${this.parameters.fontFamily}`, d && (n.fillStyle = d, this._drawRoundedRect(n, 0, 0, N, P, p), n.fill()), b && n.drawImage(i, O + l, A + l, c, c), z) {
|
|
1969
1994
|
n.fillStyle = a;
|
|
1970
1995
|
const k = n.measureText(r), U = k.actualBoundingBoxAscent + k.actualBoundingBoxDescent, et = k.actualBoundingBoxAscent - U / 2;
|
|
1971
|
-
n.textBaseline = "alphabetic", n.fillText(r, E + l,
|
|
1996
|
+
n.textBaseline = "alphabetic", n.fillText(r, E + l, g + l + et);
|
|
1972
1997
|
}
|
|
1973
1998
|
const q = this.material.map, $ = new zt(s);
|
|
1974
|
-
$.colorSpace = De, this.material.map = $, q?.dispose(), this.scale.set(N *
|
|
1999
|
+
$.colorSpace = De, this.material.map = $, q?.dispose(), this.scale.set(N * f, P * f, 1);
|
|
1975
2000
|
}
|
|
1976
2001
|
_loadImage(e) {
|
|
1977
2002
|
return new Promise((t, s) => {
|
|
@@ -2000,7 +2025,7 @@ class Ke extends G {
|
|
|
2000
2025
|
...t,
|
|
2001
2026
|
geometryParameters: {
|
|
2002
2027
|
...t.geometryParameters,
|
|
2003
|
-
shape: new ke(e.map((s) => new
|
|
2028
|
+
shape: new ke(e.map((s) => new C(s.x, -s.z)))
|
|
2004
2029
|
}
|
|
2005
2030
|
});
|
|
2006
2031
|
}
|
|
@@ -2016,7 +2041,7 @@ class Qe extends G {
|
|
|
2016
2041
|
...t,
|
|
2017
2042
|
geometryParameters: {
|
|
2018
2043
|
...t.geometryParameters,
|
|
2019
|
-
shape: new ke(e?.map((s) => new
|
|
2044
|
+
shape: new ke(e?.map((s) => new C(s.x, -s.z)))
|
|
2020
2045
|
}
|
|
2021
2046
|
});
|
|
2022
2047
|
}
|
|
@@ -2072,15 +2097,15 @@ class Pn {
|
|
|
2072
2097
|
scale: i = 1,
|
|
2073
2098
|
intensity: r = 1,
|
|
2074
2099
|
distortion: o = 0.5
|
|
2075
|
-
} = e, a = H(new M(t)), c = H(new M(s)), l = xe().mul(i), d = te.mul(n), p =
|
|
2100
|
+
} = e, a = H(new M(t)), c = H(new M(s)), l = xe().mul(i), d = te.mul(n), p = Ce(l.add(d), 1, 0), u = l.add(p.mul(o)), f = Ce(u, 1, 0).add(1).mul(0.5), v = se(f, r);
|
|
2076
2101
|
return ne(a, c, v);
|
|
2077
2102
|
}
|
|
2078
2103
|
}
|
|
2079
2104
|
function On(h) {
|
|
2080
2105
|
}
|
|
2081
2106
|
const he = "uSpaceHighlight", Q = `${he}/enabled`, Xe = `${he}/opacity`, qe = `${he}/color`, Ye = `${he}/overwrite`, le = "uSpaceBreathe", ae = `${le}/enabled`, Je = `${le}/color`, Ve = `${le}/speed`, Ze = `${le}/intensity`, ce = /* @__PURE__ */ new WeakMap(), Qs = Ue(() => {
|
|
2082
|
-
const h = B(Q, "uint"), e = B(qe, "uint"), t = B(Ye, "uint"), s = Ae(e), n =
|
|
2083
|
-
return ie(o.greaterThan(0),
|
|
2107
|
+
const h = B(Q, "uint"), e = B(qe, "uint"), t = B(Ye, "uint"), s = Ae(e), n = Se.mul(s), i = ie(t.greaterThan(0), s, n), r = ie(h.greaterThan(0), i, Se), o = B(ae, "uint"), a = B(Je, "uint"), c = B(Ve, "float"), l = B(Ze, "float"), d = Ae(a), p = pe(te.mul(c)).add(1).mul(0.5), u = se(p, l), f = ne(r, d, u);
|
|
2108
|
+
return ie(o.greaterThan(0), f, r);
|
|
2084
2109
|
})(), Xs = Ue(() => {
|
|
2085
2110
|
const h = B(Q, "uint"), e = B(Xe, "float");
|
|
2086
2111
|
return ie(h.greaterThan(0), e, qt);
|
|
@@ -2194,14 +2219,14 @@ class oe {
|
|
|
2194
2219
|
cancelAnimationFrame(c), o();
|
|
2195
2220
|
return;
|
|
2196
2221
|
}
|
|
2197
|
-
for (const { material:
|
|
2198
|
-
|
|
2222
|
+
for (const { material: f, targetOpacity: v } of r)
|
|
2223
|
+
f.opacity = t + (v - t) * p, f.needsUpdate = !0;
|
|
2199
2224
|
if (p < 1)
|
|
2200
2225
|
c = requestAnimationFrame(l);
|
|
2201
2226
|
else {
|
|
2202
2227
|
if (s >= 1)
|
|
2203
|
-
for (const { material:
|
|
2204
|
-
|
|
2228
|
+
for (const { material: f } of r)
|
|
2229
|
+
f.transparent = !1;
|
|
2205
2230
|
o();
|
|
2206
2231
|
}
|
|
2207
2232
|
};
|
|
@@ -2234,8 +2259,8 @@ class qs extends ms {
|
|
|
2234
2259
|
}
|
|
2235
2260
|
function An(h, e, t, s = {}, n, i) {
|
|
2236
2261
|
return new Promise((r, o) => {
|
|
2237
|
-
const { duration: a = 1e3, delay: c = 0, repeat: l = !1, mode: d = "Linear.None", yoyo: p = !1 } = s, u = new qs(h, e).to(t, a).easingByMode(d).delay(c).onUpdate((
|
|
2238
|
-
n?.(
|
|
2262
|
+
const { duration: a = 1e3, delay: c = 0, repeat: l = !1, mode: d = "Linear.None", yoyo: p = !1 } = s, u = new qs(h, e).to(t, a).easingByMode(d).delay(c).onUpdate((f) => {
|
|
2263
|
+
n?.(f, u);
|
|
2239
2264
|
}).onComplete(() => {
|
|
2240
2265
|
r();
|
|
2241
2266
|
}).onStop(() => {
|
|
@@ -2471,17 +2496,17 @@ class Ln {
|
|
|
2471
2496
|
* Measure the angle between three points (vertex at the middle point).
|
|
2472
2497
|
*/
|
|
2473
2498
|
measureAngle(e, t, s, n = {}) {
|
|
2474
|
-
const { lineColor: i = 16746496 } = n, r = new w(e.x, e.y, e.z), o = new w(t.x, t.y, t.z), a = new w(s.x, s.y, s.z), c = r.clone().sub(o).normalize(), l = a.clone().sub(o).normalize(), p = Math.acos(Math.max(-1, Math.min(1, c.dot(l)))) * 180 / Math.PI, u = `measure_angle_${this._idCounter++}`,
|
|
2475
|
-
|
|
2499
|
+
const { lineColor: i = 16746496 } = n, r = new w(e.x, e.y, e.z), o = new w(t.x, t.y, t.z), a = new w(s.x, s.y, s.z), c = r.clone().sub(o).normalize(), l = a.clone().sub(o).normalize(), p = Math.acos(Math.max(-1, Math.min(1, c.dot(l)))) * 180 / Math.PI, u = `measure_angle_${this._idCounter++}`, f = new I();
|
|
2500
|
+
f.name = u;
|
|
2476
2501
|
const v = new K().setFromPoints([r, o, a]), _ = new Z({ color: i }), x = new ee(v, _);
|
|
2477
|
-
|
|
2502
|
+
f.add(x), this.scene.add(f);
|
|
2478
2503
|
const y = {
|
|
2479
2504
|
id: u,
|
|
2480
2505
|
type: "angle",
|
|
2481
2506
|
value: p,
|
|
2482
2507
|
unit: "°",
|
|
2483
2508
|
points: [r, o, a],
|
|
2484
|
-
object:
|
|
2509
|
+
object: f
|
|
2485
2510
|
};
|
|
2486
2511
|
return this.measurements.set(u, y), y;
|
|
2487
2512
|
}
|
|
@@ -2685,7 +2710,7 @@ class In {
|
|
|
2685
2710
|
this.removeAll();
|
|
2686
2711
|
}
|
|
2687
2712
|
}
|
|
2688
|
-
const Js = "0.0.
|
|
2713
|
+
const Js = "0.0.18";
|
|
2689
2714
|
window.__USPACE__ = { version: Js };
|
|
2690
2715
|
export {
|
|
2691
2716
|
In as AnnotationManager,
|
|
@@ -2700,8 +2725,8 @@ export {
|
|
|
2700
2725
|
En as CircleMesh,
|
|
2701
2726
|
Bn as ClippingTool,
|
|
2702
2727
|
Qe as ExtrudeMesh,
|
|
2703
|
-
|
|
2704
|
-
|
|
2728
|
+
fs as InteractionEvent,
|
|
2729
|
+
gs as InteractionManager,
|
|
2705
2730
|
xn as LightManager,
|
|
2706
2731
|
oe as MaterialEffects,
|
|
2707
2732
|
Ln as MeasureTool,
|
|
@@ -2712,7 +2737,7 @@ export {
|
|
|
2712
2737
|
Tn as PlaneMesh,
|
|
2713
2738
|
_n as Poi,
|
|
2714
2739
|
ws as RenderPipeline,
|
|
2715
|
-
|
|
2740
|
+
Cs as RoomEnvironment,
|
|
2716
2741
|
Gs as SBMLoader,
|
|
2717
2742
|
Ps as SBMXLoader,
|
|
2718
2743
|
bn as SceneManager,
|
|
@@ -2720,11 +2745,11 @@ export {
|
|
|
2720
2745
|
Ke as ShapeMesh,
|
|
2721
2746
|
Ks as SphereMesh,
|
|
2722
2747
|
Pn as TSLEffects,
|
|
2723
|
-
|
|
2748
|
+
Sn as TextureLoaderManager,
|
|
2724
2749
|
Mn as Topology,
|
|
2725
2750
|
Ee as TubeMesh,
|
|
2726
2751
|
qs as Tween,
|
|
2727
|
-
|
|
2752
|
+
Cn as Viewer,
|
|
2728
2753
|
On as reinterpretType,
|
|
2729
2754
|
An as tweenAnimation,
|
|
2730
2755
|
Js as version
|