Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions src/renderers/opengl/tr_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,15 +532,6 @@ static void RB_BeginDrawingView( void ) {
{
clearBits |= GL_STENCIL_BUFFER_BIT;
}
if ( 0 && r_fastsky->integer && !( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) )
{
clearBits |= GL_COLOR_BUFFER_BIT; /* Could clear only if sky shaders used */
#ifdef _DEBUG
qglClearColor( 0.8f, 0.7f, 0.4f, 1.0f ); /* Debug: could sample sky color */
#else
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); /* Could sample sky color */
#endif
}
qglClear( clearBits );

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

if ( 0 && r_drawSun->integer ) { /* sun drawing disabled */
RB_DrawSun( 0.1f, tr.sunShader );
}

// darken down any stencil shadows
RB_ShadowFinish();

Expand Down
62 changes: 16 additions & 46 deletions src/renderers/opengl/tr_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,54 +241,24 @@ static float R_ProcessLightmap( byte *image, const byte *buf_p, float maxIntensi
{
int x, y;

if ( 0 && r_lightmap->integer == 2 ) {
int j;
// color code by intensity as development tool (r/g/b from buf_p, clamp output)
for ( j = 0; j < LIGHTMAP_SIZE * LIGHTMAP_SIZE; j++ )
{
float r = buf_p[j*3+0];
float g = buf_p[j*3+1];
float b = buf_p[j*3+2];
float intensity;
float out[3] = {0.0, 0.0, 0.0};

intensity = 0.33f * r + 0.685f * g + 0.063f * b;

if ( intensity > 255 )
intensity = 1.0f;
else
intensity /= 255.0f;

if ( intensity > maxIntensity )
maxIntensity = intensity;

HSVtoRGB( intensity, 1.00, 0.50, out );

image[j*4+0] = (byte)Com_Clamp( 0.0f, 255.0f, out[0] * 255.0f );
image[j*4+1] = (byte)Com_Clamp( 0.0f, 255.0f, out[1] * 255.0f );
image[j*4+2] = (byte)Com_Clamp( 0.0f, 255.0f, out[2] * 255.0f );
image[j*4+3] = 255;
if ( tr.mergeLightmaps ) {
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
byte *dst = &image[((y + LIGHTMAP_BORDER) * LIGHTMAP_LEN + x + LIGHTMAP_BORDER) * 4];
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
dst[3] = 255;
buf_p += 3;
}
}
FillBorders( image );
} else {
if ( tr.mergeLightmaps ) {
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
byte *dst = &image[((y + LIGHTMAP_BORDER) * LIGHTMAP_LEN + x + LIGHTMAP_BORDER) * 4];
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
dst[3] = 255;
buf_p += 3;
}
}
FillBorders( image );
} else {
// legacy path
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
byte *dst = &image[(y * LIGHTMAP_SIZE + x) * 4];
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
dst[3] = 255;
buf_p += 3;
}
// legacy path
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
byte *dst = &image[(y * LIGHTMAP_SIZE + x) * 4];
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
dst[3] = 255;
buf_p += 3;
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/renderers/opengl/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ cvar_t *r_teleporterFlash;

cvar_t *r_fastsky;
cvar_t *r_neatsky;
cvar_t *r_drawSun;
cvar_t *r_dynamiclight;
#ifdef USE_PMLIGHT
cvar_t *r_dlightMode;
Expand Down Expand Up @@ -1602,8 +1601,6 @@ static void R_Register( void )
ri.Cvar_SetDescription( r_teleporterFlash, "Show a white screen instead of a black screen when being teleported in hyperspace." );
r_fastsky = ri.Cvar_Get( "r_fastsky", "0", CVAR_ARCHIVE_ND );
ri.Cvar_SetDescription( r_fastsky, "Draw flat colored skies." );
r_drawSun = ri.Cvar_Get( "r_drawSun", "0", CVAR_ARCHIVE_ND );
ri.Cvar_SetDescription( r_drawSun, "Draw sun shader in skies." );
r_dynamiclight = ri.Cvar_Get( "r_dynamiclight", "1", CVAR_ARCHIVE );
ri.Cvar_SetDescription( r_dynamiclight, "Enables dynamic lighting." );
#ifdef USE_PMLIGHT
Expand Down
2 changes: 0 additions & 2 deletions src/renderers/opengl/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,6 @@ extern cvar_t *r_teleporterFlash; // teleport hyperspace visual

extern cvar_t *r_fastsky; // controls whether sky should be cleared or drawn
extern cvar_t *r_neatsky; // nomip and nopicmip for skyboxes, cnq3 like look
extern cvar_t *r_drawSun; // controls drawing of sun quad
extern cvar_t *r_dynamiclight; // dynamic lights enabled/disabled
#ifdef USE_PMLIGHT
extern cvar_t *r_dlightMode; // 0 - vq3, 1 - pmlight
Expand Down Expand Up @@ -1695,7 +1694,6 @@ SKIES

void R_InitSkyTexCoords( float cloudLayerHeight );
void R_DrawSkyBox( const shaderCommands_t *shader );
void RB_DrawSun( float scale, shader_t *shader );

/*
============================================================
Expand Down
40 changes: 0 additions & 40 deletions src/renderers/opengl/tr_sky.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,46 +757,6 @@ void R_InitSkyTexCoords( float heightCloud )

//======================================================================================

/*
** RB_DrawSun
*/
void RB_DrawSun( float scale, shader_t *shader ) {
float size;
float dist;
vec3_t origin, vec1, vec2;
color4ub_t sunColor;

if ( !backEnd.skyRenderedThisView )
return;

sunColor.u32 = ~0U;

qglLoadMatrixf( backEnd.viewParms.world.modelMatrix );

dist = backEnd.viewParms.zFar / 1.75; // div sqrt(3)
size = dist * scale;

VectorMA( backEnd.viewParms.or.origin, dist, tr.sunDirection, origin );
PerpendicularVector( vec1, tr.sunDirection );
CrossProduct( tr.sunDirection, vec1, vec2 );

VectorScale( vec1, size, vec1 );
VectorScale( vec2, size, vec2 );

// farthest depth range
qglDepthRange( sky_min_depth, 1.0 );

RB_BeginSurface( shader, 0 );

RB_AddQuadStamp( origin, vec1, vec2, sunColor );

RB_EndSurface();

// back to normal depth range
qglDepthRange( 0.0, 1.0 );
}


/*
================
RB_StageIteratorSky
Expand Down
13 changes: 0 additions & 13 deletions src/renderers/vulkan/tr_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,15 +563,6 @@ static void RB_BeginDrawingView( void ) {
{
clearBits |= GL_STENCIL_BUFFER_BIT;
}
if ( 0 && r_fastsky->integer && !( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) )
{
clearBits |= GL_COLOR_BUFFER_BIT; /* Could clear only if sky shaders used */
#ifdef _DEBUG
qglClearColor( 0.8f, 0.7f, 0.4f, 1.0f ); /* Debug: could sample sky color */
#else
qglClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); /* Could sample sky color */
#endif
}
qglClear( clearBits );
#endif

