SceneOptimizer

Class used to run optimizations in order to reach a target frame rate

description

More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer

Hierarchy

  • SceneOptimizer

Implements

Index

Constructors

constructor

Find examples in Playground
  • Creates a new SceneOptimizer

    Parameters

    • scene: Scene

      defines the scene to work on

    • Optional options: SceneOptimizerOptions

      defines the options to use with the SceneOptimizer

    • Optional autoGeneratePriorities: boolean

      defines if priorities must be generated and not read from SceneOptimization property (true by default)

    • Optional improvementMode: boolean

      defines if the scene optimizer must run the maximum optimization while staying over a target frame instead of trying to reach the target framerate (false by default)

    Returns SceneOptimizer

Properties

currentFrameRate

Find examples in Playground
currentFrameRate: number

Gets the current frame rate checked by the SceneOptimizer

currentPriorityLevel

Find examples in Playground
currentPriorityLevel: number

Gets the current priority level (0 at start)

isInImprovementMode

Find examples in Playground
isInImprovementMode: boolean

Gets a boolean indicating if the optimizer is in improvement mode

onFailureObservable

Find examples in Playground
onFailureObservable: Observable<SceneOptimizer>

Defines an observable called when the optimizer is not able to reach the target frame rate

onNewOptimizationAppliedObservable

Find examples in Playground
onNewOptimizationAppliedObservable: Observable<SceneOptimization>

Defines an observable called when the optimizer enables an optimization

onSuccessObservable

Find examples in Playground
onSuccessObservable: Observable<SceneOptimizer>

Defines an observable called when the optimizer reaches the target frame rate

optimizations

Find examples in Playground
optimizations: SceneOptimization[]

Gets the list of active optimizations

targetFrameRate

Find examples in Playground
targetFrameRate: number

Gets or sets the current target frame rate (60 by default)

trackerDuration

Find examples in Playground
trackerDuration: number

Gets or sets the current interval between two checks (every 2000ms by default)

Methods

dispose

Find examples in Playground
  • dispose(): void

reset

Find examples in Playground
  • reset(): void
  • Reset the optimizer to initial step (current priority level = 0)

    Returns void

start

Find examples in Playground
  • start(): void
  • Start the optimizer. By default it will try to reach a specific framerate but if the optimizer is set with improvementMode === true then it will run all optimiatiation while frame rate is above the target frame rate

    Returns void

stop

Find examples in Playground
  • stop(): void
  • Stops the current optimizer

    Returns void

Static OptimizeAsync

Find examples in Playground
  • Helper function to create a SceneOptimizer with one single line of code

    Parameters

    • scene: Scene

      defines the scene to work on

    • Optional options: SceneOptimizerOptions

      defines the options to use with the SceneOptimizer

    • Optional onSuccess: function

      defines a callback to call on success

        • (): void
        • Returns void

    • Optional onFailure: function

      defines a callback to call on failure

        • (): void
        • Returns void

    Returns SceneOptimizer

    the new SceneOptimizer object

Generated using TypeDoc