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