Draw. TextureInfo

Tile Info - Stores info about each texture

Constructor

new TextureInfo(image, useWebGLopt, wrapopt)

Create a TextureInfo, called automatically by the engine

Parameters:
NameTypeAttributesDefaultDescription
imageHTMLImageElement | OffscreenCanvas
useWebGLboolean<optional>
true

Should use WebGL if available?

wrapboolean<optional>
false

Should the texture wrap (REPEAT) or clamp (CLAMP_TO_EDGE)?

Members

glTexture

Properties
TypeDescription
WebGLTexture

WebGL texture

image

Properties
TypeDescription
HTMLImageElement | OffscreenCanvas

image source

size

Properties
TypeDescription
Vector2

size of the image

sizeInverse

Properties
TypeDescription
Vector2

inverse of the size, cached for rendering

wrap

Properties
TypeDescription
boolean

true for REPEAT wrap mode, false for CLAMP_TO_EDGE

Methods

createWebGLTexture()

Creates the WebGL texture, updates if already created

destroyWebGLTexture()

Destroys the WebGL texture

hasWebGL() → {boolean}

Check if the texture is webgl enabled

Returns:
Type: 
boolean

setWrap(wrapopt)

Set the wrap mode for this texture

Parameters:
NameTypeAttributesDefaultDescription
wrapboolean<optional>
true

true for REPEAT, false for CLAMP_TO_EDGE