Create a TextureInfo, called automatically by the engine
image HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmapuseWebGL boolean optional, default trueShould use WebGL if available?
wrap boolean|Array<number> optional, default falseShould 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 optionalHard edged or smooth for this texture alone, undefined follows tilesPixelated
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
inverse of the size, cached for rendering
true for REPEAT wrap mode, false for CLAMP_TO_EDGE, or the WebGL modes
across and down
Creates the WebGL texture, updates if already created
Destroys the WebGL texture
Check if the texture is webgl enabled
Make this texture hard edged or smooth on its own, whatever tilesPixelated says for the rest; a change makes it
again from its image with the new filtering, since a smooth one is stored premultiplied with mipmaps, so
pixels put in with updateData are lost unless the image has them too, as after a lost context
pixelated boolean optionalundefined follows tilesPixelated again
Set the wrap mode for this texture
wrap boolean|Array<number> optional, default truetrue for REPEAT, false for CLAMP_TO_EDGE, or the WebGL modes across
and down
Put new pixels into part of the texture without uploading all of it, for a texture that changes as the game
runs, like an atlas decoded every frame where only a few tiles changed; what was batched with the old pixels
is drawn first
- x and y are image pixels from the top left, as a tile's pos is, and the rectangle must be inside the image
- With WebGL only the texture changes, so a lost context brings back the image as it was: keep the image up to
date too, or put the pixels in again from a plugin's glContextRestored
- Without WebGL the image is what is drawn, so it must be a canvas, and the pixels are written into it
- Call it outside the 3D pass, which may still hold draws that read the old pixels
pixels Uint8Array|Uint8ClampedArray|ImageData|HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmapRGBA bytes, width * height * 4 of them, or an image put in at its own size
x number optional, default 0y number optional, default 0width number optionalWidth of a byte array's rectangle, the whole image by default
height number optionalHeight of a byte array's rectangle, the whole image by default