From 80bb1d908ac2e19cf7094e71fd1f31d1235405a7 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Fri, 28 Jul 2017 14:00:28 -0400 Subject: [PATCH] - basic groundwork for render feature visibility flags. I haven't gotten very far with it yet, but since I am taking a break I am going to commit what I have and continue it later. todo: * call a render class function in D_Main that enumerates the capabilities of the current renderer into a global variable to be accessed later * add a debug-specific cvar to always show all actors, regardless of these filters * put in checks in the renderer themselves that check both flagsets and reject rendering of any sprite/model that does not fit the definition's criteria --- src/actor.h | 23 +++++++++++++++++++++++ wadsrc/static/zscript/constants.txt | 21 ++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/actor.h b/src/actor.h index 2059b83095..893e9cb57a 100644 --- a/src/actor.h +++ b/src/actor.h @@ -516,6 +516,25 @@ enum ActorBounceFlag }; +// this is a special flag set that is exposed directly to DECORATE/ZScript +// these flags are for filtering actor visibility based on certain conditions of the renderer's feature support. +// currently, no renderer supports every single one of these features. +enum ActorRenderFeatureFlag +{ + RFF_FLATSPRITES = 1<<0, // flat sprites + RFF_MODELS = 1<<1, // 3d models + RFF_SLOPE3DFLOORS = 1<<2, // sloped 3d floor support + RFF_TILTPITCH = 1<<3, // full free-look + RFF_ROLLSPRITES = 1<<4, // roll sprites + RFF_UNCLIPPEDTEX = 1<<5, // midtex and sprite can render "into" flats and walls + RFF_FRAGMENTSHADER = 1<<6, // fragment (material) shaders + RFF_POSTSHADER = 1<<7, // post-process shaders (renderbuffers) + RFF_BRIGHTMAP = 1<<8, // brightmaps + RFF_COLORMAP = 1<<9, // custom colormaps (incl. ability to fullbright certain ranges, ala Strife) + RFF_POLYGONAL = 1<<10, // uses polygons instead of wallscans/visplanes (i.e. softpoly and hardware opengl) + RFF_TRUECOLOR = 1<<11, // renderer is currently truecolor +}; + // [TP] Flagset definitions typedef TFlags ActorFlags; typedef TFlags ActorFlags2; @@ -527,6 +546,7 @@ typedef TFlags ActorFlags7; typedef TFlags ActorFlags8; typedef TFlags ActorRenderFlags; typedef TFlags ActorBounceFlags; +typedef TFlags ActorRenderFeatureFlags; DEFINE_TFLAGS_OPERATORS (ActorFlags) DEFINE_TFLAGS_OPERATORS (ActorFlags2) DEFINE_TFLAGS_OPERATORS (ActorFlags3) @@ -537,6 +557,7 @@ DEFINE_TFLAGS_OPERATORS (ActorFlags7) DEFINE_TFLAGS_OPERATORS (ActorFlags8) DEFINE_TFLAGS_OPERATORS (ActorRenderFlags) DEFINE_TFLAGS_OPERATORS (ActorBounceFlags) +DEFINE_TFLAGS_OPERATORS (ActorRenderFeatureFlags) // Used to affect the logic for thing activation through death, USESPECIAL and BUMPSPECIAL // "thing" refers to what has the flag and the special, "trigger" refers to what used or bumped it @@ -1024,6 +1045,8 @@ public: uint32_t Translation; ActorRenderFlags renderflags; // Different rendering flags + ActorRenderFeatureFlags renderrequired; // current renderer must have this feature set + ActorRenderFeatureFlags renderhidden; // current renderer must *not* have any of these features ActorFlags flags; ActorFlags2 flags2; // Heretic flags ActorFlags3 flags3; // [RH] Hexen/Heretic actor-dependant behavior made flaggable diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index b0bf1b65de..05f373f693 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -1171,4 +1171,23 @@ enum EWeaponState WF_USER2OK = 1 << 9, WF_USER3OK = 1 << 10, WF_USER4OK = 1 << 11, -}; \ No newline at end of file +}; + +// these flags are for filtering actor visibility based on certain conditions of the renderer's feature support. +// currently, no renderer supports every single one of these features. +enum ActorRenderFeatureFlag +{ + RFF_FLATSPRITES = 1<<0, // flat sprites + RFF_MODELS = 1<<1, // 3d models + RFF_SLOPE3DFLOORS = 1<<2, // sloped 3d floor support + RFF_TILTPITCH = 1<<3, // full free-look + RFF_ROLLSPRITES = 1<<4, // roll sprites + RFF_UNCLIPPEDTEX = 1<<5, // midtex and sprite can render "into" flats and walls + RFF_FRAGMENTSHADER = 1<<6, // fragment (material) shaders + RFF_POSTSHADER = 1<<7, // post-process shaders (renderbuffers) + RFF_BRIGHTMAP = 1<<8, // brightmaps + RFF_COLORMAP = 1<<9, // custom colormaps (incl. ability to fullbright certain ranges, ala Strife) + RFF_POLYGONAL = 1<<10, // uses polygons instead of wallscans/visplanes (i.e. softpoly and hardware opengl) + RFF_TRUECOLOR = 1<<11, // renderer is currently truecolor +}; +