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

[Merged by Bors] - bevy_reflect: Register missing reflected types for bevy_render #6725

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
42 changes: 33 additions & 9 deletions crates/bevy_render/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@ pub mod prelude {

use globals::GlobalsPlugin;
pub use once_cell;
use prelude::ComputedVisibility;

use crate::{
camera::CameraPlugin,
color::Color,
mesh::MeshPlugin,
primitives::{CubemapFrusta, Frustum},
render_graph::RenderGraph,
render_resource::{PipelineCache, Shader, ShaderLoader},
renderer::{render_system, RenderInstance},
Expand All @@ -52,7 +49,9 @@ use crate::{
use bevy_app::{App, AppLabel, Plugin};
use bevy_asset::{AddAsset, AssetServer};
use bevy_ecs::prelude::*;
use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
use bevy_utils::tracing::debug;
use std::ops::Range;
use std::{
any::TypeId,
ops::{Deref, DerefMut},
Expand Down Expand Up @@ -137,8 +136,7 @@ impl Plugin for RenderPlugin {
app.add_asset::<Shader>()
.add_debug_asset::<Shader>()
.init_asset_loader::<ShaderLoader>()
.init_debug_asset_loader::<ShaderLoader>()
.register_type::<Color>();
.init_debug_asset_loader::<ShaderLoader>();

if let Some(backends) = options.backends {
let windows = app.world.resource_mut::<bevy_window::Windows>();
Expand Down Expand Up @@ -166,9 +164,7 @@ impl Plugin for RenderPlugin {
.insert_resource(queue.clone())
.insert_resource(adapter_info.clone())
.insert_resource(render_adapter.clone())
.init_resource::<ScratchMainWorld>()
.register_type::<Frustum>()
.register_type::<CubemapFrusta>();
.init_resource::<ScratchMainWorld>();

let pipeline_cache = PipelineCache::new(device.clone());
let asset_server = app.world.resource::<AssetServer>().clone();
Expand Down Expand Up @@ -327,12 +323,40 @@ impl Plugin for RenderPlugin {
});
}

app.add_plugin(ValidParentCheckPlugin::<ComputedVisibility>::default())
app.add_plugin(ValidParentCheckPlugin::<view::ComputedVisibility>::default())
.add_plugin(WindowRenderPlugin)
.add_plugin(CameraPlugin)
.add_plugin(ViewPlugin)
.add_plugin(MeshPlugin)
.add_plugin(GlobalsPlugin);

app.register_type::<camera::Camera>()
.register_type::<camera::CameraRenderGraph>()
.register_type::<camera::OrthographicProjection>()
.register_type::<camera::PerspectiveProjection>()
.register_type::<camera::Projection>()
.register_type::<camera::RenderTarget>()
.register_type::<camera::ScalingMode>()
.register_type::<camera::Viewport>()
.register_type::<Option<camera::Viewport>>()
.register_type::<Range<f32>>()
.register_type_data::<Range<f32>, ReflectSerialize>()
.register_type_data::<Range<f32>, ReflectDeserialize>()
.register_type::<camera::WindowOrigin>()
.register_type::<color::Color>()
.register_type::<globals::GlobalsUniform>()
.register_type::<mesh::skinning::SkinnedMesh>()
.register_type::<Vec<Entity>>()
.register_type::<primitives::Aabb>()
.register_type::<primitives::CubemapFrusta>()
.register_type::<primitives::Frustum>()
.register_type::<texture::Image>()
.register_type::<view::ComputedVisibility>()
.register_type::<view::ComputedVisibilityFlags>()
.register_type::<view::Msaa>()
.register_type::<view::RenderLayers>()
.register_type::<view::Visibility>()
.register_type::<view::VisibleEntities>();
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/view/visibility/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Visibility {

bitflags::bitflags! {
#[derive(Reflect)]
struct ComputedVisibilityFlags: u8 {
pub(crate) struct ComputedVisibilityFlags: u8 {
const VISIBLE_IN_VIEW = 1 << 0;
const VISIBLE_IN_HIERARCHY = 1 << 1;
}
Expand Down