From 7d81da012e40998c3d645a491dc729f249402af7 Mon Sep 17 00:00:00 2001 From: tomoron Date: Wed, 15 Jan 2025 19:13:13 +0100 Subject: [PATCH] set metallic at 1 by default on mtl materials --- srcs/class/SceneParser.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/srcs/class/SceneParser.cpp b/srcs/class/SceneParser.cpp index 5c2b893..9f597ef 100644 --- a/srcs/class/SceneParser.cpp +++ b/srcs/class/SceneParser.cpp @@ -6,7 +6,7 @@ /* By: ycontre +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/12/26 21:43:51 by TheRed #+# #+# */ -/* Updated: 2025/01/15 13:27:43 by tomoron ### ########.fr */ +/* Updated: 2025/01/15 19:08:42 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -132,7 +132,6 @@ void SceneParser::parseMtl(std::stringstream &input_line, std::map> filename; @@ -158,11 +157,12 @@ void SceneParser::parseMtl(std::stringstream &input_line, std::mapmetallic = 1.0f; continue; } if(!mat) throw std::runtime_error("OBJ: error in material file, material name not defined"); - if(/*identifier == "Ka" || */identifier == "Kd") + if(identifier == "Kd") { if(!(lineStream >> mat->color.x >> mat->color.y >> mat->color.z)) throw std::runtime_error("OBJ: syntax error while getting material color"); @@ -175,16 +175,10 @@ void SceneParser::parseMtl(std::stringstream &input_line, std::map> tmp)) + float x, y, z; + if(!(lineStream >> x >> y >> z)) throw std::runtime_error("OBJ: syntax error while getting material emission"); - mat->emission += tmp; - if(!(lineStream >> tmp)) - throw std::runtime_error("OBJ: syntax error while getting material emission"); - mat->emission += tmp; - if(!(lineStream >> tmp)) - throw std::runtime_error("OBJ: syntax error while getting material emission"); - mat->emission += tmp; - mat->emission /= 3; + mat->emission = (x + y + z) / 3; } else if(identifier == "Ni") {