Avoid std::endl in the writers to avoid flushing the output stream on every line. (Thanks to Roman Zoller for the hint).

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1209 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2015-01-19 17:37:47 +00:00
parent a1617b1b98
commit f1a9b3a871
5 changed files with 53 additions and 53 deletions

View File

@@ -177,18 +177,18 @@ writeMaterial(std::ostream& _out, BaseExporter& _be, Options _opt) const
//write the materials
if ( _opt.color_has_alpha() )
for (size_t i=0; i < materialA_.size(); i++){
_out << "newmtl " << "mat" << i << std::endl;
_out << "Ka 0.5000 0.5000 0.5000" << std::endl;
_out << "Kd " << materialA_[i][0] << materialA_[i][1] << materialA_[i][2] << std::endl;;
_out << "Tr " << materialA_[i][3] << std::endl;
_out << "illum 1" << std::endl;
_out << "newmtl " << "mat" << i << '\n';
_out << "Ka 0.5000 0.5000 0.5000" << '\n';
_out << "Kd " << materialA_[i][0] << materialA_[i][1] << materialA_[i][2] << '\n';;
_out << "Tr " << materialA_[i][3] << '\n';
_out << "illum 1" << '\n';
}
else
for (size_t i=0; i < material_.size(); i++){
_out << "newmtl " << "mat" << i << std::endl;
_out << "Ka 0.5000 0.5000 0.5000" << std::endl;
_out << "Kd " << material_[i][0] << material_[i][1] << material_[i][2] << std::endl;;
_out << "illum 1" << std::endl;
_out << "newmtl " << "mat" << i << '\n';
_out << "Ka 0.5000 0.5000 0.5000" << '\n';
_out << "Kd " << material_[i][0] << material_[i][1] << material_[i][2] << '\n';;
_out << "illum 1" << '\n';
}
return true;
@@ -246,11 +246,11 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
// header
_out << "# " << _be.n_vertices() << " vertices, ";
_out << _be.n_faces() << " faces" << std::endl;
_out << _be.n_faces() << " faces" << '\n';
// material file
if (useMatrial && _opt.check(Options::FaceColor) )
_out << "mtllib " << objName_ << ".mat" << std::endl;
_out << "mtllib " << objName_ << ".mat" << '\n';
// vertex data (point, normals, texcoords)
for (i=0, nV=_be.n_vertices(); i<nV; ++i)
@@ -260,13 +260,13 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
n = _be.normal(vh);
t = _be.texcoord(vh);
_out << "v " << v[0] <<" "<< v[1] <<" "<< v[2] << std::endl;
_out << "v " << v[0] <<" "<< v[1] <<" "<< v[2] << '\n';
if (_opt.check(Options::VertexNormal))
_out << "vn " << n[0] <<" "<< n[1] <<" "<< n[2] << std::endl;
_out << "vn " << n[0] <<" "<< n[1] <<" "<< n[2] << '\n';
if (_opt.check(Options::VertexTexCoord))
_out << "vt " << t[0] <<" "<< t[1] << std::endl;
_out << "vt " << t[0] <<" "<< t[1] << '\n';
}
size_t lastMat = std::numeric_limits<std::size_t>::max();
@@ -294,7 +294,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
// if we are ina a new material block, specify in the file which material to use
if(lastMat != material) {
_out << "usemtl mat" << material << std::endl;
_out << "usemtl mat" << material << '\n';
lastMat = material;
}
}
@@ -327,7 +327,7 @@ write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _prec
}
}
_out << std::endl;
_out << '\n';
}
material_.clear();