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

Make more things pub in the renderer #12053

Merged
merged 3 commits into from
Feb 23, 2024
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
14 changes: 13 additions & 1 deletion crates/bevy_pbr/src/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,19 @@ pub struct PreparedMaterial<T: Material> {
}

#[derive(Component, Clone, Copy, Default, PartialEq, Eq, Deref, DerefMut)]
pub struct MaterialBindGroupId(Option<BindGroupId>);
pub struct MaterialBindGroupId(pub Option<BindGroupId>);
IceSentry marked this conversation as resolved.
Show resolved Hide resolved

impl MaterialBindGroupId {
pub fn new(id: BindGroupId) -> Self {
Self(Some(id))
}
}

impl From<BindGroup> for MaterialBindGroupId {
fn from(value: BindGroup) -> Self {
Self::new(value.id())
}
}

/// An atomic version of [`MaterialBindGroupId`] that can be read from and written to
/// safely from multiple threads.
Expand Down
38 changes: 19 additions & 19 deletions crates/bevy_pbr/src/render/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,30 @@ use crate::*;

#[derive(Component)]
pub struct ExtractedPointLight {
color: Color,
pub color: Color,
/// luminous intensity in lumens per steradian
intensity: f32,
range: f32,
radius: f32,
transform: GlobalTransform,
shadows_enabled: bool,
shadow_depth_bias: f32,
shadow_normal_bias: f32,
spot_light_angles: Option<(f32, f32)>,
pub intensity: f32,
pub range: f32,
pub radius: f32,
pub transform: GlobalTransform,
pub shadows_enabled: bool,
pub shadow_depth_bias: f32,
pub shadow_normal_bias: f32,
pub spot_light_angles: Option<(f32, f32)>,
}

#[derive(Component, Debug)]
pub struct ExtractedDirectionalLight {
color: Color,
illuminance: f32,
transform: GlobalTransform,
shadows_enabled: bool,
shadow_depth_bias: f32,
shadow_normal_bias: f32,
cascade_shadow_config: CascadeShadowConfig,
cascades: EntityHashMap<Vec<Cascade>>,
frusta: EntityHashMap<Vec<Frustum>>,
render_layers: RenderLayers,
pub color: Color,
pub illuminance: f32,
pub transform: GlobalTransform,
pub shadows_enabled: bool,
pub shadow_depth_bias: f32,
pub shadow_normal_bias: f32,
pub cascade_shadow_config: CascadeShadowConfig,
pub cascades: EntityHashMap<Vec<Cascade>>,
pub frusta: EntityHashMap<Vec<Frustum>>,
pub render_layers: RenderLayers,
}

#[derive(Copy, Clone, ShaderType, Default, Debug)]
Expand Down