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:
@@ -14,6 +14,7 @@ static const char* LightingMetal =
|
||||
"};\n"
|
||||
"struct Fog\n"
|
||||
"{\n"
|
||||
" uint mode;\n"
|
||||
" float4 color;\n"
|
||||
" float rangeScale;\n"
|
||||
" float start;\n"
|
||||
@@ -62,6 +63,7 @@ static const char* LightingShadowMetal =
|
||||
"};\n"
|
||||
"struct Fog\n"
|
||||
"{\n"
|
||||
" uint mode;\n"
|
||||
" float4 color;\n"
|
||||
" float rangeScale;\n"
|
||||
" float start;\n"
|
||||
@@ -115,8 +117,31 @@ static const char* LightingShadowMetal =
|
||||
static const char* MainPostMetal =
|
||||
"float4 MainPostFunc(thread VertToFrag& vtf, constant LightingUniform& lu, float4 colorIn)\n"
|
||||
"{\n"
|
||||
" float fogZ = (-vtf.mvPos.z - lu.fog.start) * lu.fog.rangeScale;\n"
|
||||
" return mix(lu.fog.color, colorIn, saturate(exp2(-8.0 * fogZ)));\n"
|
||||
" float fogZ, temp;\n"
|
||||
" switch (lu.fog.mode)\n"
|
||||
" {\n"
|
||||
" case 2:\n"
|
||||
" fogZ = (-vtf.mvPos.z - lu.fog.start) * lu.fog.rangeScale;\n"
|
||||
" break;\n"
|
||||
" case 4:\n"
|
||||
" fogZ = 1.0 - exp2(-8.0 * (-vtf.mvPos.z - lu.fog.start) * lu.fog.rangeScale);\n"
|
||||
" break;\n"
|
||||
" case 5:\n"
|
||||
" temp = (-vtf.mvPos.z - lu.fog.start) * lu.fog.rangeScale;\n"
|
||||
" fogZ = 1.0 - exp2(-8.0 * temp * temp);\n"
|
||||
" break;\n"
|
||||
" case 6:\n"
|
||||
" fogZ = exp2(-8.0 * (lu.fog.start + vtf.mvPos.z) * lu.fog.rangeScale);\n"
|
||||
" break;\n"
|
||||
" case 7:\n"
|
||||
" temp = (lu.fog.start + vtf.mvPos.z) * lu.fog.rangeScale;\n"
|
||||
" fogZ = exp2(-8.0 * temp * temp);\n"
|
||||
" break;\n"
|
||||
" default:\n"
|
||||
" fogZ = 0.0;\n"
|
||||
" break;\n"
|
||||
" }\n"
|
||||
" return mix(colorIn, lu.fog.color, saturate(fogZ));\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user