0025276: Visualization - Lighting is broken if some kinds of transformation applied...
[occt.git] / src / StdPrs / StdPrs_ShadedShape.cxx
CommitLineData
973c2be1 1// Created on: 1993-09-23
2// Created by: Jean-Louis FRENKEL
3// Copyright (c) 1993-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
2bd4c032 16
17#include <StdPrs_ShadedShape.hxx>
18
19#include <Bnd_Box.hxx>
20#include <BRep_Builder.hxx>
21#include <BRepBndLib.hxx>
22#include <BRepMesh_DiscretFactory.hxx>
23#include <BRepMesh_DiscretRoot.hxx>
24#include <BRepTools.hxx>
31c0e219 25#include <Graphic3d_ArrayOfSegments.hxx>
2bd4c032 26#include <Graphic3d_ArrayOfTriangles.hxx>
27#include <Graphic3d_AspectFillArea3d.hxx>
28#include <Graphic3d_Group.hxx>
29#include <gp_Dir.hxx>
30#include <gp_Vec.hxx>
31#include <gp_Pnt.hxx>
31c0e219 32#include <NCollection_List.hxx>
2bd4c032 33#include <Precision.hxx>
9dba391d 34#include <Prs3d.hxx>
2bd4c032 35#include <Prs3d_Drawer.hxx>
31c0e219 36#include <Prs3d_LineAspect.hxx>
2bd4c032 37#include <Prs3d_Presentation.hxx>
38#include <Prs3d_ShadingAspect.hxx>
39#include <Poly_Connect.hxx>
31c0e219 40#include <Poly_PolygonOnTriangulation.hxx>
2bd4c032 41#include <Poly_Triangulation.hxx>
42#include <StdPrs_ToolShadedShape.hxx>
43#include <StdPrs_WFShape.hxx>
31c0e219 44#include <TopExp.hxx>
fc9b36d6 45#include <TopExp_Explorer.hxx>
46#include <TopoDS.hxx>
31c0e219 47#include <TopoDS_Compound.hxx>
2bd4c032 48#include <TopoDS_Face.hxx>
31c0e219 49#include <TopoDS_Shape.hxx>
2bd4c032 50#include <TColgp_Array1OfDir.hxx>
51#include <TColgp_Array1OfPnt2d.hxx>
31c0e219 52#include <TColgp_HArray1OfPnt.hxx>
a2d5ab2e 53#include <TopTools_ListOfShape.hxx>
54#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
2bd4c032 55
56namespace
57{
31c0e219 58
59 //! Computes wireframe presentation for free wires and vertices
60 void wireframeFromShape (const Handle (Prs3d_Presentation)& thePrs,
61 const TopoDS_Shape& theShape,
62 const Handle (Prs3d_Drawer)& theDrawer)
63 {
53b15292 64 Standard_Boolean aDrawAllVerticesFlag = (theDrawer->VertexDrawMode() == Prs3d_VDM_All);
65
66 if (!aDrawAllVerticesFlag && theShape.ShapeType() != TopAbs_COMPOUND)
31c0e219 67 {
68 return;
69 }
70
71 TopExp_Explorer aShapeIter (theShape, TopAbs_FACE);
72 if (!aShapeIter.More())
73 {
74 // compound contains no shaded elements at all
75 StdPrs_WFShape::Add (thePrs, theShape, theDrawer);
76 return;
77 }
78
53b15292 79 // We have to create a compound and collect all subshapes not drawn by the shading algo.
80 // This includes:
81 // - isolated edges
82 // - isolated vertices, if aDrawAllVerticesFlag == Standard_False
83 // - all shape's vertices, if aDrawAllVerticesFlag == Standard_True
31c0e219 84 TopoDS_Compound aCompoundWF;
85 BRep_Builder aBuilder;
86 aBuilder.MakeCompound (aCompoundWF);
87 Standard_Boolean hasElement = Standard_False;
88
89 // isolated edges
90 for (aShapeIter.Init (theShape, TopAbs_EDGE, TopAbs_FACE); aShapeIter.More(); aShapeIter.Next())
91 {
92 hasElement = Standard_True;
93 aBuilder.Add (aCompoundWF, aShapeIter.Current());
94 }
53b15292 95 // isolated or all vertices
96 aShapeIter.Init (theShape, TopAbs_VERTEX, aDrawAllVerticesFlag ? TopAbs_SHAPE : TopAbs_EDGE);
97 for (; aShapeIter.More(); aShapeIter.Next())
31c0e219 98 {
99 hasElement = Standard_True;
100 aBuilder.Add (aCompoundWF, aShapeIter.Current());
101 }
102 if (hasElement)
103 {
104 StdPrs_WFShape::Add (thePrs, aCompoundWF, theDrawer);
105 }
106 }
107
31c0e219 108 //! Gets triangulation of every face of shape and fills output array of triangles
109 static Handle(Graphic3d_ArrayOfTriangles) fillTriangles (const TopoDS_Shape& theShape,
110 const Standard_Boolean theHasTexels,
111 const gp_Pnt2d& theUVOrigin,
112 const gp_Pnt2d& theUVRepeat,
113 const gp_Pnt2d& theUVScale)
2bd4c032 114 {
31c0e219 115 Handle(Poly_Triangulation) aT;
2bd4c032 116 TopLoc_Location aLoc;
31c0e219 117 gp_Pnt aPoint;
118 Standard_Integer aNbTriangles = 0;
119 Standard_Integer aNbVertices = 0;
2bd4c032 120
31c0e219 121 // Precision for compare square distances
3b1817a9 122 const Standard_Real aPreci = Precision::SquareConfusion();
2bd4c032 123
fc9b36d6 124 TopExp_Explorer aFaceIt(theShape, TopAbs_FACE);
125 for (; aFaceIt.More(); aFaceIt.Next())
2bd4c032 126 {
fc9b36d6 127 const TopoDS_Face& aFace = TopoDS::Face(aFaceIt.Current());
128 aT = StdPrs_ToolShadedShape::Triangulation (aFace, aLoc);
31c0e219 129 if (!aT.IsNull())
2bd4c032 130 {
31c0e219 131 aNbTriangles += aT->NbTriangles();
132 aNbVertices += aT->NbNodes();
2bd4c032 133 }
2bd4c032 134 }
31c0e219 135 if (aNbVertices < 3 || aNbTriangles <= 0)
2bd4c032 136 {
31c0e219 137 return Handle(Graphic3d_ArrayOfTriangles)();
3b1817a9 138 }
2bd4c032 139
31c0e219 140 Handle(Graphic3d_ArrayOfTriangles) anArray = new Graphic3d_ArrayOfTriangles (aNbVertices, 3 * aNbTriangles,
871fa103 141 Standard_True, Standard_False, theHasTexels);
31c0e219 142 Standard_Real aUmin (0.0), aUmax (0.0), aVmin (0.0), aVmax (0.0), dUmax (0.0), dVmax (0.0);
fc9b36d6 143 for (aFaceIt.Init (theShape, TopAbs_FACE); aFaceIt.More(); aFaceIt.Next())
2bd4c032 144 {
fc9b36d6 145 const TopoDS_Face& aFace = TopoDS::Face(aFaceIt.Current());
146 aT = StdPrs_ToolShadedShape::Triangulation (aFace, aLoc);
31c0e219 147 if (aT.IsNull())
3b1817a9 148 {
149 continue;
150 }
151 const gp_Trsf& aTrsf = aLoc.Transformation();
7d9e854b 152
153 // Determinant of transform matrix less then 0 means that mirror transform applied.
154 Standard_Boolean isMirrored = aTrsf.VectorialPart().Determinant() < 0;
155
31c0e219 156 Poly_Connect aPolyConnect (aT);
3b1817a9 157 // Extracts vertices & normals from nodes
31c0e219 158 const TColgp_Array1OfPnt& aNodes = aT->Nodes();
159 const TColgp_Array1OfPnt2d& aUVNodes = aT->UVNodes();
3b1817a9 160 TColgp_Array1OfDir aNormals (aNodes.Lower(), aNodes.Upper());
fc9b36d6 161 StdPrs_ToolShadedShape::Normal (aFace, aPolyConnect, aNormals);
3b1817a9 162
163 if (theHasTexels)
2bd4c032 164 {
3b1817a9 165 BRepTools::UVBounds (aFace, aUmin, aUmax, aVmin, aVmax);
166 dUmax = (aUmax - aUmin);
167 dVmax = (aVmax - aVmin);
168 }
169
31c0e219 170 const Standard_Integer aDecal = anArray->VertexNumber();
3b1817a9 171 for (Standard_Integer aNodeIter = aNodes.Lower(); aNodeIter <= aNodes.Upper(); ++aNodeIter)
172 {
31c0e219 173 aPoint = aNodes (aNodeIter);
3b1817a9 174 if (!aLoc.IsIdentity())
2bd4c032 175 {
31c0e219 176 aPoint.Transform (aTrsf);
7d9e854b 177
178 aNormals (aNodeIter) = aNormals (aNodeIter).Transformed (aTrsf);
2bd4c032 179 }
3b1817a9 180
181 if (theHasTexels && aUVNodes.Upper() == aNodes.Upper())
2bd4c032 182 {
3b1817a9 183 const gp_Pnt2d aTexel = gp_Pnt2d ((-theUVOrigin.X() + (theUVRepeat.X() * (aUVNodes (aNodeIter).X() - aUmin)) / dUmax) / theUVScale.X(),
184 (-theUVOrigin.Y() + (theUVRepeat.Y() * (aUVNodes (aNodeIter).Y() - aVmin)) / dVmax) / theUVScale.Y());
31c0e219 185 anArray->AddVertex (aPoint, aNormals (aNodeIter), aTexel);
2bd4c032 186 }
3b1817a9 187 else
2bd4c032 188 {
31c0e219 189 anArray->AddVertex (aPoint, aNormals (aNodeIter));
2bd4c032 190 }
3b1817a9 191 }
2bd4c032 192
3b1817a9 193 // Fill array with vertex and edge visibility info
31c0e219 194 const Poly_Array1OfTriangle& aTriangles = aT->Triangles();
195 Standard_Integer anIndex[3];
196 for (Standard_Integer aTriIter = 1; aTriIter <= aT->NbTriangles(); ++aTriIter)
3b1817a9 197 {
7d9e854b 198 if ((aFace.Orientation() == TopAbs_REVERSED) ^ isMirrored)
31c0e219 199 {
200 aTriangles (aTriIter).Get (anIndex[0], anIndex[2], anIndex[1]);
201 }
3b1817a9 202 else
31c0e219 203 {
204 aTriangles (aTriIter).Get (anIndex[0], anIndex[1], anIndex[2]);
205 }
3b1817a9 206
31c0e219 207 gp_Pnt aP1 = aNodes (anIndex[0]);
208 gp_Pnt aP2 = aNodes (anIndex[1]);
209 gp_Pnt aP3 = aNodes (anIndex[2]);
3b1817a9 210
31c0e219 211 gp_Vec aV1 (aP1, aP2);
212 if (aV1.SquareMagnitude() <= aPreci)
3b1817a9 213 {
214 continue;
215 }
31c0e219 216 gp_Vec aV2 (aP2, aP3);
217 if (aV2.SquareMagnitude() <= aPreci)
3b1817a9 218 {
219 continue;
220 }
31c0e219 221 gp_Vec aV3 (aP3, aP1);
222 if (aV3.SquareMagnitude() <= aPreci)
3b1817a9 223 {
224 continue;
225 }
31c0e219 226 aV1.Normalize();
227 aV2.Normalize();
228 aV1.Cross (aV2);
229 if (aV1.SquareMagnitude() > aPreci)
2bd4c032 230 {
31c0e219 231 anArray->AddEdge (anIndex[0] + aDecal);
232 anArray->AddEdge (anIndex[1] + aDecal);
233 anArray->AddEdge (anIndex[2] + aDecal);
2bd4c032 234 }
235 }
2bd4c032 236 }
31c0e219 237 return anArray;
238 }
239
240 //! Searches closed and unclosed subshapes in shape structure
241 //! and puts them into two compounds for separate processing of closed and unclosed sub-shapes.
242 static void exploreSolids (const TopoDS_Shape& theShape,
243 const BRep_Builder& theBuilder,
244 TopoDS_Compound& theCompoundForClosed,
245 TopoDS_Compound& theCompoundForOpened)
246 {
247 if (theShape.IsNull())
248 {
249 return;
250 }
251
252 switch (theShape.ShapeType())
253 {
254 case TopAbs_COMPOUND:
255 case TopAbs_COMPSOLID:
256 {
257 for (TopoDS_Iterator anIter (theShape); anIter.More(); anIter.Next())
258 {
259 exploreSolids (anIter.Value(), theBuilder, theCompoundForClosed, theCompoundForOpened);
260 }
261 return;
262 }
263 case TopAbs_SOLID:
264 {
4769a395 265 for (TopoDS_Iterator anIter (theShape); anIter.More(); anIter.Next())
266 {
267 const TopoDS_Shape& aSubShape = anIter.Value();
268 const Standard_Boolean isClosed = aSubShape.ShapeType() == TopAbs_SHELL &&
269 BRep_Tool::IsClosed (aSubShape) &&
270 StdPrs_ToolShadedShape::IsTriangulated (aSubShape);
271 theBuilder.Add (isClosed ? theCompoundForClosed : theCompoundForOpened, aSubShape);
272 }
31c0e219 273 return;
274 }
275 case TopAbs_SHELL:
276 case TopAbs_FACE:
277 {
278 theBuilder.Add (theCompoundForOpened, theShape);
279 return;
280 }
281 case TopAbs_WIRE:
282 case TopAbs_EDGE:
283 case TopAbs_VERTEX:
284 case TopAbs_SHAPE:
285 default:
286 return;
287 }
288 }
289
290 //! Prepare shaded presentation for specified shape
291 static Standard_Boolean shadeFromShape (const TopoDS_Shape& theShape,
292 const Handle(Prs3d_Presentation)& thePrs,
293 const Handle(Prs3d_Drawer)& theDrawer,
294 const Standard_Boolean theHasTexels,
295 const gp_Pnt2d& theUVOrigin,
296 const gp_Pnt2d& theUVRepeat,
297 const gp_Pnt2d& theUVScale,
298 const Standard_Boolean theIsClosed)
299 {
300 Handle(Graphic3d_ArrayOfTriangles) aPArray = fillTriangles (theShape, theHasTexels, theUVOrigin, theUVRepeat, theUVScale);
301 if (aPArray.IsNull())
302 {
303 return Standard_False;
304 }
3b1817a9 305
31c0e219 306 Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePrs);
307 aGroup->SetClosed (theIsClosed);
308 if (!theDrawer->ShadingAspectGlobal())
309 {
310 Handle(Graphic3d_AspectFillArea3d) anAsp = theDrawer->ShadingAspect()->Aspect();
311 theIsClosed ? anAsp->SuppressBackFace() : anAsp->AllowBackFace();
312 aGroup->SetGroupPrimitivesAspect (anAsp);
313 }
314 aGroup->AddPrimitiveArray (aPArray);
2bd4c032 315 return Standard_True;
316 }
a2d5ab2e 317
31c0e219 318 //! Compute boundary presentation for faces of the shape.
319 static void computeFaceBoundaries (const TopoDS_Shape& theShape,
320 const Handle(Prs3d_Presentation)& thePrs,
321 const Handle(Prs3d_Drawer)& theDrawer)
a2d5ab2e 322 {
323 // collection of all triangulation nodes on edges
324 // for computing boundaries presentation
325 NCollection_List<Handle(TColgp_HArray1OfPnt)> aNodeCollection;
326 Standard_Integer aNodeNumber = 0;
327
328 TopLoc_Location aTrsf;
329
330 // explore all boundary edges
331 TopTools_IndexedDataMapOfShapeListOfShape anEdgesMap;
332 TopExp::MapShapesAndAncestors (
333 theShape, TopAbs_EDGE, TopAbs_FACE, anEdgesMap);
334
335 Standard_Integer anEdgeIdx = 1;
336 for ( ; anEdgeIdx <= anEdgesMap.Extent (); anEdgeIdx++)
337 {
338 // reject free edges
339 const TopTools_ListOfShape& aFaceList = anEdgesMap.FindFromIndex (anEdgeIdx);
340 if (aFaceList.Extent() == 0)
341 continue;
342
343 // take one of the shared edges and get edge triangulation
344 const TopoDS_Face& aFace = TopoDS::Face (aFaceList.First ());
345 const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgesMap.FindKey (anEdgeIdx));
346
347 Handle(Poly_Triangulation) aTriangulation =
348 BRep_Tool::Triangulation (aFace, aTrsf);
349
350 if (aTriangulation.IsNull ())
351 continue;
352
353 Handle(Poly_PolygonOnTriangulation) anEdgePoly =
354 BRep_Tool::PolygonOnTriangulation (anEdge, aTriangulation, aTrsf);
355
356 if (anEdgePoly.IsNull ())
357 continue;
358
359 // get edge nodes indexes from face triangulation
360 const TColgp_Array1OfPnt& aTriNodes = aTriangulation->Nodes ();
361 const TColStd_Array1OfInteger& anEdgeNodes = anEdgePoly->Nodes ();
362
363 if (anEdgeNodes.Length () < 2)
364 continue;
365
366 // collect the edge nodes
367 Handle(TColgp_HArray1OfPnt) aCollected =
368 new TColgp_HArray1OfPnt (anEdgeNodes.Lower (), anEdgeNodes.Upper ());
369
370 Standard_Integer aNodeIdx = anEdgeNodes.Lower ();
371 for ( ; aNodeIdx <= anEdgeNodes.Upper (); aNodeIdx++)
372 {
373 // node index in face triangulation
374 Standard_Integer aTriIndex = anEdgeNodes.Value (aNodeIdx);
375
376 // get node and apply location transformation to the node
377 gp_Pnt aTriNode = aTriNodes.Value (aTriIndex);
378 if (!aTrsf.IsIdentity ())
379 aTriNode.Transform (aTrsf);
380
381 // add node to the boundary array
382 aCollected->SetValue (aNodeIdx, aTriNode);
383 }
384
385 aNodeNumber += anEdgeNodes.Length ();
386 aNodeCollection.Append (aCollected);
387 }
388
389 // check if it possible to continue building the presentation
390 if (aNodeNumber == 0)
391 return;
392
393 // allocate polyline array for presentation
394 Standard_Integer aSegmentEdgeNb =
395 (aNodeNumber - aNodeCollection.Extent()) * 2;
396
397 Handle(Graphic3d_ArrayOfSegments) aSegments =
398 new Graphic3d_ArrayOfSegments (aNodeNumber, aSegmentEdgeNb);
399
400 // build presentation for edge bondaries
401 NCollection_List<Handle(TColgp_HArray1OfPnt)>::Iterator
402 aCollIt (aNodeCollection);
403
404 // the edge index is increased in each iteration step to
405 // avoid contiguous segments between different face edges.
406 for ( ; aCollIt.More(); aCollIt.Next () )
407 {
408 const Handle(TColgp_HArray1OfPnt)& aNodeArray = aCollIt.Value ();
409
410 Standard_Integer aNodeIdx = aNodeArray->Lower ();
411
412 // add first node (this node is not shared with previous segment).
413 // for each face edge, indices for sharing nodes
414 // between segments begin from the first added node.
415 Standard_Integer aSegmentEdge =
416 aSegments->AddVertex (aNodeArray->Value (aNodeIdx));
417
418 // add subsequent nodes and provide edge indexes for sharing
419 // the nodes between the sequential segments.
420 for ( aNodeIdx++; aNodeIdx <= aNodeArray->Upper (); aNodeIdx++ )
421 {
422 aSegments->AddVertex (aNodeArray->Value (aNodeIdx));
423 aSegments->AddEdge ( aSegmentEdge);
424 aSegments->AddEdge (++aSegmentEdge);
425 }
426 }
427
428 // set up aspect and add polyline data
429 Handle(Graphic3d_AspectLine3d) aBoundaryAspect =
430 theDrawer->FaceBoundaryAspect ()->Aspect ();
431
31c0e219 432 Handle(Graphic3d_Group) aPrsGrp = Prs3d_Root::CurrentGroup (thePrs);
a2d5ab2e 433 aPrsGrp->SetGroupPrimitivesAspect (aBoundaryAspect);
a2d5ab2e 434 aPrsGrp->AddPrimitiveArray (aSegments);
a2d5ab2e 435 }
2bd4c032 436};
437
438// =======================================================================
439// function : Add
440// purpose :
441// =======================================================================
31c0e219 442void StdPrs_ShadedShape::Add (const Handle(Prs3d_Presentation)& thePrs,
443 const TopoDS_Shape& theShape,
444 const Handle(Prs3d_Drawer)& theDrawer,
445 const Standard_Boolean theToExploreSolids)
2bd4c032 446{
447 gp_Pnt2d aDummy;
31c0e219 448 StdPrs_ShadedShape::Add (thePrs, theShape, theDrawer,
449 Standard_False, aDummy, aDummy, aDummy, theToExploreSolids);
2bd4c032 450}
451
ad3217cd 452// =======================================================================
453// function : Tessellate
454// purpose :
455// =======================================================================
456void StdPrs_ShadedShape::Tessellate (const TopoDS_Shape& theShape,
457 const Handle (Prs3d_Drawer)& theDrawer)
458{
31c0e219 459 // Check if it is possible to avoid unnecessary recomputation of shape triangulation
9dba391d 460 Standard_Real aDeflection = Prs3d::GetDeflection (theShape, theDrawer);
ad3217cd 461 if (BRepTools::Triangulation (theShape, aDeflection))
462 {
463 return;
464 }
465
466 // retrieve meshing tool from Factory
ad3217cd 467 Handle(BRepMesh_DiscretRoot) aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret (theShape,
468 aDeflection,
469 theDrawer->HLRAngle());
470 if (!aMeshAlgo.IsNull())
471 {
472 aMeshAlgo->Perform();
473 }
474}
475
2bd4c032 476// =======================================================================
477// function : Add
478// purpose :
479// =======================================================================
31c0e219 480void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
2bd4c032 481 const TopoDS_Shape& theShape,
482 const Handle (Prs3d_Drawer)& theDrawer,
483 const Standard_Boolean theHasTexels,
484 const gp_Pnt2d& theUVOrigin,
485 const gp_Pnt2d& theUVRepeat,
31c0e219 486 const gp_Pnt2d& theUVScale,
487 const Standard_Boolean theToExploreSolids)
2bd4c032 488{
489 if (theShape.IsNull())
490 {
491 return;
492 }
493
31c0e219 494 // add wireframe presentation for isolated edges and vertices
495 wireframeFromShape (thePrs, theShape, theDrawer);
496
4769a395 497 // Triangulation completeness is important for "open-closed" analysis - perform tessellation beforehand
31c0e219 498 Tessellate (theShape, theDrawer);
4769a395 499
500 // The shape types listed below need advanced analysis as potentially containing
501 // both closed and open parts. Solids are also included, because they might
502 // contain non-manifold parts inside (internal open shells)
31c0e219 503 if ((theShape.ShapeType() == TopAbs_COMPOUND
4769a395 504 || theShape.ShapeType() == TopAbs_COMPSOLID
505 || theShape.ShapeType() == TopAbs_SOLID)
31c0e219 506 && theToExploreSolids)
2bd4c032 507 {
31c0e219 508 // collect two compounds: for opened and closed (solid) sub-shapes
509 TopoDS_Compound anOpened, aClosed;
510 BRep_Builder aBuilder;
511 aBuilder.MakeCompound (aClosed);
512 aBuilder.MakeCompound (anOpened);
513 exploreSolids (theShape, aBuilder, aClosed, anOpened);
514
515 TopoDS_Iterator aShapeIter (aClosed);
516 if (aShapeIter.More())
2bd4c032 517 {
31c0e219 518 shadeFromShape (aClosed, thePrs, theDrawer,
519 theHasTexels, theUVOrigin, theUVRepeat, theUVScale, Standard_True);
2bd4c032 520 }
31c0e219 521
522 aShapeIter.Initialize (anOpened);
523 if (aShapeIter.More())
2bd4c032 524 {
31c0e219 525 shadeFromShape (anOpened, thePrs, theDrawer,
526 theHasTexels, theUVOrigin, theUVRepeat, theUVScale, Standard_False);
2bd4c032 527 }
528 }
31c0e219 529 else
530 {
531 shadeFromShape (theShape, thePrs, theDrawer,
4769a395 532 theHasTexels, theUVOrigin, theUVRepeat, theUVScale,
533 StdPrs_ToolShadedShape::IsClosed (theShape));
31c0e219 534 }
2bd4c032 535
31c0e219 536 if (theDrawer->IsFaceBoundaryDraw())
a2d5ab2e 537 {
31c0e219 538 computeFaceBoundaries (theShape, thePrs, theDrawer);
a2d5ab2e 539 }
540}