Revert "feat(engine): per-theme nearest-sampling opt-in for pixel-art themes"

This reverts commit 17e3112502.
This commit is contained in:
funman300
2026-05-06 19:38:13 -07:00
parent aad8bb9c83
commit e41def8c89
7 changed files with 0 additions and 54 deletions
-32
View File
@@ -187,7 +187,6 @@ fn sync_card_image_set_with_active_theme(
themes: Res<Assets<CardTheme>>,
mut card_image_set: Option<ResMut<CardImageSet>>,
mut state_events: MessageWriter<StateChangedEvent>,
mut images: ResMut<Assets<Image>>,
) {
let Some(active) = active else { return };
let active_id = active.0.id();
@@ -208,9 +207,6 @@ fn sync_card_image_set_with_active_theme(
let Some(theme) = themes.get(&active.0) else {
return;
};
if theme.meta.pixel_art {
apply_nearest_sampler_to_theme_images(theme, &mut images);
}
let Some(card_image_set) = card_image_set.as_deref_mut() else {
return;
};
@@ -218,32 +214,6 @@ fn sync_card_image_set_with_active_theme(
state_events.write(StateChangedEvent);
}
/// Overrides the texture sampler on every face + back `Image` in
/// `theme` to nearest-neighbor (point) sampling, so non-integer
/// downscales preserve crisp pixel-grid edges instead of bilinear
/// blur.
///
/// Called only for themes whose manifest sets `meta.pixel_art = true`.
/// SVG-rasterised themes leave the field at its `false` default and
/// keep Bevy's smooth-downscale sampler — pixel-art and SVG paths use
/// different filters from the same loader pipeline because they
/// optimise for different artwork tradeoffs.
fn apply_nearest_sampler_to_theme_images(
theme: &CardTheme,
images: &mut Assets<Image>,
) {
use bevy::image::{ImageSampler, ImageSamplerDescriptor};
let nearest = ImageSampler::Descriptor(ImageSamplerDescriptor::nearest());
for handle in theme.faces.values() {
if let Some(image) = images.get_mut(handle) {
image.sampler = nearest.clone();
}
}
if let Some(image) = images.get_mut(&theme.back) {
image.sampler = nearest;
}
}
/// Pure helper that copies the theme's image handles into the
/// `[suit][rank]` face matrix and into the dedicated `theme_back`
/// slot. Split out so it can be unit-tested without spinning up a
@@ -489,7 +459,6 @@ mod tests {
author: "test".into(),
version: "0".into(),
card_aspect: (2, 3),
pixel_art: false,
},
faces: HashMap::new(),
back: Handle::default(),
@@ -754,7 +723,6 @@ mod tests {
author: "x".into(),
version: "x".into(),
card_aspect: (2, 3),
pixel_art: false,
},
}],
});