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

Various bug fixes

This commit is contained in:
Jack Andersen
2018-05-26 18:22:38 -10:00
parent 92ed463051
commit cc6d79e280
25 changed files with 182 additions and 46 deletions

View File

@@ -14,6 +14,7 @@ static const char* LightingHLSL =
"};\n"
"struct Fog\n"
"{\n"
" uint mode;\n"
" float4 color;\n"
" float rangeScale;\n"
" float start;\n"
@@ -62,6 +63,7 @@ static const char* LightingShadowHLSL =
"};\n"
"struct Fog\n"
"{\n"
" uint mode;\n"
" float4 color;\n"
" float rangeScale;\n"
" float start;\n"
@@ -114,8 +116,31 @@ static const char* LightingShadowHLSL =
static const char* MainPostHLSL =
"static float4 MainPostFunc(in VertToFrag vtf, float4 colorIn)\n"
"{\n"
" float fogZ = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n"
" return lerp(fog.color, colorIn, saturate(exp2(-8.0 * fogZ)));\n"
" float fogZ, temp;\n"
" switch (fog.mode)\n"
" {\n"
" case 2:\n"
" fogZ = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n"
" break;\n"
" case 4:\n"
" fogZ = 1.0 - exp2(-8.0 * (-vtf.mvPos.z - fog.start) * fog.rangeScale);\n"
" break;\n"
" case 5:\n"
" temp = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n"
" fogZ = 1.0 - exp2(-8.0 * temp * temp);\n"
" break;\n"
" case 6:\n"
" fogZ = exp2(-8.0 * (fog.start + vtf.mvPos.z) * fog.rangeScale);\n"
" break;\n"
" case 7:\n"
" temp = (fog.start + vtf.mvPos.z) * fog.rangeScale;\n"
" fogZ = exp2(-8.0 * temp * temp);\n"
" break;\n"
" default:\n"
" fogZ = 0.0;\n"
" break;\n"
" }\n"
" return lerp(colorIn, fog.color, saturate(fogZ));\n"
"}\n"
"\n";