org.ogre4j
Class SkeletonInstance

java.lang.Object
  extended by org.xbig.base.NativeObject
      extended by org.ogre4j.SkeletonInstance
All Implemented Interfaces:
IAllocatedObject<IResourceAllocPolicy>, IResource, IResourceAllocatedObject, ISkeleton, ISkeletonInstance, IStringInterface, INativeObject

public class SkeletonInstance
extends NativeObject
implements ISkeletonInstance


Nested Class Summary
protected static class SkeletonInstance.TagPointList
           
 
Nested classes/interfaces inherited from interface org.ogre4j.ISkeletonInstance
ISkeletonInstance.ITagPointList
 
Nested classes/interfaces inherited from interface org.ogre4j.ISkeleton
ISkeleton.IAnimationList, ISkeleton.IBoneHandleMap, ISkeleton.IBoneIterator, ISkeleton.IBoneList, ISkeleton.IBoneListByName, ISkeleton.IBoneSet, ISkeleton.ILinkedSkeletonAnimSourceIterator, ISkeleton.ILinkedSkeletonAnimSourceList
 
Nested classes/interfaces inherited from interface org.ogre4j.IResource
IResource.IListener, IResource.IListenerList
 
Field Summary
 
Fields inherited from class org.xbig.base.NativeObject
deleted, object, remote
 
Constructor Summary
  SkeletonInstance(InstancePointer p)
          This constructor is public for internal useage only!
protected SkeletonInstance(InstancePointer p, boolean remote)
          Creates a Java wrapper object for an existing C++ object.
  SkeletonInstance(ISkeletonPtr masterCopy)
          Constructor, don't call directly, this will be created automatically when you create an based on a skeletally animated .
  SkeletonInstance(WithoutNativeObject val)
          Allows creation of Java objects without C++ objects.
 
Method Summary
 void _buildMapBoneByHandle(ISkeleton source, ISkeleton.IBoneHandleMap boneHandleMap)
          Build the bone handle map to use with .
 void _buildMapBoneByName(ISkeleton source, ISkeleton.IBoneHandleMap boneHandleMap)
          Build the bone handle map to use with .
 void _dirtyState()
          Manually mark the state of this resource as having been changed.
 void _fireBackgroundLoadingComplete()
          Firing of background loading complete event
 void _fireBackgroundPreparingComplete()
          Firing of background preparing complete event
 IAnimation _getAnimationImpl(java.lang.String name, NativeObjectPointer<ILinkedSkeletonAnimationSource> linker)
           
 void _getBoneMatrices(IMatrix4 pMatrices)
          Populates the passed in array with the bone matrices based on the current position.
 void _initAnimationState(IAnimationStateSet animSet)
          Initialise an animation set suitable for use with this skeleton.
 void _mergeSkeletonAnimations(ISkeleton source, ISkeleton.IBoneHandleMap boneHandleMap, IStringVector animations)
          Merge animations from another object into this skeleton.
 void _notifyManualBonesDirty()
           
 void _notifyManualBoneStateChange(IBone bone)
           
 void _notifyOrigin(java.lang.String origin)
           
 void _refreshAnimationState(IAnimationStateSet animSet)
          Refresh an animation set suitable for use with this skeleton.
 void _updateTransforms()
           
 void addLinkedSkeletonAnimationSource(java.lang.String skelName, float scale)
          Allows you to use the animations from another object to animate this skeleton.
 void addListener(IResource.IListener lis)
          Register a listener on this resource.
 void changeGroupOwnership(java.lang.String newGroup)
          Change the resource group ownership of a .
