|
| bool | decompose (mat4 const &m, float3 &scale, quat &rotation, float3 &transform) |
| |
| mat4 | infinitePerspectiveRHReverseZ (float fovY, float a, float zNear) |
| |
| mat4 | perspectiveRHReverseZ (float fovY, float a, float zNear, float zFar) |
| |
| mat4 | viewMatrixRHReverseZ (vec3 pos, quat rot) |
| |
| float4 | planeSymmetric (mat4 proj) |
| |
| unsigned short | quantizeFP16 (float v) |
| |
| float | quantizeFP32 (float v, int N) |
| |
| float | dequantizeFP16 (unsigned short h) |
| |
| float | quantizeFP32 (float v, int32_t N) |
| |
| float | dequantizeFP16 (uint16_t h) |
| |
| uint32_t | quantizeUnorm (float v, int32_t N) |
| |
| float | dequantizeUnorm (int32_t q, int32_t Nbits) |
| |
| int32_t | quantizeSnorm (float v, int32_t N) |
| |
| float | dequantizeSnorm (int32_t q, int32_t Nbits) |
| |
| uint32_t | quantizeSnormShifted (float v, int32_t Nbits) |
| |
| float | dequantizeSnormShifted (uint32_t q, int32_t Nbits) |
| |
| float4 | packQuaternionXYZPositionBit (quat const &q) |
| |
| quat | unpackQuaternionXYZPositionBit (float4 const &packed) |
| |
| float Foundation::Math::quantizeFP32 |
( |
float |
v, |
|
|
int32_t |
N |
|
) |
| |
Quantize a float into a floating point value with a limited number of significant mantissa bits, preserving the IEEE-754 fp32 binary representation Generates +-inf for overflow, preserves NaN, flushes denormals to zero, rounds to nearest Assumes N is in a valid mantissa precision range, which is 1..23
| int32_t Foundation::Math::quantizeSnorm |
( |
float |
v, |
|
|
int32_t |
N |
|
) |
| |
|
inline |
[-1, 1] range -> [-(1<< (Nbits - 1)) - 1, (1 << (Nbits - 1))] \in N e.g. Nbits = 10 -> [-511, 512] In transport you may want to add 1 << (Nbits - 1) to the quantized value to shift it to [0, 1 << NBits) range since you'd be packing complement int32 bits - truncation would result in a loss of precision To do this, use QuantizeSnormShifted and DequantizeSnormShifted