more tree recovering. This includes Despair's anisotropy support work.

This commit is contained in:
Bill Currie 2005-01-02 14:23:20 +00:00
parent 0029a26f40
commit 23f71485d1
18 changed files with 128 additions and 48 deletions

7
NEWS
View file

@ -51,7 +51,7 @@ Changes from 0.5.4
* treat server clients like non-client entities for GIB "frag" event * treat server clients like non-client entities for GIB "frag" event
* expand ~ for fs_dirconf * expand ~ for fs_dirconf
* don't write config.cfg until /after/ it's been read :) * don't write config.cfg until /after/ it's been read :)
* ATI's libGL needs to be loaded with global symbols in order to work * ATI's libGL needed to be loaded with global symbols in order to work
properly properly
* oss sound doesn't block if the sound device is busy (from Grievre) * oss sound doesn't block if the sound device is busy (from Grievre)
* add snd_bits/rate/stereo cvars to win and dx sound targets * add snd_bits/rate/stereo cvars to win and dx sound targets
@ -62,12 +62,13 @@ Changes from 0.5.4
* curses server console scrollback works * curses server console scrollback works
* qfdefs nuked. no longer needed as "standard" progs get resolved * qfdefs nuked. no longer needed as "standard" progs get resolved
staticly staticly
* TruForm support. Controlled by gl_tessellate * Anisotropy support, controlled by gl_anisotropy
* TruForm support, controlled by gl_tessellate
* Improvements in time accounting. Accurate to +-0.5ms, instead of -1,0 * Improvements in time accounting. Accurate to +-0.5ms, instead of -1,0
like others. Based on Grievre's and zquake's code like others. Based on Grievre's and zquake's code
* mangled sounds on gamedir change fixed thanks to Grievre * mangled sounds on gamedir change fixed thanks to Grievre
* mtex support for world rendering. * mtex support for world rendering.
* alias models us GL lighting * alias models use GL lighting
* support for 7 mouse buttons * support for 7 mouse buttons
* all archived cvars get written to config.cfg prefixed with "seta" * all archived cvars get written to config.cfg prefixed with "seta"
(new command that sets the archive bit) (new command that sets the archive bit)

View file

@ -73,6 +73,12 @@
# define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED # define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED
#endif #endif
#ifndef GL_EXT_texture_filter_anisotropic
# define GL_EXT_texture_filter_anisotropic
# define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84fe
# define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84ff
#endif
#ifndef GL_EXT_texture_object #ifndef GL_EXT_texture_object
# define GL_EXT_texture_object # define GL_EXT_texture_object
# define GL_TEXTURE_PRIORITY_EXT 0x8066 # define GL_TEXTURE_PRIORITY_EXT 0x8066
@ -82,12 +88,12 @@
# define GL_TEXTURE_3D_BINDING_EXT 0x806A # define GL_TEXTURE_3D_BINDING_EXT 0x806A
#endif #endif
#ifndef GL_EXT_point_parameters #ifndef GL_ARB_point_parameters
# define GL_EXT_point_parameters # define GL_ARB_point_parameters
# define GL_POINT_SIZE_MIN_EXT 0x8126 # define GL_POINT_SIZE_MIN_ARB 0x8126
# define GL_POINT_SIZE_MAX_EXT 0x8127 # define GL_POINT_SIZE_MAX_ARB 0x8127
# define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 # define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128
# define GL_DISTANCE_ATTENUATION_EXT 0x8129 # define GL_DISTANCE_ATTENUATION_ARB 0x8129
#endif #endif
#ifndef GL_EXT_shared_texture_palette #ifndef GL_EXT_shared_texture_palette
@ -134,6 +140,12 @@
# define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 # define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
#endif #endif
#ifndef GL_ARB_point_sprite
# define GL_ARB_point_sprite
# define GL_POINT_SPRITE_ARB 0x8861
# define GL_COORD_REPLACE_ARB 0x8862
#endif
#ifndef GL_ARB_texture_cube_map #ifndef GL_ARB_texture_cube_map
# define GL_ARB_texture_cube_map # define GL_ARB_texture_cube_map
# define GL_NORMAL_MAP_ARB 0x8511 # define GL_NORMAL_MAP_ARB 0x8511
@ -265,16 +277,16 @@ typedef void (GLAPIENTRY *QF_glMultiTexCoord2sv) (GLenum target, const GLshort *
typedef void (GLAPIENTRY *QF_glMultiTexCoord3sv) (GLenum target, const GLshort *v); typedef void (GLAPIENTRY *QF_glMultiTexCoord3sv) (GLenum target, const GLshort *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord4sv) (GLenum target, const GLshort *v); typedef void (GLAPIENTRY *QF_glMultiTexCoord4sv) (GLenum target, const GLshort *v);
// GL_ARB_point_parameters
typedef void (GLAPIENTRY *QF_glPointParameterfARB) (GLenum pname, GLfloat param);
typedef void (GLAPIENTRY *QF_glPointParameterfvARB) (GLenum pname, const GLfloat *params);
// GL_EXT_paletted_texture // GL_EXT_paletted_texture
typedef void (GLAPIENTRY *QF_glColorTableEXT) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); typedef void (GLAPIENTRY *QF_glColorTableEXT) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
typedef void (GLAPIENTRY *QF_glGetColorTableEXT) (GLenum target, GLenum format, GLenum type, GLvoid *data); typedef void (GLAPIENTRY *QF_glGetColorTableEXT) (GLenum target, GLenum format, GLenum type, GLvoid *data);
typedef void (GLAPIENTRY *QF_glGetColorTableParameterivEXT) (GLenum target, GLenum pname, GLint *params); typedef void (GLAPIENTRY *QF_glGetColorTableParameterivEXT) (GLenum target, GLenum pname, GLint *params);
typedef void (GLAPIENTRY *QF_glGetColorTableParameterfvEXT) (GLenum target, GLenum pname, GLfloat *params); typedef void (GLAPIENTRY *QF_glGetColorTableParameterfvEXT) (GLenum target, GLenum pname, GLfloat *params);
// GL_EXT_point_parameters
typedef void (GLAPIENTRY *QF_glPointParameterfEXT) (GLenum pname, GLfloat param);
typedef void (GLAPIENTRY *QF_glPointParameterfvEXT) (GLenum pname, const GLfloat *params);
// GL_EXT_subtexture // GL_EXT_subtexture
typedef void (GLAPIENTRY *QF_glTexSubImage1DEXT) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); typedef void (GLAPIENTRY *QF_glTexSubImage1DEXT) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (GLAPIENTRY *QF_glTexSubImage2DEXT) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); typedef void (GLAPIENTRY *QF_glTexSubImage2DEXT) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);

