/** * Utility static class providing functionality to pack float values to various storage * representations. * * {@link float2Half} converts a JavaScript number to the 16-bit half-float encoding used by * half-precision textures and vertex formats, so float data can be uploaded to the GPU at half the * size. * * @example * // Fill a half-float buffer from an array of numbers * const halves = new Uint16Array(values.length); * for (let i = 0; i < values.length; i++) { * halves[i] = FloatPacking.float2Half(values[i]); * } * @category Math */ export class FloatPacking { /** * Packs a float to a 16-bit half-float representation used by the GPU. * * @param {number} value - The float value to pack. * @returns {number} The 16-bit half-float representation as an integer. * @example * const half = FloatPacking.float2Half(1.5); */ static float2Half(value: number): number; /** * Converts bits of a 32-bit float into RGBA8 format and stores the result in a provided color. * The float can be reconstructed in shader using the uintBitsToFloat instruction. * * @param {number} value - The float value to convert. * @param {Color} data - The color to store the RGBA8 packed value in. * * @ignore */ static float2RGBA8(value: number, data: Color): void; } import type { Color } from './color.js';