Class Quantization

java.lang.Object
com.gaia3d.converter.jgltf.Quantization

public class Quantization extends Object
Quantization class for computing quantization matrices and converting values. This class provides methods to compute a quantization matrix based on input values, convert signed shorts from unsigned shorts, and quantize unsigned shorts. It also includes methods for padding lengths.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.joml.Matrix4d
    computeQuantizationMatrix(float[] values)
    Computes a quantization matrix based on the provided values.
    static org.joml.Matrix4d
    computeQuantizationMatrix(org.joml.Matrix4d originalMatrix, float[] values)
    Computes a quantization matrix based on the provided values and an original transformation matrix.
    static short
    Converts an unsigned short value to a signed short value.
    static int
    paddedLength(int length)
    Calculates the padded length for a given length.
    static short[]
    quantizeUnsignedShorts(float[] values, org.joml.Matrix4d originalMatrix, org.joml.Matrix4d quantizationMatrix)
    Quantize an array of float values into unsigned shorts.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Quantization

      public Quantization()
  • Method Details

    • computeQuantizationMatrix

      public static org.joml.Matrix4d computeQuantizationMatrix(float[] values)
      Computes a quantization matrix based on the provided values.
      Parameters:
      values - An array of float values to compute the quantization matrix from.
      Returns:
      A quantization matrix that maps the input values to a normalized range.
    • computeQuantizationMatrix

      public static org.joml.Matrix4d computeQuantizationMatrix(org.joml.Matrix4d originalMatrix, float[] values)
      Computes a quantization matrix based on the provided values and an original transformation matrix.
      Parameters:
      originalMatrix - The original transformation matrix.
      values - An array of float values to compute the quantization matrix from.
      Returns:
      A quantization matrix that maps the input values to a normalized range.
    • paddedLength

      public static int paddedLength(int length)
      Calculates the padded length for a given length.
      Parameters:
      length - The length to be padded.
      Returns:
      The padded length, which is a multiple of 4.
    • convertSignedShortFromUnsignedShort

      public static short convertSignedShortFromUnsignedShort(int value)
      Converts an unsigned short value to a signed short value.
      Parameters:
      value - The unsigned short value to be converted.
      Returns:
      The signed short value.
    • quantizeUnsignedShorts

      public static short[] quantizeUnsignedShorts(float[] values, org.joml.Matrix4d originalMatrix, org.joml.Matrix4d quantizationMatrix)
      Quantize an array of float values into unsigned shorts.
      Parameters:
      values - The array of float values to be quantized.
      originalMatrix - The original transformation matrix.
      quantizationMatrix - The quantization matrix used for quantization.
      Returns:
      An array of quantized unsigned short values.