From 3913ef0c28bd707931b2af1df3ee9dcc3454bcfe Mon Sep 17 00:00:00 2001 From: Mitchell Mosure Date: Tue, 3 Sep 2024 21:15:49 -0500 Subject: [PATCH] feat: bevy 0.14 (#112) * feat: bevy 0.14 building * fix: view matrices --- Cargo.toml | 18 +++++------ README.md | 1 + examples/headless.rs | 15 ++++----- src/io/loader.rs | 68 ++++++++++++++++++--------------------- src/lib.rs | 4 +-- src/morph/particle.rs | 32 +++++++++--------- src/render/gaussian.wgsl | 12 +++---- src/render/mod.rs | 68 +++++++++++++++++++-------------------- src/render/texture.rs | 2 +- src/render/transform.wgsl | 7 +--- src/sort/mod.rs | 18 +++++------ src/sort/radix.rs | 15 +++++---- tests/gpu/radix.rs | 10 +++--- tools/compare_aabb_obb.rs | 4 +-- viewer/viewer.rs | 7 ++-- 15 files changed, 135 insertions(+), 146 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d4233587..876fbb75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bevy_gaussian_splatting" description = "bevy gaussian splatting render pipeline plugin" -version = "2.2.1" +version = "2.3.0" edition = "2021" authors = ["mosure "] license = "MIT" @@ -112,7 +112,7 @@ viewer = [ "bevy-inspector-egui", "bevy_panorbit_camera", # "bevy_transform_gizmo", - "bevy/multi-threaded", # bevy screenshot functionality requires bevy/multi-threaded as of 0.12.1 + "bevy/multi_threaded", # bevy screenshot functionality requires bevy/multi_threaded as of 0.12.1 "clap", "bevy/bevy_ui", ] @@ -133,11 +133,11 @@ webgpu = ["bevy/webgpu"] [dependencies] -bevy_args = { version = "1.4.2" } -bevy-inspector-egui = { version = "0.24", optional = true } -bevy_mod_picking = { version = "0.18", optional = true } -bevy_panorbit_camera = { version = "0.18", optional = true } -bevy_transform_gizmo = { version = "0.11", optional = true } +bevy_args = "1.6" +bevy-inspector-egui = { version = "0.25", optional = true } +bevy_mod_picking = { version = "0.20", optional = true } +bevy_panorbit_camera = { version = "0.19", optional = true } +bevy_transform_gizmo = { version = "0.12", optional = true } bincode2 = { version = "2.0", optional = true } byte-unit = { version = "5.0", optional = true } bytemuck = "1.14" @@ -154,7 +154,7 @@ rayon = { version = "1.8", optional = true } serde = "1.0" static_assertions = "1.1" typenum = "1.17" -wgpu = "0.19.1" +wgpu = "0.20" [target.'cfg(target_arch = "wasm32")'.dependencies] @@ -163,7 +163,7 @@ wasm-bindgen = "0.2" [dependencies.bevy] -version = "0.13" +version = "0.14" default-features = false features = [ "bevy_asset", diff --git a/README.md b/README.md index 0fb7e575..110f2e30 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ fn setup_gaussian_cloud( | `bevy_gaussian_splatting` | `bevy` | | :-- | :-- | +| `2.3` | `0.14` | | `2.1` | `0.13` | | `0.4 - 2.0` | `0.12` | | `0.1 - 0.3` | `0.11` | diff --git a/examples/headless.rs b/examples/headless.rs index ca6770f9..45597424 100644 --- a/examples/headless.rs +++ b/examples/headless.rs @@ -30,6 +30,7 @@ mod frame_capture { use bevy::render::render_graph::{self, NodeRunError, RenderGraph, RenderGraphContext, RenderLabel}; use bevy::render::renderer::{RenderContext, RenderDevice, RenderQueue}; use bevy::render::{Extract, RenderApp}; + use bevy::render::texture::GpuImage; use bevy::render::render_resource::{ Buffer, BufferDescriptor, BufferUsages, CommandEncoderDescriptor, Extent3d, @@ -85,10 +86,9 @@ mod frame_capture { render_app.add_systems(ExtractSchedule, image_copy_extract); - let mut graph = render_app.world.get_resource_mut::().unwrap(); + let mut graph = render_app.world_mut().get_resource_mut::().unwrap(); graph.add_node(ImageCopyLabel, ImageCopyDriver); - graph.add_node_edge(ImageCopyLabel, bevy::render::graph::CameraDriverLabel); } } @@ -154,7 +154,7 @@ mod frame_capture { world: &World, ) -> Result<(), NodeRunError> { let image_copiers = world.get_resource::().unwrap(); - let gpu_images = world.get_resource::>().unwrap(); + let gpu_images = world.get_resource::>().unwrap(); for image_copier in image_copiers.iter() { if !image_copier.enabled() { @@ -333,7 +333,7 @@ mod frame_capture { ) { if let SceneState::Render(n) = scene_controller.state { if n < 1 { - for image in images_to_save.iter() { + for (i, image) in images_to_save.iter().enumerate() { let img_bytes = images.get_mut(image.id()).unwrap(); let img = match img_bytes.clone().try_into_dynamic() { @@ -345,14 +345,13 @@ mod frame_capture { PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("headless_output"); std::fs::create_dir_all(&images_dir).unwrap(); - let uuid = bevy::utils::Uuid::new_v4(); - let image_path = images_dir.join(format!("{uuid}.png")); + let image_path = images_dir.join(format!("{i}.png")); if let Err(e) = img.save(image_path){ panic!("Failed to save image: {}", e); }; } if scene_controller.single_image { - app_exit_writer.send(AppExit); + app_exit_writer.send(AppExit::Success); } } else { scene_controller.state = SceneState::Render(n - 1); @@ -428,7 +427,7 @@ fn headless_app() { // setup frame capture app.insert_resource(frame_capture::scene::SceneController::new(config.width, config.height, config.single_image)); - app.insert_resource(ClearColor(Color::rgb_u8(0, 0, 0))); + app.insert_resource(ClearColor(Color::srgb_u8(0, 0, 0))); app.add_plugins( DefaultPlugins diff --git a/src/io/loader.rs b/src/io/loader.rs index 21e6c086..ae42b189 100644 --- a/src/io/loader.rs +++ b/src/io/loader.rs @@ -5,14 +5,11 @@ use std::io::{ ErrorKind, }; -use bevy::{ - asset::{ - AssetLoader, - AsyncReadExt, - LoadContext, - io::Reader, - }, - utils::BoxedFuture, +use bevy::asset::{ + AssetLoader, + AsyncReadExt, + LoadContext, + io::Reader, }; use crate::{ @@ -29,42 +26,39 @@ impl AssetLoader for GaussianCloudLoader { type Settings = (); type Error = std::io::Error; - fn load<'a>( + async fn load<'a>( &'a self, - reader: &'a mut Reader, + reader: &'a mut Reader<'_>, _settings: &'a Self::Settings, - load_context: &'a mut LoadContext, - ) -> BoxedFuture<'a, Result> { + load_context: &'a mut LoadContext<'_>, + ) -> Result { + let mut bytes = Vec::new(); + reader.read_to_end(&mut bytes).await?; - Box::pin(async move { - let mut bytes = Vec::new(); - reader.read_to_end(&mut bytes).await?; + match load_context.path().extension() { + Some(ext) if ext == "ply" => { + #[cfg(feature = "io_ply")] + { + let cursor = Cursor::new(bytes); + let mut f = BufReader::new(cursor); - match load_context.path().extension() { - Some(ext) if ext == "ply" => { - #[cfg(feature = "io_ply")] - { - let cursor = Cursor::new(bytes); - let mut f = BufReader::new(cursor); + let gaussians = crate::io::ply::parse_ply(&mut f)?; - let gaussians = crate::io::ply::parse_ply(&mut f)?; + Ok(GaussianCloud::from_gaussians(gaussians)) + } - Ok(GaussianCloud::from_gaussians(gaussians)) - } + #[cfg(not(feature = "io_ply"))] + { + Err(std::io::Error::new(ErrorKind::Other, "ply support not enabled, enable with io_ply feature")) + } + }, + Some(ext) if ext == "gcloud" => { + let cloud = GaussianCloud::decode(bytes.as_slice()); - #[cfg(not(feature = "io_ply"))] - { - Err(std::io::Error::new(ErrorKind::Other, "ply support not enabled, enable with io_ply feature")) - } - }, - Some(ext) if ext == "gcloud" => { - let cloud = GaussianCloud::decode(bytes.as_slice()); - - Ok(cloud) - }, - _ => Err(std::io::Error::new(ErrorKind::Other, "only .ply and .gcloud supported")), - } - }) + Ok(cloud) + }, + _ => Err(std::io::Error::new(ErrorKind::Other, "only .ply and .gcloud supported")), + } } fn extensions(&self) -> &[&str] { diff --git a/src/lib.rs b/src/lib.rs index 7d363d1d..fe70f5f2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,8 +34,8 @@ pub struct GaussianSplattingBundle { } -#[derive(Component, Default)] -struct GaussianSplattingCamera; +// #[derive(Component, Default)] +// struct GaussianSplattingCamera; // TODO: filter camera 3D entities pub struct GaussianSplattingPlugin; diff --git a/src/morph/particle.rs b/src/morph/particle.rs index 89a64231..fc6e25e4 100644 --- a/src/morph/particle.rs +++ b/src/morph/particle.rs @@ -109,9 +109,9 @@ impl Plugin for ParticleBehaviorPlugin { app.register_type::(); app.init_asset::(); app.register_asset_reflect::(); - app.add_plugins(RenderAssetPlugin::::default()); + app.add_plugins(RenderAssetPlugin::::default()); - if let Ok(render_app) = app.get_sub_app_mut(RenderApp) { + if let Some(render_app) = app.get_sub_app_mut(RenderApp) { render_app .add_render_graph_node::( Core3d, @@ -128,14 +128,14 @@ impl Plugin for ParticleBehaviorPlugin { .add_systems( Render, ( - queue_particle_behavior_bind_group.in_set(RenderSet::QueueMeshes), + queue_particle_behavior_bind_group.in_set(RenderSet::Queue), ), ); } } fn finish(&self, app: &mut App) { - if let Ok(render_app) = app.get_sub_app_mut(RenderApp) { + if let Some(render_app) = app.get_sub_app_mut(RenderApp) { render_app .init_resource::(); } @@ -172,20 +172,20 @@ pub struct GpuParticleBehaviorBuffers { pub particle_behavior_buffer: Buffer, } -impl RenderAsset for ParticleBehaviors { - type PreparedAsset = GpuParticleBehaviorBuffers; +impl RenderAsset for GpuParticleBehaviorBuffers { + type SourceAsset = ParticleBehaviors; type Param = SRes; fn prepare_asset( - self, + source: Self::SourceAsset, render_device: &mut SystemParamItem, - ) -> Result> { - let particle_behavior_count = self.0.len() as u32; + ) -> Result> { + let particle_behavior_count = source.0.len() as u32; let particle_behavior_buffer = render_device.create_buffer_with_data(&BufferInitDescriptor { label: Some("particle behavior buffer"), contents: bytemuck::cast_slice( - self.0.as_slice() + source.0.as_slice() ), usage: BufferUsages::VERTEX | BufferUsages::COPY_DST | BufferUsages::STORAGE, }); @@ -196,8 +196,8 @@ impl RenderAsset for ParticleBehaviors { }) } - fn asset_usage(&self) -> RenderAssetUsages { - RenderAssetUsages::RENDER_WORLD + fn asset_usage(_: &Self::SourceAsset) -> RenderAssetUsages { + RenderAssetUsages::default() } } @@ -265,7 +265,7 @@ pub fn queue_particle_behavior_bind_group( particle_behavior_pipeline: Res, render_device: Res, asset_server: Res, - particle_behaviors_res: Res>, + particle_behaviors_res: Res>, particle_behaviors: Query<( Entity, &Handle, @@ -276,11 +276,11 @@ pub fn queue_particle_behavior_bind_group( continue; } - if particle_behaviors_res.get(behaviors_handle).is_none() { + if particle_behaviors_res.get(behaviors_handle.id()).is_none() { continue; } - let behaviors = particle_behaviors_res.get(behaviors_handle).unwrap(); + let behaviors = particle_behaviors_res.get(behaviors_handle.id()).unwrap(); let particle_behavior_bindgroup = render_device.create_bind_group( "particle_behavior_bind_group", @@ -375,7 +375,7 @@ impl Node for ParticleBehaviorNode { behaviors_handle, particle_behavior_bind_group, ) in self.gaussian_clouds.iter_manual(world) { - let behaviors = world.get_resource::>().unwrap().get(behaviors_handle).unwrap(); + let behaviors = world.get_resource::>().unwrap().get(behaviors_handle.id()).unwrap(); let gaussian_uniforms = world.resource::(); { diff --git a/src/render/gaussian.wgsl b/src/render/gaussian.wgsl index 60d869a2..e07a6aab 100644 --- a/src/render/gaussian.wgsl +++ b/src/render/gaussian.wgsl @@ -210,11 +210,11 @@ fn compute_cov2d( cov3d[2], cov3d[4], cov3d[5], ); - var t = view.inverse_view * vec4(position, 1.0); + var t = view.view_from_world * vec4(position, 1.0); let focal = vec2( - view.projection.x.x * view.viewport.z, - view.projection.y.y * view.viewport.w, + view.clip_from_view .x.x * view.viewport.z, + view.clip_from_view .y.y * view.viewport.w, ); let s = 1.0 / (t.z * t.z); @@ -226,9 +226,9 @@ fn compute_cov2d( let W = transpose( mat3x3( - view.inverse_view.x.xyz, - view.inverse_view.y.xyz, - view.inverse_view.z.xyz, + view.view_from_world.x.xyz, + view.view_from_world.y.xyz, + view.view_from_world.z.xyz, ) ); diff --git a/src/render/mod.rs b/src/render/mod.rs index 6c6bd0d1..4bb52e27 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -36,11 +36,12 @@ use bevy::{ AddRenderCommand, DrawFunctions, PhaseItem, + PhaseItemExtraIndex, RenderCommand, RenderCommandResult, - RenderPhase, SetItemPipeline, TrackedRenderPass, + ViewSortedRenderPhases, }, render_resource::*, renderer::RenderDevice, @@ -72,6 +73,7 @@ use crate::{ }, morph::MorphPlugin, sort::{ + GpuSortedEntry, SortPlugin, SortedEntries, }, @@ -142,7 +144,7 @@ impl Plugin for RenderPipelinePlugin { Shader::from_wgsl ); - app.add_plugins(RenderAssetPlugin::::default()); + app.add_plugins(RenderAssetPlugin::::default()); app.add_plugins(UniformComponentPlugin::::default()); app.add_plugins(( @@ -153,7 +155,7 @@ impl Plugin for RenderPipelinePlugin { #[cfg(feature = "buffer_texture")] app.add_plugins(texture::BufferTexturePlugin); - if let Ok(render_app) = app.get_sub_app_mut(RenderApp) { + if let Some(render_app) = app.get_sub_app_mut(RenderApp) { render_app .add_render_command::() .init_resource::() @@ -161,16 +163,16 @@ impl Plugin for RenderPipelinePlugin { .add_systems( Render, ( - queue_gaussian_bind_group.in_set(RenderSet::QueueMeshes), - queue_gaussian_view_bind_groups.in_set(RenderSet::QueueMeshes), - queue_gaussians.in_set(RenderSet::QueueMeshes), + queue_gaussian_bind_group.in_set(RenderSet::Queue), + queue_gaussian_view_bind_groups.in_set(RenderSet::Queue), + queue_gaussians.in_set(RenderSet::Queue), ), ); } } fn finish(&self, app: &mut App) { - if let Ok(render_app) = app.get_sub_app_mut(RenderApp) { + if let Some(render_app) = app.get_sub_app_mut(RenderApp) { render_app .init_resource::() .init_resource::>(); @@ -201,15 +203,15 @@ pub struct GpuGaussianCloud { #[cfg(feature = "debug_gpu")] pub debug_gpu: GaussianCloud, } -impl RenderAsset for GaussianCloud { - type PreparedAsset = GpuGaussianCloud; +impl RenderAsset for GpuGaussianCloud { + type SourceAsset = GaussianCloud; type Param = SRes; fn prepare_asset( - self, + source: Self::SourceAsset, render_device: &mut SystemParamItem, - ) -> Result> { - let count = self.len(); + ) -> Result> { + let count = source.len(); let draw_indirect_buffer = render_device.create_buffer_with_data(&BufferInitDescriptor { label: Some("draw indirect buffer"), @@ -229,16 +231,16 @@ impl RenderAsset for GaussianCloud { draw_indirect_buffer, #[cfg(feature = "packed")] - packed: packed::prepare_cloud(render_device, &self), + packed: packed::prepare_cloud(render_device, &source), #[cfg(feature = "buffer_storage")] - planar: planar::prepare_cloud(render_device, &self), + planar: planar::prepare_cloud(render_device, &source), #[cfg(feature = "debug_gpu")] debug_gpu: gaussian_cloud, }) } - fn asset_usage(&self) -> RenderAssetUsages { + fn asset_usage(_: &Self::SourceAsset) -> RenderAssetUsages { RenderAssetUsages::default() } } @@ -268,12 +270,10 @@ fn queue_gaussians( custom_pipeline: Res, mut pipelines: ResMut>, pipeline_cache: Res, - gaussian_clouds: Res>, - sorted_entries: Res>, - mut views: Query<( - &ExtractedView, - &mut RenderPhase, - )>, + gaussian_clouds: Res>, + sorted_entries: Res>, + mut transparent_render_phases: ResMut>, + mut views: Query<(Entity, &ExtractedView)>, msaa: Res, gaussian_splatting_bundles: Query, ) { @@ -284,10 +284,11 @@ fn queue_gaussians( let draw_custom = transparent_3d_draw_functions.read().id::(); - for ( - _view, - mut transparent_phase, - ) in &mut views { + for (view_entity, _view) in &mut views { + let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else { + continue; + }; + for ( entity, cloud_handle, @@ -324,7 +325,7 @@ fn queue_gaussians( // .distance_translation(&mesh_instance.transforms.transform.translation), pipeline, batch_range: 0..1, - dynamic_offset: None, + extra_index: PhaseItemExtraIndex::NONE, }); } } @@ -668,7 +669,7 @@ pub fn extract_gaussians( mut commands: Commands, mut prev_commands_len: Local, asset_server: Res, - gaussian_cloud_res: Res>, + gaussian_cloud_res: Res>, gaussians_query: Extract< Query<( Entity, @@ -744,12 +745,12 @@ fn queue_gaussian_bind_group( render_device: Res, gaussian_uniforms: Res>, asset_server: Res, - gaussian_cloud_res: Res>, - sorted_entries_res: Res>, + gaussian_cloud_res: Res>, + sorted_entries_res: Res>, gaussian_clouds: Query, #[cfg(feature = "buffer_texture")] - gpu_images: Res>, + gpu_images: Res>, ) { let Some(model) = gaussian_uniforms.buffer() else { return; @@ -857,7 +858,6 @@ pub fn queue_gaussian_view_bind_groups( views: Query<( Entity, &ExtractedView, - &mut RenderPhase, )>, globals_buffer: Res, ) { @@ -871,9 +871,7 @@ pub fn queue_gaussian_view_bind_groups( for ( entity, _extracted_view, - _render_phase, - ) in &views - { + ) in &views { let layout = &gaussian_cloud_pipeline.view_layout; let entries = vec![ @@ -958,7 +956,7 @@ impl RenderCommand

for SetGaussianUniformBindGr pub struct DrawGaussianInstanced; impl RenderCommand

for DrawGaussianInstanced { - type Param = SRes>; + type Param = SRes>; type ViewQuery = (); type ItemQuery = ( Read>, diff --git a/src/render/texture.rs b/src/render/texture.rs index 0a5fb260..b174fa38 100644 --- a/src/render/texture.rs +++ b/src/render/texture.rs @@ -115,7 +115,7 @@ pub fn queue_gpu_texture_buffers( // gaussian_cloud_pipeline: Res, pipeline: ResMut, render_device: ResMut, - gpu_images: Res>, + gpu_images: Res>, clouds: Query<( Entity, &TextureBuffers, diff --git a/src/render/transform.wgsl b/src/render/transform.wgsl index 5f9b943b..f6c52715 100644 --- a/src/render/transform.wgsl +++ b/src/render/transform.wgsl @@ -4,15 +4,10 @@ fn world_to_clip(world_pos: vec3) -> vec4 { - let homogenous_pos = view.projection * view.inverse_view * vec4(world_pos, 1.0); + let homogenous_pos = view.clip_from_world * vec4(world_pos, 1.0); return homogenous_pos / (homogenous_pos.w + 0.000000001); } -// fn world_to_clip(world_pos: vec3) -> vec4 { -// let homogenous_pos = view.unjittered_view_proj * vec4(world_pos, 1.0); -// return homogenous_pos / (homogenous_pos.w + 0.000000001); -// } - fn in_frustum(clip_space_pos: vec3) -> bool { return abs(clip_space_pos.x) < 1.1 diff --git a/src/sort/mod.rs b/src/sort/mod.rs index 2143cd6c..fba19dcc 100644 --- a/src/sort/mod.rs +++ b/src/sort/mod.rs @@ -104,7 +104,7 @@ impl Plugin for SortPlugin { app.init_asset::(); app.register_asset_reflect::(); - app.add_plugins(RenderAssetPlugin::::default()); + app.add_plugins(RenderAssetPlugin::::default()); app.add_systems(Update, auto_insert_sorted_entries); @@ -244,32 +244,32 @@ pub struct SortedEntries { pub texture: Handle, } -impl RenderAsset for SortedEntries { - type PreparedAsset = GpuSortedEntry; +impl RenderAsset for GpuSortedEntry { + type SourceAsset = SortedEntries; type Param = SRes; fn prepare_asset( - self, + source: Self::SourceAsset, render_device: &mut SystemParamItem, - ) -> Result> { + ) -> Result> { let sorted_entry_buffer = render_device.create_buffer_with_data(&BufferInitDescriptor { label: Some("sorted_entry_buffer"), - contents: bytemuck::cast_slice(self.sorted.as_slice()), + contents: bytemuck::cast_slice(source.sorted.as_slice()), usage: BufferUsages::COPY_SRC | BufferUsages::COPY_DST | BufferUsages::STORAGE, }); - let count = self.sorted.len(); + let count = source.sorted.len(); Ok(GpuSortedEntry { sorted_entry_buffer, count, #[cfg(feature = "buffer_texture")] - texture: self.texture, + texture: source.texture, }) } - fn asset_usage(&self) -> RenderAssetUsages { + fn asset_usage(_: &Self::SourceAsset) -> RenderAssetUsages { RenderAssetUsages::default() } } diff --git a/src/sort/radix.rs b/src/sort/radix.rs index cd85112a..4dc4220e 100644 --- a/src/sort/radix.rs +++ b/src/sort/radix.rs @@ -65,6 +65,7 @@ use crate::{ shader_defs, }, sort::{ + GpuSortedEntry, SortEntry, SortedEntries, SortMode, @@ -107,7 +108,7 @@ impl Plugin for RadixSortPlugin { Shader::from_wgsl ); - if let Ok(render_app) = app.get_sub_app_mut(RenderApp) { + if let Some(render_app) = app.get_sub_app_mut(RenderApp) { render_app .add_render_graph_node::( Core3d, @@ -123,7 +124,7 @@ impl Plugin for RadixSortPlugin { .add_systems( Render, ( - queue_radix_bind_group.in_set(RenderSet::QueueMeshes), + queue_radix_bind_group.in_set(RenderSet::Queue), ), ); @@ -133,7 +134,7 @@ impl Plugin for RadixSortPlugin { } fn finish(&self, app: &mut App) { - if let Ok(render_app) = app.get_sub_app_mut(RenderApp) { + if let Some(render_app) = app.get_sub_app_mut(RenderApp) { render_app .init_resource::(); } @@ -205,7 +206,7 @@ impl GpuRadixBuffers { fn update_sort_buffers( - gpu_gaussian_clouds: Res>, + gpu_gaussian_clouds: Res>, mut sort_buffers: ResMut, render_device: Res, ) { @@ -364,8 +365,8 @@ pub fn queue_radix_bind_group( radix_pipeline: Res, render_device: Res, asset_server: Res, - gaussian_cloud_res: Res>, - sorted_entries_res: Res>, + gaussian_cloud_res: Res>, + sorted_entries_res: Res>, gaussian_clouds: Query<( Entity, &Handle, @@ -566,7 +567,7 @@ impl Node for RadixSortNode { cloud_bind_group, radix_bind_group, ) in self.gaussian_clouds.iter_manual(world) { - let cloud = world.get_resource::>().unwrap().get(cloud_handle).unwrap(); + let cloud = world.get_resource::>().unwrap().get(cloud_handle).unwrap(); assert!(sort_buffers.asset_map.contains_key(&cloud_handle.id())); let sorting_assets = &sort_buffers.asset_map[&cloud_handle.id()]; diff --git a/tests/gpu/radix.rs b/tests/gpu/radix.rs index fcd5c4c8..cb0eceeb 100644 --- a/tests/gpu/radix.rs +++ b/tests/gpu/radix.rs @@ -30,7 +30,7 @@ use bevy::{ RenderGraphApp, RenderGraphContext, }, - render_phase::RenderPhase, + render_phase::SortedRenderPhase, view::ExtractedView, }, }; @@ -65,7 +65,7 @@ fn main() { app.add_systems(Startup, setup); - if let Ok(render_app) = app.get_sub_app_mut(RenderApp) { + if let Some(render_app) = app.get_sub_app_mut(RenderApp) { render_app .add_render_graph_node::( CORE_3D, @@ -117,7 +117,7 @@ pub struct RadixTestNode { state: TestStateArc, views: QueryState<( &'static ExtractedView, - &'static RenderPhase, + &'static SortedRenderPhase, )>, start_frame: u32, } @@ -171,8 +171,8 @@ impl Node for RadixTestNode { cloud_handle, sorted_entries_handle, ) in self.gaussian_clouds.iter_manual(world) { - let gaussian_cloud_res = world.get_resource::>().unwrap(); - let sorted_entries_res = world.get_resource::>().unwrap(); + let gaussian_cloud_res = world.get_resource::>().unwrap(); + let sorted_entries_res = world.get_resource::>().unwrap(); let mut state = self.state.lock().unwrap(); if gaussian_cloud_res.get(cloud_handle).is_none() || sorted_entries_res.get(sorted_entries_handle).is_none() { diff --git a/tools/compare_aabb_obb.rs b/tools/compare_aabb_obb.rs index da1f1122..5c3b2668 100644 --- a/tools/compare_aabb_obb.rs +++ b/tools/compare_aabb_obb.rs @@ -105,7 +105,7 @@ fn compare_aabb_obb_app() { let mut app = App::new(); // setup for gaussian viewer app - app.insert_resource(ClearColor(Color::rgb_u8(0, 0, 0))); + app.insert_resource(ClearColor(Color::srgb_u8(0, 0, 0))); app.add_plugins( DefaultPlugins .set(ImagePlugin::default_nearest()) @@ -144,7 +144,7 @@ pub fn esc_close( mut exit: EventWriter ) { if keys.just_pressed(KeyCode::Escape) { - exit.send(AppExit); + exit.send(AppExit::Success); } } diff --git a/viewer/viewer.rs b/viewer/viewer.rs index d96ed915..47cdba37 100644 --- a/viewer/viewer.rs +++ b/viewer/viewer.rs @@ -4,6 +4,7 @@ use std::path::PathBuf; use bevy::{ prelude::*, app::AppExit, + color::palettes::css::GOLD, core::FrameCount, core_pipeline::tonemapping::Tonemapping, diagnostic::{ @@ -212,7 +213,7 @@ fn example_app() { }); // setup for gaussian viewer app - app.insert_resource(ClearColor(Color::rgb_u8(0, 0, 0))); + app.insert_resource(ClearColor(Color::srgb_u8(0, 0, 0))); app.add_plugins( DefaultPlugins .set(ImagePlugin::default_nearest()) @@ -302,7 +303,7 @@ pub fn press_esc_close( mut exit: EventWriter ) { if keys.just_pressed(KeyCode::Escape) { - exit.send(AppExit); + exit.send(AppExit::Success); } } @@ -345,7 +346,7 @@ fn fps_display_setup( TextSection::from_style(TextStyle { font: asset_server.load("fonts/Caveat-Medium.ttf"), font_size: 60.0, - color: Color::GOLD, + color: Color::Srgba(GOLD), }), ]).with_style(Style { position_type: PositionType::Absolute,