You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Compared to the draw function the required ECS data is fetched automatically (by the [`RenderCommandState`]) from the render world.
141
-
/// Therefore the three types [`Param`](RenderCommand::Param), [`ViewWorldQuery`](RenderCommand::ViewWorldQuery) and [`WorldQuery`](RenderCommand::WorldQuery) are used.
144
+
/// Compared to the draw function the required ECS data is fetched automatically
145
+
/// (by the [`RenderCommandState`]) from the render world.
146
+
/// Therefore the three types [`Param`](RenderCommand::Param),
147
+
/// [`ViewWorldQuery`](RenderCommand::ViewWorldQuery) and
148
+
/// [`ItemWorldQuery`](RenderCommand::ItemWorldQuery) are used.
142
149
/// They specify which information is required to execute the render command.
143
150
///
144
151
/// Multiple render commands can be combined together by wrapping them in a tuple.
/// Specifies all ECS data required by [`RenderCommand::render`].
167
+
/// Specifies the general ECS data (e.g. resources) required by [`RenderCommand::render`].
161
168
/// All parameters have to be read only.
162
169
typeParam:SystemParam + 'static;
163
-
// Todo: add comment
170
+
/// Specifies the ECS data of the view required by [`RenderCommand::render`].
171
+
/// All components have to be accessed read only.
164
172
typeViewWorldQuery:ReadOnlyWorldQuery;
165
-
// Todo: add comment
173
+
/// Specifies the ECS data of the item required by [`RenderCommand::render`].
174
+
/// All components have to be accessed read only.
166
175
typeItemWorldQuery:ReadOnlyWorldQuery;
167
176
168
-
/// Renders a [`PhaseItem`] by recording commands (e.g. setting pipelines, binding bind groups, issuing draw calls, etc.) via the [`TrackedRenderPass`].
177
+
/// Renders a [`PhaseItem`] by recording commands (e.g. setting pipelines, binding bind groups,
178
+
/// issuing draw calls, etc.) via the [`TrackedRenderPass`].
/// Wraps a [`RenderCommand`] into a state so that it can be used as a [`Draw`] function.
211
-
/// Therefore the [`RenderCommand::Param`], [`RenderCommand::ViewWorldQuery`] and [`RenderCommand::WorldQuery`] are queried from the ECS and passed to the command.
221
+
/// Therefore the [`RenderCommand::Param`], [`RenderCommand::ViewWorldQuery`] and
222
+
/// [`RenderCommand::ItemWorldQuery`] are queried from the ECS and passed to the command.
Copy file name to clipboardExpand all lines: crates/bevy_render/src/render_phase/mod.rs
+27-13Lines changed: 27 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,43 @@
1
-
//! The modular rendering abstractions that queue, prepare, sort and draw entities as part of separate phases.
1
+
//! A modular rendering abstraction responsible for queuing, preparing, sorting and drawing entities
2
+
//! as part of separate phases.
2
3
//!
3
-
//! To draw an entity, a corresponding [`PhaseItem`] has to be added to one of the renderers multiple [`RenderPhase`]s (e.g. opaque, transparent, shadow, etc).
4
+
//! To draw an entity, a corresponding [`PhaseItem`] has to be added to one of the renderers
//! Therefore each [`PhaseItem`] is assigned a [`Draw`] function.
9
-
//! These set up the state of the [`TrackedRenderPass`] (i.e. select the [`RenderPipeline`](crate::render_resource::RenderPipeline), configure the [`BindGroup`](crate::render_resource::BindGroup)s, etc.) and then issue a draw call, for the corresponding [`PhaseItem`].
13
+
//! These set up the state of the [`TrackedRenderPass`] (i.e. select the
14
+
//! [`RenderPipeline`](crate::render_resource::RenderPipeline), configure the
15
+
//! [`BindGroup`](crate::render_resource::BindGroup)s, etc.) and then issue a draw call,
16
+
//! for the corresponding [`PhaseItem`].
10
17
//!
11
-
//! The [`Draw`] function trait can either be implemented directly or such a function can be created by composing multiple [`RenderCommand`]s.
18
+
//! The [`Draw`] function trait can either be implemented directly or such a function can be
19
+
//! created by composing multiple [`RenderCommand`]s.
12
20
13
21
mod draw;
14
22
mod draw_state;
15
23
mod rangefinder;
16
24
17
-
use bevy_ecs::entity::Entity;
18
25
pubuse draw::*;
19
26
pubuse draw_state::*;
20
27
pubuse rangefinder::*;
21
28
22
29
use bevy_ecs::prelude::*;
23
-
use bevy_ecs::world::World;
24
30
use std::ops::Range;
25
31
26
32
/// A render phase sorts and renders all [`PhaseItem`]s (entities) that are assigned to it.
27
33
///
28
-
/// It corresponds to exactly one [`TrackedRenderPass`] and thus renders all items into the same texture attachments (e.g. color, depth, stencil).
34
+
/// Each view (camera, or shadow-casting light, etc.) can have one or multiple render phases.
35
+
/// They are used to queue entities for rendering.
36
+
/// Multiple phases might be required due to different sorting/batching behaviours
37
+
/// (e.g. opaque: front to back, transparent: back to front) or because one phase depends on
38
+
/// the rendered texture of the previous phase (e.g. for screen-space reflections).
39
+
/// All phase items are then rendered using a single [`TrackedRenderPass`].
40
+
/// This render pass might be reused for multiple phases.
0 commit comments