mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 13:47:58 +03:00
Added anisotropic filtering
This commit is contained in:
parent
3a18c9f327
commit
9c8ca98e68
3 changed files with 25 additions and 6 deletions
|
@ -611,7 +611,7 @@ static void Upload32(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
internalFormat = 3;
|
||||
internalFormat = GL_RGB;
|
||||
}
|
||||
// copy or resample data as appropriate for first MIP level
|
||||
if ( ( scaled_width == width ) &&
|
||||
|
@ -679,11 +679,18 @@ done:
|
|||
|
||||
if (numMipmaps)
|
||||
{
|
||||
if ( textureFilterAnisotropic )
|
||||
qglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
|
||||
(GLint)Com_Clamp( 1, maxAnisotropy, r_ext_max_anisotropy->integer ) );
|
||||
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (textureFilterAnisotropic)
|
||||
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1);
|
||||
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
}
|
||||
|
|
|
@ -24,6 +24,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#include "tr_local.h"
|
||||
|
||||
glconfig_t glConfig;
|
||||
qboolean textureFilterAnisotropic = qfalse;
|
||||
int maxAnisotropy = 0;
|
||||
float displayAspect = 0;
|
||||
qboolean haveClampToEdge;
|
||||
glstate_t glState;
|
||||
int r_sequencenumber;
|
||||
|
||||
|
@ -87,6 +91,7 @@ cvar_t *r_ext_texture_env_add;
|
|||
|
||||
cvar_t *r_ext_texture_env_combine;
|
||||
cvar_t *r_ext_aniso_filter;
|
||||
cvar_t *r_ext_max_anisotropy;
|
||||
cvar_t *r_forceClampToEdge;
|
||||
cvar_t *r_geForce3WorkAround;
|
||||
cvar_t *r_reset_tc_array;
|
||||
|
@ -258,11 +263,6 @@ cvar_t* r_noborder;
|
|||
cvar_t* r_ext_texture_filter_anisotropic;
|
||||
cvar_t* r_stereoEnabled;
|
||||
|
||||
qboolean textureFilterAnisotropic = qtrue;
|
||||
int maxAnisotropy = 16;
|
||||
float displayAspect = 16.f / 9.f;
|
||||
qboolean haveClampToEdge = qtrue;
|
||||
|
||||
static void AssertCvarRange( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral )
|
||||
{
|
||||
if ( shouldBeIntegral )
|
||||
|
@ -1004,6 +1004,7 @@ void R_Register( void )
|
|||
#endif
|
||||
r_ext_texture_env_combine = ri.Cvar_Get("r_ext_texture_env_combine", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_ext_aniso_filter = ri.Cvar_Get("r_ext_aniso_filter", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_ext_max_anisotropy = ri.Cvar_Get("r_ext_max_anisotropy", "2", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_forceClampToEdge = ri.Cvar_Get("r_forceClampToEdge", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_geForce3WorkAround = ri.Cvar_Get("r_geForce3WorkAround", "1", CVAR_ARCHIVE);
|
||||
r_reset_tc_array = ri.Cvar_Get("r_reset_tc_array", "1", CVAR_ARCHIVE);
|
||||
|
|
|
@ -1378,6 +1378,16 @@ typedef struct {
|
|||
extern backEndState_t backEnd;
|
||||
extern trGlobals_t tr;
|
||||
extern glconfig_t glConfig; // outside of TR since it shouldn't be cleared during ref re-init
|
||||
|
||||
// These variables should live inside glConfig but can't because of
|
||||
// compatibility issues to the original ID vms. If you release a stand-alone
|
||||
// game and your mod uses tr_types.h from this build you can safely move them
|
||||
// to the glconfig_t struct.
|
||||
extern qboolean textureFilterAnisotropic;
|
||||
extern int maxAnisotropy;
|
||||
extern float displayAspect;
|
||||
extern qboolean haveClampToEdge;
|
||||
|
||||
extern glstate_t glState; // outside of TR since it shouldn't be cleared during ref re-init
|
||||
extern int r_sequencenumber;
|
||||
|
||||
|
@ -1456,6 +1466,7 @@ extern cvar_t *r_ext_compiled_vertex_array;
|
|||
extern cvar_t *r_ext_texture_env_add;
|
||||
extern cvar_t *r_ext_texture_env_combine;
|
||||
extern cvar_t *r_ext_aniso_filter;
|
||||
extern cvar_t *r_ext_max_anisotropy;
|
||||
extern cvar_t *r_forceClampToEdge;
|
||||
extern cvar_t *r_geForce3WorkAround;
|
||||
extern cvar_t *r_reset_tc_array;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue