mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-19 01:46:27 +00:00
CGraphics: Make use of std::array
This commit is contained in:
@@ -198,8 +198,9 @@ CStructProperty* CLight::GetProperties() const
|
||||
// ************ OTHER ************
|
||||
void CLight::Load() const
|
||||
{
|
||||
uint8 Index = (uint8) CGraphics::sNumLights;
|
||||
if (Index >= 8) return;
|
||||
const auto Index = static_cast<uint8>(CGraphics::sNumLights);
|
||||
if (Index >= CGraphics::sLightBlock.Lights.size())
|
||||
return;
|
||||
|
||||
CGraphics::SLightBlock::SGXLight *pLight = &CGraphics::sLightBlock.Lights[Index];
|
||||
|
||||
|
||||
@@ -181,13 +181,13 @@ bool CMaterial::SetCurrent(FRenderOptions Options)
|
||||
glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||
|
||||
// Set konst inputs
|
||||
for (uint32 iKonst = 0; iKonst < 4; iKonst++)
|
||||
CGraphics::sPixelBlock.Konst[iKonst] = mKonstColors[iKonst];
|
||||
CGraphics::sPixelBlock.Konst = mKonstColors;
|
||||
|
||||
// Set TEV registers
|
||||
if (mVersion >= EGame::Corruption)
|
||||
for (uint32 iTev = 0; iTev < 4; iTev++)
|
||||
CGraphics::sPixelBlock.TevColor[iTev] = mTevColors[iTev];
|
||||
{
|
||||
CGraphics::sPixelBlock.TevColor = mTevColors;
|
||||
}
|
||||
|
||||
// Set color channels
|
||||
// COLOR0_Amb,Mat is initialized by the node instead of by the material
|
||||
@@ -242,21 +242,21 @@ uint64 CMaterial::HashParameters()
|
||||
{
|
||||
CFNV1A Hash(CFNV1A::EHashLength::k64Bit);
|
||||
|
||||
Hash.HashLong((int) mVersion);
|
||||
Hash.HashLong(static_cast<int>(mVersion));
|
||||
Hash.HashLong(mOptions);
|
||||
Hash.HashLong(mVtxDesc);
|
||||
Hash.HashData(mKonstColors, sizeof(CColor) * 4);
|
||||
Hash.HashData(mTevColors, sizeof(CColor) * 4);
|
||||
Hash.HashData(mKonstColors.data(), sizeof(mKonstColors));
|
||||
Hash.HashData(mTevColors.data(), sizeof(mTevColors));
|
||||
Hash.HashLong(mBlendSrcFac);
|
||||
Hash.HashLong(mBlendDstFac);
|
||||
Hash.HashByte(mLightingEnabled);
|
||||
Hash.HashLong(mEchoesUnknownA);
|
||||
Hash.HashLong(mEchoesUnknownB);
|
||||
|
||||
for (uint32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||
mPasses[iPass]->HashParameters(Hash);
|
||||
for (auto& pass : mPasses)
|
||||
pass->HashParameters(Hash);
|
||||
|
||||
uint64 NewHash = Hash.GetHash64();
|
||||
const uint64 NewHash = Hash.GetHash64();
|
||||
|
||||
if (mParametersHash != NewHash)
|
||||
ClearShader();
|
||||
|
||||
@@ -83,8 +83,8 @@ private:
|
||||
EGame mVersion;
|
||||
FMaterialOptions mOptions; // See the EMaterialOption enum above
|
||||
FVertexDescription mVtxDesc; // Descriptor of vertex attributes used by this material
|
||||
CColor mKonstColors[4]; // Konst color values for TEV
|
||||
CColor mTevColors[4]; // Initial TEV color register values (for MP3 materials only)
|
||||
std::array<CColor, 4> mKonstColors; // Konst color values for TEV
|
||||
std::array<CColor, 4> mTevColors; // Initial TEV color register values (for MP3 materials only)
|
||||
GLenum mBlendSrcFac; // Source blend factor
|
||||
GLenum mBlendDstFac; // Dest blend factor
|
||||
bool mLightingEnabled; // Color channel control flags; indicate whether lighting is enabled
|
||||
|
||||
Reference in New Issue
Block a user