From: san Date: Fri, 30 Mar 2018 13:38:34 +0000 (+0300) Subject: 0029667: Visualization, TKV3d - User-defined texture coordinates corrupted by StdPrs_... X-Git-Tag: V7_3_0_beta~21 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=d051064495d3485ea0b1a88d0802539f072ab5f6;p=occt.git 0029667: Visualization, TKV3d - User-defined texture coordinates corrupted by StdPrs_ShadedShape Add protection in fillTriangles() against void UV range of a face. --- diff --git a/src/StdPrs/StdPrs_ShadedShape.cxx b/src/StdPrs/StdPrs_ShadedShape.cxx index e29b6950c0..e098fc47e6 100644 --- a/src/StdPrs/StdPrs_ShadedShape.cxx +++ b/src/StdPrs/StdPrs_ShadedShape.cxx @@ -218,8 +218,10 @@ namespace if (theHasTexels && aUVNodes.Upper() == aNodes.Upper()) { - const gp_Pnt2d aTexel = gp_Pnt2d ((-theUVOrigin.X() + (theUVRepeat.X() * (aUVNodes (aNodeIter).X() - aUmin)) / dUmax) / theUVScale.X(), - (-theUVOrigin.Y() + (theUVRepeat.Y() * (aUVNodes (aNodeIter).Y() - aVmin)) / dVmax) / theUVScale.Y()); + const gp_Pnt2d aTexel = (dUmax == 0.0 || dVmax == 0.0) + ? aUVNodes (aNodeIter) + : gp_Pnt2d ((-theUVOrigin.X() + (theUVRepeat.X() * (aUVNodes(aNodeIter).X() - aUmin)) / dUmax) / theUVScale.X(), + (-theUVOrigin.Y() + (theUVRepeat.Y() * (aUVNodes(aNodeIter).Y() - aVmin)) / dVmax) / theUVScale.Y()); anArray->AddVertex (aPoint, aNorm, aTexel); } else