Merge topic '18719-vtkPlyReaderFix'

c54f9b1e58 Fix Issue #18719: vtkPLYReader Bug For Face Textured PLYs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Mathieu Westphal <mathieu.westphal@kitware.com>
Acked-by: Dan Lipsa <dan.lipsa@kitware.com>
Merge-request: !9714
dev
Mathieu Westphal 2 months ago committed by Kitware Robot
commit f37f9e676d

@ -1,5 +1,6 @@
vtk_module_test_data(
Data/Armadillo.ply
Data/FaceTexturedWithReusedTCoords.ply
Data/PointCloud.ply
Data/bunny.ply
Data/squareTextured.ply

@ -15,4 +15,8 @@ vtk_add_test_cxx(vtkIOPLYCxxTests tests
TestPLYReaderTextureUVFaces,TestPLYReaderTextureUV.cxx squareTexturedFaces.ply
two_vtk_logos_stacked.png
)
vtk_add_test_cxx(vtkIOPLYCxxTests tests
TestPLYReaderFaceTexturedWithReusedTCoord,TestPLYReaderTextureUV.cxx FaceTexturedWithReusedTCoords.ply
vtk.png
)
vtk_test_cxx_executable(vtkIOPLYCxxTests tests)

@ -0,0 +1 @@
5e33790e9793fc4403c03e331dbb78d36b81053ff1d2df9b75203fdff5962f47b5b6a760b27698fce5eeaa0c34b2e8d685c4427a0d5a4755b9809abe5934ecef

@ -560,27 +560,25 @@ int vtkPLYReader::RequestData(vtkInformation* vtkNotUsed(request),
else
{
size_t sameTexIndex = 0;
if (pointIds[ti].size() > 1)
double first[3];
output->GetPoint(vtkVerts[k], first);
for (; sameTexIndex < pointIds[ti].size(); ++sameTexIndex)
{
double first[3];
output->GetPoint(vtkVerts[k], first);
for (; sameTexIndex < pointIds[ti].size(); ++sameTexIndex)
{
double second[3];
output->GetPoint(pointIds[ti][sameTexIndex], second);
if (FuzzyEqual(first, second, this->FaceTextureTolerance))
{
break;
}
}
if (sameTexIndex == pointIds[ti].size())
double second[3];
output->GetPoint(pointIds[ti][sameTexIndex], second);
if (FuzzyEqual(first, second, this->FaceTextureTolerance))
{
// newly seen point for this texture coordinate
vtkIdType dp = duplicateCellPoint(output, cell, k);
texCoordsPoints->SetTuple2(dp, newTex[0], newTex[1]);
pointIds[ti].push_back(dp);
break;
}
}
if (sameTexIndex == pointIds[ti].size())
{
// newly seen point for this texture coordinate
vtkIdType dp = duplicateCellPoint(output, cell, k);
texCoordsPoints->SetTuple2(dp, newTex[0], newTex[1]);
pointIds[ti].push_back(dp);
}
// texture coordinate already seen before, use the vertex
// associated with these texture coordinates

@ -0,0 +1 @@
d6cf1cf267ce056887444ea5325abee7957b283480471d64a0e28f88dbd9d7e8dc7559a65324b213596206b02ae3b8b33287a048a2e31f7252d0e1dc6e6e7b5b
Loading…
Cancel
Save