SSAO is working, but is kinda crappy. You can change shade variables in the debug window.

This commit is contained in:
Teejoon
2016-02-19 16:50:04 +01:00
parent 0d665c10fe
commit 201480b17f
16 changed files with 444 additions and 38 deletions
@@ -17,7 +17,7 @@ public:
void InitializeFrameBuffers();
void InitializeShaderPrograms();
void Draw(GLuint sceneTexture, GLuint bloomTexture, GLuint sceneTextureLowRes, GLuint bloomTextureLowRes, GLfloat gamma, GLfloat exposure);
void Draw(GLuint sceneTexture, GLuint bloomTexture, GLuint sceneTextureLowRes, GLuint bloomTextureLowRes, GLuint SSAOTexture, GLfloat gamma, GLfloat exposure);
private:
const IRenderer* m_Renderer;
+4
View File
@@ -21,6 +21,9 @@ public:
void Draw(RenderScene& scene);
void ClearBuffer();
//Return the texture that is used in later stages to apply the bloom effect
GLuint DepthBuffer() const { return m_DepthBuffer; }
Camera* DepthBufferCamera() const { return RenderCamera; }
//Return the texture that is used in later stages to apply the bloom effect
GLuint BloomTexture() const { return m_BloomTexture; }
GLuint BloomTextureLowRes() const { return m_BloomTextureLowRes; }
@@ -62,6 +65,7 @@ private:
GLuint m_SceneTextureLowRes;
GLuint m_DepthBuffer;
GLuint m_DepthBufferLowRes;
Camera* RenderCamera;
//maqke this component based i guess?
GLuint m_ShieldPixelRate = 16;
+5
View File
@@ -16,6 +16,7 @@
#include "DrawScreenQuadPass.h"
#include "DrawBloomPass.h"
#include "DrawColorCorrectionPass.h"
#include "SSAOPass.h"
#include "../Core/EventBroker.h"
#include "ImGuiRenderPass.h"
#include "Camera.h"
@@ -50,6 +51,9 @@ private:
Model* m_UnitSphere;
int m_DebugTextureToDraw = 0;
float m_SSAO_Radius = 0.2f;
float m_SSAO_Bias = 0.012f;
float m_SSAO_Intensity = 1.0f;
PickingPass* m_PickingPass;
LightCullingPass* m_LightCullingPass;
@@ -58,6 +62,7 @@ private:
DrawScreenQuadPass* m_DrawScreenQuadPass;
DrawBloomPass* m_DrawBloomPass;
DrawColorCorrectionPass* m_DrawColorCorrectionPass;
SSAOPass* m_SSAOPass;
//----------------------Functions----------------------//
void InitializeWindow();
+58
View File
@@ -0,0 +1,58 @@
#ifndef SSAOPass_h__
#define SSAOPass_h__
#include "IRenderer.h"
#include "SSAOPassState.h"
//#include "LightCullingPass.h" Finalpass om den skall skickas in
#include "FrameBuffer.h"
#include "ShaderProgram.h"
#include "DrawBloomPass.h"
//#include "Util/UnorderedMapVec2.h"
#include "Texture.h"
class SSAOPass
{
public:
SSAOPass(IRenderer* rendere);
~SSAOPass() { };
void Draw(GLuint depthBuffer, Camera* camera);
void Setting(float radius, float bias, float intensity);
void ClearBuffer();
//Return the SSAO of the texture sent to Draw
GLuint SSAOTexture() const { return m_DrawBloomPass->GaussianTexture(); }
private:
void InitializeTexture();
void InitializeFrameBuffer();
void InitializeShaderProgram();
void InitializeBuffer();
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
void ComputeAO(GLuint depthBuffer, Camera* camera);
//void blurHorizontal(GLuint depthBuffer);
//void blurVertical(GLuint depthBuffer);
Model* m_ScreenQuad;
const IRenderer* m_Renderer;
float m_Radius;
float m_Bias;
float m_Intensity;
GLuint m_SSAOTexture;
FrameBuffer m_SSAOFramBuffer;
GLuint m_SSAOViewSpaceZTexture;
FrameBuffer m_SSAOViewSpaceZFramBuffer;
ShaderProgram* m_SSAOProgram;
ShaderProgram* m_SSAOViewSpaceZProgram;
DrawBloomPass* m_DrawBloomPass;
};
#endif
+15
View File
@@ -0,0 +1,15 @@
#ifndef SSAOPassState_h__
#define SSAOPassState_h__
#include "Rendering/RenderState.h"
class SSAOPassState : public RenderState
{
public:
SSAOPassState();
~SSAOPassState();
private:
};
#endif