Utils general shader.
More...
◆ buildFrame()
void GPUShaders::Common::Utils::buildFrame |
( |
vec3 |
up, |
|
|
out vec3 |
right, |
|
|
out vec3 |
front |
|
) |
| |
|
inline |
Build a reference orthonormal frame from a given up vector.
- Parameters
-
up | the normalized up vector to use |
right | will contain the normalized right vector |
front | will contain the normalized front vector |
◆ convertToPrecision() [1/2]
float GPUShaders::Common::Utils::convertToPrecision |
( |
float |
value, |
|
|
uint |
size |
|
) |
| |
|
inline |
Convert a normalized float value to a given bit precision.
- Parameters
-
value | the normalized value to quantize |
size | the number of bits to use |
- Returns
- the quantized normalized value
◆ convertToPrecision() [2/2]
vec3 GPUShaders::Common::Utils::convertToPrecision |
( |
vec3 |
value, |
|
|
uint |
size |
|
) |
| |
|
inline |
Convert a vector of normalized float values to a given bit precision.
- Parameters
-
value | the normalized values to quantize |
size | the number of bits to use |
- Returns
- the quantized normalized values
◆ decodeNormal()
vec3 GPUShaders::Common::Utils::decodeNormal |
( |
vec2 |
e | ) |
|
|
inline |
Decode a normal from its storage-efficient representation.
- Parameters
-
e | the normal representation |
- Returns
- the decoded normal
◆ decodeOctahedralDirection()
vec3 GPUShaders::Common::Utils::decodeOctahedralDirection |
( |
vec2 |
e | ) |
|
|
inline |
Decode a normalized direction from an octahedral representation.
- Parameters
-
e | the representation parameters |
- Returns
- the decoded direction
◆ encodeNormal()
vec2 GPUShaders::Common::Utils::encodeNormal |
( |
vec3 |
n | ) |
|
|
inline |
Encode a normal into a compact representation for storage in a framebuffer.
- Parameters
-
- Returns
- the encoded representation
◆ encodeOctahedralDirection()
vec2 GPUShaders::Common::Utils::encodeOctahedralDirection |
( |
vec3 |
d | ) |
|
|
inline |
◆ floatToVec4()
vec4 GPUShaders::Common::Utils::floatToVec4 |
( |
float |
f | ) |
|
|
inline |
Store a 32bits float in a 4x8bits vector of normalized values.
- Parameters
-
- Returns
- the vec4 representation of the float
◆ hammersleySample()
vec2 GPUShaders::Common::Utils::hammersleySample |
( |
uint |
i, |
|
|
int |
scount |
|
) |
| |
|
inline |
Compute an arbitrary sample of the 2D Hammersley sequence.
- Parameters
-
i | the index in the hammersley sequence |
scount | the total number of samples |
- Returns
- the i-th 2D sample
◆ linearizeDepth()
float GPUShaders::Common::Utils::linearizeDepth |
( |
float |
depth, |
|
|
vec2 |
projPlanes |
|
) |
| |
|
inline |
Linearize a NDC space to view space using the camera projection parameters.
- Parameters
-
depth | the non-linear depth of the fragment |
projPlanes | the depth-related coefficients of the projection matrix |
- Returns
- the view space depth
◆ octahedralWrap()
vec2 GPUShaders::Common::Utils::octahedralWrap |
( |
vec2 |
d | ) |
|
|
inline |
Wrap a projected direction in the octahedral parametrization of the unit sphere
- Parameters
-
d | the projected direction in 2D |
- Returns
- the corresponding coordinates in the parameterization
◆ positionFromDepth()
vec3 GPUShaders::Common::Utils::positionFromDepth |
( |
float |
depth, |
|
|
vec2 |
uv, |
|
|
vec4 |
projMat |
|
) |
| |
|
inline |
Estimate the position of the current fragment in view space based on its depth and camera parameters.
- Parameters
-
depth | the depth of the fragment |
uv | the input uv |
projMat | the non trivial coefficients of the projection matrix |
- Returns
- the view space position
◆ toCube() [1/2]
vec3 GPUShaders::Common::Utils::toCube |
( |
vec3 |
v | ) |
|
|
inline |
Transform a world space direction to cubemap space. A vertical flip is needed.
- Parameters
-
- Returns
- the direction to use to sample in the cubemap
◆ toCube() [2/2]
vec4 GPUShaders::Common::Utils::toCube |
( |
vec3 |
v, |
|
|
uint |
layer |
|
) |
| |
|
inline |
Transform a world space direction to cubemap array space. A vertical flip is needed.
- Parameters
-
v | the direction to flip |
layer | the array layer index |
- Returns
- the direction to use to sample in the cubemap
◆ vec4ToFloat()
float GPUShaders::Common::Utils::vec4ToFloat |
( |
vec4 |
v | ) |
|
|
inline |
Load a 32bits float from a 4x8bits vector of normalized values.
- Parameters
-
v | the vec4 representation of the float |
- Returns
- the loaded float
The documentation for this class was generated from the following file:
- resources/common/shaders/utils.glsl