From 66035e375c585f301602c150c26f3699dfb7b055 Mon Sep 17 00:00:00 2001 From: yum Date: Sun, 12 Apr 2026 17:21:42 -0700 Subject: Improve naming in voronoi function --- math.cginc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'math.cginc') diff --git a/math.cginc b/math.cginc index ee70495..b79d9b6 100755 --- a/math.cginc +++ b/math.cginc @@ -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; -- cgit v1.2.3