0024732: OpenGl_Context - retrieve functions up to GL4.4
[occt.git] / src / OpenGl / OpenGl_Group.hxx
1 // Created on: 2011-08-01
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _OpenGl_Group_Header
17 #define _OpenGl_Group_Header
18
19 #include <NCollection_List.hxx>
20 #include <InterfaceGraphic_Graphic3d.hxx>
21
22 #include <OpenGl_Element.hxx>
23
24 #include <OpenGl_AspectLine.hxx>
25 #include <OpenGl_AspectFace.hxx>
26 #include <OpenGl_AspectMarker.hxx>
27 #include <OpenGl_AspectText.hxx>
28
29 class OpenGl_Group;
30 class OpenGl_Structure;
31
32 typedef NCollection_List<const OpenGl_Group* > OpenGl_ListOfGroup;
33
34 struct OpenGl_ElementNode
35 {
36   OpenGl_Element*     elem;
37   OpenGl_ElementNode* next;
38   DEFINE_STANDARD_ALLOC
39 };
40
41 class OpenGl_Group : public OpenGl_Element
42 {
43 public:
44
45 #ifndef HAVE_OPENCL
46   OpenGl_Group();
47 #else
48   OpenGl_Group (const OpenGl_Structure* theAncestorStructure);
49 #endif
50
51   void SetAspectLine   (const CALL_DEF_CONTEXTLINE&     theAspect, const Standard_Boolean IsGlobal = Standard_True);
52   void SetAspectFace   (const CALL_DEF_CONTEXTFILLAREA& theAspect, const Standard_Boolean IsGlobal = Standard_True);
53   void SetAspectMarker (const CALL_DEF_CONTEXTMARKER&   theAspect, const Standard_Boolean IsGlobal = Standard_True);
54   void SetAspectText   (const CALL_DEF_CONTEXTTEXT&     theAspect, const Standard_Boolean IsGlobal = Standard_True);
55
56   void AddElement (OpenGl_Element* theElem);
57
58   virtual void Render  (const Handle(OpenGl_Workspace)& theWorkspace) const;
59   virtual void Release (const Handle(OpenGl_Context)&   theGlCtx);
60
61   //! Returns first OpenGL element node of the group.
62   const OpenGl_ElementNode* FirstNode() const { return myFirst; }
63
64   //! Returns OpenGL face aspect.
65   const OpenGl_AspectFace* AspectFace() const { return myAspectFace; }
66
67 #ifdef HAVE_OPENCL
68
69   //! Returns modification state for ray-tracing.
70   Standard_Size ModificationState() const { return myModificationState; }
71
72   //! Is the group ray-tracable (contains ray-tracable elements)?
73   Standard_Boolean IsRaytracable() const { return myIsRaytracable; }
74
75 #endif
76
77 protected:
78
79   virtual ~OpenGl_Group();
80
81 protected:
82
83   OpenGl_AspectLine*     myAspectLine;
84   OpenGl_AspectFace*     myAspectFace;
85   OpenGl_AspectMarker*   myAspectMarker;
86   OpenGl_AspectText*     myAspectText;
87
88   OpenGl_ElementNode*    myFirst;
89   OpenGl_ElementNode*    myLast;
90
91 #ifdef HAVE_OPENCL
92   const OpenGl_Structure*  myAncestorStructure;
93   Standard_Boolean         myIsRaytracable;
94   Standard_Size            myModificationState;
95 #endif
96
97 public:
98
99   DEFINE_STANDARD_ALLOC
100
101 };
102
103 #endif //_OpenGl_Group_Header