Class AdvancedFbo.Builder

java.lang.Object
foundry.veil.api.client.render.framebuffer.AdvancedFbo.Builder
Enclosing interface:
AdvancedFbo

public static class AdvancedFbo.Builder extends Object
A builder used to attach buffers to an AdvancedFbo.
Since:
2.4.0
See Also:
  • Constructor Details

    • Builder

      public Builder(int width, int height)
      Creates a new builder of the specified size.
      Parameters:
      width - The width of the framebuffer
      height - The height of the framebuffer
  • Method Details

    • addAttachments

      public AdvancedFbo.Builder addAttachments(AdvancedFbo parent)
      Adds copies of the buffers inside the specified fbo.
      Parameters:
      parent - The parent to add the attachments for
    • addAttachments

      public AdvancedFbo.Builder addAttachments(com.mojang.blaze3d.pipeline.RenderTarget parent)
      Adds copies of the buffers inside the specified fbo.
      Parameters:
      parent - The parent to add the attachments for
    • setMipmaps

      public AdvancedFbo.Builder setMipmaps(int mipmaps)
      Sets the number of mipmaps levels to use for texture attachments. 0 is the default for none.
      Parameters:
      mipmaps - The levels to have
    • setSamples

      public AdvancedFbo.Builder setSamples(int samples)
      Sets the number of samples to use for render buffer attachments. 1 is the default for single sample buffers.
      Parameters:
      samples - The samples to have
    • setFormat

      Sets the format to use for texture attachments.
      Parameters:
      format - The new format to use
    • setFormat

      public AdvancedFbo.Builder setFormat(int format, int internalFormat)
      Sets the format to use for texture attachments. GL11.GL_RGBA is the default.
      Parameters:
      format - The new format to use
      internalFormat - The new internal format to use
    • setLinear

      public AdvancedFbo.Builder setLinear(boolean linear)
      Sets the sampling mode for textures.
      Parameters:
      linear - Whether linear filtering should be used
    • setName

      public AdvancedFbo.Builder setName(@Nullable @Nullable String name)
      Sets the uniform name for textures.
      Parameters:
      name - The custom name to use for the sampler in shaders
    • addColorBuffer

      public AdvancedFbo.Builder addColorBuffer(AdvancedFboAttachment attachment)
      Adds the specified color attachment.
      Parameters:
      attachment - The attachment to add
    • addColorTextureWrapper

      public AdvancedFbo.Builder addColorTextureWrapper(int textureId, int width, int height)
      Adds the specified texture as a 2D texture attachment.
      Parameters:
      textureId - The id of the texture to add
      width - The width of the texture
      height - The height of the texture
    • addColorTextureWrapper

      public AdvancedFbo.Builder addColorTextureWrapper(int textureId, int textureTarget, int width, int height)
      Adds the specified texture as a texture attachment.
      Parameters:
      textureId - The id of the texture to add
      textureTarget - The target to use for the texture
      width - The width of the texture
      height - The height of the texture
    • addColorTextureBuffer

      public AdvancedFbo.Builder addColorTextureBuffer()
      Adds a color texture buffer with the size of the framebuffer and GL_UNSIGNED_BYTE as the format.
    • addColorTextureBuffer

      public AdvancedFbo.Builder addColorTextureBuffer(int width, int height)
      Adds a color texture buffer with the specified size and GL_UNSIGNED_BYTE as the format.
      Parameters:
      width - The width of the texture buffer
      height - The height of the texture buffer
    • addColorTextureBuffer

      public AdvancedFbo.Builder addColorTextureBuffer(int dataType)
      Adds a color texture buffer with the specified data type.
      Parameters:
      dataType - The format of the data internally
    • addColorTextureBuffer

      public AdvancedFbo.Builder addColorTextureBuffer(int width, int height, int dataType)
      Adds a color texture buffer with the specified size and data type.
      Parameters:
      width - The width of the texture buffer
      height - The height of the texture buffer
      dataType - The format of the data internally
    • addColorRenderBuffer

      public AdvancedFbo.Builder addColorRenderBuffer()

      Adds a color render buffer with the size of the framebuffer and 1 sample.

      NOTE: COLOR RENDER BUFFERS CAN ONLY BE COPIED TO OTHER FRAMEBUFFERS

    • addColorRenderBuffer

      public AdvancedFbo.Builder addColorRenderBuffer(int width, int height)

      Adds a color render buffer with the specified size and the specified samples.

      NOTE: COLOR RENDER BUFFERS CAN ONLY BE COPIED TO OTHER FRAMEBUFFERS

      Parameters:
      width - The width of the render buffer
      height - The height of the render buffer
    • setDepthBuffer

      public AdvancedFbo.Builder setDepthBuffer(@Nullable @Nullable AdvancedFboAttachment attachment)
      Sets the depth buffer to the specified attachment.
      Parameters:
      attachment - The attachment to add
    • setDepthTextureWrapper

      public AdvancedFbo.Builder setDepthTextureWrapper(int textureId, int width, int height)
      Adds the specified texture as a 2D texture attachment.
      Parameters:
      textureId - The id of the texture to add
      width - The width of the texture
      height - The height of the texture
    • setDepthTextureWrapper

      public AdvancedFbo.Builder setDepthTextureWrapper(int textureId, int textureTarget, int width, int height)
      Adds the specified texture as a texture attachment.
      Parameters:
      textureId - The id of the texture to add
      textureTarget - The target to use for the texture
      width - The width of the texture
      height - The height of the texture
    • setDepthTextureBuffer

      public AdvancedFbo.Builder setDepthTextureBuffer()
      Sets the depth texture buffer to the size of the framebuffer and GL_FLOAT as the format.
    • setDepthTextureBuffer

      public AdvancedFbo.Builder setDepthTextureBuffer(int width, int height)
      Sets the depth texture buffer to the specified size and GL_FLOAT as the format.
      Parameters:
      width - The width of the texture buffer
      height - The height of the texture buffer
    • setDepthTextureBuffer

      public AdvancedFbo.Builder setDepthTextureBuffer(int dataType)
      Sets the depth texture buffer to the size of the framebuffer and specified data type.
      Parameters:
      dataType - The format of the data internally
    • setDepthTextureBuffer

      public AdvancedFbo.Builder setDepthTextureBuffer(int width, int height, int dataType)
      Sets the depth texture buffer to the specified size and data type.
      Parameters:
      width - The width of the texture buffer
      height - The height of the texture buffer
      dataType - The format of the data internally
    • setDepthRenderBuffer

      public AdvancedFbo.Builder setDepthRenderBuffer()

      Sets the depth texture buffer to the size of the framebuffer and 1 sample.

      NOTE: DEPTH RENDER BUFFERS CAN ONLY BE COPIED TO OTHER FRAMEBUFFERS

    • setDepthRenderBuffer

      public AdvancedFbo.Builder setDepthRenderBuffer(int width, int height)

      Sets the depth texture buffer to the specified size and the specified samples.

      NOTE: DEPTH RENDER BUFFERS CAN ONLY BE COPIED TO OTHER FRAMEBUFFERS

      Parameters:
      width - The width of the render buffer
      height - The height of the render buffer
    • build

      public AdvancedFbo build(boolean create)
      Constructs a new AdvancedFbo with the specified attachments.
      Parameters:
      create - Whether to immediately create the buffer
      Returns:
      A new AdvancedFbo with the specified builder properties.