Implement Reflect on NoFrustumCulling (#8801)

# Objective

`NoFrustumCulling` doesn't implement `Reflect`, while nothing prevents
it from implementing it.

## Solution

Implement `Reflect` for it.

---

## Changelog

- Add `Reflect` derive to `NoFrustrumCulling`.
- Add `FromReflect` derive to `Visibility`.
This commit is contained in:
Nicola Papale 2023-06-10 12:04:50 +02:00 committed by GitHub
parent a1494e53df
commit c1fd505f9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -43,6 +43,7 @@ impl Plugin for ViewPlugin {
app.register_type::<ComputedVisibility>() app.register_type::<ComputedVisibility>()
.register_type::<ComputedVisibilityFlags>() .register_type::<ComputedVisibilityFlags>()
.register_type::<Msaa>() .register_type::<Msaa>()
.register_type::<NoFrustumCulling>()
.register_type::<RenderLayers>() .register_type::<RenderLayers>()
.register_type::<Visibility>() .register_type::<Visibility>()
.register_type::<VisibleEntities>() .register_type::<VisibleEntities>()

View File

@ -6,10 +6,8 @@ use bevy_app::{Plugin, PostUpdate};
use bevy_asset::{Assets, Handle}; use bevy_asset::{Assets, Handle};
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_hierarchy::{Children, Parent}; use bevy_hierarchy::{Children, Parent};
use bevy_reflect::Reflect; use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect, ReflectFromReflect};
use bevy_reflect::{std_traits::ReflectDefault, FromReflect}; use bevy_transform::{components::GlobalTransform, TransformSystem};
use bevy_transform::components::GlobalTransform;
use bevy_transform::TransformSystem;
use std::cell::Cell; use std::cell::Cell;
use thread_local::ThreadLocal; use thread_local::ThreadLocal;
@ -30,7 +28,7 @@ use crate::{
/// This is done by the `visibility_propagate_system` which uses the entity hierarchy and /// 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. /// `Visibility` to set the values of each entity's [`ComputedVisibility`] component.
#[derive(Component, Clone, Copy, Reflect, FromReflect, Debug, PartialEq, Eq, Default)] #[derive(Component, Clone, Copy, Reflect, FromReflect, Debug, PartialEq, Eq, Default)]
#[reflect(Component, Default)] #[reflect(Component, Default, FromReflect)]
pub enum Visibility { pub enum Visibility {
/// An entity with `Visibility::Inherited` will inherit the Visibility of its [`Parent`]. /// An entity with `Visibility::Inherited` will inherit the Visibility of its [`Parent`].
/// ///
@ -157,7 +155,8 @@ pub struct VisibilityBundle {
} }
/// Use this component to opt-out of built-in frustum culling for Mesh entities /// 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; pub struct NoFrustumCulling;
/// Collection of entities visible from the current view. /// Collection of entities visible from the current view.