static void cleanupDictionary()
          Cleans up the static 'msDictionary' required to reset , otherwise the containers are left with invalid pointers, which will lead to a crash as soon as one of the implementers (e.g. ) initializes.
 void copyParametersTo(IStringInterface dest)
          Method for copying this object's parameters to another object.
 IAnimation createAnimation(java.lang.String name, float length)
          Creates a new object for animating this skeleton.
 IBone createBone()
          Creates a brand new owned by this .
 IBone createBone(int handle)
          Creates a brand new owned by this .
 IBone createBone(java.lang.String name)
          Creates a brand new owned by this .
 IBone createBone(java.lang.String name, int handle)
          Creates a brand new owned by this .
 ITagPoint createTagPointOnBone(IBone bone, IQuaternion offsetOrientation, IVector3 offsetPosition)
          Creates a ready to be attached to a bone
 void delete()
          Deletes the corresponding C++ object.
 void escalateLoading()
          Escalates the loading of a background loaded resource.
 void finalize()
           
 void freeTagPoint(ITagPoint tagPoint)
          Frees a that already attached to a bone
 IAnimation getAnimation(int index)
          Gets a single animation by index.
 IAnimation getAnimation(java.lang.String name, NativeObjectPointer<ILinkedSkeletonAnimationSource> linker)
          Returns the named object.
 SkeletonAnimationBlendMode getBlendMode()
          Gets the animation blending mode which this skeleton will use.
 IBone getBone(int handle)
          Gets a bone by it's handle.
 IBone getBone(java.lang.String name)
          Gets a bone by it's name.
 void getBoneIterator(ISkeleton.IBoneIterator returnValue)
           
 IResourceManager getCreator()
           
 java.lang.String getGroup()
           
 long getHandle()
           
 void getLinkedSkeletonAnimationSourceIterator(ISkeleton.ILinkedSkeletonAnimSourceIterator returnValue)
           
 Resource.LoadingState getLoadingState()
          Returns the current loading state.
 boolean getManualBonesDirty()
           
 java.lang.String getName()
          Gets resource name.
 int getNumAnimations()
          Gets the number of animations on this skeleton.
 int getNumBones()
          Returns the number of bones in this skeleton.
 java.lang.String getOrigin()
          Get the origin of this resource, e.g. a script file name.
 IParamDictionary getParamDictionary_const()
           
 IParamDictionary getParamDictionary()
          Retrieves the parameter dictionary for this class.
 java.lang.String getParameter(java.lang.String name)
          Generic parameter retrieval method.
 IParameterList getParameters()
          Retrieves a list of parameters valid for this object.
 IBone getRootBone()
          Gets the root bone of the skeleton: deprecated in favour of getRootBoneIterator.
 void getRootBoneIterator(ISkeleton.IBoneIterator returnValue)
           
 int getSize()
          Retrieves info about the size of the resource.
 int getStateCount()
          Returns the number of times this resource has changed state, which generally means the number of times it has been loaded.
 boolean hasAnimation(java.lang.String name)
          Returns whether this skeleton contains the named animation.
 boolean hasBone(java.lang.String name)
          Returns whether this skeleton contains the named bone.
 boolean hasManualBones()
           
 boolean isBackgroundLoaded()
          Returns whether this has been earmarked for background loading.
 boolean isLoaded()
          Returns true if the has been loaded, false otherwise.
 boolean isLoading()
          Returns whether the resource is currently in the process of background loading.
 boolean isManuallyLoaded()
          Is this resource manually loaded?
 boolean isPrepared()
          Returns true if the has been prepared, false otherwise.
 boolean isReloadable()
          Returns true if the is reloadable, false otherwise.
 void load(boolean backgroundThread)
          Loads the resource, if it is not already.
 void optimiseAllAnimations(boolean preservingIdentityNodeTracks)
          Optimise all of this skeleton's animations.
 void prepare()
          Prepares the resource for load, if it is not already.
 void reload()
          Reloads the resource, if it is already loaded.
 void removeAllLinkedSkeletonAnimationSources()
           
 void removeAnimation(java.lang.String name)
          Removes an from this skeleton.
 void removeListener(IResource.IListener lis)
          Remove a listener on this resource.
 void reset(boolean resetManualBones)
          Resets the position and orientation of all bones in this skeleton to their original binding position.
 void setAnimationState(IAnimationStateSet animSet)
          Changes the state of the skeleton to reflect the application of the passed in collection of animations.
 void setBackgroundLoaded(boolean bl)
          Tells the resource whether it is background loaded or not.
 void setBindingPose()
          Sets the current position / orientation to be the 'binding pose' i.e. the layout in which bones were originally bound to a mesh.
 void setBlendMode(SkeletonAnimationBlendMode state)
          Sets the animation blending mode this skeleton will use.
 boolean setParameter(java.lang.String name, java.lang.String value)
          Generic parameter setting method.
 void setParameterList(INameValuePairList paramList)
          Generic multiple parameter setting method.
 void touch()
          'Touches' the resource to indicate it has been used.
 void unload()
          Unloads the resource; this is not permanent, the resource can be reloaded later if required.
 
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

