|
|
|
@ -14,7 +14,7 @@ fn main() { |
|
|
|
|
println!("{} {}", width, height); |
|
|
|
|
*/ |
|
|
|
|
let (width, height) = (640, 480); |
|
|
|
|
let (xr, yr) = ([-200, 200], [-200, 200]); |
|
|
|
|
let (xr, yr) = ([-320, 320], [-240, 240]); |
|
|
|
|
let depth = 500; |
|
|
|
|
|
|
|
|
|
let (window, ctx, vid_sys) = render::create_window("Mandelbrot set", width, height); |
|
|
|
@ -24,6 +24,20 @@ fn main() { |
|
|
|
|
canvas.clear(); |
|
|
|
|
canvas.present(); |
|
|
|
|
|
|
|
|
|
// render stuff
|
|
|
|
|
println!("Init mandel render"); |
|
|
|
|
for dx in xr[0]..xr[1] { |
|
|
|
|
for dy in yr[0]..yr[1] { |
|
|
|
|
let col: Color = mandel::get_point_color(width.try_into().unwrap(),
|
|
|
|
|
height.try_into().unwrap(),
|
|
|
|
|
dx, dy, depth);
|
|
|
|
|
//println!("{}:{} {:?}", dx, dy, col);
|
|
|
|
|
render::set_pixel(&mut canvas, dx, dy, col); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
canvas.present(); |
|
|
|
|
println!("Post mandel render"); |
|
|
|
|
|
|
|
|
|
let mut event_pump = ctx.event_pump().unwrap(); |
|
|
|
|
'running: loop { |
|
|
|
|
for event in event_pump.poll_iter() { |
|
|
|
@ -36,15 +50,6 @@ fn main() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// render stuff
|
|
|
|
|
for dx in xr[0]..xr[1] { |
|
|
|
|
for dy in yr[0]..yr[1] { |
|
|
|
|
let col: Color = mandel::get_point_color(width.try_into().unwrap(), height.try_into().unwrap(), dx, dy, depth);
|
|
|
|
|
println!("{}:{} {:?}", dx, dy, col); |
|
|
|
|
render::set_pixel(&mut canvas, dx, dy, col); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
canvas.present(); |
|
|
|
|
} |
|
|
|
|
::std::thread::sleep(Duration::new(0, 1_000_000_000u32 / 60)); |
|
|
|
|
} |
|
|
|
|