2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 15:04:56 +00:00

Lots of bug fixes; working CPhazonSuitFilter

This commit is contained in:
Jack Andersen
2017-12-19 20:06:54 -10:00
parent 1c44f8d1bc
commit c00cc6cea9
41 changed files with 322 additions and 161 deletions

View File

@@ -117,9 +117,10 @@ void CHudEnergyInterface::Update(float dt, float energyLowPulse)
zeus::CColor emptyColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarEmptyLowEnergy() : barColors.empty;
zeus::CColor filledColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarFilledLowEnergy() : barColors.filled;
zeus::CColor shadowColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarShadowLowEnergy() : barColors.shadow;
x2c_energybart01_energybar->SetFilledColor(zeus::CColor::lerp(
zeus::CColor::lerp(filledColor, g_tweakGuiColors->GetEnergyBarFlashColor(), x8_flashMag),
zeus::CColor(1.f, 0.8f, 0.4f, 1.f), energyLowPulse));
zeus::CColor useFillColor = zeus::CColor::lerp(filledColor, g_tweakGuiColors->GetEnergyBarFlashColor(), x8_flashMag);
if (x1c_27_energyLow)
useFillColor = zeus::CColor::lerp(useFillColor, zeus::CColor(1.f, 0.8f, 0.4f, 1.f), energyLowPulse);
x2c_energybart01_energybar->SetFilledColor(useFillColor);
x2c_energybart01_energybar->SetShadowColor(shadowColor);
x2c_energybart01_energybar->SetEmptyColor(emptyColor);
}

View File

@@ -58,6 +58,12 @@ void CTextRenderBuffer::CommitResources()
{
m_uniBuf = CTextSupportShader::s_Uniforms.allocateBlock(CGraphics::g_BooFactory);
auto uBufInfo = m_uniBuf.getBufferInfo();
decltype(uBufInfo) uBufInfo2;
if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw)
{
m_uniBuf2 = CTextSupportShader::s_Uniforms.allocateBlock(CGraphics::g_BooFactory);
uBufInfo2 = m_uniBuf2.getBufferInfo();
}
for (BooFontCharacters& chs : m_fontCharacters)
{
@@ -94,6 +100,16 @@ void CTextRenderBuffer::CommitResources()
vFmt, nullptr, iBufInfo.first.get(), nullptr,
1, uniforms, unistages, unioffs,
unisizes, 1, texs, nullptr, nullptr, 0, iBufInfo.second);
if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw)
{
uniforms[0] = uBufInfo2.first.get();
unioffs[0] = size_t(uBufInfo2.second);
chs.m_dataBinding2 = ctx.newShaderDataBinding(CTextSupportShader::GetTextAdditiveOverdrawPipeline(),
vFmt, nullptr, iBufInfo.first.get(), nullptr,
1, uniforms, unistages, unioffs,
unisizes, 1, texs, nullptr, nullptr, 0, iBufInfo.second);
}
}
for (BooImage& img : m_images)
@@ -134,6 +150,21 @@ void CTextRenderBuffer::CommitResources()
1, uniforms, unistages, unioffs,
unisizes, 1, texs, nullptr, nullptr, 0, iBufInfo.second));
}
if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw)
{
uniforms[0] = uBufInfo2.first.get();
unioffs[0] = size_t(uBufInfo2.second);
img.m_dataBinding2.reserve(img.m_imageDef.x4_texs.size());
for (TToken<CTexture>& tex : img.m_imageDef.x4_texs)
{
boo::ObjToken<boo::ITexture> texs[] = {tex->GetBooTexture()};
img.m_dataBinding2.push_back(ctx.newShaderDataBinding(CTextSupportShader::GetImageAdditiveOverdrawPipeline(),
vFmt, nullptr, iBufInfo.first.get(), nullptr,
1, uniforms, unistages, unioffs,
unisizes, 1, texs, nullptr, nullptr, 0, iBufInfo.second));
}
}
}
return true;
});
@@ -166,6 +197,13 @@ void CTextRenderBuffer::Render(const zeus::CColor& col, float time) const
const_cast<CTextRenderBuffer*>(this)->m_uniBuf.access() =
CTextSupportShader::Uniform{mat, col};
if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw)
{
zeus::CColor colSq = col * col;
colSq.a = col.a;
const_cast<CTextRenderBuffer*>(this)->m_uniBuf2.access() =
CTextSupportShader::Uniform{mat, colSq};
}
for (const BooFontCharacters& chs : m_fontCharacters)
{
@@ -180,6 +218,11 @@ void CTextRenderBuffer::Render(const zeus::CColor& col, float time) const
}
CGraphics::SetShaderDataBinding(chs.m_dataBinding);
CGraphics::DrawInstances(0, 4, chs.m_charData.size());
if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw)
{
CGraphics::SetShaderDataBinding(chs.m_dataBinding2);
CGraphics::DrawInstances(0, 4, chs.m_charData.size());
}
}
}
@@ -193,6 +236,11 @@ void CTextRenderBuffer::Render(const zeus::CColor& col, float time) const
int idx = int(img.m_imageDef.x0_fps * time) % img.m_dataBinding.size();
CGraphics::SetShaderDataBinding(img.m_dataBinding[idx]);
CGraphics::DrawInstances(0, 4, 1);
if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw)
{
CGraphics::SetShaderDataBinding(img.m_dataBinding2[idx]);
CGraphics::DrawInstances(0, 4, 1);
}
}
}

View File

@@ -67,12 +67,14 @@ private:
#else
/* Boo-specific text-rendering functionality */
hecl::UniformBufferPool<CTextSupportShader::Uniform>::Token m_uniBuf;
hecl::UniformBufferPool<CTextSupportShader::Uniform>::Token m_uniBuf2;
struct BooFontCharacters
{
TLockedToken<CRasterFont> m_font;
hecl::VertexBufferPool<CTextSupportShader::CharacterInstance>::Token m_instBuf;
boo::ObjToken<boo::IShaderDataBinding> m_dataBinding;
boo::ObjToken<boo::IShaderDataBinding> m_dataBinding2;
std::vector<CTextSupportShader::CharacterInstance> m_charData;
u32 m_charCount = 0;
bool m_dirty = true;
@@ -86,6 +88,7 @@ private:
CFontImageDef m_imageDef;
hecl::VertexBufferPool<CTextSupportShader::ImageInstance>::Token m_instBuf;
std::vector<boo::ObjToken<boo::IShaderDataBinding>> m_dataBinding;
std::vector<boo::ObjToken<boo::IShaderDataBinding>> m_dataBinding2;
CTextSupportShader::ImageInstance m_imageData;
bool m_dirty = true;
BooImage(const CFontImageDef& imgDef, const zeus::CVector2i& offset);