Merge pull request #1152 from flyinghead/fh/modvols

Enable modifier volumes. Fix for exclusion volumes.
This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2018-06-09 17:52:51 +02:00 committed by GitHub
commit d0cd5a5f64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 9 deletions

View File

@ -166,7 +166,7 @@ struct TA_context
rend.global_param_mvo.Init(4096,&rend.Overrun);
rend.global_param_tr.Init(4096,&rend.Overrun);
rend.modtrig.Init(4096,&rend.Overrun);
rend.modtrig.Init(8192,&rend.Overrun);
Reset();
}

View File

@ -243,6 +243,7 @@ void LoadSettings()
settings.aica.NoSound = cfgLoadInt("config","aica.NoSound",0);
settings.rend.UseMipmaps = cfgLoadInt("config","rend.UseMipmaps",1);
settings.rend.WideScreen = cfgLoadInt("config","rend.WideScreen",0);
settings.rend.ModifierVolumes = cfgLoadInt("config","rend.ModifierVolumes",1);
settings.pvr.subdivide_transp = cfgLoadInt("config","pvr.Subdivide",0);

View File

@ -856,6 +856,7 @@ void SetMVS_Mode(u32 mv_mode,ISP_Modvol ispc)
if (mv_mode==1)
{
// Inclusion volume
//res : old : final
//0 : 0 : 00
//0 : 1 : 01
@ -881,21 +882,22 @@ void SetMVS_Mode(u32 mv_mode,ISP_Modvol ispc)
}
else
{
// Exclusion volume
/*
this is bugged. a lot.
I've only seen a single game use it, so i guess it doesn't matter ? (Zombie revenge)
(actually, i think there was also another, racing game)
*/
// The initial value for exclusion volumes is 1 so we need to invert the result before and'ing.
//res : old : final
//0 : 0 : 00
//0 : 1 : 00
//0 : 1 : 01
//1 : 0 : 00
//1 : 1 : 01
//1 : 1 : 00
//if (2>st) st=1; else st=0; //can't be done with a single pass
glStencilFunc(GL_GREATER,1,3);
glStencilOp(GL_ZERO,GL_KEEP,GL_REPLACE);
//if (1 == st) st = 1; else st = 0;
glStencilFunc(GL_EQUAL, 1, 3);
glStencilOp(GL_ZERO,GL_KEEP,GL_KEEP);
#ifndef NO_STENCIL_WORKAROUND
//Look @ comment above -- this looks like a driver bug
glStencilOp(GL_ZERO,GL_KEEP,GL_REPLACE);
@ -986,7 +988,7 @@ void DrawModVols()
*/
glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
glDepthFunc(GL_GREATER);
if ( 0 /* || GetAsyncKeyState(VK_F6)*/ )
{
//simple single level stencil
@ -1107,7 +1109,8 @@ void DrawStrips()
/*if (!GetAsyncKeyState(VK_F1))*/
DrawList<ListType_Opaque,false>(pvrrc.global_param_op);
//DrawModVols();
if (settings.rend.ModifierVolumes)
DrawModVols();
//Alpha tested
//setup alpha test state

View File

@ -1751,6 +1751,7 @@ bool RenderFrame()
glClearColor(0,0,0,1.0f);
glClearDepthf(0.f); glCheck();
glStencilMask(0xFF); glCheck();
glClear(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glCheck();

View File

@ -615,6 +615,7 @@ struct settings_t
{
bool UseMipmaps;
bool WideScreen;
bool ModifierVolumes;
} rend;
struct