Add documentation to VisibleEntities and related (#5100)
# Objective Add missing docs ## Solution Add documentation to the `VisibleEntities` component, its related `check_visibility()` system, and that system's label. See Discord discussion here : https://discord.com/channels/691052431525675048/866787577687310356/990432663921901678
This commit is contained in:
parent
4c5e30a9f8
commit
382cd49c3b
@ -49,6 +49,18 @@ impl Default for ComputedVisibility {
|
||||
#[derive(Component)]
|
||||
pub struct NoFrustumCulling;
|
||||
|
||||
/// Collection of entities visible from the current view.
|
||||
///
|
||||
/// This component contains all entities which are visible from the currently
|
||||
/// rendered view. The collection is updated automatically by the [`check_visibility()`]
|
||||
/// system, and renderers can use it to optimize rendering of a particular view, to
|
||||
/// prevent drawing items not visible from that view.
|
||||
///
|
||||
/// This component is intended to be attached to the same entity as the [`Camera`] and
|
||||
/// the [`Frustum`] defining the view.
|
||||
///
|
||||
/// Currently this component is ignored by the sprite renderer, so sprite rendering
|
||||
/// is not optimized per view.
|
||||
#[derive(Clone, Component, Default, Debug, Reflect)]
|
||||
#[reflect(Component)]
|
||||
pub struct VisibleEntities {
|
||||
@ -76,6 +88,8 @@ pub enum VisibilitySystems {
|
||||
UpdateOrthographicFrusta,
|
||||
UpdatePerspectiveFrusta,
|
||||
UpdateProjectionFrusta,
|
||||
/// Label for the [`check_visibility()`] system updating each frame the [`ComputedVisibility`]
|
||||
/// of each entity and the [`VisibleEntities`] of each view.
|
||||
CheckVisibility,
|
||||
}
|
||||
|
||||
@ -149,6 +163,11 @@ pub fn update_frusta<T: Component + CameraProjection + Send + Sync + 'static>(
|
||||
}
|
||||
}
|
||||
|
||||
/// System updating the visibility of entities each frame.
|
||||
///
|
||||
/// The system is labelled with [`VisibilitySystems::CheckVisibility`]. Each frame, it updates the
|
||||
/// [`ComputedVisibility`] of all entities, and for each view also compute the [`VisibleEntities`]
|
||||
/// for that view.
|
||||
pub fn check_visibility(
|
||||
mut thread_queues: Local<ThreadLocal<Cell<Vec<Entity>>>>,
|
||||
mut view_query: Query<(&mut VisibleEntities, &Frustum, Option<&RenderLayers>), With<Camera>>,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user