Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.

This commit is contained in:
mtarini 2007-03-12 16:40:17 +00:00
parent 84946de883
commit e1f61a9f6f
10 changed files with 75 additions and 51 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.1 2004/06/03 13:16:32 ganovelli
created
****************************************************************************/ ****************************************************************************/
#ifndef __VCGLIB_TETRAIMPORTERPLY #ifndef __VCGLIB_TETRAIMPORTERPLY
#define __VCGLIB_TETRAIMPORTERPLY #define __VCGLIB_TETRAIMPORTERPLY
@ -76,9 +79,9 @@ struct LoadPly_TetraAux
int v[512]; int v[512];
int flags; int flags;
float q; float q;
float tcoord[32]; float texcoord[32];
unsigned char ntcoord; unsigned char ntexcoord;
int tcoordind; int texcoordind;
float colors[32]; float colors[32];
unsigned char ncolors; unsigned char ncolors;
@ -161,9 +164,9 @@ static const PropDescriptor &TetraDesc(int i)
{"tetra", "vertex_indices", ply::T_INT, ply::T_INT, offsetof(LoadPly_TetraAux,v), 1,0,ply::T_UCHAR,ply::T_UCHAR,offsetof(LoadPly_TetraAux,size) }, {"tetra", "vertex_indices", ply::T_INT, ply::T_INT, offsetof(LoadPly_TetraAux,v), 1,0,ply::T_UCHAR,ply::T_UCHAR,offsetof(LoadPly_TetraAux,size) },
{"tetra", "flags", ply::T_INT, ply::T_INT, offsetof(LoadPly_TetraAux,flags), 0,0,0,0,0}, {"tetra", "flags", ply::T_INT, ply::T_INT, offsetof(LoadPly_TetraAux,flags), 0,0,0,0,0},
{"tetra", "quality", ply::T_FLOAT, ply::T_FLOAT, offsetof(LoadPly_TetraAux,q), 0,0,0,0,0}, {"tetra", "quality", ply::T_FLOAT, ply::T_FLOAT, offsetof(LoadPly_TetraAux,q), 0,0,0,0,0},
{"tetra", "texcoord", ply::T_FLOAT, ply::T_FLOAT, offsetof(LoadPly_TetraAux,tcoord), 1,0,ply::T_UCHAR,ply::T_UCHAR,offsetof(LoadPly_TetraAux,ntcoord) }, {"tetra", "texcoord", ply::T_FLOAT, ply::T_FLOAT, offsetof(LoadPly_TetraAux,texcoord), 1,0,ply::T_UCHAR,ply::T_UCHAR,offsetof(LoadPly_TetraAux,ntexcoord) },
{"tetra", "color", ply::T_FLOAT, ply::T_FLOAT, offsetof(LoadPly_TetraAux,colors), 1,0,ply::T_UCHAR,ply::T_UCHAR,offsetof(LoadPly_TetraAux,ncolors) }, {"tetra", "color", ply::T_FLOAT, ply::T_FLOAT, offsetof(LoadPly_TetraAux,colors), 1,0,ply::T_UCHAR,ply::T_UCHAR,offsetof(LoadPly_TetraAux,ncolors) },
{"tetra", "texnumber", ply::T_INT, ply::T_INT, offsetof(LoadPly_TetraAux,tcoordind), 0,0,0,0,0}, {"tetra", "texnumber", ply::T_INT, ply::T_INT, offsetof(LoadPly_TetraAux,texcoordind), 0,0,0,0,0},
{"tetra", "red" , ply::T_UCHAR, ply::T_UCHAR, offsetof(LoadPly_TetraAux,r), 0,0,0,0,0}, {"tetra", "red" , ply::T_UCHAR, ply::T_UCHAR, offsetof(LoadPly_TetraAux,r), 0,0,0,0,0},
{"tetra", "green", ply::T_UCHAR, ply::T_UCHAR, offsetof(LoadPly_TetraAux,g), 0,0,0,0,0}, {"tetra", "green", ply::T_UCHAR, ply::T_UCHAR, offsetof(LoadPly_TetraAux,g), 0,0,0,0,0},
{"tetra", "blue" , ply::T_UCHAR, ply::T_UCHAR, offsetof(LoadPly_TetraAux,b), 0,0,0,0,0}, {"tetra", "blue" , ply::T_UCHAR, ply::T_UCHAR, offsetof(LoadPly_TetraAux,b), 0,0,0,0,0},

