|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.threed.jpct.TextureManager
The TextureManager is a singleton for storing and retrieving textures. Each texture managed by this class can be identified by a unique name. A texture managed by this class is an instance of Texture.
Texture
Field Summary | |
static int |
TEXTURE_NOTFOUND
The id of a none-existent texture |
Method Summary | |
void |
addTexture(java.lang.String name)
Adds a texture with the given name to the manager. |
void |
addTexture(java.lang.String name,
Texture tex)
Adds a texture with the given name to the manager. |
boolean |
containsTexture(java.lang.String name)
Checks if a texture has already been added to the texture-manager (or better: if a texture with this name exists within the manager instance). |
void |
flush()
Flushes the textures in the manager. |
Texture |
getDummyTexture()
Returns the current dummy texture. |
static TextureManager |
getInstance()
Returns an instance of the TextureManager. |
long |
getMemoryUsage(boolean localOnly)
Returns the memory usage of all texture in the texture manager and in the GPU's memory. |
java.lang.String |
getNameByID(int id)
Gets the name with which the texture with the given ID has been added to the manager. |
java.lang.String |
getNameByTexture(Texture texture)
Returns the name with which the texture has been added to the manager. |
java.util.Enumeration |
getNames()
Gets all the names of the textures that have been added to the manager. |
java.util.Vector |
getState()
Dumps the current state of the TextureManager to a Vector. |
Texture |
getTexture(java.lang.String name)
Returns the texture being named 'name'. |
Texture |
getTextureByID(int id)
Returns the texture with the ID or null if no such texture can be found. |
int |
getTextureCount()
Returns the number of textures the TextureManager holds. |
int |
getTextureID(java.lang.String name)
Returns the numerical ID of the texture. |
boolean |
isForgiving()
Returns if the TextureManager is in "forgiving" mode or not (default). |
void |
preWarm(FrameBuffer buffer)
Does some work that may otherwise happen during runtime and can cause hick-ups. |
boolean |
preWarm(FrameBuffer buffer,
int count)
Special purpose version of preWarm(), which takes a count value in addition. |
void |
removeAndUnload(java.lang.String name,
FrameBuffer from)
Combines removal and unload of a texture. |
void |
removeTexture(java.lang.String name)
Removes a texture from the manager. |
void |
replaceTexture(int id,
Texture tex)
Replaces a texture with the given id with another one. |
void |
replaceTexture(java.lang.String name,
Texture tex)
Replaces a texture with the given name with another one. |
void |
setDummyTexture(Texture texture)
Sets a texture as dummy texture. |
void |
setForgiving(boolean forgiving)
Sets "forgiving" mode. |
void |
setState(java.util.Vector dump)
Sets the state of the TextureManager. |
void |
unloadTexture(FrameBuffer from,
Texture texture)
Unloads a texture from the contexts of the renderers of the given frame buffer. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int TEXTURE_NOTFOUND
getTextureID(java.lang.String)
,
Constant Field ValuesMethod Detail |
public static TextureManager getInstance()
public java.util.Vector getState()
public void setState(java.util.Vector dump)
dump
- the state dumppublic long getMemoryUsage(boolean localOnly)
localOnly
- if true, the GPU's memory usage won't be taken into account.
public void addTexture(java.lang.String name)
name
- the (unique) name for this texturereplaceTexture(java.lang.String, com.threed.jpct.Texture)
public void addTexture(java.lang.String name, Texture tex)
name
- the (unique) name for this texturetex
- the texturepublic void unloadTexture(FrameBuffer from, Texture texture)
from
- the FrameBuffertexture
- the texture to unloadremoveAndUnload(java.lang.String, com.threed.jpct.FrameBuffer)
public void removeTexture(java.lang.String name)
name
- the name of the texture to be removedunloadTexture(com.threed.jpct.FrameBuffer, com.threed.jpct.Texture)
,
removeAndUnload(java.lang.String, com.threed.jpct.FrameBuffer)
,
replaceTexture(int, com.threed.jpct.Texture)
public void removeAndUnload(java.lang.String name, FrameBuffer from)
name
- the texture's namefrom
- the FrameBufferunloadTexture(com.threed.jpct.FrameBuffer, com.threed.jpct.Texture)
,
removeTexture(java.lang.String)
public void replaceTexture(java.lang.String name, Texture tex)
name
- the (unique) name of the texture to replacetex
- the new texturepublic void replaceTexture(int id, Texture tex)
id
- the id of the texture to replacetex
- the new texturepublic void flush()
public void preWarm(FrameBuffer buffer)
buffer
- the current frame buffer. The desired renderer should be
enabled.public boolean preWarm(FrameBuffer buffer, int count)
buffer
- the current frame buffer. The desired renderer should be
enabled.count
- the maximum number of processing requests
public void setDummyTexture(Texture texture)
texture
- the new dummy texturepublic Texture getDummyTexture()
public boolean containsTexture(java.lang.String name)
name
- the name of the texture
public int getTextureCount()
public int getTextureID(java.lang.String name)
name
- the name of the texture
public Texture getTextureByID(int id)
id
- int the ID
public Texture getTexture(java.lang.String name)
name
- the name of the texture that should be retrieved
public java.util.Enumeration getNames()
public java.lang.String getNameByID(int id)
id
- the texture's ID
public java.lang.String getNameByTexture(Texture texture)
texture
-
public boolean isForgiving()
public void setForgiving(boolean forgiving)
forgiving
- the mode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |