mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-02 22:01:41 +00:00
Add +ONLYVISIBLEINMIRRORS and +INVISIBLEINMIRRORS actor flags. The former makes the actor only visible in reflections, while the latter makes the actor not cast reflections in mirrors.
This commit is contained in:
parent
e3d7afa2d5
commit
593627f049
7 changed files with 41 additions and 0 deletions
|
@ -477,6 +477,12 @@ enum ActorRenderFlag
|
||||||
RF_NOSPRITESHADOW = 0x80000000, // actor will not cast a sprite shadow
|
RF_NOSPRITESHADOW = 0x80000000, // actor will not cast a sprite shadow
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ActorRenderFlag2
|
||||||
|
{
|
||||||
|
RF2_INVISIBLEINMIRRORS = 0x0001, // [Nash] won't render in mirrors
|
||||||
|
RF2_ONLYVISIBLEINMIRRORS = 0x0002, // [Nash] only renders in mirrors
|
||||||
|
};
|
||||||
|
|
||||||
// This translucency value produces the closest match to Heretic's TINTTAB.
|
// This translucency value produces the closest match to Heretic's TINTTAB.
|
||||||
// ~40% of the value of the overlaid image shows through.
|
// ~40% of the value of the overlaid image shows through.
|
||||||
const double HR_SHADOW = (0x6800 / 65536.);
|
const double HR_SHADOW = (0x6800 / 65536.);
|
||||||
|
@ -579,6 +585,7 @@ typedef TFlags<ActorFlag6> ActorFlags6;
|
||||||
typedef TFlags<ActorFlag7> ActorFlags7;
|
typedef TFlags<ActorFlag7> ActorFlags7;
|
||||||
typedef TFlags<ActorFlag8> ActorFlags8;
|
typedef TFlags<ActorFlag8> ActorFlags8;
|
||||||
typedef TFlags<ActorRenderFlag> ActorRenderFlags;
|
typedef TFlags<ActorRenderFlag> ActorRenderFlags;
|
||||||
|
typedef TFlags<ActorRenderFlag2> ActorRenderFlags2;
|
||||||
typedef TFlags<ActorBounceFlag> ActorBounceFlags;
|
typedef TFlags<ActorBounceFlag> ActorBounceFlags;
|
||||||
typedef TFlags<ActorRenderFeatureFlag> ActorRenderFeatureFlags;
|
typedef TFlags<ActorRenderFeatureFlag> ActorRenderFeatureFlags;
|
||||||
DEFINE_TFLAGS_OPERATORS (ActorFlags)
|
DEFINE_TFLAGS_OPERATORS (ActorFlags)
|
||||||
|
@ -590,6 +597,7 @@ DEFINE_TFLAGS_OPERATORS (ActorFlags6)
|
||||||
DEFINE_TFLAGS_OPERATORS (ActorFlags7)
|
DEFINE_TFLAGS_OPERATORS (ActorFlags7)
|
||||||
DEFINE_TFLAGS_OPERATORS (ActorFlags8)
|
DEFINE_TFLAGS_OPERATORS (ActorFlags8)
|
||||||
DEFINE_TFLAGS_OPERATORS (ActorRenderFlags)
|
DEFINE_TFLAGS_OPERATORS (ActorRenderFlags)
|
||||||
|
DEFINE_TFLAGS_OPERATORS (ActorRenderFlags2)
|
||||||
DEFINE_TFLAGS_OPERATORS (ActorBounceFlags)
|
DEFINE_TFLAGS_OPERATORS (ActorBounceFlags)
|
||||||
DEFINE_TFLAGS_OPERATORS (ActorRenderFeatureFlags)
|
DEFINE_TFLAGS_OPERATORS (ActorRenderFeatureFlags)
|
||||||
|
|
||||||
|
@ -1037,6 +1045,7 @@ public:
|
||||||
uint32_t RenderHidden; // current renderer must *not* have any of these features
|
uint32_t RenderHidden; // current renderer must *not* have any of these features
|
||||||
|
|
||||||
ActorRenderFlags renderflags; // Different rendering flags
|
ActorRenderFlags renderflags; // Different rendering flags
|
||||||
|
ActorRenderFlags2 renderflags2; // More rendering flags...
|
||||||
ActorFlags flags;
|
ActorFlags flags;
|
||||||
ActorFlags2 flags2; // Heretic flags
|
ActorFlags2 flags2; // Heretic flags
|
||||||
ActorFlags3 flags3; // [RH] Hexen/Heretic actor-dependant behavior made flaggable
|
ActorFlags3 flags3; // [RH] Hexen/Heretic actor-dependant behavior made flaggable
|
||||||
|
|
|
@ -205,6 +205,7 @@ void AActor::Serialize(FSerializer &arc)
|
||||||
A("scale", Scale)
|
A("scale", Scale)
|
||||||
A("renderstyle", RenderStyle)
|
A("renderstyle", RenderStyle)
|
||||||
A("renderflags", renderflags)
|
A("renderflags", renderflags)
|
||||||
|
A("renderflags2", renderflags2)
|
||||||
A("picnum", picnum)
|
A("picnum", picnum)
|
||||||
A("floorpic", floorpic)
|
A("floorpic", floorpic)
|
||||||
A("ceilingpic", ceilingpic)
|
A("ceilingpic", ceilingpic)
|
||||||
|
|
|
@ -735,6 +735,17 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
||||||
viewmaster = thing->master;
|
viewmaster = thing->master;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [Nash] filter visibility in mirrors
|
||||||
|
bool isInMirror = di->mCurrentPortal && (di->mCurrentPortal->mState->MirrorFlag > 0 || di->mCurrentPortal->mState->PlaneMirrorFlag > 0);
|
||||||
|
if (thing->renderflags2 & RF2_INVISIBLEINMIRRORS && isInMirror)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (thing->renderflags2 & RF2_ONLYVISIBLEINMIRRORS && !isInMirror)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Some added checks if the camera actor is not supposed to be seen. It can happen that some portal setup has this actor in view in which case it may not be skipped here
|
// Some added checks if the camera actor is not supposed to be seen. It can happen that some portal setup has this actor in view in which case it may not be skipped here
|
||||||
if (viewmaster == camera && !vp.showviewer)
|
if (viewmaster == camera && !vp.showviewer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1028,6 +1028,17 @@ namespace swrenderer
|
||||||
if (!renderportal->CurrentPortalInSkybox && renderportal->CurrentPortal && !!P_PointOnLineSidePrecise(thing->Pos(), renderportal->CurrentPortal->dst))
|
if (!renderportal->CurrentPortalInSkybox && renderportal->CurrentPortal && !!P_PointOnLineSidePrecise(thing->Pos(), renderportal->CurrentPortal->dst))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// [Nash] filter visibility in mirrors
|
||||||
|
bool isInMirror = renderportal != nullptr && renderportal->IsInMirrorRecursively;
|
||||||
|
if (thing->renderflags2 & RF2_INVISIBLEINMIRRORS && isInMirror)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (thing->renderflags2 & RF2_ONLYVISIBLEINMIRRORS && !isInMirror)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
double distanceSquared = (thing->Pos() - Thread->Viewport->viewpoint.Pos).LengthSquared();
|
double distanceSquared = (thing->Pos() - Thread->Viewport->viewpoint.Pos).LengthSquared();
|
||||||
if (distanceSquared > sprite_distance_cull)
|
if (distanceSquared > sprite_distance_cull)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -339,6 +339,8 @@ namespace swrenderer
|
||||||
|
|
||||||
if (pds->mirror)
|
if (pds->mirror)
|
||||||
{
|
{
|
||||||
|
IsInMirrorRecursively = true;
|
||||||
|
|
||||||
//vertex_t *v1 = ds->curline->v1;
|
//vertex_t *v1 = ds->curline->v1;
|
||||||
vertex_t *v1 = pds->src->v1;
|
vertex_t *v1 = pds->src->v1;
|
||||||
|
|
||||||
|
@ -465,6 +467,7 @@ namespace swrenderer
|
||||||
|
|
||||||
CurrentPortal = prevpds;
|
CurrentPortal = prevpds;
|
||||||
MirrorFlags = prevmf;
|
MirrorFlags = prevmf;
|
||||||
|
IsInMirrorRecursively = false;
|
||||||
viewpoint.Angles.Yaw = startang;
|
viewpoint.Angles.Yaw = startang;
|
||||||
viewpoint.Pos = startpos;
|
viewpoint.Pos = startpos;
|
||||||
viewpoint.Path[0] = savedpath[0];
|
viewpoint.Path[0] = savedpath[0];
|
||||||
|
|
|
@ -48,6 +48,10 @@ namespace swrenderer
|
||||||
int WindowRight = 0;
|
int WindowRight = 0;
|
||||||
uint16_t MirrorFlags = 0;
|
uint16_t MirrorFlags = 0;
|
||||||
|
|
||||||
|
// [Nash] this is set when first entering a mirror portal, and is unset when leaving the final mirror portal recursion
|
||||||
|
// Used for the RF2_INVISIBLEINMIRRORS and RF2_ONLYVISIBLEINMIRRORS features
|
||||||
|
bool IsInMirrorRecursively = false;
|
||||||
|
|
||||||
PortalDrawseg* CurrentPortal = nullptr;
|
PortalDrawseg* CurrentPortal = nullptr;
|
||||||
int CurrentPortalUniq = 0;
|
int CurrentPortalUniq = 0;
|
||||||
bool CurrentPortalInSkybox = false;
|
bool CurrentPortalInSkybox = false;
|
||||||
|
|
|
@ -368,6 +368,8 @@ static FFlagDef ActorFlagDefs[]=
|
||||||
DEFINE_FLAG(RF, ZDOOMTRANS, AActor, renderflags),
|
DEFINE_FLAG(RF, ZDOOMTRANS, AActor, renderflags),
|
||||||
DEFINE_FLAG(RF, CASTSPRITESHADOW, AActor, renderflags),
|
DEFINE_FLAG(RF, CASTSPRITESHADOW, AActor, renderflags),
|
||||||
DEFINE_FLAG(RF, NOSPRITESHADOW, AActor, renderflags),
|
DEFINE_FLAG(RF, NOSPRITESHADOW, AActor, renderflags),
|
||||||
|
DEFINE_FLAG(RF2, INVISIBLEINMIRRORS, AActor, renderflags2),
|
||||||
|
DEFINE_FLAG(RF2, ONLYVISIBLEINMIRRORS, AActor, renderflags2),
|
||||||
|
|
||||||
// Bounce flags
|
// Bounce flags
|
||||||
DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags),
|
DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags),
|
||||||
|
|
Loading…
Reference in a new issue