Package graphics
Class Camera
java.lang.Object
graphics.Camera
Azurite
Represents a basic camera. The purpose of a digital camera capturing a digital point of view is to translate the 3D locations in game onto the 2 dimensions of your monitor (if you come from the future with holograms in it, Hi! welcome to the past!) The camera does so by way of linear algebra; points in 3D space can be projected onto a 2D plane using matrix transformations.Specifically, the digital camera used in this engine is composed of two matrices: the projection and the view matrices. The projection matrix is used to define an in game width and height to your perspective by defining how many in-game coordinate units can be seen horizontally and vertically on your monitor. The view matrix defines the direction and orientation of the camera; it's usually the matrix defined in terms of camera position, pitch, and yaw.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCamera()Creates a new Camera positioned at (0, 0) Projection matrix is set to default: 0 to Window's width from left to right, 0 to Window's height from top to bottomCamera(org.joml.Vector2f position) Creates a new Camera with a certain position Projection matrix is set to default: 0 to Window's width from left to right, 0 to Window's height from top to bottom -
Method Summary
Modifier and TypeMethodDescriptionvoidRecalculate Projection Matrixorg.joml.Vector2fGet the camera's positionorg.joml.Matrix4fGet the camera's projection matrixorg.joml.Matrix4fRecalculates and returns the view marixvoidsmoothFollow(org.joml.Vector2f c) Smoothly center the camera on to a transform
-
Field Details
-
position
public org.joml.Vector2f positionPosition of the camera
-
-
Constructor Details
-
Camera
public Camera(org.joml.Vector2f position) Creates a new Camera with a certain position Projection matrix is set to default: 0 to Window's width from left to right, 0 to Window's height from top to bottom- Parameters:
position- initial position
-
Camera
public Camera()Creates a new Camera positioned at (0, 0) Projection matrix is set to default: 0 to Window's width from left to right, 0 to Window's height from top to bottom
-
-
Method Details
-
adjustProjection
public void adjustProjection()Recalculate Projection Matrix -
getViewMatrix
public org.joml.Matrix4f getViewMatrix()Recalculates and returns the view marix -
getProjectionMatrix
public org.joml.Matrix4f getProjectionMatrix()Get the camera's projection matrix -
smoothFollow
public void smoothFollow(org.joml.Vector2f c) Smoothly center the camera on to a transform -
getPosition
public org.joml.Vector2f getPosition()Get the camera's position
-