@xviewer.js/core 1.0.0-alpha.45 → 1.0.0-alpha.46
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 +92 -6
- package/dist/main.js.map +1 -1
- package/dist/module.js +92 -7
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/Viewer.d.ts +2 -2
- package/types/components/PerformanceMonitor.d.ts +48 -0
- package/types/components/index.d.ts +1 -0
- package/types/plugins/EnvironmentPlugin.d.ts +4 -1
package/package.json
CHANGED
package/types/Viewer.d.ts
CHANGED
|
@@ -144,8 +144,8 @@ export declare class Viewer extends EventEmitter {
|
|
|
144
144
|
addNode<T, K extends __C<T>>(object: T | K & __C<T>, props?: __P<T, K>): T;
|
|
145
145
|
removeNode(node: Object3D): void;
|
|
146
146
|
activeNode(node: Object3D, active: boolean): Object3D<import("three").Object3DEventMap>;
|
|
147
|
-
createRenderTarget(width: number, height: number, nearest?: boolean, floatType?: boolean | TextureDataType, msaa?: number, mipmap?: boolean): WebGLRenderTarget<Texture>;
|
|
148
|
-
createCubeRenderTarget(size: number, nearest?: boolean, floatType?: boolean | TextureDataType, msaa?: number, mipmap?: boolean): WebGLCubeRenderTarget;
|
|
147
|
+
createRenderTarget(width: number, height: number, nearest?: boolean, floatType?: boolean | TextureDataType, msaa?: number, mipmap?: boolean, depth?: boolean): WebGLRenderTarget<Texture>;
|
|
148
|
+
createCubeRenderTarget(size: number, nearest?: boolean, floatType?: boolean | TextureDataType, msaa?: number, mipmap?: boolean, depth?: boolean): WebGLCubeRenderTarget;
|
|
149
149
|
createDataTexture(data: BufferSource, width: number, height: number, floatType?: boolean, nearest?: boolean): DataTexture;
|
|
150
150
|
/**
|
|
151
151
|
* 传送门,得到一个全新的场景
|
|
@@ -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 {};
|
|
@@ -13,12 +13,14 @@ export declare class EnvironmentPlugin extends Plugin {
|
|
|
13
13
|
private _mergeInfo;
|
|
14
14
|
private _debug;
|
|
15
15
|
private _debugNode;
|
|
16
|
+
private _elapsed;
|
|
16
17
|
get debug(): boolean;
|
|
17
18
|
set debug(v: boolean);
|
|
18
19
|
performance: number;
|
|
19
20
|
envMapIntensity: number;
|
|
20
21
|
reflectExposure: number;
|
|
21
22
|
reflectBlurIntensity: number;
|
|
23
|
+
interval: number;
|
|
22
24
|
constructor({ envMap, scene, near, far, layer, resolution, floatType, position, }?: {
|
|
23
25
|
envMap?: Texture;
|
|
24
26
|
scene?: Scene | Object3D;
|
|
@@ -30,5 +32,6 @@ export declare class EnvironmentPlugin extends Plugin {
|
|
|
30
32
|
floatType?: boolean | TextureDataType;
|
|
31
33
|
position?: Vector3;
|
|
32
34
|
});
|
|
33
|
-
onRender(): void;
|
|
35
|
+
onRender(dt: number): void;
|
|
36
|
+
private _renderFrame;
|
|
34
37
|
}
|