SkeletonInstance

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


SkeletonInstance

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


SkeletonInstance

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

See Also:
WithoutNativeObject, INativeObject.disconnectFromNativeObject()

SkeletonInstance

public SkeletonInstance(ISkeletonPtr masterCopy)
Constructor, don't call directly, this will be created automatically when you create an based on a skeletally animated .

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

getNumAnimations

public int getNumAnimations()
Gets the number of animations on this skeleton.

Specified by:
getNumAnimations in interface ISkeleton
Specified by:
getNumAnimations in interface ISkeletonInstance

getAnimation

public IAnimation getAnimation(int index)
Gets a single animation by index.

Specified by:
getAnimation in interface ISkeleton
Specified by:
getAnimation in interface ISkeletonInstance

_getAnimationImpl

public IAnimation _getAnimationImpl(java.lang.String name,
                                    NativeObjectPointer<ILinkedSkeletonAnimationSource> linker)
Specified by:
_getAnimationImpl in interface ISkeleton
Specified by:
_getAnimationImpl in interface ISkeletonInstance

createAnimation

public IAnimation createAnimation(java.lang.String name,
                                  float length)
Creates a new object for animating this skeleton.

Specified by:
createAnimation in interface ISkeleton
Specified by:
createAnimation in interface ISkeletonInstance

getAnimation

public IAnimation getAnimation(java.lang.String name,
                               NativeObjectPointer<ILinkedSkeletonAnimationSource> linker)
Returns the named object.

Specified by:
getAnimation in interface ISkeleton
Specified by:
getAnimation in interface ISkeletonInstance

removeAnimation

public void removeAnimation(java.lang.String name)
Removes an from this skeleton.

Specified by:
removeAnimation in interface ISkeleton
Specified by:
removeAnimation in interface ISkeletonInstance

createTagPointOnBone

public ITagPoint createTagPointOnBone(IBone bone,
                                      IQuaternion offsetOrientation,
                                      IVector3 offsetPosition)
Creates a ready to be attached to a bone

Specified by:
createTagPointOnBone in interface ISkeletonInstance

freeTagPoint

public void freeTagPoint(ITagPoint tagPoint)
Frees a that already attached to a bone

Specified by:
freeTagPoint in interface ISkeletonInstance

addLinkedSkeletonAnimationSource

public void addLinkedSkeletonAnimationSource(java.lang.String skelName,
                                             float scale)
Description copied from interface: ISkeleton
Allows you to use the animations from another object to animate this skeleton. You cannot set up cyclic relationships, e.g. SkeletonA uses SkeletonB's animations, and SkeletonB uses SkeletonA's animations. This is because it would set up a circular dependency which would prevent proper unloading - make one of the skeletons the 'master' in this case.

Specified by:
addLinkedSkeletonAnimationSource in interface ISkeleton
Specified by:
addLinkedSkeletonAnimationSource in interface ISkeletonInstance

removeAllLinkedSkeletonAnimationSources

