Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.cult3d.world
Class Node

    java.lang.Object
      |
      +--com.cult3d.world.Node

Direct Known Subclasses:
  Camera, CultObject, ParticleSystem

public class Node
extends java.lang.Object

This class provides a Java representation for a Cult3D Node that exists in the scene graph of the Cult3D project.

Since:
  Cult3D 4.2

Field Summary
`static short` | `LOCAL` The local reference frame of the Cult3D universe.
`static short` | `WORLD` the world reference frame of the Cult3D universe.
`static int` | `X` The x-axis.
`static int` | `Y` The y-axis.
`static int` | `Z` The z-axis.

Method Summary
`void` | `addChild(Node child)` Attaches a node as a child to this node.
`static void` | `addChildToRoot(Node child)` Adds a node too the highest level in the scene graph.
`void` | `disconnect()` Disconnects a node from the scene graph.
`boolean` | `equals(java.lang.Object obj)` Compares two Nodes for equality.
`Node` | `getChildAt(int index)` Returns the child at the specified index.
`int` | `getChildCount()` Returns the number of children of this node in the scene graph.
`Node` | `getFirstChild()` Returns the first child to this node.
`static Node` | `getFirstNode()` Gets the first node of the scene graph.
`java.lang.String` | `getInfo()` Returns a string representation of the values of this object.
`java.lang.String` | `getName()` Returns the Name of this node.
`Node` | `getNextSibling()` Gets the next sibling to this node.
`Matrix4x4` | `getOrientation(short refFrame)` Gets the orientation of this object relative to the given reference frame.
`Node` | `getParent()` Gets the parent of this node.
`Vector3` | `getPosition(short refFrame)` Gets the position of this node in the given reference frame.
`Matrix4x4` | `getTransform(short refFrame)` Gets the transform matrix for this object relative to the given reference frame.
`boolean` | `isBoundingBoxVisible()` Determines whether this objects boundingbox is visible.
`boolean` | `isVisible()` Determines whether this object is visible.
`Matrix4x4` | `nodeToWorld(Matrix4x4 nodecoord)` Converts the given matrix from the local reference frame to the world reference frame.
`void` | `rotate(int axis, float amount)` Rotates the object the given amount in radians around the given axis.
`void` | `rotate(int axis, float amount, double ms)` Smoothly rotates the object in in radians around the given axis in its own reference frame.
`void` | `rotate(int axis, float amount, double ms, boolean loop)` Smoothly rotates the object the given amount in radians around the given axis in its own reference frame.
`void` | `rotate(int axis, float amount, double ms, CultEvent ce)` Smoothly rotates the object the given amount in radians around the given axis in its own reference frame.
`void` | `rotateDegrees(int axis, float amount)` Rotates the object the given amount in degrees around the given axis.
`void` | `rotateDegrees(int axis, float amount, double ms)` Smoothly rotates the object in in degrees around the given axis in its own reference frame.
`void` | `rotateDegrees(int axis, float amount, double ms, boolean loop)` Smoothly rotates the object the given amount in degrees around the given axis in its own reference frame.
`void` | `rotateDegrees(int axis, float amount, double ms, CultEvent ce)` Smoothly rotates the object the given amount in degrees around the given axis in its own reference frame.
`void` | `setBoundingBoxVisible(boolean state)` Shows or hides this objects boundingbox depending on the value of parameter `state`.
`void` | `setName(java.lang.String name)` Changes the name of this node to the name given as parameter
`void` | `setOrientation(short refFrame, Matrix4x4 matrix)` Sets the orientation of this object relative to the given reference frame.
`void` | `setPosition(short refFrame, Vector3 newPos)` Sets the position for this node in the given reference frame.
`void` | `setTransform(short refFrame, Matrix4x4 matrix)` Sets the transform for this object relative to the given reference frame.
`void` | `setVisible(boolean state)` Shows or hides this object depending on the value of parameter `state`.
`void` | `setVisible(boolean visibleState, boolean applyToChildren)` Shows or hides this object depending on the value of parameter.
`void` | `stopRotation()` Stops any rotations this object is currently performing.
`void` | `stopTranslation()` Stops any translations this object is currently performing.
`java.lang.String` | `toString()` Returns a string representation of the values of this object.
`void` | `translate(float amountx, float amounty, float amountz)` Translates the object in its own reference frame.
`void` | `translate(float amountx, float amounty, float amountz, double ms)` Smoothly translates the object in its own reference frame.
`void` | `translate(float amountx, float amounty, float amountz, double ms, boolean loop)` Smoothly translates the object in its own reference frame.
`void` | `translate(float amountx, float amounty, float amountz, double ms, CultEvent ce)` Smoothly translates the object in its own reference frame.
`Matrix4x4` | `worldToNode(Matrix4x4 worldcoord)` Converts the given matrix from the world reference frame to the local reference frame.

