org.ogre4j
Class TextureManager

java.lang.Object
  extended by org.xbig.base.NativeObject
      extended by org.ogre4j.TextureManager
All Implemented Interfaces:
IAllocatedObject<IResourceAllocPolicy>, IResourceAllocatedObject, IResourceManager, IScriptLoader, ISingleton<ITextureManager>, ITextureManager, INativeObject

public class TextureManager
extends NativeObject
implements ITextureManager


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.ogre4j.IResourceManager
IResourceManager.IResourceCreateOrRetrieveResult, IResourceManager.IResourceHandleMap, IResourceManager.IResourceMap, IResourceManager.IResourceMapIterator
 
Field Summary
 
Fields inherited from class org.xbig.base.NativeObject
deleted, object, remote
 
Constructor Summary
  TextureManager(InstancePointer p)
          This constructor is public for internal useage only!
protected TextureManager(InstancePointer p, boolean remote)
          Creates a Java wrapper object for an existing C++ object.
  TextureManager(WithoutNativeObject val)
          Allows creation of Java objects without C++ objects.
 
Method Summary
 void _notifyResourceLoaded(IResource res)
          Notify this manager that a resource which it manages has been loaded.
 void _notifyResourceTouched(IResource res)
          Notify this manager that a resource which it manages has been 'touched', i.e. used.
 void _notifyResourceUnloaded(IResource res)
          Notify this manager that a resource which it manages has been unloaded.
 void create(IResourcePtr returnValue, java.lang.String name, java.lang.String group, boolean isManual, IManualResourceLoader loader, INameValuePairList createParams)
          Creates a new blank resource, but does not immediately load it.
 void createManual(ITexturePtr returnValue, java.lang.String name, java.lang.String group, TextureType texType, long width, long height, int num_mips, PixelFormat format, int usage, IManualResourceLoader loader, boolean hwGammaCorrection, long fsaa)
          Create a manual texture with a depth of 1 (not loaded from a file).
 void createManual(ITexturePtr returnValue, java.lang.String name, java.lang.String group, TextureType texType, long width, long height, long depth, int num_mips, PixelFormat format, int usage, IManualResourceLoader loader, boolean hwGammaCorrection, long fsaa)
          Create a manual texture with specified width, height and depth (not loaded from a file).
 void createOrRetrieve(IResourceManager.IResourceCreateOrRetrieveResult returnValue, java.lang.String name, java.lang.String group, boolean isManual, IManualResourceLoader loader, INameValuePairList createParams)
          Create a new resource, or retrieve an existing one with the same name if it already exists.
 void createOrRetrieve(IResourceManager.IResourceCreateOrRetrieveResult returnValue, java.lang.String name, java.lang.String group, boolean isManual, IManualResourceLoader loader, INameValuePairList createParams, TextureType texType, int numMipmaps, float gamma, boolean isAlpha, PixelFormat desiredFormat, boolean hwGammaCorrection)
          Create a new texture, or retrieve an existing one with the same name if it already exists.
 void delete()
          Deletes the corresponding C++ object.
 void finalize()
           
 void getByHandle(IResourcePtr returnValue, long handle)
          Retrieves a pointer to a resource by handle, or null if the resource does not exist.
 void getByName(IResourcePtr returnValue, java.lang.String name)
          Retrieves a pointer to a resource by name, or null if the resource does not exist.
 int getDefaultNumMipmaps()
          Gets the default number of mipmaps to be used for loaded textures.
 float getLoadingOrder()
          Gets the relative loading order of resources of this type.
 int getMemoryBudget()
          Get the limit on the amount of memory this resource handler may use.
 int getMemoryUsage()
          Gets the current memory usage, in bytes.
 PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage)
          Gets the format which will be natively used for a requested format given the constraints of the current device.
 int getPreferredFloatBitDepth()
          gets preferred bit depth for float pixel format textures.
 int getPreferredIntegerBitDepth()
          gets preferred bit depth for integer pixel format textures.
 void getResourceIterator(IResourceManager.IResourceMapIterator returnValue)
          Returns an iterator over all resources in this manager.
 java.lang.String getResourceType()
          Gets a string identifying the type of resource this manager handles.
 IStringVector getScriptPatterns()
          Gets the file patterns which should be used to find scripts for this .
static ITextureManager getSingleton()
          Override standard retrieval.
