Class CameraMatrices

java.lang.Object
foundry.veil.api.client.render.CameraMatrices
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource

public class CameraMatrices extends Object implements org.lwjgl.system.NativeResource
Packages all camera matrices and shader uniforms to make shader management easier.
  • 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 camera
      modelView - The modelview rotation of the camera
      pos - The position of the camera
      zNear - The near clipping plane of the camera
      zFar - 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 interface org.lwjgl.system.NativeResource