Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:21:03

0001 // Created on: 2021-01-15
0002 // Copyright (c) 2021 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _OpenGl_DepthPeeling_HeaderFile
0016 #define _OpenGl_DepthPeeling_HeaderFile
0017 
0018 #include <OpenGl_FrameBuffer.hxx>
0019 #include <OpenGl_NamedResource.hxx>
0020 
0021 //! Class provides FBOs for dual depth peeling.
0022 class OpenGl_DepthPeeling : public OpenGl_NamedResource
0023 {
0024   DEFINE_STANDARD_RTTIEXT(OpenGl_DepthPeeling, OpenGl_NamedResource)
0025 public:
0026   //! Constructor.
0027   Standard_EXPORT OpenGl_DepthPeeling();
0028 
0029   //! Destructor.
0030   Standard_EXPORT ~OpenGl_DepthPeeling() override;
0031 
0032   //! Release OpenGL resources
0033   Standard_EXPORT void Release(OpenGl_Context* theGlCtx) override;
0034 
0035   //! Returns estimated GPU memory usage for holding data without considering overheads and
0036   //! allocation alignment rules.
0037   Standard_EXPORT size_t EstimatedDataSize() const override;
0038 
0039   //! Attach a texture image.
0040   //! Resets the active FBO to 0.
0041   Standard_EXPORT void AttachDepthTexture(
0042     const occ::handle<OpenGl_Context>& theCtx,
0043     const occ::handle<OpenGl_Texture>& theDepthStencilTexture);
0044 
0045   //! Detach a texture image.
0046   //! Resets the active FBO to 0.
0047   Standard_EXPORT void DetachDepthTexture(const occ::handle<OpenGl_Context>& theCtx);
0048 
0049   //! Returns additional buffers for ping-pong
0050   const occ::handle<OpenGl_FrameBuffer>* DepthPeelFbosOit() const { return myDepthPeelFbosOit; }
0051 
0052   //! Returns additional buffers for ping-pong
0053   const occ::handle<OpenGl_FrameBuffer>* FrontBackColorFbosOit() const
0054   {
0055     return myFrontBackColorFbosOit;
0056   }
0057 
0058   //! Returns additional FBO for depth peeling
0059   const occ::handle<OpenGl_FrameBuffer>& BlendBackFboOit() const { return myBlendBackFboOit; }
0060 
0061 private:
0062   occ::handle<OpenGl_FrameBuffer> myDepthPeelFbosOit[2];      //!< depth + front color + back color
0063   occ::handle<OpenGl_FrameBuffer> myFrontBackColorFbosOit[2]; //!< front color + back color
0064   occ::handle<OpenGl_FrameBuffer> myBlendBackFboOit;
0065 };
0066 
0067 #endif // _OpenGl_DepthPeeling_HeaderFile