Class PerspectiveCamera

java.lang.Object
rosequartz.gfx.Camera<PerspectiveCamera>
rosequartz.gfx.PerspectiveCamera
All Implemented Interfaces:
Serializable, Cloneable, CameraConfiguration.CameraConfigurationHolder

public final class PerspectiveCamera extends Camera<PerspectiveCamera> implements Serializable
Represents a camera with a symmetrical perspective projection, primarily used in 3D games. Objects that are closer to the camera appear bigger, while objects that are further away appear smaller.
See Also:
Serialized Form
  • Field Details

    • fov

      public float fov
    • aspectRatio

      public float aspectRatio
  • Constructor Details

    • PerspectiveCamera

      public PerspectiveCamera(CameraConfiguration configuration)
      Creates a new PerspectiveCamera from a CameraConfiguration
      Parameters:
      configuration - configuration of the camera
  • Method Details

    • setFieldOfView

      public PerspectiveCamera setFieldOfView(float fovRad)
      Sets the field of view (FOV) of the camera IN RADIANS. The default fov is PI/2 radians.
      Parameters:
      fovRad - the angle between the left and right borders of the camera IN RADIANS
      Returns:
      this
    • setFieldOfViewDegrees

      public PerspectiveCamera setFieldOfViewDegrees(float fovDeg)
      Sets the field of view (FOV) of the camera IN DEGREES. The default fov is 45 degrees.
      Parameters:
      fovDeg - the angle between the left and right borders of the camera IN DEGREES
      Returns:
      this
    • setAspectRatio

      public PerspectiveCamera setAspectRatio(float aspectRatio)
      Sets the aspect ratio of the camera. The default aspect ratio is 1:1.
      Parameters:
      aspectRatio - aspect ratio
      Returns:
      this
    • setAspectRatio

      public PerspectiveCamera setAspectRatio(float width, float height)
      Sets the aspect ratio of the camera from width and height. The default aspect ratio is 1:1.
      Parameters:
      width - width of the camera
      height - height of the camera
      Returns:
      this
    • getProjectionMatrix

      public Mat4 getProjectionMatrix()
      Description copied from class: Camera
      Calculates the projection matrix for the current values of the camera.
      Specified by:
      getProjectionMatrix in class Camera<PerspectiveCamera>
      Returns:
      projection matrix
    • clone

      public PerspectiveCamera clone()
      Specified by:
      clone in class Camera<PerspectiveCamera>
    • toString

      public String toString()
      Overrides:
      toString in class Object