2015-07-26 21:39:49 +00:00
|
|
|
#ifndef CMATERIALPASS_H
|
|
|
|
#define CMATERIALPASS_H
|
|
|
|
|
|
|
|
#include <Common/CFourCC.h>
|
|
|
|
#include <Common/CHashFNV1A.h>
|
2015-12-13 20:52:17 +00:00
|
|
|
#include <Core/TResPtr.h>
|
2015-07-26 21:39:49 +00:00
|
|
|
#include <Core/ERenderOptions.h>
|
|
|
|
#include <Resource/CTexture.h>
|
|
|
|
#include "ETevEnums.h"
|
|
|
|
|
|
|
|
class CMaterial;
|
|
|
|
|
|
|
|
class CMaterialPass
|
|
|
|
{
|
|
|
|
friend class CMaterialLoader;
|
|
|
|
friend class CMaterialCooker;
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum EPassSettings
|
|
|
|
{
|
2015-11-28 18:37:22 +00:00
|
|
|
eNoPassSettings = 0x0,
|
2015-07-26 21:39:49 +00:00
|
|
|
eEmissiveBloom = 0x4,
|
|
|
|
eInvertOpacityMap = 0x10
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
CMaterial *mpParentMat;
|
|
|
|
CFourCC mPassType;
|
|
|
|
EPassSettings mSettings;
|
|
|
|
|
|
|
|
ETevColorInput mColorInputs[4];
|
|
|
|
ETevAlphaInput mAlphaInputs[4];
|
|
|
|
ETevOutput mColorOutput;
|
|
|
|
ETevOutput mAlphaOutput;
|
|
|
|
ETevKSel mKColorSel;
|
|
|
|
ETevKSel mKAlphaSel;
|
|
|
|
ETevRasSel mRasSel;
|
|
|
|
u32 mTexCoordSource; // Should maybe be an enum but worried about conflicts with EVertexDescriptionn
|
2015-12-13 20:52:17 +00:00
|
|
|
TResPtr<CTexture> mpTexture;
|
2015-07-26 21:39:49 +00:00
|
|
|
EUVAnimMode mAnimMode;
|
|
|
|
float mAnimParams[4];
|
|
|
|
bool mEnabled;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CMaterialPass(CMaterial *pParent);
|
|
|
|
~CMaterialPass();
|
2015-08-01 03:44:50 +00:00
|
|
|
CMaterialPass* Clone(CMaterial *pParent);
|
2015-07-26 21:39:49 +00:00
|
|
|
void HashParameters(CHashFNV1A& Hash);
|
|
|
|
void LoadTexture(u32 PassIndex);
|
|
|
|
void SetAnimCurrent(ERenderOptions Options, u32 PassIndex);
|
|
|
|
|
|
|
|
// Setters
|
|
|
|
void SetType(CFourCC Type);
|
|
|
|
void SetColorInputs(ETevColorInput InputA, ETevColorInput InputB, ETevColorInput InputC, ETevColorInput InputD);
|
|
|
|
void SetAlphaInputs(ETevAlphaInput InputA, ETevAlphaInput InputB, ETevAlphaInput InputC, ETevAlphaInput InputD);
|
|
|
|
void SetColorOutput(ETevOutput OutputReg);
|
|
|
|
void SetAlphaOutput(ETevOutput OutputReg);
|
|
|
|
void SetKColorSel(ETevKSel Sel);
|
|
|
|
void SetKAlphaSel(ETevKSel Sel);
|
|
|
|
void SetRasSel(ETevRasSel Sel);
|
|
|
|
void SetTexCoordSource(u32 Source);
|
|
|
|
void SetTexture(CTexture *pTex);
|
|
|
|
void SetAnimMode(EUVAnimMode Mode);
|
|
|
|
void SetAnimParam(u32 ParamIndex, float Value);
|
|
|
|
void SetEnabled(bool Enabled);
|
|
|
|
|
|
|
|
// Getters
|
|
|
|
inline CFourCC Type() const {
|
|
|
|
return mPassType;
|
|
|
|
}
|
|
|
|
|
2015-11-24 06:08:31 +00:00
|
|
|
inline TString NamedType() const {
|
2015-07-26 21:39:49 +00:00
|
|
|
return PassTypeName(mPassType);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline ETevColorInput ColorInput(u32 Input) const {
|
|
|
|
return mColorInputs[Input];
|
|
|
|
}
|
|
|
|
|
|
|
|
inline ETevAlphaInput AlphaInput(u32 Input) const {
|
|
|
|
return mAlphaInputs[Input];
|
|
|
|
}
|
|
|
|
|
|
|
|
inline ETevOutput ColorOutput() const {
|
|
|
|
return mColorOutput;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline ETevOutput AlphaOutput() const {
|
|
|
|
return mAlphaOutput;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline ETevKSel KColorSel() const {
|
|
|
|
return mKColorSel;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline ETevKSel KAlphaSel() const {
|
|
|
|
return mKAlphaSel;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline ETevRasSel RasSel() const {
|
|
|
|
return mRasSel;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline u32 TexCoordSource() const {
|
|
|
|
return mTexCoordSource;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline CTexture* Texture() const {
|
|
|
|
return mpTexture;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline EUVAnimMode AnimMode() const {
|
|
|
|
return mAnimMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline float AnimParam(u32 ParamIndex) const {
|
|
|
|
return mAnimParams[ParamIndex];
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool IsEnabled() const {
|
|
|
|
return mEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Static
|
2015-11-24 06:08:31 +00:00
|
|
|
static TString PassTypeName(CFourCC Type);
|
2015-07-26 21:39:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CMATERIALPASS_H
|