static ITextureManager getSingletonPtr()
          Override standard retrieval.
 boolean getVerbose()
          Gets whether this manager and its resources habitually produce log output
 boolean isEquivalentFormatSupported(TextureType ttype, PixelFormat format, int usage)
          Returns whether this render system can support the texture format requested with the given usage options, or another format with no quality reduction.
 boolean isFormatSupported(TextureType ttype, PixelFormat format, int usage)
          Returns whether this render system can natively support the precise texture format requested with the given usage options.
 boolean isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage, boolean preciseFormatOnly)
          Returns whether this render system has hardware filtering supported for the texture format requested with the given usage options.
 void load(IResourcePtr returnValue, java.lang.String name, java.lang.String group, boolean isManual, IManualResourceLoader loader, INameValuePairList loadParams)
          Generic load method, used to create a specific to this without using one of the specialised 'load' methods (containing per-Resource-type parameters).
 void load(ITexturePtr returnValue, java.lang.String name, java.lang.String group, TextureType texType, int numMipmaps, float gamma, boolean isAlpha, PixelFormat desiredFormat, boolean hwGammaCorrection)
          Loads a texture from a file.
 void loadImage(ITexturePtr returnValue, java.lang.String name, java.lang.String group, IImage img, TextureType texType, int iNumMipmaps, float gamma, boolean isAlpha, PixelFormat desiredFormat, boolean hwGammaCorrection)
          Loads a texture from an object.
 void loadRawData(ITexturePtr returnValue, java.lang.String name, java.lang.String group, IDataStreamPtr stream, int uWidth, int uHeight, PixelFormat format, TextureType texType, int iNumMipmaps, float gamma, boolean hwGammaCorrection)
          Loads a texture from a raw data stream.
 void parseScript(IDataStreamPtr stream, java.lang.String groupName)
          Parse the definition of a set of resources from a script file.
 void prepare(IResourcePtr returnValue, java.lang.String name, java.lang.String group, boolean isManual, IManualResourceLoader loader, INameValuePairList loadParams)
          Generic prepare method, used to create a specific to this without using one of the specialised 'prepare' methods (containing per-Resource-type parameters).
 void prepare(ITexturePtr returnValue, java.lang.String name, java.lang.String group, TextureType texType, int numMipmaps, float gamma, boolean isAlpha, PixelFormat desiredFormat, boolean hwGammaCorrection)
          Prepares to loads a texture from a file.
 void reloadAll(boolean reloadableOnly)
          Caused all currently loaded resources to be reloaded.
 void reloadUnreferencedResources(boolean reloadableOnly)
          Caused all currently loaded but not referenced by any other object resources to be reloaded.
 void remove(IResourcePtr r)
          Remove a single resource.
 void remove(long handle)
          Remove a single resource by handle.
 void remove(java.lang.String name)
          Remove a single resource by name.
 void removeAll()
          Removes all resources.
 boolean resourceExists(long handle)
           
 boolean resourceExists(java.lang.String name)
           
 void setDefaultNumMipmaps(int num)
          Sets the default number of mipmaps to be used for loaded textures, for when textures are loaded automatically (e.g. by class) or when 'load' is called with the default parameters by the application.
 void setMemoryBudget(int bytes)
          Set a limit on the amount of memory this resource handler may use.
 void setPreferredBitDepths(int integerBits, int floatBits, boolean reloadTextures)
          Sets preferred bit depth for integer and float pixel format.
 void setPreferredFloatBitDepth(int bits, boolean reloadTextures)
          Sets preferred bit depth for float pixel format textures.
 void setPreferredIntegerBitDepth(int bits, boolean reloadTextures)
          Sets preferred bit depth for integer pixel format textures.
 void setVerbose(boolean v)
          Sets whether this manager and its resources habitually produce log output
 void unload(long handle)
          Unloads a single resource by handle.
 void unload(java.lang.String name)
          Unloads a single resource by name.
 void unloadAll(boolean reloadableOnly)
          Unloads all resources.
 void unloadUnreferencedResources(boolean reloadableOnly)
          Unload all resources which are not referenced by any other object.
 
Methods inherited from class org.xbig.base.NativeObject
disconnectFromNativeObject, equals, getInstancePointer, hashCode, setInstancePointer, setInstancePointer, setInstancePointer, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.xbig.base.INativeObject
disconnectFromNativeObject, getInstancePointer, setInstancePointer, setInstancePointer, setInstancePointer
 

