Constructor
new TextureAtlas(widthopt, heightopt)
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
width | number | <optional> | 1024 | Texture atlas width, if it hasn't 1024 default. |
height | number | <optional> | 1024 | Texture atlas height, if it hasn't 1024 default. |
- Source
Methods
(protected) _makeAtlas(fastInsertopt)
Main atlas making function.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
fastInsert | boolean | <optional> | false | If it's true atlas doesn't restore all images again and store image in the current atlas scheme. |
- Source
addImage(image, fastInsertopt) → {TextureAtlasNode|undefined}
Adds image to the atlas and returns created node with texture coordinates of the stored image.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
image | HTMLImageElementExt | Input javascript image object. | ||
fastInsert | boolean | <optional> | false | If it's true atlas doesn't restore all images again and store image in the current atlas scheme. |
- Source
- Type:
- TextureAtlasNode |
undefined
assignHandler(handler)
Sets openglobus gl handler that creates gl texture.
Name | Type | Description |
---|---|---|
handler | Handler | WebGL handler. |
- Source
clearCanvas()
Clear atlas with black.
- Source
createTexture()
Creates atlas gl texture.
- Source
getCanvas() → {HTMLCanvasElement}
Returns canvas object.
- Source
- Type:
- HTMLCanvasElement
getDiagonal(image) → {number}
Returns image diagonal size.
Name | Type | Description |
---|---|---|
image | HTMLImageElementExt | Image object. |
- Source
- Type:
- number
getImage() → {HTMLImageElement}
Returns atlas javascript image object.
- Source
- Type:
- HTMLImageElement
loadImage(src, success)
Asynchronous function that loads and creates image to the image cache, and call success callback when it's done.
Name | Type | Description |
---|---|---|
src | string | Image object src string. |
success | ImagesCacheManagerCallback | The callback that handles the image loads done. |
- Source