Fixed seed expansion for noise seeding.

This commit is contained in:
Acrimon 2019-08-19 00:19:51 +02:00
parent 66dc78a4ce
commit 6b59f0bc9a

View File

@ -55,36 +55,36 @@ pub struct WorldSim {
impl WorldSim {
pub fn generate(mut seed: u32) -> Self {
let mut gen_seed = || {
seed = seed_expan::diffuse(seed + 1);
seed
seed = seed_expan::diffuse(seed);
let mut gen_seed = |seed: &mut u32| {
std::mem::replace(seed, seed_expan::diffuse(*seed + 1))
};
let mut gen_ctx = GenCtx {
turb_x_nz: SuperSimplex::new().set_seed(gen_seed()),
turb_y_nz: SuperSimplex::new().set_seed(gen_seed()),
chaos_nz: RidgedMulti::new().set_octaves(7).set_seed(gen_seed()),
hill_nz: SuperSimplex::new().set_seed(gen_seed()),
turb_x_nz: SuperSimplex::new().set_seed(gen_seed(&mut seed)),
turb_y_nz: SuperSimplex::new().set_seed(gen_seed(&mut seed)),
chaos_nz: RidgedMulti::new().set_octaves(7).set_seed(gen_seed(&mut seed)),
hill_nz: SuperSimplex::new().set_seed(gen_seed(&mut seed)),
alt_nz: HybridMulti::new()
.set_octaves(8)
.set_persistence(0.1)
.set_seed(gen_seed()),
temp_nz: SuperSimplex::new().set_seed(gen_seed()),
dry_nz: BasicMulti::new().set_seed(gen_seed()),
small_nz: BasicMulti::new().set_octaves(2).set_seed(gen_seed()),
rock_nz: HybridMulti::new().set_persistence(0.3).set_seed(gen_seed()),
cliff_nz: HybridMulti::new().set_persistence(0.3).set_seed(gen_seed()),
warp_nz: BasicMulti::new().set_octaves(3).set_seed(gen_seed()),
.set_seed(gen_seed(&mut seed)),
temp_nz: SuperSimplex::new().set_seed(gen_seed(&mut seed)),
dry_nz: BasicMulti::new().set_seed(gen_seed(&mut seed)),
small_nz: BasicMulti::new().set_octaves(2).set_seed(gen_seed(&mut seed)),
rock_nz: HybridMulti::new().set_persistence(0.3).set_seed(gen_seed(&mut seed)),
cliff_nz: HybridMulti::new().set_persistence(0.3).set_seed(gen_seed(&mut seed)),
warp_nz: BasicMulti::new().set_octaves(3).set_seed(gen_seed(&mut seed)),
tree_nz: BasicMulti::new()
.set_octaves(12)
.set_persistence(0.75)
.set_seed(gen_seed()),
cave_0_nz: SuperSimplex::new().set_seed(gen_seed()),
cave_1_nz: SuperSimplex::new().set_seed(gen_seed()),
.set_seed(gen_seed(&mut seed)),
cave_0_nz: SuperSimplex::new().set_seed(gen_seed(&mut seed)),
cave_1_nz: SuperSimplex::new().set_seed(gen_seed(&mut seed)),
structure_gen: StructureGen2d::new(gen_seed(), 32, 24),
region_gen: StructureGen2d::new(gen_seed(), 400, 96),
cliff_gen: StructureGen2d::new(gen_seed(), 80, 56),
structure_gen: StructureGen2d::new(gen_seed(&mut seed), 32, 24),
region_gen: StructureGen2d::new(gen_seed(&mut seed), 400, 96),
cliff_gen: StructureGen2d::new(gen_seed(&mut seed), 80, 56),
};
let mut chunks = Vec::new();