u-space 0.0.13 → 0.0.16
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 +2 -2
- package/dist/index.js +3 -1
- package/dist/plugins/atmosphere/AgxToneMapping.d.ts +3 -0
- package/dist/plugins/u-manager/index.cjs +24 -24
- package/dist/plugins/u-manager/index.js +3676 -3651
- package/dist/plugins/u-manager/semantics/BuildingGroup.d.ts +3 -2
- package/dist/plugins/u-manager/semantics/FloorMesh.d.ts +5 -4
- package/dist/plugins/u-manager/semantics/types.d.ts +1 -1
- package/dist/src/objects/BaseGroup.d.ts +2 -1
- package/dist/src/objects/BaseMesh.d.ts +4 -1
- package/dist/src/objects/BaseSprite.d.ts +2 -1
- package/docs/api-plugin-u-manager.md +7 -6
- package/docs/mcp.md +1 -2
- package/package.json +5 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseGroup } from 'u-space';
|
|
2
2
|
import type { FloorMesh } from './FloorMesh';
|
|
3
|
+
import type { SemanticKind } from './types';
|
|
3
4
|
export declare class BuildingGroup extends BaseGroup {
|
|
4
5
|
isBuildingGroup: boolean;
|
|
5
6
|
type: string;
|
|
@@ -10,6 +11,6 @@ export declare class BuildingGroup extends BaseGroup {
|
|
|
10
11
|
removeFloor(mesh: FloorMesh): this;
|
|
11
12
|
isolateFloor(mesh: FloorMesh | number): this;
|
|
12
13
|
showAllFloors(): this;
|
|
13
|
-
planishFloors(): this;
|
|
14
|
-
unplanishFloors(): this;
|
|
14
|
+
planishFloors(kind?: SemanticKind): this;
|
|
15
|
+
unplanishFloors(kind?: SemanticKind): this;
|
|
15
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box3, Matrix4, Sphere, Vector3, Vector4, type Intersection, type Raycaster } from 'three/webgpu';
|
|
2
2
|
import { BaseMesh } from 'u-space';
|
|
3
|
-
import type { SemanticColor, SemanticGeometryEntry } from './types';
|
|
3
|
+
import type { SemanticColor, SemanticGeometryEntry, SemanticKind } from './types';
|
|
4
4
|
export declare class FloorMesh extends BaseMesh {
|
|
5
5
|
#private;
|
|
6
6
|
isFloorMergedSemanticMesh: boolean;
|
|
@@ -14,13 +14,13 @@ export declare class FloorMesh extends BaseMesh {
|
|
|
14
14
|
windowsInstances: Map<string, number>;
|
|
15
15
|
semanticInstances: Map<string, number>;
|
|
16
16
|
constructor(entries: SemanticGeometryEntry[]);
|
|
17
|
-
planish():
|
|
18
|
-
unplanish():
|
|
17
|
+
planish(kind?: SemanticKind): this;
|
|
18
|
+
unplanish(kind?: SemanticKind): this;
|
|
19
19
|
get semanticCount(): number;
|
|
20
20
|
get instanceCount(): number;
|
|
21
21
|
getSemanticIndexById(id: string): number | undefined;
|
|
22
22
|
getSemanticIdAt(index: number): string;
|
|
23
|
-
getSemanticKindAt(index: number):
|
|
23
|
+
getSemanticKindAt(index: number): SemanticKind;
|
|
24
24
|
getSemanticNameAt(index: number): string | undefined;
|
|
25
25
|
setColorAt(index: number, color: SemanticColor): this;
|
|
26
26
|
getColorAt(index: number, target?: Vector4): Vector4;
|
|
@@ -30,6 +30,7 @@ export declare class FloorMesh extends BaseMesh {
|
|
|
30
30
|
getVisibleAt(index: number): boolean;
|
|
31
31
|
setMatrixAt(index: number, matrix: Matrix4): this;
|
|
32
32
|
setScaleAt(index: number, scale: number | Vector3, y?: number, z?: number): this;
|
|
33
|
+
setScaleYAt(index: number, y: number): this;
|
|
33
34
|
getMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
34
35
|
getFinalMatrixAt(index: number, matrix?: Matrix4): Matrix4;
|
|
35
36
|
computeBoundingBox(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BufferGeometry, Color, Matrix4, Vector3, Vector4 } from 'three/webgpu';
|
|
2
|
-
export type SemanticKind = '
|
|
2
|
+
export type SemanticKind = 'Walls' | 'Columns' | 'Spaces' | 'Doors' | 'Windows';
|
|
3
3
|
export type SemanticColor = Color | Vector3 | Vector4;
|
|
4
4
|
export interface SemanticGeometryEntry {
|
|
5
5
|
id: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Raycaster, type Intersection, type Object3DEventMap, Group } from 'three/webgpu';
|
|
2
|
-
|
|
2
|
+
import type { InteractionEventMap } from '../interactions';
|
|
3
|
+
export declare class BaseGroup<TEventMap extends Object3DEventMap = InteractionEventMap> extends Group<TEventMap> {
|
|
3
4
|
readonly isBaseGroup = true;
|
|
4
5
|
type: string;
|
|
5
6
|
ignoreInvisibleWhenRaycast: boolean;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { type BufferGeometry, type Intersection, type Material, type Object3DEventMap, type Raycaster, Mesh } from 'three/webgpu';
|
|
2
|
-
|
|
2
|
+
import type { InteractionEventMap } from '../interactions';
|
|
3
|
+
export declare class BaseMesh<TGeometry extends BufferGeometry = BufferGeometry, TMaterial extends Material | Material[] = Material | Material[], TEventMap extends Object3DEventMap = InteractionEventMap> extends Mesh<TGeometry, TMaterial, TEventMap> {
|
|
3
4
|
readonly isBaseMesh = true;
|
|
4
5
|
type: string;
|
|
6
|
+
castShadow: boolean;
|
|
7
|
+
receiveShadow: boolean;
|
|
5
8
|
ignoreInvisibleWhenRaycast: boolean;
|
|
6
9
|
constructor(...args: ConstructorParameters<typeof Mesh<TGeometry, TMaterial, TEventMap>>);
|
|
7
10
|
raycast(raycaster: Raycaster, intersects: Intersection[]): boolean | void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Raycaster, type Intersection, type Object3DEventMap, Sprite } from 'three/webgpu';
|
|
2
|
-
|
|
2
|
+
import type { InteractionEventMap } from '../interactions';
|
|
3
|
+
export declare class BaseSprite<TEventMap extends Object3DEventMap = InteractionEventMap> extends Sprite<TEventMap> {
|
|
3
4
|
readonly isBaseSprite = true;
|
|
4
5
|
type: string;
|
|
5
6
|
ignoreInvisibleWhenRaycast: boolean;
|
|
@@ -46,8 +46,8 @@ floor.addEventListener('click', ({ event }) => {
|
|
|
46
46
|
| `getFloorAt(index)` | 按楼层下标获取 `FloorMesh`。 |
|
|
47
47
|
| `isolateFloor(floor \| index)` | 只显示指定楼层,隐藏其他楼层。 |
|
|
48
48
|
| `showAllFloors()` | 显示全部楼层。 |
|
|
49
|
-
| `planishFloors()` |
|
|
50
|
-
| `unplanishFloors()` |
|
|
49
|
+
| `planishFloors(kind?)` | 压扁所有楼层;传入 `kind` 时只压扁该语义类型。 |
|
|
50
|
+
| `unplanishFloors(kind?)` | 恢复所有楼层;传入 `kind` 时只恢复该语义类型。 |
|
|
51
51
|
|
|
52
52
|
### `FloorMesh`
|
|
53
53
|
|
|
@@ -62,18 +62,19 @@ floor.addEventListener('click', ({ event }) => {
|
|
|
62
62
|
| `wallsInstances` / `columnsInstances` / `spacesInstances` / `doorsInstances` / `windowsInstances` | 按语义类型维护的 ID 到实例下标映射。 |
|
|
63
63
|
| `getSemanticIndexById(id)` | 根据语义 ID 获取实例下标。 |
|
|
64
64
|
| `getSemanticIdAt(index)` | 获取实例语义 ID。 |
|
|
65
|
-
| `getSemanticKindAt(index)` | 获取实例类型:`'
|
|
66
|
-
| `getSemanticNameAt(index)` | 获取实例名称;当前 `
|
|
65
|
+
| `getSemanticKindAt(index)` | 获取实例类型:`'Walls' \| 'Columns' \| 'Spaces' \| 'Doors' \| 'Windows'`。 |
|
|
66
|
+
| `getSemanticNameAt(index)` | 获取实例名称;当前 `Spaces` 会从语义数据的 `Name` 写入,其他类型可能为 `undefined`。 |
|
|
67
67
|
| `setColorAt(index, color)` / `getColorAt(index, target?)` | 修改或读取实例颜色,支持 `Color`、`Vector3`、`Vector4`。 |
|
|
68
68
|
| `setOpacityAt(index, opacity)` / `getOpacityAt(index)` | 修改或读取实例透明度。 |
|
|
69
69
|
| `setVisibleAt(index, visible)` / `getVisibleAt(index)` | 修改或读取实例显隐状态。 |
|
|
70
70
|
| `setMatrixAt(index, matrix)` / `getMatrixAt(index, target?)` | 设置或读取实例附加矩阵。 |
|
|
71
71
|
| `setScaleAt(index, scale, y?, z?)` | 修改实例缩放,支持 `number` 或 `Vector3`。 |
|
|
72
|
+
| `setScaleYAt(index, y)` | 只修改实例 Y 轴缩放,保留 X/Z 缩放和已有位移、旋转。 |
|
|
72
73
|
| `getFinalMatrixAt(index, target?)` | 读取实例最终矩阵,包含语义对象原始基点矩阵。 |
|
|
73
74
|
| `getBoundingBoxAt(index, target?, world?)` | 获取实例包围盒;`world = true` 时包含 `FloorMesh.matrixWorld`。 |
|
|
74
75
|
| `getBoundingSphereAt(index, target?, world?)` | 获取实例包围球;`world = true` 时包含 `FloorMesh.matrixWorld`。 |
|
|
75
76
|
| `computeBoundingBox()` / `computeBoundingSphere()` | 计算整个楼层的包围体。 |
|
|
76
|
-
| `planish()` / `unplanish()` |
|
|
77
|
+
| `planish(kind?)` / `unplanish(kind?)` | 压扁或恢复楼层语义实例;传入 `kind` 时只作用于该语义类型。 |
|
|
77
78
|
|
|
78
79
|
### 飞向语义实例
|
|
79
80
|
|
|
@@ -110,7 +111,7 @@ if (index !== undefined) {
|
|
|
110
111
|
|
|
111
112
|
### 楼层压扁
|
|
112
113
|
|
|
113
|
-
`planish()`
|
|
114
|
+
`planish()` / `unplanish()` 默认作用于当前楼层的全部语义实例;传入 `kind` 时只处理该类型,例如 `floor.planish('Walls')`。如果只想调整单个实例,可以使用 `setScaleAt()` 或 `setScaleYAt()`,它们会保留该语义对象自己的基点矩阵,因此压扁墙、柱、房间时不会被压到世界原点。
|
|
114
115
|
|
|
115
116
|
## `SceneLoader`
|
|
116
117
|
|
package/docs/mcp.md
CHANGED
|
@@ -86,10 +86,9 @@ export const codingAgent = new Agent({
|
|
|
86
86
|
|
|
87
87
|
## 包结构
|
|
88
88
|
|
|
89
|
-
源码位于 `packages/u-space-mcp
|
|
89
|
+
源码位于 `packages/u-space-mcp`。发布时会先从根目录 `docs/*.md` 生成内置文档索引,并编译成可发布的 npm 包:
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
|
-
pnpm build:mcp
|
|
93
92
|
pnpm publish:mcp
|
|
94
93
|
```
|
|
95
94
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "u-space",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "dist/src/index.d.ts",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"docs:preview": "vitepress preview docs",
|
|
31
31
|
"docs:deploy": "pnpm docs:build && vercel --prod",
|
|
32
32
|
"build:mcp": "pnpm --filter u-space-mcp build",
|
|
33
|
-
"publish:mcp": "npm publish ./packages/u-space-mcp --access public",
|
|
33
|
+
"publish:mcp": "pnpm build:mcp && npm publish ./packages/u-space-mcp --access public --ignore-scripts",
|
|
34
34
|
"release": "npm version patch && pnpm build && npm publish --access=public"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
@@ -60,10 +60,12 @@
|
|
|
60
60
|
"vitepress": "^1.6.4"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"3d-tiles-renderer": ">=0.4.
|
|
63
|
+
"3d-tiles-renderer": ">=0.4.28",
|
|
64
64
|
"@takram/three-geospatial": ">=0.9.1",
|
|
65
|
+
"@takram/three-atmosphere": ">=0.19.1",
|
|
65
66
|
"@types/three": ">=0.184.1",
|
|
66
67
|
"camera-controls": ">=3.1.2",
|
|
68
|
+
"postprocessing": ">=6.39.1",
|
|
67
69
|
"three": ">=0.184.0"
|
|
68
70
|
}
|
|
69
71
|
}
|