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 | ||
19 | #include <InterfaceGraphic_Graphic3d.hxx> | |
b64d84be | 20 | #include <Graphic3d_Group.hxx> |
21 | #include <Graphic3d_Structure.hxx> | |
2166f0fa | 22 | |
b64d84be | 23 | #include <NCollection_List.hxx> |
2166f0fa SK |
24 | #include <OpenGl_AspectLine.hxx> |
25 | #include <OpenGl_AspectFace.hxx> | |
26 | #include <OpenGl_AspectMarker.hxx> | |
27 | #include <OpenGl_AspectText.hxx> | |
b64d84be | 28 | #include <OpenGl_Element.hxx> |
2166f0fa | 29 | |
4269bd1b | 30 | class OpenGl_Group; |
e276548b | 31 | class OpenGl_Structure; |
4269bd1b | 32 | |
2166f0fa SK |
33 | struct OpenGl_ElementNode |
34 | { | |
5322131b | 35 | OpenGl_Element* elem; |
36 | OpenGl_ElementNode* next; | |
1c35b92f | 37 | DEFINE_STANDARD_ALLOC |
2166f0fa SK |
38 | }; |
39 | ||
b64d84be | 40 | //! Implementation of low-level graphic group. |
41 | class OpenGl_Group : public Graphic3d_Group | |
2166f0fa | 42 | { |
5e27df78 | 43 | public: |
44 | ||
b64d84be | 45 | //! Create empty group. |
46 | //! Will throw exception if not created by OpenGl_Structure. | |
47 | Standard_EXPORT OpenGl_Group (const Handle(Graphic3d_Structure)& theStruct); | |
48 | ||
79104795 | 49 | Standard_EXPORT virtual void Clear (const Standard_Boolean theToUpdateStructureMgr) Standard_OVERRIDE; |
b64d84be | 50 | |
51 | //! Update line aspect | |
79104795 | 52 | Standard_EXPORT virtual void UpdateAspectLine (const Standard_Boolean theIsGlobal) Standard_OVERRIDE; |
b64d84be | 53 | |
54 | //! Update fill aspect | |
79104795 | 55 | Standard_EXPORT virtual void UpdateAspectFace (const Standard_Boolean theIsGlobal) Standard_OVERRIDE; |
b64d84be | 56 | |
57 | //! Update marker aspect | |
79104795 | 58 | Standard_EXPORT virtual void UpdateAspectMarker (const Standard_Boolean theIsGlobal) Standard_OVERRIDE; |
b64d84be | 59 | |
60 | //! Update text aspect | |
79104795 | 61 | Standard_EXPORT virtual void UpdateAspectText (const Standard_Boolean theIsGlobal) Standard_OVERRIDE; |
2166f0fa | 62 | |
b64d84be | 63 | //! Add primitive array element |
871fa103 | 64 | Standard_EXPORT virtual void AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theType, |
65 | const Handle(Graphic3d_IndexBuffer)& theIndices, | |
66 | const Handle(Graphic3d_Buffer)& theAttribs, | |
67 | const Handle(Graphic3d_BoundBuffer)& theBounds, | |
79104795 | 68 | const Standard_Boolean theToEvalMinMax) Standard_OVERRIDE; |
2166f0fa | 69 | |
b64d84be | 70 | //! Add text element |
71 | Standard_EXPORT virtual void Text (const Standard_CString theTextUtf, | |
72 | const Graphic3d_Vertex& thePoint, | |
73 | const Standard_Real theHeight, | |
74 | const Quantity_PlaneAngle theAngle, | |
75 | const Graphic3d_TextPath theTp, | |
76 | const Graphic3d_HorizontalTextAlignment theHta, | |
77 | const Graphic3d_VerticalTextAlignment theVta, | |
79104795 | 78 | const Standard_Boolean theToEvalMinMax) Standard_OVERRIDE; |
2166f0fa | 79 | |
ce01ec26 | 80 | //! Add text element in 3D space. |
81 | Standard_EXPORT virtual void Text (const Standard_CString theTextUtf, | |
82 | const gp_Ax2& theOrientation, | |
83 | const Standard_Real theHeight, | |
84 | const Quantity_PlaneAngle theAngle, | |
85 | const Graphic3d_TextPath theTp, | |
86 | const Graphic3d_HorizontalTextAlignment theHTA, | |
87 | const Graphic3d_VerticalTextAlignment theVTA, | |
3f1eb0ab | 88 | const Standard_Boolean theToEvalMinMax, |
89 | const Standard_Boolean theHasOwnAnchor = Standard_True) Standard_OVERRIDE; | |
ce01ec26 | 90 | |
b64d84be | 91 | //! Add flipping element |
92 | Standard_EXPORT virtual void SetFlippingOptions (const Standard_Boolean theIsEnabled, | |
79104795 | 93 | const gp_Ax2& theRefPlane) Standard_OVERRIDE; |
b64d84be | 94 | |
95 | //! Add stencil test element | |
79104795 | 96 | Standard_EXPORT virtual void SetStencilTestOptions (const Standard_Boolean theIsEnabled) Standard_OVERRIDE; |
b64d84be | 97 | |
98 | public: | |
99 | ||
100 | OpenGl_Structure* GlStruct() const { return (OpenGl_Structure* )(myStructure->CStructure().operator->()); } | |
101 | ||
102 | Standard_EXPORT void AddElement (OpenGl_Element* theElem); | |
103 | ||
104 | Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; | |
105 | Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theGlCtx); | |
2166f0fa | 106 | |
e276548b | 107 | //! Returns first OpenGL element node of the group. |
108 | const OpenGl_ElementNode* FirstNode() const { return myFirst; } | |
109 | ||
110 | //! Returns OpenGL face aspect. | |
111 | const OpenGl_AspectFace* AspectFace() const { return myAspectFace; } | |
112 | ||
e276548b | 113 | //! Is the group ray-tracable (contains ray-tracable elements)? |
114 | Standard_Boolean IsRaytracable() const { return myIsRaytracable; } | |
115 | ||
b64d84be | 116 | //! Accessor to line aspect (to be removed) |
117 | CALL_DEF_CONTEXTLINE& ChangeContextLine() { return ContextLine; } | |
e276548b | 118 | |
5e27df78 | 119 | protected: |
2166f0fa | 120 | |
b64d84be | 121 | Standard_EXPORT virtual ~OpenGl_Group(); |
5e27df78 | 122 | |
123 | protected: | |
2166f0fa | 124 | |
e276548b | 125 | OpenGl_AspectLine* myAspectLine; |
126 | OpenGl_AspectFace* myAspectFace; | |
127 | OpenGl_AspectMarker* myAspectMarker; | |
128 | OpenGl_AspectText* myAspectText; | |
129 | ||
130 | OpenGl_ElementNode* myFirst; | |
131 | OpenGl_ElementNode* myLast; | |
5322131b | 132 | |
b64d84be | 133 | Standard_Boolean myIsRaytracable; |
5e27df78 | 134 | |
135 | public: | |
2166f0fa | 136 | |
92efcf78 | 137 | DEFINE_STANDARD_RTTIEXT(OpenGl_Group,Graphic3d_Group) // Type definition |
5e27df78 | 138 | |
2166f0fa SK |
139 | }; |
140 | ||
b64d84be | 141 | DEFINE_STANDARD_HANDLE(OpenGl_Group, Graphic3d_Group) |
142 | ||
143 | #endif // _OpenGl_Group_Header |