Class Index | File Index

Classes


Class TextureManager


Defined in: TextureManager.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Singleton managing texture image cache.
Method Summary
Method Attributes Method Name and Description
 
Clears loaded texture images cache.
<static>  
TextureManager.getInstance()
Returns an instance of this singleton.
 
Returns the height of the given texture once its rotation angle is applied.
 
Returns the width of the given texture once its rotation angle is applied.
 
isTextureTransparent(textureImage)
Returns true if the texture is shared and its image contains at least one transparent pixel.
 
loadTexture(content, angle, synchronous, textureObserver)
Reads a texture image from content notified to textureObserver.
Class Detail
TextureManager()
Singleton managing texture image cache.
Author: Emmanuel Puybaret.
Method Detail
clear()
Clears loaded texture images cache.

<static> {TextureManager} TextureManager.getInstance()
Returns an instance of this singleton.
Returns:
{TextureManager}

{number} getRotatedTextureHeight(texture)
Returns the height of the given texture once its rotation angle is applied.
Parameters:
texture
Returns:
{number}

{number} getRotatedTextureWidth(texture)
Returns the width of the given texture once its rotation angle is applied.
Parameters:
texture
Returns:
{number}

{boolean} isTextureTransparent(textureImage)
Returns true if the texture is shared and its image contains at least one transparent pixel.
Parameters:
textureImage
Returns:
{boolean}

loadTexture(content, angle, synchronous, textureObserver)
Reads a texture image from content notified to textureObserver. If the texture isn't loaded in cache yet and synchronous is false, a one pixel white image texture will be notified immediately to the given textureObserver, then a second notification will be given in Event Dispatch Thread once the image texture is loaded. If the texture is in cache, it will be notified immediately to the given textureObserver.
Parameters:
{URLContent} content
an object containing an image
{number} angle Optional
the rotation angle applied to the image
{boolean} synchronous Optional
if true, this method will return only once image content is loaded.
{{textureUpdated|textureError|progression}} textureObserver
the observer that will be notified once the texture is available. It may define textureUpdated(textureImage), textureError(error), progression(part, info, percentage) optional methods with textureImage being an instance of Image, error, part, info strings and percentage a number.

© Copyright 2024 Emmanuel PUYBARET / eTeks
Distributed under GNU General Public License
Documentation generated by JsDoc Toolkit 2.4.0 on Thu Apr 04 2024 17:30:27 GMT+0200 (CEST)