r719 - in trunk: . code/renderer code/unix code/win32

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Apr 22 18:14:16 EDT 2006


Author: tma
Date: 2006-04-22 18:14:15 -0400 (Sat, 22 Apr 2006)
New Revision: 719

Modified:
   trunk/README
   trunk/code/renderer/tr_image.c
   trunk/code/renderer/tr_init.c
   trunk/code/renderer/tr_local.h
   trunk/code/renderer/tr_types.h
   trunk/code/unix/linux_glimp.c
   trunk/code/unix/sdl_glimp.c
   trunk/code/win32/win_glimp.c
Log:
* Anisotropic texture filtering (from Echon)


Modified: trunk/README
===================================================================
--- trunk/README	2006-04-22 18:24:50 UTC (rev 718)
+++ trunk/README	2006-04-22 22:14:15 UTC (rev 719)
@@ -92,34 +92,43 @@
 ------------------------------------------------------------------ Console -----
 
 New cvars
-  cl_autoRecordDemo       - record a new demo on each map change
-  cl_aviFrameRate         - the framerate to use when capturing video
-  cl_aviMotionJpeg        - use the mjpeg codec when capturing video
+  cl_autoRecordDemo                 - record a new demo on each map change
+  cl_aviFrameRate                   - the framerate to use when capturing video
+  cl_aviMotionJpeg                  - use the mjpeg codec when capturing video
 
-  s_useOpenAL             - use the OpenAL sound backend if available
-  s_alPrecache            - cache OpenAL sounds before use
-  s_alGain                - the value of AL_GAIN for each source
-  s_alSources             - the total number of sources (memory) to allocate
-  s_alDopplerFactor       - the value passed to alDopplerFactor
-  s_alDopplerSpeed        - the value passed to alDopplerVelocity
-  s_alMinDistance         - the value of AL_REFERENCE_DISTANCE for each source
-  s_alRolloff             - the value of AL_ROLLOFF_FACTOR for each source
-  s_alMaxSpeakerDistance  - ET_SPEAKERS beyond this distance are culled
-  s_alDriver              - which OpenAL library to use
+  s_useOpenAL                       - use the OpenAL sound backend if available
+  s_alPrecache                      - cache OpenAL sounds before use
+  s_alGain                          - the value of AL_GAIN for each source
+  s_alSources                       - the total number of sources (memory) to
+                                      allocate
+  s_alDopplerFactor                 - the value passed to alDopplerFactor
+  s_alDopplerSpeed                  - the value passed to alDopplerVelocity
+  s_alMinDistance                   - the value of AL_REFERENCE_DISTANCE for
+                                      each source
+  s_alRolloff                       - the value of AL_ROLLOFF_FACTOR for each
+                                      source
+  s_alMaxSpeakerDistance            - ET_SPEAKERS beyond this distance are
+                                      culled
+  s_alDriver                        - which OpenAL library to use
 
-  s_sdlBits               - SDL bit resolution
-  s_sdlSpeed              - SDL sample rate
-  s_sdlChannels           - SDL number of channels
-  s_sdlDevSamps           - SDL DMA buffer size override
-  s_sdlMixSamps           - SDL mix buffer size override
+  s_sdlBits                         - SDL bit resolution
+  s_sdlSpeed                        - SDL sample rate
+  s_sdlChannels                     - SDL number of channels
+  s_sdlDevSamps                     - SDL DMA buffer size override
+  s_sdlMixSamps                     - SDL mix buffer size override
 
-  ttycon_ansicolor        - enable use of ANSI escape codes in the tty
-  r_GLlibCoolDownMsec     - wait for some milliseconds to close GL library
-  com_altivec             - enable use of altivec on PowerPC systems
-  s_backend               - read only, indicates the current sound backend
-  in_shiftedKeys          - non-SDL Linux only. Enables binding to shifted keys
-  cl_consoleHistory       - read only, stores the console history
-  cl_platformSensitivity  - read only, indicates the mouse input scaling
+  ttycon_ansicolor                  - enable use of ANSI escape codes in the tty
+  r_GLlibCoolDownMsec               - wait for some milliseconds to close GL
+                                      library
+  com_altivec                       - enable use of altivec on PowerPC systems
+  s_backend                         - read only, indicates the current sound
+                                      backend
+  in_shiftedKeys                    - non-SDL Linux only. Enables binding to
+                                      shifted keys
+  cl_consoleHistory                 - read only, stores the console history
+  cl_platformSensitivity            - read only, indicates the mouse input
+                                      scaling
+  r_ext_texture_filter_anisotropic  - anisotropic texture filtering
 
 New commands
   video [filename]        - start video capture (use with demo command)

