Options
All
  • Public
  • Public/Protected
  • All
Menu

Manage the loading of any asset type from images to videos, models, sounds, etc

Hierarchy

  • loader

Index

Constructors

constructor

  • new loader(scene: Scene): loader
  • Creates a new loader

    Parameters

    • scene: Scene

      AssetsManager need to know to what scene the assets will be loaded

    Returns loader

Properties

ambient

ambient: any

assetTypeList

assetTypeList: string[] = ['image', 'particle', 'albedo', 'ambient', 'specular', 'emissive', 'reflection', 'refraction', 'reflectivity', 'bump', 'opacity', 'cubetexture', 'heightmap', 'video', 'model', 'sound', 'upload']

The list of all possible asset type

bump

bump: any

cubetexture

cubetexture: any

emissive

emissive: any

firstload

firstload: boolean = true

Check if this is the first time we use the loader

heightmap

heightmap: any

image

image: any

loadwaiting

loadwaiting: any

List the current assets loading by type

manager

manager: AssetsManager

BabylonJS AssetsManager

model

model: any

onErrorLoad

onErrorLoad: Function

Called when one asset is not successfully loaded

onSuccessLoad

onSuccessLoad: Function

Called when one asset is successfully loaded

opacity

opacity: any

reflection

reflection: any

reflectivity

reflectivity: any

sound

sound: any

specular

specular: any

successes

successes: any

Store the functions waiting for a callback when asset will be loaded

textures

textures: string[] = ['image', 'particle', 'albedo', 'ambient', 'specular', 'emissive', 'reflection', 'reflectivity', 'bump', 'opacity']

The list of all asset which are images

video

video: any

Methods

checkInstanceInModel

  • checkInstanceInModel(meshes: Array<Mesh>): boolean
  • Check if model uses instancedMesh

    Parameters

    • meshes: Array<Mesh>

      List of model meshes

    Returns boolean

createManager

  • createManager(): void

error

  • error(type: string, name: string, error: any): void
  • When an asset didn't load correctly, we send a false result to the waiting callback

    Parameters

    • type: string

      The type of asset not successfully loaded

    • name: string

      Name of the asset

    • error: any

      Object which contains the error

    Returns void

getAlbedo

  • getAlbedo(url: string, callback: Function): void

getAmbient

  • getAmbient(url: string, callback: Function): void

getAsset

  • getAsset(type: "image" | "particle" | "albedo" | "ambient" | "specular" | "emissive" | "reflectivity" | "reflection" | "refraction" | "heightmap" | "cubetexture" | "bump" | "opacity" | "model" | "video" | "sound", url: string, callback: Function): void
  • Get one asset, before loading it will check if the asset doesn't already exist

    Parameters

    • type: "image" | "particle" | "albedo" | "ambient" | "specular" | "emissive" | "reflectivity" | "reflection" | "refraction" | "heightmap" | "cubetexture" | "bump" | "opacity" | "model" | "video" | "sound"

      The type of asset to be loaded

    • url: string

      The path to where the asset must be loaded

    • callback: Function

      Function called once loading is over

    Returns void

getBump

  • getBump(url: string, callback: Function): void

getClonedParentModel

  • getClonedParentModel(modelParents: Array<Mesh>): Mesh[]
  • Clone the main model parent in order to duplicate a model

    Parameters

    • modelParents: Array<Mesh>

      List of model parents

    Returns Mesh[]

getCubeTexture

  • getCubeTexture(url: string, callback: Function): void

getEmissive

  • getEmissive(url: string, callback: Function): void

getHeightMap

  • getHeightMap(url: string, callback: Function): void

getImage

  • getImage(url: string, callback: Function): void

getMeshRootParent

  • getMeshRootParent(mesh: AbstractMesh): AbstractMesh
  • Loop which get the last parent of a Mesh

    Parameters

    • mesh: AbstractMesh

      mesh which parent need to be find

    Returns AbstractMesh

getModel

  • getModel(url: string, callback: Function): void

getModelParents

  • getModelParents(meshes: Array<AbstractMesh>): any[]
  • Look for all the main model parent

    Parameters

    • meshes: Array<AbstractMesh>

      List of model meshes

    Returns any[]

getModelPath

  • getModelPath(url: string): object
  • For the model asset, the url path must be splited

    Parameters

    • url: string

      Url of the model

    Returns object

    • file: string
    • folder: string

getOpacity

  • getOpacity(url: string, callback: Function): void

getParticle

  • getParticle(url: string, callback: Function): void

getReflection

  • getReflection(url: string, callback: Function): void

getReflectivity

  • getReflectivity(url: string, callback: Function): void

getRefraction

  • getRefraction(url: string, callback: Function): void

getSound

  • getSound(url: string, callback: Function): void

getSpecular

  • getSpecular(url: string, callback: Function): void

getVideo

  • getVideo(url: string, callback: Function): void

loadAsset

  • loadAsset(type: "image" | "particle" | "albedo" | "ambient" | "specular" | "emissive" | "reflectivity" | "reflection" | "refraction" | "heightmap" | "cubetexture" | "bump" | "opacity" | "model" | "video" | "sound", url: string, callback: Function): any
  • Load one asset

    Parameters

    • type: "image" | "particle" | "albedo" | "ambient" | "specular" | "emissive" | "reflectivity" | "reflection" | "refraction" | "heightmap" | "cubetexture" | "bump" | "opacity" | "model" | "video" | "sound"

      The type of asset to be loaded

    • url: string

      The path to where the asset must be loaded

    • callback: Function

      Function called once loading is over

    Returns any

modelSucces

  • modelSucces(url: string, name: string, task: any): void
  • For the models we differenciate several model type on success (normal, animated and instanciated)

    Parameters

    • url: string

      The path to where the asset must be loaded

    • name: string

      Name of the asset

    • task: any

      Object which contains the asset data

    Returns void

modelSuccessWithAnimation

  • modelSuccessWithAnimation(url: string, name: string, task: any): void
  • When model have animation we can't clone it and keep animation attach to meshes So we reload it in order to make sure every model as its own animations

    Parameters

    • url: string

      The path to where the asset must be loaded

    • name: string

      Name of the asset

    • task: any

      Object which contains the asset data

    Returns void

modelSuccessWithInstance

  • modelSuccessWithInstance(url: string, name: string, task: any): void
  • When model have instance we can't clone it So we reload it in order to make sure it works

    Parameters

    • url: string

      The path to where the asset must be loaded

    • name: string

      Name of the asset

    • task: any

      Object which contains the asset data

    Returns void

modelSuccessWithoutAnimation

  • modelSuccessWithoutAnimation(url: string, name: string, task: any): void
  • Normal success function for model wihtou instance or animations

    Parameters

    • url: string

      The path to where the asset must be loaded

    • name: string

      Name of the asset

    • task: any

      Object which contains the asset data

    Returns void

resetLoadWaiting

  • resetLoadWaiting(): void

success

  • success(type: string, url: string, name: string, task: any): void
  • When an asset finish loading, we check the asset data ad return the result to the callback

    Parameters

    • type: string

      The type of asset successfully loaded

    • url: string

      The path to where the asset must be loaded

    • name: string

      Name of the asset

    • task: any

      Object which contains the asset data

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc