3es  0.7
tes::vhash Namespace Reference

Contains functions for hashing vector3/vector4 style vertices for vertex hash maps. More...

Functions

uint32_t hashBits (uint32_t a, uint32_t b=VHASH_MAGIC, uint32_t c=0)
 Generate a hash for 2 to 3 components. More...
 
uint32_t hashBits (uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e=0, uint32_t f=0)
 Generate a hash for 4 to 6 components. More...
 
uint32_t hash (float x, float y, float z)
 Generate a hash code for a 3-component vertex. More...
 
uint32_t hash (float x, float y, float z, float w)
 Generate a hash code for a 4-component vertex. More...
 

Detailed Description

Contains functions for hashing vector3/vector4 style vertices for vertex hash maps.

This hash technique was taken from NVIDIA open source code. Specifically the code for the paper "Efficient Sparse Voxel Octrees"

Function Documentation

◆ hash() [1/2]

uint32_t tes::vhash::hash ( float  x,
float  y,
float  z 
)
inline

Generate a hash code for a 3-component vertex.

Parameters
xA vector coordinate.
yA vector coordinate.
zA vector coordinate.

References hashBits().

Referenced by tes::Vector3Hash< T >::operator()().

◆ hash() [2/2]

uint32_t tes::vhash::hash ( float  x,
float  y,
float  z,
float  w 
)
inline

Generate a hash code for a 4-component vertex.

Parameters
xA vector coordinate.
yA vector coordinate.
zA vector coordinate.
wA vector coordinate.

References hashBits().

◆ hashBits() [1/2]

uint32_t tes::vhash::hashBits ( uint32_t  a,
uint32_t  b = VHASH_MAGIC,
uint32_t  c = 0 
)
inline

Generate a hash for 2 to 3 components.

Parameters
aFirst component.
bSecond component.
cThird component.

Referenced by hash().

◆ hashBits() [2/2]

uint32_t tes::vhash::hashBits ( uint32_t  a,
uint32_t  b,
uint32_t  c,
uint32_t  d,
uint32_t  e = 0,
uint32_t  f = 0 
)
inline

Generate a hash for 4 to 6 components.

Parameters
aFirst component.
bSecond component.
cThird component.
dFourth component.
eFifth component.
fSixth component.