Scale based on minimum dimension to fit the frame

This commit is contained in:
Bradlee Speice 2025-02-09 09:31:25 -05:00
parent a94ab87eab
commit 0a1e0f98c6

View File

@ -257,12 +257,12 @@ pub fn main_cs(
point = next_transform(&mut rng, transform_weight, transforms).apply(variations, point);
}
// ...because `<i32>.max(<i32>)` has compilation issues.
let max_dimension = if image_constants.accum_width > image_constants.accum_height { image_constants.accum_width } else { image_constants.accum_height };
// ...because `<i32>.min(<i32>)` has compilation issues.
let min_dimension = if image_constants.accum_width < image_constants.accum_height { image_constants.accum_width } else { image_constants.accum_height };
// Fixed camera, should be provided by a uniform in the future
let camera = CameraConstants {
scale: max_dimension as f32 / 4.0,
scale: min_dimension as f32 / 4.0,
zoom: 2.0,
rotate: 0.0,
offset_x: 0.5,