@xviewer.js/core 1.0.0-alpha.6 → 1.0.0-alpha.61
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/main.js +4213 -12834
- package/dist/main.js.map +1 -1
- package/dist/module.js +4155 -12821
- package/dist/module.js.map +1 -1
- package/package.json +19 -21
- package/types/ObjectInstance.d.ts +2 -2
- package/types/PropertyManager.d.ts +14 -4
- package/types/SystemInfo.d.ts +1 -0
- package/types/Task.d.ts +2 -0
- package/types/TextureSettings.d.ts +3 -1
- package/types/Viewer.d.ts +51 -19
- package/types/asset/ResourceManager.d.ts +12 -26
- package/types/asset/aLoader.d.ts +9 -2
- package/types/base/EventEmitter.d.ts +10 -10
- package/types/base/getClassInstance.d.ts +1 -0
- package/types/base/index.d.ts +1 -0
- package/types/cinestation/CinestationBlendDefinition.d.ts +4 -4
- package/types/cinestation/CinestationBrain.d.ts +0 -2
- package/types/cinestation/FreelookVirtualCamera.d.ts +40 -21
- package/types/cinestation/VirtualCamera.d.ts +8 -8
- package/types/components/Animation.d.ts +26 -0
- package/types/components/PerformanceMonitor.d.ts +48 -0
- package/types/components/Reflector.d.ts +15 -0
- package/types/components/index.d.ts +2 -0
- package/types/index.d.ts +10 -2
- package/types/loaders/aEXRLoader.d.ts +6 -0
- package/types/loaders/aFBXLoader.d.ts +6 -0
- package/types/loaders/aGLTFLoader.d.ts +7 -0
- package/types/loaders/aHDRLoader.d.ts +6 -0
- package/types/loaders/aJSONLoader.d.ts +6 -0
- package/types/loaders/aTextureLoader.d.ts +6 -0
- package/types/{loader → loaders}/index.d.ts +3 -5
- package/types/materials/ReflectorMaterial.d.ts +34 -0
- package/types/{material → materials}/getShaderMaterial.d.ts +2 -2
- package/types/materials/glsl/index.d.ts +3 -0
- package/types/materials/index.d.ts +3 -0
- package/types/math/Constant.d.ts +8 -1
- package/types/math/Interpolation.d.ts +6 -6
- package/types/math/Perlin.d.ts +12 -0
- package/types/math/index.d.ts +5 -0
- package/types/passes/MipBlurPass.d.ts +27 -0
- package/types/passes/cubeuv/MergeBlurPass.d.ts +21 -0
- package/types/passes/cubeuv/MergeInfo.d.ts +9 -0
- package/types/passes/cubeuv/MergeReflectPass.d.ts +18 -0
- package/types/passes/cubeuv/utils.d.ts +16 -0
- package/types/passes/mipGaussianBlendWeight.d.ts +1 -0
- package/types/plugins/BoxProjectionPlugin.d.ts +20 -0
- package/types/plugins/DebugPlugin.d.ts +10 -0
- package/types/plugins/DropFilePlugin.d.ts +18 -0
- package/types/plugins/EnvironmentPlugin.d.ts +40 -0
- package/types/plugins/PerformanceMonitorPlugin.d.ts +48 -0
- package/types/plugins/index.d.ts +5 -0
- package/types/tween/Easing.d.ts +25 -0
- package/types/tween/Group.d.ts +16 -0
- package/types/tween/Interpolation.d.ts +19 -0
- package/types/tween/Now.d.ts +2 -0
- package/types/tween/Sequence.d.ts +7 -0
- package/types/tween/Tween.d.ts +96 -0
- package/types/tween/TweenChain.d.ts +15 -5
- package/types/tween/TweenManager.d.ts +0 -2
- package/types/tween/Version.d.ts +1 -0
- package/types/tween/index.d.ts +3 -1
- package/types/tween/mainGroup.d.ts +2 -0
- package/types/types.d.ts +4 -0
- package/types/loader/aFBXLoader.d.ts +0 -4
- package/types/loader/aGLTFLoader.d.ts +0 -4
- package/types/loader/aHDRLoader.d.ts +0 -4
- package/types/loader/aTextureLoader.d.ts +0 -4
- package/types/material/glsl/copy.glsl.d.ts +0 -1
- /package/types/{material → materials}/glsl/boxfilterblur.glsl.d.ts +0 -0
- /package/types/{material → materials}/glsl/fullscreen.glsl.d.ts +0 -0
- /package/types/{material → materials}/glsl/panorama.glsl.d.ts +0 -0
- /package/types/{primitives → primitive}/Box.d.ts +0 -0
- /package/types/{primitives → primitive}/Plane.d.ts +0 -0
- /package/types/{primitives → primitive}/Sphere.d.ts +0 -0
- /package/types/{primitives → primitive}/index.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"three": ">= 0.164.0 < 0.165.0"
|
|
22
|
-
}
|
|
2
|
+
"name": "@xviewer.js/core",
|
|
3
|
+
"version": "1.0.0-alpha.61",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "dist/main.js",
|
|
8
|
+
"module": "dist/module.js",
|
|
9
|
+
"types": "types/index.d.ts",
|
|
10
|
+
"debug": "src/index.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/**/*",
|
|
13
|
+
"types/**/*"
|
|
14
|
+
],
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"three": ">= 0.164.0"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"b:types": "tsc"
|
|
20
|
+
}
|
|
23
21
|
}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
declare class ClassProperties {
|
|
2
|
+
clsName: string;
|
|
3
|
+
private _properties;
|
|
4
|
+
constructor(clsName: string);
|
|
5
|
+
property(propertyKey: string, options?: Object): this;
|
|
6
|
+
applyProperties(target: object): object;
|
|
7
|
+
}
|
|
1
8
|
export declare class PropertyManager {
|
|
2
|
-
static
|
|
3
|
-
static
|
|
4
|
-
static _hasProperties(
|
|
5
|
-
static
|
|
9
|
+
static _classMap: Map<String, ClassProperties>;
|
|
10
|
+
static _propertyMap: Map<Object, Object>;
|
|
11
|
+
static _hasProperties(constructor: Function): boolean;
|
|
12
|
+
static _getProperties(constructor: Function, autoAdd?: boolean): Object;
|
|
13
|
+
static _getMergedProperties(constructor: Function): any;
|
|
14
|
+
static _getClassProperties(clsName: string, autoAdd?: boolean): ClassProperties;
|
|
15
|
+
static _applyClassProperties(clsName: string, constructor: Function): object;
|
|
6
16
|
}
|
|
7
17
|
export interface IPropertyOptions {
|
|
8
18
|
dir?: string;
|
package/types/SystemInfo.d.ts
CHANGED
package/types/Task.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mapping, PixelFormat, TextureDataType, TextureFilter, Vector2, Wrapping } from "three";
|
|
1
|
+
import { ColorSpace, Mapping, PixelFormat, TextureDataType, TextureFilter, Vector2, Wrapping } from "three";
|
|
2
2
|
export interface TextureSettings {
|
|
3
3
|
flipY?: boolean;
|
|
4
4
|
mapping?: Mapping;
|
|
@@ -10,4 +10,6 @@ export interface TextureSettings {
|
|
|
10
10
|
dataType?: TextureDataType;
|
|
11
11
|
anisotropy?: number;
|
|
12
12
|
repeat?: Vector2;
|
|
13
|
+
colorSpace?: ColorSpace;
|
|
14
|
+
channel?: number;
|
|
13
15
|
}
|
package/types/Viewer.d.ts
CHANGED
|
@@ -1,24 +1,41 @@
|
|
|
1
|
-
import { BufferGeometry, Camera, ColorSpace, DataTexture, DirectionalLightShadow, Euler, Material, Mesh, Object3D, OrthographicCamera, PerspectiveCamera, Scene,
|
|
1
|
+
import { BufferGeometry, Camera, ColorSpace, DataTexture, DirectionalLightShadow, Euler, LoadingManager, Material, Mesh, Object3D, OrthographicCamera, PerspectiveCamera, Scene, ShadowMapType, Texture, TextureDataType, ToneMapping, Vector3, WebGLCubeRenderTarget, WebGLRenderer, WebGLRendererParameters, WebGLRenderTarget } from "three";
|
|
2
2
|
import { EventEmitter } from "./base";
|
|
3
3
|
import { ComponentManager } from "./ComponentManager";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { TaskManager } from "./TaskManager";
|
|
5
|
+
import { DeviceInput } from "./DeviceInput";
|
|
6
|
+
import { Orientation } from "./enums/Orientation";
|
|
7
|
+
import { AssetProperties, LoaderConstructor, ResourceManager } from "./asset/ResourceManager";
|
|
8
|
+
import { __C, __P } from "./types";
|
|
6
9
|
import { Component } from "./Component";
|
|
7
|
-
import { TextureSettings } from "./TextureSettings";
|
|
8
10
|
import { Plugin } from "./Plugin";
|
|
11
|
+
import { Task } from "./Task";
|
|
9
12
|
export declare class Viewer extends EventEmitter {
|
|
10
13
|
static __target: Vector3;
|
|
11
14
|
static __worldPos: Vector3;
|
|
12
|
-
static _getClassInstance(constructor: any, args?: any[]): any;
|
|
13
15
|
static _shadowCameraKeys: string[];
|
|
14
16
|
static _setDirectLightShadow(shadow: DirectionalLightShadow, props: number[]): DirectionalLightShadow;
|
|
15
|
-
static
|
|
16
|
-
static
|
|
17
|
-
static
|
|
18
|
-
static Blit(renderer: WebGLRenderer, renderTarget: WebGLRenderTarget, material:
|
|
19
|
-
static
|
|
17
|
+
static compileMaterial(renderer: WebGLRenderer, scene: Scene, camera: Camera, target: Material | Material[]): void;
|
|
18
|
+
static compileObject3D(renderer: WebGLRenderer, scene: Scene, camera: Camera, target: Object3D): void;
|
|
19
|
+
static compileTexture(renderer: WebGLRenderer, target: Texture | Texture[]): void;
|
|
20
|
+
static Blit(renderer: WebGLRenderer, renderTarget: WebGLRenderTarget, material: Material, lod?: number, face?: number): void;
|
|
21
|
+
static createFullscreenTriangle(): BufferGeometry<import("three").NormalBufferAttributes>;
|
|
22
|
+
static findChild<T extends Object3D>(node: T, path: string): T;
|
|
23
|
+
static getChildByName<T extends Object3D>(node: T, name: string): T;
|
|
24
|
+
static getObject<T extends Object3D>(node: T, filter: (value: T) => any, group?: boolean): any;
|
|
25
|
+
static __emtpyObject: {};
|
|
26
|
+
static _getObjectValue<T extends Object & {
|
|
27
|
+
name: string;
|
|
28
|
+
}>(object: any, name?: string, group?: boolean): T | T[];
|
|
29
|
+
static getMaterial<T extends Material>(node: Object3D): T[];
|
|
30
|
+
static getMaterial<T extends Material>(node: Object3D, name: string): T;
|
|
31
|
+
static getTexture<T extends Texture>(node: Object3D): T[];
|
|
32
|
+
static getTexture<T extends Texture>(node: Object3D, name: string): T;
|
|
33
|
+
static getMesh<T extends Mesh>(node: Object3D): T[];
|
|
34
|
+
static getMesh<T extends Mesh>(node: Object3D, name: string): T;
|
|
20
35
|
static fullscreenMesh: Mesh;
|
|
21
36
|
static fullscreenCamera: OrthographicCamera;
|
|
37
|
+
static _instanceCount: number;
|
|
38
|
+
private _instanceId;
|
|
22
39
|
private _root;
|
|
23
40
|
private _canvas;
|
|
24
41
|
private _gl;
|
|
@@ -33,17 +50,21 @@ export declare class Viewer extends EventEmitter {
|
|
|
33
50
|
private _height;
|
|
34
51
|
private _viewport;
|
|
35
52
|
private _orientation;
|
|
53
|
+
private _defaultProps;
|
|
36
54
|
private _running;
|
|
37
55
|
private _rootRotated;
|
|
38
56
|
private _time;
|
|
39
57
|
private _lastTime;
|
|
58
|
+
private _lastFrameTime;
|
|
40
59
|
private _targetFrameRate;
|
|
60
|
+
private _fixedFrameTime;
|
|
41
61
|
private _autoResize;
|
|
42
62
|
private _taskManager;
|
|
43
63
|
private _resourceManager;
|
|
44
64
|
private _componentManager;
|
|
45
65
|
private _pluginManager;
|
|
46
66
|
private _tweenManager;
|
|
67
|
+
private _loadingManager;
|
|
47
68
|
get root(): HTMLElement;
|
|
48
69
|
get time(): number;
|
|
49
70
|
get scene(): Scene;
|
|
@@ -62,10 +83,18 @@ export declare class Viewer extends EventEmitter {
|
|
|
62
83
|
factor: number;
|
|
63
84
|
};
|
|
64
85
|
get rootRotated(): boolean;
|
|
65
|
-
|
|
86
|
+
get input(): DeviceInput;
|
|
87
|
+
get targetFrameRate(): number;
|
|
88
|
+
set targetFrameRate(v: number);
|
|
89
|
+
get instanceId(): number;
|
|
90
|
+
get loadingManager(): LoadingManager;
|
|
91
|
+
get resourceManager(): ResourceManager;
|
|
92
|
+
get taskManager(): TaskManager;
|
|
93
|
+
constructor({ root, canvas, autoStart, autoResize, shadows, camera, targetFrameRate, fixedFrameTime, colorSpace, toneMapping, toneMappingExposure, maxDPR, path, resourcePath, dracoPath, orientation, loader, tasker, ...webglOpts }?: {
|
|
66
94
|
root?: HTMLElement;
|
|
67
95
|
canvas?: HTMLCanvasElement;
|
|
68
96
|
targetFrameRate?: number;
|
|
97
|
+
fixedFrameTime?: boolean;
|
|
69
98
|
autoStart?: boolean;
|
|
70
99
|
autoResize?: boolean;
|
|
71
100
|
shadows?: boolean | ShadowMapType;
|
|
@@ -76,6 +105,7 @@ export declare class Viewer extends EventEmitter {
|
|
|
76
105
|
path?: string;
|
|
77
106
|
resourcePath?: string;
|
|
78
107
|
dracoPath?: string;
|
|
108
|
+
orientation?: Orientation;
|
|
79
109
|
camera?: {
|
|
80
110
|
fov?: number;
|
|
81
111
|
aspect?: number;
|
|
@@ -96,6 +126,7 @@ export declare class Viewer extends EventEmitter {
|
|
|
96
126
|
};
|
|
97
127
|
} & WebGLRendererParameters);
|
|
98
128
|
destroy(): void;
|
|
129
|
+
private _addDefaultLoaders;
|
|
99
130
|
private _frame;
|
|
100
131
|
loop(dt: number): void;
|
|
101
132
|
update(dt: number): void;
|
|
@@ -105,9 +136,9 @@ export declare class Viewer extends EventEmitter {
|
|
|
105
136
|
start(): this;
|
|
106
137
|
stop(): this;
|
|
107
138
|
resize(width?: number, height?: number): void;
|
|
108
|
-
loadAsset(props: AssetProperties
|
|
109
|
-
|
|
110
|
-
|
|
139
|
+
loadAsset(props: AssetProperties): Promise<any>;
|
|
140
|
+
getLoader(ext: string): import(".").aLoader;
|
|
141
|
+
addLoader(Loader: LoaderConstructor): void;
|
|
111
142
|
timeline(target: Object): import("./tween").TweenChain;
|
|
112
143
|
killTweensOf(target: Object): void;
|
|
113
144
|
traverseMaterials(callback: (mat: Material) => void): void;
|
|
@@ -124,12 +155,12 @@ export declare class Viewer extends EventEmitter {
|
|
|
124
155
|
new (): T;
|
|
125
156
|
}): T;
|
|
126
157
|
removeComponent(node: Object3D, component: Component): ComponentManager;
|
|
127
|
-
|
|
158
|
+
addTask(task: Task): void;
|
|
159
|
+
addNode<T extends Object3D | Component, K extends __C<T>>(object: T | K & __C<T>, props?: __P<T, K>): T;
|
|
128
160
|
removeNode(node: Object3D): void;
|
|
129
|
-
activeNode(node: Object3D, active: boolean):
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
createCubeRenderTarget(size: number, nearest?: boolean, floatType?: boolean | TextureDataType, msaa?: number, mipmap?: boolean): WebGLCubeRenderTarget;
|
|
161
|
+
activeNode(node: Object3D, active: boolean): Object3D<import("three").Object3DEventMap>;
|
|
162
|
+
createRenderTarget(width: number, height: number, nearest?: boolean, floatType?: boolean | TextureDataType, msaa?: number, mipmap?: boolean, depth?: boolean): WebGLRenderTarget<Texture>;
|
|
163
|
+
createCubeRenderTarget(size: number, nearest?: boolean, floatType?: boolean | TextureDataType, msaa?: number, mipmap?: boolean, depth?: boolean): WebGLCubeRenderTarget;
|
|
133
164
|
createDataTexture(data: BufferSource, width: number, height: number, floatType?: boolean, nearest?: boolean): DataTexture;
|
|
134
165
|
/**
|
|
135
166
|
* 传送门,得到一个全新的场景
|
|
@@ -137,6 +168,7 @@ export declare class Viewer extends EventEmitter {
|
|
|
137
168
|
* @returns
|
|
138
169
|
*/
|
|
139
170
|
portal<T = any>(callback: () => T): T;
|
|
171
|
+
blit(renderTarget: WebGLRenderTarget, material: Material, lod?: number, face?: number): void;
|
|
140
172
|
compile(target?: Object3D | Scene | Material | Texture): void;
|
|
141
173
|
compile(target?: Material[]): void;
|
|
142
174
|
}
|
|
@@ -1,42 +1,28 @@
|
|
|
1
1
|
import { LoadingManager } from "three";
|
|
2
2
|
import { TextureSettings } from "../TextureSettings";
|
|
3
3
|
import { aLoader } from "./aLoader";
|
|
4
|
-
export interface AssetProperties {
|
|
4
|
+
export interface AssetProperties extends TextureSettings {
|
|
5
|
+
url?: string;
|
|
5
6
|
ext?: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
buffer?: string | ArrayBuffer;
|
|
8
|
+
path?: string;
|
|
9
|
+
resourcePath?: string;
|
|
10
|
+
dracoPath?: string;
|
|
11
|
+
manager?: LoadingManager;
|
|
10
12
|
onProgress?: (event: ProgressEvent) => void;
|
|
11
13
|
}
|
|
14
|
+
export type LoaderConstructor = new (manager: ResourceManager) => aLoader;
|
|
12
15
|
export declare class ResourceManager {
|
|
13
16
|
static extension(path: string): string;
|
|
14
17
|
static dirname(path: string): string;
|
|
15
18
|
static basename(path: string, ext?: string): string;
|
|
16
|
-
static _loaders: Map<string, aLoader>;
|
|
17
|
-
static _addLoader(extNames: string[], Loader: new () => aLoader): void;
|
|
18
|
-
static _parseURL(uri: any): {
|
|
19
|
-
url: string;
|
|
20
|
-
file: any;
|
|
21
|
-
ext: string;
|
|
22
|
-
};
|
|
23
|
-
static _getTextureKey(url: string, settings: TextureSettings): string;
|
|
24
19
|
static _texSettingKeys: string[];
|
|
25
20
|
static _splitTextureSettings(props: TextureSettings & {
|
|
26
21
|
[k: string]: any;
|
|
27
22
|
}): {};
|
|
28
|
-
|
|
29
|
-
resourcePath: string;
|
|
30
|
-
dracoPath: string;
|
|
31
|
-
loadingManager: LoadingManager;
|
|
32
|
-
private _caches;
|
|
33
|
-
constructor(props: {
|
|
34
|
-
path: string;
|
|
35
|
-
resourcePath: string;
|
|
36
|
-
dracoPath: string;
|
|
37
|
-
loadingManager: LoadingManager;
|
|
38
|
-
});
|
|
23
|
+
private _loaders;
|
|
39
24
|
destroy(): void;
|
|
40
|
-
|
|
25
|
+
getLoader(ext: string): aLoader;
|
|
26
|
+
addLoader(Loader: LoaderConstructor): void;
|
|
27
|
+
loadAsset<T = any>({ url, buffer, ext, path, resourcePath, dracoPath, manager, onProgress, ...props }: AssetProperties): Promise<T>;
|
|
41
28
|
}
|
|
42
|
-
export declare function resourceLoader(extNames: string[]): <T extends aLoader>(Loader: new () => T) => void;
|
package/types/asset/aLoader.d.ts
CHANGED
|
@@ -3,14 +3,21 @@ import { ResourceManager } from "./ResourceManager";
|
|
|
3
3
|
import { TextureSettings } from "../TextureSettings";
|
|
4
4
|
export interface LoadProperties {
|
|
5
5
|
url: string;
|
|
6
|
+
buffer?: string | ArrayBuffer;
|
|
6
7
|
texSettings?: TextureSettings;
|
|
8
|
+
path?: string;
|
|
9
|
+
resourcePath?: string;
|
|
10
|
+
dracoPath?: string;
|
|
11
|
+
manager?: LoadingManager;
|
|
7
12
|
onLoad: (asset: any) => void;
|
|
8
13
|
onProgress?: (event: ProgressEvent) => void;
|
|
9
14
|
onError?: (event: ErrorEvent) => void;
|
|
10
15
|
}
|
|
11
16
|
export declare abstract class aLoader {
|
|
12
|
-
static _setMeshData(node: Object3D): Object3D<import("three").Object3DEventMap>;
|
|
13
17
|
manager: ResourceManager;
|
|
14
|
-
|
|
18
|
+
static _texKeys: string[];
|
|
19
|
+
static _setUserData(node: Object3D): Object3D<import("three").Object3DEventMap>;
|
|
20
|
+
constructor(manager: ResourceManager);
|
|
21
|
+
abstract extension: string[];
|
|
15
22
|
abstract load(props: LoadProperties): void;
|
|
16
23
|
}
|
|
@@ -4,26 +4,26 @@ interface EventHandler {
|
|
|
4
4
|
target?: Object;
|
|
5
5
|
once?: boolean;
|
|
6
6
|
}
|
|
7
|
-
interface Listener {
|
|
8
|
-
name:
|
|
7
|
+
interface Listener<T> {
|
|
8
|
+
name: T;
|
|
9
9
|
callback: (...args: any[]) => any;
|
|
10
10
|
}
|
|
11
|
-
export declare class EventEmitter {
|
|
11
|
+
export declare class EventEmitter<T extends string = string> {
|
|
12
12
|
protected _events: {
|
|
13
13
|
[k: string]: EventHandler[];
|
|
14
14
|
};
|
|
15
15
|
protected _removeEvent(list: EventHandler[], index: number, name: string): this;
|
|
16
16
|
clear(): this;
|
|
17
|
-
has(name:
|
|
18
|
-
on(name:
|
|
19
|
-
off(name:
|
|
20
|
-
onof(name:
|
|
21
|
-
_listeners?: Listener[];
|
|
17
|
+
has(name: T): boolean;
|
|
18
|
+
on(name: T, callback: (...args: any[]) => any, target?: Object, once?: boolean): this;
|
|
19
|
+
off(name: T, callback: (...args: any[]) => any, target?: Object): this;
|
|
20
|
+
onof(name: T, callback: (...args: any[]) => any, container: Object & {
|
|
21
|
+
_listeners?: Listener<T>[];
|
|
22
22
|
}): this;
|
|
23
23
|
offof(container: Object & {
|
|
24
|
-
_listeners?: Listener[];
|
|
24
|
+
_listeners?: Listener<T>[];
|
|
25
25
|
}): this;
|
|
26
26
|
targetOff(target: Object): this;
|
|
27
|
-
emit(name:
|
|
27
|
+
emit(name: T, ...args: any[]): this;
|
|
28
28
|
}
|
|
29
29
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getClassInstance(constructor: any, args?: any[]): any;
|
package/types/base/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const CinestationBlendStyle: {
|
|
2
|
-
Linear: (
|
|
3
|
-
QuadraticIn: (
|
|
4
|
-
QuadraticOut: (
|
|
5
|
-
QuadraticInOut: (
|
|
2
|
+
Linear: import("../tween").EasingFunction;
|
|
3
|
+
QuadraticIn: import("../tween").EasingFunction;
|
|
4
|
+
QuadraticOut: import("../tween").EasingFunction;
|
|
5
|
+
QuadraticInOut: import("../tween").EasingFunction;
|
|
6
6
|
};
|
|
7
7
|
export type CinestationBlendStyle = typeof CinestationBlendStyle[keyof typeof CinestationBlendStyle];
|
|
8
8
|
export declare class CinestationBlendDefinition {
|
|
@@ -7,9 +7,7 @@ export declare class CinestationBrain extends Component<PerspectiveCamera> {
|
|
|
7
7
|
private _vcamSolo;
|
|
8
8
|
private _vcams;
|
|
9
9
|
private _lerpTime;
|
|
10
|
-
private _isChanged;
|
|
11
10
|
brainBlend: CinestationBlendDefinition;
|
|
12
|
-
onChanged: (v: boolean) => void;
|
|
13
11
|
get vcam(): VirtualCamera;
|
|
14
12
|
get vcams(): VirtualCamera[];
|
|
15
13
|
lastUpdate(dt: number): void;
|
|
@@ -1,54 +1,60 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Quaternion, Vector2, Vector3 } from "three";
|
|
2
2
|
import { VirtualCamera } from "./VirtualCamera";
|
|
3
|
-
|
|
4
|
-
FREE = 0,
|
|
5
|
-
TRANSLATE = 1
|
|
6
|
-
}
|
|
3
|
+
import { EasingFunction } from "../tween";
|
|
7
4
|
export declare class FreelookVirtualCamera extends VirtualCamera {
|
|
8
5
|
static __loc0: Vector2;
|
|
9
6
|
static __loc1: Vector2;
|
|
10
7
|
static __center: Vector2;
|
|
11
8
|
static __preCenter: Vector2;
|
|
12
|
-
static
|
|
13
|
-
static
|
|
9
|
+
static __panDelta: Vector2;
|
|
10
|
+
static __panTarget: Vector2;
|
|
11
|
+
static __rotateDelta: Vector2;
|
|
14
12
|
static __posDelta: Vector3;
|
|
15
|
-
static __posOffset: Vector3;
|
|
16
13
|
static __xAxis: Vector3;
|
|
17
14
|
static __yAxis: Vector3;
|
|
18
15
|
static __quat: Quaternion;
|
|
19
|
-
static __spherical: Spherical;
|
|
20
16
|
private _button;
|
|
21
17
|
private _touchID;
|
|
22
|
-
private _distanceDelta;
|
|
23
18
|
private _preLoc0;
|
|
24
19
|
private _preLoc1;
|
|
25
|
-
private
|
|
26
|
-
private
|
|
27
|
-
|
|
20
|
+
private _spherical;
|
|
21
|
+
private _lookAt;
|
|
22
|
+
private _tempSmoothing;
|
|
23
|
+
private _tempRotateSmoothing;
|
|
24
|
+
private _targetTheta;
|
|
25
|
+
private _targetPhi;
|
|
26
|
+
private _targetSpringLength;
|
|
27
|
+
private _targetFov;
|
|
28
|
+
private _targetLookAt;
|
|
28
29
|
forbidX: boolean;
|
|
29
30
|
forbidY: boolean;
|
|
30
31
|
forbidZ: boolean;
|
|
31
32
|
forbidPanX: boolean;
|
|
32
33
|
forbidPanY: boolean;
|
|
33
34
|
forbitPanOffsetY: boolean;
|
|
35
|
+
panSpeed: number;
|
|
34
36
|
rotateSpeed: number;
|
|
37
|
+
smoothing: number;
|
|
35
38
|
rotateSmoothing: number;
|
|
36
|
-
panSpeed: number;
|
|
37
|
-
panSmoothing: number;
|
|
38
|
-
panScale: Vector3;
|
|
39
39
|
phiMin: number;
|
|
40
40
|
phiMax: number;
|
|
41
41
|
thetaMin: number;
|
|
42
42
|
thetaMax: number;
|
|
43
43
|
distanceMin: number;
|
|
44
44
|
distanceMax: number;
|
|
45
|
-
|
|
46
|
-
lookAt:
|
|
45
|
+
get lookAt(): Vector3;
|
|
46
|
+
set lookAt(v: Vector3);
|
|
47
|
+
get springLength(): number;
|
|
48
|
+
set springLength(v: number);
|
|
49
|
+
get theta(): number;
|
|
50
|
+
set theta(v: number);
|
|
51
|
+
get phi(): number;
|
|
52
|
+
set phi(v: number);
|
|
53
|
+
get fov(): number;
|
|
54
|
+
set fov(v: number);
|
|
47
55
|
onEnable(): void;
|
|
48
56
|
onDisable(): void;
|
|
49
57
|
reset(): void;
|
|
50
|
-
private _tweenPOI;
|
|
51
|
-
gotoPOI(position: Vector3, lookAt: Vector3, duration?: number, easing?: (amount: number) => number): void;
|
|
52
58
|
private _onPointerDown;
|
|
53
59
|
private _onPointerUp;
|
|
54
60
|
private _onPointerMove;
|
|
@@ -56,7 +62,20 @@ export declare class FreelookVirtualCamera extends VirtualCamera {
|
|
|
56
62
|
private _onTouchStart;
|
|
57
63
|
private _onTouchMove;
|
|
58
64
|
private _calculateDistanceScale;
|
|
59
|
-
private
|
|
65
|
+
private _calculateRotatelDelta;
|
|
60
66
|
private _calculatePanDelta;
|
|
67
|
+
private _calculateTargetLookAt;
|
|
68
|
+
private _calculateTargetSpringArm;
|
|
69
|
+
gotoPOI({ duration, easing, springLength, theta, phi, lookAt, fov, smoothing, rotateSmoothing }: {
|
|
70
|
+
duration?: number;
|
|
71
|
+
easing?: EasingFunction;
|
|
72
|
+
springLength?: number;
|
|
73
|
+
theta?: number;
|
|
74
|
+
phi?: number;
|
|
75
|
+
lookAt?: Vector3;
|
|
76
|
+
fov?: number;
|
|
77
|
+
smoothing?: number;
|
|
78
|
+
rotateSmoothing?: number;
|
|
79
|
+
}): void;
|
|
61
80
|
update(dt: number): void;
|
|
62
81
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { Object3D, Quaternion, Vector3 } from "three";
|
|
2
2
|
import { Component } from "../Component";
|
|
3
3
|
import { CinestationBrain } from "./CinestationBrain";
|
|
4
|
+
declare class Lens {
|
|
5
|
+
fov: number;
|
|
6
|
+
near: number;
|
|
7
|
+
far: number;
|
|
8
|
+
}
|
|
4
9
|
export declare class VirtualCamera extends Component<Object3D & {
|
|
5
10
|
isCamera?: boolean;
|
|
6
11
|
}> {
|
|
7
12
|
private _finalPosition;
|
|
8
13
|
private _finalRotation;
|
|
14
|
+
locked: boolean;
|
|
9
15
|
priority: number;
|
|
10
|
-
|
|
11
|
-
follow: Object3D | null;
|
|
12
|
-
fov: number;
|
|
13
|
-
near: number;
|
|
14
|
-
far: number;
|
|
16
|
+
lens: Lens;
|
|
15
17
|
correctPosition: Vector3;
|
|
16
18
|
correctRotation: Quaternion;
|
|
17
|
-
lookaheadPosition: Vector3;
|
|
18
|
-
trackedObjectOffset: Vector3;
|
|
19
19
|
brain: CinestationBrain;
|
|
20
20
|
get finalPosition(): Vector3;
|
|
21
21
|
get finalRotation(): Quaternion;
|
|
22
22
|
onLoad(): void;
|
|
23
23
|
onDestroy(): void;
|
|
24
|
-
update(dt: number): void;
|
|
25
24
|
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AnimationAction, AnimationActionLoopStyles, AnimationMixer } from "three";
|
|
2
|
+
import { Component } from "../Component";
|
|
3
|
+
export declare class Animation extends Component {
|
|
4
|
+
private _mixer;
|
|
5
|
+
private _action;
|
|
6
|
+
private _actions;
|
|
7
|
+
private _progress;
|
|
8
|
+
playing: boolean;
|
|
9
|
+
get mixer(): AnimationMixer;
|
|
10
|
+
get action(): AnimationAction;
|
|
11
|
+
get actions(): AnimationAction[];
|
|
12
|
+
get progress(): number;
|
|
13
|
+
set progress(v: number);
|
|
14
|
+
onLoad(): void;
|
|
15
|
+
onDestroy(): void;
|
|
16
|
+
update(dt: number): void;
|
|
17
|
+
play(animName?: string, state?: {
|
|
18
|
+
mode?: AnimationActionLoopStyles;
|
|
19
|
+
repetitions?: number;
|
|
20
|
+
duration?: number;
|
|
21
|
+
clampWhenFinished?: boolean;
|
|
22
|
+
zeroSlopeAtStart?: boolean;
|
|
23
|
+
zeroSlopeAtEnd?: boolean;
|
|
24
|
+
}): this;
|
|
25
|
+
stop(): this;
|
|
26
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Component } from "../Component";
|
|
2
|
+
type PerformanceMonitorProps = {
|
|
3
|
+
/** How much time in milliseconds to collect an average fps, 250 */
|
|
4
|
+
ms?: number;
|
|
5
|
+
/** How many interations of averages to collect, 10 */
|
|
6
|
+
iterations?: number;
|
|
7
|
+
/** The percentage of iterations that are matched against the lower and upper bounds, 0.75 */
|
|
8
|
+
threshold?: number;
|
|
9
|
+
/** A function that receive the max device refreshrate to determine lower and upper bounds which create a margin where neither incline nor decline should happen, (refreshrate) => (refreshrate > 90 ? [50, 90] : [50, 60]) */
|
|
10
|
+
bounds?: (refreshrate: number) => [lower: number, upper: number];
|
|
11
|
+
/** How many times it can inline or decline before onFallback is called, Infinity */
|
|
12
|
+
flipflops?: number;
|
|
13
|
+
/** The factor increases and decreases between 0-1, this prop sets the starting value, 0.5 */
|
|
14
|
+
factor?: number;
|
|
15
|
+
/** The step that gets added or subtracted to or from the factor on each incline/decline, 0.1 */
|
|
16
|
+
step?: number;
|
|
17
|
+
/** When performance is higher than the upper bound (good!) */
|
|
18
|
+
onIncline?: (monitor: PerformanceMonitor) => void;
|
|
19
|
+
/** When performance is lower than the upper bound (bad!) */
|
|
20
|
+
onDecline?: (monitor: PerformanceMonitor) => void;
|
|
21
|
+
/** Incline and decline will change the factor, this will trigger when that happened */
|
|
22
|
+
onChange?: (monitor: PerformanceMonitor) => void;
|
|
23
|
+
/** Called after when the number of flipflops is reached, it indicates instability, use the function to set a fixed baseline */
|
|
24
|
+
onFallback?: (monitor: PerformanceMonitor) => void;
|
|
25
|
+
};
|
|
26
|
+
type PerformanceMonitorSubscriber = {
|
|
27
|
+
onIncline?: (monitor: PerformanceMonitor) => void;
|
|
28
|
+
/** When performance is lower than the upper bound (bad!) */
|
|
29
|
+
onDecline?: (monitor: PerformanceMonitor) => void;
|
|
30
|
+
/** Incline and decline will change the factor, this will trigger when that happened */
|
|
31
|
+
onChange?: (monitor: PerformanceMonitor) => void;
|
|
32
|
+
/** Called after when the number of flipflops is reached, it indicates instability, use the function to set a fixed baseline */
|
|
33
|
+
onFallback?: (monitor: PerformanceMonitor) => void;
|
|
34
|
+
};
|
|
35
|
+
export declare class PerformanceMonitor extends Component {
|
|
36
|
+
fps: number;
|
|
37
|
+
index: number;
|
|
38
|
+
factor: number;
|
|
39
|
+
flipped: number;
|
|
40
|
+
refreshrate: number;
|
|
41
|
+
fallback: boolean;
|
|
42
|
+
frames: any[];
|
|
43
|
+
averages: any[];
|
|
44
|
+
subscriptions: Map<any, any>;
|
|
45
|
+
subscribe(subscriber: PerformanceMonitorSubscriber): void;
|
|
46
|
+
constructor({ iterations, ms, threshold, step, factor: _factor, flipflops, bounds, onIncline, onDecline, onChange, onFallback, }: PerformanceMonitorProps);
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Matrix4, Vector3, WebGLRenderTarget } from "three";
|
|
2
|
+
import { Component } from "../Component";
|
|
3
|
+
export declare class Reflector extends Component {
|
|
4
|
+
constructor({ textureWidth, textureHeight, clipBias, multisample, layer, normal, mipmap, }?: {
|
|
5
|
+
textureWidth?: number;
|
|
6
|
+
textureHeight?: number;
|
|
7
|
+
clipBias?: number;
|
|
8
|
+
multisample?: number;
|
|
9
|
+
normal?: Vector3;
|
|
10
|
+
layer?: number;
|
|
11
|
+
mipmap?: boolean;
|
|
12
|
+
});
|
|
13
|
+
getTextureMatrix: () => Matrix4;
|
|
14
|
+
getRenderTarget: () => WebGLRenderTarget;
|
|
15
|
+
}
|