u-space 0.0.19 → 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 +7581 -7268
- 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 +12 -10
- package/docs/api-plugin-tiles.md +38 -6
- package/docs/api-plugin-u-manager.md +28 -3
- package/docs/changelog.md +11 -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,6 +1,6 @@
|
|
|
1
1
|
import { Loader } from 'three/webgpu';
|
|
2
2
|
import type { Viewer } from 'u-space';
|
|
3
|
-
import { BuildingGroup } from './BuildingGroup';
|
|
3
|
+
import { BuildingGroup } from './objects/BuildingGroup';
|
|
4
4
|
export declare class SemanticLoader extends Loader {
|
|
5
5
|
viewer: Viewer;
|
|
6
6
|
constructor(viewer: Viewer);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './semantic.types';
|
|
2
2
|
export * from './types';
|
|
3
|
-
export * from './FloorMesh';
|
|
4
|
-
export * from './
|
|
3
|
+
export * from './objects/FloorMesh';
|
|
4
|
+
export * from './objects/VerticalShaftMesh';
|
|
5
|
+
export * from './objects/ElevatorMesh';
|
|
6
|
+
export * from './objects/VentMesh';
|
|
7
|
+
export * from './objects/BuildingGroup';
|
|
5
8
|
export * from './SemanticParser';
|
|
6
9
|
export * from './SemanticLoader';
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { BaseGroup } from 'u-space';
|
|
2
|
+
import type { ElevatorMesh } from './ElevatorMesh';
|
|
2
3
|
import type { FloorMesh } from './FloorMesh';
|
|
3
|
-
import type { SemanticKind } from '
|
|
4
|
+
import type { SemanticKind } from '../types';
|
|
5
|
+
import type { VentMesh } from './VentMesh';
|
|
4
6
|
export declare class BuildingGroup extends BaseGroup {
|
|
5
7
|
isBuildingGroup: boolean;
|
|
6
8
|
type: string;
|
|
7
9
|
floorMeshes: FloorMesh[];
|
|
10
|
+
elevatorMeshes: ElevatorMesh[];
|
|
11
|
+
ventMeshes: VentMesh[];
|
|
8
12
|
constructor();
|
|
9
13
|
addFloor(mesh: FloorMesh): this;
|
|
10
14
|
getFloorAt(index: number): FloorMesh;
|
|
11
15
|
removeFloor(mesh: FloorMesh): this;
|
|
16
|
+
addElevator(mesh: ElevatorMesh): this;
|
|
17
|
+
getElevatorAt(index: number): ElevatorMesh;
|
|
18
|
+
removeElevator(mesh: ElevatorMesh): this;
|
|
19
|
+
addVent(mesh: VentMesh): this;
|
|
20
|
+
getVentAt(index: number): VentMesh;
|
|
21
|
+
removeVent(mesh: VentMesh): this;
|
|
12
22
|
isolateFloor(mesh: FloorMesh | number): this;
|
|
13
23
|
showAllFloors(): this;
|
|
14
24
|
planishFloors(kind?: SemanticKind): this;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Elevator } from '../semantic.types';
|
|
2
|
+
import { VerticalShaftMesh } from './VerticalShaftMesh';
|
|
3
|
+
export declare class ElevatorMesh extends VerticalShaftMesh<Elevator> {
|
|
4
|
+
readonly isElevatorMesh = true;
|
|
5
|
+
type: string;
|
|
6
|
+
constructor(elevator: Elevator);
|
|
7
|
+
static create(elevator: Elevator): ElevatorMesh | null;
|
|
8
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box3, BufferGeometry, Matrix4, MeshStandardNodeMaterial, Sphere, Vector3, Vector4, type Intersection, type Raycaster } from 'three/webgpu';
|
|
2
2
|
import { BaseMesh, type InteractionEvent, type InteractionEventMap } from 'u-space';
|
|
3
|
-
import type { SemanticColor, SemanticGeometryEntry, SemanticKind } from '
|
|
3
|
+
import type { SemanticColor, SemanticGeometryEntry, SemanticKind } from '../types';
|
|
4
4
|
type FloorMeshEventPayload<T> = T extends {
|
|
5
5
|
event: InteractionEvent;
|
|
6
6
|
} ? {
|
|
@@ -32,6 +32,7 @@ export declare class FloorMesh extends BaseMesh<BufferGeometry, MeshStandardNode
|
|
|
32
32
|
spacesInstances: Map<string, number>;
|
|
33
33
|
doorsInstances: Map<string, number>;
|
|
34
34
|
windowsInstances: Map<string, number>;
|
|
35
|
+
staircasesInstances: Map<string, number>;
|
|
35
36
|
semanticInstances: Map<string, number>;
|
|
36
37
|
constructor(entries: SemanticGeometryEntry[]);
|
|
37
38
|
planish(kind?: SemanticKind): this;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Vent } from '../semantic.types';
|
|
2
|
+
import { VerticalShaftMesh } from './VerticalShaftMesh';
|
|
3
|
+
export declare class VentMesh extends VerticalShaftMesh<Vent> {
|
|
4
|
+
readonly isVentMesh = true;
|
|
5
|
+
type: string;
|
|
6
|
+
constructor(vent: Vent);
|
|
7
|
+
static create(vent: Vent): VentMesh | null;
|
|
8
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ExtrudeMesh } from 'u-space';
|
|
2
|
+
import type { VerticalShaft } from '../semantic.types';
|
|
3
|
+
export type VerticalShaftKind = 'Elevators' | 'Vents';
|
|
4
|
+
export interface VerticalShaftMaterialParameters {
|
|
5
|
+
color: number;
|
|
6
|
+
opacity: number;
|
|
7
|
+
}
|
|
8
|
+
export interface VerticalShaftMeshParameters<TShaft extends VerticalShaft = VerticalShaft> {
|
|
9
|
+
shaft: TShaft;
|
|
10
|
+
kind: VerticalShaftKind;
|
|
11
|
+
material: VerticalShaftMaterialParameters;
|
|
12
|
+
}
|
|
13
|
+
export declare function createVerticalShaftMesh<TMesh extends VerticalShaftMesh>(createMesh: () => TMesh): TMesh | null;
|
|
14
|
+
export declare class VerticalShaftMesh<TShaft extends VerticalShaft = VerticalShaft> extends ExtrudeMesh {
|
|
15
|
+
readonly isVerticalShaftMesh = true;
|
|
16
|
+
type: string;
|
|
17
|
+
readonly shaft: TShaft;
|
|
18
|
+
readonly semanticId: string;
|
|
19
|
+
readonly semanticKind: VerticalShaftKind;
|
|
20
|
+
readonly semanticName: string;
|
|
21
|
+
readonly bottom: number;
|
|
22
|
+
readonly top: number;
|
|
23
|
+
readonly height: number;
|
|
24
|
+
constructor({ shaft, kind, material }: VerticalShaftMeshParameters<TShaft>);
|
|
25
|
+
}
|
|
@@ -2,6 +2,8 @@ export interface Building {
|
|
|
2
2
|
ID: string;
|
|
3
3
|
Name: string;
|
|
4
4
|
Stories: number[];
|
|
5
|
+
Elevators?: number[];
|
|
6
|
+
Vents?: number[];
|
|
5
7
|
}
|
|
6
8
|
export interface Polygon {
|
|
7
9
|
shape?: number[];
|
|
@@ -67,6 +69,30 @@ export interface Window {
|
|
|
67
69
|
Polygon?: Polygon;
|
|
68
70
|
Width: number;
|
|
69
71
|
}
|
|
72
|
+
export interface VerticalShaftStory {
|
|
73
|
+
Doors?: number[];
|
|
74
|
+
FloorIndex: number;
|
|
75
|
+
}
|
|
76
|
+
export interface VerticalShaft {
|
|
77
|
+
BeginFloorIndex: number;
|
|
78
|
+
Depth?: number;
|
|
79
|
+
EndFloorIndex: number;
|
|
80
|
+
Height?: number;
|
|
81
|
+
ID: string;
|
|
82
|
+
Name: string;
|
|
83
|
+
Polygon?: Polygon;
|
|
84
|
+
Stories?: VerticalShaftStory[];
|
|
85
|
+
Width?: number;
|
|
86
|
+
Elevation?: number;
|
|
87
|
+
TotalHeight?: number;
|
|
88
|
+
}
|
|
89
|
+
export interface Elevator extends VerticalShaft {
|
|
90
|
+
}
|
|
91
|
+
export interface Vent extends VerticalShaft {
|
|
92
|
+
WindowElevation?: number;
|
|
93
|
+
WindowHeight?: number;
|
|
94
|
+
WindowWidth?: number;
|
|
95
|
+
}
|
|
70
96
|
export interface Asset {
|
|
71
97
|
Generator: string;
|
|
72
98
|
GplUUID?: any;
|
|
@@ -83,5 +109,7 @@ export interface SemanticObject {
|
|
|
83
109
|
Walls?: Wall[];
|
|
84
110
|
Windows?: Window[];
|
|
85
111
|
Columns?: Column[];
|
|
112
|
+
Elevators?: Elevator[];
|
|
113
|
+
Vents?: Vent[];
|
|
86
114
|
Asset?: Asset;
|
|
87
115
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BufferGeometry, Color, Matrix4, Vector3, Vector4 } from 'three/webgpu';
|
|
2
|
-
export type SemanticKind = 'Walls' | 'Columns' | 'Spaces' | 'Doors' | 'Windows';
|
|
2
|
+
export type SemanticKind = 'Walls' | 'Columns' | 'Spaces' | 'Doors' | 'Windows' | 'Staircases';
|
|
3
3
|
export type SemanticColor = Color | Vector3 | Vector4;
|
|
4
4
|
export interface SemanticGeometryEntry {
|
|
5
5
|
id: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# atmosphere
|
|
2
2
|
|
|
3
|
-
天空和大气渲染插件,基于 `@takram/three-atmosphere` 的 WebGPU 节点实现。启用后会接入 Viewer 的 `renderer.contextNode`、`scene.backgroundNode` 和 RenderPipeline 的 output effect/MRT
|
|
3
|
+
天空和大气渲染插件,基于 `@takram/three-atmosphere` 的 WebGPU 节点实现。启用后会接入 Viewer 的 `renderer.contextNode`、`scene.backgroundNode`、可选的 `scene.environmentNode` 和 RenderPipeline 的 output effect/MRT 扩展点,提供天空背景、天空环境、太阳/月亮方向、lens flare、tone mapping、temporal antialias、dithering 和大气方向光阴影。
|
|
4
4
|
|
|
5
5
|
```typescript
|
|
6
6
|
import { Atmosphere } from 'u-space/plugins/atmosphere';
|
|
@@ -16,8 +16,8 @@ atmosphere.enable({
|
|
|
16
16
|
## 能力
|
|
17
17
|
|
|
18
18
|
- 使用经纬高将本地场景原点映射到 WGS84/ECEF,用 `date` 计算太阳和月亮方向。
|
|
19
|
-
- 写入 `scene.backgroundNode
|
|
20
|
-
- 通过 RenderPipeline output effect
|
|
19
|
+
- 写入 `scene.backgroundNode = skyBackground()`;`useSkyEnvironment` 开启时写入 `scene.environmentNode = skyEnvironment()`,关闭插件会恢复启用前的背景和环境节点。
|
|
20
|
+
- 通过 RenderPipeline output effect 追加 lens flare、tone mapping、temporal antialias 和 dithering,不占用业务侧的 `setOutputComposer()`。
|
|
21
21
|
- 开启 `temporalAntialias` 时注册独立的 `atmosphereVelocity` MRT 通道,并避免和 RenderPipeline 自带 TRAA 重复运行。
|
|
22
22
|
- 创建 `AtmosphereLight` 作为太阳方向光,并在每帧跟随相机控制器 target 更新阴影目标。
|
|
23
23
|
|
|
@@ -82,13 +82,13 @@ atmosphere.update({
|
|
|
82
82
|
| `showMoon` | `boolean` | `true` | 显示月亮 |
|
|
83
83
|
| `showStars` | `boolean` | `true` | 显示星空 |
|
|
84
84
|
| `showGround` | `boolean` | `false` | 是否渲染大气地面 |
|
|
85
|
-
| `useSkyEnvironment` | `boolean` | `true` |
|
|
85
|
+
| `useSkyEnvironment` | `boolean` | `true` | 是否使用 `skyEnvironment()` 作为 `scene.environmentNode` |
|
|
86
86
|
| `raymarchScattering` | `boolean` | `true` | 是否启用 raymarch scattering |
|
|
87
|
-
| `lighting` | `boolean` | `true` | aerial perspective
|
|
88
|
-
| `transmittance` | `boolean` | `true` | aerial perspective
|
|
89
|
-
| `inscattering` | `boolean` | `true` | aerial perspective
|
|
90
|
-
| `moonScattering` | `boolean` | `true` |
|
|
91
|
-
| `lensFlare` | `boolean` | `true` | 是否在
|
|
87
|
+
| `lighting` | `boolean` | `true` | 保留项:当前后处理链不再插入 aerial perspective,暂不生效 |
|
|
88
|
+
| `transmittance` | `boolean` | `true` | 保留项:当前后处理链不再插入 aerial perspective,暂不生效 |
|
|
89
|
+
| `inscattering` | `boolean` | `true` | 保留项:当前后处理链不再插入 aerial perspective,暂不生效 |
|
|
90
|
+
| `moonScattering` | `boolean` | `true` | 是否在天空背景中包含月光散射 |
|
|
91
|
+
| `lensFlare` | `boolean` | `true` | 是否在 output effect 链中启用 lens flare |
|
|
92
92
|
| `temporalAntialias` | `boolean` | `true` | 是否在大气后处理链中启用 temporal antialias |
|
|
93
93
|
| `dithering` | `boolean` | `true` | 是否在 temporal antialias 后追加 dithering |
|
|
94
94
|
| `toneMapping` | `ToneMapping \| false` | `AgXPunchyToneMapping` | 大气后处理链使用的 tone mapping;设为 `false` 可跳过 |
|
|
@@ -105,7 +105,9 @@ atmosphere.update({
|
|
|
105
105
|
|
|
106
106
|
## 注意事项
|
|
107
107
|
|
|
108
|
-
`Atmosphere` 不会占用 `viewer.renderPipeline.setOutputComposer()`。它通过 output effect
|
|
108
|
+
`Atmosphere` 不会占用 `viewer.renderPipeline.setOutputComposer()`。它通过 output effect 追加 lens flare、tone mapping、temporal antialias 和 dithering;开启 `temporalAntialias` 时才会注册独立的 `atmosphereVelocity` MRT 通道,并会避免和 RenderPipeline 自带 TRAA 重复运行。业务设置自定义 composer 时,大气 output effect 和它的输出变换开关都会被 RenderPipeline 跳过,让 composer 保持完整接管输出的原语义。
|
|
109
|
+
|
|
110
|
+
`scene.backgroundNode` 使用 `skyBackground()`,`scene.environmentNode` 使用独立的 `skyEnvironment()`,两者不是同一个天空节点。`showGround` 默认为 `false`,当相机视线落到天空节点的地面半球时背景可能呈暗色;需要渲染大气地面时传入 `showGround: true`。
|
|
109
111
|
|
|
110
112
|
插件会在 `beforeRender` 中刷新相机 ECEF 位置、太阳/月亮方向和阴影 target,因此相机移动时的大气状态会跟随每一帧更新。`setDate()` 只更新传入的时间,不会自动推进时钟;需要动态昼夜变化时,由业务侧定时调用 `setDate()` 或 `update({ date })`。
|
|
111
113
|
|
package/docs/api-plugin-tiles.md
CHANGED
|
@@ -14,13 +14,45 @@ arcgisTilesRenderer.invalidate(120.002269, 30.284849, 4);
|
|
|
14
14
|
viewer.frameloop = 'always';
|
|
15
15
|
|
|
16
16
|
arcgisTilesRenderer.enable();
|
|
17
|
+
|
|
18
|
+
// 经纬高转场景世界坐标
|
|
19
|
+
const position = arcgisTilesRenderer.lonLatHeightToPosition(120.002269, 30.284849, 8);
|
|
20
|
+
|
|
21
|
+
// 场景世界坐标转经纬高
|
|
22
|
+
const location = arcgisTilesRenderer.positionToLonLatHeight(position);
|
|
17
23
|
```
|
|
18
24
|
|
|
19
25
|
**方法:**
|
|
20
26
|
|
|
21
|
-
| 方法
|
|
22
|
-
|
|
|
23
|
-
| `invalidate(lon, lat, alt)` | 将瓦片原点设置为指定的 WGS84
|
|
24
|
-
| `
|
|
25
|
-
| `
|
|
26
|
-
| `
|
|
27
|
+
| 方法 | 说明 |
|
|
28
|
+
| :--- | :--- |
|
|
29
|
+
| `invalidate(lon, lat, alt)` | 将瓦片原点设置为指定的 WGS84 经纬高。`lon`、`lat` 使用度,`alt` 使用米。可多次调用。返回一个取消订阅的函数。 |
|
|
30
|
+
| `lonLatHeightToPosition(lon, lat, height?, target?)` | 将 WGS84 经纬高转换为当前场景的世界坐标。`lon`、`lat` 使用度,`height` 使用米,返回 `Vector3`。 |
|
|
31
|
+
| `positionToLonLatHeight(position, target?)` | 将当前场景的世界坐标转换为 WGS84 经纬高,返回 `{ lon, lat, height }`。`lon`、`lat` 使用度,`height` 使用米。 |
|
|
32
|
+
| `enable()` | 将瓦片添加到场景并启动更新循环。 |
|
|
33
|
+
| `disable()` | 从场景中移除瓦片并暂停更新循环。 |
|
|
34
|
+
| `dispose()` | 禁用并完全释放瓦片渲染器。 |
|
|
35
|
+
|
|
36
|
+
## 坐标转换
|
|
37
|
+
|
|
38
|
+
`invalidate(lon, lat, alt)` 会通过 `3d-tiles-renderer` 的 `ReorientationPlugin` 把指定 WGS84 经纬高移动到场景原点。重定位完成后,默认场景轴向为:
|
|
39
|
+
|
|
40
|
+
- `+Y`:高度方向(Up)
|
|
41
|
+
- `+Z`:北向(North)
|
|
42
|
+
- `+X`:西向(West),东向为 `-X`
|
|
43
|
+
|
|
44
|
+
`lonLatHeightToPosition()` 和 `positionToLonLatHeight()` 复用瓦片当前的 `group.matrixWorld` 与 WGS84 椭球坐标,适合在 GIS 点位、POI、业务模型和 Three.js 场景世界坐标之间互转。
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { Vector3 } from 'three/webgpu';
|
|
48
|
+
|
|
49
|
+
const poiPosition = arcgisTilesRenderer.lonLatHeightToPosition(120.0024, 30.285, 12);
|
|
50
|
+
poi.position.copy(poiPosition);
|
|
51
|
+
|
|
52
|
+
const worldPosition = object.getWorldPosition(new Vector3());
|
|
53
|
+
const { lon, lat, height } = arcgisTilesRenderer.positionToLonLatHeight(worldPosition);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
传给 `positionToLonLatHeight()` 的 `position` 必须是场景世界坐标。如果坐标来自某个对象的局部空间,先通过 `object.localToWorld(localPosition)` 或 `object.getWorldPosition()` 转成世界坐标。
|
|
57
|
+
|
|
58
|
+
如果在瓦片 root tileset 加载前调用 `invalidate()`,重定位会等到 root tileset 加载后才真正应用。需要在业务逻辑中立即使用转换结果时,应确保 `invalidate()` 已经完成,或在瓦片加载完成后再调用转换方法。
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# u-manager
|
|
2
2
|
|
|
3
|
-
`u-manager`
|
|
3
|
+
`u-manager` 是一套全面的加载器和解析器,用于从服务器路径流式传输、解密并显示结构化场景数据。支持场景、拓扑、动画、属性、相机视点、楼层和井道语义模型。
|
|
4
4
|
|
|
5
5
|
所有加载器均继承自 Three.js 的 `Loader`,并提供 `setPath(path)` 方法,在调用 `loadAsync()` 前配置基础数据目录。
|
|
6
6
|
|
|
7
7
|
## `SemanticLoader`
|
|
8
8
|
|
|
9
|
-
加载 `db/semantic_model.json` 楼层语义数据,并按建筑返回 `BuildingGroup[]`。每个建筑包含多个 `FloorMesh`,每个楼层把墙、柱、空间等语义对象合并为一个 TSL
|
|
9
|
+
加载 `db/semantic_model.json` 楼层语义数据,并按建筑返回 `BuildingGroup[]`。每个建筑包含多个 `FloorMesh`,每个楼层把墙、柱、空间等语义对象合并为一个 TSL 材质驱动的网格;建筑级电梯井和通风井会使用 `ExtrudeMesh` 独立渲染。
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
12
|
import { Vector3, Vector4 } from 'three';
|
|
@@ -36,19 +36,44 @@ floor.addEventListener('click', ({ event }) => {
|
|
|
36
36
|
|
|
37
37
|
### `BuildingGroup`
|
|
38
38
|
|
|
39
|
-
`BuildingGroup` 继承自 `BaseGroup
|
|
39
|
+
`BuildingGroup` 继承自 `BaseGroup`,用于组织一个建筑下的所有楼层、电梯井和通风井。
|
|
40
40
|
|
|
41
41
|
| 属性 / 方法 | 说明 |
|
|
42
42
|
| :---------- | :--- |
|
|
43
43
|
| `floorMeshes` | 当前建筑内的 `FloorMesh[]`。 |
|
|
44
|
+
| `elevatorMeshes` | 当前建筑内由 `Elevators` 语义生成的 `ExtrudeMesh[]`。 |
|
|
45
|
+
| `ventMeshes` | 当前建筑内由 `Vents` 语义生成的 `ExtrudeMesh[]`。 |
|
|
44
46
|
| `addFloor(floor)` | 添加楼层,并同步加入 group。 |
|
|
45
47
|
| `removeFloor(floor)` | 移除楼层,并同步从 group 移除。 |
|
|
46
48
|
| `getFloorAt(index)` | 按楼层下标获取 `FloorMesh`。 |
|
|
49
|
+
| `addElevator(elevator)` / `removeElevator(elevator)` | 添加或移除电梯井,并同步更新 group。 |
|
|
50
|
+
| `getElevatorAt(index)` | 按下标获取电梯井 `ExtrudeMesh`。 |
|
|
51
|
+
| `addVent(vent)` / `removeVent(vent)` | 添加或移除通风井,并同步更新 group。 |
|
|
52
|
+
| `getVentAt(index)` | 按下标获取通风井 `ExtrudeMesh`。 |
|
|
47
53
|
| `isolateFloor(floor \| index)` | 只显示指定楼层,隐藏其他楼层。 |
|
|
48
54
|
| `showAllFloors()` | 显示全部楼层。 |
|
|
49
55
|
| `planishFloors(kind?)` | 压扁所有楼层;传入 `kind` 时只压扁该语义类型。 |
|
|
50
56
|
| `unplanishFloors(kind?)` | 恢复所有楼层;传入 `kind` 时只恢复该语义类型。 |
|
|
51
57
|
|
|
58
|
+
### 电梯井和通风井
|
|
59
|
+
|
|
60
|
+
`SemanticLoader` 会读取 `semantic_model.json` 中建筑引用的 `Elevators` 和 `Vents`。每个井道使用 `Polygon.shape` 作为底面轮廓,`Elevation` 作为底面高度,`TotalHeight` 作为拉伸高度,并以 building 级 `ExtrudeMesh` 加入 `BuildingGroup`。
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
const elevator = building.getElevatorAt(0);
|
|
64
|
+
const vent = building.getVentAt(0);
|
|
65
|
+
|
|
66
|
+
if (elevator) {
|
|
67
|
+
await viewer.controls.flyToObject(elevator);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (vent) {
|
|
71
|
+
building.removeVent(vent);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
电梯井和通风井会在渲染阶段沿法线轻微内收,减少与墙体共面时的闪面。`Spaces` 实例也会使用稳定的 per-instance 渲染偏移抖动,缓解完全重叠空间之间的 z-fighting;这些偏移只影响渲染顶点,不改变语义 ID、实例矩阵和包围体查询的使用方式。
|
|
76
|
+
|
|
52
77
|
### `FloorMesh`
|
|
53
78
|
|
|
54
79
|
`FloorMesh` 继承自 `BaseMesh`,表示一个楼层。它不是 `BatchedMesh`,而是把同一楼层内的语义对象合并为一份几何,并通过 TSL + `DataTexture` 在 GPU 侧按 `semanticIndex` 控制颜色、透明度、显示隐藏和实例矩阵。
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## 未发布
|
|
4
|
+
|
|
5
|
+
### 新增
|
|
6
|
+
|
|
7
|
+
- **u-manager semantics** — `SemanticLoader` 支持解析建筑级 `Elevators` 和 `Vents`,以 `Polygon.shape` 作为底面轮廓、`Elevation` 作为底面高度、`TotalHeight` 作为拉伸高度生成 `ExtrudeMesh`,并通过 `BuildingGroup.elevatorMeshes`、`BuildingGroup.ventMeshes` 及 add/get/remove 方法管理。
|
|
8
|
+
|
|
9
|
+
### 修复
|
|
10
|
+
|
|
11
|
+
- **透明语义体块渲染** — 电梯井/通风井在渲染阶段沿法线轻微内收,`Spaces` 实例使用稳定 per-instance 渲染偏移抖动,缓解与墙体或完全重叠空间共面时的 z-fighting。
|
|
12
|
+
- **atmosphere 插件** — 后处理链移除 aerial perspective 节点,保留 lens flare、tone mapping、temporal antialias 和 dithering;`scene.backgroundNode` 使用 `skyBackground()`,`scene.environmentNode` 使用 `skyEnvironment()`,并继续在关闭插件时恢复启用前的背景和环境节点。
|
|
13
|
+
|
|
3
14
|
## 0.0.18
|
|
4
15
|
|
|
5
16
|
### 变更
|
package/docs/examples-guide.md
CHANGED
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
|
|
35
35
|
- 动态实例化复杂插件(`ArcgisTilesRenderer`),并传入核心 viewer 引用。
|
|
36
36
|
- 由于瓦片是异步流式加载并持续更新视口的,需使用 `viewer.frameloop = 'always'`。
|
|
37
|
-
- 通过插件的 `invalidate(lon, lat,
|
|
37
|
+
- 通过插件的 `invalidate(lon, lat, alt)` 方法定位到指定的经纬高位置。
|
|
38
|
+
- 使用 `lonLatHeightToPosition()` / `positionToLonLatHeight()` 在 WGS84 经纬高和场景世界坐标之间互转。
|
|
38
39
|
|
|
39
40
|
## 4. `test_umanager.html`:场景组合与解析器
|
|
40
41
|
|
package/docs/index.md
CHANGED
|
@@ -52,10 +52,10 @@ features:
|
|
|
52
52
|
| [keyboard-controls](./api-plugin-keyboard-controls) | WASD / 方向键控制相机移动与旋转 |
|
|
53
53
|
| [minimap](./api-plugin-minimap) | 2D 小地图叠加层 |
|
|
54
54
|
| [tiles](./api-plugin-tiles) | ArcGIS 3D 瓦片 / GIS 地球渲染 |
|
|
55
|
-
| [u-manager](./api-plugin-u-manager) |
|
|
55
|
+
| [u-manager](./api-plugin-u-manager) | 场景加载、语义楼层、语义井道、拓扑、动画、属性、视点管理 |
|
|
56
56
|
| [curve-movement](./api-plugin-curve-movement) | 沿样条曲线移动相机或对象 |
|
|
57
57
|
| [tracking-controls](./api-plugin-tracking-controls) | 相机跟随移动目标 |
|
|
58
|
-
| [atmosphere](./api-plugin-atmosphere) |
|
|
58
|
+
| [atmosphere](./api-plugin-atmosphere) | 天空背景、天空环境、太阳/月亮光照与阴影 |
|
|
59
59
|
| [object-controls](./api-plugin-object-controls) | 交互式移动、旋转、缩放 3D 对象 |
|
|
60
60
|
| [topology-drawer](./api-plugin-topology-drawer) | 在场景任意表面交互式绘制拓扑路径图 |
|
|
61
61
|
|
package/docs/mcp.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# u-space MCP
|
|
2
2
|
|
|
3
|
-
`u-space-mcp` 是面向 `u-space` 文档的 Model Context Protocol(MCP)服务器。它把当前文档打包成只读 MCP 工具,方便 Mastra、Claude Desktop、Cursor 等 MCP 客户端在回答 `u-space` API、插件和示例问题时直接检索官方文档,包括 `u-manager` 的 `SemanticLoader`、`BuildingGroup`
|
|
3
|
+
`u-space-mcp` 是面向 `u-space` 文档的 Model Context Protocol(MCP)服务器。它把当前文档打包成只读 MCP 工具,方便 Mastra、Claude Desktop、Cursor 等 MCP 客户端在回答 `u-space` API、插件和示例问题时直接检索官方文档,包括 `u-manager` 的 `SemanticLoader`、`BuildingGroup`、`FloorMesh` 语义楼层 API、电梯井/通风井语义体块,以及 atmosphere 插件的 `skyBackground()`、`skyEnvironment()` 和 RenderPipeline output effect 配置。
|
|
4
4
|
|
|
5
5
|
## 安装与启动
|
|
6
6
|
|