Package icyllis.arc3d.engine

# Class SamplerDesc

java.lang.Object
icyllis.arc3d.engine.SamplerDesc

All Implemented Interfaces:
  `IResourceKey`

@Immutable public final class SamplerDesc extends Object implements IResourceKey
Represents the filtering and tile modes used to access a texture. It's packed as an `int` value.

- 0-4 bits: mag filter
- 4-8 bits: min filter
- 8-12 bits: mipmap mode
- 12-16 bits: address mode (x direction)
- 16-20 bits: address mode (y direction)
- 20-24 bits: address mode (z direction)
- 24-32 bits: max anisotropy (integer value)

Do NOT change the packing format and the default value.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `ADDRESS_MODE_CLAMP_TO_BORDER`
  Address modes, or wrap modes.
  `static final int`
  `ADDRESS_MODE_CLAMP_TO_EDGE`
  Address modes, or wrap modes.
  `static final int`
  `ADDRESS_MODE_MIRRORED_REPEAT`
  Address modes, or wrap modes.
  `static final int`
  `ADDRESS_MODE_REPEAT`
  Address modes, or wrap modes.
  `static final SamplerDesc`
  `DEFAULT`
  Default value.
  `static final int`
  `FILTER_LINEAR`
  Filters.
  `static final int`
  `FILTER_NEAREST`
  Filters.
  `static final int`
  `MIPMAP_MODE_LINEAR`
  Mipmap modes.
  `static final int`
  `MIPMAP_MODE_NEAREST`
  Mipmap modes.
  `static final int`
  `MIPMAP_MODE_NONE`
  Mipmap modes.
  `static final SamplerDesc`
  `NEAREST`
  Nearest value.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SamplerDesc`
  `copy()`
  `boolean`
  `equals(Object o)`
  `int`
  `getAddressModeX()`
  `int`
  `getAddressModeY()`
  `int`
  `getAddressModeZ()`
  `int`
  `getMagFilter()`
  `int`
  `getMaxAnisotropy()`
  `int`
  `getMinFilter()`
  `int`
  `getMipmapMode()`
  `int`
  `hashCode()`
  `boolean`
  `isAnisotropy()`
  `boolean`
  `isMipmapped()`
  `boolean`
  `isRepeated()`
  `boolean`
  `isRepeatedX()`
  `boolean`
  `isRepeatedY()`
  `boolean`
  `isRepeatedZ()`
  `boolean`
  `isShareable()`
  Can the resource be held by multiple users at the same time? For example, pipelines, samplers, etc.
  `static SamplerDesc`
  `make(int filter)`
  Turn the sampler state into an integer for use as a key.
  `static SamplerDesc`
  `make(int filter, int mipmap)`
  Turn the sampler state into an integer for use as a key.
  `static SamplerDesc`
  `make(int filter, int mipmap, int address)`
  Turn the sampler state into an integer for use as a key.
  `static SamplerDesc`
  `make(int magFilter, int minFilter, int mipmapMode, int addressModeX, int addressModeY, int addressModeZ)`
  Turn the sampler state into an integer for use as a key.
  `static SamplerDesc`
  `makeAnisotropy(int addressModeX, int addressModeY, int addressModeZ, int maxAnisotropy, boolean isMipmapped)`
  Turn the sampler state into an integer for use as a key.
  `SamplerDesc`
  `resetMipmapMode()`
  Reset mipmap mode to `MIPMAP_MODE_NONE`.

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### FILTER_NEAREST

    public static final int FILTER_NEAREST
    Filters.
    See Also:
      - Constant Field Values

  - ### FILTER_LINEAR

    public static final int FILTER_LINEAR
    Filters.
    See Also:
      - Constant Field Values

  - ### MIPMAP_MODE_NONE

    public static final int MIPMAP_MODE_NONE
    Mipmap modes.
    See Also:
      - Constant Field Values

  - ### MIPMAP_MODE_NEAREST

    public static final int MIPMAP_MODE_NEAREST
    Mipmap modes.
    See Also:
      - Constant Field Values

  - ### MIPMAP_MODE_LINEAR

    public static final int MIPMAP_MODE_LINEAR
    Mipmap modes.
    See Also:
      - Constant Field Values

  - ### ADDRESS_MODE_REPEAT

    public static final int ADDRESS_MODE_REPEAT
    Address modes, or wrap modes. Specify behavior of sampling with texture coordinates outside an image.
    See Also:
      - Constant Field Values

  - ### ADDRESS_MODE_MIRRORED_REPEAT

    public static final int ADDRESS_MODE_MIRRORED_REPEAT
    Address modes, or wrap modes. Specify behavior of sampling with texture coordinates outside an image.
    See Also:
      - Constant Field Values

  - ### ADDRESS_MODE_CLAMP_TO_EDGE

    public static final int ADDRESS_MODE_CLAMP_TO_EDGE
    Address modes, or wrap modes. Specify behavior of sampling with texture coordinates outside an image.
    See Also:
      - Constant Field Values

  - ### ADDRESS_MODE_CLAMP_TO_BORDER

    public static final int ADDRESS_MODE_CLAMP_TO_BORDER
    Address modes, or wrap modes. Specify behavior of sampling with texture coordinates outside an image.
    See Also:
      - Constant Field Values

  - ### NEAREST

    public static final SamplerDesc NEAREST
    Nearest value. mag filter nearest, min filter nearest, mipmap mode none, address mode clamp to edge, max anisotropy 1.

  - ### DEFAULT

    public static final SamplerDesc DEFAULT
    Default value. mag filter linear, min filter linear, mipmap mode none, address mode clamp to edge, max anisotropy 1.

- ## Method Details

  - ### make

    @Contract(pure=true) public static SamplerDesc make(int filter)
    Turn the sampler state into an integer for use as a key.
    Parameters:
      `filter` - the filter for mag and min

  - ### make

    @Contract(pure=true) public static SamplerDesc make(int filter, int mipmap)
    Turn the sampler state into an integer for use as a key.
    Parameters:
      `filter` - the filter for mag and min
      `mipmap` - the mipmap mode

  - ### make

    @Contract(pure=true) public static SamplerDesc make(int filter, int mipmap, int address)
    Turn the sampler state into an integer for use as a key.
    Parameters:
      `filter` - the filter for mag and min
      `mipmap` - the mipmap mode
      `address` - the address mode for x, y and z

  - ### make

    @Contract(pure=true) public static SamplerDesc make(int magFilter, int minFilter, int mipmapMode, int addressModeX, int addressModeY, int addressModeZ)
    Turn the sampler state into an integer for use as a key.
    Parameters:
      `magFilter` - the mag filter
      `minFilter` - the min filter
      `mipmapMode` - the mipmap mode
      `addressModeX` - the address mode X
      `addressModeY` - the address mode Y
      `addressModeZ` - the address mode Z

  - ### makeAnisotropy

    @Contract(pure=true) public static SamplerDesc makeAnisotropy(int addressModeX, int addressModeY, int addressModeZ, int maxAnisotropy, boolean isMipmapped)
    Turn the sampler state into an integer for use as a key.

    We require 'isMipmapped' for APIs that allow MIP filtering to be specified orthogonally to anisotropy.

    Parameters:
      `addressModeX` - the address mode X
      `addressModeY` - the address mode Y
      `addressModeZ` - the address mode Z
      `maxAnisotropy` - the max anisotropy filtering level

  - ### getMagFilter

    @Contract(pure=true) public int getMagFilter()

  - ### getMinFilter

    @Contract(pure=true) public int getMinFilter()

  - ### getMipmapMode

    @Contract(pure=true) public int getMipmapMode()

  - ### getAddressModeX

    @Contract(pure=true) public int getAddressModeX()

  - ### getAddressModeY

    @Contract(pure=true) public int getAddressModeY()

  - ### getAddressModeZ

    @Contract(pure=true) public int getAddressModeZ()

  - ### isMipmapped

    @Contract(pure=true) public boolean isMipmapped()

  - ### isRepeatedX

    @Contract(pure=true) public boolean isRepeatedX()

  - ### isRepeatedY

    @Contract(pure=true) public boolean isRepeatedY()

  - ### isRepeatedZ

    @Contract(pure=true) public boolean isRepeatedZ()

  - ### isRepeated

    @Contract(pure=true) public boolean isRepeated()

  - ### getMaxAnisotropy

    @Contract(pure=true) public int getMaxAnisotropy()

  - ### isAnisotropy

    @Contract(pure=true) public boolean isAnisotropy()

  - ### resetMipmapMode

    @Contract(pure=true) public SamplerDesc resetMipmapMode()
    Reset mipmap mode to `MIPMAP_MODE_NONE`. Return value is a valid sampler state.

  - ### isShareable

    public boolean isShareable()
    Description copied from interface: `IResourceKey`
    Can the resource be held by multiple users at the same time? For example, pipelines, samplers, etc.
    Specified by:
      `isShareable` in interface `IResourceKey`
    Returns:
      true if shareable, false if scratch

  - ### copy

    public SamplerDesc copy()
    Specified by:
      `copy` in interface `IResourceKey`

  - ### hashCode

    public int hashCode()
    Specified by:
      `hashCode` in interface `IResourceKey`
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(Object o)
    Specified by:
      `equals` in interface `IResourceKey`
    Overrides:
      `equals` in class `Object`