Class: Texture

Texture() → {Texture}

new Texture() → {Texture}

Base texture object for importing images and turning them into texures unit that can be used by other texture primitives.
Author:
  • Alan Wu
Source:
Returns:
Type
Texture

Methods

getMaterial() → {Boolean}

Return true if the texture is ready for consumption, otherwise false.
Source:
Returns:
Type
Boolean

(async) imageToUint8Array(img, src, canvas) → {IMAGE_UNIT8_RETURN}

Read an image from src and turn it into Uint8Array.
Parameters:
Name Type Description
img Image An image object.
src String Source location of the image.
canvas Canvas Canvas html element used for the conversion.
Source:
Returns:
Type
IMAGE_UNIT8_RETURN

isReady() → {Boolean}

Return true if the texture is ready for consumption.
Source:
Returns:
Type
Boolean

(async) loadImage(img, src) → {Promise}

Read an image from src.
Parameters:
Name Type Description
img Image An image object.
src String Source location of the image.
Source:
Returns:
img on resolve.
Type
Promise