Commit 90b7d21a authored by Jan Möbius's avatar Jan Möbius
Browse files

Fix: Dont write texture coordinates if writing them is disabled

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@20292 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 4d1a626a
......@@ -317,7 +317,7 @@ bool FileOBJPlugin::writeMesh(std::ostream& _out, QString _filename, MeshT& _mes
std::map<typename MeshT::HalfedgeHandle, int> vtMap;
// If mesh has halfedge tex coords, write them out instead of vertex texcoords
if(_mesh.has_halfedge_texcoords2D()) {
if(optionVertexTexCoords && _mesh.has_halfedge_texcoords2D()) {
int count = 1;
for (f_it = _mesh.faces_begin(); f_it != _mesh.faces_end(); ++f_it) {
for(fh_it=_mesh.fh_iter(*f_it); fh_it.is_valid(); ++fh_it) {
......@@ -363,17 +363,19 @@ bool FileOBJPlugin::writeMesh(std::ostream& _out, QString _filename, MeshT& _mes
// Write separator
_out << "/" ;
// Write vertex texture coordinate index
if ( optionVertexTexCoords && _mesh.has_halfedge_texcoords2D()) {
// Refer to halfedge texture coordinates
typename std::map<typename MeshT::HalfedgeHandle, int>::iterator it = vtMap.find(*fh_it);
if(it != vtMap.end())
_out << (*it).second;
} else if (optionVertexTexCoords && !_mesh.has_halfedge_texcoords2D() && _mesh.has_vertex_texcoords2D()) {
// Refer to vertex texture coordinates
typename std::map<typename MeshT::VertexHandle, int>::iterator it = vtMapV.find(_mesh.to_vertex_handle(*fh_it));
if(it != vtMapV.end())
_out << (*it).second;
if ( optionVertexTexCoords ) {
// Write vertex texture coordinate index
if ( optionVertexTexCoords && _mesh.has_halfedge_texcoords2D()) {
// Refer to halfedge texture coordinates
typename std::map<typename MeshT::HalfedgeHandle, int>::iterator it = vtMap.find(*fh_it);
if(it != vtMap.end())
_out << (*it).second;
} else if (optionVertexTexCoords && !_mesh.has_halfedge_texcoords2D() && _mesh.has_vertex_texcoords2D()) {
// Refer to vertex texture coordinates
typename std::map<typename MeshT::VertexHandle, int>::iterator it = vtMapV.find(_mesh.to_vertex_handle(*fh_it));
if(it != vtMapV.end())
_out << (*it).second;
}
}
// Write vertex normal index
......
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