Struct bevy_render::render_phase::BinnedRenderPhase
source · pub struct BinnedRenderPhase<BPI>where
BPI: BinnedPhaseItem,{
pub batchable_mesh_keys: Vec<BPI::BinKey>,
pub unbatchable_mesh_keys: Vec<BPI::BinKey>,
pub non_mesh_items: Vec<(BPI::BinKey, Entity)>,
/* private fields */
}
Expand description
A collection of all rendering instructions, that will be executed by the GPU, for a single render phase for a single view.
Each view (camera, or shadow-casting light, etc.) can have one or multiple render phases.
They are used to queue entities for rendering.
Multiple phases might be required due to different sorting/batching behaviors
(e.g. opaque: front to back, transparent: back to front) or because one phase depends on
the rendered texture of the previous phase (e.g. for screen-space reflections).
All PhaseItem
s are then rendered using a single TrackedRenderPass
.
The render pass might be reused for multiple phases to reduce GPU overhead.
This flavor of render phase is used for phases in which the ordering is less
critical: for example, Opaque3d
. It’s generally faster than the
alternative SortedRenderPhase
.
Fields§
§batchable_mesh_keys: Vec<BPI::BinKey>
A list of BinKey
s for batchable items.
These are accumulated in queue_material_meshes
and then sorted in
batch_and_prepare_binned_render_phase
.
unbatchable_mesh_keys: Vec<BPI::BinKey>
A list of BinKey
s for unbatchable items.
These are accumulated in queue_material_meshes
and then sorted in
batch_and_prepare_binned_render_phase
.
non_mesh_items: Vec<(BPI::BinKey, Entity)>
Items in the bin that aren’t meshes at all.
Bevy itself doesn’t place anything in this list, but plugins or your app can in order to execute custom drawing commands. Draw functions for each entity are simply called in order at rendering time.
See the custom_phase_item
example for an example of how to use this.
Implementations§
source§impl<BPI> BinnedRenderPhase<BPI>where
BPI: BinnedPhaseItem,
impl<BPI> BinnedRenderPhase<BPI>where
BPI: BinnedPhaseItem,
sourcepub fn add(
&mut self,
key: BPI::BinKey,
entity: Entity,
phase_type: BinnedRenderPhaseType
)
pub fn add( &mut self, key: BPI::BinKey, entity: Entity, phase_type: BinnedRenderPhaseType )
Bins a new entity.
The phase_type
parameter specifies whether the entity is a
preprocessable mesh and whether it can be binned with meshes of the same
type.
sourcepub fn render<'w>(
&self,
render_pass: &mut TrackedRenderPass<'w>,
world: &'w World,
view: Entity
)
pub fn render<'w>( &self, render_pass: &mut TrackedRenderPass<'w>, world: &'w World, view: Entity )
Encodes the GPU commands needed to render all entities in this phase.
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
Trait Implementations§
source§impl<BPI> Default for BinnedRenderPhase<BPI>where
BPI: BinnedPhaseItem,
impl<BPI> Default for BinnedRenderPhase<BPI>where
BPI: BinnedPhaseItem,
Auto Trait Implementations§
impl<BPI> Freeze for BinnedRenderPhase<BPI>
impl<BPI> RefUnwindSafe for BinnedRenderPhase<BPI>
impl<BPI> Send for BinnedRenderPhase<BPI>
impl<BPI> Sync for BinnedRenderPhase<BPI>
impl<BPI> Unpin for BinnedRenderPhase<BPI>
impl<BPI> UnwindSafe for BinnedRenderPhase<BPI>
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World
.