Crates.io | ds-heightmap |
lib.rs | ds-heightmap |
version | 0.2.1 |
source | src |
created_at | 2022-05-10 07:11:01.489476 |
updated_at | 2023-06-04 02:28:25.581165 |
description | Using diamond-square algorithm to generate heightmaps which stored in a 2D-array. |
homepage | https://github.com/fralonra/ds-heightmap |
repository | https://github.com/fralonra/ds-heightmap |
max_upload_size | |
id | 583851 |
size | 12,972 |
Install wasm-pack and build:
wasm-pack build --release
use ds_heightmap::Runner;
fn main() {
let mut runner = Runner::new();
let output = runner.ds();
println!("data: {:?}", output.data);
println!("max: {}", output.max);
println!("min: {}", output.min);
}
If you would like to supply a random number generator:
use ds_heightmap::Runner;
use rand_chacha::{rand_core::SeedableRng, ChaCha8Rng};
fn main() {
let mut rng = ChaCha8Rng::from_entropy();
let mut runner = Runner::new();
let output = runner.ds_with_rng(&mut rng);
println!("data: {:?}", output.data);
println!("max: {}", output.max);
println!("min: {}", output.min);
}