Merge branch 'main' into add-transform-lerp

This commit is contained in:
Sigma-dev 2024-11-11 17:23:11 +01:00 committed by GitHub
commit 4533a25ccc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
100 changed files with 225 additions and 189 deletions

View file

@ -72,8 +72,7 @@ jobs:
run: cargo run -p ci -- lints
miri:
# Explicitly use macOS 14 to take advantage of M1 chip.
runs-on: macos-14
runs-on: macos-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
@ -243,7 +242,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/typos@v1.27.0
uses: crate-ci/typos@v1.27.3
- name: Typos info
if: failure()
run: |
@ -254,8 +253,7 @@ jobs:
echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode'
run-examples-macos-metal:
# Explicitly use macOS 14 to take advantage of M1 chip.
runs-on: macos-14
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

View file

@ -40,6 +40,7 @@ semicolon_if_nothing_returned = "warn"
type_complexity = "allow"
undocumented_unsafe_blocks = "warn"
unwrap_or_default = "warn"
needless_lifetimes = "allow"
ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
@ -80,6 +81,7 @@ semicolon_if_nothing_returned = "warn"
type_complexity = "allow"
undocumented_unsafe_blocks = "warn"
unwrap_or_default = "warn"
needless_lifetimes = "allow"
ptr_as_ptr = "warn"
ptr_cast_constness = "warn"

0
crates/bevy_animation/src/lib.rs Executable file → Normal file
View file

View file

@ -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;

View file

@ -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.

View file

@ -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,
};

View file

@ -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,
};

View file

@ -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,

View file

@ -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,
};

View file

@ -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},
};

View file

@ -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,
};

View file

@ -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,
};

View file

@ -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,
};

View file

@ -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<Shader> = 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")
);

View file

@ -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,
};

View file

@ -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(

View file

@ -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 }

View file

@ -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,
};

View file

@ -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,
};

View file

@ -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;

View file

@ -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;

0
crates/bevy_hierarchy/src/lib.rs Executable file → Normal file
View file

View file

@ -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;
}

View file

@ -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")]

View file

@ -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;

View file

@ -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)]

View file

@ -331,7 +331,17 @@ impl Rot2 {
/// Returns the angle in radians needed to make `self` and `other` coincide.
#[inline]
#[deprecated(
since = "0.15.0",
note = "Use `angle_to` instead, the semantics of `angle_between` will change in the future."
)]
pub fn angle_between(self, other: Self) -> f32 {
self.angle_to(other)
}
/// Returns the angle in radians needed to make `self` and `other` coincide.
#[inline]
pub fn angle_to(self, other: Self) -> f32 {
(other * self.inverse()).as_radians()
}
@ -424,7 +434,7 @@ impl Rot2 {
/// ```
#[inline]
pub fn slerp(self, end: Self, s: f32) -> Self {
self * Self::radians(self.angle_between(end) * s)
self * Self::radians(self.angle_to(end) * s)
}
}
@ -567,10 +577,7 @@ mod tests {
assert_relative_eq!((rotation1 * rotation2.inverse()).as_degrees(), 45.0);
// This should be equivalent to the above
assert_relative_eq!(
rotation2.angle_between(rotation1),
core::f32::consts::FRAC_PI_4
);
assert_relative_eq!(rotation2.angle_to(rotation1), core::f32::consts::FRAC_PI_4);
}
#[test]

View file

@ -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",

View file

@ -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<Shader> =

View file

@ -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<Shader> = Handle::weak_from_u128(1708015359337029744);

View file

@ -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};

View file

@ -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};

View file

@ -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,
};

View file

@ -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,
};

View file

@ -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};

View file

@ -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,

View file

@ -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,

View file

@ -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,
};

View file

@ -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,
};

View file

@ -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,
};

View file

@ -41,6 +41,7 @@ enum BindingState<'a> {
pub fn derive_as_bind_group(ast: syn::DeriveInput) -> Result<TokenStream> {
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<TokenStream> {
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<TokenStream> {
(
#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<TokenStream> {
(
#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)?;

View file

@ -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;

View file

@ -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;

View file

@ -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};

View file

@ -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;

View file

@ -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<Option<Handle<Image>>>`]. In practice,
/// most fields should be a [`Handle<Image>`](bevy_asset::Handle) or [`Option<Handle<Image>>`]. If the value of an [`Option<Handle<Image>>`] 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<Option<Handle<Image>>>`]. In practice,
/// most fields should be a [`Handle<Image>`](bevy_asset::Handle) or [`Option<Handle<Image>>`]. If the value of an [`Option<Handle<Image>>`] 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<Handle<Image>>`] 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() {

View file

@ -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<Image> =
// 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::<ExrTextureLoader>();
app.init_asset_loader::<bevy_image::ExrTextureLoader>();
}
#[cfg(feature = "hdr")]

View file

@ -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;

View file

@ -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::{

View file

@ -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 = [

View file

@ -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};

View file

@ -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,
};

View file

@ -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<Shader> =
Handle::weak_from_u128(3253086872234592509);

View file

@ -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};

View file

@ -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,
},

View file

@ -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::*;

View file

@ -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,

View file

@ -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};

View file

@ -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.

View file

@ -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<Assets<Image>>, mut layouts: ResMut<Assets<TextureAtlasLayout>>) {
/// // Declare your builder

View file

@ -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;

View file

@ -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",

View file

@ -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;

View file

@ -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;

View file

@ -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.

View file

@ -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;

View file

@ -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,
};

