mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
This had merge conflicts with the 0.9.1 release branch, so this had to be merged manually. Creating a PR for visibility + a final review.
This commit is contained in:
parent
4f975d726f
commit
9d33846810
6 changed files with 20 additions and 22 deletions
|
@ -7,12 +7,7 @@ pub use camera::*;
|
||||||
pub use camera_driver_node::*;
|
pub use camera_driver_node::*;
|
||||||
pub use projection::*;
|
pub use projection::*;
|
||||||
|
|
||||||
use crate::{
|
use crate::{render_graph::RenderGraph, RenderApp, RenderStage};
|
||||||
primitives::Aabb,
|
|
||||||
render_graph::RenderGraph,
|
|
||||||
view::{ComputedVisibility, RenderLayers, Visibility, VisibleEntities},
|
|
||||||
RenderApp, RenderStage,
|
|
||||||
};
|
|
||||||
use bevy_app::{App, Plugin};
|
use bevy_app::{App, Plugin};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
|
@ -23,14 +18,10 @@ impl Plugin for CameraPlugin {
|
||||||
app.register_type::<Camera>()
|
app.register_type::<Camera>()
|
||||||
.register_type::<Viewport>()
|
.register_type::<Viewport>()
|
||||||
.register_type::<Option<Viewport>>()
|
.register_type::<Option<Viewport>>()
|
||||||
.register_type::<Visibility>()
|
|
||||||
.register_type::<ComputedVisibility>()
|
|
||||||
.register_type::<VisibleEntities>()
|
|
||||||
.register_type::<WindowOrigin>()
|
.register_type::<WindowOrigin>()
|
||||||
.register_type::<ScalingMode>()
|
.register_type::<ScalingMode>()
|
||||||
.register_type::<Aabb>()
|
|
||||||
.register_type::<CameraRenderGraph>()
|
.register_type::<CameraRenderGraph>()
|
||||||
.register_type::<RenderLayers>()
|
.register_type::<RenderTarget>()
|
||||||
.add_plugin(CameraProjectionPlugin::<Projection>::default())
|
.add_plugin(CameraProjectionPlugin::<Projection>::default())
|
||||||
.add_plugin(CameraProjectionPlugin::<OrthographicProjection>::default())
|
.add_plugin(CameraProjectionPlugin::<OrthographicProjection>::default())
|
||||||
.add_plugin(CameraProjectionPlugin::<PerspectiveProjection>::default());
|
.add_plugin(CameraProjectionPlugin::<PerspectiveProjection>::default());
|
||||||
|
|
|
@ -14,6 +14,7 @@ pub struct GlobalsPlugin;
|
||||||
|
|
||||||
impl Plugin for GlobalsPlugin {
|
impl Plugin for GlobalsPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
|
app.register_type::<GlobalsUniform>();
|
||||||
if let Ok(render_app) = app.get_sub_app_mut(RenderApp) {
|
if let Ok(render_app) = app.get_sub_app_mut(RenderApp) {
|
||||||
render_app
|
render_app
|
||||||
.init_resource::<GlobalsBuffer>()
|
.init_resource::<GlobalsBuffer>()
|
||||||
|
|
|
@ -38,14 +38,11 @@ pub mod prelude {
|
||||||
|
|
||||||
use globals::GlobalsPlugin;
|
use globals::GlobalsPlugin;
|
||||||
pub use once_cell;
|
pub use once_cell;
|
||||||
use prelude::ComputedVisibility;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
camera::CameraPlugin,
|
camera::CameraPlugin,
|
||||||
color::Color,
|
|
||||||
mesh::MeshPlugin,
|
mesh::MeshPlugin,
|
||||||
primitives::{CubemapFrusta, Frustum},
|
prelude::ComputedVisibility,
|
||||||
render_graph::RenderGraph,
|
|
||||||
render_resource::{PipelineCache, Shader, ShaderLoader},
|
render_resource::{PipelineCache, Shader, ShaderLoader},
|
||||||
renderer::{render_system, RenderInstance},
|
renderer::{render_system, RenderInstance},
|
||||||
view::{ViewPlugin, WindowRenderPlugin},
|
view::{ViewPlugin, WindowRenderPlugin},
|
||||||
|
@ -138,8 +135,7 @@ impl Plugin for RenderPlugin {
|
||||||
app.add_asset::<Shader>()
|
app.add_asset::<Shader>()
|
||||||
.add_debug_asset::<Shader>()
|
.add_debug_asset::<Shader>()
|
||||||
.init_asset_loader::<ShaderLoader>()
|
.init_asset_loader::<ShaderLoader>()
|
||||||
.init_debug_asset_loader::<ShaderLoader>()
|
.init_debug_asset_loader::<ShaderLoader>();
|
||||||
.register_type::<Color>();
|
|
||||||
|
|
||||||
if let Some(backends) = options.backends {
|
if let Some(backends) = options.backends {
|
||||||
let windows = app.world.resource_mut::<bevy_window::Windows>();
|
let windows = app.world.resource_mut::<bevy_window::Windows>();
|
||||||
|
@ -167,9 +163,7 @@ impl Plugin for RenderPlugin {
|
||||||
.insert_resource(queue.clone())
|
.insert_resource(queue.clone())
|
||||||
.insert_resource(adapter_info.clone())
|
.insert_resource(adapter_info.clone())
|
||||||
.insert_resource(render_adapter.clone())
|
.insert_resource(render_adapter.clone())
|
||||||
.init_resource::<ScratchMainWorld>()
|
.init_resource::<ScratchMainWorld>();
|
||||||
.register_type::<Frustum>()
|
|
||||||
.register_type::<CubemapFrusta>();
|
|
||||||
|
|
||||||
let pipeline_cache = PipelineCache::new(device.clone());
|
let pipeline_cache = PipelineCache::new(device.clone());
|
||||||
let asset_server = app.world.resource::<AssetServer>().clone();
|
let asset_server = app.world.resource::<AssetServer>().clone();
|
||||||
|
@ -204,7 +198,7 @@ impl Plugin for RenderPlugin {
|
||||||
.with_system(render_system.at_end()),
|
.with_system(render_system.at_end()),
|
||||||
)
|
)
|
||||||
.add_stage(RenderStage::Cleanup, SystemStage::parallel())
|
.add_stage(RenderStage::Cleanup, SystemStage::parallel())
|
||||||
.init_resource::<RenderGraph>()
|
.init_resource::<render_graph::RenderGraph>()
|
||||||
.insert_resource(RenderInstance(instance))
|
.insert_resource(RenderInstance(instance))
|
||||||
.insert_resource(device)
|
.insert_resource(device)
|
||||||
.insert_resource(queue)
|
.insert_resource(queue)
|
||||||
|
@ -335,6 +329,11 @@ impl Plugin for RenderPlugin {
|
||||||
.add_plugin(MeshPlugin)
|
.add_plugin(MeshPlugin)
|
||||||
.add_plugin(GlobalsPlugin)
|
.add_plugin(GlobalsPlugin)
|
||||||
.add_plugin(FrameCountPlugin);
|
.add_plugin(FrameCountPlugin);
|
||||||
|
|
||||||
|
app.register_type::<color::Color>()
|
||||||
|
.register_type::<primitives::Aabb>()
|
||||||
|
.register_type::<primitives::CubemapFrusta>()
|
||||||
|
.register_type::<primitives::Frustum>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ pub use mesh::*;
|
||||||
use crate::render_asset::RenderAssetPlugin;
|
use crate::render_asset::RenderAssetPlugin;
|
||||||
use bevy_app::{App, Plugin};
|
use bevy_app::{App, Plugin};
|
||||||
use bevy_asset::AddAsset;
|
use bevy_asset::AddAsset;
|
||||||
|
use bevy_ecs::entity::Entity;
|
||||||
|
|
||||||
/// Adds the [`Mesh`] as an asset and makes sure that they are extracted and prepared for the GPU.
|
/// Adds the [`Mesh`] as an asset and makes sure that they are extracted and prepared for the GPU.
|
||||||
pub struct MeshPlugin;
|
pub struct MeshPlugin;
|
||||||
|
@ -17,6 +18,7 @@ impl Plugin for MeshPlugin {
|
||||||
app.add_asset::<Mesh>()
|
app.add_asset::<Mesh>()
|
||||||
.add_asset::<skinning::SkinnedMeshInverseBindposes>()
|
.add_asset::<skinning::SkinnedMeshInverseBindposes>()
|
||||||
.register_type::<skinning::SkinnedMesh>()
|
.register_type::<skinning::SkinnedMesh>()
|
||||||
|
.register_type::<Vec<Entity>>()
|
||||||
.add_plugin(RenderAssetPlugin::<Mesh>::default());
|
.add_plugin(RenderAssetPlugin::<Mesh>::default());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,7 @@ impl Plugin for ImagePlugin {
|
||||||
app.add_plugin(RenderAssetPlugin::<Image>::with_prepare_asset_label(
|
app.add_plugin(RenderAssetPlugin::<Image>::with_prepare_asset_label(
|
||||||
PrepareAssetLabel::PreAssetPrepare,
|
PrepareAssetLabel::PreAssetPrepare,
|
||||||
))
|
))
|
||||||
|
.register_type::<Image>()
|
||||||
.add_asset::<Image>()
|
.add_asset::<Image>()
|
||||||
.register_asset_reflect::<Image>();
|
.register_asset_reflect::<Image>();
|
||||||
app.world
|
app.world
|
||||||
|
|
|
@ -31,7 +31,11 @@ pub struct ViewPlugin;
|
||||||
|
|
||||||
impl Plugin for ViewPlugin {
|
impl Plugin for ViewPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.register_type::<Msaa>()
|
app.register_type::<ComputedVisibility>()
|
||||||
|
.register_type::<Msaa>()
|
||||||
|
.register_type::<RenderLayers>()
|
||||||
|
.register_type::<Visibility>()
|
||||||
|
.register_type::<VisibleEntities>()
|
||||||
.init_resource::<Msaa>()
|
.init_resource::<Msaa>()
|
||||||
// NOTE: windows.is_changed() handles cases where a window was resized
|
// NOTE: windows.is_changed() handles cases where a window was resized
|
||||||
.add_plugin(ExtractResourcePlugin::<Msaa>::default())
|
.add_plugin(ExtractResourcePlugin::<Msaa>::default())
|
||||||
|
|
Loading…
Reference in a new issue