com.badlogic.gdx.graphics.g3d.model
Class Node

java.lang.Object
  extended by com.badlogic.gdx.graphics.g3d.model.Node

public class Node
extends Object

A node is part of a hierarchy of Nodes in a Model. A Node encodes a transform relative to its parents. A Node can have child nodes. Optionally a node can specify a MeshPart and a Material to be applied to the mesh part.

Author:
badlogic

Field Summary
 Array<Node> children
          child nodes
 Matrix4 globalTransform
          the global transform, product of local transform and transform of the parent node, calculated via calculateWorldTransform()
 String id
          the id, may be null, FIXME is this unique?
 boolean isAnimated
          Whether this node is currently being animated, if so the translation, rotation and scale values are not used.
 Matrix4 localTransform
          the local transform, based on translation/rotation/scale (calculateLocalTransform()) or any applied animation
 Node parent
          parent node, may be null
 Array<NodePart> parts
           
 Quaternion rotation
          the rotation, relative to the parent, not modified by animations
 Vector3 scale
          the scale, relative to the parent, not modified by animations
 Vector3 translation
          the translation, relative to the parent, not modified by animations
 
Constructor Summary
Node()
           
 
Method Summary
 void calculateBoneTransforms(boolean recursive)
           
 BoundingBox calculateBoundingBox(BoundingBox out)
          Calculate the bounding box of this Node.
 BoundingBox calculateBoundingBox(BoundingBox out, boolean transform)
          Calculate the bounding box of this Node.
 Matrix4 calculateLocalTransform()
          Calculates the local transform based on the translation, scale and rotation
 void calculateTransforms(boolean recursive)
          Calculates the local and world transform of this node and optionally all its children.
 Matrix4 calculateWorldTransform()
          Calculates the world transform; the product of local transform and the parent's world transform.
 BoundingBox extendBoundingBox(BoundingBox out)
          Extends the bounding box with the bounds of this Node.
 BoundingBox extendBoundingBox(BoundingBox out, boolean transform)
          Extends the bounding box with the bounds of this Node.
 Node getChild(String id, boolean recursive, boolean ignoreCase)
           
static Node getNode(Array<Node> nodes, String id, boolean recursive, boolean ignoreCase)
          Helper method to recursive fetch a node from an array
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

public String id
the id, may be null, FIXME is this unique?


parent

public Node parent
parent node, may be null


children

public final Array<Node> children
child nodes


isAnimated

public boolean isAnimated
Whether this node is currently being animated, if so the translation, rotation and scale values are not used.


translation

public final Vector3 translation
the translation, relative to the parent, not modified by animations


rotation

public final Quaternion rotation
the rotation, relative to the parent, not modified by animations


scale

public final Vector3 scale
the scale, relative to the parent, not modified by animations


localTransform

public final Matrix4 localTransform
the local transform, based on translation/rotation/scale (calculateLocalTransform()) or any applied animation


globalTransform

public final Matrix4 globalTransform
the global transform, product of local transform and transform of the parent node, calculated via calculateWorldTransform()


parts

public Array<NodePart> parts
Constructor Detail

Node

public Node()
Method Detail

calculateLocalTransform

public Matrix4 calculateLocalTransform()
Calculates the local transform based on the translation, scale and rotation

Returns:
the local transform

calculateWorldTransform

public 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 BoundingBox calculateBoundingBox(BoundingBox out)
Calculate the bounding box of this Node. This is a potential slow operation, it is advised to cache the result.


calculateBoundingBox

public BoundingBox calculateBoundingBox(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 BoundingBox extendBoundingBox(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 BoundingBox extendBoundingBox(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.


getChild

public Node getChild(String id,
                     boolean recursive,
                     boolean ignoreCase)
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.

getNode

public static Node getNode(Array<Node> 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.


Copyright © 2013. All Rights Reserved.