0024224: Suspicious logics in changing clipping planes at OpenGl_Structure
[occt.git] / src / OpenGl / OpenGl_CappingAlgo.hxx
CommitLineData
4269bd1b 1// Created on: 2013-09-05
2// Created by: Anton POLETAEV
3// Copyright (c) 2013 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#ifndef _OpenGl_CappingAlgo_H__
21#define _OpenGl_CappingAlgo_H__
22
23#include <OpenGl_RenderFilter.hxx>
24#include <OpenGl_Group.hxx>
25
26// Forward declaration
27class Handle(OpenGl_Workspace);
28class Handle(Graphic3d_ClipPlane);
29
30DEFINE_STANDARD_HANDLE (OpenGl_CappingAlgoFilter, OpenGl_RenderFilter)
31
32//! Capping surface rendering algorithm.
33class OpenGl_CappingAlgo
34{
35public:
36
37 //! Draw capping surfaces by OpenGl for the clipping planes
38 //! enabled in current context state. Depth buffer must be generated
39 //! for the passed groups.
40 //! @param theWorkspace [in] the GL workspace, context state.
41 //! @param theGroups [in] the group of primitives to be capped.
42 Standard_EXPORT static void RenderCapping (const Handle(OpenGl_Workspace)& theWorkspace,
43 const OpenGl_ListOfGroup& theGroups);
44
45 //! Render infinite capping plane.
46 //! @param theWorkspace [in] the GL workspace, context state.
47 //! @param thePlane [in] the graphical plane, for which the capping surface is rendered.
48 Standard_EXPORT static void RenderPlane (const Handle(OpenGl_Workspace)& theWorkspace,
49 const Handle(Graphic3d_ClipPlane)& thePlane);
50
51private:
52
53 //! Init algorithm.
54 static void Init();
55
56 //! @return capping algorithm rendering filter.
57 static const Handle(OpenGl_RenderFilter)& CappingFilter() { return myRenderFilter; }
58
59 //! @return face aspect for front face culling mode.
60 static const OpenGl_AspectFace* FrontCulling() { return &myFrontCulling; }
61
62 //! @return face aspect for none culling mode.
63 static const OpenGl_AspectFace* NoneCulling() { return &myNoneCulling; }
64
65private:
66
67 static Handle(OpenGl_RenderFilter) myRenderFilter;
68 static OpenGl_AspectFace myFrontCulling;
69 static OpenGl_AspectFace myNoneCulling;
70 static Standard_Boolean myIsInit;
71};
72
73//! Graphical capping rendering algorithm filter.
74//! Filters out everything excepth shaded primitives.
75class OpenGl_CappingAlgoFilter : public OpenGl_RenderFilter
76{
77public:
78
79 //! Default constructor.
80 OpenGl_CappingAlgoFilter() {}
81
82 //! Checks whether the element can be rendered or not.
83 //! @param theElement [in] the element to check.
84 //! @return True if element can be rendered.
85 virtual Standard_Boolean CanRender (const OpenGl_Element* theElement);
86
87public:
88
89 DEFINE_STANDARD_RTTI(OpenGl_CappingAlgoFilter)
90};
91
92#endif