1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-07 03:13:49 +00:00

Fix blend modes for Bomberman64.

This commit is contained in:
Sergey Lipskiy 2014-11-05 18:32:13 +06:00
parent 0aa090af1e
commit 939280c99e
2 changed files with 28 additions and 7 deletions

View File

@ -429,9 +429,22 @@ ShaderCombiner::ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCo
strFragmentShader.append(fragment_shader_color_dither);
strFragmentShader.append(fragment_shader_alpha_dither);
strFragmentShader.append(" if (uFogUsage == 3) fragColor = uFogColor; \n");
strFragmentShader.append(" else if (uFogUsage == 2) fragColor = vec4(color2, uFogColor.a); \n");
strFragmentShader.append(" else fragColor = vec4(color2, alpha2); \n");
strFragmentShader.append(
" switch (uFogUsage) { \n"
" case 2: \n"
" fragColor = vec4(color2, uFogColor.a); \n"
" break; \n"
" case 3: \n"
" fragColor = uFogColor; \n"
" break; \n"
" case 4: \n"
" fragColor = vec4(color2, uFogColor.a*alpha2); \n"
" break; \n"
" default: \n"
" fragColor = vec4(color2, alpha2); \n"
" break; \n"
" } \n"
);
strFragmentShader.append(" if (!alpha_test(fragColor.a)) discard; \n");
if (video().getRender().isImageTexturesSupported()) {
@ -444,10 +457,12 @@ ShaderCombiner::ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCo
#ifdef USE_TOONIFY
strFragmentShader.append(" toonify(intensity); \n");
#endif
strFragmentShader.append(" if (uFogUsage == 1) \n");
strFragmentShader.append(" fragColor = vec4(mix(fragColor.rgb, uFogColor.rgb, vFogFragCoord), fragColor.a); \n");
strFragmentShader.append(" if (uGammaCorrectionEnabled != 0) \n");
strFragmentShader.append(" fragColor = vec4(sqrt(fragColor.rgb), fragColor.a); \n");
strFragmentShader.append(
" if (uFogUsage == 1) \n"
" fragColor = vec4(mix(fragColor.rgb, uFogColor.rgb, vFogFragCoord), fragColor.a); \n"
" if (uGammaCorrectionEnabled != 0) \n"
" fragColor = vec4(sqrt(fragColor.rgb), fragColor.a); \n"
);
strFragmentShader.append(fragment_shader_end);
@ -621,9 +636,14 @@ void ShaderCombiner::updateColors(bool _bForce)
switch (blender) {
case 0x0150:
case 0x0D18:
nFogUsage = gDP.otherMode.cycleType == G_CYC_2CYCLE ? 2 : 0;
break;
case 0xC912:
nFogUsage = 2;
break;
case 0x0550:
nFogUsage = 4;
break;
case 0xF550:
nFogUsage = 3;
break;

View File

@ -467,6 +467,7 @@ void OGLRender::_setBlendMode() const
case 0xF550: //clr_fog * a_fog + clr_mem * (1-a)
case 0x0150: // spiderman
case 0x0550: // bomberman 64
case 0x0D18: //clr_in * a_fog + clr_mem * (1-a)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
break;