mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-07-06 13:16:00 +00:00
CMaterial: Make use of in-class initializers
Same behavior, less code.
This commit is contained in:
parent
b18accfa60
commit
46e5056ba7
@ -12,38 +12,12 @@ uint64 CMaterial::sCurrentMaterial = 0;
|
|||||||
CColor CMaterial::sCurrentTint = CColor::White();
|
CColor CMaterial::sCurrentTint = CColor::White();
|
||||||
std::map<uint64, CMaterial::SMaterialShader> CMaterial::smShaderMap;
|
std::map<uint64, CMaterial::SMaterialShader> CMaterial::smShaderMap;
|
||||||
|
|
||||||
CMaterial::CMaterial()
|
CMaterial::CMaterial() = default;
|
||||||
: mpShader(nullptr)
|
|
||||||
, mShaderStatus(EShaderStatus::NoShader)
|
|
||||||
, mRecalcHash(true)
|
|
||||||
, mVersion(EGame::Invalid)
|
|
||||||
, mOptions(EMaterialOption::None)
|
|
||||||
, mVtxDesc(EVertexAttribute::None)
|
|
||||||
, mBlendSrcFac(GL_ONE)
|
|
||||||
, mBlendDstFac(GL_ZERO)
|
|
||||||
, mLightingEnabled(true)
|
|
||||||
, mEchoesUnknownA(0)
|
|
||||||
, mEchoesUnknownB(0)
|
|
||||||
, mpIndirectTexture(nullptr)
|
|
||||||
, mpNextDrawPassMaterial(nullptr)
|
|
||||||
, mpBloomMaterial(nullptr)
|
|
||||||
{}
|
|
||||||
|
|
||||||
CMaterial::CMaterial(EGame Version, FVertexDescription VtxDesc)
|
CMaterial::CMaterial(EGame Version, FVertexDescription VtxDesc)
|
||||||
: mpShader(nullptr)
|
: mVersion(Version)
|
||||||
, mShaderStatus(EShaderStatus::NoShader)
|
|
||||||
, mRecalcHash(true)
|
|
||||||
, mVersion(Version)
|
|
||||||
, mOptions(EMaterialOption::DepthWrite | EMaterialOption::ColorWrite)
|
, mOptions(EMaterialOption::DepthWrite | EMaterialOption::ColorWrite)
|
||||||
, mVtxDesc(VtxDesc)
|
, mVtxDesc(VtxDesc)
|
||||||
, mBlendSrcFac(GL_ONE)
|
|
||||||
, mBlendDstFac(GL_ZERO)
|
|
||||||
, mLightingEnabled(true)
|
|
||||||
, mEchoesUnknownA(0)
|
|
||||||
, mEchoesUnknownB(0)
|
|
||||||
, mpIndirectTexture(nullptr)
|
|
||||||
, mpNextDrawPassMaterial(nullptr)
|
|
||||||
, mpBloomMaterial(nullptr)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CMaterial::~CMaterial()
|
CMaterial::~CMaterial()
|
||||||
|
@ -75,21 +75,21 @@ private:
|
|||||||
|
|
||||||
// Members
|
// Members
|
||||||
TString mName; // Name of the material
|
TString mName; // Name of the material
|
||||||
CShader *mpShader; // This material's generated shader. Created with GenerateShader().
|
CShader *mpShader = nullptr; // This material's generated shader. Created with GenerateShader().
|
||||||
EShaderStatus mShaderStatus; // A status variable so that PWE won't crash if a shader fails to compile.
|
EShaderStatus mShaderStatus{EShaderStatus::NoShader}; // A status variable so that PWE won't crash if a shader fails to compile.
|
||||||
uint64 mParametersHash; // A hash of all the parameters that can identify this TEV setup.
|
uint64 mParametersHash = 0; // A hash of all the parameters that can identify this TEV setup.
|
||||||
bool mRecalcHash; // Indicates the hash needs to be recalculated. Set true when parameters are changed.
|
bool mRecalcHash = true; // Indicates the hash needs to be recalculated. Set true when parameters are changed.
|
||||||
|
|
||||||
EGame mVersion;
|
EGame mVersion{EGame::Invalid};
|
||||||
FMaterialOptions mOptions; // See the EMaterialOption enum above
|
FMaterialOptions mOptions{EMaterialOption::None}; // See the EMaterialOption enum above
|
||||||
FVertexDescription mVtxDesc; // Descriptor of vertex attributes used by this material
|
FVertexDescription mVtxDesc{EVertexAttribute::None}; // Descriptor of vertex attributes used by this material
|
||||||
std::array<CColor, 4> mKonstColors; // Konst color values for TEV
|
std::array<CColor, 4> mKonstColors; // Konst color values for TEV
|
||||||
std::array<CColor, 4> mTevColors; // Initial TEV color register values (for MP3 materials only)
|
std::array<CColor, 4> mTevColors; // Initial TEV color register values (for MP3 materials only)
|
||||||
GLenum mBlendSrcFac; // Source blend factor
|
GLenum mBlendSrcFac{GL_ONE}; // Source blend factor
|
||||||
GLenum mBlendDstFac; // Dest blend factor
|
GLenum mBlendDstFac{GL_ZERO}; // Dest blend factor
|
||||||
bool mLightingEnabled; // Color channel control flags; indicate whether lighting is enabled
|
bool mLightingEnabled = true; // Color channel control flags; indicate whether lighting is enabled
|
||||||
uint32 mEchoesUnknownA; // First unknown value introduced in Echoes. Included for cooking.
|
uint32 mEchoesUnknownA = 0; // First unknown value introduced in Echoes. Included for cooking.
|
||||||
uint32 mEchoesUnknownB; // Second unknown value introduced in Echoes. Included for cooking.
|
uint32 mEchoesUnknownB = 0; // Second unknown value introduced in Echoes. Included for cooking.
|
||||||
TResPtr<CTexture> mpIndirectTexture; // Optional texture used for the indirect stage for reflections
|
TResPtr<CTexture> mpIndirectTexture; // Optional texture used for the indirect stage for reflections
|
||||||
|
|
||||||
std::vector<std::unique_ptr<CMaterialPass>> mPasses;
|
std::vector<std::unique_ptr<CMaterialPass>> mPasses;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user