From 30ed1257d13e2329879c8b476adf8fbd090f77fc Mon Sep 17 00:00:00 2001 From: Nicola Papale Date: Tue, 19 Sep 2023 09:04:05 +0200 Subject: [PATCH] Use wildcard imports in bevy_pbr --- crates/bevy_pbr/src/environment_map/mod.rs | 5 +--- crates/bevy_pbr/src/light.rs | 7 +---- crates/bevy_pbr/src/material.rs | 17 ++--------- crates/bevy_pbr/src/pbr_material.rs | 6 ++-- crates/bevy_pbr/src/prepass/mod.rs | 31 +++------------------ crates/bevy_pbr/src/render/light.rs | 17 ++++------- crates/bevy_pbr/src/render/mesh.rs | 24 ++++------------ crates/bevy_pbr/src/render/mesh_bindings.rs | 9 +----- crates/bevy_pbr/src/ssao/mod.rs | 11 +------- crates/bevy_pbr/src/wireframe.rs | 5 +--- 10 files changed, 24 insertions(+), 108 deletions(-) diff --git a/crates/bevy_pbr/src/environment_map/mod.rs b/crates/bevy_pbr/src/environment_map/mod.rs index bc3bda5a86c87a..2e7ca5a0a49414 100644 --- a/crates/bevy_pbr/src/environment_map/mod.rs +++ b/crates/bevy_pbr/src/environment_map/mod.rs @@ -6,10 +6,7 @@ use bevy_reflect::Reflect; use bevy_render::{ extract_component::{ExtractComponent, ExtractComponentPlugin}, render_asset::RenderAssets, - render_resource::{ - BindGroupEntry, BindGroupLayoutEntry, BindingResource, BindingType, SamplerBindingType, - Shader, ShaderStages, TextureSampleType, TextureViewDimension, - }, + render_resource::*, texture::{FallbackImageCubemap, Image}, }; diff --git a/crates/bevy_pbr/src/light.rs b/crates/bevy_pbr/src/light.rs index d68036a8308485..af3fdf023c6eb3 100644 --- a/crates/bevy_pbr/src/light.rs +++ b/crates/bevy_pbr/src/light.rs @@ -16,12 +16,7 @@ use bevy_render::{ use bevy_transform::{components::GlobalTransform, prelude::Transform}; use bevy_utils::{tracing::warn, HashMap}; -use crate::{ - calculate_cluster_factors, spot_light_projection_matrix, spot_light_view_matrix, - CascadesVisibleEntities, CubeMapFace, CubemapVisibleEntities, ViewClusterBindings, - CLUSTERED_FORWARD_STORAGE_BUFFER_COUNT, CUBE_MAP_FACES, MAX_UNIFORM_BUFFER_POINT_LIGHTS, - POINT_LIGHT_NEAR_Z, -}; +use crate::*; /// A light that emits light in all directions from a central point. /// diff --git a/crates/bevy_pbr/src/material.rs b/crates/bevy_pbr/src/material.rs index 8f6c59ce0f7c34..5caf70ac6bf749 100644 --- a/crates/bevy_pbr/src/material.rs +++ b/crates/bevy_pbr/src/material.rs @@ -1,8 +1,4 @@ -use crate::{ - render, AlphaMode, DrawMesh, DrawPrepass, EnvironmentMapLight, MeshPipeline, MeshPipelineKey, - MeshTransforms, PrepassPipelinePlugin, PrepassPlugin, ScreenSpaceAmbientOcclusionSettings, - SetMeshBindGroup, SetMeshViewBindGroup, Shadow, -}; +use crate::*; use bevy_app::{App, Plugin}; use bevy_asset::{Asset, AssetApp, AssetEvent, AssetId, AssetServer, Assets, Handle}; use bevy_core_pipeline::{ @@ -24,15 +20,8 @@ use bevy_render::{ mesh::{Mesh, MeshVertexBufferLayout}, prelude::Image, render_asset::{prepare_assets, RenderAssets}, - render_phase::{ - AddRenderCommand, DrawFunctions, PhaseItem, RenderCommand, RenderCommandResult, - RenderPhase, SetItemPipeline, TrackedRenderPass, - }, - render_resource::{ - AsBindGroup, AsBindGroupError, BindGroup, BindGroupLayout, OwnedBindingResource, - PipelineCache, RenderPipelineDescriptor, Shader, ShaderRef, SpecializedMeshPipeline, - SpecializedMeshPipelineError, SpecializedMeshPipelines, - }, + render_phase::*, + render_resource::*, renderer::RenderDevice, texture::FallbackImage, view::{ExtractedView, Msaa, VisibleEntities}, diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index f979765c5d4719..514e0983eadd4a 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -1,7 +1,3 @@ -use crate::{ - AlphaMode, Material, MaterialPipeline, MaterialPipelineKey, ParallaxMappingMethod, - PBR_PREPASS_SHADER_HANDLE, PBR_SHADER_HANDLE, -}; use bevy_asset::{Asset, Handle}; use bevy_math::Vec4; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; @@ -10,6 +6,8 @@ use bevy_render::{ texture::Image, }; +use crate::*; + /// A material with "standard" properties used in PBR lighting /// Standard property values with pictures here /// . diff --git a/crates/bevy_pbr/src/prepass/mod.rs b/crates/bevy_pbr/src/prepass/mod.rs index 3c9bdd7ddb4ec8..1116104d9dc164 100644 --- a/crates/bevy_pbr/src/prepass/mod.rs +++ b/crates/bevy_pbr/src/prepass/mod.rs @@ -1,13 +1,6 @@ use bevy_app::{Plugin, PreUpdate}; use bevy_asset::{load_internal_asset, AssetServer, Handle}; -use bevy_core_pipeline::{ - prelude::Camera3d, - prepass::{ - AlphaMask3dPrepass, DepthPrepass, MotionVectorPrepass, NormalPrepass, Opaque3dPrepass, - ViewPrepassTextures, DEPTH_PREPASS_FORMAT, MOTION_VECTOR_PREPASS_FORMAT, - NORMAL_PREPASS_FORMAT, - }, -}; +use bevy_core_pipeline::{prelude::Camera3d, prepass::*}; use bevy_ecs::{ prelude::*, system::{ @@ -21,20 +14,8 @@ use bevy_render::{ mesh::MeshVertexBufferLayout, prelude::{Camera, Mesh}, render_asset::RenderAssets, - render_phase::{ - AddRenderCommand, DrawFunctions, PhaseItem, RenderCommand, RenderCommandResult, - RenderPhase, SetItemPipeline, TrackedRenderPass, - }, - render_resource::{ - BindGroup, BindGroupDescriptor, BindGroupEntry, BindGroupLayout, BindGroupLayoutDescriptor, - BindGroupLayoutEntry, BindingResource, BindingType, BlendState, BufferBindingType, - ColorTargetState, ColorWrites, CompareFunction, DepthBiasState, DepthStencilState, - DynamicUniformBuffer, FragmentState, FrontFace, MultisampleState, PipelineCache, - PolygonMode, PrimitiveState, PushConstantRange, RenderPipelineDescriptor, Shader, - ShaderRef, ShaderStages, ShaderType, SpecializedMeshPipeline, SpecializedMeshPipelineError, - SpecializedMeshPipelines, StencilFaceState, StencilState, TextureSampleType, - TextureViewDimension, VertexState, - }, + render_phase::*, + render_resource::*, renderer::{RenderDevice, RenderQueue}, texture::{FallbackImagesDepth, FallbackImagesMsaa}, view::{ExtractedView, Msaa, ViewUniform, ViewUniformOffset, ViewUniforms, VisibleEntities}, @@ -43,11 +24,7 @@ use bevy_render::{ use bevy_transform::prelude::GlobalTransform; use bevy_utils::tracing::error; -use crate::{ - prepare_materials, setup_morph_and_skinning_defs, AlphaMode, DrawMesh, Material, - MaterialPipeline, MaterialPipelineKey, MeshLayouts, MeshPipeline, MeshPipelineKey, - MeshTransforms, RenderMaterials, SetMaterialBindGroup, SetMeshBindGroup, -}; +use crate::*; use std::{hash::Hash, marker::PhantomData}; diff --git a/crates/bevy_pbr/src/render/light.rs b/crates/bevy_pbr/src/render/light.rs index a9d0cef47a7b60..c47d87a05eb463 100644 --- a/crates/bevy_pbr/src/render/light.rs +++ b/crates/bevy_pbr/src/render/light.rs @@ -1,11 +1,5 @@ -use crate::{ - directional_light_order, point_light_order, AlphaMode, AmbientLight, Cascade, - CascadeShadowConfig, Cascades, CascadesVisibleEntities, Clusters, CubemapVisibleEntities, - DirectionalLight, DirectionalLightShadowMap, DrawPrepass, EnvironmentMapLight, - GlobalVisiblePointLights, Material, MaterialPipelineKey, MeshPipeline, MeshPipelineKey, - NotShadowCaster, PointLight, PointLightShadowMap, PrepassPipeline, RenderMaterials, SpotLight, - VisiblePointLights, -}; +use std::{hash::Hash, num::NonZeroU64}; + use bevy_asset::Handle; use bevy_core_pipeline::core_3d::Transparent3d; use bevy_ecs::prelude::*; @@ -16,9 +10,7 @@ use bevy_render::{ mesh::Mesh, render_asset::RenderAssets, render_graph::{Node, NodeRunError, RenderGraphContext}, - render_phase::{ - CachedRenderPipelinePhaseItem, DrawFunctionId, DrawFunctions, PhaseItem, RenderPhase, - }, + render_phase::*, render_resource::*, renderer::{RenderContext, RenderDevice, RenderQueue}, texture::*, @@ -30,7 +22,8 @@ use bevy_utils::{ tracing::{error, warn}, HashMap, }; -use std::{hash::Hash, num::NonZeroU64}; + +use crate::*; #[derive(Component)] pub struct ExtractedPointLight { diff --git a/crates/bevy_pbr/src/render/mesh.rs b/crates/bevy_pbr/src/render/mesh.rs index a8127d0ce59ea3..b9321135bdc048 100644 --- a/crates/bevy_pbr/src/render/mesh.rs +++ b/crates/bevy_pbr/src/render/mesh.rs @@ -1,18 +1,9 @@ -use crate::{ - environment_map, prepass, EnvironmentMapLight, FogMeta, GlobalLightMeta, GpuFog, GpuLights, - GpuPointLights, LightMeta, NotShadowCaster, NotShadowReceiver, PreviousGlobalTransform, - ScreenSpaceAmbientOcclusionTextures, Shadow, ShadowSamplers, ViewClusterBindings, - ViewFogUniformOffset, ViewLightsUniformOffset, ViewShadowBindings, - CLUSTERED_FORWARD_STORAGE_BUFFER_COUNT, MAX_CASCADES_PER_LIGHT, MAX_DIRECTIONAL_LIGHTS, -}; use bevy_app::Plugin; use bevy_asset::{load_internal_asset, AssetId, Assets, Handle}; use bevy_core_pipeline::{ core_3d::{AlphaMask3d, Opaque3d, Transparent3d}, prepass::ViewPrepassTextures, - tonemapping::{ - get_lut_bind_group_layout_entries, get_lut_bindings, Tonemapping, TonemappingLuts, - }, + tonemapping::*, }; use bevy_ecs::{ prelude::*, @@ -22,20 +13,14 @@ use bevy_ecs::{ use bevy_math::{Affine3, Affine3A, Mat4, Vec2, Vec3Swizzles, Vec4}; use bevy_render::{ globals::{GlobalsBuffer, GlobalsUniform}, - mesh::{ - skinning::{SkinnedMesh, SkinnedMeshInverseBindposes}, - GpuBufferInfo, InnerMeshVertexBufferLayout, Mesh, MeshVertexBufferLayout, - VertexAttributeDescriptor, - }, + mesh::skinning::{SkinnedMesh, SkinnedMeshInverseBindposes}, + mesh::*, prelude::Msaa, render_asset::RenderAssets, render_phase::{PhaseItem, RenderCommand, RenderCommandResult, RenderPhase, TrackedRenderPass}, render_resource::*, renderer::{RenderDevice, RenderQueue}, - texture::{ - BevyDefault, DefaultImageSampler, FallbackImageCubemap, FallbackImagesDepth, - FallbackImagesMsaa, GpuImage, Image, ImageSampler, TextureFormatPixelInfo, - }, + texture::*, view::{ViewTarget, ViewUniform, ViewUniformOffset, ViewUniforms, ViewVisibility}, Extract, ExtractSchedule, Render, RenderApp, RenderSet, }; @@ -47,6 +32,7 @@ use crate::render::{ morph::{extract_morphs, prepare_morphs, MorphIndex, MorphUniform}, MeshLayouts, }; +use crate::*; #[derive(Default)] pub struct MeshRenderPlugin; diff --git a/crates/bevy_pbr/src/render/mesh_bindings.rs b/crates/bevy_pbr/src/render/mesh_bindings.rs index e46af242fdf855..ed3ba94501ae0b 100644 --- a/crates/bevy_pbr/src/render/mesh_bindings.rs +++ b/crates/bevy_pbr/src/render/mesh_bindings.rs @@ -1,13 +1,6 @@ //! Bind group layout related definitions for the mesh pipeline. -use bevy_render::{ - mesh::morph::MAX_MORPH_WEIGHTS, - render_resource::{ - BindGroup, BindGroupDescriptor, BindGroupLayout, BindGroupLayoutDescriptor, - BindingResource, Buffer, TextureView, - }, - renderer::RenderDevice, -}; +use bevy_render::{mesh::morph::MAX_MORPH_WEIGHTS, render_resource::*, renderer::RenderDevice}; const MORPH_WEIGHT_SIZE: usize = std::mem::size_of::(); pub const MORPH_BUFFER_SIZE: usize = MAX_MORPH_WEIGHTS * MORPH_WEIGHT_SIZE; diff --git a/crates/bevy_pbr/src/ssao/mod.rs b/crates/bevy_pbr/src/ssao/mod.rs index 3a31c0afbe6209..bbb91f4e6fbe2d 100644 --- a/crates/bevy_pbr/src/ssao/mod.rs +++ b/crates/bevy_pbr/src/ssao/mod.rs @@ -20,16 +20,7 @@ use bevy_render::{ globals::{GlobalsBuffer, GlobalsUniform}, prelude::Camera, render_graph::{NodeRunError, RenderGraphApp, RenderGraphContext, ViewNode, ViewNodeRunner}, - render_resource::{ - AddressMode, BindGroup, BindGroupDescriptor, BindGroupEntry, BindGroupLayout, - BindGroupLayoutDescriptor, BindGroupLayoutEntry, BindingResource, BindingType, - BufferBindingType, CachedComputePipelineId, ComputePassDescriptor, - ComputePipelineDescriptor, Extent3d, FilterMode, PipelineCache, Sampler, - SamplerBindingType, SamplerDescriptor, Shader, ShaderDefVal, ShaderStages, ShaderType, - SpecializedComputePipeline, SpecializedComputePipelines, StorageTextureAccess, - TextureDescriptor, TextureDimension, TextureFormat, TextureSampleType, TextureUsages, - TextureView, TextureViewDescriptor, TextureViewDimension, - }, + render_resource::*, renderer::{RenderAdapter, RenderContext, RenderDevice, RenderQueue}, texture::{CachedTexture, TextureCache}, view::{Msaa, ViewUniform, ViewUniformOffset, ViewUniforms}, diff --git a/crates/bevy_pbr/src/wireframe.rs b/crates/bevy_pbr/src/wireframe.rs index e62ac1ae857d58..0a920e65e2c040 100644 --- a/crates/bevy_pbr/src/wireframe.rs +++ b/crates/bevy_pbr/src/wireframe.rs @@ -13,10 +13,7 @@ use bevy_render::{ mesh::{Mesh, MeshVertexBufferLayout}, render_asset::RenderAssets, render_phase::{AddRenderCommand, DrawFunctions, RenderPhase, SetItemPipeline}, - render_resource::{ - PipelineCache, PolygonMode, RenderPipelineDescriptor, Shader, SpecializedMeshPipeline, - SpecializedMeshPipelineError, SpecializedMeshPipelines, - }, + render_resource::*, view::{ExtractedView, Msaa, VisibleEntities}, RenderApp, RenderSet, };