Methods inherited from class java.lang.Object
`getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### X

    public static final int X

  The x-axis.
  Since:
    Cult3D 4.0

### Y

    public static final int Y

  The y-axis.
  Since:
    Cult3D 4.0

### Z

    public static final int Z

  The z-axis.
  Since:
    Cult3D 4.0

### LOCAL

    public static final short LOCAL

  The local reference frame of the Cult3D universe.
  Since:
    Cult3D 4.2

### WORLD

    public static final short WORLD

  the world reference frame of the Cult3D universe.
  Since:
    Cult3D 4.2

Method Detail

### rotate

    public void rotate(int axis,
                       float amount)

  Rotates the object the given amount in radians around the given axis. It rotates in its own reference frame. The rotation occurs immediately. Any children linked to this object will be rotated as well.
  Parameters:
    `axis` - the axis to rotate around. Use the static varables X, Y, and Z defined in this class.
    `amount` - the amount in radians to rotate this object.
  Throws:
    java.lang.IllegalArgumentException - If the given axis is invalid.
  Since:
    Cult3D 4.0
  See Also:
    `X`, `Y`, `Z`

### rotate

    public void rotate(int axis,
                       float amount,
                       double ms)

  Smoothly rotates the object in in radians around the given axis in its own reference frame. The rotation will occur during the given amount of milliseconds. Any children linked to this object will be rotated as well.
  Parameters:
    `axis` - the axis to rotate around. Use the static varables X, Y, and Z defined in this class.
    `amount` - the amount to rotate, in radians.
    `ms` - The time the rotation will last, in milliseconds.
  Throws:
    java.lang.IllegalArgumentException - if the given axix is invalid.
  Since:
    Cult3D 4.2
  See Also:
    `X`, `Y`, `Z`

### rotate

    public void rotate(int axis,
                       float amount,
                       double ms,
                       CultEvent ce)

  Smoothly rotates the object the given amount in radians around the given axis in its own reference frame. The rotation will occur during the given amount of milliseconds. Any children linked to this object will be rotated as well.
  Parameters:
    `axis` - the axis to rotate around. Use the static varables X, Y, and Z defined in this class.
    `amount` - the amount to rotate in radians.
    `ms` - The time the rotation will last, in milliseconds.
    `ce` - A CultEvent to be triggered when the rotation has come to a full stop.
  Throws:
    java.lang.IllegalArgumentException - if the given axix is invalid.
  Since:
    Cult3D 4.2
  See Also:
    `X`, `Y`, `Z`

### rotate

    public void rotate(int axis,
                       float amount,
                       double ms,
                       boolean loop)

  Smoothly rotates the object the given amount in radians around the given axis in its own reference frame. The rotation will occur during the given amount of milliseconds. Any children linked to this object will be rotated as well. If the loop flag is true, the rotation will loop until stopped with the stopRotation() method.
  Parameters:
    `axis` - the axis to rotate around. Use the static varables X, Y, and Z defined in this class.
    `amount` - the amount to rotate in radians.
    `ms` - The time the rotation will last, in milliseconds.
  Throws:
    java.lang.IllegalArgumentException - if the given axix is invalid.
  Since:
    Cult3D 4.2
  See Also:
    `X`, `Y`, `Z`, `stopRotation()`

### rotateDegrees

    public void rotateDegrees(int axis,
                              float amount)

  Rotates the object the given amount in degrees around the given axis. It rotates in its own reference frame. The rotation occurs immediately. Any children linked to this object will be rotated as well.
  Parameters:
    `axis` - the axis to rotate around. Use the static varables X, Y, and Z defined in this class.
    `amount` - the amount in degrees to rotate this object.
  Throws:
    java.lang.IllegalArgumentException - If the given axis is invalid.
  Since:
    Cult3D 5.3
  See Also:
    `X`, `Y`, `Z`

### rotateDegrees

    public void rotateDegrees(int axis,
                              float amount,
                              double ms)

  Smoothly rotates the object in in degrees around the given axis in its own reference frame. The rotation will occur during the given amount of milliseconds. Any children linked to this object will be rotated as well.
  Parameters:
    `axis` - the axis to rotate around. Use the static varables X, Y, and Z defined in this class.
    `amount` - the amount to rotate, in degrees.
    `ms` - The time the rotation will last, in milliseconds.
  Throws:
    java.lang.IllegalArgumentException - if the given axix is invalid.
  Since:
    Cult3D 5.3
  See Also:
    `X`, `Y`, `Z`

### rotateDegrees

    public void rotateDegrees(int axis,
                              float amount,
                              double ms,
                              CultEvent ce)

  Smoothly rotates the object the given amount in degrees around the given axis in its own reference frame. The rotation will occur during the given amount of milliseconds. Any children linked to this object will be rotated as well.
  Parameters:
    `axis` - the axis to rotate around. Use the static varables X, Y, and Z defined in this class.
    `amount` - the amount to rotate in radians.
    `ms` - The time the rotation will last, in milliseconds.
    `ce` - A CultEvent to be triggered when the rotation has come to a full stop.
  Throws:
    java.lang.IllegalArgumentException - if the given axix is invalid.
  Since:
    Cult3D 5.3
  See Also:
    `X`, `Y`, `Z`

### rotateDegrees

    public void rotateDegrees(int axis,
                              float amount,
                              double ms,
                              boolean loop)

  Smoothly rotates the object the given amount in degrees around the given axis in its own reference frame. The rotation will occur during the given amount of milliseconds. Any children linked to this object will be rotated as well. If the loop flag is true, the rotation will loop until stopped with the stopRotation() method.
  Parameters:
    `axis` - the axis to rotate around. Use the static varables X, Y, and Z defined in this class.
    `amount` - the amount to rotate in radians.
    `ms` - The time the rotation will last, in milliseconds.
  Throws:
    java.lang.IllegalArgumentException - if the given axix is invalid.
  Since:
    Cult3D 5.3
  See Also:
    `X`, `Y`, `Z`, `stopRotation()`

### stopRotation

    public void stopRotation()

  Stops any rotations this object is currently performing.
  Since:
    Cult3D 4.2

### getPosition

    public Vector3 getPosition(short refFrame)

  Gets the position of this node in the given reference frame.
  Parameters:
    `refFrame` - The reference frame, use the class variables WORLD or LOCAL
  Returns:
    The x, y, z position for this object relative to WORLD or LOCAL
  Since:
    Cult3D 4.2
  See Also:
    `Vector3`, `LOCAL`, `WORLD`

### setPosition

    public void setPosition(short refFrame,
                            Vector3 newPos)

  Sets the position for this node in the given reference frame.
  Parameters:
    `refFrame` - The reference frame, use the class variables WORLD or LOCAL
    `Vector3` - The position where the object is moved to in relation with the given reference frame
  Since:
    Cult3D 4.2
  See Also:
    `LOCAL`, `WORLD`

### worldToNode

    public Matrix4x4 worldToNode(Matrix4x4 worldcoord)

  Converts the given matrix from the world reference frame to the local reference frame.
  Parameters:
    `worldCoord` - The matrix which has been converted from world to local.
  Since:
    Cult3D 4.2

### nodeToWorld

    public Matrix4x4 nodeToWorld(Matrix4x4 nodecoord)

  Converts the given matrix from the local reference frame to the world reference frame.
  Parameters:
    `nodecoord` - The matrix which has been converted from local to world.
  Since:
    Cult3D 4.2

### getOrientation

    public Matrix4x4 getOrientation(short refFrame)

  Gets the orientation of this object relative to the given reference frame.
  Parameters:
    `refFrame` - WORLD or LOCAL for the reference frame. Use the class variables WORLD or LOCAL.
  Returns:
    The orientation of this object
  Since:
    Cult3D 4.2
  See Also:
    `LOCAL`, `WORLD`

### setOrientation

    public void setOrientation(short refFrame,
                               Matrix4x4 matrix)

  Sets the orientation of this object relative to the given reference frame.
  Parameters:
    `refFrame` - WORLD or LOCAL for the reference frame. Use the class variables WORLD and LOCAL.
    `matrix` - The matrix which contains the coordinates you want to set to this node.
  Since:
    Cult3D 4.2
  See Also:
    `LOCAL`, `WORLD`

### getTransform

    public Matrix4x4 getTransform(short refFrame)

  Gets the transform matrix for this object relative to the given reference frame.
  Parameters:
    `refFrame` - WORLD or LOCAL for the reference frame. Use the class variables WORLD and LOCAL.
  Since:
    Cult3D 4.2
  See Also:
    `LOCAL`, `WORLD`

### setTransform

    public void setTransform(short refFrame,
                             Matrix4x4 matrix)

  Sets the transform for this object relative to the given reference frame.
  Parameters:
    `refFrame` - WORLD or LOCAL for the reference frame. use the class variables WORLD and LOCAL.
    `matrix` - The matrix which contains the coordinates you want to set to this node.
  Since:
    Cult3D 4.2
  See Also:
    `LOCAL`, `WORLD`

### translate

    public void translate(float amountx,
                          float amounty,
                          float amountz)

  Translates the object in its own reference frame. The translation occurs immediately. Any children linked to this object will be translated as well.
  Parameters:
    `amountx` - the amount to translate along the x-axis.
    `amounty` - the amount to translate along the y-axis.
    `amountz` - the amount to translate along the z-axis.
  Since:
    Cult3D 4.0

### translate

    public void translate(float amountx,
                          float amounty,
                          float amountz,
                          double ms)

  Smoothly translates the object in its own reference frame. The translation will occur during the given amount of milliseconds. Any children linked to this object will be translated as well.
  Parameters:
    `amountx` - the amount to translate along the x-axis.
    `amounty` - the amount to translate along the y-axis.
    `amountz` - the amount to translate along the z-axis.
    `ms` - The time the rotation will last, in milliseconds.
  Since:
    Cult3D 4.2

### translate

    public void translate(float amountx,
                          float amounty,
                          float amountz,
                          double ms,
                          CultEvent ce)

  Smoothly translates the object in its own reference frame. The translation will occur during the given amount of milliseconds. Any children linked to this object will be translated as well. When the translation is finished, the given CultEvent will be triggered.
  Parameters:
    `amountx` - the amount to translate along x-axis.
    `amounty` - the amount to translate along y-axis.
    `amountz` - the amount to translate along z-axis.
    `ms` - time in miliseconds.
    `ce` - CultEvent to trigger vhen translation have finished.
  Since:
    Cult3D 4.2

### translate

    public void translate(float amountx,
                          float amounty,
                          float amountz,
                          double ms,
                          boolean loop)

  Smoothly translates the object in its own reference frame. The translation will occur during the given amount of milliseconds. Any children linked to this object will be translated as well. If loop variable is set to true, the translation will loop until stopped by the stopTranslation() method.
  Parameters:
    `amountx` - the amount to translate along the x-axis.
    `amounty` - the amount to translate along the y-axis.
    `amountz` - the amount to translate along the z-axis.
    `ms` - time in miliseconds.
    `loop` - loop flag, if true the translation will loop.
  Since:
    Cult3D 4.2

### stopTranslation

    public void stopTranslation()

  Stops any translations this object is currently performing.
  Since:
    Cult3D 4.2

### getFirstNode

    public static Node getFirstNode()

  Gets the first node of the scene graph. The first node in the scene graph is the first node at the highest level in the scene graph. The first node have no parent but it can have siblings and children. So to traverse the entire scene graph, both the children of this node, and its siblings must be traversed.
  Returns:
    the first node in the scene graph.
  Since:
    Cult3D 4.2

### addChildToRoot

    public static void addChildToRoot(Node child)

  Adds a node too the highest level in the scene graph.
  Parameters:
    `child` - the node to add to the scene graph.
  Since:
    Cult3D 4.2

### getParent

    public Node getParent()

  Gets the parent of this node. The nodes that lies directly under the scene graph root will return null.
  Returns:
    the parent node, or null if it has no parent.
  Since:
    Cult3D 4.2

### getNextSibling

    public Node getNextSibling()

  Gets the next sibling to this node. The next sibling to a node is the next node on the same level.
  Returns:
    the next sibling or null if no more siblings.
  Since:
    Cult3D 4.2

### getChildCount

    public int getChildCount()

  Returns the number of children of this node in the scene graph.
  Returns:
    the number of children of this node.
  Since:
    Cult3D 4.2

### getFirstChild

    public Node getFirstChild()

  Returns the first child to this node.
  Returns:
    the the first child to this node or null if there are no children.
  Since:
    Cult3D 4.2

### getChildAt

    public Node getChildAt(int index)

  Returns the child at the specified index.
  Parameters:
    `index` - The index number the child has in the scene graph.
  Returns:
    the child Node at the specified index.
  Throws:
    IndexOutOfBoundsException - If the node for the index could not be found.
  Since:
    Cult3D 4.2

### disconnect

    public void disconnect()

  Disconnects a node from the scene graph. A disconnected node and it's children are no longer rendered. A disconnected node can be attached to another node in the graph.
  Since:
    Cult3D 4.2

### addChild

    public void addChild(Node child)

  Attaches a node as a child to this node. The Attached node is disconnected from the scene graph before its attached to the new node.
  Parameters:
    `child` - a node to add as a child.
  Since:
    Cult3D 4.2

### getName

    public java.lang.String getName()

  Returns the Name of this node.
  Returns:
    the Name of this node.
  Since:
    Cult3D 4.2

### setName

    public void setName(java.lang.String name)

  Changes the name of this node to the name given as parameter
  Parameters:
    `name` - the new name.
  Since:
    Cult3D 4.2

### equals

    public boolean equals(java.lang.Object obj)

  Compares two Nodes for equality.
  Overrides:
    equals in class java.lang.Object
  Parameters:
    `obj` - the reference object with which to compare.
  Returns:
    true if this object reference to the same node as the obj argument, false otherwise.
  Since:
    Cult3D 4.2

### setVisible

    public void setVisible(boolean state)

  Shows or hides this object depending on the value of parameter `state`.
  Parameters:
    `state` - If `true` shows this object, if `false` hide this object.
  Since:
    Cult3D 4.2
  See Also:
    `isVisible()`

### setVisible

    public void setVisible(boolean visibleState,
                           boolean applyToChildren)

  Shows or hides this object depending on the value of parameter.
  Parameters:
    `state` - If `true` shows this object, if `false` hide this object.
    `applyToChildren` - If `true` all child to this object will be hidden/visible, if `false` only this object will be hidden/visible
  Since:
    Cult3D 5.3
  See Also:
    `isVisible()`

### isVisible

    public boolean isVisible()

  Determines whether this object is visible.
  Returns:
    `true` if the object is visible, `false` otherwise.
  Since:
    Cult3D 4.2
  See Also:
    `setVisible(boolean)`

### setBoundingBoxVisible

    public void setBoundingBoxVisible(boolean state)

  Shows or hides this objects boundingbox depending on the value of parameter `state`.
  Parameters:
    `state` - If true the bounding box will be shown, if false the boundingbox will be hidden.
  Since:
    Cult3D 4.2
  See Also:
    `isBoundingBoxVisible()`

### isBoundingBoxVisible

    public boolean isBoundingBoxVisible()

  Determines whether this objects boundingbox is visible.
  Returns:
    `true` if the objects boundingbox is visible; `false` otherwise.
  Since:
    Cult3D 4.2
  See Also:
    `setBoundingBoxVisible(boolean)`

### getInfo

    public java.lang.String getInfo()

  Returns a string representation of the values of this object.

  This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D.

  Returns:
    A string representing this object.
  Since:
    Cult3D 5.3

### toString

    public java.lang.String toString()

  Returns a string representation of the values of this object.

  The string contains the name of this class and the name of this node

  .

  This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D.

  Overrides:
    toString in class java.lang.Object
  Returns:
    A string representing this object.

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD