Skip to content

Commit 55d153b

Browse files
committed
Round 2
1 parent dee0cc7 commit 55d153b

47 files changed

Lines changed: 165 additions & 223 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

crates/bevy_anti_alias/src/contrast_adaptive_sharpening/mod.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,10 @@ use bevy_ecs::{prelude::*, query::QueryItem};
1010
use bevy_image::BevyDefault as _;
1111
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
1212
use bevy_render::{
13-
extract_component::{ExtractComponent, ExtractComponentPlugin, UniformComponentPlugin},
14-
render_resource::{
13+
Render, RenderApp, RenderStartup, RenderSystems, extract_component::{ExtractBaseComponent, ExtractComponent, ExtractComponentPlugin, UniformComponentPlugin}, render_resource::{
1514
binding_types::{sampler, texture_2d, uniform_buffer},
1615
*,
17-
},
18-
renderer::RenderDevice,
19-
sync_component::SyncComponent,
20-
view::{ExtractedView, ViewTarget},
21-
Render, RenderApp, RenderStartup, RenderSystems,
16+
}, renderer::RenderDevice, sync_component::SyncComponent, view::{ExtractedView, ViewTarget}
2217
};
2318

2419
mod node;
@@ -80,7 +75,7 @@ impl SyncComponent for ContrastAdaptiveSharpening {
8075
type Out = (DenoiseCas, CasUniform);
8176
}
8277

