diff --git a/crates/bevy_core_pipeline/src/auto_exposure/pipeline.rs b/crates/bevy_core_pipeline/src/auto_exposure/pipeline.rs index 798bb368e1..87d6abd8cf 100644 --- a/crates/bevy_core_pipeline/src/auto_exposure/pipeline.rs +++ b/crates/bevy_core_pipeline/src/auto_exposure/pipeline.rs @@ -3,11 +3,11 @@ use super::compensation_curve::{ }; use bevy_asset::prelude::*; use bevy_ecs::prelude::*; +use bevy_image::Image; use bevy_render::{ globals::GlobalsUniform, render_resource::{binding_types::*, *}, renderer::RenderDevice, - texture::Image, view::ViewUniform, }; use core::num::NonZero; diff --git a/crates/bevy_core_pipeline/src/auto_exposure/settings.rs b/crates/bevy_core_pipeline/src/auto_exposure/settings.rs index 066e8d3c88..91bdf836ee 100644 --- a/crates/bevy_core_pipeline/src/auto_exposure/settings.rs +++ b/crates/bevy_core_pipeline/src/auto_exposure/settings.rs @@ -3,8 +3,9 @@ use core::ops::RangeInclusive; use super::compensation_curve::AutoExposureCompensationCurve; use bevy_asset::Handle; use bevy_ecs::{prelude::Component, reflect::ReflectComponent}; +use bevy_image::Image; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; -use bevy_render::{extract_component::ExtractComponent, texture::Image}; +use bevy_render::extract_component::ExtractComponent; use bevy_utils::default; /// Component that enables auto exposure for an HDR-enabled 2d or 3d camera. diff --git a/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs b/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs index 093c6fa9a3..e76be196d5 100644 --- a/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs +++ b/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs @@ -6,6 +6,7 @@ use crate::{ use bevy_app::prelude::*; use bevy_asset::{load_internal_asset, Handle}; use bevy_ecs::{prelude::*, query::QueryItem}; +use bevy_image::BevyDefault as _; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ extract_component::{ExtractComponent, ExtractComponentPlugin, UniformComponentPlugin}, @@ -16,7 +17,6 @@ use bevy_render::{ *, }, renderer::RenderDevice, - texture::BevyDefault, view::{ExtractedView, ViewTarget}, Render, RenderApp, RenderSet, }; diff --git a/crates/bevy_core_pipeline/src/core_3d/mod.rs b/crates/bevy_core_pipeline/src/core_3d/mod.rs index ae88905bac..4a616226d1 100644 --- a/crates/bevy_core_pipeline/src/core_3d/mod.rs +++ b/crates/bevy_core_pipeline/src/core_3d/mod.rs @@ -65,14 +65,15 @@ pub const DEPTH_TEXTURE_SAMPLING_SUPPORTED: bool = true; use core::ops::Range; -use bevy_asset::{AssetId, UntypedAssetId}; -use bevy_color::LinearRgba; pub use camera_3d::*; pub use main_opaque_pass_3d_node::*; pub use main_transparent_pass_3d_node::*; use bevy_app::{App, Plugin, PostUpdate}; +use bevy_asset::{AssetId, UntypedAssetId}; +use bevy_color::LinearRgba; use bevy_ecs::{entity::EntityHashSet, prelude::*}; +use bevy_image::{BevyDefault, Image}; use bevy_math::FloatOrd; use bevy_render::sync_world::MainEntity; use bevy_render::{ @@ -91,7 +92,7 @@ use bevy_render::{ }, renderer::RenderDevice, sync_world::RenderEntity, - texture::{BevyDefault, ColorAttachment, Image, TextureCache}, + texture::{ColorAttachment, TextureCache}, view::{ExtractedView, ViewDepthTexture, ViewTarget}, Extract, ExtractSchedule, Render, RenderApp, RenderSet, }; diff --git a/crates/bevy_core_pipeline/src/dof/mod.rs b/crates/bevy_core_pipeline/src/dof/mod.rs index d4ed35e64e..06cbbe3e9d 100644 --- a/crates/bevy_core_pipeline/src/dof/mod.rs +++ b/crates/bevy_core_pipeline/src/dof/mod.rs @@ -26,6 +26,7 @@ use bevy_ecs::{ system::{lifetimeless::Read, Commands, Query, Res, ResMut, Resource}, world::{FromWorld, World}, }; +use bevy_image::BevyDefault as _; use bevy_math::ops; use bevy_reflect::{prelude::ReflectDefault, Reflect}; use bevy_render::{ @@ -48,7 +49,7 @@ use bevy_render::{ renderer::{RenderContext, RenderDevice}, sync_component::SyncComponentPlugin, sync_world::RenderEntity, - texture::{BevyDefault, CachedTexture, TextureCache}, + texture::{CachedTexture, TextureCache}, view::{ prepare_view_targets, ExtractedView, Msaa, ViewDepthTexture, ViewTarget, ViewUniform, ViewUniformOffset, ViewUniforms, diff --git a/crates/bevy_core_pipeline/src/fxaa/mod.rs b/crates/bevy_core_pipeline/src/fxaa/mod.rs index 076d40dcfc..547b597624 100644 --- a/crates/bevy_core_pipeline/src/fxaa/mod.rs +++ b/crates/bevy_core_pipeline/src/fxaa/mod.rs @@ -6,6 +6,7 @@ use crate::{ use bevy_app::prelude::*; use bevy_asset::{load_internal_asset, Handle}; use bevy_ecs::prelude::*; +use bevy_image::BevyDefault as _; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ extract_component::{ExtractComponent, ExtractComponentPlugin}, @@ -16,7 +17,6 @@ use bevy_render::{ *, }, renderer::RenderDevice, - texture::BevyDefault, view::{ExtractedView, ViewTarget}, Render, RenderApp, RenderSet, }; diff --git a/crates/bevy_core_pipeline/src/motion_blur/pipeline.rs b/crates/bevy_core_pipeline/src/motion_blur/pipeline.rs index c4fbd1c572..8109beeb4e 100644 --- a/crates/bevy_core_pipeline/src/motion_blur/pipeline.rs +++ b/crates/bevy_core_pipeline/src/motion_blur/pipeline.rs @@ -5,6 +5,7 @@ use bevy_ecs::{ system::{Commands, Query, Res, ResMut, Resource}, world::FromWorld, }; +use bevy_image::BevyDefault as _; use bevy_render::{ globals::GlobalsUniform, render_resource::{ @@ -19,7 +20,6 @@ use bevy_render::{ TextureFormat, TextureSampleType, }, renderer::RenderDevice, - texture::BevyDefault, view::{ExtractedView, Msaa, ViewTarget}, }; diff --git a/crates/bevy_core_pipeline/src/oit/resolve/mod.rs b/crates/bevy_core_pipeline/src/oit/resolve/mod.rs index e86ef1259a..101f7b1ed9 100644 --- a/crates/bevy_core_pipeline/src/oit/resolve/mod.rs +++ b/crates/bevy_core_pipeline/src/oit/resolve/mod.rs @@ -9,6 +9,7 @@ use bevy_ecs::{ entity::{EntityHashMap, EntityHashSet}, prelude::*, }; +use bevy_image::BevyDefault as _; use bevy_render::{ render_resource::{ binding_types::{storage_buffer_sized, texture_depth_2d, uniform_buffer}, @@ -18,7 +19,6 @@ use bevy_render::{ Shader, ShaderDefVal, ShaderStages, TextureFormat, }, renderer::{RenderAdapter, RenderDevice}, - texture::BevyDefault, view::{ExtractedView, ViewTarget, ViewUniform, ViewUniforms}, Render, RenderApp, RenderSet, }; diff --git a/crates/bevy_core_pipeline/src/post_process/mod.rs b/crates/bevy_core_pipeline/src/post_process/mod.rs index f7131482ae..a633134b27 100644 --- a/crates/bevy_core_pipeline/src/post_process/mod.rs +++ b/crates/bevy_core_pipeline/src/post_process/mod.rs @@ -14,6 +14,7 @@ use bevy_ecs::{ system::{lifetimeless::Read, Commands, Query, Res, ResMut, Resource}, world::{FromWorld, World}, }; +use bevy_image::{BevyDefault, Image}; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ camera::Camera, @@ -32,7 +33,7 @@ use bevy_render::{ TextureDimension, TextureFormat, TextureSampleType, }, renderer::{RenderContext, RenderDevice, RenderQueue}, - texture::{BevyDefault, GpuImage, Image}, + texture::GpuImage, view::{ExtractedView, ViewTarget}, Render, RenderApp, RenderSet, }; diff --git a/crates/bevy_core_pipeline/src/skybox/mod.rs b/crates/bevy_core_pipeline/src/skybox/mod.rs index de74cb62cb..5ca7c3fce2 100644 --- a/crates/bevy_core_pipeline/src/skybox/mod.rs +++ b/crates/bevy_core_pipeline/src/skybox/mod.rs @@ -6,6 +6,7 @@ use bevy_ecs::{ schedule::IntoSystemConfigs, system::{Commands, Query, Res, ResMut, Resource}, }; +use bevy_image::{BevyDefault, Image}; use bevy_math::{Mat4, Quat}; use bevy_render::{ camera::Exposure, @@ -19,7 +20,7 @@ use bevy_render::{ *, }, renderer::RenderDevice, - texture::{BevyDefault, GpuImage, Image}, + texture::GpuImage, view::{ExtractedView, Msaa, ViewTarget, ViewUniform, ViewUniforms}, Render, RenderApp, RenderSet, }; diff --git a/crates/bevy_core_pipeline/src/smaa/mod.rs b/crates/bevy_core_pipeline/src/smaa/mod.rs index 2338ecfced..ae294c19b2 100644 --- a/crates/bevy_core_pipeline/src/smaa/mod.rs +++ b/crates/bevy_core_pipeline/src/smaa/mod.rs @@ -30,6 +30,10 @@ //! //! [SMAA]: https://www.iryoku.com/smaa/ +use crate::{ + core_2d::graph::{Core2d, Node2d}, + core_3d::graph::{Core3d, Node3d}, +}; use bevy_app::{App, Plugin}; #[cfg(feature = "smaa_luts")] use bevy_asset::load_internal_binary_asset; @@ -44,6 +48,7 @@ use bevy_ecs::{ system::{lifetimeless::Read, Commands, Query, Res, ResMut, Resource}, world::{FromWorld, World}, }; +use bevy_image::{BevyDefault, Image}; use bevy_math::{vec4, Vec4}; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ @@ -67,24 +72,12 @@ use bevy_render::{ VertexState, }, renderer::{RenderContext, RenderDevice, RenderQueue}, - texture::{BevyDefault, CachedTexture, GpuImage, Image, TextureCache}, + texture::{CachedTexture, GpuImage, TextureCache}, view::{ExtractedView, ViewTarget}, Render, RenderApp, RenderSet, }; -#[cfg(feature = "smaa_luts")] -use bevy_render::{ - render_asset::RenderAssetUsages, - texture::{CompressedImageFormats, ImageFormat, ImageSampler, ImageType}, -}; use bevy_utils::prelude::default; -#[cfg(not(feature = "smaa_luts"))] -use crate::tonemapping::lut_placeholder; -use crate::{ - core_2d::graph::{Core2d, Node2d}, - core_3d::graph::{Core3d, Node3d}, -}; - /// The handle of the `smaa.wgsl` shader. const SMAA_SHADER_HANDLE: Handle = Handle::weak_from_u128(12247928498010601081); /// The handle of the area LUT, a KTX2 format texture that SMAA uses internally. @@ -306,11 +299,11 @@ impl Plugin for SmaaPlugin { #[cfg(all(debug_assertions, feature = "dds"))] "SMAAAreaLUT".to_owned(), bytes, - ImageType::Format(ImageFormat::Ktx2), - CompressedImageFormats::NONE, + bevy_image::ImageType::Format(bevy_image::ImageFormat::Ktx2), + bevy_image::CompressedImageFormats::NONE, false, - ImageSampler::Default, - RenderAssetUsages::RENDER_WORLD, + bevy_image::ImageSampler::Default, + bevy_asset::RenderAssetUsages::RENDER_WORLD, ) .expect("Failed to load SMAA area LUT") ); @@ -324,11 +317,11 @@ impl Plugin for SmaaPlugin { #[cfg(all(debug_assertions, feature = "dds"))] "SMAASearchLUT".to_owned(), bytes, - ImageType::Format(ImageFormat::Ktx2), - CompressedImageFormats::NONE, + bevy_image::ImageType::Format(bevy_image::ImageFormat::Ktx2), + bevy_image::CompressedImageFormats::NONE, false, - ImageSampler::Default, - RenderAssetUsages::RENDER_WORLD, + bevy_image::ImageSampler::Default, + bevy_asset::RenderAssetUsages::RENDER_WORLD, ) .expect("Failed to load SMAA search LUT") ); diff --git a/crates/bevy_core_pipeline/src/taa/mod.rs b/crates/bevy_core_pipeline/src/taa/mod.rs index 193cd66aaf..e9f8f1ac3d 100644 --- a/crates/bevy_core_pipeline/src/taa/mod.rs +++ b/crates/bevy_core_pipeline/src/taa/mod.rs @@ -16,6 +16,7 @@ use bevy_ecs::{ system::{Commands, Query, Res, ResMut, Resource}, world::{FromWorld, World}, }; +use bevy_image::BevyDefault as _; use bevy_math::vec2; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ @@ -34,7 +35,7 @@ use bevy_render::{ renderer::{RenderContext, RenderDevice}, sync_component::SyncComponentPlugin, sync_world::RenderEntity, - texture::{BevyDefault, CachedTexture, TextureCache}, + texture::{CachedTexture, TextureCache}, view::{ExtractedView, Msaa, ViewTarget}, ExtractSchedule, MainWorld, Render, RenderApp, RenderSet, }; diff --git a/crates/bevy_core_pipeline/src/tonemapping/mod.rs b/crates/bevy_core_pipeline/src/tonemapping/mod.rs index 16fecb0140..c6fb321725 100644 --- a/crates/bevy_core_pipeline/src/tonemapping/mod.rs +++ b/crates/bevy_core_pipeline/src/tonemapping/mod.rs @@ -2,6 +2,7 @@ use crate::fullscreen_vertex_shader::fullscreen_shader_vertex_state; use bevy_app::prelude::*; use bevy_asset::{load_internal_asset, Assets, Handle}; use bevy_ecs::prelude::*; +use bevy_image::{CompressedImageFormats, Image, ImageSampler, ImageType}; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ camera::Camera, @@ -13,7 +14,7 @@ use bevy_render::{ *, }, renderer::RenderDevice, - texture::{CompressedImageFormats, FallbackImage, GpuImage, Image, ImageSampler, ImageType}, + texture::{FallbackImage, GpuImage}, view::{ExtractedView, ViewTarget, ViewUniform}, Render, RenderApp, RenderSet, }; @@ -433,14 +434,14 @@ pub fn get_lut_bind_group_layout_entries() -> [BindGroupLayoutEntryBuilder; 2] { // allow(dead_code) so it doesn't complain when the tonemapping_luts feature is disabled #[allow(dead_code)] fn setup_tonemapping_lut_image(bytes: &[u8], image_type: ImageType) -> Image { - let image_sampler = ImageSampler::Descriptor(bevy_render::texture::ImageSamplerDescriptor { + let image_sampler = ImageSampler::Descriptor(bevy_image::ImageSamplerDescriptor { label: Some("Tonemapping LUT sampler".to_string()), - address_mode_u: bevy_render::texture::ImageAddressMode::ClampToEdge, - address_mode_v: bevy_render::texture::ImageAddressMode::ClampToEdge, - address_mode_w: bevy_render::texture::ImageAddressMode::ClampToEdge, - mag_filter: bevy_render::texture::ImageFilterMode::Linear, - min_filter: bevy_render::texture::ImageFilterMode::Linear, - mipmap_filter: bevy_render::texture::ImageFilterMode::Linear, + address_mode_u: bevy_image::ImageAddressMode::ClampToEdge, + address_mode_v: bevy_image::ImageAddressMode::ClampToEdge, + address_mode_w: bevy_image::ImageAddressMode::ClampToEdge, + mag_filter: bevy_image::ImageFilterMode::Linear, + min_filter: bevy_image::ImageFilterMode::Linear, + mipmap_filter: bevy_image::ImageFilterMode::Linear, ..default() }); Image::from_buffer( diff --git a/crates/bevy_gizmos/Cargo.toml b/crates/bevy_gizmos/Cargo.toml index 5f79b93d3a..e880e985ff 100644 --- a/crates/bevy_gizmos/Cargo.toml +++ b/crates/bevy_gizmos/Cargo.toml @@ -20,6 +20,7 @@ bevy_sprite = { path = "../bevy_sprite", version = "0.15.0-dev", optional = true bevy_app = { path = "../bevy_app", version = "0.15.0-dev" } bevy_color = { path = "../bevy_color", version = "0.15.0-dev" } bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev" } +bevy_image = { path = "../bevy_image", version = "0.15.0-dev" } bevy_math = { path = "../bevy_math", version = "0.15.0-dev" } bevy_asset = { path = "../bevy_asset", version = "0.15.0-dev" } bevy_render = { path = "../bevy_render", version = "0.15.0-dev", optional = true } diff --git a/crates/bevy_gizmos/src/pipeline_2d.rs b/crates/bevy_gizmos/src/pipeline_2d.rs index ff38abf031..9e122782f7 100644 --- a/crates/bevy_gizmos/src/pipeline_2d.rs +++ b/crates/bevy_gizmos/src/pipeline_2d.rs @@ -13,6 +13,7 @@ use bevy_ecs::{ system::{Query, Res, ResMut, Resource}, world::{FromWorld, World}, }; +use bevy_image::BevyDefault as _; use bevy_math::FloatOrd; use bevy_render::sync_world::MainEntity; use bevy_render::{ @@ -22,7 +23,6 @@ use bevy_render::{ ViewSortedRenderPhases, }, render_resource::*, - texture::BevyDefault, view::{ExtractedView, Msaa, RenderLayers, ViewTarget}, Render, RenderApp, RenderSet, }; diff --git a/crates/bevy_gizmos/src/pipeline_3d.rs b/crates/bevy_gizmos/src/pipeline_3d.rs index 5e7a322f2a..2d3f2bbd8d 100644 --- a/crates/bevy_gizmos/src/pipeline_3d.rs +++ b/crates/bevy_gizmos/src/pipeline_3d.rs @@ -17,6 +17,7 @@ use bevy_ecs::{ system::{Query, Res, ResMut, Resource}, world::{FromWorld, World}, }; +use bevy_image::BevyDefault as _; use bevy_pbr::{MeshPipeline, MeshPipelineKey, SetMeshViewBindGroup}; use bevy_render::sync_world::MainEntity; use bevy_render::{ @@ -26,7 +27,6 @@ use bevy_render::{ ViewSortedRenderPhases, }, render_resource::*, - texture::BevyDefault, view::{ExtractedView, Msaa, RenderLayers, ViewTarget}, Render, RenderApp, RenderSet, }; diff --git a/crates/bevy_gltf/src/lib.rs b/crates/bevy_gltf/src/lib.rs index 05d4c596f8..46f9ad3ae9 100644 --- a/crates/bevy_gltf/src/lib.rs +++ b/crates/bevy_gltf/src/lib.rs @@ -103,12 +103,12 @@ pub use loader::*; use bevy_app::prelude::*; use bevy_asset::{Asset, AssetApp, AssetPath, Handle}; use bevy_ecs::{prelude::Component, reflect::ReflectComponent}; +use bevy_image::CompressedImageFormats; use bevy_pbr::StandardMaterial; use bevy_reflect::{std_traits::ReflectDefault, Reflect, TypePath}; use bevy_render::{ mesh::{skinning::SkinnedMeshInverseBindposes, Mesh, MeshVertexAttribute}, renderer::RenderDevice, - texture::CompressedImageFormats, }; use bevy_scene::Scene; diff --git a/crates/bevy_gltf/src/loader.rs b/crates/bevy_gltf/src/loader.rs index 1cc747264e..d9d1571ce9 100644 --- a/crates/bevy_gltf/src/loader.rs +++ b/crates/bevy_gltf/src/loader.rs @@ -15,6 +15,10 @@ use bevy_ecs::{ world::World, }; use bevy_hierarchy::{BuildChildren, ChildBuild, WorldChildBuilder}; +use bevy_image::{ + CompressedImageFormats, Image, ImageAddressMode, ImageFilterMode, ImageLoaderSettings, + ImageSampler, ImageSamplerDescriptor, ImageType, TextureError, +}; use bevy_math::{Affine2, Mat4, Vec3}; use bevy_pbr::{ DirectionalLight, MeshMaterial3d, PointLight, SpotLight, StandardMaterial, UvChannel, @@ -31,10 +35,6 @@ use bevy_render::{ primitives::Aabb, render_asset::RenderAssetUsages, render_resource::{Face, PrimitiveTopology}, - texture::{ - CompressedImageFormats, Image, ImageAddressMode, ImageFilterMode, ImageLoaderSettings, - ImageSampler, ImageSamplerDescriptor, ImageType, TextureError, - }, view::Visibility, }; use bevy_scene::Scene; diff --git a/crates/bevy_image/src/image.rs b/crates/bevy_image/src/image.rs index abf504536e..cfe3a768d6 100644 --- a/crates/bevy_image/src/image.rs +++ b/crates/bevy_image/src/image.rs @@ -14,6 +14,7 @@ use core::hash::Hash; use derive_more::derive::{Display, Error, From}; use serde::{Deserialize, Serialize}; use wgpu::{Extent3d, TextureDimension, TextureFormat, TextureViewDescriptor}; + pub trait BevyDefault { fn bevy_default() -> Self; } diff --git a/crates/bevy_image/src/lib.rs b/crates/bevy_image/src/lib.rs index ac5510e5e3..ce2e932826 100644 --- a/crates/bevy_image/src/lib.rs +++ b/crates/bevy_image/src/lib.rs @@ -2,6 +2,10 @@ #![allow(missing_docs, reason = "Not all docs are written yet, see #3492.")] #![allow(unsafe_code)] +pub mod prelude { + pub use crate::{BevyDefault as _, Image, ImageFormat, TextureError}; +} + mod image; pub use self::image::*; #[cfg(feature = "basis-universal")] diff --git a/crates/bevy_internal/src/lib.rs b/crates/bevy_internal/src/lib.rs index bc553af972..aa9ad4c830 100644 --- a/crates/bevy_internal/src/lib.rs +++ b/crates/bevy_internal/src/lib.rs @@ -37,6 +37,8 @@ pub use bevy_gizmos as gizmos; #[cfg(feature = "bevy_gltf")] pub use bevy_gltf as gltf; pub use bevy_hierarchy as hierarchy; +#[cfg(feature = "bevy_image")] +pub use bevy_image as image; pub use bevy_input as input; pub use bevy_log as log; pub use bevy_math as math; diff --git a/crates/bevy_internal/src/prelude.rs b/crates/bevy_internal/src/prelude.rs index bec80694fd..6d8830eb4d 100644 --- a/crates/bevy_internal/src/prelude.rs +++ b/crates/bevy_internal/src/prelude.rs @@ -6,6 +6,10 @@ pub use crate::{ MinimalPlugins, }; +#[doc(hidden)] +#[cfg(feature = "bevy_image")] +pub use crate::image::prelude::*; + pub use bevy_derive::{bevy_main, Deref, DerefMut}; #[doc(hidden)] diff --git a/crates/bevy_pbr/Cargo.toml b/crates/bevy_pbr/Cargo.toml index 5dde710843..4cad902a4c 100644 --- a/crates/bevy_pbr/Cargo.toml +++ b/crates/bevy_pbr/Cargo.toml @@ -37,6 +37,7 @@ bevy_color = { path = "../bevy_color", version = "0.15.0-dev" } bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.15.0-dev" } bevy_derive = { path = "../bevy_derive", version = "0.15.0-dev" } bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev" } +bevy_image = { path = "../bevy_image", version = "0.15.0-dev" } bevy_math = { path = "../bevy_math", version = "0.15.0-dev" } bevy_reflect = { path = "../bevy_reflect", version = "0.15.0-dev", features = [ "bevy", diff --git a/crates/bevy_pbr/src/deferred/mod.rs b/crates/bevy_pbr/src/deferred/mod.rs index 243183e9d0..67271a916f 100644 --- a/crates/bevy_pbr/src/deferred/mod.rs +++ b/crates/bevy_pbr/src/deferred/mod.rs @@ -5,6 +5,9 @@ use crate::{ ViewScreenSpaceReflectionsUniformOffset, TONEMAPPING_LUT_SAMPLER_BINDING_INDEX, TONEMAPPING_LUT_TEXTURE_BINDING_INDEX, }; +use crate::{ + MeshPipelineKey, ShadowFilteringMethod, ViewFogUniformOffset, ViewLightsUniformOffset, +}; use bevy_app::prelude::*; use bevy_asset::{load_internal_asset, Handle}; use bevy_core_pipeline::{ @@ -16,6 +19,7 @@ use bevy_core_pipeline::{ tonemapping::{DebandDither, Tonemapping}, }; use bevy_ecs::{prelude::*, query::QueryItem}; +use bevy_image::BevyDefault as _; use bevy_render::{ extract_component::{ ComponentUniforms, ExtractComponent, ExtractComponentPlugin, UniformComponentPlugin, @@ -23,15 +27,10 @@ use bevy_render::{ render_graph::{NodeRunError, RenderGraphApp, RenderGraphContext, ViewNode, ViewNodeRunner}, render_resource::{binding_types::uniform_buffer, *}, renderer::{RenderContext, RenderDevice}, - texture::BevyDefault, view::{ExtractedView, ViewTarget, ViewUniformOffset}, Render, RenderApp, RenderSet, }; -use crate::{ - MeshPipelineKey, ShadowFilteringMethod, ViewFogUniformOffset, ViewLightsUniformOffset, -}; - pub struct DeferredPbrLightingPlugin; pub const DEFERRED_LIGHTING_SHADER_HANDLE: Handle = diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index 559fa99dcc..7526f384e2 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -116,6 +116,7 @@ use bevy_app::prelude::*; use bevy_asset::{load_internal_asset, AssetApp, Assets, Handle}; use bevy_core_pipeline::core_3d::graph::{Core3d, Node3d}; use bevy_ecs::prelude::*; +use bevy_image::Image; use bevy_render::{ alpha::AlphaMode, camera::{ @@ -128,10 +129,11 @@ use bevy_render::{ render_graph::RenderGraph, render_resource::Shader, sync_component::SyncComponentPlugin, - texture::{GpuImage, Image}, + texture::GpuImage, view::{check_visibility, VisibilitySystems}, ExtractSchedule, Render, RenderApp, RenderSet, }; + use bevy_transform::TransformSystem; pub const PBR_TYPES_SHADER_HANDLE: Handle = Handle::weak_from_u128(1708015359337029744); diff --git a/crates/bevy_pbr/src/light_probe/environment_map.rs b/crates/bevy_pbr/src/light_probe/environment_map.rs index 4fff505427..6b47c9915a 100644 --- a/crates/bevy_pbr/src/light_probe/environment_map.rs +++ b/crates/bevy_pbr/src/light_probe/environment_map.rs @@ -51,6 +51,7 @@ use bevy_ecs::{ bundle::Bundle, component::Component, query::QueryItem, reflect::ReflectComponent, system::lifetimeless::Read, }; +use bevy_image::Image; use bevy_math::Quat; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ @@ -63,7 +64,7 @@ use bevy_render::{ TextureSampleType, TextureView, }, renderer::RenderDevice, - texture::{FallbackImage, GpuImage, Image}, + texture::{FallbackImage, GpuImage}, }; use core::{num::NonZero, ops::Deref}; diff --git a/crates/bevy_pbr/src/light_probe/irradiance_volume.rs b/crates/bevy_pbr/src/light_probe/irradiance_volume.rs index f43d84d4e7..bc8fc542fb 100644 --- a/crates/bevy_pbr/src/light_probe/irradiance_volume.rs +++ b/crates/bevy_pbr/src/light_probe/irradiance_volume.rs @@ -133,6 +133,7 @@ //! [Why ambient cubes?]: #why-ambient-cubes use bevy_ecs::{component::Component, reflect::ReflectComponent}; +use bevy_image::Image; use bevy_render::{ render_asset::RenderAssets, render_resource::{ @@ -140,7 +141,7 @@ use bevy_render::{ TextureSampleType, TextureView, }, renderer::RenderDevice, - texture::{FallbackImage, GpuImage, Image}, + texture::{FallbackImage, GpuImage}, }; use core::{num::NonZero, ops::Deref}; diff --git a/crates/bevy_pbr/src/light_probe/mod.rs b/crates/bevy_pbr/src/light_probe/mod.rs index 0cda05f055..cab462c280 100644 --- a/crates/bevy_pbr/src/light_probe/mod.rs +++ b/crates/bevy_pbr/src/light_probe/mod.rs @@ -12,6 +12,7 @@ use bevy_ecs::{ schedule::IntoSystemConfigs, system::{Commands, Local, Query, Res, ResMut, Resource}, }; +use bevy_image::Image; use bevy_math::{Affine3A, FloatOrd, Mat4, Vec3A, Vec4}; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ @@ -22,7 +23,7 @@ use bevy_render::{ renderer::{RenderDevice, RenderQueue}, settings::WgpuFeatures, sync_world::RenderEntity, - texture::{FallbackImage, GpuImage, Image}, + texture::{FallbackImage, GpuImage}, view::{ExtractedView, Visibility}, Extract, ExtractSchedule, Render, RenderApp, RenderSet, }; diff --git a/crates/bevy_pbr/src/lightmap/mod.rs b/crates/bevy_pbr/src/lightmap/mod.rs index 982f7214a8..0e0debc92e 100644 --- a/crates/bevy_pbr/src/lightmap/mod.rs +++ b/crates/bevy_pbr/src/lightmap/mod.rs @@ -39,6 +39,7 @@ use bevy_ecs::{ schedule::IntoSystemConfigs, system::{Query, Res, ResMut, Resource}, }; +use bevy_image::Image; use bevy_math::{uvec2, vec4, Rect, UVec2}; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::sync_world::MainEntityHashMap; @@ -46,7 +47,7 @@ use bevy_render::{ mesh::{Mesh, RenderMesh}, render_asset::RenderAssets, render_resource::Shader, - texture::{GpuImage, Image}, + texture::GpuImage, view::ViewVisibility, Extract, ExtractSchedule, RenderApp, }; diff --git a/crates/bevy_pbr/src/material.rs b/crates/bevy_pbr/src/material.rs index 916b5a4676..65d935226e 100644 --- a/crates/bevy_pbr/src/material.rs +++ b/crates/bevy_pbr/src/material.rs @@ -60,8 +60,9 @@ use core::{ /// ``` /// # use bevy_pbr::{Material, MeshMaterial3d}; /// # use bevy_ecs::prelude::*; +/// # use bevy_image::Image; /// # use bevy_reflect::TypePath; -/// # use bevy_render::{mesh::{Mesh, Mesh3d}, render_resource::{AsBindGroup, ShaderRef}, texture::Image}; +/// # use bevy_render::{mesh::{Mesh, Mesh3d}, render_resource::{AsBindGroup, ShaderRef}}; /// # use bevy_color::LinearRgba; /// # use bevy_color::palettes::basic::RED; /// # use bevy_asset::{Handle, AssetServer, Assets, Asset}; diff --git a/crates/bevy_pbr/src/render/mesh.rs b/crates/bevy_pbr/src/render/mesh.rs index db9c031801..06a1de09e2 100644 --- a/crates/bevy_pbr/src/render/mesh.rs +++ b/crates/bevy_pbr/src/render/mesh.rs @@ -14,6 +14,7 @@ use bevy_ecs::{ query::ROQueryItem, system::{lifetimeless::*, SystemParamItem, SystemState}, }; +use bevy_image::{BevyDefault, ImageSampler, TextureFormatPixelInfo}; use bevy_math::{Affine3, Rect, UVec2, Vec3, Vec4}; use bevy_render::{ batching::{ @@ -32,7 +33,7 @@ use bevy_render::{ }, render_resource::*, renderer::{RenderDevice, RenderQueue}, - texture::{BevyDefault, DefaultImageSampler, ImageSampler, TextureFormatPixelInfo}, + texture::DefaultImageSampler, view::{ prepare_view_targets, GpuCulling, RenderVisibilityRanges, ViewTarget, ViewUniformOffset, ViewVisibility, VisibilityRange, diff --git a/crates/bevy_pbr/src/render/mesh_view_bindings.rs b/crates/bevy_pbr/src/render/mesh_view_bindings.rs index 159a87bd1c..bbf158564d 100644 --- a/crates/bevy_pbr/src/render/mesh_view_bindings.rs +++ b/crates/bevy_pbr/src/render/mesh_view_bindings.rs @@ -15,13 +15,14 @@ use bevy_ecs::{ system::{Commands, Query, Res, Resource}, world::{FromWorld, World}, }; +use bevy_image::BevyDefault as _; use bevy_math::Vec4; use bevy_render::{ globals::{GlobalsBuffer, GlobalsUniform}, render_asset::RenderAssets, render_resource::{binding_types::*, *}, renderer::RenderDevice, - texture::{BevyDefault, FallbackImage, FallbackImageMsaa, FallbackImageZero, GpuImage}, + texture::{FallbackImage, FallbackImageMsaa, FallbackImageZero, GpuImage}, view::{ Msaa, RenderVisibilityRanges, ViewUniform, ViewUniforms, VISIBILITY_RANGES_STORAGE_BUFFER_COUNT, diff --git a/crates/bevy_pbr/src/ssr/mod.rs b/crates/bevy_pbr/src/ssr/mod.rs index 26fcb27802..935e5f5b8f 100644 --- a/crates/bevy_pbr/src/ssr/mod.rs +++ b/crates/bevy_pbr/src/ssr/mod.rs @@ -23,6 +23,7 @@ use bevy_ecs::{ system::{lifetimeless::Read, Commands, Query, Res, ResMut, Resource}, world::{FromWorld, World}, }; +use bevy_image::BevyDefault as _; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ extract_component::{ExtractComponent, ExtractComponentPlugin}, @@ -36,7 +37,6 @@ use bevy_render::{ TextureFormat, TextureSampleType, }, renderer::{RenderContext, RenderDevice, RenderQueue}, - texture::BevyDefault as _, view::{ExtractedView, Msaa, ViewTarget, ViewUniformOffset}, Render, RenderApp, RenderSet, }; diff --git a/crates/bevy_pbr/src/volumetric_fog/mod.rs b/crates/bevy_pbr/src/volumetric_fog/mod.rs index 7a94a1e135..5291276495 100644 --- a/crates/bevy_pbr/src/volumetric_fog/mod.rs +++ b/crates/bevy_pbr/src/volumetric_fog/mod.rs @@ -42,6 +42,7 @@ use bevy_ecs::{ bundle::Bundle, component::Component, reflect::ReflectComponent, schedule::IntoSystemConfigs as _, }; +use bevy_image::Image; use bevy_math::{ primitives::{Cuboid, Plane3d}, Vec2, Vec3, @@ -52,7 +53,6 @@ use bevy_render::{ render_graph::{RenderGraphApp, ViewNodeRunner}, render_resource::{Shader, SpecializedRenderPipelines}, sync_component::SyncComponentPlugin, - texture::Image, view::{InheritedVisibility, ViewVisibility, Visibility}, ExtractSchedule, Render, RenderApp, RenderSet, }; diff --git a/crates/bevy_pbr/src/volumetric_fog/render.rs b/crates/bevy_pbr/src/volumetric_fog/render.rs index a18d206c5d..76039bbbe4 100644 --- a/crates/bevy_pbr/src/volumetric_fog/render.rs +++ b/crates/bevy_pbr/src/volumetric_fog/render.rs @@ -16,6 +16,7 @@ use bevy_ecs::{ system::{lifetimeless::Read, Commands, Local, Query, Res, ResMut, Resource}, world::{FromWorld, World}, }; +use bevy_image::{BevyDefault, Image}; use bevy_math::{vec4, Mat3A, Mat4, Vec3, Vec3A, Vec4, Vec4Swizzles as _}; use bevy_render::{ mesh::{ @@ -37,7 +38,7 @@ use bevy_render::{ }, renderer::{RenderContext, RenderDevice, RenderQueue}, sync_world::RenderEntity, - texture::{BevyDefault as _, GpuImage, Image}, + texture::GpuImage, view::{ExtractedView, Msaa, ViewDepthTexture, ViewTarget, ViewUniformOffset}, Extract, }; diff --git a/crates/bevy_render/macros/src/as_bind_group.rs b/crates/bevy_render/macros/src/as_bind_group.rs index d0edd18dd6..8f871bd0e0 100644 --- a/crates/bevy_render/macros/src/as_bind_group.rs +++ b/crates/bevy_render/macros/src/as_bind_group.rs @@ -41,6 +41,7 @@ enum BindingState<'a> { pub fn derive_as_bind_group(ast: syn::DeriveInput) -> Result { let manifest = BevyManifest::default(); let render_path = manifest.get_path("bevy_render"); + let image_path = manifest.get_path("bevy_image"); let asset_path = manifest.get_path("bevy_asset"); let ecs_path = manifest.get_path("bevy_ecs"); @@ -264,7 +265,7 @@ pub fn derive_as_bind_group(ast: syn::DeriveInput) -> Result { binding_impls.insert(0, quote! { ( #binding_index, #render_path::render_resource::OwnedBindingResource::TextureView({ - let handle: Option<&#asset_path::Handle<#render_path::texture::Image>> = (&self.#field_name).into(); + let handle: Option<&#asset_path::Handle<#image_path::Image>> = (&self.#field_name).into(); if let Some(handle) = handle { images.get(handle).ok_or_else(|| #render_path::render_resource::AsBindGroupError::RetryNextUpdate)?.texture_view.clone() } else { @@ -305,7 +306,7 @@ pub fn derive_as_bind_group(ast: syn::DeriveInput) -> Result { ( #binding_index, #render_path::render_resource::OwnedBindingResource::TextureView({ - let handle: Option<&#asset_path::Handle<#render_path::texture::Image>> = (&self.#field_name).into(); + let handle: Option<&#asset_path::Handle<#image_path::Image>> = (&self.#field_name).into(); if let Some(handle) = handle { images.get(handle).ok_or_else(|| #render_path::render_resource::AsBindGroupError::RetryNextUpdate)?.texture_view.clone() } else { @@ -362,7 +363,7 @@ pub fn derive_as_bind_group(ast: syn::DeriveInput) -> Result { ( #binding_index, #render_path::render_resource::OwnedBindingResource::Sampler({ - let handle: Option<&#asset_path::Handle<#render_path::texture::Image>> = (&self.#field_name).into(); + let handle: Option<&#asset_path::Handle<#image_path::Image>> = (&self.#field_name).into(); if let Some(handle) = handle { let image = images.get(handle).ok_or_else(|| #render_path::render_resource::AsBindGroupError::RetryNextUpdate)?; diff --git a/crates/bevy_render/src/camera/camera.rs b/crates/bevy_render/src/camera/camera.rs index f00ebb5e9d..7e7036d1e8 100644 --- a/crates/bevy_render/src/camera/camera.rs +++ b/crates/bevy_render/src/camera/camera.rs @@ -4,7 +4,6 @@ use crate::view::RenderVisibleEntities; use crate::{ batching::gpu_preprocessing::GpuPreprocessingSupport, camera::{CameraProjection, ManualTextureViewHandle, ManualTextureViews}, - prelude::Image, primitives::Frustum, render_asset::RenderAssets, render_graph::{InternedRenderSubGraph, RenderSubGraph}, @@ -30,6 +29,7 @@ use bevy_ecs::{ system::{Commands, Query, Res, ResMut, Resource}, world::DeferredWorld, }; +use bevy_image::Image; use bevy_math::{ops, vec2, Dir3, Mat4, Ray3d, Rect, URect, UVec2, UVec4, Vec2, Vec3}; use bevy_reflect::prelude::*; use bevy_render_macros::ExtractComponent; diff --git a/crates/bevy_render/src/camera/manual_texture_view.rs b/crates/bevy_render/src/camera/manual_texture_view.rs index a1353b9d0f..11d82364a6 100644 --- a/crates/bevy_render/src/camera/manual_texture_view.rs +++ b/crates/bevy_render/src/camera/manual_texture_view.rs @@ -1,7 +1,6 @@ -use crate::{ - extract_resource::ExtractResource, render_resource::TextureView, texture::BevyDefault, -}; +use crate::{extract_resource::ExtractResource, render_resource::TextureView}; use bevy_ecs::{prelude::Component, reflect::ReflectComponent, system::Resource}; +use bevy_image::BevyDefault as _; use bevy_math::UVec2; use bevy_reflect::prelude::*; use bevy_utils::HashMap; diff --git a/crates/bevy_render/src/gpu_readback.rs b/crates/bevy_render/src/gpu_readback.rs index 434b4603ca..bb0092edf1 100644 --- a/crates/bevy_render/src/gpu_readback.rs +++ b/crates/bevy_render/src/gpu_readback.rs @@ -1,12 +1,11 @@ use crate::{ extract_component::ExtractComponentPlugin, - prelude::Image, render_asset::RenderAssets, render_resource::{Buffer, BufferUsages, Extent3d, ImageDataLayout, Texture, TextureFormat}, renderer::{render_system, RenderDevice}, storage::{GpuShaderStorageBuffer, ShaderStorageBuffer}, sync_world::MainEntity, - texture::{GpuImage, TextureFormatPixelInfo}, + texture::GpuImage, ExtractSchedule, MainWorld, Render, RenderApp, RenderSet, }; use async_channel::{Receiver, Sender}; @@ -21,6 +20,7 @@ use bevy_ecs::{ prelude::{Component, Resource, World}, system::{Query, Res}, }; +use bevy_image::{Image, TextureFormatPixelInfo}; use bevy_reflect::Reflect; use bevy_render_macros::ExtractComponent; use bevy_utils::{default, tracing::warn, HashMap}; diff --git a/crates/bevy_render/src/lib.rs b/crates/bevy_render/src/lib.rs index a682f2b954..c220470e48 100644 --- a/crates/bevy_render/src/lib.rs +++ b/crates/bevy_render/src/lib.rs @@ -61,12 +61,11 @@ pub mod prelude { }, render_resource::Shader, spatial_bundle::SpatialBundle, - texture::{Image, ImagePlugin, IntoDynamicImageError}, + texture::ImagePlugin, view::{InheritedVisibility, Msaa, ViewVisibility, Visibility, VisibilityBundle}, ExtractSchedule, }; } - use batching::gpu_preprocessing::BatchingPlugin; use bevy_ecs::schedule::ScheduleBuildSettings; use bevy_utils::prelude::default; diff --git a/crates/bevy_render/src/render_resource/bind_group.rs b/crates/bevy_render/src/render_resource/bind_group.rs index 73e2579406..2753616aa0 100644 --- a/crates/bevy_render/src/render_resource/bind_group.rs +++ b/crates/bevy_render/src/render_resource/bind_group.rs @@ -78,7 +78,7 @@ impl Deref for BindGroup { /// ok to do "expensive" work here, such as creating a [`Buffer`] for a uniform. /// /// If for some reason a [`BindGroup`] cannot be created yet (for example, the [`Texture`](crate::render_resource::Texture) -/// for an [`Image`](crate::texture::Image) hasn't loaded yet), just return [`AsBindGroupError::RetryNextUpdate`], which signals that the caller +/// for an [`Image`](bevy_image::Image) hasn't loaded yet), just return [`AsBindGroupError::RetryNextUpdate`], which signals that the caller /// should retry again later. /// /// # Deriving @@ -87,7 +87,8 @@ impl Deref for BindGroup { /// what their binding type is, and what index they should be bound at: /// /// ``` -/// # use bevy_render::{render_resource::*, texture::Image}; +/// # use bevy_render::render_resource::*; +/// # use bevy_image::Image; /// # use bevy_color::LinearRgba; /// # use bevy_asset::Handle; /// # use bevy_render::storage::ShaderStorageBuffer; @@ -133,7 +134,7 @@ impl Deref for BindGroup { /// GPU resource, which will be bound as a texture in shaders. The field will be assumed to implement [`Into>>`]. In practice, /// most fields should be a [`Handle`](bevy_asset::Handle) or [`Option>`]. If the value of an [`Option>`] is /// [`None`], the [`crate::texture::FallbackImage`] resource will be used instead. This attribute can be used in conjunction with a `sampler` binding attribute -/// (with a different binding index) if a binding of the sampler for the [`Image`](crate::texture::Image) is also required. +/// (with a different binding index) if a binding of the sampler for the [`Image`](bevy_image::Image) is also required. /// /// | Arguments | Values | Default | /// |-----------------------|-------------------------------------------------------------------------|----------------------| @@ -161,7 +162,7 @@ impl Deref for BindGroup { /// resource, which will be bound as a sampler in shaders. The field will be assumed to implement [`Into>>`]. In practice, /// most fields should be a [`Handle`](bevy_asset::Handle) or [`Option>`]. If the value of an [`Option>`] is /// [`None`], the [`crate::texture::FallbackImage`] resource will be used instead. This attribute can be used in conjunction with a `texture` binding attribute -/// (with a different binding index) if a binding of the texture for the [`Image`](crate::texture::Image) is also required. +/// (with a different binding index) if a binding of the texture for the [`Image`](bevy_image::Image) is also required. /// /// | Arguments | Values | Default | /// |------------------------|-------------------------------------------------------------------------|------------------------| @@ -194,9 +195,10 @@ impl Deref for BindGroup { /// /// As mentioned above, [`Option>`] is also supported: /// ``` -/// # use bevy_render::{render_resource::AsBindGroup, texture::Image}; -/// # use bevy_color::LinearRgba; /// # use bevy_asset::Handle; +/// # use bevy_color::LinearRgba; +/// # use bevy_image::Image; +/// # use bevy_render::render_resource::AsBindGroup; /// #[derive(AsBindGroup)] /// struct CoolMaterial { /// #[uniform(0)] @@ -433,8 +435,9 @@ where #[cfg(test)] mod test { use super::*; - use crate::{self as bevy_render, prelude::Image}; + use crate as bevy_render; use bevy_asset::Handle; + use bevy_image::Image; #[test] fn texture_visibility() { diff --git a/crates/bevy_render/src/texture/mod.rs b/crates/bevy_render/src/texture/mod.rs index 351a356be2..3671b7a0c8 100644 --- a/crates/bevy_render/src/texture/mod.rs +++ b/crates/bevy_render/src/texture/mod.rs @@ -4,18 +4,11 @@ mod texture_attachment; mod texture_cache; pub use crate::render_resource::DefaultImageSampler; -#[cfg(feature = "exr")] -pub use bevy_image::ExrTextureLoader; -#[cfg(feature = "hdr")] -pub use bevy_image::HdrTextureLoader; -pub use bevy_image::{ - BevyDefault, CompressedImageFormats, FileTextureError, Image, ImageAddressMode, - ImageFilterMode, ImageFormat, ImageFormatSetting, ImageLoader, ImageLoaderError, - ImageLoaderSettings, ImageSampler, ImageSamplerDescriptor, ImageType, IntoDynamicImageError, - TextureError, TextureFormatPixelInfo, -}; #[cfg(feature = "basis-universal")] -pub use bevy_image::{CompressedImageSaver, CompressedImageSaverError}; +use bevy_image::CompressedImageSaver; +#[cfg(feature = "hdr")] +use bevy_image::HdrTextureLoader; +use bevy_image::{CompressedImageFormats, Image, ImageLoader, ImageSamplerDescriptor}; pub use fallback_image::*; pub use gpu_image::*; pub use texture_attachment::*; @@ -39,7 +32,7 @@ pub const TRANSPARENT_IMAGE_HANDLE: Handle = // TODO: replace Texture names with Image names? /// Adds the [`Image`] as an asset and makes sure that they are extracted and prepared for the GPU. pub struct ImagePlugin { - /// The default image sampler to use when [`ImageSampler`] is set to `Default`. + /// The default image sampler to use when [`bevy_image::ImageSampler`] is set to `Default`. pub default_sampler: ImageSamplerDescriptor, } @@ -69,7 +62,7 @@ impl Plugin for ImagePlugin { fn build(&self, app: &mut App) { #[cfg(feature = "exr")] { - app.init_asset_loader::(); + app.init_asset_loader::(); } #[cfg(feature = "hdr")] diff --git a/crates/bevy_render/src/view/mod.rs b/crates/bevy_render/src/view/mod.rs index 2e306d610f..572a1db7b8 100644 --- a/crates/bevy_render/src/view/mod.rs +++ b/crates/bevy_render/src/view/mod.rs @@ -18,8 +18,8 @@ use crate::{ render_resource::{DynamicUniformBuffer, ShaderType, Texture, TextureView}, renderer::{RenderDevice, RenderQueue}, texture::{ - BevyDefault, CachedTexture, ColorAttachment, DepthAttachment, GpuImage, - OutputColorAttachment, TextureCache, + CachedTexture, ColorAttachment, DepthAttachment, GpuImage, OutputColorAttachment, + TextureCache, }, Render, RenderApp, RenderSet, }; @@ -28,6 +28,7 @@ use bevy_app::{App, Plugin}; use bevy_color::LinearRgba; use bevy_derive::{Deref, DerefMut}; use bevy_ecs::prelude::*; +use bevy_image::BevyDefault as _; use bevy_math::{mat3, vec2, vec3, Mat3, Mat4, UVec4, Vec2, Vec3, Vec4, Vec4Swizzles}; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render_macros::ExtractComponent; diff --git a/crates/bevy_render/src/view/window/screenshot.rs b/crates/bevy_render/src/view/window/screenshot.rs index 6303456bd8..ad03ca0920 100644 --- a/crates/bevy_render/src/view/window/screenshot.rs +++ b/crates/bevy_render/src/view/window/screenshot.rs @@ -2,7 +2,7 @@ use super::ExtractedWindows; use crate::{ camera::{ManualTextureViewHandle, ManualTextureViews, NormalizedRenderTarget, RenderTarget}, gpu_readback, - prelude::{Image, Shader}, + prelude::Shader, render_asset::{RenderAssetUsages, RenderAssets}, render_resource::{ binding_types::texture_2d, BindGroup, BindGroupEntries, BindGroupLayout, @@ -11,7 +11,7 @@ use crate::{ SpecializedRenderPipelines, Texture, TextureUsages, TextureView, VertexState, }, renderer::RenderDevice, - texture::{GpuImage, OutputColorAttachment, TextureFormatPixelInfo}, + texture::{GpuImage, OutputColorAttachment}, view::{prepare_view_attachments, prepare_view_targets, ViewTargetAttachments, WindowSurfaces}, ExtractSchedule, MainWorld, Render, RenderApp, RenderSet, }; @@ -23,6 +23,7 @@ use bevy_ecs::{ entity::EntityHashMap, event::event_update_system, prelude::*, system::SystemState, }; use bevy_hierarchy::DespawnRecursiveExt; +use bevy_image::{Image, TextureFormatPixelInfo}; use bevy_reflect::Reflect; use bevy_tasks::AsyncComputeTaskPool; use bevy_utils::{ diff --git a/crates/bevy_sprite/Cargo.toml b/crates/bevy_sprite/Cargo.toml index 59ee9b8fe1..0709eead67 100644 --- a/crates/bevy_sprite/Cargo.toml +++ b/crates/bevy_sprite/Cargo.toml @@ -22,6 +22,7 @@ bevy_asset = { path = "../bevy_asset", version = "0.15.0-dev" } bevy_color = { path = "../bevy_color", version = "0.15.0-dev" } bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.15.0-dev" } bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev" } +bevy_image = { path = "../bevy_image", version = "0.15.0-dev" } bevy_math = { path = "../bevy_math", version = "0.15.0-dev" } bevy_picking = { path = "../bevy_picking", version = "0.15.0-dev", optional = true } bevy_reflect = { path = "../bevy_reflect", version = "0.15.0-dev", features = [ diff --git a/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs b/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs index 879a9af3a4..4c53e321ae 100644 --- a/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs +++ b/crates/bevy_sprite/src/dynamic_texture_atlas_builder.rs @@ -1,8 +1,9 @@ use crate::TextureAtlasLayout; +use bevy_image::{Image, TextureFormatPixelInfo}; use bevy_math::{URect, UVec2}; use bevy_render::{ render_asset::{RenderAsset, RenderAssetUsages}, - texture::{GpuImage, Image, TextureFormatPixelInfo}, + texture::GpuImage, }; use guillotiere::{size2, Allocation, AtlasAllocator}; diff --git a/crates/bevy_sprite/src/lib.rs b/crates/bevy_sprite/src/lib.rs index 265be52209..8ea962eec2 100644 --- a/crates/bevy_sprite/src/lib.rs +++ b/crates/bevy_sprite/src/lib.rs @@ -51,13 +51,13 @@ use bevy_app::prelude::*; use bevy_asset::{load_internal_asset, AssetApp, Assets, Handle}; use bevy_core_pipeline::core_2d::Transparent2d; use bevy_ecs::{prelude::*, query::QueryItem}; +use bevy_image::Image; use bevy_render::{ extract_component::{ExtractComponent, ExtractComponentPlugin}, mesh::{Mesh, Mesh2d, MeshAabb}, primitives::Aabb, render_phase::AddRenderCommand, render_resource::{Shader, SpecializedRenderPipelines}, - texture::Image, view::{check_visibility, NoFrustumCulling, VisibilitySystems}, ExtractSchedule, Render, RenderApp, RenderSet, }; diff --git a/crates/bevy_sprite/src/mesh2d/color_material.rs b/crates/bevy_sprite/src/mesh2d/color_material.rs index 3b4ce76416..8c3267c40b 100644 --- a/crates/bevy_sprite/src/mesh2d/color_material.rs +++ b/crates/bevy_sprite/src/mesh2d/color_material.rs @@ -4,13 +4,10 @@ use crate::{AlphaMode2d, Material2d, Material2dPlugin, MaterialMesh2dBundle}; use bevy_app::{App, Plugin}; use bevy_asset::{load_internal_asset, Asset, AssetApp, Assets, Handle}; use bevy_color::{Alpha, Color, ColorToComponents, LinearRgba}; +use bevy_image::Image; use bevy_math::Vec4; use bevy_reflect::prelude::*; -use bevy_render::{ - render_asset::RenderAssets, - render_resource::*, - texture::{GpuImage, Image}, -}; +use bevy_render::{render_asset::RenderAssets, render_resource::*, texture::GpuImage}; pub const COLOR_MATERIAL_SHADER_HANDLE: Handle = Handle::weak_from_u128(3253086872234592509); diff --git a/crates/bevy_sprite/src/mesh2d/material.rs b/crates/bevy_sprite/src/mesh2d/material.rs index cfef74be39..4eb064de20 100644 --- a/crates/bevy_sprite/src/mesh2d/material.rs +++ b/crates/bevy_sprite/src/mesh2d/material.rs @@ -58,8 +58,9 @@ use derive_more::derive::From; /// ``` /// # use bevy_sprite::{Material2d, MeshMaterial2d}; /// # use bevy_ecs::prelude::*; +/// # use bevy_image::Image; /// # use bevy_reflect::TypePath; -/// # use bevy_render::{mesh::{Mesh, Mesh2d}, render_resource::{AsBindGroup, ShaderRef}, texture::Image}; +/// # use bevy_render::{mesh::{Mesh, Mesh2d}, render_resource::{AsBindGroup, ShaderRef}}; /// # use bevy_color::LinearRgba; /// # use bevy_color::palettes::basic::RED; /// # use bevy_asset::{Handle, AssetServer, Assets, Asset}; diff --git a/crates/bevy_sprite/src/mesh2d/mesh.rs b/crates/bevy_sprite/src/mesh2d/mesh.rs index 85e057f639..bc67c75aa5 100644 --- a/crates/bevy_sprite/src/mesh2d/mesh.rs +++ b/crates/bevy_sprite/src/mesh2d/mesh.rs @@ -14,8 +14,8 @@ use bevy_ecs::{ query::ROQueryItem, system::{lifetimeless::*, SystemParamItem, SystemState}, }; +use bevy_image::{BevyDefault, Image, ImageSampler, TextureFormatPixelInfo}; use bevy_math::{Affine3, Vec4}; -use bevy_render::sync_world::{MainEntity, MainEntityHashMap}; use bevy_render::{ batching::{ gpu_preprocessing::IndirectParameters, @@ -34,10 +34,8 @@ use bevy_render::{ render_phase::{PhaseItem, RenderCommand, RenderCommandResult, TrackedRenderPass}, render_resource::{binding_types::uniform_buffer, *}, renderer::{RenderDevice, RenderQueue}, - texture::{ - BevyDefault, DefaultImageSampler, FallbackImage, GpuImage, Image, ImageSampler, - TextureFormatPixelInfo, - }, + sync_world::{MainEntity, MainEntityHashMap}, + texture::{DefaultImageSampler, FallbackImage, GpuImage}, view::{ ExtractedView, ViewTarget, ViewUniform, ViewUniformOffset, ViewUniforms, ViewVisibility, }, diff --git a/crates/bevy_sprite/src/picking_backend.rs b/crates/bevy_sprite/src/picking_backend.rs index 55c06a8ec9..ad2afc33d1 100644 --- a/crates/bevy_sprite/src/picking_backend.rs +++ b/crates/bevy_sprite/src/picking_backend.rs @@ -8,6 +8,7 @@ use crate::{Sprite, TextureAtlasLayout}; use bevy_app::prelude::*; use bevy_asset::prelude::*; use bevy_ecs::prelude::*; +use bevy_image::Image; use bevy_math::{prelude::*, FloatExt, FloatOrd}; use bevy_picking::backend::prelude::*; use bevy_render::prelude::*; diff --git a/crates/bevy_sprite/src/render/mod.rs b/crates/bevy_sprite/src/render/mod.rs index 98c38a7130..9ef692452f 100644 --- a/crates/bevy_sprite/src/render/mod.rs +++ b/crates/bevy_sprite/src/render/mod.rs @@ -18,6 +18,7 @@ use bevy_ecs::{ query::ROQueryItem, system::{lifetimeless::*, SystemParamItem, SystemState}, }; +use bevy_image::{BevyDefault, Image, ImageSampler, TextureFormatPixelInfo}; use bevy_math::{Affine3A, FloatOrd, Quat, Rect, Vec2, Vec4}; use bevy_render::sync_world::MainEntity; use bevy_render::view::RenderVisibleEntities; @@ -33,10 +34,7 @@ use bevy_render::{ }, renderer::{RenderDevice, RenderQueue}, sync_world::{RenderEntity, TemporaryRenderEntity}, - texture::{ - BevyDefault, DefaultImageSampler, FallbackImage, GpuImage, Image, ImageSampler, - TextureFormatPixelInfo, - }, + texture::{DefaultImageSampler, FallbackImage, GpuImage}, view::{ ExtractedView, Msaa, ViewTarget, ViewUniform, ViewUniformOffset, ViewUniforms, ViewVisibility, diff --git a/crates/bevy_sprite/src/sprite.rs b/crates/bevy_sprite/src/sprite.rs index 88faf4af10..f6b8b266d5 100644 --- a/crates/bevy_sprite/src/sprite.rs +++ b/crates/bevy_sprite/src/sprite.rs @@ -1,9 +1,10 @@ use bevy_asset::Handle; use bevy_color::Color; use bevy_ecs::{component::Component, reflect::ReflectComponent}; +use bevy_image::Image; use bevy_math::{Rect, Vec2}; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; -use bevy_render::{sync_world::SyncToRenderWorld, texture::Image, view::Visibility}; +use bevy_render::{sync_world::SyncToRenderWorld, view::Visibility}; use bevy_transform::components::Transform; use crate::{TextureAtlas, TextureSlicer}; diff --git a/crates/bevy_sprite/src/texture_atlas.rs b/crates/bevy_sprite/src/texture_atlas.rs index a4d82b2ca1..797fb4aa20 100644 --- a/crates/bevy_sprite/src/texture_atlas.rs +++ b/crates/bevy_sprite/src/texture_atlas.rs @@ -1,9 +1,9 @@ use bevy_asset::{Asset, AssetId, Assets, Handle}; +use bevy_image::Image; use bevy_math::{URect, UVec2}; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; #[cfg(feature = "serialize")] use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; -use bevy_render::texture::Image; use bevy_utils::HashMap; /// Stores a mapping from sub texture handles to the related area index. diff --git a/crates/bevy_sprite/src/texture_atlas_builder.rs b/crates/bevy_sprite/src/texture_atlas_builder.rs index 2428fd4b15..b59c9423b9 100644 --- a/crates/bevy_sprite/src/texture_atlas_builder.rs +++ b/crates/bevy_sprite/src/texture_atlas_builder.rs @@ -1,9 +1,9 @@ use bevy_asset::AssetId; +use bevy_image::{Image, TextureFormatPixelInfo}; use bevy_math::{URect, UVec2}; use bevy_render::{ render_asset::RenderAssetUsages, render_resource::{Extent3d, TextureDimension, TextureFormat}, - texture::{Image, TextureFormatPixelInfo}, }; use bevy_utils::{ tracing::{debug, error, warn}, @@ -179,6 +179,7 @@ impl<'a> TextureAtlasBuilder<'a> { /// # use bevy_ecs::prelude::*; /// # use bevy_asset::*; /// # use bevy_render::prelude::*; + /// # use bevy_image::Image; /// /// fn my_system(mut commands: Commands, mut textures: ResMut>, mut layouts: ResMut>) { /// // Declare your builder diff --git a/crates/bevy_sprite/src/texture_slice/computed_slices.rs b/crates/bevy_sprite/src/texture_slice/computed_slices.rs index 6e2d94198c..490071a600 100644 --- a/crates/bevy_sprite/src/texture_slice/computed_slices.rs +++ b/crates/bevy_sprite/src/texture_slice/computed_slices.rs @@ -3,8 +3,8 @@ use crate::{ExtractedSprite, Sprite, SpriteImageMode, TextureAtlasLayout}; use super::TextureSlice; use bevy_asset::{AssetEvent, Assets}; use bevy_ecs::prelude::*; +use bevy_image::Image; use bevy_math::{Rect, Vec2}; -use bevy_render::texture::Image; use bevy_transform::prelude::*; use bevy_utils::HashSet; diff --git a/crates/bevy_text/Cargo.toml b/crates/bevy_text/Cargo.toml index ef3d235113..479ebed5f4 100644 --- a/crates/bevy_text/Cargo.toml +++ b/crates/bevy_text/Cargo.toml @@ -19,6 +19,7 @@ bevy_color = { path = "../bevy_color", version = "0.15.0-dev" } bevy_derive = { path = "../bevy_derive", version = "0.15.0-dev" } bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev" } bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.15.0-dev" } +bevy_image = { path = "../bevy_image", version = "0.15.0-dev" } bevy_math = { path = "../bevy_math", version = "0.15.0-dev" } bevy_reflect = { path = "../bevy_reflect", version = "0.15.0-dev", features = [ "bevy", diff --git a/crates/bevy_text/src/font_atlas.rs b/crates/bevy_text/src/font_atlas.rs index 8f32dade93..4ce4ea6207 100644 --- a/crates/bevy_text/src/font_atlas.rs +++ b/crates/bevy_text/src/font_atlas.rs @@ -1,9 +1,9 @@ use bevy_asset::{Assets, Handle}; +use bevy_image::{Image, ImageSampler}; use bevy_math::{IVec2, UVec2}; use bevy_render::{ render_asset::RenderAssetUsages, render_resource::{Extent3d, TextureDimension, TextureFormat}, - texture::{Image, ImageSampler}, }; use bevy_sprite::{DynamicTextureAtlasBuilder, TextureAtlasLayout}; use bevy_utils::HashMap; diff --git a/crates/bevy_text/src/font_atlas_set.rs b/crates/bevy_text/src/font_atlas_set.rs index 3be8cf74b7..5547ea5fdb 100644 --- a/crates/bevy_text/src/font_atlas_set.rs +++ b/crates/bevy_text/src/font_atlas_set.rs @@ -3,12 +3,12 @@ use bevy_ecs::{ event::EventReader, system::{ResMut, Resource}, }; +use bevy_image::Image; use bevy_math::{IVec2, UVec2}; use bevy_reflect::TypePath; use bevy_render::{ render_asset::RenderAssetUsages, render_resource::{Extent3d, TextureDimension, TextureFormat}, - texture::Image, }; use bevy_sprite::TextureAtlasLayout; use bevy_utils::HashMap; diff --git a/crates/bevy_text/src/glyph.rs b/crates/bevy_text/src/glyph.rs index 4b264a8c89..b5295c655e 100644 --- a/crates/bevy_text/src/glyph.rs +++ b/crates/bevy_text/src/glyph.rs @@ -1,9 +1,9 @@ //! This module exports types related to rendering glyphs. use bevy_asset::Handle; +use bevy_image::Image; use bevy_math::{IVec2, Vec2}; use bevy_reflect::Reflect; -use bevy_render::texture::Image; use bevy_sprite::TextureAtlasLayout; /// A glyph of a font, typically representing a single character, positioned in screen space. diff --git a/crates/bevy_text/src/pipeline.rs b/crates/bevy_text/src/pipeline.rs index cf5fe2f90c..92b5cd902e 100644 --- a/crates/bevy_text/src/pipeline.rs +++ b/crates/bevy_text/src/pipeline.rs @@ -9,9 +9,9 @@ use bevy_ecs::{ reflect::ReflectComponent, system::{ResMut, Resource}, }; +use bevy_image::Image; use bevy_math::{UVec2, Vec2}; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; -use bevy_render::texture::Image; use bevy_sprite::TextureAtlasLayout; use bevy_utils::HashMap; diff --git a/crates/bevy_text/src/text2d.rs b/crates/bevy_text/src/text2d.rs index 509108cb50..36448baab7 100644 --- a/crates/bevy_text/src/text2d.rs +++ b/crates/bevy_text/src/text2d.rs @@ -16,13 +16,13 @@ use bevy_ecs::{ query::{Changed, Without}, system::{Commands, Local, Query, Res, ResMut}, }; +use bevy_image::Image; use bevy_math::Vec2; use bevy_reflect::{prelude::ReflectDefault, Reflect}; use bevy_render::sync_world::TemporaryRenderEntity; use bevy_render::view::Visibility; use bevy_render::{ primitives::Aabb, - texture::Image, view::{NoFrustumCulling, ViewVisibility}, Extract, }; diff --git a/crates/bevy_ui/Cargo.toml b/crates/bevy_ui/Cargo.toml index 6cc41f0e1a..1184b94b09 100644 --- a/crates/bevy_ui/Cargo.toml +++ b/crates/bevy_ui/Cargo.toml @@ -18,6 +18,7 @@ bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.15.0-dev" } bevy_derive = { path = "../bevy_derive", version = "0.15.0-dev" } bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev" } bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.15.0-dev" } +bevy_image = { path = "../bevy_image", version = "0.15.0-dev" } bevy_input = { path = "../bevy_input", version = "0.15.0-dev" } bevy_math = { path = "../bevy_math", version = "0.15.0-dev" } bevy_reflect = { path = "../bevy_reflect", version = "0.15.0-dev", features = [ diff --git a/crates/bevy_ui/src/layout/mod.rs b/crates/bevy_ui/src/layout/mod.rs index 5d163a34f1..c4a5d63880 100644 --- a/crates/bevy_ui/src/layout/mod.rs +++ b/crates/bevy_ui/src/layout/mod.rs @@ -463,11 +463,11 @@ mod tests { use bevy_hierarchy::{ despawn_with_children_recursive, BuildChildren, ChildBuild, Children, Parent, }; + use bevy_image::Image; use bevy_math::{Rect, UVec2, Vec2}; use bevy_render::{ camera::{ManualTextureViews, OrthographicProjection}, prelude::Camera, - texture::Image, }; use bevy_transform::{ prelude::GlobalTransform, diff --git a/crates/bevy_ui/src/render/box_shadow.rs b/crates/bevy_ui/src/render/box_shadow.rs index a648242f2b..eb7c8169d4 100644 --- a/crates/bevy_ui/src/render/box_shadow.rs +++ b/crates/bevy_ui/src/render/box_shadow.rs @@ -16,6 +16,7 @@ use bevy_ecs::{ *, }, }; +use bevy_image::BevyDefault as _; use bevy_math::{vec2, FloatOrd, Mat4, Rect, Vec2, Vec3Swizzles, Vec4Swizzles}; use bevy_render::sync_world::MainEntity; use bevy_render::RenderApp; @@ -25,7 +26,6 @@ use bevy_render::{ render_resource::{binding_types::uniform_buffer, *}, renderer::{RenderDevice, RenderQueue}, sync_world::{RenderEntity, TemporaryRenderEntity}, - texture::BevyDefault, view::*, Extract, ExtractSchedule, Render, RenderSet, }; diff --git a/crates/bevy_ui/src/render/mod.rs b/crates/bevy_ui/src/render/mod.rs index 41c176a578..27068346e8 100644 --- a/crates/bevy_ui/src/render/mod.rs +++ b/crates/bevy_ui/src/render/mod.rs @@ -18,6 +18,7 @@ use bevy_core_pipeline::core_3d::graph::{Core3d, Node3d}; use bevy_core_pipeline::{core_2d::Camera2d, core_3d::Camera3d}; use bevy_ecs::entity::{EntityHashMap, EntityHashSet}; use bevy_ecs::prelude::*; +use bevy_image::Image; use bevy_math::{FloatOrd, Mat4, Rect, URect, UVec4, Vec2, Vec3, Vec3Swizzles, Vec4Swizzles}; use bevy_render::render_phase::ViewSortedRenderPhases; use bevy_render::sync_world::MainEntity; @@ -29,7 +30,6 @@ use bevy_render::{ render_phase::{sort_phase_system, AddRenderCommand, DrawFunctions}, render_resource::*, renderer::{RenderDevice, RenderQueue}, - texture::Image, view::{ExtractedView, ViewUniforms}, Extract, RenderApp, RenderSet, }; @@ -208,7 +208,7 @@ pub enum ExtractedUiItem { flip_x: bool, flip_y: bool, /// Border radius of the UI node. - /// Ordering: top left, top right, bottom right, bottom left. + /// Ordering: top left, top right, bottom right, bottom left. border_radius: ResolvedBorderRadius, /// Border thickness of the UI node. /// Ordering: left, top, right, bottom. diff --git a/crates/bevy_ui/src/render/pipeline.rs b/crates/bevy_ui/src/render/pipeline.rs index 633559cb9b..dd465515c5 100644 --- a/crates/bevy_ui/src/render/pipeline.rs +++ b/crates/bevy_ui/src/render/pipeline.rs @@ -1,11 +1,11 @@ use bevy_ecs::prelude::*; +use bevy_image::BevyDefault as _; use bevy_render::{ render_resource::{ binding_types::{sampler, texture_2d, uniform_buffer}, *, }, renderer::RenderDevice, - texture::BevyDefault, view::{ViewTarget, ViewUniform}, }; diff --git a/crates/bevy_ui/src/render/ui_material_pipeline.rs b/crates/bevy_ui/src/render/ui_material_pipeline.rs index f5379b2e5c..23be50063c 100644 --- a/crates/bevy_ui/src/render/ui_material_pipeline.rs +++ b/crates/bevy_ui/src/render/ui_material_pipeline.rs @@ -11,6 +11,7 @@ use bevy_ecs::{ *, }, }; +use bevy_image::BevyDefault as _; use bevy_math::{FloatOrd, Mat4, Rect, Vec2, Vec4Swizzles}; use bevy_render::sync_world::MainEntity; use bevy_render::{ @@ -21,7 +22,6 @@ use bevy_render::{ render_resource::{binding_types::uniform_buffer, *}, renderer::{RenderDevice, RenderQueue}, sync_world::{RenderEntity, TemporaryRenderEntity}, - texture::BevyDefault, view::*, Extract, ExtractSchedule, Render, RenderSet, }; diff --git a/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs b/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs index eb5dfd007f..67f9b327ae 100644 --- a/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs +++ b/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs @@ -11,6 +11,7 @@ use bevy_ecs::{ *, }, }; +use bevy_image::{BevyDefault, Image}; use bevy_math::{FloatOrd, Mat4, Rect, Vec2, Vec4Swizzles}; use bevy_render::sync_world::MainEntity; use bevy_render::{ @@ -19,7 +20,7 @@ use bevy_render::{ render_resource::{binding_types::uniform_buffer, *}, renderer::{RenderDevice, RenderQueue}, sync_world::{RenderEntity, TemporaryRenderEntity}, - texture::{BevyDefault, GpuImage, Image, TRANSPARENT_IMAGE_HANDLE}, + texture::{GpuImage, TRANSPARENT_IMAGE_HANDLE}, view::*, Extract, ExtractSchedule, Render, RenderSet, }; diff --git a/crates/bevy_ui/src/ui_material.rs b/crates/bevy_ui/src/ui_material.rs index 9c26f242e4..741bddfa29 100644 --- a/crates/bevy_ui/src/ui_material.rs +++ b/crates/bevy_ui/src/ui_material.rs @@ -30,8 +30,9 @@ use derive_more::derive::From; /// ``` /// # use bevy_ui::prelude::*; /// # use bevy_ecs::prelude::*; +/// # use bevy_image::Image; /// # use bevy_reflect::TypePath; -/// # use bevy_render::{render_resource::{AsBindGroup, ShaderRef}, texture::Image}; +/// # use bevy_render::render_resource::{AsBindGroup, ShaderRef}; /// # use bevy_color::LinearRgba; /// # use bevy_asset::{Handle, AssetServer, Assets, Asset}; /// diff --git a/crates/bevy_ui/src/widget/image.rs b/crates/bevy_ui/src/widget/image.rs index a45e8c8e7d..70995e3c93 100644 --- a/crates/bevy_ui/src/widget/image.rs +++ b/crates/bevy_ui/src/widget/image.rs @@ -2,9 +2,10 @@ use crate::{ContentSize, Measure, MeasureArgs, Node, NodeMeasure, UiScale}; use bevy_asset::{Assets, Handle}; use bevy_color::Color; use bevy_ecs::prelude::*; +use bevy_image::Image; use bevy_math::{Rect, UVec2, Vec2}; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; -use bevy_render::texture::{Image, TRANSPARENT_IMAGE_HANDLE}; +use bevy_render::texture::TRANSPARENT_IMAGE_HANDLE; use bevy_sprite::{TextureAtlas, TextureAtlasLayout, TextureSlicer}; use bevy_window::{PrimaryWindow, Window}; use taffy::{MaybeMath, MaybeResolve}; diff --git a/crates/bevy_ui/src/widget/text.rs b/crates/bevy_ui/src/widget/text.rs index 30817e05da..1007a4cc78 100644 --- a/crates/bevy_ui/src/widget/text.rs +++ b/crates/bevy_ui/src/widget/text.rs @@ -14,9 +14,10 @@ use bevy_ecs::{ system::{Local, Query, Res, ResMut}, world::{Mut, Ref}, }; +use bevy_image::Image; use bevy_math::Vec2; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; -use bevy_render::{camera::Camera, texture::Image}; +use bevy_render::camera::Camera; use bevy_sprite::TextureAtlasLayout; use bevy_text::{ scale_value, ComputedTextBlock, CosmicFontSystem, Font, FontAtlasSets, LineBreak, SwashCache, diff --git a/examples/2d/mesh2d_manual.rs b/examples/2d/mesh2d_manual.rs index 6be6ca5f07..f12e6a27cb 100644 --- a/examples/2d/mesh2d_manual.rs +++ b/examples/2d/mesh2d_manual.rs @@ -25,7 +25,6 @@ use bevy::{ TextureFormat, VertexBufferLayout, VertexFormat, VertexState, VertexStepMode, }, sync_world::MainEntityHashMap, - texture::BevyDefault, view::{ExtractedView, RenderVisibleEntities, ViewTarget}, Extract, Render, RenderApp, RenderSet, }, diff --git a/examples/2d/texture_atlas.rs b/examples/2d/texture_atlas.rs index 532903c0ad..502285c9ac 100644 --- a/examples/2d/texture_atlas.rs +++ b/examples/2d/texture_atlas.rs @@ -7,7 +7,7 @@ //! Only one padded and one unpadded texture atlas are rendered to the screen. //! An upscaled sprite from each of the four atlases are rendered to the screen. -use bevy::{asset::LoadedFolder, prelude::*, render::texture::ImageSampler}; +use bevy::{asset::LoadedFolder, image::ImageSampler, prelude::*}; fn main() { App::new() diff --git a/examples/3d/anti_aliasing.rs b/examples/3d/anti_aliasing.rs index 19659ac3a5..f41ca3576f 100644 --- a/examples/3d/anti_aliasing.rs +++ b/examples/3d/anti_aliasing.rs @@ -10,13 +10,13 @@ use bevy::{ prepass::{DepthPrepass, MotionVectorPrepass}, smaa::{Smaa, SmaaPreset}, }, + image::{ImageSampler, ImageSamplerDescriptor}, pbr::CascadeShadowConfigBuilder, prelude::*, render::{ camera::TemporalJitter, render_asset::RenderAssetUsages, render_resource::{Extent3d, TextureDimension, TextureFormat}, - texture::{ImageSampler, ImageSamplerDescriptor}, }, }; diff --git a/examples/3d/clearcoat.rs b/examples/3d/clearcoat.rs index 1cd825285a..c04b12d581 100644 --- a/examples/3d/clearcoat.rs +++ b/examples/3d/clearcoat.rs @@ -22,9 +22,9 @@ use std::f32::consts::PI; use bevy::{ color::palettes::css::{BLUE, GOLD, WHITE}, core_pipeline::{tonemapping::Tonemapping::AcesFitted, Skybox}, + image::ImageLoaderSettings, math::vec3, prelude::*, - render::texture::ImageLoaderSettings, }; /// The size of each sphere. diff --git a/examples/3d/deferred_rendering.rs b/examples/3d/deferred_rendering.rs index 769d617495..2bca5a5be7 100644 --- a/examples/3d/deferred_rendering.rs +++ b/examples/3d/deferred_rendering.rs @@ -7,13 +7,13 @@ use bevy::{ fxaa::Fxaa, prepass::{DeferredPrepass, DepthPrepass, MotionVectorPrepass, NormalPrepass}, }, + image::ImageLoaderSettings, math::ops, pbr::{ CascadeShadowConfigBuilder, DefaultOpaqueRendererMethod, DirectionalLightShadowMap, NotShadowCaster, NotShadowReceiver, OpaqueRendererMethod, }, prelude::*, - render::texture::ImageLoaderSettings, }; fn main() { diff --git a/examples/3d/motion_blur.rs b/examples/3d/motion_blur.rs index caea6835ac..94a203ea69 100644 --- a/examples/3d/motion_blur.rs +++ b/examples/3d/motion_blur.rs @@ -1,7 +1,12 @@ //! Demonstrates how to enable per-object motion blur. This rendering feature can be configured per //! camera using the [`MotionBlur`] component.z -use bevy::{core_pipeline::motion_blur::MotionBlur, math::ops, prelude::*}; +use bevy::{ + core_pipeline::motion_blur::MotionBlur, + image::{ImageAddressMode, ImageFilterMode, ImageSampler, ImageSamplerDescriptor}, + math::ops, + prelude::*, +}; fn main() { let mut app = App::new(); @@ -350,7 +355,7 @@ fn move_camera( } fn uv_debug_texture() -> Image { - use bevy::render::{render_asset::RenderAssetUsages, render_resource::*, texture::*}; + use bevy::render::{render_asset::RenderAssetUsages, render_resource::*}; const TEXTURE_SIZE: usize = 7; let mut palette = [ diff --git a/examples/3d/parallax_mapping.rs b/examples/3d/parallax_mapping.rs index 1d4daad5db..47d83a4e76 100644 --- a/examples/3d/parallax_mapping.rs +++ b/examples/3d/parallax_mapping.rs @@ -3,7 +3,7 @@ use std::fmt; -use bevy::{math::ops, prelude::*, render::texture::ImageLoaderSettings}; +use bevy::{image::ImageLoaderSettings, math::ops, prelude::*}; fn main() { App::new() diff --git a/examples/3d/rotate_environment_map.rs b/examples/3d/rotate_environment_map.rs index 0e7f4a5e55..68ecceeccf 100644 --- a/examples/3d/rotate_environment_map.rs +++ b/examples/3d/rotate_environment_map.rs @@ -5,8 +5,8 @@ use std::f32::consts::PI; use bevy::{ color::palettes::css::{GOLD, WHITE}, core_pipeline::{tonemapping::Tonemapping::AcesFitted, Skybox}, + image::ImageLoaderSettings, prelude::*, - render::texture::ImageLoaderSettings, }; /// Entry point. diff --git a/examples/3d/scrolling_fog.rs b/examples/3d/scrolling_fog.rs index 5e66bc25cb..5511862572 100644 --- a/examples/3d/scrolling_fog.rs +++ b/examples/3d/scrolling_fog.rs @@ -15,12 +15,12 @@ use bevy::{ bloom::Bloom, experimental::taa::{TemporalAntiAliasPlugin, TemporalAntiAliasing}, }, - pbr::{DirectionalLightShadowMap, FogVolume, VolumetricFog, VolumetricLight}, - prelude::*, - render::texture::{ + image::{ ImageAddressMode, ImageFilterMode, ImageLoaderSettings, ImageSampler, ImageSamplerDescriptor, }, + pbr::{DirectionalLightShadowMap, FogVolume, VolumetricFog, VolumetricLight}, + prelude::*, }; /// Initializes the example. diff --git a/examples/3d/skybox.rs b/examples/3d/skybox.rs index d2593f7741..8dc94d9f94 100644 --- a/examples/3d/skybox.rs +++ b/examples/3d/skybox.rs @@ -5,11 +5,11 @@ mod camera_controller; use bevy::{ core_pipeline::Skybox, + image::CompressedImageFormats, prelude::*, render::{ render_resource::{TextureViewDescriptor, TextureViewDimension}, renderer::RenderDevice, - texture::CompressedImageFormats, }, }; use camera_controller::{CameraController, CameraControllerPlugin}; diff --git a/examples/3d/ssr.rs b/examples/3d/ssr.rs index 8f4ae85fe1..1cc3695354 100644 --- a/examples/3d/ssr.rs +++ b/examples/3d/ssr.rs @@ -5,19 +5,17 @@ use std::ops::Range; use bevy::{ color::palettes::css::{BLACK, WHITE}, core_pipeline::{fxaa::Fxaa, Skybox}, + image::{ + ImageAddressMode, ImageFilterMode, ImageLoaderSettings, ImageSampler, + ImageSamplerDescriptor, + }, input::mouse::MouseWheel, math::{vec3, vec4}, pbr::{ DefaultOpaqueRendererMethod, ExtendedMaterial, MaterialExtension, ScreenSpaceReflections, }, prelude::*, - render::{ - render_resource::{AsBindGroup, ShaderRef, ShaderType}, - texture::{ - ImageAddressMode, ImageFilterMode, ImageLoaderSettings, ImageSampler, - ImageSamplerDescriptor, - }, - }, + render::render_resource::{AsBindGroup, ShaderRef, ShaderType}, }; /// This example uses a shader source file from the assets subdirectory diff --git a/examples/app/headless_renderer.rs b/examples/app/headless_renderer.rs index cb11c42a0e..8fe2ef5871 100644 --- a/examples/app/headless_renderer.rs +++ b/examples/app/headless_renderer.rs @@ -10,6 +10,7 @@ use bevy::{ app::{AppExit, ScheduleRunnerPlugin}, core_pipeline::tonemapping::Tonemapping, + image::TextureFormatPixelInfo, prelude::*, render::{ camera::RenderTarget, @@ -21,7 +22,6 @@ use bevy::{ TextureUsages, }, renderer::{RenderContext, RenderDevice, RenderQueue}, - texture::{BevyDefault, TextureFormatPixelInfo}, Extract, Render, RenderApp, RenderSet, }, winit::WinitPlugin, diff --git a/examples/asset/alter_sprite.rs b/examples/asset/alter_sprite.rs index 807013b675..92f0d0e929 100644 --- a/examples/asset/alter_sprite.rs +++ b/examples/asset/alter_sprite.rs @@ -1,9 +1,8 @@ //! Shows how to modify texture assets after spawning. use bevy::{ - input::common_conditions::input_just_pressed, - prelude::*, - render::{render_asset::RenderAssetUsages, texture::ImageLoaderSettings}, + image::ImageLoaderSettings, input::common_conditions::input_just_pressed, prelude::*, + render::render_asset::RenderAssetUsages, }; fn main() { diff --git a/examples/asset/asset_settings.rs b/examples/asset/asset_settings.rs index cf8182f4f9..cfc76d774a 100644 --- a/examples/asset/asset_settings.rs +++ b/examples/asset/asset_settings.rs @@ -1,8 +1,8 @@ //! This example demonstrates the usage of '.meta' files and [`AssetServer::load_with_settings`] to override the default settings for loading an asset use bevy::{ + image::{ImageLoaderSettings, ImageSampler}, prelude::*, - render::texture::{ImageLoaderSettings, ImageSampler}, }; fn main() { diff --git a/examples/asset/repeated_texture.rs b/examples/asset/repeated_texture.rs index aed3215ab5..34664a9e42 100644 --- a/examples/asset/repeated_texture.rs +++ b/examples/asset/repeated_texture.rs @@ -2,11 +2,9 @@ //! This example shows how to configure it to repeat the image instead. use bevy::{ + image::{ImageAddressMode, ImageLoaderSettings, ImageSampler, ImageSamplerDescriptor}, math::Affine2, prelude::*, - render::texture::{ - ImageAddressMode, ImageLoaderSettings, ImageSampler, ImageSamplerDescriptor, - }, }; fn main() { diff --git a/examples/shader/custom_phase_item.rs b/examples/shader/custom_phase_item.rs index f4b9a87236..088265ef4e 100644 --- a/examples/shader/custom_phase_item.rs +++ b/examples/shader/custom_phase_item.rs @@ -30,7 +30,6 @@ use bevy::{ VertexFormat, VertexState, VertexStepMode, }, renderer::{RenderDevice, RenderQueue}, - texture::BevyDefault as _, view::{self, ExtractedView, RenderVisibleEntities, VisibilitySystems}, Render, RenderApp, RenderSet, }, diff --git a/examples/shader/custom_post_processing.rs b/examples/shader/custom_post_processing.rs index 8567f45d26..ec532071bf 100644 --- a/examples/shader/custom_post_processing.rs +++ b/examples/shader/custom_post_processing.rs @@ -26,7 +26,6 @@ use bevy::{ *, }, renderer::{RenderContext, RenderDevice}, - texture::BevyDefault, view::ViewTarget, RenderApp, }, diff --git a/examples/shader/gpu_readback.rs b/examples/shader/gpu_readback.rs index a83f01dcae..5a33f93743 100644 --- a/examples/shader/gpu_readback.rs +++ b/examples/shader/gpu_readback.rs @@ -7,8 +7,7 @@ use bevy::{ extract_resource::{ExtractResource, ExtractResourcePlugin}, gpu_readback::{Readback, ReadbackComplete}, render_asset::{RenderAssetUsages, RenderAssets}, - render_graph, - render_graph::{RenderGraph, RenderLabel}, + render_graph::{self, RenderGraph, RenderLabel}, render_resource::{ binding_types::{storage_buffer, texture_storage_2d}, *, diff --git a/examples/shader/specialized_mesh_pipeline.rs b/examples/shader/specialized_mesh_pipeline.rs index dd097a0b66..2d30f605d1 100644 --- a/examples/shader/specialized_mesh_pipeline.rs +++ b/examples/shader/specialized_mesh_pipeline.rs @@ -28,7 +28,6 @@ use bevy::{ RenderPipelineDescriptor, SpecializedMeshPipeline, SpecializedMeshPipelineError, SpecializedMeshPipelines, TextureFormat, VertexState, }, - texture::BevyDefault as _, view::{self, ExtractedView, RenderVisibleEntities, ViewTarget, VisibilitySystems}, Render, RenderApp, RenderSet, }, diff --git a/examples/ui/ui_texture_slice_flip_and_tile.rs b/examples/ui/ui_texture_slice_flip_and_tile.rs index 07f81f14ed..ccf9e7d174 100644 --- a/examples/ui/ui_texture_slice_flip_and_tile.rs +++ b/examples/ui/ui_texture_slice_flip_and_tile.rs @@ -1,8 +1,8 @@ //! This example illustrates how to how to flip and tile images with 9-slicing in the UI. use bevy::{ + image::{ImageLoaderSettings, ImageSampler}, prelude::*, - render::texture::{ImageLoaderSettings, ImageSampler}, ui::widget::NodeImageMode, winit::WinitSettings, };