Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f89cef7a78 |
@@ -13,6 +13,7 @@
|
|||||||
#include "Texture.h"
|
#include "Texture.h"
|
||||||
#include "ShadowPass.h"
|
#include "ShadowPass.h"
|
||||||
#include "BlurHUD.h"
|
#include "BlurHUD.h"
|
||||||
|
#include "TextPass.h"
|
||||||
|
|
||||||
class DrawFinalPass
|
class DrawFinalPass
|
||||||
{
|
{
|
||||||
@@ -22,7 +23,7 @@ public:
|
|||||||
void InitializeTextures();
|
void InitializeTextures();
|
||||||
void InitializeFrameBuffers();
|
void InitializeFrameBuffers();
|
||||||
void InitializeShaderPrograms();
|
void InitializeShaderPrograms();
|
||||||
void Draw(RenderScene& scene, BlurHUD* blurHUDPass);
|
void Draw(RenderScene& scene, BlurHUD* blurHUDPass, TextPass* textPass);
|
||||||
void ClearBuffer();
|
void ClearBuffer();
|
||||||
void OnWindowResize();
|
void OnWindowResize();
|
||||||
|
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ void DrawFinalPass::InitializeShaderPrograms()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawFinalPass::Draw(RenderScene& scene, BlurHUD* blurHUDPass)
|
void DrawFinalPass::Draw(RenderScene& scene, BlurHUD* blurHUDPass, TextPass* textPass)
|
||||||
{
|
{
|
||||||
GLERROR("Pre");
|
GLERROR("Pre");
|
||||||
DrawFinalPassState* stateDethp = new DrawFinalPassState(m_ShieldDepthFrameBuffer.GetHandle());
|
DrawFinalPassState* stateDethp = new DrawFinalPassState(m_ShieldDepthFrameBuffer.GetHandle());
|
||||||
@@ -282,19 +282,7 @@ void DrawFinalPass::Draw(RenderScene& scene, BlurHUD* blurHUDPass)
|
|||||||
//state->StencilMask(0x00);
|
//state->StencilMask(0x00);
|
||||||
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene);
|
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene);
|
||||||
GLERROR("OpaqueObjects");
|
GLERROR("OpaqueObjects");
|
||||||
|
|
||||||
//state->Disable(GL_STENCIL_TEST);
|
|
||||||
//Draw Transparen Shielded objects
|
|
||||||
state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
DrawModelRenderQueuesWithShieldCheck(scene.Jobs.TransparentObjects, scene); //might need changing
|
|
||||||
GLERROR("Shielded Transparent objects");
|
|
||||||
|
|
||||||
//Generate blur texture.
|
|
||||||
delete state;
|
delete state;
|
||||||
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.
|
|
||||||
m_FullBlurredTexture = blurHUDPass->Draw(m_SceneTexture, scene);
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawFinalPassState* stateSprite = new DrawFinalPassState(m_FinalPassFrameBuffer.GetHandle());
|
DrawFinalPassState* stateSprite = new DrawFinalPassState(m_FinalPassFrameBuffer.GetHandle());
|
||||||
if (scene.ShouldBlur) {
|
if (scene.ShouldBlur) {
|
||||||
@@ -317,6 +305,24 @@ void DrawFinalPass::Draw(RenderScene& scene, BlurHUD* blurHUDPass)
|
|||||||
GLERROR("SpriteJobs");
|
GLERROR("SpriteJobs");
|
||||||
|
|
||||||
delete stateSprite;
|
delete stateSprite;
|
||||||
|
|
||||||
|
state = new DrawFinalPassState(m_FinalPassFrameBuffer.GetHandle());
|
||||||
|
|
||||||
|
//state->Disable(GL_STENCIL_TEST);
|
||||||
|
//Draw Transparen Shielded objects
|
||||||
|
state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
textPass->Draw(scene, m_FinalPassFrameBuffer);
|
||||||
|
DrawModelRenderQueuesWithShieldCheck(scene.Jobs.TransparentObjects, scene); //might need changing
|
||||||
|
GLERROR("Shielded Transparent objects");
|
||||||
|
|
||||||
|
//Generate blur texture.
|
||||||
|
delete state;
|
||||||
|
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.
|
||||||
|
m_FullBlurredTexture = blurHUDPass->Draw(m_SceneTexture, scene);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GLERROR("END");
|
GLERROR("END");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,14 +210,15 @@ void Renderer::Draw(RenderFrame& frame)
|
|||||||
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Light Culling");
|
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Light Culling");
|
||||||
m_LightCullingPass->CullLights(*scene);
|
m_LightCullingPass->CullLights(*scene);
|
||||||
GLERROR("LightCulling");
|
GLERROR("LightCulling");
|
||||||
|
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Draw Text");
|
||||||
|
//m_TextPass->Draw(*scene, *m_DrawFinalPass->FinalPassFrameBuffer());
|
||||||
|
GLERROR("Draw Text");
|
||||||
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Draw Geometry+Light");
|
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Draw Geometry+Light");
|
||||||
m_DrawFinalPass->Draw(*scene, m_BlurHUDPass);
|
m_DrawFinalPass->Draw(*scene, m_BlurHUDPass, m_TextPass);
|
||||||
GLERROR("Draw Geometry+Light");
|
GLERROR("Draw Geometry+Light");
|
||||||
//m_DrawScenePass->Draw(*scene);
|
//m_DrawScenePass->Draw(*scene);
|
||||||
|
|
||||||
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Draw Text");
|
|
||||||
m_TextPass->Draw(*scene, *m_DrawFinalPass->FinalPassFrameBuffer());
|
|
||||||
GLERROR("Draw Text");
|
|
||||||
PerformanceTimer::StopTimer("Renderer-Draw Text");
|
PerformanceTimer::StopTimer("Renderer-Draw Text");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ void TextPass::Update()
|
|||||||
void TextPass::Draw(RenderScene& scene, FrameBuffer& frameBuffer)
|
void TextPass::Draw(RenderScene& scene, FrameBuffer& frameBuffer)
|
||||||
{
|
{
|
||||||
GLERROR("Derp1");
|
GLERROR("Derp1");
|
||||||
TextPassState* state = new TextPassState(frameBuffer.GetHandle());
|
//TextPassState* state = new TextPassState(frameBuffer.GetHandle());
|
||||||
for (auto &job : scene.Jobs.Text) {
|
for (auto &job : scene.Jobs.Text) {
|
||||||
auto textJob = std::dynamic_pointer_cast<TextJob>(job);
|
auto textJob = std::dynamic_pointer_cast<TextJob>(job);
|
||||||
if (textJob) {
|
if (textJob) {
|
||||||
@@ -43,7 +43,7 @@ void TextPass::Draw(RenderScene& scene, FrameBuffer& frameBuffer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
GLERROR("Derp2");
|
GLERROR("Derp2");
|
||||||
delete state;
|
// delete state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextPass::renderText(std::string text, Font* font, TextJob::AlignmentEnum alignment, glm::vec4 color, glm::mat4 modelMatrix, glm::mat4 projectionMatrix, glm::mat4 viewMatrix)
|
void TextPass::renderText(std::string text, Font* font, TextJob::AlignmentEnum alignment, glm::vec4 color, glm::mat4 modelMatrix, glm::mat4 projectionMatrix, glm::mat4 viewMatrix)
|
||||||
|
|||||||
@@ -4,10 +4,13 @@
|
|||||||
TextPassState::TextPassState(GLuint frameBuffer)
|
TextPassState::TextPassState(GLuint frameBuffer)
|
||||||
{
|
{
|
||||||
BindFramebuffer(frameBuffer);
|
BindFramebuffer(frameBuffer);
|
||||||
glEnable(GL_BLEND);
|
Enable(GL_BLEND);
|
||||||
glDisable(GL_CULL_FACE);
|
Disable(GL_CULL_FACE);
|
||||||
glEnable(GL_DEPTH_TEST);
|
Enable(GL_DEPTH_TEST);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
Enable(GL_ALPHA_TEST);
|
||||||
|
AlphaFunc(GL_GEQUAL, 0.05f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextPassState::~TextPassState()
|
TextPassState::~TextPassState()
|
||||||
|
|||||||
Reference in New Issue
Block a user