Commits (1)
......@@ -599,6 +599,42 @@ void OBJImporter::addMaterial(std::string _materialName){
}
}
// set materialNode color
if (mat.has_Ka()) {
TriMesh::Color color = OpenMesh::color_cast< OpenMesh::Vec4f >(mat.Ka());
triMeshObj->materialNode()->set_ambient_color(color);
}
if (mat.has_Kd()) {
TriMesh::Color color = OpenMesh::color_cast< OpenMesh::Vec4f >(mat.Kd());
triMeshObj->materialNode()->set_diffuse_color(color);
}
if (mat.has_Ks()) {
TriMesh::Color color = OpenMesh::color_cast< OpenMesh::Vec4f >(mat.Ks());
triMeshObj->materialNode()->set_specular_color(color);
}
if (mat.has_Ke()) {
TriMesh::Color color = OpenMesh::color_cast< OpenMesh::Vec4f >(mat.Ke());
triMeshObj->materialNode()->set_emission(color);
}
if (mat.has_Ni()) {
float Ni = mat.Ni();
triMeshObj->materialNode()->set_indexOfRefraction(Ni);
}
if (mat.has_Ns()) {
float shininess = mat.Ns();
triMeshObj->materialNode()->set_shininess(shininess);
}
if (mat.has_illum()) {
triMeshObj->materialNode()->set_refractive(mat.isRefractive());
}
for (unsigned int i=0; i < addedFacesTri_[currentGroup_].size(); i++){
if ( mat.has_Kd() ) {
......@@ -615,41 +651,10 @@ void OBJImporter::addMaterial(std::string _materialName){
color[3] = 1.0;
}
currentTriMesh()->set_color(addedFacesTri_[currentGroup_][i], color );
triMeshObj->materialNode()->set_diffuse_color(color);
objectOptions_[ currentObject() ] |= FACECOLOR;
}
}
// set materialNode color
if (mat.has_Ka()) {
TriMesh::Color color = OpenMesh::color_cast< OpenMesh::Vec4f >(mat.Ka());
triMeshObj->materialNode()->set_ambient_color(color);
}
if (mat.has_Ks()) {
TriMesh::Color color = OpenMesh::color_cast< OpenMesh::Vec4f >(mat.Ks());
triMeshObj->materialNode()->set_specular_color(color);
}
if (mat.has_Ke()) {
TriMesh::Color color = OpenMesh::color_cast< OpenMesh::Vec4f >(mat.Ke());
triMeshObj->materialNode()->set_emission(color);
}
if (mat.has_Ni()) {
float Ni = mat.Ni();
triMeshObj->materialNode()->set_indexOfRefraction(Ni);
}
if (mat.has_Ns()) {
float shininess = mat.Ns();
triMeshObj->materialNode()->set_shininess(shininess);
}
if (mat.has_illum()) {
triMeshObj->materialNode()->set_refractive(mat.isRefractive());
}
bool textureAllowed = ! ( objectOptions_[ currentObject() ] & FORCE_NOTEXTURES );
// Set the texture index in the face index property
......@@ -663,6 +668,7 @@ void OBJImporter::addMaterial(std::string _materialName){
if ( hasTexture( currentObject() ) && textureAllowed )
currentTriMesh()->property(indexProperty, addedFacesTri_[currentGroup_][i]) = 0;
}
}
}
......@@ -678,6 +684,8 @@ void OBJImporter::addMaterial(std::string _materialName){
//get textureIndex Property
OpenMesh::FPropHandleT< int > indexProperty;
BaseObjectData* polyMeshObj = PluginFunctions::baseObjectData(object(currentObject()));
if ( hasTexture( currentObject() ) ){
bool textureAllowed = ! ( objectOptions_[ currentObject() ] & FORCE_NOTEXTURES );
......@@ -704,10 +712,41 @@ void OBJImporter::addMaterial(std::string _materialName){
}
currentPolyMesh()->set_color(addedFacePoly_, color );
polyMeshObj->materialNode()->set_diffuse_color(color);
objectOptions_[ currentObject() ] |= FACECOLOR;
}
}
// set materialNode color
if (mat.has_Ka()) {
TriMesh::Color color = OpenMesh::color_cast< OpenMesh::Vec4f >(mat.Ka());
polyMeshObj->materialNode()->set_ambient_color(color);
}
if (mat.has_Ks()) {
TriMesh::Color color = OpenMesh::color_cast< OpenMesh::Vec4f >(mat.Ks());
polyMeshObj->materialNode()->set_specular_color(color);
}
if (mat.has_Ke()) {
TriMesh::Color color = OpenMesh::color_cast< OpenMesh::Vec4f >(mat.Ke());
polyMeshObj->materialNode()->set_emission(color);
}
if (mat.has_Ni()) {
float Ni = mat.Ni();
polyMeshObj->materialNode()->set_indexOfRefraction(Ni);
}
if (mat.has_Ns()) {
float shininess = mat.Ns();
polyMeshObj->materialNode()->set_shininess(shininess);
}
if (mat.has_illum()) {
polyMeshObj->materialNode()->set_refractive(mat.isRefractive());
}
bool textureAllowed = ! ( objectOptions_[ currentObject() ] & FORCE_NOTEXTURES );
// Set the texture index in the face index property
......