Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:19:01

0001 // Created on: 1993-09-23
0002 // Created by: Jean Louis FRENKEL
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _StdPrs_ShadedShape_HeaderFile
0018 #define _StdPrs_ShadedShape_HeaderFile
0019 
0020 #include <Prs3d_Root.hxx>
0021 #include <Prs3d_Drawer.hxx>
0022 #include <StdPrs_Volume.hxx>
0023 
0024 class Graphic3d_ArrayOfSegments;
0025 class Graphic3d_ArrayOfTriangles;
0026 class TopoDS_Shape;
0027 class BRep_Builder;
0028 class TopoDS_Compound;
0029 
0030 //! Auxiliary procedures to prepare Shaded presentation of specified shape.
0031 class StdPrs_ShadedShape : public Prs3d_Root
0032 {
0033 public:
0034   //! Shades <theShape>.
0035   //! @param theVolumeType defines the way how to interpret input shapes - as Closed volumes (to
0036   //! activate back-face culling and capping plane algorithms), as Open volumes (shells or solids
0037   //! with holes) or to perform Autodetection (would split input shape into two groups)
0038   Standard_EXPORT static void Add(const occ::handle<Prs3d_Presentation>& thePresentation,
0039                                   const TopoDS_Shape&                    theShape,
0040                                   const occ::handle<Prs3d_Drawer>&       theDrawer,
0041                                   const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection,
0042                                   const occ::handle<Graphic3d_Group>& theGroup = nullptr);
0043 
0044   //! Shades <theShape> with texture coordinates.
0045   //! @param theVolumeType defines the way how to interpret input shapes - as Closed volumes (to
0046   //! activate back-face culling and capping plane algorithms), as Open volumes (shells or solids
0047   //! with holes) or to perform Autodetection (would split input shape into two groups)
0048   Standard_EXPORT static void Add(const occ::handle<Prs3d_Presentation>& thePresentation,
0049                                   const TopoDS_Shape&                    theShape,
0050                                   const occ::handle<Prs3d_Drawer>&       theDrawer,
0051                                   const bool                             theHasTexels,
0052                                   const gp_Pnt2d&                        theUVOrigin,
0053                                   const gp_Pnt2d&                        theUVRepeat,
0054                                   const gp_Pnt2d&                        theUVScale,
0055                                   const StdPrs_Volume theVolume = StdPrs_Volume_Autodetection,
0056                                   const occ::handle<Graphic3d_Group>& theGroup = nullptr);
0057 
0058   //! Searches closed and unclosed subshapes in shape structure and puts them
0059   //! into two compounds for separate processing of closed and unclosed sub-shapes
0060   Standard_EXPORT static void ExploreSolids(const TopoDS_Shape& theShape,
0061                                             const BRep_Builder& theBuilder,
0062                                             TopoDS_Compound&    theClosed,
0063                                             TopoDS_Compound&    theOpened,
0064                                             const bool          theIgnore1DSubShape);
0065 
0066   //! Computes wireframe presentation for free wires and vertices
0067   Standard_EXPORT static void AddWireframeForFreeElements(
0068     const occ::handle<Prs3d_Presentation>& thePrs,
0069     const TopoDS_Shape&                    theShape,
0070     const occ::handle<Prs3d_Drawer>&       theDrawer);
0071 
0072   //! Computes special wireframe presentation for faces without triangulation.
0073   Standard_EXPORT static void AddWireframeForFacesWithoutTriangles(
0074     const occ::handle<Prs3d_Presentation>& thePrs,
0075     const TopoDS_Shape&                    theShape,
0076     const occ::handle<Prs3d_Drawer>&       theDrawer);
0077 
0078 public:
0079   //! Create primitive array with triangles for specified shape.
0080   //! @param[in] theShape  the shape with precomputed triangulation
0081   static occ::handle<Graphic3d_ArrayOfTriangles> FillTriangles(const TopoDS_Shape& theShape)
0082   {
0083     gp_Pnt2d aDummy;
0084     return FillTriangles(theShape, false, aDummy, aDummy, aDummy);
0085   }
0086 
0087   //! Create primitive array of triangles for specified shape.
0088   //! @param theShape     the shape with precomputed triangulation
0089   //! @param theHasTexels define UV coordinates in primitive array
0090   //! @param theUVOrigin  origin for UV coordinates
0091   //! @param theUVRepeat  repeat parameters  for UV coordinates
0092   //! @param theUVScale   scale coefficients for UV coordinates
0093   //! @return triangles array or NULL if specified face does not have computed triangulation
0094   Standard_EXPORT static occ::handle<Graphic3d_ArrayOfTriangles> FillTriangles(
0095     const TopoDS_Shape& theShape,
0096     const bool          theHasTexels,
0097     const gp_Pnt2d&     theUVOrigin,
0098     const gp_Pnt2d&     theUVRepeat,
0099     const gp_Pnt2d&     theUVScale);
0100 
0101   //! Define primitive array of boundary segments for specified shape.
0102   //! @param theShape segments array or NULL if specified face does not have computed triangulation
0103   //! @param theUpperContinuity the most edge continuity class to be included to result (edges with
0104   //! more continuity will be ignored)
0105   Standard_EXPORT static occ::handle<Graphic3d_ArrayOfSegments> FillFaceBoundaries(
0106     const TopoDS_Shape& theShape,
0107     GeomAbs_Shape       theUpperContinuity = GeomAbs_CN);
0108 };
0109 
0110 #endif // _StdPrs_ShadedShape_HeaderFile