Skip to content

KBE3D / KBCore / Cesium / FrameRateMonitor

类: FrameRateMonitor

Monitors the frame rate (frames per second) in a Scene and raises an event if the frame rate is lower than a threshold. Later, if the frame rate returns to the required level, a separate event is raised. To avoid creating multiple FrameRateMonitors for a single Scene, use FrameRateMonitor.fromScene instead of constructing an instance explicitly.

参数

Object with the following properties:

参数

The Scene instance for which to monitor performance.

参数

The length of the sliding window over which to compute the average frame rate, in seconds.

参数

The length of time to wait at startup and each time the page becomes visible (i.e. when the user switches back to the tab) before starting to measure performance, in seconds.

参数

The length of the warmup period, in seconds. During the warmup period, a separate (usually lower) frame rate is required.

参数

The minimum frames-per-second that are required for acceptable performance during the warmup period. If the frame rate averages less than this during any samplingWindow during the warmupPeriod, the lowFrameRate event will be raised and the page will redirect to the redirectOnLowFrameRateUrl, if any.

参数

The minimum frames-per-second that are required for acceptable performance after the end of the warmup period. If the frame rate averages less than this during any samplingWindow after the warmupPeriod, the lowFrameRate event will be raised and the page will redirect to the redirectOnLowFrameRateUrl, if any.

属性

defaultSettings

static defaultSettings: any

The default frame rate monitoring settings. These settings are used when FrameRateMonitor.fromScene needs to create a new frame rate monitor, and for any settings that are not passed to the FrameRateMonitor constructor.


samplingWindow

samplingWindow: number

Gets or sets the length of the sliding window over which to compute the average frame rate, in seconds.


quietPeriod

quietPeriod: number

Gets or sets the length of time to wait at startup and each time the page becomes visible (i.e. when the user switches back to the tab) before starting to measure performance, in seconds.


warmupPeriod

warmupPeriod: number

Gets or sets the length of the warmup period, in seconds. During the warmup period, a separate (usually lower) frame rate is required.


minimumFrameRateDuringWarmup

minimumFrameRateDuringWarmup: number

Gets or sets the minimum frames-per-second that are required for acceptable performance during the warmup period. If the frame rate averages less than this during any <code>samplingWindow</code> during the <code>warmupPeriod</code>, the <code>lowFrameRate</code> event will be raised and the page will redirect to the <code>redirectOnLowFrameRateUrl</code>, if any.


minimumFrameRateAfterWarmup

minimumFrameRateAfterWarmup: number

Gets or sets the minimum frames-per-second that are required for acceptable performance after the end of the warmup period. If the frame rate averages less than this during any <code>samplingWindow</code> after the <code>warmupPeriod</code>, the <code>lowFrameRate</code> event will be raised and the page will redirect to the <code>redirectOnLowFrameRateUrl</code>, if any.


scene

scene: Scene

Gets the Scene instance for which to monitor performance.


lowFrameRate

lowFrameRate: Event

Gets the event that is raised when a low frame rate is detected. The function will be passed the Scene instance as its first parameter and the average number of frames per second over the sampling window as its second parameter.


nominalFrameRate

nominalFrameRate: Event

Gets the event that is raised when the frame rate returns to a normal level after having been low. The function will be passed the Scene instance as its first parameter and the average number of frames per second over the sampling window as its second parameter.


lastFramesPerSecond

lastFramesPerSecond: number

Gets the most recently computed average frames-per-second over the last <code>samplingWindow</code>. This property may be undefined if the frame rate has not been computed.

方法

fromScene()

static fromScene(scene: Scene): FrameRateMonitor

Gets the FrameRateMonitor for a given scene. If the scene does not yet have a FrameRateMonitor, one is created with the FrameRateMonitor.defaultSettings.

参数

scene

Scene

The scene for which to get the FrameRateMonitor.

返回

FrameRateMonitor

The scene's FrameRateMonitor.


pause()

pause(): void

Pauses monitoring of the frame rate. To resume monitoring, FrameRateMonitor#unpause must be called once for each time this function is called.

返回

void


unpause()

unpause(): void

Resumes monitoring of the frame rate. If FrameRateMonitor#pause was called multiple times, this function must be called the same number of times in order to actually resume monitoring.

返回

void


isDestroyed()

isDestroyed(): boolean

Returns true if this object was destroyed; otherwise, false. <br /><br /> If this object was destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception.

返回

boolean

True if this object was destroyed; otherwise, false.


destroy()

destroy(): void

Unsubscribes this instance from all events it is listening to. Once an object is destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception. Therefore, assign the return value (<code>undefined</code>) to the object as done in the example.

返回

void

构造函数

构造函数

new FrameRateMonitor(options?: { scene: Scene; samplingWindow?: number; quietPeriod?: number; warmupPeriod?: number; minimumFrameRateDuringWarmup?: number; minimumFrameRateAfterWarmup?: number; }): FrameRateMonitor

参数

options?
scene

Scene

samplingWindow?

number

quietPeriod?

number

warmupPeriod?

number

minimumFrameRateDuringWarmup?

number

minimumFrameRateAfterWarmup?

number

返回

FrameRateMonitor

KBE3D @3.0.0 Copyright © 2024-present KBE3D