a large number of small ui changes

This commit is contained in:
grimsace
2026-04-21 14:12:02 -05:00
parent 4295bb6b0f
commit 82f8323ff4
2 changed files with 77 additions and 45 deletions
+17 -4
View File
@@ -28,7 +28,7 @@ impl Default for GenerationParams {
Self {
image_width: 512,
image_height: 512,
generation_scale: 6.0,
generation_scale: 1.0,
erosion_scale: 0.15,
random_seed: 0,
erosion_strength: 0.05,
@@ -124,9 +124,10 @@ fn clamp01(x: f32) -> f32 {
}
fn hash22(p: Vec2, random_seed: u64) -> Vec2 {
let seed = random_seed as f64;
let seed_x = seed * 0.754_877_666_246_692_7;
let seed_y = seed * 0.569_840_290_998_053_2;
let scrambled_x = splitmix64(random_seed ^ 0x9E37_79B9_7F4A_7C15);
let scrambled_y = splitmix64(random_seed ^ 0xBF58_476D_1CE4_E5B9);
let seed_x = u64_to_unit_f64(scrambled_x) * 1024.0;
let seed_y = u64_to_unit_f64(scrambled_y) * 1024.0;
let kx = 0.318_309_9_f64;
let ky = 0.367_879_4_f64;
@@ -140,6 +141,18 @@ fn hash22(p: Vec2, random_seed: u64) -> Vec2 {
Vec2::new(rx as f32, ry as f32)
}
fn splitmix64(mut x: u64) -> u64 {
x = x.wrapping_add(0x9E37_79B9_7F4A_7C15);
x = (x ^ (x >> 30)).wrapping_mul(0xBF58_476D_1CE4_E5B9);
x = (x ^ (x >> 27)).wrapping_mul(0x94D0_49BB_1331_11EB);
x ^ (x >> 31)
}
fn u64_to_unit_f64(value: u64) -> f64 {
const SCALE: f64 = 1.0 / (u64::MAX as f64);
(value as f64) * SCALE
}
fn noised(p: Vec2, random_seed: u64) -> (f32, Vec2) {
let i = Vec2::new(p.x.floor(), p.y.floor());
let f = Vec2::new(p.x - i.x, p.y - i.y);