#ifndef OPENMW_MWRENDER_PINGPONGCANVAS_H #define OPENMW_MWRENDER_PINGPONGCANVAS_H #include #include #include #include #include #include #include "luminancecalculator.hpp" namespace Shader { class ShaderManager; } namespace MWRender { class PingPongCanvas : public osg::Geometry { public: PingPongCanvas( Shader::ShaderManager& shaderManager, const std::shared_ptr& luminanceCalculator); void drawGeometry(osg::RenderInfo& renderInfo) const; void drawImplementation(osg::RenderInfo& renderInfo) const override; void dirty() { mDirty = true; } void setDirtyAttachments(const std::vector& attachments) { mDirtyAttachments = attachments; } const fx::DispatchArray& getPasses() { return mPasses; } void setPasses(fx::DispatchArray&& passes); void setMask(bool underwater, bool exterior); void setTextureScene(osg::ref_ptr tex) { mTextureScene = tex; } void setTextureDepth(osg::ref_ptr tex) { mTextureDepth = tex; } void setTextureNormals(osg::ref_ptr tex) { mTextureNormals = tex; } void setTextureDistortion(osg::ref_ptr tex) { mTextureDistortion = tex; } void setCalculateAvgLum(bool enabled) { mAvgLum = enabled; } void setPostProcessing(bool enabled) { mPostprocessing = enabled; } const osg::ref_ptr& getSceneTexture(size_t frameId) const { return mTextureScene; } private: bool mAvgLum = false; bool mPostprocessing = false; fx::DispatchArray mPasses; fx::FlagsType mMask = 0; osg::ref_ptr mFallbackProgram; osg::ref_ptr mMultiviewResolveProgram; osg::ref_ptr mFallbackStateSet; osg::ref_ptr mMultiviewResolveStateSet; osg::ref_ptr mTextureScene; osg::ref_ptr mTextureDepth; osg::ref_ptr mTextureNormals; osg::ref_ptr mTextureDistortion; mutable bool mDirty = false; mutable std::vector mDirtyAttachments; mutable osg::ref_ptr mRenderViewport; mutable osg::ref_ptr mMultiviewResolveFramebuffer; mutable osg::ref_ptr mDestinationFBO; mutable std::array, 3> mFbos; mutable std::shared_ptr mLuminanceCalculator; }; } #endif