Bug fixing

This commit is contained in:
Gianpaolo Palma 2018-07-12 10:55:53 +02:00
parent 6c3c940e34
commit 4aa5b95f5b
3 changed files with 17 additions and 9 deletions

View File

@ -229,8 +229,8 @@ namespace nanoply
{ PlyEntity::NNP_CRGBA, NameVector({ "rgba", "diffuse_rgba" }) },
{ PlyEntity::NNP_DENSITY, NameVector({ "radius", "density" }) },
{ PlyEntity::NNP_SCALE, NameVector({ "scale", "value" }) },
{ PlyEntity::NNP_TEXTUREU, NameVector({ "texture_u", "u", "s" }) },
{ PlyEntity::NNP_TEXTUREV, NameVector({ "texture_v", "v", "t" }) },
{ PlyEntity::NNP_TEXTUREU, NameVector({ "texture_u", "u", "s", "tx" }) },
{ PlyEntity::NNP_TEXTUREV, NameVector({ "texture_v", "v", "t", "ty" }) },
{ PlyEntity::NNP_TEXTURE2D, NameVector({ "texture_uv", "uv" }) },
{ PlyEntity::NNP_TEXTUREW, NameVector({ "texture_w", "w" }) },
{ PlyEntity::NNP_TEXTURE3D, NameVector({ "texture_uvw", "uvw" }) },
@ -1064,7 +1064,7 @@ namespace nanoply
/**
* Default Constructor
*/
inline PlyElement() :validToWrite(false){};
inline PlyElement() :validToWrite(false), cnt(0){};
/**
* Constructor that sets the name, the properties and the number of instances of the element.
@ -1643,7 +1643,7 @@ namespace nanoply
PlyElement* pe = GetElement(e);
if (pe != NULL)
return pe->cnt;
return -1;
return 0;
}
@ -1892,6 +1892,12 @@ namespace nanoply
}
}
}
else if ((dataDescriptor[i]->elem == PlyEntity::NNP_CRGB && prop.elem == PlyEntity::NNP_CRGBA) ||
(dataDescriptor[i]->elem == PlyEntity::NNP_CRGBA && prop.elem == PlyEntity::NNP_CRGB))
{
descr.push_back(dataDescriptor[i]);
break;
}
}
if (i == dataDescriptor.size())
descr.push_back(NULL);
@ -2364,7 +2370,7 @@ namespace nanoply
template<class ContainerType, int VectorSize, typename ScalarType>
bool DataDescriptor<ContainerType, VectorSize, ScalarType>::ReadElemBinary(PlyFile &file, PlyProperty &prop, bool fixEndian)
{
if (prop.elem != elem)
if (prop.elem != elem && ((prop.elem != PlyEntity::NNP_CRGB && prop.elem != PlyEntity::NNP_CRGBA) || (prop.elem != PlyEntity::NNP_CRGBA && prop.elem != PlyEntity::NNP_CRGB)))
return false;
switch (prop.type)
{

View File

@ -1250,6 +1250,7 @@ namespace nanoply
{
mesh.face[i].WT(j).U() = wedgeTexCoord[i][j * 2];
mesh.face[i].WT(j).V() = wedgeTexCoord[i][j * 2 + 1];
mesh.face[i].WT(j).N() = mesh.face[i].WT(0).N();
}
}
}
@ -1426,7 +1427,7 @@ namespace nanoply
nameList.clear();
EdgeType::Name(nameList);
std::vector<PlyProperty> edgeProp;
ElementDescriptor edgeDescr(NNP_VERTEX_ELEM);
ElementDescriptor edgeDescr(NNP_EDGE_ELEM);
std::vector<vcg::Point2i> edgeIndex;
for (int i = 0; i < mesh.edge.size(); i++)
edgeIndex.push_back(vcg::Point2i(vcg::tri::Index(mesh, mesh.edge[i].V(0)), vcg::tri::Index(mesh, mesh.edge[i].V(1))));

View File

@ -1,8 +1,9 @@
INCLUDEPATH += ../../../
INCLUDEPATH += ../../../ ../../../eigenlib
CONFIG += console stl c++11
CONFIG -= qt
CONFIG += qt
TEMPLATE = app
SOURCES += main.cpp
QT += core
# Mac specific Config required to avoid to make application bundles
CONFIG -= app_bundle