TextureAssetTask

Define a task used by {BABYLON.AssetsManager} to load 2D textures

Hierarchy

Implements

Index

Constructors

constructor

  • new TextureAssetTask(name: string, url: string, noMipmap?: boolean | undefined, invertY?: boolean | undefined, samplingMode?: number): TextureAssetTask
  • Creates a new TextureAssetTask object

    Parameters

    • name: string

      defines the name of the task

    • url: string

      defines the location of the file to load

    • Optional noMipmap: boolean | undefined

      defines if mipmap should not be generated (default is false)

    • Optional invertY: boolean | undefined

      defines if texture must be inverted on Y axis (default is false)

    • Optional samplingMode: number

      defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)

    Returns TextureAssetTask

Properties

errorObject

errorObject: object

Gets the current error object (if task is in error)

Type declaration

  • Optional exception?: any
  • Optional message?: string

Optional invertY

invertY: boolean | undefined

Defines if texture must be inverted on Y axis (default is false)

isCompleted

isCompleted: boolean

Get if the task is completed

name

name: string

Defines the name of the task

Optional noMipmap

noMipmap: boolean | undefined

Defines if mipmap should not be generated (default is false)

onError

onError: function

Callback called when the task is successful

Type declaration

    • Parameters

      Returns void

onSuccess

onSuccess: function

Callback called when the task is successful

Type declaration

samplingMode

samplingMode: number

Defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)

taskState

taskState: AssetTaskState

Gets the current state of the task

texture

texture: Texture

Gets the loaded texture

url

url: string

Defines the location of the file to load

Methods

reset

  • reset(): void
  • Reset will set the task state back to INIT, so the next load call of the assets manager will execute this task again. This can be used with failed tasks that have the reason for failure fixed.

    Returns void

run

  • run(scene: Scene, onSuccess: function, onError: function): void
  • Execute the current task

    Parameters

    • scene: Scene

      defines the scene where you want your assets to be loaded

    • onSuccess: function

      is a callback called when the task is successfully executed

        • (): void
        • Returns void

    • onError: function

      is a callback called if an error occurs

        • (message?: string, exception?: any): void
        • Parameters

          • Optional message: string
          • Optional exception: any

          Returns void

    Returns void

runTask

  • runTask(scene: Scene, onSuccess: function, onError: function): void
  • Execute the current task

    Parameters

    • scene: Scene

      defines the scene where you want your assets to be loaded

    • onSuccess: function

      is a callback called when the task is successfully executed

        • (): void
        • Returns void

    • onError: function

      is a callback called if an error occurs

        • (message?: string, exception?: any): void
        • Parameters

          • Optional message: string
          • Optional exception: any

          Returns void

    Returns void

Generated using TypeDoc