- implement per-renderer sprite hiding based on the actor's render feature flags

- hook the thing up to zscript (does not currently compile)
This commit is contained in:
Rachael Alexanderson 2017-07-29 13:59:36 -04:00
parent 8bb5687159
commit 712d21e26a
4 changed files with 37 additions and 0 deletions

View file

@ -79,6 +79,7 @@ EXTERN_CVAR (Float, transsouls)
extern TArray<spritedef_t> sprites;
extern TArray<spriteframe_t> SpriteFrames;
extern uint32_t r_renderercaps;
enum HWRenderStyle
{
@ -677,6 +678,13 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
if (!(thing->flags & MF_STEALTH) || !mDrawer->FixedColormap || !gl_enhanced_nightvision || thing == camera)
return;
}
// check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature,
// check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it.
if ((!!((uint32_t)(thing->renderrequired) & ~r_renderercaps)) ||
(!!((uint32_t)(thing->renderhidden) & r_renderercaps)))
return;
int spritenum = thing->sprite;
DVector2 sprscale = thing->Scale;
if (thing->player != NULL)

View file

@ -32,6 +32,7 @@
EXTERN_CVAR(Float, transsouls)
EXTERN_CVAR(Int, r_drawfuzz)
extern uint32_t r_renderercaps;
bool RenderPolySprite::GetLine(AActor *thing, DVector2 &left, DVector2 &right)
{
@ -176,6 +177,12 @@ bool RenderPolySprite::IsThingCulled(AActor *thing)
return true;
}
// check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature,
// check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it.
if ((!!((uint32_t)(thing->renderrequired) & ~r_renderercaps)) ||
(!!((uint32_t)(thing->renderhidden) & r_renderercaps)))
return true;
return false;
}

View file

@ -1837,3 +1837,18 @@ DEFINE_SCRIPTED_PROPERTY(unmorphflash, S, PowerMorph)
}
//==========================================================================
// actor render feature filters - stop rendering if the renderer does/does not support certain features
//==========================================================================
DEFINE_SCRIPTED_PROPERTY(renderrequired, I, Actor)
{
PROP_INT_PARM(f, 0);
defaults->renderrequired = f;
}
DEFINE_SCRIPTED_PROPERTY(renderhidden, I, Actor)
{
PROP_INT_PARM(f, 0);
defaults->renderhidden = f;
}

View file

@ -72,6 +72,7 @@
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
EXTERN_CVAR(Bool, r_drawvoxels);
extern uint32_t r_renderercaps;
namespace
{
@ -968,6 +969,12 @@ namespace swrenderer
return false;
}
// check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature,
// check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it.
if ((!!((uint32_t)(thing->renderrequired) & ~r_renderercaps)) ||
(!!((uint32_t)(thing->renderhidden) & r_renderercaps)))
return false;
// [ZZ] Or less definitely not visible (hue)
// [ZZ] 10.01.2016: don't try to clip stuff inside a skybox against the current portal.
RenderPortal *renderportal = Thread->Portal.get();