Class TextureLoader

Class for loading a texture. Unlike other loaders, this one emits events instead of using predefined callbacks. So if you're interested in getting notified when things happen, you need to add listeners to the object.

Hierarchy

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(manager?: LoadingManager): TextureLoader

Parameters

Returns

TextureLoader

Properties

public crossOrigin: string

Methods

public addEventListener(type: string, listener: (event: any) => void)

Adds a listener to an event type.

Parameters

  • type: string

    The type of the listener that gets removed.

  • listener: (event: any) => void

    The listener function that gets removed.

public dispatchEvent(event: { type: string; target: any; })

Fire an event type.

Parameters

  • event: { type: string; target: any; }

public hasEventListener(type: string, listener: (event: any) => void)

Adds a listener to an event type.

Parameters

  • type: string

    The type of the listener that gets removed.

  • listener: (event: any) => void

    The listener function that gets removed.

public load(url: string, onLoad: (texture: THREE.Texture) => void)

Begin loading from url

Parameters

  • url: string
  • onLoad: (texture: THREE.Texture) => void

public removeEventListener(type: string, listener: (event: any) => void)

Removes a listener from an event type.

Parameters

  • type: string

    The type of the listener that gets removed.

  • listener: (event: any) => void

    The listener function that gets removed.

public setCrossOrigin(crossOrigin: string)

Parameters

  • crossOrigin: string