PLY Writer normal support (Thanks to Bruno Dutailly)

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@478 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2011-12-01 16:55:24 +00:00
parent 7d092c7465
commit 73f5a1fe89
2 changed files with 31 additions and 5 deletions

View File

@@ -187,6 +187,12 @@ write_ascii(std::ostream& _out, BaseExporter& _be, Options _opt) const
_out << "property float32 y" << std::endl;
_out << "property float32 z" << std::endl;
if ( _opt.vertex_has_normal() ){
_out << "property float32 nx" << std::endl;
_out << "property float32 ny" << std::endl;
_out << "property float32 nz" << std::endl;
}
if ( _opt.vertex_has_texcoord() ){
_out << "property float32 u" << std::endl;
_out << "property float32 v" << std::endl;
@@ -214,6 +220,12 @@ write_ascii(std::ostream& _out, BaseExporter& _be, Options _opt) const
//Vertex
_out << v[0] << " " << v[1] << " " << v[2];
// Vertex Normals
if ( _opt.vertex_has_normal() ){
n = _be.normal(vh);
_out << " " << n[0] << " " << n[1] << " " << n[2];
}
// Vertex TexCoords
if ( _opt.vertex_has_texcoord() ) {
t = _be.texcoord(vh);
@@ -385,6 +397,12 @@ write_binary(std::ostream& _out, BaseExporter& _be, Options _opt) const
_out << "property float32 y" << std::endl;
_out << "property float32 z" << std::endl;
if ( _opt.vertex_has_normal() ){
_out << "property float32 nx" << std::endl;
_out << "property float32 ny" << std::endl;
_out << "property float32 nz" << std::endl;
}
if ( _opt.vertex_has_texcoord() ){
_out << "property float32 u" << std::endl;
_out << "property float32 v" << std::endl;
@@ -414,6 +432,14 @@ write_binary(std::ostream& _out, BaseExporter& _be, Options _opt) const
writeValue(ValueTypeFLOAT, _out, v[1]);
writeValue(ValueTypeFLOAT, _out, v[2]);
// Vertex Normal
if ( _opt.vertex_has_normal() ){
n = _be.normal(vh);
writeValue(ValueTypeFLOAT, _out, n[0]);
writeValue(ValueTypeFLOAT, _out, n[1]);
writeValue(ValueTypeFLOAT, _out, n[2]);
}
// Vertex TexCoords
if ( _opt.vertex_has_texcoord() ) {
t = _be.texcoord(vh);