soonspacejs 3.0.0-alpha.1 → 3.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/dist/index.esm.js +5580 -4637
- package/package.json +1 -1
- package/types/Cache/ModelBufferCache.d.ts +15 -0
- package/types/Constants/headers.d.ts +4 -1
- package/types/Entity/EntityCollection.d.ts +15 -3
- package/types/Entity/EntityRenderer.d.ts +18 -3
- package/types/Entity/ModelResources.d.ts +6 -1
- package/types/Entity/StaticModelPool.d.ts +28 -0
- package/types/Entity/index.d.ts +2 -0
- package/types/Loader/TexturePreloader.d.ts +44 -0
- package/types/Loader/request-loaders.d.ts +24 -0
- package/types/Loader/scoped-gltf.d.ts +3 -0
- package/types/Manager/ModelManage.d.ts +3 -0
- package/types/Shared/network.d.ts +4 -3
- package/types/Shared/request.d.ts +4 -0
- package/types/Viewport/EventHandler.d.ts +5 -1
- package/types/Viewport/Info.d.ts +1 -0
- package/types/Viewport/index.d.ts +1 -1
- package/types/Viewport/render-info-change.d.ts +5 -0
- package/types/index.d.ts +112 -6
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Raw HTTP model bytes only. Runtime leases / GPU graphs are never persisted. */
|
|
2
|
+
export declare class ModelBufferCache {
|
|
3
|
+
private readonly store;
|
|
4
|
+
private readonly enabled;
|
|
5
|
+
constructor(store?: LocalForage, enabled?: () => boolean);
|
|
6
|
+
load(url: string, init: {
|
|
7
|
+
headers: Headers;
|
|
8
|
+
credentials: RequestCredentials;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
redirect?: RequestRedirect;
|
|
11
|
+
}): Promise<ArrayBuffer>;
|
|
12
|
+
private key;
|
|
13
|
+
private mutate;
|
|
14
|
+
clear(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/** Default headers for SDK-owned HTTP(S) resource requests. */
|
|
2
|
+
export declare const RequestHeaders: Record<string, string>;
|
|
3
|
+
/** Backwards-compatible alias. Both names refer to the same mutable object. */
|
|
4
|
+
export declare const FileRequestHeaders: Record<string, string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box3, Matrix4, Object3D, Raycaster, Scene } from 'three';
|
|
1
|
+
import { Box3, Matrix4, Object3D, Raycaster, Scene, BufferGeometry } from 'three';
|
|
2
2
|
import { Entity, EntityChange, EntityOptions } from './Entity';
|
|
3
3
|
import { EntityHit } from './EntityRenderer';
|
|
4
4
|
import { ModelResources, ModelLease, ModelLoadOptions } from './ModelResources';
|
|
@@ -19,6 +19,7 @@ export declare class EntityCollection {
|
|
|
19
19
|
private pendingModels;
|
|
20
20
|
private selected;
|
|
21
21
|
private selectionDirty;
|
|
22
|
+
private selectionHighlight;
|
|
22
23
|
constructor(scene: Scene, requestRender: () => void, models: ModelResources, sideVariants?: Pick<TransparentSideVariants, 'register' | 'unregister'>);
|
|
23
24
|
get roots(): readonly Entity[];
|
|
24
25
|
getById(id: string): Entity | undefined;
|
|
@@ -42,6 +43,11 @@ export declare class EntityCollection {
|
|
|
42
43
|
attach(entity: Entity, object: Object3D): void;
|
|
43
44
|
detach(entity: Entity, object: Object3D): void;
|
|
44
45
|
pick(raycaster: Raycaster): EntityHit[];
|
|
46
|
+
private pickAttachments;
|
|
47
|
+
/** On-demand source surfaces for drawing/projection. These meshes never enter the scene. */
|
|
48
|
+
pickSurfaces(raycaster: Raycaster): EntityHit[];
|
|
49
|
+
/** Explicit BVH preparation snapshots current parts; later loads need another preparation. */
|
|
50
|
+
getSourceGeometries(): ReadonlySet<BufferGeometry>;
|
|
45
51
|
/** Fresh world bounds from committed transforms, including hidden content. */
|
|
46
52
|
getBounds(entity: Entity, options?: {
|
|
47
53
|
includeDescendants?: boolean;
|
|
@@ -49,12 +55,18 @@ export declare class EntityCollection {
|
|
|
49
55
|
getStats(): {
|
|
50
56
|
updatedEntities: number;
|
|
51
57
|
entities: number;
|
|
58
|
+
sourceParts: number;
|
|
59
|
+
renderObjects: number;
|
|
60
|
+
rebuilds: number;
|
|
52
61
|
instancedBatches: number;
|
|
53
62
|
batchedBatches: number;
|
|
54
63
|
independentObjects: number;
|
|
55
|
-
|
|
64
|
+
lineBatches: number;
|
|
56
65
|
};
|
|
57
|
-
|
|
66
|
+
/** Selection identity is retained even when the optional visual overlay is disabled. */
|
|
67
|
+
setSelection(entities: readonly Entity[], options?: {
|
|
68
|
+
highlight?: boolean;
|
|
69
|
+
}): void;
|
|
58
70
|
getSelection(): readonly Entity[];
|
|
59
71
|
setInstancingEnabled(enabled: boolean): void;
|
|
60
72
|
setBatchedEnabled(enabled: boolean): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box3, Group, Matrix4, Raycaster, Intersection } from 'three';
|
|
1
|
+
import { Box3, BufferGeometry, Group, Matrix4, Raycaster, Intersection } from 'three';
|
|
2
2
|
import { Entity } from './Entity';
|
|
3
3
|
import { RegisteredPart } from './ModelResources';
|
|
4
4
|
import { TransparentSideVariants } from './TransparentSideVariants';
|
|
@@ -25,13 +25,19 @@ export declare class EntityRenderer {
|
|
|
25
25
|
private dirtyGroups;
|
|
26
26
|
private policyDirty;
|
|
27
27
|
private bounds;
|
|
28
|
+
private sourceGeometries;
|
|
29
|
+
private geometryRefs;
|
|
28
30
|
private enabled;
|
|
29
31
|
private batchedEnabled;
|
|
30
32
|
private rebuilds;
|
|
33
|
+
private sourceParts;
|
|
34
|
+
private sourceMeshes;
|
|
35
|
+
private batchCounts;
|
|
31
36
|
private selection;
|
|
32
37
|
private selectionDirty;
|
|
33
38
|
private highlights;
|
|
34
39
|
private highlightMaterial;
|
|
40
|
+
private highlightLineMaterial;
|
|
35
41
|
constructor(sideVariants?: Pick<TransparentSideVariants, "register" | "unregister"> | undefined);
|
|
36
42
|
add(input: EntityRenderInput): void;
|
|
37
43
|
remove(entity: Entity): void;
|
|
@@ -44,15 +50,24 @@ export declare class EntityRenderer {
|
|
|
44
50
|
private assignGroup;
|
|
45
51
|
private rebuildGroup;
|
|
46
52
|
private createBatch;
|
|
53
|
+
private createLineBatch;
|
|
54
|
+
private updateLineBatch;
|
|
55
|
+
private sortLineBatch;
|
|
47
56
|
private updateBatch;
|
|
48
|
-
|
|
57
|
+
/** Live geometry membership is updated only when model parts are added/removed. */
|
|
58
|
+
getSourceGeometries(): ReadonlySet<BufferGeometry>;
|
|
59
|
+
pick(raycaster: Raycaster, surfaces?: boolean): EntityHit[];
|
|
49
60
|
getBounds(entity: Entity): Box3;
|
|
50
61
|
getStats(): {
|
|
62
|
+
sourceParts: number;
|
|
63
|
+
renderObjects: number;
|
|
64
|
+
rebuilds: number;
|
|
51
65
|
instancedBatches: number;
|
|
52
66
|
batchedBatches: number;
|
|
53
67
|
independentObjects: number;
|
|
54
|
-
|
|
68
|
+
lineBatches: number;
|
|
55
69
|
};
|
|
70
|
+
private countBatch;
|
|
56
71
|
private clearBatches;
|
|
57
72
|
dispose(): void;
|
|
58
73
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { BufferGeometry, Material, Matrix4, Texture } from 'three';
|
|
2
2
|
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
3
|
+
import { ModelBufferCache } from '../Cache/ModelBufferCache';
|
|
3
4
|
export interface ModelPart {
|
|
5
|
+
/** Omitted for triangle meshes. Basic line segments share the Entity lifecycle. */
|
|
6
|
+
kind?: 'mesh' | 'line-segments';
|
|
7
|
+
pickable?: boolean;
|
|
4
8
|
geometry: BufferGeometry;
|
|
5
9
|
material: Material | MaterialLease;
|
|
6
10
|
matrix: Matrix4;
|
|
@@ -60,8 +64,9 @@ export declare class ModelResources {
|
|
|
60
64
|
private pending;
|
|
61
65
|
private urls;
|
|
62
66
|
private gltfLoader;
|
|
67
|
+
private bufferCache;
|
|
63
68
|
/** Borrow a host-configured loader; its decoder workers remain host-owned. */
|
|
64
|
-
setGLTFLoader(loader: GLTFLoader): void;
|
|
69
|
+
setGLTFLoader(loader: GLTFLoader, bufferCache?: ModelBufferCache): void;
|
|
65
70
|
readonly materials: {
|
|
66
71
|
register: (material: Material, options: {
|
|
67
72
|
ownership: "transfer";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Object3D } from 'three';
|
|
2
|
+
import { ModelLease, ModelResources } from './ModelResources';
|
|
3
|
+
export interface StaticModelSnapshot {
|
|
4
|
+
object: Object3D;
|
|
5
|
+
model?: ModelLease;
|
|
6
|
+
empty?: boolean;
|
|
7
|
+
release: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface StaticModelExtraction extends StaticModelSnapshot {
|
|
10
|
+
restore: () => void;
|
|
11
|
+
}
|
|
12
|
+
/** Load-session cache. It owns snapshots, never resources borrowed from procedural factories. */
|
|
13
|
+
export declare class StaticModelPool {
|
|
14
|
+
private resources;
|
|
15
|
+
private options;
|
|
16
|
+
private materials;
|
|
17
|
+
private models;
|
|
18
|
+
private disposed;
|
|
19
|
+
constructor(resources: ModelResources, options?: {
|
|
20
|
+
pickableLines?: boolean;
|
|
21
|
+
ignoreRootVisibility?: boolean;
|
|
22
|
+
});
|
|
23
|
+
extract(root: Object3D): StaticModelExtraction;
|
|
24
|
+
/** Copy an immutable render snapshot without retaining/moving the source tree.
|
|
25
|
+
* The returned native remainder is owned by the snapshot, never the factory. */
|
|
26
|
+
snapshot(root: Object3D): StaticModelSnapshot;
|
|
27
|
+
dispose(): void;
|
|
28
|
+
}
|
package/types/Entity/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { Entity, } from './Entity';
|
|
2
|
+
export { StaticModelPool, } from './StaticModelPool';
|
|
3
|
+
export type { StaticModelSnapshot, StaticModelExtraction, } from './StaticModelPool';
|
|
2
4
|
export type { EntityOptions, EntityChange, } from './Entity';
|
|
3
5
|
export { EntityCollection, } from './EntityCollection';
|
|
4
6
|
export { ModelResources, ResourceLease, ModelResourceUnsupportedError, } from './ModelResources';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Object3D, Texture } from 'three';
|
|
2
|
+
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
3
|
+
interface TextureRenderer {
|
|
4
|
+
initTexture(texture: Texture): void;
|
|
5
|
+
domElement?: EventTarget;
|
|
6
|
+
getContext?: () => {
|
|
7
|
+
isContextLost(): boolean;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare const texturePreloaderFor: (loader: GLTFLoader) => TexturePreloader | undefined;
|
|
11
|
+
export declare const bindTexturePreloader: (loader: GLTFLoader, queue: TexturePreloader) => void;
|
|
12
|
+
/** Renderer-owned, frame-budgeted preparation for newly decoded GLTF roots. */
|
|
13
|
+
export declare class TexturePreloader {
|
|
14
|
+
private readonly renderer;
|
|
15
|
+
private readonly budgetMs;
|
|
16
|
+
private entries;
|
|
17
|
+
private jobs;
|
|
18
|
+
private owners;
|
|
19
|
+
private frame;
|
|
20
|
+
private fallback;
|
|
21
|
+
private frameGeneration;
|
|
22
|
+
private contextLost;
|
|
23
|
+
private disposed;
|
|
24
|
+
readonly stats: {
|
|
25
|
+
uploads: number;
|
|
26
|
+
reused: number;
|
|
27
|
+
cancelled: number;
|
|
28
|
+
failed: number;
|
|
29
|
+
frames: number;
|
|
30
|
+
totalMs: number;
|
|
31
|
+
maxUploadMs: number;
|
|
32
|
+
maxFrameMs: number;
|
|
33
|
+
};
|
|
34
|
+
constructor(renderer: TextureRenderer, budgetMs?: number);
|
|
35
|
+
private onContextLost;
|
|
36
|
+
private onContextRestored;
|
|
37
|
+
private cancelFrame;
|
|
38
|
+
prepare(root: Object3D, signal?: AbortSignal, managerSignal?: AbortSignal): Promise<void>;
|
|
39
|
+
private schedule;
|
|
40
|
+
private pump;
|
|
41
|
+
private cancel;
|
|
42
|
+
dispose(): void;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CubeTextureLoader, FileLoader, ImageLoader, LoadingManager, TextureLoader } from 'three';
|
|
2
|
+
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
3
|
+
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
|
|
4
|
+
import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader.js';
|
|
5
|
+
/** Only SDK-owned instances are adapted; resolve before snapshotting the actual request. */
|
|
6
|
+
export declare function configureRequestLoader<T extends {
|
|
7
|
+
load: any;
|
|
8
|
+
path: string;
|
|
9
|
+
requestHeader: any;
|
|
10
|
+
manager: LoadingManager;
|
|
11
|
+
}>(loader: T): T;
|
|
12
|
+
/** @internal Add parent-local headers only to copies of SDK-adapted handlers. */
|
|
13
|
+
export declare function withRequestHeaders<T extends {
|
|
14
|
+
requestHeader: any;
|
|
15
|
+
}>(loader: T, parentHeaders?: HeadersInit): T;
|
|
16
|
+
export declare function createFileLoader(manager?: LoadingManager): FileLoader;
|
|
17
|
+
export declare function createImageLoader(manager?: LoadingManager): ImageLoader;
|
|
18
|
+
/** @internal Preserve the historical shared imageLoader FileLoader/Blob transport. */
|
|
19
|
+
export declare function createFileImageLoader(manager?: LoadingManager): ImageLoader;
|
|
20
|
+
export declare function createTextureLoader(manager?: LoadingManager): TextureLoader;
|
|
21
|
+
export declare function createCubeTextureLoader(manager?: LoadingManager): CubeTextureLoader;
|
|
22
|
+
export declare function configureGLTFLoader(loader: GLTFLoader): GLTFLoader;
|
|
23
|
+
export declare function configureDRACOLoader(loader: DRACOLoader): DRACOLoader;
|
|
24
|
+
export declare function configureKTX2Loader(loader: KTX2Loader): KTX2Loader;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
2
|
+
import { ModelBufferCache } from '../Cache/ModelBufferCache';
|
|
2
3
|
interface RequestScope {
|
|
3
4
|
rootURL: string;
|
|
4
5
|
headers: HeadersInit;
|
|
5
6
|
signal?: AbortSignal;
|
|
7
|
+
bufferCache?: ModelBufferCache;
|
|
6
8
|
}
|
|
7
9
|
/** Each standard GLTFLoader parse constructs its parser synchronously, before any await. */
|
|
8
10
|
export declare function parseScopedGLTF(loader: GLTFLoader, data: ArrayBuffer, path: string, scope: RequestScope): Promise<{
|
|
9
11
|
gltf: GLTF;
|
|
10
12
|
dependencyError?: unknown;
|
|
13
|
+
prepareTextures: () => Promise<void>;
|
|
11
14
|
}>;
|
|
12
15
|
export {};
|
|
@@ -9,6 +9,7 @@ import { Group, GroupInfo, Model, ModelInfo } from '../Library';
|
|
|
9
9
|
import { CloneModelInfo } from '../Interface';
|
|
10
10
|
import { ObjectsCache } from '../Cache';
|
|
11
11
|
import { default as DefaultManage } from './DefaultManage';
|
|
12
|
+
import { ModelBufferCache } from '../Cache/ModelBufferCache';
|
|
12
13
|
declare class ModelManage extends DefaultManage {
|
|
13
14
|
readonly viewport: Viewport;
|
|
14
15
|
readonly cache: ObjectsCache;
|
|
@@ -24,6 +25,8 @@ declare class ModelManage extends DefaultManage {
|
|
|
24
25
|
*/
|
|
25
26
|
store: typeof localforage;
|
|
26
27
|
cacheStore: typeof localforage;
|
|
28
|
+
readonly bufferCache: ModelBufferCache;
|
|
29
|
+
private texturePreloader?;
|
|
27
30
|
loadingManager: LoadingManager;
|
|
28
31
|
gltfLoader: GLTFLoader;
|
|
29
32
|
fbxLoader: FBXLoader;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ImageLoader, TextureLoader } from 'three';
|
|
2
1
|
import { HDRLoader } from 'three/examples/jsm/loaders/HDRLoader.js';
|
|
2
|
+
export * from './request';
|
|
3
|
+
export { configureRequestLoader, createFileLoader, createImageLoader, createTextureLoader, createCubeTextureLoader, configureGLTFLoader, } from '../Loader/request-loaders';
|
|
3
4
|
export type FileResponseType = 'json' | 'arraybuffer' | 'blob' | 'document' | 'text';
|
|
4
5
|
export declare const fetchFile: <T = any>(url: string, responseType: FileResponseType) => Promise<T>;
|
|
5
|
-
export declare const imageLoader: ImageLoader;
|
|
6
|
-
export declare const textureLoader: TextureLoader;
|
|
6
|
+
export declare const imageLoader: import('three').ImageLoader;
|
|
7
|
+
export declare const textureLoader: import('three').TextureLoader;
|
|
7
8
|
export declare const rgbeLoader: HDRLoader;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Snapshot defaults and explicit headers. Explicit names win case-insensitively. */
|
|
2
|
+
export declare function getRequestHeaders(input: string | URL | Request, headers?: HeadersInit): Record<string, string>;
|
|
3
|
+
/** Keep the caller's Request/RequestInit semantics and snapshot at dispatch time. */
|
|
4
|
+
export declare function fetchResource(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
@@ -7,7 +7,10 @@ declare class EventHandler {
|
|
|
7
7
|
/**
|
|
8
8
|
* PC
|
|
9
9
|
*/
|
|
10
|
-
private
|
|
10
|
+
private mouseClickGroup;
|
|
11
|
+
private mouseDownGroup;
|
|
12
|
+
private pendingMouseClicks;
|
|
13
|
+
private disposed;
|
|
11
14
|
private mouseDownEvent;
|
|
12
15
|
private container;
|
|
13
16
|
private options;
|
|
@@ -30,6 +33,7 @@ declare class EventHandler {
|
|
|
30
33
|
private handleMouseDown;
|
|
31
34
|
private handleMouseMove;
|
|
32
35
|
private handleMouseUp;
|
|
36
|
+
private cancelPendingMouseClicks;
|
|
33
37
|
private handleDblClick;
|
|
34
38
|
private handleMouseWheel;
|
|
35
39
|
private handleTouchStart;
|
package/types/Viewport/Info.d.ts
CHANGED
|
@@ -127,7 +127,7 @@ declare class Viewport {
|
|
|
127
127
|
top: number;
|
|
128
128
|
};
|
|
129
129
|
getPositionByOffset(offset: OffsetPoint, z?: number, scalar?: number): Vector3;
|
|
130
|
-
getIntersects(event: MouseEvent | TouchEvent | OffsetPoint, objects?: Object3D
|
|
130
|
+
getIntersects(event: MouseEvent | TouchEvent | OffsetPoint, objects?: Object3D | Object3D[], options?: IntersectsOptions): Intersection<Object3D<import('three').Object3DEventMap>>[];
|
|
131
131
|
rayClash(startPoint?: Vector3, dir?: Vector3, objects?: Mesh<import('three').BufferGeometry<import('three').NormalBufferAttributes, import('three').BufferGeometryEventMap>, Material<import('three').MaterialEventMap> | Material<import('three').MaterialEventMap>[], import('three').Object3DEventMap>[]): Intersection<Object3D<import('three').Object3DEventMap>>[];
|
|
132
132
|
clearSignals(): void;
|
|
133
133
|
/**
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Object3D } from 'three';
|
|
2
|
+
export declare function getRenderInfoSourceMeshes(object: Object3D): number | undefined;
|
|
3
|
+
export declare function setRenderInfoSourceMeshes(object: Object3D, count: number): void;
|
|
4
|
+
export declare function observeRenderInfoChange(object: Object3D, listener: () => void): () => void;
|
|
5
|
+
export declare function notifyRenderInfoChange(object: Object3D): void;
|
package/types/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { Camera } from 'three';
|
|
|
14
14
|
import { CanvasTexture } from 'three';
|
|
15
15
|
import { ColorRepresentation } from 'three';
|
|
16
16
|
import { CubeTexture } from 'three';
|
|
17
|
+
import { CubeTextureLoader } from 'three';
|
|
17
18
|
import { Curve } from 'three';
|
|
18
19
|
import type { CurvePath } from 'three';
|
|
19
20
|
import { DataTexture } from 'three';
|
|
@@ -29,6 +30,7 @@ import type { EulerOrder } from 'three';
|
|
|
29
30
|
import { Event as Event_2 } from 'three';
|
|
30
31
|
import { EventDispatcher } from 'three';
|
|
31
32
|
import { EventListener as EventListener_2 } from 'three';
|
|
33
|
+
import { FileLoader } from 'three';
|
|
32
34
|
import { GLTFExporterOptions } from 'three/examples/jsm/exporters/GLTFExporter.js';
|
|
33
35
|
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
34
36
|
import { GridHelper } from 'three';
|
|
@@ -1274,6 +1276,16 @@ export declare type ClonePoiInfo = Omit<PoiInfo, 'url' | 'type'>;
|
|
|
1274
1276
|
*/
|
|
1275
1277
|
declare function computeTargetByRotation(position: IVector3, rotation: Rotation, scalar?: number): Vector3;
|
|
1276
1278
|
|
|
1279
|
+
declare function configureGLTFLoader(loader: GLTFLoader): GLTFLoader;
|
|
1280
|
+
|
|
1281
|
+
/** Only SDK-owned instances are adapted; resolve before snapshotting the actual request. */
|
|
1282
|
+
declare function configureRequestLoader<T extends {
|
|
1283
|
+
load: any;
|
|
1284
|
+
path: string;
|
|
1285
|
+
requestHeader: any;
|
|
1286
|
+
manager: LoadingManager;
|
|
1287
|
+
}>(loader: T): T;
|
|
1288
|
+
|
|
1277
1289
|
/**
|
|
1278
1290
|
* 以等分链的方式配置几何体的顶点权重
|
|
1279
1291
|
* @param options - 选项
|
|
@@ -1586,6 +1598,8 @@ export declare interface CreateChainSkinnedMeshForMeshOptions_Base {
|
|
|
1586
1598
|
skeleton: Skeleton;
|
|
1587
1599
|
}
|
|
1588
1600
|
|
|
1601
|
+
declare function createCubeTextureLoader(manager?: LoadingManager): CubeTextureLoader;
|
|
1602
|
+
|
|
1589
1603
|
export declare function createCurveAnimationClip(options: CreateCurveAnimationClipByCurveOptions): CreateCurveAnimationClipReturn;
|
|
1590
1604
|
|
|
1591
1605
|
export declare function createCurveAnimationClip(options: CreateCurveAnimationClipByPolylineOptions): CreateCurveAnimationClipReturn;
|
|
@@ -1694,6 +1708,8 @@ export declare interface CreateCurveAnimationClipReturn {
|
|
|
1694
1708
|
*/
|
|
1695
1709
|
export declare function createEqualChainBones(boneOpts: EqualChainBoneOptions): Bone[];
|
|
1696
1710
|
|
|
1711
|
+
declare function createFileLoader(manager?: LoadingManager): FileLoader;
|
|
1712
|
+
|
|
1697
1713
|
/**
|
|
1698
1714
|
* 创建 查找位置附近的 box 空间范围内的物体
|
|
1699
1715
|
* @param boxSpace - 描述查找空间的信息对象
|
|
@@ -1727,6 +1743,8 @@ export declare function createFindObjectsNearPath(points: Vector3[], radius: num
|
|
|
1727
1743
|
*/
|
|
1728
1744
|
export declare function createGuiAnimationController(action: AnimationAction): GuiAnimationController;
|
|
1729
1745
|
|
|
1746
|
+
declare function createImageLoader(manager?: LoadingManager): ImageLoader;
|
|
1747
|
+
|
|
1730
1748
|
/**
|
|
1731
1749
|
* createKeyframeTracksOfCurveAnimationByPolyline 的选项
|
|
1732
1750
|
*/
|
|
@@ -1831,6 +1849,8 @@ export declare function createPlaneMatrix(points: Vector3[]): Matrix3;
|
|
|
1831
1849
|
|
|
1832
1850
|
export declare function createTexture(image: string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, cache?: boolean, textureCache?: Map<string, Texture>): Texture<unknown, TextureEventMap>;
|
|
1833
1851
|
|
|
1852
|
+
declare function createTextureLoader(manager?: LoadingManager): TextureLoader;
|
|
1853
|
+
|
|
1834
1854
|
/**
|
|
1835
1855
|
* 创建 uv 变换矩阵
|
|
1836
1856
|
* @remarks
|
|
@@ -2164,6 +2184,7 @@ export declare class EntityCollection {
|
|
|
2164
2184
|
private pendingModels;
|
|
2165
2185
|
private selected;
|
|
2166
2186
|
private selectionDirty;
|
|
2187
|
+
private selectionHighlight;
|
|
2167
2188
|
constructor(scene: Scene, requestRender: () => void, models: ModelResources, sideVariants?: Pick<TransparentSideVariants, 'register' | 'unregister'>);
|
|
2168
2189
|
get roots(): readonly Entity[];
|
|
2169
2190
|
getById(id: string): Entity | undefined;
|
|
@@ -2187,6 +2208,11 @@ export declare class EntityCollection {
|
|
|
2187
2208
|
attach(entity: Entity, object: Object3D): void;
|
|
2188
2209
|
detach(entity: Entity, object: Object3D): void;
|
|
2189
2210
|
pick(raycaster: Raycaster): EntityHit[];
|
|
2211
|
+
private pickAttachments;
|
|
2212
|
+
/** On-demand source surfaces for drawing/projection. These meshes never enter the scene. */
|
|
2213
|
+
pickSurfaces(raycaster: Raycaster): EntityHit[];
|
|
2214
|
+
/** Explicit BVH preparation snapshots current parts; later loads need another preparation. */
|
|
2215
|
+
getSourceGeometries(): ReadonlySet<BufferGeometry>;
|
|
2190
2216
|
/** Fresh world bounds from committed transforms, including hidden content. */
|
|
2191
2217
|
getBounds(entity: Entity, options?: {
|
|
2192
2218
|
includeDescendants?: boolean;
|
|
@@ -2194,12 +2220,18 @@ export declare class EntityCollection {
|
|
|
2194
2220
|
getStats(): {
|
|
2195
2221
|
updatedEntities: number;
|
|
2196
2222
|
entities: number;
|
|
2223
|
+
sourceParts: number;
|
|
2224
|
+
renderObjects: number;
|
|
2225
|
+
rebuilds: number;
|
|
2197
2226
|
instancedBatches: number;
|
|
2198
2227
|
batchedBatches: number;
|
|
2199
2228
|
independentObjects: number;
|
|
2200
|
-
|
|
2229
|
+
lineBatches: number;
|
|
2201
2230
|
};
|
|
2202
|
-
|
|
2231
|
+
/** Selection identity is retained even when the optional visual overlay is disabled. */
|
|
2232
|
+
setSelection(entities: readonly Entity[], options?: {
|
|
2233
|
+
highlight?: boolean;
|
|
2234
|
+
}): void;
|
|
2203
2235
|
getSelection(): readonly Entity[];
|
|
2204
2236
|
setInstancingEnabled(enabled: boolean): void;
|
|
2205
2237
|
setBatchedEnabled(enabled: boolean): void;
|
|
@@ -2258,7 +2290,10 @@ declare class EventHandler {
|
|
|
2258
2290
|
/**
|
|
2259
2291
|
* PC
|
|
2260
2292
|
*/
|
|
2261
|
-
private
|
|
2293
|
+
private mouseClickGroup;
|
|
2294
|
+
private mouseDownGroup;
|
|
2295
|
+
private pendingMouseClicks;
|
|
2296
|
+
private disposed;
|
|
2262
2297
|
private mouseDownEvent;
|
|
2263
2298
|
private container;
|
|
2264
2299
|
private options;
|
|
@@ -2281,6 +2316,7 @@ declare class EventHandler {
|
|
|
2281
2316
|
private handleMouseDown;
|
|
2282
2317
|
private handleMouseMove;
|
|
2283
2318
|
private handleMouseUp;
|
|
2319
|
+
private cancelPendingMouseClicks;
|
|
2284
2320
|
private handleDblClick;
|
|
2285
2321
|
private handleMouseWheel;
|
|
2286
2322
|
private handleTouchStart;
|
|
@@ -2308,7 +2344,11 @@ declare class FBXLoader extends Loader<any, string> {
|
|
|
2308
2344
|
|
|
2309
2345
|
declare const fetchFile: <T = any>(url: string, responseType: FileResponseType) => Promise<T>;
|
|
2310
2346
|
|
|
2311
|
-
|
|
2347
|
+
/** Keep the caller's Request/RequestInit semantics and snapshot at dispatch time. */
|
|
2348
|
+
declare function fetchResource(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
2349
|
+
|
|
2350
|
+
/** Backwards-compatible alias. Both names refer to the same mutable object. */
|
|
2351
|
+
export declare const FileRequestHeaders: Record<string, string>;
|
|
2312
2352
|
|
|
2313
2353
|
declare type FileResponseType = 'json' | 'arraybuffer' | 'blob' | 'document' | 'text';
|
|
2314
2354
|
|
|
@@ -2659,6 +2699,9 @@ export declare function getPolygonGeometryInfo(points: Vector3[]): {
|
|
|
2659
2699
|
position: Vector3;
|
|
2660
2700
|
};
|
|
2661
2701
|
|
|
2702
|
+
/** Snapshot defaults and explicit headers. Explicit names win case-insensitively. */
|
|
2703
|
+
declare function getRequestHeaders(input: string | URL | Request, headers?: HeadersInit): Record<string, string>;
|
|
2704
|
+
|
|
2662
2705
|
/**
|
|
2663
2706
|
* 获取根骨骼
|
|
2664
2707
|
* @remarks
|
|
@@ -3061,6 +3104,7 @@ declare class Info {
|
|
|
3061
3104
|
container: HTMLDivElement;
|
|
3062
3105
|
private renderStateFrame;
|
|
3063
3106
|
private disposed;
|
|
3107
|
+
private cleanups;
|
|
3064
3108
|
state: {
|
|
3065
3109
|
objects: number;
|
|
3066
3110
|
meshes: number;
|
|
@@ -3479,6 +3523,22 @@ export declare interface ModelAnimationFindFunc {
|
|
|
3479
3523
|
(animation: AnimationClip, index: number, animations: AnimationClip[]): boolean;
|
|
3480
3524
|
}
|
|
3481
3525
|
|
|
3526
|
+
/** Raw HTTP model bytes only. Runtime leases / GPU graphs are never persisted. */
|
|
3527
|
+
declare class ModelBufferCache {
|
|
3528
|
+
private readonly store;
|
|
3529
|
+
private readonly enabled;
|
|
3530
|
+
constructor(store?: LocalForage, enabled?: () => boolean);
|
|
3531
|
+
load(url: string, init: {
|
|
3532
|
+
headers: Headers;
|
|
3533
|
+
credentials: RequestCredentials;
|
|
3534
|
+
signal?: AbortSignal;
|
|
3535
|
+
redirect?: RequestRedirect;
|
|
3536
|
+
}): Promise<ArrayBuffer>;
|
|
3537
|
+
private key;
|
|
3538
|
+
private mutate;
|
|
3539
|
+
clear(): Promise<void>;
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3482
3542
|
export declare interface ModelEventParams {
|
|
3483
3543
|
target: Model;
|
|
3484
3544
|
currentTarget: Mesh;
|
|
@@ -3536,6 +3596,8 @@ declare class ModelManage extends DefaultManage {
|
|
|
3536
3596
|
*/
|
|
3537
3597
|
store: typeof default_2;
|
|
3538
3598
|
cacheStore: typeof default_2;
|
|
3599
|
+
readonly bufferCache: ModelBufferCache;
|
|
3600
|
+
private texturePreloader?;
|
|
3539
3601
|
loadingManager: LoadingManager;
|
|
3540
3602
|
gltfLoader: GLTFLoader;
|
|
3541
3603
|
fbxLoader: FBXLoader;
|
|
@@ -3617,6 +3679,9 @@ declare class ModelManage extends DefaultManage {
|
|
|
3617
3679
|
}
|
|
3618
3680
|
|
|
3619
3681
|
export declare interface ModelPart {
|
|
3682
|
+
/** Omitted for triangle meshes. Basic line segments share the Entity lifecycle. */
|
|
3683
|
+
kind?: 'mesh' | 'line-segments';
|
|
3684
|
+
pickable?: boolean;
|
|
3620
3685
|
geometry: BufferGeometry;
|
|
3621
3686
|
material: Material | MaterialLease;
|
|
3622
3687
|
matrix: Matrix4;
|
|
@@ -3642,8 +3707,9 @@ export declare class ModelResources {
|
|
|
3642
3707
|
private pending;
|
|
3643
3708
|
private urls;
|
|
3644
3709
|
private gltfLoader;
|
|
3710
|
+
private bufferCache;
|
|
3645
3711
|
/** Borrow a host-configured loader; its decoder workers remain host-owned. */
|
|
3646
|
-
setGLTFLoader(loader: GLTFLoader): void;
|
|
3712
|
+
setGLTFLoader(loader: GLTFLoader, bufferCache?: ModelBufferCache): void;
|
|
3647
3713
|
readonly materials: {
|
|
3648
3714
|
register: (material: Material, options: {
|
|
3649
3715
|
ownership: "transfer";
|
|
@@ -4201,6 +4267,9 @@ declare class RendererManager {
|
|
|
4201
4267
|
*/
|
|
4202
4268
|
export declare function renderLoop(frameFun: (time: DOMHighResTimeStamp) => void): () => void;
|
|
4203
4269
|
|
|
4270
|
+
/** Default headers for SDK-owned HTTP(S) resource requests. */
|
|
4271
|
+
export declare const RequestHeaders: Record<string, string>;
|
|
4272
|
+
|
|
4204
4273
|
export declare class ResourceLease<T> {
|
|
4205
4274
|
readonly registry: ModelResources;
|
|
4206
4275
|
private record;
|
|
@@ -4460,11 +4529,19 @@ declare namespace shared {
|
|
|
4460
4529
|
cloneDeep,
|
|
4461
4530
|
cloneMaterials,
|
|
4462
4531
|
disposeMaterials,
|
|
4532
|
+
configureRequestLoader,
|
|
4533
|
+
createFileLoader,
|
|
4534
|
+
createImageLoader,
|
|
4535
|
+
createTextureLoader,
|
|
4536
|
+
createCubeTextureLoader,
|
|
4537
|
+
configureGLTFLoader,
|
|
4463
4538
|
FileResponseType,
|
|
4464
4539
|
fetchFile,
|
|
4465
4540
|
imageLoader,
|
|
4466
4541
|
textureLoader,
|
|
4467
4542
|
rgbeLoader,
|
|
4543
|
+
getRequestHeaders,
|
|
4544
|
+
fetchResource,
|
|
4468
4545
|
isObjectBehindCamera,
|
|
4469
4546
|
isObjectOccludeVisible,
|
|
4470
4547
|
poiNodeOccludeHandler,
|
|
@@ -6108,6 +6185,35 @@ export declare interface State {
|
|
|
6108
6185
|
};
|
|
6109
6186
|
}
|
|
6110
6187
|
|
|
6188
|
+
export declare interface StaticModelExtraction extends StaticModelSnapshot {
|
|
6189
|
+
restore: () => void;
|
|
6190
|
+
}
|
|
6191
|
+
|
|
6192
|
+
/** Load-session cache. It owns snapshots, never resources borrowed from procedural factories. */
|
|
6193
|
+
export declare class StaticModelPool {
|
|
6194
|
+
private resources;
|
|
6195
|
+
private options;
|
|
6196
|
+
private materials;
|
|
6197
|
+
private models;
|
|
6198
|
+
private disposed;
|
|
6199
|
+
constructor(resources: ModelResources, options?: {
|
|
6200
|
+
pickableLines?: boolean;
|
|
6201
|
+
ignoreRootVisibility?: boolean;
|
|
6202
|
+
});
|
|
6203
|
+
extract(root: Object3D): StaticModelExtraction;
|
|
6204
|
+
/** Copy an immutable render snapshot without retaining/moving the source tree.
|
|
6205
|
+
* The returned native remainder is owned by the snapshot, never the factory. */
|
|
6206
|
+
snapshot(root: Object3D): StaticModelSnapshot;
|
|
6207
|
+
dispose(): void;
|
|
6208
|
+
}
|
|
6209
|
+
|
|
6210
|
+
export declare interface StaticModelSnapshot {
|
|
6211
|
+
object: Object3D;
|
|
6212
|
+
model?: ModelLease;
|
|
6213
|
+
empty?: boolean;
|
|
6214
|
+
release: () => void;
|
|
6215
|
+
}
|
|
6216
|
+
|
|
6111
6217
|
export declare interface StrokeSelectOptions extends BaseSelectOptions {
|
|
6112
6218
|
isOpacityShow?: boolean;
|
|
6113
6219
|
edgeColor?: IColor;
|
|
@@ -6681,7 +6787,7 @@ declare class Viewport {
|
|
|
6681
6787
|
top: number;
|
|
6682
6788
|
};
|
|
6683
6789
|
getPositionByOffset(offset: OffsetPoint, z?: number, scalar?: number): Vector3;
|
|
6684
|
-
getIntersects(event: MouseEvent | TouchEvent | OffsetPoint, objects?: Object3D
|
|
6790
|
+
getIntersects(event: MouseEvent | TouchEvent | OffsetPoint, objects?: Object3D | Object3D[], options?: IntersectsOptions): Intersection<Object3D<Object3DEventMap>>[];
|
|
6685
6791
|
rayClash(startPoint?: Vector3, dir?: Vector3, objects?: Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material<MaterialEventMap> | Material<MaterialEventMap>[], Object3DEventMap>[]): Intersection<Object3D<Object3DEventMap>>[];
|
|
6686
6792
|
clearSignals(): void;
|
|
6687
6793
|
/**
|