Package engine.entities
Class Camera
java.lang.Object
engine.entities.Entity
engine.entities.Camera
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.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCamera
(org.joml.Vector3f position) Constructor which sets initial position and rotation -
Method Summary
Modifier and TypeMethodDescriptionvoid
Calculate the pitch based on the mouse moving vertically on the mousepad when right mouse button is clicked.void
Calculate the rotation based on the mouse moving horizontally on the mousepad when the right mouse button is clicked.void
Calculates the zoom factor based on the scroll wheelfloat
getPitch()
org.joml.Vector3f
float
getYaw()
void
move()
Called by the rendered every frame Rotation, Speed and distance of movement is calculated in this method.Methods inherited from class engine.entities.Entity
getModel, getRotX, getRotY, getRotZ, getScale, increasePosition, increaseRotation, setModel, setPosition, setRotX, setRotY, setRotZ, setScale
-
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 classEntity
- 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.
-