Path: blob/main/crates/bevy_render/src/texture/manual_texture_view.rs
6596 views
use bevy_camera::ManualTextureViewHandle;1use bevy_ecs::{prelude::Component, resource::Resource};2use bevy_image::BevyDefault;3use bevy_math::UVec2;4use bevy_platform::collections::HashMap;5use bevy_render_macros::ExtractResource;6use wgpu::TextureFormat;78use crate::render_resource::TextureView;910/// A manually managed [`TextureView`] for use as a [`bevy_camera::RenderTarget`].11#[derive(Debug, Clone, Component)]12pub struct ManualTextureView {13pub texture_view: TextureView,14pub size: UVec2,15pub format: TextureFormat,16}1718impl ManualTextureView {19pub fn with_default_format(texture_view: TextureView, size: UVec2) -> Self {20Self {21texture_view,22size,23format: TextureFormat::bevy_default(),24}25}26}2728/// Stores manually managed [`ManualTextureView`]s for use as a [`bevy_camera::RenderTarget`].29#[derive(Default, Clone, Resource, ExtractResource)]30pub struct ManualTextureViews(HashMap<ManualTextureViewHandle, ManualTextureView>);3132impl core::ops::Deref for ManualTextureViews {33type Target = HashMap<ManualTextureViewHandle, ManualTextureView>;3435fn deref(&self) -> &Self::Target {36&self.037}38}3940impl core::ops::DerefMut for ManualTextureViews {41fn deref_mut(&mut self) -> &mut Self::Target {42&mut self.043}44}454647