org.ogre4j
Class MeshManager

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

public class MeshManager
extends NativeObject
implements IMeshManager


Nested Class Summary
protected static class MeshManager.MeshBuildParams
           
protected static class MeshManager.MeshBuildParamsMap
           
protected static class MeshManager.MeshBuildType
           
 
Nested classes/interfaces inherited from interface org.ogre4j.IMeshManager
IMeshManager.IMeshBuildParams, IMeshManager.IMeshBuildParamsMap
 
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
  MeshManager()
           
  MeshManager(InstancePointer p)
          This constructor is public for internal useage only!
protected MeshManager(InstancePointer p, boolean remote)
          Creates a Java wrapper object for an existing C++ object.
  MeshManager(WithoutNativeObject val)
          Allows creation of Java objects without C++ objects.
 
Method Summary
 void _initialise()
          Initialises the manager, only to be called by OGRE internally.
 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 createBezierPatch(IPatchMeshPtr returnValue, java.lang.String name, java.lang.String groupName, VoidPointer controlPointBuffer, IVertexDeclaration declaration, int width, int height, int uMaxSubdivisionLevel, int vMaxSubdivisionLevel, PatchSurface.VisibleSide visibleSide, HardwareBuffer.Usage vbUsage, HardwareBuffer.Usage ibUsage, boolean vbUseShadow, boolean ibUseShadow)
          Creates a Bezier patch based on an array of control vertices.
 void createCurvedIllusionPlane(IMeshPtr returnValue, java.lang.String name, java.lang.String groupName, IPlane plane, float width, float height, float curvature, int xsegments, int ysegments, boolean normals, int numTexCoordSets, float uTile, float vTile, IVector3 upVector, IQuaternion orientation, HardwareBuffer.Usage vertexBufferUsage, HardwareBuffer.Usage indexBufferUsage, boolean vertexShadowBuffer, boolean indexShadowBuffer, int ySegmentsToKeep)
          Creates a plane, which because of it's texture coordinates looks like a curved surface, useful for skies in a skybox.
 void createCurvedPlane(IMeshPtr returnValue, java.lang.String name, java.lang.String groupName, IPlane plane, float width, float height, float bow, int xsegments, int ysegments, boolean normals, int numTexCoordSets, float xTile, float yTile, IVector3 upVector, HardwareBuffer.Usage vertexBufferUsage, HardwareBuffer.Usage indexBufferUsage, boolean vertexShadowBuffer, boolean indexShadowBuffer)
          Creates a genuinely curved plane, by default majoring on the x/y axes facing positive Z.
 void createManual(IMeshPtr returnValue, java.lang.String name, java.lang.String groupName, IManualResourceLoader loader)
          Creates a new specifically for manual definition rather than loading from an object 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 params, HardwareBuffer.Usage vertexBufferUsage, HardwareBuffer.Usage indexBufferUsage, boolean vertexBufferShadowed, boolean indexBufferShadowed)
          Create a new mesh, or retrieve an existing one with the same name if it already exists.
 void createPlane(IMeshPtr returnValue, java.lang.String name, java.lang.String groupName, IPlane plane, float width, float height, int xsegments, int ysegments, boolean normals, int numTexCoordSets, float uTile, float vTile, IVector3 upVector, HardwareBuffer.Usage vertexBufferUsage, HardwareBuffer.Usage indexBufferUsage, boolean vertexShadowBuffer, boolean indexShadowBuffer)
          Creates a basic plane, by default majoring on the x/y axes facing positive Z.
 void delete()
          Deletes the corresponding C++ object.
 void finalize()
           
 float getBoundsPaddingFactor()
          Gets the factor by which the bounding box of an entity is padded.
 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.
 IMeshSerializerListener getListener()
          Gets the listener used to control mesh loading through the serializer.
 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.
 boolean getPrepareAllMeshesForShadowVolumes()
          Retrieves whether all Meshes should prepare themselves for shadow volumes.
 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 IMeshManager getSingleton()
          Override standard retrieval.
