public interface IAttachment
Interface for attachments, which provide new capabilities for INode instances. These capabilities can be things like rendering geometry, providing advanced control over the node and more.
Because inheritance is a very poor, brittle way to extend node capabilities in a scene hierarchy, this approach allows for design via composition.
Modifier and Type | Method and Description |
---|---|
void |
attach(INode owner)
Adds this instance to the supplied node.
|
void |
detach(INode owner)
Removes this instance from the supplied node.
|
INode |
getOwner()
Returns the node this attachment is attached to or null if there is no
attached node.
|
java.lang.Class<?> |
getType()
Returns the class type of the attachment.
|
boolean |
isSingleton()
If the attachment is a singleton, only a single instance of the
attachment can be attached to any given node.
|
INode getOwner()
Returns the node this attachment is attached to or null if there is no attached node.
void attach(INode owner)
Adds this instance to the supplied node. The attachment's functionality will be applied to the new owner node.
If the attachment is a singleton, this will replace any existing attachment of the same type.
owner
- the node to attach tovoid detach(INode owner)
Removes this instance from the supplied node. Any functionality provided by this attachment will be removed from the owner node.
If the supplied node is not attached, this is a no-op.
owner
- the node to detach fromboolean isSingleton()
If the attachment is a singleton, only a single instance of the attachment can be attached to any given node.
java.lang.Class<?> getType()
Returns the class type of the attachment. Note that this may not be the same as the concrete type.