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> #include <Common/CTimer.h>
CMaterialPass::CMaterialPass(CMaterial *pParent) CMaterialPass::CMaterialPass(CMaterial *pParent)
: mPassType("CUST") : mpParentMat(pParent)
, 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'}
{ {
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) std::unique_ptr<CMaterialPass> CMaterialPass::Clone(CMaterial* pParent)
{ {

View File

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