2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-13 06:46:10 +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

@@ -15,6 +15,7 @@ static const char* LightingGLSL =
"};\n"
"struct Fog\n"
"{\n"
" uint mode;\n"
" vec4 color;\n"
" float rangeScale;\n"
" float start;\n"
@@ -63,6 +64,7 @@ static const char* LightingShadowGLSL =
"};\n"
"struct Fog\n"
"{\n"
" uint mode;\n"
" vec4 color;\n"
" float rangeScale;\n"
" float start;\n"
@@ -118,8 +120,31 @@ static const char* LightingShadowGLSL =
static const char* MainPostGLSL =
"vec4 MainPostFunc(vec4 colorIn)\n"
"{\n"
" float fogZ = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n"
" return mix(fog.color, colorIn, clamp(exp2(-8.0 * fogZ), 0.0, 1.0));\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 mix(colorIn, fog.color, clamp(fogZ, 0.0, 1.0));\n"
"}\n"
"\n";