Perlin noise fixes
This commit is contained in:
parent
3482eceea3
commit
36bfcb135e
1 changed files with 3 additions and 3 deletions
|
|
@ -93,13 +93,13 @@ namespace psemek::pcg
|
|||
ip[i] = geom::clamp<std::size_t>(std::floor(p[i]), {0, static_cast<std::size_t>(grad_map_.dim(i)) - 2});
|
||||
}
|
||||
|
||||
geom::vector<float, N> t = p - geom::cast<float>(ip);
|
||||
geom::vector<T, N> t = p - geom::cast<T>(ip);
|
||||
|
||||
T values[1 << N];
|
||||
|
||||
for (std::size_t mask = 0; mask < (1 << N); ++mask)
|
||||
{
|
||||
geom::vector<float, N> tt;
|
||||
geom::vector<T, N> tt;
|
||||
std::array<std::size_t, N> ii;
|
||||
for (std::size_t i = 0; i < N; ++i)
|
||||
{
|
||||
|
|
@ -122,7 +122,7 @@ namespace psemek::pcg
|
|||
values[mask] = smoothstep(values[mask], values[mask | (1 << i)], t[i]);
|
||||
}
|
||||
|
||||
return 0.5f * (1.f + std::sqrt(2.f) * values[0]);
|
||||
return 0.5 * (1. + std::sqrt(2.) * values[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue