-
Notifications
You must be signed in to change notification settings - Fork 125
/
Copy pathopen_simplex.rs
42 lines (35 loc) · 1.1 KB
/
open_simplex.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! An example of using simplex noise
extern crate noise;
use noise::{
core::open_simplex::{open_simplex_2d, open_simplex_3d, open_simplex_4d},
permutationtable::PermutationTable,
utils::*,
};
mod utils;
fn main() {
let hasher = PermutationTable::new(0);
utils::write_example_to_file(
&PlaneMapBuilder::new_fn(|point| open_simplex_2d(point.into(), &hasher))
.set_size(1024, 1024)
.set_x_bounds(-5.0, 5.0)
.set_y_bounds(-5.0, 5.0)
.build(),
"open_simplex 2d.png",
);
utils::write_example_to_file(
&PlaneMapBuilder::new_fn(|point| open_simplex_3d(point.into(), &hasher))
.set_size(1024, 1024)
.set_x_bounds(-5.0, 5.0)
.set_y_bounds(-5.0, 5.0)
.build(),
"open_simplex 3d.png",
);
utils::write_example_to_file(
&PlaneMapBuilder::new_fn(|point| open_simplex_4d(point.into(), &hasher))
.set_size(1024, 1024)
.set_x_bounds(-5.0, 5.0)
.set_y_bounds(-5.0, 5.0)
.build(),
"open_simplex 4d.png",
);
}