78c4e836 |
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> |
1220d98e |
19 | #include <OpenGl_NamedResource.hxx> |
78c4e836 |
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 | |
7d7541ce |
39 | //! Attach a texture image. |
40 | //! Resets the active FBO to 0. |
78c4e836 |
41 | Standard_EXPORT void AttachDepthTexture (const Handle(OpenGl_Context)& theCtx, |
42 | const Handle(OpenGl_Texture)& theDepthStencilTexture); |
43 | |
7d7541ce |
44 | //! Detach a texture image. |
45 | //! Resets the active FBO to 0. |
78c4e836 |
46 | Standard_EXPORT void DetachDepthTexture (const Handle(OpenGl_Context)& theCtx); |
47 | |
48 | //! Returns additional buffers for ping-pong |
49 | const Handle(OpenGl_FrameBuffer)* DepthPeelFbosOit() const { return myDepthPeelFbosOit; } |
50 | |
51 | //! Returns additional buffers for ping-pong |
52 | const Handle(OpenGl_FrameBuffer)* FrontBackColorFbosOit() const { return myFrontBackColorFbosOit; } |
53 | |
54 | //! Returns additional FBO for depth peeling |
55 | const Handle(OpenGl_FrameBuffer)& BlendBackFboOit() const { return myBlendBackFboOit; } |
56 | |
57 | private: |
58 | |
59 | Handle(OpenGl_FrameBuffer) myDepthPeelFbosOit[2]; //!< depth + front color + back color |
60 | Handle(OpenGl_FrameBuffer) myFrontBackColorFbosOit[2]; //!< front color + back color |
61 | Handle(OpenGl_FrameBuffer) myBlendBackFboOit; |
62 | |
63 | }; |
64 | |
65 | #endif // _OpenGl_DepthPeeling_HeaderFile |