Class: TextureMatrix


Class controls uv mapping from Texture normal space to BaseTexture normal space.

Takes trim and rotate into account. May contain clamp settings for Meshes and TilingSprite.

Can be used in Texture uvMatrix field, or separately, you can use different clamp settings on the same texture. If you want to add support for texture region of certain feature or filter, that's what you're looking for.

Takes track of Texture changes through _lastTextureID private field. Use update() method call to track it from outside.

new PIXI.TextureMatrix (texture, clampMargin)

Name Type Description
texture PIXI.Texture

observed texture

clampMargin number optional

Changes frame clamping, 0.5 by default. Use -0.5 for extra border.



_textureID number protected

Tracks Texture frame changes

_updateID number protected

Tracks Texture frame changes

clampMargin number

Changes frame clamping Works with TilingSprite and Mesh Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas

Default Value:
  • 0.5

clampOffset number

Changes frame clamping Works with TilingSprite and Mesh Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders

Default Value:
  • 0

isSimple boolean readonly

If texture size is the same as baseTexture

Default Value:
  • false

mapCoord PIXI.Matrix readonly

Matrix operation that converts texture region coords to texture coords

texture PIXI.Texture

texture property

uClampFrame Float32Array readonly

Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw. Calculated based on clampOffset.

uClampOffset Float32Array readonly

Normalized clamp offset. Calculated based on clampOffset.


multiplyUvs (uvs, out)Float32Array

Multiplies uvs array to transform

Name Type Default Description
uvs Float32Array

mesh uvs

out Float32Array uvs optional


Type Description
Float32Array output

update (forceUpdate)boolean

updates matrices if texture was changed

Name Type Default Description
forceUpdate boolean false optional

if true, matrices will be updated any case

Type Description
boolean whether or not it was updated