View file

@ -38,7 +38,8 @@ extern int gl_solid_format;
extern int gl_lightmap_format; extern int gl_lightmap_format;
extern int gl_filter_min; extern int gl_filter_min;
extern int gl_filter_max; extern int gl_filter_max;
extern qboolean Anisotropy;
extern float aniso;
extern int part_tex; extern int part_tex;
/* /*
extern int part_tex_dot; extern int part_tex_dot;

View file

@ -218,7 +218,7 @@ void ED_EntityParseFunction (progs_t *pr);
#define PR_edicts(p) ((byte *) *(p)->edicts) #define PR_edicts(p) ((byte *) *(p)->edicts)
#define NEXT_EDICT(p,e) ((edict_t *) ((byte *) e + (p)->pr_edict_size)) #define NEXT_EDICT(p,e) ((edict_t *) ((byte *) e + (p)->pr_edict_size))
#define EDICT_TO_PROG(p,e) ((byte *) (e) - PR_edicts (p)) #define EDICT_TO_PROG(p,e) ((long) ((byte *) (e) - PR_edicts (p)))
#define PROG_TO_EDICT(p,e) ((edict_t *) (PR_edicts (p) + (e))) #define PROG_TO_EDICT(p,e) ((edict_t *) (PR_edicts (p) + (e)))
#define NUM_FOR_BAD_EDICT(p,e) (EDICT_TO_PROG (p, e) / (p)->pr_edict_size) #define NUM_FOR_BAD_EDICT(p,e) (EDICT_TO_PROG (p, e) / (p)->pr_edict_size)
#ifndef PR_PARANOID_PROGS #ifndef PR_PARANOID_PROGS

View file

@ -14,6 +14,7 @@ extern struct cvar_s *d_mipcap;
extern struct cvar_s *d_mipscale; extern struct cvar_s *d_mipscale;
extern struct cvar_s *gl_affinemodels; extern struct cvar_s *gl_affinemodels;
extern struct cvar_s *gl_anisotropy;
extern struct cvar_s *gl_clear; extern struct cvar_s *gl_clear;
extern struct cvar_s *gl_conspin; extern struct cvar_s *gl_conspin;
extern struct cvar_s *gl_constretch; extern struct cvar_s *gl_constretch;

View file

@ -79,7 +79,7 @@ void R_Particles_Init_Cvars (void);
void R_InitBubble (void); void R_InitBubble (void);
void R_InitParticles (void); void R_InitParticles (void);
inline void R_ClearParticles (void); void R_ClearParticles (void);
void R_DrawParticles (void); void R_DrawParticles (void);
struct cvar_s; struct cvar_s;
void R_MaxParticlesCheck (struct cvar_s *r_particles, void R_MaxParticlesCheck (struct cvar_s *r_particles,

View file

@ -255,7 +255,7 @@ qboolean R_AliasCheckBBox (void);
void R_DrawParticles (void); void R_DrawParticles (void);
void R_InitParticles (void); void R_InitParticles (void);
inline void R_ClearParticles (void); void R_ClearParticles (void);
void R_ReadPointFile_f (void); void R_ReadPointFile_f (void);
void R_InitSprites (void); void R_InitSprites (void);
void R_SurfacePatch (void); void R_SurfacePatch (void);

View file

@ -473,7 +473,7 @@ value_string (progs_t *pr, etype_t type, pr_type_t *val)
break; break;
case ev_entity: case ev_entity:
edict = PROG_TO_EDICT (pr, val->entity_var); edict = PROG_TO_EDICT (pr, val->entity_var);
dsprintf (line, "entity %i", NUM_FOR_BAD_EDICT (pr, edict)); dsprintf (line, "entity %ld", NUM_FOR_BAD_EDICT (pr, edict));
break; break;
case ev_func: case ev_func:
if (val->func_var < 0 || val->func_var >= pr->progs->numfunctions) if (val->func_var < 0 || val->func_var >= pr->progs->numfunctions)
@ -640,8 +640,7 @@ PR_PrintStatement (progs_t * pr, dstatement_t *s, int contents)
fmt += 2; fmt += 2;
} else { } else {
const char *str; const char *str;
char mode = fmt[1]; char mode = fmt[1], opchar = fmt[2];
char opchar = fmt[2];
long opval; long opval;
etype_t optype; etype_t optype;
@ -782,10 +781,9 @@ PR_Profile (progs_t * pr)
void void
ED_Print (progs_t *pr, edict_t *ed) ED_Print (progs_t *pr, edict_t *ed)
{ {
int l; int type, l;
unsigned int i; unsigned int i;
const char *name; const char *name;
int type;
ddef_t *d; ddef_t *d;
pr_type_t *v; pr_type_t *v;
@ -794,7 +792,7 @@ ED_Print (progs_t *pr, edict_t *ed)
return; return;
} }
Sys_Printf ("\nEDICT %i:\n", NUM_FOR_BAD_EDICT (pr, ed)); Sys_Printf ("\nEDICT %ld:\n", NUM_FOR_BAD_EDICT (pr, ed));
for (i = 0; i < pr->progs->numfielddefs; i++) { for (i = 0; i < pr->progs->numfielddefs; i++) {
d = &pr->pr_fielddefs[i]; d = &pr->pr_fielddefs[i];
if (!d->s_name) // null field def (probably 1st) if (!d->s_name) // null field def (probably 1st)

View file

@ -67,7 +67,8 @@ ED_ClearEdict (progs_t *pr, edict_t *e, int val)
unsigned int i; unsigned int i;
if (NUM_FOR_EDICT (pr, e) < *pr->reserved_edicts) if (NUM_FOR_EDICT (pr, e) < *pr->reserved_edicts)
Sys_Printf("clearing reserved edict %d\n", NUM_FOR_EDICT(pr,e)); Sys_Printf ("clearing reserved edict %ld\n",
NUM_FOR_EDICT (pr, e));
for (i=0; i < pr->progs->entityfields; i++) for (i=0; i < pr->progs->entityfields; i++)
e->v[i].integer_var = val; e->v[i].integer_var = val;
e->free = false; e->free = false;

View file

@ -78,7 +78,7 @@ PR_UglyValueString (progs_t *pr, etype_t type, pr_type_t *val)
PR_GetString (pr, val->string_var)); PR_GetString (pr, val->string_var));
break; break;
case ev_entity: case ev_entity:
snprintf (line, sizeof (line), "%i", snprintf (line, sizeof (line), "%ld",
NUM_FOR_BAD_EDICT (pr, PROG_TO_EDICT (pr, val->entity_var))); NUM_FOR_BAD_EDICT (pr, PROG_TO_EDICT (pr, val->entity_var)));
break; break;
case ev_func: case ev_func:

View file

@ -288,7 +288,7 @@ static const char *
selector_get_key (void *s, void *_pr) selector_get_key (void *s, void *_pr)
{ {
progs_t *pr = (progs_t *) _pr; progs_t *pr = (progs_t *) _pr;
return PR_GetString (pr, pr->selector_names[(int) s]); return PR_GetString (pr, pr->selector_names[(long) s]);
} }
static const char * static const char *
@ -404,11 +404,11 @@ static pr_sel_t *
sel_register_typed_name (progs_t *pr, const char *name, const char *types, sel_register_typed_name (progs_t *pr, const char *name, const char *types,
pr_sel_t *sel) pr_sel_t *sel)
{ {
int index; long index;
int is_new = 0; int is_new = 0;
obj_list *l; obj_list *l;
index = (int) Hash_Find (pr->selector_hash, name); index = (long) Hash_Find (pr->selector_hash, name);
if (index) { if (index) {
for (l = ((obj_list **) pr->selector_sels)[index]; l; l = l->next) { for (l = ((obj_list **) pr->selector_sels)[index]; l; l = l->next) {
pr_sel_t *s = l->data; pr_sel_t *s = l->data;
@ -581,8 +581,8 @@ obj_send_message_in_list (progs_t *pr, pr_method_list_t *method_list,
pr_method_t *mth = &method_list->method_list[i]; pr_method_t *mth = &method_list->method_list[i];
if (mth->method_name && sel_eq (&G_STRUCT (pr, pr_sel_t, if (mth->method_name && sel_eq (&G_STRUCT (pr, pr_sel_t,
mth->method_name), op) mth->method_name), op)
&& !Hash_FindElement (pr->load_methods, (void *)mth->method_imp)) { && !Hash_FindElement (pr->load_methods, (void *) (long) mth->method_imp)) {
Hash_AddElement (pr->load_methods, (void *)mth->method_imp); Hash_AddElement (pr->load_methods, (void *) (long) mth->method_imp);
PR_ExecuteProgram (pr, mth->method_imp); PR_ExecuteProgram (pr, mth->method_imp);
break; break;

View file

@ -269,10 +269,10 @@ Z_Print (memzone_t *zone)
Sys_Printf ("zone size: %i location: %p used: %i\n", Sys_Printf ("zone size: %i location: %p used: %i\n",
zone->size, zone, zone->used); zone->size, zone, zone->used);
for (block = zone->blocklist.next ; ; block = block->next) for (block = zone->blocklist.next ; ; block = block->next) {
{
Sys_Printf ("block:%p size:%7i tag:%3i ofs:%d\n", Sys_Printf ("block:%p size:%7i tag:%3i ofs:%d\n",
block, block->size, block->tag, (byte *) block - (byte *) zone); block, block->size, block->tag,
(int) ((byte *) block - (byte *) zone));
if (block->next == &zone->blocklist) if (block->next == &zone->blocklist)
break; // all blocks have been hit break; // all blocks have been hit
@ -294,8 +294,7 @@ Z_CheckHeap (memzone_t *zone)
{ {
memblock_t *block; memblock_t *block;
for (block = zone->blocklist.next ; ; block = block->next) for (block = zone->blocklist.next ; ; block = block->next) {
{
if (block->next == &zone->blocklist) if (block->next == &zone->blocklist)
break; // all blocks have been hit break; // all blocks have been hit
if ( (byte *)block + block->size != (byte *)block->next) if ( (byte *)block + block->size != (byte *)block->next)

View file

@ -145,7 +145,7 @@ particle_new_veryrandom (ptype_t type, int texnum, const vec3_t org,
} }
*/ */
inline void void
R_ClearParticles (void) R_ClearParticles (void)
{ {
numparticles = 0; numparticles = 0;

View file

@ -793,6 +793,9 @@ GL_BuildLightmaps (model_t **models, int num_models)
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures + i); qfglBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
qfglTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, BLOCK_WIDTH, qfglTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, BLOCK_WIDTH,
BLOCK_HEIGHT, 0, gl_lightmap_format, BLOCK_HEIGHT, 0, gl_lightmap_format,
GL_UNSIGNED_BYTE, lightmaps[i]); GL_UNSIGNED_BYTE, lightmaps[i]);