View File

@ -25,6 +25,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.6 2006/11/30 22:48:06 cignoni
Corrected bug in exporting mesh with deleted vertices
Revision 1.5 2006/11/08 15:48:50 cignoni Revision 1.5 2006/11/08 15:48:50 cignoni
Corrected management of capabilities and masks Corrected management of capabilities and masks
@ -185,8 +188,8 @@ namespace io {
typedef typename SaveMeshType::VertexType VertexType; typedef typename SaveMeshType::VertexType VertexType;
//int: old index vertex //int: old index vertex
//TCoord2: textcoord with vertex's index i //TexCoord2: tex coord with vertex's index i
typedef std::pair<int,vcg::TCoord2<float> > Key; typedef std::pair<int,vcg::TexCoord2<float> > Key;
/* /*
enum of all the types of error enum of all the types of error
@ -327,7 +330,7 @@ namespace io {
std::vector<int> VertRemap; // VertRemap[i] keep the final position of m.vert[i] inside the 3ds vertex list. used for remapping the pointers to vertex in the faces std::vector<int> VertRemap; // VertRemap[i] keep the final position of m.vert[i] inside the 3ds vertex list. used for remapping the pointers to vertex in the faces
int count = 1; int count = 1;
int nface = 0; int nface = 0;
if(HasPerWedgeTexture(m) && (mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD) ) if(HasPerWedgeTexCoord(m) && (mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD) )
{ {
FaceIterator fi; FaceIterator fi;
for(fi=m.face.begin(); fi!=m.face.end(); ++fi) if( !(*fi).IsD() ) for(fi=m.face.begin(); fi!=m.face.end(); ++fi) if( !(*fi).IsD() )
@ -335,7 +338,7 @@ namespace io {
for(unsigned int k=0;k<3;k++) for(unsigned int k=0;k<3;k++)
{ {
int i = GetIndexVertex(m, (*fi).V(k)); int i = GetIndexVertex(m, (*fi).V(k));
vcg::TCoord2<float> t = (*fi).WT(k); vcg::TexCoord2<float> t = (*fi).WT(k);
if(!m.vert[i].IsD()) if(!m.vert[i].IsD())
{ {
if(AddDuplexVertexCoord(ListOfDuplexVert,Key(i,t))) if(AddDuplexVertexCoord(ListOfDuplexVert,Key(i,t)))
@ -356,7 +359,7 @@ namespace io {
int number_vertex_to_duplicate = 0; int number_vertex_to_duplicate = 0;
if(HasPerWedgeTexture(m) && (mask & MeshModel::IOM_WEDGTEXCOORD )) if(HasPerWedgeTexCoord(m) && (mask & MeshModel::IOM_WEDGTEXCOORD ))
number_vertex_to_duplicate = (count-1) - m.vn; number_vertex_to_duplicate = (count-1) - m.vn;
Lib3dsFile *file = lib3ds_file_new();//creates new file Lib3dsFile *file = lib3ds_file_new();//creates new file
@ -370,13 +373,13 @@ namespace io {
lib3ds_mesh_new_point_list(mesh, m.vn + number_vertex_to_duplicate);// set number of vertexs lib3ds_mesh_new_point_list(mesh, m.vn + number_vertex_to_duplicate);// set number of vertexs
if(HasPerWedgeTexture(m) && (mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD )) if(HasPerWedgeTexCoord(m) && (mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD ))
lib3ds_mesh_new_texel_list(mesh,m.vn + number_vertex_to_duplicate); //set number of textures lib3ds_mesh_new_texel_list(mesh,m.vn + number_vertex_to_duplicate); //set number of textures
int v_index = 0; int v_index = 0;
VertexIterator vi; VertexIterator vi;
//saves vert //saves vert
if(HasPerWedgeTexture(m) && (mask & MeshModel::IOM_WEDGTEXCOORD )) if(HasPerWedgeTexCoord(m) && (mask & MeshModel::IOM_WEDGTEXCOORD ))
{ {
for(unsigned int i=0; i< VectorOfVertexType.size();i++) for(unsigned int i=0; i< VectorOfVertexType.size();i++)
{ {
@ -419,11 +422,11 @@ namespace io {
FaceIterator fi; FaceIterator fi;
for(fi=m.face.begin(); fi!=m.face.end(); ++fi) if( !(*fi).IsD() ) for(fi=m.face.begin(); fi!=m.face.end(); ++fi) if( !(*fi).IsD() )
{ {
vcg::TCoord2<float> t0,t1,t2; vcg::TexCoord2<float> t0,t1,t2;
int i0 = GetIndexVertex(m, (*fi).V(0)); int i0 = GetIndexVertex(m, (*fi).V(0));
int i1 = GetIndexVertex(m, (*fi).V(1)); int i1 = GetIndexVertex(m, (*fi).V(1));
int i2 = GetIndexVertex(m, (*fi).V(2)); int i2 = GetIndexVertex(m, (*fi).V(2));
if(HasPerWedgeTexture(m) && (mask & MeshModel::IOM_WEDGTEXCOORD ) ) if(HasPerWedgeTexCoord(m) && (mask & MeshModel::IOM_WEDGTEXCOORD ) )
{ {
t0 = (*fi).WT(0); t0 = (*fi).WT(0);
t1 = (*fi).WT(1); t1 = (*fi).WT(1);
@ -431,7 +434,7 @@ namespace io {
} }
Lib3dsFace face; Lib3dsFace face;
if(HasPerWedgeTexture(m) && (mask & MeshModel::IOM_WEDGTEXCOORD )) if(HasPerWedgeTexCoord(m) && (mask & MeshModel::IOM_WEDGTEXCOORD ))
{ {
face.points[0] = GetIndexDuplexVertex(ListOfDuplexVert,Key(i0,t0)); face.points[0] = GetIndexDuplexVertex(ListOfDuplexVert,Key(i0,t0));
face.points[1] = GetIndexDuplexVertex(ListOfDuplexVert,Key(i1,t1)); face.points[1] = GetIndexDuplexVertex(ListOfDuplexVert,Key(i1,t1));
@ -445,7 +448,7 @@ namespace io {
} }
//saves coord textures //saves coord textures
if(HasPerWedgeTexture(m) && (mask & MeshModel::IOM_WEDGTEXCOORD ) ) if(HasPerWedgeTexCoord(m) && (mask & MeshModel::IOM_WEDGTEXCOORD ) )
{ {
mesh->texelL[face.points[0]][0] = t0.u(); mesh->texelL[face.points[0]][0] = t0.u();
mesh->texelL[face.points[0]][1] = t0.v(); mesh->texelL[face.points[0]][1] = t0.v();
@ -502,7 +505,7 @@ namespace io {
} }
//texture //texture
if(HasPerWedgeTexture(m) && (mask & MeshModel::IOM_WEDGTEXCOORD ) ) if(HasPerWedgeTexCoord(m) && (mask & MeshModel::IOM_WEDGTEXCOORD ) )
strcpy(material->texture1_map.name,materials[materials.size()-1].map_Kd.c_str()); strcpy(material->texture1_map.name,materials[materials.size()-1].map_Kd.c_str());
lib3ds_file_insert_material(file,material);//inserts the material inside the file lib3ds_file_insert_material(file,material);//inserts the material inside the file

View File

@ -25,6 +25,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.8 2007/03/08 11:27:52 ganovelli
added include to tcoord2
Revision 1.7 2007/02/16 21:12:13 m_di_benedetto Revision 1.7 2007/02/16 21:12:13 m_di_benedetto
Commented out strange abort in WriteMaterials() Commented out strange abort in WriteMaterials()
@ -92,7 +95,7 @@
#include <wrap/callback.h> #include <wrap/callback.h>
#include <vcg/complex/trimesh/allocate.h> #include <vcg/complex/trimesh/allocate.h>
#include <vcg/space/tcoord2.h> #include <vcg/space/texcoord2.h>
#include <wrap/io_trimesh/io_mask.h> #include <wrap/io_trimesh/io_mask.h>
#include "io_material.h" #include "io_material.h"
#include <iostream> #include <iostream>
@ -229,7 +232,7 @@ namespace io {
//faces + texture coords //faces + texture coords
FaceIterator fi; FaceIterator fi;
std::map<vcg::TCoord2<float>,int> CoordIndexTexture; std::map<vcg::TexCoord2<float>,int> CoordIndexTexture;
unsigned int material_num = 0; unsigned int material_num = 0;
int mem_index = 0; //var temporany int mem_index = 0; //var temporany
/*int*/ value = 1;//tmp /*int*/ value = 1;//tmp
@ -259,7 +262,7 @@ namespace io {
unsigned int MAX = 3; unsigned int MAX = 3;
for(unsigned int k=0;k<MAX;k++) for(unsigned int k=0;k<MAX;k++)
{ {
if(m.HasPerWedgeTexture() && mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD) if(m.HasPerWedgeTexCoord() && mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD)
{ {
if(AddNewTextureCoord(CoordIndexTexture,(*fi).WT(k),value)) if(AddNewTextureCoord(CoordIndexTexture,(*fi).WT(k),value))
{ {
@ -339,7 +342,7 @@ namespace io {
/* /*
returns index of the texture coord returns index of the texture coord
*/ */
inline static int GetIndexVertexTexture(std::map<vcg::TCoord2<float>,int> &m, const vcg::TCoord2<float> &wt) inline static int GetIndexVertexTexture(std::map<vcg::TexCoord2<float>,int> &m, const vcg::TexCoord2<float> &wt)
{ {
int index = m[wt]; int index = m[wt];
if(index!=0){return index;} if(index!=0){return index;}
@ -376,7 +379,7 @@ namespace io {
adds a new index to the coordinate of Texture if it is the first time adds a new index to the coordinate of Texture if it is the first time
which is otherwise met not execute anything which is otherwise met not execute anything
*/ */
inline static bool AddNewTextureCoord(std::map<vcg::TCoord2<float>,int> &m, const vcg::TCoord2<float> &wt,int value) inline static bool AddNewTextureCoord(std::map<vcg::TexCoord2<float>,int> &m, const vcg::TexCoord2<float> &wt,int value)
{ {
int index = m[wt]; int index = m[wt];
if(index==0){m[wt]=value;return true;} if(index==0){m[wt]=value;return true;}

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.11 2006/12/07 00:37:58 cignoni
Corrected bug in the management of deleted vertices
****************************************************************************/ ****************************************************************************/
/** /**
@ -65,7 +68,7 @@ namespace vcg {
if( m.HasPerVertexNormal() && (mask & io::Mask::IOM_VERTNORMAL)) fprintf(fpout,"N"); if( m.HasPerVertexNormal() && (mask & io::Mask::IOM_VERTNORMAL)) fprintf(fpout,"N");
if( m.HasPerVertexColor() && (mask & io::Mask::IOM_VERTCOLOR)) fprintf(fpout,"C"); if( m.HasPerVertexColor() && (mask & io::Mask::IOM_VERTCOLOR)) fprintf(fpout,"C");
if( m.HasPerVertexTexture() && (mask & io::Mask::IOM_VERTTEXCOORD)) fprintf(fpout,"ST"); if( m.HasPerVertexTexCoord() && (mask & io::Mask::IOM_VERTTEXCOORD)) fprintf(fpout,"ST");
fprintf(fpout,"OFF\n"); fprintf(fpout,"OFF\n");
fprintf(fpout,"%d %d 0\n", m.vn, m.fn); // note that as edge number we simply write zero fprintf(fpout,"%d %d 0\n", m.vn, m.fn); // note that as edge number we simply write zero
typename SaveMeshType::FaceIterator fi; typename SaveMeshType::FaceIterator fi;
@ -89,7 +92,7 @@ namespace vcg {
if( m.HasPerVertexNormal() && (mask & io::Mask::IOM_VERTNORMAL) ) if( m.HasPerVertexNormal() && (mask & io::Mask::IOM_VERTNORMAL) )
fprintf(fpout,"%g %g %g\n", vp->N()[0],vp->N()[1],vp->N()[2]); fprintf(fpout,"%g %g %g\n", vp->N()[0],vp->N()[1],vp->N()[2]);
if( m.HasPerVertexTexture() && (mask & io::Mask::IOM_VERTTEXCOORD) ) if( m.HasPerVertexTexCoord() && (mask & io::Mask::IOM_VERTTEXCOORD) )
fprintf(fpout,"%g %g\n",vp->T().u(),vp->T().v()); fprintf(fpout,"%g %g\n",vp->T().u(),vp->T().v());
vp->UberFlags()=j; // Trucco! Nascondi nei flags l'indice del vertice non deletato! vp->UberFlags()=j; // Trucco! Nascondi nei flags l'indice del vertice non deletato!

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.22 2007/02/18 08:01:07 cignoni
Added missing typename
Revision 1.21 2007/02/14 16:07:41 ganovelli Revision 1.21 2007/02/14 16:07:41 ganovelli
added HasPerFaceFlag added HasPerFaceFlag
@ -192,7 +195,7 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
for(i=0; i < static_cast<int>(m.textures.size()); ++i) for(i=0; i < static_cast<int>(m.textures.size()); ++i)
fprintf(fpout,"comment %s %s\n", TFILE, (const char *)(m.textures[i].c_str()) ); fprintf(fpout,"comment %s %s\n", TFILE, (const char *)(m.textures[i].c_str()) );
if(m.textures.size()>1 && (m.HasPerWedgeTexture() || m.HasPerVertexTexture())) multit = true; if(m.textures.size()>1 && (m.HasPerWedgeTexCoord() || m.HasPerVertexTexCoord())) multit = true;
} }
if((pi.mask & Mask::IOM_CAMERA)) if((pi.mask & Mask::IOM_CAMERA))
@ -274,8 +277,8 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
); );
} }
if( ( m.HasPerVertexTexture() && pi.mask & Mask::IOM_VERTTEXCOORD ) || if( ( m.HasPerVertexTexCoord() && pi.mask & Mask::IOM_VERTTEXCOORD ) ||
( m.HasPerWedgeTexture() && pi.mask & Mask::IOM_WEDGTEXCOORD ) ) ( m.HasPerWedgeTexCoord() && pi.mask & Mask::IOM_WEDGTEXCOORD ) )
{ {
fprintf(fpout, fprintf(fpout,
"property list uchar float texcoord\n" "property list uchar float texcoord\n"
@ -502,7 +505,7 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
if(m.HasPerVertexFlags()&&( pi.mask & Mask::IOM_FACEFLAGS) ) if(m.HasPerVertexFlags()&&( pi.mask & Mask::IOM_FACEFLAGS) )
fwrite(&(fp->Flags()),sizeof(int),1,fpout); fwrite(&(fp->Flags()),sizeof(int),1,fpout);
if( m.HasPerVertexTexture() && (pi.mask & Mask::IOM_VERTTEXCOORD) ) if( m.HasPerVertexTexCoord() && (pi.mask & Mask::IOM_VERTTEXCOORD) )
{ {
fwrite(&b6,sizeof(char),1,fpout); fwrite(&b6,sizeof(char),1,fpout);
float t[6]; float t[6];
@ -513,7 +516,7 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
} }
fwrite(t,sizeof(float),6,fpout); fwrite(t,sizeof(float),6,fpout);
} }
else if( m.HasPerWedgeTexture() && (pi.mask & Mask::IOM_WEDGTEXCOORD) ) else if( m.HasPerWedgeTexCoord() && (pi.mask & Mask::IOM_WEDGTEXCOORD) )
{ {
fwrite(&b6,sizeof(char),1,fpout); fwrite(&b6,sizeof(char),1,fpout);
float t[6]; float t[6];
@ -578,7 +581,7 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
if(m.HasPerVertexFlags()&&( pi.mask & Mask::IOM_FACEFLAGS )) if(m.HasPerVertexFlags()&&( pi.mask & Mask::IOM_FACEFLAGS ))
fprintf(fpout,"%d ",fp->Flags()); fprintf(fpout,"%d ",fp->Flags());
if( m.HasPerVertexTexture() && (pi.mask & Mask::IOM_VERTTEXCOORD) ) if( m.HasPerVertexTexCoord() && (pi.mask & Mask::IOM_VERTTEXCOORD) )
{ {
fprintf(fpout,"6 "); fprintf(fpout,"6 ");
for(int k=0;k<3;++k) for(int k=0;k<3;++k)
@ -587,7 +590,7 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
,fp->V(k)->T().v() ,fp->V(k)->T().v()
); );
} }
else if( m.HasPerWedgeTexture() && (pi.mask & Mask::IOM_WEDGTEXCOORD) ) else if( m.HasPerWedgeTexCoord() && (pi.mask & Mask::IOM_WEDGTEXCOORD) )
{ {
fprintf(fpout,"6 "); fprintf(fpout,"6 ");
for(int k=0;k<3;++k) for(int k=0;k<3;++k)

View File

@ -93,7 +93,7 @@ namespace io {
if (!srcnodetext.isNull()) if (!srcnodetext.isNull())
{ {
assert((ii * 2 < geosrcverttext.size()) && (ii * 2 + 1 < geosrcverttext.size())); assert((ii * 2 < geosrcverttext.size()) && (ii * 2 + 1 < geosrcverttext.size()));
m.vert[vv].T() = vcg::TCoord2<float>(); m.vert[vv].T() = vcg::TexCoord2<float>();
m.vert[vv].T().u() = geosrcverttext[ii * 2].toFloat(); m.vert[vv].T().u() = geosrcverttext[ii * 2].toFloat();
m.vert[vv].T().v() = geosrcverttext[ii * 2 + 1].toFloat(); m.vert[vv].T().v() = geosrcverttext[ii * 2 + 1].toFloat();
} }
@ -170,7 +170,7 @@ namespace io {
{ {
indtx = face.at(jj + offtx).toInt(); indtx = face.at(jj + offtx).toInt();
assert(indtx * 2 < wt.size()); assert(indtx * 2 < wt.size());
m.face[ff].WT(0) = vcg::TCoord2<float>(); m.face[ff].WT(0) = vcg::TexCoord2<float>();
m.face[ff].WT(0).u() = wt.at(indtx * 2).toFloat(); m.face[ff].WT(0).u() = wt.at(indtx * 2).toFloat();
m.face[ff].WT(0).v() = wt.at(indtx * 2 + 1).toFloat(); m.face[ff].WT(0).v() = wt.at(indtx * 2 + 1).toFloat();
m.face[ff].WT(0).n() = 1; m.face[ff].WT(0).n() = 1;
@ -199,7 +199,7 @@ namespace io {
{ {
indtx = face.at(jj + offtx).toInt(); indtx = face.at(jj + offtx).toInt();
assert(indtx * 2 < wt.size()); assert(indtx * 2 < wt.size());
m.face[ff].WT(1) = vcg::TCoord2<float>(); m.face[ff].WT(1) = vcg::TexCoord2<float>();
m.face[ff].WT(1).u() = wt.at(indtx * 2).toFloat(); m.face[ff].WT(1).u() = wt.at(indtx * 2).toFloat();
m.face[ff].WT(1).v() = wt.at(indtx * 2 + 1).toFloat(); m.face[ff].WT(1).v() = wt.at(indtx * 2 + 1).toFloat();
m.face[ff].WT(1).n() = 1; m.face[ff].WT(1).n() = 1;
@ -227,7 +227,7 @@ namespace io {
{ {
indtx = face.at(jj + offtx).toInt(); indtx = face.at(jj + offtx).toInt();
assert(indtx * 2 < wt.size()); assert(indtx * 2 < wt.size());
m.face[ff].WT(2) = vcg::TCoord2<float>(); m.face[ff].WT(2) = vcg::TexCoord2<float>();
m.face[ff].WT(2).u() = wt.at(indtx * 2).toFloat(); m.face[ff].WT(2).u() = wt.at(indtx * 2).toFloat();
m.face[ff].WT(2).v() = wt.at(indtx * 2 + 1).toFloat(); m.face[ff].WT(2).v() = wt.at(indtx * 2 + 1).toFloat();
m.face[ff].WT(2).n() = 1; m.face[ff].WT(2).n() = 1;
@ -249,7 +249,7 @@ namespace io {
else return E_NOMESH; else return E_NOMESH;
} }
static void GetTexture(const QDomDocument& doc,AdditionalInfoDAE* inf) static void GetTexCoord(const QDomDocument& doc,AdditionalInfoDAE* inf)
{ {
QDomNodeList txlst = doc.elementsByTagName("library_images"); QDomNodeList txlst = doc.elementsByTagName("library_images");
for(int img = 0;img < txlst.size();++img) for(int img = 0;img < txlst.size();++img)

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.19 2006/03/29 08:50:10 corsini
Fix bug in texture coordinates reading
Revision 1.18 2006/03/29 08:15:46 corsini Revision 1.18 2006/03/29 08:15:46 corsini
Fix several bugs Fix several bugs
Add LoadMask Add LoadMask
@ -397,7 +400,7 @@ namespace vcg
k++; k++;
// Store texture coordinates // Store texture coordinates
if (VertexType::HasTexture()) if (VertexType::HasTexCoord())
{ {
//...TODO... //...TODO...
} }

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.34 2007/03/03 02:28:59 cignoni
Removed initialization of a single face in the main parsing loop. Single face cannot exist anymore with OCF. Moved into the tristrip parsing section.
Revision 1.33 2007/02/14 15:30:13 ganovelli Revision 1.33 2007/02/14 15:30:13 ganovelli
added treatment of HasPerVertexFlags absent added treatment of HasPerVertexFlags absent
@ -183,9 +186,9 @@ struct LoadPly_FaceAux
int v[512]; int v[512];
int flags; int flags;
float q; float q;
float tcoord[32]; float texcoord[32];
unsigned char ntcoord; unsigned char ntexcoord;
int tcoordind; int texcoordind;
float colors[32]; float colors[32];
unsigned char ncolors; unsigned char ncolors;
@ -271,9 +274,9 @@ static const PropDescriptor &FaceDesc(int i)
{"face", "vertex_indices", ply::T_INT, ply::T_INT, offsetof(LoadPly_FaceAux,v), 1,0,ply::T_UCHAR,ply::T_UCHAR,offsetof(LoadPly_FaceAux,size) ,0}, {"face", "vertex_indices", ply::T_INT, ply::T_INT, offsetof(LoadPly_FaceAux,v), 1,0,ply::T_UCHAR,ply::T_UCHAR,offsetof(LoadPly_FaceAux,size) ,0},
{"face", "flags", ply::T_INT, ply::T_INT, offsetof(LoadPly_FaceAux,flags), 0,0,0,0,0 ,0}, {"face", "flags", ply::T_INT, ply::T_INT, offsetof(LoadPly_FaceAux,flags), 0,0,0,0,0 ,0},
{"face", "quality", ply::T_FLOAT, ply::T_FLOAT, offsetof(LoadPly_FaceAux,q), 0,0,0,0,0 ,0}, {"face", "quality", ply::T_FLOAT, ply::T_FLOAT, offsetof(LoadPly_FaceAux,q), 0,0,0,0,0 ,0},
{"face", "texcoord", ply::T_FLOAT, ply::T_FLOAT, offsetof(LoadPly_FaceAux,tcoord), 1,0,ply::T_UCHAR,ply::T_UCHAR,offsetof(LoadPly_FaceAux,ntcoord) ,0}, {"face", "texcoord", ply::T_FLOAT, ply::T_FLOAT, offsetof(LoadPly_FaceAux,texcoord), 1,0,ply::T_UCHAR,ply::T_UCHAR,offsetof(LoadPly_FaceAux,ntexcoord) ,0},
{"face", "color", ply::T_FLOAT, ply::T_FLOAT, offsetof(LoadPly_FaceAux,colors), 1,0,ply::T_UCHAR,ply::T_UCHAR,offsetof(LoadPly_FaceAux,ncolors) ,0}, {"face", "color", ply::T_FLOAT, ply::T_FLOAT, offsetof(LoadPly_FaceAux,colors), 1,0,ply::T_UCHAR,ply::T_UCHAR,offsetof(LoadPly_FaceAux,ncolors) ,0},
{"face", "texnumber", ply::T_INT, ply::T_INT, offsetof(LoadPly_FaceAux,tcoordind), 0,0,0,0,0 ,0}, {"face", "texnumber", ply::T_INT, ply::T_INT, offsetof(LoadPly_FaceAux,texcoordind), 0,0,0,0,0 ,0},
{"face", "red" , ply::T_UCHAR, ply::T_UCHAR, offsetof(LoadPly_FaceAux,r), 0,0,0,0,0 ,0}, {"face", "red" , ply::T_UCHAR, ply::T_UCHAR, offsetof(LoadPly_FaceAux,r), 0,0,0,0,0 ,0},
{"face", "green", ply::T_UCHAR, ply::T_UCHAR, offsetof(LoadPly_FaceAux,g), 0,0,0,0,0 ,0}, {"face", "green", ply::T_UCHAR, ply::T_UCHAR, offsetof(LoadPly_FaceAux,g), 0,0,0,0,0 ,0},
{"face", "blue" , ply::T_UCHAR, ply::T_UCHAR, offsetof(LoadPly_FaceAux,b), 0,0,0,0,0 ,0}, {"face", "blue" , ply::T_UCHAR, ply::T_UCHAR, offsetof(LoadPly_FaceAux,b), 0,0,0,0,0 ,0},
@ -491,7 +494,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
} }
if( FaceType::HasWedgeTexture() ) if( FaceType::HasWedgeTexCoord() )
{ {
if( pf.AddToRead(FaceDesc(3))!=-1 ) if( pf.AddToRead(FaceDesc(3))!=-1 )
{ {
@ -697,9 +700,9 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
{ {
for(int k=0;k<3;++k) for(int k=0;k<3;++k)
{ {
(*fi).WT(k).u() = fa.tcoord[k*2+0]; (*fi).WT(k).u() = fa.texcoord[k*2+0];
(*fi).WT(k).v() = fa.tcoord[k*2+1]; (*fi).WT(k).v() = fa.texcoord[k*2+1];
if(multit) (*fi).WT(k).n() = fa.tcoordind; if(multit) (*fi).WT(k).n() = fa.texcoordind;
else (*fi).WT(k).n()=0; // safely intialize texture index else (*fi).WT(k).n()=0; // safely intialize texture index
} }
} }

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.6 2006/05/21 06:58:55 cignoni
Added ClampMask function
Revision 1.5 2006/01/10 13:20:42 cignoni Revision 1.5 2006/01/10 13:20:42 cignoni
Changed ply::PlyMask to io::Mask Changed ply::PlyMask to io::Mask
@ -98,7 +101,7 @@ enum {
// if( mask & IOM_VERTFLAGS ) strcat(str,"flag,"); // if( mask & IOM_VERTFLAGS ) strcat(str,"flag,");
// if( mask & IOM_VERTCOLOR ) strcat(str,"color,"); // if( mask & IOM_VERTCOLOR ) strcat(str,"color,");
// if( mask & IOM_VERTQUALITY ) strcat(str,"quality,"); // if( mask & IOM_VERTQUALITY ) strcat(str,"quality,");
// if( mask & IOM_VERTTEXCOORD ) strcat(str,"tcoord,"); // if( mask & IOM_VERTTEXCOORD ) strcat(str,"texcoord,");
// if( mask & IOM_VERTNORMAL ) strcat(str,"normal,"); // if( mask & IOM_VERTNORMAL ) strcat(str,"normal,");
// //
// strcat(str," F:"); // strcat(str," F:");
@ -109,7 +112,7 @@ enum {
// //
// strcat(str," W:"); // strcat(str," W:");
// if( mask & IOM_WEDGCOLOR ) strcat(str,"color,"); // if( mask & IOM_WEDGCOLOR ) strcat(str,"color,");
// if( mask & IOM_WEDGTEXCOORD ) strcat(str,"tcoord,"); // if( mask & IOM_WEDGTEXCOORD ) strcat(str,"texcoord,");
// if( mask & IOM_WEDGNORMAL ) strcat(str,"normal,"); // if( mask & IOM_WEDGNORMAL ) strcat(str,"normal,");
// //
// if( mask & IOM_CAMERA ) strcat(str," camera"); // if( mask & IOM_CAMERA ) strcat(str," camera");
@ -118,7 +121,7 @@ template <class MeshType>
static void ClampMask(MeshType &m, int &mask) static void ClampMask(MeshType &m, int &mask)
{ {
if( (mask & IOM_FACECOLOR) && !HasPerFaceColor(m) ) mask = mask & (~IOM_FACECOLOR); if( (mask & IOM_FACECOLOR) && !HasPerFaceColor(m) ) mask = mask & (~IOM_FACECOLOR);
if( (mask & IOM_WEDGTEXCOORD) && !HasPerWedgeTexture(m) ) mask = mask & (~IOM_WEDGTEXCOORD); if( (mask & IOM_WEDGTEXCOORD) && !HasPerWedgeTexCoord(m) ) mask = mask & (~IOM_WEDGTEXCOORD);
if( (mask & IOM_WEDGNORMAL) && !m.HasPerWedgeNormal() ) mask = mask & (~IOM_WEDGNORMAL); if( (mask & IOM_WEDGNORMAL) && !m.HasPerWedgeNormal() ) mask = mask & (~IOM_WEDGNORMAL);
if( (mask & IOM_VERTCOLOR) && !m.HasPerVertexColor() ) mask = mask & (~IOM_VERTCOLOR); if( (mask & IOM_VERTCOLOR) && !m.HasPerVertexColor() ) mask = mask & (~IOM_VERTCOLOR);
} }

View File

@ -12,7 +12,7 @@
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include<vcg/space/point3.h> #include<vcg/space/point3.h>
#include<vcg/space/tcoord2.h> #include<vcg/space/texcoord2.h>
#include<vcg/space/color4.h> #include<vcg/space/color4.h>
#include <wrap/callback.h> #include <wrap/callback.h>