library: render: pathtracer: fix off-by-one exports
This commit is contained in:
parent
faa1ef1fb8
commit
1e7d0a2807
|
@ -68,6 +68,11 @@ impl Pathtracer {
|
||||||
(vec, count)
|
(vec, count)
|
||||||
},
|
},
|
||||||
|(mut acc, count), buf| {
|
|(mut acc, count), buf| {
|
||||||
|
for (i, pixel) in buf.into_iter().enumerate() {
|
||||||
|
acc[i] += pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
let count = count + 1; // Because count is 0-indexed
|
||||||
if steps.contains(&count) {
|
if steps.contains(&count) {
|
||||||
let image = buffer_to_image(&acc, count as u32, width, height);
|
let image = buffer_to_image(&acc, count as u32, width, height);
|
||||||
image
|
image
|
||||||
|
@ -75,11 +80,7 @@ impl Pathtracer {
|
||||||
.expect("writing image failed!");
|
.expect("writing image failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i, pixel) in buf.into_iter().enumerate() {
|
(acc, count) // Count has been updated previously
|
||||||
acc[i] += pixel;
|
|
||||||
}
|
|
||||||
|
|
||||||
(acc, count + 1)
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue