CMaterialPass: Simplify initialization code

This commit is contained in:
Lioncash 2020-06-11 17:41:28 -04:00
parent 92811a9309
commit 7b81aa5268
2 changed files with 22 additions and 44 deletions

View File

@ -4,33 +4,11 @@
#include <Common/CTimer.h>
CMaterialPass::CMaterialPass(CMaterial *pParent)
: mPassType("CUST")
, mSettings(EPassSettings::None)
, mpTexture(nullptr)
, mEnabled(true)
, mpParentMat(pParent)
, mColorOutput(kPrevReg)
, mAlphaOutput(kPrevReg)
, mKColorSel(kKonstOne)
, mKAlphaSel(kKonstOne)
, mRasSel(kRasColorNull)
, mTevColorScale(1.f)
, mTevAlphaScale(1.f)
, mTexCoordSource(0xFF)
, mAnimMode(EUVAnimMode::NoUVAnim)
, mTexSwapComps{'r', 'g', 'b', 'a'}
: mpParentMat(pParent)
{
for (uint32 iParam = 0; iParam < 4; iParam++)
{
mColorInputs[iParam] = kZeroRGB;
mAlphaInputs[iParam] = kZeroAlpha;
mAnimParams[iParam] = 0.f;
}
}
CMaterialPass::~CMaterialPass()
{
}
CMaterialPass::~CMaterialPass() = default;
std::unique_ptr<CMaterialPass> CMaterialPass::Clone(CMaterial* pParent)
{

View File

@ -24,29 +24,29 @@ class CMaterialPass
friend class CMaterialLoader;
friend class CMaterialCooker;
CMaterial *mpParentMat;
CFourCC mPassType;
FPassSettings mSettings;
CMaterial *mpParentMat = nullptr;
CFourCC mPassType{"CUST"};
FPassSettings mSettings{EPassSettings::None};
ETevColorInput mColorInputs[4];
ETevAlphaInput mAlphaInputs[4];
ETevOutput mColorOutput;
ETevOutput mAlphaOutput;
ETevKSel mKColorSel;
ETevKSel mKAlphaSel;
ETevRasSel mRasSel;
float mTevColorScale;
float mTevAlphaScale;
uint32 mTexCoordSource; // Should maybe be an enum but worried about conflicts with EVertexDescriptionn
TResPtr<CTexture> mpTexture;
EUVAnimMode mAnimMode;
EUVConvolutedModeBType mAnimConvolutedModeBType;
float mAnimParams[8];
char mTexSwapComps[4];
bool mEnabled;
ETevColorInput mColorInputs[4] = {kZeroRGB, kZeroRGB, kZeroRGB, kZeroRGB};
ETevAlphaInput mAlphaInputs[4] = {kZeroAlpha, kZeroAlpha, kZeroAlpha, kZeroAlpha};
ETevOutput mColorOutput{kPrevReg};
ETevOutput mAlphaOutput{kPrevReg};
ETevKSel mKColorSel{kKonstOne};
ETevKSel mKAlphaSel{kKonstOne};
ETevRasSel mRasSel{kRasColorNull};
float mTevColorScale = 1.0f;
float mTevAlphaScale = 1.0f;
uint32 mTexCoordSource = 0xFF; // Should maybe be an enum but worried about conflicts with EVertexDescriptionn
TResPtr<CTexture> mpTexture{nullptr};
EUVAnimMode mAnimMode{EUVAnimMode::NoUVAnim};
EUVConvolutedModeBType mAnimConvolutedModeBType{};
float mAnimParams[8] = {};
char mTexSwapComps[4] = {'r', 'g', 'b', 'a'};
bool mEnabled = true;
public:
CMaterialPass(CMaterial *pParent);
explicit CMaterialPass(CMaterial *pParent);
~CMaterialPass();
std::unique_ptr<CMaterialPass> Clone(CMaterial *pParent);
void HashParameters(CFNV1A& rHash);