Class CameraMatrices

java.lang.Object
foundry.veil.api.client.render.CameraMatrices

public class CameraMatrices extends Object
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

    • createLayout

      public static VeilShaderBufferLayout<CameraMatrices> 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 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.
    • 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