Package gaiasky.util.gdx.model
Class IntNode
java.lang.Object
gaiasky.util.gdx.model.IntNode
 Direct Known Subclasses:
NodePlus

Field Summary
Modifier and TypeFieldDescriptionfinal com.badlogic.gdx.math.Matrix4
the global transform, product of local transform and transform of the parent node, calculated viacalculateWorldTransform()
the id, may be null, FIXME is this unique?boolean
Whether this node should inherit the transformation of its parent node, defaults to true.boolean
Whether this node is currently being animated, if so the translation, rotation and scale values are not used.final com.badlogic.gdx.math.Matrix4
the local transform, based on translation/rotation/scale (calculateLocalTransform()
) or any applied animationprotected IntNode
com.badlogic.gdx.utils.Array<IntNodePart>
final com.badlogic.gdx.math.Quaternion
the rotation, relative to the parent, not modified by animationsfinal com.badlogic.gdx.math.Vector3
the scale, relative to the parent, not modified by animationsfinal com.badlogic.gdx.math.Vector3
the translation, relative to the parent, not modified by animations 
Constructor Summary

Method Summary
Modifier and TypeMethodDescription<T extends IntNode>
intaddChild
(T child) Adds the specified node as the currently last child of this node.<T extends IntNode>
intaddChildren
(Iterable<T> nodes) Adds the specified nodes as the currently last child of this node.<T extends IntNode>
voidattachTo
(T parent) Adds this node as child to specified parent Node, synonym for:parent.addChild(this)
void
calculateBoneTransforms
(boolean recursive) com.badlogic.gdx.math.collision.BoundingBox
calculateBoundingBox
(com.badlogic.gdx.math.collision.BoundingBox out) Calculate the bounding box of this Node.com.badlogic.gdx.math.collision.BoundingBox
calculateBoundingBox
(com.badlogic.gdx.math.collision.BoundingBox out, boolean transform) Calculate the bounding box of this Node.com.badlogic.gdx.math.Matrix4
Calculates the local transform based on the translation, scale and rotationvoid
calculateTransforms
(boolean recursive) Calculates the local and world transform of this node and optionally all its children.com.badlogic.gdx.math.Matrix4
Calculates the world transform; the product of local transform and the parent's world transform.copy()
Creates a nested copy of this Node, any child nodes are copied using this method as well.void
detach()
Removes this node from its current parent, if any.com.badlogic.gdx.math.collision.BoundingBox
extendBoundingBox
(com.badlogic.gdx.math.collision.BoundingBox out) Extends the bounding box with the bounds of this Node.com.badlogic.gdx.math.collision.BoundingBox
extendBoundingBox
(com.badlogic.gdx.math.collision.BoundingBox out, boolean transform) Extends the bounding box with the bounds of this Node.getChild
(int index) int
static IntNode
getNode
(com.badlogic.gdx.utils.Array<IntNode> nodes, String id, boolean recursive, boolean ignoreCase) Helper method to recursive fetch a node from an arrayboolean
boolean
<T extends IntNode>
intinsertChild
(int index, T child) Insert the specified node as child of this node at the specified index.<T extends IntNode>
intinsertChildren
(int index, Iterable<T> nodes) Insert the specified nodes as children of this node at the specified index.<T extends IntNode>
booleanremoveChild
(T child) Removes the specified node as child of this node.protected IntNode
Creates a nested copy of this Node, any child nodes are copied using thecopy()
method.

Field Details

translation
public final com.badlogic.gdx.math.Vector3 translationthe translation, relative to the parent, not modified by animations 
rotation
public final com.badlogic.gdx.math.Quaternion rotationthe rotation, relative to the parent, not modified by animations 
scale
public final com.badlogic.gdx.math.Vector3 scalethe scale, relative to the parent, not modified by animations 
localTransform
public final com.badlogic.gdx.math.Matrix4 localTransformthe local transform, based on translation/rotation/scale (calculateLocalTransform()
) or any applied animation 
globalTransform
public final com.badlogic.gdx.math.Matrix4 globalTransformthe global transform, product of local transform and transform of the parent node, calculated viacalculateWorldTransform()

id
the id, may be null, FIXME is this unique? 
inheritTransform
public boolean inheritTransformWhether this node should inherit the transformation of its parent node, defaults to true. When this flag is false the value ofglobalTransform
will be the same as the value oflocalTransform
causing the transform to be independent of its parent transform. 
isAnimated
public boolean isAnimatedWhether this node is currently being animated, if so the translation, rotation and scale values are not used. 
parts

parent


Constructor Details

IntNode
public IntNode()


Method Details

getNode
public static IntNode getNode(com.badlogic.gdx.utils.Array<IntNode> nodes, String id, boolean recursive, boolean ignoreCase) Helper method to recursive fetch a node from an array Parameters:
recursive
 false to fetch a root node only, true to search the entire node tree for the specified node. Returns:
 The node with the specified id, or null if not found.

