Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 2011-08-01 |
2 | // Created by: Sergey ZERCHANINOV | |
973c2be1 | 3 | // Copyright (c) 2011-2014 OPEN CASCADE SAS |
b311480e | 4 | // |
973c2be1 | 5 | // This file is part of Open CASCADE Technology software library. |
b311480e | 6 | // |
d5f74e42 | 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 | |
973c2be1 | 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. | |
b311480e | 12 | // |
973c2be1 | 13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. | |
b311480e | 15 | |
2166f0fa SK |
16 | #ifndef _OpenGl_Group_Header |
17 | #define _OpenGl_Group_Header | |
18 | ||
b64d84be | 19 | #include <Graphic3d_Group.hxx> |
20 | #include <Graphic3d_Structure.hxx> | |
2166f0fa | 21 | |
b64d84be | 22 | #include <NCollection_List.hxx> |
bf5f0ca2 | 23 | #include <OpenGl_Aspects.hxx> |
b64d84be | 24 | #include <OpenGl_Element.hxx> |
2166f0fa | 25 | |
4269bd1b | 26 | class OpenGl_Group; |
e276548b | 27 | class OpenGl_Structure; |
4269bd1b | 28 | |
2166f0fa SK |
29 | struct OpenGl_ElementNode |
30 | { | |
5322131b | 31 | OpenGl_Element* elem; |
32 | OpenGl_ElementNode* next; | |
1c35b92f | 33 | DEFINE_STANDARD_ALLOC |
2166f0fa SK |
34 | }; |
35 | ||
b64d84be | 36 | //! Implementation of low-level graphic group. |
37 | class OpenGl_Group : public Graphic3d_Group | |
2166f0fa | 38 | { |
5e27df78 | 39 | public: |
40 | ||
b64d84be | 41 | //! Create empty group. |
42 | //! Will throw exception if not created by OpenGl_Structure. | |
43 | Standard_EXPORT OpenGl_Group (const Handle(Graphic3d_Structure)& theStruct); | |
44 | ||
79104795 | 45 | Standard_EXPORT virtual void Clear (const Standard_Boolean theToUpdateStructureMgr) Standard_OVERRIDE; |
b64d84be | 46 | |
b6472664 | 47 | //! Return line aspect. |
bf5f0ca2 | 48 | virtual Handle(Graphic3d_Aspects) Aspects() const Standard_OVERRIDE |
b6472664 | 49 | { |
bf5f0ca2 | 50 | return myAspects != NULL |
51 | ? myAspects->Aspect() | |
52 | : Handle(Graphic3d_Aspects)(); | |
b6472664 | 53 | } |
54 | ||
bf5f0ca2 | 55 | //! Update aspect. |
56 | Standard_EXPORT virtual void SetGroupPrimitivesAspect (const Handle(Graphic3d_Aspects)& theAspect) Standard_OVERRIDE; | |
b6472664 | 57 | |
bf5f0ca2 | 58 | //! Append aspect as an element. |
59 | Standard_EXPORT virtual void SetPrimitivesAspect (const Handle(Graphic3d_Aspects)& theAspect) Standard_OVERRIDE; | |
2166f0fa | 60 | |
eaac0866 | 61 | //! Update presentation aspects after their modification. |
62 | Standard_EXPORT virtual void SynchronizeAspects() Standard_OVERRIDE; | |
63 | ||
bf5f0ca2 | 64 | //! Replace aspects specified in the replacement map. |
65 | Standard_EXPORT virtual void ReplaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap) Standard_OVERRIDE; | |
66 | ||
b64d84be | 67 | //! Add primitive array element |
871fa103 | 68 | Standard_EXPORT virtual void AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theType, |
69 | const Handle(Graphic3d_IndexBuffer)& theIndices, | |
70 | const Handle(Graphic3d_Buffer)& theAttribs, | |
71 | const Handle(Graphic3d_BoundBuffer)& theBounds, | |
79104795 | 72 | const Standard_Boolean theToEvalMinMax) Standard_OVERRIDE; |
2166f0fa | 73 | |
8ed07085 | 74 | //! Adds a text for display |
75 | Standard_EXPORT virtual void AddText (const Handle(Graphic3d_Text)& theTextParams, | |
76 | const Standard_Boolean theToEvalMinMax) Standard_OVERRIDE; | |
b64d84be | 77 | //! Add flipping element |
78 | Standard_EXPORT virtual void SetFlippingOptions (const Standard_Boolean theIsEnabled, | |
79104795 | 79 | const gp_Ax2& theRefPlane) Standard_OVERRIDE; |
b64d84be | 80 | |
81 | //! Add stencil test element | |
79104795 | 82 | Standard_EXPORT virtual void SetStencilTestOptions (const Standard_Boolean theIsEnabled) Standard_OVERRIDE; |
b64d84be | 83 | |
84 | public: | |
85 | ||
86 | OpenGl_Structure* GlStruct() const { return (OpenGl_Structure* )(myStructure->CStructure().operator->()); } | |
87 | ||
88 | Standard_EXPORT void AddElement (OpenGl_Element* theElem); | |
89 | ||
90 | Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; | |
91 | Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theGlCtx); | |
2166f0fa | 92 | |
e276548b | 93 | //! Returns first OpenGL element node of the group. |
94 | const OpenGl_ElementNode* FirstNode() const { return myFirst; } | |
95 | ||
bf5f0ca2 | 96 | //! Returns OpenGL aspect. |
97 | const OpenGl_Aspects* GlAspects() const { return myAspects; } | |
e276548b | 98 | |
e276548b | 99 | //! Is the group ray-tracable (contains ray-tracable elements)? |
100 | Standard_Boolean IsRaytracable() const { return myIsRaytracable; } | |
101 | ||
0904aa63 | 102 | //! Dumps the content of me into the stream |
bc73b006 | 103 | Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; |
0904aa63 | 104 | |
5e27df78 | 105 | protected: |
2166f0fa | 106 | |
b64d84be | 107 | Standard_EXPORT virtual ~OpenGl_Group(); |
5e27df78 | 108 | |
109 | protected: | |
2166f0fa | 110 | |
bf5f0ca2 | 111 | OpenGl_Aspects* myAspects; |
112 | OpenGl_ElementNode* myFirst; | |
113 | OpenGl_ElementNode* myLast; | |
114 | Standard_Boolean myIsRaytracable; | |
5e27df78 | 115 | |
116 | public: | |
2166f0fa | 117 | |
92efcf78 | 118 | DEFINE_STANDARD_RTTIEXT(OpenGl_Group,Graphic3d_Group) // Type definition |
5e27df78 | 119 | |
2166f0fa SK |
120 | }; |
121 | ||
b64d84be | 122 | DEFINE_STANDARD_HANDLE(OpenGl_Group, Graphic3d_Group) |
123 | ||
124 | #endif // _OpenGl_Group_Header |