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

index is ok for its first material, need to check that per face mat is OK

parent 874d226d
......@@ -1555,8 +1555,7 @@ bool SceneParser::addMaterial(XMLElement *a_mat_element, mrf::rendering::Scene &
parseMultiMaterial(a_mat_element, multimat, scene);
_brdf_map[name] = scene.addMaterial(multimat);
}
if (type.compare(BRDFTypes::LAMBERT) == 0)
else if (type.compare(BRDFTypes::LAMBERT) == 0)
{
_loger->trace("Lambertian Material Detected");
......@@ -2753,8 +2752,8 @@ void SceneParser::parseMultiMaterial(
std::string name(material->Attribute(SceneLexer::NAME_AT));
unsigned int mat_index;
material->QueryUnsignedAttribute(SceneLexer::INDEX_AT, &mat_index);
multi_mat->addEntry(mat_index, name);
addMaterial(material, scene);
multi_mat->addEntry(_brdf_map[name], mat_index, name);
}
//TODO
//else if (element_name.compare(SceneLexer::EMITTANCE_MK) == 0)
......
......@@ -63,6 +63,6 @@ char const *BRDFTypes::RATIONAL_HC = "Rational_HC";
char const *BRDFTypes::PRINCIPLED = "principled";
char const *BRDFTypes::MULTI_MAT = "multi-material";
char const *BRDFTypes::MULTI_MAT = "multi_material";
} // namespace materials
} // namespace mrf
......@@ -22,7 +22,8 @@ protected:
unsigned int _index_offset;
unsigned int _material_count;
std::vector<unsigned int> _indices;
std::vector<unsigned int> _mrf_indices;
std::vector<unsigned int> _mesh_indices;
std::vector<std::string> _names;
public:
......@@ -30,15 +31,18 @@ protected:
~MultiMaterial();
//void addEntry(unsigned int idx, std::string name) { _material_map[idx] = name; }
void addEntry(unsigned int idx, std::string name)
void addEntry(unsigned int mrf_idx, unsigned int mesh_idx, std::string name)
{
_indices.push_back(idx);
_mrf_indices.push_back(mrf_idx);
_mesh_indices.push_back(mesh_idx);
_names.push_back(name);
}
void addIdEntry(unsigned int idx) { _indices.push_back(idx); }
void addMRFIdEntry(unsigned int idx) { _mrf_indices.push_back(idx); }
void addMeshIdEntry(unsigned int idx) { _mesh_indices.push_back(idx); }
void addNameEntry(std::string name) { _names.push_back(name); }
std::vector<unsigned int> &getAllId() { return _indices; }
std::vector<unsigned int> &getAllMRFId() { return _mrf_indices; }
std::vector<unsigned int> &getAllMeshId() { return _mesh_indices; }
std::vector<std::string> & getAllNames() { return _names; }
};
......
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