API Docs for: 1.4.0
Show:

Kiwi.Textures.TextureAtlas Class

Module: Textures
Parent Module: Kiwi

A TextureAtlas is the base class that is created for each image that is loaded through Kiwi. Each TextureAtlas contains a name (the same as the key that the user chose when loading the image in),the HTMLImageElement that it is for and a number of cells.

Constructor

Kiwi.Textures.TextureAtlas

(
  • name
  • type
  • cells
  • image
  • [sequences]
)
Kiwi.TextureAtlas

Parameters:

  • name String

    Name of the texture atlas. This is usually defined by the developer when loading the assets.

  • type Number

    The type of texture atlas that this is. There are currently only three types.

  • cells Any

    The cells that are within this image..

  • image HTMLImageElement/HTMLCanvasElement

    The image that the texture atlas is using.

  • [sequences] Sequence optional

    Any sequences of cells for this texture atlas. Used for animation.

Returns:

Kiwi.TextureAtlas:

Methods

createGLTextureWrapper

(
  • gl
  • textureManager
)
public

Defined in src\textures\TextureAtlas.ts:147

Available since 1.1.0

Creates a GLTextureWrapper to allow the atlas to communicate efficiently with the video card. This is mostly an internal method.

If you are extending TextureAtlas to incorporate multiple textures, you will need to override this method.

Parameters:

enableGL

(
  • gl
  • renderer
  • textureManager
)
public

Defined in src\textures\TextureAtlas.ts:167

Available since 1.1.0

Sends the texture to the video card.

Parameters:

  • gl WebGLRenderingContext
  • renderer Renderer
  • textureManager GLTextureManager

objType

() String public

The type of object that this texture atlas is.

Returns:

String:

"TextureAtlas"

readJSON

(
  • atlasJSON
)
public

Will populate this texture atlas with information based on a JSON file that was passed.

Parameters:

  • atlasJSON Any

refreshTextureGL

(
  • glContext
)
public

Defined in src\textures\TextureAtlas.ts:186

Available since 1.0.1

Will reload the texture into video memory for WebGL rendering.

Parameters:

  • glContext WebGLRenderingContext

Properties

_type

Number private

The type of texture atlas that this is. This only ever is given a value when the object is instantated.

cellIndex

Number public

The cell that is to be render at the start.

Default: 0

cells

Array public

The cells for this image.

dirty

Boolean public

Indicates that the image data has changed, and needs to be reuplaoded to the gpu in webGL mode.

image

HTMLImageElement/HTMLCanvasElement public

The image that this texture atlas is holding. Can be an HTMLImageElement or a HTMLCanvasElement

name

String public

The name of this texture atlas

sequences

Array public

An array of Sequences that are for this texture.

SINGLE_IMAGE

Number public final static

The number that defines a single image type of texture atlas

Default: 0

SPRITE_SHEET

Number public final static

The number that defines a spritesheet type of texture atlas

Default: 1

TEXTURE_ATLAS

Number public final static

The number that defines a normal texture atlas

Default: 2