Class IntNode

java.lang.Object
gaiasky.util.gdx.model.IntNode

public class IntNode extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final com.badlogic.gdx.math.Matrix4
    the global transform, product of local transform and transform of the parent node, calculated via calculateWorldTransform()
    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 animation
    protected IntNode
     
    com.badlogic.gdx.utils.Array<IntNodePart>
     
    final com.badlogic.gdx.math.Quaternion
    the rotation, relative to the parent, not modified by animations
    final com.badlogic.gdx.math.Vector3
    the scale, relative to the parent, not modified by animations
    final com.badlogic.gdx.math.Vector3
    the translation, relative to the parent, not modified by animations
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    IntNode(com.badlogic.gdx.graphics.g3d.model.Node other)
     
    IntNode(com.badlogic.gdx.graphics.g3d.model.Node other, IntNode parent)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends IntNode>
    int
    addChild(T child)
    Adds the specified node as the currently last child of this node.
    <T extends IntNode>
    int
    Adds the specified nodes as the currently last child of this node.
    <T extends IntNode>
    void
    attachTo(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 rotation
    void
    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.
    Creates a nested copy of this Node, any child nodes are copied using this method as well.
    void
    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)
     
    getChild(String id, boolean recursive, boolean ignoreCase)
     
    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 array
     
    boolean
     
    boolean
     
    <T extends IntNode>
    int
    insertChild(int index, T child)
    Insert the specified node as child of this node at the specified index.
    <T extends IntNode>
    int
    insertChildren(int index, Iterable<T> nodes)
    Insert the specified nodes as children of this node at the specified index.
    <T extends IntNode>
    boolean
    removeChild(T child)
    Removes the specified node as child of this node.
    protected IntNode
    set(IntNode other)
    Creates a nested copy of this Node, any child nodes are copied using the copy() method.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • translation

      public final com.badlogic.gdx.math.Vector3 translation
      the translation, relative to the parent, not modified by animations
    • rotation

      public final com.badlogic.gdx.math.Quaternion rotation
      the rotation, relative to the parent, not modified by animations
    • scale

      public final com.badlogic.gdx.math.Vector3 scale
      the scale, relative to the parent, not modified by animations
    • localTransform

      public final com.badlogic.gdx.math.Matrix4 localTransform
      the local transform, based on translation/rotation/scale (calculateLocalTransform()) or any applied animation
    • globalTransform

      public final com.badlogic.gdx.math.Matrix4 globalTransform
      the global transform, product of local transform and transform of the parent node, calculated via calculateWorldTransform()
    • id

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

      public boolean inheritTransform
      Whether this node should inherit the transformation of its parent node, defaults to true. When this flag is false the value of globalTransform will be the same as the value of localTransform causing the transform to be independent of its parent transform.
    • isAnimated

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

      public com.badlogic.gdx.utils.Array<IntNodePart> parts
    • parent

      protected IntNode parent
  • Constructor Details

    • IntNode

      public IntNode()
    • IntNode

      public IntNode(com.badlogic.gdx.graphics.g3d.model.Node other)
    • IntNode

      public IntNode(com.badlogic.gdx.graphics.g3d.model.Node other, IntNode parent)
  • 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

      public <T extends IntNode> void attachTo(T parent)
      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

      public IntNode getChild(int index)
      Parameters:
      index - The zero-based index of the child node to get, must be: 0 invalid input: '<'= index invalid input: '<' getChildCount().
      Returns:
      The child node at the specified index
    • getChild

      public IntNode 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.
    • addChild

      public <T extends IntNode> int addChild(T child)
      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 zero-based index of the child
    • addChildren

      public <T extends IntNode> int addChildren(Iterable<T> nodes)
      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 zero-based index of the first added child
    • insertChild

      public <T extends IntNode> int insertChild(int index, T child)
      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 than getChildCount() then the Node is added as the currently last child.
      Parameters:
      index - The zero-based index at which to add the child
      child - The Node to add as child of this Node
      Returns:
      the zero-based index of the child
    • insertChildren

      public <T extends IntNode> int insertChildren(int index, Iterable<T> nodes)
      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 than getChildCount() then the Node is added as the currently last child.
      Parameters:
      index - The zero-based index at which to add the child
      nodes - The nodes to add as child of this Node
      Returns:
      the zero-based index of the first inserted child
    • removeChild

      public <T extends IntNode> boolean removeChild(T child)
      Removes the specified node as child of this node. On success, the child node will be not attached to any parent node (its getParent() 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

      public Iterable<IntNode> getChildren()
      Returns:
      An Iterable to all child nodes that this node contains.
    • getParent

      public IntNode 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

      public IntNode copy()
      Creates a nested copy of this Node, any child nodes are copied using this method as well. The parts are copied using the IntNodePart.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

      protected IntNode set(IntNode other)
      Creates a nested copy of this Node, any child nodes are copied using the copy() method. This will detach this node from its parent, but does not attach it to the parent of node being copied. The parts are copied using the IntNodePart.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