Class CameraConfiguration

java.lang.Object
rosequartz.gfx.CameraConfiguration
All Implemented Interfaces:
Serializable, Cloneable

public class CameraConfiguration extends Object implements Serializable, Cloneable
Represents the position and orientation of a camera or audio listener.
See Also:
Serialized Form
  • Constructor Details

    • CameraConfiguration

      public CameraConfiguration()
      Creates a new CameraConfiguration at [0, 0, 0] looking at the point [0, 0, -1] with [0, 1, 0] pointing 'up'.
    • CameraConfiguration

      public CameraConfiguration(CameraConfiguration source)
      Creates a new CameraConfiguration from another camera configuration to copy its values from.
  • Method Details

    • setPosition

      public CameraConfiguration setPosition(float x, float y, float z)
      Sets the position.
      Parameters:
      x - position on the x-axis
      y - position on the y-axis
      z - position on the z-axis
      Returns:
      this
    • setPosition

      public CameraConfiguration setPosition(Vec3 xyz)
      Sets the position.
      Parameters:
      xyz - position
      Returns:
      this
    • setPositionRelative

      public CameraConfiguration setPositionRelative(float dx, float dy, float dz)
      Sets the position relative to the current position.
      Parameters:
      dx - position difference on the x-axis
      dy - position difference on the y-axis
      dz - position difference on the z-axis
      Returns:
      this
    • setPositionRelative

      public CameraConfiguration setPositionRelative(Vec3 dxyz)
      Sets the position relative to the current position.
      Parameters:
      dxyz - position difference
      Returns:
      this
    • getPositionX

      public float getPositionX()
      Gets the position on the x-axis.
      Returns:
      position on the x-axis
    • getPositionY

      public float getPositionY()
      Gets the position on the y-axis.
      Returns:
      position on the y-axis
    • getPositionZ

      public float getPositionZ()
      Gets the position on the z-axis.
      Returns:
      position on the z-axis
    • getPosition

      public Vec3 getPosition()
      Gets the position.
      Returns:
      position
    • setLookAt

      public CameraConfiguration setLookAt(float x, float y, float z)
      Sets the configuration to look at a given point (aligns -z to go through the point). The camera looks at [0, 0, -1] by default.
      Parameters:
      x - position of the point to look at on the x-axis
      y - position of the point to look at on the y-axis
      z - position of the point to look at on the z-axis
      Returns:
      this
    • setLookAt

      public CameraConfiguration setLookAt(Vec3 xyz)
      Sets the configuration to look at a given point (aligns -z to go through the point). The camera looks at [0, 0, -1] by default.
      Parameters:
      xyz - position of the point to look at
      Returns:
      this
    • setLookAt

      public CameraConfiguration setLookAt(float x, float y, float z, float upX, float upY, float upZ)
      Sets the configuration to look at a given point (aligns -z to go through the point), with a given vector pointing where 'up' is. The camera looks at [0, 0, -1] by default, with [0, 1, 0] being 'up'. 'up' does not need to be normalized nor be perpendicular to the vector the configuration looks in. For most use cases, [0, 1, 0] is a good value (that's why it is the default).
      Parameters:
      x - position of the point to look at on the x-axis
      y - position of the point to look at on the y-axis
      z - position of the point to look at on the z-axis
      upX - x-axis of a vector pointing 'up'
      upY - y-axis of a vector pointing 'up'
      upZ - z-axis of a vector pointing 'up'
      Returns:
      this
    • setLookAt

      public CameraConfiguration setLookAt(Vec3 xyz, Vec3 up)
      Sets the configuration to look at a given point (aligns -z to go through the point), with a given vector pointing where 'up' is. The camera looks at [0, 0, -1] by default, with [0, 1, 0] being 'up'. 'up' does not need to be normalized nor be perpendicular to the vector the configuration looks in. For most use cases, [0, 1, 0] is a good value (that's why it is the default).
      Parameters:
      xyz - position of the point to look at
      up - vector pointing 'up'
      Returns:
      this
    • setLookIn

      public CameraConfiguration setLookIn(float x, float y, float z)
      Sets the configuration to look in the direction of a given vector. The camera looks in the direction of [0, 0, -1] by default.
      Parameters:
      x - x-axis of a vector pointing in the direction to look in
      y - y-axis of a vector pointing in the direction to look in
      z - z-axis of a vector pointing in the direction to look in
      Returns:
      this
    • setLookIn

      public CameraConfiguration setLookIn(Vec3 xyz)
      Sets the configuration to look in the direction of a given vector. The camera looks in the direction of [0, 0, -1] by default.
      Parameters:
      xyz - vector pointing in the direction to look in
      Returns:
      this
    • setLookIn

      public CameraConfiguration setLookIn(float x, float y, float z, float upX, float upY, float upZ)
      Sets the configuration to look in the direction of a given vector, with a given vector pointing where 'up' is. The camera looks in the direction of [0, 0, -1] by default, with [0, 1, 0] being 'up'. 'up' does not need to be normalized nor be perpendicular to the vector the configuration looks in. For most use cases, [0, 1, 0] is a good value (that's why it is the default).
      Parameters:
      x - x-axis of a vector pointing in the direction to look in
      y - y-axis of a vector pointing in the direction to look in
      z - z-axis of a vector pointing in the direction to look in
      upX - x-axis of a vector pointing 'up'
      upY - y-axis of a vector pointing 'up'
      upZ - z-axis of a vector pointing 'up'
      Returns:
      this
    • setLookIn

      public CameraConfiguration setLookIn(Vec3 xyz, Vec3 up)
      Sets the configuration to look in the direction of a given vector, with a given vector pointing where 'up' is. The camera looks in the direction of [0, 0, -1] by default, with [0, 1, 0] being 'up'. 'up' does not need to be normalized nor be perpendicular to the vector the configuration looks in. For most use cases, [0, 1, 0] is a good value (that's why it is the default).
      Parameters:
      xyz - x-vector pointing in the direction to look in
      up - vector pointing 'up'
      Returns:
      this
    • setLookUp

      public CameraConfiguration setLookUp(float upX, float upY, float upZ)
      Sets the direction of 'up' to a given vector. 'up' does not need to be normalized nor be perpendicular to the vector the configuration looks in. For most use cases, [0, 1, 0] is a good value (that's why it is the default).
      Parameters:
      upX - x-axis of a vector pointing 'up'
      upY - y-axis of a vector pointing 'up'
      upZ - z-axis of a vector pointing 'up'
      Returns:
      this
    • setLookUp

      public CameraConfiguration setLookUp(Vec3 xyz)
      Sets the direction of 'up' to a given vector. 'up' does not need to be normalized nor be perpendicular to the vector the configuration looks in. For most use cases, [0, 1, 0] is a good value (that's why it is the default).
      Parameters:
      xyz - vector pointing 'up'
      Returns:
      this
    • getLookInX

      public float getLookInX()
      Returns the x-axis of a vector describing where the configuration is looking.
      Returns:
      lookInX-value
    • getLookInY

      public float getLookInY()
      Returns the y-axis of a vector describing where the configuration is looking.
      Returns:
      lookInY-value
    • getLookInZ

      public float getLookInZ()
      Returns the z-axis of a vector describing where the configuration is looking.
      Returns:
      lookInZ-value
    • getLookIn

      public Vec3 getLookIn()
      Returns a vector describing where the configuration is looking.
      Returns:
      lookIn-value
    • getLookAtX

      public float getLookAtX()
      Returns the x-axis of a point that the configuration is looking at.
      Returns:
      lookAtX-value
    • getLookAtY

      public float getLookAtY()
      Returns the y-axis of a point that the configuration is looking at.
      Returns:
      lookAtY-value
    • getLookAtZ

      public float getLookAtZ()
      Returns the z-axis of a point that the configuration is looking at.
      Returns:
      lookAtZ-value
    • getLookAt

      public Vec3 getLookAt()
      Returns a point that the configuration is looking at.
      Returns:
      lookAt-value
    • getLookUpX

      public float getLookUpX()
      Returns the x-axis of a vector describing where 'up' is relative to the camera.
      Returns:
      x-axis of a vector pointing 'up'
    • getLookUpY

      public float getLookUpY()
      Returns the y-axis of a vector describing where 'up' is relative to the camera.
      Returns:
      y-axis of a vector pointing 'up'
    • getLookUpZ

      public float getLookUpZ()
      Returns the z-axis of a vector describing where 'up' is relative to the camera.
      Returns:
      z-axis of a vector pointing 'up'
    • getLookUp

      public Vec3 getLookUp()
      Returns a vector describing where 'up' is relative to the camera.
      Returns:
      vector pointing 'up'
    • copyValues

      public CameraConfiguration copyValues(CameraConfiguration source)
      Copies the values of a given configuration into this.
      Parameters:
      source - configuration to copy values from
      Returns:
      this
    • clone

      public CameraConfiguration clone()
      Overrides:
      clone in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object