Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SceneOptimizer

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

description

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

Hierarchy

  • SceneOptimizer

Implements

Index

Constructors

constructor

  • 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

onFailureObservableSearch playground for onFailureObservable

onFailureObservable: Observable<SceneOptimizer>

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

onNewOptimizationAppliedObservableSearch playground for onNewOptimizationAppliedObservable

onNewOptimizationAppliedObservable: Observable<SceneOptimization>

Defines an observable called when the optimizer enables an optimization

onSuccessObservableSearch playground for onSuccessObservable

onSuccessObservable: Observable<SceneOptimizer>

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

Accessors

currentFrameRate

  • get currentFrameRate(): number
  • Gets the current frame rate checked by the SceneOptimizer

    Returns number

currentPriorityLevel

  • get currentPriorityLevel(): number
  • Gets the current priority level (0 at start)

    Returns number

isInImprovementMode

  • get isInImprovementMode(): boolean
  • set isInImprovementMode(value: boolean): any
  • Gets or sets a boolean indicating if the optimizer is in improvement mode

    Returns boolean

  • Gets or sets a boolean indicating if the optimizer is in improvement mode

    Parameters

    • value: boolean

    Returns any

optimizations

  • Gets the list of active optimizations

    Returns SceneOptimization[]

targetFrameRate

  • get targetFrameRate(): number
  • set targetFrameRate(value: number): any
  • Gets or sets the current target frame rate (60 by default)

    Returns number

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

    Parameters

    • value: number

    Returns any

trackerDuration

  • get trackerDuration(): number
  • set trackerDuration(value: number): any
  • Gets or sets the current interval between two checks (every 2000ms by default)

    Returns number

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

    Parameters

    • value: number

    Returns any

Methods

disposeSearch playground for dispose

  • dispose(): void
  • Release all resources

    Returns void

resetSearch playground for reset

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

    Returns void

startSearch playground for start

  • 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 optimization while frame rate is above the target frame rate

    Returns void

stopSearch playground for stop

  • stop(): void
  • Stops the current optimizer

    Returns void

Static OptimizeAsyncSearch playground for OptimizeAsync

  • 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: () => void

      defines a callback to call on success

        • (): void
        • Returns void

    • Optional onFailure: () => void

      defines a callback to call on failure

        • (): void
        • Returns void

    Returns SceneOptimizer

    the new SceneOptimizer object

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method