Constructor Detail

TextureManager

public TextureManager(InstancePointer p)
This constructor is public for internal useage only! Do not use it!


TextureManager

protected TextureManager(InstancePointer p,
                         boolean remote)
Creates a Java wrapper object for an existing C++ object. If remote is set to 'true' this object cannot be deleted in Java.


TextureManager

public TextureManager(WithoutNativeObject val)
Allows creation of Java objects without C++ objects.

See Also:
WithoutNativeObject, INativeObject.disconnectFromNativeObject()
Method Detail

delete

public void delete()
Description copied from interface: INativeObject
Deletes the corresponding C++ object.

Subclasses must implement this but if the native instance was created by the underlying library the native call to dispose must not happen!

Specified by:
delete in interface INativeObject
Specified by:
delete in class NativeObject
See Also:
#remote

finalize

public void finalize()
Overrides:
finalize in class NativeObject

createOrRetrieve

public void createOrRetrieve(IResourceManager.IResourceCreateOrRetrieveResult returnValue,
                             java.lang.String name,
                             java.lang.String group,
                             boolean isManual,
                             IManualResourceLoader loader,
                             INameValuePairList createParams,
                             TextureType texType,
                             int numMipmaps,
                             float gamma,
                             boolean isAlpha,
                             PixelFormat desiredFormat,
                             boolean hwGammaCorrection)
Create a new texture, or retrieve an existing one with the same name if it already exists.

Specified by:
createOrRetrieve in interface ITextureManager

prepare

public void prepare(ITexturePtr returnValue,
                    java.lang.String name,
                    java.lang.String group,
                    TextureType texType,
                    int numMipmaps,
                    float gamma,
                    boolean isAlpha,
                    PixelFormat desiredFormat,
                    boolean hwGammaCorrection)
Prepares to loads a texture from a file.

Specified by:
prepare in interface ITextureManager

load

public void load(ITexturePtr returnValue,
                 java.lang.String name,
                 java.lang.String group,
                 TextureType texType,
                 int numMipmaps,
                 float gamma,
                 boolean isAlpha,
                 PixelFormat desiredFormat,
                 boolean hwGammaCorrection)
Loads a texture from a file.

Specified by:
load in interface ITextureManager

loadImage

public void loadImage(ITexturePtr returnValue,
                      java.lang.String name,
                      java.lang.String group,
                      IImage img,
                      TextureType texType,
                      int iNumMipmaps,
                      float gamma,
                      boolean isAlpha,
                      PixelFormat desiredFormat,
                      boolean hwGammaCorrection)
Loads a texture from an object.

Specified by:
loadImage in interface ITextureManager

loadRawData

public void loadRawData(ITexturePtr returnValue,
                        java.lang.String name,
                        java.lang.String group,
                        IDataStreamPtr stream,
                        int uWidth,
                        int uHeight,
                        PixelFormat format,
                        TextureType texType,
                        int iNumMipmaps,
                        float gamma,
                        boolean hwGammaCorrection)
Loads a texture from a raw data stream.

Specified by:
loadRawData in interface ITextureManager

createManual

public void createManual(ITexturePtr returnValue,
                         java.lang.String name,
                         java.lang.String group,
                         TextureType texType,
                         long width,
                         long height,
                         long depth,
                         int num_mips,
                         PixelFormat format,
                         int usage,
                         IManualResourceLoader loader,
                         boolean hwGammaCorrection,
                         long fsaa)
Create a manual texture with specified width, height and depth (not loaded from a file).

Specified by:
createManual in interface ITextureManager

createManual

public void createManual(ITexturePtr returnValue,
                         java.lang.String name,
                         java.lang.String group,
                         TextureType texType,
                         long width,
                         long height,
                         int num_mips,
                         PixelFormat format,
                         int usage,
                         IManualResourceLoader loader,
                         boolean hwGammaCorrection,
                         long fsaa)
Create a manual texture with a depth of 1 (not loaded from a file).

Specified by:
createManual in interface ITextureManager

setPreferredIntegerBitDepth

public void setPreferredIntegerBitDepth(int bits,
                                        boolean reloadTextures)
Sets preferred bit depth for integer pixel format textures.

Specified by:
setPreferredIntegerBitDepth in interface ITextureManager

getPreferredIntegerBitDepth

public int getPreferredIntegerBitDepth()
gets preferred bit depth for integer pixel format textures.