Modified: trunk/code/renderer/tr_image.c
===================================================================
--- trunk/code/renderer/tr_image.c	2006-04-22 18:24:50 UTC (rev 718)
+++ trunk/code/renderer/tr_image.c	2006-04-22 22:14:15 UTC (rev 719)
@@ -699,11 +699,18 @@
 
 	if (mipmap)
 	{
+		if ( glConfig.textureFilterAnisotropic )
+			qglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
+					(GLint)Com_Clamp( 1, glConfig.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 ( glConfig.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 );
 	}

Modified: trunk/code/renderer/tr_init.c
===================================================================
--- trunk/code/renderer/tr_init.c	2006-04-22 18:24:50 UTC (rev 718)
+++ trunk/code/renderer/tr_init.c	2006-04-22 22:14:15 UTC (rev 719)
@@ -81,6 +81,8 @@
 cvar_t	*r_ext_multitexture;
 cvar_t	*r_ext_compiled_vertex_array;
 cvar_t	*r_ext_texture_env_add;
+cvar_t	*r_ext_texture_filter_anisotropic;
+cvar_t	*r_ext_max_anisotropy;
 
 cvar_t	*r_ignoreGLErrors;
 cvar_t	*r_logFile;
@@ -910,6 +912,10 @@
 	r_ext_texture_env_add = ri.Cvar_Get( "r_ext_texture_env_add", "1", CVAR_ARCHIVE | CVAR_LATCH);
 #endif
 
+	r_ext_texture_filter_anisotropic = ri.Cvar_Get( "r_ext_texture_filter_anisotropic",
+			"0", CVAR_ARCHIVE | CVAR_LATCH );
+	r_ext_max_anisotropy = ri.Cvar_Get( "r_ext_max_anisotropy", "2", CVAR_ARCHIVE | CVAR_LATCH );
+
 	r_picmip = ri.Cvar_Get ("r_picmip", "1", CVAR_ARCHIVE | CVAR_LATCH );
 	r_roundImagesDown = ri.Cvar_Get ("r_roundImagesDown", "1", CVAR_ARCHIVE | CVAR_LATCH );
 	r_colorMipLevels = ri.Cvar_Get ("r_colorMipLevels", "0", CVAR_LATCH );

Modified: trunk/code/renderer/tr_local.h
===================================================================
--- trunk/code/renderer/tr_local.h	2006-04-22 18:24:50 UTC (rev 718)
+++ trunk/code/renderer/tr_local.h	2006-04-22 22:14:15 UTC (rev 719)
@@ -1041,6 +1041,9 @@
 extern cvar_t	*r_ext_compiled_vertex_array;
 extern cvar_t	*r_ext_texture_env_add;
 
+extern cvar_t	*r_ext_texture_filter_anisotropic;
+extern cvar_t	*r_ext_max_anisotropy;
+
 extern	cvar_t	*r_nobind;						// turns off binding to appropriate textures
 extern	cvar_t	*r_singleShader;				// make most world faces use default shader
 extern	cvar_t	*r_roundImagesDown;

Modified: trunk/code/renderer/tr_types.h
===================================================================
--- trunk/code/renderer/tr_types.h	2006-04-22 18:24:50 UTC (rev 718)
+++ trunk/code/renderer/tr_types.h	2006-04-22 22:14:15 UTC (rev 719)
@@ -200,6 +200,9 @@
 	qboolean				isFullscreen;
 	qboolean				stereoEnabled;
 	qboolean				smpActive;		// dual processor
+
+	qboolean				textureFilterAnisotropic;
+	int						maxAnisotropy;
 } glconfig_t;
 
 // FIXME: VM should be OS agnostic .. in theory