Expand Down Expand Up @@ -1795,10 +1786,6 @@ static const void *RB_DrawSurfs( const void *data ) {
VBO_UnBind();
#endif

if ( 0 && r_drawSun->integer ) { /* sun drawing disabled */
RB_DrawSun( 0.1f, tr.sunShader );
}

// darken down any stencil shadows
RB_ShadowFinish();

Expand Down
62 changes: 16 additions & 46 deletions src/renderers/vulkan/tr_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,54 +250,24 @@ static float R_ProcessLightmap( byte *image, const byte *buf_p, float maxIntensi
{
int x, y;

if ( 0 && r_lightmap->integer == 2 ) {
int j;
// color code by intensity as development tool (r/g/b from buf_p, clamp output)
for ( j = 0; j < LIGHTMAP_SIZE * LIGHTMAP_SIZE; j++ )
{
float r = buf_p[j*3+0];
float g = buf_p[j*3+1];
float b = buf_p[j*3+2];
float intensity;
float out[3] = {0.0, 0.0, 0.0};

intensity = 0.33f * r + 0.685f * g + 0.063f * b;

if ( intensity > 255 )
intensity = 1.0f;
else
intensity /= 255.0f;

if ( intensity > maxIntensity )
maxIntensity = intensity;

HSVtoRGB( intensity, 1.00, 0.50, out );

image[j*4+0] = (byte)Com_Clamp( 0.0f, 255.0f, out[0] * 255.0f );
image[j*4+1] = (byte)Com_Clamp( 0.0f, 255.0f, out[1] * 255.0f );
image[j*4+2] = (byte)Com_Clamp( 0.0f, 255.0f, out[2] * 255.0f );
image[j*4+3] = 255;
if ( tr.mergeLightmaps ) {
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
byte *dst = &image[((y + LIGHTMAP_BORDER) * LIGHTMAP_LEN + x + LIGHTMAP_BORDER) * 4];
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
dst[3] = 255;
buf_p += 3;
}
}
FillBorders( image );
} else {
if ( tr.mergeLightmaps ) {
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
byte *dst = &image[((y + LIGHTMAP_BORDER) * LIGHTMAP_LEN + x + LIGHTMAP_BORDER) * 4];
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
dst[3] = 255;
buf_p += 3;
}
}
FillBorders( image );
} else {
// legacy path
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
byte *dst = &image[(y * LIGHTMAP_SIZE + x) * 4];
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
dst[3] = 255;
buf_p += 3;
}
// legacy path
for ( y = 0 ; y < LIGHTMAP_SIZE; y++ ) {
for ( x = 0 ; x < LIGHTMAP_SIZE; x++ ) {
byte *dst = &image[(y * LIGHTMAP_SIZE + x) * 4];
R_ColorShiftLightingBytes( buf_p, dst, qfalse );
dst[3] = 255;
buf_p += 3;
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/renderers/vulkan/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ cvar_t *r_teleporterFlash;

cvar_t *r_fastsky;
cvar_t *r_neatsky;
cvar_t *r_drawSun;
cvar_t *r_dynamiclight;
#ifdef USE_PMLIGHT
cvar_t *r_dlightMode;
Expand Down Expand Up @@ -2448,8 +2447,6 @@ static void R_Register( void )
ri.Cvar_SetDescription( r_teleporterFlash, "Show a white screen instead of a black screen when being teleported in hyperspace." );
r_fastsky = ri.Cvar_Get( "r_fastsky", "0", CVAR_ARCHIVE_ND );
ri.Cvar_SetDescription( r_fastsky, "Draw flat colored skies." );
r_drawSun = ri.Cvar_Get( "r_drawSun", "0", CVAR_ARCHIVE_ND );
ri.Cvar_SetDescription( r_drawSun, "Draw sun shader in skies." );
r_dynamiclight = ri.Cvar_Get( "r_dynamiclight", "1", CVAR_ARCHIVE );
ri.Cvar_SetDescription( r_dynamiclight, "Enables dynamic lighting." );
#ifdef USE_PMLIGHT
Expand Down
2 changes: 0 additions & 2 deletions src/renderers/vulkan/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,6 @@ extern cvar_t *r_teleporterFlash; // teleport hyperspace visual

extern cvar_t *r_fastsky; // controls whether sky should be cleared or drawn
extern cvar_t *r_neatsky; // nomip and nopicmip for skyboxes, cnq3 like look
extern cvar_t *r_drawSun; // controls drawing of sun quad
extern cvar_t *r_dynamiclight; // dynamic lights enabled/disabled
#ifdef USE_PMLIGHT
extern cvar_t *r_dlightMode; // 0 - vq3, 1 - pmlight
Expand Down Expand Up @@ -2153,7 +2152,6 @@ SKIES

void R_InitSkyTexCoords( float cloudLayerHeight );
void R_DrawSkyBox( const shaderCommands_t *shader );
void RB_DrawSun( float scale, shader_t *shader );

/*
============================================================
Expand Down
52 changes: 0 additions & 52 deletions src/renderers/vulkan/tr_sky.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,58 +764,6 @@ void R_InitSkyTexCoords( float heightCloud )

//======================================================================================

/*
** RB_DrawSun
*/
void RB_DrawSun( float scale, shader_t *shader ) {
float size;
float dist;
vec3_t origin, vec1, vec2;
color4ub_t sunColor;

if ( !backEnd.skyRenderedThisView )
return;

sunColor.u32 = ~0U;

#ifdef USE_VULKAN
vk_update_mvp( NULL );
#else
qglLoadMatrixf( backEnd.viewParms.world.modelViewMatrix );
#endif

dist = backEnd.viewParms.zFar / 1.75; // div sqrt(3)
size = dist * scale;

VectorMA( backEnd.viewParms.or.origin, dist, tr.sunDirection, origin );
PerpendicularVector( vec1, tr.sunDirection );
CrossProduct( tr.sunDirection, vec1, vec2 );

VectorScale( vec1, size, vec1 );
VectorScale( vec2, size, vec2 );

// farthest depth range
#ifdef USE_VULKAN
tess.depthRange = DEPTH_RANGE_ONE;
#else
qglDepthRange( sky_min_depth, 1.0 );
#endif

RB_BeginSurface( shader, 0 );

RB_AddQuadStamp( origin, vec1, vec2, sunColor );

RB_EndSurface();

// back to normal depth range
#ifdef USE_VULKAN
tess.depthRange = DEPTH_RANGE_NORMAL;
#else
qglDepthRange( 0.0, 1.0 );
#endif
}


/*
================
RB_StageIteratorSky
Expand Down
Loading