diff options
author | HampusM <hampus@hampusmat.com> | 2024-05-22 20:42:11 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-05-22 20:42:11 +0200 |
commit | 944518fa4c3523bdc3e299e03e52613efaaf46b3 (patch) | |
tree | 13b4b841018ffe855b39c18a3e410c8027760dbf | |
parent | d4b61dd34b06119e87c8932ab7718d432dbc6a4f (diff) |
feat: use light attenuation
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 6dc72a2..8dbd788 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,7 @@ use engine::event::Start as StartEvent; use engine::file_format::wavefront::mtl::parse as parse_mtl; use engine::file_format::wavefront::obj::parse as parse_obj; use engine::input::Extension as InputExtension; -use engine::lighting::{GlobalLight, PointLight}; +use engine::lighting::{AttenuationParams, GlobalLight, PointLight}; use engine::material::{Builder as MaterialBuilder, Flags as MaterialFlags}; use engine::renderer::Extension as RendererExtension; use engine::shader::Program as ShaderProgram; @@ -70,7 +70,14 @@ fn main() -> Result<(), Box<dyn Error>> )); engine.spawn(( - PointLight::builder().diffuse(YELLOW).build(), + PointLight::builder() + .diffuse(YELLOW) + .attenuation_params(AttenuationParams { + linear: 0.045, + quadratic: 0.0075, + ..Default::default() + }) + .build(), Transform { position: Vec3 { x: -6.0, y: 3.0, z: 3.0 }, ..Default::default() |