Specified by:
getPreferredIntegerBitDepth in interface ITextureManager

setPreferredFloatBitDepth

public void setPreferredFloatBitDepth(int bits,
                                      boolean reloadTextures)
Sets preferred bit depth for float pixel format textures.

Specified by:
setPreferredFloatBitDepth in interface ITextureManager

getPreferredFloatBitDepth

public int getPreferredFloatBitDepth()
gets preferred bit depth for float pixel format textures.

Specified by:
getPreferredFloatBitDepth in interface ITextureManager

setPreferredBitDepths

public void setPreferredBitDepths(int integerBits,
                                  int floatBits,
                                  boolean reloadTextures)
Sets preferred bit depth for integer and float pixel format.

Specified by:
setPreferredBitDepths in interface ITextureManager

isFormatSupported

public boolean isFormatSupported(TextureType ttype,
                                 PixelFormat format,
                                 int usage)
Returns whether this render system can natively support the precise texture format requested with the given usage options.

Specified by:
isFormatSupported in interface ITextureManager

isEquivalentFormatSupported

public boolean isEquivalentFormatSupported(TextureType ttype,
                                           PixelFormat format,
                                           int usage)
Returns whether this render system can support the texture format requested with the given usage options, or another format with no quality reduction.

Specified by:
isEquivalentFormatSupported in interface ITextureManager

getNativeFormat

public PixelFormat getNativeFormat(TextureType ttype,
                                   PixelFormat format,
                                   int usage)
Gets the format which will be natively used for a requested format given the constraints of the current device.

Specified by:
getNativeFormat in interface ITextureManager

isHardwareFilteringSupported

public boolean isHardwareFilteringSupported(TextureType ttype,
                                            PixelFormat format,
                                            int usage,
                                            boolean preciseFormatOnly)
Returns whether this render system has hardware filtering supported for the texture format requested with the given usage options.

Specified by:
isHardwareFilteringSupported in interface ITextureManager

setDefaultNumMipmaps

public void setDefaultNumMipmaps(int num)
Sets the default number of mipmaps to be used for loaded textures, for when textures are loaded automatically (e.g. by class) or when 'load' is called with the default parameters by the application. If set to MIP_UNLIMITED mipmaps will be generated until the lowest possible level, 1x1x1.

Specified by:
setDefaultNumMipmaps in interface ITextureManager

getDefaultNumMipmaps

public int getDefaultNumMipmaps()
Gets the default number of mipmaps to be used for loaded textures.

Specified by:
getDefaultNumMipmaps in interface ITextureManager

getSingleton

public static ITextureManager getSingleton()
Override standard retrieval.


getSingletonPtr

public static ITextureManager getSingletonPtr()
Override standard retrieval.


create

public void create(IResourcePtr returnValue,
                   java.lang.String name,
                   java.lang.String group,
                   boolean isManual,
                   IManualResourceLoader loader,
                   INameValuePairList createParams)
Creates a new blank resource, but does not immediately load it.

Specified by:
create in interface IResourceManager

createOrRetrieve

public void createOrRetrieve(IResourceManager.IResourceCreateOrRetrieveResult returnValue,
                             java.lang.String name,
                             java.lang.String group,
                             boolean isManual,
                             IManualResourceLoader loader,
                             INameValuePairList createParams)
Create a new resource, or retrieve an existing one with the same name if it already exists.

Specified by:
createOrRetrieve in interface IResourceManager

setMemoryBudget

public void setMemoryBudget(int bytes)
Set a limit on the amount of memory this resource handler may use.

Specified by:
setMemoryBudget in interface IResourceManager

getMemoryBudget

public int getMemoryBudget()
Get the limit on the amount of memory this resource handler may use.

Specified by:
getMemoryBudget in interface IResourceManager

getMemoryUsage

public int getMemoryUsage()
Gets the current memory usage, in bytes.

Specified by:
getMemoryUsage in interface IResourceManager

unload

public void unload(java.lang.String name)
Unloads a single resource by name.

Specified by:
unload in interface IResourceManager

unload

public void unload(long handle)
Unloads a single resource by handle.

Specified by:
unload in interface IResourceManager

unloadAll

public void unloadAll(boolean reloadableOnly)
Unloads all resources.

Specified by:
unloadAll in interface IResourceManager

reloadAll

public void reloadAll(boolean reloadableOnly)
Caused all currently loaded resources to be reloaded.

