ply export custom point attribute - set list size to uchar type

This commit is contained in:
alemuntoni 2021-04-02 16:37:10 +02:00
parent 6509139fc6
commit 702c139108
3 changed files with 8 additions and 8 deletions

View File

@ -416,7 +416,7 @@ public:
{
case ply::T_FLOAT : thff[i] = vcg::tri::Allocator<SaveMeshType>::template FindPerFaceAttribute<float>(m,pi.FaceAttrNameVec[i]); break;
case ply::T_DOUBLE : thdf[i] = vcg::tri::Allocator<SaveMeshType>::template FindPerFaceAttribute<double>(m,pi.FaceAttrNameVec[i]); break;
case ply::T_INT : thif[i] = vcg::tri::Allocator<SaveMeshType>::template FindPerFaceAttribute<int >(m,pi.FaceAttrNameVec[i]); break;
case ply::T_INT : thif[i] = vcg::tri::Allocator<SaveMeshType>::template FindPerFaceAttribute<int >(m,pi.FaceAttrNameVec[i]); break;
case ply::T_SHORT : thsf[i] = vcg::tri::Allocator<SaveMeshType>::template FindPerFaceAttribute<short >(m,pi.FaceAttrNameVec[i]); break;
case ply::T_CHAR : thcf[i] = vcg::tri::Allocator<SaveMeshType>::template FindPerFaceAttribute<char>(m,pi.FaceAttrNameVec[i]); break;
case ply::T_UCHAR : thuf[i] = vcg::tri::Allocator<SaveMeshType>::template FindPerFaceAttribute<unsigned char>(m,pi.FaceAttrNameVec[i]); break;
@ -482,7 +482,7 @@ public:
{
case ply::T_FLOAT : tf=thfv[i][vp]; fwrite(&tf, sizeof(float),1,fpout); break;
case ply::T_DOUBLE : td=thdv[i][vp]; fwrite(&td, sizeof(double),1,fpout); break;
case ply::T_INT : ti=thiv[i][vp]; fwrite(&ti, sizeof(int),1,fpout); break;
case ply::T_INT : ti=thiv[i][vp]; fwrite(&ti, sizeof(int),1,fpout); break;
case ply::T_SHORT : ts=thsv[i][vp]; fwrite(&ts, sizeof(short),1,fpout); break;
case ply::T_CHAR : tc=thcv[i][vp]; fwrite(&tc, sizeof(char),1,fpout); break;
case ply::T_UCHAR : tu=thuv[i][vp]; fwrite(&tu,sizeof(unsigned char),1,fpout); break;
@ -490,18 +490,18 @@ public:
}
}
else { //it is a Poin3f or a Point3d attribute. Saving it as a list
static const unsigned int psize = 3;
static const unsigned char psize = 3;
switch (pi.VertDescriptorVec[i].stotype1)
{
case ply::T_FLOAT :
fwrite(&psize, sizeof(unsigned int), 1,fpout);
fwrite(&psize, sizeof(unsigned char), 1,fpout);
fwrite(&thp3fv[i][vp][0], sizeof(float), 1,fpout);
fwrite(&thp3fv[i][vp][1], sizeof(float), 1,fpout);
fwrite(&thp3fv[i][vp][2], sizeof(float), 1,fpout);
break;
//fprintf(fpout,"%d %f %f %f", 3, thp3fv[i][vp][0], thp3fv[i][vp][1], thp3fv[i][vp][2]); break;
case ply::T_DOUBLE :
fwrite(&psize, sizeof(unsigned int), 1,fpout);
fwrite(&psize, sizeof(unsigned char), 1,fpout);
fwrite(&thp3dv[i][vp][0], sizeof(double), 1,fpout);
fwrite(&thp3dv[i][vp][1], sizeof(double), 1,fpout);
fwrite(&thp3dv[i][vp][2], sizeof(double), 1,fpout);

View File

@ -130,8 +130,8 @@ public:
p.stotype1 = propertyType;
p.memtype1 = propertyType;
p.islist = true;
p.stotype2 = vcg::ply::PlyTypes::T_UINT;
p.stotype2 = vcg::ply::PlyTypes::T_UINT;
p.memtype2 = vcg::ply::PlyTypes::T_UCHAR;
p.stotype2 = vcg::ply::PlyTypes::T_UCHAR;
if (elemType == 0){ //vertex
VertAttrNameVec.push_back(attrName);

View File

@ -176,7 +176,7 @@ public:
int bestored; // 1 se va storata
PropDescriptor desc; // Descrittore di memorizzazione
readelemcb cb; // Callback di lettura
readelemcb cb = nullptr; // Callback di lettura
};