Handle objs without faces(Thanks to Bruno Dutailly)
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@476 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -589,6 +589,29 @@ read(std::istream& _in, BaseImporter& _bi, Options& _opt)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we do not have any faces,
|
||||||
|
// assume this is a point cloud and read the normals and colors directly
|
||||||
|
if (_bi.n_faces()==0)
|
||||||
|
{
|
||||||
|
int i=0;
|
||||||
|
// add normal per vertex
|
||||||
|
if ( normals.size() == _bi.n_vertices() )
|
||||||
|
for (std::vector<VertexHandle>::iterator it = vertexHandles.begin();
|
||||||
|
it != vertexHandles.end(); ++it, i++) {
|
||||||
|
_bi.set_normal( *it, normals[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// add color per vertex
|
||||||
|
i=0;
|
||||||
|
if ( colors.size() >= _bi.n_vertices() )
|
||||||
|
for (std::vector<VertexHandle>::iterator it = vertexHandles.begin();
|
||||||
|
it != vertexHandles.end(); ++it, i++) {
|
||||||
|
_bi.set_color( *it, colors[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user