]> OCCT Git - occt.git/commitdiff
0029667: Visualization, TKV3d - User-defined texture coordinates corrupted by StdPrs_...
authorsan <san@opencascade.com>
Fri, 30 Mar 2018 13:38:34 +0000 (16:38 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 30 Mar 2018 16:36:20 +0000 (19:36 +0300)
Add protection in fillTriangles() against void UV range of a face.

src/StdPrs/StdPrs_ShadedShape.cxx

index e29b6950c048bb59badeda805c4e66a971c92b09..e098fc47e684ffc5d6616dc08fe28b7c02e31533 100644 (file)
@@ -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