soonspacejs 2.3.20 → 2.4.0
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/dist/index.esm.js +6 -6
- package/dist/index.js +6 -6
- package/package.json +3 -2
- package/types/Interface/animation.d.ts +4 -4
- package/types/Interface/base.d.ts +2 -1
- package/types/Interface/manager.d.ts +1 -1
- package/types/Interface/viewport.d.ts +5 -0
- package/types/Library/BaseObject3D.d.ts +2 -1
- package/types/Library/Model.d.ts +0 -2
- package/types/Library/Sbm.d.ts +0 -2
- package/types/Loader/DatLoader.d.ts +68 -0
- package/types/Loader/SbmLoader/SbkLoader.d.ts +1 -10
- package/types/Loader/SbmLoader/SbmLoader.d.ts +13 -9
- package/types/Loader/{utils → SbmLoader/utils}/generateSbm.d.ts +2 -2
- package/types/Manager/Canvas3DManage.d.ts +2 -2
- package/types/Manager/DefaultManage.d.ts +20 -11
- package/types/Manager/GroupManage.d.ts +7 -0
- package/types/Manager/HelperManage.d.ts +2 -2
- package/types/Manager/LightManage.d.ts +2 -1
- package/types/Manager/ModelManage.d.ts +22 -6
- package/types/Manager/PluginObjectManage.d.ts +3 -3
- package/types/Manager/PoiManage.d.ts +2 -2
- package/types/Manager/PoiNodeManage.d.ts +2 -2
- package/types/Manager/SbmManage.d.ts +2 -2
- package/types/Manager/TopologyManage.d.ts +2 -2
- package/types/Manager/index.d.ts +6 -5
- package/types/Shared/cloneDeep.d.ts +2 -0
- package/types/Shared/index.d.ts +5 -3
- package/types/Shared/material.d.ts +2 -0
- package/types/Shared/path.d.ts +1 -0
- package/types/Viewport/RendererManager.d.ts +4 -2
- package/types/Viewport/index.d.ts +8 -5
- package/types/index.d.ts +15 -6
- package/types/Shared/sbmx.d.ts +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soonspacejs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
|
+
"homepage": "http://www.xwbuilders.com:8800/",
|
|
4
5
|
"description": "soonspacejs 2.x",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"module": "dist/index.esm.js",
|
|
@@ -21,5 +22,5 @@
|
|
|
21
22
|
"localforage": "1.9.0",
|
|
22
23
|
"three": "0.139.0"
|
|
23
24
|
},
|
|
24
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "33f17a26b09ee1ff70726ef24baacba701a8a573"
|
|
25
26
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
declare type
|
|
2
|
-
declare type
|
|
1
|
+
declare type AnimationModeType = 'Linear.None' | 'Quadratic.In' | 'Quadratic.Out' | 'Quadratic.InOut' | 'Cubic.In' | 'Cubic.Out' | 'Cubic.InOut' | 'Quartic.In' | 'Quartic.Out' | 'Quartic.InOut' | 'Quintic.In' | 'Quintic.Out' | 'Quintic.InOut' | 'Sinusoidal.In' | 'Sinusoidal.Out' | 'Sinusoidal.InOut' | 'Exponential.In' | 'Exponential.Out' | 'Exponential.InOut' | 'Circular.In' | 'Circular.Out' | 'Circular.InOut' | 'Elastic.In' | 'Elastic.Out' | 'Elastic.InOut' | 'Back.In' | 'Back.Out' | 'Back.InOut' | 'Bounce.In' | 'Bounce.Out' | 'Bounce.InOut';
|
|
2
|
+
declare type AnimationModeValueType = (amount: number) => number;
|
|
3
3
|
interface AnimationOptions {
|
|
4
4
|
duration?: number;
|
|
5
5
|
delay?: number;
|
|
6
6
|
repeat?: number | boolean;
|
|
7
|
-
mode?:
|
|
7
|
+
mode?: AnimationModeType;
|
|
8
8
|
yoyo?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export {
|
|
10
|
+
export { AnimationModeType, AnimationModeValueType, AnimationOptions, };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Color } from 'three';
|
|
1
2
|
interface IVector2 {
|
|
2
3
|
x: number;
|
|
3
4
|
y: number;
|
|
@@ -15,7 +16,7 @@ interface IVector3 extends IVector2 {
|
|
|
15
16
|
declare type Position = IVector3;
|
|
16
17
|
declare type Rotation = IVector3;
|
|
17
18
|
declare type Scale = IVector3;
|
|
18
|
-
declare type IColor = string | number;
|
|
19
|
+
declare type IColor = string | number | Color;
|
|
19
20
|
interface Level {
|
|
20
21
|
max: number | null;
|
|
21
22
|
min: number | null;
|
|
@@ -80,6 +80,7 @@ interface ViewportOptions {
|
|
|
80
80
|
fog?: boolean | FogOptions;
|
|
81
81
|
controls?: ControlsOptions;
|
|
82
82
|
hoverEnabled?: boolean;
|
|
83
|
+
levelEnabled?: boolean;
|
|
83
84
|
closeInfoLog?: boolean;
|
|
84
85
|
closeWarnLog?: boolean;
|
|
85
86
|
useIndexedDB?: boolean;
|
|
@@ -98,4 +99,8 @@ export interface BloomOptions {
|
|
|
98
99
|
export interface SobelOptions {
|
|
99
100
|
enable?: boolean;
|
|
100
101
|
}
|
|
102
|
+
export interface ToneMappingOptions {
|
|
103
|
+
type?: 'None' | 'Linear' | 'Reinhard' | 'Cineon' | 'ACESFilmic';
|
|
104
|
+
exposure?: number;
|
|
105
|
+
}
|
|
101
106
|
export { CameraViewpointData, FlyToObjOptions, SurroundOptions, LabelOptions, InternalOptions, SelectModelOptions, EdgeSelectOptions, StrokeSelectOptions, OpacitySelectOptions, HighlightSelectOptions, EmissiveSelectOptions, FogOptions, SkyOptions, ViewportOptions, ViewportState, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Object3D, Vector3, Euler, BaseEvent, Event } from 'three';
|
|
1
|
+
import { Object3D, Vector3, Euler, BaseEvent, Event, Box3 } from 'three';
|
|
2
2
|
import { Tween } from '@tweenjs/tween.js';
|
|
3
3
|
import { Position, Rotation, Scale, Level, AnimationOptions, Interpolate } from '../Interface';
|
|
4
4
|
interface BaseObject3DInfo {
|
|
@@ -25,6 +25,7 @@ declare class BaseObject3D<E extends BaseEvent = Event> extends Object3D<E> {
|
|
|
25
25
|
setScale(scale: Scale | Vector3, options?: AnimationOptions, onUpdate?: (source: Scale, tween: Tween<Scale>) => void, onStart?: (tween: Tween<Scale>) => void): Promise<void>;
|
|
26
26
|
sClone<T extends BaseObject3D>(recursive?: boolean): T;
|
|
27
27
|
sCopy<T extends BaseObject3D>(source: BaseObject3D, recursive?: boolean): T;
|
|
28
|
+
getBoundingBox(): Box3;
|
|
28
29
|
getSpaceAttribute(isFromWorld?: boolean): {
|
|
29
30
|
position: Vector3;
|
|
30
31
|
rotation: Euler;
|
package/types/Library/Model.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Box3 } from 'three';
|
|
2
1
|
import { BaseObject3D, BaseObject3DInfo } from './BaseObject3D';
|
|
3
2
|
import { ObjectEvents, ObjectEventsListener } from '../Interface';
|
|
4
3
|
interface ModelInfo extends BaseObject3DInfo, ObjectEvents<Model> {
|
|
@@ -15,7 +14,6 @@ declare class Model extends BaseObject3D<ObjectEventsListener> implements Object
|
|
|
15
14
|
onDblClick: ((object: Model) => void) | null;
|
|
16
15
|
onRightClick: ((object: Model) => void) | null;
|
|
17
16
|
constructor(param: ModelInnerInfo);
|
|
18
|
-
getBoundingBox(): Box3;
|
|
19
17
|
eventPropagation(): void;
|
|
20
18
|
setEnvMap(dirPath: string, fileNames?: string[], options?: {
|
|
21
19
|
reflectivity?: number;
|
package/types/Library/Sbm.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Box3 } from 'three';
|
|
2
1
|
import { BaseObject3D, BaseObject3DInfo } from './BaseObject3D';
|
|
3
2
|
import { ObjectEvents, ObjectEventsListener } from '../Interface';
|
|
4
3
|
interface SbmInfo extends BaseObject3DInfo, ObjectEvents<Sbm> {
|
|
@@ -12,7 +11,6 @@ declare class Sbm extends BaseObject3D<ObjectEventsListener> implements ObjectEv
|
|
|
12
11
|
onDblClick: ((object: Sbm) => void) | null;
|
|
13
12
|
onRightClick: ((object: Sbm) => void) | null;
|
|
14
13
|
constructor(param: SbmInfo);
|
|
15
|
-
getBoundingBox(): Box3;
|
|
16
14
|
eventPropagation(): void;
|
|
17
15
|
setEnvMap(dirPath: string, fileNames?: string[], options?: {
|
|
18
16
|
reflectivity?: number;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { Material } from 'three';
|
|
3
|
+
export interface TexturesIndexes {
|
|
4
|
+
name: string;
|
|
5
|
+
base_map: string;
|
|
6
|
+
nor_map: string;
|
|
7
|
+
color: {
|
|
8
|
+
r: number;
|
|
9
|
+
g: number;
|
|
10
|
+
b: number;
|
|
11
|
+
a: number;
|
|
12
|
+
};
|
|
13
|
+
metallic: number;
|
|
14
|
+
roughness: number;
|
|
15
|
+
alphamode: number;
|
|
16
|
+
use_list: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface MaterialsMapValue {
|
|
19
|
+
material: Material;
|
|
20
|
+
materialIndex: number;
|
|
21
|
+
}
|
|
22
|
+
declare class DatLoader extends THREE.Loader {
|
|
23
|
+
loadedTextures: Set<string>;
|
|
24
|
+
loadedMaterialsMap: Map<string, MaterialsMapValue>;
|
|
25
|
+
loadedMaterials: THREE.Material[];
|
|
26
|
+
constructor();
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param buffer
|
|
30
|
+
* @param path
|
|
31
|
+
*/
|
|
32
|
+
parseAsync(buffer: ArrayBuffer, path: string): Promise<THREE.Mesh<THREE.BufferGeometry, THREE.Material[]>>;
|
|
33
|
+
private _createMeshByStream;
|
|
34
|
+
/**
|
|
35
|
+
* 创建 material
|
|
36
|
+
* @param path
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
private _createMaterial;
|
|
40
|
+
}
|
|
41
|
+
export { DatLoader, };
|
|
42
|
+
export interface SubMesh {
|
|
43
|
+
start: number;
|
|
44
|
+
count: number;
|
|
45
|
+
uuid: string;
|
|
46
|
+
alphaMode: number;
|
|
47
|
+
}
|
|
48
|
+
export interface ChunkInfo {
|
|
49
|
+
position: Float32Array;
|
|
50
|
+
normal: Int8Array;
|
|
51
|
+
color: Uint8Array;
|
|
52
|
+
texcoord: Float32Array;
|
|
53
|
+
indice: Uint32Array;
|
|
54
|
+
sub_mesh: SubMesh[];
|
|
55
|
+
}
|
|
56
|
+
export declare const parseChunk: (arraybuffer: ArrayBuffer) => {
|
|
57
|
+
position: Float32Array;
|
|
58
|
+
normal: Int8Array;
|
|
59
|
+
color: Uint8Array;
|
|
60
|
+
texcoord: Float32Array;
|
|
61
|
+
indice: Uint32Array;
|
|
62
|
+
sub_mesh: {
|
|
63
|
+
start: number;
|
|
64
|
+
count: number;
|
|
65
|
+
uuid: string;
|
|
66
|
+
alphaMode: number;
|
|
67
|
+
}[];
|
|
68
|
+
};
|
|
@@ -6,22 +6,13 @@ declare class SbkLoader {
|
|
|
6
6
|
materials: Map<string, any>;
|
|
7
7
|
sbmInfo: SbmInfo | null;
|
|
8
8
|
constructor();
|
|
9
|
-
/**
|
|
10
|
-
* 加载模型
|
|
11
|
-
* @param sbmInfo 模型信息
|
|
12
|
-
* @param onProgress 模型加载进度回填函数
|
|
13
|
-
*/
|
|
14
|
-
load(sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<Sbm | {
|
|
15
|
-
sbm: Sbm;
|
|
16
|
-
caches: SbmCache;
|
|
17
|
-
}>;
|
|
18
9
|
/**
|
|
19
10
|
* 解析模型
|
|
20
11
|
* @param buffer 模型二进制原数据
|
|
21
12
|
* @param sbmInfo 模型信息
|
|
22
13
|
* @param onProgress 模型加载进度回填函数
|
|
23
14
|
*/
|
|
24
|
-
parseBuffer(buffer: ArrayBuffer, sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<
|
|
15
|
+
parseBuffer(buffer: ArrayBuffer, sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<{
|
|
25
16
|
sbm: Sbm;
|
|
26
17
|
caches: SbmCache;
|
|
27
18
|
}>;
|
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
import { Sbm, SbmInfo } from '../../Library';
|
|
2
2
|
import { ModelLoadingProgress, ModelLoadingProgressCallback } from '../../Interface';
|
|
3
|
+
import { SbmCache } from '../../Interface/sbmCache';
|
|
3
4
|
declare class SbmLoader {
|
|
4
5
|
materials: Map<string, any>;
|
|
5
6
|
sbmInfo: SbmInfo | null;
|
|
6
7
|
isLE: boolean;
|
|
7
8
|
constructor();
|
|
8
|
-
/**
|
|
9
|
-
* 加载模型
|
|
10
|
-
* @param sbmInfo 模型信息
|
|
11
|
-
* @param onProgress 模型加载进度回填函数
|
|
12
|
-
*/
|
|
13
|
-
load(sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<Sbm>;
|
|
14
9
|
/**
|
|
15
10
|
* 解析模型
|
|
16
11
|
* @param buffer 模型二进制原数据
|
|
17
12
|
* @param sbmInfo 模型信息
|
|
18
13
|
* @param onProgress 模型加载进度回填函数
|
|
19
14
|
*/
|
|
20
|
-
parseBuffer(buffer: ArrayBuffer, sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<
|
|
15
|
+
parseBuffer(buffer: ArrayBuffer, sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<{
|
|
16
|
+
sbm: Sbm;
|
|
17
|
+
caches: SbmCache;
|
|
18
|
+
}>;
|
|
21
19
|
/**
|
|
22
20
|
* @param dataView
|
|
23
21
|
* @param offset
|
|
24
22
|
* @param onProgress
|
|
25
23
|
*/
|
|
26
|
-
_parseV2(dataView: DataView, offset: number, onProgress?: ModelLoadingProgressCallback): Promise<
|
|
24
|
+
_parseV2(dataView: DataView, offset: number, onProgress?: ModelLoadingProgressCallback): Promise<{
|
|
25
|
+
sbm: Sbm;
|
|
26
|
+
caches: SbmCache;
|
|
27
|
+
}>;
|
|
27
28
|
/**
|
|
28
29
|
* @param dataView
|
|
29
30
|
* @param offset
|
|
30
31
|
* @param onProgress
|
|
31
32
|
*/
|
|
32
|
-
_parseV3(dataView: DataView, offset: number, onProgress?: ModelLoadingProgressCallback): Promise<
|
|
33
|
+
_parseV3(dataView: DataView, offset: number, onProgress?: ModelLoadingProgressCallback): Promise<{
|
|
34
|
+
sbm: Sbm;
|
|
35
|
+
caches: SbmCache;
|
|
36
|
+
}>;
|
|
33
37
|
/**
|
|
34
38
|
* 获取材质贴图路径
|
|
35
39
|
* @param modelUrl 模型资源路径
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Texture,
|
|
1
|
+
import { Texture, MeshStandardMaterial } from 'three';
|
|
2
2
|
/**
|
|
3
3
|
* 生成 sbm 纹理
|
|
4
4
|
* @param url
|
|
@@ -10,4 +10,4 @@ export declare const generateSbmTexture: (textureUrl: string) => Texture;
|
|
|
10
10
|
* @param arr
|
|
11
11
|
* @param texture
|
|
12
12
|
*/
|
|
13
|
-
export declare const generateSbmMaterial: (materialId: string, arr: number[], texture: Texture | null) =>
|
|
13
|
+
export declare const generateSbmMaterial: (materialId: string, arr: number[], texture: Texture | null) => MeshStandardMaterial;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import DefaultManage from './DefaultManage';
|
|
2
2
|
import Viewport from '../Viewport';
|
|
3
|
-
import { Group, GroupInfo, Canvas3D, Canvas3DInfo } from '../Library';
|
|
3
|
+
import { Group, GroupInfo, Canvas3D, Canvas3DInfo, SceneManage } from '../Library';
|
|
4
4
|
declare class Canvas3DManage extends DefaultManage {
|
|
5
|
-
constructor(viewport: Viewport);
|
|
5
|
+
constructor(viewport: Viewport, scene: SceneManage);
|
|
6
6
|
create(info: Canvas3DInfo): Canvas3D;
|
|
7
7
|
createToGroup(groupInfo: GroupInfo, poiInfo: Canvas3DInfo[]): Group;
|
|
8
8
|
addForGroup(groupId: GroupInfo['id'], poiInfo: Canvas3DInfo[]): Group | null;
|
|
@@ -1,22 +1,31 @@
|
|
|
1
|
+
import { Object3D } from 'three';
|
|
1
2
|
import Viewport from '../Viewport';
|
|
2
|
-
import {
|
|
3
|
+
import { Group, GroupInfo, SceneManage, BaseObject3D } from '../Library';
|
|
3
4
|
import { UserDataPropertyFindFunc } from '../Interface';
|
|
4
5
|
declare type findPropKey = 'name' | 'sid';
|
|
6
|
+
declare type ManageCache = {
|
|
7
|
+
objects: Map<BaseObject3D['sid'], Object3D>;
|
|
8
|
+
};
|
|
5
9
|
declare class DefaultManage {
|
|
6
10
|
readonly type: string;
|
|
7
11
|
readonly scene: SceneManage;
|
|
8
12
|
readonly viewport: Viewport;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
readonly cache: ManageCache;
|
|
14
|
+
constructor(type: string, viewport: Viewport, scene: SceneManage);
|
|
15
|
+
/**
|
|
16
|
+
* cache
|
|
17
|
+
*/
|
|
18
|
+
getObjectsCache<T extends Object3D>(sid: BaseObject3D['sid']): T;
|
|
19
|
+
setObjectsCache<T extends Object3D>(objects: T): void;
|
|
20
|
+
removeObjectsCache(sid: BaseObject3D['sid']): void;
|
|
21
|
+
/***
|
|
22
|
+
* group
|
|
23
|
+
*/
|
|
24
|
+
createGroup(groupInfo: GroupInfo, parent?: Object3D | null): Group;
|
|
25
|
+
getById<T extends Object3D>(id: BaseObject3D['sid'], type?: string): T | null;
|
|
26
|
+
getByName<T extends BaseObject3D>(name: string, type?: string): T[];
|
|
27
|
+
getByUserDataProperty<T extends Object3D = BaseObject3D>(propNameOrFindFunc: string | UserDataPropertyFindFunc, propValue?: any): T[];
|
|
14
28
|
removeById(id: BaseObject3D['sid']): boolean;
|
|
15
|
-
createGroup(groupInfo: GroupInfo): Group;
|
|
16
|
-
getGroupById<T = Group>(id: string | number): T | null;
|
|
17
|
-
getGroupByName<T = Group>(name: string): T[];
|
|
18
|
-
getAllGroup(): Group[];
|
|
19
|
-
removeGroupById(id: BaseObject3D['sid']): boolean;
|
|
20
29
|
clear(): void;
|
|
21
30
|
getAll<T = BaseObject3D>(): T[];
|
|
22
31
|
hideAll(): void;
|
|
@@ -3,9 +3,9 @@ import DefaultManage from './DefaultManage';
|
|
|
3
3
|
import { GridHelper, AxesHelper, Box3Helper, DirectionalLightHelper, HemisphereLightHelper, SpotLightHelper, PointLightHelper } from 'three';
|
|
4
4
|
import { RectAreaLightHelper } from 'three/examples/jsm/helpers/RectAreaLightHelper.js';
|
|
5
5
|
import { GridHelperOptions, AxesHelperOptions, BoxHelperOptions, PlaneHelperOptions, GroundHelperOptions, DirectionalLightHelperOptions, HemisphereLightHelperOptions, SpotLightHelperOptions, PointLightHelperOptions, RectAreaLightHelperOptions } from '../Interface';
|
|
6
|
-
import { BaseMesh, Ground } from '../Library';
|
|
6
|
+
import { BaseMesh, Ground, SceneManage } from '../Library';
|
|
7
7
|
declare class HelperManage extends DefaultManage {
|
|
8
|
-
constructor(viewport: Viewport);
|
|
8
|
+
constructor(viewport: Viewport, scene: SceneManage);
|
|
9
9
|
addGridHelper(options: GridHelperOptions): GridHelper;
|
|
10
10
|
addAxesHelper(options: AxesHelperOptions): AxesHelper;
|
|
11
11
|
addBoxHelper(options: BoxHelperOptions): Box3Helper;
|
|
@@ -2,8 +2,9 @@ import { AmbientLight, DirectionalLight, HemisphereLight, SpotLight, PointLight,
|
|
|
2
2
|
import DefaultManage from './DefaultManage';
|
|
3
3
|
import Viewport from '../Viewport';
|
|
4
4
|
import { AmbientLightOptions, DirectionalLightOptions, HemisphereLightOptions, SpotLightOptions, PointLightOptions, RectAreaLightOptions } from '../Interface';
|
|
5
|
+
import { SceneManage } from '../Library';
|
|
5
6
|
declare class LightManage extends DefaultManage {
|
|
6
|
-
constructor(viewport: Viewport);
|
|
7
|
+
constructor(viewport: Viewport, scene: SceneManage);
|
|
7
8
|
createAmbientLight(options: AmbientLightOptions): AmbientLight;
|
|
8
9
|
setAmbientLight(options: AmbientLightOptions): boolean;
|
|
9
10
|
createDirectionalLight(options: DirectionalLightOptions): DirectionalLight;
|
|
@@ -1,20 +1,38 @@
|
|
|
1
|
+
import { LoadingManager } from 'three';
|
|
1
2
|
import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader.js';
|
|
2
3
|
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
3
4
|
import * as localforage from 'localforage';
|
|
5
|
+
import { DatLoader } from '../Loader/DatLoader';
|
|
4
6
|
import DefaultManage from './DefaultManage';
|
|
5
|
-
import { BaseObject3D, Group, GroupInfo, Model, ModelInfo } from '../Library';
|
|
7
|
+
import { BaseObject3D, Group, GroupInfo, Model, ModelInfo, SceneManage } from '../Library';
|
|
6
8
|
import { CloneModelInfo } from '../Interface';
|
|
7
9
|
import Viewport from '../Viewport';
|
|
8
10
|
declare class ModelManage extends DefaultManage {
|
|
9
11
|
readonly viewport: Viewport;
|
|
10
12
|
modelMaps: Map<string, Model>;
|
|
11
13
|
store: typeof localforage;
|
|
14
|
+
loadingManager: LoadingManager;
|
|
15
|
+
datLoader: DatLoader;
|
|
16
|
+
gltfLoader: GLTFLoader;
|
|
17
|
+
fbxLoader: FBXLoader;
|
|
12
18
|
dracoDecoderPath: string | null;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
constructor(viewport: Viewport, scene: SceneManage);
|
|
20
|
+
private _initLoadingManager;
|
|
21
|
+
private _setModelMpas;
|
|
22
|
+
private _parseSbmx;
|
|
23
|
+
private _parseDat;
|
|
24
|
+
private _parseGltf;
|
|
25
|
+
private _parseFbx;
|
|
16
26
|
setDracoDecoderPath(path: string): void;
|
|
17
27
|
load(modelInfo: ModelInfo): Promise<Model>;
|
|
28
|
+
_loadItem(modelInfo: ModelInfo, parent?: BaseObject3D | null): Promise<Model>;
|
|
29
|
+
/**
|
|
30
|
+
* model 解析
|
|
31
|
+
* @param format
|
|
32
|
+
* @param buffer
|
|
33
|
+
* @param modelInfo
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
18
36
|
parse(format: string, buffer: ArrayBuffer, modelInfo: ModelInfo): Promise<Model>;
|
|
19
37
|
clone(model: Model, info: CloneModelInfo, parent?: BaseObject3D | null): Promise<Model>;
|
|
20
38
|
loadToGroup(groupInfo: GroupInfo, modelInfo: ModelInfo[]): Promise<Group>;
|
|
@@ -23,13 +41,11 @@ declare class ModelManage extends DefaultManage {
|
|
|
23
41
|
* 清空本地模型缓存数据
|
|
24
42
|
*/
|
|
25
43
|
clearIdb(): Promise<void>;
|
|
26
|
-
_loadItem(modelInfo: ModelInfo, parent?: BaseObject3D | null): Promise<Model>;
|
|
27
44
|
/**
|
|
28
45
|
* 远程请求 model
|
|
29
46
|
* @param modelInfo
|
|
30
47
|
* @returns
|
|
31
48
|
*/
|
|
32
49
|
_fetchBuffer(modelInfo: ModelInfo): Promise<ArrayBuffer>;
|
|
33
|
-
private _copyMaterial;
|
|
34
50
|
}
|
|
35
51
|
export default ModelManage;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { Object3D } from 'three';
|
|
1
2
|
import DefaultManage from './DefaultManage';
|
|
2
|
-
import { PluginObject, PluginObjectInfo } from '../Library';
|
|
3
|
+
import { PluginObject, PluginObjectInfo, SceneManage } from '../Library';
|
|
3
4
|
import Viewport from '../Viewport';
|
|
4
|
-
import { Object3D } from 'three';
|
|
5
5
|
declare class PluginManage extends DefaultManage {
|
|
6
|
-
constructor(viewport: Viewport);
|
|
6
|
+
constructor(viewport: Viewport, scene: SceneManage);
|
|
7
7
|
createObject(info: PluginObjectInfo, object?: Object3D): PluginObject;
|
|
8
8
|
addToObject(id: PluginObjectInfo['id'], object: Object3D): PluginObject | null;
|
|
9
9
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import DefaultManage from './DefaultManage';
|
|
2
2
|
import { SpriteMaterial } from 'three';
|
|
3
|
-
import { Poi, PoiInfo, Group, GroupInfo, BaseObject3D } from '../Library';
|
|
3
|
+
import { Poi, PoiInfo, Group, GroupInfo, BaseObject3D, SceneManage } from '../Library';
|
|
4
4
|
import { ClonePoiInfo } from '../Interface';
|
|
5
5
|
import Viewport from '../Viewport';
|
|
6
6
|
declare class PoiManage extends DefaultManage {
|
|
7
7
|
materials: Map<string, SpriteMaterial>;
|
|
8
|
-
constructor(viewport: Viewport);
|
|
8
|
+
constructor(viewport: Viewport, scene: SceneManage);
|
|
9
9
|
create(info: PoiInfo): Poi;
|
|
10
10
|
clone(poi: Poi, poiInfo: ClonePoiInfo, parent?: BaseObject3D | null): Poi | void;
|
|
11
11
|
createToGroup(groupInfo: GroupInfo, poiInfo: PoiInfo[]): Group;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import DefaultManage from './DefaultManage';
|
|
2
2
|
import Viewport from '../Viewport';
|
|
3
|
-
import { PoiNode, PoiNodeInfo, Group, GroupInfo } from '../Library';
|
|
3
|
+
import { PoiNode, PoiNodeInfo, Group, GroupInfo, SceneManage } from '../Library';
|
|
4
4
|
declare class PoiNodeManage extends DefaultManage {
|
|
5
|
-
constructor(viewport: Viewport);
|
|
5
|
+
constructor(viewport: Viewport, scene: SceneManage);
|
|
6
6
|
create(info: PoiNodeInfo): PoiNode;
|
|
7
7
|
createToGroup(groupInfo: GroupInfo, poiNodeInfo: PoiNodeInfo[]): Group;
|
|
8
8
|
addForGroup(groupId: GroupInfo['id'], poiNodeInfo: PoiNodeInfo[]): Group | null;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as localforage from 'localforage';
|
|
2
2
|
import DefaultManage from './DefaultManage';
|
|
3
3
|
import Viewport from '../Viewport';
|
|
4
|
-
import { BaseObject3D, Group, GroupInfo, Sbm, SbmInfo } from '../Library';
|
|
4
|
+
import { BaseObject3D, Group, GroupInfo, Sbm, SbmInfo, SceneManage } from '../Library';
|
|
5
5
|
import { CloneSbmInfo, ModelLoadingProgressCallback, GroupProgressCallback } from '../Interface';
|
|
6
6
|
import { SbmCache } from '../Interface/sbmCache';
|
|
7
7
|
declare class SbmManage extends DefaultManage {
|
|
8
8
|
readonly viewport: Viewport;
|
|
9
9
|
modelMaps: Map<string, Sbm>;
|
|
10
10
|
store: typeof localforage;
|
|
11
|
-
constructor(viewport: Viewport);
|
|
11
|
+
constructor(viewport: Viewport, scene: SceneManage);
|
|
12
12
|
load(sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<Sbm>;
|
|
13
13
|
parse(data: ArrayBuffer | SbmCache, sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<Sbm>;
|
|
14
14
|
clone(model: Sbm, sbmInfo: CloneSbmInfo, parent?: BaseObject3D | null): Promise<Sbm>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import DefaultManage from './DefaultManage';
|
|
2
|
-
import { Group, GroupInfo, Topology, TopologyInfo } from '../Library';
|
|
2
|
+
import { Group, GroupInfo, SceneManage, Topology, TopologyInfo } from '../Library';
|
|
3
3
|
import { TopologyInfoForGml, ShortestPathInfo, ShortestPathByMultipleStartPoints, ShortestPathByMultipleEndPoints, TopologyNodeInfo } from '../Interface';
|
|
4
4
|
import Viewport from '../Viewport';
|
|
5
5
|
import { Dijkstras } from '../Math/dijkstra';
|
|
6
6
|
declare class TopologyManage extends DefaultManage {
|
|
7
7
|
dijkstra: Dijkstras;
|
|
8
|
-
constructor(viewport: Viewport);
|
|
8
|
+
constructor(viewport: Viewport, scene: SceneManage);
|
|
9
9
|
createFromGml(topologyInfoForGml: TopologyInfoForGml): Promise<Topology>;
|
|
10
10
|
create(topologyInfo: TopologyInfo): Topology;
|
|
11
11
|
resetNodes(topology: Topology, nodes: TopologyNodeInfo[]): Topology;
|
package/types/Manager/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Viewport from '../Viewport';
|
|
2
|
-
import
|
|
2
|
+
import { SceneManage } from '../Library';
|
|
3
3
|
import LightManage from './LightManage';
|
|
4
4
|
import SbmManage from './SbmManage';
|
|
5
5
|
import ModelManage from './ModelManage';
|
|
@@ -9,8 +9,10 @@ import Canvas3DManage from './Canvas3DManage';
|
|
|
9
9
|
import TopologyManage from './TopologyManage';
|
|
10
10
|
import HelperManage from './HelperManage';
|
|
11
11
|
import PluginObjectManage from './PluginObjectManage';
|
|
12
|
+
import GroupManage from './GroupManage';
|
|
12
13
|
interface ManagerStore {
|
|
13
|
-
|
|
14
|
+
groupManager: GroupManage;
|
|
15
|
+
lightManager: LightManage;
|
|
14
16
|
sbmManager: SbmManage;
|
|
15
17
|
modelManager: ModelManage;
|
|
16
18
|
poiManager: PoiManage;
|
|
@@ -19,14 +21,13 @@ interface ManagerStore {
|
|
|
19
21
|
topologyManager: TopologyManage;
|
|
20
22
|
helperManager: HelperManage;
|
|
21
23
|
pluginObjectManager: PluginObjectManage;
|
|
22
|
-
[x: string]: DefaultManage;
|
|
23
24
|
}
|
|
24
25
|
declare class Manager {
|
|
25
26
|
readonly viewport: Viewport;
|
|
26
|
-
|
|
27
|
+
readonly scene: SceneManage;
|
|
27
28
|
readonly store: ManagerStore;
|
|
28
|
-
readonly postUpdate: Map<string, () => void>;
|
|
29
29
|
constructor(viewport: Viewport);
|
|
30
|
+
levelUpdate(): void;
|
|
30
31
|
update(): void;
|
|
31
32
|
clearObject(): void;
|
|
32
33
|
clear(): void;
|
package/types/Shared/index.d.ts
CHANGED
|
@@ -9,15 +9,17 @@ declare const isArray: (arg: any) => arg is any[];
|
|
|
9
9
|
declare const isObject: <T = Record<any, any>>(val: unknown) => val is T;
|
|
10
10
|
declare const isFunction: (val: unknown) => val is () => void;
|
|
11
11
|
declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
|
12
|
-
declare const
|
|
12
|
+
declare const getValueType: (val: any) => string;
|
|
13
13
|
declare const sleep: (time: number) => Promise<void>;
|
|
14
14
|
declare const getAsciiString: (buf: ArrayBufferLike, offset: number, len: number) => string;
|
|
15
15
|
export * from './log';
|
|
16
16
|
export * from './viewport';
|
|
17
17
|
export * from './MinHeap';
|
|
18
18
|
export * from './map';
|
|
19
|
-
export * from './
|
|
19
|
+
export * from './path';
|
|
20
|
+
export * from './cloneDeep';
|
|
21
|
+
export * from './material';
|
|
20
22
|
export { hasOwn, };
|
|
21
23
|
export { isString, isBoolean, isNumber, isNull, isSymbol, };
|
|
22
24
|
export { isDate, isArray, isObject, isFunction, isPromise, };
|
|
23
|
-
export {
|
|
25
|
+
export { getValueType, sleep, getAsciiString, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const parseFilePath: (url: string) => string;
|
|
@@ -13,12 +13,13 @@ export interface PassObj {
|
|
|
13
13
|
unrealBloomPass: UnrealBloomPass;
|
|
14
14
|
sobelPass: ShaderPass;
|
|
15
15
|
gammaCorrectionPass: ShaderPass;
|
|
16
|
+
fxaaPass: ShaderPass;
|
|
16
17
|
}
|
|
17
18
|
declare class RendererManager {
|
|
18
19
|
scene: Scene;
|
|
19
20
|
options: ViewportOptions;
|
|
20
21
|
internalOptions: InternalOptions;
|
|
21
|
-
effectComposer: EffectComposer
|
|
22
|
+
effectComposer: EffectComposer;
|
|
22
23
|
renderer: WebGLRenderer;
|
|
23
24
|
container: HTMLElement;
|
|
24
25
|
interactiveContainer: HTMLElement;
|
|
@@ -26,7 +27,7 @@ declare class RendererManager {
|
|
|
26
27
|
rendererCSS3D: CSS3DRenderer;
|
|
27
28
|
rendererCSS2DHalf: CSS2DHalfRenderer;
|
|
28
29
|
constructor(scene: Scene, options: ViewportOptions);
|
|
29
|
-
|
|
30
|
+
_initEffectComposer(): EffectComposer;
|
|
30
31
|
initAllPass(camera: Camera): PassObj;
|
|
31
32
|
addPass(effectPass: Pass): void;
|
|
32
33
|
isIncludesPass(effectPass: Pass): boolean;
|
|
@@ -46,5 +47,6 @@ declare class RendererManager {
|
|
|
46
47
|
_initUnrealBloomPass(): UnrealBloomPass;
|
|
47
48
|
_initSobelPass(): ShaderPass;
|
|
48
49
|
_initGammaCorrectionPass(): ShaderPass;
|
|
50
|
+
_initFXAAPass(): ShaderPass;
|
|
49
51
|
}
|
|
50
52
|
export default RendererManager;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Scene, PerspectiveCamera, WebGLRenderer, PMREMGenerator, Vector3, AnimationMixer, Intersection, Object3D, AnimationAction, AnimationClip } from 'three';
|
|
1
|
+
import { Clock, Scene, PerspectiveCamera, WebGLRenderer, PMREMGenerator, Vector3, AnimationMixer, Intersection, Object3D, AnimationAction, AnimationClip } from 'three';
|
|
2
2
|
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
|
|
3
3
|
import Stats from 'three/examples/jsm/libs/stats.module.js';
|
|
4
4
|
import { Sky } from 'three/examples/jsm/objects/Sky.js';
|
|
@@ -8,11 +8,14 @@ import RendererManager, { PassObj } from './RendererManager';
|
|
|
8
8
|
import CameraManager from './CameraManager';
|
|
9
9
|
import { FullFreeControls } from '../Controls';
|
|
10
10
|
import { Model } from '../Library';
|
|
11
|
-
import { ColorSpace, SkyOptions, IColor, OffsetPoint, SceneEventType, Position, ViewportOptions, ViewportState, ModelAnimationFindFunc, SignalsState, BloomOptions, SobelOptions } from '../Interface';
|
|
11
|
+
import { ColorSpace, SkyOptions, IColor, OffsetPoint, SceneEventType, Position, ViewportOptions, ViewportState, ModelAnimationFindFunc, SignalsState, BloomOptions, SobelOptions, ToneMappingOptions } from '../Interface';
|
|
12
12
|
import Info from './Info';
|
|
13
13
|
import { ViewHelper } from './ViewHelper';
|
|
14
|
-
export declare const innerRenderState:
|
|
14
|
+
export declare const innerRenderState: {
|
|
15
|
+
needsUpdate: boolean;
|
|
16
|
+
};
|
|
15
17
|
declare class Viewport {
|
|
18
|
+
clock: Clock;
|
|
16
19
|
options: ViewportOptions;
|
|
17
20
|
state: ViewportState;
|
|
18
21
|
signals: SignalsState;
|
|
@@ -51,12 +54,13 @@ declare class Viewport {
|
|
|
51
54
|
_initInfo(): void;
|
|
52
55
|
_initStats(): void;
|
|
53
56
|
_initViewHelper(): void;
|
|
54
|
-
setSobel(options?: SobelOptions): void;
|
|
55
57
|
/**
|
|
56
58
|
***************************** renderer ***************************
|
|
57
59
|
*/
|
|
60
|
+
setSobel(options?: SobelOptions): void;
|
|
58
61
|
setBloom(options?: BloomOptions): void;
|
|
59
62
|
setColorSpace(colorSpace: ColorSpace): void;
|
|
63
|
+
setToneMapping(options?: ToneMappingOptions): void;
|
|
60
64
|
/**
|
|
61
65
|
***************************** background ***************************
|
|
62
66
|
*/
|
|
@@ -106,6 +110,5 @@ declare class Viewport {
|
|
|
106
110
|
* @param {MouseEvent | TouchEvent} event 鼠标事件对象 或 触摸事件对象
|
|
107
111
|
*/
|
|
108
112
|
_triggerSceneEventInAllObject(eventType: SceneEventType, event: MouseEvent | TouchEvent): void;
|
|
109
|
-
_getManagerScene(type: string): Object3D | undefined;
|
|
110
113
|
}
|
|
111
114
|
export default Viewport;
|