- improved support for double precision floating point attributes

This commit is contained in:
granzuglia 2014-10-06 08:28:40 +00:00
parent adca0d032e
commit eefdd5ddf6
2 changed files with 625 additions and 621 deletions

View File

@ -32,28 +32,31 @@
//#include<wrap/ply/io_mask.h>
#include<wrap/io_trimesh/io_mask.h>
#include<wrap/io_trimesh/io_ply.h>
#include<wrap/io_trimesh/precision.h>
#include<vcg/container/simple_temporary_data.h>
#include <stdio.h>
namespace vcg {
namespace tri {
namespace io {
namespace tri {
namespace io {
template <class SaveMeshType>
class ExporterPLY
{
template <class SaveMeshType>
class ExporterPLY
{
// Si occupa di convertire da un tipo all'altro.
// usata nella saveply per matchare i tipi tra stotype e memtype.
// Ad es se in memoria c'e' un int e voglio salvare un float
// src sara in effetti un puntatore a int il cui valore deve
// essere convertito al tipo di ritorno desiderato (stotype)
// usata nella saveply per matchare i tipi tra stotype e memtype.
// Ad es se in memoria c'e' un int e voglio salvare un float
// src sara in effetti un puntatore a int il cui valore deve
// essere convertito al tipo di ritorno desiderato (stotype)
template <class StoType>
static void PlyConv(int mem_type, void *src, StoType &dest)
{
template <class StoType>
static void PlyConv(int mem_type, void *src, StoType &dest)
{
switch (mem_type){
case ply::T_FLOAT : dest = (StoType) (* ((float *) src)); break;
case ply::T_DOUBLE: dest = (StoType) (* ((double *) src)); break;
@ -63,41 +66,46 @@ static void PlyConv(int mem_type, void *src, StoType &dest)
case ply::T_UCHAR : dest = (StoType) (* ((unsigned char *)src)); break;
default : assert(0);
}
}
}
public:
typedef ::vcg::ply::PropDescriptor PropDescriptor ;
typedef typename SaveMeshType::VertexPointer VertexPointer;
typedef typename SaveMeshType::ScalarType ScalarType;
typedef typename SaveMeshType::VertexType VertexType;
typedef typename SaveMeshType::FaceType FaceType;
typedef typename SaveMeshType::FacePointer FacePointer;
typedef typename SaveMeshType::VertexIterator VertexIterator;
typedef typename SaveMeshType::FaceIterator FaceIterator;
typedef typename SaveMeshType::EdgeIterator EdgeIterator;
public:
typedef ::vcg::ply::PropDescriptor PropDescriptor ;
typedef typename SaveMeshType::VertexPointer VertexPointer;
typedef typename SaveMeshType::ScalarType ScalarType;
typedef typename SaveMeshType::VertexType VertexType;
typedef typename SaveMeshType::FaceType FaceType;
typedef typename SaveMeshType::FacePointer FacePointer;
typedef typename SaveMeshType::VertexIterator VertexIterator;
typedef typename SaveMeshType::FaceIterator FaceIterator;
typedef typename SaveMeshType::EdgeIterator EdgeIterator;
typedef typename SaveMeshType::ShotType::ScalarType ShotScalarType;
static int Save(SaveMeshType &m, const char * filename, bool binary=true)
{
static int Save(SaveMeshType &m, const char * filename, bool binary=true)
{
PlyInfo pi;
return Save(m,filename,binary,pi);
}
}
static int Save(SaveMeshType &m, const char * filename, int savemask, bool binary = true, CallBackPos *cb=0 )
{
static int Save(SaveMeshType &m, const char * filename, int savemask, bool binary = true, CallBackPos *cb=0 )
{
PlyInfo pi;
pi.mask=savemask;
return Save(m,filename,binary,pi,cb);
}
}
static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &pi, CallBackPos *cb=0) // V1.0
{
static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &pi, CallBackPos *cb=0) // V1.0
{
FILE * fpout;
int i;
const char * hbin = "binary_little_endian";
const char * hasc = "ascii";
const char * h;
//Coord ScalarType
const int DGT = vcg::tri::io::Precision<ScalarType>::digits();
const int DGTS = vcg::tri::io::Precision<ShotScalarType>::digits();
const int DGTVQ = vcg::tri::io::Precision<typename VertexType::QualityType>::digits();
const int DGTVR = vcg::tri::io::Precision<typename VertexType::RadiusType>::digits();
const int DGTFQ = vcg::tri::io::Precision<typename FaceType::QualityType>::digits();
bool multit = false;
if(binary) h=hbin;
@ -127,49 +135,44 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
if((pi.mask & Mask::IOM_CAMERA))
{
fprintf(fpout,
"element camera 1\n"
"property float view_px\n"
"property float view_py\n"
"property float view_pz\n"
"property float x_axisx\n"
"property float x_axisy\n"
"property float x_axisz\n"
"property float y_axisx\n"
"property float y_axisy\n"
"property float y_axisz\n"
"property float z_axisx\n"
"property float z_axisy\n"
"property float z_axisz\n"
"property float focal\n"
"property float scalex\n"
"property float scaley\n"
"property float centerx\n"
"property float centery\n"
"property int viewportx\n"
"property int viewporty\n"
"property float k1\n"
"property float k2\n"
"property float k3\n"
"property float k4\n"
);
const char* cmtp = vcg::tri::io::Precision<typename SaveMeshType::ShotType::ScalarType>::typeName();
fprintf(fpout,"element camera 1\n");
fprintf(fpout,"property %s view_px\n",cmtp);
fprintf(fpout,"property %s view_py\n",cmtp);
fprintf(fpout,"property %s view_pz\n",cmtp);
fprintf(fpout,"property %s x_axisx\n",cmtp);
fprintf(fpout,"property %s x_axisy\n",cmtp);
fprintf(fpout,"property %s x_axisz\n",cmtp);
fprintf(fpout,"property %s y_axisx\n",cmtp);
fprintf(fpout,"property %s y_axisy\n",cmtp);
fprintf(fpout,"property %s y_axisz\n",cmtp);
fprintf(fpout,"property %s z_axisx\n",cmtp);
fprintf(fpout,"property %s z_axisy\n",cmtp);
fprintf(fpout,"property %s z_axisz\n",cmtp);
fprintf(fpout,"property %s focal\n",cmtp);
fprintf(fpout,"property %s scalex\n",cmtp);
fprintf(fpout,"property %s scaley\n",cmtp);
fprintf(fpout,"property %s centerx\n",cmtp);
fprintf(fpout,"property %s centery\n",cmtp);
fprintf(fpout,"property int viewportx\n");
fprintf(fpout,"property int viewporty\n");
fprintf(fpout,"property %s k1\n",cmtp);
fprintf(fpout,"property %s k2\n",cmtp);
fprintf(fpout,"property %s k3\n",cmtp);
fprintf(fpout,"property %s k4\n",cmtp);
}
fprintf(fpout,
"element vertex %d\n"
"property float x\n"
"property float y\n"
"property float z\n"
,m.vn
);
const char* vttp = vcg::tri::io::Precision<ScalarType>::typeName();
fprintf(fpout,"element vertex %d\n",m.vn);
fprintf(fpout,"property %s x\n",vttp);
fprintf(fpout,"property %s y\n",vttp);
fprintf(fpout,"property %s z\n",vttp);
if( HasPerVertexNormal(m) &&( pi.mask & Mask::IOM_VERTNORMAL) )
{
fprintf(fpout,
"property float nx\n"
"property float ny\n"
"property float nz\n"
);
fprintf(fpout,"property %s nx\n",vttp);
fprintf(fpout,"property %s ny\n",vttp);
fprintf(fpout,"property %s nz\n",vttp);
}
@ -192,16 +195,14 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
if( HasPerVertexQuality(m) && (pi.mask & Mask::IOM_VERTQUALITY) )
{
fprintf(fpout,
"property float quality\n"
);
const char* vqtp = vcg::tri::io::Precision<typename VertexType::ScalarType>::typeName();
fprintf(fpout,"property %s quality\n",vqtp);
}
if( tri::HasPerVertexRadius(m) && (pi.mask & Mask::IOM_VERTRADIUS) )
{
fprintf(fpout,
"property float radius\n"
);
const char* rdtp = vcg::tri::io::Precision<typename VertexType::RadiusType>::typeName();
fprintf(fpout,"property float radius\n",rdtp);
}
if( ( HasPerVertexTexCoord(m) && pi.mask & Mask::IOM_VERTTEXCOORD ) )
{
@ -257,9 +258,8 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
if( HasPerFaceQuality(m) && (pi.mask & Mask::IOM_FACEQUALITY) )
{
fprintf(fpout,
"property float quality\n"
);
const char* fqtp = vcg::tri::io::Precision<typename SaveMeshType::FaceType::ScalarType>::typeName();
fprintf(fpout,"property %s quality\n",fqtp);
}
for(i=0;i<pi.fdn;i++)
@ -279,61 +279,61 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
{
if(binary)
{
float t[17];
ShotScalarType t[17];
t[ 0] = (float)m.shot.Extrinsics.Tra()[0];
t[ 1] = (float)m.shot.Extrinsics.Tra()[1];
t[ 2] = (float)m.shot.Extrinsics.Tra()[2];
t[ 3] = (float)m.shot.Extrinsics.Rot()[0][0];
t[ 4] = (float)m.shot.Extrinsics.Rot()[0][1];
t[ 5] = (float)m.shot.Extrinsics.Rot()[0][2];
t[ 6] = (float)m.shot.Extrinsics.Rot()[1][0];
t[ 7] = (float)m.shot.Extrinsics.Rot()[1][1];
t[ 8] = (float)m.shot.Extrinsics.Rot()[1][2];
t[ 9] = (float)m.shot.Extrinsics.Rot()[2][0];
t[10] = (float)m.shot.Extrinsics.Rot()[2][1];
t[11] = (float)m.shot.Extrinsics.Rot()[2][2];
t[12] = (float)m.shot.Intrinsics.FocalMm;
t[13] = (float)m.shot.Intrinsics.PixelSizeMm[0];
t[14] = (float)m.shot.Intrinsics.PixelSizeMm[1];
t[15] = (float)m.shot.Intrinsics.CenterPx[0];
t[16] = (float)m.shot.Intrinsics.CenterPx[1];
fwrite(t,sizeof(float),17,fpout);
t[ 0] = (ShotScalarType)m.shot.Extrinsics.Tra()[0];
t[ 1] = (ShotScalarType)m.shot.Extrinsics.Tra()[1];
t[ 2] = (ShotScalarType)m.shot.Extrinsics.Tra()[2];
t[ 3] = (ShotScalarType)m.shot.Extrinsics.Rot()[0][0];
t[ 4] = (ShotScalarType)m.shot.Extrinsics.Rot()[0][1];
t[ 5] = (ShotScalarType)m.shot.Extrinsics.Rot()[0][2];
t[ 6] = (ShotScalarType)m.shot.Extrinsics.Rot()[1][0];
t[ 7] = (ShotScalarType)m.shot.Extrinsics.Rot()[1][1];
t[ 8] = (ShotScalarType)m.shot.Extrinsics.Rot()[1][2];
t[ 9] = (ShotScalarType)m.shot.Extrinsics.Rot()[2][0];
t[10] = (ShotScalarType)m.shot.Extrinsics.Rot()[2][1];
t[11] = (ShotScalarType)m.shot.Extrinsics.Rot()[2][2];
t[12] = (ShotScalarType)m.shot.Intrinsics.FocalMm;
t[13] = (ShotScalarType)m.shot.Intrinsics.PixelSizeMm[0];
t[14] = (ShotScalarType)m.shot.Intrinsics.PixelSizeMm[1];
t[15] = (ShotScalarType)m.shot.Intrinsics.CenterPx[0];
t[16] = (ShotScalarType)m.shot.Intrinsics.CenterPx[1];
fwrite(t,sizeof(ShotScalarType),17,fpout);
fwrite( &m.shot.Intrinsics.ViewportPx[0],sizeof(int),2,fpout );
t[ 0] = (float)m.shot.Intrinsics.k[0];
t[ 1] = (float)m.shot.Intrinsics.k[1];
t[ 2] = (float)m.shot.Intrinsics.k[2];
t[ 3] = (float)m.shot.Intrinsics.k[3];
fwrite(t,sizeof(float),4,fpout);
t[ 0] = (ShotScalarType)m.shot.Intrinsics.k[0];
t[ 1] = (ShotScalarType)m.shot.Intrinsics.k[1];
t[ 2] = (ShotScalarType)m.shot.Intrinsics.k[2];
t[ 3] = (ShotScalarType)m.shot.Intrinsics.k[3];
fwrite(t,sizeof(ShotScalarType),4,fpout);
}
else
{
fprintf(fpout,"%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d %d %g %g %g %g\n"
,-m.shot.Extrinsics.Tra()[0]
,-m.shot.Extrinsics.Tra()[1]
,-m.shot.Extrinsics.Tra()[2]
,m.shot.Extrinsics.Rot()[0][0]
,m.shot.Extrinsics.Rot()[0][1]
,m.shot.Extrinsics.Rot()[0][2]
,m.shot.Extrinsics.Rot()[1][0]
,m.shot.Extrinsics.Rot()[1][1]
,m.shot.Extrinsics.Rot()[1][2]
,m.shot.Extrinsics.Rot()[2][0]
,m.shot.Extrinsics.Rot()[2][1]
,m.shot.Extrinsics.Rot()[2][2]
,m.shot.Intrinsics.FocalMm
,m.shot.Intrinsics.PixelSizeMm[0]
,m.shot.Intrinsics.PixelSizeMm[1]
,m.shot.Intrinsics.CenterPx[0]
,m.shot.Intrinsics.CenterPx[1]
fprintf(fpout,"%.*g %.*g %.*g %.*g %.*g %.*g %.*g %.*g %.*g %.*g %.*g %.*g %.*g %.*g %.*g %.*g %.*g %d %d %.*g %.*g %.*g %.*g\n"
,DGTS,-m.shot.Extrinsics.Tra()[0]
,DGTS,-m.shot.Extrinsics.Tra()[1]
,DGTS,-m.shot.Extrinsics.Tra()[2]
,DGTS,m.shot.Extrinsics.Rot()[0][0]
,DGTS,m.shot.Extrinsics.Rot()[0][1]
,DGTS,m.shot.Extrinsics.Rot()[0][2]
,DGTS,m.shot.Extrinsics.Rot()[1][0]
,DGTS,m.shot.Extrinsics.Rot()[1][1]
,DGTS,m.shot.Extrinsics.Rot()[1][2]
,DGTS,m.shot.Extrinsics.Rot()[2][0]
,DGTS,m.shot.Extrinsics.Rot()[2][1]
,DGTS,m.shot.Extrinsics.Rot()[2][2]
,DGTS,m.shot.Intrinsics.FocalMm
,DGTS,m.shot.Intrinsics.PixelSizeMm[0]
,DGTS,m.shot.Intrinsics.PixelSizeMm[1]
,DGTS,m.shot.Intrinsics.CenterPx[0]
,DGTS,m.shot.Intrinsics.CenterPx[1]
,m.shot.Intrinsics.ViewportPx[0]
,m.shot.Intrinsics.ViewportPx[1]
,m.shot.Intrinsics.k[0]
,m.shot.Intrinsics.k[1]
,m.shot.Intrinsics.k[2]
,m.shot.Intrinsics.k[3]
,DGTS,m.shot.Intrinsics.k[0]
,DGTS,m.shot.Intrinsics.k[1]
,DGTS,m.shot.Intrinsics.k[2]
,DGTS,m.shot.Intrinsics.k[3]
);
}
}
@ -355,17 +355,17 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
{
if(binary)
{
float t;
ScalarType t;
t = float(vp->P()[0]); fwrite(&t,sizeof(float),1,fpout);
t = float(vp->P()[1]); fwrite(&t,sizeof(float),1,fpout);
t = float(vp->P()[2]); fwrite(&t,sizeof(float),1,fpout);
t = ScalarType(vp->P()[0]); fwrite(&t,sizeof(ScalarType),1,fpout);
t = ScalarType(vp->P()[1]); fwrite(&t,sizeof(ScalarType),1,fpout);
t = ScalarType(vp->P()[2]); fwrite(&t,sizeof(ScalarType),1,fpout);
if( HasPerVertexNormal(m) && (pi.mask & Mask::IOM_VERTNORMAL) )
{
t = float(vp->N()[0]); fwrite(&t,sizeof(float),1,fpout);
t = float(vp->N()[1]); fwrite(&t,sizeof(float),1,fpout);
t = float(vp->N()[2]); fwrite(&t,sizeof(float),1,fpout);
t = ScalarType(vp->N()[0]); fwrite(&t,sizeof(ScalarType),1,fpout);
t = ScalarType(vp->N()[1]); fwrite(&t,sizeof(ScalarType),1,fpout);
t = ScalarType(vp->N()[2]); fwrite(&t,sizeof(ScalarType),1,fpout);
}
if( HasPerVertexFlags(m) && (pi.mask & Mask::IOM_VERTFLAGS) )
fwrite(&(vp->Flags()),sizeof(int),1,fpout);
@ -374,10 +374,10 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
fwrite(&( vp->C() ),sizeof(char),4,fpout);
if( HasPerVertexQuality(m) && (pi.mask & Mask::IOM_VERTQUALITY) )
fwrite(&( vp->Q() ),sizeof(float),1,fpout);
fwrite(&( vp->Q() ),sizeof(typename VertexType::QualityType),1,fpout);
if( HasPerVertexRadius(m) && (pi.mask & Mask::IOM_VERTRADIUS) )
fwrite(&( vp->R() ),sizeof(float),1,fpout);
fwrite(&( vp->R() ),sizeof(typename VertexType::RadiusType),1,fpout);
if( HasPerVertexTexCoord(m) && (pi.mask & Mask::IOM_VERTTEXCOORD) )
{
@ -402,10 +402,10 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
}
else // ***** ASCII *****
{
fprintf(fpout,"%g %g %g " ,vp->P()[0],vp->P()[1],vp->P()[2]);
fprintf(fpout,"%.*g %.*g %.*g " ,DGT,vp->P()[0],DGT,vp->P()[1],DGT,vp->P()[2]);
if( HasPerVertexNormal(m) && (pi.mask & Mask::IOM_VERTNORMAL) )
fprintf(fpout,"%g %g %g " ,double(vp->N()[0]),double(vp->N()[1]),double(vp->N()[2]));
fprintf(fpout,"%.*g %.*g %.*g " ,DGT,vp->N()[0],DGT,vp->N()[1],DGT,vp->N()[2]);
if( HasPerVertexFlags(m) && (pi.mask & Mask::IOM_VERTFLAGS))
fprintf(fpout,"%d ",vp->Flags());
@ -414,13 +414,13 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
fprintf(fpout,"%d %d %d %d ",vp->C()[0],vp->C()[1],vp->C()[2],vp->C()[3] );
if( HasPerVertexQuality(m) && (pi.mask & Mask::IOM_VERTQUALITY) )
fprintf(fpout,"%g ",vp->Q());
fprintf(fpout,"%.*g ",DGTVQ,vp->Q());
if( HasPerVertexRadius(m) && (pi.mask & Mask::IOM_VERTRADIUS) )
fprintf(fpout,"%g ",vp->R());
fprintf(fpout,"%.*g ",DGTVR,vp->R());
if( HasPerVertexTexCoord(m) && (pi.mask & Mask::IOM_VERTTEXCOORD) )
fprintf(fpout,"%g %g",vp->T().u(),vp->T().v());
fprintf(fpout,"%f %f",vp->T().u(),vp->T().v());
for(i=0;i<pi.vdn;i++)
{
@ -428,8 +428,8 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
int ti;
switch (pi.VertexData[i].memtype1)
{
case ply::T_FLOAT : tf=*( (float *) (((char *)vp)+pi.VertexData[i].offset1)); fprintf(fpout,"%g ",tf); break;
case ply::T_DOUBLE : td=*( (double *) (((char *)vp)+pi.VertexData[i].offset1)); fprintf(fpout,"%g ",tf); break;
case ply::T_FLOAT : tf=*( (float *) (((char *)vp)+pi.VertexData[i].offset1)); fprintf(fpout,"%f ",tf); break;
case ply::T_DOUBLE : td=*( (double *) (((char *)vp)+pi.VertexData[i].offset1)); fprintf(fpout,"%f ",tf); break;
case ply::T_INT : ti=*( (int *) (((char *)vp)+pi.VertexData[i].offset1)); fprintf(fpout,"%i ",ti); break;
case ply::T_SHORT : ti=*( (short *) (((char *)vp)+pi.VertexData[i].offset1)); fprintf(fpout,"%i ",ti); break;
case ply::T_CHAR : ti=*( (char *) (((char *)vp)+pi.VertexData[i].offset1)); fprintf(fpout,"%i ",ti); break;
@ -521,7 +521,7 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
}
if( HasPerFaceQuality(m) && (pi.mask & Mask::IOM_FACEQUALITY) )
fwrite( &(fp->Q()),sizeof(float),1,fpout);
fwrite( &(fp->Q()),sizeof(typename FaceType::ScalarType),1,fpout);
for(i=0;i<pi.fdn;i++)
@ -551,7 +551,7 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
{
fprintf(fpout,"%d ",fp->VN()*2);
for(int k=0;k<fp->VN();++k)
fprintf(fpout,"%g %g "
fprintf(fpout,"%f %f "
,fp->V(k)->T().u()
,fp->V(k)->T().v()
);
@ -560,7 +560,7 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
{
fprintf(fpout,"%d ",fp->VN()*2);
for(int k=0;k<fp->VN()*2;++k)
fprintf(fpout,"%g %g "
fprintf(fpout,"%f %f "
,fp->WT(k).u()
,fp->WT(k).v()
);
@ -594,7 +594,7 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
}
if( HasPerFaceQuality(m) && (pi.mask & Mask::IOM_FACEQUALITY) )
fprintf(fpout,"%g ",fp->Q());
fprintf(fpout,"%.*g ",DGTFQ,fp->Q());
for(i=0;i<pi.fdn;i++)
{
@ -640,10 +640,10 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
}
fclose(fpout);
return 0;
}
}
static const char *ErrorMsg(int error)
{
static const char *ErrorMsg(int error)
{
static std::vector<std::string> ply_error_msg;
if(ply_error_msg.empty())
{
@ -673,7 +673,7 @@ static const char *ErrorMsg(int error)
if(error>PlyInfo::E_MAXPLYINFOERRORS || error<0) return "Unknown error";
else return ply_error_msg[error].c_str();
};
};
static int GetExportMaskCapability()
{
@ -700,12 +700,12 @@ static const char *ErrorMsg(int error)
}
}; // end class
}; // end class
} // end namespace tri
} // end namespace io
} // end namespace tri
} // end namespace io
} // end namespace vcg
//@}
#endif

View File

@ -152,7 +152,7 @@ struct LoadPly_Camera
float k4;
};
#define _VERTDESC_LAST_ 29
#define _VERTDESC_LAST_ 30
static const PropDescriptor &VertDesc(int i)
{
static const PropDescriptor pv[_VERTDESC_LAST_]={
@ -186,7 +186,7 @@ static const PropDescriptor &VertDesc(int i)
/*26*/ {"vertex", "ny", ply::T_DOUBLE, PlyType<ScalarType>(),offsetof(LoadPly_VertAux<ScalarType>,n) + 1*sizeof(ScalarType),0,0,0,0,0 ,0},
/*27*/ {"vertex", "nz", ply::T_DOUBLE, PlyType<ScalarType>(),offsetof(LoadPly_VertAux<ScalarType>,n) + 2*sizeof(ScalarType),0,0,0,0,0 ,0},
/*28*/ {"vertex", "radius", ply::T_DOUBLE, ply::T_FLOAT, offsetof(LoadPly_VertAux<ScalarType>,radius),0,0,0,0,0 ,0},
/*29*/ {"vertex", "quality", ply::T_DOUBLE, PlyType<ScalarType>(),offsetof(LoadPly_VertAux<ScalarType>,q),0,0,0,0,0 ,0}
};
return pv[i];
}
@ -453,6 +453,9 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
if( pf.AddToRead(VertDesc(4))!=-1 ||
pf.AddToRead(VertDesc(11))!=-1 )
pi.mask |= Mask::IOM_VERTQUALITY;
else
if (pf.AddToRead(VertDesc(29))!=-1)
pi.mask |= Mask::IOM_VERTQUALITY;
}
if(vcg::tri::HasPerVertexColor(m) )
@ -1118,6 +1121,7 @@ static bool LoadMask(const char * filename, int &mask, PlyInfo &pi)
if( pf.AddToRead(VertDesc(11))!=-1 ) mask |= Mask::IOM_VERTQUALITY;
if( pf.AddToRead(VertDesc(15))!=-1 ) mask |= Mask::IOM_VERTRADIUS;
if( pf.AddToRead(VertDesc(28))!=-1 ) mask |= Mask::IOM_VERTRADIUS;
if( pf.AddToRead(VertDesc(29))!=-1 ) mask |= Mask::IOM_VERTQUALITY;
if( pf.AddToRead(VertDesc( 5))!=-1 &&
pf.AddToRead(VertDesc( 6))!=-1 &&
pf.AddToRead(VertDesc( 7))!=-1 ) mask |= Mask::IOM_VERTCOLOR;