fixed (part of) the obj importer when loading data that is not present in the destination mesh
This commit is contained in:
parent
44937573d0
commit
d66446f6dc
|
|
@ -34,7 +34,7 @@ namespace tri {
|
||||||
|
|
||||||
/// \headerfile texture.h vcg/complex/algorithms/update/texture.h
|
/// \headerfile texture.h vcg/complex/algorithms/update/texture.h
|
||||||
|
|
||||||
/// \brief This class is used to update/generate texcoord position according to various critera. .
|
/// \brief This class is used to update/generate texcoord position according to various critera.
|
||||||
template <class ComputeMeshType>
|
template <class ComputeMeshType>
|
||||||
class UpdateTexture
|
class UpdateTexture
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -446,7 +446,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( oi.mask & vcg::tri::io::Mask::IOM_FACECOLOR) // assigning face color
|
if(((oi.mask & vcg::tri::io::Mask::IOM_FACECOLOR) != 0) && HasPerFaceColor(m)) // assigning face color
|
||||||
ff.c = currentColor;
|
ff.c = currentColor;
|
||||||
|
|
||||||
++numTriangles;
|
++numTriangles;
|
||||||
|
|
@ -569,7 +569,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// assigning face color
|
// assigning face color
|
||||||
if( oi.mask & vcg::tri::io::Mask::IOM_FACECOLOR) ff.c = currentColor;
|
if( ((oi.mask & vcg::tri::io::Mask::IOM_FACECOLOR) != 0) && HasPerFaceColor(m))
|
||||||
|
{
|
||||||
|
ff.c = currentColor;
|
||||||
|
}
|
||||||
|
|
||||||
ff.mInd = currentMaterialIdx;
|
ff.mInd = currentMaterialIdx;
|
||||||
|
|
||||||
|
|
@ -672,25 +675,26 @@ public:
|
||||||
assert(vertInd >=0 && vertInd < m.vn); (void)vertInd;
|
assert(vertInd >=0 && vertInd < m.vn); (void)vertInd;
|
||||||
m.face[i].V(j) = &(m.vert[indexedFaces[i].v[j]]);
|
m.face[i].V(j) = &(m.vert[indexedFaces[i].v[j]]);
|
||||||
|
|
||||||
if (((oi.mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD) != 0) && (HasPerWedgeTexCoord(m)))
|
if (((oi.mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD) != 0) && HasPerWedgeTexCoord(m))
|
||||||
{
|
{
|
||||||
ObjTexCoord t = texCoords[indexedFaces[i].t[j]];
|
ObjTexCoord t = texCoords[indexedFaces[i].t[j]];
|
||||||
m.face[i].WT(j).u() = t.u;
|
m.face[i].WT(j).u() = t.u;
|
||||||
m.face[i].WT(j).v() = t.v;
|
m.face[i].WT(j).v() = t.v;
|
||||||
m.face[i].WT(j).n() = indexedFaces[i].tInd;
|
m.face[i].WT(j).n() = indexedFaces[i].tInd;
|
||||||
}
|
}
|
||||||
if ( oi.mask & vcg::tri::io::Mask::IOM_VERTTEXCOORD ) {
|
if (((oi.mask & vcg::tri::io::Mask::IOM_VERTTEXCOORD) != 0 ) && HasPerVertexTexCoord(m))
|
||||||
|
{
|
||||||
ObjTexCoord t = texCoords[indexedFaces[i].t[j]];
|
ObjTexCoord t = texCoords[indexedFaces[i].t[j]];
|
||||||
m.face[i].V(j)->T().u() = t.u;
|
m.face[i].V(j)->T().u() = t.u;
|
||||||
m.face[i].V(j)->T().v() = t.v;
|
m.face[i].V(j)->T().v() = t.v;
|
||||||
m.face[i].V(j)->T().n() = indexedFaces[i].tInd;
|
m.face[i].V(j)->T().n() = indexedFaces[i].tInd;
|
||||||
}
|
}
|
||||||
if ( oi.mask & vcg::tri::io::Mask::IOM_WEDGNORMAL )
|
if (((oi.mask & vcg::tri::io::Mask::IOM_WEDGNORMAL) != 0) && HasPerWedgeNormal(m))
|
||||||
{
|
{
|
||||||
m.face[i].WN(j).Import(normals[indexedFaces[i].n[j]]);
|
m.face[i].WN(j).Import(normals[indexedFaces[i].n[j]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( oi.mask & vcg::tri::io::Mask::IOM_VERTNORMAL )
|
if (((oi.mask & vcg::tri::io::Mask::IOM_VERTNORMAL) != 0) && HasPerVertexNormal(m))
|
||||||
{
|
{
|
||||||
m.face[i].V(j)->N().Import(normals[indexedFaces[i].n[j]]);
|
m.face[i].V(j)->N().Import(normals[indexedFaces[i].n[j]]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue