Made texture getters from draw finalpass from const

This commit is contained in:
Teejoon
2016-03-12 18:04:10 +01:00
parent 1ad087dc75
commit 90d848e8d9
3 changed files with 8 additions and 15 deletions
+6 -12
View File
@@ -27,7 +27,7 @@ public:
void OnWindowResize(); void OnWindowResize();
//Return the texture that is used in later stages to apply the bloom effect //Return the texture that is used in later stages to apply the bloom effect
GLuint BloomTexture() const { GLuint BloomTexture() {
if (m_MSAA){ if (m_MSAA){
m_AntiAliasedFrameBuffer->Bind(); m_AntiAliasedFrameBuffer->Bind();
glClearColor(0.f, 0.f, 0.f, 0.f); glClearColor(0.f, 0.f, 0.f, 0.f);
@@ -40,35 +40,29 @@ public:
0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height, 0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height,
0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height, 0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height,
GL_COLOR_BUFFER_BIT, GL_NEAREST); GL_COLOR_BUFFER_BIT, GL_NEAREST);
glReadBuffer(GL_BACK);
return m_AntiAliasedTexture; return m_AntiAliasedTexture;
} }
return m_BloomTexture; } return m_BloomTexture; }
//Return the texture with diffuse and lighting of the scene. //Return the texture with diffuse and lighting of the scene.
GLuint SceneTexture() const { GLuint DrawFinalPass::SceneTexture() {
if (m_MSAA) { if (m_MSAA) {
m_AntiAliasedFrameBuffer->Bind(); m_AntiAliasedFrameBuffer->Bind();
glClearColor(0.f, 0.f, 0.f, 0.f); glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
m_AntiAliasedFrameBuffer->Unbind(); m_AntiAliasedFrameBuffer->Unbind();
GLERROR("SceneTexture() 11");
m_FinalPassFrameBuffer->Read(); m_FinalPassFrameBuffer->Read();
GLERROR("SceneTexture() 12");
glReadBuffer(GL_COLOR_ATTACHMENT0); glReadBuffer(GL_COLOR_ATTACHMENT0);
GLERROR("SceneTexture() 13");
m_AntiAliasedFrameBuffer->Draw(); m_AntiAliasedFrameBuffer->Draw();
GLERROR("SceneTexture() 14");
glBlitFramebuffer( glBlitFramebuffer(
0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height, 0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height,
0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height, 0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height,
GL_COLOR_BUFFER_BIT, GL_NEAREST); GL_COLOR_BUFFER_BIT, GL_NEAREST);
GLERROR("SceneTexture() 15");
glReadBuffer(GL_BACK);
return m_AntiAliasedTexture; return m_AntiAliasedTexture;
} }
return m_SceneTexture; } return m_SceneTexture;
}
//Return the SceneTexture with the blurred HUD bits. //Return the SceneTexture with the blurred HUD bits.
GLuint CombinedSceneTexture() const { GLuint CombinedSceneTexture() {
if (m_MSAA) { if (m_MSAA) {
m_AntiAliasedFrameBuffer->Bind(); m_AntiAliasedFrameBuffer->Bind();
glClearColor(0.f, 0.f, 0.f, 0.f); glClearColor(0.f, 0.f, 0.f, 0.f);
@@ -84,7 +78,7 @@ public:
} }
return m_CombinedTexture; } return m_CombinedTexture; }
//Return the blurred scene texture. //Return the blurred scene texture.
GLuint FullBlurredTexture() const { GLuint FullBlurredTexture() {
if (m_MSAA) { if (m_MSAA) {
m_AntiAliasedFrameBuffer->Bind(); m_AntiAliasedFrameBuffer->Bind();
glClearColor(0.f, 0.f, 0.f, 0.f); glClearColor(0.f, 0.f, 0.f, 0.f);
-2
View File
@@ -352,7 +352,6 @@ void DrawFinalPass::Draw(RenderScene& scene, BlurHUD* blurHUDPass)
if (scene.ShouldBlur) { if (scene.ShouldBlur) {
//This needs to be drawn only when the full scene is being renderd, and then let be, otherwise sprite and other shit will show on it. //This needs to be drawn only when the full scene is being renderd, and then let be, otherwise sprite and other shit will show on it.
GLuint sceneTexture = SceneTexture(); GLuint sceneTexture = SceneTexture();
GLERROR("SceneTexture() 1");
m_FullBlurredTexture = blurHUDPass->Draw(sceneTexture, scene); m_FullBlurredTexture = blurHUDPass->Draw(sceneTexture, scene);
} }
@@ -362,7 +361,6 @@ void DrawFinalPass::Draw(RenderScene& scene, BlurHUD* blurHUDPass)
stateSprite->Disable(GL_DEPTH_TEST); stateSprite->Disable(GL_DEPTH_TEST);
stateSprite->Disable(GL_STENCIL_TEST); stateSprite->Disable(GL_STENCIL_TEST);
GLuint sceneTexture = SceneTexture(); GLuint sceneTexture = SceneTexture();
GLERROR("SceneTexture() 2");
delete stateSprite; delete stateSprite;
stateSprite = new DrawFinalPassState(m_FinalPassFrameBuffer->GetHandle()); stateSprite = new DrawFinalPassState(m_FinalPassFrameBuffer->GetHandle());
m_CombinedTexture = blurHUDPass->CombineTextures(sceneTexture, m_FullBlurredTexture); m_CombinedTexture = blurHUDPass->CombineTextures(sceneTexture, m_FullBlurredTexture);
+2 -1
View File
@@ -227,7 +227,8 @@ void Renderer::Draw(RenderFrame& frame)
if (m_DebugTextureToDraw == 0) { if (m_DebugTextureToDraw == 0) {
PerformanceTimer::StartTimer("Renderer-Color Correction Pass"); PerformanceTimer::StartTimer("Renderer-Color Correction Pass");
m_DrawColorCorrectionPass->Draw(m_DrawFinalPass->SceneTexture(), m_DrawBloomPass->GaussianTexture(), frame.Gamma, frame.Exposure); GLuint test = m_DrawFinalPass->SceneTexture();
m_DrawColorCorrectionPass->Draw(test, m_DrawBloomPass->GaussianTexture(), frame.Gamma, frame.Exposure);
PerformanceTimer::StopTimer("Renderer-Color Correction Pass"); PerformanceTimer::StopTimer("Renderer-Color Correction Pass");
} }