_TextureManager
Extends:
Manages textures in the engine so the RendererManager and Renderables can reference one location for Textures. Essentially a texture library.
Constructor Summary
| Public Constructor | ||
| public |
|
|
Member Summary
| Public Members | ||
| public |
textureIDs: *[] |
|
| public |
textures: {} |
|
Method Summary
| Public Methods | ||
| public |
addDataTexture(texName: string, textureData: Array *, textureInternalFormat: GLint, textureFormat: GLint, frameWidth: number, frameHeight: number, width: number, height: number): * |
|
| public |
addGlyphInfoToTexture(texName: *, glyphInfo: *): boolean |
|
| public |
addTexture(texName: string, textureImageAsset: string, frameWidth: number, frameHeight: number, glyphInfo: JSON Object): Promise Creates a Texture JSON Object and initializes the Texture with WebGL. |
|
| public |
getTexture(texID: number): Texture Object Returns a texture JSON Object containing the texture, texture data, name and id. |
|
| public |
removeTexture(texName: *) |
|
| public |
updateDataTexture(texName: *, textureData: *, x1: *, y1: *, width: *, height: *): * |
|
| Private Methods | ||
| private |
_createTextureFromAsset(asset: string): Promise Private function used for initializing a Texture from a path and binding it with WebGL. |
|
| private |
_createTextureFromData(texData: *, textureInternalFormat: *, textureFormat: *, textureByteType: *, width: *, height: *): * |
|
| private |
|
|
Inherited Summary
| From class Manager | ||
| public |
end() |
|
| public |
pause() |
|
| public |
start() |
|
| public |
unpause() |
|
| public |
update() |
|
Public Constructors
Public Methods
public addDataTexture(texName: string, textureData: Array *, textureInternalFormat: GLint, textureFormat: GLint, frameWidth: number, frameHeight: number, width: number, height: number): * source
Params:
| Name | Type | Attribute | Description |
| texName | string | The name of the texture. |
|
| textureData | Array * | An array object of data, array type depending on the textureInternalFormat. |
|
| textureInternalFormat | GLint | Internal texture format type. |
|
| textureFormat | GLint | Texture format type. |
|
| frameWidth | number | Width of each sub sprite frame. |
|
| frameHeight | number | Height of each sub sprite frame. |
|
| width | number | Width of the texture. |
|
| height | number | Height of the texture. |
Return:
| * |
public addGlyphInfoToTexture(texName: *, glyphInfo: *): boolean source
Params:
| Name | Type | Attribute | Description |
| texName | * | ||
| glyphInfo | * |
public addTexture(texName: string, textureImageAsset: string, frameWidth: number, frameHeight: number, glyphInfo: JSON Object): Promise source
Creates a Texture JSON Object and initializes the Texture with WebGL. The Texture is added to the textures array.
Params:
| Name | Type | Attribute | Description |
| texName | string | Name of the texture. |
|
| textureImageAsset | string | Path to the texture image to load. |
|
| frameWidth | number | Width of sprite in spritesheet. -1 for full. |
|
| frameHeight | number | Height of sprite in spritesheet. -1 for full. |
|
| glyphInfo | JSON Object | Object defining additional info for letters to be used as a mapping for writing text. Fonts should have these for displaying letters. Format the ojject like so: { //height of all letters height: 8, } |
public getTexture(texID: number): Texture Object source
Returns a texture JSON Object containing the texture, texture data, name and id.
Params:
| Name | Type | Attribute | Description |
| texID | number | Name of the texture. |
Return:
| Texture Object | Returns a JSON object with Texture data. |
public removeTexture(texName: *) source
Params:
| Name | Type | Attribute | Description |
| texName | * |
public updateDataTexture(texName: *, textureData: *, x1: *, y1: *, width: *, height: *): * source
Params:
| Name | Type | Attribute | Description |
| texName | * | ||
| textureData | * | ||
| x1 | * | ||
| y1 | * | ||
| width | * | ||
| height | * |
Return:
| * |
Private Methods
private _createTextureFromAsset(asset: string): Promise source
Private function used for initializing a Texture from a path and binding it with WebGL.
Params:
| Name | Type | Attribute | Description |
| asset | string | Path to texture file. |
private _createTextureFromData(texData: *, textureInternalFormat: *, textureFormat: *, textureByteType: *, width: *, height: *): * source
Params:
| Name | Type | Attribute | Description |
| texData | * | ||
| textureInternalFormat | * | ||
| textureFormat | * | ||
| textureByteType | * | ||
| width | * | ||
| height | * |
Return:
| * |
