From 0c289ca482301230f5fb6bd3e2dc47f5bc6ccda7 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 7 Apr 2020 17:31:19 +0200 Subject: [PATCH] library: scene: mesh: parse emitted light from MTL --- pathtracer/Cargo.toml | 5 ++++- pathtracer/src/scene/mesh.rs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pathtracer/Cargo.toml b/pathtracer/Cargo.toml index f80ec3b..2673431 100644 --- a/pathtracer/Cargo.toml +++ b/pathtracer/Cargo.toml @@ -28,7 +28,6 @@ rand = "0.7" rayon = "1.3.0" serde_yaml = "0.8" structopt = "0.3" -tobj = "1.0" [dependencies.nalgebra] version = "0.20.0" @@ -37,3 +36,7 @@ features = ["serde-serialize"] [dependencies.serde] version = "1.0" features = ["derive"] + +[dependencies.tobj] +git = "https://github.com/alarsyo/tobj" # forked for Ke support +rev = "82b5c2ca" diff --git a/pathtracer/src/scene/mesh.rs b/pathtracer/src/scene/mesh.rs index d04cb4c..974680c 100644 --- a/pathtracer/src/scene/mesh.rs +++ b/pathtracer/src/scene/mesh.rs @@ -97,6 +97,7 @@ impl TryFrom for Mesh { let diffuse = LinearColor::from_slice(&mesh_mat.ambient[..]); let specular = LinearColor::from_slice(&mesh_mat.ambient[..]); + let emitted = LinearColor::from_slice(&mesh_mat.emission[..]); let material = UniformMaterial::new(LightProperties::new( diffuse.clone(), @@ -104,8 +105,7 @@ impl TryFrom for Mesh { // FIXME: material.dissolve is supposed to be "the alpha term" // Needs translation to our ReflTransEnum None, - // FIXME: parse 'Ke' component for emitted light - LinearColor::black(), + emitted, )); // we only handle uniform textures