2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 15:04:56 +00:00

Thermal visor fixes

This commit is contained in:
Jack Andersen
2019-02-24 22:14:59 -10:00
parent 5ebf465a53
commit 67b9882dbe
14 changed files with 36 additions and 15 deletions

View File

@@ -1111,9 +1111,13 @@ void CBooRenderer::DoThermalBlendCold() {
m_thermColdFilter->draw();
CElementGen::SetMoveRedToAlphaBuffer(true);
CDecal::SetMoveRedToAlphaBuffer(true);
m_thermalHotPass = true;
}
void CBooRenderer::DoThermalBlendHot() { m_thermHotFilter->draw(); }
void CBooRenderer::DoThermalBlendHot() {
m_thermHotFilter->draw();
m_thermalHotPass = false;
}
u32 CBooRenderer::GetStaticWorldDataSize() { return 0; }

View File

@@ -160,6 +160,7 @@ class CBooRenderer final : public IRenderer {
bool x318_29_thermalVisor : 1;
bool x318_30_inAreaDraw : 1;
bool x318_31_persistRGBA6 : 1;
bool m_thermalHotPass : 1;
};
u16 dummy = 0;
};
@@ -294,6 +295,7 @@ public:
float alpha) const;
bool IsThermalVisorActive() const { return x318_29_thermalVisor; }
bool IsThermalVisorHotPass() const { return m_thermalHotPass; }
};
} // namespace urde

View File

@@ -35,6 +35,8 @@ struct CModelFlags {
CModelFlags(u8 blendMode, u8 shadIdx, u16 flags, const zeus::CColor& col)
: x0_blendMode(blendMode), x1_matSetIdx(shadIdx), x2_flags(flags), x4_color(col) {
/* Blend mode will override this if the surface's original material is opaque */
m_noZWrite = !(x2_flags & 0x2);
m_depthGreater = (x2_flags & 0x8);
}
/* Flags

View File

@@ -530,7 +530,9 @@ static EExtendedShader ResolveExtendedShader(const MaterialSet::Material& data,
EExtendedShader extended = EExtendedShader::Flat;
if (flags.m_extendedShader == EExtendedShader::Lighting) {
/* Transform lighting into thermal cold if the thermal visor is active */
if (g_Renderer->IsThermalVisorActive())
if (g_Renderer->IsThermalVisorHotPass())
return EExtendedShader::LightingAlphaWrite;
else if (g_Renderer->IsThermalVisorActive())
return EExtendedShader::ThermalCold;
if (data.heclIr.m_blendSrc == boo::BlendFactor::One && data.heclIr.m_blendDst == boo::BlendFactor::Zero) {
/* Override shader if originally opaque (typical for FRME models) */

View File

@@ -91,7 +91,7 @@ static hecl::Backend::ExtensionSlot g_ExtensionSlots[] = {
hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface, false, false, true},
/* Forced additive shading */
{1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::One,
hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface, true, false, true},
hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface, false, false, true},
/* Solid color */
{1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::One, hecl::Backend::BlendFactor::Zero,
hecl::Backend::ZTest::LEqual, hecl::Backend::CullMode::Backface, false, false, false},
@@ -148,7 +148,10 @@ static hecl::Backend::ExtensionSlot g_ExtensionSlots[] = {
/* Thermal cold shading */
{1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original,
hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Original,
false, false, true, false, false, false, true}};
false, false, true, false, false, false, true},
/* Normal lit shading with alpha */
{1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original,
hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface}};
extern const hecl::Backend::Function ExtensionLightingFuncsGLSL[];
extern const hecl::Backend::Function ExtensionPostFuncsGLSL[];

View File

@@ -36,6 +36,7 @@ enum EExtendedShader : uint8_t {
Disintegrate,
ForcedAdditiveNoZWriteDepthGreater,
ThermalCold,
LightingAlphaWrite,
MAX
};

View File

@@ -252,6 +252,7 @@ const hecl::Backend::Function ExtensionLightingFuncsGLSL[] = {
{},
{LightingGLSL, "LightingFunc"},
{},
{LightingGLSL, "LightingFunc"},
};
const hecl::Backend::Function ExtensionPostFuncsGLSL[] = {
@@ -278,6 +279,7 @@ const hecl::Backend::Function ExtensionPostFuncsGLSL[] = {
{DisintegratePostGLSL, "DisintegratePostFunc"},
{MainPostGLSL, "MainPostFunc"},
{ThermalColdPostGLSL, "ThermalColdPostFunc"},
{MainPostGLSL, "MainPostFunc"},
};
} // namespace urde

View File

@@ -243,7 +243,8 @@ const hecl::Backend::Function ExtensionLightingFuncsHLSL[] = {{},
{LightingHLSL, "LightingFunc"},
{},
{LightingHLSL, "LightingFunc"},
{}};
{},
{LightingHLSL, "LightingFunc"},};
const hecl::Backend::Function ExtensionPostFuncsHLSL[] = {
{},
@@ -269,6 +270,7 @@ const hecl::Backend::Function ExtensionPostFuncsHLSL[] = {
{DisintegratePostHLSL, "DisintegratePostFunc"},
{MainPostHLSL, "MainPostFunc"},
{ThermalColdPostHLSL, "ThermalColdPostFunc"},
{MainPostHLSL, "MainPostFunc"},
};
} // namespace urde

View File

@@ -248,7 +248,8 @@ const hecl::Backend::Function ExtensionLightingFuncsMetal[] = {{},
{LightingMetal, "LightingFunc"},
{},
{LightingMetal, "LightingFunc"},
{}};
{},
{LightingMetal, "LightingFunc"},};
const hecl::Backend::Function ExtensionPostFuncsMetal[] = {
{},
@@ -274,6 +275,7 @@ const hecl::Backend::Function ExtensionPostFuncsMetal[] = {
{DisintegratePostMetal, "EXTDisintegratePostFunc"},
{MainPostMetal, "MainPostFunc"},
{ThermalColdPostMetal, "ThermalColdPostFunc"},
{MainPostMetal, "MainPostFunc"},
};
} // namespace urde