Skip to content
Permalink
Browse files

debugging: implement r_showNormalMaps

r_showEntityNormals is dropped, in any way, vertexLighting_DBS_entity
and vertexLighting_DBS_world glsl are asking for merge

also beautify some code for other r_show* cvar
  • Loading branch information
illwieckz committed Dec 29, 2019
1 parent 3525109 commit 6792a33c8429ede58fc70f7f5a956ed90915f1c3
@@ -544,13 +544,19 @@ static std::string GenEngineConstants() {
AddDefine( str, "r_precomputedLighting", 1 );

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

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

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

if ( glConfig2.vboVertexSkinningAvailable )
{
@@ -102,9 +102,14 @@ void main()

outputColor = color;

// Debugging
#if defined(r_showLightMaps)
outputColor = texture2D(u_LightMap, var_TexLight);
#elif defined(r_showDeluxeMaps)
outputColor = texture2D(u_DeluxeMap, var_TexLight);
#elif defined(r_showNormalMaps)
// convert normal to [0,1] color space
normal = normal * 0.5 + 0.5;
outputColor = vec4(normal, 1.0);
#endif
}
@@ -156,4 +156,10 @@ void main()
computeLight(lightDir, normal, viewDir, lightColor, diffuse, reflectColor, color);

outputColor = color;

#if defined(r_showNormalMaps)
// convert normal to [0,1] color space
normal = normal * 0.5 + 0.5;
outputColor = vec4(normal, 1.0);
#endif
}
@@ -142,7 +142,7 @@ void main()
outputColor = color;

// Debugging
#if defined(r_showEntityNormals)
#if defined(r_showNormalMaps)
// convert normal to [0,1] color space
normal = normal * 0.5 + 0.5;
outputColor = vec4(normal, 1.0);
@@ -112,4 +112,11 @@ void main()
#endif // r_glowMapping

outputColor = color;

// Debugging
#if defined(r_showNormalMaps)
// convert normal to [0,1] color space
normal = normal * 0.5 + 0.5;
outputColor = vec4(normal, 1.0);
#endif
}
@@ -227,7 +227,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
cvar_t *r_showBatches;
cvar_t *r_showLightMaps;
cvar_t *r_showDeluxeMaps;
cvar_t *r_showEntityNormals;
cvar_t *r_showNormalMaps;
cvar_t *r_showAreaPortals;
cvar_t *r_showCubeProbes;
cvar_t *r_showBspNodes;
@@ -1304,7 +1304,7 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p
r_showBatches = ri.Cvar_Get( "r_showBatches", "0", CVAR_CHEAT );
r_showLightMaps = ri.Cvar_Get( "r_showLightMaps", "0", CVAR_CHEAT | CVAR_LATCH );
r_showDeluxeMaps = ri.Cvar_Get( "r_showDeluxeMaps", "0", CVAR_CHEAT | CVAR_LATCH );
r_showEntityNormals = ri.Cvar_Get( "r_showEntityNormals", "0", CVAR_CHEAT | CVAR_LATCH );
r_showNormalMaps = ri.Cvar_Get( "r_showNormalMaps", "0", CVAR_CHEAT | CVAR_LATCH );
r_showAreaPortals = ri.Cvar_Get( "r_showAreaPortals", "0", CVAR_CHEAT );
r_showCubeProbes = ri.Cvar_Get( "r_showCubeProbes", "0", CVAR_CHEAT );
r_showBspNodes = ri.Cvar_Get( "r_showBspNodes", "0", CVAR_CHEAT );
@@ -2954,7 +2954,7 @@ static inline void halfToFloat( const f16vec4_t in, vec4_t out )
extern cvar_t *r_showBatches;
extern cvar_t *r_showLightMaps; // render lightmaps only
extern cvar_t *r_showDeluxeMaps;
extern cvar_t *r_showEntityNormals;
extern cvar_t *r_showNormalMaps;
extern cvar_t *r_showAreaPortals;
extern cvar_t *r_showCubeProbes;
extern cvar_t *r_showBspNodes;

0 comments on commit 6792a33

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