calculateLocalTransform
public com.badlogic.gdx.math.Matrix4 calculateLocalTransform()Calculates the local transform based on the translation, scale and rotation Returns:
 the local transform

calculateWorldTransform
public com.badlogic.gdx.math.Matrix4 calculateWorldTransform()Calculates the world transform; the product of local transform and the parent's world transform. Returns:
 the world transform

calculateTransforms
public void calculateTransforms(boolean recursive) Calculates the local and world transform of this node and optionally all its children. Parameters:
recursive
 whether to calculate the local/world transforms for children.

calculateBoneTransforms
public void calculateBoneTransforms(boolean recursive) 
calculateBoundingBox
public com.badlogic.gdx.math.collision.BoundingBox calculateBoundingBox(com.badlogic.gdx.math.collision.BoundingBox out) Calculate the bounding box of this Node. This is a potential slow operation, it is advised to cache the result. 
calculateBoundingBox
public com.badlogic.gdx.math.collision.BoundingBox calculateBoundingBox(com.badlogic.gdx.math.collision.BoundingBox out, boolean transform) Calculate the bounding box of this Node. This is a potential slow operation, it is advised to cache the result. 
extendBoundingBox
public com.badlogic.gdx.math.collision.BoundingBox extendBoundingBox(com.badlogic.gdx.math.collision.BoundingBox out) Extends the bounding box with the bounds of this Node. This is a potential slow operation, it is advised to cache the result. 
extendBoundingBox
public com.badlogic.gdx.math.collision.BoundingBox extendBoundingBox(com.badlogic.gdx.math.collision.BoundingBox out, boolean transform) Extends the bounding box with the bounds of this Node. This is a potential slow operation, it is advised to cache the result. 
attachTo
Adds this node as child to specified parent Node, synonym for:parent.addChild(this)
 Parameters:
parent
 The Node to attach this Node to.

detach
public void detach()Removes this node from its current parent, if any. Short for:this.getParent().removeChild(this)

hasChildren
public boolean hasChildren() Returns:
 whether this Node has one or more children (true) or not (false)

getChildCount
public int getChildCount() Returns:
 The number of child nodes that this Node current contains.
 See Also:

getChild
 Parameters:
index
 The zerobased index of the child node to get, must be: 0 <= index <getChildCount()
. Returns:
 The child node at the specified index

getChild
 Parameters:
recursive
 false to fetch a root child only, true to search the entire node tree for the specified node. Returns:
 The node with the specified id, or null if not found.

addChild
Adds the specified node as the currently last child of this node. If the node is already a child of another node, then it is removed from its current parent. Parameters:
child
 The Node to add as child of this Node Returns:
 the zerobased index of the child

addChildren
Adds the specified nodes as the currently last child of this node. If the node is already a child of another node, then it is removed from its current parent. Parameters:
nodes
 The Node to add as child of this Node Returns:
 the zerobased index of the first added child

insertChild
Insert the specified node as child of this node at the specified index. If the node is already a child of another node, then it is removed from its current parent. If the specified index is less than zero or equal or greater thangetChildCount()
then the Node is added as the currently last child. Parameters:
index
 The zerobased index at which to add the childchild
 The Node to add as child of this Node Returns:
 the zerobased index of the child

insertChildren
Insert the specified nodes as children of this node at the specified index. If the node is already a child of another node, then it is removed from its current parent. If the specified index is less than zero or equal or greater thangetChildCount()
then the Node is added as the currently last child. Parameters:
index
 The zerobased index at which to add the childnodes
 The nodes to add as child of this Node Returns:
 the zerobased index of the first inserted child

removeChild
Removes the specified node as child of this node. On success, the child node will be not attached to any parent node (itsgetParent()
method will return null). If the specified node currently isn't a child of this node then the removal is considered to be unsuccessful and the method will return false. Parameters:
child
 The child node to remove. Returns:
 Whether the removal was successful.

getChildren
 Returns:
 An
Iterable
to all child nodes that this node contains.

getParent
 Returns:
 The parent node that holds this node as child node, may be null.

hasParent
public boolean hasParent() Returns:
 Whether (true) is this Node is a child node of another node or not (false).

copy
Creates a nested copy of this Node, any child nodes are copied using this method as well. Theparts
are copied using theIntNodePart.copy()
method. Note that that method copies the material and nodes (bones) by reference. If you intend to use the copy in a different node tree (e.g. a different Model or ModelInstance) then you will need to update these references afterwards.Override this method in your custom Node class to instantiate that class, in that case you should override the
set(IntNode)
method as well. 
set
Creates a nested copy of this Node, any child nodes are copied using thecopy()
method. This will detach this node from its parent, but does not attach it to the parent of node being copied. Theparts
are copied using theIntNodePart.copy()
method. Note that that method copies the material and nodes (bones) by reference. If you intend to use this node in a different node tree (e.g. a different Model or ModelInstance) then you will need to update these references afterwards.Override this method in your custom Node class to copy any additional fields you've added.
 Returns:
 This Node for chaining
