diff options
| author | HampusM <hampus@hampusmat.com> | 2026-08-21 20:31:16 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-08-21 20:31:16 +0200 |
| commit | ffbbe51561393e559b6e70d9e9b39bc025f77d1c (patch) | |
| tree | 4f8b3f5ba3358d18452bb3424d47aff8c275cabb /engine/src/lighting.rs | |
| parent | 81032f9005479368b0e3d101f2997ef2de2a7fe8 (diff) | |
fix(engine): make DirectionalLight default value sensible
Diffstat (limited to 'engine/src/lighting.rs')
| -rw-r--r-- | engine/src/lighting.rs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/engine/src/lighting.rs b/engine/src/lighting.rs index 5aae795..5314e58 100644 --- a/engine/src/lighting.rs +++ b/engine/src/lighting.rs @@ -70,8 +70,8 @@ impl Default for AttenuationParams } builder! { -#[builder(name = DirectionalLightBuilder, derives = (Debug, Default, Clone))] -#[derive(Debug, Default, Clone, Component, Reflection)] +#[builder(name = DirectionalLightBuilder, derives = (Debug, Clone))] +#[derive(Debug, Clone, Component, Reflection)] #[non_exhaustive] pub struct DirectionalLight { @@ -90,6 +90,26 @@ impl DirectionalLight } } +impl Default for DirectionalLight +{ + fn default() -> Self + { + Self::builder().build() + } +} + +impl Default for DirectionalLightBuilder +{ + fn default() -> Self + { + Self { + diffuse: Color::Rgb(Rgb { r: 0.5, g: 0.5, b: 0.5 }), + specular: Color::Rgb(Rgb::<f32>::white()), + direction: Vec3::LEFT, + } + } +} + builder! { #[builder(name = EnvironmentalBuilder, derives = (Debug, Clone))] #[derive(Debug, Clone, Component, Reflection)] |
