Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:46

0001 // Created on: 2001-01-04
0002 // Copyright (c) 2001-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _Graphic3d_ArrayOfPolygons_HeaderFile
0016 #define _Graphic3d_ArrayOfPolygons_HeaderFile
0017 
0018 #include <Graphic3d_ArrayOfPrimitives.hxx>
0019 
0020 //! Contains polygons array definition.
0021 //! WARNING! Polygon primitives might be unsupported by graphics library.
0022 //! Triangulation should be used instead of quads for better compatibility.
0023 class Graphic3d_ArrayOfPolygons : public Graphic3d_ArrayOfPrimitives
0024 {
0025   DEFINE_STANDARD_RTTIEXT(Graphic3d_ArrayOfPolygons, Graphic3d_ArrayOfPrimitives)
0026 public:
0027 
0028   //! Creates an array of polygons (Graphic3d_TOPA_POLYGONS), a polygon can be filled as:
0029   //! 1) Creating a single polygon defined with his vertexes, i.e:
0030   //! @code
0031   //!   myArray = Graphic3d_ArrayOfPolygons (7);
0032   //!   myArray->AddVertex (x1, y1, z1);
0033   //!   ....
0034   //!   myArray->AddVertex (x7, y7, z7);
0035   //! @endcode
0036   //! 2) Creating separate polygons defined with a predefined number of bounds and the number of vertex per bound, i.e:
0037   //! @code
0038   //!   myArray = Graphic3d_ArrayOfPolygons (7, 2);
0039   //!   myArray->AddBound (4);
0040   //!   myArray->AddVertex (x1, y1, z1);
0041   //!   ....
0042   //!   myArray->AddVertex (x4, y4, z4);
0043   //!   myArray->AddBound (3);
0044   //!   myArray->AddVertex (x5, y5, z5);
0045   //!   ....
0046   //!   myArray->AddVertex (x7, y7, z7);
0047   //! @endcode
0048   //! 3) Creating a single indexed polygon defined with his vertex ans edges, i.e:
0049   //! @code
0050   //!   myArray = Graphic3d_ArrayOfPolygons (4, 0, 6);
0051   //!   myArray->AddVertex (x1, y1, z1);
0052   //!   ....
0053   //!   myArray->AddVertex (x4, y4, z4);
0054   //!   myArray->AddEdge (1);
0055   //!   myArray->AddEdge (2);
0056   //!   myArray->AddEdge (3);
0057   //!   myArray->AddEdge (1);
0058   //!   myArray->AddEdge (2);
0059   //!   myArray->AddEdge (4);
0060   //! @endcode
0061   //! 4) Creating separate polygons defined with a predefined number of bounds and the number of edges per bound, i.e:
0062   //! @code
0063   //!   myArray = Graphic3d_ArrayOfPolygons (6, 4, 14);
0064   //!   myArray->AddBound (3);
0065   //!   myArray->AddVertex (x1, y1, z1);
0066   //!   myArray->AddVertex (x2, y2, z2);
0067   //!   myArray->AddVertex (x3, y3, z3);
0068   //!   myArray->AddEdge (1);
0069   //!   myArray->AddEdge (2);
0070   //!   myArray->AddEdge (3);
0071   //!   myArray->AddBound (3);
0072   //!   myArray->AddVertex (x4, y4, z4);
0073   //!   myArray->AddVertex (x5, y5, z5);
0074   //!   myArray->AddVertex (x6, y6, z6);
0075   //!   myArray->AddEdge (4);
0076   //!   myArray->AddEdge (5);
0077   //!   myArray->AddEdge (6);
0078   //!   myArray->AddBound (4);
0079   //!   myArray->AddEdge (2);
0080   //!   myArray->AddEdge (3);
0081   //!   myArray->AddEdge (5);
0082   //!   myArray->AddEdge (6);
0083   //!   myArray->AddBound (4);
0084   //!   myArray->AddEdge (1);
0085   //!   myArray->AddEdge (3);
0086   //!   myArray->AddEdge (5);
0087   //!   myArray->AddEdge (4);
0088   //! @endcode
0089   //! @param theMaxVertexs defines the maximum allowed vertex number in the array
0090   //! @param theMaxBounds  defines the maximum allowed bound  number in the array
0091   //! @param theMaxEdges   defines the maximum allowed edge   number in the array
0092   //! @param theArrayFlags array flags
0093   Graphic3d_ArrayOfPolygons (Standard_Integer theMaxVertexs,
0094                              Standard_Integer theMaxBounds,
0095                              Standard_Integer theMaxEdges,
0096                              Graphic3d_ArrayFlags theArrayFlags)
0097   : Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_POLYGONS, theMaxVertexs, theMaxBounds, theMaxEdges, theArrayFlags) {}
0098 
0099   //! Creates an array of polygons (Graphic3d_TOPA_POLYGONS):
0100   //! @param theMaxVertexs defines the maximum allowed vertex number in the array
0101   //! @param theMaxBounds  defines the maximum allowed bound  number in the array
0102   //! @param theMaxEdges   defines the maximum allowed edge   number in the array
0103   Graphic3d_ArrayOfPolygons (const Standard_Integer theMaxVertexs,
0104                              const Standard_Integer theMaxBounds   = 0,
0105                              const Standard_Integer theMaxEdges    = 0,
0106                              const Standard_Boolean theHasVNormals = Standard_False,
0107                              const Standard_Boolean theHasVColors  = Standard_False,
0108                              const Standard_Boolean theHasBColors  = Standard_False,
0109                              const Standard_Boolean theHasVTexels  = Standard_False)
0110   : Graphic3d_ArrayOfPrimitives (Graphic3d_TOPA_POLYGONS, theMaxVertexs, theMaxBounds, theMaxEdges,
0111                                  (theHasVNormals ? Graphic3d_ArrayFlags_VertexNormal : Graphic3d_ArrayFlags_None)
0112                                | (theHasVColors  ? Graphic3d_ArrayFlags_VertexColor  : Graphic3d_ArrayFlags_None)
0113                                | (theHasBColors  ? Graphic3d_ArrayFlags_BoundColor   : Graphic3d_ArrayFlags_None)
0114                                | (theHasVTexels  ? Graphic3d_ArrayFlags_VertexTexel  : Graphic3d_ArrayFlags_None)) {}
0115 
0116 };
0117 
0118 DEFINE_STANDARD_HANDLE(Graphic3d_ArrayOfPolygons, Graphic3d_ArrayOfPrimitives)
0119 
0120 #endif // _Graphic3d_ArrayOfPolygons_HeaderFile