Skip to content

Commit 95ededc

Browse files
cursoragenttimfox
andcommitted
chore(render): drop permanently-disabled renderer branches
Remove `if (0 && …)` dead code for lightmap debug visualization, optional fastsky color clear in RB_BeginDrawingView, and RB_DrawSun after surfaces (already commented as disabled). Behavior matches the previous always-false conditionals. Co-authored-by: Tim Fox <timfox@outlook.com>
1 parent 2db3859 commit 95ededc

4 files changed

Lines changed: 32 additions & 118 deletions

File tree

src/renderers/opengl/tr_backend.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -532,15 +532,6 @@ static void RB_BeginDrawingView( void ) {
532532
{
533533
clearBits |= GL_STENCIL_BUFFER_BIT;
534534
}
535-
if ( 0 && r_fastsky->integer && !( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) )
536-
{
537-
clearBits |= GL_COLOR_BUFFER_BIT; /* Could clear only if sky shaders used */
538-
#ifdef _DEBUG
539-
qglClearColor( 0.8f, 0.7f, 0.4f, 1.0f ); /* Debug: could sample sky color */
540-
#else
541-
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); /* Could sample sky color */
542-
#endif
543-
}
544535
qglClear( clearBits );
545536

546537
if ( backEnd.refdef.rdflags & RDF_HYPERSPACE ) {
@@ -1270,10 +1261,6 @@ static const void *RB_DrawSurfs( const void *data ) {
12701261
VBO_UnBind();
12711262
#endif
12721263

1273-
if ( 0 && r_drawSun->integer ) { /* sun drawing disabled */
1274-
RB_DrawSun( 0.1f, tr.sunShader );
1275-
}
1276-
12771264
// darken down any stencil shadows
12781265
RB_ShadowFinish();
12791266

src/renderers/opengl/tr_bsp.c

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -241,54 +241,24 @@ static float R_ProcessLightmap( byte *image, const byte *buf_p, float maxIntensi
241241
{
242242
int x, y;
243243

244-
if ( 0 && r_lightmap->integer == 2 ) {
245-
int j;
246-
// color code by intensity as development tool (r/g/b from buf_p, clamp output)
247-
for ( j = 0; j < LIGHTMAP_SIZE * LIGHTMAP_SIZE; j++ )
248-
{
249-
float r = buf_p[j*3+0];
250-
float g = buf_p[j*3+1];
251-
float b = buf_p[j*3+2];
252-
float intensity;
253-
float out[3] = {0.0, 0.0, 0.0};
254-
255-
intensity = 0.33f * r + 0.685f * g + 0.063f * b;
256-
257-
if ( intensity > 255 )
258-
intensity = 1.0f;
259-
else
260-
intensity /= 255.0f;
261-
262-
if ( intensity > maxIntensity )
263-
maxIntensity = intensity;
264-
265-
HSVtoRGB( intensity, 1.00, 0.50, out );
266-
267-
image[j*4+0] = (byte)Com_Clamp( 0.0f, 255.0f, out[0] * 255.0f );
268-
image[j*4+1] = (byte)Com_Clamp( 0.0f, 255.0f, out[1] * 255.0f );
269-
image[j*4+2] = (byte)Com_Clamp( 0.0f, 255.0f, out[2] * 255.0f );
270-
image[j*4+3] = 255;
244+
if ( tr.mergeLightmaps ) {
245+
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
246+
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
247+
byte *dst = &image[((y + LIGHTMAP_BORDER) * LIGHTMAP_LEN + x + LIGHTMAP_BORDER) * 4];
248+
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
249+
dst[3] = 255;
250+
buf_p += 3;
251+
}
271252
}
253+
FillBorders( image );
272254
} else {
273-
if ( tr.mergeLightmaps ) {
274-
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
275-
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
276-
byte *dst = &image[((y + LIGHTMAP_BORDER) * LIGHTMAP_LEN + x + LIGHTMAP_BORDER) * 4];
277-
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
278-
dst[3] = 255;
279-
buf_p += 3;
280-
}
281-
}
282-
FillBorders( image );
283-
} else {
284-
// legacy path
285-
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
286-
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
287-
byte *dst = &image[(y * LIGHTMAP_SIZE + x) * 4];
288-
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
289-
dst[3] = 255;
290-
buf_p += 3;
291-
}
255+
// legacy path
256+
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
257+
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
258+
byte *dst = &image[(y * LIGHTMAP_SIZE + x) * 4];
259+
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
260+
dst[3] = 255;
261+
buf_p += 3;
292262
}
293263
}
294264
}

