Class SamplerObject

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

public class SamplerObject extends Object implements org.lwjgl.system.NativeResource
Sampler objects allow shaders to sample from the same texture storage in different ways depending on what samplers are bound.
  • Method Details

    • create

      public static SamplerObject create()
      Creates a single new sampler object.
      Returns:
      A new sampler
    • create

      public static SamplerObject[] create(int count)
      Creates an array of sampler objects.
      Parameters:
      count - The number of samplers to create
      Returns:
      An array of new sampler objects
    • create

      public static void create(SamplerObject[] fill)
      Replaces each element of the specified array with a new sampler object.
      Parameters:
      fill - The array to fill
    • bind

      public void bind(int unit)
      Binds this sampler to the specified texture unit.
      Parameters:
      unit - The unit to bind to
    • unbind

      public static void unbind(int unit)
      Unbinds the sampler from the specified unit.
      Parameters:
      unit - The unit to unbind from
    • getId

      public int getId()
      Returns:
      The OpenGL id of this sampler
    • setFilter

      public void setFilter(TextureFilter filter)
      Sets the texture filtering to match the specified state.
      Parameters:
      filter - The new texture filtering state to use
    • setFilter

      public void setFilter(boolean blur, boolean mipmap)
      Sets the minification and magnification filters to match the specified blur and mipmap states.
      Parameters:
      blur - Whether to use linear or nearest neighbor filtering
      mipmap - Whether to interpolate between mipmap levels or not
    • setAnisotropy

      public void setAnisotropy(float value)
      Sets the anisotropic filtering value. Any value >1 is considered to be enabled. Set to Float.MAX_VALUE to set to the platform maximum
      Parameters:
      value - The new anisotropic filtering value
    • setCompareFunc

      public void setCompareFunc(@Nullable TextureFilter.CompareFunction compareFunction)
      Sets the depth compare function for depth texture sampling.
      Parameters:
      compareFunction - The new function or null to disable
    • setWrapX

      public void setWrapX(TextureFilter.Wrap wrap)
      Sets the X texture wrap function.
      Parameters:
      wrap - The new X wrap value
    • setWrapY

      public void setWrapY(TextureFilter.Wrap wrap)
      Sets the Y texture wrap function.
      Parameters:
      wrap - The new Y wrap value
    • setWrapZ

      public void setWrapZ(TextureFilter.Wrap wrap)
      Sets the Z texture wrap function.
      Parameters:
      wrap - The new Z wrap value
    • setWrap

      public void setWrap(TextureFilter.Wrap wrapX, TextureFilter.Wrap wrapY, TextureFilter.Wrap wrapZ)
      Sets the texture wrap function for all axes.
      Parameters:
      wrapX - The new X wrap value
      wrapY - The new Y wrap value
      wrapZ - The new Z wrap value
    • setBorderColor

      public void setBorderColor(float red, float green, float blue, float alpha)
      Sets the border color to use when the wrap mode is TextureFilter.Wrap.CLAMP_TO_BORDER.
      Parameters:
      red - The red value from 0 to 1
      green - The green value from 0 to 1
      blue - The blue value from 0 to 1
      alpha - The alpha value from 0 to 1
    • setBorderColor

      public void setBorderColor(int red, int green, int blue, int alpha)
      Sets the border color to use when the wrap mode is TextureFilter.Wrap.CLAMP_TO_BORDER.
      Parameters:
      red - The red value from 0 to 255
      green - The green value from 0 to 255
      blue - The blue value from 0 to 255
      alpha - The alpha value from 0 to 255
    • setBorderColor

      public void setBorderColor(int color)
      Sets the border color to use when the wrap mode is TextureFilter.Wrap.CLAMP_TO_BORDER.
      Parameters:
      color - The color value encoded as an RGBA int
    • setBorderColorI

      public void setBorderColorI(int red, int green, int blue, int alpha)
      Sets the border color to use when the wrap mode is TextureFilter.Wrap.CLAMP_TO_BORDER.
      Parameters:
      red - The red value from 0 to 255
      green - The green value from 0 to 255
      blue - The blue value from 0 to 255
      alpha - The alpha value from 0 to 255
    • setBorderColorI

      public void setBorderColorI(int color)
      Sets the border color to use when the wrap mode is TextureFilter.Wrap.CLAMP_TO_BORDER.
      Parameters:
      color - The color value encoded as an RGBA int
    • setBorderColorUI

      public void setBorderColorUI(int red, int green, int blue, int alpha)
      Sets the border color to use when the wrap mode is TextureFilter.Wrap.CLAMP_TO_BORDER.
      Parameters:
      red - The red value from 0 to 255
      green - The green value from 0 to 255
      blue - The blue value from 0 to 255
      alpha - The alpha value from 0 to 255
    • setBorderColorUI

      public void setBorderColorUI(int color)
      Sets the border color to use when the wrap mode is TextureFilter.Wrap.CLAMP_TO_BORDER.
      Parameters:
      color - The color value encoded as an RGBA int
    • setCubeMapSeamless

      public void setCubeMapSeamless(boolean seamless)
      Allows filtering to work across faces of cubemaps.
      Parameters:
      seamless - Whether to enable seamless cube maps
    • free

      public void free()
      Specified by:
      free in interface org.lwjgl.system.NativeResource