u-space 0.0.29 → 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 (72) 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 +1718 -1503
  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 +48 -48
  18. package/dist/plugins/u-manager/index.d.ts +1 -1
  19. package/dist/plugins/u-manager/index.js +8126 -8660
  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 +11 -3
  23. package/dist/plugins/u-manager/semantics/objects/BuildingGroup.d.ts +4 -5
  24. package/dist/plugins/u-manager/semantics/objects/FacilityInstancedLayer.d.ts +4 -4
  25. package/dist/plugins/u-manager/semantics/objects/FloorMesh.d.ts +20 -22
  26. package/dist/plugins/u-manager/semantics/objects/SemanticGroup.d.ts +2 -3
  27. package/dist/protocol-C-OMPz15.js +10 -0
  28. package/dist/protocol-IUAzx0lk.cjs +1 -0
  29. package/dist/src/batches/EditableGeometryBatchLayer.d.ts +50 -0
  30. package/dist/src/batches/ModelInstancedLayer.d.ts +42 -0
  31. package/dist/src/batches/index.d.ts +2 -0
  32. package/dist/src/effects/TSLEffects.d.ts +24 -1
  33. package/dist/src/index.d.ts +2 -0
  34. package/dist/src/instances/InstanceObject.d.ts +57 -0
  35. package/dist/src/instances/index.d.ts +1 -0
  36. package/dist/src/interactions/MeshBVHRaycast.d.ts +9 -0
  37. package/dist/src/interactions/index.d.ts +1 -0
  38. package/dist/src/viewers/RenderPipeline.d.ts +37 -0
  39. package/dist/src/viewers/ReversedDepthSSGICompat.d.ts +10 -0
  40. package/dist/src/viewers/ReversedDepthSSRCompat.d.ts +20 -0
  41. package/dist/src/viewers/Viewer.d.ts +3 -1
  42. package/dist/src/viewers/renderInvalidation.d.ts +2 -0
  43. package/dist/src/worker/FrameTimingWindow.d.ts +16 -0
  44. package/dist/src/worker/OffscreenViewerHost.d.ts +20 -0
  45. package/dist/src/worker/WorkerDomTarget.d.ts +44 -0
  46. package/dist/src/worker/createWorkerViewer.d.ts +18 -0
  47. package/dist/src/worker/index.d.ts +2 -0
  48. package/dist/src/worker/installWorkerImageLoader.d.ts +5 -0
  49. package/dist/src/worker/protocol.d.ts +102 -0
  50. package/dist/src/worker/runtime.d.ts +2 -0
  51. package/dist/worker/index.cjs +1 -0
  52. package/dist/worker/index.js +224 -0
  53. package/dist/worker/runtime.cjs +1 -0
  54. package/dist/worker/runtime.js +418 -0
  55. package/docs/api-batches.md +112 -0
  56. package/docs/api-effects.md +2 -2
  57. package/docs/api-interactions.md +8 -0
  58. package/docs/api-managers.md +1 -1
  59. package/docs/api-objects.md +207 -0
  60. package/docs/api-plugin-u-manager.md +193 -102
  61. package/docs/api-render-pipeline.md +103 -5
  62. package/docs/api-viewer.md +188 -1
  63. package/docs/changelog.md +53 -12
  64. package/docs/examples-guide.md +98 -20
  65. package/docs/getting-started.md +1 -1
  66. package/docs/index.md +11 -4
  67. package/docs/mcp.md +28 -14
  68. package/docs/release.md +95 -0
  69. package/package.json +27 -4
  70. package/dist/plugins/u-manager/instances/SemanticInstanceObject.d.ts +0 -51
  71. package/dist/plugins/u-manager/instances/SemanticModelInstancedLayer.d.ts +0 -42
  72. 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,24 +1,32 @@
1
1
  import { Loader } from 'three/webgpu';
2
2
  import { Model, type Viewer, BaseGroup } from 'u-space';
3
3
  import { SceneInstancedLayer } from './SceneInstancedLayer';
4
+ import { SceneEditableBatchLayer, type SceneEditableBatchOptions } from './SceneEditableBatchLayer';
4
5
  import type { ITreeData } from '../types';
