new Tiny.RenderTexture(baseRenderTexture, frame)
Name | Type | Description |
---|---|---|
baseRenderTexture |
Tiny.BaseRenderTexture |
The renderer used for this RenderTexture |
frame |
Tiny.Rectangle |
optional
The rectangle frame of the texture to show |
Extends
Members
-
_frameTiny.Rectangle
-
This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering, irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)
-
baseTextureTiny.BaseTexture
-
The base texture that this texture uses.
-
defaultAnchorTiny.Point
-
Anchor point that is used as default if sprite is created with this texture.
Changing thedefaultAnchor
at a later point of time will not update Sprite's anchor point.- Version:
- 1.2.0
- Default Value:
- {0,0}
-
frameTiny.Rectangle
-
The frame specifies the region of the base texture that this texture uses.
Please call_updateUvs()
after you change coordinates offrame
manually. -
heightnumber
-
The height of the Texture in pixels.
-
noFrameboolean
-
Does this Texture have any frame data assigned to it?
-
origTiny.Rectangle
-
This is the area of original texture, before it was put in atlas
-
requiresUpdateboolean
-
This will let a renderer know that a texture has been updated (used mainly for webGL uv updates)
-
rotatenumber
-
Indicates whether the texture is rotated inside the atlas, set to 2 to compensate for texture packer rotation, set to 6 to compensate for spine packer rotation, can be used to rotate or mirror sprites
See Tiny.GroupD8 for explanation -
textureCacheIdsArray.<string>
-
The ids under which this Texture has been added to the texture cache. This is automatically set as long as Texture.addToCache is used, but may not be set if a
Texture is added directly to the TextureCache array. -
transformTiny.TextureTransform
-
Contains data for uvs. May contain clamp settings and some matrices.
Its a bit heavy, so by default that object is not created.- Default Value:
- null
-
trimTiny.Rectangle
-
This is the trimmed area of original texture, before it was put in atlas
Please call_updateUvs()
after you change coordinates oftrim
manually. -
validboolean
-
This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.
-
widthnumber
-
The width of the Texture in pixels.
Methods
-
staticTiny.RenderTexture.create(width, height, scaleMode, resolution) ❯ {Tiny.RenderTexture}
-
A short hand way of creating a render texture.
Name Type Default Description width
number 100 optional The width of the render texture
height
number 100 optional The height of the render texture
scaleMode
number Tiny.settings.SCALE_MODE optional See Tiny.SCALE_MODES for possible values
resolution
number 1 optional The resolution / device pixel ratio of the texture being generated
Returns:
Type Description Tiny.RenderTexture The new render texture -
inherited _updateUvs()
-
Updates the internal WebGL UV cache. Use it after you change
frame
ortrim
of the texture. -
inherited clone() ❯ {Tiny.Texture}
-
Creates a new texture object that acts the same as this one.
Returns:
Type Description Tiny.Texture The new texture -
inherited destroy(destroyBase)
-
Destroys this texture
Name Type Default Description destroyBase
boolean false optional Whether to destroy the base texture as well
-
resize(width, height, doNotResizeBaseTexture)
-
Resizes the RenderTexture.
Name Type Description width
number The width to resize to.
height
number The height to resize to.
doNotResizeBaseTexture
boolean Should the baseTexture.width and height values be resized as well?
-
inherited update()
-
Updates this texture on the gpu.
Events
-
Fired when the texture is updated. This happens if the frame or the baseTexture is updated.