@@ 3,6 3,8 @@ use math;
use os;
use time;
+def SAMPLES: uint = 50u;
+
fn init_scene() *hittable = {
let ground = alloc(make_lambertian(&C(0.8, 0.8, 0.0)));
let center = alloc(make_lambertian(&C(0.1, 0.2, 0.5)));
@@ 46,7 48,6 @@ export fn main() void = {
let img = image_create(width, height, C(0f64, 0f64, 0f64));
defer image_free(img);
- let samples = 50u32;
let max_bounce = 50u;
let from = V(3.0, -3.0, 2.0);
@@ 60,7 61,7 @@ export fn main() void = {
for (let j = 0z; j < height; j += 1) {
fmt::errorf("\rProgress: {}/{}", j, height)!;
for (let i = 0z; i < width; i += 1) {
- for (let k = 0u32; k < samples; k += 1) {
+ for (let k = 0u; k < SAMPLES; k += 1) {
let u = i: int: f64;
u += random(0.0, 1.0);
u /= (width: int: f64 - 1.0);
@@ 77,5 78,5 @@ export fn main() void = {
};
let end = time::unix(time::now(time::clock::MONOTONIC));
fmt::errorf("\rDone in {} s\n", end - start)!;
- write(os::stdout, img, samples)!;
+ write(os::stdout, img, SAMPLES)!;
};