Class CameraNode

All Implemented Interfaces:
Hintable, Savable

public class CameraNode extends Node
Defines a node that manages a Camera object, allowing it to be part of a scenegraph. The updateWorldTransform method is overridden to adjust the managed camera's location and orientation using this Node's world translation and the world rotation. The column 0 of the world rotation matrix is used for the camera left vector, column 1 is used for the camera up vector, column 2 is used for the camera direction vector.
  • Constructor Details

    • CameraNode

      public CameraNode()
    • CameraNode

      public CameraNode(String name, Camera camera)
      Constructor instantiates a new CameraNode object setting the camera to use for the frame reference.
      Parameters:
      name - the name of the scene element. This is required for identification and comparison purposes.
      camera - the camera this node controls.
  • Method Details

    • updateFromCamera

      public void updateFromCamera()
      Forces rotation and translation of this node to be sync'd with the attached camera. (Assumes the node is in world space.)
    • setCamera

      public void setCamera(Camera camera)
      setCamera sets the camera that this node controls.
      Parameters:
      camera - the camera that this node controls.
    • getCamera

      public Camera getCamera()
      getCamera retrieves the camera object that this node controls.
      Returns:
      the camera this node controls.
    • updateWorldTransform

      public void updateWorldTransform(boolean recurse)
      updateWorldTransform updates the rotation and translation of this node, and sets the camera's frame buffer to reflect the current view.
      Overrides:
      updateWorldTransform in class Node
      Parameters:
      recurse - usually false when updating the tree. Set to true when you just want to update the world transforms for a branch without updating geometric state.
    • write

      public void write(OutputCapsule capsule) throws IOException
      Specified by:
      write in interface Savable
      Overrides:
      write in class Node
      Parameters:
      capsule - the capsule
      Throws:
      IOException - Signals that an I/O exception has occurred.
      See Also:
    • read

      public void read(InputCapsule capsule) throws IOException
      Specified by:
      read in interface Savable
      Overrides:
      read in class Node
      Parameters:
      capsule - the input capsule
      Throws:
      IOException - Signals that an I/O exception has occurred.
      See Also: