4269bd1b |
1 | // Created on: 2013-09-05 |
2 | // Created by: Anton POLETAEV |
3 | // Copyright (c) 2013 OPEN CASCADE SAS |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
4269bd1b |
6 | // |
973c2be1 |
7 | // This library is free software; you can redistribute it and / or modify it |
8 | // under the terms of the GNU Lesser General Public 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. |
4269bd1b |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
4269bd1b |
15 | |
16 | #ifndef _OpenGl_CappingAlgo_H__ |
17 | #define _OpenGl_CappingAlgo_H__ |
18 | |
19 | #include <OpenGl_RenderFilter.hxx> |
20 | #include <OpenGl_Group.hxx> |
21 | |
22 | // Forward declaration |
23 | class Handle(OpenGl_Workspace); |
24 | class Handle(Graphic3d_ClipPlane); |
25 | |
26 | DEFINE_STANDARD_HANDLE (OpenGl_CappingAlgoFilter, OpenGl_RenderFilter) |
27 | |
28 | //! Capping surface rendering algorithm. |
29 | class OpenGl_CappingAlgo |
30 | { |
31 | public: |
32 | |
33 | //! Draw capping surfaces by OpenGl for the clipping planes |
34 | //! enabled in current context state. Depth buffer must be generated |
35 | //! for the passed groups. |
36 | //! @param theWorkspace [in] the GL workspace, context state. |
37 | //! @param theGroups [in] the group of primitives to be capped. |
38 | Standard_EXPORT static void RenderCapping (const Handle(OpenGl_Workspace)& theWorkspace, |
39 | const OpenGl_ListOfGroup& theGroups); |
40 | |
41 | //! Render infinite capping plane. |
42 | //! @param theWorkspace [in] the GL workspace, context state. |
43 | //! @param thePlane [in] the graphical plane, for which the capping surface is rendered. |
44 | Standard_EXPORT static void RenderPlane (const Handle(OpenGl_Workspace)& theWorkspace, |
45 | const Handle(Graphic3d_ClipPlane)& thePlane); |
46 | |
47 | private: |
48 | |
49 | //! Init algorithm. |
50 | static void Init(); |
51 | |
52 | //! @return capping algorithm rendering filter. |
53 | static const Handle(OpenGl_RenderFilter)& CappingFilter() { return myRenderFilter; } |
54 | |
55 | //! @return face aspect for front face culling mode. |
56 | static const OpenGl_AspectFace* FrontCulling() { return &myFrontCulling; } |
57 | |
58 | //! @return face aspect for none culling mode. |
59 | static const OpenGl_AspectFace* NoneCulling() { return &myNoneCulling; } |
60 | |
61 | private: |
62 | |
63 | static Handle(OpenGl_RenderFilter) myRenderFilter; |
64 | static OpenGl_AspectFace myFrontCulling; |
65 | static OpenGl_AspectFace myNoneCulling; |
66 | static Standard_Boolean myIsInit; |
67 | }; |
68 | |
69 | //! Graphical capping rendering algorithm filter. |
70 | //! Filters out everything excepth shaded primitives. |
71 | class OpenGl_CappingAlgoFilter : public OpenGl_RenderFilter |
72 | { |
73 | public: |
74 | |
75 | //! Default constructor. |
76 | OpenGl_CappingAlgoFilter() {} |
77 | |
78 | //! Checks whether the element can be rendered or not. |
79 | //! @param theElement [in] the element to check. |
80 | //! @return True if element can be rendered. |
81 | virtual Standard_Boolean CanRender (const OpenGl_Element* theElement); |
82 | |
83 | public: |
84 | |
85 | DEFINE_STANDARD_RTTI(OpenGl_CappingAlgoFilter) |
86 | }; |
87 | |
88 | #endif |