static IMeshManager getSingletonPtr()
          Override standard retrieval.
 boolean getVerbose()
          Gets whether this manager and its resources habitually produce log output
 void load(IMeshPtr returnValue, java.lang.String filename, java.lang.String groupName, HardwareBuffer.Usage vertexBufferUsage, HardwareBuffer.Usage indexBufferUsage, boolean vertexBufferShadowed, boolean indexBufferShadowed)
          Loads a mesh from a file, making it immediately available for use.
 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 loadResource(IResource res)
          Called when a resource wishes to prepare.
 void parseScript(IDataStreamPtr stream, java.lang.String groupName)
          Parse the definition of a set of resources from a script file.
 void prepare(IMeshPtr returnValue, java.lang.String filename, java.lang.String groupName, HardwareBuffer.Usage vertexBufferUsage, HardwareBuffer.Usage indexBufferUsage, boolean vertexBufferShadowed, boolean indexBufferShadowed)
          Prepares a mesh for loading from a 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 prepareResource(IResource resource)
          Called when a resource wishes to load.
 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 setBoundsPaddingFactor(float paddingFactor)
          Sets the factor by which the bounding box of an entity is padded
 void setListener(IMeshSerializerListener listener)
          Sets the listener used to control mesh loading through the serializer.
 void setMemoryBudget(int bytes)
          Set a limit on the amount of memory this resource handler may use.
 void setPrepareAllMeshesForShadowVolumes(boolean enable)
          Tells the mesh manager that all future meshes should prepare themselves for shadow volumes on loading.
 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

MeshManager

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


MeshManager

