]> OCCT Git - occt-copy.git/commitdiff
0025936: Modeling Data - reusable data structure for 2D tesselation (3- and 4-nodal... CR25936_5
authorvro <vladislav.romashko@opencascade.com>
Mon, 15 Feb 2021 13:13:46 +0000 (16:13 +0300)
committervro <vladislav.romashko@opencascade.com>
Mon, 15 Feb 2021 13:13:46 +0000 (16:13 +0300)
// Fixed a regression in bugs vis bug30630_1 (mirrored shape)

src/StdPrs/StdPrs_ShadedShape.cxx

index a434c61daacff9d4203e733a54e2d4e534232331..9ff3ab6449fb8694d7b8629348974bb1de267ca4 100644 (file)
@@ -188,10 +188,8 @@ namespace
       // Determinant of transform matrix less then 0 means that mirror transform applied.
       Standard_Boolean isMirrored = aTrsf.VectorialPart().Determinant() < 0;
 
-      Poly_Connect aPolyConnect (aT);
       // Extracts vertices & normals from nodes
-      TColgp_Array1OfDir aNormals (1, aT->NbNodes());
-      StdPrs_ToolTriangulatedShape::Normal (aFace, aPolyConnect, aNormals);
+      StdPrs_ToolTriangulatedShape::ComputeNormals (aFace, aT);
 
       if (theHasTexels)
       {
@@ -200,11 +198,17 @@ namespace
         dVmax = (aVmax - aVmin);
       }
 
+      gp_Dir aNorm;
       const Standard_Integer aDecal = anArray->VertexNumber();
       for (Standard_Integer aNodeIter = 1; aNodeIter <= aT->NbNodes(); ++aNodeIter)
       {
         aPoint = aT->Node (aNodeIter);
-        gp_Dir aNorm = aNormals (aNodeIter);
+        const Vec3f& aVec = aT->Normal (aNodeIter);
+        aNorm.SetCoord (aVec.x(), aVec.y(), aVec.z());
+        if ((aFace.Orientation() == TopAbs_REVERSED) ^ isMirrored)
+        {
+          aNorm.Reverse();
+        }
         if (!aLoc.IsIdentity())
         {
           aPoint.Transform (aTrsf);