u-space 0.0.26 → 0.0.28

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.
Files changed (42) hide show
  1. package/dist/index.cjs +3 -3
  2. package/dist/index.js +411 -373
  3. package/dist/plugins/atmosphere/index.cjs +1 -1
  4. package/dist/plugins/atmosphere/index.js +3255 -129
  5. package/dist/plugins/atmosphere/threeR185Compat.d.ts +2 -0
  6. package/dist/plugins/fire/FireEffect.d.ts +90 -0
  7. package/dist/plugins/fire/index.cjs +1 -0
  8. package/dist/plugins/fire/index.d.ts +1 -0
  9. package/dist/plugins/fire/index.js +433 -0
  10. package/dist/plugins/u-manager/index.cjs +60 -60
  11. package/dist/plugins/u-manager/index.d.ts +3 -0
  12. package/dist/plugins/u-manager/index.js +10070 -9660
  13. package/dist/plugins/u-manager/instances/SemanticInstanceObject.d.ts +37 -0
  14. package/dist/plugins/u-manager/instances/SemanticModelInstancedLayer.d.ts +33 -0
  15. package/dist/plugins/u-manager/instances/index.d.ts +2 -0
  16. package/dist/plugins/u-manager/loaders/SceneInstancedLayer.d.ts +13 -0
  17. package/dist/plugins/u-manager/loaders/SceneLoader.d.ts +5 -5
  18. package/dist/plugins/u-manager/loaders/UManagerLoader.d.ts +24 -0
  19. package/dist/plugins/u-manager/semantics/SemanticLoader.d.ts +2 -2
  20. package/dist/plugins/u-manager/semantics/SemanticParser.d.ts +3 -3
  21. package/dist/plugins/u-manager/semantics/index.d.ts +1 -1
  22. package/dist/plugins/u-manager/semantics/objects/BuildingGroup.d.ts +4 -10
  23. package/dist/plugins/u-manager/semantics/objects/FacilityInstancedLayer.d.ts +5 -24
  24. package/dist/plugins/u-manager/semantics/objects/FloorMesh.d.ts +30 -15
  25. package/dist/plugins/u-manager/semantics/objects/SemanticGroup.d.ts +26 -0
  26. package/dist/plugins/u-manager/semantics/types.d.ts +1 -0
  27. package/dist/src/effects/MaterialEffects.d.ts +1 -0
  28. package/dist/src/tools/AnnotationManager.d.ts +4 -1
  29. package/dist/src/viewers/RenderPipeline.d.ts +6 -5
  30. package/docs/api-effects.md +3 -0
  31. package/docs/api-interactions.md +1 -0
  32. package/docs/api-managers.md +1 -1
  33. package/docs/api-plugin-fire.md +174 -0
  34. package/docs/api-plugin-u-manager.md +249 -57
  35. package/docs/api-tools.md +1 -1
  36. package/docs/changelog.md +41 -8
  37. package/docs/examples-guide.md +39 -13
  38. package/docs/getting-started.md +1 -1
  39. package/docs/index.md +1 -0
  40. package/docs/mcp.md +34 -1
  41. package/package.json +4 -4
  42. package/dist/plugins/u-manager/semantics/objects/SemanticSceneGroup.d.ts +0 -31
