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

Add support for Bomberman 2 special blend mode,

which is used to highlight current location on the map.

Fixed issue #122
This commit is contained in:
Sergey Lipskiy 2015-03-04 16:12:19 +06:00
parent 9f7963b770
commit be0eab5ea7
3 changed files with 24 additions and 6 deletions

View File

@ -496,8 +496,7 @@ ShaderCombiner::ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCo
m_nInputs = CompileCombiner(_alpha.stage[0], AlphaInput, strCombiner);
strcat(strCombiner, " color1 = ");
m_nInputs |= CompileCombiner(_color.stage[0], ColorInput, strCombiner);
if (gDP.otherMode.cycleType == G_CYC_2CYCLE)
strcat(strCombiner, fragment_shader_blender);
strcat(strCombiner, fragment_shader_blender);
strcat(strCombiner, " combined_color = vec4(color1, alpha1); \n");
if (_alpha.numStages == 2) {
@ -778,8 +777,19 @@ void ShaderCombiner::updateColors(bool _bForce)
case 0x0091:
// Mace
// CLR_IN * A_IN + CLR_BL * 1MA
nSpecialBlendMode = 1;
_setV4Uniform(m_uniforms.uBlendColor, &gDP.blendColor.r, _bForce);
if (gDP.otherMode.cycleType == G_CYC_2CYCLE) {
nSpecialBlendMode = 1;
_setV4Uniform(m_uniforms.uBlendColor, &gDP.blendColor.r, _bForce);
}
break;
case 0xA500:
// Bomberman 2
// CLR_BL * A_FOG + CLR_IN * 1MA
if (gDP.otherMode.cycleType == G_CYC_1CYCLE) {
nSpecialBlendMode = 2;
nFogUsage = 5;
_setV4Uniform(m_uniforms.uBlendColor, &gDP.blendColor.r, _bForce);
}
break;
/* Brings troubles with Roadsters sky
case 0xc702:

View File

@ -486,6 +486,8 @@ void OGLRender::_setBlendMode() const
case 0x0F0A:
//DK64 blue prints
case 0x0302:
// Bomberman 2 special blend mode, see GLSLCombiner.cpp
case 0xA500:
//Sin and Punishment
case 0xCB02:
// Battlezone

View File

@ -359,10 +359,16 @@ static const char* fragment_shader_blender =
;
#else
static const char* fragment_shader_blender =
" if (uSpecialBlendMode == 1) { \n"
" switch (uSpecialBlendMode) { \n"
" case 1: \n"
// Mace
" color1 = color1 * alpha1 + uBlendColor.rgb * (1.0 - alpha1); \n"
" } \n"
" break; \n"
" case 2: \n"
// Bomberman2
" color1 = uBlendColor.rgb * uFogColor.a + color1.rgb * (1.0 - uFogColor.a); \n"
" break; \n"
" } \n"
;
#endif