protected MeshManager(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.


MeshManager

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

See Also:
WithoutNativeObject, INativeObject.disconnectFromNativeObject()

MeshManager

public MeshManager()
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

_initialise

public void _initialise()
Initialises the manager, only to be called by OGRE internally.

Specified by:
_initialise in interface IMeshManager

createOrRetrieve

public void createOrRetrieve(IResourceManager.IResourceCreateOrRetrieveResult returnValue,
                             java.lang.String name,
                             java.lang.String group,
                             boolean isManual,
                             IManualResourceLoader loader,
                             INameValuePairList params,
                             HardwareBuffer.Usage vertexBufferUsage,
                             HardwareBuffer.Usage indexBufferUsage,
                             boolean vertexBufferShadowed,
                             boolean indexBufferShadowed)
Create a new mesh, or retrieve an existing one with the same name if it already exists.

Specified by:
createOrRetrieve in interface IMeshManager

prepare

public void prepare(IMeshPtr returnValue,
                    java.lang.String filename,
                    java.lang.String groupName,
                    HardwareBuffer.Usage vertexBufferUsage,
                    HardwareBuffer.Usage indexBufferUsage,
                    boolean vertexBufferShadowed,
                    boolean indexBufferShadowed)
Prepares a mesh for loading from a file. This does the IO in advance of the call to .

Specified by:
prepare in interface IMeshManager

load

public void load(IMeshPtr returnValue,
                 java.lang.String filename,
                 java.lang.String groupName,
                 HardwareBuffer.Usage vertexBufferUsage,
                 HardwareBuffer.Usage indexBufferUsage,
                 boolean vertexBufferShadowed,
                 boolean indexBufferShadowed)
Loads a mesh from a file, making it immediately available for use.

Specified by:
load in interface IMeshManager

createManual

public void createManual(IMeshPtr returnValue,
                         java.lang.String name,
                         java.lang.String groupName,
                         IManualResourceLoader loader)
Creates a new specifically for manual definition rather than loading from an object file.

Specified by:
createManual in interface IMeshManager

createPlane

public void createPlane(IMeshPtr returnValue,
                        java.lang.String name,
                        java.lang.String groupName,
                        IPlane plane,
                        float width,
                        float height,
                        int xsegments,
                        int ysegments,
                        boolean normals,
                        int numTexCoordSets,
                        float uTile,
                        float vTile,
                        IVector3 upVector,
                        HardwareBuffer.Usage vertexBufferUsage,
                        HardwareBuffer.Usage indexBufferUsage,
                        boolean vertexShadowBuffer,
                        boolean indexShadowBuffer)
Creates a basic plane, by default majoring on the x/y axes facing positive Z.

Specified by:
createPlane in interface IMeshManager

createCurvedIllusionPlane

public void createCurvedIllusionPlane(IMeshPtr returnValue,
                                      java.lang.String name,
                                      java.lang.String groupName,
                                      IPlane plane,
                                      float width,
                                      float height,
                                      float curvature,
                                      int xsegments,
                                      int ysegments,
                                      boolean normals,
                                      int numTexCoordSets,
                                      float uTile,
                                      float vTile,
                                      IVector3 upVector,
                                      IQuaternion orientation,
                                      HardwareBuffer.Usage vertexBufferUsage,
                                      HardwareBuffer.Usage indexBufferUsage,
                                      boolean vertexShadowBuffer,
                                      boolean indexShadowBuffer,
                                      int ySegmentsToKeep)
Creates a plane, which because of it's texture coordinates looks like a curved surface, useful for skies in a skybox.

Specified by:
createCurvedIllusionPlane in interface IMeshManager

createCurvedPlane

public void createCurvedPlane(IMeshPtr returnValue,
                              java.lang.String name,
                              java.lang.String groupName,
                              IPlane plane,
                              float width,
                              float height,
                              float bow,
                              int xsegments,
                              int ysegments,
                              boolean normals,
                              int numTexCoordSets,
                              float xTile,
                              float yTile,
                              IVector3 upVector,
                              HardwareBuffer.Usage vertexBufferUsage,
                              HardwareBuffer.Usage indexBufferUsage,
                              boolean vertexShadowBuffer,
                              boolean indexShadowBuffer)
Creates a genuinely curved plane, by default majoring on the x/y axes facing positive Z.

Specified by:
createCurvedPlane in interface IMeshManager

createBezierPatch

public void createBezierPatch(IPatchMeshPtr returnValue,
                              java.lang.String name,
                              java.lang.String groupName,
                              VoidPointer controlPointBuffer,
                              IVertexDeclaration declaration,
                              int width,
                              int height,
                              int uMaxSubdivisionLevel,
                              int vMaxSubdivisionLevel,
                              PatchSurface.VisibleSide visibleSide,
                              HardwareBuffer.Usage vbUsage,
                              HardwareBuffer.Usage ibUsage,
                              boolean vbUseShadow,
                              boolean ibUseShadow)
Creates a Bezier patch based on an array of control vertices.

Specified by:
createBezierPatch in interface IMeshManager

setPrepareAllMeshesForShadowVolumes

public void setPrepareAllMeshesForShadowVolumes(boolean enable)
Tells the mesh manager that all future meshes should prepare themselves for shadow volumes on loading.

Specified by:
setPrepareAllMeshesForShadowVolumes in interface IMeshManager

getPrepareAllMeshesForShadowVolumes

public boolean getPrepareAllMeshesForShadowVolumes()
Retrieves whether all Meshes should prepare themselves for shadow volumes.

Specified by:
getPrepareAllMeshesForShadowVolumes in interface IMeshManager

getBoundsPaddingFactor

public float getBoundsPaddingFactor()
Gets the factor by which the bounding box of an entity is padded. Default is 0.01

Specified by:
getBoundsPaddingFactor in interface IMeshManager

setBoundsPaddingFactor

public void setBoundsPaddingFactor(float paddingFactor)
Sets the factor by which the bounding box of an entity is padded

Specified by:
setBoundsPaddingFactor in interface IMeshManager

setListener

public void setListener(IMeshSerializerListener listener)
Sets the listener used to control mesh loading through the serializer.

Specified by:
setListener in interface IMeshManager

getListener

public IMeshSerializerListener getListener()
Gets the listener used to control mesh loading through the serializer.

Specified by:
getListener in interface IMeshManager

loadResource

public void loadResource(IResource res)
Description copied from interface: IManualResourceLoader
Called when a resource wishes to prepare.

Specified by:
loadResource in interface IManualResourceLoader
Specified by:
loadResource in interface IMeshManager

getSingleton

public static IMeshManager getSingleton()
Override standard retrieval.


getSingletonPtr

public static IMeshManager 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

prepareResource

public void prepareResource(IResource resource)
Called when a resource wishes to load. Note that this could get called in a background thread even in just a semithreaded ogre (OGRE_THREAD_SUPPORT==2). Thus, you must not access the rendersystem from this callback. Do that stuff in loadResource.

Specified by:
prepareResource in interface IManualResourceLoader


Copyright © 2007 netAllied GmbH. All Rights Reserved.