1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-31 06:32:39 +00:00
OpenMW/apps/openmw/mwrender/luminancecalculator.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
1.8 KiB
C++
Raw Normal View History

2022-07-22 20:41:08 -07:00
#ifndef OPENMW_MWRENDER_LUMINANCECALCULATOR_H
#define OPENMW_MWRENDER_LUMINANCECALCULATOR_H
#include <array>
#include <osg/FrameBufferObject>
#include <osg/Program>
#include <osg/Texture2D>
namespace Shader
{
class ShaderManager;
}
namespace MWRender
{
class PingPongCanvas;
class LuminanceCalculator
{
public:
LuminanceCalculator() = default;
LuminanceCalculator(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; }
2023-02-05 12:30:38 -08:00
void dirty(int w, int h);
2022-07-22 20:41:08 -07:00
osg::ref_ptr<osg::Texture2D> getLuminanceTexture(size_t frameId) const;
private:
void compile();
struct Container
{
osg::ref_ptr<osg::FrameBufferObject> sceneLumFbo;
osg::ref_ptr<osg::FrameBufferObject> resolveSceneLumFbo;
osg::ref_ptr<osg::FrameBufferObject> resolveFbo;
osg::ref_ptr<osg::FrameBufferObject> luminanceProxyFbo;
osg::ref_ptr<osg::Texture2D> mipmappedSceneLuminanceTex;
osg::ref_ptr<osg::Texture2D> luminanceTex;
osg::ref_ptr<osg::Texture2D> luminanceProxyTex;
osg::ref_ptr<osg::StateSet> sceneLumSS;
osg::ref_ptr<osg::StateSet> resolveSS;
};
std::array<Container, 2> mBuffers;
osg::ref_ptr<osg::Program> mLuminanceProgram;
osg::ref_ptr<osg::Program> mResolveProgram;
bool mCompiled = false;
bool mEnabled = false;
2023-11-08 17:25:41 -08:00
bool mIsBlank = true;
2022-07-22 20:41:08 -07:00
int mWidth = 1;
int mHeight = 1;
2023-02-05 12:30:38 -08:00
osg::Vec2f mScale = osg::Vec2f(1, 1);
2022-07-22 20:41:08 -07:00
};
}
#endif