From 4aa5b95f5b432299b1b15c3217caa88c0470e66f Mon Sep 17 00:00:00 2001 From: gianpaolopalma Date: Thu, 12 Jul 2018 10:55:53 +0200 Subject: [PATCH] Bug fixing --- wrap/nanoply/include/nanoply.hpp | 16 +++++++++++----- wrap/nanoply/include/nanoplyWrapper.hpp | 5 +++-- wrap/nanoply/nanoply_vcg/nanoply_vcg.pro | 5 +++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/wrap/nanoply/include/nanoply.hpp b/wrap/nanoply/include/nanoply.hpp index 3f867c41..06c1f1a2 100644 --- a/wrap/nanoply/include/nanoply.hpp +++ b/wrap/nanoply/include/nanoply.hpp @@ -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 bool DataDescriptor::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) { diff --git a/wrap/nanoply/include/nanoplyWrapper.hpp b/wrap/nanoply/include/nanoplyWrapper.hpp index c5f3a87c..84c8fb0d 100644 --- a/wrap/nanoply/include/nanoplyWrapper.hpp +++ b/wrap/nanoply/include/nanoplyWrapper.hpp @@ -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 edgeProp; - ElementDescriptor edgeDescr(NNP_VERTEX_ELEM); + ElementDescriptor edgeDescr(NNP_EDGE_ELEM); std::vector 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)))); @@ -1434,7 +1435,7 @@ namespace nanoply { if ((bitMask & BitMask::IO_EDGEINDEX) && EdgeType::HasVertexRef()) { - PushDescriport(edgeProp, edgeDescr, NNP_EDGE_V1, &(*edgeIndex.begin()).V()[0]); + PushDescriport(edgeProp, edgeDescr, NNP_EDGE_V1, &(*edgeIndex.begin()).V()[0]); PushDescriport(edgeProp, edgeDescr, NNP_EDGE_V2, &(*edgeIndex.begin()).V()[1]); } if ((bitMask & BitMask::IO_EDGEQUALITY) && vcg::tri::HasPerEdgeQuality(mesh)) diff --git a/wrap/nanoply/nanoply_vcg/nanoply_vcg.pro b/wrap/nanoply/nanoply_vcg/nanoply_vcg.pro index 69f90098..c103ff7e 100644 --- a/wrap/nanoply/nanoply_vcg/nanoply_vcg.pro +++ b/wrap/nanoply/nanoply_vcg/nanoply_vcg.pro @@ -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