Skip to content

Commit

Permalink
DataUtils: Add toRGB9E5() and fromRGB9E5(). (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 authored Mar 28, 2024
1 parent 743db8f commit 4876209
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions types/three/src/extras/DataUtils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,26 @@ export function toHalfFloat(val: number): number;
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/DataUtils.js | Source}
*/
export function fromHalfFloat(val: number): number;

/**
* This method packs three floats into a single Uint32 value which is required for the `RGB9E5` texture format.
* @param r A float representing the R channel.
* @param g A float representing the G channel.
* @param b A float representing the B channel.
* @param target An instance of `Uint32Array` with length `1`.
*/
export function toRGB9E5(r: number, g: number, b: number, target: Uint32Array): Uint32Array;

/**
* This method unpacks three floats from a single Uint32 value holding a `RGB9E5` texel.
* @param val An instance of `Uint32Array` with length `1`.
* @param target An array holding the three unpacked floats.
*/
export function fromRGB9E5(val: Uint32Array, target: number[]): number[];

export const DataUtils: {
toHalfFloat: typeof toHalfFloat;
fromHalfFloat: typeof fromHalfFloat;
toRGB9E5: typeof toRGB9E5;
fromRGB9E5: typeof fromRGB9E5;
};

0 comments on commit 4876209

Please sign in to comment.