|
Core 1.0
|
PCG3D hashing of three integer coordinates. More...
#include <hashing.h>
Static Public Member Functions | |
| static int | Integer (int, int, int) |
| Hash of integer coordinates. | |
| static double | Value (int, int, int) |
| Hash of integer coordinates, as a real number. | |
| static void | Integer3 (int, int, int, int &, int &, int &) |
| Hash of integer coordinates, as three integers. | |
| static Vector | Value3 (int, int, int) |
| Hash of integer coordinates, as a vector. | |
| static QString | Glsl () |
| GLSL source code equivalent to the functions of Hash. | |
Static Protected Member Functions | |
| static void | Pcg (uint32_t &, uint32_t &, uint32_t &) |
| Core of the pcg3d hash. | |
PCG3D hashing of three integer coordinates.
Implements the pcg3d hash of Jarzynski and Olano, Hash Functions for GPU Rendering, Journal of Computer Graphics Techniques, 2020.
The computation only uses 32 bit unsigned integer arithmetic (modulo 2^32), so that the results are bit-exact between C++ and GLSL: the string returned by Hash::Glsl() implements exactly the same functions.
All the functions are static, and, except Hash::Glsl(), inline.
|
static |
GLSL source code equivalent to the functions of Hash.
Defines the functions uvec3 Hash3u(uvec3), vec3 Hash3f(uvec3) (equivalent to Hash::Integer3() and Hash::Value3()), int HashInteger(int,int,int) and float HashValue(int,int,int) (equivalent to Hash::Integer() and Hash::Value()). The source can be concatenated with the one of Hash2::Glsl() in the same shader.
|
inlinestatic |
Hash of integer coordinates.
Negative coordinates are reinterpreted as two's complement 32 bit values, as done in GLSL by uint(int).
| x,y,z | Integer coordinates. |
|
inlinestatic |
Hash of integer coordinates, as three integers.
Unlike Hash::Integer(), which only keeps the first component, the three components of the pcg3d output are returned. They are all of good quality.
| x,y,z | Integer coordinates. |
| a,b,c | Pseudo-random integers, covering the whole range of int. |
|
inlinestaticprotected |
Core of the pcg3d hash.
| x,y,z | Values, modified in place. |
|
inlinestatic |
Hash of integer coordinates, as a real number.
The 24 high bits of the hash are converted to a double in [0,1). The value is exactly representable as a float, and is identical to the one computed in GLSL.
| x,y,z | Integer coordinates. |
|
inlinestatic |
Hash of integer coordinates, as a vector.
Each coordinate of the vector is computed as in Hash::Value() from the corresponding component of the pcg3d output.
| x,y,z | Integer coordinates. |