Commit 4619e730 authored by Matthias Möller's avatar Matthias Möller

OM3 iterators

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17227 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 16b98d47
...@@ -1302,7 +1302,7 @@ void FileOFFPlugin::backupTextureCoordinates(MeshT& _mesh) { ...@@ -1302,7 +1302,7 @@ void FileOFFPlugin::backupTextureCoordinates(MeshT& _mesh) {
_mesh.add_property(oldVertexCoords, "Original Per Vertex Texture Coords"); _mesh.add_property(oldVertexCoords, "Original Per Vertex Texture Coords");
for (typename MeshT::VertexIter v_it = _mesh.vertices_begin(); v_it != _mesh.vertices_end(); ++v_it) for (typename MeshT::VertexIter v_it = _mesh.vertices_begin(); v_it != _mesh.vertices_end(); ++v_it)
_mesh.property(oldVertexCoords, v_it) = _mesh.texcoord2D(v_it); _mesh.property(oldVertexCoords, *v_it) = _mesh.texcoord2D(*v_it);
} }
...@@ -1314,7 +1314,7 @@ void FileOFFPlugin::backupTextureCoordinates(MeshT& _mesh) { ...@@ -1314,7 +1314,7 @@ void FileOFFPlugin::backupTextureCoordinates(MeshT& _mesh) {
_mesh.add_property(oldHalfedgeCoords,"Original Per Face Texture Coords"); _mesh.add_property(oldHalfedgeCoords,"Original Per Face Texture Coords");
for (typename MeshT::HalfedgeIter he_it = _mesh.halfedges_begin(); he_it != _mesh.halfedges_end(); ++he_it) for (typename MeshT::HalfedgeIter he_it = _mesh.halfedges_begin(); he_it != _mesh.halfedges_end(); ++he_it)
_mesh.property(oldHalfedgeCoords, he_it) = _mesh.texcoord2D(he_it); _mesh.property(oldHalfedgeCoords, *he_it) = _mesh.texcoord2D(*he_it);
} }
} }
......
...@@ -134,12 +134,12 @@ bool FileOFFPlugin::writeASCIIData(std::ostream& _out, MeshT& _mesh ) { ...@@ -134,12 +134,12 @@ bool FileOFFPlugin::writeASCIIData(std::ostream& _out, MeshT& _mesh ) {
_out << "\n"; _out << "\n";
// Write vertex p[0] p[1] p[2] // Write vertex p[0] p[1] p[2]
p = _mesh.point(vit.handle()); p = _mesh.point(*vit);
_out << p[0] << " " << p[1] << " " << p[2]; _out << p[0] << " " << p[1] << " " << p[2];
// Write vertex normals // Write vertex normals
if(_mesh.has_vertex_normals() && (userWriteOptions_ & OFFImporter::VERTEXNORMAL)) { if(_mesh.has_vertex_normals() && (userWriteOptions_ & OFFImporter::VERTEXNORMAL)) {
n = _mesh.normal(vit.handle()); n = _mesh.normal(*vit);
_out << " " << n[0] << " " << n[1] << " " << n[2]; _out << " " << n[0] << " " << n[1] << " " << n[2];
} }
...@@ -147,13 +147,13 @@ bool FileOFFPlugin::writeASCIIData(std::ostream& _out, MeshT& _mesh ) { ...@@ -147,13 +147,13 @@ bool FileOFFPlugin::writeASCIIData(std::ostream& _out, MeshT& _mesh ) {
// Note: Vertex colors always have only three components. // Note: Vertex colors always have only three components.
// This has to be determined since it can not be read dynamically in binary files. // This has to be determined since it can not be read dynamically in binary files.
if(_mesh.has_vertex_colors() && (userWriteOptions_ & OFFImporter::VERTEXCOLOR)) { if(_mesh.has_vertex_colors() && (userWriteOptions_ & OFFImporter::VERTEXCOLOR)) {
c = OpenMesh::color_cast<OpenMesh::Vec4f> (_mesh.color(vit.handle())); c = OpenMesh::color_cast<OpenMesh::Vec4f> (_mesh.color(*vit));
_out << " " << std::showpoint << c[0] << " " << std::showpoint << c[1] << " " << std::showpoint << c[2] << " " << std::showpoint << c[3]; _out << " " << std::showpoint << c[0] << " " << std::showpoint << c[1] << " " << std::showpoint << c[2] << " " << std::showpoint << c[3];
} }
// Write vertex texcoords // Write vertex texcoords
if(_mesh.has_vertex_texcoords2D() && (userWriteOptions_ & OFFImporter::VERTEXTEXCOORDS)) { if(_mesh.has_vertex_texcoords2D() && (userWriteOptions_ & OFFImporter::VERTEXTEXCOORDS)) {
t = _mesh.texcoord2D(vit.handle()); t = _mesh.texcoord2D(*vit);
_out << " " << t[0] << " " << t[1]; _out << " " << t[0] << " " << t[1];
} }
} }
...@@ -168,19 +168,19 @@ bool FileOFFPlugin::writeASCIIData(std::ostream& _out, MeshT& _mesh ) { ...@@ -168,19 +168,19 @@ bool FileOFFPlugin::writeASCIIData(std::ostream& _out, MeshT& _mesh ) {
_out << "\n"; _out << "\n";
// Write face valence // Write face valence
_out << _mesh.valence(fit.handle()); _out << _mesh.valence(*fit);
// Get face-vertex iterator // Get face-vertex iterator
fvit = _mesh.fv_iter(fit.handle()); fvit = _mesh.fv_iter(*fit);
// Write vertex indices // Write vertex indices
for(;fvit; ++fvit) { for(;fvit.is_valid(); ++fvit) {
_out << " " << fvit.handle().idx(); _out << " " << fvit->idx();
} }
// Write face colors // Write face colors
if(_mesh.has_face_colors() && (userWriteOptions_ & OFFImporter::FACECOLOR ) ) { if(_mesh.has_face_colors() && (userWriteOptions_ & OFFImporter::FACECOLOR ) ) {
c = OpenMesh::color_cast<OpenMesh::Vec4f> (_mesh.color(fit.handle())); c = OpenMesh::color_cast<OpenMesh::Vec4f> (_mesh.color(*fit));
_out << " " << std::showpoint << c[0] << " " << std::showpoint << c[1] << " " << std::showpoint << c[2]; _out << " " << std::showpoint << c[0] << " " << std::showpoint << c[1] << " " << std::showpoint << c[2];
if(userWriteOptions_ & OFFImporter::COLORALPHA) _out << " " << std::showpoint << c[3]; if(userWriteOptions_ & OFFImporter::COLORALPHA) _out << " " << std::showpoint << c[3];
...@@ -212,14 +212,14 @@ bool FileOFFPlugin::writeBinaryData(std::ostream& _out, MeshT& _mesh ){ ...@@ -212,14 +212,14 @@ bool FileOFFPlugin::writeBinaryData(std::ostream& _out, MeshT& _mesh ){
for(; vit != end_vit; ++vit) { for(; vit != end_vit; ++vit) {
// Write vertex p[0] p[1] p[2] // Write vertex p[0] p[1] p[2]
p = _mesh.point(vit.handle()); p = _mesh.point(*vit);
writeValue(_out, p[0]); writeValue(_out, p[0]);
writeValue(_out, p[1]); writeValue(_out, p[1]);
writeValue(_out, p[2]); writeValue(_out, p[2]);
// Write vertex normals // Write vertex normals
if(_mesh.has_vertex_normals() && (userWriteOptions_ & OFFImporter::VERTEXNORMAL)) { if(_mesh.has_vertex_normals() && (userWriteOptions_ & OFFImporter::VERTEXNORMAL)) {
n = _mesh.normal(vit.handle()); n = _mesh.normal(*vit);
writeValue(_out, n[0]); writeValue(_out, n[0]);
writeValue(_out, n[1]); writeValue(_out, n[1]);
writeValue(_out, n[2]); writeValue(_out, n[2]);
...@@ -229,7 +229,7 @@ bool FileOFFPlugin::writeBinaryData(std::ostream& _out, MeshT& _mesh ){ ...@@ -229,7 +229,7 @@ bool FileOFFPlugin::writeBinaryData(std::ostream& _out, MeshT& _mesh ){
// Note: Vertex colors always have only three components. // Note: Vertex colors always have only three components.
// This has to be determined since it can not be read dynamically in binary files. // This has to be determined since it can not be read dynamically in binary files.
if(_mesh.has_vertex_colors() && (userWriteOptions_ & OFFImporter::VERTEXCOLOR)) { if(_mesh.has_vertex_colors() && (userWriteOptions_ & OFFImporter::VERTEXCOLOR)) {
c = OpenMesh::color_cast<OpenMesh::Vec4f> (_mesh.color(vit.handle())); c = OpenMesh::color_cast<OpenMesh::Vec4f> (_mesh.color(*vit));
writeValue(_out, c[0]); writeValue(_out, c[0]);
writeValue(_out, c[1]); writeValue(_out, c[1]);
writeValue(_out, c[2]); writeValue(_out, c[2]);
...@@ -237,7 +237,7 @@ bool FileOFFPlugin::writeBinaryData(std::ostream& _out, MeshT& _mesh ){ ...@@ -237,7 +237,7 @@ bool FileOFFPlugin::writeBinaryData(std::ostream& _out, MeshT& _mesh ){
// Write vertex texcoords // Write vertex texcoords
if(_mesh.has_vertex_texcoords2D() && (userWriteOptions_ & OFFImporter::VERTEXTEXCOORDS)) { if(_mesh.has_vertex_texcoords2D() && (userWriteOptions_ & OFFImporter::VERTEXTEXCOORDS)) {
t = _mesh.texcoord2D(vit.handle()); t = _mesh.texcoord2D(*vit);
writeValue(_out, t[0]); writeValue(_out, t[0]);
writeValue(_out, t[1]); writeValue(_out, t[1]);
} }
...@@ -251,14 +251,14 @@ bool FileOFFPlugin::writeBinaryData(std::ostream& _out, MeshT& _mesh ){ ...@@ -251,14 +251,14 @@ bool FileOFFPlugin::writeBinaryData(std::ostream& _out, MeshT& _mesh ){
for(; fit != end_fit; ++fit) { for(; fit != end_fit; ++fit) {
// Write face valence // Write face valence
writeValue(_out, _mesh.valence(fit.handle())); writeValue(_out, _mesh.valence(*fit));
// Get face-vertex iterator // Get face-vertex iterator
fvit = _mesh.fv_iter(fit.handle()); fvit = _mesh.fv_iter(*fit);
// Write vertex indices // Write vertex indices
for(;fvit; ++fvit) { for(;fvit.is_valid(); ++fvit) {
writeValue(_out, fvit.handle().idx()); writeValue(_out, fvit->idx());
} }
// Write face colors // Write face colors
...@@ -269,7 +269,7 @@ bool FileOFFPlugin::writeBinaryData(std::ostream& _out, MeshT& _mesh ){ ...@@ -269,7 +269,7 @@ bool FileOFFPlugin::writeBinaryData(std::ostream& _out, MeshT& _mesh ){
else writeValue(_out, (uint)3); else writeValue(_out, (uint)3);
// Color itself // Color itself
c = OpenMesh::color_cast<OpenMesh::Vec4f> (_mesh.color(fit.handle())); c = OpenMesh::color_cast<OpenMesh::Vec4f> (_mesh.color(*fit));
writeValue(_out, c[0]); writeValue(_out, c[0]);
writeValue(_out, c[1]); writeValue(_out, c[1]);
writeValue(_out, c[2]); writeValue(_out, c[2]);
......
...@@ -362,8 +362,8 @@ void OFFImporter::finish() { ...@@ -362,8 +362,8 @@ void OFFImporter::finish() {
// Mark edges of failed face as non-two-manifold // Mark edges of failed face as non-two-manifold
if (triMesh()->has_edge_status()) { if (triMesh()->has_edge_status()) {
TriMesh::FaceEdgeIter fe_it = triMesh()->fe_iter(fh); TriMesh::FaceEdgeIter fe_it = triMesh()->fe_iter(fh);
for(; fe_it; ++fe_it) { for(; fe_it.is_valid(); ++fe_it) {
triMesh()->status(fe_it).set_fixed_nonmanifold(true); triMesh()->status(*fe_it).set_fixed_nonmanifold(true);
} }
} }
...@@ -401,8 +401,8 @@ void OFFImporter::finish() { ...@@ -401,8 +401,8 @@ void OFFImporter::finish() {
// Mark edges of failed face as non-two-manifold // Mark edges of failed face as non-two-manifold
if (polyMesh()->has_edge_status()) { if (polyMesh()->has_edge_status()) {
TriMesh::FaceEdgeIter fe_it = polyMesh()->fe_iter(fh); TriMesh::FaceEdgeIter fe_it = polyMesh()->fe_iter(fh);
for(; fe_it; ++fe_it) { for(; fe_it.is_valid(); ++fe_it) {
polyMesh()->status(fe_it).set_fixed_nonmanifold(true); polyMesh()->status(*fe_it).set_fixed_nonmanifold(true);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment