Class CameraPath

java.lang.Object
gaiasky.util.camera.rec.CameraPath

public class CameraPath extends Object
Contains the in-memory data for a specific camera path.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Contains the position (3), direction (3) and up (3) values for each step.
    double
    Optional frame rate.
    long
    Current step number.
    long
    Number of steps in the current path.
    final com.badlogic.gdx.utils.Array<Instant>
    Contains the time as a long timestamp for each step.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CameraPath(double targetFps)
    Create an empty camera path.
    Create a camera path from a .gsc file.
    Create a camera path from a list of keyframes and its respective array of path parts.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(Instant time, double px, double py, double pz, double dx, double dy, double dz, double ux, double uy, double uz)
    Add a new time step at the end of the path.
    void
    Persist the current camera path to the file pointed by the given path.

    Methods inherited from class java.lang.Object

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

    • n

      public long n
      Number of steps in the current path.
    • times

      public final com.badlogic.gdx.utils.Array<Instant> times
      Contains the time as a long timestamp for each step.
    • data

      public final DoubleArray data
      Contains the position (3), direction (3) and up (3) values for each step.
    • frameRate

      public double frameRate
      Optional frame rate. If < 0, it is considered uncapped.
    • i

      public long i
      Current step number.
  • Constructor Details

    • CameraPath

      public CameraPath(double targetFps)
      Create an empty camera path.
    • CameraPath

      public CameraPath(InputStream file) throws RuntimeException
      Create a camera path from a .gsc file.
      Parameters:
      file - The file.
      Throws:
      RuntimeException - If the file can't be read, is not in the right format, or does not exist.
    • CameraPath

      public CameraPath(List<Keyframe> keyframes, KeyframesManager.PathPart[] posSplines)
      Create a camera path from a list of keyframes and its respective array of path parts.
      Parameters:
      keyframes - Array of keyframes.
      posSplines - Array of path parts.
  • Method Details

    • add

      public void add(Instant time, double px, double py, double pz, double dx, double dy, double dz, double ux, double uy, double uz)
      Add a new time step at the end of the path.
      Parameters:
      time - The time, as an Instant.
      px - The x-position.
      py - The y-position.
      pz - The z-position.
      dx - The x-direction.
      dy - The y-direction.
      dz - The z-direction.
      ux - The x-up.
      uy - The y-up.
      uz - The z-up.
    • persist

      public void persist(Path f) throws Exception
      Persist the current camera path to the file pointed by the given path.
      Parameters:
      f - The path of the file.
      Throws:
      RuntimeException - If the path does not point to a file, or the file could not be written.
      Exception