From fb6fdaffcdff9e1f287d587ad3418f29201e04f6 Mon Sep 17 00:00:00 2001 From: MadDeCoDeR Date: Thu, 16 Nov 2023 00:47:34 +0200 Subject: [PATCH] Allow r_clear to accept standard RGB values (ref #132) --- neo/renderer/OpenGL/RenderBackend_GL.cpp | 5 +++++ neo/renderer/RenderSystem_init.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/neo/renderer/OpenGL/RenderBackend_GL.cpp b/neo/renderer/OpenGL/RenderBackend_GL.cpp index 517a7e50..4f3ab9a2 100644 --- a/neo/renderer/OpenGL/RenderBackend_GL.cpp +++ b/neo/renderer/OpenGL/RenderBackend_GL.cpp @@ -1851,6 +1851,11 @@ void idRenderBackend::SetBuffer( const void* data ) float c[3]; if( sscanf( r_clear.GetString(), "%f %f %f", &c[0], &c[1], &c[2] ) == 3 ) { + if (c[0] > 1.0f || c[1] > 1.0f || c[2] > 1.0f) { + c[0] = c[0] / 255.0f; + c[1] = c[1] / 255.0f; + c[2] = c[2] / 255.0f; + } GL_Clear( true, false, false, 0, c[0], c[1], c[2], 1.0f, true ); } else if( r_clear.GetInteger() == 2 ) diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index e61a0e7d..84a76837 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -145,7 +145,7 @@ idCVar r_useLightAreaCulling( "r_useLightAreaCulling", "1", CVAR_RENDERER | CVAR idCVar r_useLightScissors( "r_useLightScissors", "3", CVAR_RENDERER | CVAR_INTEGER, "0 = no scissor, 1 = non-clipped scissor, 2 = near-clipped scissor, 3 = fully-clipped scissor", 0, 3, idCmdSystem::ArgCompletion_Integer<0, 3> ); idCVar r_useEntityPortalCulling( "r_useEntityPortalCulling", "1", CVAR_RENDERER | CVAR_INTEGER, "0 = none, 1 = cull frustum corners to plane, 2 = exact clip the frustum faces", 0, 2, idCmdSystem::ArgCompletion_Integer<0, 2> ); idCVar r_logFile( "r_logFile", "0", CVAR_RENDERER | CVAR_INTEGER, "number of frames to emit GL logs" ); -idCVar r_clear( "r_clear", "2", CVAR_RENDERER, "force screen clear every frame, 1 = purple, 2 = black, 'r g b' = custom" ); +idCVar r_clear( "r_clear", "2", CVAR_RENDERER, "force screen clear every frame, 1 = purple, 2 = black, 'r g b' = custom, NOTE: acceptable values must be either in the range of 0-1 or 0-255" ); idCVar r_offsetFactor( "r_offsetfactor", "0", CVAR_RENDERER | CVAR_FLOAT, "polygon offset parameter" ); // RB: offset factor was 0, and units were -600 which caused some very ugly polygon offsets on Android so I reverted the values to the same as in Q3A