Kiwi.Textures.TextureAtlas Class
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]
Parameters:
-
name
StringName of the texture atlas. This is usually defined by the developer when loading the assets.
-
type
NumberThe type of texture atlas that this is. There are currently only three types.
-
cells
AnyThe cells that are within this image..
-
image
HTMLImageElement/HTMLCanvasElementThe image that the texture atlas is using.
-
[sequences]
Sequence optionalAny sequences of cells for this texture atlas. Used for animation.
Returns:
Item Index
Properties
- _type
- cellIndex
- cells
- dirty
- image
- name
- sequences
- SINGLE_IMAGE static
- SPRITE_SHEET static
- TEXTURE_ATLAS static
Methods
createGLTextureWrapper
-
gl
-
textureManager
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:
-
gl
WebGLRenderingContextThe rendering context.
-
textureManager
Kiwi.Renderers.GLTextureManagerThe texture manager.
enableGL
-
gl
-
renderer
-
textureManager
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:
"TextureAtlas"
readJSON
-
atlasJSON
Will populate this texture atlas with information based on a JSON file that was passed.
Parameters:
-
atlasJSON
Any
refreshTextureGL
-
glContext
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