- fixed writing face indices in different configurations regarding vertex texture coordinates and vertex normals

- adjusted the intial patch provided by Robert Luo

refs #1560

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@824 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Isaak Lim
2013-05-16 11:11:41 +00:00
parent 83722b8e5f
commit c15f0f60f5

View File

@@ -270,6 +270,10 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
int lastMat = -1; int lastMat = -1;
// we do not want to write seperators if we only write vertex indices
bool onlyVertices = !_opt.check(Options::VertexTexCoord)
&& !_opt.check(Options::VertexNormal);
// faces (indices starting at 1 not 0) // faces (indices starting at 1 not 0)
for (i=0, nF=_be.n_faces(); i<nF; ++i) for (i=0, nF=_be.n_faces(); i<nF; ++i)
{ {
@@ -305,19 +309,21 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
idx = vhandles[j].idx() + 1; idx = vhandles[j].idx() + 1;
_out << " " << idx; _out << " " << idx;
// write separator if (!onlyVertices) {
_out << "/" ; // write separator
_out << "/" ;
// write vertex texture coordinate index // write vertex texture coordinate index
if (_opt.check(Options::VertexTexCoord)) if (_opt.check(Options::VertexTexCoord))
_out << idx; _out << idx;
// write separator // write vertex normal index
_out << "/" ; if ( _opt.check(Options::VertexNormal) ) {
// write separator
// write vertex normal index _out << "/" ;
if ( _opt.check(Options::VertexNormal) ) _out << idx;
_out << idx; }
}
} }
_out << std::endl; _out << std::endl;