u-space 0.0.28 → 0.0.30

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 (73) hide show
  1. package/README.md +9 -0
  2. package/dist/Viewer-BKNV67Jj.cjs +1 -0
  3. package/dist/Viewer-Cs_y7IiH.js +1256 -0
  4. package/dist/index.cjs +3 -3
  5. package/dist/index.js +1715 -1497
  6. package/dist/plugins/atmosphere/AgxToneMapping.d.ts +1 -1
  7. package/dist/plugins/atmosphere/index.cjs +1 -1
  8. package/dist/plugins/atmosphere/index.js +4 -4
  9. package/dist/plugins/curve-movement/index.cjs +1 -1
  10. package/dist/plugins/curve-movement/index.js +1 -1
  11. package/dist/plugins/fire/index.cjs +1 -1
  12. package/dist/plugins/fire/index.js +5 -5
  13. package/dist/plugins/object-controls/index.cjs +1 -1
  14. package/dist/plugins/object-controls/index.js +4 -4
  15. package/dist/plugins/tiles/index.cjs +1 -1
  16. package/dist/plugins/tiles/index.js +5 -5
  17. package/dist/plugins/u-manager/index.cjs +51 -51
  18. package/dist/plugins/u-manager/index.d.ts +1 -1
  19. package/dist/plugins/u-manager/index.js +8330 -8637
  20. package/dist/plugins/u-manager/loaders/SceneEditableBatchLayer.d.ts +17 -0
  21. package/dist/plugins/u-manager/loaders/SceneInstancedLayer.d.ts +3 -3
  22. package/dist/plugins/u-manager/loaders/SceneLoader.d.ts +20 -3
  23. package/dist/plugins/u-manager/loaders/UManagerLoader.d.ts +4 -4
  24. package/dist/plugins/u-manager/semantics/objects/BuildingGroup.d.ts +12 -5
  25. package/dist/plugins/u-manager/semantics/objects/FacilityInstancedLayer.d.ts +4 -4
  26. package/dist/plugins/u-manager/semantics/objects/FloorMesh.d.ts +28 -22
  27. package/dist/plugins/u-manager/semantics/objects/SemanticGroup.d.ts +6 -6
  28. package/dist/protocol-C-OMPz15.js +10 -0
  29. package/dist/protocol-IUAzx0lk.cjs +1 -0
  30. package/dist/src/batches/EditableGeometryBatchLayer.d.ts +50 -0
  31. package/dist/src/batches/ModelInstancedLayer.d.ts +42 -0
  32. package/dist/src/batches/index.d.ts +2 -0
  33. package/dist/src/effects/TSLEffects.d.ts +24 -1
  34. package/dist/src/index.d.ts +2 -0
  35. package/dist/src/instances/InstanceObject.d.ts +57 -0
  36. package/dist/src/instances/index.d.ts +1 -0
  37. package/dist/src/interactions/MeshBVHRaycast.d.ts +9 -0
  38. package/dist/src/interactions/index.d.ts +1 -0
  39. package/dist/src/viewers/RenderPipeline.d.ts +37 -0
  40. package/dist/src/viewers/ReversedDepthSSGICompat.d.ts +10 -0
  41. package/dist/src/viewers/ReversedDepthSSRCompat.d.ts +20 -0
  42. package/dist/src/viewers/Viewer.d.ts +3 -1
  43. package/dist/src/viewers/renderInvalidation.d.ts +2 -0
  44. package/dist/src/worker/FrameTimingWindow.d.ts +16 -0
  45. package/dist/src/worker/OffscreenViewerHost.d.ts +20 -0
  46. package/dist/src/worker/WorkerDomTarget.d.ts +44 -0
  47. package/dist/src/worker/createWorkerViewer.d.ts +18 -0
  48. package/dist/src/worker/index.d.ts +2 -0
  49. package/dist/src/worker/installWorkerImageLoader.d.ts +5 -0
  50. package/dist/src/worker/protocol.d.ts +102 -0
  51. package/dist/src/worker/runtime.d.ts +2 -0
  52. package/dist/worker/index.cjs +1 -0
  53. package/dist/worker/index.js +224 -0
  54. package/dist/worker/runtime.cjs +1 -0
  55. package/dist/worker/runtime.js +418 -0
  56. package/docs/api-batches.md +112 -0
  57. package/docs/api-effects.md +2 -2
  58. package/docs/api-interactions.md +8 -0
  59. package/docs/api-managers.md +1 -1
  60. package/docs/api-objects.md +207 -0
  61. package/docs/api-plugin-u-manager.md +245 -96
  62. package/docs/api-render-pipeline.md +103 -5
  63. package/docs/api-viewer.md +188 -1
  64. package/docs/changelog.md +69 -6
  65. package/docs/examples-guide.md +111 -17
  66. package/docs/getting-started.md +1 -1
  67. package/docs/index.md +11 -4
  68. package/docs/mcp.md +29 -14
  69. package/docs/release.md +95 -0
  70. package/package.json +27 -4
  71. package/dist/plugins/u-manager/instances/SemanticInstanceObject.d.ts +0 -37
  72. package/dist/plugins/u-manager/instances/SemanticModelInstancedLayer.d.ts +0 -33
  73. package/dist/plugins/u-manager/instances/index.d.ts +0 -2
