Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Reflect on NoFrustumCulling #8801

Merged
merged 2 commits into from
Jun 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/bevy_render/src/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ impl Plugin for ViewPlugin {
app.register_type::<ComputedVisibility>()
.register_type::<ComputedVisibilityFlags>()
.register_type::<Msaa>()
.register_type::<NoFrustumCulling>()
.register_type::<RenderLayers>()
.register_type::<Visibility>()
.register_type::<VisibleEntities>()
Expand Down
11 changes: 5 additions & 6 deletions crates/bevy_render/src/view/visibility/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ use bevy_app::{Plugin, PostUpdate};
use bevy_asset::{Assets, Handle};
use bevy_ecs::prelude::*;
use bevy_hierarchy::{Children, Parent};
use bevy_reflect::Reflect;
use bevy_reflect::{std_traits::ReflectDefault, FromReflect};
use bevy_transform::components::GlobalTransform;
use bevy_transform::TransformSystem;
use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect, ReflectFromReflect};
use bevy_transform::{components::GlobalTransform, TransformSystem};
use std::cell::Cell;
use thread_local::ThreadLocal;

Expand All @@ -30,7 +28,7 @@ use crate::{
/// This is done by the `visibility_propagate_system` which uses the entity hierarchy and
/// `Visibility` to set the values of each entity's [`ComputedVisibility`] component.
#[derive(Component, Clone, Copy, Reflect, FromReflect, Debug, PartialEq, Eq, Default)]
#[reflect(Component, Default)]
#[reflect(Component, Default, FromReflect)]
pub enum Visibility {
/// An entity with `Visibility::Inherited` will inherit the Visibility of its [`Parent`].
///
Expand Down Expand Up @@ -157,7 +155,8 @@ pub struct VisibilityBundle {
}

/// Use this component to opt-out of built-in frustum culling for Mesh entities
#[derive(Component)]
#[derive(Component, Default, Reflect, FromReflect)]
#[reflect(Component, Default, FromReflect)]
pub struct NoFrustumCulling;

/// Collection of entities visible from the current view.
Expand Down