View file

@ -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 = [

View file

@ -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,

View file

@ -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,
};

View file

@ -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.

View file

@ -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},
};

View file

@ -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,
};

View file

@ -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,
};

View file

@ -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};
///

View file

@ -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};

View file

@ -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,

View file

@ -385,8 +385,11 @@ pub(crate) fn changed_windows(
}
}
if window.cursor_options.grab_mode != cache.window.cursor_options.grab_mode {
crate::winit_windows::attempt_grab(winit_window, window.cursor_options.grab_mode);
if window.cursor_options.grab_mode != cache.window.cursor_options.grab_mode
&& crate::winit_windows::attempt_grab(winit_window, window.cursor_options.grab_mode)
.is_err()
{
window.cursor_options.grab_mode = cache.window.cursor_options.grab_mode;
}
if window.cursor_options.visible != cache.window.cursor_options.visible {

View file

@ -10,6 +10,7 @@ use bevy_window::{
use winit::{
dpi::{LogicalSize, PhysicalPosition},
error::ExternalError,
event_loop::ActiveEventLoop,
monitor::{MonitorHandle, VideoModeHandle},
window::{CursorGrabMode as WinitCursorGrabMode, Fullscreen, Window as WinitWindow, WindowId},
@ -279,7 +280,7 @@ impl WinitWindows {
// Do not set the grab mode on window creation if it's none. It can fail on mobile.
if window.cursor_options.grab_mode != CursorGrabMode::None {
attempt_grab(&winit_window, window.cursor_options.grab_mode);
let _ = attempt_grab(&winit_window, window.cursor_options.grab_mode);
}
winit_window.set_cursor_visible(window.cursor_options.visible);
@ -380,7 +381,10 @@ pub fn get_best_videomode(monitor: &MonitorHandle) -> VideoModeHandle {
modes.first().unwrap().clone()
}
pub(crate) fn attempt_grab(winit_window: &WinitWindow, grab_mode: CursorGrabMode) {
pub(crate) fn attempt_grab(
winit_window: &WinitWindow,
grab_mode: CursorGrabMode,
) -> Result<(), ExternalError> {
let grab_result = match grab_mode {
CursorGrabMode::None => winit_window.set_cursor_grab(WinitCursorGrabMode::None),
CursorGrabMode::Confined => winit_window
@ -398,6 +402,9 @@ pub(crate) fn attempt_grab(winit_window: &WinitWindow, grab_mode: CursorGrabMode
};
bevy_utils::tracing::error!("Unable to {} cursor: {}", err_desc, err);
Err(err)
} else {
Ok(())
}
}

View file

@ -25,7 +25,6 @@ use bevy::{
TextureFormat, VertexBufferLayout, VertexFormat, VertexState, VertexStepMode,
},
sync_world::MainEntityHashMap,
texture::BevyDefault,
view::{ExtractedView, RenderVisibleEntities, ViewTarget},
Extract, Render, RenderApp, RenderSet,
},

View file

@ -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()

View file

@ -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},
},
};

View file

@ -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.

View file

@ -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() {

View file

@ -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 = [

View file

@ -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()

View file

@ -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.

View file

@ -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.

View file

@ -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};

View file

@ -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

View file

@ -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,

View file

@ -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() {

View file

@ -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() {

View file

@ -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() {

View file

@ -30,7 +30,6 @@ use bevy::{
VertexFormat, VertexState, VertexStepMode,
},
renderer::{RenderDevice, RenderQueue},
texture::BevyDefault as _,
view::{self, ExtractedView, RenderVisibleEntities, VisibilitySystems},
Render, RenderApp, RenderSet,
},

View file

@ -26,7 +26,6 @@ use bevy::{
*,
},
renderer::{RenderContext, RenderDevice},
texture::BevyDefault,
view::ViewTarget,
RenderApp,
},

View file

@ -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},
*,

View file

@ -28,7 +28,6 @@ use bevy::{
RenderPipelineDescriptor, SpecializedMeshPipeline, SpecializedMeshPipelineError,
SpecializedMeshPipelines, TextureFormat, VertexState,
},
texture::BevyDefault as _,
view::{self, ExtractedView, RenderVisibleEntities, ViewTarget, VisibilitySystems},
Render, RenderApp, RenderSet,
},

View file

@ -17,13 +17,13 @@ fn main() {
.run();
}
// A unit struct to help identify the FPS UI component, since there may be many Text components
// Marker struct to help identify the FPS UI component, since there may be many Text components
#[derive(Component)]
struct FpsText;
// A unit struct to help identify the color-changing Text component
// Marker struct to help identify the color-changing Text component
#[derive(Component)]
struct ColorText;
struct AnimatedText;
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
// UI camera
@ -47,7 +47,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
right: Val::Px(5.0),
..default()
},
ColorText,
AnimatedText,
));
// Text with multiple sections
@ -116,7 +116,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
));
}
fn text_color_system(time: Res<Time>, mut query: Query<&mut TextColor, With<ColorText>>) {
fn text_color_system(time: Res<Time>, mut query: Query<&mut TextColor, With<AnimatedText>>) {
for mut text_color in &mut query {
let seconds = time.elapsed_secs();

View file

@ -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,
};