add missing 4 comp hash variants

This commit is contained in:
Green Sky 2022-04-13 23:35:56 +02:00
parent 69a04cbd7e
commit b520811e72

View File

@ -142,6 +142,16 @@ float hash13(vec3 p3)
return fract((p3.x + p3.y) * p3.z); return fract((p3.x + p3.y) * p3.z);
} }
//----------------------------------------------------------------------------------------
// TODO: test properly
// 1 out, 4 in...
float hash14(vec4 p4)
{
p4 = fract(p4 * .1031);
p4 += dot(p4, p4.zywx + 31.32);
return fract((p4.x + p4.y + p4.w) * p4.z);
}
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// 2 out, 1 in... // 2 out, 1 in...
vec2 hash21(float p) vec2 hash21(float p)
@ -169,6 +179,16 @@ vec2 hash23(vec3 p3)
return fract((p3.xx+p3.yz)*p3.zy); return fract((p3.xx+p3.yz)*p3.zy);
} }
//----------------------------------------------------------------------------------------
// TODO: test properly
// 2 out, 4 in...
vec2 hash24(vec4 p4)
{
p4 = fract(p4 * vec4(.1031, .1030, .0973, .1337));
p4 += dot(p4, p4.ywzx+33.33);
return fract((p4.wx+p4.yz)*p4.zy);
}
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// 3 out, 1 in... // 3 out, 1 in...
vec3 hash31(float p) vec3 hash31(float p)