mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed seed expansion for noise seeding.
This commit is contained in:
parent
66dc78a4ce
commit
6b59f0bc9a
@ -55,36 +55,36 @@ pub struct WorldSim {
|
|||||||
|
|
||||||
impl WorldSim {
|
impl WorldSim {
|
||||||
pub fn generate(mut seed: u32) -> Self {
|
pub fn generate(mut seed: u32) -> Self {
|
||||||
let mut gen_seed = || {
|
seed = seed_expan::diffuse(seed);
|
||||||
seed = seed_expan::diffuse(seed + 1);
|
let mut gen_seed = |seed: &mut u32| {
|
||||||
seed
|
std::mem::replace(seed, seed_expan::diffuse(*seed + 1))
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut gen_ctx = GenCtx {
|
let mut gen_ctx = GenCtx {
|
||||||
turb_x_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()),
|
turb_y_nz: SuperSimplex::new().set_seed(gen_seed(&mut seed)),
|
||||||
chaos_nz: RidgedMulti::new().set_octaves(7).set_seed(gen_seed()),
|
chaos_nz: RidgedMulti::new().set_octaves(7).set_seed(gen_seed(&mut seed)),
|
||||||
hill_nz: SuperSimplex::new().set_seed(gen_seed()),
|
hill_nz: SuperSimplex::new().set_seed(gen_seed(&mut seed)),
|
||||||
alt_nz: HybridMulti::new()
|
alt_nz: HybridMulti::new()
|
||||||
.set_octaves(8)
|
.set_octaves(8)
|
||||||
.set_persistence(0.1)
|
.set_persistence(0.1)
|
||||||
.set_seed(gen_seed()),
|
.set_seed(gen_seed(&mut seed)),
|
||||||
temp_nz: SuperSimplex::new().set_seed(gen_seed()),
|
temp_nz: SuperSimplex::new().set_seed(gen_seed(&mut seed)),
|
||||||
dry_nz: BasicMulti::new().set_seed(gen_seed()),
|
dry_nz: BasicMulti::new().set_seed(gen_seed(&mut seed)),
|
||||||
small_nz: BasicMulti::new().set_octaves(2).set_seed(gen_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()),
|
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()),
|
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()),
|
warp_nz: BasicMulti::new().set_octaves(3).set_seed(gen_seed(&mut seed)),
|
||||||
tree_nz: BasicMulti::new()
|
tree_nz: BasicMulti::new()
|
||||||
.set_octaves(12)
|
.set_octaves(12)
|
||||||
.set_persistence(0.75)
|
.set_persistence(0.75)
|
||||||
.set_seed(gen_seed()),
|
.set_seed(gen_seed(&mut seed)),
|
||||||
cave_0_nz: SuperSimplex::new().set_seed(gen_seed()),
|
cave_0_nz: SuperSimplex::new().set_seed(gen_seed(&mut seed)),
|
||||||
cave_1_nz: SuperSimplex::new().set_seed(gen_seed()),
|
cave_1_nz: SuperSimplex::new().set_seed(gen_seed(&mut seed)),
|
||||||
|
|
||||||
structure_gen: StructureGen2d::new(gen_seed(), 32, 24),
|
structure_gen: StructureGen2d::new(gen_seed(&mut seed), 32, 24),
|
||||||
region_gen: StructureGen2d::new(gen_seed(), 400, 96),
|
region_gen: StructureGen2d::new(gen_seed(&mut seed), 400, 96),
|
||||||
cliff_gen: StructureGen2d::new(gen_seed(), 80, 56),
|
cliff_gen: StructureGen2d::new(gen_seed(&mut seed), 80, 56),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut chunks = Vec::new();
|
let mut chunks = Vec::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user