octEncodeInRange

external fun octEncodeInRange(vector: Cartesian3, result: Cartesian2, rangeMax: Double): Cartesian2(source)

Encodes a normalized vector into 2 SNORM values in the range of 0-rangeMax following the 'oct' encoding.

Oct encoding is a compact representation of unit length vectors. The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors", Cigolle et al 2014: http://jcgt.org/published/0003/02/01/

Return

The 2 component oct-encoded unit length vector.

Parameters

vector

The normalized vector to be compressed into 2 component 'oct' encoding.

result

The 2 component oct-encoded unit length vector.

rangeMax

The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.

See also