diff --git a/examples/simple_new.rs b/examples/simple_new.rs index 12aefe3bd1..17daf6d47e 100644 --- a/examples/simple_new.rs +++ b/examples/simple_new.rs @@ -1,5 +1,7 @@ -use bevy::prelude::*; -use bevy::render::render_graph_2::{ShaderUniforms, StandardMaterial}; +use bevy::{ + prelude::*, + render::render_graph_2::{ShaderUniforms, StandardMaterial}, +}; fn main() { AppBuilder::new().add_defaults().setup_world(setup).run(); diff --git a/examples/simple_new_graph.rs b/examples/simple_new_graph.rs index cf8b087677..953f169fd6 100644 --- a/examples/simple_new_graph.rs +++ b/examples/simple_new_graph.rs @@ -1,5 +1,7 @@ -use bevy::prelude::*; -use bevy::render::render_graph_2::{uniform_selector, ShaderUniforms, StandardMaterial}; +use bevy::{ + prelude::*, + render::render_graph_2::{uniform_selector, ShaderUniforms, StandardMaterial}, +}; use rand::{rngs::StdRng, Rng, SeedableRng}; use std::collections::VecDeque; diff --git a/examples/ui_new.rs b/examples/ui_new.rs index 89b4bf2a05..68c2a2ef58 100644 --- a/examples/ui_new.rs +++ b/examples/ui_new.rs @@ -1,5 +1,7 @@ -use bevy::prelude::*; -use bevy::render::render_graph_2::{ShaderUniforms, StandardMaterial}; +use bevy::{ + prelude::*, + render::render_graph_2::{ShaderUniforms, StandardMaterial}, +}; fn main() { AppBuilder::new().add_defaults().setup_world(setup).run(); diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000000..2461f06545 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +merge_imports = true \ No newline at end of file diff --git a/src/app/app_builder.rs b/src/app/app_builder.rs index 5485d33697..5f46149ee4 100644 --- a/src/app/app_builder.rs +++ b/src/app/app_builder.rs @@ -4,12 +4,15 @@ use crate::{ core::Time, legion::prelude::{Runnable, Schedulable, Schedule, Universe, World}, plugin::load_plugin, - render::render_graph_2, - render::render_graph_2::{ - passes::*, pipelines::*, renderers::wgpu_renderer::WgpuRenderer, resource_providers::*, - StandardMaterial, + render::{ + passes::*, + render_graph_2, + render_graph_2::{ + passes::*, pipelines::*, renderers::wgpu_renderer::WgpuRenderer, resource_providers::*, + StandardMaterial, + }, + *, }, - render::{passes::*, *}, ui, }; diff --git a/src/asset/gltf.rs b/src/asset/gltf.rs index 34cfa5c034..1257d44567 100644 --- a/src/asset/gltf.rs +++ b/src/asset/gltf.rs @@ -1,6 +1,4 @@ -use std::boxed::Box; -use std::error::Error; -use std::{fs, io}; +use std::{boxed::Box, error::Error, fs, io}; // use crate::render::Mesh; diff --git a/src/ecs/default_archetypes.rs b/src/ecs/default_archetypes.rs index d62edbcdf7..68128ec5ad 100644 --- a/src/ecs/default_archetypes.rs +++ b/src/ecs/default_archetypes.rs @@ -1,5 +1,7 @@ -use crate::prelude::*; -use crate::render::render_graph_2::{ShaderUniforms, StandardMaterial}; +use crate::{ + prelude::*, + render::render_graph_2::{ShaderUniforms, StandardMaterial}, +}; use bevy_derive::EntityArchetype; #[derive(EntityArchetype)] diff --git a/src/prelude.rs b/src/prelude.rs index b27827362d..e177ca7b68 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -3,8 +3,7 @@ pub use crate::{ asset::{Asset, AssetStorage, Handle, Mesh, MeshType, Texture, TextureType}, core::Time, ecs, - ecs::default_archetypes::*, - ecs::{EntityArchetype, EntityBuilder, EntityBuilderSource}, + ecs::{default_archetypes::*, EntityArchetype, EntityBuilder, EntityBuilderSource}, render::{ ActiveCamera, ActiveCamera2d, Albedo, Camera, CameraType, Instanced, Light, Material, }, @@ -15,7 +14,6 @@ pub use glam as math; pub use legion::{ prelude::*, schedule::{Builder, Schedulable}, - system::SubWorld, - system::SystemBuilder, + system::{SubWorld, SystemBuilder}, }; pub use math::{Mat3, Mat4, Quat, Vec2, Vec3, Vec4}; diff --git a/src/render/passes/forward_shadow/mod.rs b/src/render/passes/forward_shadow/mod.rs index 26e5c62bd3..b07d988ccf 100644 --- a/src/render/passes/forward_shadow/mod.rs +++ b/src/render/passes/forward_shadow/mod.rs @@ -1,4 +1,7 @@ -use crate::{asset::*, render::passes::shadow, render::*}; +use crate::{ + asset::*, + render::{passes::shadow, *}, +}; use legion::prelude::*; use wgpu::SwapChainOutput; diff --git a/src/render/passes/shadow/shadow_pass.rs b/src/render/passes/shadow/shadow_pass.rs index 5e0d992ea9..efc7f32636 100644 --- a/src/render/passes/shadow/shadow_pass.rs +++ b/src/render/passes/shadow/shadow_pass.rs @@ -1,7 +1,6 @@ use crate::{ prelude::{LocalToWorld, Translation}, - render::passes::shadow, - render::*, + render::{passes::shadow, *}, }; use legion::prelude::*; use std::mem; diff --git a/src/render/render_graph_2/draw_targets/mesh_draw_target.rs b/src/render/render_graph_2/draw_targets/mesh_draw_target.rs index 62567bad5d..a32d36a9f9 100644 --- a/src/render/render_graph_2/draw_targets/mesh_draw_target.rs +++ b/src/render/render_graph_2/draw_targets/mesh_draw_target.rs @@ -56,4 +56,4 @@ pub fn mesh_draw_target(world: &World, render_pass: &mut dyn RenderPass) { let renderer = render_pass.get_renderer(); renderer.remove_buffer(resource_name::buffer::TEMP_MESH_VERTEX_BUFFER_NAME); renderer.remove_buffer(resource_name::buffer::TEMP_MESH_INDEX_BUFFER_NAME); -} \ No newline at end of file +} diff --git a/src/render/render_graph_2/draw_targets/mod.rs b/src/render/render_graph_2/draw_targets/mod.rs index f13cc7152d..84642021d2 100644 --- a/src/render/render_graph_2/draw_targets/mod.rs +++ b/src/render/render_graph_2/draw_targets/mod.rs @@ -1,5 +1,5 @@ -mod ui_draw_target; mod mesh_draw_target; +mod ui_draw_target; -pub use ui_draw_target::*; pub use mesh_draw_target::*; +pub use ui_draw_target::*; diff --git a/src/render/render_graph_2/mod.rs b/src/render/render_graph_2/mod.rs index b0d7b87273..79ba57cb4b 100644 --- a/src/render/render_graph_2/mod.rs +++ b/src/render/render_graph_2/mod.rs @@ -24,4 +24,4 @@ pub use renderer::*; pub use resource::*; pub use resource_provider::*; pub use standard_material::*; -pub use uniform::*; \ No newline at end of file +pub use uniform::*; diff --git a/src/render/render_graph_2/pipelines/forward_flat/mod.rs b/src/render/render_graph_2/pipelines/forward_flat/mod.rs index 602429cef9..7300797abf 100644 --- a/src/render/render_graph_2/pipelines/forward_flat/mod.rs +++ b/src/render/render_graph_2/pipelines/forward_flat/mod.rs @@ -1,12 +1,9 @@ use crate::render::{ - Vertex, - { - render_graph_2::{ - draw_targets::mesh_draw_target, pipeline_layout::*, PipelineDescriptor, - RenderGraphBuilder, - }, - shader::{Shader, ShaderStage}, + render_graph_2::{ + draw_targets::mesh_draw_target, pipeline_layout::*, PipelineDescriptor, RenderGraphBuilder, }, + shader::{Shader, ShaderStage}, + Vertex, }; pub trait ForwardFlatPipelineBuilder { fn add_forward_flat_pipeline(self) -> Self; diff --git a/src/render/render_graph_2/pipelines/ui/mod.rs b/src/render/render_graph_2/pipelines/ui/mod.rs index d1874bd590..12aefa3d02 100644 --- a/src/render/render_graph_2/pipelines/ui/mod.rs +++ b/src/render/render_graph_2/pipelines/ui/mod.rs @@ -1,14 +1,10 @@ -use crate::render::render_graph_2::resource_providers::RectData; -use crate::render::render_graph_2::VertexBufferDescriptor; use crate::render::{ - Vertex, - { - render_graph_2::{ - draw_targets::ui_draw_target, pipeline_layout::*, PipelineDescriptor, - RenderGraphBuilder, - }, - shader::{Shader, ShaderStage}, + render_graph_2::{ + draw_targets::ui_draw_target, pipeline_layout::*, resource_providers::RectData, + PipelineDescriptor, RenderGraphBuilder, VertexBufferDescriptor, }, + shader::{Shader, ShaderStage}, + Vertex, }; pub trait UiPipelineBuilder { fn add_ui_pipeline(self) -> Self; diff --git a/src/render/render_graph_2/resource_providers/camera2d_resource_provider.rs b/src/render/render_graph_2/resource_providers/camera2d_resource_provider.rs index 384cd68581..9c98d019f1 100644 --- a/src/render/render_graph_2/resource_providers/camera2d_resource_provider.rs +++ b/src/render/render_graph_2/resource_providers/camera2d_resource_provider.rs @@ -1,6 +1,5 @@ -use crate::render::render_graph_2::ResourceProvider; use crate::render::{ - render_graph_2::{resource_name, Renderer}, + render_graph_2::{resource_name, Renderer, ResourceProvider}, ActiveCamera2d, Camera, }; use legion::prelude::*; diff --git a/src/render/render_graph_2/resource_providers/camera_resource_provider.rs b/src/render/render_graph_2/resource_providers/camera_resource_provider.rs index c75c97fb98..8bfc6a765a 100644 --- a/src/render/render_graph_2/resource_providers/camera_resource_provider.rs +++ b/src/render/render_graph_2/resource_providers/camera_resource_provider.rs @@ -1,6 +1,5 @@ -use crate::render::render_graph_2::ResourceProvider; use crate::render::{ - render_graph_2::{resource_name, Renderer}, + render_graph_2::{resource_name, Renderer, ResourceProvider}, ActiveCamera, Camera, }; use bevy_transform::prelude::LocalToWorld; diff --git a/src/render/render_graph_2/resource_providers/frame_texture_resource_provider.rs b/src/render/render_graph_2/resource_providers/frame_texture_resource_provider.rs index abc2e799a0..4464259b49 100644 --- a/src/render/render_graph_2/resource_providers/frame_texture_resource_provider.rs +++ b/src/render/render_graph_2/resource_providers/frame_texture_resource_provider.rs @@ -1,7 +1,7 @@ -use crate::prelude::World; -use crate::render::render_graph_2::Renderer; -use crate::render::render_graph_2::ResourceProvider; -use crate::render::render_graph_2::TextureDescriptor; +use crate::{ + prelude::World, + render::render_graph_2::{Renderer, ResourceProvider, TextureDescriptor}, +}; pub struct FrameTextureResourceProvider { pub name: String, diff --git a/src/render/render_graph_2/resource_providers/light_resource_provider.rs b/src/render/render_graph_2/resource_providers/light_resource_provider.rs index ced67809b8..ff69fa3315 100644 --- a/src/render/render_graph_2/resource_providers/light_resource_provider.rs +++ b/src/render/render_graph_2/resource_providers/light_resource_provider.rs @@ -1,7 +1,7 @@ -use crate::render::render_graph_2::resource_name; -use crate::render::render_graph_2::Renderer; -use crate::render::render_graph_2::ResourceProvider; -use crate::render::{Light, LightRaw}; +use crate::render::{ + render_graph_2::{resource_name, Renderer, ResourceProvider}, + Light, LightRaw, +}; use bevy_transform::prelude::{LocalToWorld, Translation}; use legion::prelude::*; use zerocopy::AsBytes; diff --git a/src/render/render_graph_2/resource_providers/ui_resource_provider.rs b/src/render/render_graph_2/resource_providers/ui_resource_provider.rs index a5c6391782..9bd36d90a8 100644 --- a/src/render/render_graph_2/resource_providers/ui_resource_provider.rs +++ b/src/render/render_graph_2/resource_providers/ui_resource_provider.rs @@ -1,11 +1,8 @@ -use crate::asset::MeshType; -use crate::prelude::Node; -use crate::render::render_graph_2::resource_name; -use crate::render::render_graph_2::ResourceProvider; use crate::{ - asset::{Asset, AssetStorage, Handle, Mesh}, + asset::{Asset, AssetStorage, Handle, Mesh, MeshType}, ecs, math, - render::render_graph_2::Renderer, + prelude::Node, + render::render_graph_2::{resource_name, Renderer, ResourceProvider}, }; use bevy_transform::prelude::Parent; use legion::prelude::*; diff --git a/src/render/render_graph_2/standard_material.rs b/src/render/render_graph_2/standard_material.rs index bba79b98ae..cbd9e938f7 100644 --- a/src/render/render_graph_2/standard_material.rs +++ b/src/render/render_graph_2/standard_material.rs @@ -1,6 +1,9 @@ use crate::{ math::Vec4, - render::render_graph_2::{BindType, UniformPropertyType, uniform::{UniformInfo, AsUniforms, GetBytes}}, + render::render_graph_2::{ + uniform::{AsUniforms, GetBytes, UniformInfo}, + BindType, UniformPropertyType, + }, }; use zerocopy::AsBytes; @@ -9,7 +12,6 @@ pub struct StandardMaterial { pub albedo: Vec4, } - // create this from a derive macro const STANDARD_MATERIAL_UNIFORM_INFO: &[UniformInfo] = &[UniformInfo { name: "StandardMaterial", diff --git a/src/render/render_graph_2/uniform.rs b/src/render/render_graph_2/uniform.rs index 9a35ebc26a..8913de32bc 100644 --- a/src/render/render_graph_2/uniform.rs +++ b/src/render/render_graph_2/uniform.rs @@ -129,4 +129,4 @@ impl ShaderUniforms { None } -} \ No newline at end of file +} diff --git a/src/render/render_resources/global_resource_manager.rs b/src/render/render_resources/global_resource_manager.rs index 0326acfc82..025b406465 100644 --- a/src/render/render_resources/global_resource_manager.rs +++ b/src/render/render_resources/global_resource_manager.rs @@ -1,4 +1,8 @@ -use crate::{math, prelude::LocalToWorld, render::passes::ForwardUniforms, render::*}; +use crate::{ + math, + prelude::LocalToWorld, + render::{passes::ForwardUniforms, *}, +}; use legion::prelude::*; use std::mem;