@@ -0,0 +1,37 @@
1
+ import { Box3, Color, Object3D, type ColorRepresentation } from 'three/webgpu';
2
+ import { BaseGroup } from 'u-space';
3
+ export interface SemanticInstanceStyle {
4
+ color: Color | null;
5
+ colorMode: number;
6
+ opacity: number;
7
+ }
8
+ export interface SemanticInstanceObjectOptions {
9
+ boundsName?: string;
10
+ }
11
+ export declare const SEMANTIC_COLOR_MODE_NONE = 0;
12
+ export declare const SEMANTIC_COLOR_MODE_OVERRIDE = 1;
13
+ export declare const SEMANTIC_COLOR_MODE_TINT = 2;
14
+ export declare class SemanticInstanceObject extends BaseGroup {
15
+ #private;
16
+ isSemanticInstanceObject: boolean;
17
+ type: string;
18
+ constructor(options?: SemanticInstanceObjectOptions);
19
+ setSemanticBounds(bounds: Box3): this;
20
+ setSemanticRenderObject(object: Object3D | null): this;
21
+ getSemanticRenderObject(): Object3D<import("three").Object3DEventMap> | null;
22
+ getSemanticBoundingBox(target?: Box3, world?: boolean): Box3;
23
+ setSemanticVisible(visible: boolean): this;
24
+ setSemanticColor(color: ColorRepresentation): this;
25
+ resetSemanticColor(): this;
26
+ setSemanticOpacity(opacity: number): this;
27
+ getSemanticColor(target?: Color): Color;
28
+ hasSemanticColor(): boolean;
29
+ getSemanticOpacity(): number;
30
+ setSemanticHighlight(color: ColorRepresentation, opacity: number, overwrite?: boolean): this;
31
+ clearSemanticHighlight(): this;
32
+ getSemanticColorMode(): number;
33
+ onSemanticRenderDirty(callback: () => void): () => boolean;
34
+ markSemanticRenderDirty(): this;
35
+ updateMatrixWorld(force?: boolean): void;
36
+ }
37
+ export declare function isSemanticInstanceObject(object: Object3D): object is SemanticInstanceObject;
@@ -0,0 +1,33 @@
1
+ import { Object3D } from 'three/webgpu';
2
+ import { BaseGroup } from 'u-space';
3
+ import { SemanticInstanceObject } from './SemanticInstanceObject';
4
+ export interface SemanticInstanceCullingOptions {
5
+ enabled?: boolean;
6
+ frustum?: boolean;
7
+ minScreenRadius?: number;
8
+ }
9
+ export interface SemanticModelInstancedLayerOptions<T extends SemanticInstanceObject> {
10
+ name?: string;
11
+ getBatchUserData?: (url: string, instances: T[]) => Record<string, unknown>;
12
+ getHitUserData?: (instance: T, renderIndex: number) => Record<string, unknown>;
13
+ }
14
+ export declare class SemanticModelInstancedLayer<T extends SemanticInstanceObject = SemanticInstanceObject> extends BaseGroup {
15
+ #private;
16
+ isSemanticModelInstancedLayer: boolean;
17
+ type: string;
18
+ constructor(options?: SemanticModelInstancedLayerOptions<T>);
19
+ getSemanticInstances(): T[];
20
+ getInstanceCulling(): {
21
+ enabled: boolean;
22
+ frustum: boolean;
23
+ minScreenRadius: number;
24
+ };
25
+ setInstanceCulling(options?: SemanticInstanceCullingOptions): this;
26
+ setSemanticVisible(visible: boolean): this;
27
+ setSemanticColor(color: Parameters<SemanticInstanceObject['setSemanticColor']>[0]): this;
28
+ resetSemanticColor(): this;
29
+ setSemanticOpacity(opacity: number): this;
30
+ setSemanticHighlight(color: Parameters<SemanticInstanceObject['setSemanticHighlight']>[0], opacity: number, overwrite?: boolean): this;
31
+ clearSemanticHighlight(): this;
32
+ addSemanticBatch(url: string, template: Object3D, instances: T[]): boolean;
33
+ }
@@ -0,0 +1,2 @@
1
+ export * from './SemanticInstanceObject';
2
+ export * from './SemanticModelInstancedLayer';
@@ -0,0 +1,13 @@
1
+ import type { Object3D } from 'three/webgpu';
2
+ import { SemanticInstanceObject, SemanticModelInstancedLayer } from '../instances';
3
+ export declare class SceneInstanceObject extends SemanticInstanceObject {
4
+ isSceneInstanceObject: boolean;
5
+ type: string;
6
+ constructor();
7
+ }
8
+ export declare class SceneInstancedLayer extends SemanticModelInstancedLayer<SceneInstanceObject> {
9
+ isSceneInstancedLayer: boolean;
10
+ type: string;
11
+ constructor();
12
+ }
13
+ export type SceneInstanceReference = SceneInstanceObject | Object3D;
@@ -1,9 +1,7 @@
1
1
  import { Group, Loader } from 'three/webgpu';
