veloren/world/src/index.rs

36 lines
685 B
Rust
Raw Normal View History

use crate::site::Site;
use common::store::Store;
use noise::{Seedable, SuperSimplex};
pub struct Index {
pub seed: u32,
pub time: f32,
2020-07-26 11:41:46 +00:00
pub noise: Noise,
pub sites: Store<Site>,
}
impl Index {
pub fn new(seed: u32) -> Self {
Self {
seed,
2020-07-26 11:41:46 +00:00
time: 0.0,
noise: Noise::new(seed),
sites: Store::default(),
}
}
}
pub struct Noise {
pub cave_nz: SuperSimplex,
2020-08-09 16:34:48 +00:00
pub scatter_nz: SuperSimplex,
2020-07-26 11:41:46 +00:00
}
impl Noise {
fn new(seed: u32) -> Self {
Self {
2020-08-09 16:34:48 +00:00
cave_nz: SuperSimplex::new().set_seed(seed + 0),
scatter_nz: SuperSimplex::new().set_seed(seed + 1),
}
}
}