Skip to content
Permalink
Browse files

renderer: introduce r_liquidMapping, disabled by default (broken feat…

…ure)
  • Loading branch information
illwieckz committed Dec 16, 2019
1 parent 5c37019 commit 0d3d97fd46c49a630d597c4f6d31729db9d8e4fe
@@ -584,6 +584,11 @@ static std::string GenEngineConstants() {
AddDefine( str, "r_normalMapping", 1 );
}

if ( r_liquidMapping->integer )
{
AddDefine( str, "r_liquidMapping", 1 );
}

if ( r_specularMapping->integer )
{
AddDefine( str, "r_specularMapping", 1 );
@@ -111,9 +111,15 @@ void main()
vec4 reflectColor;
vec4 color;

#if defined(r_liquidMapping)
refractColor = texture2D(u_CurrentMap, texScreen).rgb;
reflectColor.rgb = texture2D(u_PortalMap, texScreen).rgb;
reflectColor.a = 1.0;
#else // !r_liquidMapping
// dummy fallback color
refractColor = vec3(0.7, 0.7, 0.7);
reflectColor = vec4(0.7, 0.7, 0.7, 1.0);
#endif // !r_liquidMapping

color.rgb = mix(refractColor, reflectColor.rgb, fresnel);
color.a = 1.0;
@@ -4716,6 +4716,7 @@ static void RB_RenderView( bool depthPass )

if ( backEnd.viewParms.portalLevel > 0 )
{
if ( r_liquidMapping->integer )
{
// capture current color buffer
// liquid shader will then bind tr.portalRenderImage
@@ -166,6 +166,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
cvar_t *r_deluxeMapping;
cvar_t *r_normalScale;
cvar_t *r_normalMapping;
cvar_t *r_liquidMapping;
cvar_t *r_highQualityNormalMapping;
cvar_t *r_parallaxDepthScale;
cvar_t *r_parallaxMapping;
@@ -1199,6 +1200,7 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p
r_normalScale = ri.Cvar_Get( "r_normalScale", "1.0", CVAR_ARCHIVE );
r_normalMapping = ri.Cvar_Get( "r_normalMapping", "1", CVAR_LATCH | CVAR_ARCHIVE );
r_highQualityNormalMapping = ri.Cvar_Get( "r_highQualityNormalMapping", "0", CVAR_LATCH );
r_liquidMapping = ri.Cvar_Get( "r_liquidMapping", "0", CVAR_LATCH );
r_parallaxDepthScale = ri.Cvar_Get( "r_parallaxDepthScale", "0.03", CVAR_CHEAT );
r_parallaxMapping = ri.Cvar_Get( "r_parallaxMapping", "0", 0 );
r_glowMapping = ri.Cvar_Get( "r_glowMapping", "1", CVAR_LATCH );
@@ -2857,6 +2857,7 @@ static inline void halfToFloat( const f16vec4_t in, vec4_t out )
extern cvar_t *r_normalScale;
extern cvar_t *r_normalMapping;
extern cvar_t *r_highQualityNormalMapping;
extern cvar_t *r_liquidMapping;
extern cvar_t *r_parallaxDepthScale;
extern cvar_t *r_parallaxMapping;
extern cvar_t *r_glowMapping;

0 comments on commit 0d3d97f

Please sign in to comment.
You can’t perform that action at this time.