Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit f22b5202 authored by MURRAY David's avatar MURRAY David
Browse files

bit of cleaning

parent df05941c
......@@ -208,8 +208,8 @@ bool SceneParser::parseGlobalMaterials(Scene &scene)
if (material)
{
_loger->trace("Materials Found ! Parsing it....");
_loger->trace("Materials Found ! Parsing them....");
for (; material; material = material->NextSiblingElement())
{
std::string element_name = material->Name();
......@@ -233,6 +233,24 @@ bool SceneParser::parseGlobalMaterials(Scene &scene)
_loger->warn("Unrecognized element in materials ");
}
}
if (_multi_mat_list.size() >= 1)
{
for (int i = 0; i < _multi_mat_list.size(); ++i)
{
auto multi_mat = _multi_mat_list[i];
bool rOK = true;
for (int j = 0; j < multi_mat->size(); ++j)
{
rOK &= _brdf_map.count(multi_mat->getAllNames()[j]) == 1;
if (rOK)
multi_mat->addMRFIdEntry(_brdf_map[multi_mat->getAllNames()[j]]);
else
break;
}
if (!rOK) multi_mat = nullptr;
}
}
}
else
{
......@@ -1227,10 +1245,6 @@ SceneParser::addMesh(XMLElement *a_mesh_element, mrf::rendering::Scene &scene, i
enforced_materials[i] = remapping[prev];
}
_loger->info("Remapped per face material for OBJ " + obj_relative_path + " with:");
for (int i = 0; i < remapping.size(); ++i)
_loger->info("i = " + std::to_string(i) + " | i2 = " + std::to_string(remapping[i]));
assert(enforced_materials.size() == per_face_material.size());
}
else
......@@ -1591,7 +1605,10 @@ bool SceneParser::addMaterial(XMLElement *a_mat_element, mrf::rendering::Scene &
MultiMaterial *multimat = new MultiMaterial(name, count);
bool rOK = parseMultiMaterial(a_mat_element, multimat, scene);
if (rOK)
{
_brdf_map[name] = scene.addMaterial(multimat);
_multi_mat_list.push_back(multimat);
}
else
{
_loger->warn("Something went wrong with a mutli-material. Please check that its material are in the scene graph.");
......@@ -2794,10 +2811,12 @@ bool SceneParser::parseMultiMaterial(
if (element_name.compare(SceneLexer::MATERIAL_MK) == 0)
{
std::string name(material->Attribute(SceneLexer::NAME_AT));
unsigned int mat_index;
if (_brdf_map.count(name) != 1)
rOK &= addMaterial(material, scene);
multi_mat->addEntry(_brdf_map[name], name);
/* if (_brdf_map.count(name) != 1)
rOK &= addMaterial(material, scene); */
//multi_mat->addEntry(_brdf_map[name], name);
multi_mat->addNameEntry(name);
}
}
......
......@@ -64,6 +64,8 @@ protected:
**/
std::map<std::string, unsigned int> _brdf_map;
std::vector<mrf::materials::MultiMaterial *> _multi_mat_list;
/**
* For ENVMAP Ressource Management
*
......
......@@ -35,6 +35,8 @@ public:
std::vector<unsigned int> &getAllMRFId() { return _mrf_indices; }
std::vector<std::string> & getAllNames() { return _names; }
size_t size() { return _names.size(); }
};
} // namespace materials
} // namespace mrf
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment