LittleJS 1.28.0

Draw

TextureInfo

Texture Info - Stores info about each texture

Constructor

new TextureInfo(image, useWebGL, wrap, pixelated)engineDraw.js:262

Create a TextureInfo, called automatically by the engine

image HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap
useWebGL boolean optional, default true

Should use WebGL if available?

wrap boolean|Array<number> optional, default false

Should the texture wrap (REPEAT) or clamp (CLAMP_TO_EDGE)? Or the WebGL modes across and down, like [gl.CLAMP_TO_EDGE, gl.MIRRORED_REPEAT], as a glTF sampler gives them

pixelated boolean optional

Hard edged or smooth for this texture alone, undefined follows tilesPixelated

Members

Methods

Members

glTexture : WebGLTexture|undefinedengineDraw.js:282

WebGL texture

image : HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmapengineDraw.js:275

image source

pixelated : boolean|undefinedengineDraw.js:290

Hard edged or smooth for this texture alone, a soft glow in a pixel art game or pixel art in a smooth one; undefined follows tilesPixelated

size of the image

inverse of the size, cached for rendering

wrap : boolean|Array<number>engineDraw.js:286

true for REPEAT wrap mode, false for CLAMP_TO_EDGE, or the WebGL modes across and down

Methods

createWebGLTexture()engineDraw.js:295

Creates the WebGL texture, updates if already created

destroyWebGLTexture()engineDraw.js:307

Destroys the WebGL texture

hasWebGL() → booleanengineDraw.js:311

Check if the texture is webgl enabled

setPixelated(pixelated)engineDraw.js:325

Make this texture hard edged or smooth on its own, whatever tilesPixelated says for the rest; it is made again with the new filtering

pixelated boolean optional

undefined follows tilesPixelated again

setWrap(wrap)engineDraw.js:316

Set the wrap mode for this texture

wrap boolean|Array<number> optional, default true

true for REPEAT, false for CLAMP_TO_EDGE, or the WebGL modes across and down