Finalize marble parameters for scene/final.
Add pixel_scale parameter to noise_explorer to allow scaling of p vector passed to value function.
This commit is contained in:
@@ -9,7 +9,8 @@ pub trait NoiseSource: Send + Sync {
|
||||
/// value returns noise on the interval [0., 1.).
|
||||
fn value(&self, p: Vec3) -> f32;
|
||||
|
||||
fn marble(&self, p: Vec3, period: Vec3, power: f32, size: usize) -> f32 {
|
||||
fn marble(&self, p: Vec3, period: Vec3, power: f32, size: usize, scale: f32) -> f32 {
|
||||
let p = p / scale;
|
||||
// TODO(wathiede): can't understand why 255 works for perlin and lode, maybe it's near 360
|
||||
// degrees and interacts with the sine function?
|
||||
let xyz_value = p.x * period.x / 255.
|
||||
@@ -52,6 +53,7 @@ pub enum NoiseType {
|
||||
period: Vec3,
|
||||
power: f32,
|
||||
size: usize,
|
||||
scale: f32,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -64,9 +66,10 @@ impl NoiseType {
|
||||
period,
|
||||
power,
|
||||
size,
|
||||
scale,
|
||||
} => format!(
|
||||
"marble/period/{},{},{}/power/{}/size/{}",
|
||||
period.x, period.y, period.z, power, size,
|
||||
"marble/period/{},{},{}/power/{}/size/{}/scale/{}",
|
||||
period.x, period.y, period.z, power, size, scale
|
||||
),
|
||||
}
|
||||
}
|
||||
@@ -79,10 +82,12 @@ impl NoiseType {
|
||||
period,
|
||||
power,
|
||||
size,
|
||||
scale,
|
||||
} => vec![
|
||||
("Period", period.to_string()),
|
||||
("Power", power.to_string()),
|
||||
("Size", size.to_string()),
|
||||
("Scale", scale.to_string()),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user