From 54409423f767d8b1cf30cb7d0efca6b4ca138823 Mon Sep 17 00:00:00 2001 From: Ethan Morgan Date: Sat, 14 Feb 2026 16:44:06 +0000 Subject: move to own git server --- apps/openmb/renderer/SSAORenderer.hpp | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 apps/openmb/renderer/SSAORenderer.hpp (limited to 'apps/openmb/renderer/SSAORenderer.hpp') diff --git a/apps/openmb/renderer/SSAORenderer.hpp b/apps/openmb/renderer/SSAORenderer.hpp new file mode 100644 index 0000000..3075252 --- /dev/null +++ b/apps/openmb/renderer/SSAORenderer.hpp @@ -0,0 +1,64 @@ +#pragma once + +#include "Shader.hpp" +#include +#include + +#define GLFW_INCLUDE_NONE +#include +#ifdef __APPLE__ +#include +#endif + +namespace renderer { +class SSAORenderer { + public: + SSAORenderer(); + ~SSAORenderer(); + + bool init( int width, int height, bool halfRes = true ); + void resize( int width, int height ); + + void bindGBuffer(); + void unbind(); + + void computeSSAO( const glm::mat4& proj, const glm::mat4& invProj, float radius, float bias, float power ); + void blurSSAO(); + + unsigned int getSSAOTextureID() const; + void bindSSAOTextureToUnit( int unit, renderer::Shader& shader, const std::string& uniformName = "ssao" ) const; + + renderer::Shader& getGBufferShader () { return mGBufferShader; } + + private: + void initBuffers(); + void initKernelAndNoise(); + + int mWidth; + int mHeight; + bool mHalfRes; + + GLuint mGBufferFBO; + GLuint mGNormal; + GLuint mGDepth; + + GLuint mSSAOFBO; + GLuint mSSAOTexture; + + GLuint mSSAOBlurFBO; + GLuint mSSAOBlurTexture; + + GLuint mNoiseTexture; + + GLuint mQuadVAO; + GLuint mQuadVBO; + + std::vector mKernel; + int mKernelSize; + + renderer::Shader mGBufferShader; + renderer::Shader mSSAOShader; + renderer::Shader mBlurShader; +}; + +} // namespace renderer -- cgit v1.2.3