5
6
  export declare class SceneGroup extends BaseGroup {
6
7
  isSceneGroup: boolean;
7
8
  type: string;
8
- sceneLayer: SceneInstancedLayer | null;
9
+ sceneLayer: SceneInstancedLayer | SceneEditableBatchLayer | null;
9
10
  constructor();
10
- setSceneLayer(layer: SceneInstancedLayer | null): this;
11
- getDefaultSceneLayer(): SceneInstancedLayer | null;
11
+ setSceneLayer(layer: SceneInstancedLayer | SceneEditableBatchLayer | null): this;
12
+ getDefaultSceneLayer(): SceneInstancedLayer | SceneEditableBatchLayer | null;
12
13
  }
13
14
  export declare class SceneLoader extends Loader {
14
15
  #private;
15
16
  viewer: Viewer;
16
17
  key: string;
17
18
  cachedIds: Set<string>;
19
+ editableBatchOptions: SceneEditableBatchOptions | null;
18
20
  protected _resourceData: any;
19
21
  protected _treeData: ITreeData[];
20
22
  constructor(viewer: Viewer);
21
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;
22
30
  protected loadModel(url: string): Promise<Model>;
23
31
  protected _preareTreeData(): Promise<void>;
24
32
  protected _prepareSemanticIds(): Promise<ReadonlySet<string>>;
@@ -1,10 +1,9 @@
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;
@@ -39,11 +38,11 @@ export declare class BuildingGroup extends BaseGroup {
39
38
  showAllFloors(): this;
40
39
  showAllFacilities(): this;
41
40
  hideAllFacilities(): this;
42
- getFacilityById(id: string): SemanticInstanceObject | undefined;
41
+ getFacilityById(id: string): InstanceObject | undefined;
43
42
  syncFacilityIndexes(): this;
44
43
  get facilityIndexVersion(): number;
45
44
  getFacilityIndexIds(): MapIterator<string>;
46
- getFacilityIndexObjects(): MapIterator<SemanticInstanceObject>;
45
+ getFacilityIndexObjects(): MapIterator<InstanceObject>;
47
46
  planishFloors(kind?: FloorSemanticKind): this;
48
47
  unplanishFloors(kind?: FloorSemanticKind): this;
49
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,21 +45,21 @@ 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;
@@ -81,8 +79,8 @@ export declare class FloorMesh extends BaseMesh<BufferGeometry, FloorMeshMateria
81
79
  staircasesInstances: Map<string, number>;
82
80
  semanticInstances: Map<string, number>;
83
81
  semanticEntities: Map<string, FloorSemanticEntity>;
84
- facilityObjectsById: Map<string, SemanticInstanceObject>;
85
- facilityObjects: SemanticInstanceObject[];
82
+ facilityObjectsById: Map<string, InstanceObject>;
83
+ facilityObjects: InstanceObject[];
86
84
  facilityIndexVersion: number;
87
85
  constructor(entries: SemanticGeometryEntry[]);
88
86
  setSemanticIdentity(identity: {
@@ -104,10 +102,10 @@ export declare class FloorMesh extends BaseMesh<BufferGeometry, FloorMeshMateria
104
102
  getSemanticObjectAt(index: number): FloorSemanticInstanceObject;
105
103
  showAllFacilities(): this;
106
104
  hideAllFacilities(): this;
107
- addFacility(object: SemanticInstanceObject, ids?: string | string[]): this;
108
- getFacilityById(id: string): SemanticInstanceObject | undefined;
109
- getFacilityAt(index: number): SemanticInstanceObject;
110
- getFacilities(): SemanticInstanceObject[];
105
+ addFacility(object: InstanceObject, ids?: string | string[]): this;
106
+ getFacilityById(id: string): InstanceObject | undefined;
107
+ getFacilityAt(index: number): InstanceObject;
108
+ getFacilities(): InstanceObject[];
111
109
  removeFacility(facility: FacilityReference): this;
112
110
  setColorAt(index: number, color: SemanticColor): this;
113
111
  resetColorAt(index: number): this;
@@ -1,8 +1,7 @@
1
- import { BaseGroup } from 'u-space';
1
+ import { BaseGroup, type InstanceObject } from 'u-space';
2
2
  import type { BuildingGroup } from './BuildingGroup';
3
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;
@@ -20,7 +19,7 @@ export declare class SemanticGroup extends BaseGroup {
20
19
  getDefaultFacilityLayer(): FacilityInstancedLayer | null;
21
20
  showAllFacilities(): this;
22
21
  hideAllFacilities(): this;
23
- getFacilityById(id: string): SemanticInstanceObject | undefined;
22
+ getFacilityById(id: string): InstanceObject | undefined;
24
23
  showAllFloors(): this;
25
24
  planishFloors(kind?: FloorSemanticKind): this;
26
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 };
@@ -0,0 +1,16 @@
1
+ import type { WorkerFrameTimingStats } from './protocol';
2
+ export interface FrameTimingWindowOptions {
3
+ windowMs?: number;
4
+ idleResetMs?: number;
5
+ missedFrameThresholdMs?: number;
6
+ }
7
+ export declare class FrameTimingWindow {
8
+ #private;
9
+ readonly windowMs: number;
10
+ readonly idleResetMs: number;
11
+ readonly missedFrameThresholdMs: number;
12
+ constructor(options?: FrameTimingWindowOptions);
13
+ add(duration: number, now?: number): WorkerFrameTimingStats;
14
+ snapshot(now?: number): WorkerFrameTimingStats;
15
+ reset(): void;
16
+ }
@@ -0,0 +1,20 @@
1
+ import type { SerializedDomEvent } from './protocol';
2
+ export interface OffscreenViewerHostOptions {
3
+ el: HTMLElement;
4
+ worker: Worker;
5
+ canvas?: HTMLCanvasElement;
6
+ pixelRatio?: number;
7
+ terminateWorkerOnDispose?: boolean;
8
+ }
9
+ export declare function serializeDomEvent(event: Event): SerializedDomEvent;
10
+ export declare class OffscreenViewerHost extends EventTarget {
11
+ #private;
12
+ readonly el: HTMLElement;
13
+ readonly worker: Worker;
14
+ readonly canvas: HTMLCanvasElement;
15
+ constructor(options: OffscreenViewerHostOptions);
16
+ static isSupported(): boolean;
17
+ init(): Promise<void>;
18
+ request<T = unknown>(command: string, payload?: unknown): Promise<T>;
19
+ dispose(): void;
20
+ }
@@ -0,0 +1,44 @@
1
+ import type { SerializedDomEvent, WorkerCanvasSize } from './protocol';
2
+ export type WorkerDomTarget = OffscreenCanvas & HTMLElement;
3
+ declare class WorkerDomEvent {
4
+ readonly type: string;
5
+ readonly timeStamp: number;
6
+ readonly target: WorkerDomTarget;
7
+ readonly currentTarget: WorkerDomTarget;
8
+ readonly cancelable = true;
9
+ readonly bubbles = true;
10
+ defaultPrevented: boolean;
11
+ cancelBubble: boolean;
12
+ immediatePropagationStopped: boolean;
13
+ pointerId: number;
14
+ pointerType: string;
15
+ button: number;
16
+ buttons: number;
17
+ altKey: boolean;
18
+ ctrlKey: boolean;
19
+ metaKey: boolean;
20
+ shiftKey: boolean;
21
+ movementX: number;
22
+ movementY: number;
23
+ clientX: number;
24
+ clientY: number;
25
+ offsetX: number;
26
+ offsetY: number;
27
+ pageX: number;
28
+ pageY: number;
29
+ screenX: number;
30
+ screenY: number;
31
+ deltaX: number;
32
+ deltaY: number;
33
+ deltaZ: number;
34
+ deltaMode: number;
35
+ constructor(data: SerializedDomEvent, target: WorkerDomTarget);
36
+ preventDefault(): void;
37
+ stopPropagation(): void;
38
+ stopImmediatePropagation(): void;
39
+ composedPath(): WorkerDomTarget[];
40
+ }
41
+ export declare function createWorkerDomTarget(canvas: OffscreenCanvas, initialSize: WorkerCanvasSize): WorkerDomTarget;
42
+ export declare function resizeWorkerDomTarget(target: WorkerDomTarget, size: WorkerCanvasSize): void;
43
+ export declare function dispatchWorkerDomEvent(target: WorkerDomTarget, data: SerializedDomEvent): WorkerDomEvent;
44
+ export {};