Fix the magnification range of the tessellation test

This commit is contained in:
Emil Ernerfeldt 2025-02-04 17:35:55 +01:00
parent 985e569542
commit 0db56dc9f1
1 changed files with 20 additions and 18 deletions

View File

@ -178,7 +178,7 @@ impl crate::View for TessellationTest {
ui.add( ui.add(
egui::DragValue::new(magnification_pixel_size) egui::DragValue::new(magnification_pixel_size)
.speed(0.5) .speed(0.5)
.range(0.0..=64.0), .range(1.0..=32.0),
); );
ui.end_row(); ui.end_row();
@ -244,25 +244,27 @@ impl crate::View for TessellationTest {
} }
} }
// Draw pixel centers: if 3.0 < magnification_pixel_size {
let pixel_radius = 0.75; // Draw pixel centers:
let pixel_color = Color32::GRAY; let pixel_radius = 0.75;
for yi in 0.. { let pixel_color = Color32::GRAY;
let y = (yi as f32 + 0.5) * magnification_pixel_size; for yi in 0.. {
if y > canvas.height() / 2.0 { let y = (yi as f32 + 0.5) * magnification_pixel_size;
break; if y > canvas.height() / 2.0 {
}
for xi in 0.. {
let x = (xi as f32 + 0.5) * magnification_pixel_size;
if x > canvas.width() / 2.0 {
break; break;
} }
for offset in [vec2(x, y), vec2(x, -y), vec2(-x, y), vec2(-x, -y)] { for xi in 0.. {
painter.circle_filled( let x = (xi as f32 + 0.5) * magnification_pixel_size;
canvas.center() + offset, if x > canvas.width() / 2.0 {
pixel_radius, break;
pixel_color, }
); for offset in [vec2(x, y), vec2(x, -y), vec2(-x, y), vec2(-x, -y)] {
painter.circle_filled(
canvas.center() + offset,
pixel_radius,
pixel_color,
);
}
} }
} }
} }