add hdr flag

This commit is contained in:
tigregalis 2025-01-08 11:29:27 +08:00
parent 81d3a928bf
commit 3396f812ef
2 changed files with 7 additions and 3 deletions

View File

@ -848,8 +848,12 @@ impl Image {
///
/// [`Camera`]: https://docs.rs/bevy/latest/bevy/render/camera/struct.Camera.html
/// [`RenderTarget::Image`]: https://docs.rs/bevy/latest/bevy/render/camera/enum.RenderTarget.html#variant.Image
pub fn new_target_texture(width: u32, height: u32) -> Self {
let format = TextureFormat::bevy_default();
pub fn new_target_texture(width: u32, height: u32, hdr: bool) -> Self {
let format = if hdr {
TEXTURE_FORMAT_HDR
} else {
TEXTURE_FORMAT_SDR
};
let size = Extent3d {
width,
height,

View File

@ -27,7 +27,7 @@ fn setup(
mut images: ResMut<Assets<Image>>,
) {
// This is the texture that will be rendered to.
let image = Image::new_target_texture(512, 512);
let image = Image::new_target_texture(512, 512, false);
let image_handle = images.add(image);