Added "fake bloom" rendering mode for MP3 maps
This commit is contained in:
parent
7946f09eae
commit
c16c0899bf
|
@ -148,8 +148,13 @@ void CRenderer::RenderBloom()
|
||||||
CColor((u8) 53, 53, 53, 255),
|
CColor((u8) 53, 53, 53, 255),
|
||||||
CColor((u8) 17, 17, 17, 255) };
|
CColor((u8) 17, 17, 17, 255) };
|
||||||
|
|
||||||
|
float BloomWidth = (mBloomMode == eBloom ? mBloomWidth : mViewportWidth);
|
||||||
|
float BloomHeight = (mBloomMode == eBloom ? mBloomHeight : mViewportHeight);
|
||||||
|
float BloomHScale = (mBloomMode == eBloom ? mBloomHScale : 0);
|
||||||
|
float BloomVScale = (mBloomMode == eBloom ? mBloomVScale : 0);
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glViewport(0, 0, mBloomWidth, mBloomHeight);
|
glViewport(0, 0, BloomWidth, BloomHeight);
|
||||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
|
||||||
|
@ -159,7 +164,7 @@ void CRenderer::RenderBloom()
|
||||||
CGraphics::UpdateMVPBlock();
|
CGraphics::UpdateMVPBlock();
|
||||||
|
|
||||||
// Pass 1: Alpha-blend the scene texture on a black background
|
// Pass 1: Alpha-blend the scene texture on a black background
|
||||||
mBloomFramebuffers[0].Resize(mBloomWidth, mBloomHeight);
|
mBloomFramebuffers[0].Resize(BloomWidth, BloomHeight);
|
||||||
mBloomFramebuffers[0].Bind();
|
mBloomFramebuffers[0].Bind();
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
@ -169,7 +174,7 @@ void CRenderer::RenderBloom()
|
||||||
CDrawUtil::DrawSquare();
|
CDrawUtil::DrawSquare();
|
||||||
|
|
||||||
// Pass 2: Horizontal blur
|
// Pass 2: Horizontal blur
|
||||||
mBloomFramebuffers[1].Resize(mBloomWidth, mBloomHeight);
|
mBloomFramebuffers[1].Resize(BloomWidth, BloomHeight);
|
||||||
mBloomFramebuffers[1].Bind();
|
mBloomFramebuffers[1].Bind();
|
||||||
|
|
||||||
CDrawUtil::UseTextureShader(CColor::skGray);
|
CDrawUtil::UseTextureShader(CColor::skGray);
|
||||||
|
@ -180,7 +185,7 @@ void CRenderer::RenderBloom()
|
||||||
for (u32 iPass = 0; iPass < 6; iPass++)
|
for (u32 iPass = 0; iPass < 6; iPass++)
|
||||||
{
|
{
|
||||||
CDrawUtil::UseTextureShader(skTintColors[iPass]);
|
CDrawUtil::UseTextureShader(skTintColors[iPass]);
|
||||||
CVector3f Translate(skHOffset[iPass] * mBloomHScale, 0.f, 0.f);
|
CVector3f Translate(skHOffset[iPass] * BloomHScale, 0.f, 0.f);
|
||||||
CGraphics::sMVPBlock.ModelMatrix = CTransform4f::TranslationMatrix(Translate).ToMatrix4f();
|
CGraphics::sMVPBlock.ModelMatrix = CTransform4f::TranslationMatrix(Translate).ToMatrix4f();
|
||||||
CGraphics::UpdateMVPBlock();
|
CGraphics::UpdateMVPBlock();
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
|
@ -188,7 +193,7 @@ void CRenderer::RenderBloom()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass 3: Vertical blur
|
// Pass 3: Vertical blur
|
||||||
mBloomFramebuffers[2].Resize(mBloomWidth, mBloomHeight);
|
mBloomFramebuffers[2].Resize(BloomWidth, BloomHeight);
|
||||||
mBloomFramebuffers[2].Bind();
|
mBloomFramebuffers[2].Bind();
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
@ -200,7 +205,7 @@ void CRenderer::RenderBloom()
|
||||||
for (u32 iPass = 0; iPass < 6; iPass++)
|
for (u32 iPass = 0; iPass < 6; iPass++)
|
||||||
{
|
{
|
||||||
CDrawUtil::UseTextureShader(skTintColors[iPass]);
|
CDrawUtil::UseTextureShader(skTintColors[iPass]);
|
||||||
CVector3f Translate(0.f, skVOffset[iPass] * mBloomVScale, 0.f);
|
CVector3f Translate(0.f, skVOffset[iPass] * BloomVScale, 0.f);
|
||||||
CGraphics::sMVPBlock.ModelMatrix = CTransform4f::TranslationMatrix(Translate).ToMatrix4f();
|
CGraphics::sMVPBlock.ModelMatrix = CTransform4f::TranslationMatrix(Translate).ToMatrix4f();
|
||||||
CGraphics::UpdateMVPBlock();
|
CGraphics::UpdateMVPBlock();
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
|
@ -272,7 +277,7 @@ void CRenderer::BeginFrame()
|
||||||
void CRenderer::EndFrame()
|
void CRenderer::EndFrame()
|
||||||
{
|
{
|
||||||
// Post-processing
|
// Post-processing
|
||||||
if (mBloomMode == eBloom)
|
if ((mBloomMode == eBloom) || (mBloomMode == eFakeBloom))
|
||||||
RenderBloom();
|
RenderBloom();
|
||||||
|
|
||||||
// Render result to screen
|
// Render result to screen
|
||||||
|
@ -293,7 +298,7 @@ void CRenderer::EndFrame()
|
||||||
mSceneFramebuffer.Texture()->Bind(0);
|
mSceneFramebuffer.Texture()->Bind(0);
|
||||||
CDrawUtil::DrawSquare();
|
CDrawUtil::DrawSquare();
|
||||||
|
|
||||||
if (mBloomMode == eBloom)
|
if ((mBloomMode == eBloom) || (mBloomMode == eFakeBloom))
|
||||||
{
|
{
|
||||||
CDrawUtil::UseTextureShader();
|
CDrawUtil::UseTextureShader();
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
|
|
|
@ -23,7 +23,7 @@ class CRenderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum EBloomMode {
|
enum EBloomMode {
|
||||||
eNoBloom, eBloom, eBloomMaps
|
eNoBloom, eBloom, eBloomMaps, eFakeBloom
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -104,11 +104,11 @@ void CWorldEditor::SetArea(CWorld *pWorld, CGameArea *pArea)
|
||||||
CVector3f AreaPosition(AreaTransform[0][3], AreaTransform[1][3], AreaTransform[2][3]);
|
CVector3f AreaPosition(AreaTransform[0][3], AreaTransform[1][3], AreaTransform[2][3]);
|
||||||
ui->MainViewport->Camera().Snap(AreaPosition);
|
ui->MainViewport->Camera().Snap(AreaPosition);
|
||||||
|
|
||||||
// Default bloom to ON for Metroid Prime 3; disable for other games
|
// Default bloom to Fake Bloom for Metroid Prime 3; disable for other games
|
||||||
if (mpWorld->Version() == eCorruption)
|
if (mpWorld->Version() == eCorruption)
|
||||||
{
|
{
|
||||||
ui->menuBloom->setEnabled(true);
|
ui->menuBloom->setEnabled(true);
|
||||||
on_ActionBloom_triggered();
|
on_ActionFakeBloom_triggered();
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -420,6 +420,7 @@ void CWorldEditor::on_ActionNoBloom_triggered()
|
||||||
mpRenderer->SetBloom(CRenderer::eNoBloom);
|
mpRenderer->SetBloom(CRenderer::eNoBloom);
|
||||||
ui->ActionNoBloom->setChecked(true);
|
ui->ActionNoBloom->setChecked(true);
|
||||||
ui->ActionBloomMaps->setChecked(false);
|
ui->ActionBloomMaps->setChecked(false);
|
||||||
|
ui->ActionFakeBloom->setChecked(false);
|
||||||
ui->ActionBloom->setChecked(false);
|
ui->ActionBloom->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,6 +429,16 @@ void CWorldEditor::on_ActionBloomMaps_triggered()
|
||||||
mpRenderer->SetBloom(CRenderer::eBloomMaps);
|
mpRenderer->SetBloom(CRenderer::eBloomMaps);
|
||||||
ui->ActionNoBloom->setChecked(false);
|
ui->ActionNoBloom->setChecked(false);
|
||||||
ui->ActionBloomMaps->setChecked(true);
|
ui->ActionBloomMaps->setChecked(true);
|
||||||
|
ui->ActionFakeBloom->setChecked(false);
|
||||||
|
ui->ActionBloom->setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWorldEditor::on_ActionFakeBloom_triggered()
|
||||||
|
{
|
||||||
|
mpRenderer->SetBloom(CRenderer::eFakeBloom);
|
||||||
|
ui->ActionNoBloom->setChecked(false);
|
||||||
|
ui->ActionBloomMaps->setChecked(false);
|
||||||
|
ui->ActionFakeBloom->setChecked(true);
|
||||||
ui->ActionBloom->setChecked(false);
|
ui->ActionBloom->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,6 +447,7 @@ void CWorldEditor::on_ActionBloom_triggered()
|
||||||
mpRenderer->SetBloom(CRenderer::eBloom);
|
mpRenderer->SetBloom(CRenderer::eBloom);
|
||||||
ui->ActionNoBloom->setChecked(false);
|
ui->ActionNoBloom->setChecked(false);
|
||||||
ui->ActionBloomMaps->setChecked(false);
|
ui->ActionBloomMaps->setChecked(false);
|
||||||
|
ui->ActionFakeBloom->setChecked(false);
|
||||||
ui->ActionBloom->setChecked(true);
|
ui->ActionBloom->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ private slots:
|
||||||
void on_ActionWorldLighting_triggered();
|
void on_ActionWorldLighting_triggered();
|
||||||
void on_ActionNoBloom_triggered();
|
void on_ActionNoBloom_triggered();
|
||||||
void on_ActionBloomMaps_triggered();
|
void on_ActionBloomMaps_triggered();
|
||||||
|
void on_ActionFakeBloom_triggered();
|
||||||
void on_ActionBloom_triggered();
|
void on_ActionBloom_triggered();
|
||||||
void on_ActionZoomOnSelection_triggered();
|
void on_ActionZoomOnSelection_triggered();
|
||||||
void on_ActionDisableBackfaceCull_triggered();
|
void on_ActionDisableBackfaceCull_triggered();
|
||||||
|
|
|
@ -84,6 +84,7 @@
|
||||||
</property>
|
</property>
|
||||||
<addaction name="ActionNoBloom"/>
|
<addaction name="ActionNoBloom"/>
|
||||||
<addaction name="ActionBloomMaps"/>
|
<addaction name="ActionBloomMaps"/>
|
||||||
|
<addaction name="ActionFakeBloom"/>
|
||||||
<addaction name="ActionBloom"/>
|
<addaction name="ActionBloom"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="ActionZoomOnSelection"/>
|
<addaction name="ActionZoomOnSelection"/>
|
||||||
|
@ -580,6 +581,14 @@
|
||||||
<string>Edit Layers</string>
|
<string>Edit Layers</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="ActionFakeBloom">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Fake Bloom</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
Loading…
Reference in New Issue