83-
impl ExtractComponent for ContrastAdaptiveSharpening {
78+
impl ExtractBaseComponent<RenderApp> for ContrastAdaptiveSharpening {
8479
type QueryData = &'static Self;
8580
type QueryFilter = With<Camera>;
8681

@@ -107,7 +102,7 @@ impl Plugin for CasPlugin {
107102
embedded_asset!(app, "robust_contrast_adaptive_sharpening.wgsl");
108103

109104
app.add_plugins((
110-
ExtractComponentPlugin::<ContrastAdaptiveSharpening>::default(),
105+
ExtractComponentPlugin::<ContrastAdaptiveSharpening>::new(RenderApp),
111106
UniformComponentPlugin::<CasUniform>::default(),
112107
));
113108

crates/bevy_anti_alias/src/fxaa/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl Plugin for FxaaPlugin {
8787
fn build(&self, app: &mut App) {
8888
embedded_asset!(app, "fxaa.wgsl");
8989

90-
app.add_plugins(ExtractComponentPlugin::<Fxaa>::default());
90+
app.add_plugins(ExtractComponentPlugin::<Fxaa>::new(RenderApp));
9191

9292
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
9393
return;

crates/bevy_anti_alias/src/smaa/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl Plugin for SmaaPlugin {
323323
}
324324
};
325325

326-
app.add_plugins(ExtractComponentPlugin::<Smaa>::default());
326+
app.add_plugins(ExtractComponentPlugin::<Smaa>::new(RenderApp));
327327

328328
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
329329
return;

crates/bevy_core_pipeline/src/core_2d/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use bevy_image::ToExtents;
99
use bevy_platform::collections::{HashMap, HashSet};
1010
use bevy_render::{
1111
batching::gpu_preprocessing::GpuPreprocessingMode,
12-
camera::CameraRenderGraph,
12+
camera::{CameraPlugin, CameraRenderGraph},
1313
render_phase::PhaseItemBatchSetKey,
1414
view::{ExtractedView, RetainedViewEntity},
1515
};
@@ -53,7 +53,7 @@ impl Plugin for Core2dPlugin {
5353
CameraRenderGraph::new(Core2d)
5454
})
5555
.register_required_components_with::<Camera2d, Tonemapping>(|| Tonemapping::None)
56-
.add_plugins(ExtractComponentPlugin::<Camera2d>::default());
56+
.add_plugins(ExtractComponentPlugin::<Camera2d, CameraPlugin>::new(RenderApp));
5757

5858
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
5959
return;

crates/bevy_core_pipeline/src/core_3d/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ use bevy_camera::{Camera, Camera3d, Camera3dDepthLoadOp};
3030
use bevy_diagnostic::FrameCount;
3131
use bevy_render::{
3232
batching::gpu_preprocessing::{GpuPreprocessingMode, GpuPreprocessingSupport},
33-
camera::CameraRenderGraph,
33+
camera::{CameraPlugin, CameraRenderGraph},
3434
mesh::allocator::SlabId,
3535
occlusion_culling::OcclusionCulling,
3636
render_phase::PhaseItemBatchSetKey,
3737
texture::CachedTexture,
38-
view::{prepare_view_targets, NoIndirectDrawing, RetainedViewEntity},
38+
view::{NoIndirectDrawing, RetainedViewEntity, prepare_view_targets},
3939
};
4040
pub use main_opaque_pass_3d_node::*;
4141
pub use main_transparent_pass_3d_node::*;
@@ -99,7 +99,7 @@ impl Plugin for Core3dPlugin {
9999
CameraRenderGraph::new(Core3d)
100100
})
101101
.register_required_components::<Camera3d, Tonemapping>()
102-
.add_plugins((SkyboxPlugin, ExtractComponentPlugin::<Camera3d>::default()))
102+
.add_plugins((SkyboxPlugin, ExtractComponentPlugin::<Camera3d, CameraPlugin>::new(RenderApp)))
103103
.add_systems(PostUpdate, check_msaa);
104104

105105
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {

crates/bevy_core_pipeline/src/fullscreen_material.rs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,11 @@ use bevy_ecs::{
1919
};
2020
use bevy_image::BevyDefault;
2121
use bevy_render::{
22-
extract_component::{
23-
ComponentUniforms, DynamicUniformIndex, ExtractComponent, ExtractComponentPlugin,
24-
UniformComponentPlugin,
25-
},
26-
render_resource::{
27-
binding_types::{sampler, texture_2d, uniform_buffer},
28-
encase::internal::WriteInto,
29-
BindGroup, BindGroupEntries, BindGroupLayoutDescriptor, BindGroupLayoutEntries,
30-
CachedRenderPipelineId, ColorTargetState, ColorWrites, FragmentState, Operations,
31-
PipelineCache, RenderPassColorAttachment, RenderPassDescriptor, RenderPipelineDescriptor,
32-
Sampler, SamplerBindingType, SamplerDescriptor, ShaderStages, ShaderType, TextureFormat,
33-
TextureSampleType, TextureView, TextureViewId,
34-
},
35-
renderer::{RenderContext, RenderDevice, ViewQuery},
36-
view::ViewTarget,
37-
Render, RenderApp, RenderStartup, RenderSystems,
22+
Render, RenderApp, RenderStartup, RenderSystems, extract_component::{
23+
ComponentUniforms, DynamicUniformIndex, ExtractBaseComponent, ExtractComponent, ExtractComponentPlugin, UniformComponentPlugin
24+
}, render_resource::{
25+
BindGroup, BindGroupEntries, BindGroupLayoutDescriptor, BindGroupLayoutEntries, CachedRenderPipelineId, ColorTargetState, ColorWrites, FragmentState, Operations, PipelineCache, RenderPassColorAttachment, RenderPassDescriptor, RenderPipelineDescriptor, Sampler, SamplerBindingType, SamplerDescriptor, ShaderStages, ShaderType, TextureFormat, TextureSampleType, TextureView, TextureViewId, binding_types::{sampler, texture_2d, uniform_buffer}, encase::internal::WriteInto
26+
}, renderer::{RenderContext, RenderDevice, ViewQuery}, view::ViewTarget
3827
};
3928
use bevy_shader::ShaderRef;
4029
use bevy_utils::default;
@@ -47,7 +36,7 @@ pub struct FullscreenMaterialPlugin<T: FullscreenMaterial> {
4736
impl<T: FullscreenMaterial> Plugin for FullscreenMaterialPlugin<T> {
4837
fn build(&self, app: &mut App) {
4938
app.add_plugins((
50-
ExtractComponentPlugin::<T>::default(),
39+
ExtractComponentPlugin::<T>::new(RenderApp),
5140
UniformComponentPlugin::<T>::default(),
5241
));
5342

@@ -75,7 +64,7 @@ impl<T: FullscreenMaterial> Plugin for FullscreenMaterialPlugin<T> {
7564

7665
/// A trait to define a material that will render to the entire screen using a fullscreen triangle.
7766
pub trait FullscreenMaterial:
78-
Component + ExtractComponent + Clone + Copy + ShaderType + WriteInto + Default
67+
Component + ExtractBaseComponent<RenderApp> + Clone + Copy + ShaderType + WriteInto + Default
7968
{
8069
/// The shader that will run on the entire screen using a fullscreen triangle.
8170
fn fragment_shader() -> ShaderRef;

crates/bevy_core_pipeline/src/oit/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl Plugin for OrderIndependentTransparencyPlugin {
8585
load_shader_library!(app, "oit_draw.wgsl");
8686

8787
app.add_plugins((
88-
ExtractComponentPlugin::<OrderIndependentTransparencySettings>::default(),
88+
ExtractComponentPlugin::<OrderIndependentTransparencySettings>::new(RenderApp),
8989
OitResolvePlugin,
9090
))
9191
.add_systems(Update, check_msaa);

crates/bevy_core_pipeline/src/tonemapping/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ impl Plugin for TonemappingPlugin {
8282
app.insert_resource(tonemapping_luts);
8383
}
8484

85-
app.add_plugins(ExtractResourcePlugin::<TonemappingLuts>::default());
85+
app.add_plugins(ExtractResourcePlugin::<TonemappingLuts>::new(RenderApp));
8686

8787
app.add_plugins((
88-
ExtractComponentPlugin::<Tonemapping>::default(),
89-
ExtractComponentPlugin::<DebandDither>::default(),
88+
ExtractComponentPlugin::<Tonemapping>::new(RenderApp),
89+
ExtractComponentPlugin::<DebandDither>::new(RenderApp),
9090
));
9191

9292
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {

crates/bevy_extract/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Bevy App
22

33
[![License](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/bevyengine/bevy#license)
4-
[![Crates.io](https://img.shields.io/crates/v/bevy.svg)](https://crates.io/crates/bevy_app)
5-
[![Downloads](https://img.shields.io/crates/d/bevy_app.svg)](https://crates.io/crates/bevy_app)
6-
[![Docs](https://docs.rs/bevy_app/badge.svg)](https://docs.rs/bevy_app/latest/bevy_app/)
4+
[![Crates.io](https://img.shields.io/crates/v/bevy.svg)](https://crates.io/crates/bevy_extract)
5+
[![Downloads](https://img.shields.io/crates/d/bevy_extract.svg)](https://crates.io/crates/bevy_extract)
6+
[![Docs](https://docs.rs/bevy_extract/badge.svg)](https://docs.rs/bevy_extract/latest/bevy_extract/)
77
[![Discord](https://img.shields.io/discord/691052431525675048.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/bevy)
88

9-
This crate is about everything concerning the highest-level, application layer of a [Bevy](https://crates.io/crates/bevy) app.
9+
This crate makes it easy to copy out main world state to a sub app's world.

crates/bevy_extract/macros/src/extract_component.rs renamed to crates/bevy_extract/macros/src/extract_base_component.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn derive_extract_component(input: TokenStream) -> TokenStream {
4343
type Out = Self;
4444
}
4545

46-
impl #impl_generics #bevy_extract_path::extract_component::ExtractBaseComponent for #struct_name #type_generics #where_clause {
46+
impl #impl_generics #bevy_extract_path::extract_base_component::ExtractBaseComponent for #struct_name #type_generics #where_clause {
4747
type QueryData = &'static Self;
4848

4949
type QueryFilter = #filter;

0 commit comments

Comments
 (0)