mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-10 06:31:48 +00:00
added r_depthClamp and cap_DepthClamp
This commit is contained in:
parent
74acd92d91
commit
c8c9bef131
9 changed files with 53 additions and 6 deletions
|
@ -4,6 +4,13 @@ See the end of this file for known issues.
|
|||
|
||||
DD Mmm 20 - 1.53
|
||||
|
||||
add: r_depthClamp <0|1> (default: 0) disables vertex clipping against the near and far clip planes
|
||||
enabling this feature will raise the maximum allowed FoV value of CPMA 1.53
|
||||
it turns the view frustum into a pyramid and prevents any vertex between the near clip plane
|
||||
and the camera's position from getting clipped (but will still clip anything behind the camera),
|
||||
which prevents solid objects from being seen through when too close to the camera
|
||||
because depth values are clamped, improper depth ordering can potentially occur
|
||||
|
||||
add: /shaderinfo <shadername> [code] prints where the shader was loaded from and optionally the code
|
||||
|
||||
add: console mark mode (selection mode) can be toggled with Ctrl-M
|
||||
|
|
|
@ -343,8 +343,14 @@ static qbool CL_CG_GetValue( char* value, int valueSize, const char* key )
|
|||
{ "cap_ExtraColorCodes", 1 }
|
||||
};
|
||||
|
||||
if ( Q_stricmp(key, "cap_DepthClamp") == 0 ) {
|
||||
value[0] = re.DepthClamp() ? '1' : '0';
|
||||
value[1] = '\0';
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < ARRAY_LEN( syscalls ); ++i ) {
|
||||
if( Q_stricmp(key, syscalls[i].name) == 0 ) {
|
||||
if ( Q_stricmp(key, syscalls[i].name) == 0 ) {
|
||||
Com_sprintf( value, valueSize, "%d", syscalls[i].number );
|
||||
return qtrue;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2019-2020 Gian 'myT' Schellenbaum
|
||||
Copyright (C) 2019-2022 Gian 'myT' Schellenbaum
|
||||
|
||||
This file is part of Challenge Quake 3 (CNQ3).
|
||||
|
||||
|
@ -1628,7 +1628,7 @@ static qbool GAL_Init()
|
|||
rasterDesc.CullMode = GetCullMode((cullType_t)cullType);
|
||||
rasterDesc.FrontCounterClockwise = TRUE;
|
||||
rasterDesc.ScissorEnable = TRUE;
|
||||
rasterDesc.DepthClipEnable = TRUE;
|
||||
rasterDesc.DepthClipEnable = r_depthClamp->integer ? FALSE : TRUE;
|
||||
rasterDesc.DepthBiasClamp = 0.0f;
|
||||
rasterDesc.DepthBias = polygonOffset ? -1 : 0;
|
||||
rasterDesc.SlopeScaledDepthBias = polygonOffset ? -1.0f : 0.0f;
|
||||
|
|
|
@ -1514,7 +1514,10 @@ static void GL_SetDefaultState()
|
|||
// RGB with width 1366 -> not a multiple of 4!
|
||||
glPixelStorei( GL_PACK_ALIGNMENT, 1 );
|
||||
|
||||
glDisable( GL_DEPTH_CLAMP );
|
||||
if ( r_depthClamp->integer )
|
||||
glEnable( GL_DEPTH_CLAMP );
|
||||
else
|
||||
glDisable( GL_DEPTH_CLAMP );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2019-2020 Gian 'myT' Schellenbaum
|
||||
Copyright (C) 2019-2022 Gian 'myT' Schellenbaum
|
||||
|
||||
This file is part of Challenge Quake 3 (CNQ3).
|
||||
|
||||
|
@ -1762,7 +1762,14 @@ static void SetDefaultState()
|
|||
glDisable(GL_CLIP_DISTANCE0);
|
||||
glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
glDisable(GL_DEPTH_CLAMP);
|
||||
if(r_depthClamp->integer)
|
||||
{
|
||||
glEnable(GL_DEPTH_CLAMP);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable(GL_DEPTH_CLAMP);
|
||||
}
|
||||
|
||||
gl.boundTextures[0] = GLuint(-1);
|
||||
gl.boundTextures[1] = GLuint(-1);
|
||||
|
|
|
@ -177,6 +177,16 @@ S_COLOR_VAL " 0 " S_COLOR_HELP "= R8G8B8A8\n" \
|
|||
S_COLOR_VAL " 1 " S_COLOR_HELP "= R10G10B10A2\n" \
|
||||
S_COLOR_VAL " 2 " S_COLOR_HELP "= R16G16B16A16"
|
||||
|
||||
#define help_r_depthClamp \
|
||||
"enables depth clamping\n" \
|
||||
"Enable this if you want " S_COLOR_CVAR "cg_fov " S_COLOR_HELP "to be higher than " S_COLOR_VAL "130" S_COLOR_HELP ".\n" \
|
||||
"Vertices don't get clipped against the near and far clip planes.\n" \
|
||||
"It turns the view frustum into a pyramid and prevents any vertex between\n" \
|
||||
"the near clip plane and the camera's position from getting clipped\n" \
|
||||
"(but will still clip anything behind the camera),\n" \
|
||||
"preventing solid objects too close to the camera from being see-through.\n" \
|
||||
"Because depth values are clamped, improper depth ordering can occur."
|
||||
|
||||
#define help_r_colorMipLevels \
|
||||
"colorizes textures based on their mip level\n" \
|
||||
"This disables MSAA on back-ends that use centroid sampling."
|
||||
|
|
|
@ -71,6 +71,7 @@ cvar_t *r_gpuMipGen;
|
|||
cvar_t *r_alphaToCoverage;
|
||||
cvar_t *r_dither;
|
||||
cvar_t *r_rtColorFormat;
|
||||
cvar_t *r_depthClamp;
|
||||
|
||||
cvar_t *r_mipGenFilter;
|
||||
cvar_t *r_mipGenGamma;
|
||||
|
@ -393,6 +394,7 @@ static const cvarTableItem_t r_cvars[] =
|
|||
{ &r_alphaToCoverage, "r_alphaToCoverage", "1", CVAR_ARCHIVE | CVAR_LATCH, CVART_BOOL, NULL, NULL, help_r_alphaToCoverage },
|
||||
{ &r_dither, "r_dither", "0", CVAR_ARCHIVE | CVAR_LATCH, CVART_BOOL, NULL, NULL, help_r_dither },
|
||||
{ &r_rtColorFormat, "r_rtColorFormat", "0", CVAR_ARCHIVE | CVAR_LATCH, CVART_INTEGER, "0", XSTRING(RTCF_MAX), help_r_rtColorFormat },
|
||||
{ &r_depthClamp, "r_depthClamp", "0", CVAR_ARCHIVE | CVAR_LATCH, CVART_BOOL, NULL, NULL, help_r_depthClamp },
|
||||
|
||||
//
|
||||
// latched variables that can only change over a restart
|
||||
|
@ -689,6 +691,12 @@ static qbool RE_IsFrameSleepNeeded()
|
|||
}
|
||||
|
||||
|
||||
static qbool RE_IsDepthClampEnabled()
|
||||
{
|
||||
return r_depthClamp->integer != 0;
|
||||
}
|
||||
|
||||
|
||||
const refexport_t* GetRefAPI( const refimport_t* rimp )
|
||||
{
|
||||
static refexport_t re;
|
||||
|
@ -740,5 +748,7 @@ const refexport_t* GetRefAPI( const refimport_t* rimp )
|
|||
|
||||
re.ShouldSleep = RE_IsFrameSleepNeeded;
|
||||
|
||||
re.DepthClamp = RE_IsDepthClampEnabled;
|
||||
|
||||
return &re;
|
||||
}
|
||||
|
|
|
@ -1032,6 +1032,7 @@ extern cvar_t *r_gpuMipGen; // uses GPU-side mip-map generation
|
|||
extern cvar_t *r_alphaToCoverage; // enables A2C on alpha-tested surfaces
|
||||
extern cvar_t *r_dither; // enables dithering
|
||||
extern cvar_t *r_rtColorFormat; // color render target format, see RTCF_*
|
||||
extern cvar_t *r_depthClamp; // disables clipping vertices against the near and far clip planes
|
||||
|
||||
extern cvar_t *r_mipGenFilter; // if the string is invalid, Lanczos 4 is used
|
||||
extern cvar_t *r_mipGenGamma; // what gamma-space do we consider the textures to be in
|
||||
|
|
|
@ -167,6 +167,9 @@ typedef struct {
|
|||
|
||||
// do we need to sleep this frame to maintain the frame-rate cap?
|
||||
qbool (*ShouldSleep)();
|
||||
|
||||
// is depth clamping enabled?
|
||||
qbool (*DepthClamp)();
|
||||
} refexport_t;
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue