Struct bevy::render::prelude::ComputedVisibility
pub struct ComputedVisibility { /* private fields */ }
Expand description
Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
Implementations§
§impl ComputedVisibility
impl ComputedVisibility
pub const INVISIBLE: ComputedVisibility = ComputedVisibility{
is_visible_in_hierarchy: false,
is_visible_in_view: false,}
pub const INVISIBLE: ComputedVisibility = ComputedVisibility{ is_visible_in_hierarchy: false, is_visible_in_view: false,}
A ComputedVisibility
, set as invisible.
pub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Whether this entity is visible to something this frame. This is true if and only if Self::is_visible_in_hierarchy
and Self::is_visible_in_view
are true. This is the canonical method to call to determine if an entity should be drawn.
This value is updated in CoreStage::PostUpdate
during the VisibilitySystems::CheckVisibility
system label. Reading it from the
CoreStage::Update
stage will yield the value from the previous frame.
pub fn is_visible_in_hierarchy(&self) -> bool
pub fn is_visible_in_hierarchy(&self) -> bool
Whether this entity is visible in the entity hierarchy, which is determined by the Visibility
component.
This takes into account “visibility inheritance”. If any of this entity’s ancestors (see Parent
) are hidden, this entity
will be hidden as well. This value is updated in the CoreStage::PostUpdate
stage in the
VisibilitySystems::VisibilityPropagate
system label.
pub fn is_visible_in_view(&self) -> bool
pub fn is_visible_in_view(&self) -> bool
Whether this entity is visible in any view (Cameras, Lights, etc). Each entity type (and view type) should choose how to set this
value. For cameras and drawn entities, this will take into account RenderLayers
.
This value is reset to false
every frame in VisibilitySystems::VisibilityPropagate
during CoreStage::PostUpdate
.
Each entity type then chooses how to set this field in the CoreStage::PostUpdate
stage in the
VisibilitySystems::CheckVisibility
system label. Meshes might use frustum culling to decide if they are visible in a view.
Other entities might just set this to true
every frame.
pub fn set_visible_in_view(&mut self)
pub fn set_visible_in_view(&mut self)
Sets is_visible_in_view
to true
. This is not reversible for a given frame, as it encodes whether or not this is visible in
any view. This will be automatically reset to false
every frame in VisibilitySystems::VisibilityPropagate
and then set
to the proper value in VisibilitySystems::CheckVisibility
. This should only be set in systems with the VisibilitySystems::CheckVisibility
label. Don’t call this unless you are defining a custom visibility system. For normal user-defined entity visibility, see Visibility
.
Trait Implementations§
§impl Clone for ComputedVisibility
impl Clone for ComputedVisibility
§fn clone(&self) -> ComputedVisibility
fn clone(&self) -> ComputedVisibility
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Component for ComputedVisibilitywhere
ComputedVisibility: 'static + Send + Sync,
impl Component for ComputedVisibilitywhere
ComputedVisibility: 'static + Send + Sync,
type Storage = TableStorage
§impl Debug for ComputedVisibility
impl Debug for ComputedVisibility
§impl Default for ComputedVisibility
impl Default for ComputedVisibility
§fn default() -> ComputedVisibility
fn default() -> ComputedVisibility
§impl GetTypeRegistration for ComputedVisibility
impl GetTypeRegistration for ComputedVisibility
§impl PartialEq<ComputedVisibility> for ComputedVisibility
impl PartialEq<ComputedVisibility> for ComputedVisibility
§fn eq(&self, other: &ComputedVisibility) -> bool
fn eq(&self, other: &ComputedVisibility) -> bool
§impl Reflect for ComputedVisibility
impl Reflect for ComputedVisibility
§fn get_type_info(&self) -> &'static TypeInfo
fn get_type_info(&self) -> &'static TypeInfo
§fn into_any(
self: Box<ComputedVisibility, Global>
) -> Box<dyn Any + 'static, Global>
fn into_any(
self: Box<ComputedVisibility, Global>
) -> Box<dyn Any + 'static, Global>
Box<dyn Any>
.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut dyn Any
.§fn into_reflect(
self: Box<ComputedVisibility, Global>
) -> Box<dyn Reflect + 'static, Global>
fn into_reflect(
self: Box<ComputedVisibility, Global>
) -> Box<dyn Reflect + 'static, Global>
§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
§fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>
fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>
Reflect
trait object. Read more§fn set(
&mut self,
value: Box<dyn Reflect + 'static, Global>
) -> Result<(), Box<dyn Reflect + 'static, Global>>
fn set(
&mut self,
value: Box<dyn Reflect + 'static, Global>
) -> Result<(), Box<dyn Reflect + 'static, Global>>
§fn apply(&mut self, value: &(dyn Reflect + 'static))
fn apply(&mut self, value: &(dyn Reflect + 'static))
§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
§fn reflect_owned(self: Box<ComputedVisibility, Global>) -> ReflectOwned
fn reflect_owned(self: Box<ComputedVisibility, Global>) -> ReflectOwned
§fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
§fn serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
§impl Struct for ComputedVisibility
impl Struct for ComputedVisibility
§fn field_at_mut(&mut self, index: usize) -> Option<&mut (dyn Reflect + 'static)>
fn field_at_mut(&mut self, index: usize) -> Option<&mut (dyn Reflect + 'static)>
index
as a &mut dyn Reflect
. Read more§fn iter_fields(&self) -> FieldIter<'_> ⓘ
fn iter_fields(&self) -> FieldIter<'_> ⓘ
§fn clone_dynamic(&self) -> DynamicStruct
fn clone_dynamic(&self) -> DynamicStruct
DynamicStruct
.§impl Typed for ComputedVisibility
impl Typed for ComputedVisibility
impl Eq for ComputedVisibility
impl StructuralEq for ComputedVisibility
impl StructuralPartialEq for ComputedVisibility
Auto Trait Implementations§
impl RefUnwindSafe for ComputedVisibility
impl Send for ComputedVisibility
impl Sync for ComputedVisibility
impl Unpin for ComputedVisibility
impl UnwindSafe for ComputedVisibility
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist. Read more§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids(
components: &mut Components,
storages: &mut Storages,
ids: &mut impl FnMut(ComponentId)
)
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> Cwhere
F: for<'a> FnMut(&'a mut T) -> OwningPtr<'a>,
fn get_components(self, func: &mut impl FnMut(OwningPtr<'_>))
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
. Read more§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more§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. Read more§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. Read moresource§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World§impl<S> GetField for Swhere
S: Struct,
impl<S> GetField for Swhere
S: Struct,
§impl<T> GetPath for Twhere
T: Reflect,
impl<T> GetPath for Twhere
T: Reflect,
§fn path<'r, 'p>(
&'r self,
path: &'p str
) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
fn path<'r, 'p>(
&'r self,
path: &'p str
) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
path
. Read more§fn path_mut<'r, 'p>(
&'r mut self,
path: &'p str
) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
fn path_mut<'r, 'p>(
&'r mut self,
path: &'p str
) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
path
. Read more§fn get_path<T, 'r, 'p>(
&'r self,
path: &'p str
) -> Result<&'r T, ReflectPathError<'p>>where
T: Reflect,
fn get_path<T, 'r, 'p>(
&'r self,
path: &'p str
) -> Result<&'r T, ReflectPathError<'p>>where
T: Reflect,
path
.§fn get_path_mut<T, 'r, 'p>(
&'r mut self,
path: &'p str
) -> Result<&'r mut T, ReflectPathError<'p>>where
T: Reflect,
fn get_path_mut<T, 'r, 'p>(
&'r mut self,
path: &'p str
) -> Result<&'r mut T, ReflectPathError<'p>>where
T: Reflect,
path
. Read more