Commit fb428e26 authored by Matthias Möller's avatar Matthias Möller
Browse files

OM3 iterators

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17230 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 4e27b2c0
...@@ -403,7 +403,7 @@ void FileOBJPlugin::backupTextureCoordinates(MeshT& _mesh) { ...@@ -403,7 +403,7 @@ void FileOBJPlugin::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);
} }
...@@ -415,7 +415,7 @@ void FileOBJPlugin::backupTextureCoordinates(MeshT& _mesh) { ...@@ -415,7 +415,7 @@ void FileOBJPlugin::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);
} }
} }
...@@ -520,7 +520,7 @@ void FileOBJPlugin::addTextures(OBJImporter& _importer, int _objectID ){ ...@@ -520,7 +520,7 @@ void FileOBJPlugin::addTextures(OBJImporter& _importer, int _objectID ){
return; return;
for (f_it = mesh.faces_begin(); f_it != f_end; ++f_it) for (f_it = mesh.faces_begin(); f_it != f_end; ++f_it)
mesh.property(indexProperty, f_it) = newMapping[ mesh.property(indexProperty, f_it) ]; mesh.property(indexProperty, *f_it) = newMapping[ mesh.property(indexProperty, *f_it) ];
backupTextureCoordinates(mesh); backupTextureCoordinates(mesh);
...@@ -541,7 +541,7 @@ void FileOBJPlugin::addTextures(OBJImporter& _importer, int _objectID ){ ...@@ -541,7 +541,7 @@ void FileOBJPlugin::addTextures(OBJImporter& _importer, int _objectID ){
return; return;
for (f_it = mesh.faces_begin(); f_it != f_end; ++f_it) for (f_it = mesh.faces_begin(); f_it != f_end; ++f_it)
mesh.property(indexProperty, f_it) = newMapping[ mesh.property(indexProperty, f_it) ]; mesh.property(indexProperty, *f_it) = newMapping[ mesh.property(indexProperty, *f_it) ];
backupTextureCoordinates(mesh); backupTextureCoordinates(mesh);
......
...@@ -88,7 +88,7 @@ bool FileOBJPlugin::writeMaterial(QString _filename, MeshT& _mesh, int _objId ) ...@@ -88,7 +88,7 @@ bool FileOBJPlugin::writeMaterial(QString _filename, MeshT& _mesh, int _objId )
// Prepare materials ( getMaterial handles a list that is set up by this call) // Prepare materials ( getMaterial handles a list that is set up by this call)
for (f_it = _mesh.faces_begin(); f_it != f_end; ++f_it){ for (f_it = _mesh.faces_begin(); f_it != f_end; ++f_it){
getMaterial(_mesh, f_it.handle(), _objId); getMaterial(_mesh, *f_it, _objId);
} }
//write the materials //write the materials
...@@ -322,10 +322,10 @@ bool FileOBJPlugin::writeMesh(std::ostream& _out, QString _filename, MeshT& _mes ...@@ -322,10 +322,10 @@ bool FileOBJPlugin::writeMesh(std::ostream& _out, QString _filename, MeshT& _mes
if(_mesh.has_halfedge_texcoords2D()) { if(_mesh.has_halfedge_texcoords2D()) {
int count = 1; int count = 1;
for (f_it = _mesh.faces_begin(); f_it != _mesh.faces_end(); ++f_it) { for (f_it = _mesh.faces_begin(); f_it != _mesh.faces_end(); ++f_it) {
for(fh_it=_mesh.fh_iter(f_it.handle()); fh_it; ++fh_it) { for(fh_it=_mesh.fh_iter(*f_it); fh_it.is_valid(); ++fh_it) {
typename MeshT::TexCoord2D t = _mesh.texcoord2D(fh_it.handle()); typename MeshT::TexCoord2D t = _mesh.texcoord2D(*fh_it);
_out << "vt " << t[0] << " " << t[1] << std::endl; _out << "vt " << t[0] << " " << t[1] << std::endl;
vtMap.insert(std::pair<typename MeshT::HalfedgeHandle, int>(fh_it.handle(), count)); vtMap.insert(std::pair<typename MeshT::HalfedgeHandle, int>(*fh_it, count));
count++; count++;
} }
} }
...@@ -342,7 +342,7 @@ bool FileOBJPlugin::writeMesh(std::ostream& _out, QString _filename, MeshT& _mes ...@@ -342,7 +342,7 @@ bool FileOBJPlugin::writeMesh(std::ostream& _out, QString _filename, MeshT& _mes
if (useMaterial && optionFaceColors) { if (useMaterial && optionFaceColors) {
Material& material = getMaterial(_mesh, f_it.handle(), _objId); Material& material = getMaterial(_mesh, *f_it, _objId);
// If we are ina a new material block, specify in the file which material to use // If we are ina a new material block, specify in the file which material to use
if(lastMat != material) { if(lastMat != material) {
...@@ -354,10 +354,10 @@ bool FileOBJPlugin::writeMesh(std::ostream& _out, QString _filename, MeshT& _mes ...@@ -354,10 +354,10 @@ bool FileOBJPlugin::writeMesh(std::ostream& _out, QString _filename, MeshT& _mes
_out << "f"; _out << "f";
// Write out face information // Write out face information
for(fh_it=_mesh.fh_iter(f_it.handle()); fh_it; ++fh_it) { for(fh_it=_mesh.fh_iter(*f_it); fh_it.is_valid(); ++fh_it) {
// Write vertex index // Write vertex index
idx = _mesh.to_vertex_handle(fh_it.handle()).idx() + 1; idx = _mesh.to_vertex_handle(*fh_it).idx() + 1;
_out << " " << idx; _out << " " << idx;
if (!vertexOnly) { if (!vertexOnly) {
...@@ -368,12 +368,12 @@ bool FileOBJPlugin::writeMesh(std::ostream& _out, QString _filename, MeshT& _mes ...@@ -368,12 +368,12 @@ bool FileOBJPlugin::writeMesh(std::ostream& _out, QString _filename, MeshT& _mes
// Write vertex texture coordinate index // Write vertex texture coordinate index
if ( optionVertexTexCoords && _mesh.has_halfedge_texcoords2D()) { if ( optionVertexTexCoords && _mesh.has_halfedge_texcoords2D()) {
// Refer to halfedge texture coordinates // Refer to halfedge texture coordinates
typename std::map<typename MeshT::HalfedgeHandle, int>::iterator it = vtMap.find(fh_it.handle()); typename std::map<typename MeshT::HalfedgeHandle, int>::iterator it = vtMap.find(*fh_it);
if(it != vtMap.end()) if(it != vtMap.end())
_out << (*it).second; _out << (*it).second;
} else if (optionVertexTexCoords && !_mesh.has_halfedge_texcoords2D() && _mesh.has_vertex_texcoords2D()) { } else if (optionVertexTexCoords && !_mesh.has_halfedge_texcoords2D() && _mesh.has_vertex_texcoords2D()) {
// Refer to vertex texture coordinates // Refer to vertex texture coordinates
typename std::map<typename MeshT::VertexHandle, int>::iterator it = vtMapV.find(_mesh.to_vertex_handle(fh_it.handle())); typename std::map<typename MeshT::VertexHandle, int>::iterator it = vtMapV.find(_mesh.to_vertex_handle(*fh_it));
if(it != vtMapV.end()) if(it != vtMapV.end())
_out << (*it).second; _out << (*it).second;
} }
......
...@@ -956,8 +956,8 @@ void OBJImporter::finish() { ...@@ -956,8 +956,8 @@ void OBJImporter::finish() {
// Mark edges of failed face as non-two-manifold // Mark edges of failed face as non-two-manifold
if (currentTriMesh()->has_edge_status()) { if (currentTriMesh()->has_edge_status()) {
TriMesh::FaceEdgeIter fe_it = currentTriMesh()->fe_iter(fh); TriMesh::FaceEdgeIter fe_it = currentTriMesh()->fe_iter(fh);
for(; fe_it; ++fe_it) { for(; fe_it.is_valid(); ++fe_it) {
currentTriMesh()->status(fe_it).set_fixed_nonmanifold(true); currentTriMesh()->status(*fe_it).set_fixed_nonmanifold(true);
} }
} }
} }
...@@ -996,8 +996,8 @@ void OBJImporter::finish() { ...@@ -996,8 +996,8 @@ void OBJImporter::finish() {
// Mark edges of failed face as non-two-manifold // Mark edges of failed face as non-two-manifold
if (currentPolyMesh()->has_edge_status()) { if (currentPolyMesh()->has_edge_status()) {
PolyMesh::FaceEdgeIter fe_it = currentPolyMesh()->fe_iter(fh); PolyMesh::FaceEdgeIter fe_it = currentPolyMesh()->fe_iter(fh);
for(; fe_it; ++fe_it) { for(; fe_it.is_valid(); ++fe_it) {
currentPolyMesh()->status(fe_it).set_fixed_nonmanifold(true); currentPolyMesh()->status(*fe_it).set_fixed_nonmanifold(true);
} }
} }
} }
......
Supports Markdown
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