CMaterialLoader: Make use of std::array

This commit is contained in:
Lioncash 2020-06-14 19:41:42 -04:00
parent 903f6dfe7e
commit cc376d3e21
2 changed files with 16 additions and 20 deletions

View File

@ -5,14 +5,9 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
CMaterialLoader::CMaterialLoader() CMaterialLoader::CMaterialLoader() = default;
: mCorruptionFlags(0)
{
}
CMaterialLoader::~CMaterialLoader() CMaterialLoader::~CMaterialLoader() = default;
{
}
FVertexDescription CMaterialLoader::ConvertToVertexDescription(uint32 VertexFlags) FVertexDescription CMaterialLoader::ConvertToVertexDescription(uint32 VertexFlags)
{ {

View File

@ -8,6 +8,7 @@
#include <Common/FileIO.h> #include <Common/FileIO.h>
#include <assimp/scene.h> #include <assimp/scene.h>
#include <array>
#include <optional> #include <optional>
enum class EMP3RenderConfig enum class EMP3RenderConfig
@ -83,7 +84,7 @@ struct SMP3IntermediateMaterial
EUVAnimMatrixConfig mMtxConfig = EUVAnimMatrixConfig::NoMtxNoPost; EUVAnimMatrixConfig mMtxConfig = EUVAnimMatrixConfig::NoMtxNoPost;
EUVAnimMode mAnimMode = EUVAnimMode::NoUVAnim; EUVAnimMode mAnimMode = EUVAnimMode::NoUVAnim;
EUVConvolutedModeBType mAnimConvolutedModeBType; EUVConvolutedModeBType mAnimConvolutedModeBType;
float mAnimParams[8]; std::array<float, 8> mAnimParams;
char GetSwapAlphaComp() const char GetSwapAlphaComp() const
{ {
@ -96,14 +97,14 @@ struct SMP3IntermediateMaterial
} }
} }
}; };
std::optional<PASS> mPASSes[14]; std::array<std::optional<PASS>, 14> mPASSes;
const std::optional<PASS>& GetPASS(EPASS pass) const { return mPASSes[int(pass)]; } const std::optional<PASS>& GetPASS(EPASS pass) const { return mPASSes[static_cast<size_t>(pass)]; }
uint8 mINTs[5] = {255, 255, 0, 32, 255}; std::array<uint8, 5> mINTs{255, 255, 0, 32, 255};
uint8 GetINT(EINT eint) const { return mINTs[int(eint)]; } uint8 GetINT(EINT eint) const { return mINTs[static_cast<size_t>(eint)]; }
CColor mCLRs[2] = {CColor::skWhite, CColor::skWhite}; std::array<CColor, 2> mCLRs{CColor::skWhite, CColor::skWhite};
const CColor& GetCLR(ECLR clr) const { return mCLRs[int(clr)]; } const CColor& GetCLR(ECLR clr) const { return mCLRs[static_cast<size_t>(clr)]; }
}; };
struct STevTracker struct STevTracker
@ -116,14 +117,14 @@ struct STevTracker
class CMaterialLoader class CMaterialLoader
{ {
// Material data // Material data
CMaterialSet *mpSet; CMaterialSet *mpSet = nullptr;
IInputStream *mpFile; IInputStream *mpFile = nullptr;
EGame mVersion; EGame mVersion{};
std::vector<TResPtr<CTexture>> mTextures; std::vector<TResPtr<CTexture>> mTextures;
CColor mCorruptionColors[4]; std::array<CColor, 4> mCorruptionColors;
uint8 mCorruptionInts[5]; std::array<uint8, 5> mCorruptionInts{};
uint32 mCorruptionFlags; uint32 mCorruptionFlags = 0;
CMaterialLoader(); CMaterialLoader();
~CMaterialLoader(); ~CMaterialLoader();