2
- import { type Viewer } from 'u-space';
2
+ import { Model, type Viewer } from 'u-space';
3
3
  import type { ITreeData } from '../types';
4
- export interface SceneLoaderOptions {
5
- }
6
- export declare class SceneLoader extends Loader<unknown, SceneLoaderOptions> {
4
+ export declare class SceneLoader extends Loader {
7
5
  #private;
8
6
  viewer: Viewer;
9
7
  key: string;
@@ -12,13 +10,15 @@ export declare class SceneLoader extends Loader<unknown, SceneLoaderOptions> {
12
10
  protected _treeData: ITreeData[];
13
11
  constructor(viewer: Viewer);
14
12
  setKey(key: string): this;
13
+ protected loadModel(url: string): Promise<Model>;
15
14
  protected _preareTreeData(): Promise<void>;
15
+ protected _prepareSemanticIds(): Promise<ReadonlySet<string>>;
16
16
  /**
17
17
  * 加载场景
18
18
  * @param options
19
19
  * @returns
20
20
  */
21
- loadAsync(options?: SceneLoaderOptions): Promise<Group>;
21
+ loadAsync(): Promise<Group>;
22
22
  clearCache(): void;
23
23
  dispose(): void;
24
24
  }
@@ -0,0 +1,24 @@
1
+ import { Loader, type Group } from 'three/webgpu';
2
+ import { BaseGroup, type Viewer } from 'u-space';
3
+ import { SceneLoader } from './SceneLoader';
4
+ import { SemanticLoader } from '../semantics/SemanticLoader';
5
+ import type { SemanticGroup } from '../semantics';
6
+ export declare class UManagerSceneGroup extends BaseGroup {
7
+ isUManagerSceneGroup: boolean;
8
+ type: string;
9
+ semanticGroup: SemanticGroup;
10
+ sceneGroup: Group;
11
+ constructor(semanticGroup: SemanticGroup, sceneGroup: Group);
12
+ }
13
+ export declare class UManagerLoader extends Loader {
14
+ #private;
15
+ viewer: Viewer;
16
+ key: string;
17
+ sceneLoader: SceneLoader;
18
+ semanticLoader: SemanticLoader;
19
+ constructor(viewer: Viewer);
20
+ setKey(key: string): this;
21
+ loadAsync(): Promise<UManagerSceneGroup>;
22
+ clearCache(): void;
23
+ dispose(): void;
24
+ }
@@ -1,6 +1,6 @@
1
1
  import { Loader } from 'three/webgpu';
2
2
  import type { Viewer } from 'u-space';
3
- import { SemanticSceneGroup } from './objects/SemanticSceneGroup';
3
+ import { SemanticGroup } from './objects/SemanticGroup';
4
4
  export declare class SemanticLoader extends Loader {
5
5
  #private;
6
6
  viewer: Viewer;
@@ -8,7 +8,7 @@ export declare class SemanticLoader extends Loader {
8
8
  cachedIds: Set<string>;
9
9
  constructor(viewer: Viewer);
10
10
  setKey(key: string): this;
11
- loadAsync(): Promise<SemanticSceneGroup>;
11
+ loadAsync(): Promise<SemanticGroup>;
12
12
  clearCache(): void;
13
13
  dispose(): void;
14
14
  }
@@ -1,5 +1,5 @@
1
1
  import { type LoadingManager, type Object3D } from 'three/webgpu';
2
- import { SemanticSceneGroup } from './objects/SemanticSceneGroup';
2
+ import { SemanticGroup } from './objects/SemanticGroup';
3
3
  import type { SemanticObject } from './semantic.types';
4
4
  import type { ITreeData } from '../types';
5
5
  export interface SemanticParserOptions {
@@ -10,6 +10,6 @@ export interface SemanticParserOptions {
10
10
  }
11
11
  export declare class SemanticParser {
12
12
  #private;
13
- parse(semanticData: SemanticObject): SemanticSceneGroup;
14
- parseAsync(semanticData: SemanticObject, options?: SemanticParserOptions): Promise<SemanticSceneGroup>;
13
+ parse(semanticData: SemanticObject): SemanticGroup;
14
+ parseAsync(semanticData: SemanticObject, options?: SemanticParserOptions): Promise<SemanticGroup>;
15
15
  }
@@ -5,7 +5,7 @@ export * from './objects/VerticalShaftMesh';
5
5
  export * from './objects/ElevatorMesh';
6
6
  export * from './objects/VentMesh';
7
7
  export * from './objects/BuildingGroup';
8
- export * from './objects/SemanticSceneGroup';
8
+ export * from './objects/SemanticGroup';
9
9
  export * from './objects/FacilityInstancedLayer';
10
10
  export * from './SemanticParser';
11
11
  export * from './SemanticLoader';
@@ -1,10 +1,10 @@
1
- import type { ColorRepresentation, Object3D } from 'three/webgpu';
2
1
  import { BaseGroup } from 'u-space';
3
2
  import type { ElevatorMesh } from './ElevatorMesh';
4
3
  import type { FloorMesh, FloorSemanticKind } from './FloorMesh';
5
4
  import type { VentMesh } from './VentMesh';
5
+ import type { SemanticInstanceObject } from '../../instances';
6
6
  export type BuildingFloorReference = FloorMesh | number;
7
- export type BuildingFacilityReference = Object3D | string;
7
+ export type BuildingFacilityReference = SemanticInstanceObject | string;
8
8
  export declare class BuildingGroup extends BaseGroup {
9
9
  #private;
10
10
  isBuildingGroup: boolean;
@@ -31,17 +31,11 @@ export declare class BuildingGroup extends BaseGroup {
31
31
  showAllFloors(): this;
32
32
  showAllFacilities(): this;
33
33
  hideAllFacilities(): this;
34
- getFacilityById(id: string): Object3D<import("three").Object3DEventMap> | undefined;
35
- setFacilityVisible(facility: BuildingFacilityReference, visible: boolean): this;
36
- showFacility(facility: BuildingFacilityReference): this;
37
- hideFacility(facility: BuildingFacilityReference): this;
38
- setFacilityColor(facility: BuildingFacilityReference, color: ColorRepresentation): this;
39
- resetFacilityColor(facility: BuildingFacilityReference): this;
40
- setFacilityOpacity(facility: BuildingFacilityReference, opacity: number): this;
34
+ getFacilityById(id: string): SemanticInstanceObject | undefined;
41
35
  syncFacilityIndexes(): this;
42
36
  get facilityIndexVersion(): number;
43
37
  getFacilityIndexIds(): MapIterator<string>;
44
- getFacilityIndexObjects(): MapIterator<Object3D<import("three").Object3DEventMap>>;
38
+ getFacilityIndexObjects(): MapIterator<SemanticInstanceObject>;
45
39
  planishFloors(kind?: FloorSemanticKind): this;
46
40
  unplanishFloors(kind?: FloorSemanticKind): this;
47
41
  }
@@ -1,31 +1,12 @@
1
- import { Box3, Color, Group, Object3D, type ColorRepresentation } from 'three/webgpu';
2
- import { BaseGroup } from 'u-space';
3
- export declare class FacilityInstanceObject extends Group {
4
- #private;
1
+ import { SemanticInstanceObject, SemanticModelInstancedLayer, type SemanticInstanceCullingOptions } from '../../instances';
2
+ export declare class FacilityInstanceObject extends SemanticInstanceObject {
5
3
  isFacilityInstanceObject: boolean;
6
4
  type: string;
7
- setLocalBounds(bounds: Box3): this;
8
- getFacilityBoundingBox(target?: Box3, world?: boolean): Box3;
9
- setFacilityVisible(visible: boolean): this;
10
- setFacilityColor(color: ColorRepresentation): this;
11
- resetFacilityColor(): this;
12
- setFacilityOpacity(opacity: number): this;
13
- getFacilityColor(target?: Color): Color;
14
- hasFacilityColor(): boolean;
15
- getFacilityOpacity(): number;
5
+ constructor();
16
6
  }
17
- export declare class FacilityInstancedLayer extends BaseGroup {
18
- #private;
7
+ export declare class FacilityInstancedLayer extends SemanticModelInstancedLayer<FacilityInstanceObject> {
19
8
  isFacilityInstancedLayer: boolean;
20
9
  type: string;
21
- /** @deprecated No effect; facility culling uses per-instance bounding-box frustum tests only. */
22
- cameraDistanceCulling: boolean;
23
- /** @deprecated No effect; facility culling uses per-instance bounding-box frustum tests only. */
24
- cameraCullDistance: number;
25
- /** @deprecated No effect; facility culling uses per-instance bounding-box frustum tests only. */
26
- cameraCullOverviewFactor: number;
27
- /** @deprecated No effect; facility culling uses per-instance bounding-box frustum tests only. */
28
- cameraCullPlanViewThreshold: number;
29
10
  constructor();
30
- addFacilityBatch(url: string, template: Object3D, facilities: FacilityInstanceObject[]): boolean;
31
11
  }
12
+ export type FacilityInstanceCullingOptions = SemanticInstanceCullingOptions;
@@ -1,7 +1,8 @@
1
1
  import { Box3, BufferGeometry, Matrix4, MeshStandardNodeMaterial, Sphere, Vector3, Vector4, type ColorRepresentation, type Intersection, type Object3D, type Raycaster } from 'three/webgpu';
2
2
  import { BaseMesh, type InteractionEvent, type InteractionEventMap } from 'u-space';
3
3
  import type { SemanticColor, SemanticGeometryEntry, SemanticKind } from '../types';
4
- type FacilityReference = Object3D | string;
4
+ import { SemanticInstanceObject } from '../../instances';
5
+ type FacilityReference = SemanticInstanceObject | string;
5
6
  type FacilitySemanticKind = 'Facilities';
6
7
  type FloorMeshMaterial = MeshStandardNodeMaterial | MeshStandardNodeMaterial[];
7
8
  export type FloorSemanticKind = SemanticKind | FacilitySemanticKind;
@@ -11,6 +12,7 @@ export interface FloorGeometrySemanticEntity {
11
12
  id: string;
12
13
  name?: string;
13
14
  index: number;
15
+ object: FloorSemanticInstanceObject;
14
16
  }
15
17
  export interface FloorFacilitySemanticEntity {
16
18
  type: 'object';
@@ -18,7 +20,7 @@ export interface FloorFacilitySemanticEntity {
18
20
  id: string;
19
21
  name?: string;
20
22
  index: number;
21
- object: Object3D;
23
+ object: SemanticInstanceObject;
22
24
  aliases: string[];
23
25
  }
24
26
  export type FloorSemanticEntity = FloorGeometrySemanticEntity | FloorFacilitySemanticEntity;
@@ -33,7 +35,8 @@ export interface FloorMeshIntersection extends Intersection<Object3D> {
33
35
  semanticName?: string;
34
36
  semanticIndex: number;
35
37
  instanceId: number;
36
- facility?: Object3D;
38
+ semanticObject?: SemanticInstanceObject;
39
+ facility?: SemanticInstanceObject;
37
40
  facilityId?: string;
38
41
  }
39
42
  export type FloorMeshInteractionEvent = Omit<InteractionEvent, 'target' | 'currentTarget' | 'intersect'> & {
@@ -44,6 +47,22 @@ export type FloorMeshInteractionEvent = Omit<InteractionEvent, 'target' | 'curre
44
47
  export type FloorMeshEventMap = {
45
48
  [K in keyof InteractionEventMap]: FloorMeshEventPayload<InteractionEventMap[K]>;
46
49
  };
50
+ export declare class FloorSemanticInstanceObject extends SemanticInstanceObject {
51
+ #private;
52
+ isFloorSemanticInstanceObject: boolean;
53
+ type: string;
54
+ readonly floorMesh: FloorMesh;
55
+ readonly semanticIndex: number;
56
+ constructor(floorMesh: FloorMesh, semanticIndex: number);
57
+ setSemanticVisible(visible: boolean): this;
58
+ setSemanticColor(color: ColorRepresentation): this;
59
+ resetSemanticColor(): this;
60
+ setSemanticOpacity(opacity: number): this;
61
+ getSemanticOpacity(): number;
62
+ setSemanticHighlight(color: ColorRepresentation, opacity: number, overwrite?: boolean): this;
63
+ clearSemanticHighlight(): this;
64
+ getSemanticBoundingBox(target?: Box3, world?: boolean): Box3;
65
+ }
47
66
  export declare class FloorMesh extends BaseMesh<BufferGeometry, FloorMeshMaterial, FloorMeshEventMap> {
48
67
  #private;
49
68
  isFloorMergedSemanticMesh: boolean;
@@ -59,8 +78,8 @@ export declare class FloorMesh extends BaseMesh<BufferGeometry, FloorMeshMateria
59
78
  staircasesInstances: Map<string, number>;
60
79
  semanticInstances: Map<string, number>;
61
80
  semanticEntities: Map<string, FloorSemanticEntity>;
62
- facilityObjectsById: Map<string, Object3D>;
63
- facilityObjects: Object3D[];
81
+ facilityObjectsById: Map<string, SemanticInstanceObject>;
82
+ facilityObjects: SemanticInstanceObject[];
64
83
  facilityIndexVersion: number;
65
84
  constructor(entries: SemanticGeometryEntry[]);
66
85
  planish(kind?: FloorSemanticKind): this;
@@ -74,20 +93,16 @@ export declare class FloorMesh extends BaseMesh<BufferGeometry, FloorMeshMateria
74
93
  getSemanticIdAt(index: number): string;
75
94
  getSemanticKindAt(index: number): SemanticKind;
76
95
  getSemanticNameAt(index: number): string | undefined;
96
+ getSemanticObjectAt(index: number): FloorSemanticInstanceObject;
77
97
  showAllFacilities(): this;
78
98
  hideAllFacilities(): this;
79
- addFacility(object: Object3D, ids?: string | string[]): this;
80
- getFacilityById(id: string): Object3D<import("three").Object3DEventMap> | undefined;
81
- getFacilityAt(index: number): Object3D<import("three").Object3DEventMap>;
82
- getFacilities(): Object3D<import("three").Object3DEventMap>[];
83
- setFacilityVisible(facility: FacilityReference, visible: boolean): this;
84
- showFacility(facility: FacilityReference): this;
85
- hideFacility(facility: FacilityReference): this;
86
- setFacilityColor(facility: FacilityReference, color: ColorRepresentation): this;
87
- resetFacilityColor(facility: FacilityReference): this;
88
- setFacilityOpacity(facility: FacilityReference, opacity: number): this;
99
+ addFacility(object: SemanticInstanceObject, ids?: string | string[]): this;
100
+ getFacilityById(id: string): SemanticInstanceObject | undefined;
101
+ getFacilityAt(index: number): SemanticInstanceObject;
102
+ getFacilities(): SemanticInstanceObject[];
89
103
  removeFacility(facility: FacilityReference): this;
90
104
  setColorAt(index: number, color: SemanticColor): this;
105
+ resetColorAt(index: number): this;
91
106
  getColorAt(index: number, target?: Vector4): Vector4;
92
107
  setOpacityAt(index: number, opacity: number): this;
93
108
  getOpacityAt(index: number): number;
@@ -0,0 +1,26 @@
1
+ import { type Object3D } from 'three/webgpu';
2
+ import { BaseGroup } from 'u-space';
3
+ import type { BuildingGroup } from './BuildingGroup';
4
+ import type { FloorMesh, FloorSemanticKind } from './FloorMesh';
5
+ import type { SemanticInstanceObject } from '../../instances';
6
+ export declare class SemanticGroup extends BaseGroup {
7
+ #private;
8
+ isSemanticGroup: boolean;
9
+ type: string;
10
+ buildings: BuildingGroup[];
11
+ facilityLayer: Object3D | null;
12
+ constructor();
13
+ addBuilding(group: BuildingGroup): this;
14
+ getBuildingAt(index: number): BuildingGroup;
15
+ getBuildingById(id: string): BuildingGroup | undefined;
16
+ getBuildings(): BuildingGroup[];
17
+ removeBuilding(group: BuildingGroup): this;
18
+ get floorMeshes(): FloorMesh[];
19
+ setFacilityLayer(layer: Object3D | null): this;
20
+ showAllFacilities(): this;
21
+ hideAllFacilities(): this;
22
+ getFacilityById(id: string): SemanticInstanceObject | undefined;
23
+ showAllFloors(): this;
24
+ planishFloors(kind?: FloorSemanticKind): this;
25
+ unplanishFloors(kind?: FloorSemanticKind): this;
26
+ }
@@ -19,6 +19,7 @@ export interface SemanticObjectState {
19
19
  matrix: Matrix4;
20
20
  finalMatrix: Matrix4;
21
21
  geometry: BufferGeometry;
22
+ initialColor: Vector4;
22
23
  color: Vector4;
23
24
  visible: boolean;
24
25
  }
@@ -4,6 +4,7 @@ export interface HighlightColorOptions {
4
4
  color?: ColorRepresentation;
5
5
  overwrite?: boolean;
6
6
  depthWrite?: boolean;
7
+ multiplyOpacity?: boolean;
7
8
  }
8
9
  export interface BreatheColorOptions {
9
10
  color?: ColorRepresentation;
@@ -1,4 +1,7 @@
1
1
  import { Line, type Scene, type ColorRepresentation, Group } from 'three/webgpu';
2
+ export type AnnotationLabelStyle = {
3
+ [K in keyof CSSStyleDeclaration as CSSStyleDeclaration[K] extends string ? K : never]?: CSSStyleDeclaration[K];
4
+ };
2
5
  export interface AnnotationOptions {
3
6
  /** Position of the annotation anchor in 3D space */
4
7
  position: {
@@ -19,7 +22,7 @@ export interface AnnotationOptions {
19
22
  /** Leader line color */
20
23
  lineColor?: ColorRepresentation;
21
24
  /** CSS styles for the label element */
22
- labelStyle?: Partial<CSSStyleDeclaration>;
25
+ labelStyle?: AnnotationLabelStyle;
23
26
  }
24
27
  export interface Annotation {
25
28
  id: string;
@@ -12,8 +12,9 @@ export interface SSGIConfig {
12
12
  radius?: number;
13
13
  thickness?: number;
14
14
  }
15
- export type OutputNodeComposer = (scenePass: PassNode) => Node;
16
- export type OutputNodeEffect = ((scenePass: PassNode, inputNode: Node) => Node) & {
15
+ export type ColorOutputNode = Node<'vec4'>;
16
+ export type OutputNodeComposer = (scenePass: PassNode) => ColorOutputNode;
17
+ export type OutputNodeEffect = ((scenePass: PassNode, inputNode: ColorOutputNode) => ColorOutputNode) & {
17
18
  includesTemporalAntialias?: boolean;
18
19
  includesOutputTransform?: boolean;
19
20
  };
@@ -27,11 +28,11 @@ export declare class RenderPipeline extends RenderPipelineBase {
27
28
  constructor(...args: Args);
28
29
  /** @deprecated Use `scenePass` instead */
29
30
  get currentOutputNode(): PassNode;
30
- addOverlayPass(pass: Node): void;
31
- removeOverlayPass(pass: Node): void;
31
+ addOverlayPass(pass: ColorOutputNode): void;
32
+ removeOverlayPass(pass: ColorOutputNode): void;
32
33
  setCamera(camera: Camera): void;
33
34
  /** @deprecated Use `setOutputComposer` instead */
34
- setCurrentOutputNode(node: Node): void;
35
+ setCurrentOutputNode(node: ColorOutputNode): void;
35
36
  /** @deprecated Use `setOutputComposer(null)` instead */
36
37
  resetCurrentOutputNode(): void;
37
38
  setOutputComposer(composer: OutputNodeComposer | null): void;
@@ -5,6 +5,8 @@
5
5
  ## `MaterialEffects`
6
6
 
7
7
  静态工具类,将基于 TSL 的视觉特效直接应用于对象的材质。适用于任何 `Object3D`(支持单个或数组),会自动遍历所有子网格。
8
+ 当对象是 `SemanticInstanceObject`(例如 `SceneInstanceObject`、`FacilityInstanceObject` 或楼层里的 `FloorSemanticInstanceObject`)时,`highlightColor()` / `removeHighlightColor()` 会通过 `setSemanticHighlight()` / `clearSemanticHighlight()` 改写该语义实例的颜色和透明度,而不是改动共享 batch 材质。
9
+ `SemanticInstanceObject` 支持 `overwrite` 的替换/染色语义;`depthWrite` 属于共享 batch 材质状态,不能按单个实例设置,因此对该类对象不会生效。
8
10
 
9
11
  特性:
10
12
  - **效果可叠加**:高亮和呼吸效果可同时作用于同一对象,呼吸在高亮结果之上混合
@@ -48,6 +50,7 @@ MaterialEffects.highlightColor([model1, model2], { color: 0x00ff00 });
48
50
  | `opacity` | `number` | `0.5` | 高亮时材质的透明度。 |
49
51
  | `overwrite` | `boolean` | `false` | `false` = 与原始颜色相乘(叠加);`true` = 完全替换颜色。 |
50
52
  | `depthWrite` | `boolean` | — | 可选。设为 `false` 可产生 X 光透视效果。不设置时保持原始值。 |
53
+ | `multiplyOpacity` | `boolean` | `false` | 可选。设为 `true` 时高亮透明度会与材质原始透明度相乘,主要用于语义 fallback 模型内部。 |
51
54
 
52
55
  ### `MaterialEffects.removeHighlightColor(object)`
53
56
 
@@ -16,6 +16,7 @@ viewer.interactionManager.pointerMoveEventsEnabled = true;
16
16
  ### 目标对象
17
17
 
18
18
  可以限制射线检测所针对的对象范围。默认值为 `scene.children`(即整个场景的直接子级,含递归嵌套)。
19
+ `BaseMesh` / `BaseGroup` 默认会在自身 `visible === false` 时让 `raycast()` 返回 `false`,从而阻止自身和子级继续参与递归射线检测;如需隐藏但仍可交互,可将对象的 `ignoreInvisibleWhenRaycast` 设为 `false`。`setInteractable(object, false)` / `addIgnore(object)` 会在命中后过滤该对象及其子对象。
19
20
 
20
21
  ```typescript
21
22
  // 仅检测指定对象
@@ -129,7 +129,7 @@ viewer.objectManager.showAll();
129
129
 
130
130
  #### `setOpacity(id: string, opacity: number)`
131
131
 
132
- 设置指定对象所有材质的透明度。
132
+ 设置指定对象所有材质的透明度。对于 `SemanticInstanceObject`(例如 `SceneInstanceObject`、`FacilityInstanceObject` 或 `FloorSemanticInstanceObject`),会调用 `setSemanticOpacity()` 写入该实例的透明度,而不会影响同一模型 path 或同一楼层内的其他实例。
133
133
 
134
134
  ```typescript
135
135
  viewer.objectManager.setOpacity('building-01', 0.3);