mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
replace DoublePerlinNoiseParameters with parsed one
This commit is contained in:
@@ -9,6 +9,7 @@ mod chunk_status;
|
||||
mod entity_pose;
|
||||
mod entity_type;
|
||||
mod game_event;
|
||||
mod noise_parmeter;
|
||||
mod packet;
|
||||
mod particle;
|
||||
mod scoreboard_slot;
|
||||
@@ -29,6 +30,7 @@ pub fn main() {
|
||||
write_generated_file(scoreboard_slot::build(), "scoreboard_slot.rs");
|
||||
write_generated_file(world_event::build(), "world_event.rs");
|
||||
write_generated_file(entity_type::build(), "entity_type.rs");
|
||||
write_generated_file(noise_parmeter::build(), "noise_parmeter.rs");
|
||||
}
|
||||
|
||||
pub fn array_to_tokenstream(array: Vec<String>) -> TokenStream {
|
||||
|
||||
56
pumpkin-data/build/noise_parmeter.rs
Normal file
56
pumpkin-data/build/noise_parmeter.rs
Normal file
@@ -0,0 +1,56 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::quote;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::ident;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct DoublePerlinNoiseParameters {
|
||||
first_octave: i32,
|
||||
amplitudes: Vec<f64>,
|
||||
}
|
||||
|
||||
pub(crate) fn build() -> TokenStream {
|
||||
println!("cargo:rerun-if-changed=assets/noise_parameters.json");
|
||||
|
||||
let json: HashMap<String, DoublePerlinNoiseParameters> =
|
||||
serde_json::from_str(include_str!("../../assets/noise_parameters.json"))
|
||||
.expect("Failed to parse noise_parameters.json");
|
||||
let mut variants = TokenStream::new();
|
||||
|
||||
for (name, paremter) in json.iter() {
|
||||
let raw_name = name;
|
||||
let name = ident(name.to_uppercase());
|
||||
let first_octave = paremter.first_octave;
|
||||
let amplitudes = &paremter.amplitudes;
|
||||
variants.extend([quote! {
|
||||
pub const #name: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(#first_octave, &[#(#amplitudes),*], #raw_name);
|
||||
}]);
|
||||
}
|
||||
|
||||
quote! {
|
||||
pub struct DoublePerlinNoiseParameters {
|
||||
pub first_octave: i32,
|
||||
pub amplitudes: &'static [f64],
|
||||
id: &'static str,
|
||||
}
|
||||
|
||||
impl DoublePerlinNoiseParameters {
|
||||
pub const fn new(first_octave: i32, amplitudes: &'static [f64], id: &'static str) -> Self {
|
||||
Self {
|
||||
first_octave,
|
||||
amplitudes,
|
||||
id
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn id(&self) -> &'static str {
|
||||
self.id
|
||||
}
|
||||
}
|
||||
|
||||
#variants
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,8 @@ pub mod sound {
|
||||
include!(concat!(env!("OUT_DIR"), "/sound_category.rs"));
|
||||
}
|
||||
|
||||
pub mod chunk_status {
|
||||
pub mod chunk {
|
||||
include!(concat!(env!("OUT_DIR"), "/noise_parmeter.rs"));
|
||||
include!(concat!(env!("OUT_DIR"), "/chunk_status.rs"));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use fastnbt::LongArray;
|
||||
use pumpkin_data::chunk_status::ChunkStatus;
|
||||
use pumpkin_data::chunk::ChunkStatus;
|
||||
use pumpkin_util::math::{ceil_log2, vector2::Vector2};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{collections::HashMap, iter::repeat_with};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use pumpkin_data::chunk::DoublePerlinNoiseParameters;
|
||||
use pumpkin_util::random::{
|
||||
legacy_rand::LegacyRand, xoroshiro128::Xoroshiro, RandomDeriver, RandomGenerator, RandomImpl,
|
||||
};
|
||||
@@ -13,7 +14,7 @@ use super::{
|
||||
end::EndIslandFunction,
|
||||
noise::InternalNoise,
|
||||
},
|
||||
perlin::{DoublePerlinNoiseParameters, DoublePerlinNoiseSampler},
|
||||
perlin::DoublePerlinNoiseSampler,
|
||||
router::BaseRouter,
|
||||
};
|
||||
|
||||
|
||||
@@ -953,15 +953,13 @@ mod test {
|
||||
|
||||
use pumpkin_util::random::{legacy_rand::LegacyRand, RandomDeriver, RandomImpl};
|
||||
|
||||
use crate::generation::noise::{
|
||||
built_in_noise_params,
|
||||
density::{
|
||||
noise::{InternalNoise, NoiseFunction},
|
||||
spline::{FloatAmplifier, ImmutableSplineRef, SplineBuilder, SplineFunction},
|
||||
test::{FakeEnvironment, OwnedConverter, TestConverter},
|
||||
NoisePos, UnblendedNoisePos,
|
||||
},
|
||||
use crate::generation::noise::density::{
|
||||
noise::{InternalNoise, NoiseFunction},
|
||||
spline::{FloatAmplifier, ImmutableSplineRef, SplineBuilder, SplineFunction},
|
||||
test::{FakeEnvironment, OwnedConverter, TestConverter},
|
||||
NoisePos, UnblendedNoisePos,
|
||||
};
|
||||
use pumpkin_data::chunk::*;
|
||||
|
||||
use super::{ComponentReference, NoEnvironment, SharedComponentReference};
|
||||
|
||||
@@ -969,10 +967,7 @@ mod test {
|
||||
fn test_owned_minimal_conversion_spline() {
|
||||
let minimal_spline = SplineBuilder::new(
|
||||
NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::NETHER_WART,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&NETHER_WART, None)),
|
||||
0.2f64,
|
||||
1.1f64,
|
||||
)
|
||||
@@ -1017,10 +1012,7 @@ mod test {
|
||||
fn test_nested_minimal_conversion_spline() {
|
||||
let minimal_spline = SplineBuilder::new(
|
||||
NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::NETHER_WART,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&NETHER_WART, None)),
|
||||
0.2f64,
|
||||
1.1f64,
|
||||
)
|
||||
@@ -1031,10 +1023,7 @@ mod test {
|
||||
0f32,
|
||||
SplineBuilder::new(
|
||||
NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::NETHER_WART,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&NETHER_WART, None)),
|
||||
0.2f64,
|
||||
1.1f64,
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ use noise::{InternalNoise, NoiseFunction};
|
||||
|
||||
use crate::generation::{blender::Blender, chunk_noise::ChunkNoisePos};
|
||||
|
||||
use super::perlin::DoublePerlinNoiseParameters;
|
||||
use pumpkin_data::chunk::DoublePerlinNoiseParameters;
|
||||
|
||||
pub mod basic;
|
||||
mod blend;
|
||||
@@ -74,9 +74,9 @@ pub trait NoisePosImpl {
|
||||
}
|
||||
|
||||
pub mod built_in_density_function {
|
||||
use pumpkin_data::chunk::*;
|
||||
use std::sync::{Arc, LazyLock};
|
||||
|
||||
use crate::generation::noise::built_in_noise_params::{self};
|
||||
use crate::generation::positions::{MAX_COLUMN_HEIGHT, MIN_HEIGHT};
|
||||
|
||||
use pumpkin_util::math::floor_div;
|
||||
@@ -124,11 +124,7 @@ pub mod built_in_density_function {
|
||||
pub static SHIFT_X: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||
ShiftAFunction::new(Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::OFFSET,
|
||||
None,
|
||||
)))
|
||||
.into(),
|
||||
ShiftAFunction::new(Arc::new(InternalNoise::new(&OFFSET, None))).into(),
|
||||
WrapperType::Cache2D,
|
||||
)
|
||||
.into(),
|
||||
@@ -139,11 +135,7 @@ pub mod built_in_density_function {
|
||||
pub static SHIFT_Z: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||
ShiftBFunction::new(Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::OFFSET,
|
||||
None,
|
||||
)))
|
||||
.into(),
|
||||
ShiftBFunction::new(Arc::new(InternalNoise::new(&OFFSET, None))).into(),
|
||||
WrapperType::Cache2D,
|
||||
)
|
||||
.into(),
|
||||
@@ -182,10 +174,7 @@ pub mod built_in_density_function {
|
||||
SHIFT_Z.clone(),
|
||||
0.25f64,
|
||||
0f64,
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::CONTINENTALNESS,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&CONTINENTALNESS, None)),
|
||||
)
|
||||
.into(),
|
||||
WrapperType::FlatCache,
|
||||
@@ -205,7 +194,7 @@ pub mod built_in_density_function {
|
||||
SHIFT_Z.clone(),
|
||||
0.25f64,
|
||||
0f64,
|
||||
Arc::new(InternalNoise::new(&built_in_noise_params::EROSION, None)),
|
||||
Arc::new(InternalNoise::new(&EROSION, None)),
|
||||
)
|
||||
.into(),
|
||||
WrapperType::FlatCache,
|
||||
@@ -225,7 +214,7 @@ pub mod built_in_density_function {
|
||||
SHIFT_Z.clone(),
|
||||
0.25f64,
|
||||
0f64,
|
||||
Arc::new(InternalNoise::new(&built_in_noise_params::RIDGE, None)),
|
||||
Arc::new(InternalNoise::new(&RIDGE, None)),
|
||||
)
|
||||
.into(),
|
||||
WrapperType::FlatCache,
|
||||
@@ -242,12 +231,7 @@ pub mod built_in_density_function {
|
||||
.mul_const(-3f64)
|
||||
});
|
||||
static JAGGED_NOISE: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||
NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(&built_in_noise_params::JAGGED, None)),
|
||||
1500f64,
|
||||
0f64,
|
||||
)
|
||||
.into()
|
||||
NoiseFunction::new(Arc::new(InternalNoise::new(&JAGGED, None)), 1500f64, 0f64).into()
|
||||
});
|
||||
pub static OFFSET_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||
apply_blending(
|
||||
@@ -329,10 +313,7 @@ pub mod built_in_density_function {
|
||||
SHIFT_Z.clone(),
|
||||
0.25f64,
|
||||
0f64,
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::CONTINENTALNESS_LARGE,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&CONTINENTALNESS_LARGE, None)),
|
||||
)
|
||||
.into(),
|
||||
WrapperType::FlatCache,
|
||||
@@ -353,10 +334,7 @@ pub mod built_in_density_function {
|
||||
SHIFT_Z.clone(),
|
||||
0.25f64,
|
||||
0f64,
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::EROSION_LARGE,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&EROSION_LARGE, None)),
|
||||
)
|
||||
.into(),
|
||||
WrapperType::FlatCache,
|
||||
@@ -511,21 +489,13 @@ pub mod built_in_density_function {
|
||||
pub static CAVES_SPAGHETTI_ROUGHNESS_FUNCTION_OVERWORLD: LazyLock<SharedComponentReference> =
|
||||
LazyLock::new(|| {
|
||||
let function = NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::SPAGHETTI_ROUGHNESS,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&SPAGHETTI_ROUGHNESS, None)),
|
||||
1f64,
|
||||
1f64,
|
||||
);
|
||||
|
||||
let function2 = noise_in_range(
|
||||
&built_in_noise_params::SPAGHETTI_ROUGHNESS_MODULATOR,
|
||||
1f64,
|
||||
1f64,
|
||||
0f64,
|
||||
-0.1f64,
|
||||
);
|
||||
let function2 =
|
||||
noise_in_range(&SPAGHETTI_ROUGHNESS_MODULATOR, 1f64, 1f64, 0f64, -0.1f64);
|
||||
|
||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||
function2.mul(function.abs().add_const(-0.4f64)),
|
||||
@@ -536,13 +506,7 @@ pub mod built_in_density_function {
|
||||
pub static CAVES_SPAGHETTI_2D_THICKNESS_MODULAR_OVERWORLD: LazyLock<SharedComponentReference> =
|
||||
LazyLock::new(|| {
|
||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||
noise_in_range(
|
||||
&built_in_noise_params::SPAGHETTI_2D_THICKNESS,
|
||||
2f64,
|
||||
1f64,
|
||||
-0.6f64,
|
||||
-1.3f64,
|
||||
),
|
||||
noise_in_range(&SPAGHETTI_2D_THICKNESS, 2f64, 1f64, -0.6f64, -1.3f64),
|
||||
WrapperType::OnceCache,
|
||||
)
|
||||
.into()
|
||||
@@ -550,25 +514,19 @@ pub mod built_in_density_function {
|
||||
pub static CAVES_SPAGHETTI_2D_OVERWORLD: LazyLock<SharedComponentReference> =
|
||||
LazyLock::new(|| {
|
||||
let function1 = NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::SPAGHETTI_2D_MODULATOR,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&SPAGHETTI_2D_MODULATOR, None)),
|
||||
2f64,
|
||||
1f64,
|
||||
);
|
||||
|
||||
let function2 = WierdScaledFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||
function1.into(),
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::SPAGHETTI_2D,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&SPAGHETTI_2D, None)),
|
||||
RarityMapper::Caves,
|
||||
);
|
||||
|
||||
let function3 = noise_in_range(
|
||||
&built_in_noise_params::SPAGHETTI_2D_ELEVATION,
|
||||
&SPAGHETTI_2D_ELEVATION,
|
||||
1f64,
|
||||
0f64,
|
||||
floor_div(-64, 8) as f64,
|
||||
@@ -592,10 +550,7 @@ pub mod built_in_density_function {
|
||||
let function_ref: SharedComponentReference =
|
||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||
NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::SPAGHETTI_3D_RARITY,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&SPAGHETTI_3D_RARITY, None)),
|
||||
2f64,
|
||||
1f64,
|
||||
)
|
||||
@@ -604,29 +559,18 @@ pub mod built_in_density_function {
|
||||
)
|
||||
.into();
|
||||
|
||||
let function2 = noise_in_range(
|
||||
&built_in_noise_params::SPAGHETTI_3D_THICKNESS,
|
||||
1f64,
|
||||
1f64,
|
||||
-0.065f64,
|
||||
-0.088f64,
|
||||
);
|
||||
let function2 =
|
||||
noise_in_range(&SPAGHETTI_3D_THICKNESS, 1f64, 1f64, -0.065f64, -0.088f64);
|
||||
|
||||
let function3 = WierdScaledFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||
function_ref.clone(),
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::SPAGHETTI_3D_1,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&SPAGHETTI_3D_1, None)),
|
||||
RarityMapper::Tunnels,
|
||||
);
|
||||
|
||||
let function4 = WierdScaledFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||
function_ref,
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::SPAGHETTI_3D_2,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&SPAGHETTI_3D_2, None)),
|
||||
RarityMapper::Tunnels,
|
||||
);
|
||||
let function5 = function3
|
||||
@@ -637,10 +581,7 @@ pub mod built_in_density_function {
|
||||
let function6 = CAVES_SPAGHETTI_ROUGHNESS_FUNCTION_OVERWORLD.clone();
|
||||
|
||||
let function7 = NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::CAVE_ENTRANCE,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&CAVE_ENTRANCE, None)),
|
||||
0.75f64,
|
||||
0.5f64,
|
||||
);
|
||||
@@ -658,12 +599,7 @@ pub mod built_in_density_function {
|
||||
pub static CAVES_NOODLE_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||
let function2 = vertical_range_choice(
|
||||
Y.clone(),
|
||||
NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(&built_in_noise_params::NOODLE, None)),
|
||||
1f64,
|
||||
1f64,
|
||||
)
|
||||
.into(),
|
||||
NoiseFunction::new(Arc::new(InternalNoise::new(&NOODLE, None)), 1f64, 1f64).into(),
|
||||
-60,
|
||||
320,
|
||||
-1,
|
||||
@@ -671,13 +607,7 @@ pub mod built_in_density_function {
|
||||
|
||||
let function3 = vertical_range_choice(
|
||||
Y.clone(),
|
||||
noise_in_range(
|
||||
&built_in_noise_params::NOODLE_THICKNESS,
|
||||
1f64,
|
||||
1f64,
|
||||
-0.05f64,
|
||||
-0.1f64,
|
||||
),
|
||||
noise_in_range(&NOODLE_THICKNESS, 1f64, 1f64, -0.05f64, -0.1f64),
|
||||
-60,
|
||||
320,
|
||||
0,
|
||||
@@ -686,10 +616,7 @@ pub mod built_in_density_function {
|
||||
let function4 = vertical_range_choice(
|
||||
Y.clone(),
|
||||
NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::NOODLE_RIDGE_A,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&NOODLE_RIDGE_A, None)),
|
||||
2.6666666666666665f64,
|
||||
2.6666666666666665f64,
|
||||
)
|
||||
@@ -702,10 +629,7 @@ pub mod built_in_density_function {
|
||||
let function5 = vertical_range_choice(
|
||||
Y.clone(),
|
||||
NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::NOODLE_RIDGE_B,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&NOODLE_RIDGE_B, None)),
|
||||
2.6666666666666665f64,
|
||||
2.6666666666666665f64,
|
||||
)
|
||||
@@ -732,27 +656,12 @@ pub mod built_in_density_function {
|
||||
.into()
|
||||
});
|
||||
pub static CAVES_PILLARS_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||
let function = NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(&built_in_noise_params::PILLAR, None)),
|
||||
25f64,
|
||||
0.3f64,
|
||||
);
|
||||
let function =
|
||||
NoiseFunction::new(Arc::new(InternalNoise::new(&PILLAR, None)), 25f64, 0.3f64);
|
||||
|
||||
let function2 = noise_in_range(
|
||||
&built_in_noise_params::PILLAR_RARENESS,
|
||||
1f64,
|
||||
1f64,
|
||||
0f64,
|
||||
-2f64,
|
||||
);
|
||||
let function2 = noise_in_range(&PILLAR_RARENESS, 1f64, 1f64, 0f64, -2f64);
|
||||
|
||||
let function3 = noise_in_range(
|
||||
&built_in_noise_params::PILLAR_THICKNESS,
|
||||
1f64,
|
||||
1f64,
|
||||
0f64,
|
||||
1.1f64,
|
||||
);
|
||||
let function3 = noise_in_range(&PILLAR_THICKNESS, 1f64, 1f64, 0f64, 1.1f64);
|
||||
|
||||
let function4 = function.mul_const(2f64).add(function2);
|
||||
|
||||
@@ -875,15 +784,14 @@ pub fn lerp_density_static_start(
|
||||
mod test {
|
||||
use std::sync::Arc;
|
||||
|
||||
use pumpkin_util::random::{
|
||||
legacy_rand::LegacyRand, RandomDeriver, RandomDeriverImpl, RandomImpl,
|
||||
};
|
||||
|
||||
use crate::generation::noise::{
|
||||
built_in_noise_params,
|
||||
density::{built_in_density_function::*, NoisePos, UnblendedNoisePos},
|
||||
perlin::DoublePerlinNoiseSampler,
|
||||
};
|
||||
use pumpkin_data::chunk::*;
|
||||
use pumpkin_util::random::{
|
||||
legacy_rand::LegacyRand, RandomDeriver, RandomDeriverImpl, RandomImpl,
|
||||
};
|
||||
|
||||
use super::{
|
||||
component_functions::{
|
||||
@@ -1357,21 +1265,11 @@ mod test {
|
||||
#[test]
|
||||
fn test_owned_converter() {
|
||||
let test_func = NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::NETHER_WART,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&NETHER_WART, None)),
|
||||
10f64,
|
||||
1.2f64,
|
||||
)
|
||||
.add(
|
||||
NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(&built_in_noise_params::NOODLE, None)),
|
||||
0.1f64,
|
||||
-1f64,
|
||||
)
|
||||
.into(),
|
||||
);
|
||||
.add(NoiseFunction::new(Arc::new(InternalNoise::new(&NOODLE, None)), 0.1f64, -1f64).into());
|
||||
|
||||
let mut rand = LegacyRand::from_seed(0);
|
||||
let splitter = rand.next_splitter();
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
use std::{marker::PhantomData, sync::Arc};
|
||||
|
||||
use pumpkin_data::chunk::*;
|
||||
use pumpkin_util::random::{xoroshiro128::Xoroshiro, RandomGenerator, RandomImpl};
|
||||
|
||||
use crate::{
|
||||
generation::noise::{
|
||||
clamped_lerp,
|
||||
perlin::{DoublePerlinNoiseParameters, DoublePerlinNoiseSampler, OctavePerlinNoiseSampler},
|
||||
perlin::{DoublePerlinNoiseSampler, OctavePerlinNoiseSampler},
|
||||
},
|
||||
match_ref_implementations,
|
||||
};
|
||||
|
||||
@@ -5,191 +5,6 @@ pub mod perlin;
|
||||
pub mod router;
|
||||
mod simplex;
|
||||
|
||||
pub mod built_in_noise_params {
|
||||
use super::perlin::DoublePerlinNoiseParameters;
|
||||
|
||||
pub const TEMPERATURE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(
|
||||
-10,
|
||||
&[1.5f64, 0f64, 1f64, 0f64, 0f64, 0f64],
|
||||
"minecraft:temperature",
|
||||
);
|
||||
pub const VEGETATION: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(
|
||||
-8,
|
||||
&[1f64, 1f64, 0f64, 0f64, 0f64, 0f64],
|
||||
"minecraft:vegetation",
|
||||
);
|
||||
pub const CONTINENTALNESS: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(
|
||||
-9,
|
||||
&[1f64, 1f64, 2f64, 2f64, 2f64, 1f64, 1f64, 1f64, 1f64],
|
||||
"minecraft:continentalness",
|
||||
);
|
||||
pub const EROSION: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-9, &[1f64, 1f64, 0f64, 1f64, 1f64], "minecraft:erosion");
|
||||
pub const TEMPERATURE_LARGE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(
|
||||
-12,
|
||||
&[1.5f64, 0f64, 1f64, 0f64, 0f64, 0f64],
|
||||
"minecraft:temperature_large",
|
||||
);
|
||||
pub const VEGETATION_LARGE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(
|
||||
-10,
|
||||
&[1f64, 1f64, 0f64, 0f64, 0f64, 0f64],
|
||||
"minecraft:vegetation_large",
|
||||
);
|
||||
pub const CONTINENTALNESS_LARGE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(
|
||||
-11,
|
||||
&[1f64, 1f64, 2f64, 2f64, 2f64, 1f64, 1f64, 1f64, 1f64],
|
||||
"minecraft:continentalness_large",
|
||||
);
|
||||
pub const EROSION_LARGE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(
|
||||
-11,
|
||||
&[1f64, 1f64, 0f64, 1f64, 1f64],
|
||||
"minecraft:erosion_large",
|
||||
);
|
||||
pub const RIDGE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(
|
||||
-7,
|
||||
&[1f64, 2f64, 1f64, 0f64, 0f64, 0f64],
|
||||
"minecraft:ridge",
|
||||
);
|
||||
pub const OFFSET: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-3, &[1f64, 1f64, 1f64, 0f64], "minecraft:offset");
|
||||
pub const AQUIFER_BARRIER: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-3, &[1f64], "minecraft:aquifer_barrier");
|
||||
pub const AQUIFER_FLUID_LEVEL_FLOODEDNESS: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:aquifer_fluid_level_floodedness");
|
||||
pub const AQUIFER_LAVA: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-1, &[1f64], "minecraft:aquifer_lava");
|
||||
pub const AQUIFER_FLUID_LEVEL_SPREAD: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-5, &[1f64], "minecraft:aquifer_fluid_level_spread");
|
||||
pub const PILLAR: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-7, &[1f64; 2], "minecraft:pillar");
|
||||
pub const PILLAR_RARENESS: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:pillar_rareness");
|
||||
pub const PILLAR_THICKNESS: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:pillar_thickness");
|
||||
pub const SPAGHETTI_2D: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:spaghetti_2d");
|
||||
pub const SPAGHETTI_2D_ELEVATION: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:spaghetti_2d_elevation");
|
||||
pub const SPAGHETTI_2D_MODULATOR: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-11, &[1f64], "minecraft:spaghetti_2d_modulator");
|
||||
pub const SPAGHETTI_2D_THICKNESS: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-11, &[1f64], "minecraft:spaghetti_2d_thickness");
|
||||
pub const SPAGHETTI_3D_1: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:spaghetti_3d_1");
|
||||
pub const SPAGHETTI_3D_2: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:spaghetti_3d_2");
|
||||
pub const SPAGHETTI_3D_RARITY: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-11, &[1f64], "minecraft:spaghetti_3d_rarity");
|
||||
pub const SPAGHETTI_3D_THICKNESS: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:spaghetti_3d_thickness");
|
||||
pub const SPAGHETTI_ROUGHNESS: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-5, &[1f64], "minecraft:spaghetti_roughness");
|
||||
pub const SPAGHETTI_ROUGHNESS_MODULATOR: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:spaghetti_roughness_modulator");
|
||||
pub const CAVE_ENTRANCE: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-7, &[0.4f64, 0.5f64, 1f64], "minecraft:cave_entrance");
|
||||
pub const CAVE_LAYER: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:cave_layer");
|
||||
pub const CAVE_CHEESE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(
|
||||
-8,
|
||||
&[0.5f64, 1f64, 2f64, 1f64, 2f64, 1f64, 0f64, 2f64, 0f64],
|
||||
"minecraft:cave_cheese",
|
||||
);
|
||||
pub const ORE_VEININESS: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:ore_veininess");
|
||||
pub const ORE_VEIN_A: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:ore_vein_a");
|
||||
pub const ORE_VEIN_B: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:ore_vein_b");
|
||||
pub const ORE_GAP: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-5, &[1f64], "minecraft:ore_gap");
|
||||
pub const NOODLE: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:noodle");
|
||||
pub const NOODLE_THICKNESS: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:noodle_thickness");
|
||||
pub const NOODLE_RIDGE_A: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:noodle_ridge_a");
|
||||
pub const NOODLE_RIDGE_B: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:noodle_ridge_b");
|
||||
|
||||
pub const JAGGED: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-16, &[1f64; 16], "minecraft:jagged");
|
||||
pub const SURFACE: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-6, &[1f64; 3], "minecraft:surface");
|
||||
pub const SURFACE_SECONDARY: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(
|
||||
-6,
|
||||
&[1f64, 1f64, 0f64, 1f64],
|
||||
"minecraft:surface_secondary",
|
||||
);
|
||||
pub const CLAY_BANDS_OFFSET: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:clay_bands_offset");
|
||||
pub const BADLANDS_PILLAR: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-2, &[1f64; 4], "minecraft:badlands_pillar");
|
||||
pub const BADLANDS_PILLAR_ROOF: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:badlands_pillar_roof");
|
||||
pub const BADLANDS_SURFACE: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-6, &[1f64; 3], "minecraft:badlands_surface");
|
||||
pub const ICEBERG_PILLAR: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-6, &[1f64; 4], "minecraft:iceberg_pillar");
|
||||
pub const ICEBERG_PILLAR_ROOF: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-3, &[1f64], "minecraft:iceberg_pillar_roof");
|
||||
pub const ICEBERG_SURFACE: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-6, &[1f64; 3], "minecraft:iceberg_surface");
|
||||
pub const SURFACE_SWAMP: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-2, &[1f64], "minecraft:surface_swamp");
|
||||
pub const CALCITE: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-9, &[1f64; 4], "minecraft:calcite");
|
||||
pub const GRAVEL: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-8, &[1f64; 4], "minecraft:gravel");
|
||||
pub const POWDER_SNOW: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-6, &[1f64; 4], "minecraft:powder_snow");
|
||||
pub const PACKED_ICE: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-7, &[1f64; 4], "minecraft:packed_ice");
|
||||
pub const ICE: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-4, &[1f64; 4], "minecraft:ice");
|
||||
pub const SOUL_SAND_LAYER: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(
|
||||
-8,
|
||||
&[
|
||||
1f64,
|
||||
1f64,
|
||||
1f64,
|
||||
1f64,
|
||||
0f64,
|
||||
0f64,
|
||||
0f64,
|
||||
0f64,
|
||||
0.013333333333333334f64,
|
||||
],
|
||||
"minecraft:soul_sand_layer",
|
||||
);
|
||||
pub const GRAVEL_LAYER: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(
|
||||
-8,
|
||||
&[
|
||||
1f64,
|
||||
1f64,
|
||||
1f64,
|
||||
1f64,
|
||||
0f64,
|
||||
0f64,
|
||||
0f64,
|
||||
0f64,
|
||||
0.013333333333333334f64,
|
||||
],
|
||||
"minecraft:gravel_layer",
|
||||
);
|
||||
pub const PATCH: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new(
|
||||
-5,
|
||||
&[1f64, 0f64, 0f64, 0f64, 0f64, 0.013333333333333334f64],
|
||||
"minecraft:patch",
|
||||
);
|
||||
pub const NETHERRACK: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-3, &[1f64, 0f64, 0f64, 0.35f64], "minecraft:netherrack");
|
||||
pub const NETHER_WART: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-3, &[1f64, 0f64, 0f64, 0.9f64], "minecraft:nether_wart");
|
||||
pub const NETHER_STATE_SELECTOR: DoublePerlinNoiseParameters =
|
||||
DoublePerlinNoiseParameters::new(-4, &[1f64], "minecraft:nether_state_selector");
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn lerp<T>(delta: T, start: T, end: T) -> T
|
||||
where
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use num_traits::Pow;
|
||||
use pumpkin_data::chunk::DoublePerlinNoiseParameters;
|
||||
use pumpkin_util::random::RandomGenerator;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::{lerp3, GRADIENTS};
|
||||
|
||||
@@ -293,30 +293,6 @@ impl OctavePerlinNoiseSampler {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct DoublePerlinNoiseParameters {
|
||||
first_octave: i32,
|
||||
amplitudes: &'static [f64],
|
||||
id: &'static str,
|
||||
}
|
||||
|
||||
impl DoublePerlinNoiseParameters {
|
||||
pub(crate) const fn new(
|
||||
first_octave: i32,
|
||||
amplitudes: &'static [f64],
|
||||
id: &'static str,
|
||||
) -> Self {
|
||||
Self {
|
||||
first_octave,
|
||||
amplitudes,
|
||||
id,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn id(&self) -> &'static str {
|
||||
self.id
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct DoublePerlinNoiseSampler {
|
||||
first_sampler: Arc<OctavePerlinNoiseSampler>,
|
||||
@@ -377,12 +353,12 @@ impl DoublePerlinNoiseSampler {
|
||||
|
||||
#[cfg(test)]
|
||||
mod double_perlin_noise_sampler_test {
|
||||
use crate::generation::noise::perlin::DoublePerlinNoiseSampler;
|
||||
use pumpkin_data::chunk::DoublePerlinNoiseParameters;
|
||||
use pumpkin_util::random::{
|
||||
legacy_rand::LegacyRand, xoroshiro128::Xoroshiro, RandomGenerator, RandomImpl,
|
||||
};
|
||||
|
||||
use crate::generation::noise::perlin::{DoublePerlinNoiseParameters, DoublePerlinNoiseSampler};
|
||||
|
||||
#[test]
|
||||
fn sample_legacy() {
|
||||
let mut rand = LegacyRand::from_seed(513513513);
|
||||
|
||||
@@ -13,26 +13,23 @@ use crate::generation::{
|
||||
},
|
||||
ore_sampler::vein_type,
|
||||
};
|
||||
use pumpkin_data::chunk::*;
|
||||
|
||||
use super::{
|
||||
built_in_noise_params,
|
||||
density::{
|
||||
basic::{ConstantFunction, WrapperFunction, WrapperType, YClampedFunction},
|
||||
built_in_density_function::{
|
||||
CAVES_PILLARS_OVERWORLD, CAVES_SPAGHETTI_2D_OVERWORLD,
|
||||
CAVES_SPAGHETTI_ROUGHNESS_FUNCTION_OVERWORLD, DEPTH_OVERWORLD,
|
||||
DEPTH_OVERWORLD_AMPLIFIED, DEPTH_OVERWORLD_LARGE_BIOME, FACTOR_OVERWORLD,
|
||||
FACTOR_OVERWORLD_AMPLIFIED, FACTOR_OVERWORLD_LARGE_BIOME, SHIFT_X, SHIFT_Z,
|
||||
SLOPED_CHEESE_OVERWORLD, SLOPED_CHEESE_OVERWORLD_AMPLIFIED,
|
||||
SLOPED_CHEESE_OVERWORLD_LARGE_BIOME, ZERO,
|
||||
},
|
||||
component_functions::{
|
||||
ComponentReference, ComponentReferenceMap, ComponentReferenceMath, ConverterImpl,
|
||||
DensityFunctionEnvironment, NoEnvironment, SharedComponentReference,
|
||||
},
|
||||
lerp_density_static_start,
|
||||
noise::{InternalNoise, NoiseFunction, ShiftedNoiseFunction},
|
||||
use super::density::{
|
||||
basic::{ConstantFunction, WrapperFunction, WrapperType, YClampedFunction},
|
||||
built_in_density_function::{
|
||||
CAVES_PILLARS_OVERWORLD, CAVES_SPAGHETTI_2D_OVERWORLD,
|
||||
CAVES_SPAGHETTI_ROUGHNESS_FUNCTION_OVERWORLD, DEPTH_OVERWORLD, DEPTH_OVERWORLD_AMPLIFIED,
|
||||
DEPTH_OVERWORLD_LARGE_BIOME, FACTOR_OVERWORLD, FACTOR_OVERWORLD_AMPLIFIED,
|
||||
FACTOR_OVERWORLD_LARGE_BIOME, SHIFT_X, SHIFT_Z, SLOPED_CHEESE_OVERWORLD,
|
||||
SLOPED_CHEESE_OVERWORLD_AMPLIFIED, SLOPED_CHEESE_OVERWORLD_LARGE_BIOME, ZERO,
|
||||
},
|
||||
component_functions::{
|
||||
ComponentReference, ComponentReferenceMap, ComponentReferenceMath, ConverterImpl,
|
||||
DensityFunctionEnvironment, NoEnvironment, SharedComponentReference,
|
||||
},
|
||||
lerp_density_static_start,
|
||||
noise::{InternalNoise, NoiseFunction, ShiftedNoiseFunction},
|
||||
};
|
||||
|
||||
pub static OVERWORLD_NOISE_ROUTER: LazyLock<BaseRouter> =
|
||||
@@ -153,37 +150,25 @@ impl BaseRouter {
|
||||
assert!(!(large_biomes && amplified));
|
||||
|
||||
let aquifier_barrier = NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::AQUIFER_BARRIER,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&AQUIFER_BARRIER, None)),
|
||||
1f64,
|
||||
0.5f64,
|
||||
);
|
||||
|
||||
let aquifier_fluid_level_floodedness = NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::AQUIFER_FLUID_LEVEL_FLOODEDNESS,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&AQUIFER_FLUID_LEVEL_FLOODEDNESS, None)),
|
||||
1f64,
|
||||
0.67f64,
|
||||
);
|
||||
|
||||
let aquifer_fluid_level_spread = NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::AQUIFER_FLUID_LEVEL_SPREAD,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&AQUIFER_FLUID_LEVEL_SPREAD, None)),
|
||||
1f64,
|
||||
0.7142857142857143f64,
|
||||
);
|
||||
|
||||
let aquifer_lava = NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::AQUIFER_LAVA,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&AQUIFER_LAVA, None)),
|
||||
1f64,
|
||||
1f64,
|
||||
);
|
||||
@@ -201,9 +186,9 @@ impl BaseRouter {
|
||||
0f64,
|
||||
Arc::new(InternalNoise::new(
|
||||
if large_biomes {
|
||||
&built_in_noise_params::TEMPERATURE_LARGE
|
||||
&TEMPERATURE_LARGE
|
||||
} else {
|
||||
&built_in_noise_params::TEMPERATURE
|
||||
&TEMPERATURE
|
||||
},
|
||||
None,
|
||||
)),
|
||||
@@ -222,9 +207,9 @@ impl BaseRouter {
|
||||
0f64,
|
||||
Arc::new(InternalNoise::new(
|
||||
if large_biomes {
|
||||
&built_in_noise_params::VEGETATION_LARGE
|
||||
&VEGETATION_LARGE
|
||||
} else {
|
||||
&built_in_noise_params::VEGETATION
|
||||
&VEGETATION
|
||||
},
|
||||
None,
|
||||
)),
|
||||
@@ -295,10 +280,7 @@ impl BaseRouter {
|
||||
let ore_veininess = vertical_range_choice(
|
||||
Y.clone(),
|
||||
NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::ORE_VEININESS,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&ORE_VEININESS, None)),
|
||||
1.5f64,
|
||||
1.5f64,
|
||||
)
|
||||
@@ -310,12 +292,7 @@ impl BaseRouter {
|
||||
|
||||
let ore_vein_a = vertical_range_choice(
|
||||
Y.clone(),
|
||||
NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(&built_in_noise_params::ORE_VEIN_A, None)),
|
||||
4f64,
|
||||
4f64,
|
||||
)
|
||||
.into(),
|
||||
NoiseFunction::new(Arc::new(InternalNoise::new(&ORE_VEIN_A, None)), 4f64, 4f64).into(),
|
||||
i,
|
||||
j,
|
||||
0,
|
||||
@@ -324,12 +301,7 @@ impl BaseRouter {
|
||||
|
||||
let ore_vein_b = vertical_range_choice(
|
||||
Y.clone(),
|
||||
NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(&built_in_noise_params::ORE_VEIN_B, None)),
|
||||
4f64,
|
||||
4f64,
|
||||
)
|
||||
.into(),
|
||||
NoiseFunction::new(Arc::new(InternalNoise::new(&ORE_VEIN_B, None)), 4f64, 4f64).into(),
|
||||
i,
|
||||
j,
|
||||
0,
|
||||
@@ -338,11 +310,7 @@ impl BaseRouter {
|
||||
|
||||
let ore_vein = ConstantFunction::new(-0.08f32 as f64).add(ore_vein_a.max(ore_vein_b));
|
||||
|
||||
let ore_gap = NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(&built_in_noise_params::ORE_GAP, None)),
|
||||
1f64,
|
||||
1f64,
|
||||
);
|
||||
let ore_gap = NoiseFunction::new(Arc::new(InternalNoise::new(&ORE_GAP, None)), 1f64, 1f64);
|
||||
|
||||
Self {
|
||||
barrier: aquifier_barrier.into(),
|
||||
@@ -423,17 +391,11 @@ fn apply_slides(
|
||||
}
|
||||
|
||||
fn create_caves(sloped_cheese: SharedComponentReference) -> SharedComponentReference {
|
||||
let cave_layer = NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(&built_in_noise_params::CAVE_LAYER, None)),
|
||||
1f64,
|
||||
8f64,
|
||||
);
|
||||
let cave_layer =
|
||||
NoiseFunction::new(Arc::new(InternalNoise::new(&CAVE_LAYER, None)), 1f64, 8f64);
|
||||
let scaled_cave_layer = ConstantFunction::new(4f64).mul(cave_layer.square());
|
||||
let cave_cheese = NoiseFunction::new(
|
||||
Arc::new(InternalNoise::new(
|
||||
&built_in_noise_params::CAVE_CHEESE,
|
||||
None,
|
||||
)),
|
||||
Arc::new(InternalNoise::new(&CAVE_CHEESE, None)),
|
||||
1f64,
|
||||
0.6666666666666666f64,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user