2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 04:27:42 +00:00

Finish CSamusHud and subsystems

This commit is contained in:
Jack Andersen
2017-04-13 09:28:31 -10:00
parent 84578e9909
commit 0fe125d913
42 changed files with 1094 additions and 316 deletions

View File

@@ -8,6 +8,7 @@
#include "Input/CFinalInput.hpp"
#include "zeus/CColor.hpp"
#include "CSimplePool.hpp"
#include "Graphics/CModel.hpp"
namespace urde
{
@@ -51,15 +52,18 @@ void CGuiFrame::SortDrawOrder()
});
}
void CGuiFrame::EnableLights(u32 lights) const
void CGuiFrame::EnableLights(u32 lights, CBooModel& model) const
{
std::vector<CLight> lightsOut;
lightsOut.reserve(m_indexedLights.size() + 1);
CGraphics::DisableAllLights();
zeus::CColor accumColor(zeus::CColor::skBlack);
zeus::CColor ambColor(zeus::CColor::skBlack);
ERglLight lightId = ERglLight::Zero;
int idx = 0;
for (auto& light : m_indexedLights)
for (CGuiLight* light : m_indexedLights)
{
if (!light)
if (!light || !light->GetIsVisible())
{
++reinterpret_cast<std::underlying_type_t<ERglLight>&>(lightId);
++idx;
@@ -67,18 +71,31 @@ void CGuiFrame::EnableLights(u32 lights) const
}
if ((lights & (1 << idx)) != 0)
{
// accumulate color
accumColor += light->GetColor();
CGraphics::LoadLight(lightId, light->BuildLight());
CGraphics::EnableLight(lightId);
const zeus::CColor& geomCol = light->GetGeometryColor();
if (geomCol.r || geomCol.g || geomCol.b)
{
//CGraphics::LoadLight(lightId, light->BuildLight());
lightsOut.push_back(light->BuildLight());
CGraphics::EnableLight(lightId);
}
// accumulate ambient color
ambColor += light->GetAmbientLightColor();
}
++reinterpret_cast<std::underlying_type_t<ERglLight>&>(lightId);
++idx;
}
if (m_indexedLights.empty())
CGraphics::SetAmbientColor(zeus::CColor::skWhite);
{
//CGraphics::SetAmbientColor(zeus::CColor::skWhite);
lightsOut.push_back(CLight::BuildLocalAmbient(zeus::CVector3f::skZero, zeus::CColor::skWhite));
}
else
CGraphics::SetAmbientColor(accumColor);
{
//CGraphics::SetAmbientColor(ambColor);
lightsOut.push_back(CLight::BuildLocalAmbient(zeus::CVector3f::skZero, ambColor));
}
model.ActivateLights(lightsOut);
}
void CGuiFrame::DisableLights() const