public class TextureManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
TextureManager.TextureObserver
An observer that receives texture loading notifications.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Shutdowns the multithreaded service that load textures.
|
static TextureManager |
getInstance()
Returns an instance of this singleton.
|
float |
getRotatedTextureHeight(HomeTexture texture)
Returns the height of the given texture once its rotation angle is applied.
|
float |
getRotatedTextureWidth(HomeTexture texture)
Returns the width of the given texture once its rotation angle is applied.
|
boolean |
isTextureTransparent(javax.media.j3d.Texture texture)
Returns
true if the texture is shared and its image contains
at least one transparent pixel. |
javax.media.j3d.Texture |
loadTexture(Content content)
Returns a texture created from the image from
content . |
void |
loadTexture(Content content,
boolean synchronous,
TextureManager.TextureObserver textureObserver)
Reads a texture image from
content notified to textureObserver . |
void |
loadTexture(Content content,
float angle,
boolean synchronous,
TextureManager.TextureObserver textureObserver)
Reads a texture image from
content notified to textureObserver . |
void |
loadTexture(Content content,
TextureManager.TextureObserver textureObserver)
Reads a texture image from
content notified to textureObserver
If the texture isn't loaded in cache yet, 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. |
javax.media.j3d.Texture |
shareTexture(javax.media.j3d.Texture texture)
Returns either the
texture in parameter or a shared texture
if the same texture as the one in parameter is already shared. |
public static TextureManager getInstance()
public void clear()
public void loadTexture(Content content, TextureManager.TextureObserver textureObserver)
content
notified to textureObserver
If the texture isn't loaded in cache yet, 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
.content
- an object containing an imagetextureObserver
- the observer that will be notified once the texture is availablepublic void loadTexture(Content content, boolean synchronous, TextureManager.TextureObserver textureObserver)
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
.content
- an object containing an imagesynchronous
- if true
, this method will return only once image content is loaded.textureObserver
- the observer that will be notified once the texture is availablejava.lang.IllegalStateException
- if synchronous is false
and the current thread isn't
the Event Dispatch Thread.public void loadTexture(Content content, float angle, boolean synchronous, TextureManager.TextureObserver textureObserver)
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
.content
- an object containing an imageangle
- the rotation angle applied to the imagesynchronous
- if true
, this method will return only once image content is loaded.textureObserver
- the observer that will be notified once the texture is availablejava.lang.IllegalStateException
- if synchronous is false
and the current thread isn't
the Event Dispatch Thread.public javax.media.j3d.Texture loadTexture(Content content)
content
.public javax.media.j3d.Texture shareTexture(javax.media.j3d.Texture texture)
texture
in parameter or a shared texture
if the same texture as the one in parameter is already shared.public boolean isTextureTransparent(javax.media.j3d.Texture texture)
true
if the texture is shared and its image contains
at least one transparent pixel.public float getRotatedTextureWidth(HomeTexture texture)
public float getRotatedTextureHeight(HomeTexture texture)
© Copyright 2024 Space Mushrooms
Distributed under GNU General Public License