Dont rescale fractal noise before image output
This commit is contained in:
parent
eecc648954
commit
3885e9a9ab
@ -29,14 +29,13 @@ util::noise::image2d (uint8_t *restrict pixels,
|
|||||||
size_t width,
|
size_t width,
|
||||||
size_t height,
|
size_t height,
|
||||||
const util::noise::fractal &p) {
|
const util::noise::fractal &p) {
|
||||||
util::range<double> r(0.0,0.0);
|
util::range<double> r(std::numeric_limits<double>::quiet_NaN (),
|
||||||
|
std::numeric_limits<double>::quiet_NaN ());
|
||||||
|
|
||||||
for (size_t y = 0; y < height; ++y)
|
for (size_t y = 0; y < height; ++y)
|
||||||
for (size_t x = 0; x < width; ++x) {
|
for (size_t x = 0; x < width; ++x) {
|
||||||
double v = p.eval (x / double (width) * 2, y / double (height) * 2);
|
double v = p.eval (x / double (width), y / double (height));
|
||||||
r.expand (v);
|
r.expand (v);
|
||||||
v += 1.0;
|
|
||||||
v /= 2.0;
|
|
||||||
pixels[x + y * width] = v * std::numeric_limits<uint8_t>::max ();
|
pixels[x + y * width] = v * std::numeric_limits<uint8_t>::max ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user