@@ -0,0 +1,17 @@
1
+ import { EditableGeometryBatchLayer, type EditableGeometryBatchBuildResult, type EditableGeometryBatchOptions, type EditableGeometryBatchStats, type Model, type UnsupportedEditableGeometryBatch } from 'u-space';
2
+ import type { SceneInstanceObject } from './SceneInstancedLayer';
3
+ export type SceneEditableBatchOptions = EditableGeometryBatchOptions;
4
+ export type SceneEditableBatchStats = EditableGeometryBatchStats;
5
+ export interface UnsupportedSceneBatch extends UnsupportedEditableGeometryBatch<SceneInstanceObject> {
6
+ url: string;
7
+ }
8
+ export interface SceneEditableBatchBuildResult extends EditableGeometryBatchBuildResult<SceneInstanceObject> {
9
+ unsupported: UnsupportedSceneBatch[];
10
+ }
11
+ export declare class SceneEditableBatchLayer extends EditableGeometryBatchLayer<SceneInstanceObject> {
12
+ isSceneEditableBatchLayer: boolean;
13
+ type: string;
14
+ constructor(options?: SceneEditableBatchOptions);
15
+ addTemplate(url: string, template: Model, instances: SceneInstanceObject[]): boolean;
16
+ build(): SceneEditableBatchBuildResult;
17
+ }
@@ -1,11 +1,11 @@
1
1
  import type { Object3D } from 'three/webgpu';
