1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-18 20:41:18 +02:00

refactor: cal px, py directly

This commit is contained in:
Justin Lin
2022-04-01 22:15:24 +08:00
parent 4e0078f25c
commit b8e52677b3

View File

@@ -16,20 +16,17 @@ ripples();
module ripples() {
point_size = size / mesh_w;
points = [for(y = [0:point_size.y - 1], x = [0:point_size.x - 1]) [x, y] * mesh_w];
noise = [for(p = points) nz_worley2(p.x, p.y, seed, grid_w, dist)[2]];
sf = [
for(y = [0:point_size.y - 1])
[for(x = [0:point_size.x - 1])
[
for(x = [0:point_size.x - 1])
let(
i = point_size.x * y + x,
nz = noise[i],
p = points[i],
n = amplitude * nz_perlin2(nz + p.x / wave_smoothness, nz + p.y / wave_smoothness, seed)
px = x * mesh_w,
py = y * mesh_w,
nz = nz_worley2(px, py, seed, grid_w, dist)[2],
n = amplitude * nz_perlin2(nz + px / wave_smoothness, nz + py / wave_smoothness, seed)
)
[p.x, p.y, n]
[px, py, n]
]
];