public void removeAllLinkedSkeletonAnimationSources()
Specified by:
removeAllLinkedSkeletonAnimationSources in interface ISkeleton
Specified by:
removeAllLinkedSkeletonAnimationSources in interface ISkeletonInstance

getLinkedSkeletonAnimationSourceIterator

public void getLinkedSkeletonAnimationSourceIterator(ISkeleton.ILinkedSkeletonAnimSourceIterator returnValue)
Specified by:
getLinkedSkeletonAnimationSourceIterator in interface ISkeleton
Specified by:
getLinkedSkeletonAnimationSourceIterator in interface ISkeletonInstance

_initAnimationState

public void _initAnimationState(IAnimationStateSet animSet)
Description copied from interface: ISkeleton
Initialise an animation set suitable for use with this skeleton.

Specified by:
_initAnimationState in interface ISkeleton
Specified by:
_initAnimationState in interface ISkeletonInstance

_refreshAnimationState

public void _refreshAnimationState(IAnimationStateSet animSet)
Description copied from interface: ISkeleton
Refresh an animation set suitable for use with this skeleton.

Specified by:
_refreshAnimationState in interface ISkeleton
Specified by:
_refreshAnimationState in interface ISkeletonInstance

getName

public java.lang.String getName()
Description copied from interface: IResource
Gets resource name.

Specified by:
getName in interface IResource
Specified by:
getName in interface ISkeletonInstance

getHandle

public long getHandle()
Specified by:
getHandle in interface IResource
Specified by:
getHandle in interface ISkeletonInstance

getGroup

public java.lang.String getGroup()
Specified by:
getGroup in interface IResource
Specified by:
getGroup in interface ISkeletonInstance

createBone

public IBone createBone()
Creates a brand new owned by this .

Specified by:
createBone in interface ISkeleton

createBone

public IBone createBone(int handle)
Creates a brand new owned by this .

Specified by:
createBone in interface ISkeleton

createBone

public IBone createBone(java.lang.String name)
Creates a brand new owned by this .

Specified by:
createBone in interface ISkeleton

createBone

public IBone createBone(java.lang.String name,
                        int handle)
Creates a brand new owned by this .

Specified by:
createBone in interface ISkeleton

getNumBones

public int getNumBones()
Returns the number of bones in this skeleton.

Specified by:
getNumBones in interface ISkeleton

getRootBone

public IBone getRootBone()
Gets the root bone of the skeleton: deprecated in favour of getRootBoneIterator.

Specified by:
getRootBone in interface ISkeleton

getRootBoneIterator

public void getRootBoneIterator(ISkeleton.IBoneIterator returnValue)
Specified by:
getRootBoneIterator in interface ISkeleton

getBoneIterator

public void getBoneIterator(ISkeleton.IBoneIterator returnValue)
Specified by:
getBoneIterator in interface ISkeleton

getBone

public IBone getBone(int handle)
Gets a bone by it's handle.

Specified by:
getBone in interface ISkeleton

getBone

public IBone getBone(java.lang.String name)
Gets a bone by it's name.

Specified by:
getBone in interface ISkeleton

hasBone

public boolean hasBone(java.lang.String name)
Returns whether this skeleton contains the named bone.

Specified by:
hasBone in interface ISkeleton

setBindingPose

public void setBindingPose()
Sets the current position / orientation to be the 'binding pose' i.e. the layout in which bones were originally bound to a mesh.

Specified by:
setBindingPose in interface ISkeleton

reset

public void reset(boolean resetManualBones)
Resets the position and orientation of all bones in this skeleton to their original binding position.

Specified by:
reset in interface ISkeleton

hasAnimation

public boolean hasAnimation(java.lang.String name)
Returns whether this skeleton contains the named animation.

Specified by:
hasAnimation in interface ISkeleton

setAnimationState

public void setAnimationState(IAnimationStateSet animSet)
Changes the state of the skeleton to reflect the application of the passed in collection of animations.

Specified by:
setAnimationState in interface ISkeleton

