0032121: Draw Harness, ViewerTest - implement -reset option for vlight command
[occt.git] / src / OpenGl / OpenGl_DepthPeeling.hxx
1 // Created on: 2021-01-15
2 // Copyright (c) 2021 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #ifndef _OpenGl_DepthPeeling_HeaderFile
16 #define _OpenGl_DepthPeeling_HeaderFile
17
18 #include <OpenGl_FrameBuffer.hxx>
19 #include <OpenGl_NamedResource.hxx>
20
21 //! Class provides FBOs for dual depth peeling.
22 class OpenGl_DepthPeeling : public OpenGl_NamedResource
23 {
24   DEFINE_STANDARD_RTTIEXT(OpenGl_DepthPeeling, OpenGl_NamedResource)
25 public:
26
27   //! Constructor.
28   Standard_EXPORT OpenGl_DepthPeeling();
29
30   //! Destructor.
31   Standard_EXPORT virtual ~OpenGl_DepthPeeling();
32
33   //! Release OpenGL resources
34   Standard_EXPORT virtual void Release (OpenGl_Context* theGlCtx) Standard_OVERRIDE;
35
36   //! Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.
37   Standard_EXPORT virtual Standard_Size EstimatedDataSize() const Standard_OVERRIDE;
38
39   //! Attach a texture image
40   Standard_EXPORT void AttachDepthTexture (const Handle(OpenGl_Context)& theCtx,
41                                            const Handle(OpenGl_Texture)& theDepthStencilTexture);
42
43   //! Detach a texture image
44   Standard_EXPORT void DetachDepthTexture (const Handle(OpenGl_Context)& theCtx);
45
46   //! Returns additional buffers for ping-pong
47   const Handle(OpenGl_FrameBuffer)* DepthPeelFbosOit() const { return myDepthPeelFbosOit; }
48
49   //! Returns additional buffers for ping-pong
50   const Handle(OpenGl_FrameBuffer)* FrontBackColorFbosOit() const { return myFrontBackColorFbosOit; }
51
52   //! Returns additional FBO for depth peeling
53   const Handle(OpenGl_FrameBuffer)& BlendBackFboOit() const { return myBlendBackFboOit; }
54
55 private:
56
57   Handle(OpenGl_FrameBuffer) myDepthPeelFbosOit[2];      //!< depth + front color + back color
58   Handle(OpenGl_FrameBuffer) myFrontBackColorFbosOit[2]; //!< front color + back color
59   Handle(OpenGl_FrameBuffer) myBlendBackFboOit;
60
61 };
62
63 #endif // _OpenGl_DepthPeeling_HeaderFile