u-space 0.0.18 → 0.0.21
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 +1 -1
- package/dist/index.js +1 -1
- package/dist/plugins/atmosphere/index.cjs +1 -1
- package/dist/plugins/atmosphere/index.js +98 -109
- package/dist/plugins/tiles/ArcgisTilesRenderer.d.ts +11 -0
- package/dist/plugins/tiles/index.cjs +1 -1
- package/dist/plugins/tiles/index.js +62 -52
- package/dist/plugins/u-manager/index.cjs +43 -43
- package/dist/plugins/u-manager/index.js +7986 -7662
- package/dist/plugins/u-manager/semantics/SemanticLoader.d.ts +1 -1
- package/dist/plugins/u-manager/semantics/SemanticParser.d.ts +1 -1
- package/dist/plugins/u-manager/semantics/index.d.ts +5 -2
- package/dist/plugins/u-manager/semantics/{BuildingGroup.d.ts → objects/BuildingGroup.d.ts} +11 -1
- package/dist/plugins/u-manager/semantics/objects/ElevatorMesh.d.ts +8 -0
- package/dist/plugins/u-manager/semantics/{FloorMesh.d.ts → objects/FloorMesh.d.ts} +2 -1
- package/dist/plugins/u-manager/semantics/objects/VentMesh.d.ts +8 -0
- package/dist/plugins/u-manager/semantics/objects/VerticalShaftMesh.d.ts +25 -0
- package/dist/plugins/u-manager/semantics/semantic.types.d.ts +28 -0
- package/dist/plugins/u-manager/semantics/types.d.ts +1 -1
- package/docs/api-plugin-atmosphere.md +20 -8
- package/docs/api-plugin-tiles.md +38 -6
- package/docs/api-plugin-u-manager.md +28 -3
- package/docs/changelog.md +29 -0
- package/docs/examples-guide.md +2 -1
- package/docs/index.md +2 -2
- package/docs/mcp.md +1 -1
- package/package.json +1 -1
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { NodeMaterial as M, MeshBasicNodeMaterial as
|
|
2
|
-
import { TilesRenderer as
|
|
3
|
-
import { TilesFadePlugin as
|
|
4
|
-
import { FadeMaterialManager as
|
|
1
|
+
import { NodeMaterial as M, MeshBasicNodeMaterial as P, Mesh as d, Matrix4 as R, Vector3 as u, MathUtils as n } from "three/webgpu";
|
|
2
|
+
import { TilesRenderer as w } from "3d-tiles-renderer";
|
|
3
|
+
import { TilesFadePlugin as E, TileCompressionPlugin as y, UpdateOnChangePlugin as _, ReorientationPlugin as x, XYZTilesPlugin as F } from "3d-tiles-renderer/plugins";
|
|
4
|
+
import { FadeMaterialManager as L } from "3d-tiles-renderer/src/three/plugins/fade/FadeMaterialManager.js";
|
|
5
5
|
import { wrapFadeMaterial as b } from "3d-tiles-renderer/src/three/plugins/fade/wrapFadeMaterial.js";
|
|
6
|
-
import { uniform as
|
|
7
|
-
import { reinterpretType as
|
|
8
|
-
import { FnLayout as
|
|
9
|
-
const
|
|
6
|
+
import { uniform as f, Fn as C, screenCoordinate as D, If as h, Discard as p, output as A } from "three/tsl";
|
|
7
|
+
import { reinterpretType as l } from "@takram/three-geospatial";
|
|
8
|
+
import { FnLayout as T } from "@takram/three-geospatial/webgpu";
|
|
9
|
+
const g = /* @__PURE__ */ Symbol("FADE_PARAMS"), c = T({
|
|
10
10
|
name: "bayerDither2x2",
|
|
11
11
|
type: "float",
|
|
12
12
|
inputs: [{ name: "v", type: "vec2" }]
|
|
13
|
-
})(([t]) => (
|
|
13
|
+
})(([t]) => (l(t), t.y.mul(3).add(t.x.mul(2)).mod(4))), O = T({
|
|
14
14
|
name: "bayerDither4x4",
|
|
15
15
|
type: "float",
|
|
16
16
|
inputs: [{ name: "v", type: "vec2" }]
|
|
17
17
|
})(([t]) => {
|
|
18
|
-
|
|
18
|
+
l(t);
|
|
19
19
|
const e = t.mod(2), i = t.mod(4).mul(0.5).floor();
|
|
20
|
-
return
|
|
21
|
-
}),
|
|
20
|
+
return c(e).mul(4).add(c(i));
|
|
21
|
+
}), S = f(0).onObjectUpdate(
|
|
22
22
|
({ material: t }) => t != null ? t?.params?.fadeIn.value ?? 0 : 0
|
|
23
|
-
),
|
|
23
|
+
), U = f(0).onObjectUpdate(
|
|
24
24
|
({ material: t }) => t != null ? t?.params?.fadeOut.value ?? 0 : 0
|
|
25
|
-
),
|
|
26
|
-
const i =
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
}),
|
|
30
|
-
|
|
25
|
+
), H = C(() => {
|
|
26
|
+
const i = O(D.xy.mod(4).floor()).add(0.5).div(16);
|
|
27
|
+
return h(i.greaterThanEqual(S), () => {
|
|
28
|
+
p();
|
|
29
|
+
}), h(i.lessThan(U), () => {
|
|
30
|
+
p();
|
|
31
31
|
}), A;
|
|
32
32
|
})();
|
|
33
|
-
function
|
|
34
|
-
if (
|
|
35
|
-
return t[
|
|
33
|
+
function W(t) {
|
|
34
|
+
if (l(t), t[g] != null)
|
|
35
|
+
return t[g];
|
|
36
36
|
const e = {
|
|
37
37
|
fadeIn: { value: 0 },
|
|
38
38
|
fadeOut: { value: 0 },
|
|
@@ -43,54 +43,54 @@ function U(t) {
|
|
|
43
43
|
get FEATURE_FADE() {
|
|
44
44
|
return i;
|
|
45
45
|
},
|
|
46
|
-
set FEATURE_FADE(
|
|
47
|
-
|
|
46
|
+
set FEATURE_FADE(s) {
|
|
47
|
+
s !== i && (i = s, t.outputNode = s === 1 ? H : null);
|
|
48
48
|
}
|
|
49
49
|
}, e;
|
|
50
50
|
}
|
|
51
|
-
class
|
|
51
|
+
class I extends L {
|
|
52
52
|
// HACK: Override "wrapFadeMaterial" to support NodeMaterial:
|
|
53
53
|
prepareMaterial(e) {
|
|
54
54
|
const i = this._fadeParams;
|
|
55
55
|
if (i.has(e))
|
|
56
56
|
return;
|
|
57
|
-
let
|
|
58
|
-
e instanceof M ?
|
|
57
|
+
let s;
|
|
58
|
+
e instanceof M ? s = W(e) : s = b(e, e.onBeforeCompile), i.set(e, s);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
class
|
|
61
|
+
class N extends E {
|
|
62
62
|
constructor(...e) {
|
|
63
|
-
super(...e), this._fadeMaterialManager = new
|
|
63
|
+
super(...e), this._fadeMaterialManager = new I();
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function m(t, e) {
|
|
67
67
|
const i = t.material;
|
|
68
68
|
if (Array.isArray(i))
|
|
69
69
|
throw new Error("Multiple materials are not supported yet.");
|
|
70
|
-
const
|
|
71
|
-
"map" in i && i.map != null && "map" in
|
|
70
|
+
const s = new e();
|
|
71
|
+
"map" in i && i.map != null && "map" in s && (l(i.map), l(s.map), i.map.flipY = !1, s.map = i.map.clone()), t.material = s, i.dispose();
|
|
72
72
|
}
|
|
73
|
-
class
|
|
73
|
+
class z {
|
|
74
74
|
tiles;
|
|
75
75
|
overrideMaterial;
|
|
76
|
-
constructor(e =
|
|
76
|
+
constructor(e = P) {
|
|
77
77
|
this.overrideMaterial = e;
|
|
78
78
|
}
|
|
79
79
|
// Plugin method
|
|
80
80
|
init(e) {
|
|
81
81
|
this.tiles = e, e.group.traverse((i) => {
|
|
82
|
-
i instanceof
|
|
82
|
+
i instanceof d && m(i, this.overrideMaterial);
|
|
83
83
|
}), e.addEventListener("load-model", this.handleLoadModel), e.addEventListener("dispose-model", this.handleDisposeModel);
|
|
84
84
|
}
|
|
85
85
|
handleLoadModel = ({ scene: e }) => {
|
|
86
86
|
e.traverse((i) => {
|
|
87
|
-
i instanceof
|
|
87
|
+
i instanceof d && m(i, this.overrideMaterial);
|
|
88
88
|
});
|
|
89
89
|
};
|
|
90
90
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
91
91
|
handleDisposeModel = ({ scene: e }) => {
|
|
92
92
|
e.traverse((i) => {
|
|
93
|
-
i instanceof
|
|
93
|
+
i instanceof d && i.material.dispose();
|
|
94
94
|
});
|
|
95
95
|
};
|
|
96
96
|
// Plugin method
|
|
@@ -98,7 +98,7 @@ class N {
|
|
|
98
98
|
this.tiles?.removeEventListener("load-model", this.handleLoadModel), this.tiles?.removeEventListener("dispose-model", this.handleDisposeModel);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
class
|
|
101
|
+
class B {
|
|
102
102
|
tiles;
|
|
103
103
|
tileCompressionPlugin;
|
|
104
104
|
updateOnChangePlugin;
|
|
@@ -110,19 +110,19 @@ class z {
|
|
|
110
110
|
this.tiles = this._initTilesRenderer(), this.tileCompressionPlugin = this._initTileCompressionPlugin(), this.updateOnChangePlugin = this._initUpdateOnChangePlugin(), this.reorientationPlugin = this._initReorientationPlugin(), this.xyzTilesPlugin = this._initXYZTilesPlugin(), this.tilesFadePlugin = this._initTilesFadePlugin(), this.tileMaterialReplacementPlugin = this._initTileMaterialReplacementPlugin();
|
|
111
111
|
}
|
|
112
112
|
_initTilesRenderer() {
|
|
113
|
-
const e = new
|
|
113
|
+
const e = new w();
|
|
114
114
|
return e.maxDepth = 20, e.errorTarget = 1, e;
|
|
115
115
|
}
|
|
116
116
|
_initTileCompressionPlugin() {
|
|
117
|
-
const e = new
|
|
117
|
+
const e = new y();
|
|
118
118
|
return this.tiles.registerPlugin(e), e;
|
|
119
119
|
}
|
|
120
120
|
_initUpdateOnChangePlugin() {
|
|
121
|
-
const e = new
|
|
121
|
+
const e = new _();
|
|
122
122
|
return this.tiles.registerPlugin(e), e;
|
|
123
123
|
}
|
|
124
124
|
_initReorientationPlugin() {
|
|
125
|
-
const e = new
|
|
125
|
+
const e = new x();
|
|
126
126
|
return this.tiles.registerPlugin(e), e;
|
|
127
127
|
}
|
|
128
128
|
_initXYZTilesPlugin() {
|
|
@@ -134,17 +134,20 @@ class z {
|
|
|
134
134
|
return this.tiles.registerPlugin(e), e;
|
|
135
135
|
}
|
|
136
136
|
_initTilesFadePlugin() {
|
|
137
|
-
const e = new
|
|
137
|
+
const e = new N();
|
|
138
138
|
return this.tiles.registerPlugin(e), e;
|
|
139
139
|
}
|
|
140
140
|
_initTileMaterialReplacementPlugin() {
|
|
141
|
-
const e = new
|
|
141
|
+
const e = new z(P);
|
|
142
142
|
return this.tiles.registerPlugin(e), e;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class J extends B {
|
|
146
146
|
viewer;
|
|
147
147
|
loedTilesSets = /* @__PURE__ */ new Set();
|
|
148
|
+
gisOrigin = null;
|
|
149
|
+
_worldToEllipsoidMatrix = new R();
|
|
150
|
+
_ellipsoidPosition = new u();
|
|
148
151
|
constructor(e) {
|
|
149
152
|
super(), this.viewer = e, this.tiles.addEventListener("needs-render", this.render), this.tiles.addEventListener("needs-update", this.render);
|
|
150
153
|
}
|
|
@@ -160,20 +163,27 @@ class G extends z {
|
|
|
160
163
|
disable() {
|
|
161
164
|
return this.viewer.scene.remove(this.tiles.group), this.viewer.removeEventListener("beforeRender", this.beforeRenderHandler), this;
|
|
162
165
|
}
|
|
163
|
-
invalidate(e, i,
|
|
166
|
+
invalidate(e, i, s) {
|
|
164
167
|
const r = () => {
|
|
165
|
-
const
|
|
166
|
-
this.reorientationPlugin.transformLatLonHeightToOrigin(
|
|
167
|
-
},
|
|
168
|
+
const o = n.degToRad(i), v = n.degToRad(e);
|
|
169
|
+
this.reorientationPlugin.transformLatLonHeightToOrigin(o, v, s), this.gisOrigin = { lon: e, lat: i, height: s }, this.render(), a();
|
|
170
|
+
}, a = () => {
|
|
168
171
|
this.tiles.removeEventListener("load-root-tileset", r), this.loedTilesSets.delete(r);
|
|
169
172
|
};
|
|
170
|
-
return this.tiles.addEventListener("load-root-tileset", r), this.loedTilesSets.add(r), this.tiles.root && r(),
|
|
173
|
+
return this.tiles.addEventListener("load-root-tileset", r), this.loedTilesSets.add(r), this.tiles.root && r(), a;
|
|
174
|
+
}
|
|
175
|
+
lonLatHeightToPosition(e, i, s = 0, r = new u()) {
|
|
176
|
+
const a = n.degToRad(i), o = n.degToRad(e);
|
|
177
|
+
return this.tiles.ellipsoid.getCartographicToPosition(a, o, s, r), this.tiles.group.updateWorldMatrix(!0, !1), r.applyMatrix4(this.tiles.group.matrixWorld);
|
|
178
|
+
}
|
|
179
|
+
positionToLonLatHeight(e, i = { lon: 0, lat: 0, height: 0 }) {
|
|
180
|
+
return this.tiles.group.updateWorldMatrix(!0, !1), this._worldToEllipsoidMatrix.copy(this.tiles.group.matrixWorld).invert(), this._ellipsoidPosition.copy(e).applyMatrix4(this._worldToEllipsoidMatrix), this.tiles.ellipsoid.getPositionToCartographic(this._ellipsoidPosition, i), i.lon = n.radToDeg(i.lon), i.lat = n.radToDeg(i.lat), i;
|
|
171
181
|
}
|
|
172
182
|
dispose() {
|
|
173
183
|
this.disable(), this.loedTilesSets.forEach((e) => this.tiles.removeEventListener("load-root-tileset", e)), this.loedTilesSets.clear(), this.tiles.removeEventListener("needs-render", this.render), this.tiles.removeEventListener("needs-update", this.render), this.tiles.dispose();
|
|
174
184
|
}
|
|
175
185
|
}
|
|
176
186
|
export {
|
|
177
|
-
|
|
178
|
-
|
|
187
|
+
J as ArcgisTilesRenderer,
|
|
188
|
+
B as Globe
|
|
179
189
|
};
|