Adds alpha and custom options to render debug modes.
Tested By: Langbart Differential Revision: https://code.wildfiregames.com/D4346 This was SVN commit r25996.
This commit is contained in:
parent
59a13f97be
commit
d1a7aa2858
@ -20,7 +20,9 @@ DeveloperOverlayControlDrowDowns.prototype.RenderDebugMode = class
|
||||
{
|
||||
return [
|
||||
{ "value": "RENDER_DEBUG_MODE_NONE", "label": translate("Render Debug Mode Disabled") },
|
||||
{ "value": "RENDER_DEBUG_MODE_AO", "label": translate("Render Debug Mode AO") }
|
||||
{ "value": "RENDER_DEBUG_MODE_AO", "label": translate("Render Debug Mode AO") },
|
||||
{ "value": "RENDER_DEBUG_MODE_ALPHA", "label": translate("Render Debug Mode Alpha") },
|
||||
{ "value": "RENDER_DEBUG_MODE_CUSTOM", "label": translate("Render Debug Mode Custom") }
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -3,15 +3,21 @@
|
||||
|
||||
#define RENDER_DEBUG_MODE_NONE 0
|
||||
#define RENDER_DEBUG_MODE_AO 1
|
||||
#define RENDER_DEBUG_MODE_ALPHA 2
|
||||
#define RENDER_DEBUG_MODE_CUSTOM 3
|
||||
|
||||
#ifndef RENDER_DEBUG_MODE
|
||||
#define RENDER_DEBUG_MODE RENDER_DEBUG_MODE_NONE
|
||||
#endif
|
||||
|
||||
vec3 applyDebugColor(vec3 color, float ao)
|
||||
vec3 applyDebugColor(vec3 color, float ao, float alpha, float custom)
|
||||
{
|
||||
#if RENDER_DEBUG_MODE == RENDER_DEBUG_MODE_AO
|
||||
return vec3(ao);
|
||||
#elif RENDER_DEBUG_MODE == RENDER_DEBUG_MODE_ALPHA
|
||||
return vec3(alpha);
|
||||
#elif RENDER_DEBUG_MODE == RENDER_DEBUG_MODE_CUSTOM
|
||||
return vec3(custom);
|
||||
#else
|
||||
return color;
|
||||
#endif
|
||||
|
@ -108,9 +108,9 @@ void main()
|
||||
#endif
|
||||
|
||||
#if USE_TRANSPARENT
|
||||
gl_FragColor.a = tex.a;
|
||||
float alpha = tex.a;
|
||||
#else
|
||||
gl_FragColor.a = 1.0;
|
||||
float alpha = 1.0;
|
||||
#endif
|
||||
|
||||
vec3 texdiffuse = tex.rgb;
|
||||
@ -174,7 +174,7 @@ void main()
|
||||
|
||||
color *= shadingColor;
|
||||
|
||||
color = applyDebugColor(color, ao);
|
||||
color = applyDebugColor(color, ao, alpha, 0.0);
|
||||
|
||||
gl_FragColor.rgb = color;
|
||||
gl_FragColor = vec4(color, alpha);
|
||||
}
|
||||
|
@ -93,10 +93,10 @@ void main()
|
||||
vec3 color = mix(refrColor + 0.3*specular, reflColor + specular, fresShadow);
|
||||
color *= getLOS();
|
||||
|
||||
gl_FragColor.rgb = applyDebugColor(color, 1.0);
|
||||
|
||||
// Make alpha vary based on both depth (so it blends with the shore) and view angle (make it
|
||||
// become opaque faster at lower view angles so we can't look "underneath" the water plane)
|
||||
t = 18.0 * max(0.0, 0.7 - v.y);
|
||||
gl_FragColor.a = 0.15 * waterDepth * (1.2 + t + fresnel);
|
||||
float alpha = 0.15 * waterDepth * (1.2 + t + fresnel);
|
||||
|
||||
gl_FragColor = vec4(applyDebugColor(color, 1.0, alpha, 0.0), alpha);
|
||||
}
|
||||
|
@ -38,6 +38,5 @@ void main()
|
||||
|
||||
color *= getLOS();
|
||||
|
||||
gl_FragColor.rgb = applyDebugColor(color, 1.0);
|
||||
gl_FragColor.a = texdiffuse.a;
|
||||
gl_FragColor = vec4(applyDebugColor(color, 1.0, texdiffuse.a, 0.0), texdiffuse.a);
|
||||
}
|
||||
|
@ -30,5 +30,5 @@ void main()
|
||||
|
||||
color *= getLOS();
|
||||
|
||||
gl_FragColor = vec4(applyDebugColor(color, 1.0), alpha * base.a);
|
||||
gl_FragColor = vec4(applyDebugColor(color, 1.0, alpha * base.a, 0.0), alpha * base.a);
|
||||
}
|
||||
|
@ -101,16 +101,18 @@ vec4 triplanarNormals(sampler2D sampler, vec3 wpos)
|
||||
|
||||
void main()
|
||||
{
|
||||
float alpha = 0.0;
|
||||
|
||||
#if BLEND
|
||||
// Use alpha from blend texture
|
||||
gl_FragColor.a = 1.0 - texture2D(blendTex, v_blend).a;
|
||||
alpha = 1.0 - texture2D(blendTex, v_blend).a;
|
||||
|
||||
#if USE_GRASS
|
||||
if (gl_FragColor.a < LAYER / 10.0)
|
||||
if (alpha < LAYER / 10.0)
|
||||
discard;
|
||||
#endif
|
||||
#else
|
||||
gl_FragColor.a = 1.0;
|
||||
alpha = 1.0;
|
||||
#endif
|
||||
|
||||
#if USE_TRIPLANAR
|
||||
@ -126,7 +128,7 @@ void main()
|
||||
|
||||
#if DECAL
|
||||
// Use alpha from main texture
|
||||
gl_FragColor.a = tex.a;
|
||||
alpha = tex.a;
|
||||
#endif
|
||||
|
||||
vec3 texdiffuse = tex.rgb;
|
||||
@ -184,9 +186,9 @@ void main()
|
||||
color *= shadingColor;
|
||||
#endif
|
||||
|
||||
gl_FragColor.rgb = applyDebugColor(color, 1.0);
|
||||
|
||||
#if USE_GRASS
|
||||
gl_FragColor.a = tex.a;
|
||||
alpha = tex.a;
|
||||
#endif
|
||||
|
||||
gl_FragColor = vec4(applyDebugColor(color, 1.0, 1.0, 0.0), alpha);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#version 110
|
||||
|
||||
#include "common/debug_fragment.h"
|
||||
#include "common/fog.h"
|
||||
#include "common/los_fragment.h"
|
||||
#include "common/shadows_fragment.h"
|
||||
@ -305,5 +306,5 @@ void main()
|
||||
|
||||
color = applyFog(color);
|
||||
|
||||
gl_FragColor = vec4(color * getLOS(), refrColor.a);
|
||||
gl_FragColor = vec4(applyDebugColor(color * getLOS(), 1.0, refrColor.a, 0.0), refrColor.a);
|
||||
}
|
||||
|
@ -58,6 +58,8 @@ X(MODE_SILHOUETTEOCCLUDER)
|
||||
X(MODE_WIREFRAME)
|
||||
X(RENDER_DEBUG_MODE)
|
||||
X(RENDER_DEBUG_MODE_AO)
|
||||
X(RENDER_DEBUG_MODE_ALPHA)
|
||||
X(RENDER_DEBUG_MODE_CUSTOM)
|
||||
X(RENDER_DEBUG_MODE_NONE)
|
||||
X(SHADOWS_CASCADE_COUNT)
|
||||
X(SYS_HAS_ARB)
|
||||
|
@ -81,6 +81,10 @@ RenderDebugMode RenderDebugModeEnum::FromString(const CStr8& name)
|
||||
return RenderDebugMode::NONE;
|
||||
if (name == str_RENDER_DEBUG_MODE_AO.c_str())
|
||||
return RenderDebugMode::AO;
|
||||
if (name == str_RENDER_DEBUG_MODE_ALPHA.c_str())
|
||||
return RenderDebugMode::ALPHA;
|
||||
if (name == str_RENDER_DEBUG_MODE_CUSTOM.c_str())
|
||||
return RenderDebugMode::CUSTOM;
|
||||
|
||||
LOGWARNING("Unknown render debug mode %s", name.c_str());
|
||||
return RenderDebugMode::NONE;
|
||||
@ -92,6 +96,10 @@ CStrIntern RenderDebugModeEnum::ToString(RenderDebugMode mode)
|
||||
{
|
||||
case RenderDebugMode::AO:
|
||||
return str_RENDER_DEBUG_MODE_AO;
|
||||
case RenderDebugMode::ALPHA:
|
||||
return str_RENDER_DEBUG_MODE_ALPHA;
|
||||
case RenderDebugMode::CUSTOM:
|
||||
return str_RENDER_DEBUG_MODE_CUSTOM;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -54,7 +54,9 @@ struct RenderPathEnum
|
||||
enum class RenderDebugMode
|
||||
{
|
||||
NONE,
|
||||
AO
|
||||
AO,
|
||||
ALPHA,
|
||||
CUSTOM
|
||||
};
|
||||
|
||||
struct RenderDebugModeEnum
|
||||
|
Loading…
Reference in New Issue
Block a user