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

Use wildcard imports in bevy_pbr #9847

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 1 addition & 4 deletions crates/bevy_pbr/src/environment_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ use bevy_reflect::Reflect;
use bevy_render::{
extract_component::{ExtractComponent, ExtractComponentPlugin},
render_asset::RenderAssets,
render_resource::{
BindGroupLayoutEntry, BindingType, Sampler, SamplerBindingType, Shader, ShaderStages,
TextureSampleType, TextureView, TextureViewDimension,
},
render_resource::*,
texture::{FallbackImageCubemap, Image},
};

Expand Down
7 changes: 1 addition & 6 deletions crates/bevy_pbr/src/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,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.
///
Expand Down
19 changes: 4 additions & 15 deletions crates/bevy_pbr/src/material.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use crate::{
render, AlphaMode, DrawMesh, DrawPrepass, EnvironmentMapLight, MeshPipeline, MeshPipelineKey,
PrepassPipelinePlugin, PrepassPlugin, RenderMeshInstances, ScreenSpaceAmbientOcclusionSettings,
SetMeshBindGroup, SetMeshViewBindGroup, Shadow, ShadowFilteringMethod,
};
use crate::*;
use bevy_app::{App, Plugin};
use bevy_asset::{Asset, AssetApp, AssetEvent, AssetId, AssetServer, Assets, Handle};
use bevy_core_pipeline::{
Expand All @@ -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, BindGroupId, BindGroupLayout,
OwnedBindingResource, PipelineCache, RenderPipelineDescriptor, Shader, ShaderRef,
SpecializedMeshPipeline, SpecializedMeshPipelineError, SpecializedMeshPipelines,
},
render_phase::*,
render_resource::*,
renderer::RenderDevice,
texture::FallbackImage,
view::{ExtractedView, Msaa, VisibleEntities},
Expand All @@ -42,7 +31,7 @@ use bevy_utils::{tracing::error, HashMap, HashSet};
use std::hash::Hash;
use std::marker::PhantomData;

/// Materials are used alongside [`MaterialPlugin`] and [`MaterialMeshBundle`](crate::MaterialMeshBundle)
/// Materials are used alongside [`MaterialPlugin`] and [`MaterialMeshBundle`]
/// to spawn entities that are rendered with a specific [`Material`] type. They serve as an easy to use high level
/// way to render [`Mesh`] entities with custom shader logic.
///
Expand Down
8 changes: 3 additions & 5 deletions crates/bevy_pbr/src/pbr_material.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
use crate::{
deferred::DEFAULT_PBR_DEFERRED_LIGHTING_PASS_ID, AlphaMode, Material, MaterialPipeline,
MaterialPipelineKey, OpaqueRendererMethod, ParallaxMappingMethod, PBR_PREPASS_SHADER_HANDLE,
PBR_SHADER_HANDLE,
};
use bevy_asset::{Asset, Handle};
use bevy_math::Vec4;
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
Expand All @@ -11,6 +6,9 @@ use bevy_render::{
texture::Image,
};

use crate::deferred::DEFAULT_PBR_DEFERRED_LIGHTING_PASS_ID;
use crate::*;

/// A material with "standard" properties used in PBR lighting
/// Standard property values with pictures here
/// <https://google.github.io/filament/Material%20Properties.pdf>.
Expand Down
36 changes: 5 additions & 31 deletions crates/bevy_pbr/src/prepass/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,8 @@ pub use prepass_bindings::*;

use bevy_app::{Plugin, PreUpdate};
use bevy_asset::{load_internal_asset, AssetServer, Handle};
use bevy_core_pipeline::{
core_3d::CORE_3D_DEPTH_FORMAT,
deferred::{
AlphaMask3dDeferred, Opaque3dDeferred, DEFERRED_LIGHTING_PASS_ID_FORMAT,
DEFERRED_PREPASS_FORMAT,
},
prelude::Camera3d,
prepass::{
AlphaMask3dPrepass, DeferredPrepass, DepthPrepass, MotionVectorPrepass, NormalPrepass,
Opaque3dPrepass, MOTION_VECTOR_PREPASS_FORMAT, NORMAL_PREPASS_FORMAT,
},
};
use bevy_core_pipeline::{core_3d::CORE_3D_DEPTH_FORMAT, prelude::Camera3d};
use bevy_core_pipeline::{deferred::*, prepass::*};
use bevy_ecs::{
prelude::*,
system::{
Expand All @@ -30,32 +20,16 @@ use bevy_render::{
mesh::MeshVertexBufferLayout,
prelude::{Camera, Mesh},
render_asset::RenderAssets,
render_phase::{
AddRenderCommand, DrawFunctions, PhaseItem, RenderCommand, RenderCommandResult,
RenderPhase, SetItemPipeline, TrackedRenderPass,
},
render_resource::{
BindGroup, BindGroupEntries, BindGroupLayout, BindGroupLayoutDescriptor,
BindGroupLayoutEntry, BindingType, BufferBindingType, ColorTargetState, ColorWrites,
CompareFunction, DepthBiasState, DepthStencilState, DynamicUniformBuffer, FragmentState,
FrontFace, MultisampleState, PipelineCache, PolygonMode, PrimitiveState, PushConstantRange,
RenderPipelineDescriptor, Shader, ShaderRef, ShaderStages, ShaderType,
SpecializedMeshPipeline, SpecializedMeshPipelineError, SpecializedMeshPipelines,
StencilFaceState, StencilState, VertexState,
},
render_phase::*,
render_resource::*,
renderer::{RenderDevice, RenderQueue},
view::{ExtractedView, Msaa, ViewUniform, ViewUniformOffset, ViewUniforms, VisibleEntities},
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
};
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,
OpaqueRendererMethod, RenderMaterialInstances, RenderMaterials, RenderMeshInstances,
SetMaterialBindGroup, SetMeshBindGroup,
};
use crate::*;

use std::{hash::Hash, marker::PhantomData};

Expand Down
14 changes: 3 additions & 11 deletions crates/bevy_pbr/src/render/light.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
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,
PointLight, PointLightShadowMap, PrepassPipeline, RenderMaterialInstances, RenderMaterials,
RenderMeshInstances, SpotLight, VisiblePointLights,
};
use bevy_core_pipeline::core_3d::{Transparent3d, CORE_3D_DEPTH_FORMAT};
use bevy_ecs::prelude::*;
use bevy_math::{Mat4, UVec3, UVec4, Vec2, Vec3, Vec3Swizzles, Vec4, Vec4Swizzles};
Expand All @@ -15,9 +7,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::*,
Expand All @@ -32,6 +22,8 @@ use bevy_utils::{
};
use std::{hash::Hash, num::NonZeroU64, ops::Range};