_getBoneMatrices

public void _getBoneMatrices(IMatrix4 pMatrices)
Populates the passed in array with the bone matrices based on the current position.

Specified by:
_getBoneMatrices in interface ISkeleton

getBlendMode

public SkeletonAnimationBlendMode getBlendMode()
Gets the animation blending mode which this skeleton will use.

Specified by:
getBlendMode in interface ISkeleton

setBlendMode

public void setBlendMode(SkeletonAnimationBlendMode state)
Sets the animation blending mode this skeleton will use.

Specified by:
setBlendMode in interface ISkeleton

_updateTransforms

public void _updateTransforms()
Specified by:
_updateTransforms in interface ISkeleton

optimiseAllAnimations

public void optimiseAllAnimations(boolean preservingIdentityNodeTracks)
Optimise all of this skeleton's animations.

Specified by:
optimiseAllAnimations in interface ISkeleton

_notifyManualBonesDirty

public void _notifyManualBonesDirty()
Specified by:
_notifyManualBonesDirty in interface ISkeleton

_notifyManualBoneStateChange

public void _notifyManualBoneStateChange(IBone bone)
Specified by:
_notifyManualBoneStateChange in interface ISkeleton

getManualBonesDirty

public boolean getManualBonesDirty()
Specified by:
getManualBonesDirty in interface ISkeleton

hasManualBones

public boolean hasManualBones()
Specified by:
hasManualBones in interface ISkeleton

_mergeSkeletonAnimations

public void _mergeSkeletonAnimations(ISkeleton source,
                                     ISkeleton.IBoneHandleMap boneHandleMap,
                                     IStringVector animations)
Merge animations from another object into this skeleton.

Specified by:
_mergeSkeletonAnimations in interface ISkeleton

_buildMapBoneByHandle

public void _buildMapBoneByHandle(ISkeleton source,
                                  ISkeleton.IBoneHandleMap boneHandleMap)
Build the bone handle map to use with .

Specified by:
_buildMapBoneByHandle in interface ISkeleton

_buildMapBoneByName

public void _buildMapBoneByName(ISkeleton source,
                                ISkeleton.IBoneHandleMap boneHandleMap)
Build the bone handle map to use with .

Specified by:
_buildMapBoneByName in interface ISkeleton

prepare

public void prepare()
Prepares the resource for load, if it is not already. One can call before , but this is not required as will call itself, if needed. When OGRE_THREAD_SUPPORT==1 both and are thread-safe. When OGRE_THREAD_SUPPORT==2 however, only is thread-safe. The reason for this function is to allow a background thread to do some of the loading work, without requiring the whole render system to be thread-safe. The background thread would call while the main render loop would later call . So long as remains thread-safe, subclasses can arbitrarily split the work of loading a resource between and . It is best to try and do as much work in , however, since this will leave less work for the main render thread to do and thus increase FPS.

Specified by:
prepare in interface IResource

load

public void load(boolean backgroundThread)
Loads the resource, if it is not already.

Specified by:
load in interface IResource

reload

public void reload()
Reloads the resource, if it is already loaded.

Specified by:
reload in interface IResource

isReloadable

public boolean isReloadable()
Returns true if the is reloadable, false otherwise.

Specified by:
isReloadable in interface IResource

isManuallyLoaded

public boolean isManuallyLoaded()
Is this resource manually loaded?

Specified by:
isManuallyLoaded in interface IResource

unload

public void unload()
Unloads the resource; this is not permanent, the resource can be reloaded later if required.

Specified by:
unload in interface IResource

getSize

public int getSize()
Retrieves info about the size of the resource.

Specified by:
getSize in interface IResource

touch

public void touch()
'Touches' the resource to indicate it has been used.

Specified by:
touch in interface IResource

isPrepared

public boolean isPrepared()
Returns true if the has been prepared, false otherwise.

Specified by:
isPrepared in interface IResource

