This commit is contained in:
Tleety
2016-03-07 23:25:06 +01:00
parent 7de95d4cb5
commit 5c0d9070c7
11 changed files with 421 additions and 5 deletions
+69
View File
@@ -0,0 +1,69 @@
#ifndef BlurHUD_h__
#define BlurHUD_h__
#include "IRenderer.h"
#include "DrawBloomPassState.h"
//#include "LightCullingPass.h" Finalpass om den skall skickas in
#include "FrameBuffer.h"
#include "ShaderProgram.h"
//#include "Util/UnorderedMapVec2.h"
#include "Texture.h"
class BlurHUD
{
public:
BlurHUD(IRenderer* renderer);
~BlurHUD() { }
void InitializeTextures();
void InitializeFrameBuffers();
void InitializeShaderPrograms();
void InitializeBuffers();
void ClearBuffer();
void FillGaussianBuffer(FrameBuffer* fb);
GLuint Draw(GLuint texture, RenderScene& scene);
void OnWindowResize();
void FillStencil(RenderScene& scene);
GLuint CombineTextures(GLuint texture1, GLuint texture2);
//Getters
//Return the blurred result of the texture that was sent into draw
GLuint GaussianTexture() const {
if (m_Quality == 0) {
return m_BlackTexture->m_Texture;
} else {
return m_GaussianTexture_vert;
}
}
private:
Texture* m_BlackTexture;
Model* m_ScreenQuad;
const IRenderer* m_Renderer;
ConfigFile* m_Config;
//const LightCullingPass* m_LightCullingPass
int m_Iterations = 3;
int m_Quality = 0;
GLuint m_GaussianTexture_horiz = 0;
GLuint m_GaussianTexture_vert = 0;
GLuint m_DepthStencil_horiz = 0;
GLuint m_DepthStencil_vert = 0;
GLuint m_CombinedTexture = 0;
FrameBuffer m_GaussianFrameBuffer_horiz;
FrameBuffer m_GaussianFrameBuffer_vert;
FrameBuffer m_CombinedTextureBuffer;
ShaderProgram* m_GaussianProgram_horiz;
ShaderProgram* m_GaussianProgram_vert;
ShaderProgram* m_FillDepthStencilProgram;
ShaderProgram* m_CombineTexturesProgram;
};
#endif
+8 -1
View File
@@ -11,6 +11,7 @@
#include "Util/UnorderedMapVec2.h"
#include "Util/CommonFunctions.h"
#include "Texture.h"
#include "BlurHUD.h"
class DrawFinalPass
{
@@ -20,7 +21,7 @@ public:
void InitializeTextures();
void InitializeFrameBuffers();
void InitializeShaderPrograms();
void Draw(RenderScene& scene);
void Draw(RenderScene& scene, BlurHUD* blurHUDPass);
void ClearBuffer();
void OnWindowResize();
@@ -28,6 +29,10 @@ public:
GLuint BloomTexture() const { return m_BloomTexture; }
//Return the texture with diffuse and lighting of the scene.
GLuint SceneTexture() const { return m_SceneTexture; }
//Return the SceneTexture with the blurred HUD bits.
GLuint CombinedSceneTexture() const { return m_CombinedTexture; }
//Return the blurred scene texture.
GLuint FullBlurredTexture() const { return m_FullBlurredTexture; }
//Return the framebuffer used in the scene rendering stage.
FrameBuffer* FinalPassFrameBuffer() { return &m_FinalPassFrameBuffer; }
@@ -57,6 +62,8 @@ private:
GLuint m_DepthBuffer;
GLuint m_ShieldBuffer;
GLuint m_CubeMapTexture;
GLuint m_FullBlurredTexture;
GLuint m_CombinedTexture; //This can be removed for less memory usage, just set m_sceneTexture to the return from m_BlurHUDPass.CombineTextures
//maqke this component based i guess?
GLuint m_ShieldPixelRate = 16;
+2
View File
@@ -18,6 +18,7 @@
#include "DrawColorCorrectionPass.h"
#include "SSAOPass.h"
#include "CubeMapPass.h"
#include "BlurHUD.h"
#include "../Core/EventBroker.h"
#include "ImGuiRenderPass.h"
#include "Camera.h"
@@ -75,6 +76,7 @@ private:
DrawColorCorrectionPass* m_DrawColorCorrectionPass;
SSAOPass* m_SSAOPass;
CubeMapPass* m_CubeMapPass;
BlurHUD* m_BlurHUDPass;
//----------------------Functions----------------------//
void InitializeWindow();
+3
View File
@@ -32,6 +32,8 @@ struct SpriteJob : RenderJob
EndIndex = matProp.material->EndIndex;
Matrix = matrix;
Color = cSprite["Color"];
BlurBackground = (bool)cSprite["BlurBackground"];
Entity = cSprite.EntityID;
Position = Transform::AbsolutePosition(world, cSprite.EntityID);
Depth = 0;
@@ -65,6 +67,7 @@ struct SpriteJob : RenderJob
bool Pickable;
bool IsIndicator = false;
bool BlurBackground = false;
glm::vec4 FillColor = glm::vec4(0);
float FillPercentage = 0.0;
+1
View File
@@ -5,4 +5,5 @@
<Color R="1" G="1" B="1" A="1"/>
<Visible>true</Visible>
<DepthSort>true</DepthSort>
<BlurBackground>false</BlurBackground>
</Sprite>
+3
View File
@@ -24,6 +24,9 @@
<xs:element name="DepthSort" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Whether the sprite should be sorted with depth or not. Only use false for textures that are on HUD</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="BlurBackground" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Wether the background should be blurred begind this sprite.</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
@@ -0,0 +1,25 @@
#version 430
uniform sampler2D Texture0;
uniform sampler2D Texture1;
in VertexData{
vec2 TextureCoordinate;
}Input;
out vec4 fragmentColor;
void main()
{
vec4 texel0 = texture(Texture0, Input.TextureCoordinate);
vec4 texel1 = texture(Texture1, Input.TextureCoordinate);
float texel1_total = (texel1.r + texel1.g + texel1.b) * texel1.a;
texel1_total = ceil(clamp(texel1_total, 0, 1));
vec4 final = texel0 * texel1_total + texel1 * (1 - texel1_total);
//vec4 final = vec4(texel1_total, texel1_total, texel1_total, 1.0);
fragmentColor = final;
}
@@ -0,0 +1,13 @@
#version 430
layout (location = 0) in vec3 Position;
out VertexData{
vec2 TextureCoordinate;
}Output;
void main()
{
gl_Position = vec4(Position, 1.0);
Output.TextureCoordinate = (vec2(Position) + 1) / 2;
}
+280
View File
@@ -0,0 +1,280 @@
#include "Rendering/BlurHUD.h"
BlurHUD::BlurHUD(IRenderer* renderer)
: m_Renderer(renderer)
{
InitializeShaderPrograms();
InitializeBuffers();
InitializeTextures();
}
void BlurHUD::InitializeTextures()
{
m_BlackTexture = CommonFunctions::LoadTexture("Textures/Core/Black.png", false);
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.mesh");
}
void BlurHUD::InitializeShaderPrograms()
{
m_GaussianProgram_horiz = ResourceManager::Load<ShaderProgram>("##GaussianProgramHoriz");
if (m_GaussianProgram_horiz->GetHandle() == 0) {
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_horiz.vert.glsl")));
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_horiz.frag.glsl")));
m_GaussianProgram_horiz->Compile();
m_GaussianProgram_horiz->BindFragDataLocation(0, "fragmentColor");
m_GaussianProgram_horiz->Link();
}
m_GaussianProgram_vert = ResourceManager::Load<ShaderProgram>("##GaussianProgramVert");
if (m_GaussianProgram_vert->GetHandle() == 0) {
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_vert.vert.glsl")));
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_vert.frag.glsl")));
m_GaussianProgram_vert->Compile();
m_GaussianProgram_vert->BindFragDataLocation(0, "fragmentColor");
m_GaussianProgram_vert->Link();
}
m_FillDepthStencilProgram = ResourceManager::Load<ShaderProgram>("#FillDepthStencilProgram");
if (m_FillDepthStencilProgram->GetHandle() == 0) {
m_FillDepthStencilProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/FillDepthBuffer.vert.glsl")));
m_FillDepthStencilProgram->Compile();
m_FillDepthStencilProgram->Link();
}
m_CombineTexturesProgram = ResourceManager::Load<ShaderProgram>("#CombineTexturesProgram");
if (m_CombineTexturesProgram->GetHandle() == 0) {
m_CombineTexturesProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/CombineTexture.vert.glsl")));
m_CombineTexturesProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/CombineTexture.frag.glsl")));
m_CombineTexturesProgram->Compile();
m_CombineTexturesProgram->BindFragDataLocation(0, "fragmentColor");
m_CombineTexturesProgram->Link();
}
GLERROR("Creating DepthFill program");
}
void BlurHUD::InitializeBuffers()
{
glm::vec2 res = glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
CommonFunctions::GenerateTexture(&m_DepthStencil_horiz, GL_CLAMP_TO_BORDER, GL_NEAREST,
res, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
CommonFunctions::GenerateTexture(&m_GaussianTexture_horiz, GL_CLAMP_TO_EDGE, GL_LINEAR,
res, GL_RGB16F, GL_RGB, GL_FLOAT);
if (m_GaussianFrameBuffer_horiz.GetHandle() == 0) {
m_GaussianFrameBuffer_horiz.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_DepthStencil_horiz, GL_DEPTH_STENCIL_ATTACHMENT)));
m_GaussianFrameBuffer_horiz.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_GaussianTexture_horiz, GL_COLOR_ATTACHMENT0)));
}
m_GaussianFrameBuffer_horiz.Generate();
CommonFunctions::GenerateTexture(&m_DepthStencil_vert, GL_CLAMP_TO_BORDER, GL_NEAREST,
res, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
CommonFunctions::GenerateTexture(&m_GaussianTexture_vert, GL_CLAMP_TO_EDGE, GL_LINEAR,
res, GL_RGB16F, GL_RGB, GL_FLOAT);
if (m_GaussianFrameBuffer_vert.GetHandle() == 0) {
m_GaussianFrameBuffer_vert.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_DepthStencil_vert, GL_DEPTH_STENCIL_ATTACHMENT)));
m_GaussianFrameBuffer_vert.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_GaussianTexture_vert, GL_COLOR_ATTACHMENT0)));
}
m_GaussianFrameBuffer_vert.Generate();
CommonFunctions::GenerateTexture(&m_CombinedTexture, GL_CLAMP_TO_BORDER, GL_NEAREST,
res, GL_RGB16F, GL_RGB, GL_FLOAT);
if (m_CombinedTextureBuffer.GetHandle() == 0) {
m_CombinedTextureBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_CombinedTexture, GL_COLOR_ATTACHMENT0)));
}
m_CombinedTextureBuffer.Generate();
}
void BlurHUD::ClearBuffer()
{
GLERROR("PRE");
m_GaussianFrameBuffer_horiz.Bind();
glClearColor(0.f, 0.f, 0.f, 0.f);
glClearStencil(0x00);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
m_GaussianFrameBuffer_horiz.Unbind();
m_GaussianFrameBuffer_vert.Bind();
glClearColor(0.f, 0.f, 0.f, 0.f);
glClearStencil(0x00);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
m_GaussianFrameBuffer_vert.Unbind();
m_CombinedTextureBuffer.Bind();
glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT);
m_CombinedTextureBuffer.Unbind();
GLERROR("END");
}
//Returns the finished blurred texture
GLuint BlurHUD::Draw(GLuint texture, RenderScene& scene)
{
GLERROR("DrawBloomPass::Draw: Pre");
FillStencil(scene);
DrawBloomPassState state;
GLuint shaderHandle_horiz = m_GaussianProgram_horiz->GetHandle();
GLuint shaderHandle_vert = m_GaussianProgram_vert->GetHandle();
//Horizontal pass, first use the given texture then save it to the horizontal framebuffer.
m_GaussianFrameBuffer_horiz.Bind();
state.Enable(GL_STENCIL_TEST);
state.StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
state.StencilFunc(GL_EQUAL, 1, 0xFF);
state.StencilMask(0x00);
state.DepthMask(GL_FALSE);
m_GaussianProgram_horiz->Bind();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture);
glBindVertexArray(m_ScreenQuad->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
//Iterate some times to make it more gaussian.
for (int i = 1; i < m_Iterations; i++) {
//Vertical pass
m_GaussianFrameBuffer_vert.Bind();
state.Enable(GL_STENCIL_TEST);
state.StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
state.StencilFunc(GL_EQUAL, 1, 0xFF);
state.StencilMask(0x00);
state.DepthMask(GL_FALSE);
m_GaussianProgram_vert->Bind();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_horiz);
glBindVertexArray(m_ScreenQuad->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
//horizontal pass
m_GaussianFrameBuffer_vert.Unbind();
m_GaussianFrameBuffer_horiz.Bind();
state.Enable(GL_STENCIL_TEST);
state.StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
state.StencilFunc(GL_EQUAL, 1, 0xFF);
state.StencilMask(0x00);
state.DepthMask(GL_FALSE);
m_GaussianProgram_horiz->Bind();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_vert);
glBindVertexArray(m_ScreenQuad->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
m_GaussianFrameBuffer_horiz.Unbind();
}
//final vertical gaussian after the iterations are done
m_GaussianFrameBuffer_vert.Bind();
state.Enable(GL_STENCIL_TEST);
state.StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
state.StencilFunc(GL_EQUAL, 1, 0xFF);
state.StencilMask(0x00);
state.DepthMask(GL_FALSE);
m_GaussianProgram_vert->Bind();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_horiz);
glBindVertexArray(m_ScreenQuad->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
GLERROR("DrawBloomPass::Draw: END");
return m_GaussianTexture_vert;
}
void BlurHUD::OnWindowResize()
{
CommonFunctions::GenerateTexture(&m_GaussianTexture_vert, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
m_GaussianFrameBuffer_vert.Generate();
CommonFunctions::GenerateTexture(&m_GaussianTexture_horiz, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
m_GaussianFrameBuffer_horiz.Generate();
}
void BlurHUD::FillStencil(RenderScene& scene)
{
RenderState state;
state.BindFramebuffer(m_GaussianFrameBuffer_horiz.GetHandle());
state.Disable(GL_DEPTH_TEST);
state.Enable(GL_CULL_FACE);
state.Enable(GL_STENCIL_TEST);
state.StencilFunc(GL_ALWAYS, 1, 0xFF);
state.StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
state.StencilMask(0xFF);
m_FillDepthStencilProgram->Bind();
GLuint shaderHandle = m_FillDepthStencilProgram->GetHandle();
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
for (auto& job : scene.Jobs.SpriteJob) {
auto spriteJob = std::dynamic_pointer_cast<SpriteJob>(job);
if (!spriteJob) {
continue;
}
if (!spriteJob->BlurBackground) {
continue;
}
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(spriteJob->Matrix));
glBindVertexArray(spriteJob->Model->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, spriteJob->Model->ElementBuffer);
glDrawElements(GL_TRIANGLES, spriteJob->EndIndex - spriteJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(spriteJob->StartIndex*sizeof(unsigned int)));
}
state.BindFramebuffer(m_GaussianFrameBuffer_vert.GetHandle());
for (auto& job : scene.Jobs.SpriteJob) {
auto spriteJob = std::dynamic_pointer_cast<SpriteJob>(job);
if (!spriteJob) {
continue;
}
if(!spriteJob->BlurBackground) {
continue;
}
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(spriteJob->Matrix));
glBindVertexArray(spriteJob->Model->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, spriteJob->Model->ElementBuffer);
glDrawElements(GL_TRIANGLES, spriteJob->EndIndex - spriteJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(spriteJob->StartIndex*sizeof(unsigned int)));
}
}
//Texture 1 will be used if texture 2 is black at that texel, else texture 2 is used.
GLuint BlurHUD::CombineTextures(GLuint texture1, GLuint texture2)
{
RenderState state;
state.BindFramebuffer(m_CombinedTextureBuffer.GetHandle());
state.Disable(GL_DEPTH_TEST);
state.Disable(GL_STENCIL_TEST);
m_CombineTexturesProgram->Bind();
glActiveTexture(GL_TEXTURE0);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, texture1);
glBindTexture(GL_TEXTURE_2D, texture2);
glBindVertexArray(m_ScreenQuad->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
return m_CombinedTexture;
}
+6 -1
View File
@@ -233,7 +233,7 @@ void DrawFinalPass::InitializeShaderPrograms()
}
void DrawFinalPass::Draw(RenderScene& scene)
void DrawFinalPass::Draw(RenderScene& scene, BlurHUD* blurHUDPass)
{
GLERROR("Pre");
DrawFinalPassState* stateDethp = new DrawFinalPassState(m_ShieldDepthFrameBuffer.GetHandle());
@@ -280,6 +280,11 @@ void DrawFinalPass::Draw(RenderScene& scene)
DrawModelRenderQueuesWithShieldCheck(scene.Jobs.TransparentObjects, scene); //might need changing
GLERROR("Shielded Transparent objects");
//Generate blur texture.
m_FullBlurredTexture = blurHUDPass->Draw(m_SceneTexture, scene);
//Combine nonblur and blur texture
m_CombinedTexture = blurHUDPass->CombineTextures(m_SceneTexture, m_FullBlurredTexture);
//Draw Transparen objects
//state->BlendFunc(GL_ONE, GL_ONE);
//state->StencilFunc(GL_EQUAL, 1, 0xFF);
+11 -3
View File
@@ -110,7 +110,7 @@ void Renderer::Draw(RenderFrame& frame)
{
GLERROR("PRE");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
ImGui::Combo("Draw textures", &m_DebugTextureToDraw, "Final\0Scene\0Bloom\0Gaussian\0Picking\0Ambient Occlusion");
ImGui::Combo("Draw textures", &m_DebugTextureToDraw, "Final\0Scene\0Bloom\0Gaussian\0Picking\0Ambient Occlusion\0Combined Scene Texture\0Full Blurred Texture");
ImGui::Combo("CubeMap", &m_CubeMapTexture, "Nevada(512)\0Sky(1024)");
if(m_CubeMapTexture == 0) {
m_CubeMapPass->LoadTextures("Nevada");
@@ -133,6 +133,7 @@ void Renderer::Draw(RenderFrame& frame)
m_DrawFinalPass->ClearBuffer();
m_DrawBloomPass->ClearBuffer();
m_SSAOPass->ClearBuffer();
m_BlurHUDPass->ClearBuffer();
PerformanceTimer::StopTimer("Renderer-ClearBuffers");
GLERROR("ClearBuffers");
for (auto scene : frame.RenderScenes) {
@@ -158,7 +159,7 @@ void Renderer::Draw(RenderFrame& frame)
m_LightCullingPass->CullLights(*scene);
GLERROR("LightCulling");
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Draw Geometry+Light");
m_DrawFinalPass->Draw(*scene);
m_DrawFinalPass->Draw(*scene, m_BlurHUDPass);
GLERROR("Draw Geometry+Light");
//m_DrawScenePass->Draw(*scene);
@@ -194,6 +195,12 @@ void Renderer::Draw(RenderFrame& frame)
if (m_DebugTextureToDraw == 5) {
m_DrawScreenQuadPass->Draw(m_SSAOPass->SSAOTexture());
}
if (m_DebugTextureToDraw == 6) {
m_DrawScreenQuadPass->Draw(m_DrawFinalPass->CombinedSceneTexture());
}
if (m_DebugTextureToDraw == 7) {
m_DrawScreenQuadPass->Draw(m_DrawFinalPass->FullBlurredTexture());
}
PerformanceTimer::StopTimer("Renderer-Misc Debug Draws");
PerformanceTimer::StartTimer("Renderer-ImGuiRenderPass");
@@ -244,9 +251,10 @@ void Renderer::InitializeRenderPasses()
m_LightCullingPass = new LightCullingPass(this);
m_CubeMapPass = new CubeMapPass(this);
m_SSAOPass = new SSAOPass(this, m_Config);
m_BlurHUDPass = new BlurHUD(this);
m_DrawFinalPass = new DrawFinalPass(this, m_LightCullingPass, m_CubeMapPass, m_SSAOPass);
m_DrawScreenQuadPass = new DrawScreenQuadPass(this);
m_DrawBloomPass = new DrawBloomPass(this, m_Config);
m_DrawColorCorrectionPass = new DrawColorCorrectionPass(this);
}