export point3f/d vertex attribute works ply files
This commit is contained in:
parent
4001b5aa34
commit
6509139fc6
File diff suppressed because it is too large
Load Diff
|
|
@ -100,22 +100,66 @@ public:
|
||||||
addPerElemScalarAttribute(elemType, vcg::ply::T_DOUBLE, attrName, propName);
|
addPerElemScalarAttribute(elemType, vcg::ply::T_DOUBLE, attrName, propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addPerVertexScalarAttribute(const std::string& attrName, vcg::ply::PlyTypes attrType, std::string propName="") {
|
void addPerVertexScalarAttribute(const std::string& attrName, vcg::ply::PlyTypes attrType, std::string propName="")
|
||||||
|
{
|
||||||
addPerElemScalarAttribute(0,attrType, attrName,propName);
|
addPerElemScalarAttribute(0,attrType, attrName,propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddPerVertexFloatAttribute(const std::string& attrName, std::string propName="") {
|
void AddPerVertexFloatAttribute(const std::string& attrName, std::string propName="")
|
||||||
|
{
|
||||||
AddPerElemFloatAttribute(0,attrName,propName);
|
AddPerElemFloatAttribute(0,attrName,propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addPerFaceScalarAttribute(const std::string& attrName, vcg::ply::PlyTypes attrType, std::string propName="") {
|
void addPerFaceScalarAttribute(const std::string& attrName, vcg::ply::PlyTypes attrType, std::string propName="")
|
||||||
|
{
|
||||||
addPerElemScalarAttribute(1,attrType, attrName,propName);
|
addPerElemScalarAttribute(1,attrType, attrName,propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddPerFaceFloatAttribute(const std::string& attrName, std::string propName="") {
|
void AddPerFaceFloatAttribute(const std::string& attrName, std::string propName="")
|
||||||
|
{
|
||||||
AddPerElemFloatAttribute(1,attrName,propName);
|
AddPerElemFloatAttribute(1,attrName,propName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addPerElemPointAttribute(int elemType, vcg::ply::PlyTypes propertyType, const std::string& attrName, std::string propName="")
|
||||||
|
{
|
||||||
|
if(propName=="")
|
||||||
|
propName=attrName;
|
||||||
|
|
||||||
|
PropDescriptor p;
|
||||||
|
p.propname=propName;
|
||||||
|
p.stotype1 = propertyType;
|
||||||
|
p.memtype1 = propertyType;
|
||||||
|
p.islist = true;
|
||||||
|
p.stotype2 = vcg::ply::PlyTypes::T_UINT;
|
||||||
|
p.stotype2 = vcg::ply::PlyTypes::T_UINT;
|
||||||
|
|
||||||
|
if (elemType == 0){ //vertex
|
||||||
|
VertAttrNameVec.push_back(attrName);
|
||||||
|
p.elemname="vertex";
|
||||||
|
VertDescriptorVec.push_back(p);
|
||||||
|
}
|
||||||
|
else if (elemType == 1){ //face
|
||||||
|
FaceAttrNameVec.push_back(attrName);
|
||||||
|
p.elemname="face";
|
||||||
|
FaceDescriptorVec.push_back(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void addPerVertexPoint3mAttribute(const std::string& attrName, vcg::ply::PlyTypes attrType, std::string propName="")
|
||||||
|
{
|
||||||
|
addPerElemPointAttribute(0,attrType, attrName,propName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void addPerVertexPoint3fAttribute(const std::string& attrName, std::string propName="")
|
||||||
|
{
|
||||||
|
addPerElemPointAttribute(0,vcg::ply::PlyTypes::T_FLOAT, attrName,propName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void addPerVertexPoint3dAttribute(const std::string& attrName, std::string propName="")
|
||||||
|
{
|
||||||
|
addPerElemPointAttribute(0,vcg::ply::PlyTypes::T_DOUBLE, attrName,propName);
|
||||||
|
}
|
||||||
|
|
||||||
/* Note that saving a per vertex point3 attribute is a mess.
|
/* Note that saving a per vertex point3 attribute is a mess.
|
||||||
* Actually require to allocate 3 float attribute and save them. And they are never deallocated... */
|
* Actually require to allocate 3 float attribute and save them. And they are never deallocated... */
|
||||||
template<class MeshType>
|
template<class MeshType>
|
||||||
|
|
|
||||||
|
|
@ -143,8 +143,12 @@ static int TypeSize[] = {
|
||||||
|
|
||||||
size_t PropDescriptor::memtypesize() const {return TypeSize[memtype1];}
|
size_t PropDescriptor::memtypesize() const {return TypeSize[memtype1];}
|
||||||
size_t PropDescriptor::stotypesize() const {return TypeSize[stotype1];}
|
size_t PropDescriptor::stotypesize() const {return TypeSize[stotype1];}
|
||||||
|
size_t PropDescriptor::memtype2size() const {return TypeSize[memtype2];}
|
||||||
|
size_t PropDescriptor::stotype2size() const {return TypeSize[stotype2];}
|
||||||
const char *PropDescriptor::memtypename() const {return PlyFile::typenames[memtype1];}
|
const char *PropDescriptor::memtypename() const {return PlyFile::typenames[memtype1];}
|
||||||
const char *PropDescriptor::stotypename() const {return PlyFile::typenames[stotype1];}
|
const char *PropDescriptor::stotypename() const {return PlyFile::typenames[stotype1];}
|
||||||
|
const char *PropDescriptor::memtype2name() const {return PlyFile::typenames[memtype2];}
|
||||||
|
const char *PropDescriptor::stotype2name() const {return PlyFile::typenames[stotype2];}
|
||||||
|
|
||||||
static char CrossType[9][9]=
|
static char CrossType[9][9]=
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,10 @@ public:
|
||||||
size_t memtypesize() const; // per sapere quanto e'grande un dato descrittore in memoria
|
size_t memtypesize() const; // per sapere quanto e'grande un dato descrittore in memoria
|
||||||
const char* memtypename() const;
|
const char* memtypename() const;
|
||||||
const char* stotypename() const;
|
const char* stotypename() const;
|
||||||
|
size_t stotype2size() const; // per sapere quanto e'grande un dato descrittore sul file
|
||||||
|
size_t memtype2size() const; // per sapere quanto e'grande un dato descrittore in memoria
|
||||||
|
const char* memtype2name() const;
|
||||||
|
const char* stotype2name() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Reading Callback (used to copy a data prop)
|
// Reading Callback (used to copy a data prop)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue