mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-02-27 06:20:54 +00:00
Try to ensure currentDepthImage always uses NEAREST filtering
cleaner than only setting it in CopyDepthbuffer()
This commit is contained in:
parent
6a3fa8c28a
commit
47bd8afa91
3 changed files with 20 additions and 6 deletions
|
@ -388,6 +388,19 @@ static void R_RGBA8Image( idImage *image ) {
|
||||||
TF_DEFAULT, false, TR_REPEAT, TD_HIGH_QUALITY );
|
TF_DEFAULT, false, TR_REPEAT, TD_HIGH_QUALITY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void R_DepthImage( idImage *image ) {
|
||||||
|
byte data[DEFAULT_SIZE][DEFAULT_SIZE][4];
|
||||||
|
|
||||||
|
memset( data, 0, sizeof( data ) );
|
||||||
|
data[0][0][0] = 16;
|
||||||
|
data[0][0][1] = 32;
|
||||||
|
data[0][0][2] = 48;
|
||||||
|
data[0][0][3] = 96;
|
||||||
|
|
||||||
|
image->GenerateImage( (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE,
|
||||||
|
TF_NEAREST, false, TR_CLAMP, TD_HIGH_QUALITY );
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static void R_RGB8Image( idImage *image ) {
|
static void R_RGB8Image( idImage *image ) {
|
||||||
byte data[DEFAULT_SIZE][DEFAULT_SIZE][4];
|
byte data[DEFAULT_SIZE][DEFAULT_SIZE][4];
|
||||||
|
@ -1993,7 +2006,7 @@ void idImageManager::Init() {
|
||||||
accumImage = ImageFromFunction("_accum", R_RGBA8Image );
|
accumImage = ImageFromFunction("_accum", R_RGBA8Image );
|
||||||
scratchCubeMapImage = ImageFromFunction("_scratchCubeMap", makeNormalizeVectorCubeMap );
|
scratchCubeMapImage = ImageFromFunction("_scratchCubeMap", makeNormalizeVectorCubeMap );
|
||||||
currentRenderImage = ImageFromFunction("_currentRender", R_RGBA8Image );
|
currentRenderImage = ImageFromFunction("_currentRender", R_RGBA8Image );
|
||||||
currentDepthImage = ImageFromFunction( "_currentDepth", R_RGBA8Image ); // #3877. Allow shaders to access scene depth
|
currentDepthImage = ImageFromFunction( "_currentDepth", R_DepthImage ); // #3877. Allow shaders to access scene depth
|
||||||
|
|
||||||
cmdSystem->AddCommand( "reloadImages", R_ReloadImages_f, CMD_FL_RENDERER, "reloads images" );
|
cmdSystem->AddCommand( "reloadImages", R_ReloadImages_f, CMD_FL_RENDERER, "reloads images" );
|
||||||
cmdSystem->AddCommand( "listImages", R_ListImages_f, CMD_FL_RENDERER, "lists images" );
|
cmdSystem->AddCommand( "listImages", R_ListImages_f, CMD_FL_RENDERER, "lists images" );
|
||||||
|
|
|
@ -458,7 +458,9 @@ void R_LoadARBProgram( int progIndex ) {
|
||||||
end[3] = 0;
|
end[3] = 0;
|
||||||
|
|
||||||
// DG: hack gamma correction into shader
|
// DG: hack gamma correction into shader
|
||||||
if ( r_gammaInShader.GetBool() && progs[progIndex].target == GL_FRAGMENT_PROGRAM_ARB ) {
|
if ( r_gammaInShader.GetBool() && progs[progIndex].target == GL_FRAGMENT_PROGRAM_ARB
|
||||||
|
&& strstr( start, "nodhewm3gammahack" ) == NULL )
|
||||||
|
{
|
||||||
|
|
||||||
// note that strlen("dhewm3tmpres") == strlen("result.color")
|
// note that strlen("dhewm3tmpres") == strlen("result.color")
|
||||||
const char* tmpres = "TEMP dhewm3tmpres; # injected by dhewm3 for gamma correction\n";
|
const char* tmpres = "TEMP dhewm3tmpres; # injected by dhewm3 for gamma correction\n";
|
||||||
|
|
|
@ -560,8 +560,8 @@ void RB_STD_FillDepthBuffer( drawSurf_t **drawSurfs, int numDrawSurfs ) {
|
||||||
RB_RenderDrawSurfListWithFunction( drawSurfs, numDrawSurfs, RB_T_FillDepthBuffer );
|
RB_RenderDrawSurfListWithFunction( drawSurfs, numDrawSurfs, RB_T_FillDepthBuffer );
|
||||||
|
|
||||||
// Make the early depth pass available to shaders. #3877
|
// Make the early depth pass available to shaders. #3877
|
||||||
if ( /*backEnd.viewDef->renderView.viewID >= 0 // Suppress for lightgem rendering passes
|
if ( backEnd.viewDef->renderView.viewID >= 0 // Suppress for lightgem rendering passes
|
||||||
&&*/ !r_skipDepthCapture.GetBool() )
|
&& !r_skipDepthCapture.GetBool() )
|
||||||
{
|
{
|
||||||
globalImages->currentDepthImage->CopyDepthbuffer( backEnd.viewDef->viewport.x1,
|
globalImages->currentDepthImage->CopyDepthbuffer( backEnd.viewDef->viewport.x1,
|
||||||
backEnd.viewDef->viewport.y1,
|
backEnd.viewDef->viewport.y1,
|
||||||
|
@ -812,7 +812,7 @@ void RB_STD_T_RenderShaderPasses( const drawSurf_t *surf ) {
|
||||||
RB_EnterWeaponDepthHack();
|
RB_EnterWeaponDepthHack();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( surf->space->modelDepthHack != 0.0f && !soft_particle ) // #3878 soft particles don't want modelDepthHack, which is
|
if ( surf->space->modelDepthHack != 0.0f && !soft_particle ) // #3878 soft particles don't want modelDepthHack, which is
|
||||||
{ // an older way to slightly "soften" particles
|
{ // an older way to slightly "soften" particles
|
||||||
RB_EnterModelDepthHack( surf->space->modelDepthHack );
|
RB_EnterModelDepthHack( surf->space->modelDepthHack );
|
||||||
}
|
}
|
||||||
|
@ -954,7 +954,6 @@ void RB_STD_T_RenderShaderPasses( const drawSurf_t *surf ) {
|
||||||
|
|
||||||
GL_State( pStage->drawStateBits | GLS_DEPTHFUNC_ALWAYS ); // Disable depth clipping. The fragment program will
|
GL_State( pStage->drawStateBits | GLS_DEPTHFUNC_ALWAYS ); // Disable depth clipping. The fragment program will
|
||||||
// handle it to allow overdraw.
|
// handle it to allow overdraw.
|
||||||
//GL_State( pStage->drawStateBits );
|
|
||||||
|
|
||||||
qglBindProgramARB( GL_VERTEX_PROGRAM_ARB, VPROG_SOFT_PARTICLE );
|
qglBindProgramARB( GL_VERTEX_PROGRAM_ARB, VPROG_SOFT_PARTICLE );
|
||||||
qglEnable( GL_VERTEX_PROGRAM_ARB );
|
qglEnable( GL_VERTEX_PROGRAM_ARB );
|
||||||
|
|
Loading…
Reference in a new issue