isLoaded

public boolean isLoaded()
Returns true if the has been loaded, false otherwise.

Specified by:
isLoaded in interface IResource

isLoading

public boolean isLoading()
Returns whether the resource is currently in the process of background loading.

Specified by:
isLoading in interface IResource

getLoadingState

public Resource.LoadingState getLoadingState()
Returns the current loading state.

Specified by:
getLoadingState in interface IResource

isBackgroundLoaded

public boolean isBackgroundLoaded()
Returns whether this has been earmarked for background loading.

Specified by:
isBackgroundLoaded in interface IResource

setBackgroundLoaded

public void setBackgroundLoaded(boolean bl)
Tells the resource whether it is background loaded or not.

Specified by:
setBackgroundLoaded in interface IResource

escalateLoading

public void escalateLoading()
Escalates the loading of a background loaded resource.

Specified by:
escalateLoading in interface IResource

addListener

public void addListener(IResource.IListener lis)
Register a listener on this resource.

Specified by:
addListener in interface IResource

removeListener

public void removeListener(IResource.IListener lis)
Remove a listener on this resource.

Specified by:
removeListener in interface IResource

changeGroupOwnership

public void changeGroupOwnership(java.lang.String newGroup)
Change the resource group ownership of a .

Specified by:
changeGroupOwnership in interface IResource

getCreator

public IResourceManager getCreator()
Specified by:
getCreator in interface IResource

getOrigin

public java.lang.String getOrigin()
Get the origin of this resource, e.g. a script file name.

Specified by:
getOrigin in interface IResource

_notifyOrigin

public void _notifyOrigin(java.lang.String origin)
Specified by:
_notifyOrigin in interface IResource

getStateCount

public int getStateCount()
Returns the number of times this resource has changed state, which generally means the number of times it has been loaded. Objects that build derived data based on the resource can check this value against a copy they kept last time they built this derived data, in order to know whether it needs rebuilding. This is a nice way of monitoring changes without having a tightly-bound callback.

Specified by:
getStateCount in interface IResource

_dirtyState

public void _dirtyState()
Manually mark the state of this resource as having been changed.

Specified by:
_dirtyState in interface IResource

_fireBackgroundLoadingComplete

public void _fireBackgroundLoadingComplete()
Firing of background loading complete event

Specified by:
_fireBackgroundLoadingComplete in interface IResource

_fireBackgroundPreparingComplete

public void _fireBackgroundPreparingComplete()
Firing of background preparing complete event

Specified by:
_fireBackgroundPreparingComplete in interface IResource

getParamDictionary

public IParamDictionary getParamDictionary()
Retrieves the parameter dictionary for this class.

Specified by:
getParamDictionary in interface IStringInterface

getParamDictionary_const

public IParamDictionary getParamDictionary_const()
Specified by:
getParamDictionary_const in interface IStringInterface

getParameters

public IParameterList getParameters()
Retrieves a list of parameters valid for this object.

Specified by:
getParameters in interface IStringInterface

setParameter

public boolean setParameter(java.lang.String name,
                            java.lang.String value)
Generic parameter setting method.

Specified by:
setParameter in interface IStringInterface

setParameterList

public void setParameterList(INameValuePairList paramList)
Generic multiple parameter setting method.

Specified by:
setParameterList in interface IStringInterface

getParameter

public java.lang.String getParameter(java.lang.String name)
Generic parameter retrieval method.

Specified by:
getParameter in interface IStringInterface

copyParametersTo

public void copyParametersTo(IStringInterface dest)
Method for copying this object's parameters to another object.

Specified by:
copyParametersTo in interface IStringInterface

cleanupDictionary

public static void cleanupDictionary()
Cleans up the static 'msDictionary' required to reset , otherwise the containers are left with invalid pointers, which will lead to a crash as soon as one of the implementers (e.g. ) initializes.



Copyright © 2007 netAllied GmbH. All Rights Reserved.