From 95199848d30b0e23006569d3d4b9a344915bd2c1 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 5 Apr 2020 05:44:26 -0400 Subject: [PATCH] CGraphics: Make use of std::array where applicable --- Runtime/Graphics/CGraphics.cpp | 6 +++--- Runtime/Graphics/CGraphics.hpp | 5 +++-- Runtime/Graphics/CModelBoo.cpp | 4 +--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Runtime/Graphics/CGraphics.cpp b/Runtime/Graphics/CGraphics.cpp index 678e5d17b..cfeb54859 100644 --- a/Runtime/Graphics/CGraphics.cpp +++ b/Runtime/Graphics/CGraphics.cpp @@ -12,7 +12,7 @@ namespace urde { CGraphics::CProjectionState CGraphics::g_Proj; CGraphics::CFogState CGraphics::g_Fog; -zeus::CColor CGraphics::g_ColorRegs[3] = {}; +std::array CGraphics::g_ColorRegs{}; float CGraphics::g_ProjAspect = 1.f; u32 CGraphics::g_NumLightsActive = 0; u32 CGraphics::g_NumBreakpointsWaiting = 0; @@ -35,7 +35,7 @@ SViewport g_Viewport = { }; u32 CGraphics::g_FrameCounter = 0; -const zeus::CMatrix3f CGraphics::skCubeBasisMats[] = { +const std::array CGraphics::skCubeBasisMats{{ /* Right */ {0.f, 1.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, -1.f}, /* Left */ @@ -48,7 +48,7 @@ const zeus::CMatrix3f CGraphics::skCubeBasisMats[] = { {1.f, 0.f, 0.f, 0.f, -1.f, 0.f, 0.f, 0.f, -1.f}, /* Forward */ {-1.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, -1.f}, -}; +}}; void CGraphics::DisableAllLights() { g_NumLightsActive = 0; diff --git a/Runtime/Graphics/CGraphics.hpp b/Runtime/Graphics/CGraphics.hpp index 27e811e48..cf4eb982c 100644 --- a/Runtime/Graphics/CGraphics.hpp +++ b/Runtime/Graphics/CGraphics.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include "Runtime/RetroTypes.hpp" @@ -248,7 +249,7 @@ public: static CProjectionState g_Proj; static zeus::CVector2f g_CachedDepthRange; static CFogState g_Fog; - static zeus::CColor g_ColorRegs[3]; + static std::array g_ColorRegs; static float g_ProjAspect; static u32 g_NumLightsActive; static u32 g_NumBreakpointsWaiting; @@ -316,7 +317,7 @@ public: static boo::IGraphicsCommandQueue* g_BooMainCommandQueue; static boo::ObjToken g_SpareTexture; - static const zeus::CMatrix3f skCubeBasisMats[6]; + static const std::array skCubeBasisMats; static void InitializeBoo(boo::IGraphicsDataFactory* factory, boo::IGraphicsCommandQueue* cc, const boo::ObjToken& spareTex) { diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index 8720d0e75..bb30f753e 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -1055,9 +1055,7 @@ boo::ObjToken CBooModel::UpdateUniformData(const CModelFl } else { CModelShaders::LightingUniform& lightingOut = *reinterpret_cast(dataCur); lightingOut = m_lightingData; - lightingOut.colorRegs[0] = CGraphics::g_ColorRegs[0]; - lightingOut.colorRegs[1] = CGraphics::g_ColorRegs[1]; - lightingOut.colorRegs[2] = CGraphics::g_ColorRegs[2]; + lightingOut.colorRegs = CGraphics::g_ColorRegs; lightingOut.mulColor = flags.x4_color; lightingOut.addColor = flags.addColor; lightingOut.fog = CGraphics::g_Fog;