mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-19 04:51:26 +02:00
refactor: cal px, py directly
This commit is contained in:
@@ -16,21 +16,18 @@ ripples();
|
|||||||
module ripples() {
|
module ripples() {
|
||||||
point_size = size / mesh_w;
|
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 = [
|
sf = [
|
||||||
for(y = [0:point_size.y - 1])
|
for(y = [0:point_size.y - 1])
|
||||||
[for(x = [0:point_size.x - 1])
|
[
|
||||||
let(
|
for(x = [0:point_size.x - 1])
|
||||||
i = point_size.x * y + x,
|
let(
|
||||||
nz = noise[i],
|
px = x * mesh_w,
|
||||||
p = points[i],
|
py = y * mesh_w,
|
||||||
n = amplitude * nz_perlin2(nz + p.x / wave_smoothness, nz + p.y / wave_smoothness, seed)
|
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]
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
sf_thicken(sf, thickness);
|
sf_thicken(sf, thickness);
|
||||||
|
Reference in New Issue
Block a user