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

activate per_face on OBJ and update blender scripts

parent b30eafb9
This diff is collapsed.
......@@ -604,6 +604,22 @@ def add_material_phong(root_node,material_name,rgb,roughness,directory_full_path
material.append(specular_xml)
materials.append(material)
def add_multi_material(root_node,material_name, multi_mat_names, multi_mat_indices, directory_full_path, directory_relative_path,mrf_tools):
print("ADD Multi Material")
materials = root_node.find('materials')
material = ET.Element('material')
material.set('name',material_name)
material.set('type','multi_material')
nb_mat = len(multi_mat_names)
for i in range(0, nb_mat):
sub_mat = ET.Element('material')
sub_mat.set('index',str(multi_mat_indices[i]))
sub_mat.set('name',str(multi_mat_names[i]))
material.append(sub_mat)
materials.append(material)
def add_point_light(root_node,power,rgb,pos,light_name,directory_full_path, directory_relative_path):
lights = root_node.find('lights')
point_light = ET.Element('point_light')
......
......@@ -1193,14 +1193,22 @@ SceneParser::addMesh(XMLElement *a_mesh_element, mrf::rendering::Scene &scene, i
_loger->trace(" Nb UVs", uvs.size());
if (materials.size() > 0)
{
_loger->warn(" OVERRIDING the materials in the objfile and replacing them with a MRF material");
}
//if (materials.size() > 0)
//{
// _loger->warn(" OVERRIDING the materials in the objfile and replacing them with a MRF material");
//}
//Retrieve the current material
std::vector<unsigned int> enforced_materials;
enforced_materials.resize(new_faces.size() / 3);
std::fill(enforced_materials.begin(), enforced_materials.end(), current_material_index);
if (per_face_material.size() > 0)
{
enforced_materials = per_face_material;
}
else
{
enforced_materials.resize(new_faces.size() / 3);
std::fill(enforced_materials.begin(), enforced_materials.end(), current_material_index);
}
// Check if the mesh has a tangent method attribute
......
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