View file

@ -150,6 +150,9 @@ build_skin_32 (byte * original, int tinwidth, int tinheight,
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
} }
static void static void

View file

@ -147,6 +147,9 @@ R_LoadSkys (const char *skyname)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
@ -430,6 +433,9 @@ R_InitSky (texture_t *mt)
GL_UNSIGNED_BYTE, trans); GL_UNSIGNED_BYTE, trans);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
for (j = 0; j < 128; j++) { for (j = 0; j < 128; j++) {
@ -447,4 +453,7 @@ R_InitSky (texture_t *mt)
GL_UNSIGNED_BYTE, trans); GL_UNSIGNED_BYTE, trans);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
} }

View file

@ -225,6 +225,9 @@ GL_TextureMode_f (void)
gl_filter_min); gl_filter_min);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max); gl_filter_max);
if (Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D,
GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso);
} }
} }
} }
@ -428,6 +431,9 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap,
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max); gl_filter_max);
} }
if (Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
free (scaled); free (scaled);
} }
@ -502,6 +508,9 @@ GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap,
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max); gl_filter_max);
} }
if (Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
free (scaled); free (scaled);
} }

View file

@ -83,7 +83,7 @@ int use_bgra;
int gl_va_capable; int gl_va_capable;
int vaelements; int vaelements;
int texture_extension_number = 1; int texture_extension_number = 1;
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST; int gl_filter_min = GL_LINEAR_MIPMAP_LINEAR;
int gl_filter_max = GL_LINEAR; int gl_filter_max = GL_LINEAR;
float gldepthmin, gldepthmax; float gldepthmin, gldepthmax;
@ -104,7 +104,12 @@ qboolean is8bit = false;
qboolean gl_feature_mach64 = false; qboolean gl_feature_mach64 = false;
// ATI PN_triangles // GL_EXT_texture_filter_anisotropic
qboolean Anisotropy;
static float aniso_max;
float aniso;
// GL_ATI_pn_triangles
static qboolean TruForm; static qboolean TruForm;
static int tess_max; static int tess_max;
int tess; int tess;
@ -112,6 +117,7 @@ int tess;
// GL_LIGHT // GL_LIGHT
int gl_max_lights; int gl_max_lights;
cvar_t *gl_anisotropy;
cvar_t *gl_doublebright; cvar_t *gl_doublebright;
cvar_t *gl_fb_bmodels; cvar_t *gl_fb_bmodels;
cvar_t *gl_finish; cvar_t *gl_finish;
@ -231,6 +237,22 @@ gl_screenshot_byte_swap_f (cvar_t *var)
var->int_val ? GL_TRUE : GL_FALSE); var->int_val ? GL_TRUE : GL_FALSE);
} }
static void
gl_anisotropy_f (cvar_t * var)
{
if (Anisotropy) {
if (var)
aniso = (bound (1.0, var->value, aniso_max));
else
aniso = 1.0;
} else {
aniso = 1.0;
if (var)
Con_Printf ("Anisotropy (GL_EXT_texture_filter_anisotropic) is "
"not supported by your hardware and/or drivers.\n");
}
}
static void static void
gl_tessellate_f (cvar_t * var) gl_tessellate_f (cvar_t * var)
{ {
@ -271,6 +293,11 @@ GL_Common_Init_Cvars (void)
gl_screenshot_byte_swap_f, "Swap the bytes for gl " gl_screenshot_byte_swap_f, "Swap the bytes for gl "
"screenshots. Needed if you get screenshots with red and " "screenshots. Needed if you get screenshots with red and "
"blue swapped."); "blue swapped.");
gl_anisotropy =
Cvar_Get ("gl_anisotropy", "1.0", CVAR_NONE, gl_anisotropy_f,
nva ("Specifies degree of anisotropy, from 1.0 to %f. "
"Higher anisotropy means less distortion of textures "
"at shallow angles to the viewer.", aniso_max));
gl_tessellate = gl_tessellate =
Cvar_Get ("gl_tessellate", "0", CVAR_NONE, gl_tessellate_f, Cvar_Get ("gl_tessellate", "0", CVAR_NONE, gl_tessellate_f,
nva ("Specifies tessellation level from 0 to %i. Higher " nva ("Specifies tessellation level from 0 to %i. Higher "
@ -321,6 +348,18 @@ CheckGLVersionString (void)
gl_feature_mach64 = true; gl_feature_mach64 = true;
} }
static void
CheckAnisotropyExtensions (void)
{
if (QFGL_ExtensionPresent ("GL_EXT_texture_filter_anisotropic")) {
Anisotropy = true;
qfglGetFloatv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &aniso_max);
} else {
Anisotropy = false;
aniso_max = 1.0;
}
}
static void static void
CheckBGRAExtensions (void) CheckBGRAExtensions (void)
{ {
@ -556,9 +595,13 @@ GL_Init_Common (void)
qfglEnable (GL_BLEND); qfglEnable (GL_BLEND);
qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
CheckAnisotropyExtensions ();
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
if (Anisotropy)
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
aniso);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);