#ifndef OPENMW_MWRENDER_HDR_H #define OPENMW_MWRENDER_HDR_H #include #include #include #include namespace Shader { class ShaderManager; } namespace MWRender { class PingPongCanvas; class HDRDriver { public: HDRDriver() = default; HDRDriver(Shader::ShaderManager& shaderManager); void draw(const PingPongCanvas& canvas, osg::RenderInfo& renderInfo, osg::State& state, osg::GLExtensions* ext, size_t frameId); bool isEnabled() const { return mEnabled; } void enable() { mEnabled = true; } void disable() { mEnabled = false; } void dirty(int w, int h) { mWidth = w; mHeight = h; mCompiled = false; } osg::ref_ptr getLuminanceTexture(size_t frameId) const; private: void compile(); struct HDRContainer { osg::ref_ptr fullscreenFbo; osg::ref_ptr mipmapFbo; osg::ref_ptr finalFbo; osg::ref_ptr texture; osg::ref_ptr finalTexture; osg::ref_ptr fullscreenStateset; osg::ref_ptr mipmapStateset; }; std::array mBuffers; osg::ref_ptr mLuminanceProgram; osg::ref_ptr mProgram; bool mCompiled; bool mEnabled; int mWidth; int mHeight; }; } #endif