soonspacejs 3.0.0-alpha.1 → 3.0.0-alpha.11
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 +6010 -5031
- package/package.json +1 -1
- package/types/Cache/ModelBufferCache.d.ts +26 -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/Interface/index.d.ts +1 -0
- package/types/Interface/modelCache.d.ts +9 -0
- package/types/Interface/signals.d.ts +2 -0
- package/types/Interface/viewport.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 +136 -6
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';
|
|
@@ -1140,6 +1142,11 @@ declare class Bvh {
|
|
|
1140
1142
|
dispose(): void;
|
|
1141
1143
|
}
|
|
1142
1144
|
|
|
1145
|
+
declare interface CacheOptions {
|
|
1146
|
+
maxEntryBytes?: number;
|
|
1147
|
+
onDiagnostic?: (event: ModelCacheDiagnostic) => void;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1143
1150
|
declare const calculateScaleFactor: (point3: Vector3, radiusPx: number, camera: Camera, size: Vector2) => number;
|
|
1144
1151
|
|
|
1145
1152
|
declare class CameraManager {
|
|
@@ -1274,6 +1281,16 @@ export declare type ClonePoiInfo = Omit<PoiInfo, 'url' | 'type'>;
|
|
|
1274
1281
|
*/
|
|
1275
1282
|
declare function computeTargetByRotation(position: IVector3, rotation: Rotation, scalar?: number): Vector3;
|
|
1276
1283
|
|
|
1284
|
+
declare function configureGLTFLoader(loader: GLTFLoader): GLTFLoader;
|
|
1285
|
+
|
|
1286
|
+
/** Only SDK-owned instances are adapted; resolve before snapshotting the actual request. */
|
|
1287
|
+
declare function configureRequestLoader<T extends {
|
|
1288
|
+
load: any;
|
|
1289
|
+
path: string;
|
|
1290
|
+
requestHeader: any;
|
|
1291
|
+
manager: LoadingManager;
|
|
1292
|
+
}>(loader: T): T;
|
|
1293
|
+
|
|
1277
1294
|
/**
|
|
1278
1295
|
* 以等分链的方式配置几何体的顶点权重
|
|
1279
1296
|
* @param options - 选项
|
|
@@ -1586,6 +1603,8 @@ export declare interface CreateChainSkinnedMeshForMeshOptions_Base {
|
|
|
1586
1603
|
skeleton: Skeleton;
|
|
1587
1604
|
}
|
|
1588
1605
|
|
|
1606
|
+
declare function createCubeTextureLoader(manager?: LoadingManager): CubeTextureLoader;
|
|
1607
|
+
|
|
1589
1608
|
export declare function createCurveAnimationClip(options: CreateCurveAnimationClipByCurveOptions): CreateCurveAnimationClipReturn;
|
|
1590
1609
|
|
|
1591
1610
|
export declare function createCurveAnimationClip(options: CreateCurveAnimationClipByPolylineOptions): CreateCurveAnimationClipReturn;
|
|
@@ -1694,6 +1713,8 @@ export declare interface CreateCurveAnimationClipReturn {
|
|
|
1694
1713
|
*/
|
|
1695
1714
|
export declare function createEqualChainBones(boneOpts: EqualChainBoneOptions): Bone[];
|
|
1696
1715
|
|
|
1716
|
+
declare function createFileLoader(manager?: LoadingManager): FileLoader;
|
|
1717
|
+
|
|
1697
1718
|
/**
|
|
1698
1719
|
* 创建 查找位置附近的 box 空间范围内的物体
|
|
1699
1720
|
* @param boxSpace - 描述查找空间的信息对象
|
|
@@ -1727,6 +1748,8 @@ export declare function createFindObjectsNearPath(points: Vector3[], radius: num
|
|
|
1727
1748
|
*/
|
|
1728
1749
|
export declare function createGuiAnimationController(action: AnimationAction): GuiAnimationController;
|
|
1729
1750
|
|
|
1751
|
+
declare function createImageLoader(manager?: LoadingManager): ImageLoader;
|
|
1752
|
+
|
|
1730
1753
|
/**
|
|
1731
1754
|
* createKeyframeTracksOfCurveAnimationByPolyline 的选项
|
|
1732
1755
|
*/
|
|
@@ -1831,6 +1854,8 @@ export declare function createPlaneMatrix(points: Vector3[]): Matrix3;
|
|
|
1831
1854
|
|
|
1832
1855
|
export declare function createTexture(image: string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, cache?: boolean, textureCache?: Map<string, Texture>): Texture<unknown, TextureEventMap>;
|
|
1833
1856
|
|
|
1857
|
+
declare function createTextureLoader(manager?: LoadingManager): TextureLoader;
|
|
1858
|
+
|
|
1834
1859
|
/**
|
|
1835
1860
|
* 创建 uv 变换矩阵
|
|
1836
1861
|
* @remarks
|
|
@@ -2164,6 +2189,7 @@ export declare class EntityCollection {
|
|
|
2164
2189
|
private pendingModels;
|
|
2165
2190
|
private selected;
|
|
2166
2191
|
private selectionDirty;
|
|
2192
|
+
private selectionHighlight;
|
|
2167
2193
|
constructor(scene: Scene, requestRender: () => void, models: ModelResources, sideVariants?: Pick<TransparentSideVariants, 'register' | 'unregister'>);
|
|
2168
2194
|
get roots(): readonly Entity[];
|
|
2169
2195
|
getById(id: string): Entity | undefined;
|
|
@@ -2187,6 +2213,11 @@ export declare class EntityCollection {
|
|
|
2187
2213
|
attach(entity: Entity, object: Object3D): void;
|
|
2188
2214
|
detach(entity: Entity, object: Object3D): void;
|
|
2189
2215
|
pick(raycaster: Raycaster): EntityHit[];
|
|
2216
|
+
private pickAttachments;
|
|
2217
|
+
/** On-demand source surfaces for drawing/projection. These meshes never enter the scene. */
|
|
2218
|
+
pickSurfaces(raycaster: Raycaster): EntityHit[];
|
|
2219
|
+
/** Explicit BVH preparation snapshots current parts; later loads need another preparation. */
|
|
2220
|
+
getSourceGeometries(): ReadonlySet<BufferGeometry>;
|
|
2190
2221
|
/** Fresh world bounds from committed transforms, including hidden content. */
|
|
2191
2222
|
getBounds(entity: Entity, options?: {
|
|
2192
2223
|
includeDescendants?: boolean;
|
|
@@ -2194,12 +2225,18 @@ export declare class EntityCollection {
|
|
|
2194
2225
|
getStats(): {
|
|
2195
2226
|
updatedEntities: number;
|
|
2196
2227
|
entities: number;
|
|
2228
|
+
sourceParts: number;
|
|
2229
|
+
renderObjects: number;
|
|
2230
|
+
rebuilds: number;
|
|
2197
2231
|
instancedBatches: number;
|
|
2198
2232
|
batchedBatches: number;
|
|
2199
2233
|
independentObjects: number;
|
|
2200
|
-
|
|
2234
|
+
lineBatches: number;
|
|
2201
2235
|
};
|
|
2202
|
-
|
|
2236
|
+
/** Selection identity is retained even when the optional visual overlay is disabled. */
|
|
2237
|
+
setSelection(entities: readonly Entity[], options?: {
|
|
2238
|
+
highlight?: boolean;
|
|
2239
|
+
}): void;
|
|
2203
2240
|
getSelection(): readonly Entity[];
|
|
2204
2241
|
setInstancingEnabled(enabled: boolean): void;
|
|
2205
2242
|
setBatchedEnabled(enabled: boolean): void;
|
|
@@ -2258,7 +2295,10 @@ declare class EventHandler {
|
|
|
2258
2295
|
/**
|
|
2259
2296
|
* PC
|
|
2260
2297
|
*/
|
|
2261
|
-
private
|
|
2298
|
+
private mouseClickGroup;
|
|
2299
|
+
private mouseDownGroup;
|
|
2300
|
+
private pendingMouseClicks;
|
|
2301
|
+
private disposed;
|
|
2262
2302
|
private mouseDownEvent;
|
|
2263
2303
|
private container;
|
|
2264
2304
|
private options;
|
|
@@ -2281,6 +2321,7 @@ declare class EventHandler {
|
|
|
2281
2321
|
private handleMouseDown;
|
|
2282
2322
|
private handleMouseMove;
|
|
2283
2323
|
private handleMouseUp;
|
|
2324
|
+
private cancelPendingMouseClicks;
|
|
2284
2325
|
private handleDblClick;
|
|
2285
2326
|
private handleMouseWheel;
|
|
2286
2327
|
private handleTouchStart;
|
|
@@ -2308,7 +2349,11 @@ declare class FBXLoader extends Loader<any, string> {
|
|
|
2308
2349
|
|
|
2309
2350
|
declare const fetchFile: <T = any>(url: string, responseType: FileResponseType) => Promise<T>;
|
|
2310
2351
|
|
|
2311
|
-
|
|
2352
|
+
/** Keep the caller's Request/RequestInit semantics and snapshot at dispatch time. */
|
|
2353
|
+
declare function fetchResource(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
2354
|
+
|
|
2355
|
+
/** Backwards-compatible alias. Both names refer to the same mutable object. */
|
|
2356
|
+
export declare const FileRequestHeaders: Record<string, string>;
|
|
2312
2357
|
|
|
2313
2358
|
declare type FileResponseType = 'json' | 'arraybuffer' | 'blob' | 'document' | 'text';
|
|
2314
2359
|
|
|
@@ -2659,6 +2704,9 @@ export declare function getPolygonGeometryInfo(points: Vector3[]): {
|
|
|
2659
2704
|
position: Vector3;
|
|
2660
2705
|
};
|
|
2661
2706
|
|
|
2707
|
+
/** Snapshot defaults and explicit headers. Explicit names win case-insensitively. */
|
|
2708
|
+
declare function getRequestHeaders(input: string | URL | Request, headers?: HeadersInit): Record<string, string>;
|
|
2709
|
+
|
|
2662
2710
|
/**
|
|
2663
2711
|
* 获取根骨骼
|
|
2664
2712
|
* @remarks
|
|
@@ -3061,6 +3109,7 @@ declare class Info {
|
|
|
3061
3109
|
container: HTMLDivElement;
|
|
3062
3110
|
private renderStateFrame;
|
|
3063
3111
|
private disposed;
|
|
3112
|
+
private cleanups;
|
|
3064
3113
|
state: {
|
|
3065
3114
|
objects: number;
|
|
3066
3115
|
meshes: number;
|
|
@@ -3479,6 +3528,37 @@ export declare interface ModelAnimationFindFunc {
|
|
|
3479
3528
|
(animation: AnimationClip, index: number, animations: AnimationClip[]): boolean;
|
|
3480
3529
|
}
|
|
3481
3530
|
|
|
3531
|
+
/** Raw HTTP model bytes only. Runtime leases / GPU graphs are never persisted. */
|
|
3532
|
+
declare class ModelBufferCache {
|
|
3533
|
+
private readonly store;
|
|
3534
|
+
private readonly enabled;
|
|
3535
|
+
private readonly options;
|
|
3536
|
+
private warned;
|
|
3537
|
+
constructor(store?: LocalForage, enabled?: () => boolean, options?: () => CacheOptions);
|
|
3538
|
+
private maximumEntryBytes;
|
|
3539
|
+
private withinLimit;
|
|
3540
|
+
private diagnose;
|
|
3541
|
+
load(url: string, init: {
|
|
3542
|
+
headers: Headers;
|
|
3543
|
+
credentials: RequestCredentials;
|
|
3544
|
+
signal?: AbortSignal;
|
|
3545
|
+
redirect?: RequestRedirect;
|
|
3546
|
+
}): Promise<ArrayBuffer>;
|
|
3547
|
+
private key;
|
|
3548
|
+
private mutate;
|
|
3549
|
+
clear(): Promise<void>;
|
|
3550
|
+
}
|
|
3551
|
+
|
|
3552
|
+
/** Cache diagnostics never contain resource URLs, headers or exception messages. */
|
|
3553
|
+
export declare interface ModelCacheDiagnostic {
|
|
3554
|
+
key: string;
|
|
3555
|
+
operation: 'read' | 'write' | 'skip';
|
|
3556
|
+
reason: 'storage-error' | 'invalid-entry' | 'entry-too-large';
|
|
3557
|
+
bytes?: number;
|
|
3558
|
+
maxEntryBytes: number;
|
|
3559
|
+
errorName?: string;
|
|
3560
|
+
}
|
|
3561
|
+
|
|
3482
3562
|
export declare interface ModelEventParams {
|
|
3483
3563
|
target: Model;
|
|
3484
3564
|
currentTarget: Mesh;
|
|
@@ -3536,6 +3616,8 @@ declare class ModelManage extends DefaultManage {
|
|
|
3536
3616
|
*/
|
|
3537
3617
|
store: typeof default_2;
|
|
3538
3618
|
cacheStore: typeof default_2;
|
|
3619
|
+
readonly bufferCache: ModelBufferCache;
|
|
3620
|
+
private texturePreloader?;
|
|
3539
3621
|
loadingManager: LoadingManager;
|
|
3540
3622
|
gltfLoader: GLTFLoader;
|
|
3541
3623
|
fbxLoader: FBXLoader;
|
|
@@ -3617,6 +3699,9 @@ declare class ModelManage extends DefaultManage {
|
|
|
3617
3699
|
}
|
|
3618
3700
|
|
|
3619
3701
|
export declare interface ModelPart {
|
|
3702
|
+
/** Omitted for triangle meshes. Basic line segments share the Entity lifecycle. */
|
|
3703
|
+
kind?: 'mesh' | 'line-segments';
|
|
3704
|
+
pickable?: boolean;
|
|
3620
3705
|
geometry: BufferGeometry;
|
|
3621
3706
|
material: Material | MaterialLease;
|
|
3622
3707
|
matrix: Matrix4;
|
|
@@ -3642,8 +3727,9 @@ export declare class ModelResources {
|
|
|
3642
3727
|
private pending;
|
|
3643
3728
|
private urls;
|
|
3644
3729
|
private gltfLoader;
|
|
3730
|
+
private bufferCache;
|
|
3645
3731
|
/** Borrow a host-configured loader; its decoder workers remain host-owned. */
|
|
3646
|
-
setGLTFLoader(loader: GLTFLoader): void;
|
|
3732
|
+
setGLTFLoader(loader: GLTFLoader, bufferCache?: ModelBufferCache): void;
|
|
3647
3733
|
readonly materials: {
|
|
3648
3734
|
register: (material: Material, options: {
|
|
3649
3735
|
ownership: "transfer";
|
|
@@ -4201,6 +4287,9 @@ declare class RendererManager {
|
|
|
4201
4287
|
*/
|
|
4202
4288
|
export declare function renderLoop(frameFun: (time: DOMHighResTimeStamp) => void): () => void;
|
|
4203
4289
|
|
|
4290
|
+
/** Default headers for SDK-owned HTTP(S) resource requests. */
|
|
4291
|
+
export declare const RequestHeaders: Record<string, string>;
|
|
4292
|
+
|
|
4204
4293
|
export declare class ResourceLease<T> {
|
|
4205
4294
|
readonly registry: ModelResources;
|
|
4206
4295
|
private record;
|
|
@@ -4460,11 +4549,19 @@ declare namespace shared {
|
|
|
4460
4549
|
cloneDeep,
|
|
4461
4550
|
cloneMaterials,
|
|
4462
4551
|
disposeMaterials,
|
|
4552
|
+
configureRequestLoader,
|
|
4553
|
+
createFileLoader,
|
|
4554
|
+
createImageLoader,
|
|
4555
|
+
createTextureLoader,
|
|
4556
|
+
createCubeTextureLoader,
|
|
4557
|
+
configureGLTFLoader,
|
|
4463
4558
|
FileResponseType,
|
|
4464
4559
|
fetchFile,
|
|
4465
4560
|
imageLoader,
|
|
4466
4561
|
textureLoader,
|
|
4467
4562
|
rgbeLoader,
|
|
4563
|
+
getRequestHeaders,
|
|
4564
|
+
fetchResource,
|
|
4468
4565
|
isObjectBehindCamera,
|
|
4469
4566
|
isObjectOccludeVisible,
|
|
4470
4567
|
poiNodeOccludeHandler,
|
|
@@ -4499,6 +4596,8 @@ export declare interface SignalsState {
|
|
|
4499
4596
|
backgroundChanged: Signal;
|
|
4500
4597
|
beforeRender: Signal;
|
|
4501
4598
|
sceneRendered: Signal;
|
|
4599
|
+
/** Dispatches ModelCacheDiagnostic when persistent model caching fails or skips a size limit. */
|
|
4600
|
+
modelCacheDiagnostic: Signal;
|
|
4502
4601
|
tweenUpdate: Signal;
|
|
4503
4602
|
hover: Signal;
|
|
4504
4603
|
click: Signal;
|
|
@@ -6108,6 +6207,35 @@ export declare interface State {
|
|
|
6108
6207
|
};
|
|
6109
6208
|
}
|
|
6110
6209
|
|
|
6210
|
+
export declare interface StaticModelExtraction extends StaticModelSnapshot {
|
|
6211
|
+
restore: () => void;
|
|
6212
|
+
}
|
|
6213
|
+
|
|
6214
|
+
/** Load-session cache. It owns snapshots, never resources borrowed from procedural factories. */
|
|
6215
|
+
export declare class StaticModelPool {
|
|
6216
|
+
private resources;
|
|
6217
|
+
private options;
|
|
6218
|
+
private materials;
|
|
6219
|
+
private models;
|
|
6220
|
+
private disposed;
|
|
6221
|
+
constructor(resources: ModelResources, options?: {
|
|
6222
|
+
pickableLines?: boolean;
|
|
6223
|
+
ignoreRootVisibility?: boolean;
|
|
6224
|
+
});
|
|
6225
|
+
extract(root: Object3D): StaticModelExtraction;
|
|
6226
|
+
/** Copy an immutable render snapshot without retaining/moving the source tree.
|
|
6227
|
+
* The returned native remainder is owned by the snapshot, never the factory. */
|
|
6228
|
+
snapshot(root: Object3D): StaticModelSnapshot;
|
|
6229
|
+
dispose(): void;
|
|
6230
|
+
}
|
|
6231
|
+
|
|
6232
|
+
export declare interface StaticModelSnapshot {
|
|
6233
|
+
object: Object3D;
|
|
6234
|
+
model?: ModelLease;
|
|
6235
|
+
empty?: boolean;
|
|
6236
|
+
release: () => void;
|
|
6237
|
+
}
|
|
6238
|
+
|
|
6111
6239
|
export declare interface StrokeSelectOptions extends BaseSelectOptions {
|
|
6112
6240
|
isOpacityShow?: boolean;
|
|
6113
6241
|
edgeColor?: IColor;
|
|
@@ -6681,7 +6809,7 @@ declare class Viewport {
|
|
|
6681
6809
|
top: number;
|
|
6682
6810
|
};
|
|
6683
6811
|
getPositionByOffset(offset: OffsetPoint, z?: number, scalar?: number): Vector3;
|
|
6684
|
-
getIntersects(event: MouseEvent | TouchEvent | OffsetPoint, objects?: Object3D
|
|
6812
|
+
getIntersects(event: MouseEvent | TouchEvent | OffsetPoint, objects?: Object3D | Object3D[], options?: IntersectsOptions): Intersection<Object3D<Object3DEventMap>>[];
|
|
6685
6813
|
rayClash(startPoint?: Vector3, dir?: Vector3, objects?: Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material<MaterialEventMap> | Material<MaterialEventMap>[], Object3DEventMap>[]): Intersection<Object3D<Object3DEventMap>>[];
|
|
6686
6814
|
clearSignals(): void;
|
|
6687
6815
|
/**
|
|
@@ -6722,6 +6850,8 @@ export declare interface ViewportOptions {
|
|
|
6722
6850
|
closeInfoLog?: boolean;
|
|
6723
6851
|
closeWarnLog?: boolean;
|
|
6724
6852
|
useIndexedDB?: boolean;
|
|
6853
|
+
/** Maximum bytes per persistent model resource; default 1 GiB, zero disables persistence. */
|
|
6854
|
+
modelCacheMaxEntryBytes?: number;
|
|
6725
6855
|
}
|
|
6726
6856
|
|
|
6727
6857
|
export declare interface ViewportState {
|