Package com.gaia3d.converter.jgltf
Class Quantization
java.lang.Object
com.gaia3d.converter.jgltf.Quantization
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic org.joml.Matrix4dcomputeQuantizationMatrix(float[] values) Computes a quantization matrix based on the provided values.static org.joml.Matrix4dcomputeQuantizationMatrix(org.joml.Matrix4d originalMatrix, float[] values) Computes a quantization matrix based on the provided values and an original transformation matrix.static shortconvertSignedShortFromUnsignedShort(int value) Converts an unsigned short value to a signed short value.static intpaddedLength(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.
-
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.
-