Restrict more internal symbols to crate visibility.

This commit is contained in:
Robin KAY 2022-11-22 20:20:45 +00:00
parent 4a292ca6bc
commit d41057f905
5 changed files with 38 additions and 38 deletions

View File

@ -13,7 +13,7 @@ use crate::uniforms::{
};
use crate::view_uniforms::SetOutlineViewBindGroup;
pub type DrawStencil = (
pub(crate) type DrawStencil = (
SetItemPipeline,
SetMeshViewBindGroup<0>,
SetMeshBindGroup<1>,
@ -23,7 +23,7 @@ pub type DrawStencil = (
);
#[allow(clippy::too_many_arguments)]
pub fn queue_outline_stencil_mesh(
pub(crate) fn queue_outline_stencil_mesh(
stencil_draw_functions: Res<DrawFunctions<StencilOutline>>,
stencil_pipeline: Res<OutlinePipeline>,
msaa: Res<Msaa>,
@ -65,7 +65,7 @@ pub fn queue_outline_stencil_mesh(
}
}
pub type DrawOutline = (
pub(crate) type DrawOutline = (
SetItemPipeline,
SetMeshViewBindGroup<0>,
SetMeshBindGroup<1>,
@ -75,7 +75,7 @@ pub type DrawOutline = (
);
#[allow(clippy::too_many_arguments)]
pub fn queue_outline_volume_mesh(
pub(crate) fn queue_outline_volume_mesh(
opaque_draw_functions: Res<DrawFunctions<OpaqueOutline>>,
transparent_draw_functions: Res<DrawFunctions<TransparentOutline>>,
outline_pipeline: Res<OutlinePipeline>,

View File

@ -19,7 +19,7 @@ use bevy::render::{
};
use bevy::utils::FloatOrd;
pub struct StencilOutline {
pub(crate) struct StencilOutline {
pub distance: f32,
pub pipeline: CachedRenderPipelineId,
pub entity: Entity,
@ -52,7 +52,7 @@ impl CachedRenderPipelinePhaseItem for StencilOutline {
}
}
pub struct OpaqueOutline {
pub(crate) struct OpaqueOutline {
pub distance: f32,
pub pipeline: CachedRenderPipelineId,
pub entity: Entity,
@ -85,7 +85,7 @@ impl CachedRenderPipelinePhaseItem for OpaqueOutline {
}
}
pub struct TransparentOutline {
pub(crate) struct TransparentOutline {
pub distance: f32,
pub pipeline: CachedRenderPipelineId,
pub entity: Entity,
@ -119,7 +119,7 @@ impl CachedRenderPipelinePhaseItem for TransparentOutline {
}
#[allow(clippy::type_complexity)]
pub struct OutlineNode {
pub(crate) struct OutlineNode {
query: QueryState<
(
Read<ExtractedCamera>,
@ -135,9 +135,9 @@ pub struct OutlineNode {
}
impl OutlineNode {
pub const IN_VIEW: &'static str = "view";
pub(crate) const IN_VIEW: &'static str = "view";
pub fn new(world: &mut World) -> Self {
pub(crate) fn new(world: &mut World) -> Self {
Self {
query: world.query_filtered(),
}

View File

@ -26,21 +26,21 @@ use crate::uniforms::{OutlineFragmentUniform, OutlineStencilUniform, OutlineVolu
use crate::view_uniforms::OutlineViewUniform;
use crate::ATTRIBUTE_OUTLINE_NORMAL;
pub const OUTLINE_SHADER_HANDLE: HandleUntyped =
pub(crate) const OUTLINE_SHADER_HANDLE: HandleUntyped =
HandleUntyped::weak_from_u64(Shader::TYPE_UUID, 2101625026478770097);
pub const FRAGMENT_SHADER_HANDLE: HandleUntyped =
pub(crate) const FRAGMENT_SHADER_HANDLE: HandleUntyped =
HandleUntyped::weak_from_u64(Shader::TYPE_UUID, 12033806834125368121);
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum PassType {
pub(crate) enum PassType {
Stencil = 1,
Opaque = 2,
Transparent = 3,
}
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub struct PipelineKey(u32);
pub(crate) struct PipelineKey(u32);
bitfield_bitrange! {struct PipelineKey(u32)}
impl PipelineKey {
@ -52,25 +52,25 @@ impl PipelineKey {
pub offset_zero, set_offset_zero: 11;
}
pub fn new() -> Self {
pub(crate) fn new() -> Self {
PipelineKey(0)
}
pub fn with_msaa_samples(mut self, msaa_samples: u32) -> Self {
pub(crate) fn with_msaa_samples(mut self, msaa_samples: u32) -> Self {
self.set_msaa_samples_minus_one(msaa_samples - 1);
self
}
pub fn msaa_samples(&self) -> u32 {
pub(crate) fn msaa_samples(&self) -> u32 {
self.msaa_samples_minus_one() + 1
}
pub fn with_primitive_topology(mut self, primitive_topology: PrimitiveTopology) -> Self {
pub(crate) fn with_primitive_topology(mut self, primitive_topology: PrimitiveTopology) -> Self {
self.set_primitive_topology_int(primitive_topology as u32);
self
}
pub fn primitive_topology(&self) -> PrimitiveTopology {
pub(crate) fn primitive_topology(&self) -> PrimitiveTopology {
match self.primitive_topology_int() {
x if x == PrimitiveTopology::PointList as u32 => PrimitiveTopology::PointList,
x if x == PrimitiveTopology::LineList as u32 => PrimitiveTopology::LineList,
@ -81,12 +81,12 @@ impl PipelineKey {
}
}
pub fn with_pass_type(mut self, pass_type: PassType) -> Self {
pub(crate) fn with_pass_type(mut self, pass_type: PassType) -> Self {
self.set_pass_type_int(pass_type as u32);
self
}
pub fn pass_type(&self) -> PassType {
pub(crate) fn pass_type(&self) -> PassType {
match self.pass_type_int() {
x if x == PassType::Stencil as u32 => PassType::Stencil,
x if x == PassType::Opaque as u32 => PassType::Opaque,
@ -95,14 +95,14 @@ impl PipelineKey {
}
}
pub fn with_offset_zero(mut self, offset_zero: bool) -> Self {
pub(crate) fn with_offset_zero(mut self, offset_zero: bool) -> Self {
self.set_offset_zero(offset_zero);
self
}
}
#[derive(Resource)]
pub struct OutlinePipeline {
pub(crate) struct OutlinePipeline {
mesh_pipeline: MeshPipeline,
pub outline_view_bind_group_layout: BindGroupLayout,
pub outline_stencil_bind_group_layout: BindGroupLayout,

View File

@ -18,7 +18,7 @@ use crate::{pipeline::OutlinePipeline, ComputedOutlineDepth, OutlineStencil, Out
macro_rules! outline_vertex_uniform {
($x:ident) => {
#[derive(Clone, Component, ShaderType)]
pub struct $x {
pub(crate) struct $x {
#[align(16)]
pub origin: Vec3,
pub offset: f32,
@ -30,22 +30,22 @@ outline_vertex_uniform!(OutlineStencilUniform);
outline_vertex_uniform!(OutlineVolumeUniform);
#[derive(Clone, Component, ShaderType)]
pub struct OutlineFragmentUniform {
pub(crate) struct OutlineFragmentUniform {
#[align(16)]
pub colour: Vec4,
}
#[derive(Resource)]
pub struct OutlineStencilBindGroup {
pub(crate) struct OutlineStencilBindGroup {
pub bind_group: BindGroup,
}
#[derive(Resource)]
pub struct OutlineVolumeBindGroup {
pub(crate) struct OutlineVolumeBindGroup {
pub bind_group: BindGroup,
}
pub fn extract_outline_stencil_uniforms(
pub(crate) fn extract_outline_stencil_uniforms(
mut commands: Commands,
query: Extract<Query<(Entity, &OutlineStencil, &ComputedOutlineDepth)>>,
) {
@ -57,7 +57,7 @@ pub fn extract_outline_stencil_uniforms(
}
}
pub fn extract_outline_volume_uniforms(
pub(crate) fn extract_outline_volume_uniforms(
mut commands: Commands,
query: Extract<Query<(Entity, &OutlineVolume, &ComputedOutlineDepth)>>,
) {
@ -77,7 +77,7 @@ pub fn extract_outline_volume_uniforms(
}
}
pub fn queue_outline_stencil_bind_group(
pub(crate) fn queue_outline_stencil_bind_group(
mut commands: Commands,
render_device: Res<RenderDevice>,
outline_pipeline: Res<OutlinePipeline>,
@ -96,7 +96,7 @@ pub fn queue_outline_stencil_bind_group(
}
}
pub fn queue_outline_volume_bind_group(
pub(crate) fn queue_outline_volume_bind_group(
mut commands: Commands,
render_device: Res<RenderDevice>,
outline_pipeline: Res<OutlinePipeline>,
@ -122,7 +122,7 @@ pub fn queue_outline_volume_bind_group(
}
}
pub struct SetOutlineStencilBindGroup<const I: usize>();
pub(crate) struct SetOutlineStencilBindGroup<const I: usize>();
impl<const I: usize> EntityRenderCommand for SetOutlineStencilBindGroup<I> {
type Param = (
@ -141,7 +141,7 @@ impl<const I: usize> EntityRenderCommand for SetOutlineStencilBindGroup<I> {
}
}
pub struct SetOutlineVolumeBindGroup<const I: usize>();
pub(crate) struct SetOutlineVolumeBindGroup<const I: usize>();
impl<const I: usize> EntityRenderCommand for SetOutlineVolumeBindGroup<I> {
type Param = (

View File

@ -14,17 +14,17 @@ use crate::node::{OpaqueOutline, StencilOutline, TransparentOutline};
use crate::pipeline::OutlinePipeline;
#[derive(Clone, Component, ShaderType)]
pub struct OutlineViewUniform {
pub(crate) struct OutlineViewUniform {
#[align(16)]
scale: Vec2,
}
#[derive(Resource)]
pub struct OutlineViewBindGroup {
pub(crate) struct OutlineViewBindGroup {
bind_group: BindGroup,
}
pub fn extract_outline_view_uniforms(
pub(crate) fn extract_outline_view_uniforms(
mut commands: Commands,
query: Extract<Query<(Entity, &Camera), With<Camera3d>>>,
) {
@ -43,7 +43,7 @@ pub fn extract_outline_view_uniforms(
}
}
pub fn queue_outline_view_bind_group(
pub(crate) fn queue_outline_view_bind_group(
mut commands: Commands,
render_device: Res<RenderDevice>,
outline_pipeline: Res<OutlinePipeline>,
@ -62,7 +62,7 @@ pub fn queue_outline_view_bind_group(
}
}
pub struct SetOutlineViewBindGroup<const I: usize>();
pub(crate) struct SetOutlineViewBindGroup<const I: usize>();
impl<const I: usize> EntityRenderCommand for SetOutlineViewBindGroup<I> {
type Param = (