Revert rendering-related associated type name changes (#11027)
# Objective > Can anyone explain to me the reasoning of renaming all the types named Query to Data. I'm talking about this PR https://github.com/bevyengine/bevy/pull/10779 It doesn't make sense to me that a bunch of types that are used to run queries aren't named Query anymore. Like ViewQuery on the ViewNode is the type of the Query. I don't really understand the point of the rename, it just seems like it hides the fact that a query will run based on those types. [@IceSentry](https://discord.com/channels/691052431525675048/692572690833473578/1184946251431694387) ## Solution Revert several renames in #10779. ## Changelog - `ViewNode::ViewData` is now `ViewNode::ViewQuery` again. ## Migration Guide - This PR amends the migration guide in https://github.com/bevyengine/bevy/pull/10779 --------- Co-authored-by: atlas dostal <rodol@rivalrebels.com>
This commit is contained in:
parent
8afb3ceb89
commit
eb07d16871
@ -113,7 +113,7 @@ impl Plugin for BloomPlugin {
|
|||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct BloomNode;
|
struct BloomNode;
|
||||||
impl ViewNode for BloomNode {
|
impl ViewNode for BloomNode {
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ExtractedCamera,
|
&'static ExtractedCamera,
|
||||||
&'static ViewTarget,
|
&'static ViewTarget,
|
||||||
&'static BloomTexture,
|
&'static BloomTexture,
|
||||||
@ -140,7 +140,7 @@ impl ViewNode for BloomNode {
|
|||||||
bloom_settings,
|
bloom_settings,
|
||||||
upsampling_pipeline_ids,
|
upsampling_pipeline_ids,
|
||||||
downsampling_pipeline_ids,
|
downsampling_pipeline_ids,
|
||||||
): QueryItem<Self::ViewData>,
|
): QueryItem<Self::ViewQuery>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
let downsampling_pipeline_res = world.resource::<BloomDownsamplingPipeline>();
|
let downsampling_pipeline_res = world.resource::<BloomDownsamplingPipeline>();
|
||||||
|
|||||||
@ -182,12 +182,12 @@ pub enum BloomCompositeMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ExtractComponent for BloomSettings {
|
impl ExtractComponent for BloomSettings {
|
||||||
type Data = (&'static Self, &'static Camera);
|
type QueryData = (&'static Self, &'static Camera);
|
||||||
|
|
||||||
type Filter = ();
|
type QueryFilter = ();
|
||||||
type Out = (Self, BloomUniforms);
|
type Out = (Self, BloomUniforms);
|
||||||
|
|
||||||
fn extract_component((settings, camera): QueryItem<'_, Self::Data>) -> Option<Self::Out> {
|
fn extract_component((settings, camera): QueryItem<'_, Self::QueryData>) -> Option<Self::Out> {
|
||||||
match (
|
match (
|
||||||
camera.physical_viewport_rect(),
|
camera.physical_viewport_rect(),
|
||||||
camera.physical_viewport_size(),
|
camera.physical_viewport_size(),
|
||||||
|
|||||||
@ -77,11 +77,11 @@ pub struct CASUniform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ExtractComponent for ContrastAdaptiveSharpeningSettings {
|
impl ExtractComponent for ContrastAdaptiveSharpeningSettings {
|
||||||
type Data = &'static Self;
|
type QueryData = &'static Self;
|
||||||
type Filter = With<Camera>;
|
type QueryFilter = With<Camera>;
|
||||||
type Out = (DenoiseCAS, CASUniform);
|
type Out = (DenoiseCAS, CASUniform);
|
||||||
|
|
||||||
fn extract_component(item: QueryItem<Self::Data>) -> Option<Self::Out> {
|
fn extract_component(item: QueryItem<Self::QueryData>) -> Option<Self::Out> {
|
||||||
if !item.enabled || item.sharpening_strength == 0.0 {
|
if !item.enabled || item.sharpening_strength == 0.0 {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ use super::AlphaMask3d;
|
|||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct MainOpaquePass3dNode;
|
pub struct MainOpaquePass3dNode;
|
||||||
impl ViewNode for MainOpaquePass3dNode {
|
impl ViewNode for MainOpaquePass3dNode {
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ExtractedCamera,
|
&'static ExtractedCamera,
|
||||||
&'static RenderPhase<Opaque3d>,
|
&'static RenderPhase<Opaque3d>,
|
||||||
&'static RenderPhase<AlphaMask3d>,
|
&'static RenderPhase<AlphaMask3d>,
|
||||||
@ -44,7 +44,7 @@ impl ViewNode for MainOpaquePass3dNode {
|
|||||||
skybox_pipeline,
|
skybox_pipeline,
|
||||||
skybox_bind_group,
|
skybox_bind_group,
|
||||||
view_uniform_offset,
|
view_uniform_offset,
|
||||||
): QueryItem<Self::ViewData>,
|
): QueryItem<Self::ViewQuery>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
// Run the opaque pass, sorted front-to-back
|
// Run the opaque pass, sorted front-to-back
|
||||||
|
|||||||
@ -18,7 +18,7 @@ use std::ops::Range;
|
|||||||
pub struct MainTransmissivePass3dNode;
|
pub struct MainTransmissivePass3dNode;
|
||||||
|
|
||||||
impl ViewNode for MainTransmissivePass3dNode {
|
impl ViewNode for MainTransmissivePass3dNode {
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ExtractedCamera,
|
&'static ExtractedCamera,
|
||||||
&'static Camera3d,
|
&'static Camera3d,
|
||||||
&'static RenderPhase<Transmissive3d>,
|
&'static RenderPhase<Transmissive3d>,
|
||||||
@ -32,7 +32,7 @@ impl ViewNode for MainTransmissivePass3dNode {
|
|||||||
graph: &mut RenderGraphContext,
|
graph: &mut RenderGraphContext,
|
||||||
render_context: &mut RenderContext,
|
render_context: &mut RenderContext,
|
||||||
(camera, camera_3d, transmissive_phase, target, transmission, depth): QueryItem<
|
(camera, camera_3d, transmissive_phase, target, transmission, depth): QueryItem<
|
||||||
Self::ViewData,
|
Self::ViewQuery,
|
||||||
>,
|
>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
|
|||||||
@ -16,7 +16,7 @@ use bevy_utils::tracing::info_span;
|
|||||||
pub struct MainTransparentPass3dNode;
|
pub struct MainTransparentPass3dNode;
|
||||||
|
|
||||||
impl ViewNode for MainTransparentPass3dNode {
|
impl ViewNode for MainTransparentPass3dNode {
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ExtractedCamera,
|
&'static ExtractedCamera,
|
||||||
&'static RenderPhase<Transparent3d>,
|
&'static RenderPhase<Transparent3d>,
|
||||||
&'static ViewTarget,
|
&'static ViewTarget,
|
||||||
@ -26,7 +26,7 @@ impl ViewNode for MainTransparentPass3dNode {
|
|||||||
&self,
|
&self,
|
||||||
graph: &mut RenderGraphContext,
|
graph: &mut RenderGraphContext,
|
||||||
render_context: &mut RenderContext,
|
render_context: &mut RenderContext,
|
||||||
(camera, transparent_phase, target, depth): QueryItem<Self::ViewData>,
|
(camera, transparent_phase, target, depth): QueryItem<Self::ViewQuery>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
let view_entity = graph.view_entity();
|
let view_entity = graph.view_entity();
|
||||||
|
|||||||
@ -61,7 +61,7 @@ impl CopyDeferredLightingIdNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ViewNode for CopyDeferredLightingIdNode {
|
impl ViewNode for CopyDeferredLightingIdNode {
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ViewTarget,
|
&'static ViewTarget,
|
||||||
&'static ViewPrepassTextures,
|
&'static ViewPrepassTextures,
|
||||||
&'static DeferredLightingIdDepthTexture,
|
&'static DeferredLightingIdDepthTexture,
|
||||||
@ -72,7 +72,7 @@ impl ViewNode for CopyDeferredLightingIdNode {
|
|||||||
_graph: &mut RenderGraphContext,
|
_graph: &mut RenderGraphContext,
|
||||||
render_context: &mut RenderContext,
|
render_context: &mut RenderContext,
|
||||||
(_view_target, view_prepass_textures, deferred_lighting_id_depth_texture): QueryItem<
|
(_view_target, view_prepass_textures, deferred_lighting_id_depth_texture): QueryItem<
|
||||||
Self::ViewData,
|
Self::ViewQuery,
|
||||||
>,
|
>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
|
|||||||
@ -26,7 +26,7 @@ use super::{AlphaMask3dDeferred, Opaque3dDeferred};
|
|||||||
pub struct DeferredGBufferPrepassNode;
|
pub struct DeferredGBufferPrepassNode;
|
||||||
|
|
||||||
impl ViewNode for DeferredGBufferPrepassNode {
|
impl ViewNode for DeferredGBufferPrepassNode {
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ExtractedCamera,
|
&'static ExtractedCamera,
|
||||||
&'static RenderPhase<Opaque3dDeferred>,
|
&'static RenderPhase<Opaque3dDeferred>,
|
||||||
&'static RenderPhase<AlphaMask3dDeferred>,
|
&'static RenderPhase<AlphaMask3dDeferred>,
|
||||||
@ -44,7 +44,7 @@ impl ViewNode for DeferredGBufferPrepassNode {
|
|||||||
alpha_mask_deferred_phase,
|
alpha_mask_deferred_phase,
|
||||||
view_depth_texture,
|
view_depth_texture,
|
||||||
view_prepass_textures,
|
view_prepass_textures,
|
||||||
): QueryItem<Self::ViewData>,
|
): QueryItem<Self::ViewQuery>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
let view_entity = graph.view_entity();
|
let view_entity = graph.view_entity();
|
||||||
|
|||||||
@ -20,7 +20,7 @@ pub struct FxaaNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ViewNode for FxaaNode {
|
impl ViewNode for FxaaNode {
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ViewTarget,
|
&'static ViewTarget,
|
||||||
&'static CameraFxaaPipeline,
|
&'static CameraFxaaPipeline,
|
||||||
&'static Fxaa,
|
&'static Fxaa,
|
||||||
@ -30,7 +30,7 @@ impl ViewNode for FxaaNode {
|
|||||||
&self,
|
&self,
|
||||||
_graph: &mut RenderGraphContext,
|
_graph: &mut RenderGraphContext,
|
||||||
render_context: &mut RenderContext,
|
render_context: &mut RenderContext,
|
||||||
(target, pipeline, fxaa): QueryItem<Self::ViewData>,
|
(target, pipeline, fxaa): QueryItem<Self::ViewQuery>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
let pipeline_cache = world.resource::<PipelineCache>();
|
let pipeline_cache = world.resource::<PipelineCache>();
|
||||||
|
|||||||
@ -22,7 +22,7 @@ use super::{AlphaMask3dPrepass, DeferredPrepass, Opaque3dPrepass, ViewPrepassTex
|
|||||||
pub struct PrepassNode;
|
pub struct PrepassNode;
|
||||||
|
|
||||||
impl ViewNode for PrepassNode {
|
impl ViewNode for PrepassNode {
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ExtractedCamera,
|
&'static ExtractedCamera,
|
||||||
&'static RenderPhase<Opaque3dPrepass>,
|
&'static RenderPhase<Opaque3dPrepass>,
|
||||||
&'static RenderPhase<AlphaMask3dPrepass>,
|
&'static RenderPhase<AlphaMask3dPrepass>,
|
||||||
@ -42,7 +42,7 @@ impl ViewNode for PrepassNode {
|
|||||||
view_depth_texture,
|
view_depth_texture,
|
||||||
view_prepass_textures,
|
view_prepass_textures,
|
||||||
deferred_prepass,
|
deferred_prepass,
|
||||||
): QueryItem<Self::ViewData>,
|
): QueryItem<Self::ViewQuery>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
let view_entity = graph.view_entity();
|
let view_entity = graph.view_entity();
|
||||||
|
|||||||
@ -80,12 +80,12 @@ pub struct Skybox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ExtractComponent for Skybox {
|
impl ExtractComponent for Skybox {
|
||||||
type Data = (&'static Self, Option<&'static ExposureSettings>);
|
type QueryData = (&'static Self, Option<&'static ExposureSettings>);
|
||||||
type Filter = ();
|
type QueryFilter = ();
|
||||||
type Out = (Self, SkyboxUniforms);
|
type Out = (Self, SkyboxUniforms);
|
||||||
|
|
||||||
fn extract_component(
|
fn extract_component(
|
||||||
(skybox, exposure_settings): QueryItem<'_, Self::Data>,
|
(skybox, exposure_settings): QueryItem<'_, Self::QueryData>,
|
||||||
) -> Option<Self::Out> {
|
) -> Option<Self::Out> {
|
||||||
let exposure = exposure_settings
|
let exposure = exposure_settings
|
||||||
.map(|e| e.exposure())
|
.map(|e| e.exposure())
|
||||||
|
|||||||
@ -168,7 +168,7 @@ impl Default for TemporalAntiAliasSettings {
|
|||||||
pub struct TemporalAntiAliasNode;
|
pub struct TemporalAntiAliasNode;
|
||||||
|
|
||||||
impl ViewNode for TemporalAntiAliasNode {
|
impl ViewNode for TemporalAntiAliasNode {
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ExtractedCamera,
|
&'static ExtractedCamera,
|
||||||
&'static ViewTarget,
|
&'static ViewTarget,
|
||||||
&'static TemporalAntiAliasHistoryTextures,
|
&'static TemporalAntiAliasHistoryTextures,
|
||||||
@ -181,7 +181,7 @@ impl ViewNode for TemporalAntiAliasNode {
|
|||||||
_graph: &mut RenderGraphContext,
|
_graph: &mut RenderGraphContext,
|
||||||
render_context: &mut RenderContext,
|
render_context: &mut RenderContext,
|
||||||
(camera, view_target, taa_history_textures, prepass_textures, taa_pipeline_id): QueryItem<
|
(camera, view_target, taa_history_textures, prepass_textures, taa_pipeline_id): QueryItem<
|
||||||
Self::ViewData,
|
Self::ViewQuery,
|
||||||
>,
|
>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
|
|||||||
@ -24,7 +24,7 @@ pub struct TonemappingNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ViewNode for TonemappingNode {
|
impl ViewNode for TonemappingNode {
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ViewUniformOffset,
|
&'static ViewUniformOffset,
|
||||||
&'static ViewTarget,
|
&'static ViewTarget,
|
||||||
&'static ViewTonemappingPipeline,
|
&'static ViewTonemappingPipeline,
|
||||||
@ -36,7 +36,7 @@ impl ViewNode for TonemappingNode {
|
|||||||
_graph: &mut RenderGraphContext,
|
_graph: &mut RenderGraphContext,
|
||||||
render_context: &mut RenderContext,
|
render_context: &mut RenderContext,
|
||||||
(view_uniform_offset, target, view_tonemapping_pipeline, tonemapping): QueryItem<
|
(view_uniform_offset, target, view_tonemapping_pipeline, tonemapping): QueryItem<
|
||||||
Self::ViewData,
|
Self::ViewQuery,
|
||||||
>,
|
>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
|
|||||||
@ -18,7 +18,7 @@ pub struct UpscalingNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ViewNode for UpscalingNode {
|
impl ViewNode for UpscalingNode {
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ViewTarget,
|
&'static ViewTarget,
|
||||||
&'static ViewUpscalingPipeline,
|
&'static ViewUpscalingPipeline,
|
||||||
Option<&'static ExtractedCamera>,
|
Option<&'static ExtractedCamera>,
|
||||||
@ -28,7 +28,7 @@ impl ViewNode for UpscalingNode {
|
|||||||
&self,
|
&self,
|
||||||
_graph: &mut RenderGraphContext,
|
_graph: &mut RenderGraphContext,
|
||||||
render_context: &mut RenderContext,
|
render_context: &mut RenderContext,
|
||||||
(target, upscaling_target, camera): QueryItem<Self::ViewData>,
|
(target, upscaling_target, camera): QueryItem<Self::ViewQuery>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
let pipeline_cache = world.get_resource::<PipelineCache>().unwrap();
|
let pipeline_cache = world.get_resource::<PipelineCache>().unwrap();
|
||||||
|
|||||||
@ -343,14 +343,14 @@ fn prepare_line_gizmo_bind_group(
|
|||||||
struct SetLineGizmoBindGroup<const I: usize>;
|
struct SetLineGizmoBindGroup<const I: usize>;
|
||||||
impl<const I: usize, P: PhaseItem> RenderCommand<P> for SetLineGizmoBindGroup<I> {
|
impl<const I: usize, P: PhaseItem> RenderCommand<P> for SetLineGizmoBindGroup<I> {
|
||||||
type Param = SRes<LineGizmoUniformBindgroup>;
|
type Param = SRes<LineGizmoUniformBindgroup>;
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = Read<DynamicUniformIndex<LineGizmoUniform>>;
|
type ItemQuery = Read<DynamicUniformIndex<LineGizmoUniform>>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
_item: &P,
|
_item: &P,
|
||||||
_view: ROQueryItem<'w, Self::ViewData>,
|
_view: ROQueryItem<'w, Self::ViewQuery>,
|
||||||
uniform_index: ROQueryItem<'w, Self::ItemData>,
|
uniform_index: ROQueryItem<'w, Self::ItemQuery>,
|
||||||
bind_group: SystemParamItem<'w, '_, Self::Param>,
|
bind_group: SystemParamItem<'w, '_, Self::Param>,
|
||||||
pass: &mut TrackedRenderPass<'w>,
|
pass: &mut TrackedRenderPass<'w>,
|
||||||
) -> RenderCommandResult {
|
) -> RenderCommandResult {
|
||||||
@ -366,14 +366,14 @@ impl<const I: usize, P: PhaseItem> RenderCommand<P> for SetLineGizmoBindGroup<I>
|
|||||||
struct DrawLineGizmo;
|
struct DrawLineGizmo;
|
||||||
impl<P: PhaseItem> RenderCommand<P> for DrawLineGizmo {
|
impl<P: PhaseItem> RenderCommand<P> for DrawLineGizmo {
|
||||||
type Param = SRes<RenderAssets<LineGizmo>>;
|
type Param = SRes<RenderAssets<LineGizmo>>;
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = Read<Handle<LineGizmo>>;
|
type ItemQuery = Read<Handle<LineGizmo>>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
_item: &P,
|
_item: &P,
|
||||||
_view: ROQueryItem<'w, Self::ViewData>,
|
_view: ROQueryItem<'w, Self::ViewQuery>,
|
||||||
handle: ROQueryItem<'w, Self::ItemData>,
|
handle: ROQueryItem<'w, Self::ItemQuery>,
|
||||||
line_gizmos: SystemParamItem<'w, '_, Self::Param>,
|
line_gizmos: SystemParamItem<'w, '_, Self::Param>,
|
||||||
pass: &mut TrackedRenderPass<'w>,
|
pass: &mut TrackedRenderPass<'w>,
|
||||||
) -> RenderCommandResult {
|
) -> RenderCommandResult {
|
||||||
|
|||||||
@ -142,7 +142,7 @@ pub const DEFERRED_LIGHTING_PASS: &str = "deferred_opaque_pbr_lighting_pass_3d";
|
|||||||
pub struct DeferredOpaquePass3dPbrLightingNode;
|
pub struct DeferredOpaquePass3dPbrLightingNode;
|
||||||
|
|
||||||
impl ViewNode for DeferredOpaquePass3dPbrLightingNode {
|
impl ViewNode for DeferredOpaquePass3dPbrLightingNode {
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ViewUniformOffset,
|
&'static ViewUniformOffset,
|
||||||
&'static ViewLightsUniformOffset,
|
&'static ViewLightsUniformOffset,
|
||||||
&'static ViewFogUniformOffset,
|
&'static ViewFogUniformOffset,
|
||||||
@ -166,7 +166,7 @@ impl ViewNode for DeferredOpaquePass3dPbrLightingNode {
|
|||||||
target,
|
target,
|
||||||
deferred_lighting_id_depth_texture,
|
deferred_lighting_id_depth_texture,
|
||||||
deferred_lighting_pipeline,
|
deferred_lighting_pipeline,
|
||||||
): QueryItem<Self::ViewData>,
|
): QueryItem<Self::ViewQuery>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
let pipeline_cache = world.resource::<PipelineCache>();
|
let pipeline_cache = world.resource::<PipelineCache>();
|
||||||
|
|||||||
@ -185,11 +185,11 @@ pub(crate) enum RenderViewBindGroupEntries<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ExtractInstance for EnvironmentMapIds {
|
impl ExtractInstance for EnvironmentMapIds {
|
||||||
type Data = Read<EnvironmentMapLight>;
|
type QueryData = Read<EnvironmentMapLight>;
|
||||||
|
|
||||||
type Filter = ();
|
type QueryFilter = ();
|
||||||
|
|
||||||
fn extract(item: QueryItem<'_, Self::Data>) -> Option<Self> {
|
fn extract(item: QueryItem<'_, Self::QueryData>) -> Option<Self> {
|
||||||
Some(EnvironmentMapIds {
|
Some(EnvironmentMapIds {
|
||||||
diffuse: item.diffuse_map.id(),
|
diffuse: item.diffuse_map.id(),
|
||||||
specular: item.specular_map.id(),
|
specular: item.specular_map.id(),
|
||||||
|
|||||||
@ -379,8 +379,8 @@ type DrawMaterial<M> = (
|
|||||||
pub struct SetMaterialBindGroup<M: Material, const I: usize>(PhantomData<M>);
|
pub struct SetMaterialBindGroup<M: Material, const I: usize>(PhantomData<M>);
|
||||||
impl<P: PhaseItem, M: Material, const I: usize> RenderCommand<P> for SetMaterialBindGroup<M, I> {
|
impl<P: PhaseItem, M: Material, const I: usize> RenderCommand<P> for SetMaterialBindGroup<M, I> {
|
||||||
type Param = (SRes<RenderMaterials<M>>, SRes<RenderMaterialInstances<M>>);
|
type Param = (SRes<RenderMaterials<M>>, SRes<RenderMaterialInstances<M>>);
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = ();
|
type ItemQuery = ();
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
|
|||||||
@ -895,11 +895,11 @@ pub fn queue_prepass_material_meshes<M: Material>(
|
|||||||
pub struct SetPrepassViewBindGroup<const I: usize>;
|
pub struct SetPrepassViewBindGroup<const I: usize>;
|
||||||
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetPrepassViewBindGroup<I> {
|
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetPrepassViewBindGroup<I> {
|
||||||
type Param = SRes<PrepassViewBindGroup>;
|
type Param = SRes<PrepassViewBindGroup>;
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
Read<ViewUniformOffset>,
|
Read<ViewUniformOffset>,
|
||||||
Option<Read<PreviousViewProjectionUniformOffset>>,
|
Option<Read<PreviousViewProjectionUniformOffset>>,
|
||||||
);
|
);
|
||||||
type ItemData = ();
|
type ItemQuery = ();
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
|
|||||||
@ -1043,21 +1043,21 @@ pub fn prepare_mesh_bind_group(
|
|||||||
pub struct SetMeshViewBindGroup<const I: usize>;
|
pub struct SetMeshViewBindGroup<const I: usize>;
|
||||||
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMeshViewBindGroup<I> {
|
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMeshViewBindGroup<I> {
|
||||||
type Param = ();
|
type Param = ();
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
Read<ViewUniformOffset>,
|
Read<ViewUniformOffset>,
|
||||||
Read<ViewLightsUniformOffset>,
|
Read<ViewLightsUniformOffset>,
|
||||||
Read<ViewFogUniformOffset>,
|
Read<ViewFogUniformOffset>,
|
||||||
Read<ViewLightProbesUniformOffset>,
|
Read<ViewLightProbesUniformOffset>,
|
||||||
Read<MeshViewBindGroup>,
|
Read<MeshViewBindGroup>,
|
||||||
);
|
);
|
||||||
type ItemData = ();
|
type ItemQuery = ();
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
_item: &P,
|
_item: &P,
|
||||||
(view_uniform, view_lights, view_fog, view_light_probes, mesh_view_bind_group): ROQueryItem<
|
(view_uniform, view_lights, view_fog, view_light_probes, mesh_view_bind_group): ROQueryItem<
|
||||||
'w,
|
'w,
|
||||||
Self::ViewData,
|
Self::ViewQuery,
|
||||||
>,
|
>,
|
||||||
_entity: (),
|
_entity: (),
|
||||||
_: SystemParamItem<'w, '_, Self::Param>,
|
_: SystemParamItem<'w, '_, Self::Param>,
|
||||||
@ -1087,8 +1087,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMeshBindGroup<I> {
|
|||||||
SRes<MorphIndices>,
|
SRes<MorphIndices>,
|
||||||
SRes<RenderLightmaps>,
|
SRes<RenderLightmaps>,
|
||||||
);
|
);
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = ();
|
type ItemQuery = ();
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
@ -1157,8 +1157,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMeshBindGroup<I> {
|
|||||||
pub struct DrawMesh;
|
pub struct DrawMesh;
|
||||||
impl<P: PhaseItem> RenderCommand<P> for DrawMesh {
|
impl<P: PhaseItem> RenderCommand<P> for DrawMesh {
|
||||||
type Param = (SRes<RenderAssets<Mesh>>, SRes<RenderMeshInstances>);
|
type Param = (SRes<RenderAssets<Mesh>>, SRes<RenderMeshInstances>);
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = ();
|
type ItemQuery = ();
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
item: &P,
|
item: &P,
|
||||||
|
|||||||
@ -199,7 +199,7 @@ impl ScreenSpaceAmbientOcclusionQualityLevel {
|
|||||||
struct SsaoNode {}
|
struct SsaoNode {}
|
||||||
|
|
||||||
impl ViewNode for SsaoNode {
|
impl ViewNode for SsaoNode {
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ExtractedCamera,
|
&'static ExtractedCamera,
|
||||||
&'static SsaoPipelineId,
|
&'static SsaoPipelineId,
|
||||||
&'static SsaoBindGroups,
|
&'static SsaoBindGroups,
|
||||||
@ -210,7 +210,7 @@ impl ViewNode for SsaoNode {
|
|||||||
&self,
|
&self,
|
||||||
_graph: &mut RenderGraphContext,
|
_graph: &mut RenderGraphContext,
|
||||||
render_context: &mut RenderContext,
|
render_context: &mut RenderContext,
|
||||||
(camera, pipeline_id, bind_groups, view_uniform_offset): QueryItem<Self::ViewData>,
|
(camera, pipeline_id, bind_groups, view_uniform_offset): QueryItem<Self::ViewQuery>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
let pipelines = world.resource::<SsaoPipelines>();
|
let pipelines = world.resource::<SsaoPipelines>();
|
||||||
|
|||||||
@ -38,12 +38,12 @@ pub fn derive_extract_component(input: TokenStream) -> TokenStream {
|
|||||||
|
|
||||||
TokenStream::from(quote! {
|
TokenStream::from(quote! {
|
||||||
impl #impl_generics #bevy_render_path::extract_component::ExtractComponent for #struct_name #type_generics #where_clause {
|
impl #impl_generics #bevy_render_path::extract_component::ExtractComponent for #struct_name #type_generics #where_clause {
|
||||||
type Data = &'static Self;
|
type QueryData = &'static Self;
|
||||||
|
|
||||||
type Filter = #filter;
|
type QueryFilter = #filter;
|
||||||
type Out = Self;
|
type Out = Self;
|
||||||
|
|
||||||
fn extract_component(item: #bevy_ecs_path::query::QueryItem<'_, Self::Data>) -> Option<Self::Out> {
|
fn extract_component(item: #bevy_ecs_path::query::QueryItem<'_, Self::QueryData>) -> Option<Self::Out> {
|
||||||
Some(item.clone())
|
Some(item.clone())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,9 +36,9 @@ impl<C: Component> DynamicUniformIndex<C> {
|
|||||||
/// in the [`ExtractSchedule`] step.
|
/// in the [`ExtractSchedule`] step.
|
||||||
pub trait ExtractComponent: Component {
|
pub trait ExtractComponent: Component {
|
||||||
/// ECS [`ReadOnlyQueryData`] to fetch the components to extract.
|
/// ECS [`ReadOnlyQueryData`] to fetch the components to extract.
|
||||||
type Data: ReadOnlyQueryData;
|
type QueryData: ReadOnlyQueryData;
|
||||||
/// Filters the entities with additional constraints.
|
/// Filters the entities with additional constraints.
|
||||||
type Filter: QueryFilter;
|
type QueryFilter: QueryFilter;
|
||||||
|
|
||||||
/// The output from extraction.
|
/// The output from extraction.
|
||||||
///
|
///
|
||||||
@ -58,7 +58,7 @@ pub trait ExtractComponent: Component {
|
|||||||
// type Out: Component = Self;
|
// type Out: Component = Self;
|
||||||
|
|
||||||
/// Defines how the component is transferred into the "render world".
|
/// Defines how the component is transferred into the "render world".
|
||||||
fn extract_component(item: QueryItem<'_, Self::Data>) -> Option<Self::Out>;
|
fn extract_component(item: QueryItem<'_, Self::QueryData>) -> Option<Self::Out>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This plugin prepares the components of the corresponding type for the GPU
|
/// This plugin prepares the components of the corresponding type for the GPU
|
||||||
@ -195,12 +195,12 @@ impl<C: ExtractComponent> Plugin for ExtractComponentPlugin<C> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Asset> ExtractComponent for Handle<T> {
|
impl<T: Asset> ExtractComponent for Handle<T> {
|
||||||
type Data = Read<Handle<T>>;
|
type QueryData = Read<Handle<T>>;
|
||||||
type Filter = ();
|
type QueryFilter = ();
|
||||||
type Out = Handle<T>;
|
type Out = Handle<T>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn extract_component(handle: QueryItem<'_, Self::Data>) -> Option<Self::Out> {
|
fn extract_component(handle: QueryItem<'_, Self::QueryData>) -> Option<Self::Out> {
|
||||||
Some(handle.clone_weak())
|
Some(handle.clone_weak())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ impl<T: Asset> ExtractComponent for Handle<T> {
|
|||||||
fn extract_components<C: ExtractComponent>(
|
fn extract_components<C: ExtractComponent>(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
mut previous_len: Local<usize>,
|
mut previous_len: Local<usize>,
|
||||||
query: Extract<Query<(Entity, C::Data), C::Filter>>,
|
query: Extract<Query<(Entity, C::QueryData), C::QueryFilter>>,
|
||||||
) {
|
) {
|
||||||
let mut values = Vec::with_capacity(*previous_len);
|
let mut values = Vec::with_capacity(*previous_len);
|
||||||
for (entity, query_item) in &query {
|
for (entity, query_item) in &query {
|
||||||
@ -225,7 +225,7 @@ fn extract_components<C: ExtractComponent>(
|
|||||||
fn extract_visible_components<C: ExtractComponent>(
|
fn extract_visible_components<C: ExtractComponent>(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
mut previous_len: Local<usize>,
|
mut previous_len: Local<usize>,
|
||||||
query: Extract<Query<(Entity, &ViewVisibility, C::Data), C::Filter>>,
|
query: Extract<Query<(Entity, &ViewVisibility, C::QueryData), C::QueryFilter>>,
|
||||||
) {
|
) {
|
||||||
let mut values = Vec::with_capacity(*previous_len);
|
let mut values = Vec::with_capacity(*previous_len);
|
||||||
for (entity, view_visibility, query_item) in &query {
|
for (entity, view_visibility, query_item) in &query {
|
||||||
|
|||||||
@ -29,12 +29,12 @@ use crate::{prelude::ViewVisibility, Extract, ExtractSchedule, RenderApp};
|
|||||||
/// higher-performance because it avoids the ECS overhead.
|
/// higher-performance because it avoids the ECS overhead.
|
||||||
pub trait ExtractInstance: Send + Sync + Sized + 'static {
|
pub trait ExtractInstance: Send + Sync + Sized + 'static {
|
||||||
/// ECS [`ReadOnlyQueryData`] to fetch the components to extract.
|
/// ECS [`ReadOnlyQueryData`] to fetch the components to extract.
|
||||||
type Data: ReadOnlyQueryData;
|
type QueryData: ReadOnlyQueryData;
|
||||||
/// Filters the entities with additional constraints.
|
/// Filters the entities with additional constraints.
|
||||||
type Filter: QueryFilter;
|
type QueryFilter: QueryFilter;
|
||||||
|
|
||||||
/// Defines how the component is transferred into the "render world".
|
/// Defines how the component is transferred into the "render world".
|
||||||
fn extract(item: QueryItem<'_, Self::Data>) -> Option<Self>;
|
fn extract(item: QueryItem<'_, Self::QueryData>) -> Option<Self>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This plugin extracts one or more components into the "render world" as
|
/// This plugin extracts one or more components into the "render world" as
|
||||||
@ -107,7 +107,7 @@ where
|
|||||||
|
|
||||||
fn extract_all<EI>(
|
fn extract_all<EI>(
|
||||||
mut extracted_instances: ResMut<ExtractedInstances<EI>>,
|
mut extracted_instances: ResMut<ExtractedInstances<EI>>,
|
||||||
query: Extract<Query<(Entity, EI::Data), EI::Filter>>,
|
query: Extract<Query<(Entity, EI::QueryData), EI::QueryFilter>>,
|
||||||
) where
|
) where
|
||||||
EI: ExtractInstance,
|
EI: ExtractInstance,
|
||||||
{
|
{
|
||||||
@ -121,7 +121,7 @@ fn extract_all<EI>(
|
|||||||
|
|
||||||
fn extract_visible<EI>(
|
fn extract_visible<EI>(
|
||||||
mut extracted_instances: ResMut<ExtractedInstances<EI>>,
|
mut extracted_instances: ResMut<ExtractedInstances<EI>>,
|
||||||
query: Extract<Query<(Entity, &ViewVisibility, EI::Data), EI::Filter>>,
|
query: Extract<Query<(Entity, &ViewVisibility, EI::QueryData), EI::QueryFilter>>,
|
||||||
) where
|
) where
|
||||||
EI: ExtractInstance,
|
EI: ExtractInstance,
|
||||||
{
|
{
|
||||||
@ -139,10 +139,10 @@ impl<A> ExtractInstance for AssetId<A>
|
|||||||
where
|
where
|
||||||
A: Asset,
|
A: Asset,
|
||||||
{
|
{
|
||||||
type Data = Read<Handle<A>>;
|
type QueryData = Read<Handle<A>>;
|
||||||
type Filter = ();
|
type QueryFilter = ();
|
||||||
|
|
||||||
fn extract(item: QueryItem<'_, Self::Data>) -> Option<Self> {
|
fn extract(item: QueryItem<'_, Self::QueryData>) -> Option<Self> {
|
||||||
Some(item.id())
|
Some(item.id())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -342,7 +342,7 @@ impl Node for RunGraphOnViewNode {
|
|||||||
pub trait ViewNode {
|
pub trait ViewNode {
|
||||||
/// The query that will be used on the view entity.
|
/// The query that will be used on the view entity.
|
||||||
/// It is guaranteed to run on the view entity, so there's no need for a filter
|
/// It is guaranteed to run on the view entity, so there's no need for a filter
|
||||||
type ViewData: ReadOnlyQueryData;
|
type ViewQuery: ReadOnlyQueryData;
|
||||||
|
|
||||||
/// Updates internal node state using the current render [`World`] prior to the run method.
|
/// Updates internal node state using the current render [`World`] prior to the run method.
|
||||||
fn update(&mut self, _world: &mut World) {}
|
fn update(&mut self, _world: &mut World) {}
|
||||||
@ -354,7 +354,7 @@ pub trait ViewNode {
|
|||||||
&self,
|
&self,
|
||||||
graph: &mut RenderGraphContext,
|
graph: &mut RenderGraphContext,
|
||||||
render_context: &mut RenderContext,
|
render_context: &mut RenderContext,
|
||||||
view_query: QueryItem<Self::ViewData>,
|
view_query: QueryItem<Self::ViewQuery>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError>;
|
) -> Result<(), NodeRunError>;
|
||||||
}
|
}
|
||||||
@ -364,7 +364,7 @@ pub trait ViewNode {
|
|||||||
///
|
///
|
||||||
/// This [`Node`] exists to help reduce boilerplate when making a render node that runs on a view.
|
/// This [`Node`] exists to help reduce boilerplate when making a render node that runs on a view.
|
||||||
pub struct ViewNodeRunner<N: ViewNode> {
|
pub struct ViewNodeRunner<N: ViewNode> {
|
||||||
view_query: QueryState<N::ViewData>,
|
view_query: QueryState<N::ViewQuery>,
|
||||||
node: N,
|
node: N,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -142,8 +142,8 @@ impl<P: PhaseItem> DrawFunctions<P> {
|
|||||||
/// Compared to the draw function the required ECS data is fetched automatically
|
/// Compared to the draw function the required ECS data is fetched automatically
|
||||||
/// (by the [`RenderCommandState`]) from the render world.
|
/// (by the [`RenderCommandState`]) from the render world.
|
||||||
/// Therefore the three types [`Param`](RenderCommand::Param),
|
/// Therefore the three types [`Param`](RenderCommand::Param),
|
||||||
/// [`ViewData`](RenderCommand::ViewData) and
|
/// [`ViewQuery`](RenderCommand::ViewQuery) and
|
||||||
/// [`ItemData`](RenderCommand::ItemData) are used.
|
/// [`ItemQuery`](RenderCommand::ItemQuery) are used.
|
||||||
/// They specify which information is required to execute the render command.
|
/// They specify which information is required to execute the render command.
|
||||||
///
|
///
|
||||||
/// Multiple render commands can be combined together by wrapping them in a tuple.
|
/// Multiple render commands can be combined together by wrapping them in a tuple.
|
||||||
@ -185,19 +185,19 @@ pub trait RenderCommand<P: PhaseItem> {
|
|||||||
/// The view entity refers to the camera, or shadow-casting light, etc. from which the phase
|
/// The view entity refers to the camera, or shadow-casting light, etc. from which the phase
|
||||||
/// item will be rendered from.
|
/// item will be rendered from.
|
||||||
/// All components have to be accessed read only.
|
/// All components have to be accessed read only.
|
||||||
type ViewData: ReadOnlyQueryData;
|
type ViewQuery: ReadOnlyQueryData;
|
||||||
/// Specifies the ECS data of the item entity required by [`RenderCommand::render`].
|
/// Specifies the ECS data of the item entity required by [`RenderCommand::render`].
|
||||||
///
|
///
|
||||||
/// The item is the entity that will be rendered for the corresponding view.
|
/// The item is the entity that will be rendered for the corresponding view.
|
||||||
/// All components have to be accessed read only.
|
/// All components have to be accessed read only.
|
||||||
type ItemData: ReadOnlyQueryData;
|
type ItemQuery: ReadOnlyQueryData;
|
||||||
|
|
||||||
/// Renders a [`PhaseItem`] by recording commands (e.g. setting pipelines, binding bind groups,
|
/// Renders a [`PhaseItem`] by recording commands (e.g. setting pipelines, binding bind groups,
|
||||||
/// issuing draw calls, etc.) via the [`TrackedRenderPass`].
|
/// issuing draw calls, etc.) via the [`TrackedRenderPass`].
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
item: &P,
|
item: &P,
|
||||||
view: ROQueryItem<'w, Self::ViewData>,
|
view: ROQueryItem<'w, Self::ViewQuery>,
|
||||||
entity: ROQueryItem<'w, Self::ItemData>,
|
entity: ROQueryItem<'w, Self::ItemQuery>,
|
||||||
param: SystemParamItem<'w, '_, Self::Param>,
|
param: SystemParamItem<'w, '_, Self::Param>,
|
||||||
pass: &mut TrackedRenderPass<'w>,
|
pass: &mut TrackedRenderPass<'w>,
|
||||||
) -> RenderCommandResult;
|
) -> RenderCommandResult;
|
||||||
@ -213,14 +213,14 @@ macro_rules! render_command_tuple_impl {
|
|||||||
($(($name: ident, $view: ident, $entity: ident)),*) => {
|
($(($name: ident, $view: ident, $entity: ident)),*) => {
|
||||||
impl<P: PhaseItem, $($name: RenderCommand<P>),*> RenderCommand<P> for ($($name,)*) {
|
impl<P: PhaseItem, $($name: RenderCommand<P>),*> RenderCommand<P> for ($($name,)*) {
|
||||||
type Param = ($($name::Param,)*);
|
type Param = ($($name::Param,)*);
|
||||||
type ViewData = ($($name::ViewData,)*);
|
type ViewQuery = ($($name::ViewQuery,)*);
|
||||||
type ItemData = ($($name::ItemData,)*);
|
type ItemQuery = ($($name::ItemQuery,)*);
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
_item: &P,
|
_item: &P,
|
||||||
($($view,)*): ROQueryItem<'w, Self::ViewData>,
|
($($view,)*): ROQueryItem<'w, Self::ViewQuery>,
|
||||||
($($entity,)*): ROQueryItem<'w, Self::ItemData>,
|
($($entity,)*): ROQueryItem<'w, Self::ItemQuery>,
|
||||||
($($name,)*): SystemParamItem<'w, '_, Self::Param>,
|
($($name,)*): SystemParamItem<'w, '_, Self::Param>,
|
||||||
_pass: &mut TrackedRenderPass<'w>,
|
_pass: &mut TrackedRenderPass<'w>,
|
||||||
) -> RenderCommandResult {
|
) -> RenderCommandResult {
|
||||||
@ -237,12 +237,12 @@ all_tuples!(render_command_tuple_impl, 0, 15, C, V, E);
|
|||||||
|
|
||||||
/// Wraps a [`RenderCommand`] into a state so that it can be used as a [`Draw`] function.
|
/// Wraps a [`RenderCommand`] into a state so that it can be used as a [`Draw`] function.
|
||||||
///
|
///
|
||||||
/// The [`RenderCommand::Param`], [`RenderCommand::ViewData`] and
|
/// The [`RenderCommand::Param`], [`RenderCommand::ViewQuery`] and
|
||||||
/// [`RenderCommand::ItemData`] are fetched from the ECS and passed to the command.
|
/// [`RenderCommand::ItemQuery`] are fetched from the ECS and passed to the command.
|
||||||
pub struct RenderCommandState<P: PhaseItem + 'static, C: RenderCommand<P>> {
|
pub struct RenderCommandState<P: PhaseItem + 'static, C: RenderCommand<P>> {
|
||||||
state: SystemState<C::Param>,
|
state: SystemState<C::Param>,
|
||||||
view: QueryState<C::ViewData>,
|
view: QueryState<C::ViewQuery>,
|
||||||
entity: QueryState<C::ItemData>,
|
entity: QueryState<C::ItemQuery>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<P: PhaseItem, C: RenderCommand<P>> RenderCommandState<P, C> {
|
impl<P: PhaseItem, C: RenderCommand<P>> RenderCommandState<P, C> {
|
||||||
|
|||||||
@ -196,8 +196,8 @@ pub struct SetItemPipeline;
|
|||||||
|
|
||||||
impl<P: CachedRenderPipelinePhaseItem> RenderCommand<P> for SetItemPipeline {
|
impl<P: CachedRenderPipelinePhaseItem> RenderCommand<P> for SetItemPipeline {
|
||||||
type Param = SRes<PipelineCache>;
|
type Param = SRes<PipelineCache>;
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = ();
|
type ItemQuery = ();
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
item: &P,
|
item: &P,
|
||||||
|
|||||||
@ -330,8 +330,8 @@ impl<P: PhaseItem, M: Material2d, const I: usize> RenderCommand<P>
|
|||||||
SRes<RenderMaterials2d<M>>,
|
SRes<RenderMaterials2d<M>>,
|
||||||
SRes<RenderMaterial2dInstances<M>>,
|
SRes<RenderMaterial2dInstances<M>>,
|
||||||
);
|
);
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = ();
|
type ItemQuery = ();
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
|
|||||||
@ -613,13 +613,13 @@ pub fn prepare_mesh2d_view_bind_groups(
|
|||||||
pub struct SetMesh2dViewBindGroup<const I: usize>;
|
pub struct SetMesh2dViewBindGroup<const I: usize>;
|
||||||
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMesh2dViewBindGroup<I> {
|
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMesh2dViewBindGroup<I> {
|
||||||
type Param = ();
|
type Param = ();
|
||||||
type ViewData = (Read<ViewUniformOffset>, Read<Mesh2dViewBindGroup>);
|
type ViewQuery = (Read<ViewUniformOffset>, Read<Mesh2dViewBindGroup>);
|
||||||
type ItemData = ();
|
type ItemQuery = ();
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
_item: &P,
|
_item: &P,
|
||||||
(view_uniform, mesh2d_view_bind_group): ROQueryItem<'w, Self::ViewData>,
|
(view_uniform, mesh2d_view_bind_group): ROQueryItem<'w, Self::ViewQuery>,
|
||||||
_view: (),
|
_view: (),
|
||||||
_param: SystemParamItem<'w, '_, Self::Param>,
|
_param: SystemParamItem<'w, '_, Self::Param>,
|
||||||
pass: &mut TrackedRenderPass<'w>,
|
pass: &mut TrackedRenderPass<'w>,
|
||||||
@ -633,8 +633,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMesh2dViewBindGroup<I
|
|||||||
pub struct SetMesh2dBindGroup<const I: usize>;
|
pub struct SetMesh2dBindGroup<const I: usize>;
|
||||||
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMesh2dBindGroup<I> {
|
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMesh2dBindGroup<I> {
|
||||||
type Param = SRes<Mesh2dBindGroup>;
|
type Param = SRes<Mesh2dBindGroup>;
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = ();
|
type ItemQuery = ();
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
@ -662,8 +662,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetMesh2dBindGroup<I> {
|
|||||||
pub struct DrawMesh2d;
|
pub struct DrawMesh2d;
|
||||||
impl<P: PhaseItem> RenderCommand<P> for DrawMesh2d {
|
impl<P: PhaseItem> RenderCommand<P> for DrawMesh2d {
|
||||||
type Param = (SRes<RenderAssets<Mesh>>, SRes<RenderMesh2dInstances>);
|
type Param = (SRes<RenderAssets<Mesh>>, SRes<RenderMesh2dInstances>);
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = ();
|
type ItemQuery = ();
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
|
|||||||
@ -734,8 +734,8 @@ pub type DrawSprite = (
|
|||||||
pub struct SetSpriteViewBindGroup<const I: usize>;
|
pub struct SetSpriteViewBindGroup<const I: usize>;
|
||||||
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetSpriteViewBindGroup<I> {
|
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetSpriteViewBindGroup<I> {
|
||||||
type Param = SRes<SpriteMeta>;
|
type Param = SRes<SpriteMeta>;
|
||||||
type ViewData = Read<ViewUniformOffset>;
|
type ViewQuery = Read<ViewUniformOffset>;
|
||||||
type ItemData = ();
|
type ItemQuery = ();
|
||||||
|
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
_item: &P,
|
_item: &P,
|
||||||
@ -755,8 +755,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetSpriteViewBindGroup<I
|
|||||||
pub struct SetSpriteTextureBindGroup<const I: usize>;
|
pub struct SetSpriteTextureBindGroup<const I: usize>;
|
||||||
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetSpriteTextureBindGroup<I> {
|
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetSpriteTextureBindGroup<I> {
|
||||||
type Param = SRes<ImageBindGroups>;
|
type Param = SRes<ImageBindGroups>;
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = Read<SpriteBatch>;
|
type ItemQuery = Read<SpriteBatch>;
|
||||||
|
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
_item: &P,
|
_item: &P,
|
||||||
@ -782,8 +782,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetSpriteTextureBindGrou
|
|||||||
pub struct DrawSpriteBatch;
|
pub struct DrawSpriteBatch;
|
||||||
impl<P: PhaseItem> RenderCommand<P> for DrawSpriteBatch {
|
impl<P: PhaseItem> RenderCommand<P> for DrawSpriteBatch {
|
||||||
type Param = SRes<SpriteMeta>;
|
type Param = SRes<SpriteMeta>;
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = Read<SpriteBatch>;
|
type ItemQuery = Read<SpriteBatch>;
|
||||||
|
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
_item: &P,
|
_item: &P,
|
||||||
|
|||||||
@ -155,8 +155,8 @@ pub type DrawUi = (
|
|||||||
pub struct SetUiViewBindGroup<const I: usize>;
|
pub struct SetUiViewBindGroup<const I: usize>;
|
||||||
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetUiViewBindGroup<I> {
|
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetUiViewBindGroup<I> {
|
||||||
type Param = SRes<UiMeta>;
|
type Param = SRes<UiMeta>;
|
||||||
type ViewData = Read<ViewUniformOffset>;
|
type ViewQuery = Read<ViewUniformOffset>;
|
||||||
type ItemData = ();
|
type ItemQuery = ();
|
||||||
|
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
_item: &P,
|
_item: &P,
|
||||||
@ -176,8 +176,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetUiViewBindGroup<I> {
|
|||||||
pub struct SetUiTextureBindGroup<const I: usize>;
|
pub struct SetUiTextureBindGroup<const I: usize>;
|
||||||
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetUiTextureBindGroup<I> {
|
impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetUiTextureBindGroup<I> {
|
||||||
type Param = SRes<UiImageBindGroups>;
|
type Param = SRes<UiImageBindGroups>;
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = Read<UiBatch>;
|
type ItemQuery = Read<UiBatch>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
@ -195,8 +195,8 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetUiTextureBindGroup<I>
|
|||||||
pub struct DrawUiNode;
|
pub struct DrawUiNode;
|
||||||
impl<P: PhaseItem> RenderCommand<P> for DrawUiNode {
|
impl<P: PhaseItem> RenderCommand<P> for DrawUiNode {
|
||||||
type Param = SRes<UiMeta>;
|
type Param = SRes<UiMeta>;
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = Read<UiBatch>;
|
type ItemQuery = Read<UiBatch>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
|
|||||||
@ -263,8 +263,8 @@ pub type DrawUiMaterial<M> = (
|
|||||||
pub struct SetMatUiViewBindGroup<M: UiMaterial, const I: usize>(PhantomData<M>);
|
pub struct SetMatUiViewBindGroup<M: UiMaterial, const I: usize>(PhantomData<M>);
|
||||||
impl<P: PhaseItem, M: UiMaterial, const I: usize> RenderCommand<P> for SetMatUiViewBindGroup<M, I> {
|
impl<P: PhaseItem, M: UiMaterial, const I: usize> RenderCommand<P> for SetMatUiViewBindGroup<M, I> {
|
||||||
type Param = SRes<UiMaterialMeta<M>>;
|
type Param = SRes<UiMaterialMeta<M>>;
|
||||||
type ViewData = Read<ViewUniformOffset>;
|
type ViewQuery = Read<ViewUniformOffset>;
|
||||||
type ItemData = ();
|
type ItemQuery = ();
|
||||||
|
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
_item: &P,
|
_item: &P,
|
||||||
@ -287,13 +287,13 @@ impl<P: PhaseItem, M: UiMaterial, const I: usize> RenderCommand<P>
|
|||||||
for SetUiMaterialBindGroup<M, I>
|
for SetUiMaterialBindGroup<M, I>
|
||||||
{
|
{
|
||||||
type Param = SRes<RenderUiMaterials<M>>;
|
type Param = SRes<RenderUiMaterials<M>>;
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = Read<UiMaterialBatch<M>>;
|
type ItemQuery = Read<UiMaterialBatch<M>>;
|
||||||
|
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
_item: &P,
|
_item: &P,
|
||||||
_view: (),
|
_view: (),
|
||||||
material_handle: ROQueryItem<'_, Self::ItemData>,
|
material_handle: ROQueryItem<'_, Self::ItemQuery>,
|
||||||
materials: SystemParamItem<'w, '_, Self::Param>,
|
materials: SystemParamItem<'w, '_, Self::Param>,
|
||||||
pass: &mut TrackedRenderPass<'w>,
|
pass: &mut TrackedRenderPass<'w>,
|
||||||
) -> RenderCommandResult {
|
) -> RenderCommandResult {
|
||||||
@ -308,8 +308,8 @@ impl<P: PhaseItem, M: UiMaterial, const I: usize> RenderCommand<P>
|
|||||||
pub struct DrawUiMaterialNode<M>(PhantomData<M>);
|
pub struct DrawUiMaterialNode<M>(PhantomData<M>);
|
||||||
impl<P: PhaseItem, M: UiMaterial> RenderCommand<P> for DrawUiMaterialNode<M> {
|
impl<P: PhaseItem, M: UiMaterial> RenderCommand<P> for DrawUiMaterialNode<M> {
|
||||||
type Param = SRes<UiMaterialMeta<M>>;
|
type Param = SRes<UiMaterialMeta<M>>;
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = Read<UiMaterialBatch<M>>;
|
type ItemQuery = Read<UiMaterialBatch<M>>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
|
|||||||
@ -116,7 +116,7 @@ impl ViewNode for PostProcessNode {
|
|||||||
// but it's not a normal system so we need to define it manually.
|
// but it's not a normal system so we need to define it manually.
|
||||||
//
|
//
|
||||||
// This query will only run on the view entity
|
// This query will only run on the view entity
|
||||||
type ViewData = (
|
type ViewQuery = (
|
||||||
&'static ViewTarget,
|
&'static ViewTarget,
|
||||||
// This makes sure the node only runs on cameras with the PostProcessSettings component
|
// This makes sure the node only runs on cameras with the PostProcessSettings component
|
||||||
&'static PostProcessSettings,
|
&'static PostProcessSettings,
|
||||||
@ -133,7 +133,7 @@ impl ViewNode for PostProcessNode {
|
|||||||
&self,
|
&self,
|
||||||
_graph: &mut RenderGraphContext,
|
_graph: &mut RenderGraphContext,
|
||||||
render_context: &mut RenderContext,
|
render_context: &mut RenderContext,
|
||||||
(view_target, _post_process_settings): QueryItem<Self::ViewData>,
|
(view_target, _post_process_settings): QueryItem<Self::ViewQuery>,
|
||||||
world: &World,
|
world: &World,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
// Get the pipeline resource that contains the global data we need
|
// Get the pipeline resource that contains the global data we need
|
||||||
|
|||||||
@ -68,11 +68,11 @@ fn setup(mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>) {
|
|||||||
struct InstanceMaterialData(Vec<InstanceData>);
|
struct InstanceMaterialData(Vec<InstanceData>);
|
||||||
|
|
||||||
impl ExtractComponent for InstanceMaterialData {
|
impl ExtractComponent for InstanceMaterialData {
|
||||||
type Data = &'static InstanceMaterialData;
|
type QueryData = &'static InstanceMaterialData;
|
||||||
type Filter = ();
|
type QueryFilter = ();
|
||||||
type Out = Self;
|
type Out = Self;
|
||||||
|
|
||||||
fn extract_component(item: QueryItem<'_, Self::Data>) -> Option<Self> {
|
fn extract_component(item: QueryItem<'_, Self::QueryData>) -> Option<Self> {
|
||||||
Some(InstanceMaterialData(item.0.clone()))
|
Some(InstanceMaterialData(item.0.clone()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,8 +237,8 @@ pub struct DrawMeshInstanced;
|
|||||||
|
|
||||||
impl<P: PhaseItem> RenderCommand<P> for DrawMeshInstanced {
|
impl<P: PhaseItem> RenderCommand<P> for DrawMeshInstanced {
|
||||||
type Param = (SRes<RenderAssets<Mesh>>, SRes<RenderMeshInstances>);
|
type Param = (SRes<RenderAssets<Mesh>>, SRes<RenderMeshInstances>);
|
||||||
type ViewData = ();
|
type ViewQuery = ();
|
||||||
type ItemData = Read<InstanceBuffer>;
|
type ItemQuery = Read<InstanceBuffer>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn render<'w>(
|
fn render<'w>(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user