+ | Poorly done emissive texture

This commit is contained in:
TheRedShip
2025-02-01 21:32:37 +01:00
parent 0bb7315681
commit 328737ac4b
6 changed files with 60 additions and 13 deletions

View File

@ -249,6 +249,7 @@ void ObjParser::parseMtl(std::stringstream &input_line, Scene &scene)
mat = new Material;
memset(mat, 0, sizeof(Material));
mat->texture_index = -1;
mat->emission_texture_index = -1;
mat->refraction = 1.0f;
mat->roughness = 1.0f;
mat->metallic = 1.0f;
@ -324,6 +325,16 @@ void ObjParser::parseMtl(std::stringstream &input_line, Scene &scene)
mat->texture_index = scene.getTextures().size();
scene.addTexture(getFilePath(_filename) + path);
}
else if (identifier == "map_Ke")
{
std::string path;
if (!(lineStream >> path))
throw std::runtime_error("OBJ: syntax error while getting material texture");
mat->emission_texture_index = scene.getEmissionTextures().size();
scene.addEmissionTexture(getFilePath(_filename) + path);
}
else
std::cerr << "unsupported material setting : " << identifier << std::endl;
}