Package foundry.veil.api.client.render
Class CameraMatrices
java.lang.Object
foundry.veil.api.client.render.CameraMatrices
Packages all camera matrices and shader uniforms to make shader management easier.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic VeilShaderBufferLayout
<CameraMatrices> org.joml.Vector3f
org.joml.Vector3f
float
org.joml.Matrix4f
org.joml.Matrix4f
org.joml.Matrix3f
float
org.joml.Matrix4f
org.joml.Matrix4f
void
setFarPlane
(float farPlane) Sets the far plane of the projection matrix.void
setNearPlane
(float nearPlane) Sets the near plane of the projection matrix.void
update
(org.joml.Matrix4fc projection, org.joml.Matrix4fc modelView, org.joml.Vector3dc pos, float zNear, float zFar) Updates the camera matrices to match the specified camera object.void
Updates the camera matrices to match the current render system projection.
-
Constructor Details
-
CameraMatrices
public CameraMatrices()Creates a new set of camera matrices.
-
-
Method Details
-
createLayout
-
update
public void update(org.joml.Matrix4fc projection, org.joml.Matrix4fc modelView, org.joml.Vector3dc pos, float zNear, float zFar) Updates the camera matrices to match the specified camera object.- Parameters:
projection
- The projection of the cameramodelView
- The modelview rotation of the camerapos
- The position of the camerazNear
- The near clipping plane of the camerazFar
- The far clipping plane of the camera
-
updateGui
public void updateGui()Updates the camera matrices to match the current render system projection. -
getProjectionMatrix
public org.joml.Matrix4f getProjectionMatrix()- Returns:
- The current projection matrix of the camera
-
getInverseProjectionMatrix
public org.joml.Matrix4f getInverseProjectionMatrix()- Returns:
- The inverse matrix of
getProjectionMatrix()
-
getViewMatrix
public org.joml.Matrix4f getViewMatrix()- Returns:
- The current view matrix of the camera. This only includes rotation
-
getInverseViewMatrix
public org.joml.Matrix4f getInverseViewMatrix()- Returns:
- The inverse matrix of
getViewMatrix()
-
getInverseViewRotMatrix
public org.joml.Matrix3f getInverseViewRotMatrix()- Returns:
- The inverse view matrix with only rotation. This is stored as a mat4 to have the correct padding in GLSL
-
getCameraPosition
public org.joml.Vector3f getCameraPosition()- Returns:
- The position of the camera in world space
-
getCameraBobOffset
public org.joml.Vector3f getCameraBobOffset()- Returns:
- The world-space offset of the camera due to camera bob
-
getNearPlane
public float getNearPlane()- Returns:
- The near clipping plane of the frustum
-
getFarPlane
public float getFarPlane()- Returns:
- The far clipping plane of the frustum
-
setNearPlane
public void setNearPlane(float nearPlane) Sets the near plane of the projection matrix.- Parameters:
nearPlane
- The new near-plane value
-
setFarPlane
public void setFarPlane(float farPlane) Sets the far plane of the projection matrix.- Parameters:
farPlane
- The new far-plane value
-