equal
deleted
inserted
replaced
25 seed: String, |
25 seed: String, |
26 #[structopt(short = "d", long = "dump-before-distort")] |
26 #[structopt(short = "d", long = "dump-before-distort")] |
27 dump_before_distort: bool, |
27 dump_before_distort: bool, |
28 #[structopt(short = "b", long = "dump-before-bezierize")] |
28 #[structopt(short = "b", long = "dump-before-bezierize")] |
29 dump_before_bezierize: bool, |
29 dump_before_bezierize: bool, |
|
30 #[structopt(short = "f", long = "distance-divisor", default_value = "100")] |
|
31 distance_divisor: u32, |
30 } |
32 } |
31 |
33 |
32 fn template() -> OutlineTemplate { |
34 fn template() -> OutlineTemplate { |
33 let mut template = OutlineTemplate::new(Size::new(4096, 2048)); |
35 let mut template = OutlineTemplate::new(Size::new(4096, 2048)); |
34 template.islands = vec![vec![ |
36 template.islands = vec![vec![ |
42 template |
44 template |
43 } |
45 } |
44 |
46 |
45 fn dump( |
47 fn dump( |
46 seed: &[u8], |
48 seed: &[u8], |
|
49 distance_divisor: u32, |
47 skip_distort: bool, |
50 skip_distort: bool, |
48 skip_bezier: bool, |
51 skip_bezier: bool, |
49 file_name: &Path, |
52 file_name: &Path, |
50 ) -> std::io::Result<()> { |
53 ) -> std::io::Result<()> { |
51 let params = LandGenerationParameters::new(0 as u8, 255, 100, skip_distort, skip_bezier); |
54 let params = LandGenerationParameters::new(0 as u8, 255, distance_divisor, skip_distort, skip_bezier); |
52 let landgen = TemplatedLandGenerator::new(template()); |
55 let landgen = TemplatedLandGenerator::new(template()); |
53 let mut prng = LaggedFibonacciPRNG::new(seed); |
56 let mut prng = LaggedFibonacciPRNG::new(seed); |
54 let land = landgen.generate_land(¶ms, &mut prng); |
57 let land = landgen.generate_land(¶ms, &mut prng); |
55 |
58 |
56 let file = File::create(file_name)?; |
59 let file = File::create(file_name)?; |
72 println!("{:?}", opt); |
75 println!("{:?}", opt); |
73 |
76 |
74 if opt.dump_before_distort { |
77 if opt.dump_before_distort { |
75 dump( |
78 dump( |
76 opt.seed.as_str().as_bytes(), |
79 opt.seed.as_str().as_bytes(), |
|
80 opt.distance_divisor, |
77 true, |
81 true, |
78 true, |
82 true, |
79 Path::new("out.before_distort.png"), |
83 Path::new("out.before_distort.png"), |
80 ) |
84 ) |
81 .unwrap(); |
85 .unwrap(); |
82 } |
86 } |
83 if opt.dump_before_bezierize { |
87 if opt.dump_before_bezierize { |
84 dump( |
88 dump( |
85 opt.seed.as_str().as_bytes(), |
89 opt.seed.as_str().as_bytes(), |
|
90 opt.distance_divisor, |
86 false, |
91 false, |
87 true, |
92 true, |
88 Path::new("out.before_bezier.png"), |
93 Path::new("out.before_bezier.png"), |
89 ) |
94 ) |
90 .unwrap(); |
95 .unwrap(); |
91 } |
96 } |
92 dump( |
97 dump( |
93 opt.seed.as_str().as_bytes(), |
98 opt.seed.as_str().as_bytes(), |
|
99 opt.distance_divisor, |
94 false, |
100 false, |
95 true, |
101 true, |
96 Path::new("out.full.png"), |
102 Path::new("out.full.png"), |
97 ) |
103 ) |
98 .unwrap(); |
104 .unwrap(); |