Modified: trunk/code/unix/linux_glimp.c
===================================================================
--- trunk/code/unix/linux_glimp.c	2006-04-22 18:24:50 UTC (rev 718)
+++ trunk/code/unix/linux_glimp.c	2006-04-22 22:14:15 UTC (rev 719)
@@ -1323,6 +1323,30 @@
     ri.Printf( PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n" );
   }
 
+  glConfig.textureFilterAnisotropic = qfalse;
+  if ( strstr( glConfig.extensions_string, "GL_EXT_texture_filter_anisotropic" ) )
+  {
+    if ( r_ext_texture_filter_anisotropic->integer ) {
+      qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.maxAnisotropy );
+      if ( glConfig.maxAnisotropy <= 0 ) {
+        ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not properly supported!\n" );
+        glConfig.maxAnisotropy = 0;
+      }
+      else
+      {
+        ri.Printf( PRINT_ALL, "...using GL_EXT_texture_filter_anisotropic (max: %i)\n", glConfig.maxAnisotropy );
+        glConfig.textureFilterAnisotropic = qtrue;
+      }
+    }
+    else
+    {
+      ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_filter_anisotropic\n" );
+    }
+  }
+  else
+  {
+    ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not found\n" );
+  }
 }
 
 static void GLW_InitGamma(void)

Modified: trunk/code/unix/sdl_glimp.c
===================================================================
--- trunk/code/unix/sdl_glimp.c	2006-04-22 18:24:50 UTC (rev 718)
+++ trunk/code/unix/sdl_glimp.c	2006-04-22 22:14:15 UTC (rev 719)
@@ -802,6 +802,30 @@
     ri.Printf( PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n" );
   }
 
+  glConfig.textureFilterAnisotropic = qfalse;
+  if ( strstr( glConfig.extensions_string, "GL_EXT_texture_filter_anisotropic" ) )
+  {
+    if ( r_ext_texture_filter_anisotropic->integer ) {
+      qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.maxAnisotropy );
+      if ( glConfig.maxAnisotropy <= 0 ) {
+        ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not properly supported!\n" );
+        glConfig.maxAnisotropy = 0;
+      }
+      else
+      {
+        ri.Printf( PRINT_ALL, "...using GL_EXT_texture_filter_anisotropic (max: %i)\n", glConfig.maxAnisotropy );
+        glConfig.textureFilterAnisotropic = qtrue;
+      }
+    }
+    else
+    {
+      ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_filter_anisotropic\n" );
+    }
+  }
+  else
+  {
+    ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not found\n" );
+  }
 }
 
 static void GLW_InitGamma( void )

Modified: trunk/code/win32/win_glimp.c
===================================================================
--- trunk/code/win32/win_glimp.c	2006-04-22 18:24:50 UTC (rev 718)
+++ trunk/code/win32/win_glimp.c	2006-04-22 22:14:15 UTC (rev 719)
@@ -1111,6 +1111,31 @@
 	{
 		ri.Printf( PRINT_ALL, "...WGL_3DFX_gamma_control not found\n" );
 	}
+
+	glConfig.textureFilterAnisotropic = qfalse;
+	if ( strstr( glConfig.extensions_string, "GL_EXT_texture_filter_anisotropic" ) )
+	{
+		if ( r_ext_texture_filter_anisotropic->integer ) {
+			qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.maxAnisotropy );
+			if ( glConfig.maxAnisotropy <= 0 ) {
+				ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not properly supported!\n" );
+				glConfig.maxAnisotropy = 0;
+			}
+			else
+			{
+				ri.Printf( PRINT_ALL, "...using GL_EXT_texture_filter_anisotropic (max: %i)\n", glConfig.maxAnisotropy );
+				glConfig.textureFilterAnisotropic = qtrue;
+			}
+		}
+		else
+		{
+			ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_filter_anisotropic\n" );
+		}
+	}
+	else
+	{
+		ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not found\n" );
+	}
 }
 
 /*




More information about the quake3-commits mailing list