|
|
@ -69,9 +69,9 @@ void CMaterialLoader::ReadPrimeMatSet()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CMaterial* CMaterialLoader::ReadPrimeMaterial()
|
|
|
|
std::unique_ptr<CMaterial> CMaterialLoader::ReadPrimeMaterial()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterial *pMat = new CMaterial(mVersion, {});
|
|
|
|
auto pMat = std::make_unique<CMaterial>(mVersion, FVertexDescription{});
|
|
|
|
|
|
|
|
|
|
|
|
// Flags
|
|
|
|
// Flags
|
|
|
|
pMat->mOptions = (mpFile->ReadLong() & (uint) EMaterialOption::AllMP1Settings);
|
|
|
|
pMat->mOptions = (mpFile->ReadLong() & (uint) EMaterialOption::AllMP1Settings);
|
|
|
@ -133,7 +133,7 @@ CMaterial* CMaterialLoader::ReadPrimeMaterial()
|
|
|
|
|
|
|
|
|
|
|
|
for (uint32 iTev = 0; iTev < TevCount; iTev++)
|
|
|
|
for (uint32 iTev = 0; iTev < TevCount; iTev++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass *pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat.get());
|
|
|
|
|
|
|
|
|
|
|
|
uint32 ColorIn = mpFile->ReadLong();
|
|
|
|
uint32 ColorIn = mpFile->ReadLong();
|
|
|
|
uint32 AlphaIn = mpFile->ReadLong();
|
|
|
|
uint32 AlphaIn = mpFile->ReadLong();
|
|
|
@ -150,7 +150,7 @@ CMaterial* CMaterialLoader::ReadPrimeMaterial()
|
|
|
|
pPass->mAlphaInputs[iInput] = (ETevAlphaInput) ((AlphaIn >> (iInput * 5)) & 0x7);
|
|
|
|
pPass->mAlphaInputs[iInput] = (ETevAlphaInput) ((AlphaIn >> (iInput * 5)) & 0x7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pMat->mPasses[iTev] = pPass;
|
|
|
|
pMat->mPasses[iTev] = std::move(pPass);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<uint8> TevCoordIndices(TevCount);
|
|
|
|
std::vector<uint8> TevCoordIndices(TevCount);
|
|
|
@ -217,7 +217,7 @@ CMaterial* CMaterialLoader::ReadPrimeMaterial()
|
|
|
|
// Move TexGen and anims into passes
|
|
|
|
// Move TexGen and anims into passes
|
|
|
|
for (uint32 iPass = 0; iPass < pMat->mPasses.size(); iPass++)
|
|
|
|
for (uint32 iPass = 0; iPass < pMat->mPasses.size(); iPass++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass *pPass = pMat->mPasses[iPass];
|
|
|
|
CMaterialPass *pPass = pMat->mPasses[iPass].get();
|
|
|
|
uint8 TexCoordIdx = TevCoordIndices[iPass];
|
|
|
|
uint8 TexCoordIdx = TevCoordIndices[iPass];
|
|
|
|
|
|
|
|
|
|
|
|
if ((TexGens.size() == 0) || (TexCoordIdx == 0xFF))
|
|
|
|
if ((TexGens.size() == 0) || (TexCoordIdx == 0xFF))
|
|
|
@ -323,7 +323,7 @@ ECLR ClrFourCCToEnum(CFourCC fcc)
|
|
|
|
return ECLR::CLR;
|
|
|
|
return ECLR::CLR;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
CMaterial* CMaterialLoader::ReadCorruptionMaterial()
|
|
|
|
std::unique_ptr<CMaterial> CMaterialLoader::ReadCorruptionMaterial()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Flags
|
|
|
|
// Flags
|
|
|
|
FMP3MaterialOptions MP3Options = mpFile->ReadLong();
|
|
|
|
FMP3MaterialOptions MP3Options = mpFile->ReadLong();
|
|
|
@ -432,10 +432,10 @@ CMaterial* CMaterialLoader::ReadCorruptionMaterial()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Create non-bloom and bloom versions
|
|
|
|
// Create non-bloom and bloom versions
|
|
|
|
CMaterial* pMat = new CMaterial(mVersion, VtxDesc);
|
|
|
|
auto pMat = std::make_unique<CMaterial>(mVersion, VtxDesc);
|
|
|
|
CreateCorruptionPasses(pMat, Intermediate, false);
|
|
|
|
CreateCorruptionPasses(pMat.get(), Intermediate, false);
|
|
|
|
pMat->mpBloomMaterial = new CMaterial(mVersion, VtxDesc);
|
|
|
|
pMat->mpBloomMaterial = std::make_unique<CMaterial>(mVersion, VtxDesc);
|
|
|
|
CreateCorruptionPasses(pMat->mpBloomMaterial, Intermediate, true);
|
|
|
|
CreateCorruptionPasses(pMat->mpBloomMaterial.get(), Intermediate, true);
|
|
|
|
return pMat;
|
|
|
|
return pMat;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -587,10 +587,10 @@ bool CMaterialLoader::SetupStaticDiffuseLightingStage(STevTracker& Tracker, CMat
|
|
|
|
EMP3MaterialOption::ForceLightingStage)
|
|
|
|
EMP3MaterialOption::ForceLightingStage)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
pMat->SetTevColor(Intermediate.GetCLR(ECLR::DIFB), kColor1Reg);
|
|
|
|
pMat->SetTevColor(Intermediate.GetCLR(ECLR::DIFB), kColor1Reg);
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
if (hasDIFFTexture)
|
|
|
|
if (hasDIFFTexture)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *Intermediate.GetPASS(EPASS::DIFF));
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *Intermediate.GetPASS(EPASS::DIFF));
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kTextureRGB, kColor1RGB, kRasRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kTextureRGB, kColor1RGB, kRasRGB);
|
|
|
|
pPass->SetColorOutput(kColor0Reg);
|
|
|
|
pPass->SetColorOutput(kColor0Reg);
|
|
|
|
if (FullAlpha)
|
|
|
|
if (FullAlpha)
|
|
|
@ -642,15 +642,15 @@ bool CMaterialLoader::SetupStaticDiffuseLightingStage(STevTracker& Tracker, CMat
|
|
|
|
pPass->SetRasSel(kRasColor0A0);
|
|
|
|
pPass->SetRasSel(kRasColor0A0);
|
|
|
|
Tracker.mStaticLightingAlphaSet = true;
|
|
|
|
Tracker.mStaticLightingAlphaSet = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMaterialLoader::SetupStaticDiffuseLightingNoBloomStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
void CMaterialLoader::SetupStaticDiffuseLightingNoBloomStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *Intermediate.GetPASS(EPASS::DIFF));
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *Intermediate.GetPASS(EPASS::DIFF));
|
|
|
|
|
|
|
|
|
|
|
|
pMat->SetTevColor(Intermediate.GetCLR(ECLR::DIFB), kColor1Reg);
|
|
|
|
pMat->SetTevColor(Intermediate.GetCLR(ECLR::DIFB), kColor1Reg);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kTextureRGB, kColor1RGB, kRasRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kTextureRGB, kColor1RGB, kRasRGB);
|
|
|
@ -661,14 +661,14 @@ void CMaterialLoader::SetupStaticDiffuseLightingNoBloomStage(STevTracker& Tracke
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetRasSel(kRasColor0A0);
|
|
|
|
pPass->SetRasSel(kRasColor0A0);
|
|
|
|
|
|
|
|
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMaterialLoader::SetupStaticDiffuseLightingNoBLOLStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
void CMaterialLoader::SetupStaticDiffuseLightingNoBLOLStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *Intermediate.GetPASS(EPASS::DIFF));
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *Intermediate.GetPASS(EPASS::DIFF));
|
|
|
|
|
|
|
|
|
|
|
|
pMat->SetTevColor(Intermediate.GetCLR(ECLR::DIFB), kColor1Reg);
|
|
|
|
pMat->SetTevColor(Intermediate.GetCLR(ECLR::DIFB), kColor1Reg);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kTextureRGB, kColor1RGB, kRasRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kTextureRGB, kColor1RGB, kRasRGB);
|
|
|
@ -693,15 +693,15 @@ void CMaterialLoader::SetupStaticDiffuseLightingNoBLOLStage(STevTracker& Tracker
|
|
|
|
Tracker.mStaticLightingAlphaSet = true;
|
|
|
|
Tracker.mStaticLightingAlphaSet = true;
|
|
|
|
pPass->SetRasSel(kRasColor0A0);
|
|
|
|
pPass->SetRasSel(kRasColor0A0);
|
|
|
|
|
|
|
|
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMaterialLoader::SetupColorTextureStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
void CMaterialLoader::SetupColorTextureStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
const SMP3IntermediateMaterial& Intermediate,
|
|
|
|
const SMP3IntermediateMaterial& Intermediate,
|
|
|
|
bool useStageAlpha, uint8 Alpha, bool StaticLighting)
|
|
|
|
bool useStageAlpha, uint8 Alpha, bool StaticLighting)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *Intermediate.GetPASS(EPASS::CLR));
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *Intermediate.GetPASS(EPASS::CLR));
|
|
|
|
|
|
|
|
|
|
|
|
bool useDynamicLightingAlpha = false;
|
|
|
|
bool useDynamicLightingAlpha = false;
|
|
|
|
pPass->SetColorInputs(kZeroRGB, StaticLighting ? kColor0RGB : kRasRGB, kTextureRGB, kZeroRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, StaticLighting ? kColor0RGB : kRasRGB, kTextureRGB, kZeroRGB);
|
|
|
@ -732,14 +732,14 @@ void CMaterialLoader::SetupColorTextureStage(STevTracker& Tracker, CMaterial* pM
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetRasSel((useDynamicLightingAlpha || !StaticLighting) ? kRasColor0A0 : kRasColorNull);
|
|
|
|
pPass->SetRasSel((useDynamicLightingAlpha || !StaticLighting) ? kRasColor0A0 : kRasColorNull);
|
|
|
|
|
|
|
|
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMaterialLoader::SetupColorTextureAlwaysStaticLightingStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
void CMaterialLoader::SetupColorTextureAlwaysStaticLightingStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *Intermediate.GetPASS(EPASS::CLR));
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *Intermediate.GetPASS(EPASS::CLR));
|
|
|
|
|
|
|
|
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kColor0RGB, kTextureRGB, kZeroRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kColor0RGB, kTextureRGB, kZeroRGB);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
@ -748,14 +748,14 @@ void CMaterialLoader::SetupColorTextureAlwaysStaticLightingStage(STevTracker& Tr
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
|
|
|
|
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMaterialLoader::SetupColorKColorStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
void CMaterialLoader::SetupColorKColorStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
const SMP3IntermediateMaterial& Intermediate,
|
|
|
|
const SMP3IntermediateMaterial& Intermediate,
|
|
|
|
bool useStageAlpha, uint8 Alpha, bool StaticLighting)
|
|
|
|
bool useStageAlpha, uint8 Alpha, bool StaticLighting)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
pPass->mPassType = "CLR ";
|
|
|
|
pPass->mPassType = "CLR ";
|
|
|
|
|
|
|
|
|
|
|
|
bool useDynamicLightingAlpha = false;
|
|
|
|
bool useDynamicLightingAlpha = false;
|
|
|
@ -782,15 +782,15 @@ void CMaterialLoader::SetupColorKColorStage(STevTracker& Tracker, CMaterial* pMa
|
|
|
|
pPass->SetRasSel((useDynamicLightingAlpha || !StaticLighting) ? kRasColor0A0 : kRasColorNull);
|
|
|
|
pPass->SetRasSel((useDynamicLightingAlpha || !StaticLighting) ? kRasColor0A0 : kRasColorNull);
|
|
|
|
Tracker.mCurKColor += 1;
|
|
|
|
Tracker.mCurKColor += 1;
|
|
|
|
|
|
|
|
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CMaterialLoader::SetupTransparencyStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
bool CMaterialLoader::SetupTransparencyStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (const auto& IntermediateTran = Intermediate.GetPASS(EPASS::TRAN)) {
|
|
|
|
if (const auto& IntermediateTran = Intermediate.GetPASS(EPASS::TRAN)) {
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateTran);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateTran);
|
|
|
|
|
|
|
|
|
|
|
|
if (IntermediateTran->mSettings & EPassSettings::InvertOpacityMap)
|
|
|
|
if (IntermediateTran->mSettings & EPassSettings::InvertOpacityMap)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -806,7 +806,7 @@ bool CMaterialLoader::SetupTransparencyStage(STevTracker& Tracker, CMaterial* pM
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateTran->GetSwapAlphaComp());
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateTran->GetSwapAlphaComp());
|
|
|
|
|
|
|
|
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -818,7 +818,7 @@ void CMaterialLoader::SetupTransparencyKAlphaMultiplyStage(STevTracker& Tracker,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (Intermediate.GetPASS(EPASS::CLR) || Intermediate.GetPASS(EPASS::TRAN))
|
|
|
|
if (Intermediate.GetPASS(EPASS::CLR) || Intermediate.GetPASS(EPASS::TRAN))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
ETevAlphaInput argA;
|
|
|
|
ETevAlphaInput argA;
|
|
|
|
if (Alpha < 255)
|
|
|
|
if (Alpha < 255)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -829,8 +829,8 @@ void CMaterialLoader::SetupTransparencyKAlphaMultiplyStage(STevTracker& Tracker,
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kPrevAlpha, kKonstAlpha, kZeroAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kPrevAlpha, kKonstAlpha, kZeroAlpha);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
pPass = new CMaterialPass(pMat);
|
|
|
|
pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
argA = kPrevAlpha;
|
|
|
|
argA = kPrevAlpha;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -862,21 +862,21 @@ void CMaterialLoader::SetupTransparencyKAlphaMultiplyStage(STevTracker& Tracker,
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
if (IntermediateTran)
|
|
|
|
if (IntermediateTran)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateTran);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateTran);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateTran->GetSwapAlphaComp());
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateTran->GetSwapAlphaComp());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *Intermediate.GetPASS(EPASS::CLR));
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *Intermediate.GetPASS(EPASS::CLR));
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Tracker.mCurKColor += 1;
|
|
|
|
Tracker.mCurKColor += 1;
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
pMat->SetKonst(CColor::Integral(255, 255, 255, Alpha), Tracker.mCurKColor);
|
|
|
|
pMat->SetKonst(CColor::Integral(255, 255, 255, Alpha), Tracker.mCurKColor);
|
|
|
|
pPass->SetKAlphaSel(ETevKSel(kKonst0_A + Tracker.mCurKColor));
|
|
|
|
pPass->SetKAlphaSel(ETevKSel(kKonst0_A + Tracker.mCurKColor));
|
|
|
|
if (multiplyPrevAlpha)
|
|
|
|
if (multiplyPrevAlpha)
|
|
|
@ -890,7 +890,7 @@ void CMaterialLoader::SetupTransparencyKAlphaMultiplyStage(STevTracker& Tracker,
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
Tracker.mCurKColor += 1;
|
|
|
|
Tracker.mCurKColor += 1;
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -901,8 +901,8 @@ bool CMaterialLoader::SetupReflectionAlphaStage(STevTracker& Tracker, CMaterial*
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (const auto& IntermediateRfld = Intermediate.GetPASS(EPASS::RFLD))
|
|
|
|
if (const auto& IntermediateRfld = Intermediate.GetPASS(EPASS::RFLD))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateRfld);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateRfld);
|
|
|
|
|
|
|
|
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kPrevRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kPrevRGB);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kPrevAlpha, kTextureAlpha, kZeroAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kPrevAlpha, kTextureAlpha, kZeroAlpha);
|
|
|
@ -911,7 +911,7 @@ bool CMaterialLoader::SetupReflectionAlphaStage(STevTracker& Tracker, CMaterial*
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetTexSwapComp(3, 'r');
|
|
|
|
pPass->SetTexSwapComp(3, 'r');
|
|
|
|
|
|
|
|
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -926,7 +926,7 @@ bool CMaterialLoader::SetupReflectionStages(STevTracker& Tracker, CMaterial* pMa
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
ETevColorInput argC = kOneRGB;
|
|
|
|
ETevColorInput argC = kOneRGB;
|
|
|
|
if (Intermediate.GetPASS(EPASS::RFLV) || Intermediate.GetPASS(EPASS::LRLD) || Intermediate.GetPASS(EPASS::LURD)) {
|
|
|
|
if (Intermediate.GetPASS(EPASS::RFLV) || Intermediate.GetPASS(EPASS::LRLD) || Intermediate.GetPASS(EPASS::LURD)) {
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
pPass->SetColorOutput(kColor2Reg);
|
|
|
|
pPass->SetColorOutput(kColor2Reg);
|
|
|
|
pPass->SetAlphaOutput(kColor2Reg);
|
|
|
|
pPass->SetAlphaOutput(kColor2Reg);
|
|
|
|
if (const auto& IntermediateRflv = Intermediate.GetPASS(EPASS::RFLV))
|
|
|
|
if (const auto& IntermediateRflv = Intermediate.GetPASS(EPASS::RFLV))
|
|
|
@ -934,49 +934,49 @@ bool CMaterialLoader::SetupReflectionStages(STevTracker& Tracker, CMaterial* pMa
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kTextureRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kTextureRGB);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kZeroAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kZeroAlpha);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateRflv);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateRflv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (const auto& IntermediateLrld = Intermediate.GetPASS(EPASS::LRLD))
|
|
|
|
else if (const auto& IntermediateLrld = Intermediate.GetPASS(EPASS::LRLD))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pPass->SetColorInputs(kZeroRGB, StaticLighting ? kColor0RGB : kRasRGB, kTextureRGB, kZeroRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, StaticLighting ? kColor0RGB : kRasRGB, kTextureRGB, kZeroRGB);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kZeroAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kZeroAlpha);
|
|
|
|
pPass->SetRasSel(StaticLighting ? kRasColorNull : kRasColor0A0);
|
|
|
|
pPass->SetRasSel(StaticLighting ? kRasColorNull : kRasColor0A0);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateLrld);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateLrld);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (const auto& IntermediateLurd = Intermediate.GetPASS(EPASS::LURD))
|
|
|
|
else if (const auto& IntermediateLurd = Intermediate.GetPASS(EPASS::LURD))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pPass->SetColorInputs(kZeroRGB, StaticLighting ? kColor0RGB : kRasRGB, kTextureAAA, kTextureRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, StaticLighting ? kColor0RGB : kRasRGB, kTextureAAA, kTextureRGB);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kZeroAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kZeroAlpha);
|
|
|
|
pPass->SetRasSel(StaticLighting ? kRasColorNull : kRasColor0A0);
|
|
|
|
pPass->SetRasSel(StaticLighting ? kRasColorNull : kRasColor0A0);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateLurd);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateLurd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
argC = kColor2RGB;
|
|
|
|
argC = kColor2RGB;
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (const auto& IntermediateRfld = Intermediate.GetPASS(EPASS::RFLD))
|
|
|
|
if (const auto& IntermediateRfld = Intermediate.GetPASS(EPASS::RFLD))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kTextureRGB, argC, argD);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kTextureRGB, argC, argD);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateRfld);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateRfld);
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CMaterialLoader::SetupQuantizedKAlphaAdd(STevTracker& Tracker, CMaterial* pMat, uint8 Value)
|
|
|
|
bool CMaterialLoader::SetupQuantizedKAlphaAdd(STevTracker& Tracker, CMaterial* pMat, uint8 Value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kPrevRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kPrevRGB);
|
|
|
|
pPass->SetKAlphaSel(KColorEighths[Value / 32]);
|
|
|
|
pPass->SetKAlphaSel(KColorEighths[Value / 32]);
|
|
|
|
pPass->SetAlphaInputs(kKonstAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
|
|
|
pPass->SetAlphaInputs(kKonstAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -993,8 +993,8 @@ bool CMaterialLoader::SetupIncandecenceStage(STevTracker& Tracker, CMaterial* pM
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateInca);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateInca);
|
|
|
|
|
|
|
|
|
|
|
|
pPass->SetKColorSel(kKonstOne);
|
|
|
|
pPass->SetKColorSel(kKonstOne);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kKonstRGB, kTextureRGB, kPrevRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kKonstRGB, kTextureRGB, kPrevRGB);
|
|
|
@ -1006,7 +1006,7 @@ bool CMaterialLoader::SetupIncandecenceStage(STevTracker& Tracker, CMaterial* pM
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateInca->GetSwapAlphaComp());
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateInca->GetSwapAlphaComp());
|
|
|
|
pPass->SetKAlphaSel(KColorEighths[Intermediate.GetINT(EINT::BNIF) / 32]);
|
|
|
|
pPass->SetKAlphaSel(KColorEighths[Intermediate.GetINT(EINT::BNIF) / 32]);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kTextureAlpha, kKonstAlpha, kPrevAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kTextureAlpha, kKonstAlpha, kPrevAlpha);
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
if (bloi)
|
|
|
|
if (bloi)
|
|
|
|
SetupQuantizedKAlphaAdd(Tracker, pMat, bloi);
|
|
|
|
SetupQuantizedKAlphaAdd(Tracker, pMat, bloi);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1021,7 +1021,7 @@ bool CMaterialLoader::SetupIncandecenceStage(STevTracker& Tracker, CMaterial* pM
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1033,8 +1033,8 @@ bool CMaterialLoader::SetupIncandecenceStageNoBloom(STevTracker& Tracker, CMater
|
|
|
|
if (!IntermediateInca)
|
|
|
|
if (!IntermediateInca)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateInca);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateInca);
|
|
|
|
|
|
|
|
|
|
|
|
pPass->SetKColorSel(kKonstOne);
|
|
|
|
pPass->SetKColorSel(kKonstOne);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kKonstRGB, kTextureRGB, kPrevRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kKonstRGB, kTextureRGB, kPrevRGB);
|
|
|
@ -1042,7 +1042,7 @@ bool CMaterialLoader::SetupIncandecenceStageNoBloom(STevTracker& Tracker, CMater
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1057,21 +1057,21 @@ bool CMaterialLoader::SetupStartingIncandecenceStage(STevTracker& Tracker, CMate
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bloi)
|
|
|
|
if (bloi)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kZeroRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kZeroRGB);
|
|
|
|
pPass->SetKAlphaSel(KColorEighths[bloi / 32]);
|
|
|
|
pPass->SetKAlphaSel(KColorEighths[bloi / 32]);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kKonstAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kKonstAlpha);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateInca);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateInca);
|
|
|
|
|
|
|
|
|
|
|
|
pPass->SetKColorSel(kKonstOne);
|
|
|
|
pPass->SetKColorSel(kKonstOne);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kTextureRGB, kKonstRGB, kZeroRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kTextureRGB, kKonstRGB, kZeroRGB);
|
|
|
@ -1106,7 +1106,7 @@ bool CMaterialLoader::SetupStartingIncandecenceStage(STevTracker& Tracker, CMate
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
if (needsBloiAdd)
|
|
|
|
if (needsBloiAdd)
|
|
|
|
SetupQuantizedKAlphaAdd(Tracker, pMat, bloi);
|
|
|
|
SetupQuantizedKAlphaAdd(Tracker, pMat, bloi);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
@ -1115,8 +1115,8 @@ bool CMaterialLoader::SetupStartingIncandecenceStage(STevTracker& Tracker, CMate
|
|
|
|
void CMaterialLoader::SetupStartingIncandecenceDynamicKColorStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
void CMaterialLoader::SetupStartingIncandecenceDynamicKColorStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *Intermediate.GetPASS(EPASS::INCA));
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *Intermediate.GetPASS(EPASS::INCA));
|
|
|
|
|
|
|
|
|
|
|
|
pPass->SetKColorSel(kKonstOne);
|
|
|
|
pPass->SetKColorSel(kKonstOne);
|
|
|
|
pPass->SetKAlphaSel(kKonstOne);
|
|
|
|
pPass->SetKAlphaSel(kKonstOne);
|
|
|
@ -1126,7 +1126,7 @@ void CMaterialLoader::SetupStartingIncandecenceDynamicKColorStage(STevTracker& T
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
|
|
|
|
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CMaterialLoader::SetupStaticBloomLightingStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
|
bool CMaterialLoader::SetupStaticBloomLightingStage(STevTracker& Tracker, CMaterial* pMat,
|
|
|
@ -1135,8 +1135,8 @@ bool CMaterialLoader::SetupStaticBloomLightingStage(STevTracker& Tracker, CMater
|
|
|
|
const auto& IntermediateBlol = Intermediate.GetPASS(EPASS::BLOL);
|
|
|
|
const auto& IntermediateBlol = Intermediate.GetPASS(EPASS::BLOL);
|
|
|
|
if (!StaticLighting || !IntermediateBlol)
|
|
|
|
if (!StaticLighting || !IntermediateBlol)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateBlol);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateBlol);
|
|
|
|
|
|
|
|
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateBlol->GetSwapAlphaComp());
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateBlol->GetSwapAlphaComp());
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
@ -1145,7 +1145,7 @@ bool CMaterialLoader::SetupStaticBloomLightingStage(STevTracker& Tracker, CMater
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kPrevAlpha, kTextureAlpha, kZeroAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kPrevAlpha, kTextureAlpha, kZeroAlpha);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
|
|
|
|
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1153,14 +1153,14 @@ bool CMaterialLoader::SetupStaticBloomLightingA1Stages(STevTracker& Tracker, CMa
|
|
|
|
const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const auto& IntermediateBlol = Intermediate.GetPASS(EPASS::BLOL);
|
|
|
|
const auto& IntermediateBlol = Intermediate.GetPASS(EPASS::BLOL);
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
|
|
|
|
|
|
|
|
ETevAlphaInput argC = IntermediateBlol ? kTextureAlpha : kZeroAlpha;
|
|
|
|
ETevAlphaInput argC = IntermediateBlol ? kTextureAlpha : kZeroAlpha;
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kColor1Alpha, argC, kRasAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kColor1Alpha, argC, kRasAlpha);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
if (argC == kTextureAlpha) {
|
|
|
|
if (argC == kTextureAlpha) {
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateBlol->GetSwapAlphaComp());
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateBlol->GetSwapAlphaComp());
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateBlol);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateBlol);
|
|
|
|
pPass->SetRasSel(kRasColor0A0);
|
|
|
|
pPass->SetRasSel(kRasColor0A0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -1168,7 +1168,7 @@ bool CMaterialLoader::SetupStaticBloomLightingA1Stages(STevTracker& Tracker, CMa
|
|
|
|
pPass->SetRasSel(kRasColor0A0);
|
|
|
|
pPass->SetRasSel(kRasColor0A0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Tracker.mStaticLightingAlphaSet = true;
|
|
|
|
Tracker.mStaticLightingAlphaSet = true;
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
SetupStaticBloomDiffuseLightingStages(Tracker, pMat, Intermediate, true);
|
|
|
|
SetupStaticBloomDiffuseLightingStages(Tracker, pMat, Intermediate, true);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1191,8 +1191,8 @@ bool CMaterialLoader::SetupStaticBloomDiffuseLightingStages(STevTracker& Tracker
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateBlod);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateBlod);
|
|
|
|
|
|
|
|
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateBlod->GetSwapAlphaComp());
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateBlod->GetSwapAlphaComp());
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
@ -1224,14 +1224,14 @@ bool CMaterialLoader::SetupStaticBloomDiffuseLightingStages(STevTracker& Tracker
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kPrevAlpha, kTextureAlpha, kZeroAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kPrevAlpha, kTextureAlpha, kZeroAlpha);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pPass->SetRasSel(argC == kRasAlpha ? kRasColor0A0 : kRasColorNull);
|
|
|
|
pPass->SetRasSel(argC == kRasAlpha ? kRasColor0A0 : kRasColorNull);
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
ret = true;
|
|
|
|
ret = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (useDynamicAlpha)
|
|
|
|
if (useDynamicAlpha)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (Intermediate.GetINT(EINT::BLOD) != 255)
|
|
|
|
if (Intermediate.GetINT(EINT::BLOD) != 255)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
|
|
|
|
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
@ -1249,7 +1249,7 @@ bool CMaterialLoader::SetupStaticBloomDiffuseLightingStages(STevTracker& Tracker
|
|
|
|
pPass->SetRasSel(argB == kPrevAlpha ? kRasColor0A0 : kRasColorNull);
|
|
|
|
pPass->SetRasSel(argB == kPrevAlpha ? kRasColor0A0 : kRasColorNull);
|
|
|
|
Tracker.mStaticLightingAlphaSet = true;
|
|
|
|
Tracker.mStaticLightingAlphaSet = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
ret = true;
|
|
|
|
ret = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Tracker.mStaticDiffuseLightingAlphaSet = true;
|
|
|
|
Tracker.mStaticDiffuseLightingAlphaSet = true;
|
|
|
@ -1263,8 +1263,8 @@ bool CMaterialLoader::SetupStaticBloomIncandecenceLightingStage(STevTracker& Tra
|
|
|
|
const auto& IntermediateBloi = Intermediate.GetPASS(EPASS::BLOI);
|
|
|
|
const auto& IntermediateBloi = Intermediate.GetPASS(EPASS::BLOI);
|
|
|
|
if (!IntermediateBloi)
|
|
|
|
if (!IntermediateBloi)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass, *IntermediateBloi);
|
|
|
|
SetMP3IntermediateIntoMaterialPass(pPass.get(), *IntermediateBloi);
|
|
|
|
|
|
|
|
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kPrevRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kPrevRGB);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
@ -1273,7 +1273,7 @@ bool CMaterialLoader::SetupStaticBloomIncandecenceLightingStage(STevTracker& Tra
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateBloi->GetSwapAlphaComp());
|
|
|
|
pPass->SetTexSwapComp(3, IntermediateBloi->GetSwapAlphaComp());
|
|
|
|
pPass->SetAlphaInputs(kTextureAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
|
|
|
pPass->SetAlphaInputs(kTextureAlpha, kZeroAlpha, kZeroAlpha, kPrevAlpha);
|
|
|
|
|
|
|
|
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1304,9 +1304,8 @@ void CMaterialLoader::SetupNoBloomAdditiveIncandecence(CMaterial* pMat, const SM
|
|
|
|
uint8 Alpha)
|
|
|
|
uint8 Alpha)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SetupNoBloomTransparent(pMat, Intermediate, Alpha);
|
|
|
|
SetupNoBloomTransparent(pMat, Intermediate, Alpha);
|
|
|
|
CMaterial* pMatNext = new CMaterial(pMat->Version(), pMat->VtxDesc());
|
|
|
|
pMat->mpNextDrawPassMaterial = std::make_unique<CMaterial>(pMat->Version(), pMat->VtxDesc());
|
|
|
|
pMat->mpNextDrawPassMaterial = pMatNext;
|
|
|
|
pMat = pMat->mpNextDrawPassMaterial.get();
|
|
|
|
pMat = pMatNext;
|
|
|
|
|
|
|
|
STevTracker Tracker;
|
|
|
|
STevTracker Tracker;
|
|
|
|
SetupStartingIncandecenceDynamicKColorStage(Tracker, pMat, Intermediate);
|
|
|
|
SetupStartingIncandecenceDynamicKColorStage(Tracker, pMat, Intermediate);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::DepthWrite, false);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::DepthWrite, false);
|
|
|
@ -1381,8 +1380,8 @@ void CMaterialLoader::SetupAdditiveIncandecenceOnly(CMaterial* pMat,
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::Transparent, true);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::Transparent, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMaterialLoader::SetupFullRenderTransparent(CMaterial* pMat, const SMP3IntermediateMaterial& Intermediate,
|
|
|
|
CMaterial* CMaterialLoader::SetupFullRenderTransparent(
|
|
|
|
uint8 Alpha)
|
|
|
|
CMaterial* pMat, const SMP3IntermediateMaterial& Intermediate, uint8 Alpha)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
STevTracker Tracker;
|
|
|
|
STevTracker Tracker;
|
|
|
|
bool StaticLighting = SetupStaticDiffuseLightingStage(Tracker, pMat, Intermediate, true);
|
|
|
|
bool StaticLighting = SetupStaticDiffuseLightingStage(Tracker, pMat, Intermediate, true);
|
|
|
@ -1403,9 +1402,8 @@ void CMaterialLoader::SetupFullRenderTransparent(CMaterial* pMat, const SMP3Inte
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::Transparent, true);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::Transparent, true);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::AlphaWrite, false);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::AlphaWrite, false);
|
|
|
|
|
|
|
|
|
|
|
|
CMaterial* pMatNext = new CMaterial(pMat->Version(), pMat->VtxDesc());
|
|
|
|
pMat->mpNextDrawPassMaterial = std::make_unique<CMaterial>(pMat->Version(), pMat->VtxDesc());
|
|
|
|
pMat->mpNextDrawPassMaterial = pMatNext;
|
|
|
|
pMat = pMat->mpNextDrawPassMaterial.get();
|
|
|
|
pMat = pMatNext;
|
|
|
|
|
|
|
|
Tracker = STevTracker();
|
|
|
|
Tracker = STevTracker();
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::AlphaWrite, true);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::AlphaWrite, true);
|
|
|
|
SetupTransparencyKAlphaMultiplyStage(Tracker, pMat, Intermediate, false, Alpha);
|
|
|
|
SetupTransparencyKAlphaMultiplyStage(Tracker, pMat, Intermediate, false, Alpha);
|
|
|
@ -1415,9 +1413,8 @@ void CMaterialLoader::SetupFullRenderTransparent(CMaterial* pMat, const SMP3Inte
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::Transparent, true);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::Transparent, true);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::ColorWrite, false);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::ColorWrite, false);
|
|
|
|
|
|
|
|
|
|
|
|
pMatNext = new CMaterial(pMat->Version(), pMat->VtxDesc());
|
|
|
|
pMat->mpNextDrawPassMaterial = std::make_unique<CMaterial>(pMat->Version(), pMat->VtxDesc());
|
|
|
|
pMat->mpNextDrawPassMaterial = pMatNext;
|
|
|
|
pMat = pMat->mpNextDrawPassMaterial.get();
|
|
|
|
pMat = pMatNext;
|
|
|
|
|
|
|
|
Tracker = STevTracker();
|
|
|
|
Tracker = STevTracker();
|
|
|
|
if (SetupStaticBloomLightingA1Stages(Tracker, pMat, Intermediate))
|
|
|
|
if (SetupStaticBloomLightingA1Stages(Tracker, pMat, Intermediate))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1428,16 +1425,17 @@ void CMaterialLoader::SetupFullRenderTransparent(CMaterial* pMat, const SMP3Inte
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::Transparent, true);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::Transparent, true);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::ColorWrite, true);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::ColorWrite, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return pMat;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMaterialLoader::SetupFullRenderTransparentAdditiveIncandecence(CMaterial* pMat,
|
|
|
|
void CMaterialLoader::SetupFullRenderTransparentAdditiveIncandecence(CMaterial* pMat,
|
|
|
|
const SMP3IntermediateMaterial& Intermediate,
|
|
|
|
const SMP3IntermediateMaterial& Intermediate,
|
|
|
|
uint8 Alpha)
|
|
|
|
uint8 Alpha)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SetupFullRenderTransparent(pMat, Intermediate, Alpha);
|
|
|
|
pMat = SetupFullRenderTransparent(pMat, Intermediate, Alpha);
|
|
|
|
CMaterial* pMatNext = new CMaterial(pMat->Version(), pMat->VtxDesc());
|
|
|
|
pMat->mpNextDrawPassMaterial = std::make_unique<CMaterial>(pMat->Version(), pMat->VtxDesc());
|
|
|
|
pMat->mpNextDrawPassMaterial = pMatNext;
|
|
|
|
pMat = pMat->mpNextDrawPassMaterial.get();
|
|
|
|
pMat = pMatNext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
STevTracker Tracker;
|
|
|
|
STevTracker Tracker;
|
|
|
|
SetupStartingIncandecenceStage(Tracker, pMat, Intermediate);
|
|
|
|
SetupStartingIncandecenceStage(Tracker, pMat, Intermediate);
|
|
|
@ -1473,13 +1471,13 @@ void CMaterialLoader::SetupMaterialAlphaCompare(CMaterial* pMat, const SMP3Inter
|
|
|
|
|
|
|
|
|
|
|
|
void CMaterialLoader::SetupSolidWhite(CMaterial* pMat, const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
void CMaterialLoader::SetupSolidWhite(CMaterial* pMat, const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kOneRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kZeroRGB, kZeroRGB, kOneRGB);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kZeroAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kZeroAlpha);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::DepthWrite, false);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::DepthWrite, false);
|
|
|
|
pMat->SetBlendMode(GL_ONE, GL_ZERO);
|
|
|
|
pMat->SetBlendMode(GL_ONE, GL_ZERO);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::Transparent, false);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::Transparent, false);
|
|
|
@ -1488,7 +1486,7 @@ void CMaterialLoader::SetupSolidWhite(CMaterial* pMat, const SMP3IntermediateMat
|
|
|
|
|
|
|
|
|
|
|
|
void CMaterialLoader::SetupSolidKColorKAlpha(CMaterial* pMat, const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
void CMaterialLoader::SetupSolidKColorKAlpha(CMaterial* pMat, const SMP3IntermediateMaterial& Intermediate)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterialPass* pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat);
|
|
|
|
pMat->SetKonst(Intermediate.GetCLR(ECLR::CLR), 0);
|
|
|
|
pMat->SetKonst(Intermediate.GetCLR(ECLR::CLR), 0);
|
|
|
|
pPass->SetKColorSel(kKonst0_RGB);
|
|
|
|
pPass->SetKColorSel(kKonst0_RGB);
|
|
|
|
pPass->SetKAlphaSel(kKonst0_A);
|
|
|
|
pPass->SetKAlphaSel(kKonst0_A);
|
|
|
@ -1497,7 +1495,7 @@ void CMaterialLoader::SetupSolidKColorKAlpha(CMaterial* pMat, const SMP3Intermed
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetColorOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetAlphaOutput(kPrevReg);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pPass->SetRasSel(kRasColorNull);
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::DepthWrite, false);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::DepthWrite, false);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::Masked, false);
|
|
|
|
pMat->mOptions.AssignFlag(EMaterialOption::Masked, false);
|
|
|
|
pMat->SetBlendMode(GL_SRC_ALPHA, GL_ONE);
|
|
|
|
pMat->SetBlendMode(GL_SRC_ALPHA, GL_ONE);
|
|
|
@ -1543,24 +1541,24 @@ void CMaterialLoader::CreateCorruptionPasses(CMaterial* pMat, const SMP3Intermed
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CMaterial* CMaterialLoader::LoadAssimpMaterial(const aiMaterial *pAiMat)
|
|
|
|
std::unique_ptr<CMaterial> CMaterialLoader::LoadAssimpMaterial(const aiMaterial *pAiMat)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// todo: generate new material using import values.
|
|
|
|
// todo: generate new material using import values.
|
|
|
|
CMaterial *pMat = new CMaterial(mVersion, EVertexAttribute::None);
|
|
|
|
auto pMat = std::make_unique<CMaterial>(mVersion, EVertexAttribute::None);
|
|
|
|
|
|
|
|
|
|
|
|
aiString Name;
|
|
|
|
aiString Name;
|
|
|
|
pAiMat->Get(AI_MATKEY_NAME, Name);
|
|
|
|
pAiMat->Get(AI_MATKEY_NAME, Name);
|
|
|
|
pMat->SetName(Name.C_Str());
|
|
|
|
pMat->SetName(Name.C_Str());
|
|
|
|
|
|
|
|
|
|
|
|
// Create generic custom pass that uses Konst color
|
|
|
|
// Create generic custom pass that uses Konst color
|
|
|
|
CMaterialPass *pPass = new CMaterialPass(pMat);
|
|
|
|
auto pPass = std::make_unique<CMaterialPass>(pMat.get());
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kRasRGB, kKonstRGB, kZeroRGB);
|
|
|
|
pPass->SetColorInputs(kZeroRGB, kRasRGB, kKonstRGB, kZeroRGB);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kKonstAlpha);
|
|
|
|
pPass->SetAlphaInputs(kZeroAlpha, kZeroAlpha, kZeroAlpha, kKonstAlpha);
|
|
|
|
pPass->SetKColorSel(kKonst0_RGB);
|
|
|
|
pPass->SetKColorSel(kKonst0_RGB);
|
|
|
|
pPass->SetKAlphaSel(kKonstOne);
|
|
|
|
pPass->SetKAlphaSel(kKonstOne);
|
|
|
|
pPass->SetRasSel(kRasColor0A0);
|
|
|
|
pPass->SetRasSel(kRasColor0A0);
|
|
|
|
pMat->mKonstColors[0] = CColor::RandomLightColor(false);
|
|
|
|
pMat->mKonstColors[0] = CColor::RandomLightColor(false);
|
|
|
|
pMat->mPasses.push_back(pPass);
|
|
|
|
pMat->mPasses.push_back(std::move(pPass));
|
|
|
|
|
|
|
|
|
|
|
|
return pMat;
|
|
|
|
return pMat;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1591,8 +1589,7 @@ CMaterialSet* CMaterialLoader::ImportAssimpMaterials(const aiScene *pScene, EGam
|
|
|
|
|
|
|
|
|
|
|
|
for (uint32 iMat = 0; iMat < pScene->mNumMaterials; iMat++)
|
|
|
|
for (uint32 iMat = 0; iMat < pScene->mNumMaterials; iMat++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CMaterial *pMat = Loader.LoadAssimpMaterial(pScene->mMaterials[iMat]);
|
|
|
|
pOut->mMaterials.push_back(Loader.LoadAssimpMaterial(pScene->mMaterials[iMat]));
|
|
|
|
pOut->mMaterials.push_back(pMat);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return pOut;
|
|
|
|
return pOut;
|
|
|
|