use crate::*;

#[derive(Component)]
pub struct ExtractedPointLight {
color: Color,
Expand Down
17 changes: 3 additions & 14 deletions crates/bevy_pbr/src/render/mesh.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
use crate::{
generate_view_layouts, prepare_mesh_view_bind_groups, MaterialBindGroupId,
MeshPipelineViewLayout, MeshPipelineViewLayoutKey, MeshViewBindGroup, NotShadowCaster,
NotShadowReceiver, PreviousGlobalTransform, Shadow, ViewFogUniformOffset,
ViewLightsUniformOffset, CLUSTERED_FORWARD_STORAGE_BUFFER_COUNT, MAX_CASCADES_PER_LIGHT,
MAX_DIRECTIONAL_LIGHTS,
};
use bevy_app::{Plugin, PostUpdate};
use bevy_asset::{load_internal_asset, AssetId, Handle};
use bevy_core_pipeline::{
Expand All @@ -23,17 +16,12 @@ use bevy_render::{
batch_and_prepare_render_phase, write_batched_instance_buffer, GetBatchData,
NoAutomaticBatching,
},
mesh::{
GpuBufferInfo, InnerMeshVertexBufferLayout, Mesh, MeshVertexBufferLayout,
VertexAttributeDescriptor,
},
mesh::*,
render_asset::RenderAssets,
render_phase::{PhaseItem, RenderCommand, RenderCommandResult, TrackedRenderPass},
render_resource::*,
renderer::{RenderDevice, RenderQueue},
texture::{
BevyDefault, DefaultImageSampler, GpuImage, Image, ImageSampler, TextureFormatPixelInfo,
},
texture::*,
view::{ViewTarget, ViewUniformOffset, ViewVisibility},
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
};
Expand All @@ -58,6 +46,7 @@ use crate::render::{
skin::{extract_skins, no_automatic_skin_batching, prepare_skins, SkinUniform},
MeshLayouts,
};
use crate::*;

use super::skin::SkinIndices;

Expand Down
10 changes: 2 additions & 8 deletions crates/bevy_pbr/src/render/mesh_bindings.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
//! Bind group layout related definitions for the mesh pipeline.

use bevy_math::Mat4;
use bevy_render::{
mesh::morph::MAX_MORPH_WEIGHTS,
render_resource::{
BindGroup, BindGroupLayout, BindGroupLayoutDescriptor, BindingResource, Buffer, TextureView,
},
renderer::RenderDevice,
};
use bevy_render::{mesh::morph::MAX_MORPH_WEIGHTS, render_resource::*, renderer::RenderDevice};

use crate::render::skin::MAX_JOINTS;

Expand Down Expand Up @@ -67,7 +61,7 @@ mod layout_entry {
}
}
}
/// Individual [`BindGroupEntry`](bevy_render::render_resource::BindGroupEntry)
/// Individual [`BindGroupEntry`]
/// for bind groups.
mod entry {
use super::{JOINT_BUFFER_SIZE, MORPH_BUFFER_SIZE};
Expand Down
10 changes: 1 addition & 9 deletions crates/bevy_pbr/src/ssao/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,7 @@ use bevy_render::{
globals::{GlobalsBuffer, GlobalsUniform},
prelude::Camera,
render_graph::{NodeRunError, RenderGraphApp, RenderGraphContext, ViewNode, ViewNodeRunner},
render_resource::{
AddressMode, BindGroup, BindGroupEntries, BindGroupLayout, BindGroupLayoutDescriptor,
BindGroupLayoutEntry, 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},
Expand Down
6 changes: 2 additions & 4 deletions crates/bevy_pbr/src/wireframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ use bevy_render::{
color::Color,
extract_resource::ExtractResource,
mesh::{Mesh, MeshVertexBufferLayout},
prelude::Shader,
render_resource::{
AsBindGroup, PolygonMode, RenderPipelineDescriptor, ShaderRef, SpecializedMeshPipelineError,
},
prelude::*,
render_resource::*,
};

pub const WIREFRAME_SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(192598014480025766);
Expand Down