Package foundry.veil.api.client.render
Class CameraMatrices
java.lang.Object
foundry.veil.api.client.render.CameraMatrices
- All Implemented Interfaces:
AutoCloseable
,org.lwjgl.system.NativeResource
Packages all camera matrices and shader uniforms to make shader management easier.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
free()
org.joml.Vector3fc
float
org.joml.Matrix4fc
org.joml.Matrix4fc
org.joml.Matrix3f
float
org.joml.Matrix4fc
org.joml.Matrix4fc
void
unbind()
Unbinds this shader block.void
update
(org.joml.Matrix4fc projection, org.joml.Matrix4fc modelView, org.joml.Vector3fc 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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.lwjgl.system.NativeResource
close
-
Constructor Details
-
CameraMatrices
public CameraMatrices()Creates a new set of camera matrices.
-
-
Method Details
-
update
public void update(org.joml.Matrix4fc projection, org.joml.Matrix4fc modelView, org.joml.Vector3fc 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. -
unbind
public void unbind()Unbinds this shader block. -
getProjectionMatrix
public org.joml.Matrix4fc getProjectionMatrix()- Returns:
- The current projection matrix of the camera
-
getInverseProjectionMatrix
public org.joml.Matrix4fc getInverseProjectionMatrix()- Returns:
- The inverse matrix of
getProjectionMatrix()
-
getViewMatrix
public org.joml.Matrix4fc getViewMatrix()- Returns:
- The current view matrix of the camera. This only includes rotation
-
getInverseViewMatrix
public org.joml.Matrix4fc 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.Vector3fc getCameraPosition()- Returns:
- The position of the camera in world space
-
getNearPlane
public float getNearPlane()- Returns:
- The near clipping plane of the frustum
-
getFarPlane
public float getFarPlane()- Returns:
- The far clipping plane of the frustum
-
free
public void free()- Specified by:
free
in interfaceorg.lwjgl.system.NativeResource
-