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

fix after rebase

parent 95507ed9
......@@ -60,7 +60,13 @@ void OptixMaterialHandler::releaseMemory()
//_dirac_emittance->destroy();
//_debug_shader->destroy();
//_shadow_catcher->destroy();
_measured_utia->destroy();
//_measured_utia->destroy();
for (auto it = _materials.begin(); it != _materials.end(); ++it)
{
auto mat = it->second;
mat->destroy();
}
for (auto it_buffer = _measured_materials_buffer.begin(); it_buffer != _measured_materials_buffer.end(); ++it_buffer)
{
......@@ -164,8 +170,6 @@ optix::Material OptixMaterialHandler::createMaterialFromMRF(
{
float albedo = lambert->diffuseAlbedo();
std::vector<std::string> variable_names = {"diffuse_color", "diffuse_color2"};
{"-DUTIA", nullptr},
std::vector<mrf::materials::RADIANCE_TYPE> variable_values;
variable_values.push_back(lambert->getColor() * albedo);
......@@ -569,6 +573,53 @@ optix::Material OptixMaterialHandler::createMaterialFromMRF(
compileBRDF(optix_mat, compile_options);
return optix_mat;
}
auto utia = dynamic_cast<mrf::materials::UTIA *>(material);
if (utia)
{
compile_options.push_back("-DUTIA");
optix_mat["_material_tex_id"]->setInt(-1);
auto &id_buffer = _utia_maps_indexes[material];
optix_mat["_utia_tex_ids"]->set(id_buffer);
auto &param_buffer = _utia_maps_param[material];
optix_mat["_utia_parameters"]->set(param_buffer);
optix_mat["_parameterization"]->setUint(utia->getParameterization());
compile_options.push_back("-DUTIA");
compileBRDF(optix_mat, compile_options);
return optix_mat;
}
//TODO: use the multi-material mechanics here
//auto idx_utia = dynamic_cast<mrf::materials::IndexedUTIA *>(material);
//if (idx_utia)
//{
// auto it = _index_map.find(material);
// if (it != _index_map.end())
// {
// optix_mat["_material_tex_id"]->setInt(it->second->getId());
// }
// else
// {
// optix_mat["_material_tex_id"]->setInt(-1);
// _loger.info("Missing index map, setting variable to -1");
// }
// auto &id_buffer = _utia_maps_indexes[material];
// optix_mat["_utia_tex_ids"]->set(id_buffer);
// auto &param_buffer = _utia_maps_param[material];
// optix_mat["_utia_parameters"]->set(param_buffer);
// optix_mat["_parameterization"]->setUint(utia->getParameterization());
// compile_options.push_back("-DUTIA");
// compileBRDF(optix_mat, compile_options);
// return optix_mat;
//}
}
void OptixMaterialHandler::compileBRDF(optix::Material &mat, std::vector<std::string> const &cuda_compile_options)
......@@ -1660,48 +1711,6 @@ void OptixMaterialHandler::applyMaterial(/*OptiXMesh &optix_mesh,*/
std::vector<unsigned int> mesh_indices;
auto multi_mat = dynamic_cast<mrf::materials::MultiMaterial *>(material);
if (multi_mat)
geom_instance["_parameterization"]->setUint(measured->getParameterization());
auto utia = dynamic_cast<mrf::materials::UTIA *>(material);
if (utia)
{
geom_instance["_material_tex_id"]->setInt(-1);
auto &id_buffer = _utia_maps_indexes[material];
geom_instance["_utia_tex_ids"]->set(id_buffer);
auto &param_buffer = _utia_maps_param[material];
geom_instance["_utia_parameters"]->set(param_buffer);
geom_instance["_parameterization"]->setUint(utia->getParameterization());
geom_instance->setMaterial(0, _utia);
return;
}
auto idx_utia = dynamic_cast<mrf::materials::IndexedUTIA *>(material);
if (idx_utia)
{
auto it = _index_map.find(material);
if (it != _index_map.end())
{
geom_instance["_material_tex_id"]->setInt(it->second->getId());
}
else
{
geom_instance["_material_tex_id"]->setInt(-1);
_loger.info("Missing index map, setting variable to -1");
}
auto &id_buffer = _utia_maps_indexes[material];
geom_instance["_utia_tex_ids"]->set(id_buffer);
auto &param_buffer = _utia_maps_param[material];
geom_instance["_utia_parameters"]->set(param_buffer);
geom_instance["_parameterization"]->setUint(utia->getParameterization());
geom_instance->setMaterial(0, _utia);
return;
}
{
mrf_indices = multi_mat->getAllMRFId();
......@@ -1715,11 +1724,8 @@ void OptixMaterialHandler::applyMaterial(/*OptiXMesh &optix_mesh,*/
geom_instance["index_tex_id"]->setInt(-1);
}
}
else
{
mrf_indices.push_back(material_index);
else { mrf_indices.push_back(material_index); }
geom_instance["index_tex_id"]->setInt(-1);
}
for (unsigned int i = 0; i < mrf_indices.size(); ++i)
......
......@@ -145,7 +145,7 @@ public:
//optix::Material tangentShader() { return _debug_shader; }
//optix::Material uvShader() { return _debug_shader; }
optix::Material utia() { return _utia; }
//optix::Material utia() { return _utia; }
private:
/**
......
......@@ -1040,8 +1040,6 @@ SceneParser::addMesh(XMLElement *a_mesh_element, mrf::rendering::Scene &scene, i
try
{
mrf::util::PrecisionTimer timer;
timer.start();
tiny_mat = file.request_properties_from_element("face", {"mat_idx"});
}
catch (const std::exception &e)
......@@ -1052,6 +1050,8 @@ SceneParser::addMesh(XMLElement *a_mesh_element, mrf::rendering::Scene &scene, i
tiny_mat = nullptr;
}
mrf::util::PrecisionTimer timer;
timer.start();
file.read(ss);
timer.stop();
_loger->trace("Read ply in " + std::to_string(timer.elapsed()));
......
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