Class ktxAstcParams

java.lang.Object
org.lwjgl.system.Pointer.Default
org.lwjgl.system.Struct<ktxAstcParams>
org.lwjgl.util.ktx.ktxAstcParams
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer

public class ktxAstcParams extends org.lwjgl.system.Struct<ktxAstcParams> implements org.lwjgl.system.NativeResource
Structure for passing extended parameters to ktxTexture_CompressAstc.

Passing a struct initialized to 0 will use blockDimension 4x4, mode LDR and qualityLevel FASTEST. Setting qualityLevel to PACK_ASTC_QUALITY_LEVEL_MEDIUM is recommended.

Layout


 struct ktxAstcParams {
     ktx_uint32_t structSize();
     ktx_bool_t verbose();
     ktx_uint32_t threadCount();
     ktx_uint32_t blockDimension();
     ktx_uint32_t mode();
     ktx_uint32_t qualityLevel();
     ktx_bool_t normalMap();
     ktx_bool_t perceptual();
     char inputSwizzle()[4];
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • STRUCTSIZE

      public static final int STRUCTSIZE
      The struct member offsets.
    • VERBOSE

      public static final int VERBOSE
      The struct member offsets.
    • THREADCOUNT

      public static final int THREADCOUNT
      The struct member offsets.
    • BLOCKDIMENSION

      public static final int BLOCKDIMENSION
      The struct member offsets.
    • MODE

      public static final int MODE
      The struct member offsets.
    • QUALITYLEVEL

      public static final int QUALITYLEVEL
      The struct member offsets.
    • NORMALMAP

      public static final int NORMALMAP
      The struct member offsets.
    • PERCEPTUAL

      public static final int PERCEPTUAL
      The struct member offsets.
    • INPUTSWIZZLE

      public static final int INPUTSWIZZLE
      The struct member offsets.
  • Constructor Details

    • ktxAstcParams

      public ktxAstcParams(ByteBuffer container)
      Creates a ktxAstcParams instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Specified by:
      sizeof in class org.lwjgl.system.Struct<ktxAstcParams>
    • structSize

      public int structSize()
      Size of this struct.

      Used so library can tell which version of struct is being passed.

    • verbose

      public boolean verbose()
      If true, prints Astc encoder operation details to stdout.

      Not recommended for GUI apps.

    • threadCount

      public int threadCount()
      Number of threads used for compression. Default is 1.
    • blockDimension

      public int blockDimension()
      Combinations of block dimensions that astcenc supports
    • mode

      public int mode()
      Can be {ldr/hdr} from astcenc
    • qualityLevel

      public int qualityLevel()
      astcenc supports -fastest, -fast, -medium, -thorough, -exhaustive
    • normalMap

      public boolean normalMap()
      Tunes codec parameters for better quality on normal maps.

      In this mode normals are compressed to X,Y components, Discarding Z component, reader will need to generate Z component in shaders.

    • perceptual

      public boolean perceptual()
      The codec should optimize for perceptual error, instead of direct RMS error.

      This aims to improves perceived image quality, but typically lowers the measured PSNR score. Perceptual methods are currently only available for normal maps and RGB color data.

    • inputSwizzle

      public ByteBuffer inputSwizzle()
      A swizzle to provide as input to astcenc. It must match the regular expression /^[rgba01]{4}$/.
    • inputSwizzle

      public byte inputSwizzle(int index)
      A swizzle to provide as input to astcenc. It must match the regular expression /^[rgba01]{4}$/.
    • structSize

      public ktxAstcParams structSize(int value)
      Sets the specified value to the structSize() field.
    • verbose

      public ktxAstcParams verbose(boolean value)
      Sets the specified value to the verbose() field.
    • threadCount

      public ktxAstcParams threadCount(int value)
      Sets the specified value to the threadCount() field.
    • blockDimension

      public ktxAstcParams blockDimension(int value)
      Sets the specified value to the blockDimension() field.
    • mode

      public ktxAstcParams mode(int value)
      Sets the specified value to the mode() field.
    • qualityLevel

      public ktxAstcParams qualityLevel(int value)
      Sets the specified value to the qualityLevel() field.
    • normalMap

      public ktxAstcParams normalMap(boolean value)
      Sets the specified value to the normalMap() field.
    • perceptual

      public ktxAstcParams perceptual(boolean value)
      Sets the specified value to the perceptual() field.
    • inputSwizzle

      public ktxAstcParams inputSwizzle(ByteBuffer value)
      Copies the specified ByteBuffer to the inputSwizzle() field.
    • inputSwizzle

      public ktxAstcParams inputSwizzle(int index, byte value)
      Sets the specified value at the specified index of the inputSwizzle() field.
    • set

      public ktxAstcParams set(int structSize, boolean verbose, int threadCount, int blockDimension, int mode, int qualityLevel, boolean normalMap, boolean perceptual, ByteBuffer inputSwizzle)
      Initializes this struct with the specified values.
    • set

      public ktxAstcParams set(ktxAstcParams src)
      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static ktxAstcParams malloc()
      Returns a new ktxAstcParams instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static ktxAstcParams calloc()
      Returns a new ktxAstcParams instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static ktxAstcParams create()
      Returns a new ktxAstcParams instance allocated with BufferUtils.
    • create

      public static ktxAstcParams create(long address)
      Returns a new ktxAstcParams instance for the specified memory address.
    • createSafe

      public static @Nullable ktxAstcParams createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static ktxAstcParams.Buffer malloc(int capacity)
      Returns a new ktxAstcParams.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static ktxAstcParams.Buffer calloc(int capacity)
      Returns a new ktxAstcParams.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static ktxAstcParams.Buffer create(int capacity)
      Returns a new ktxAstcParams.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static ktxAstcParams.Buffer create(long address, int capacity)
      Create a ktxAstcParams.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable ktxAstcParams.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • malloc

      public static ktxAstcParams malloc(org.lwjgl.system.MemoryStack stack)
      Returns a new ktxAstcParams instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static ktxAstcParams calloc(org.lwjgl.system.MemoryStack stack)
      Returns a new ktxAstcParams instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static ktxAstcParams.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new ktxAstcParams.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static ktxAstcParams.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new ktxAstcParams.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • nstructSize

      public static int nstructSize(long struct)
      Unsafe version of structSize().
    • nverbose

      public static boolean nverbose(long struct)
      Unsafe version of verbose().
    • nthreadCount

      public static int nthreadCount(long struct)
      Unsafe version of threadCount().
    • nblockDimension

      public static int nblockDimension(long struct)
      Unsafe version of blockDimension().
    • nmode

      public static int nmode(long struct)
      Unsafe version of mode().
    • nqualityLevel

      public static int nqualityLevel(long struct)
      Unsafe version of qualityLevel().
    • nnormalMap

      public static boolean nnormalMap(long struct)
      Unsafe version of normalMap().
    • nperceptual

      public static boolean nperceptual(long struct)
      Unsafe version of perceptual().
    • ninputSwizzle

      public static ByteBuffer ninputSwizzle(long struct)
      Unsafe version of inputSwizzle().
    • ninputSwizzle

      public static byte ninputSwizzle(long struct, int index)
      Unsafe version of inputSwizzle.
    • nstructSize

      public static void nstructSize(long struct, int value)
      Unsafe version of structSize.
    • nverbose

      public static void nverbose(long struct, boolean value)
      Unsafe version of verbose.
    • nthreadCount

      public static void nthreadCount(long struct, int value)
      Unsafe version of threadCount.
    • nblockDimension

      public static void nblockDimension(long struct, int value)
      Unsafe version of blockDimension.
    • nmode

      public static void nmode(long struct, int value)
      Unsafe version of mode.
    • nqualityLevel

      public static void nqualityLevel(long struct, int value)
      Unsafe version of qualityLevel.
    • nnormalMap

      public static void nnormalMap(long struct, boolean value)
      Unsafe version of normalMap.
    • nperceptual

      public static void nperceptual(long struct, boolean value)
      Unsafe version of perceptual.
    • ninputSwizzle

      public static void ninputSwizzle(long struct, ByteBuffer value)
      Unsafe version of inputSwizzle.
    • ninputSwizzle

      public static void ninputSwizzle(long struct, int index, byte value)
      Unsafe version of inputSwizzle.