From 941e6bb679fbfcfbebfd56b9804ce7bd2d5a8b19 Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Sat, 21 Jan 2006 15:19:51 +0000 Subject: [PATCH] changed: inserting coord texture in to map from key = index, value=coord to key=coord, value=index_of_vertix. --- src/test/io/export_3ds.h | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/test/io/export_3ds.h b/src/test/io/export_3ds.h index 8d745202f..62fbd9404 100644 --- a/src/test/io/export_3ds.h +++ b/src/test/io/export_3ds.h @@ -25,6 +25,11 @@ History $Log$ + Revision 1.24 2006/01/21 15:19:51 fmazzant + changed: + inserting coord texture in to map from key = index, value=coord + to key=coord, value=index_of_vertix. + Revision 1.23 2006/01/20 14:15:52 fmazzant added texture filename on material 3ds and coordtexture on face @@ -153,12 +158,14 @@ namespace io { Lib3dsMesh *mesh = lib3ds_mesh_new("mesh");//crea una nuova mesh con nome mesh std::vector materials; - std::map,int> CoordTextures; - + //std::map,int> CoordTextures; + std::map > CoordTextures; + int current = 0; int max = m.vert.size()+m.face.size(); lib3ds_mesh_new_point_list(mesh, m.vert.size());//definisce il numero di vertici + int v_index = 0; VertexIterator vi; if(mask & vcg::tri::io::Mask::IOM_VERTQUALITY) @@ -170,7 +177,7 @@ namespace io { point.pos[1] = (*vi).P()[1]; point.pos[2] = (*vi).P()[2]; - mesh->pointL[v_index] = point; + mesh->pointL[v_index] = point; if (cb !=NULL) (*cb)(100.0 * (float)++current/(float)max, "writing vertices "); @@ -256,10 +263,8 @@ namespace io { unsigned int MAX = 3; for(unsigned int k=0;kfaceL[f_index]=face; @@ -278,15 +283,15 @@ namespace io { { if(lib3ds_mesh_new_texel_list(mesh,CoordTextures.size()))//alloca spazio per le coordinate di texture { - typedef std::map,int>::iterator MI; + typedef std::map >::iterator MI; int i =0; for(MI coord = CoordTextures.begin();coord!=CoordTextures.end();++coord) { - mesh->texelL[i][0] = (*coord).first.u(); - mesh->texelL[i][1] = (*coord).first.v(); + mesh->texelL[i][0] = (*coord).second.u(); + mesh->texelL[i][1] = (*coord).second.v(); i++; } - } + } else return E_NOTEXCOORDVALID; } @@ -319,13 +324,17 @@ namespace io { } /* - + aggiunge o sovrascrive il valore della coordinata di texture per vertice + TODO:migliorare...possibilità di eliminare anche la funzione. */ - inline static bool AddNewTextureCoord(std::map,int> &m, const vcg::TCoord2 &wt,int value) + inline static bool AddNewTextureCoord(std::map > &m, const vcg::TCoord2 &wt,int index_vertex) { - int index = m[wt]; - if(index==0){m[wt]=value;return true;} - return false; + //vcg::TCoord2 wtp = m[value]; + //if(wtp!=0){ + m[index_vertex]=wt; + return true; + //} + //return false; } /*