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
    • setLevels

      public AdvancedFbo.Builder setLevels(int levels)
      Sets the number of samples to use for render buffer and texture attachments. 1 is the default for single sample buffers.
      Parameters:
      levels - 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. GL11C.GL_RGBA is the default.
      Parameters:
      format - The new format to use
      internalFormat - The new internal format to use
    • setFilter

      public AdvancedFbo.Builder setFilter(boolean blur, boolean mipmap)
      Sets the sampling mode for textures.
      Parameters:
      blur - Whether linear filtering should be used
      mipmap - Whether the framebuffer has any mipmaps that should be respected
    • setAnisotropy

      public AdvancedFbo.Builder setAnisotropy(float anisotropy)
      Sets the anisotropic filtering value. Set to Float.MAX_VALUE to set to the platform maximum.
      Parameters:
      anisotropy - The value to use. Any value >1 is considered to be enabled
    • setCompareFunction

      public AdvancedFbo.Builder setCompareFunction(@Nullable TextureFilter.CompareFunction compareFunction)
      Sets the compare function to use. Only valid for depth textures.
      Parameters:
      compareFunction - The compare function to use
    • setWrapS

      public AdvancedFbo.Builder setWrapS(TextureFilter.Wrap wrapS)
      Sets the clamping for the X axis on the texture.
      Parameters:
      wrapS - The wrap mode
    • setWrapS

      public AdvancedFbo.Builder setWrapS(int wrapS)
      Sets the clamping for the X axis on the texture.
      Parameters:
      wrapS - The wrap mode
    • setWrapT

      public AdvancedFbo.Builder setWrapT(TextureFilter.Wrap wrapT)
      Sets the clamping for the Y axis on the texture.
      Parameters:
      wrapT - The wrap mode
    • setWrapT

      public AdvancedFbo.Builder setWrapT(int wrapT)
      Sets the clamping for the Y axis on the texture.
      Parameters:
      wrapT - The wrap mode
    • setWrap

      Sets the clamping for the X and Y axis on the texture.
      Parameters:
      wrapS - The X wrap mode
      wrapT - The Y wrap mode
    • setWrap

      public AdvancedFbo.Builder setWrap(int wrapS, int wrapT)
      Sets the clamping for the X and Y axis on the texture.
      Parameters:
      wrapS - The X wrap mode
      wrapT - The Y wrap mode
    • setEdgeColor

      public AdvancedFbo.Builder setEdgeColor(int edgeColor)
      Sets the color to get when sampling the texture out of bounds when using TextureFilter.Wrap.CLAMP_TO_BORDER.
      Parameters:
      edgeColor - The new edge color in ARGB
    • setFilter

      public AdvancedFbo.Builder setFilter(TextureFilter filter)
      Sets the texture filtering options to match the specified filter.
      Parameters:
      filter - The texture filtering options
    • 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)
      Adds the specified texture as a texture attachment.
      Parameters:
      textureId - The id of the texture to add
    • addColorTextureWrapper

      public AdvancedFbo.Builder addColorTextureWrapper(int textureId, int layer)
      Adds the specified texture as a texture attachment.
      Parameters:
      textureId - The id of the texture to add
      layer - The layer of the texture to use
    • 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)
      Adds the specified texture as a texture attachment.
      Parameters:
      textureId - The id of the texture to add
    • setDepthTextureWrapper

      public AdvancedFbo.Builder setDepthTextureWrapper(int textureId, int layer)
      Adds the specified texture as a texture attachment.
      Parameters:
      textureId - The id of the texture to add
      layer - The layer of the texture to use
    • 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.