2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-10 06:27:43 +00:00

Work on CMorphBallShadow

This commit is contained in:
Jack Andersen
2017-03-04 21:57:12 -10:00
parent 52fe795407
commit 8ef9ed2c3b
23 changed files with 509 additions and 132 deletions

View File

@@ -71,6 +71,35 @@ static const char* ThermalPostHLSL =
"}\n"
"\n";
static const char* SolidPostHLSL =
"cbuffer SolidUniform : register(b2)\n"
"{\n"
" float4 solidColor;\n"
"};\n"
"static float4 SolidPostFunc(float4 colorIn)\n"
"{\n"
" return solidColor;\n"
"}\n"
"\n";
static const char* MBShadowPostHLSL =
"cbuffer MBShadowUniform : register(b2)\n"
"{\n"
" float4 shadowUp;\n"
" float shadowId;\n"
"};\n"
"static float4 MBShadowPostFunc(float4 colorIn)\n"
"{\n"
" float idTexel = extTex0.Sample(samp, vtf.extTcgs[0]).a;\n"
" float sphereTexel = extTex1.Sample(samp, vtf.extTcgs[1]).a;\n"
" float fadeTexel = extTex2.Sample(samp, vtf.extTcgs[2]).a;\n"
" float val = ((abs(idTexel - shadowId) < 0.001) ?\n"
" (dot(vtf.mvNorm.xyz, shadowUp.xyz) * shadowUp.w) : 0.0) *\n"
" sphereTexel * fadeTexel;\n"
" return float4(0.0, 0.0, 0.0, val);\n"
"}\n"
"\n";
hecl::Runtime::ShaderCacheExtensions
CModelShaders::GetShaderExtensionsHLSL(boo::IGraphicsDataFactory::Platform plat)
{
@@ -96,6 +125,17 @@ CModelShaders::GetShaderExtensionsHLSL(boo::IGraphicsDataFactory::Platform plat)
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
hecl::Backend::BlendFactor::One);
/* Solid shading */
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
hecl::Backend::BlendFactor::Zero);
/* Solid shading */
ext.registerExtensionSlot({}, {MBShadowPostHLSL, "MBShadowPostFunc"},
0, nullptr, 3, BallFadeTextures,
hecl::Backend::BlendFactor::SrcAlpha,
hecl::Backend::BlendFactor::InvSrcAlpha);
return ext;
}