Package limn.render3d

Record Class Sampler

java.lang.Object
java.lang.Record
limn.render3d.Sampler

public record Sampler(Sampler.Filter minFilter, Sampler.Filter magFilter, Sampler.Wrap wrapS, Sampler.Wrap wrapT, boolean mipmaps) extends Record
How a texture is filtered and wrapped when sampled. Baked into the GpuTexture at upload time (each texture object carries its own state; no separate sampler objects yet). mipmaps builds and uses a mip chain for minified sampling (trilinear when the min filter is Sampler.Filter.LINEAR).
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    How texels are read when the texture is drawn larger or smaller: the nearest one, or a blend of its neighbours.
    static enum 
    What a coordinate outside 0 to 1 reads: the texture repeated, its edge texel, or the texture mirrored at each repeat.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Sampler(Sampler.Filter minFilter, Sampler.Filter magFilter, Sampler.Wrap wrapS, Sampler.Wrap wrapT, boolean mipmaps)
    Creates an instance of a Sampler record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the magFilter record component.
    Returns the value of the minFilter record component.
    boolean
    Returns the value of the mipmaps record component.
    static Sampler
    Nearest, clamped, no mips: crisp texels for pixel-art / data textures.
    static Sampler
    Trilinear, repeating: the sensible default for tiling color maps.
    final String
    Returns a string representation of this record class.
    Returns the value of the wrapS record component.
    Returns the value of the wrapT record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Sampler

      public Sampler(Sampler.Filter minFilter, Sampler.Filter magFilter, Sampler.Wrap wrapS, Sampler.Wrap wrapT, boolean mipmaps)
      Creates an instance of a Sampler record class.
      Parameters:
      minFilter - the value for the minFilter record component
      magFilter - the value for the magFilter record component
      wrapS - the value for the wrapS record component
      wrapT - the value for the wrapT record component
      mipmaps - the value for the mipmaps record component
  • Method Details

    • smooth

      public static Sampler smooth()
      Trilinear, repeating: the sensible default for tiling color maps.
    • pixelated

      public static Sampler pixelated()
      Nearest, clamped, no mips: crisp texels for pixel-art / data textures.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • minFilter

      public Sampler.Filter minFilter()
      Returns the value of the minFilter record component.
      Returns:
      the value of the minFilter record component
    • magFilter

      public Sampler.Filter magFilter()
      Returns the value of the magFilter record component.
      Returns:
      the value of the magFilter record component
    • wrapS

      public Sampler.Wrap wrapS()
      Returns the value of the wrapS record component.
      Returns:
      the value of the wrapS record component
    • wrapT

      public Sampler.Wrap wrapT()
      Returns the value of the wrapT record component.
      Returns:
      the value of the wrapT record component
    • mipmaps

      public boolean mipmaps()
      Returns the value of the mipmaps record component.
      Returns:
      the value of the mipmaps record component