Scale pcg::perlin output to [0,1]
This commit is contained in:
parent
7697adcc68
commit
1cfdde033b
1 changed files with 2 additions and 1 deletions
|
|
@ -44,7 +44,8 @@ namespace psemek::pcg
|
|||
float const d01 = tx * grad_map_(ix, iy+1)[0] + (ty-1.f) * grad_map_(ix, iy+1)[1];
|
||||
float const d11 = (tx-1.f) * grad_map_(ix+1, iy+1)[0] + (ty-1.f) * grad_map_(ix+1, iy+1)[1];
|
||||
|
||||
return smoothstep(smoothstep(d00, d10, tx), smoothstep(d01, d11, tx), ty);
|
||||
float v = smoothstep(smoothstep(d00, d10, tx), smoothstep(d01, d11, tx), ty) * std::sqrt(2.f);
|
||||
return 0.5f + v * 0.5f;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue