Make more things pub in the renderer (#12053)

# Objective

- Some properties of public types are private but sometimes it's useful
to be able to set those

## Solution

- Make more stuff pub

---

## Changelog

- `MaterialBindGroupId` internal id is now pub and added a new()
constructor
- `ExtractedPointLight` and `ExtractedDirectionalLight` properties are
now all pub

---------

Co-authored-by: James Liu <contact@jamessliu.com>
This commit is contained in:
IceSentry 2024-02-23 01:13:37 -05:00 committed by François
parent a8fa1f77b9
commit d62319be38
2 changed files with 32 additions and 20 deletions

View File

@ -793,7 +793,19 @@ pub struct PreparedMaterial<T: Material> {
} }
#[derive(Component, Clone, Copy, Default, PartialEq, Eq, Deref, DerefMut)] #[derive(Component, Clone, Copy, Default, PartialEq, Eq, Deref, DerefMut)]
pub struct MaterialBindGroupId(Option<BindGroupId>); pub struct MaterialBindGroupId(pub Option<BindGroupId>);
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())
}
}
impl<T: Material> PreparedMaterial<T> { impl<T: Material> PreparedMaterial<T> {
pub fn get_bind_group_id(&self) -> MaterialBindGroupId { pub fn get_bind_group_id(&self) -> MaterialBindGroupId {

View File

@ -29,30 +29,30 @@ use crate::*;
#[derive(Component)] #[derive(Component)]
pub struct ExtractedPointLight { pub struct ExtractedPointLight {
color: Color, pub color: Color,
/// luminous intensity in lumens per steradian /// luminous intensity in lumens per steradian
intensity: f32, pub intensity: f32,
range: f32, pub range: f32,
radius: f32, pub radius: f32,
transform: GlobalTransform, pub transform: GlobalTransform,
shadows_enabled: bool, pub shadows_enabled: bool,
shadow_depth_bias: f32, pub shadow_depth_bias: f32,
shadow_normal_bias: f32, pub shadow_normal_bias: f32,
spot_light_angles: Option<(f32, f32)>, pub spot_light_angles: Option<(f32, f32)>,
} }
#[derive(Component, Debug)] #[derive(Component, Debug)]
pub struct ExtractedDirectionalLight { pub struct ExtractedDirectionalLight {
color: Color, pub color: Color,
illuminance: f32, pub illuminance: f32,
transform: GlobalTransform, pub transform: GlobalTransform,
shadows_enabled: bool, pub shadows_enabled: bool,
shadow_depth_bias: f32, pub shadow_depth_bias: f32,
shadow_normal_bias: f32, pub shadow_normal_bias: f32,
cascade_shadow_config: CascadeShadowConfig, pub cascade_shadow_config: CascadeShadowConfig,
cascades: EntityHashMap<Vec<Cascade>>, pub cascades: EntityHashMap<Vec<Cascade>>,
frusta: EntityHashMap<Vec<Frustum>>, pub frusta: EntityHashMap<Vec<Frustum>>,
render_layers: RenderLayers, pub render_layers: RenderLayers,
} }
#[derive(Copy, Clone, ShaderType, Default, Debug)] #[derive(Copy, Clone, ShaderType, Default, Debug)]