Specified by:
reloadAll in interface IResourceManager

unloadUnreferencedResources

public void unloadUnreferencedResources(boolean reloadableOnly)
Unload all resources which are not referenced by any other object.

Specified by:
unloadUnreferencedResources in interface IResourceManager

reloadUnreferencedResources

public void reloadUnreferencedResources(boolean reloadableOnly)
Caused all currently loaded but not referenced by any other object resources to be reloaded.

Specified by:
reloadUnreferencedResources in interface IResourceManager

remove

public void remove(IResourcePtr r)
Remove a single resource.

Specified by:
remove in interface IResourceManager

remove

public void remove(java.lang.String name)
Remove a single resource by name.

Specified by:
remove in interface IResourceManager

remove

public void remove(long handle)
Remove a single resource by handle.

Specified by:
remove in interface IResourceManager

removeAll

public void removeAll()
Removes all resources.

Specified by:
removeAll in interface IResourceManager

getByName

public void getByName(IResourcePtr returnValue,
                      java.lang.String name)
Retrieves a pointer to a resource by name, or null if the resource does not exist.

Specified by:
getByName in interface IResourceManager

getByHandle

public void getByHandle(IResourcePtr returnValue,
                        long handle)
Retrieves a pointer to a resource by handle, or null if the resource does not exist.

Specified by:
getByHandle in interface IResourceManager

resourceExists

public boolean resourceExists(java.lang.String name)
Specified by:
resourceExists in interface IResourceManager

resourceExists

public boolean resourceExists(long handle)
Specified by:
resourceExists in interface IResourceManager

_notifyResourceTouched

public void _notifyResourceTouched(IResource res)
Notify this manager that a resource which it manages has been 'touched', i.e. used.

Specified by:
_notifyResourceTouched in interface IResourceManager

_notifyResourceLoaded

public void _notifyResourceLoaded(IResource res)
Notify this manager that a resource which it manages has been loaded.

Specified by:
_notifyResourceLoaded in interface IResourceManager

_notifyResourceUnloaded

public void _notifyResourceUnloaded(IResource res)
Notify this manager that a resource which it manages has been unloaded.

Specified by:
_notifyResourceUnloaded in interface IResourceManager

prepare

public void prepare(IResourcePtr returnValue,
                    java.lang.String name,
                    java.lang.String group,
                    boolean isManual,
                    IManualResourceLoader loader,
                    INameValuePairList loadParams)
Generic prepare method, used to create a specific to this without using one of the specialised 'prepare' methods (containing per-Resource-type parameters).

Specified by:
prepare in interface IResourceManager

load

public void load(IResourcePtr returnValue,
                 java.lang.String name,
                 java.lang.String group,
                 boolean isManual,
                 IManualResourceLoader loader,
                 INameValuePairList loadParams)
Generic load method, used to create a specific to this without using one of the specialised 'load' methods (containing per-Resource-type parameters).

Specified by:
load in interface IResourceManager

getScriptPatterns

public IStringVector getScriptPatterns()
Gets the file patterns which should be used to find scripts for this .

Specified by:
getScriptPatterns in interface IResourceManager
Specified by:
getScriptPatterns in interface IScriptLoader

parseScript

public void parseScript(IDataStreamPtr stream,
                        java.lang.String groupName)
Parse the definition of a set of resources from a script file.

Specified by:
parseScript in interface IResourceManager
Specified by:
parseScript in interface IScriptLoader

getLoadingOrder

public float getLoadingOrder()
Gets the relative loading order of resources of this type.

Specified by:
getLoadingOrder in interface IResourceManager
Specified by:
getLoadingOrder in interface IScriptLoader

getResourceType

public java.lang.String getResourceType()
Gets a string identifying the type of resource this manager handles.

Specified by:
getResourceType in interface IResourceManager

setVerbose

public void setVerbose(boolean v)
Sets whether this manager and its resources habitually produce log output

Specified by:
setVerbose in interface IResourceManager

getVerbose

public boolean getVerbose()
Gets whether this manager and its resources habitually produce log output

Specified by:
getVerbose in interface IResourceManager

getResourceIterator

public void getResourceIterator(IResourceManager.IResourceMapIterator returnValue)
Returns an iterator over all resources in this manager.

Specified by:
getResourceIterator in interface IResourceManager


Copyright © 2007 netAllied GmbH. All Rights Reserved.