2
- import { SemanticInstanceObject, SemanticModelInstancedLayer } from '../instances';
3
- export declare class SceneInstanceObject extends SemanticInstanceObject {
2
+ import { InstanceObject, ModelInstancedLayer } from 'u-space';
3
+ export declare class SceneInstanceObject extends InstanceObject {
4
4
  isSceneInstanceObject: boolean;
5
5
  type: string;
6
6
  constructor();
7
7
  }
8
- export declare class SceneInstancedLayer extends SemanticModelInstancedLayer<SceneInstanceObject> {
8
+ export declare class SceneInstancedLayer extends ModelInstancedLayer<SceneInstanceObject> {
9
9
  isSceneInstancedLayer: boolean;
10
10
  type: string;
11
11
  constructor();
@@ -1,15 +1,32 @@
1
- import { Group, Loader } from 'three/webgpu';
2
- import { Model, type Viewer } from 'u-space';
1
+ import { Loader } from 'three/webgpu';
2
+ import { Model, type Viewer, BaseGroup } from 'u-space';
3
+ import { SceneInstancedLayer } from './SceneInstancedLayer';
4
+ import { SceneEditableBatchLayer, type SceneEditableBatchOptions } from './SceneEditableBatchLayer';
3
5
  import type { ITreeData } from '../types';
6
+ export declare class SceneGroup extends BaseGroup {
7
+ isSceneGroup: boolean;
8
+ type: string;
9
+ sceneLayer: SceneInstancedLayer | SceneEditableBatchLayer | null;
10
+ constructor();
11
+ setSceneLayer(layer: SceneInstancedLayer | SceneEditableBatchLayer | null): this;
12
+ getDefaultSceneLayer(): SceneInstancedLayer | SceneEditableBatchLayer | null;
13
+ }
4
14
  export declare class SceneLoader extends Loader {
5
15
  #private;
6
16
  viewer: Viewer;
7
17
  key: string;
8
18
  cachedIds: Set<string>;
19
+ editableBatchOptions: SceneEditableBatchOptions | null;
9
20
  protected _resourceData: any;
10
21
  protected _treeData: ITreeData[];
11
22
  constructor(viewer: Viewer);
12
23
  setKey(key: string): this;
24
+ /**
25
+ * Merge mostly-static scene models into editable GPU batches. Logical scene
26
+ * objects remain addressable; transform or opacity edits materialize only the
27
+ * edited object back into an ordinary model.
28
+ */
29
+ setEditableBatching(options?: boolean | SceneEditableBatchOptions): this;
13
30
  protected loadModel(url: string): Promise<Model>;
14
31
  protected _preareTreeData(): Promise<void>;
15
32
  protected _prepareSemanticIds(): Promise<ReadonlySet<string>>;
@@ -18,7 +35,7 @@ export declare class SceneLoader extends Loader {
18
35
  * @param options
19
36
  * @returns
20
37
  */
21
- loadAsync(): Promise<Group>;
38
+ loadAsync(): Promise<SceneGroup>;
22
39
  clearCache(): void;
23
40
  dispose(): void;
24
41
  }
@@ -1,14 +1,14 @@
1
- import { Loader, type Group } from 'three/webgpu';
1
+ import { Loader } from 'three/webgpu';
2
2
  import { BaseGroup, type Viewer } from 'u-space';
3
- import { SceneLoader } from './SceneLoader';
3
+ import { SceneLoader, type SceneGroup } from './SceneLoader';
4
4
  import { SemanticLoader } from '../semantics/SemanticLoader';
5
5
  import type { SemanticGroup } from '../semantics';
6
6
  export declare class UManagerSceneGroup extends BaseGroup {
7
7
  isUManagerSceneGroup: boolean;
8
8
  type: string;
9
9
  semanticGroup: SemanticGroup;
10
- sceneGroup: Group;
11
- constructor(semanticGroup: SemanticGroup, sceneGroup: Group);
10
+ sceneGroup: SceneGroup;
11
+ constructor(semanticGroup: SemanticGroup, sceneGroup: SceneGroup);
12
12
  }
13
13
  export declare class UManagerLoader extends Loader {
14
14
  #private;
@@ -1,18 +1,25 @@
1
- import { BaseGroup } from 'u-space';
1
+ import { BaseGroup, type InstanceObject } from 'u-space';
2
2
  import type { ElevatorMesh } from './ElevatorMesh';
3
3
  import type { FloorMesh, FloorSemanticKind } from './FloorMesh';
4
4
  import type { VentMesh } from './VentMesh';
5
- import type { SemanticInstanceObject } from '../../instances';
6
5
  export type BuildingFloorReference = FloorMesh | number;
7
- export type BuildingFacilityReference = SemanticInstanceObject | string;
6
+ export type BuildingFacilityReference = InstanceObject | string;
8
7
  export declare class BuildingGroup extends BaseGroup {
9
8
  #private;
10
9
  isBuildingGroup: boolean;
11
10
  type: string;
11
+ semanticId: string;
12
+ semanticKind: string;
13
+ semanticName: string;
12
14
  floorMeshes: FloorMesh[];
13
15
  elevatorMeshes: ElevatorMesh[];
14
16
  ventMeshes: VentMesh[];
15
17
  constructor();
18
+ setSemanticIdentity(identity: {
19
+ id?: string | null;
20
+ kind?: string | null;
21
+ name?: string | null;
22
+ }): this;
16
23
  addFloor(mesh: FloorMesh): this;
17
24
  hasFloor(mesh: FloorMesh): boolean;
18
25
  getFloorAt(index: number): FloorMesh;
@@ -31,11 +38,11 @@ export declare class BuildingGroup extends BaseGroup {
31
38
  showAllFloors(): this;
32
39
  showAllFacilities(): this;
33
40
  hideAllFacilities(): this;
34
- getFacilityById(id: string): SemanticInstanceObject | undefined;
41
+ getFacilityById(id: string): InstanceObject | undefined;
35
42
  syncFacilityIndexes(): this;
36
43
  get facilityIndexVersion(): number;
37
44
  getFacilityIndexIds(): MapIterator<string>;
38
- getFacilityIndexObjects(): MapIterator<SemanticInstanceObject>;
45
+ getFacilityIndexObjects(): MapIterator<InstanceObject>;
39
46
  planishFloors(kind?: FloorSemanticKind): this;
40
47
  unplanishFloors(kind?: FloorSemanticKind): this;
41
48
  }
@@ -1,12 +1,12 @@
1
- import { SemanticInstanceObject, SemanticModelInstancedLayer, type SemanticInstanceCullingOptions } from '../../instances';
2
- export declare class FacilityInstanceObject extends SemanticInstanceObject {
1
+ import { InstanceObject, ModelInstancedLayer, type InstanceCullingOptions } from 'u-space';
2
+ export declare class FacilityInstanceObject extends InstanceObject {
3
3
  isFacilityInstanceObject: boolean;
4
4
  type: string;
5
5
  constructor();
6
6
  }
7
- export declare class FacilityInstancedLayer extends SemanticModelInstancedLayer<FacilityInstanceObject> {
7
+ export declare class FacilityInstancedLayer extends ModelInstancedLayer<FacilityInstanceObject> {
8
8
  isFacilityInstancedLayer: boolean;
9
9
  type: string;
10
10
  constructor();
11
11
  }
12
- export type FacilityInstanceCullingOptions = SemanticInstanceCullingOptions;
12
+ export type FacilityInstanceCullingOptions = InstanceCullingOptions;
@@ -1,8 +1,7 @@
1
1
  import { Box3, BufferGeometry, Matrix4, MeshStandardNodeMaterial, Sphere, Vector3, Vector4, type ColorRepresentation, type Intersection, type Object3D, type Raycaster } from 'three/webgpu';
2
- import { BaseMesh, type InteractionEvent, type InteractionEventMap } from 'u-space';
2
+ import { BaseMesh, InstanceObject, type InteractionEvent, type InteractionEventMap } from 'u-space';
3
3
  import type { SemanticColor, SemanticGeometryEntry, SemanticKind } from '../types';
4
- import { SemanticInstanceObject } from '../../instances';
5
- type FacilityReference = SemanticInstanceObject | string;
4
+ type FacilityReference = InstanceObject | string;
6
5
  type FacilitySemanticKind = 'Facilities';
7
6
  type FloorMeshMaterial = MeshStandardNodeMaterial | MeshStandardNodeMaterial[];
8
7
  export type FloorSemanticKind = SemanticKind | FacilitySemanticKind;
@@ -20,7 +19,7 @@ export interface FloorFacilitySemanticEntity {
20
19
  id: string;
21
20
  name?: string;
22
21
  index: number;
23
- object: SemanticInstanceObject;
22
+ object: InstanceObject;
24
23
  aliases: string[];
25
24
  }
26
25
  export type FloorSemanticEntity = FloorGeometrySemanticEntity | FloorFacilitySemanticEntity;
@@ -34,9 +33,8 @@ export interface FloorMeshIntersection extends Intersection<Object3D> {
34
33
  semanticKind: FloorSemanticKind;
35
34
  semanticName?: string;
36
35
  semanticIndex: number;
37
- instanceId: number;
38
- semanticObject?: SemanticInstanceObject;
39
- facility?: SemanticInstanceObject;
36
+ semanticObject?: InstanceObject;
37
+ facility?: InstanceObject;
40
38
  facilityId?: string;
41
39
  }
42
40
  export type FloorMeshInteractionEvent = Omit<InteractionEvent, 'target' | 'currentTarget' | 'intersect'> & {
@@ -47,26 +45,29 @@ export type FloorMeshInteractionEvent = Omit<InteractionEvent, 'target' | 'curre
47
45
  export type FloorMeshEventMap = {
48
46
  [K in keyof InteractionEventMap]: FloorMeshEventPayload<InteractionEventMap[K]>;
49
47
  };
50
- export declare class FloorSemanticInstanceObject extends SemanticInstanceObject {
48
+ export declare class FloorSemanticInstanceObject extends InstanceObject {
51
49
  #private;
52
50
  isFloorSemanticInstanceObject: boolean;
53
51
  type: string;
54
52
  readonly floorMesh: FloorMesh;
55
53
  readonly semanticIndex: number;
56
54
  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;
55
+ setInstanceVisible(visible: boolean): this;
56
+ setInstanceColor(color: ColorRepresentation): this;
57
+ resetInstanceColor(): this;
58
+ setInstanceOpacity(opacity: number): this;
59
+ getInstanceOpacity(): number;
60
+ setInstanceHighlight(color: ColorRepresentation, opacity: number, overwrite?: boolean): this;
61
+ clearInstanceHighlight(): this;
62
+ getInstanceBoundingBox(target?: Box3, world?: boolean): Box3;
65
63
  }
66
64
  export declare class FloorMesh extends BaseMesh<BufferGeometry, FloorMeshMaterial, FloorMeshEventMap> {
67
65
  #private;
68
66
  isFloorMergedSemanticMesh: boolean;
69
67
  type: string;
68
+ semanticId: string;
69
+ semanticKind: string;
70
+ semanticName: string;
70
71
  pivot: Vector3;
71
72
  boundingBox: Box3 | null;
72
73
  boundingSphere: Sphere | null;
@@ -78,10 +79,15 @@ export declare class FloorMesh extends BaseMesh<BufferGeometry, FloorMeshMateria
78
79
  staircasesInstances: Map<string, number>;
79
80
  semanticInstances: Map<string, number>;
80
81
  semanticEntities: Map<string, FloorSemanticEntity>;
81
- facilityObjectsById: Map<string, SemanticInstanceObject>;
82
- facilityObjects: SemanticInstanceObject[];
82
+ facilityObjectsById: Map<string, InstanceObject>;
83
+ facilityObjects: InstanceObject[];
83
84
  facilityIndexVersion: number;
84
85
  constructor(entries: SemanticGeometryEntry[]);
86
+ setSemanticIdentity(identity: {
87
+ id?: string | null;
88
+ kind?: string | null;
89
+ name?: string | null;
90
+ }): this;
85
91
  planish(kind?: FloorSemanticKind): this;
86
92
  unplanish(kind?: FloorSemanticKind): this;
87
93
  get semanticCount(): number;
@@ -96,10 +102,10 @@ export declare class FloorMesh extends BaseMesh<BufferGeometry, FloorMeshMateria
96
102
  getSemanticObjectAt(index: number): FloorSemanticInstanceObject;
97
103
  showAllFacilities(): this;
98
104
  hideAllFacilities(): this;
99
- addFacility(object: SemanticInstanceObject, ids?: string | string[]): this;
100
- getFacilityById(id: string): SemanticInstanceObject | undefined;
101
- getFacilityAt(index: number): SemanticInstanceObject;
102
- getFacilities(): SemanticInstanceObject[];
105
+ addFacility(object: InstanceObject, ids?: string | string[]): this;
106
+ getFacilityById(id: string): InstanceObject | undefined;
107
+ getFacilityAt(index: number): InstanceObject;
108
+ getFacilities(): InstanceObject[];
103
109
  removeFacility(facility: FacilityReference): this;
104
110
  setColorAt(index: number, color: SemanticColor): this;
105
111
  resetColorAt(index: number): this;
@@ -1,14 +1,13 @@
1
- import { type Object3D } from 'three/webgpu';
2
- import { BaseGroup } from 'u-space';
1
+ import { BaseGroup, type InstanceObject } from 'u-space';
3
2
  import type { BuildingGroup } from './BuildingGroup';
3
+ import type { FacilityInstancedLayer } from './FacilityInstancedLayer';
4
4
  import type { FloorMesh, FloorSemanticKind } from './FloorMesh';
5
- import type { SemanticInstanceObject } from '../../instances';
6
5
  export declare class SemanticGroup extends BaseGroup {
7
6
  #private;
8
7
  isSemanticGroup: boolean;
9
8
  type: string;
10
9
  buildings: BuildingGroup[];
11
- facilityLayer: Object3D | null;
10
+ facilityLayer: FacilityInstancedLayer | null;
12
11
  constructor();
13
12
  addBuilding(group: BuildingGroup): this;
14
13
  getBuildingAt(index: number): BuildingGroup;
@@ -16,10 +15,11 @@ export declare class SemanticGroup extends BaseGroup {
16
15
  getBuildings(): BuildingGroup[];
17
16
  removeBuilding(group: BuildingGroup): this;
18
17
  get floorMeshes(): FloorMesh[];
19
- setFacilityLayer(layer: Object3D | null): this;
18
+ setFacilityLayer(layer: FacilityInstancedLayer | null): this;
19
+ getDefaultFacilityLayer(): FacilityInstancedLayer | null;
20
20
  showAllFacilities(): this;
21
21
  hideAllFacilities(): this;
22
- getFacilityById(id: string): SemanticInstanceObject | undefined;
22
+ getFacilityById(id: string): InstanceObject | undefined;
23
23
  showAllFloors(): this;
24
24
  planishFloors(kind?: FloorSemanticKind): this;
25
25
  unplanishFloors(kind?: FloorSemanticKind): this;
@@ -0,0 +1,10 @@
1
+ function a(s) {
2
+ return s instanceof Error ? {
3
+ message: s.message,
4
+ name: s.name,
5
+ stack: s.stack
6
+ } : { message: String(s) };
7
+ }
8
+ export {
9
+ a as s
10
+ };
@@ -0,0 +1 @@
1
+ "use strict";function e(s){return s instanceof Error?{message:s.message,name:s.name,stack:s.stack}:{message:String(s)}}exports.serializeError=e;
@@ -0,0 +1,50 @@
1
+ import { Object3D } from 'three/webgpu';
2
+ import { BaseGroup, Model } from '../objects';
3
+ import { InstanceObject } from '../instances/InstanceObject';
4
+ import type { InteractionEventMap } from '../interactions/InteractionEvent';
5
+ export interface EditableGeometryBatchOptions {
6
+ maxVerticesPerBatch?: number;
7
+ maxIndicesPerBatch?: number;
8
+ /** Bake the current pose of models with animation clips. Playing them later requires materialization. */
9
+ freezeAnimations?: boolean;
10
+ }
11
+ export interface EditableGeometryBatchStats {
12
+ instances: number;
13
+ sourceMeshes: number;
14
+ batches: number;
15
+ drawCallsSaved: number;
16
+ vertices: number;
17
+ indices: number;
18
+ unsupportedInstances: number;
19
+ unsupportedByReason: Record<string, number>;
20
+ }
21
+ export interface EditableGeometryBatchSource<TInstance extends InstanceObject = InstanceObject> {
22
+ key: string;
23
+ template: Model;
24
+ instances: TInstance[];
25
+ }
26
+ export interface UnsupportedEditableGeometryBatch<TInstance extends InstanceObject = InstanceObject> extends EditableGeometryBatchSource<TInstance> {
27
+ reasons: string[];
28
+ }
29
+ export interface EditableGeometryBatchBuildResult<TInstance extends InstanceObject = InstanceObject> {
30
+ stats: EditableGeometryBatchStats;
31
+ unsupported: UnsupportedEditableGeometryBatch<TInstance>[];
32
+ }
33
+ export type EditableGeometryBatchEventMap<TInstance extends InstanceObject = InstanceObject> = InteractionEventMap & {
34
+ materialize: {
35
+ instance: TInstance;
36
+ object: Object3D;
37
+ };
38
+ };
39
+ export declare class EditableGeometryBatchLayer<TInstance extends InstanceObject = InstanceObject> extends BaseGroup<EditableGeometryBatchEventMap<TInstance>> {
40
+ #private;
41
+ isEditableGeometryBatchLayer: boolean;
42
+ type: string;
43
+ readonly options: Required<EditableGeometryBatchOptions>;
44
+ readonly stats: EditableGeometryBatchStats;
45
+ constructor(options?: EditableGeometryBatchOptions);
46
+ addSource(source: EditableGeometryBatchSource<TInstance>): boolean;
47
+ build(): EditableGeometryBatchBuildResult<TInstance>;
48
+ materialize(instance: TInstance): Object3D<import("three").Object3DEventMap> | null;
49
+ dispose(): void;
50
+ }
@@ -0,0 +1,42 @@
1
+ import { Object3D } from 'three/webgpu';
2
+ import { BaseGroup } from '../objects';
3
+ import { InstanceObject } from '../instances/InstanceObject';
4
+ export interface InstanceCullingOptions {
5
+ enabled?: boolean;
6
+ frustum?: boolean;
7
+ minScreenRadius?: number;
8
+ }
9
+ export interface ModelInstancedLayerOptions<T extends InstanceObject> {
10
+ name?: string;
11
+ instanceKind?: string;
12
+ getHitUserData?: (instance: T, renderIndex: number) => Record<string, unknown>;
13
+ }
14
+ export declare class ModelInstancedLayer<T extends InstanceObject = InstanceObject> extends BaseGroup {
15
+ #private;
16
+ isModelInstancedLayer: boolean;
17
+ type: string;
18
+ constructor(options?: ModelInstancedLayerOptions<T>);
19
+ get instanceKind(): string;
20
+ getInstances(): T[];
21
+ getInstanceById(id: string): T | undefined;
22
+ hasInstance(id: string): boolean;
23
+ getInstanceCulling(): {
24
+ enabled: boolean;
25
+ frustum: boolean;
26
+ minScreenRadius: number;
27
+ };
28
+ setInstanceCulling(options?: InstanceCullingOptions): this;
29
+ setInstanceVisible(visible: boolean): this;
30
+ setInstanceColor(color: Parameters<InstanceObject['setInstanceColor']>[0]): this;
31
+ resetInstanceColor(): this;
32
+ setInstanceOpacity(opacity: number): this;
33
+ setInstanceHighlight(color: Parameters<InstanceObject['setInstanceHighlight']>[0], opacity: number, overwrite?: boolean): this;
34
+ clearInstanceHighlight(): this;
35
+ reserveBatch(url: string, template: Object3D, capacity: number): boolean;
36
+ addInstance(url: string, template: Object3D, instance: T): boolean;
37
+ addInstances(url: string, template: Object3D, instances: T[]): boolean;
38
+ removeInstance(instanceOrId: T | string): boolean;
39
+ removeInstances(instancesOrIds: Iterable<T | string> | T | string): number;
40
+ removeBatch(url: string): boolean;
41
+ clearBatches(): this;
42
+ }
@@ -0,0 +1,2 @@
1
+ export * from './EditableGeometryBatchLayer';
2
+ export * from './ModelInstancedLayer';
@@ -1,4 +1,26 @@
1
- import { type ColorRepresentation } from 'three/webgpu';
1
+ import { type ColorRepresentation, type Object3D } from 'three/webgpu';
2
+ import type OutlineNode from 'three/addons/tsl/display/OutlineNode.js';
3
+ import type { OutputNodeEffect } from '../viewers/RenderPipeline';
4
+ export interface TSLOutlineOptions {
5
+ selectedObjects?: readonly Object3D[];
6
+ edgeStrength?: number;
7
+ edgeThickness?: number;
8
+ edgeGlow?: number;
9
+ visibleEdgeColor?: ColorRepresentation;
10
+ hiddenEdgeColor?: ColorRepresentation;
11
+ downSampleRatio?: number;
12
+ instanceBoundsProxy?: boolean;
13
+ instanceBoundsPadding?: number;
14
+ instanceBoundsMinSize?: number;
15
+ }
16
+ export type TSLOutlineUpdateOptions = Omit<TSLOutlineOptions, 'selectedObjects'>;
17
+ export interface TSLOutlineEffect extends OutputNodeEffect {
18
+ readonly outlineNode: OutlineNode | null;
19
+ readonly selectedObjects: readonly Object3D[];
20
+ setSelectedObjects(objects: readonly Object3D[]): TSLOutlineEffect;
21
+ update(options: TSLOutlineUpdateOptions): TSLOutlineEffect;
22
+ dispose(): void;
23
+ }
2
24
  export declare class TSLEffects {
3
25
  static flow(parameters?: {
4
26
  baseColor?: ColorRepresentation;
@@ -21,4 +43,5 @@ export declare class TSLEffects {
21
43
  intensity?: number;
22
44
  distortion?: number;
23
45
  }): import("three/webgpu").Node<"vec3">;
46
+ static outline(options?: TSLOutlineOptions): TSLOutlineEffect;
24
47
  }
@@ -6,6 +6,8 @@ export * from './objects';
6
6
  export * from './effects';
7
7
  export * from './animations';
8
8
  export * from './tools';
9
+ export * from './instances';
10
+ export * from './batches';
9
11
  export * from './interfaces';
10
12
  export * from './types';
11
13
  export declare const version: string;
@@ -0,0 +1,57 @@
1
+ import { Box3, BufferGeometry, Color, Object3D, Sphere, type ColorRepresentation } from 'three/webgpu';
2
+ import { BaseGroup } from '../objects';
3
+ export interface InstanceStyle {
4
+ color: Color | null;
5
+ colorMode: number;
6
+ opacity: number;
7
+ }
8
+ export interface InstanceObjectOptions {
9
+ boundsName?: string;
10
+ }
11
+ export interface InstanceIdentity {
12
+ id?: string | null;
13
+ kind?: string | null;
14
+ name?: string | null;
15
+ }
16
+ export type InstanceMaterializer = () => Object3D | null;
17
+ export declare const INSTANCE_COLOR_MODE_NONE = 0;
18
+ export declare const INSTANCE_COLOR_MODE_OVERRIDE = 1;
19
+ export declare const INSTANCE_COLOR_MODE_TINT = 2;
20
+ export declare class InstanceObject extends BaseGroup {
21
+ #private;
22
+ isInstanceObject: boolean;
23
+ type: string;
24
+ instanceId: string;
25
+ instanceKind: string;
26
+ instanceName: string;
27
+ geometry: BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>;
28
+ boundingBox: Box3 | null;
29
+ boundingSphere: Sphere | null;
30
+ constructor(options?: InstanceObjectOptions);
31
+ setInstanceIdentity(identity: InstanceIdentity): this;
32
+ setInstanceBounds(bounds: Box3): this;
33
+ setInstanceRenderObject(object: Object3D | null): this;
34
+ getInstanceRenderObject(): Object3D<import("three").Object3DEventMap> | null;
35
+ setInstanceMaterializer(materializer: InstanceMaterializer | null): this;
36
+ hasInstanceMaterializer(materializer: InstanceMaterializer): boolean;
37
+ clearInstanceMaterializer(materializer?: InstanceMaterializer): this;
38
+ materialize(): Object3D<import("three").Object3DEventMap> | null;
39
+ computeBoundingBox(): void;
40
+ computeBoundingSphere(): void;
41
+ getInstanceBoundingBox(target?: Box3, world?: boolean): Box3;
42
+ setInstanceVisible(visible: boolean): this;
43
+ setInstanceColor(color: ColorRepresentation): this;
44
+ resetInstanceColor(): this;
45
+ setInstanceOpacity(opacity: number): this;
46
+ getInstanceColor(target?: Color): Color;
47
+ hasInstanceColor(): boolean;
48
+ getInstanceOpacity(): number;
49
+ setInstanceHighlight(color: ColorRepresentation, opacity: number, overwrite?: boolean): this;
50
+ clearInstanceHighlight(): this;
51
+ getInstanceColorMode(): number;
52
+ onInstanceRenderDirty(callback: () => void): () => boolean;
53
+ markInstanceRenderDirty(): this;
54
+ updateMatrixWorld(force?: boolean): void;
55
+ updateWorldMatrix(updateParents: boolean, updateChildren: boolean): void;
56
+ }
57
+ export declare function isInstanceObject(object: Object3D): object is InstanceObject;
@@ -0,0 +1 @@
1
+ export * from './InstanceObject';
@@ -0,0 +1,9 @@
1
+ import { type BufferGeometry, type Object3D } from 'three/webgpu';
2
+ import { type GeometryBVH } from 'three-mesh-bvh';
3
+ export declare function getGeometryBoundsTree(geometry: BufferGeometry): GeometryBVH | null;
4
+ /**
5
+ * Installs lazy, per-mesh BVH raycasting without mutating Three.js prototypes.
6
+ * BVHs are shared by geometry and are built only after the ray hits a mesh's
7
+ * world-space bounding sphere.
8
+ */
9
+ export declare function enableMeshBVHRaycast(root: Object3D): Object3D<import("three").Object3DEventMap>;
@@ -1,3 +1,4 @@
1
1
  export * from './InteractionEvent';
2
2
  export * from './InteractionManager';
3
+ export { enableMeshBVHRaycast, getGeometryBoundsTree } from './MeshBVHRaycast';
3
4
  export * from './Selection';
@@ -12,6 +12,40 @@ export interface SSGIConfig {
12
12
  radius?: number;
13
13
  thickness?: number;
14
14
  }
15
+ export interface SSRTemporalReprojectConfig {
16
+ maxFrames?: number;
17
+ clampIntensity?: number;
18
+ flickerSuppression?: number;
19
+ hitPointReprojection?: boolean;
20
+ }
21
+ export interface SSRDenoiseConfig {
22
+ lumaPhi?: number;
23
+ depthPhi?: number;
24
+ normalPhi?: number;
25
+ roughnessPhi?: number;
26
+ radius?: number;
27
+ alphaPhi?: number;
28
+ strength?: number;
29
+ adapt?: number;
30
+ smoothDisocclusions?: boolean;
31
+ flickerSuppression?: number;
32
+ adaptiveTrust?: number;
33
+ }
34
+ export interface SSRConfig {
35
+ resolutionScale?: number;
36
+ quality?: number;
37
+ mirrorBias?: number;
38
+ maxDistance?: number;
39
+ intensity?: number;
40
+ thickness?: number;
41
+ maxLuminance?: number;
42
+ stepExponent?: number;
43
+ binaryRefine?: boolean;
44
+ screenEdgeFade?: number;
45
+ screenEdgeFadeBlack?: boolean;
46
+ temporal?: SSRTemporalReprojectConfig;
47
+ denoise?: SSRDenoiseConfig;
48
+ }
15
49
  export type ColorOutputNode = Node<'vec4'>;
16
50
  export type OutputNodeComposer = (scenePass: PassNode) => ColorOutputNode;
17
51
  export type OutputNodeEffect = ((scenePass: PassNode, inputNode: ColorOutputNode) => ColorOutputNode) & {
@@ -46,6 +80,9 @@ export declare class RenderPipeline extends RenderPipelineBase {
46
80
  enableSSGI(config?: SSGIConfig): void;
47
81
  disableSSGI(): void;
48
82
  updateSSGI(config: Partial<SSGIConfig>): void;
83
+ enableSSR(config?: SSRConfig): void;
84
+ disableSSR(): void;
85
+ updateSSR(config: SSRConfig): void;
49
86
  enableTRAA(): void;
50
87
  disableTRAA(): void;
51
88
  render(): void;
@@ -0,0 +1,10 @@
1
+ import type { Node, PerspectiveCamera } from 'three/webgpu';
2
+ import SSGINode from 'three/addons/tsl/display/SSGINode.js';
3
+ type SetupBuilder = Parameters<SSGINode['setup']>[0] & {
4
+ getSharedContext: () => unknown;
5
+ };
6
+ export declare class ReversedDepthSSGINode extends SSGINode {
7
+ setup(builder: SetupBuilder): Node<unknown> | null | undefined;
8
+ }
9
+ export declare const reversedDepthSSGI: (beautyNode: Node<"vec4">, depthNode: Node, normalNode: Node, camera: PerspectiveCamera) => SSGINode;
10
+ export {};
@@ -0,0 +1,20 @@
1
+ import type { Camera, Node, TextureNode } from 'three/webgpu';
2
+ import RecurrentDenoiseNode, { type RecurrentDenoiseNodeOptions } from 'three/addons/tsl/display/RecurrentDenoiseNode.js';
3
+ import SSRNode, { type SSRNodeOptions } from 'three/addons/tsl/display/SSRNode.js';
4
+ import TemporalReprojectNode, { type TemporalReprojectNodeOptions } from 'three/addons/tsl/display/TemporalReprojectNode.js';
5
+ type SetupBuilder = Parameters<SSRNode['setup']>[0] & {
6
+ getSharedContext: () => unknown;
7
+ };
8
+ export declare class ReversedDepthSSRNode extends SSRNode {
9
+ setup(builder: SetupBuilder): Node<unknown> | null | undefined;
10
+ }
11
+ export declare class ReversedDepthTemporalReprojectNode extends TemporalReprojectNode {
12
+ setup(builder: SetupBuilder): Node<unknown> | null | undefined;
13
+ }
14
+ export declare class ReversedDepthRecurrentDenoiseNode extends RecurrentDenoiseNode {
15
+ setup(builder: SetupBuilder): Node<unknown> | null | undefined;
16
+ }
17
+ export declare const reversedDepthSSR: (colorNode: Node<"vec4">, depthNode: Node<"float"> | Node<"vec4">, normalNode: Node<"vec3">, options?: SSRNodeOptions) => SSRNode;
18
+ export declare const reversedDepthTemporalReproject: (beautyNode: Node<"vec4">, depthNode: TextureNode, normalNode: TextureNode, velocityNode: TextureNode, camera: Camera, options?: TemporalReprojectNodeOptions) => TemporalReprojectNode;
19
+ export declare const reversedDepthRecurrentDenoise: (inputTexture: Node<"vec4">, camera: Camera, options?: RecurrentDenoiseNodeOptions) => RecurrentDenoiseNode;
20
+ export {};
@@ -11,6 +11,7 @@ type ViewerRendererOptions = ConstructorParameters<typeof WebGPURenderer>['0'];
11
11
  export interface ViewerOptions {
12
12
  el: HTMLElement;
13
13
  rendererOptions?: ViewerRendererOptions;
14
+ pixelRatio?: number;
14
15
  }
15
16
  export interface ScreenshotOptions {
16
17
  width?: number;
@@ -64,11 +65,12 @@ declare class Viewer extends EventDispatcher<ViewerEventMap> {
64
65
  cssRenderer: CSSRenderer;
65
66
  frameCount: number;
66
67
  frameloop: 'always' | 'demand';
67
- constructor({ el, rendererOptions }: ViewerOptions);
68
+ constructor({ el, rendererOptions, pixelRatio }: ViewerOptions);
68
69
  onWindowResize: () => void;
69
70
  init(): Promise<void>;
70
71
  setCamera(camera: PerspectiveCamera | OrthographicCamera): void;
71
72
  setCameraByType(type: 'perspective' | 'orthographic'): void;
73
+ invalidate(frame?: number): void;
72
74
  render(frame?: number): Promise<void>;
73
75
  private animate;
74
76
  private _initRenderer;
@@ -0,0 +1,2 @@
1
+ declare function coalesceRenderFrames(pendingFrames: number, requestedFrames?: number): number;
2
+ export { coalesceRenderFrames };