0023024: Update headers of OCCT files
[occt.git] / src / OpenGl / OpenGl_PrimitiveArray.hxx
1 // Created on: 2011-07-13
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2012 OPEN CASCADE SAS
4 //
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
9 //
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 //
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
19
20
21 #ifndef OpenGl_PrimitiveArray_Header
22 #define OpenGl_PrimitiveArray_Header
23
24 #include <OpenGl_GlCore11.hxx>
25
26 #include <InterfaceGraphic_telem.hxx>
27 #include <Aspect_InteriorStyle.hxx>
28
29 #include <OpenGl_Element.hxx>
30
31 struct OPENGL_SURF_PROP;
32 class Handle(OpenGl_Context);
33
34 class OpenGl_PrimitiveArray : public OpenGl_Element
35 {
36 public:
37
38   //! Default constructor
39   OpenGl_PrimitiveArray (CALL_DEF_PARRAY* thePArray);
40
41   //! Destructor
42   virtual ~OpenGl_PrimitiveArray();
43
44   //! Render primitives to the window
45   virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
46
47   CALL_DEF_PARRAY* PArray() const { return myPArray; }
48
49 private:
50
51   //! VBO initialization procedures
52   Standard_Boolean BuildVBO (const Handle(OpenGl_Workspace)& theWorkspace) const;
53   void clearMemoryOwn() const;
54   void clearMemoryGL (const Handle(OpenGl_Context)& theGlContext) const;
55   Standard_Boolean checkSizeForGraphicMemory (const Handle(OpenGl_Context)& theGlContext) const;
56
57   //! Main procedure to draw array
58   void DrawArray (Tint theLightingModel,
59                   const Aspect_InteriorStyle theInteriorStyle,
60                   Tint theEdgeFlag,
61                   const TEL_COLOUR* theInteriorColour,
62                   const TEL_COLOUR* theLineColour,
63                   const TEL_COLOUR* theEdgeColour,
64                   const OPENGL_SURF_PROP* theFaceProp,
65                   const Handle(OpenGl_Workspace)& theWorkspace) const;
66
67   //! Auxiliary procedures
68   void DrawEdges (const TEL_COLOUR*               theEdgeColour,
69                   const Handle(OpenGl_Workspace)& theWorkspace) const;
70
71   void DrawDegeneratesAsPoints (const TEL_COLOUR* theEdgeColour,
72                                 const float       theSkipRatio) const;
73   void DrawDegeneratesAsLines (const TEL_COLOUR*               theEdgeColour,
74                                const Handle(OpenGl_Workspace)& theWorkspace) const;
75   void DrawDegeneratesAsBBoxs (const TEL_COLOUR* theEdgeColour) const;
76
77   void DrawDegeneratesPointsAsPoints() const;
78   void DrawDegeneratesLinesAsPoints() const;
79   void DrawDegeneratesLinesAsLines (const float theSkipRatio) const;
80   void DrawDegeneratesTrianglesAsPoints() const;
81   void DrawDegeneratesTrianglesAsLines (const float theSkipRatio) const;
82   void DrawDegeneratesTrianglestripsAsPoints() const;
83   void DrawDegeneratesTrianglestripsAsLines (const float theSkipRatio) const;
84   void DrawDegeneratesQuadranglesAsPoints() const;
85   void DrawDegeneratesQuadranglesAsLines (const float theSkipRatio) const;
86   void DrawDegeneratesQuadranglestripsAsPoints() const;
87   void DrawDegeneratesQuadranglestripsAsLines (const float theSkipRatio) const;
88   void DrawDegeneratesPolygonsAsPoints() const;
89   void DrawDegeneratesPolygonsAsLines (const float theSkipRatio) const;
90
91 protected:
92
93   mutable CALL_DEF_PARRAY* myPArray;
94   GLenum                   myDrawMode;
95
96 public:
97
98   DEFINE_STANDARD_ALLOC
99
100 };
101
102 #endif //OpenGl_PrimitiveArray_Header