Class Camera


public class Camera extends Entity
Camera class uses the positional data and methods of the Entity to store its position in the 3D world This class handles the movement of the Camera as well as its speed of movement and direction Uses the mouse and keyboard class to check the key callbacks for movement.
  • Constructor Details

    • Camera

      public Camera(org.joml.Vector3f position)
      Constructor which sets initial position and rotation
      Parameters:
      position -
  • Method Details

    • move

      public void move()
      Called by the rendered every frame Rotation, Speed and distance of movement is calculated in this method. Camera Position is then set at the end which is what modifies the ViewMatrix in the shaders
    • getPosition

      public org.joml.Vector3f getPosition()
      Overrides:
      getPosition in class Entity
      Returns:
      3D position of the Camera
    • getPitch

      public float getPitch()
      Returns:
      Pitch of the Camera
    • getYaw

      public float getYaw()
      Returns:
      the yaw of the camera (Rotation)
    • calculateZoom

      public void calculateZoom()
      Calculates the zoom factor based on the scroll wheel
    • calculatePitch

      public void calculatePitch()
      Calculate the pitch based on the mouse moving vertically on the mousepad when right mouse button is clicked.
    • calculateRotation

      public void calculateRotation()
      Calculate the rotation based on the mouse moving horizontally on the mousepad when the right mouse button is clicked.