src/renderers/vulkan/tr_backend.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -563,15 +563,6 @@ static void RB_BeginDrawingView( void ) {
563563
{
564564
clearBits |= GL_STENCIL_BUFFER_BIT;
565565
}
566-
if ( 0 && r_fastsky->integer && !( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) )
567-
{
568-
clearBits |= GL_COLOR_BUFFER_BIT; /* Could clear only if sky shaders used */
569-
#ifdef _DEBUG
570-
qglClearColor( 0.8f, 0.7f, 0.4f, 1.0f ); /* Debug: could sample sky color */
571-
#else
572-
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); /* Could sample sky color */
573-
#endif
574-
}
575566
qglClear( clearBits );
576567
#endif
577568

@@ -1795,10 +1786,6 @@ static const void *RB_DrawSurfs( const void *data ) {
17951786
VBO_UnBind();
17961787
#endif
17971788

1798-
if ( 0 && r_drawSun->integer ) { /* sun drawing disabled */
1799-
RB_DrawSun( 0.1f, tr.sunShader );
1800-
}
1801-
18021789
// darken down any stencil shadows
18031790
RB_ShadowFinish();
18041791

src/renderers/vulkan/tr_bsp.c

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -250,54 +250,24 @@ static float R_ProcessLightmap( byte *image, const byte *buf_p, float maxIntensi
250250
{
251251
int x, y;
252252

253-
if ( 0 && r_lightmap->integer == 2 ) {
254-
int j;
255-
// color code by intensity as development tool (r/g/b from buf_p, clamp output)
256-
for ( j = 0; j < LIGHTMAP_SIZE * LIGHTMAP_SIZE; j++ )
257-
{
258-
float r = buf_p[j*3+0];
259-
float g = buf_p[j*3+1];
260-
float b = buf_p[j*3+2];
261-
float intensity;
262-
float out[3] = {0.0, 0.0, 0.0};
263-
264-
intensity = 0.33f * r + 0.685f * g + 0.063f * b;
265-
266-
if ( intensity > 255 )
267-
intensity = 1.0f;
268-
else
269-
intensity /= 255.0f;
270-
271-
if ( intensity > maxIntensity )
272-
maxIntensity = intensity;
273-
274-
HSVtoRGB( intensity, 1.00, 0.50, out );
275-
276-
image[j*4+0] = (byte)Com_Clamp( 0.0f, 255.0f, out[0] * 255.0f );
277-
image[j*4+1] = (byte)Com_Clamp( 0.0f, 255.0f, out[1] * 255.0f );
278-
image[j*4+2] = (byte)Com_Clamp( 0.0f, 255.0f, out[2] * 255.0f );
279-
image[j*4+3] = 255;
253+
if ( tr.mergeLightmaps ) {
254+
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
255+
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
256+
byte *dst = &image[((y + LIGHTMAP_BORDER) * LIGHTMAP_LEN + x + LIGHTMAP_BORDER) * 4];
257+
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
258+
dst[3] = 255;
259+
buf_p += 3;
260+
}
280261
}
262+
FillBorders( image );
281263
} else {
282-
if ( tr.mergeLightmaps ) {
283-
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
284-
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
285-
byte *dst = &image[((y + LIGHTMAP_BORDER) * LIGHTMAP_LEN + x + LIGHTMAP_BORDER) * 4];
286-
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
287-
dst[3] = 255;
288-
buf_p += 3;
289-
}
290-
}
291-
FillBorders( image );
292-
} else {
293-
// legacy path
294-
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
295-
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
296-
byte *dst = &image[(y * LIGHTMAP_SIZE + x) * 4];
297-
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
298-
dst[3] = 255;
299-
buf_p += 3;
300-
}
264+
// legacy path
265+
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
266+
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
267+
byte *dst = &image[(y * LIGHTMAP_SIZE + x) * 4];
268+
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
269+
dst[3] = 255;
270+
buf_p += 3;
301271
}
302272
}
303273
}

0 commit comments

Comments
 (0)