com.md5importer.interfaces.control
Interface IMD5NodeController

All Superinterfaces:
IController, IObserver
All Known Implementing Classes:
MD5NodeController

public interface IMD5NodeController
extends IController, IObserver

IMD5NodeController defines the interface of the concurrent controller unit that is responsible for synchronizing the IMD5Node with active IMD5Anim to perform CPU skinning.

IMD5NodeController contains the logic to properly update the IJoint of the IMD5Node based on the active IMD5Anim. It manipulates the joint positions based on the interpolated value between the current positions and the animation frame positions. The interpolation is performed using the current time value of the active animation. The actual skinning logic is maintained by the mesh primitives.

IMD5NodeController is defined as an observer unit that monitors the current active animation set on the node. It is notified whenever the frames of the current active animation are modified. This allows the controller to synchronize the controlling node with the active animation.

IMD5NodeController is registered as an observer to the given IMD5Anim when setActiveAnim method is invoked. This implied that the controller itself does not require any external update invocation. It automatically performs the synchronization operation whenever the animation is modified. In fact IMD5NodeController does not respond to update invocation.

IMD5NodeController uses ReentrantLock to guard the observer update method to prevent interleaving invocations from multiple animation updating threads. Although, it is advised to update all the animations associated with the controlled node in a single thread. This lock guarantees that the mesh is updated based on a single animation at once. There is no locking performed on setActiveAnim to allow maximum concurrency. It does provide memory visibility.


Method Summary
 IMD5Anim getActiveAnim()
          Retrieve the current active animation.
 void setActiveAnim(IMD5Anim anim)
          Set the active animation.
 
Methods inherited from interface com.md5importer.interfaces.control.IController
isActive, setActive, update
 
Methods inherited from interface com.md5importer.interfaces.IObserver
update
 

Method Detail

setActiveAnim

void setActiveAnim(IMD5Anim anim)
Set the active animation.

This invocation registers this controller as an observer to the given animation observable unit and unregisters itself from the previous active animation.

Parameters:
anim - The IMD5Anim to be set.

getActiveAnim

IMD5Anim getActiveAnim()
Retrieve the current active animation.

Returns:
The current active IMD5Anim.