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 268372d5 authored by MURRAY David's avatar MURRAY David
Browse files

working on remapping material for OBJ

parent 70c8ac70
......@@ -690,6 +690,8 @@ void OptixMaterialHandler::createMaterials(std::vector<std::string> const &cuda_
//All its underlying materials are in general material list and will be compiled normally.
auto multi_mat = dynamic_cast<mrf::materials::MultiMaterial *>(_mrf_materials[i]);
if (multi_mat) continue;
if (_mrf_materials[i])
#ifdef MRF_RENDERING_MODE_SPECTRAL
_materials[_mrf_materials[i]] = createMaterialFromMRF(_mrf_materials[i], cuda_compile_options, wavelengths);
#else
......
......@@ -1200,9 +1200,36 @@ SceneParser::addMesh(XMLElement *a_mesh_element, mrf::rendering::Scene &scene, i
//Retrieve the current material
std::vector<unsigned int> enforced_materials;
if (per_face_material.size() > 0)
auto multi_mat = dynamic_cast<mrf::materials::MultiMaterial *>(&(scene.umaterial(current_material_index)));
if (per_face_material.size() > 0 && multi_mat)
{
enforced_materials = per_face_material;
//Need to check consistency between indices and remap if necessary.
std::vector<unsigned int> remapping;
//remapping.resize(materials.size());
for (int i = 0; i < materials.size(); ++i)
{
uint index = 0;
while (multi_mat->getAllNames()[index] != materials[i].name() && index < materials.size())
{
++index;
}
remapping.push_back(multi_mat->getAllMRFId()[index]);
}
enforced_materials.resize(per_face_material.size());
#pragma omp parallel for schedule(static)
for (int i = 0; i < enforced_materials.size(); ++i)
{
unsigned int prev = per_face_material[i];
enforced_materials[i] = remapping[prev];
}
_loger->info("Remapped per face material for OBJ " + obj_relative_path);
assert(enforced_materials.size() == per_face_material.size());
}
else
{
......
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