Provides a set of Textures and slots to automatically store multiple TextureData where it fits best.

Constructor

new(textureTypes:Array<{width:Int, slots:Int, height:Int, config:TextureConfig}>)

Creates a new TextureCache instance.

Parameters:

textureTypes

defines the width, height, slots amount and texture-type of what have to be available

Variables

@:value(new Array<Texture>())textures:Array<Texture> = new Array<Texture>()

Array what contains all created textures.

Methods

addData(textureData:TextureData):{unit:Int, slot:Int}

Adds a TextureData instance into the next free texture/slot where it best fits and does not already exist.
Returns the texture unit and slot number or null if it not fits.

removeData(textureData:TextureData):Void

Removes a TextureData instance from the texture cache.