-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Images loaded in RenderApp ignores ImageSettings #5744
Copy link
Copy link
Open
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior
Description
Bevy version 0.8
There's a texture I want to have FilterMode::Nearest.
I've tried to insert_resource(ImageSettings::default_nearest()) but I believe due to the circumstance when it get's loaded, the ImageSettings seems to be ignored.
the sampler get's set to FilterMode::Linear despite the ImageSetting.
The code:
pub struct ChunkTexture(pub Handle<Image>);
impl FromWorld for ChunkTexture {
fn from_world(world: &mut World) -> Self {
let asset_server = world.resource_mut::<AssetServer>();
ChunkTexture(asset_server.load("textures/block_atlas.png"))
}
}loading occurs here:
// no effect
app.insert_resource(ImageSettings::default_nearest())
app.sub_app_mut(RenderApp)
// no effect
.insert_resource(ImageSettings::default_nearest())
.init_resource::<ChunkTexture>()I'm currently getting around this by hacking together this (added the "core/main" app):
Which has the side effect of forcing all images to be nearest.
fn set_texture_filters_to_nearest(
mut texture_events: EventReader<AssetEvent<Image>>,
mut textures: ResMut<Assets<Image>>,
) {
for event in texture_events.iter() {
if let AssetEvent::Created { handle } = event {
if let Some(mut texture) = textures.get_mut(handle) {
texture.sampler_descriptor = ImageSampler::nearest();
}
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior