diff options
| author | yum <yum.food.vr@gmail.com> | 2026-04-12 17:21:42 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-04-12 17:21:42 -0700 |
| commit | 66035e375c585f301602c150c26f3699dfb7b055 (patch) | |
| tree | 4bf9f1aa7e8c42ed51c26e6a04ac56a048c0d2f2 /math.cginc | |
| parent | 900637fddb09fe7e3dda4e2da5fe7c7a8970f91a (diff) | |
Improve naming in voronoi function
Diffstat (limited to 'math.cginc')
| -rwxr-xr-x | math.cginc | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -215,8 +215,8 @@ float3 domain_warp_3d_tex(Texture3D noise_tex, SamplerState s, float3 uvw, // Return distance to the nearest cell edge in a Voronoi pattern. float voronoi_edge_distance(float3 x) { - float3 p = floor(x); - float3 f = frac(x); + float3 x_floor = floor(x); + float3 x_frac = frac(x); float d1 = 1e6; float d2 = 1e6; float3 p1 = 0; @@ -225,8 +225,8 @@ float voronoi_edge_distance(float3 x) { for (int k = -1; k <= 1; k++) { for (int j = -1; j <= 1; j++) { for (int i = -1; i <= 1; i++) { - float3 b = float3(i, j, k); - float3 r = b + hash33_fast(p + b) - f; + float3 cell_offset = float3(i, j, k); + float3 r = cell_offset + hash33_fast(x_floor + cell_offset) - x_frac; float d = dot(r, r); if (d < d1) { d2 = d1; |
